MMCT BYPASS SHELL
:
216.73.216.98
:
91.213.11.35 / forkliftsafetysystems.com
:
Linux mgh-web6.maghost.ro 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
:
/
proc
/
self
/
cwd
/
UPLOAD FILE:
files >> //proc/self/cwd/include.tar
python3.6m/pyconfig-64.h 0000644 00000127116 15063602042 0010715 0 ustar 00 /* pyconfig.h. Generated from pyconfig.h.in by configure. */ /* pyconfig.h.in. Generated from configure.ac by autoheader. */ #ifndef Py_PYCONFIG_H #define Py_PYCONFIG_H /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want support for AIX C++ shared extension modules. */ /* #undef AIX_GENUINE_CPLUSPLUS */ /* The Android API level. */ /* #undef ANDROID_API_LEVEL */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM mixed-endian order (byte order 45670123) */ /* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most significant byte first */ /* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */ /* Define if C doubles are 64-bit IEEE 754 binary format, stored with the least significant byte first */ #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1 /* Define if --enable-ipv6 is specified */ #define ENABLE_IPV6 1 /* Define if flock needs to be linked with bsd library. */ /* #undef FLOCK_NEEDS_LIBBSD */ /* Define if getpgrp() must be called as getpgrp(0). */ /* #undef GETPGRP_HAVE_ARG */ /* Define if gettimeofday() does not have second (timezone) argument This is the case on Motorola V4 (R40V4.2) */ /* #undef GETTIMEOFDAY_NO_TZ */ /* Define to 1 if you have the `accept4' function. */ #define HAVE_ACCEPT4 1 /* Define to 1 if you have the `acosh' function. */ #define HAVE_ACOSH 1 /* struct addrinfo (netdb.h) */ #define HAVE_ADDRINFO 1 /* Define to 1 if you have the `alarm' function. */ #define HAVE_ALARM 1 /* Define if aligned memory access is required */ /* #undef HAVE_ALIGNED_REQUIRED */ /* Define to 1 if you have the <alloca.h> header file. */ #define HAVE_ALLOCA_H 1 /* Define this if your time.h defines altzone. */ /* #undef HAVE_ALTZONE */ /* Define to 1 if you have the `asinh' function. */ #define HAVE_ASINH 1 /* Define to 1 if you have the <asm/types.h> header file. */ #define HAVE_ASM_TYPES_H 1 /* Define to 1 if you have the `atanh' function. */ #define HAVE_ATANH 1 /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #define HAVE_BIND_TEXTDOMAIN_CODESET 1 /* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */ #define HAVE_BLUETOOTH_BLUETOOTH_H 1 /* Define to 1 if you have the <bluetooth.h> header file. */ /* #undef HAVE_BLUETOOTH_H */ /* Define if mbstowcs(NULL, "text", 0) does not return the number of wide chars that would be converted. */ /* #undef HAVE_BROKEN_MBSTOWCS */ /* Define if nice() returns success/failure instead of the new priority. */ /* #undef HAVE_BROKEN_NICE */ /* Define if the system reports an invalid PIPE_BUF value. */ /* #undef HAVE_BROKEN_PIPE_BUF */ /* Define if poll() sets errno on invalid file descriptors. */ /* #undef HAVE_BROKEN_POLL */ /* Define if the Posix semaphores do not work on your system */ /* #undef HAVE_BROKEN_POSIX_SEMAPHORES */ /* Define if pthread_sigmask() does not work on your system. */ /* #undef HAVE_BROKEN_PTHREAD_SIGMASK */ /* define to 1 if your sem_getvalue is broken. */ /* #undef HAVE_BROKEN_SEM_GETVALUE */ /* Define if `unsetenv` does not return an int. */ /* #undef HAVE_BROKEN_UNSETENV */ /* Has builtin atomics */ #define HAVE_BUILTIN_ATOMIC 1 /* Define to 1 if you have the 'chflags' function. */ /* #undef HAVE_CHFLAGS */ /* Define to 1 if you have the `chown' function. */ #define HAVE_CHOWN 1 /* Define if you have the 'chroot' function. */ #define HAVE_CHROOT 1 /* Define to 1 if you have the `clock' function. */ #define HAVE_CLOCK 1 /* Define to 1 if you have the `clock_getres' function. */ #define HAVE_CLOCK_GETRES 1 /* Define to 1 if you have the `clock_gettime' function. */ #define HAVE_CLOCK_GETTIME 1 /* Define to 1 if you have the `clock_settime' function. */ #define HAVE_CLOCK_SETTIME 1 /* Define if the C compiler supports computed gotos. */ #define HAVE_COMPUTED_GOTOS 1 /* Define to 1 if you have the `confstr' function. */ #define HAVE_CONFSTR 1 /* Define to 1 if you have the <conio.h> header file. */ /* #undef HAVE_CONIO_H */ /* Define to 1 if you have the `copysign' function. */ #define HAVE_COPYSIGN 1 /* Define to 1 if you have the <crypt.h> header file. */ #define HAVE_CRYPT_H 1 /* Define to 1 if you have the `ctermid' function. */ #define HAVE_CTERMID 1 /* Define if you have the 'ctermid_r' function. */ /* #undef HAVE_CTERMID_R */ /* Define if you have the 'filter' function. */ #define HAVE_CURSES_FILTER 1 /* Define to 1 if you have the <curses.h> header file. */ #define HAVE_CURSES_H 1 /* Define if you have the 'has_key' function. */ #define HAVE_CURSES_HAS_KEY 1 /* Define if you have the 'immedok' function. */ #define HAVE_CURSES_IMMEDOK 1 /* Define if you have the 'is_pad' function or macro. */ #define HAVE_CURSES_IS_PAD 1 /* Define if you have the 'is_term_resized' function. */ #define HAVE_CURSES_IS_TERM_RESIZED 1 /* Define if you have the 'resizeterm' function. */ #define HAVE_CURSES_RESIZETERM 1 /* Define if you have the 'resize_term' function. */ #define HAVE_CURSES_RESIZE_TERM 1 /* Define if you have the 'syncok' function. */ #define HAVE_CURSES_SYNCOK 1 /* Define if you have the 'typeahead' function. */ #define HAVE_CURSES_TYPEAHEAD 1 /* Define if you have the 'use_env' function. */ #define HAVE_CURSES_USE_ENV 1 /* Define if you have the 'wchgat' function. */ #define HAVE_CURSES_WCHGAT 1 /* Define to 1 if you have the declaration of `isfinite', and to 0 if you don't. */ #define HAVE_DECL_ISFINITE 1 /* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. */ #define HAVE_DECL_ISINF 1 /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. */ #define HAVE_DECL_ISNAN 1 /* Define to 1 if you have the declaration of `RTLD_DEEPBIND', and to 0 if you don't. */ #define HAVE_DECL_RTLD_DEEPBIND 1 /* Define to 1 if you have the declaration of `RTLD_GLOBAL', and to 0 if you don't. */ #define HAVE_DECL_RTLD_GLOBAL 1 /* Define to 1 if you have the declaration of `RTLD_LAZY', and to 0 if you don't. */ #define HAVE_DECL_RTLD_LAZY 1 /* Define to 1 if you have the declaration of `RTLD_LOCAL', and to 0 if you don't. */ #define HAVE_DECL_RTLD_LOCAL 1 /* Define to 1 if you have the declaration of `RTLD_NODELETE', and to 0 if you don't. */ #define HAVE_DECL_RTLD_NODELETE 1 /* Define to 1 if you have the declaration of `RTLD_NOLOAD', and to 0 if you don't. */ #define HAVE_DECL_RTLD_NOLOAD 1 /* Define to 1 if you have the declaration of `RTLD_NOW', and to 0 if you don't. */ #define HAVE_DECL_RTLD_NOW 1 /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ /* #undef HAVE_DECL_TZNAME */ /* Define to 1 if you have the device macros. */ #define HAVE_DEVICE_MACROS 1 /* Define to 1 if you have the /dev/ptc device file. */ /* #undef HAVE_DEV_PTC */ /* Define to 1 if you have the /dev/ptmx device file. */ #define HAVE_DEV_PTMX 1 /* Define to 1 if you have the <direct.h> header file. */ /* #undef HAVE_DIRECT_H */ /* Define to 1 if the dirent structure has a d_type field */ #define HAVE_DIRENT_D_TYPE 1 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define if you have the 'dirfd' function or macro. */ #define HAVE_DIRFD 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the `dlopen' function. */ #define HAVE_DLOPEN 1 /* Define to 1 if you have the `dup2' function. */ #define HAVE_DUP2 1 /* Define to 1 if you have the `dup3' function. */ #define HAVE_DUP3 1 /* Defined when any dynamic module loading is enabled. */ #define HAVE_DYNAMIC_LOADING 1 /* Define to 1 if you have the <endian.h> header file. */ #define HAVE_ENDIAN_H 1 /* Define if you have the 'epoll' functions. */ #define HAVE_EPOLL 1 /* Define if you have the 'epoll_create1' function. */ #define HAVE_EPOLL_CREATE1 1 /* Define to 1 if you have the `erf' function. */ #define HAVE_ERF 1 /* Define to 1 if you have the `erfc' function. */ #define HAVE_ERFC 1 /* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the `execv' function. */ #define HAVE_EXECV 1 /* Define to 1 if you have the `expm1' function. */ #define HAVE_EXPM1 1 /* Define to 1 if you have the `faccessat' function. */ #define HAVE_FACCESSAT 1 /* Define if you have the 'fchdir' function. */ #define HAVE_FCHDIR 1 /* Define to 1 if you have the `fchmod' function. */ #define HAVE_FCHMOD 1 /* Define to 1 if you have the `fchmodat' function. */ #define HAVE_FCHMODAT 1 /* Define to 1 if you have the `fchown' function. */ #define HAVE_FCHOWN 1 /* Define to 1 if you have the `fchownat' function. */ #define HAVE_FCHOWNAT 1 /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the 'fdatasync' function. */ #define HAVE_FDATASYNC 1 /* Define to 1 if you have the `fdopendir' function. */ #define HAVE_FDOPENDIR 1 /* Define to 1 if you have the `fexecve' function. */ #define HAVE_FEXECVE 1 /* Define to 1 if you have the `finite' function. */ #define HAVE_FINITE 1 /* Define to 1 if you have the `flock' function. */ #define HAVE_FLOCK 1 /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 /* Define to 1 if you have the `forkpty' function. */ #define HAVE_FORKPTY 1 /* Define to 1 if you have the `fpathconf' function. */ #define HAVE_FPATHCONF 1 /* Define to 1 if you have the `fseek64' function. */ /* #undef HAVE_FSEEK64 */ /* Define to 1 if you have the `fseeko' function. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `fstatat' function. */ #define HAVE_FSTATAT 1 /* Define to 1 if you have the `fstatvfs' function. */ #define HAVE_FSTATVFS 1 /* Define if you have the 'fsync' function. */ #define HAVE_FSYNC 1 /* Define to 1 if you have the `ftell64' function. */ /* #undef HAVE_FTELL64 */ /* Define to 1 if you have the `ftello' function. */ #define HAVE_FTELLO 1 /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 /* Define to 1 if you have the `ftruncate' function. */ #define HAVE_FTRUNCATE 1 /* Define to 1 if you have the `futimens' function. */ #define HAVE_FUTIMENS 1 /* Define to 1 if you have the `futimes' function. */ #define HAVE_FUTIMES 1 /* Define to 1 if you have the `futimesat' function. */ #define HAVE_FUTIMESAT 1 /* Define to 1 if you have the `gai_strerror' function. */ #define HAVE_GAI_STRERROR 1 /* Define to 1 if you have the `gamma' function. */ #define HAVE_GAMMA 1 /* Define if we can use gcc inline assembler to get and set mc68881 fpcr */ /* #undef HAVE_GCC_ASM_FOR_MC68881 */ /* Define if we can use x64 gcc inline assembler */ #define HAVE_GCC_ASM_FOR_X64 1 /* Define if we can use gcc inline assembler to get and set x87 control word */ #define HAVE_GCC_ASM_FOR_X87 1 /* Define if your compiler provides __uint128_t */ #define HAVE_GCC_UINT128_T 1 /* Define if you have the getaddrinfo function. */ #define HAVE_GETADDRINFO 1 /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ #define HAVE_GETC_UNLOCKED 1 /* Define to 1 if you have the `getentropy' function. */ #define HAVE_GETENTROPY 1 /* Define to 1 if you have the `getgrouplist' function. */ #define HAVE_GETGROUPLIST 1 /* Define to 1 if you have the `getgroups' function. */ #define HAVE_GETGROUPS 1 /* Define to 1 if you have the `gethostbyname' function. */ /* #undef HAVE_GETHOSTBYNAME */ /* Define this if you have some version of gethostbyname_r() */ #define HAVE_GETHOSTBYNAME_R 1 /* Define this if you have the 3-arg version of gethostbyname_r(). */ /* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ /* Define this if you have the 5-arg version of gethostbyname_r(). */ /* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ /* Define this if you have the 6-arg version of gethostbyname_r(). */ #define HAVE_GETHOSTBYNAME_R_6_ARG 1 /* Define to 1 if you have the `getitimer' function. */ #define HAVE_GETITIMER 1 /* Define to 1 if you have the `getloadavg' function. */ #define HAVE_GETLOADAVG 1 /* Define to 1 if you have the `getlogin' function. */ #define HAVE_GETLOGIN 1 /* Define to 1 if you have the `getnameinfo' function. */ #define HAVE_GETNAMEINFO 1 /* Define if you have the 'getpagesize' function. */ #define HAVE_GETPAGESIZE 1 /* Define to 1 if you have the `getpeername' function. */ #define HAVE_GETPEERNAME 1 /* Define to 1 if you have the `getpgid' function. */ #define HAVE_GETPGID 1 /* Define to 1 if you have the `getpgrp' function. */ #define HAVE_GETPGRP 1 /* Define to 1 if you have the `getpid' function. */ #define HAVE_GETPID 1 /* Define to 1 if you have the `getpriority' function. */ #define HAVE_GETPRIORITY 1 /* Define to 1 if you have the `getpwent' function. */ #define HAVE_GETPWENT 1 /* Define to 1 if the getrandom() function is available */ #define HAVE_GETRANDOM 1 /* Define to 1 if the Linux getrandom() syscall is available */ #define HAVE_GETRANDOM_SYSCALL 1 /* Define to 1 if you have the `getresgid' function. */ #define HAVE_GETRESGID 1 /* Define to 1 if you have the `getresuid' function. */ #define HAVE_GETRESUID 1 /* Define to 1 if you have the `getsid' function. */ #define HAVE_GETSID 1 /* Define to 1 if you have the `getspent' function. */ #define HAVE_GETSPENT 1 /* Define to 1 if you have the `getspnam' function. */ #define HAVE_GETSPNAM 1 /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the `getwd' function. */ #define HAVE_GETWD 1 /* Define if glibc has incorrect _FORTIFY_SOURCE wrappers for memmove and bcopy. */ /* #undef HAVE_GLIBC_MEMMOVE_BUG */ /* Define to 1 if you have the <grp.h> header file. */ #define HAVE_GRP_H 1 /* Define if you have the 'hstrerror' function. */ #define HAVE_HSTRERROR 1 /* Define this if you have le64toh() */ #define HAVE_HTOLE64 1 /* Define to 1 if you have the `hypot' function. */ #define HAVE_HYPOT 1 /* Define to 1 if you have the <ieeefp.h> header file. */ /* #undef HAVE_IEEEFP_H */ /* Define to 1 if you have the 'if_nameindex' function. */ #define HAVE_IF_NAMEINDEX 1 /* Define if you have the 'inet_aton' function. */ #define HAVE_INET_ATON 1 /* Define if you have the 'inet_pton' function. */ #define HAVE_INET_PTON 1 /* Define to 1 if you have the `initgroups' function. */ #define HAVE_INITGROUPS 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the <io.h> header file. */ /* #undef HAVE_IO_H */ /* Define if gcc has the ipa-pure-const bug. */ /* #undef HAVE_IPA_PURE_CONST_BUG */ /* Define to 1 if you have the `kill' function. */ #define HAVE_KILL 1 /* Define to 1 if you have the `killpg' function. */ #define HAVE_KILLPG 1 /* Define if you have the 'kqueue' functions. */ /* #undef HAVE_KQUEUE */ /* Define to 1 if you have the <langinfo.h> header file. */ #define HAVE_LANGINFO_H 1 /* Defined to enable large file support when an off_t is bigger than a long and long long is available and at least as big as an off_t. You may need to add some flags for configuration and compilation to enable this mode. (For Solaris and Linux, the necessary defines are already defined.) */ /* #undef HAVE_LARGEFILE_SUPPORT */ /* Define to 1 if you have the 'lchflags' function. */ /* #undef HAVE_LCHFLAGS */ /* Define to 1 if you have the `lchmod' function. */ /* #undef HAVE_LCHMOD */ /* Define to 1 if you have the `lchown' function. */ #define HAVE_LCHOWN 1 /* Define to 1 if you have the `lgamma' function. */ #define HAVE_LGAMMA 1 /* Define to 1 if you have the `dl' library (-ldl). */ #define HAVE_LIBDL 1 /* Define to 1 if you have the `dld' library (-ldld). */ /* #undef HAVE_LIBDLD */ /* Define to 1 if you have the `ieee' library (-lieee). */ /* #undef HAVE_LIBIEEE */ /* Define to 1 if you have the <libintl.h> header file. */ #define HAVE_LIBINTL_H 1 /* Define if you have the readline library (-lreadline). */ #define HAVE_LIBREADLINE 1 /* Define to 1 if you have the `resolv' library (-lresolv). */ /* #undef HAVE_LIBRESOLV */ /* Define to 1 if you have the `sendfile' library (-lsendfile). */ /* #undef HAVE_LIBSENDFILE */ /* Define to 1 if you have the <libutil.h> header file. */ /* #undef HAVE_LIBUTIL_H */ /* Define if you have the 'link' function. */ #define HAVE_LINK 1 /* Define to 1 if you have the `linkat' function. */ #define HAVE_LINKAT 1 /* Define to 1 if you have the <linux/can/bcm.h> header file. */ #define HAVE_LINUX_CAN_BCM_H 1 /* Define to 1 if you have the <linux/can.h> header file. */ #define HAVE_LINUX_CAN_H 1 /* Define if compiling using Linux 3.6 or later. */ #define HAVE_LINUX_CAN_RAW_FD_FRAMES 1 /* Define to 1 if you have the <linux/can/raw.h> header file. */ #define HAVE_LINUX_CAN_RAW_H 1 /* Define to 1 if you have the <linux/netlink.h> header file. */ #define HAVE_LINUX_NETLINK_H 1 /* Define to 1 if you have the <linux/random.h> header file. */ #define HAVE_LINUX_RANDOM_H 1 /* Define to 1 if you have the <linux/tipc.h> header file. */ #define HAVE_LINUX_TIPC_H 1 /* Define to 1 if you have the 'lockf' function and the F_LOCK macro. */ #define HAVE_LOCKF 1 /* Define to 1 if you have the `log1p' function. */ #define HAVE_LOG1P 1 /* Define to 1 if you have the `log2' function. */ #define HAVE_LOG2 1 /* Define this if you have the type long double. */ #define HAVE_LONG_DOUBLE 1 /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 /* Define to 1 if you have the `lutimes' function. */ #define HAVE_LUTIMES 1 /* Define this if you have the makedev macro. */ #define HAVE_MAKEDEV 1 /* Define to 1 if you have the `mbrtowc' function. */ #define HAVE_MBRTOWC 1 /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `memrchr' function. */ #define HAVE_MEMRCHR 1 /* Define to 1 if you have the `mkdirat' function. */ #define HAVE_MKDIRAT 1 /* Define to 1 if you have the `mkfifo' function. */ #define HAVE_MKFIFO 1 /* Define to 1 if you have the `mkfifoat' function. */ #define HAVE_MKFIFOAT 1 /* Define to 1 if you have the `mknod' function. */ #define HAVE_MKNOD 1 /* Define to 1 if you have the `mknodat' function. */ #define HAVE_MKNODAT 1 /* Define to 1 if you have the `mktime' function. */ #define HAVE_MKTIME 1 /* Define to 1 if you have the `mmap' function. */ #define HAVE_MMAP 1 /* Define to 1 if you have the `mremap' function. */ #define HAVE_MREMAP 1 /* Define to 1 if you have the <ncurses.h> header file. */ #define HAVE_NCURSES_H 1 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the <netpacket/packet.h> header file. */ #define HAVE_NETPACKET_PACKET_H 1 /* Define to 1 if you have the <net/if.h> header file. */ #define HAVE_NET_IF_H 1 /* Define to 1 if you have the `nice' function. */ #define HAVE_NICE 1 /* Define to 1 if you have the `openat' function. */ #define HAVE_OPENAT 1 /* Define to 1 if you have the `openpty' function. */ #define HAVE_OPENPTY 1 /* Define to 1 if you have the `pathconf' function. */ #define HAVE_PATHCONF 1 /* Define to 1 if you have the `pause' function. */ #define HAVE_PAUSE 1 /* Define to 1 if you have the `pipe2' function. */ #define HAVE_PIPE2 1 /* Define to 1 if you have the `plock' function. */ /* #undef HAVE_PLOCK */ /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 /* Define to 1 if you have the <poll.h> header file. */ #define HAVE_POLL_H 1 /* Define to 1 if you have the `posix_fadvise' function. */ #define HAVE_POSIX_FADVISE 1 /* Define to 1 if you have the `posix_fallocate' function. */ #define HAVE_POSIX_FALLOCATE 1 /* Define to 1 if you have the `pread' function. */ #define HAVE_PREAD 1 /* Define if you have the 'prlimit' functions. */ #define HAVE_PRLIMIT 1 /* Define to 1 if you have the <process.h> header file. */ /* #undef HAVE_PROCESS_H */ /* Define if your compiler supports function prototype */ #define HAVE_PROTOTYPES 1 /* Define to 1 if you have the `pthread_atfork' function. */ #define HAVE_PTHREAD_ATFORK 1 /* Define to 1 if you have the `pthread_condattr_setclock' function. */ #define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 /* Defined for Solaris 2.6 bug in pthread header. */ /* #undef HAVE_PTHREAD_DESTRUCTOR */ /* Define to 1 if you have the <pthread.h> header file. */ #define HAVE_PTHREAD_H 1 /* Define to 1 if you have the `pthread_init' function. */ /* #undef HAVE_PTHREAD_INIT */ /* Define to 1 if you have the `pthread_kill' function. */ #define HAVE_PTHREAD_KILL 1 /* Define to 1 if you have the `pthread_sigmask' function. */ #define HAVE_PTHREAD_SIGMASK 1 /* Define to 1 if you have the <pty.h> header file. */ #define HAVE_PTY_H 1 /* Define to 1 if you have the `putenv' function. */ #define HAVE_PUTENV 1 /* Define to 1 if you have the `pwrite' function. */ #define HAVE_PWRITE 1 /* Define to 1 if you have the `readlink' function. */ #define HAVE_READLINK 1 /* Define to 1 if you have the `readlinkat' function. */ #define HAVE_READLINKAT 1 /* Define to 1 if you have the `readv' function. */ #define HAVE_READV 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define to 1 if you have the `renameat' function. */ #define HAVE_RENAMEAT 1 /* Define if readline supports append_history */ #define HAVE_RL_APPEND_HISTORY 1 /* Define if you have readline 2.1 */ #define HAVE_RL_CALLBACK 1 /* Define if you can turn off readline's signal handling. */ #define HAVE_RL_CATCH_SIGNAL 1 /* Define if you have readline 2.2 */ #define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 /* Define if you have readline 4.0 */ #define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1 /* Define if you have readline 4.2 */ #define HAVE_RL_COMPLETION_MATCHES 1 /* Define if you have rl_completion_suppress_append */ #define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1 /* Define if you have readline 4.0 */ #define HAVE_RL_PRE_INPUT_HOOK 1 /* Define if you have readline 4.0 */ #define HAVE_RL_RESIZE_TERMINAL 1 /* Define to 1 if you have the `round' function. */ #define HAVE_ROUND 1 /* Define to 1 if you have the `sched_get_priority_max' function. */ #define HAVE_SCHED_GET_PRIORITY_MAX 1 /* Define to 1 if you have the <sched.h> header file. */ #define HAVE_SCHED_H 1 /* Define to 1 if you have the `sched_rr_get_interval' function. */ #define HAVE_SCHED_RR_GET_INTERVAL 1 /* Define to 1 if you have the `sched_setaffinity' function. */ #define HAVE_SCHED_SETAFFINITY 1 /* Define to 1 if you have the `sched_setparam' function. */ #define HAVE_SCHED_SETPARAM 1 /* Define to 1 if you have the `sched_setscheduler' function. */ #define HAVE_SCHED_SETSCHEDULER 1 /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 /* Define to 1 if you have the `sem_getvalue' function. */ #define HAVE_SEM_GETVALUE 1 /* Define to 1 if you have the `sem_open' function. */ #define HAVE_SEM_OPEN 1 /* Define to 1 if you have the `sem_timedwait' function. */ #define HAVE_SEM_TIMEDWAIT 1 /* Define to 1 if you have the `sem_unlink' function. */ #define HAVE_SEM_UNLINK 1 /* Define to 1 if you have the `sendfile' function. */ #define HAVE_SENDFILE 1 /* Define to 1 if you have the `setegid' function. */ #define HAVE_SETEGID 1 /* Define to 1 if you have the `seteuid' function. */ #define HAVE_SETEUID 1 /* Define to 1 if you have the `setgid' function. */ #define HAVE_SETGID 1 /* Define if you have the 'setgroups' function. */ #define HAVE_SETGROUPS 1 /* Define to 1 if you have the `sethostname' function. */ #define HAVE_SETHOSTNAME 1 /* Define to 1 if you have the `setitimer' function. */ #define HAVE_SETITIMER 1 /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setpgid' function. */ #define HAVE_SETPGID 1 /* Define to 1 if you have the `setpgrp' function. */ #define HAVE_SETPGRP 1 /* Define to 1 if you have the `setpriority' function. */ #define HAVE_SETPRIORITY 1 /* Define to 1 if you have the `setregid' function. */ #define HAVE_SETREGID 1 /* Define to 1 if you have the `setresgid' function. */ #define HAVE_SETRESGID 1 /* Define to 1 if you have the `setresuid' function. */ #define HAVE_SETRESUID 1 /* Define to 1 if you have the `setreuid' function. */ #define HAVE_SETREUID 1 /* Define to 1 if you have the `setsid' function. */ #define HAVE_SETSID 1 /* Define to 1 if you have the `setuid' function. */ #define HAVE_SETUID 1 /* Define to 1 if you have the `setvbuf' function. */ #define HAVE_SETVBUF 1 /* Define to 1 if you have the <shadow.h> header file. */ #define HAVE_SHADOW_H 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the `sigaltstack' function. */ #define HAVE_SIGALTSTACK 1 /* Define to 1 if you have the `siginterrupt' function. */ #define HAVE_SIGINTERRUPT 1 /* Define to 1 if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the `sigpending' function. */ #define HAVE_SIGPENDING 1 /* Define to 1 if you have the `sigrelse' function. */ #define HAVE_SIGRELSE 1 /* Define to 1 if you have the `sigtimedwait' function. */ #define HAVE_SIGTIMEDWAIT 1 /* Define to 1 if you have the `sigwait' function. */ #define HAVE_SIGWAIT 1 /* Define to 1 if you have the `sigwaitinfo' function. */ #define HAVE_SIGWAITINFO 1 /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 /* struct sockaddr_alg (linux/if_alg.h) */ #define HAVE_SOCKADDR_ALG 1 /* Define if sockaddr has sa_len member */ /* #undef HAVE_SOCKADDR_SA_LEN */ /* struct sockaddr_storage (sys/socket.h) */ #define HAVE_SOCKADDR_STORAGE 1 /* Define if you have the 'socketpair' function. */ #define HAVE_SOCKETPAIR 1 /* Define to 1 if you have the <spawn.h> header file. */ #define HAVE_SPAWN_H 1 /* Define if your compiler provides ssize_t */ #define HAVE_SSIZE_T 1 /* Define to 1 if you have the `statvfs' function. */ #define HAVE_STATVFS 1 /* Define if you have struct stat.st_mtim.tv_nsec */ #define HAVE_STAT_TV_NSEC 1 /* Define if you have struct stat.st_mtimensec */ /* #undef HAVE_STAT_TV_NSEC2 */ /* Define if your compiler supports variable length function prototypes (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */ #define HAVE_STDARG_PROTOTYPES 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Has stdatomic.h with atomic_int */ #define HAVE_STD_ATOMIC 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strftime' function. */ #define HAVE_STRFTIME 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcpy' function. */ /* #undef HAVE_STRLCPY */ /* Define to 1 if you have the <stropts.h> header file. */ /* #undef HAVE_STROPTS_H */ /* Define to 1 if `pw_gecos' is a member of `struct passwd'. */ #define HAVE_STRUCT_PASSWD_PW_GECOS 1 /* Define to 1 if `pw_passwd' is a member of `struct passwd'. */ #define HAVE_STRUCT_PASSWD_PW_PASSWD 1 /* Define to 1 if `st_birthtime' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_BLOCKS 1 /* Define to 1 if `st_flags' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_FLAGS */ /* Define to 1 if `st_gen' is a member of `struct stat'. */ /* #undef HAVE_STRUCT_STAT_ST_GEN */ /* Define to 1 if `st_rdev' is a member of `struct stat'. */ #define HAVE_STRUCT_STAT_ST_RDEV 1 /* Define to 1 if `tm_zone' is a member of `struct tm'. */ #define HAVE_STRUCT_TM_TM_ZONE 1 /* Define if you have the 'symlink' function. */ #define HAVE_SYMLINK 1 /* Define to 1 if you have the `symlinkat' function. */ #define HAVE_SYMLINKAT 1 /* Define to 1 if you have the `sync' function. */ #define HAVE_SYNC 1 /* Define to 1 if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define to 1 if you have the <sysexits.h> header file. */ #define HAVE_SYSEXITS_H 1 /* Define to 1 if you have the <sys/audioio.h> header file. */ /* #undef HAVE_SYS_AUDIOIO_H */ /* Define to 1 if you have the <sys/bsdtty.h> header file. */ /* #undef HAVE_SYS_BSDTTY_H */ /* Define to 1 if you have the <sys/devpoll.h> header file. */ /* #undef HAVE_SYS_DEVPOLL_H */ /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the <sys/endian.h> header file. */ /* #undef HAVE_SYS_ENDIAN_H */ /* Define to 1 if you have the <sys/epoll.h> header file. */ #define HAVE_SYS_EPOLL_H 1 /* Define to 1 if you have the <sys/event.h> header file. */ /* #undef HAVE_SYS_EVENT_H */ /* Define to 1 if you have the <sys/file.h> header file. */ #define HAVE_SYS_FILE_H 1 /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/kern_control.h> header file. */ /* #undef HAVE_SYS_KERN_CONTROL_H */ /* Define to 1 if you have the <sys/loadavg.h> header file. */ /* #undef HAVE_SYS_LOADAVG_H */ /* Define to 1 if you have the <sys/lock.h> header file. */ /* #undef HAVE_SYS_LOCK_H */ /* Define to 1 if you have the <sys/mkdev.h> header file. */ /* #undef HAVE_SYS_MKDEV_H */ /* Define to 1 if you have the <sys/modem.h> header file. */ /* #undef HAVE_SYS_MODEM_H */ /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the <sys/param.h> header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/poll.h> header file. */ #define HAVE_SYS_POLL_H 1 /* Define to 1 if you have the <sys/random.h> header file. */ #define HAVE_SYS_RANDOM_H 1 /* Define to 1 if you have the <sys/resource.h> header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the <sys/sendfile.h> header file. */ #define HAVE_SYS_SENDFILE_H 1 /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/statvfs.h> header file. */ #define HAVE_SYS_STATVFS_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/syscall.h> header file. */ #define HAVE_SYS_SYSCALL_H 1 /* Define to 1 if you have the <sys/sysmacros.h> header file. */ #define HAVE_SYS_SYSMACROS_H 1 /* Define to 1 if you have the <sys/sys_domain.h> header file. */ /* #undef HAVE_SYS_SYS_DOMAIN_H */ /* Define to 1 if you have the <sys/termio.h> header file. */ /* #undef HAVE_SYS_TERMIO_H */ /* Define to 1 if you have the <sys/times.h> header file. */ #define HAVE_SYS_TIMES_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/uio.h> header file. */ #define HAVE_SYS_UIO_H 1 /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <sys/utsname.h> header file. */ #define HAVE_SYS_UTSNAME_H 1 /* Define to 1 if you have the <sys/wait.h> header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the <sys/xattr.h> header file. */ #define HAVE_SYS_XATTR_H 1 /* Define to 1 if you have the `tcgetpgrp' function. */ #define HAVE_TCGETPGRP 1 /* Define to 1 if you have the `tcsetpgrp' function. */ #define HAVE_TCSETPGRP 1 /* Define to 1 if you have the `tempnam' function. */ #define HAVE_TEMPNAM 1 /* Define to 1 if you have the <termios.h> header file. */ #define HAVE_TERMIOS_H 1 /* Define to 1 if you have the <term.h> header file. */ #define HAVE_TERM_H 1 /* Define to 1 if you have the `tgamma' function. */ #define HAVE_TGAMMA 1 /* Define to 1 if you have the `timegm' function. */ #define HAVE_TIMEGM 1 /* Define to 1 if you have the `times' function. */ #define HAVE_TIMES 1 /* Define to 1 if you have the `tmpfile' function. */ #define HAVE_TMPFILE 1 /* Define to 1 if you have the `tmpnam' function. */ #define HAVE_TMPNAM 1 /* Define to 1 if you have the `tmpnam_r' function. */ #define HAVE_TMPNAM_R 1 /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #define HAVE_TM_ZONE 1 /* Define to 1 if you have the `truncate' function. */ #define HAVE_TRUNCATE 1 /* Define to 1 if you don't have `tm_zone' but do have the external array `tzname'. */ /* #undef HAVE_TZNAME */ /* Define this if you have tcl and TCL_UTF_MAX==6 */ /* #undef HAVE_UCS4_TCL */ /* Define to 1 if you have the `uname' function. */ #define HAVE_UNAME 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `unlinkat' function. */ #define HAVE_UNLINKAT 1 /* Define to 1 if you have the `unsetenv' function. */ #define HAVE_UNSETENV 1 /* Define if you have a useable wchar_t type defined in wchar.h; useable means wchar_t must be an unsigned type with at least 16 bits. (see Include/unicodeobject.h). */ /* #undef HAVE_USABLE_WCHAR_T */ /* Define to 1 if you have the <util.h> header file. */ /* #undef HAVE_UTIL_H */ /* Define to 1 if you have the `utimensat' function. */ #define HAVE_UTIMENSAT 1 /* Define to 1 if you have the `utimes' function. */ #define HAVE_UTIMES 1 /* Define to 1 if you have the <utime.h> header file. */ #define HAVE_UTIME_H 1 /* Define to 1 if you have the `wait3' function. */ #define HAVE_WAIT3 1 /* Define to 1 if you have the `wait4' function. */ #define HAVE_WAIT4 1 /* Define to 1 if you have the `waitid' function. */ #define HAVE_WAITID 1 /* Define to 1 if you have the `waitpid' function. */ #define HAVE_WAITPID 1 /* Define if the compiler provides a wchar.h header file. */ #define HAVE_WCHAR_H 1 /* Define to 1 if you have the `wcscoll' function. */ #define HAVE_WCSCOLL 1 /* Define to 1 if you have the `wcsftime' function. */ #define HAVE_WCSFTIME 1 /* Define to 1 if you have the `wcsxfrm' function. */ #define HAVE_WCSXFRM 1 /* Define to 1 if you have the `wmemcmp' function. */ #define HAVE_WMEMCMP 1 /* Define if tzset() actually switches the local timezone in a meaningful way. */ #define HAVE_WORKING_TZSET 1 /* Define to 1 if you have the `writev' function. */ #define HAVE_WRITEV 1 /* Define if the zlib library has inflateCopy */ #define HAVE_ZLIB_COPY 1 /* Define to 1 if you have the `_getpty' function. */ /* #undef HAVE__GETPTY */ /* Define if log1p(-0.) is 0. rather than -0. */ /* #undef LOG1P_DROPS_ZERO_SIGN */ /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>. */ /* #undef MAJOR_IN_MKDEV */ /* Define to 1 if `major', `minor', and `makedev' are declared in <sysmacros.h>. */ #define MAJOR_IN_SYSMACROS 1 /* Define if mvwdelch in curses.h is an expression. */ #define MVWDELCH_IS_EXPRESSION 1 /* Define to the address where bug reports for this package should be sent. */ /* #undef PACKAGE_BUGREPORT */ /* Define to the full name of this package. */ /* #undef PACKAGE_NAME */ /* Define to the full name and version of this package. */ /* #undef PACKAGE_STRING */ /* Define to the one symbol short name of this package. */ /* #undef PACKAGE_TARNAME */ /* Define to the home page for this package. */ /* #undef PACKAGE_URL */ /* Define to the version of this package. */ /* #undef PACKAGE_VERSION */ /* Define if POSIX semaphores aren't enabled on your system */ /* #undef POSIX_SEMAPHORES_NOT_ENABLED */ /* Defined if PTHREAD_SCOPE_SYSTEM supported. */ #define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 /* Define as the preferred size in bits of long digits */ /* #undef PYLONG_BITS_IN_DIGIT */ /* Define if you want to coerce the C locale to a UTF-8 based locale */ #define PY_COERCE_C_LOCALE 1 /* Define to printf format modifier for Py_ssize_t */ #define PY_FORMAT_SIZE_T "z" /* Default cipher suites list for ssl module. 1: Python's preferred selection, 2: leave OpenSSL defaults untouched, 0: custom string */ #define PY_SSL_DEFAULT_CIPHERS 2 /* Cipher suite string for PY_SSL_DEFAULT_CIPHERS=0 */ /* #undef PY_SSL_DEFAULT_CIPHER_STRING */ /* Define to emit a locale compatibility warning in the C locale */ #define PY_WARN_ON_C_LOCALE 1 /* Define if you want to build an interpreter with many run-time checks. */ /* #undef Py_DEBUG */ /* Defined if Python is built as a shared library. */ #define Py_ENABLE_SHARED 1 /* Define hash algorithm for str, bytes and memoryview. SipHash24: 1, FNV: 2, externally defined: 0 */ /* #undef Py_HASH_ALGORITHM */ /* assume C89 semantics that RETSIGTYPE is always void */ #define RETSIGTYPE void /* Define if setpgrp() must be called as setpgrp(0, 0). */ /* #undef SETPGRP_HAVE_ARG */ /* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ /* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */ /* The size of `double', as computed by sizeof. */ #define SIZEOF_DOUBLE 8 /* The size of `float', as computed by sizeof. */ #define SIZEOF_FLOAT 4 /* The size of `fpos_t', as computed by sizeof. */ #define SIZEOF_FPOS_T 16 /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `long double', as computed by sizeof. */ #define SIZEOF_LONG_DOUBLE 16 /* The size of `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 /* The size of `pid_t', as computed by sizeof. */ #define SIZEOF_PID_T 4 /* The size of `pthread_t', as computed by sizeof. */ #define SIZEOF_PTHREAD_T 8 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `time_t', as computed by sizeof. */ #define SIZEOF_TIME_T 8 /* The size of `uintptr_t', as computed by sizeof. */ #define SIZEOF_UINTPTR_T 8 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 8 /* The size of `wchar_t', as computed by sizeof. */ #define SIZEOF_WCHAR_T 4 /* The size of `_Bool', as computed by sizeof. */ #define SIZEOF__BOOL 1 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if you can safely include both <sys/select.h> and <sys/time.h> (which you can't on SCO ODT 3.0). */ #define SYS_SELECT_WITH_SYS_TIME 1 /* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ #define TANH_PRESERVES_ZERO_SIGN 1 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */ /* #undef TIMEMODULE_LIB */ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Define if you want to use computed gotos in ceval.c. */ #define USE_COMPUTED_GOTOS 1 /* Define to use the C99 inline keyword. */ #define USE_INLINE 1 /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # define __EXTENSIONS__ 1 #endif /* Define if you want SIGFPE handled (see Include/pyfpe.h). */ /* #undef WANT_SIGFPE_HANDLER */ /* Define if WINDOW in curses.h offers a field _flags. */ #define WINDOW_HAS_FLAGS 1 /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 /* Define if you want to compile in DTrace support */ #define WITH_DTRACE 1 /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). Dyld is necessary to support frameworks. */ /* #undef WITH_DYLD */ /* Define to 1 if libintl is needed for locale functions. */ /* #undef WITH_LIBINTL */ /* Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files). */ /* #undef WITH_NEXT_FRAMEWORK */ /* Define if you want to compile in Python-specific mallocs */ #define WITH_PYMALLOC 1 /* Define if you want to compile in rudimentary thread support */ #define WITH_THREAD 1 /* Define if you want pymalloc to be disabled when running under valgrind */ #define WITH_VALGRIND 1 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Define if arithmetic is subject to x87-style double rounding issue */ /* #undef X87_DOUBLE_ROUNDING */ /* Define on OpenBSD to activate all library features */ /* #undef _BSD_SOURCE */ /* Define on Irix to enable u_int */ #define _BSD_TYPES 1 /* Define on Darwin to activate all library features */ #define _DARWIN_C_SOURCE 1 /* This must be set to 64 on some systems to enable large file support. */ #define _FILE_OFFSET_BITS 64 /* Define on Linux to activate all library features */ #define _GNU_SOURCE 1 /* Define to include mbstate_t for mbrtowc */ /* #undef _INCLUDE__STDC_A1_SOURCE */ /* This must be defined on some systems to enable large file support. */ #define _LARGEFILE_SOURCE 1 /* This must be defined on AIX systems to enable large file support. */ /* #undef _LARGE_FILES */ /* Define to 1 if on MINIX. */ /* #undef _MINIX */ /* Define on NetBSD to activate all library features */ #define _NETBSD_SOURCE 1 /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define to activate features from IEEE Stds 1003.1-2008 */ #define _POSIX_C_SOURCE 200809L /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define if you have POSIX threads, and your system does not define that. */ /* #undef _POSIX_THREADS */ /* Define to force use of thread-safe errno, h_errno, and other functions */ /* #undef _REENTRANT */ /* Define to the level of X/Open that your system supports */ #define _XOPEN_SOURCE 700 /* Define to activate Unix95-and-earlier features */ #define _XOPEN_SOURCE_EXTENDED 1 /* Define on FreeBSD to activate all library features */ #define __BSD_VISIBLE 1 /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ /* # undef __CHAR_UNSIGNED__ */ #endif /* Define to 'long' if <time.h> doesn't define. */ /* #undef clock_t */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `int' if <sys/types.h> doesn't define. */ /* #undef gid_t */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to `int' if <sys/types.h> does not define. */ /* #undef mode_t */ /* Define to `long int' if <sys/types.h> does not define. */ /* #undef off_t */ /* Define to `int' if <sys/types.h> does not define. */ /* #undef pid_t */ /* Define to empty if the keyword does not work. */ /* #undef signed */ /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */ /* Define to `int' if <sys/socket.h> does not define. */ /* #undef socklen_t */ /* Define to `int' if <sys/types.h> doesn't define. */ /* #undef uid_t */ /* Define to empty if the keyword does not work. */ /* #undef volatile */ /* Define the macros needed if on a UnixWare 7.x system. */ #if defined(__USLC__) && defined(__SCO_VERSION__) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif #endif /*Py_PYCONFIG_H*/ python3.6m/bitset.h 0000644 00000001430 15063602042 0010130 0 ustar 00 #ifndef Py_BITSET_H #define Py_BITSET_H #ifdef __cplusplus extern "C" { #endif /* Bitset interface */ #define BYTE char typedef BYTE *bitset; bitset newbitset(int nbits); void delbitset(bitset bs); #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) int addbit(bitset bs, int ibit); /* Returns 0 if already set */ int samebitset(bitset bs1, bitset bs2, int nbits); void mergebitset(bitset bs1, bitset bs2, int nbits); #define BITSPERBYTE (8*sizeof(BYTE)) #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) #define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE) #ifdef __cplusplus } #endif #endif /* !Py_BITSET_H */ python3.6m/bltinmodule.h 0000644 00000000410 15063602042 0011151 0 ustar 00 #ifndef Py_BLTINMODULE_H #define Py_BLTINMODULE_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyFilter_Type; PyAPI_DATA(PyTypeObject) PyMap_Type; PyAPI_DATA(PyTypeObject) PyZip_Type; #ifdef __cplusplus } #endif #endif /* !Py_BLTINMODULE_H */ python3.6m/boolobject.h 0000644 00000001566 15063602042 0010772 0 ustar 00 /* Boolean object interface */ #ifndef Py_BOOLOBJECT_H #define Py_BOOLOBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyBool_Type; #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) /* Py_False and Py_True are the only two bools in existence. Don't forget to apply Py_INCREF() when returning either!!! */ /* Don't use these directly */ PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct; /* Use these macros */ #define Py_False ((PyObject *) &_Py_FalseStruct) #define Py_True ((PyObject *) &_Py_TrueStruct) /* Macros for returning Py_True or Py_False, respectively */ #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False /* Function to return a bool from a C long */ PyAPI_FUNC(PyObject *) PyBool_FromLong(long); #ifdef __cplusplus } #endif #endif /* !Py_BOOLOBJECT_H */ python3.6m/bytearrayobject.h 0000644 00000004102 15063602042 0012026 0 ustar 00 /* ByteArray object interface */ #ifndef Py_BYTEARRAYOBJECT_H #define Py_BYTEARRAYOBJECT_H #ifdef __cplusplus extern "C" { #endif #include <stdarg.h> /* Type PyByteArrayObject represents a mutable array of bytes. * The Python API is that of a sequence; * the bytes are mapped to ints in [0, 256). * Bytes are not characters; they may be used to encode characters. * The only way to go between bytes and str/unicode is via encoding * and decoding. * For the convenience of C programmers, the bytes type is considered * to contain a char pointer, not an unsigned char pointer. */ /* Object layout */ #ifndef Py_LIMITED_API typedef struct { PyObject_VAR_HEAD Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */ char *ob_bytes; /* Physical backing buffer */ char *ob_start; /* Logical start inside ob_bytes */ /* XXX(nnorwitz): should ob_exports be Py_ssize_t? */ int ob_exports; /* How many buffer exports */ } PyByteArrayObject; #endif /* Type object */ PyAPI_DATA(PyTypeObject) PyByteArray_Type; PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; /* Type check macros */ #define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) #define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type) /* Direct API functions */ PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *); PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t); PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *); PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *); PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t); /* Macros, trading safety for speed */ #ifndef Py_LIMITED_API #define PyByteArray_AS_STRING(self) \ (assert(PyByteArray_Check(self)), \ Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string) #define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self)) PyAPI_DATA(char) _PyByteArray_empty_string[]; #endif #ifdef __cplusplus } #endif #endif /* !Py_BYTEARRAYOBJECT_H */ python3.6m/bytes_methods.h 0000644 00000006167 15063602042 0011523 0 ustar 00 #ifndef Py_LIMITED_API #ifndef Py_BYTES_CTYPE_H #define Py_BYTES_CTYPE_H /* * The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray) * methods of the given names, they operate on ASCII byte strings. */ extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); /* These store their len sized answer in the given preallocated *result arg. */ extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); extern void _Py_bytes_title(char *result, const char *s, Py_ssize_t len); extern void _Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len); extern void _Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len); extern PyObject *_Py_bytes_find(const char *str, Py_ssize_t len, PyObject *args); extern PyObject *_Py_bytes_index(const char *str, Py_ssize_t len, PyObject *args); extern PyObject *_Py_bytes_rfind(const char *str, Py_ssize_t len, PyObject *args); extern PyObject *_Py_bytes_rindex(const char *str, Py_ssize_t len, PyObject *args); extern PyObject *_Py_bytes_count(const char *str, Py_ssize_t len, PyObject *args); extern int _Py_bytes_contains(const char *str, Py_ssize_t len, PyObject *arg); extern PyObject *_Py_bytes_startswith(const char *str, Py_ssize_t len, PyObject *args); extern PyObject *_Py_bytes_endswith(const char *str, Py_ssize_t len, PyObject *args); /* The maketrans() static method. */ extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to); /* Shared __doc__ strings. */ extern const char _Py_isspace__doc__[]; extern const char _Py_isalpha__doc__[]; extern const char _Py_isalnum__doc__[]; extern const char _Py_isdigit__doc__[]; extern const char _Py_islower__doc__[]; extern const char _Py_isupper__doc__[]; extern const char _Py_istitle__doc__[]; extern const char _Py_lower__doc__[]; extern const char _Py_upper__doc__[]; extern const char _Py_title__doc__[]; extern const char _Py_capitalize__doc__[]; extern const char _Py_swapcase__doc__[]; extern const char _Py_count__doc__[]; extern const char _Py_find__doc__[]; extern const char _Py_index__doc__[]; extern const char _Py_rfind__doc__[]; extern const char _Py_rindex__doc__[]; extern const char _Py_startswith__doc__[]; extern const char _Py_endswith__doc__[]; extern const char _Py_maketrans__doc__[]; extern const char _Py_expandtabs__doc__[]; extern const char _Py_ljust__doc__[]; extern const char _Py_rjust__doc__[]; extern const char _Py_center__doc__[]; extern const char _Py_zfill__doc__[]; /* this is needed because some docs are shared from the .o, not static */ #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) #endif /* !Py_BYTES_CTYPE_H */ #endif /* !Py_LIMITED_API */ python3.6m/bytesobject.h 0000644 00000020253 15063602042 0011157 0 ustar 00 /* Bytes (String) object interface */ #ifndef Py_BYTESOBJECT_H #define Py_BYTESOBJECT_H #ifdef __cplusplus extern "C" { #endif #include <stdarg.h> /* Type PyBytesObject represents a character string. An extra zero byte is reserved at the end to ensure it is zero-terminated, but a size is present so strings with null bytes in them can be represented. This is an immutable object type. There are functions to create new string objects, to test an object for string-ness, and to get the string value. The latter function returns a null pointer if the object is not of the proper type. There is a variant that takes an explicit size as well as a variant that assumes a zero-terminated string. Note that none of the functions should be applied to nil objects. */ /* Caching the hash (ob_shash) saves recalculation of a string's hash value. This significantly speeds up dict lookups. */ #ifndef Py_LIMITED_API typedef struct { PyObject_VAR_HEAD Py_hash_t ob_shash; char ob_sval[1]; /* Invariants: * ob_sval contains space for 'ob_size+1' elements. * ob_sval[ob_size] == 0. * ob_shash is the hash of the string or -1 if not computed yet. */ } PyBytesObject; #endif PyAPI_DATA(PyTypeObject) PyBytes_Type; PyAPI_DATA(PyTypeObject) PyBytesIter_Type; #define PyBytes_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS) #define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) Py_GCC_ATTRIBUTE((format(printf, 1, 0))); PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *); PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); PyAPI_FUNC(PyObject*) _PyBytes_FormatEx( const char *format, Py_ssize_t format_len, PyObject *args, int use_bytearray); PyAPI_FUNC(PyObject*) _PyBytes_FromHex( PyObject *string, int use_bytearray); #endif PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); #ifndef Py_LIMITED_API /* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *, const char **); #endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \ (((PyBytesObject *)(op))->ob_sval)) #define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op)) #endif /* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, x must be an iterable object. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); #endif /* Provides access to the internal data buffer and size of a string object or the default encoded version of a Unicode object. Passing NULL as *len parameter will force the string buffer to be 0-terminated (passing a string with embedded NULL characters will cause an exception). */ PyAPI_FUNC(int) PyBytes_AsStringAndSize( PyObject *obj, /* string or Unicode object */ char **s, /* pointer to buffer variable */ Py_ssize_t *len /* pointer to length variable or NULL (only possible for 0-terminated strings) */ ); /* Using the current locale, insert the thousands grouping into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer, Py_ssize_t n_buffer, char *digits, Py_ssize_t n_digits, Py_ssize_t min_width); /* Using explicit passed-in values, insert the thousands grouping into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer, Py_ssize_t n_buffer, char *digits, Py_ssize_t n_digits, Py_ssize_t min_width, const char *grouping, const char *thousands_sep); #endif /* Flags used by string formatting */ #define F_LJUST (1<<0) #define F_SIGN (1<<1) #define F_BLANK (1<<2) #define F_ALT (1<<3) #define F_ZERO (1<<4) #ifndef Py_LIMITED_API /* The _PyBytesWriter structure is big: it contains an embedded "stack buffer". A _PyBytesWriter variable must be declared at the end of variables in a function to optimize the memory allocation on the stack. */ typedef struct { /* bytes, bytearray or NULL (when the small buffer is used) */ PyObject *buffer; /* Number of allocated size. */ Py_ssize_t allocated; /* Minimum number of allocated bytes, incremented by _PyBytesWriter_Prepare() */ Py_ssize_t min_size; /* If non-zero, use a bytearray instead of a bytes object for buffer. */ int use_bytearray; /* If non-zero, overallocate the buffer (default: 0). This flag must be zero if use_bytearray is non-zero. */ int overallocate; /* Stack buffer */ int use_small_buffer; char small_buffer[512]; } _PyBytesWriter; /* Initialize a bytes writer By default, the overallocation is disabled. Set the overallocate attribute to control the allocation of the buffer. */ PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer); /* Get the buffer content and reset the writer. Return a bytes object, or a bytearray object if use_bytearray is non-zero. Raise an exception and return NULL on error. */ PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer, void *str); /* Deallocate memory of a writer (clear its internal buffer). */ PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer); /* Allocate the buffer to write size bytes. Return the pointer to the beginning of buffer data. Raise an exception and return NULL on error. */ PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer, Py_ssize_t size); /* Ensure that the buffer is large enough to write *size* bytes. Add size to the writer minimum size (min_size attribute). str is the current pointer inside the buffer. Return the updated current pointer inside the buffer. Raise an exception and return NULL on error. */ PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer, void *str, Py_ssize_t size); /* Resize the buffer to make it larger. The new buffer may be larger than size bytes because of overallocation. Return the updated current pointer inside the buffer. Raise an exception and return NULL on error. Note: size must be greater than the number of allocated bytes in the writer. This function doesn't use the writer minimum size (min_size attribute). See also _PyBytesWriter_Prepare(). */ PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer, void *str, Py_ssize_t size); /* Write bytes. Raise an exception and return NULL on error. */ PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer, void *str, const void *bytes, Py_ssize_t size); #endif /* Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_BYTESOBJECT_H */ python3.6m/cellobject.h 0000644 00000001275 15063602042 0010753 0 ustar 00 /* Cell object interface */ #ifndef Py_LIMITED_API #ifndef Py_CELLOBJECT_H #define Py_CELLOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD PyObject *ob_ref; /* Content of the cell or NULL when empty */ } PyCellObject; PyAPI_DATA(PyTypeObject) PyCell_Type; #define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) #define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) #ifdef __cplusplus } #endif #endif /* !Py_TUPLEOBJECT_H */ #endif /* Py_LIMITED_API */ python3.6m/ceval.h 0000644 00000020514 15063602042 0007734 0 ustar 00 #ifndef Py_CEVAL_H #define Py_CEVAL_H #ifdef __cplusplus extern "C" { #endif /* Interface to random parts in ceval.c */ PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( PyObject *func, PyObject *args, PyObject *kwargs); /* Inline this */ #define PyEval_CallObject(func,arg) \ PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, const char *format, ...); PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...); #ifndef Py_LIMITED_API PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject *); PyAPI_FUNC(PyObject *) _PyEval_GetCoroutineWrapper(void); PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *); PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void); PyAPI_FUNC(void) _PyEval_SetAsyncGenFinalizer(PyObject *); PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFinalizer(void); #endif struct _frame; /* Avoid including frameobject.h */ PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void); PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void); #ifndef Py_LIMITED_API /* Helper to look up a builtin object */ PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *); /* Look at the current frame's (if any) code's co_flags, and turn on the corresponding compiler flags in cf->cf_flags. Return 1 if any flag was set, else return 0. */ PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); #endif PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); PyAPI_FUNC(void) _PyEval_SignalReceived(void); PyAPI_FUNC(int) Py_MakePendingCalls(void); /* Protection against deeply nested recursive calls In Python 3.0, this protection has two levels: * normal anti-recursion protection is triggered when the recursion level exceeds the current recursion limit. It raises a RecursionError, and sets the "overflowed" flag in the thread state structure. This flag temporarily *disables* the normal protection; this allows cleanup code to potentially outgrow the recursion limit while processing the RecursionError. * "last chance" anti-recursion protection is triggered when the recursion level exceeds "current recursion limit + 50". By construction, this protection can only be triggered when the "overflowed" flag is set. It means the cleanup code has itself gone into an infinite loop, or the RecursionError has been mistakingly ignored. When this protection is triggered, the interpreter aborts with a Fatal Error. In addition, the "overflowed" flag is automatically reset when the recursion level drops below "current recursion limit - 50". This heuristic is meant to ensure that the normal anti-recursion protection doesn't get disabled too long. Please note: this scheme has its own limitations. See: http://mail.python.org/pipermail/python-dev/2008-August/082106.html for some observations. */ PyAPI_FUNC(void) Py_SetRecursionLimit(int); PyAPI_FUNC(int) Py_GetRecursionLimit(void); #define Py_EnterRecursiveCall(where) \ (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ _Py_CheckRecursiveCall(where)) #define Py_LeaveRecursiveCall() \ do{ if(_Py_MakeEndRecCheck(PyThreadState_GET()->recursion_depth)) \ PyThreadState_GET()->overflowed = 0; \ } while(0) PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where); PyAPI_DATA(int) _Py_CheckRecursionLimit; #ifdef USE_STACKCHECK /* With USE_STACKCHECK, we artificially decrement the recursion limit in order to trigger regular stack checks in _Py_CheckRecursiveCall(), except if the "overflowed" flag is set, in which case we need the true value of _Py_CheckRecursionLimit for _Py_MakeEndRecCheck() to function properly. */ # define _Py_MakeRecCheck(x) \ (++(x) > (_Py_CheckRecursionLimit += PyThreadState_GET()->overflowed - 1)) #else # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) #endif /* Compute the "lower-water mark" for a recursion limit. When * Py_LeaveRecursiveCall() is called with a recursion depth below this mark, * the overflowed flag is reset to 0. */ #define _Py_RecursionLimitLowerWaterMark(limit) \ (((limit) > 200) \ ? ((limit) - 50) \ : (3 * ((limit) >> 2))) #define _Py_MakeEndRecCheck(x) \ (--(x) < _Py_RecursionLimitLowerWaterMark(_Py_CheckRecursionLimit)) #define Py_ALLOW_RECURSION \ do { unsigned char _old = PyThreadState_GET()->recursion_critical;\ PyThreadState_GET()->recursion_critical = 1; #define Py_END_ALLOW_RECURSION \ PyThreadState_GET()->recursion_critical = _old; \ } while(0); PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *); PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *); PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(struct _frame *f, int exc); #endif /* Interface for threads. A module that plans to do a blocking system call (or something else that lasts a long time and doesn't touch Python data) can allow other threads to run as follows: ...preparations here... Py_BEGIN_ALLOW_THREADS ...blocking system call here... Py_END_ALLOW_THREADS ...interpret result here... The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a {}-surrounded block. To leave the block in the middle (e.g., with return), you must insert a line containing Py_BLOCK_THREADS before the return, e.g. if (...premature_exit...) { Py_BLOCK_THREADS PyErr_SetFromErrno(PyExc_IOError); return NULL; } An alternative is: Py_BLOCK_THREADS if (...premature_exit...) { PyErr_SetFromErrno(PyExc_IOError); return NULL; } Py_UNBLOCK_THREADS For convenience, that the value of 'errno' is restored across Py_END_ALLOW_THREADS and Py_BLOCK_THREADS. WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND Py_END_ALLOW_THREADS!!! The function PyEval_InitThreads() should be called only from init_thread() in "_threadmodule.c". Note that not yet all candidates have been converted to use this mechanism! */ PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); #ifdef WITH_THREAD PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); PyAPI_FUNC(void) PyEval_InitThreads(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyEval_FiniThreads(void); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(void) PyEval_AcquireLock(void); PyAPI_FUNC(void) PyEval_ReleaseLock(void); PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); PyAPI_FUNC(void) PyEval_ReInitThreads(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); #endif #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc); #endif #define Py_BEGIN_ALLOW_THREADS { \ PyThreadState *_save; \ _save = PyEval_SaveThread(); #define Py_BLOCK_THREADS PyEval_RestoreThread(_save); #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ } #else /* !WITH_THREAD */ #define Py_BEGIN_ALLOW_THREADS { #define Py_BLOCK_THREADS #define Py_UNBLOCK_THREADS #define Py_END_ALLOW_THREADS } #endif /* !WITH_THREAD */ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void); #endif /* Masks and values used by FORMAT_VALUE opcode. */ #define FVC_MASK 0x3 #define FVC_NONE 0x0 #define FVC_STR 0x1 #define FVC_REPR 0x2 #define FVC_ASCII 0x3 #define FVS_MASK 0x4 #define FVS_HAVE_SPEC 0x4 #ifdef __cplusplus } #endif #endif /* !Py_CEVAL_H */ python3.6m/classobject.h 0000644 00000003202 15063602042 0011131 0 ustar 00 /* Former class object interface -- now only bound methods are here */ /* Revealing some structures (not for general use) */ #ifndef Py_LIMITED_API #ifndef Py_CLASSOBJECT_H #define Py_CLASSOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD PyObject *im_func; /* The callable object implementing the method */ PyObject *im_self; /* The instance it is bound to */ PyObject *im_weakreflist; /* List of weak references */ } PyMethodObject; PyAPI_DATA(PyTypeObject) PyMethod_Type; #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyMethod_GET_FUNCTION(meth) \ (((PyMethodObject *)meth) -> im_func) #define PyMethod_GET_SELF(meth) \ (((PyMethodObject *)meth) -> im_self) PyAPI_FUNC(int) PyMethod_ClearFreeList(void); typedef struct { PyObject_HEAD PyObject *func; } PyInstanceMethodObject; PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; #define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type) PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *); PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyInstanceMethod_GET_FUNCTION(meth) \ (((PyInstanceMethodObject *)meth) -> func) #ifdef __cplusplus } #endif #endif /* !Py_CLASSOBJECT_H */ #endif /* Py_LIMITED_API */ python3.6m/code.h 0000644 00000013471 15063602042 0007560 0 ustar 00 /* Definitions for bytecode */ #ifndef Py_LIMITED_API #ifndef Py_CODE_H #define Py_CODE_H #ifdef __cplusplus extern "C" { #endif typedef uint16_t _Py_CODEUNIT; #ifdef WORDS_BIGENDIAN # define _Py_OPCODE(word) ((word) >> 8) # define _Py_OPARG(word) ((word) & 255) #else # define _Py_OPCODE(word) ((word) & 255) # define _Py_OPARG(word) ((word) >> 8) #endif /* Bytecode object */ typedef struct { PyObject_HEAD int co_argcount; /* #arguments, except *args */ int co_kwonlyargcount; /* #keyword only arguments */ int co_nlocals; /* #local variables */ int co_stacksize; /* #entries needed for evaluation stack */ int co_flags; /* CO_..., see below */ int co_firstlineno; /* first source line number */ PyObject *co_code; /* instruction opcodes */ PyObject *co_consts; /* list (constants used) */ PyObject *co_names; /* list of strings (names used) */ PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ /* The rest aren't used in either hash or comparisons, except for co_name, used in both. This is done to preserve the name and line number for tracebacks and debuggers; otherwise, constant de-duplication would collapse identical functions/lambdas defined on different lines. */ unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */ PyObject *co_filename; /* unicode (where it was loaded from) */ PyObject *co_name; /* unicode (name, for reference) */ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See Objects/lnotab_notes.txt for details. */ void *co_zombieframe; /* for optimization only (see frameobject.c) */ PyObject *co_weakreflist; /* to support weakrefs to code objects */ /* Scratch space for extra data relating to the code object. Type is a void* to keep the format private in codeobject.c to force people to go through the proper APIs. */ void *co_extra; } PyCodeObject; /* Masks for co_flags above */ #define CO_OPTIMIZED 0x0001 #define CO_NEWLOCALS 0x0002 #define CO_VARARGS 0x0004 #define CO_VARKEYWORDS 0x0008 #define CO_NESTED 0x0010 #define CO_GENERATOR 0x0020 /* The CO_NOFREE flag is set if there are no free or cell variables. This information is redundant, but it allows a single flag test to determine whether there is any extra work to be done when the call frame it setup. */ #define CO_NOFREE 0x0040 /* The CO_COROUTINE flag is set for coroutine functions (defined with ``async def`` keywords) */ #define CO_COROUTINE 0x0080 #define CO_ITERABLE_COROUTINE 0x0100 #define CO_ASYNC_GENERATOR 0x0200 /* These are no longer used. */ #if 0 #define CO_GENERATOR_ALLOWED 0x1000 #endif #define CO_FUTURE_DIVISION 0x2000 #define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ #define CO_FUTURE_WITH_STATEMENT 0x8000 #define CO_FUTURE_PRINT_FUNCTION 0x10000 #define CO_FUTURE_UNICODE_LITERALS 0x20000 #define CO_FUTURE_BARRY_AS_BDFL 0x40000 #define CO_FUTURE_GENERATOR_STOP 0x80000 /* This value is found in the co_cell2arg array when the associated cell variable does not correspond to an argument. The maximum number of arguments is 255 (indexed up to 254), so 255 work as a special flag.*/ #define CO_CELL_NOT_AN_ARG 255 /* This should be defined if a future statement modifies the syntax. For example, when a keyword is added. */ #define PY_PARSER_REQUIRES_FUTURE_KEYWORD #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ PyAPI_DATA(PyTypeObject) PyCode_Type; #define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) /* Public interface */ PyAPI_FUNC(PyCodeObject *) PyCode_New( int, int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ /* Creates a new empty code object with the specified source location. */ PyAPI_FUNC(PyCodeObject *) PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); /* Return the line number associated with the specified bytecode index in this code object. If you just need the line number of a frame, use PyFrame_GetLineNumber() instead. */ PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* for internal use only */ typedef struct _addr_pair { int ap_lower; int ap_upper; } PyAddrPair; #ifndef Py_LIMITED_API /* Update *bounds to describe the first and one-past-the-last instructions in the same line as lasti. Return the number of that line. */ PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair *bounds); /* Create a comparable key used to compare constants taking in account the * object type. It is used to make sure types are not coerced (e.g., float and * complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms * * Return (type(obj), obj, ...): a tuple with variable size (at least 2 items) * depending on the type and the value. The type is the first item to not * compare bytes and str which can raise a BytesWarning exception. */ PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj); #endif PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, PyObject *lnotab); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra); PyAPI_FUNC(int) _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra); #endif #ifdef __cplusplus } #endif #endif /* !Py_CODE_H */ #endif /* Py_LIMITED_API */ python3.6m/codecs.h 0000644 00000015211 15063602042 0010100 0 ustar 00 #ifndef Py_CODECREGISTRY_H #define Py_CODECREGISTRY_H #ifdef __cplusplus extern "C" { #endif /* ------------------------------------------------------------------------ Python Codec Registry and support functions Written by Marc-Andre Lemburg (mal@lemburg.com). Copyright (c) Corporation for National Research Initiatives. ------------------------------------------------------------------------ */ /* Register a new codec search function. As side effect, this tries to load the encodings package, if not yet done, to make sure that it is always first in the list of search functions. The search_function's refcount is incremented by this function. */ PyAPI_FUNC(int) PyCodec_Register( PyObject *search_function ); /* Codec registry lookup API. Looks up the given encoding and returns a CodecInfo object with function attributes which implement the different aspects of processing the encoding. The encoding string is looked up converted to all lower-case characters. This makes encodings looked up through this mechanism effectively case-insensitive. If no codec is found, a KeyError is set and NULL returned. As side effect, this tries to load the encodings package, if not yet done. This is part of the lazy load strategy for the encodings package. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyCodec_Lookup( const char *encoding ); PyAPI_FUNC(int) _PyCodec_Forget( const char *encoding ); #endif /* Codec registry encoding check API. Returns 1/0 depending on whether there is a registered codec for the given encoding. */ PyAPI_FUNC(int) PyCodec_KnownEncoding( const char *encoding ); /* Generic codec based encoding API. object is passed through the encoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. Raises a LookupError in case no encoder can be found. */ PyAPI_FUNC(PyObject *) PyCodec_Encode( PyObject *object, const char *encoding, const char *errors ); /* Generic codec based decoding API. object is passed through the decoder function found for the given encoding using the error handling method defined by errors. errors may be NULL to use the default method defined for the codec. Raises a LookupError in case no encoder can be found. */ PyAPI_FUNC(PyObject *) PyCodec_Decode( PyObject *object, const char *encoding, const char *errors ); #ifndef Py_LIMITED_API /* Text codec specific encoding and decoding API. Checks the encoding against a list of codecs which do not implement a str<->bytes encoding before attempting the operation. Please note that these APIs are internal and should not be used in Python C extensions. XXX (ncoghlan): should we make these, or something like them, public in Python 3.5+? */ PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding( const char *encoding, const char *alternate_command ); PyAPI_FUNC(PyObject *) _PyCodec_EncodeText( PyObject *object, const char *encoding, const char *errors ); PyAPI_FUNC(PyObject *) _PyCodec_DecodeText( PyObject *object, const char *encoding, const char *errors ); /* These two aren't actually text encoding specific, but _io.TextIOWrapper * is the only current API consumer. */ PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder( PyObject *codec_info, const char *errors ); PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder( PyObject *codec_info, const char *errors ); #endif /* --- Codec Lookup APIs -------------------------------------------------- All APIs return a codec object with incremented refcount and are based on _PyCodec_Lookup(). The same comments w/r to the encoding name also apply to these APIs. */ /* Get an encoder function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_Encoder( const char *encoding ); /* Get a decoder function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_Decoder( const char *encoding ); /* Get an IncrementalEncoder object for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder( const char *encoding, const char *errors ); /* Get an IncrementalDecoder object function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder( const char *encoding, const char *errors ); /* Get a StreamReader factory function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_StreamReader( const char *encoding, PyObject *stream, const char *errors ); /* Get a StreamWriter factory function for the given encoding. */ PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( const char *encoding, PyObject *stream, const char *errors ); /* Unicode encoding error handling callback registry API */ /* Register the error handling callback function error under the given name. This function will be called by the codec when it encounters unencodable characters/undecodable bytes and doesn't know the callback name, when name is specified as the error parameter in the call to the encode/decode function. Return 0 on success, -1 on error */ PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); /* Lookup the error handling callback function registered under the given name. As a special case NULL can be passed, in which case the error handling callback for "strict" will be returned. */ PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); /* raise exc as an exception */ PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc); /* ignore the unicode error, skipping the faulty input */ PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); /* replace the unicode encode error with ? or U+FFFD */ PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); /* replace the unicode encode error with XML character references */ PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc); #endif #ifndef Py_LIMITED_API PyAPI_DATA(const char *) Py_hexdigits; #endif #ifdef __cplusplus } #endif #endif /* !Py_CODECREGISTRY_H */ python3.6m/compile.h 0000644 00000004164 15063602042 0010275 0 ustar 00 #ifndef Py_COMPILE_H #define Py_COMPILE_H #ifndef Py_LIMITED_API #include "code.h" #ifdef __cplusplus extern "C" { #endif /* Public interface */ struct _node; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); /* Future feature support */ typedef struct { int ff_features; /* flags set by future statements */ int ff_lineno; /* line number of last future statement */ } PyFutureFeatures; #define FUTURE_NESTED_SCOPES "nested_scopes" #define FUTURE_GENERATORS "generators" #define FUTURE_DIVISION "division" #define FUTURE_ABSOLUTE_IMPORT "absolute_import" #define FUTURE_WITH_STATEMENT "with_statement" #define FUTURE_PRINT_FUNCTION "print_function" #define FUTURE_UNICODE_LITERALS "unicode_literals" #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL" #define FUTURE_GENERATOR_STOP "generator_stop" struct _mod; /* Declare the existence of this type */ #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar) PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx( struct _mod *mod, const char *filename, /* decoded from the filesystem encoding */ PyCompilerFlags *flags, int optimize, PyArena *arena); PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject( struct _mod *mod, PyObject *filename, PyCompilerFlags *flags, int optimize, PyArena *arena); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST( struct _mod * mod, const char *filename /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject( struct _mod * mod, PyObject *filename ); /* _Py_Mangle is defined in compile.c */ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); #define PY_INVALID_STACK_EFFECT INT_MAX PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); #ifdef __cplusplus } #endif #endif /* !Py_LIMITED_API */ /* These definitions must match corresponding definitions in graminit.h. There's code in compile.c that checks that they are the same. */ #define Py_single_input 256 #define Py_file_input 257 #define Py_eval_input 258 #endif /* !Py_COMPILE_H */ python3.6m/complexobject.h 0000644 00000003417 15063602042 0011503 0 ustar 00 /* Complex number structure */ #ifndef Py_COMPLEXOBJECT_H #define Py_COMPLEXOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API typedef struct { double real; double imag; } Py_complex; /* Operations on complex numbers from complexmodule.c */ PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); PyAPI_FUNC(double) _Py_c_abs(Py_complex); #endif /* Complex object interface */ /* PyComplexObject represents a complex number with double-precision real and imaginary parts. */ #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD Py_complex cval; } PyComplexObject; #endif PyAPI_DATA(PyTypeObject) PyComplex_Type; #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); #endif PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); #ifndef Py_LIMITED_API PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); #endif /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter( _PyUnicodeWriter *writer, PyObject *obj, PyObject *format_spec, Py_ssize_t start, Py_ssize_t end); #endif #ifdef __cplusplus } #endif #endif /* !Py_COMPLEXOBJECT_H */ python3.6m/datetime.h 0000644 00000022306 15063602042 0010437 0 ustar 00 /* datetime.h */ #ifndef Py_LIMITED_API #ifndef DATETIME_H #define DATETIME_H #ifdef __cplusplus extern "C" { #endif /* Fields are packed into successive bytes, each viewed as unsigned and * big-endian, unless otherwise noted: * * byte offset * 0 year 2 bytes, 1-9999 * 2 month 1 byte, 1-12 * 3 day 1 byte, 1-31 * 4 hour 1 byte, 0-23 * 5 minute 1 byte, 0-59 * 6 second 1 byte, 0-59 * 7 usecond 3 bytes, 0-999999 * 10 */ /* # of bytes for year, month, and day. */ #define _PyDateTime_DATE_DATASIZE 4 /* # of bytes for hour, minute, second, and usecond. */ #define _PyDateTime_TIME_DATASIZE 6 /* # of bytes for year, month, day, hour, minute, second, and usecond. */ #define _PyDateTime_DATETIME_DATASIZE 10 typedef struct { PyObject_HEAD Py_hash_t hashcode; /* -1 when unknown */ int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */ int seconds; /* 0 <= seconds < 24*3600 is invariant */ int microseconds; /* 0 <= microseconds < 1000000 is invariant */ } PyDateTime_Delta; typedef struct { PyObject_HEAD /* a pure abstract base class */ } PyDateTime_TZInfo; /* The datetime and time types have hashcodes, and an optional tzinfo member, * present if and only if hastzinfo is true. */ #define _PyTZINFO_HEAD \ PyObject_HEAD \ Py_hash_t hashcode; \ char hastzinfo; /* boolean flag */ /* No _PyDateTime_BaseTZInfo is allocated; it's just to have something * convenient to cast to, when getting at the hastzinfo member of objects * starting with _PyTZINFO_HEAD. */ typedef struct { _PyTZINFO_HEAD } _PyDateTime_BaseTZInfo; /* All time objects are of PyDateTime_TimeType, but that can be allocated * in two ways, with or without a tzinfo member. Without is the same as * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an * internal struct used to allocate the right amount of space for the * "without" case. */ #define _PyDateTime_TIMEHEAD \ _PyTZINFO_HEAD \ unsigned char data[_PyDateTime_TIME_DATASIZE]; typedef struct { _PyDateTime_TIMEHEAD } _PyDateTime_BaseTime; /* hastzinfo false */ typedef struct { _PyDateTime_TIMEHEAD unsigned char fold; PyObject *tzinfo; } PyDateTime_Time; /* hastzinfo true */ /* All datetime objects are of PyDateTime_DateTimeType, but that can be * allocated in two ways too, just like for time objects above. In addition, * the plain date type is a base class for datetime, so it must also have * a hastzinfo member (although it's unused there). */ typedef struct { _PyTZINFO_HEAD unsigned char data[_PyDateTime_DATE_DATASIZE]; } PyDateTime_Date; #define _PyDateTime_DATETIMEHEAD \ _PyTZINFO_HEAD \ unsigned char data[_PyDateTime_DATETIME_DATASIZE]; typedef struct { _PyDateTime_DATETIMEHEAD } _PyDateTime_BaseDateTime; /* hastzinfo false */ typedef struct { _PyDateTime_DATETIMEHEAD unsigned char fold; PyObject *tzinfo; } PyDateTime_DateTime; /* hastzinfo true */ /* Apply for date and datetime instances. */ #define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \ ((PyDateTime_Date*)o)->data[1]) #define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) #define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) #define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4]) #define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) #define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) #define PyDateTime_DATE_GET_MICROSECOND(o) \ ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ (((PyDateTime_DateTime*)o)->data[8] << 8) | \ ((PyDateTime_DateTime*)o)->data[9]) #define PyDateTime_DATE_GET_FOLD(o) (((PyDateTime_DateTime*)o)->fold) /* Apply for time instances. */ #define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0]) #define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1]) #define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2]) #define PyDateTime_TIME_GET_MICROSECOND(o) \ ((((PyDateTime_Time*)o)->data[3] << 16) | \ (((PyDateTime_Time*)o)->data[4] << 8) | \ ((PyDateTime_Time*)o)->data[5]) #define PyDateTime_TIME_GET_FOLD(o) (((PyDateTime_Time*)o)->fold) /* Apply for time delta instances */ #define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days) #define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds) #define PyDateTime_DELTA_GET_MICROSECONDS(o) \ (((PyDateTime_Delta*)o)->microseconds) /* Define structure for C API. */ typedef struct { /* type objects */ PyTypeObject *DateType; PyTypeObject *DateTimeType; PyTypeObject *TimeType; PyTypeObject *DeltaType; PyTypeObject *TZInfoType; /* constructors */ PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, PyObject*, PyTypeObject*); PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); /* constructors for the DB API */ PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*); PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*); /* PEP 495 constructors */ PyObject *(*DateTime_FromDateAndTimeAndFold)(int, int, int, int, int, int, int, PyObject*, int, PyTypeObject*); PyObject *(*Time_FromTimeAndFold)(int, int, int, int, PyObject*, int, PyTypeObject*); } PyDateTime_CAPI; #define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI" #ifdef Py_BUILD_CORE /* Macros for type checking when building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) #define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) #define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType) #define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType) #define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType) #define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType) #define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType) #define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType) #define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType) #define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType) #else /* Define global variable for the C API and a macro for setting it. */ static PyDateTime_CAPI *PyDateTimeAPI = NULL; #define PyDateTime_IMPORT \ PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0) /* Macros for type checking when not building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) #define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType) #define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType) #define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType) #define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType) #define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType) #define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType) #define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType) #define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) #define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType) /* Macros for accessing constructors in a simplified fashion. */ #define PyDate_FromDate(year, month, day) \ PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) #define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) #define PyDateTime_FromDateAndTimeAndFold(year, month, day, hour, min, sec, usec, fold) \ PyDateTimeAPI->DateTime_FromDateAndTimeAndFold(year, month, day, hour, \ min, sec, usec, Py_None, fold, PyDateTimeAPI->DateTimeType) #define PyTime_FromTime(hour, minute, second, usecond) \ PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ Py_None, PyDateTimeAPI->TimeType) #define PyTime_FromTimeAndFold(hour, minute, second, usecond, fold) \ PyDateTimeAPI->Time_FromTimeAndFold(hour, minute, second, usecond, \ Py_None, fold, PyDateTimeAPI->TimeType) #define PyDelta_FromDSU(days, seconds, useconds) \ PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ PyDateTimeAPI->DeltaType) /* Macros supporting the DB API. */ #define PyDateTime_FromTimestamp(args) \ PyDateTimeAPI->DateTime_FromTimestamp( \ (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL) #define PyDate_FromTimestamp(args) \ PyDateTimeAPI->Date_FromTimestamp( \ (PyObject*) (PyDateTimeAPI->DateType), args) #endif /* Py_BUILD_CORE */ #ifdef __cplusplus } #endif #endif #endif /* !Py_LIMITED_API */ python3.6m/descrobject.h 0000644 00000005624 15063602042 0011136 0 ustar 00 /* Descriptors */ #ifndef Py_DESCROBJECT_H #define Py_DESCROBJECT_H #ifdef __cplusplus extern "C" { #endif typedef PyObject *(*getter)(PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *); typedef struct PyGetSetDef { char *name; getter get; setter set; char *doc; void *closure; } PyGetSetDef; #ifndef Py_LIMITED_API typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, void *wrapped); typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds); struct wrapperbase { char *name; int offset; void *function; wrapperfunc wrapper; char *doc; int flags; PyObject *name_strobj; }; /* Flags for above struct */ #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ /* Various kinds of descriptor objects */ typedef struct { PyObject_HEAD PyTypeObject *d_type; PyObject *d_name; PyObject *d_qualname; } PyDescrObject; #define PyDescr_COMMON PyDescrObject d_common #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) typedef struct { PyDescr_COMMON; PyMethodDef *d_method; } PyMethodDescrObject; typedef struct { PyDescr_COMMON; struct PyMemberDef *d_member; } PyMemberDescrObject; typedef struct { PyDescr_COMMON; PyGetSetDef *d_getset; } PyGetSetDescrObject; typedef struct { PyDescr_COMMON; struct wrapperbase *d_base; void *d_wrapped; /* This can be any function pointer */ } PyWrapperDescrObject; #endif /* Py_LIMITED_API */ PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type; PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; PyAPI_DATA(PyTypeObject) PyDictProxy_Type; #ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; #endif /* Py_LIMITED_API */ PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); struct PyMemberDef; /* forward declaration for following prototype */ PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, struct PyMemberDef *); PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) #endif PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); PyAPI_DATA(PyTypeObject) PyProperty_Type; #ifdef __cplusplus } #endif #endif /* !Py_DESCROBJECT_H */ python3.6m/dictobject.h 0000644 00000016012 15063602042 0010752 0 ustar 00 #ifndef Py_DICTOBJECT_H #define Py_DICTOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Dictionary object type -- mapping from hashable object to object */ /* The distribution includes a separate file, Objects/dictnotes.txt, describing explorations into dictionary design and optimization. It covers typical dictionary use patterns, the parameters for tuning dictionaries, and several ideas for possible optimizations. */ #ifndef Py_LIMITED_API typedef struct _dictkeysobject PyDictKeysObject; /* The ma_values pointer is NULL for a combined table * or points to an array of PyObject* for a split table */ typedef struct { PyObject_HEAD /* Number of items in the dictionary */ Py_ssize_t ma_used; /* Dictionary version: globally unique, value change each time the dictionary is modified */ uint64_t ma_version_tag; PyDictKeysObject *ma_keys; /* If ma_values is NULL, the table is "combined": keys and values are stored in ma_keys. If ma_values is not NULL, the table is splitted: keys are stored in ma_keys and values are stored in ma_values */ PyObject **ma_values; } PyDictObject; typedef struct { PyObject_HEAD PyDictObject *dv_dict; } _PyDictViewObject; #endif /* Py_LIMITED_API */ PyAPI_DATA(PyTypeObject) PyDict_Type; PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; PyAPI_DATA(PyTypeObject) PyDictKeys_Type; PyAPI_DATA(PyTypeObject) PyDictItems_Type; PyAPI_DATA(PyTypeObject) PyDictValues_Type; #define PyDict_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type) #define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type) #define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type) /* This excludes Values, since they are not sets. */ # define PyDictViewSet_Check(op) \ (PyDictKeys_Check(op) || PyDictItems_Check(op)) PyAPI_FUNC(PyObject *) PyDict_New(void); PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key, Py_hash_t hash); #endif PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp, struct _Py_Identifier *key); PyAPI_FUNC(PyObject *) PyDict_SetDefault( PyObject *mp, PyObject *key, PyObject *defaultobj); #endif PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key, PyObject *item, Py_hash_t hash); #endif PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, Py_hash_t hash); PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, int (*predicate)(PyObject *value)); #endif PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); #ifndef Py_LIMITED_API PyDictKeysObject *_PyDict_NewKeysForClass(void); PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *); PyAPI_FUNC(int) _PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash); PyObject *_PyDictView_New(PyObject *, PyTypeObject *); #endif PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash); PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys); Py_ssize_t _PyDict_SizeOf(PyDictObject *); PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *); PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *); PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *); #define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) PyAPI_FUNC(int) PyDict_ClearFreeList(void); #endif /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); /* PyDict_Merge updates/merges from a mapping object (an object that supports PyMapping_Keys() and PyObject_GetItem()). If override is true, the last occurrence of a key wins, else the first. The Python dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). */ PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, PyObject *other, int override); #ifndef Py_LIMITED_API /* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0, the first occurrence of a key wins, if override is 1, the last occurrence of a key wins, if override is 2, a KeyError with conflicting key as argument is raised. */ PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override); PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); #endif /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing iterable objects of length 2. If override is true, the last occurrence of a key wins, else the first. The Python dict constructor dict(seq2) is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). */ PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override); PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key); PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out); int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value); PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *); #endif #ifdef __cplusplus } #endif #endif /* !Py_DICTOBJECT_H */ python3.6m/dtoa.h 0000644 00000000712 15063602042 0007567 0 ustar 00 #ifndef Py_LIMITED_API #ifndef PY_NO_SHORT_FLOAT_REPR #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve); PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); PyAPI_FUNC(double) _Py_dg_stdnan(int sign); PyAPI_FUNC(double) _Py_dg_infinity(int sign); #ifdef __cplusplus } #endif #endif #endif python3.6m/dynamic_annotations.h 0000644 00000053705 15063602042 0012713 0 ustar 00 /* Copyright (c) 2008-2009, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * --- * Author: Kostya Serebryany * Copied to CPython by Jeffrey Yasskin, with all macros renamed to * start with _Py_ to avoid colliding with users embedding Python, and * with deprecated macros removed. */ /* This file defines dynamic annotations for use with dynamic analysis tool such as valgrind, PIN, etc. Dynamic annotation is a source code annotation that affects the generated code (that is, the annotation is not a comment). Each such annotation is attached to a particular instruction and/or to a particular object (address) in the program. The annotations that should be used by users are macros in all upper-case (e.g., _Py_ANNOTATE_NEW_MEMORY). Actual implementation of these macros may differ depending on the dynamic analysis tool being used. See http://code.google.com/p/data-race-test/ for more information. This file supports the following dynamic analysis tools: - None (DYNAMIC_ANNOTATIONS_ENABLED is not defined or zero). Macros are defined empty. - ThreadSanitizer, Helgrind, DRD (DYNAMIC_ANNOTATIONS_ENABLED is 1). Macros are defined as calls to non-inlinable empty functions that are intercepted by Valgrind. */ #ifndef __DYNAMIC_ANNOTATIONS_H__ #define __DYNAMIC_ANNOTATIONS_H__ #ifndef DYNAMIC_ANNOTATIONS_ENABLED # define DYNAMIC_ANNOTATIONS_ENABLED 0 #endif #if DYNAMIC_ANNOTATIONS_ENABLED != 0 /* ------------------------------------------------------------- Annotations useful when implementing condition variables such as CondVar, using conditional critical sections (Await/LockWhen) and when constructing user-defined synchronization mechanisms. The annotations _Py_ANNOTATE_HAPPENS_BEFORE() and _Py_ANNOTATE_HAPPENS_AFTER() can be used to define happens-before arcs in user-defined synchronization mechanisms: the race detector will infer an arc from the former to the latter when they share the same argument pointer. Example 1 (reference counting): void Unref() { _Py_ANNOTATE_HAPPENS_BEFORE(&refcount_); if (AtomicDecrementByOne(&refcount_) == 0) { _Py_ANNOTATE_HAPPENS_AFTER(&refcount_); delete this; } } Example 2 (message queue): void MyQueue::Put(Type *e) { MutexLock lock(&mu_); _Py_ANNOTATE_HAPPENS_BEFORE(e); PutElementIntoMyQueue(e); } Type *MyQueue::Get() { MutexLock lock(&mu_); Type *e = GetElementFromMyQueue(); _Py_ANNOTATE_HAPPENS_AFTER(e); return e; } Note: when possible, please use the existing reference counting and message queue implementations instead of inventing new ones. */ /* Report that wait on the condition variable at address "cv" has succeeded and the lock at address "lock" is held. */ #define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) \ AnnotateCondVarWait(__FILE__, __LINE__, cv, lock) /* Report that wait on the condition variable at "cv" has succeeded. Variant w/o lock. */ #define _Py_ANNOTATE_CONDVAR_WAIT(cv) \ AnnotateCondVarWait(__FILE__, __LINE__, cv, NULL) /* Report that we are about to signal on the condition variable at address "cv". */ #define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) \ AnnotateCondVarSignal(__FILE__, __LINE__, cv) /* Report that we are about to signal_all on the condition variable at "cv". */ #define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \ AnnotateCondVarSignalAll(__FILE__, __LINE__, cv) /* Annotations for user-defined synchronization mechanisms. */ #define _Py_ANNOTATE_HAPPENS_BEFORE(obj) _Py_ANNOTATE_CONDVAR_SIGNAL(obj) #define _Py_ANNOTATE_HAPPENS_AFTER(obj) _Py_ANNOTATE_CONDVAR_WAIT(obj) /* Report that the bytes in the range [pointer, pointer+size) are about to be published safely. The race checker will create a happens-before arc from the call _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) to subsequent accesses to this memory. Note: this annotation may not work properly if the race detector uses sampling, i.e. does not observe all memory accesses. */ #define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \ AnnotatePublishMemoryRange(__FILE__, __LINE__, pointer, size) /* Instruct the tool to create a happens-before arc between mu->Unlock() and mu->Lock(). This annotation may slow down the race detector and hide real races. Normally it is used only when it would be difficult to annotate each of the mutex's critical sections individually using the annotations above. This annotation makes sense only for hybrid race detectors. For pure happens-before detectors this is a no-op. For more details see http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */ #define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) \ AnnotateMutexIsUsedAsCondVar(__FILE__, __LINE__, mu) /* ------------------------------------------------------------- Annotations useful when defining memory allocators, or when memory that was protected in one way starts to be protected in another. */ /* Report that a new memory at "address" of size "size" has been allocated. This might be used when the memory has been retrieved from a free list and is about to be reused, or when the locking discipline for a variable changes. */ #define _Py_ANNOTATE_NEW_MEMORY(address, size) \ AnnotateNewMemory(__FILE__, __LINE__, address, size) /* ------------------------------------------------------------- Annotations useful when defining FIFO queues that transfer data between threads. */ /* Report that the producer-consumer queue (such as ProducerConsumerQueue) at address "pcq" has been created. The _Py_ANNOTATE_PCQ_* annotations should be used only for FIFO queues. For non-FIFO queues use _Py_ANNOTATE_HAPPENS_BEFORE (for put) and _Py_ANNOTATE_HAPPENS_AFTER (for get). */ #define _Py_ANNOTATE_PCQ_CREATE(pcq) \ AnnotatePCQCreate(__FILE__, __LINE__, pcq) /* Report that the queue at address "pcq" is about to be destroyed. */ #define _Py_ANNOTATE_PCQ_DESTROY(pcq) \ AnnotatePCQDestroy(__FILE__, __LINE__, pcq) /* Report that we are about to put an element into a FIFO queue at address "pcq". */ #define _Py_ANNOTATE_PCQ_PUT(pcq) \ AnnotatePCQPut(__FILE__, __LINE__, pcq) /* Report that we've just got an element from a FIFO queue at address "pcq". */ #define _Py_ANNOTATE_PCQ_GET(pcq) \ AnnotatePCQGet(__FILE__, __LINE__, pcq) /* ------------------------------------------------------------- Annotations that suppress errors. It is usually better to express the program's synchronization using the other annotations, but these can be used when all else fails. */ /* Report that we may have a benign race at "pointer", with size "sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the point where "pointer" has been allocated, preferably close to the point where the race happens. See also _Py_ANNOTATE_BENIGN_RACE_STATIC. */ #define _Py_ANNOTATE_BENIGN_RACE(pointer, description) \ AnnotateBenignRaceSized(__FILE__, __LINE__, pointer, \ sizeof(*(pointer)), description) /* Same as _Py_ANNOTATE_BENIGN_RACE(address, description), but applies to the memory range [address, address+size). */ #define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \ AnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description) /* Request the analysis tool to ignore all reads in the current thread until _Py_ANNOTATE_IGNORE_READS_END is called. Useful to ignore intentional racey reads, while still checking other reads and all writes. See also _Py_ANNOTATE_UNPROTECTED_READ. */ #define _Py_ANNOTATE_IGNORE_READS_BEGIN() \ AnnotateIgnoreReadsBegin(__FILE__, __LINE__) /* Stop ignoring reads. */ #define _Py_ANNOTATE_IGNORE_READS_END() \ AnnotateIgnoreReadsEnd(__FILE__, __LINE__) /* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */ #define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() \ AnnotateIgnoreWritesBegin(__FILE__, __LINE__) /* Stop ignoring writes. */ #define _Py_ANNOTATE_IGNORE_WRITES_END() \ AnnotateIgnoreWritesEnd(__FILE__, __LINE__) /* Start ignoring all memory accesses (reads and writes). */ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \ do {\ _Py_ANNOTATE_IGNORE_READS_BEGIN();\ _Py_ANNOTATE_IGNORE_WRITES_BEGIN();\ }while(0)\ /* Stop ignoring all memory accesses. */ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() \ do {\ _Py_ANNOTATE_IGNORE_WRITES_END();\ _Py_ANNOTATE_IGNORE_READS_END();\ }while(0)\ /* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization events: RWLOCK* and CONDVAR*. */ #define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() \ AnnotateIgnoreSyncBegin(__FILE__, __LINE__) /* Stop ignoring sync events. */ #define _Py_ANNOTATE_IGNORE_SYNC_END() \ AnnotateIgnoreSyncEnd(__FILE__, __LINE__) /* Enable (enable!=0) or disable (enable==0) race detection for all threads. This annotation could be useful if you want to skip expensive race analysis during some period of program execution, e.g. during initialization. */ #define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) \ AnnotateEnableRaceDetection(__FILE__, __LINE__, enable) /* ------------------------------------------------------------- Annotations useful for debugging. */ /* Request to trace every access to "address". */ #define _Py_ANNOTATE_TRACE_MEMORY(address) \ AnnotateTraceMemory(__FILE__, __LINE__, address) /* Report the current thread name to a race detector. */ #define _Py_ANNOTATE_THREAD_NAME(name) \ AnnotateThreadName(__FILE__, __LINE__, name) /* ------------------------------------------------------------- Annotations useful when implementing locks. They are not normally needed by modules that merely use locks. The "lock" argument is a pointer to the lock object. */ /* Report that a lock has been created at address "lock". */ #define _Py_ANNOTATE_RWLOCK_CREATE(lock) \ AnnotateRWLockCreate(__FILE__, __LINE__, lock) /* Report that the lock at address "lock" is about to be destroyed. */ #define _Py_ANNOTATE_RWLOCK_DESTROY(lock) \ AnnotateRWLockDestroy(__FILE__, __LINE__, lock) /* Report that the lock at address "lock" has been acquired. is_w=1 for writer lock, is_w=0 for reader lock. */ #define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \ AnnotateRWLockAcquired(__FILE__, __LINE__, lock, is_w) /* Report that the lock at address "lock" is about to be released. */ #define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) \ AnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w) /* ------------------------------------------------------------- Annotations useful when implementing barriers. They are not normally needed by modules that merely use barriers. The "barrier" argument is a pointer to the barrier object. */ /* Report that the "barrier" has been initialized with initial "count". If 'reinitialization_allowed' is true, initialization is allowed to happen multiple times w/o calling barrier_destroy() */ #define _Py_ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \ AnnotateBarrierInit(__FILE__, __LINE__, barrier, count, \ reinitialization_allowed) /* Report that we are about to enter barrier_wait("barrier"). */ #define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \ AnnotateBarrierWaitBefore(__FILE__, __LINE__, barrier) /* Report that we just exited barrier_wait("barrier"). */ #define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) \ AnnotateBarrierWaitAfter(__FILE__, __LINE__, barrier) /* Report that the "barrier" has been destroyed. */ #define _Py_ANNOTATE_BARRIER_DESTROY(barrier) \ AnnotateBarrierDestroy(__FILE__, __LINE__, barrier) /* ------------------------------------------------------------- Annotations useful for testing race detectors. */ /* Report that we expect a race on the variable at "address". Use only in unit tests for a race detector. */ #define _Py_ANNOTATE_EXPECT_RACE(address, description) \ AnnotateExpectRace(__FILE__, __LINE__, address, description) /* A no-op. Insert where you like to test the interceptors. */ #define _Py_ANNOTATE_NO_OP(arg) \ AnnotateNoOp(__FILE__, __LINE__, arg) /* Force the race detector to flush its state. The actual effect depends on * the implementation of the detector. */ #define _Py_ANNOTATE_FLUSH_STATE() \ AnnotateFlushState(__FILE__, __LINE__) #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ #define _Py_ANNOTATE_RWLOCK_CREATE(lock) /* empty */ #define _Py_ANNOTATE_RWLOCK_DESTROY(lock) /* empty */ #define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) /* empty */ #define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) /* empty */ #define _Py_ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) /* */ #define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) /* empty */ #define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) /* empty */ #define _Py_ANNOTATE_BARRIER_DESTROY(barrier) /* empty */ #define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) /* empty */ #define _Py_ANNOTATE_CONDVAR_WAIT(cv) /* empty */ #define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) /* empty */ #define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) /* empty */ #define _Py_ANNOTATE_HAPPENS_BEFORE(obj) /* empty */ #define _Py_ANNOTATE_HAPPENS_AFTER(obj) /* empty */ #define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) /* empty */ #define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) /* empty */ #define _Py_ANNOTATE_SWAP_MEMORY_RANGE(address, size) /* empty */ #define _Py_ANNOTATE_PCQ_CREATE(pcq) /* empty */ #define _Py_ANNOTATE_PCQ_DESTROY(pcq) /* empty */ #define _Py_ANNOTATE_PCQ_PUT(pcq) /* empty */ #define _Py_ANNOTATE_PCQ_GET(pcq) /* empty */ #define _Py_ANNOTATE_NEW_MEMORY(address, size) /* empty */ #define _Py_ANNOTATE_EXPECT_RACE(address, description) /* empty */ #define _Py_ANNOTATE_BENIGN_RACE(address, description) /* empty */ #define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) /* empty */ #define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) /* empty */ #define _Py_ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) /* empty */ #define _Py_ANNOTATE_TRACE_MEMORY(arg) /* empty */ #define _Py_ANNOTATE_THREAD_NAME(name) /* empty */ #define _Py_ANNOTATE_IGNORE_READS_BEGIN() /* empty */ #define _Py_ANNOTATE_IGNORE_READS_END() /* empty */ #define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() /* empty */ #define _Py_ANNOTATE_IGNORE_WRITES_END() /* empty */ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() /* empty */ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() /* empty */ #define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() /* empty */ #define _Py_ANNOTATE_IGNORE_SYNC_END() /* empty */ #define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) /* empty */ #define _Py_ANNOTATE_NO_OP(arg) /* empty */ #define _Py_ANNOTATE_FLUSH_STATE() /* empty */ #endif /* DYNAMIC_ANNOTATIONS_ENABLED */ /* Use the macros above rather than using these functions directly. */ #ifdef __cplusplus extern "C" { #endif void AnnotateRWLockCreate(const char *file, int line, const volatile void *lock); void AnnotateRWLockDestroy(const char *file, int line, const volatile void *lock); void AnnotateRWLockAcquired(const char *file, int line, const volatile void *lock, long is_w); void AnnotateRWLockReleased(const char *file, int line, const volatile void *lock, long is_w); void AnnotateBarrierInit(const char *file, int line, const volatile void *barrier, long count, long reinitialization_allowed); void AnnotateBarrierWaitBefore(const char *file, int line, const volatile void *barrier); void AnnotateBarrierWaitAfter(const char *file, int line, const volatile void *barrier); void AnnotateBarrierDestroy(const char *file, int line, const volatile void *barrier); void AnnotateCondVarWait(const char *file, int line, const volatile void *cv, const volatile void *lock); void AnnotateCondVarSignal(const char *file, int line, const volatile void *cv); void AnnotateCondVarSignalAll(const char *file, int line, const volatile void *cv); void AnnotatePublishMemoryRange(const char *file, int line, const volatile void *address, long size); void AnnotateUnpublishMemoryRange(const char *file, int line, const volatile void *address, long size); void AnnotatePCQCreate(const char *file, int line, const volatile void *pcq); void AnnotatePCQDestroy(const char *file, int line, const volatile void *pcq); void AnnotatePCQPut(const char *file, int line, const volatile void *pcq); void AnnotatePCQGet(const char *file, int line, const volatile void *pcq); void AnnotateNewMemory(const char *file, int line, const volatile void *address, long size); void AnnotateExpectRace(const char *file, int line, const volatile void *address, const char *description); void AnnotateBenignRace(const char *file, int line, const volatile void *address, const char *description); void AnnotateBenignRaceSized(const char *file, int line, const volatile void *address, long size, const char *description); void AnnotateMutexIsUsedAsCondVar(const char *file, int line, const volatile void *mu); void AnnotateTraceMemory(const char *file, int line, const volatile void *arg); void AnnotateThreadName(const char *file, int line, const char *name); void AnnotateIgnoreReadsBegin(const char *file, int line); void AnnotateIgnoreReadsEnd(const char *file, int line); void AnnotateIgnoreWritesBegin(const char *file, int line); void AnnotateIgnoreWritesEnd(const char *file, int line); void AnnotateEnableRaceDetection(const char *file, int line, int enable); void AnnotateNoOp(const char *file, int line, const volatile void *arg); void AnnotateFlushState(const char *file, int line); /* Return non-zero value if running under valgrind. If "valgrind.h" is included into dynamic_annotations.c, the regular valgrind mechanism will be used. See http://valgrind.org/docs/manual/manual-core-adv.html about RUNNING_ON_VALGRIND and other valgrind "client requests". The file "valgrind.h" may be obtained by doing svn co svn://svn.valgrind.org/valgrind/trunk/include If for some reason you can't use "valgrind.h" or want to fake valgrind, there are two ways to make this function return non-zero: - Use environment variable: export RUNNING_ON_VALGRIND=1 - Make your tool intercept the function RunningOnValgrind() and change its return value. */ int RunningOnValgrind(void); #ifdef __cplusplus } #endif #if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus) /* _Py_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads. Instead of doing _Py_ANNOTATE_IGNORE_READS_BEGIN(); ... = x; _Py_ANNOTATE_IGNORE_READS_END(); one can use ... = _Py_ANNOTATE_UNPROTECTED_READ(x); */ template <class T> inline T _Py_ANNOTATE_UNPROTECTED_READ(const volatile T &x) { _Py_ANNOTATE_IGNORE_READS_BEGIN(); T res = x; _Py_ANNOTATE_IGNORE_READS_END(); return res; } /* Apply _Py_ANNOTATE_BENIGN_RACE_SIZED to a static variable. */ #define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \ namespace { \ class static_var ## _annotator { \ public: \ static_var ## _annotator() { \ _Py_ANNOTATE_BENIGN_RACE_SIZED(&static_var, \ sizeof(static_var), \ # static_var ": " description); \ } \ }; \ static static_var ## _annotator the ## static_var ## _annotator;\ } #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ #define _Py_ANNOTATE_UNPROTECTED_READ(x) (x) #define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */ #endif /* DYNAMIC_ANNOTATIONS_ENABLED */ #endif /* __DYNAMIC_ANNOTATIONS_H__ */ python3.6m/enumobject.h 0000644 00000000375 15063602042 0011000 0 ustar 00 #ifndef Py_ENUMOBJECT_H #define Py_ENUMOBJECT_H /* Enumerate Object */ #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyEnum_Type; PyAPI_DATA(PyTypeObject) PyReversed_Type; #ifdef __cplusplus } #endif #endif /* !Py_ENUMOBJECT_H */ python3.6m/errcode.h 0000644 00000002731 15063602042 0010266 0 ustar 00 #ifndef Py_ERRCODE_H #define Py_ERRCODE_H #ifdef __cplusplus extern "C" { #endif /* Error codes passed around between file input, tokenizer, parser and interpreter. This is necessary so we can turn them into Python exceptions at a higher level. Note that some errors have a slightly different meaning when passed from the tokenizer to the parser than when passed from the parser to the interpreter; e.g. the parser only returns E_EOF when it hits EOF immediately, and it never returns E_OK. */ #define E_OK 10 /* No error */ #define E_EOF 11 /* End Of File */ #define E_INTR 12 /* Interrupted */ #define E_TOKEN 13 /* Bad token */ #define E_SYNTAX 14 /* Syntax error */ #define E_NOMEM 15 /* Ran out of memory */ #define E_DONE 16 /* Parsing complete */ #define E_ERROR 17 /* Execution error */ #define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ #define E_OVERFLOW 19 /* Node had too many children */ #define E_TOODEEP 20 /* Too many indentation levels */ #define E_DEDENT 21 /* No matching outer block for dedent */ #define E_DECODE 22 /* Error in decoding into Unicode */ #define E_EOFS 23 /* EOF in triple-quoted string */ #define E_EOLS 24 /* EOL in single-quoted string */ #define E_LINECONT 25 /* Unexpected characters after a line continuation */ #define E_IDENTIFIER 26 /* Invalid characters in identifier */ #define E_BADSINGLE 27 /* Ill-formed single statement input */ #ifdef __cplusplus } #endif #endif /* !Py_ERRCODE_H */ python3.6m/eval.h 0000644 00000001125 15063602042 0007566 0 ustar 00 /* Interface to execute compiled code */ #ifndef Py_EVAL_H #define Py_EVAL_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argc, PyObject **kwds, int kwdc, PyObject **defs, int defc, PyObject *kwdefs, PyObject *closure); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); #endif #ifdef __cplusplus } #endif #endif /* !Py_EVAL_H */ python3.6m/fileobject.h 0000644 00000003163 15063602042 0010751 0 ustar 00 /* File object interface (what's left of it -- see io.py) */ #ifndef Py_FILEOBJECT_H #define Py_FILEOBJECT_H #ifdef __cplusplus extern "C" { #endif #define PY_STDIOTEXTMODE "b" PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int, const char *, const char *, const char *, int); PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); #endif /* The default encoding used by the platform file system APIs If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; #endif PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; /* Internal API The std printer acts as a preliminary sys.stderr until the new io infrastructure is in place. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; #endif /* Py_LIMITED_API */ /* A routine to check if a file descriptor can be select()-ed. */ #ifdef HAVE_SELECT #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE) #else #define _PyIsSelectable_fd(FD) (1) #endif /* HAVE_SELECT */ #ifdef __cplusplus } #endif #endif /* !Py_FILEOBJECT_H */ python3.6m/fileutils.h 0000644 00000006704 15063602042 0010647 0 ustar 00 #ifndef Py_FILEUTILS_H #define Py_FILEUTILS_H #ifdef __cplusplus extern "C" { #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(wchar_t *) Py_DecodeLocale( const char *arg, size_t *size); PyAPI_FUNC(char*) Py_EncodeLocale( const wchar_t *text, size_t *error_pos); #endif #ifndef Py_LIMITED_API PyAPI_FUNC(wchar_t *) _Py_DecodeLocaleEx( const char *arg, size_t *size, int current_locale); PyAPI_FUNC(char*) _Py_EncodeLocaleEx( const wchar_t *text, size_t *error_pos, int current_locale); PyAPI_FUNC(PyObject *) _Py_device_encoding(int); #if defined(MS_WINDOWS) || defined(__APPLE__) /* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611). On macOS 10.13, read() and write() with more than INT_MAX bytes fail with EINVAL (bpo-24658). */ # define _PY_READ_MAX INT_MAX # define _PY_WRITE_MAX INT_MAX #else /* write() should truncate the input to PY_SSIZE_T_MAX bytes, but it's safer to do it ourself to have a portable behaviour */ # define _PY_READ_MAX PY_SSIZE_T_MAX # define _PY_WRITE_MAX PY_SSIZE_T_MAX #endif #ifdef MS_WINDOWS struct _Py_stat_struct { unsigned long st_dev; uint64_t st_ino; unsigned short st_mode; int st_nlink; int st_uid; int st_gid; unsigned long st_rdev; __int64 st_size; time_t st_atime; int st_atime_nsec; time_t st_mtime; int st_mtime_nsec; time_t st_ctime; int st_ctime_nsec; unsigned long st_file_attributes; }; #else # define _Py_stat_struct stat #endif PyAPI_FUNC(int) _Py_fstat( int fd, struct _Py_stat_struct *status); PyAPI_FUNC(int) _Py_fstat_noraise( int fd, struct _Py_stat_struct *status); PyAPI_FUNC(int) _Py_stat( PyObject *path, struct stat *status); PyAPI_FUNC(int) _Py_open( const char *pathname, int flags); PyAPI_FUNC(int) _Py_open_noraise( const char *pathname, int flags); PyAPI_FUNC(FILE *) _Py_wfopen( const wchar_t *path, const wchar_t *mode); PyAPI_FUNC(FILE*) _Py_fopen( const char *pathname, const char *mode); PyAPI_FUNC(FILE*) _Py_fopen_obj( PyObject *path, const char *mode); PyAPI_FUNC(Py_ssize_t) _Py_read( int fd, void *buf, size_t count); PyAPI_FUNC(Py_ssize_t) _Py_write( int fd, const void *buf, size_t count); PyAPI_FUNC(Py_ssize_t) _Py_write_noraise( int fd, const void *buf, size_t count); #ifdef HAVE_READLINK PyAPI_FUNC(int) _Py_wreadlink( const wchar_t *path, wchar_t *buf, size_t bufsiz); #endif #ifdef HAVE_REALPATH PyAPI_FUNC(wchar_t*) _Py_wrealpath( const wchar_t *path, wchar_t *resolved_path, size_t resolved_path_size); #endif PyAPI_FUNC(wchar_t*) _Py_wgetcwd( wchar_t *buf, size_t size); PyAPI_FUNC(int) _Py_get_inheritable(int fd); PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable, int *atomic_flag_works); PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable, int *atomic_flag_works); PyAPI_FUNC(int) _Py_dup(int fd); #ifndef MS_WINDOWS PyAPI_FUNC(int) _Py_get_blocking(int fd); PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); #endif /* !MS_WINDOWS */ PyAPI_FUNC(int) _Py_GetLocaleconvNumeric( PyObject **decimal_point, PyObject **thousands_sep, const char **grouping); #endif /* Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_FILEUTILS_H */ python3.6m/floatobject.h 0000644 00000011272 15063602042 0011137 0 ustar 00 /* Float object interface */ /* PyFloatObject represents a (double precision) floating point number. */ #ifndef Py_FLOATOBJECT_H #define Py_FLOATOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD double ob_fval; } PyFloatObject; #endif PyAPI_DATA(PyTypeObject) PyFloat_Type; #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) #define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) #ifdef Py_NAN #define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) #endif #define Py_RETURN_INF(sign) do \ if (copysign(1., sign) == 1.) { \ return PyFloat_FromDouble(Py_HUGE_VAL); \ } else { \ return PyFloat_FromDouble(-Py_HUGE_VAL); \ } while(0) PyAPI_FUNC(double) PyFloat_GetMax(void); PyAPI_FUNC(double) PyFloat_GetMin(void); PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void); /* Return Python float from string PyObject. */ PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*); /* Return Python float from C double. */ PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); /* Extract C double from Python float. The macro version trades safety for speed. */ PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); #ifndef Py_LIMITED_API #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) #endif #ifndef Py_LIMITED_API /* _PyFloat_{Pack,Unpack}{4,8} * * The struct and pickle (at least) modules need an efficient platform- * independent way to store floating-point values as byte strings. * The Pack routines produce a string from a C double, and the Unpack * routines produce a C double from such a string. The suffix (4 or 8) * specifies the number of bytes in the string. * * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats * these functions work by copying bits. On other platforms, the formats the * 4- byte format is identical to the IEEE-754 single precision format, and * the 8-byte format to the IEEE-754 double precision format, although the * packing of INFs and NaNs (if such things exist on the platform) isn't * handled correctly, and attempting to unpack a string containing an IEEE * INF or NaN will raise an exception. * * On non-IEEE platforms with more precision, or larger dynamic range, than * 754 supports, not all values can be packed; on non-IEEE platforms with less * precision, or smaller dynamic range, not all values can be unpacked. What * happens in such cases is partly accidental (alas). */ /* The pack routines write 2, 4 or 8 bytes, starting at p. le is a bool * argument, true if you want the string in little-endian format (exponent * last, at p+1, p+3 or p+7), false if you want big-endian format (exponent * first, at p). * Return value: 0 if all is OK, -1 if error (and an exception is * set, most likely OverflowError). * There are two problems on non-IEEE platforms: * 1): What this does is undefined if x is a NaN or infinity. * 2): -0.0 and +0.0 produce the same string. */ PyAPI_FUNC(int) _PyFloat_Pack2(double x, unsigned char *p, int le); PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); /* Needed for the old way for marshal to store a floating point number. Returns the string length copied into p, -1 on error. */ PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len); /* Used to get the important decimal digits of a double */ PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum); PyAPI_FUNC(void) _PyFloat_DigitsInit(void); /* The unpack routines read 2, 4 or 8 bytes, starting at p. le is a bool * argument, true if the string is in little-endian format (exponent * last, at p+1, p+3 or p+7), false if big-endian (exponent first, at p). * Return value: The unpacked double. On error, this is -1.0 and * PyErr_Occurred() is true (and an exception is set, most likely * OverflowError). Note that on a non-IEEE platform this will refuse * to unpack a string that represents a NaN or infinity. */ PyAPI_FUNC(double) _PyFloat_Unpack2(const unsigned char *p, int le); PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); /* free list api */ PyAPI_FUNC(int) PyFloat_ClearFreeList(void); PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter( _PyUnicodeWriter *writer, PyObject *obj, PyObject *format_spec, Py_ssize_t start, Py_ssize_t end); #endif /* Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_FLOATOBJECT_H */ python3.6m/frameobject.h 0000644 00000006712 15063602042 0011127 0 ustar 00 /* Frame object interface */ #ifndef Py_LIMITED_API #ifndef Py_FRAMEOBJECT_H #define Py_FRAMEOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { int b_type; /* what kind of block this is */ int b_handler; /* where to jump to find handler */ int b_level; /* value stack level to pop to */ } PyTryBlock; typedef struct _frame { PyObject_VAR_HEAD struct _frame *f_back; /* previous frame, or NULL */ PyCodeObject *f_code; /* code segment */ PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ PyObject *f_globals; /* global symbol table (PyDictObject) */ PyObject *f_locals; /* local symbol table (any mapping) */ PyObject **f_valuestack; /* points after the last local */ /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. Frame evaluation usually NULLs it, but a frame that yields sets it to the current stack top. */ PyObject **f_stacktop; PyObject *f_trace; /* Trace function */ /* In a generator, we need to be able to swap between the exception state inside the generator and the exception state of the calling frame (which shouldn't be impacted when the generator "yields" from an except handler). These three fields exist exactly for that, and are unused for non-generator frames. See the save_exc_state and swap_exc_state functions in ceval.c for details of their use. */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; /* Borrowed reference to a generator, or NULL */ PyObject *f_gen; int f_lasti; /* Last instruction if called */ /* Call PyFrame_GetLineNumber() instead of reading this field directly. As of 2.3 f_lineno is only valid when tracing is active (i.e. when f_trace is set). At other times we use PyCode_Addr2Line to calculate the line from the current bytecode index. */ int f_lineno; /* Current line number */ int f_iblock; /* index in f_blockstack */ char f_executing; /* whether the frame is still executing */ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ } PyFrameObject; /* Standard object interface */ PyAPI_DATA(PyTypeObject) PyFrame_Type; #define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); /* The rest of the interface is specific for frame objects */ /* Block management functions */ PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); /* Extend the value stack */ PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); /* Conversions between "fast locals" and locals in dictionary */ PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f); PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); PyAPI_FUNC(int) PyFrame_ClearFreeList(void); PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out); /* Return the line of code the frame is currently executing. */ PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); #ifdef __cplusplus } #endif #endif /* !Py_FRAMEOBJECT_H */ #endif /* Py_LIMITED_API */ python3.6m/funcobject.h 0000644 00000007757 15063602042 0011002 0 ustar 00 /* Function object interface */ #ifndef Py_LIMITED_API #ifndef Py_FUNCOBJECT_H #define Py_FUNCOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Function objects and code objects should not be confused with each other: * * Function objects are created by the execution of the 'def' statement. * They reference a code object in their __code__ attribute, which is a * purely syntactic object, i.e. nothing more than a compiled version of some * source code lines. There is one code object per source code "fragment", * but each code object can be referenced by zero or many function objects * depending only on how many times the 'def' statement in the source was * executed so far. */ typedef struct { PyObject_HEAD PyObject *func_code; /* A code object, the __code__ attribute */ PyObject *func_globals; /* A dictionary (other mappings won't do) */ PyObject *func_defaults; /* NULL or a tuple */ PyObject *func_kwdefaults; /* NULL or a dict */ PyObject *func_closure; /* NULL or a tuple of cell objects */ PyObject *func_doc; /* The __doc__ attribute, can be anything */ PyObject *func_name; /* The __name__ attribute, a string object */ PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ PyObject *func_weakreflist; /* List of weak references */ PyObject *func_module; /* The __module__ attribute, can be anything */ PyObject *func_annotations; /* Annotations, a dict or NULL */ PyObject *func_qualname; /* The qualified name */ /* Invariant: * func_closure contains the bindings for func_code->co_freevars, so * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). */ } PyFunctionObject; PyAPI_DATA(PyTypeObject) PyFunction_Type; #define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *); PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict( PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); PyAPI_FUNC(PyObject *) _PyFunction_FastCallKeywords( PyObject *func, PyObject **stack, Py_ssize_t nargs, PyObject *kwnames); #endif /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #define PyFunction_GET_CODE(func) \ (((PyFunctionObject *)func) -> func_code) #define PyFunction_GET_GLOBALS(func) \ (((PyFunctionObject *)func) -> func_globals) #define PyFunction_GET_MODULE(func) \ (((PyFunctionObject *)func) -> func_module) #define PyFunction_GET_DEFAULTS(func) \ (((PyFunctionObject *)func) -> func_defaults) #define PyFunction_GET_KW_DEFAULTS(func) \ (((PyFunctionObject *)func) -> func_kwdefaults) #define PyFunction_GET_CLOSURE(func) \ (((PyFunctionObject *)func) -> func_closure) #define PyFunction_GET_ANNOTATIONS(func) \ (((PyFunctionObject *)func) -> func_annotations) /* The classmethod and staticmethod types lives here, too */ PyAPI_DATA(PyTypeObject) PyClassMethod_Type; PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_FUNCOBJECT_H */ #endif /* Py_LIMITED_API */ python3.6m/genobject.h 0000644 00000006777 15063602042 0010621 0 ustar 00 /* Generator object interface */ #ifndef Py_LIMITED_API #ifndef Py_GENOBJECT_H #define Py_GENOBJECT_H #ifdef __cplusplus extern "C" { #endif struct _frame; /* Avoid including frameobject.h */ /* _PyGenObject_HEAD defines the initial segment of generator and coroutine objects. */ #define _PyGenObject_HEAD(prefix) \ PyObject_HEAD \ /* Note: gi_frame can be NULL if the generator is "finished" */ \ struct _frame *prefix##_frame; \ /* True if generator is being executed. */ \ char prefix##_running; \ /* The code object backing the generator */ \ PyObject *prefix##_code; \ /* List of weak reference. */ \ PyObject *prefix##_weakreflist; \ /* Name of the generator. */ \ PyObject *prefix##_name; \ /* Qualified name of the generator. */ \ PyObject *prefix##_qualname; typedef struct { /* The gi_ prefix is intended to remind of generator-iterator. */ _PyGenObject_HEAD(gi) } PyGenObject; PyAPI_DATA(PyTypeObject) PyGen_Type; #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) #define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *, PyObject *name, PyObject *qualname); PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *); PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); PyAPI_FUNC(PyObject *) _PyGen_Send(PyGenObject *, PyObject *); PyObject *_PyGen_yf(PyGenObject *); PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self); #ifndef Py_LIMITED_API typedef struct { _PyGenObject_HEAD(cr) } PyCoroObject; PyAPI_DATA(PyTypeObject) PyCoro_Type; PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type; PyAPI_DATA(PyTypeObject) _PyAIterWrapper_Type; PyObject *_PyAIterWrapper_New(PyObject *aiter); #define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type) PyObject *_PyCoro_GetAwaitableIter(PyObject *o); PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *, PyObject *name, PyObject *qualname); /* Asynchronous Generators */ typedef struct { _PyGenObject_HEAD(ag) PyObject *ag_finalizer; /* Flag is set to 1 when hooks set up by sys.set_asyncgen_hooks were called on the generator, to avoid calling them more than once. */ int ag_hooks_inited; /* Flag is set to 1 when aclose() is called for the first time, or when a StopAsyncIteration exception is raised. */ int ag_closed; } PyAsyncGenObject; PyAPI_DATA(PyTypeObject) PyAsyncGen_Type; PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type; PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type; PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type; PyAPI_FUNC(PyObject *) PyAsyncGen_New(struct _frame *, PyObject *name, PyObject *qualname); #define PyAsyncGen_CheckExact(op) (Py_TYPE(op) == &PyAsyncGen_Type) PyObject *_PyAsyncGenValueWrapperNew(PyObject *); int PyAsyncGen_ClearFreeLists(void); #endif #undef _PyGenObject_HEAD #ifdef __cplusplus } #endif #endif /* !Py_GENOBJECT_H */ #endif /* Py_LIMITED_API */ python3.6m/graminit.h 0000644 00000003656 15063602042 0010464 0 ustar 00 /* Generated by Parser/pgen */ #define single_input 256 #define file_input 257 #define eval_input 258 #define decorator 259 #define decorators 260 #define decorated 261 #define async_funcdef 262 #define funcdef 263 #define parameters 264 #define typedargslist 265 #define tfpdef 266 #define varargslist 267 #define vfpdef 268 #define stmt 269 #define simple_stmt 270 #define small_stmt 271 #define expr_stmt 272 #define annassign 273 #define testlist_star_expr 274 #define augassign 275 #define del_stmt 276 #define pass_stmt 277 #define flow_stmt 278 #define break_stmt 279 #define continue_stmt 280 #define return_stmt 281 #define yield_stmt 282 #define raise_stmt 283 #define import_stmt 284 #define import_name 285 #define import_from 286 #define import_as_name 287 #define dotted_as_name 288 #define import_as_names 289 #define dotted_as_names 290 #define dotted_name 291 #define global_stmt 292 #define nonlocal_stmt 293 #define assert_stmt 294 #define compound_stmt 295 #define async_stmt 296 #define if_stmt 297 #define while_stmt 298 #define for_stmt 299 #define try_stmt 300 #define with_stmt 301 #define with_item 302 #define except_clause 303 #define suite 304 #define test 305 #define test_nocond 306 #define lambdef 307 #define lambdef_nocond 308 #define or_test 309 #define and_test 310 #define not_test 311 #define comparison 312 #define comp_op 313 #define star_expr 314 #define expr 315 #define xor_expr 316 #define and_expr 317 #define shift_expr 318 #define arith_expr 319 #define term 320 #define factor 321 #define power 322 #define atom_expr 323 #define atom 324 #define testlist_comp 325 #define trailer 326 #define subscriptlist 327 #define subscript 328 #define sliceop 329 #define exprlist 330 #define testlist 331 #define dictorsetmaker 332 #define classdef 333 #define arglist 334 #define argument 335 #define comp_iter 336 #define comp_for 337 #define comp_if 338 #define encoding_decl 339 #define yield_expr 340 #define yield_arg 341 python3.6m/grammar.h 0000644 00000004032 15063602042 0010265 0 ustar 00 /* Grammar interface */ #ifndef Py_GRAMMAR_H #define Py_GRAMMAR_H #ifdef __cplusplus extern "C" { #endif #include "bitset.h" /* Sigh... */ /* A label of an arc */ typedef struct { int lb_type; char *lb_str; } label; #define EMPTY 0 /* Label number 0 is by definition the empty label */ /* A list of labels */ typedef struct { int ll_nlabels; label *ll_label; } labellist; /* An arc from one state to another */ typedef struct { short a_lbl; /* Label of this arc */ short a_arrow; /* State where this arc goes to */ } arc; /* A state in a DFA */ typedef struct { int s_narcs; arc *s_arc; /* Array of arcs */ /* Optional accelerators */ int s_lower; /* Lowest label index */ int s_upper; /* Highest label index */ int *s_accel; /* Accelerator */ int s_accept; /* Nonzero for accepting state */ } state; /* A DFA */ typedef struct { int d_type; /* Non-terminal this represents */ char *d_name; /* For printing */ int d_initial; /* Initial state */ int d_nstates; state *d_state; /* Array of states */ bitset d_first; } dfa; /* A grammar */ typedef struct { int g_ndfas; dfa *g_dfa; /* Array of DFAs */ labellist g_ll; int g_start; /* Start symbol of the grammar */ int g_accel; /* Set if accelerators present */ } grammar; /* FUNCTIONS */ grammar *newgrammar(int start); void freegrammar(grammar *g); dfa *adddfa(grammar *g, int type, const char *name); int addstate(dfa *d); void addarc(dfa *d, int from, int to, int lbl); dfa *PyGrammar_FindDFA(grammar *g, int type); int addlabel(labellist *ll, int type, const char *str); int findlabel(labellist *ll, int type, const char *str); const char *PyGrammar_LabelRepr(label *lb); void translatelabels(grammar *g); void addfirstsets(grammar *g); void PyGrammar_AddAccelerators(grammar *g); void PyGrammar_RemoveAccelerators(grammar *); void printgrammar(grammar *g, FILE *fp); void printnonterminals(grammar *g, FILE *fp); #ifdef __cplusplus } #endif #endif /* !Py_GRAMMAR_H */ python3.6m/import.h 0000644 00000010211 15063602042 0010145 0 ustar 00 /* Module definition and import interface */ #ifndef Py_IMPORT_H #define Py_IMPORT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyImportZip_Init(void); PyMODINIT_FUNC PyInit_imp(void); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( const char *name, /* UTF-8 encoded string */ PyObject *co ); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( const char *name, /* UTF-8 encoded string */ PyObject *co, const char *pathname /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames( const char *name, /* UTF-8 encoded string */ PyObject *co, const char *pathname, /* decoded from the filesystem encoding */ const char *cpathname /* decoded from the filesystem encoding */ ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname ); #endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); #endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyImport_ImportModule( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel( const char *name, /* UTF-8 encoded string */ PyObject *globals, PyObject *locals, PyObject *fromlist, int level ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level ); #endif #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, 0) PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); PyAPI_FUNC(void) PyImport_Cleanup(void); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( PyObject *name ); #endif PyAPI_FUNC(int) PyImport_ImportFrozenModule( const char *name /* UTF-8 encoded string */ ); #ifndef Py_LIMITED_API #ifdef WITH_THREAD PyAPI_FUNC(void) _PyImport_AcquireLock(void); PyAPI_FUNC(int) _PyImport_ReleaseLock(void); #else #define _PyImport_AcquireLock() #define _PyImport_ReleaseLock() 1 #endif PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); PyAPI_FUNC(int) _PyImport_FixupBuiltin( PyObject *mod, const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *); struct _inittab { const char *name; /* ASCII encoded string */ PyObject* (*initfunc)(void); }; PyAPI_DATA(struct _inittab *) PyImport_Inittab; PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); #endif /* Py_LIMITED_API */ PyAPI_DATA(PyTypeObject) PyNullImporter_Type; PyAPI_FUNC(int) PyImport_AppendInittab( const char *name, /* ASCII encoded string */ PyObject* (*initfunc)(void) ); #ifndef Py_LIMITED_API struct _frozen { const char *name; /* ASCII encoded string */ const unsigned char *code; int size; }; /* Embedding apps may change this pointer to point to their favorite collection of frozen modules: */ PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules; #endif #ifdef __cplusplus } #endif #endif /* !Py_IMPORT_H */ python3.6m/intrcheck.h 0000644 00000001001 15063602042 0010602 0 ustar 00 #ifndef Py_INTRCHECK_H #define Py_INTRCHECK_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(int) PyOS_InterruptOccurred(void); PyAPI_FUNC(void) PyOS_InitInterrupts(void); PyAPI_FUNC(void) PyOS_AfterFork(void); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyOS_IsMainThread(void); #ifdef MS_WINDOWS /* windows.h is not included by Python.h so use void* instead of HANDLE */ PyAPI_FUNC(void*) _PyOS_SigintEvent(void); #endif #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_INTRCHECK_H */ python3.6m/iterobject.h 0000644 00000001067 15063602042 0010776 0 ustar 00 #ifndef Py_ITEROBJECT_H #define Py_ITEROBJECT_H /* Iterators (the basic kind, over a sequence) */ #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PySeqIter_Type; PyAPI_DATA(PyTypeObject) PyCallIter_Type; PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type; #define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); #define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_ITEROBJECT_H */ python3.6m/listobject.h 0000644 00000005524 15063602042 0011010 0 ustar 00 /* List object interface */ /* Another generally useful object type is a list of object pointers. This is a mutable type: the list items can be changed, and items can be added or removed. Out-of-range indices or non-list objects are ignored. *** WARNING *** PyList_SetItem does not increment the new item's reference count, but does decrement the reference count of the item it replaces, if not nil. It does *decrement* the reference count if it is *not* inserted in the list. Similarly, PyList_GetItem does not increment the returned item's reference count. */ #ifndef Py_LISTOBJECT_H #define Py_LISTOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API typedef struct { PyObject_VAR_HEAD /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ PyObject **ob_item; /* ob_item contains space for 'allocated' elements. The number * currently in use is ob_size. * Invariants: * 0 <= ob_size <= allocated * len(list) == ob_size * ob_item == NULL implies ob_size == allocated == 0 * list.sort() temporarily sets allocated to -1 to detect mutations. * * Items must normally not be NULL, except during construction when * the list is not yet visible outside the function that builds it. */ Py_ssize_t allocated; } PyListObject; #endif PyAPI_DATA(PyTypeObject) PyList_Type; PyAPI_DATA(PyTypeObject) PyListIter_Type; PyAPI_DATA(PyTypeObject) PyListRevIter_Type; PyAPI_DATA(PyTypeObject) PySortWrapper_Type; #define PyList_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) #define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Sort(PyObject *); PyAPI_FUNC(int) PyList_Reverse(PyObject *); PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); PyAPI_FUNC(int) PyList_ClearFreeList(void); PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); #endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) #define PyList_GET_SIZE(op) Py_SIZE(op) #define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item) #endif #ifdef __cplusplus } #endif #endif /* !Py_LISTOBJECT_H */ python3.6m/longintrepr.h 0000644 00000007261 15063602042 0011211 0 ustar 00 #ifndef Py_LIMITED_API #ifndef Py_LONGINTREPR_H #define Py_LONGINTREPR_H #ifdef __cplusplus extern "C" { #endif /* This is published for the benefit of "friends" marshal.c and _decimal.c. */ /* Parameters of the integer representation. There are two different sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit integer type, and one set for 15-bit digits with each digit stored in an unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at configure time or in pyport.h, is used to decide which digit size to use. Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' should be an unsigned integer type able to hold all integers up to PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, and that overflow is handled by taking the result modulo 2**N for some N > PyLong_SHIFT. The majority of the code doesn't care about the precise value of PyLong_SHIFT, but there are some notable exceptions: - long_pow() requires that PyLong_SHIFT be divisible by 5 - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 - long_hash() requires that PyLong_SHIFT is *strictly* less than the number of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) conversion functions - the Python int <-> size_t/Py_ssize_t conversion functions expect that PyLong_SHIFT is strictly less than the number of bits in a size_t - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 - NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single digit; with the current values this forces PyLong_SHIFT >= 9 The values 15 and 30 should fit all of the above requirements, on any platform. */ #if PYLONG_BITS_IN_DIGIT == 30 typedef uint32_t digit; typedef int32_t sdigit; /* signed variant of digit */ typedef uint64_t twodigits; typedef int64_t stwodigits; /* signed variant of twodigits */ #define PyLong_SHIFT 30 #define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ #define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ #elif PYLONG_BITS_IN_DIGIT == 15 typedef unsigned short digit; typedef short sdigit; /* signed variant of digit */ typedef unsigned long twodigits; typedef long stwodigits; /* signed variant of twodigits */ #define PyLong_SHIFT 15 #define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ #define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ #else #error "PYLONG_BITS_IN_DIGIT should be 15 or 30" #endif #define PyLong_BASE ((digit)1 << PyLong_SHIFT) #define PyLong_MASK ((digit)(PyLong_BASE - 1)) #if PyLong_SHIFT % 5 != 0 #error "longobject.c requires that PyLong_SHIFT be divisible by 5" #endif /* Long integer representation. The absolute value of a number is equal to SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) Negative numbers are represented with ob_size < 0; zero is represented by ob_size == 0. In a normalized number, ob_digit[abs(ob_size)-1] (the most significant digit) is never zero. Also, in all cases, for all valid i, 0 <= ob_digit[i] <= MASK. The allocation function takes care of allocating extra memory so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. CAUTION: Generic code manipulating subtypes of PyVarObject has to aware that ints abuse ob_size's sign bit. */ struct _longobject { PyObject_VAR_HEAD digit ob_digit[1]; }; PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); /* Return a copy of src. */ PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); #ifdef __cplusplus } #endif #endif /* !Py_LONGINTREPR_H */ #endif /* Py_LIMITED_API */ python3.6m/longobject.h 0000644 00000023146 15063602042 0010774 0 ustar 00 #ifndef Py_LONGOBJECT_H #define Py_LONGOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Long (arbitrary precision) integer object interface */ typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ PyAPI_DATA(PyTypeObject) PyLong_Type; #define PyLong_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) #define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type) PyAPI_FUNC(PyObject *) PyLong_FromLong(long); PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long); PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t); PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t); PyAPI_FUNC(PyObject *) PyLong_FromDouble(double); PyAPI_FUNC(long) PyLong_AsLong(PyObject *); PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *); PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *); PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyLong_AsInt(PyObject *); #endif PyAPI_FUNC(PyObject *) PyLong_GetInfo(void); /* It may be useful in the future. I've added it in the PyInt -> PyLong cleanup to keep the extra information. [CH] */ #define PyLong_AS_LONG(op) PyLong_AsLong(op) /* Issue #1983: pid_t can be longer than a C long on some systems */ #if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT #define _Py_PARSE_PID "i" #define PyLong_FromPid PyLong_FromLong #define PyLong_AsPid PyLong_AsLong #elif SIZEOF_PID_T == SIZEOF_LONG #define _Py_PARSE_PID "l" #define PyLong_FromPid PyLong_FromLong #define PyLong_AsPid PyLong_AsLong #elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG #define _Py_PARSE_PID "L" #define PyLong_FromPid PyLong_FromLongLong #define PyLong_AsPid PyLong_AsLongLong #else #error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)" #endif /* SIZEOF_PID_T */ #if SIZEOF_VOID_P == SIZEOF_INT # define _Py_PARSE_INTPTR "i" # define _Py_PARSE_UINTPTR "I" #elif SIZEOF_VOID_P == SIZEOF_LONG # define _Py_PARSE_INTPTR "l" # define _Py_PARSE_UINTPTR "k" #elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG # define _Py_PARSE_INTPTR "L" # define _Py_PARSE_UINTPTR "K" #else # error "void* different in size from int, long and long long" #endif /* SIZEOF_VOID_P */ /* Used by Python/mystrtoul.c, _PyBytes_FromHex(), _PyBytes_DecodeEscapeRecode(), etc. */ #ifndef Py_LIMITED_API PyAPI_DATA(unsigned char) _PyLong_DigitValue[256]; #endif /* _PyLong_Frexp returns a double x and an exponent e such that the true value is approximately equal to x * 2**e. e is >= 0. x is 0.0 if and only if the input is 0 (in which case, e and x are both zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is possible if the number of bits doesn't fit into a Py_ssize_t, sets OverflowError and returns -1.0 for x, 0 for e. */ #ifndef Py_LIMITED_API PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e); #endif PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); PyAPI_FUNC(PyObject *) PyLong_FromLongLong(long long); PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned long long); PyAPI_FUNC(long long) PyLong_AsLongLong(PyObject *); PyAPI_FUNC(unsigned long long) PyLong_AsUnsignedLongLong(PyObject *); PyAPI_FUNC(unsigned long long) PyLong_AsUnsignedLongLongMask(PyObject *); PyAPI_FUNC(long long) PyLong_AsLongLongAndOverflow(PyObject *, int *); PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base); PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int); #endif #ifndef Py_LIMITED_API /* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0. v must not be NULL, and must be a normalized long. There are no error cases. */ PyAPI_FUNC(int) _PyLong_Sign(PyObject *v); /* _PyLong_NumBits. Return the number of bits needed to represent the absolute value of a long. For example, this returns 1 for 1 and -1, 2 for 2 and -2, and 2 for 3 and -3. It returns 0 for 0. v must not be NULL, and must be a normalized long. (size_t)-1 is returned and OverflowError set if the true result doesn't fit in a size_t. */ PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v); /* _PyLong_DivmodNear. Given integers a and b, compute the nearest integer q to the exact quotient a / b, rounding to the nearest even integer in the case of a tie. Return (q, r), where r = a - q*b. The remainder r will satisfy abs(r) <= abs(b)/2, with equality possible only if q is even. */ PyAPI_FUNC(PyObject *) _PyLong_DivmodNear(PyObject *, PyObject *); /* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in base 256, and return a Python int with the same numeric value. If n is 0, the integer is 0. Else: If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB; else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the LSB. If is_signed is 0/false, view the bytes as a non-negative integer. If is_signed is 1/true, view the bytes as a 2's-complement integer, non-negative if bit 0x80 of the MSB is clear, negative if set. Error returns: + Return NULL with the appropriate exception set if there's not enough memory to create the Python int. */ PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( const unsigned char* bytes, size_t n, int little_endian, int is_signed); /* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long v to a base-256 integer, stored in array bytes. Normally return 0, return -1 on error. If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and the LSB at bytes[n-1]. If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes are filled and there's nothing special about bit 0x80 of the MSB. If is_signed is 1/true, bytes is filled with the 2's-complement representation of v's value. Bit 0x80 of the MSB is the sign bit. Error returns (-1): + is_signed is 0 and v < 0. TypeError is set in this case, and bytes isn't altered. + n isn't big enough to hold the full mathematical value of v. For example, if is_signed is 0 and there are more digits in the v than fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of being large enough to hold a sign bit. OverflowError is set in this case, but bytes holds the least-significant n bytes of the true value. */ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian, int is_signed); /* _PyLong_FromNbInt: Convert the given object to a PyLongObject using the nb_int slot, if available. Raise TypeError if either the nb_int slot is not available or the result of the call to nb_int returns something not of type int. */ PyAPI_FUNC(PyLongObject *)_PyLong_FromNbInt(PyObject *); /* _PyLong_Format: Convert the long to a string object with given base, appending a base prefix of 0[box] if base is 2, 8 or 16. */ PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base); PyAPI_FUNC(int) _PyLong_FormatWriter( _PyUnicodeWriter *writer, PyObject *obj, int base, int alternate); PyAPI_FUNC(char*) _PyLong_FormatBytesWriter( _PyBytesWriter *writer, char *str, PyObject *obj, int base, int alternate); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter( _PyUnicodeWriter *writer, PyObject *obj, PyObject *format_spec, Py_ssize_t start, Py_ssize_t end); #endif /* Py_LIMITED_API */ /* These aren't really part of the int object, but they're handy. The functions are in Python/mystrtoul.c. */ PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int); PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int); #ifndef Py_LIMITED_API /* For use by the gcd function in mathmodule.c */ PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *); #endif /* !Py_LIMITED_API */ #ifdef Py_BUILD_CORE /* * Default int base conversion size limitation: Denial of Service prevention. * * Chosen such that this isn't wildly slow on modern hardware and so that * everyone's existing deployed numpy test suite passes before * https://github.com/numpy/numpy/issues/22098 is widely available. * * $ python -m timeit -s 's = "1"*4300' 'int(s)' * 2000 loops, best of 5: 125 usec per loop * $ python -m timeit -s 's = "1"*4300; v = int(s)' 'str(v)' * 1000 loops, best of 5: 311 usec per loop * (zen2 cloud VM) * * 4300 decimal digits fits a ~14284 bit number. */ #define _PY_LONG_DEFAULT_MAX_STR_DIGITS 4300 /* * Threshold for max digits check. For performance reasons int() and * int.__str__() don't checks values that are smaller than this * threshold. Acts as a guaranteed minimum size limit for bignums that * applications can expect from CPython. * * % python -m timeit -s 's = "1"*640; v = int(s)' 'str(int(s))' * 20000 loops, best of 5: 12 usec per loop * * "640 digits should be enough for anyone." - gps * fits a ~2126 bit decimal number. */ #define _PY_LONG_MAX_STR_DIGITS_THRESHOLD 640 #if ((_PY_LONG_DEFAULT_MAX_STR_DIGITS != 0) && \ (_PY_LONG_DEFAULT_MAX_STR_DIGITS < _PY_LONG_MAX_STR_DIGITS_THRESHOLD)) # error "_PY_LONG_DEFAULT_MAX_STR_DIGITS smaller than threshold." #endif #endif /* Py_BUILD_CORE */ #ifdef __cplusplus } #endif #endif /* !Py_LONGOBJECT_H */ python3.6m/marshal.h 0000644 00000001443 15063602042 0010271 0 ustar 00 /* Interface for marshal.c */ #ifndef Py_MARSHAL_H #define Py_MARSHAL_H #ifdef __cplusplus extern "C" { #endif #define Py_MARSHAL_VERSION 4 PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); #ifndef Py_LIMITED_API PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); #endif PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *, Py_ssize_t); #ifdef __cplusplus } #endif #endif /* !Py_MARSHAL_H */ python3.6m/memoryobject.h 0000644 00000005315 15063602042 0011343 0 ustar 00 /* Memory view object. In Python this is available as "memoryview". */ #ifndef Py_MEMORYOBJECT_H #define Py_MEMORYOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type; #endif PyAPI_DATA(PyTypeObject) PyMemoryView_Type; #define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) #ifndef Py_LIMITED_API /* Get a pointer to the memoryview's private copy of the exporter's buffer. */ #define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view) /* Get a pointer to the exporting object (this may be NULL!). */ #define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj) #endif PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags); #endif #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); #endif PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, int buffertype, char order); /* The structs are declared here so that macros can work, but they shouldn't be considered public. Don't access their fields directly, use the macros and functions instead! */ #ifndef Py_LIMITED_API #define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */ #define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */ typedef struct { PyObject_HEAD int flags; /* state flags */ Py_ssize_t exports; /* number of direct memoryview exports */ Py_buffer master; /* snapshot buffer obtained from the original exporter */ } _PyManagedBufferObject; /* memoryview state flags */ #define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */ #define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */ #define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */ #define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */ #define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */ typedef struct { PyObject_VAR_HEAD _PyManagedBufferObject *mbuf; /* managed buffer */ Py_hash_t hash; /* hash value for read-only views */ int flags; /* state flags */ Py_ssize_t exports; /* number of buffer re-exports */ Py_buffer view; /* private copy of the exporter's view */ PyObject *weakreflist; Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */ } PyMemoryViewObject; #endif #ifdef __cplusplus } #endif #endif /* !Py_MEMORYOBJECT_H */ python3.6m/metagrammar.h 0000644 00000000375 15063602042 0011142 0 ustar 00 #ifndef Py_METAGRAMMAR_H #define Py_METAGRAMMAR_H #ifdef __cplusplus extern "C" { #endif #define MSTART 256 #define RULE 257 #define RHS 258 #define ALT 259 #define ITEM 260 #define ATOM 261 #ifdef __cplusplus } #endif #endif /* !Py_METAGRAMMAR_H */ python3.6m/methodobject.h 0000644 00000007407 15063602042 0011317 0 ustar 00 /* Method object interface */ #ifndef Py_METHODOBJECT_H #define Py_METHODOBJECT_H #ifdef __cplusplus extern "C" { #endif /* This is about the type 'builtin_function_or_method', not Python methods in user-defined classes. See classobject.h for the latter. */ PyAPI_DATA(PyTypeObject) PyCFunction_Type; #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); typedef PyObject *(*_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*PyNoArgsFunction)(PyObject *); PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ #ifndef Py_LIMITED_API #define PyCFunction_GET_FUNCTION(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_meth) #define PyCFunction_GET_SELF(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \ NULL : ((PyCFunctionObject *)func) -> m_self) #define PyCFunction_GET_FLAGS(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags) #endif PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); PyAPI_FUNC(PyObject *) _PyCFunction_FastCallKeywords(PyObject *func, PyObject **stack, Py_ssize_t nargs, PyObject *kwnames); #endif struct PyMethodDef { const char *ml_name; /* The name of the built-in function/method */ PyCFunction ml_meth; /* The C function that implements it */ int ml_flags; /* Combination of METH_xxx flags, which mostly describe the args expected by the C func */ const char *ml_doc; /* The __doc__ attribute, or NULL */ }; typedef struct PyMethodDef PyMethodDef; #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, PyObject *); /* Flag passed to newmethodobject */ /* #define METH_OLDARGS 0x0000 -- unsupported now */ #define METH_VARARGS 0x0001 #define METH_KEYWORDS 0x0002 /* METH_NOARGS and METH_O must not be combined with the flags above. */ #define METH_NOARGS 0x0004 #define METH_O 0x0008 /* METH_CLASS and METH_STATIC are a little different; these control the construction of methods for a class. These cannot be used for functions in modules. */ #define METH_CLASS 0x0010 #define METH_STATIC 0x0020 /* METH_COEXIST allows a method to be entered even though a slot has already filled the entry. When defined, the flag allows a separate method, "__contains__" for example, to coexist with a defined slot like sq_contains. */ #define METH_COEXIST 0x0040 #ifndef Py_LIMITED_API #define METH_FASTCALL 0x0080 typedef struct { PyObject_HEAD PyMethodDef *m_ml; /* Description of the C function to call */ PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ PyObject *m_module; /* The __module__ attribute, can be anything */ PyObject *m_weakreflist; /* List of weak references */ } PyCFunctionObject; #endif PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out); PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out); #endif #ifdef __cplusplus } #endif #endif /* !Py_METHODOBJECT_H */ python3.6m/modsupport.h 0000644 00000016225 15063602042 0011062 0 ustar 00 #ifndef Py_MODSUPPORT_H #define Py_MODSUPPORT_H #ifdef __cplusplus extern "C" { #endif /* Module support interface */ #include <stdarg.h> /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier to mean Py_ssize_t */ #ifdef PY_SSIZE_T_CLEAN #define PyArg_Parse _PyArg_Parse_SizeT #define PyArg_ParseTuple _PyArg_ParseTuple_SizeT #define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT #define PyArg_VaParse _PyArg_VaParse_SizeT #define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT #define Py_BuildValue _Py_BuildValue_SizeT #define Py_VaBuildValue _Py_VaBuildValue_SizeT #else #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); #endif /* !Py_LIMITED_API */ #endif /* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */ #if !defined(PY_SSIZE_T_CLEAN) || !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...); PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...); PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, ...); PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list); PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, va_list); #endif PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *); PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw); PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args); #endif PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); #ifndef Py_LIMITED_API typedef struct _PyArg_Parser { const char *format; const char * const *keywords; const char *fname; const char *custom_msg; int pos; /* number of positional-only arguments */ int min; /* minimal number of arguments */ int max; /* maximal number of positional arguments */ PyObject *kwtuple; /* tuple of keyword parameter names */ struct _PyArg_Parser *next; } _PyArg_Parser; #ifdef PY_SSIZE_T_CLEAN #define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT #define _PyArg_ParseStack _PyArg_ParseStack_SizeT #define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT #endif PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *, struct _PyArg_Parser *, ...); PyAPI_FUNC(int) _PyArg_ParseStack(PyObject **args, Py_ssize_t nargs, PyObject *kwnames, struct _PyArg_Parser *, ...); PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *, struct _PyArg_Parser *, va_list); void _PyArg_Fini(void); #endif PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long); PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *); #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) #define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c) #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *); PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *); PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def); #endif #define Py_CLEANUP_SUPPORTED 0x20000 #define PYTHON_API_VERSION 1013 #define PYTHON_API_STRING "1013" /* The API version is maintained (independently from the Python version) so we can detect mismatches between the interpreter and dynamically loaded modules. These are diagnosed by an error message but the module is still loaded (because the mismatch can only be tested after loading the module). The error message is intended to explain the core dump a few seconds later. The symbol PYTHON_API_STRING defines the same value as a string literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. *** Please add a line or two to the top of this log for each API version change: 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths 19-Aug-2002 GvR 1012 Changes to string object struct for interning changes, saving 3 bytes. 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and PyFrame_New(); Python 2.1a2 14-Mar-2000 GvR 1009 Unicode API added 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!) 3-Dec-1998 GvR 1008 Python 1.5.2b1 18-Jan-1997 GvR 1007 string interning and other speedups 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-( 30-Jul-1996 GvR Slice and ellipses syntax added 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-) 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( ) 10-Jan-1995 GvR Renamed globals to new naming scheme 9-Jan-1995 GvR Initial version (incompatible with older API) */ /* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of Python 3, it will stay at the value of 3; changes to the limited API must be performed in a strictly backwards-compatible manner. */ #define PYTHON_ABI_VERSION 3 #define PYTHON_ABI_STRING "3" #ifdef Py_TRACE_REFS /* When we are tracing reference counts, rename module creation functions so modules compiled with incompatible settings will generate a link-time error. */ #define PyModule_Create2 PyModule_Create2TraceRefs #define PyModule_FromDefAndSpec2 PyModule_FromDefAndSpec2TraceRefs #endif PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*, int apiver); #ifdef Py_LIMITED_API #define PyModule_Create(module) \ PyModule_Create2(module, PYTHON_ABI_VERSION) #else #define PyModule_Create(module) \ PyModule_Create2(module, PYTHON_API_VERSION) #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def, PyObject *spec, int module_api_version); #ifdef Py_LIMITED_API #define PyModule_FromDefAndSpec(module, spec) \ PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION) #else #define PyModule_FromDefAndSpec(module, spec) \ PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION) #endif /* Py_LIMITED_API */ #endif /* New in 3.5 */ #ifndef Py_LIMITED_API PyAPI_DATA(char *) _Py_PackageContext; #endif #ifdef __cplusplus } #endif #endif /* !Py_MODSUPPORT_H */ python3.6m/moduleobject.h 0000644 00000004355 15063602042 0011323 0 ustar 00 /* Module object interface */ #ifndef Py_MODULEOBJECT_H #define Py_MODULEOBJECT_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_NewObject( PyObject *name ); #endif PyAPI_FUNC(PyObject *) PyModule_New( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); #endif PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyModule_Clear(PyObject *); PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *); #endif PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*); PyAPI_FUNC(void*) PyModule_GetState(PyObject*); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*); PyAPI_DATA(PyTypeObject) PyModuleDef_Type; #endif typedef struct PyModuleDef_Base { PyObject_HEAD PyObject* (*m_init)(void); Py_ssize_t m_index; PyObject* m_copy; } PyModuleDef_Base; #define PyModuleDef_HEAD_INIT { \ PyObject_HEAD_INIT(NULL) \ NULL, /* m_init */ \ 0, /* m_index */ \ NULL, /* m_copy */ \ } struct PyModuleDef_Slot; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ typedef struct PyModuleDef_Slot{ int slot; void *value; } PyModuleDef_Slot; #define Py_mod_create 1 #define Py_mod_exec 2 #ifndef Py_LIMITED_API #define _Py_mod_LAST_SLOT 2 #endif #endif /* New in 3.5 */ typedef struct PyModuleDef{ PyModuleDef_Base m_base; const char* m_name; const char* m_doc; Py_ssize_t m_size; PyMethodDef *m_methods; struct PyModuleDef_Slot* m_slots; traverseproc m_traverse; inquiry m_clear; freefunc m_free; } PyModuleDef; #ifdef __cplusplus } #endif #endif /* !Py_MODULEOBJECT_H */ python3.6m/namespaceobject.h 0000644 00000000535 15063602042 0011766 0 ustar 00 /* simple namespace object interface */ #ifndef NAMESPACEOBJECT_H #define NAMESPACEOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) _PyNamespace_Type; PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !NAMESPACEOBJECT_H */ python3.6m/node.h 0000644 00000001757 15063602042 0007577 0 ustar 00 /* Parse tree node interface */ #ifndef Py_NODE_H #define Py_NODE_H #ifdef __cplusplus extern "C" { #endif typedef struct _node { short n_type; char *n_str; int n_lineno; int n_col_offset; int n_nchildren; struct _node *n_child; } node; PyAPI_FUNC(node *) PyNode_New(int type); PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, char *str, int lineno, int col_offset); PyAPI_FUNC(void) PyNode_Free(node *n); #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n); #endif /* Node access functions */ #define NCH(n) ((n)->n_nchildren) #define CHILD(n, i) (&(n)->n_child[i]) #define RCHILD(n, i) (CHILD(n, NCH(n) + i)) #define TYPE(n) ((n)->n_type) #define STR(n) ((n)->n_str) #define LINENO(n) ((n)->n_lineno) /* Assert that the type of a node is what we expect */ #define REQ(n, type) assert(TYPE(n) == (type)) PyAPI_FUNC(void) PyNode_ListTree(node *); #ifdef __cplusplus } #endif #endif /* !Py_NODE_H */ python3.6m/object.h 0000644 00000122333 15063602042 0010112 0 ustar 00 #ifndef Py_OBJECT_H #define Py_OBJECT_H #ifdef __cplusplus extern "C" { #endif /* Object and type object interface */ /* Objects are structures allocated on the heap. Special rules apply to the use of objects to ensure they are properly garbage-collected. Objects are never allocated statically or on the stack; they must be accessed through special macros and functions only. (Type objects are exceptions to the first rule; the standard types are represented by statically initialized type objects, although work on type/class unification for Python 2.2 made it possible to have heap-allocated type objects too). An object has a 'reference count' that is increased or decreased when a pointer to the object is copied or deleted; when the reference count reaches zero there are no references to the object left and it can be removed from the heap. An object has a 'type' that determines what it represents and what kind of data it contains. An object's type is fixed when it is created. Types themselves are represented as objects; an object contains a pointer to the corresponding type object. The type itself has a type pointer pointing to the object representing the type 'type', which contains a pointer to itself!). Objects do not float around in memory; once allocated an object keeps the same size and address. Objects that must hold variable-size data can contain pointers to variable-size parts of the object. Not all objects of the same type have the same size; but the size cannot change after allocation. (These restrictions are made so a reference to an object can be simply a pointer -- moving an object would require updating all the pointers, and changing an object's size would require moving it if there was another object right next to it.) Objects are always accessed through pointers of the type 'PyObject *'. The type 'PyObject' is a structure that only contains the reference count and the type pointer. The actual memory allocated for an object contains other data that can only be accessed after casting the pointer to a pointer to a longer structure type. This longer type must start with the reference count and type fields; the macro PyObject_HEAD should be used for this (to accommodate for future changes). The implementation of a particular object type can cast the object pointer to the proper type and back. A standard interface exists for objects that contain an array of items whose size is determined when the object is allocated. */ /* Py_DEBUG implies Py_TRACE_REFS. */ #if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) #define Py_TRACE_REFS #endif /* Py_TRACE_REFS implies Py_REF_DEBUG. */ #if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) #define Py_REF_DEBUG #endif #if defined(Py_LIMITED_API) && defined(Py_REF_DEBUG) #error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG #endif #ifdef Py_TRACE_REFS /* Define pointers to support a doubly-linked list of all live heap objects. */ #define _PyObject_HEAD_EXTRA \ struct _object *_ob_next; \ struct _object *_ob_prev; #define _PyObject_EXTRA_INIT 0, 0, #else #define _PyObject_HEAD_EXTRA #define _PyObject_EXTRA_INIT #endif /* PyObject_HEAD defines the initial segment of every PyObject. */ #define PyObject_HEAD PyObject ob_base; #define PyObject_HEAD_INIT(type) \ { _PyObject_EXTRA_INIT \ 1, type }, #define PyVarObject_HEAD_INIT(type, size) \ { PyObject_HEAD_INIT(type) size }, /* PyObject_VAR_HEAD defines the initial segment of all variable-size * container objects. These end with a declaration of an array with 1 * element, but enough space is malloc'ed so that the array actually * has room for ob_size elements. Note that ob_size is an element count, * not necessarily a byte count. */ #define PyObject_VAR_HEAD PyVarObject ob_base; #define Py_INVALID_SIZE (Py_ssize_t)-1 /* Nothing is actually declared to be a PyObject, but every pointer to * a Python object can be cast to a PyObject*. This is inheritance built * by hand. Similarly every pointer to a variable-size Python object can, * in addition, be cast to PyVarObject*. */ typedef struct _object { _PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt; struct _typeobject *ob_type; } PyObject; typedef struct { PyObject ob_base; Py_ssize_t ob_size; /* Number of items in variable part */ } PyVarObject; #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #ifndef Py_LIMITED_API /********************* String Literals ****************************************/ /* This structure helps managing static strings. The basic usage goes like this: Instead of doing r = PyObject_CallMethod(o, "foo", "args", ...); do _Py_IDENTIFIER(foo); ... r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); PyId_foo is a static variable, either on block level or file level. On first usage, the string "foo" is interned, and the structures are linked. On interpreter shutdown, all strings are released (through _PyUnicode_ClearStaticStrings). Alternatively, _Py_static_string allows choosing the variable name. _PyUnicode_FromId returns a borrowed reference to the interned string. _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. */ typedef struct _Py_Identifier { struct _Py_Identifier *next; const char* string; PyObject *object; } _Py_Identifier; #define _Py_static_string_init(value) { .next = NULL, .string = value, .object = NULL } #define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value) #define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) #endif /* !Py_LIMITED_API */ /* Type objects contain a string containing the type name (to help somewhat in debugging), the allocation parameters (see PyObject_New() and PyObject_NewVar()), and methods for accessing objects of the type. Methods are optional, a nil pointer meaning that particular kind of access is not available for this type. The Py_DECREF() macro uses the tp_dealloc method without checking for a nil pointer; it should always be implemented except if the implementation can guarantee that the reference count will never reach zero (e.g., for statically allocated type objects). NB: the methods for certain type groups are now contained in separate method blocks. */ typedef PyObject * (*unaryfunc)(PyObject *); typedef PyObject * (*binaryfunc)(PyObject *, PyObject *); typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *); typedef int (*inquiry)(PyObject *); typedef Py_ssize_t (*lenfunc)(PyObject *); typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t); typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t); typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *); typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *); #ifndef Py_LIMITED_API /* buffer interface */ typedef struct bufferinfo { void *buf; PyObject *obj; /* owned reference */ Py_ssize_t len; Py_ssize_t itemsize; /* This is Py_ssize_t so it can be pointed to by strides in simple case.*/ int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); /* Maximum number of dimensions */ #define PyBUF_MAX_NDIM 64 /* Flags for getting buffers */ #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 /* we used to include an E, backwards compatible alias */ #define PyBUF_WRITEABLE PyBUF_WRITABLE #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) #define PyBUF_CONTIG_RO (PyBUF_ND) #define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) #define PyBUF_STRIDED_RO (PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) #define PyBUF_READ 0x100 #define PyBUF_WRITE 0x200 /* End buffer interface */ #endif /* Py_LIMITED_API */ typedef int (*objobjproc)(PyObject *, PyObject *); typedef int (*visitproc)(PyObject *, void *); typedef int (*traverseproc)(PyObject *, visitproc, void *); #ifndef Py_LIMITED_API typedef struct { /* Number implementations must check *both* arguments for proper type and implement the necessary conversions in the slot functions themselves. */ binaryfunc nb_add; binaryfunc nb_subtract; binaryfunc nb_multiply; binaryfunc nb_remainder; binaryfunc nb_divmod; ternaryfunc nb_power; unaryfunc nb_negative; unaryfunc nb_positive; unaryfunc nb_absolute; inquiry nb_bool; unaryfunc nb_invert; binaryfunc nb_lshift; binaryfunc nb_rshift; binaryfunc nb_and; binaryfunc nb_xor; binaryfunc nb_or; unaryfunc nb_int; void *nb_reserved; /* the slot formerly known as nb_long */ unaryfunc nb_float; binaryfunc nb_inplace_add; binaryfunc nb_inplace_subtract; binaryfunc nb_inplace_multiply; binaryfunc nb_inplace_remainder; ternaryfunc nb_inplace_power; binaryfunc nb_inplace_lshift; binaryfunc nb_inplace_rshift; binaryfunc nb_inplace_and; binaryfunc nb_inplace_xor; binaryfunc nb_inplace_or; binaryfunc nb_floor_divide; binaryfunc nb_true_divide; binaryfunc nb_inplace_floor_divide; binaryfunc nb_inplace_true_divide; unaryfunc nb_index; binaryfunc nb_matrix_multiply; binaryfunc nb_inplace_matrix_multiply; } PyNumberMethods; typedef struct { lenfunc sq_length; binaryfunc sq_concat; ssizeargfunc sq_repeat; ssizeargfunc sq_item; void *was_sq_slice; ssizeobjargproc sq_ass_item; void *was_sq_ass_slice; objobjproc sq_contains; binaryfunc sq_inplace_concat; ssizeargfunc sq_inplace_repeat; } PySequenceMethods; typedef struct { lenfunc mp_length; binaryfunc mp_subscript; objobjargproc mp_ass_subscript; } PyMappingMethods; typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } PyAsyncMethods; typedef struct { getbufferproc bf_getbuffer; releasebufferproc bf_releasebuffer; } PyBufferProcs; #endif /* Py_LIMITED_API */ typedef void (*freefunc)(void *); typedef void (*destructor)(PyObject *); #ifndef Py_LIMITED_API /* We can't provide a full compile-time check that limited-API users won't implement tp_print. However, not defining printfunc and making tp_print of a different function pointer type should at least cause a warning in most cases. */ typedef int (*printfunc)(PyObject *, FILE *, int); #endif typedef PyObject *(*getattrfunc)(PyObject *, char *); typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); typedef int (*setattrfunc)(PyObject *, char *, PyObject *); typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*reprfunc)(PyObject *); typedef Py_hash_t (*hashfunc)(PyObject *); typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); typedef PyObject *(*getiterfunc) (PyObject *); typedef PyObject *(*iternextfunc) (PyObject *); typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *); typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *); typedef int (*initproc)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *); typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t); #ifdef Py_LIMITED_API typedef struct _typeobject PyTypeObject; /* opaque */ #else typedef struct _typeobject { PyObject_VAR_HEAD const char *tp_name; /* For printing, in format "<module>.<name>" */ Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ /* Methods to implement standard operations */ destructor tp_dealloc; printfunc tp_print; getattrfunc tp_getattr; setattrfunc tp_setattr; PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2) or tp_reserved (Python 3) */ reprfunc tp_repr; /* Method suites for standard classes */ PyNumberMethods *tp_as_number; PySequenceMethods *tp_as_sequence; PyMappingMethods *tp_as_mapping; /* More standard operations (here for binary compatibility) */ hashfunc tp_hash; ternaryfunc tp_call; reprfunc tp_str; getattrofunc tp_getattro; setattrofunc tp_setattro; /* Functions to access object as input/output buffer */ PyBufferProcs *tp_as_buffer; /* Flags to define presence of optional/expanded features */ unsigned long tp_flags; const char *tp_doc; /* Documentation string */ /* Assigned meaning in release 2.0 */ /* call function for all accessible objects */ traverseproc tp_traverse; /* delete references to contained objects */ inquiry tp_clear; /* Assigned meaning in release 2.1 */ /* rich comparisons */ richcmpfunc tp_richcompare; /* weak reference enabler */ Py_ssize_t tp_weaklistoffset; /* Iterators */ getiterfunc tp_iter; iternextfunc tp_iternext; /* Attribute descriptor and subclassing stuff */ struct PyMethodDef *tp_methods; struct PyMemberDef *tp_members; struct PyGetSetDef *tp_getset; struct _typeobject *tp_base; PyObject *tp_dict; descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; Py_ssize_t tp_dictoffset; initproc tp_init; allocfunc tp_alloc; newfunc tp_new; freefunc tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; PyObject *tp_mro; /* method resolution order */ PyObject *tp_cache; PyObject *tp_subclasses; PyObject *tp_weaklist; destructor tp_del; /* Type attribute cache version tag. Added in version 2.6 */ unsigned int tp_version_tag; destructor tp_finalize; #ifdef COUNT_ALLOCS /* these must be last and never explicitly initialized */ Py_ssize_t tp_allocs; Py_ssize_t tp_frees; Py_ssize_t tp_maxalloc; struct _typeobject *tp_prev; struct _typeobject *tp_next; #endif } PyTypeObject; #endif typedef struct{ int slot; /* slot id, see below */ void *pfunc; /* function pointer */ } PyType_Slot; typedef struct{ const char* name; int basicsize; int itemsize; unsigned int flags; PyType_Slot *slots; /* terminated by slot==0. */ } PyType_Spec; PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyType_FromSpecWithBases(PyType_Spec*, PyObject*); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(void*) PyType_GetSlot(PyTypeObject*, int); #endif #ifndef Py_LIMITED_API /* The *real* layout of a type object when allocated on the heap */ typedef struct _heaptypeobject { /* Note: there's a dependency on the order of these members in slotptr() in typeobject.c . */ PyTypeObject ht_type; PyAsyncMethods as_async; PyNumberMethods as_number; PyMappingMethods as_mapping; PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, so that the mapping wins when both the mapping and the sequence define a given operator (e.g. __getitem__). see add_operators() in typeobject.c . */ PyBufferProcs as_buffer; PyObject *ht_name, *ht_slots, *ht_qualname; struct _dictkeysobject *ht_cached_keys; /* here are optional user slots, followed by the members. */ } PyHeapTypeObject; /* access macro to the members which are floating "behind" the object */ #define PyHeapType_GET_MEMBERS(etype) \ ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) #endif /* Generic type check */ PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); #define PyObject_TypeCheck(ob, tp) \ (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ PyAPI_FUNC(unsigned long) PyType_GetFlags(PyTypeObject*); #define PyType_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) #define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyType_LookupId(PyTypeObject *, _Py_Identifier *); PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, _Py_Identifier *); PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *); #endif PyAPI_FUNC(unsigned int) PyType_ClearCache(void); PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *); PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *); #endif /* Generic operations on objects */ #ifndef Py_LIMITED_API struct _Py_Identifier; PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); PyAPI_FUNC(void) _Py_BreakPoint(void); PyAPI_FUNC(void) _PyObject_Dump(PyObject *); PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *); #endif PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Bytes(PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *); PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *); PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, struct _Py_Identifier *); PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, struct _Py_Identifier *, PyObject *); PyAPI_FUNC(int) _PyObject_HasAttrId(PyObject *, struct _Py_Identifier *); PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); #endif PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); #endif PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject *, PyObject *, void *); #endif PyAPI_FUNC(Py_hash_t) PyObject_Hash(PyObject *); PyAPI_FUNC(Py_hash_t) PyObject_HashNotImplemented(PyObject *); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); PyAPI_FUNC(int) PyObject_Not(PyObject *); PyAPI_FUNC(int) PyCallable_Check(PyObject *); PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *); PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *); #endif #ifndef Py_LIMITED_API /* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes dict as the last parameter. */ PyAPI_FUNC(PyObject *) _PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(int) _PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, PyObject *, PyObject *); #endif /* !Py_LIMITED_API */ /* Helper to look up a builtin object */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyObject_GetBuiltin(const char *name); #endif /* PyObject_Dir(obj) acts like Python builtins.dir(obj), returning a list of strings. PyObject_Dir(NULL) is like builtins.dir(), returning the names of the current locals. In this case, if there are no current locals, NULL is returned, and PyErr_Occurred() is false. */ PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *); /* Helpers for printing recursive container types */ PyAPI_FUNC(int) Py_ReprEnter(PyObject *); PyAPI_FUNC(void) Py_ReprLeave(PyObject *); /* Flag bits for printing: */ #define Py_PRINT_RAW 1 /* No string quotes etc. */ /* `Type flags (tp_flags) These flags are used to extend the type structure in a backwards-compatible fashion. Extensions can use the flags to indicate (and test) when a given type structure contains a new feature. The Python core will use these when introducing new functionality between major revisions (to avoid mid-version changes in the PYTHON_API_VERSION). Arbitration of the flag bit positions will need to be coordinated among all extension writers who publically release their extensions (this will be fewer than you might expect!).. Most flags were removed as of Python 3.0 to make room for new flags. (Some flags are not for backwards compatibility but to indicate the presence of an optional feature; these flags remain of course.) Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. Code can use PyType_HasFeature(type_ob, flag_value) to test whether the given type object has a specified feature. */ /* Set if the type object is dynamically allocated */ #define Py_TPFLAGS_HEAPTYPE (1UL << 9) /* Set if the type allows subclassing */ #define Py_TPFLAGS_BASETYPE (1UL << 10) /* Set if the type is 'ready' -- fully initialized */ #define Py_TPFLAGS_READY (1UL << 12) /* Set while the type is being 'readied', to prevent recursive ready calls */ #define Py_TPFLAGS_READYING (1UL << 13) /* Objects support garbage collection (see objimp.h) */ #define Py_TPFLAGS_HAVE_GC (1UL << 14) /* These two bits are preserved for Stackless Python, next after this is 17 */ #ifdef STACKLESS #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3UL << 15) #else #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 #endif /* Objects support type attribute cache */ #define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18) #define Py_TPFLAGS_VALID_VERSION_TAG (1UL << 19) /* Type is abstract and cannot be instantiated */ #define Py_TPFLAGS_IS_ABSTRACT (1UL << 20) /* These flags are used to determine if a type is a subclass. */ #define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24) #define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25) #define Py_TPFLAGS_TUPLE_SUBCLASS (1UL << 26) #define Py_TPFLAGS_BYTES_SUBCLASS (1UL << 27) #define Py_TPFLAGS_UNICODE_SUBCLASS (1UL << 28) #define Py_TPFLAGS_DICT_SUBCLASS (1UL << 29) #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1UL << 30) #define Py_TPFLAGS_TYPE_SUBCLASS (1UL << 31) #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ Py_TPFLAGS_HAVE_VERSION_TAG | \ 0) /* NOTE: The following flags reuse lower bits (removed as part of the * Python 3.0 transition). */ /* Type structure has tp_finalize member (3.4) */ #define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0) #ifdef Py_LIMITED_API #define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0) #else #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) #endif #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) /* The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement reference counts. Py_DECREF calls the object's deallocator function when the refcount falls to 0; for objects that don't contain references to other objects or heap memory this can be the standard function free(). Both macros can be used wherever a void expression is allowed. The argument must not be a NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead. The macro _Py_NewReference(op) initialize reference counts to 1, and in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional bookkeeping appropriate to the special build. We assume that the reference count field can never overflow; this can be proven when the size of the field is the same as the pointer size, so we ignore the possibility. Provided a C int is at least 32 bits (which is implicitly assumed in many parts of this code), that's enough for about 2**31 references to an object. XXX The following became out of date in Python 2.2, but I'm not sure XXX what the full truth is now. Certainly, heap-allocated type objects XXX can and should be deallocated. Type objects should never be deallocated; the type pointer in an object is not considered to be a reference to the type object, to save complications in the deallocation function. (This is actually a decision that's up to the implementer of each new type so if you want, you can count such references to the type object.) */ /* First define a pile of simple helper macros, one set per special * build symbol. These either expand to the obvious things, or to * nothing at all when the special mode isn't in effect. The main * macros can later be defined just once then, yet expand to different * things depending on which special build options are and aren't in effect. * Trust me <wink>: while painful, this is 20x easier to understand than, * e.g, defining _Py_NewReference five different times in a maze of nested * #ifdefs (we used to do that -- it was impenetrable). */ #ifdef Py_REF_DEBUG PyAPI_DATA(Py_ssize_t) _Py_RefTotal; PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op); PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); #define _Py_INC_REFTOTAL _Py_RefTotal++ #define _Py_DEC_REFTOTAL _Py_RefTotal-- #define _Py_REF_DEBUG_COMMA , #define _Py_CHECK_REFCNT(OP) \ { if (((PyObject*)OP)->ob_refcnt < 0) \ _Py_NegativeRefcount(__FILE__, __LINE__, \ (PyObject *)(OP)); \ } /* Py_REF_DEBUG also controls the display of refcounts and memory block * allocations at the interactive prompt and at interpreter shutdown */ PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void); #define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs() #else #define _Py_INC_REFTOTAL #define _Py_DEC_REFTOTAL #define _Py_REF_DEBUG_COMMA #define _Py_CHECK_REFCNT(OP) /* a semicolon */; #define _PY_DEBUG_PRINT_TOTAL_REFS() #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS PyAPI_FUNC(void) inc_count(PyTypeObject *); PyAPI_FUNC(void) dec_count(PyTypeObject *); #define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) #define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) #define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- #define _Py_COUNT_ALLOCS_COMMA , #else #define _Py_INC_TPALLOCS(OP) #define _Py_INC_TPFREES(OP) #define _Py_DEC_TPFREES(OP) #define _Py_COUNT_ALLOCS_COMMA #endif /* COUNT_ALLOCS */ #ifdef Py_TRACE_REFS /* Py_TRACE_REFS is such major surgery that we call external routines. */ PyAPI_FUNC(void) _Py_NewReference(PyObject *); PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *); PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); #else /* Without Py_TRACE_REFS, there's little enough to do that we expand code * inline. */ #define _Py_NewReference(op) ( \ _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ Py_REFCNT(op) = 1) #define _Py_ForgetReference(op) _Py_INC_TPFREES(op) #ifdef Py_LIMITED_API PyAPI_FUNC(void) _Py_Dealloc(PyObject *); #else #define _Py_Dealloc(op) ( \ _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op))) #endif #endif /* !Py_TRACE_REFS */ #define Py_INCREF(op) ( \ _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ ((PyObject *)(op))->ob_refcnt++) #define Py_DECREF(op) \ do { \ PyObject *_py_decref_tmp = (PyObject *)(op); \ if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ --(_py_decref_tmp)->ob_refcnt != 0) \ _Py_CHECK_REFCNT(_py_decref_tmp) \ else \ _Py_Dealloc(_py_decref_tmp); \ } while (0) /* Safely decref `op` and set `op` to NULL, especially useful in tp_clear * and tp_dealloc implementations. * * Note that "the obvious" code can be deadly: * * Py_XDECREF(op); * op = NULL; * * Typically, `op` is something like self->containee, and `self` is done * using its `containee` member. In the code sequence above, suppose * `containee` is non-NULL with a refcount of 1. Its refcount falls to * 0 on the first line, which can trigger an arbitrary amount of code, * possibly including finalizers (like __del__ methods or weakref callbacks) * coded in Python, which in turn can release the GIL and allow other threads * to run, etc. Such code may even invoke methods of `self` again, or cause * cyclic gc to trigger, but-- oops! --self->containee still points to the * object being torn down, and it may be in an insane state while being torn * down. This has in fact been a rich historic source of miserable (rare & * hard-to-diagnose) segfaulting (and other) bugs. * * The safe way is: * * Py_CLEAR(op); * * That arranges to set `op` to NULL _before_ decref'ing, so that any code * triggered as a side-effect of `op` getting torn down no longer believes * `op` points to a valid object. * * There are cases where it's safe to use the naive code, but they're brittle. * For example, if `op` points to a Python integer, you know that destroying * one of those can't cause problems -- but in part that relies on that * Python integers aren't currently weakly referencable. Best practice is * to use Py_CLEAR() even if you can't think of a reason for why you need to. */ #define Py_CLEAR(op) \ do { \ PyObject *_py_tmp = (PyObject *)(op); \ if (_py_tmp != NULL) { \ (op) = NULL; \ Py_DECREF(_py_tmp); \ } \ } while (0) /* Macros to use in case the object pointer may be NULL: */ #define Py_XINCREF(op) \ do { \ PyObject *_py_xincref_tmp = (PyObject *)(op); \ if (_py_xincref_tmp != NULL) \ Py_INCREF(_py_xincref_tmp); \ } while (0) #define Py_XDECREF(op) \ do { \ PyObject *_py_xdecref_tmp = (PyObject *)(op); \ if (_py_xdecref_tmp != NULL) \ Py_DECREF(_py_xdecref_tmp); \ } while (0) #ifndef Py_LIMITED_API /* Safely decref `op` and set `op` to `op2`. * * As in case of Py_CLEAR "the obvious" code can be deadly: * * Py_DECREF(op); * op = op2; * * The safe way is: * * Py_SETREF(op, op2); * * That arranges to set `op` to `op2` _before_ decref'ing, so that any code * triggered as a side-effect of `op` getting torn down no longer believes * `op` points to a valid object. * * Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of * Py_DECREF. */ #define Py_SETREF(op, op2) \ do { \ PyObject *_py_tmp = (PyObject *)(op); \ (op) = (op2); \ Py_DECREF(_py_tmp); \ } while (0) #define Py_XSETREF(op, op2) \ do { \ PyObject *_py_tmp = (PyObject *)(op); \ (op) = (op2); \ Py_XDECREF(_py_tmp); \ } while (0) #endif /* ifndef Py_LIMITED_API */ /* These are provided as conveniences to Python runtime embedders, so that they can have object code that is not dependent on Python compilation flags. */ PyAPI_FUNC(void) Py_IncRef(PyObject *); PyAPI_FUNC(void) Py_DecRef(PyObject *); #ifndef Py_LIMITED_API PyAPI_DATA(PyTypeObject) _PyNone_Type; PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type; #endif /* !Py_LIMITED_API */ /* _Py_NoneStruct is an object of undefined type which can be used in contexts where NULL (nil) is not suitable (since NULL often means 'error'). Don't forget to apply Py_INCREF() when returning this value!!! */ PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */ #define Py_None (&_Py_NoneStruct) /* Macro for returning Py_None from a function */ #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None /* Py_NotImplemented is a singleton used to signal that an operation is not implemented for a given type combination. */ PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ #define Py_NotImplemented (&_Py_NotImplementedStruct) /* Macro for returning Py_NotImplemented from a function */ #define Py_RETURN_NOTIMPLEMENTED \ return Py_INCREF(Py_NotImplemented), Py_NotImplemented /* Rich comparison opcodes */ #define Py_LT 0 #define Py_LE 1 #define Py_EQ 2 #define Py_NE 3 #define Py_GT 4 #define Py_GE 5 #ifndef Py_LIMITED_API /* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. * Defined in object.c. */ PyAPI_DATA(int) _Py_SwappedOp[]; #endif /* !Py_LIMITED_API */ /* More conventions ================ Argument Checking ----------------- Functions that take objects as arguments normally don't check for nil arguments, but they do check the type of the argument, and return an error if the function doesn't apply to the type. Failure Modes ------------- Functions may fail for a variety of reasons, including running out of memory. This is communicated to the caller in two ways: an error string is set (see errors.h), and the function result differs: functions that normally return a pointer return NULL for failure, functions returning an integer return -1 (which could be a legal return value too!), and other functions return 0 for success and -1 for failure. Callers should always check for errors before using the result. If an error was set, the caller must either explicitly clear it, or pass the error on to its caller. Reference Counts ---------------- It takes a while to get used to the proper usage of reference counts. Functions that create an object set the reference count to 1; such new objects must be stored somewhere or destroyed again with Py_DECREF(). Some functions that 'store' objects, such as PyTuple_SetItem() and PyList_SetItem(), don't increment the reference count of the object, since the most frequent use is to store a fresh object. Functions that 'retrieve' objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also don't increment the reference count, since most frequently the object is only looked at quickly. Thus, to retrieve an object and store it again, the caller must call Py_INCREF() explicitly. NOTE: functions that 'consume' a reference count, like PyList_SetItem(), consume the reference even if the object wasn't successfully stored, to simplify error handling. It seems attractive to make other functions that take an object as argument consume a reference count; however, this may quickly get confusing (even the current practice is already confusing). Consider it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at times. */ /* Trashcan mechanism, thanks to Christian Tismer. When deallocating a container object, it's possible to trigger an unbounded chain of deallocations, as each Py_DECREF in turn drops the refcount on "the next" object in the chain to 0. This can easily lead to stack faults, and especially in threads (which typically have less stack space to work with). A container object that participates in cyclic gc can avoid this by bracketing the body of its tp_dealloc function with a pair of macros: static void mytype_dealloc(mytype *p) { ... declarations go here ... PyObject_GC_UnTrack(p); // must untrack first Py_TRASHCAN_SAFE_BEGIN(p) ... The body of the deallocator goes here, including all calls ... ... to Py_DECREF on contained objects. ... Py_TRASHCAN_SAFE_END(p) } CAUTION: Never return from the middle of the body! If the body needs to "get out early", put a label immediately before the Py_TRASHCAN_SAFE_END call, and goto it. Else the call-depth counter (see below) will stay above 0 forever, and the trashcan will never get emptied. How it works: The BEGIN macro increments a call-depth counter. So long as this counter is small, the body of the deallocator is run directly without further ado. But if the counter gets large, it instead adds p to a list of objects to be deallocated later, skips the body of the deallocator, and resumes execution after the END macro. The tp_dealloc routine then returns without deallocating anything (and so unbounded call-stack depth is avoided). When the call stack finishes unwinding again, code generated by the END macro notices this, and calls another routine to deallocate all the objects that may have been added to the list of deferred deallocations. In effect, a chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. */ #ifndef Py_LIMITED_API /* This is the old private API, invoked by the macros before 3.2.4. Kept for binary compatibility of extensions using the stable ABI. */ PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_destroy_chain(void); PyAPI_DATA(int) _PyTrash_delete_nesting; PyAPI_DATA(PyObject *) _PyTrash_delete_later; #endif /* !Py_LIMITED_API */ /* The new thread-safe private API, invoked by the macros below. */ PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); #define PyTrash_UNWIND_LEVEL 50 #define Py_TRASHCAN_SAFE_BEGIN(op) \ do { \ PyThreadState *_tstate = PyThreadState_GET(); \ if (_tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ ++_tstate->trash_delete_nesting; /* The body of the deallocator is here. */ #define Py_TRASHCAN_SAFE_END(op) \ --_tstate->trash_delete_nesting; \ if (_tstate->trash_delete_later && _tstate->trash_delete_nesting <= 0) \ _PyTrash_thread_destroy_chain(); \ } \ else \ _PyTrash_thread_deposit_object((PyObject*)op); \ } while (0); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks, size_t sizeof_block); PyAPI_FUNC(void) _PyObject_DebugTypeStats(FILE *out); #endif /* ifndef Py_LIMITED_API */ /* Define a pair of assertion macros. These work like the regular C assert(), in that they will abort the process with a message on stderr if the given condition fails to hold, but compile away to nothing if NDEBUG is defined. However, before aborting, Python will also try to call _PyObject_Dump() on the given object. This may be of use when investigating bugs in which a particular object is corrupt (e.g. buggy a tp_visit method in an extension module breaking the garbage collector), to help locate the broken objects. The WITH_MSG variant allows you to supply an additional message that Python will attempt to print to stderr, after the object dump. */ #ifdef NDEBUG /* No debugging: compile away the assertions: */ #define PyObject_ASSERT_WITH_MSG(obj, expr, msg) ((void)0) #else /* With debugging: generate checks: */ #define PyObject_ASSERT_WITH_MSG(obj, expr, msg) \ ((expr) \ ? (void)(0) \ : _PyObject_AssertFailed((obj), \ (msg), \ (__STRING(expr)), \ (__FILE__), \ (__LINE__), \ (__PRETTY_FUNCTION__))) #endif #define PyObject_ASSERT(obj, expr) \ PyObject_ASSERT_WITH_MSG(obj, expr, NULL) /* Declare and define the entrypoint even when NDEBUG is defined, to avoid causing compiler/linker errors when building extensions without NDEBUG against a Python built with NDEBUG defined */ PyAPI_FUNC(void) _PyObject_AssertFailed(PyObject *, const char *, const char *, const char *, int, const char *); #ifdef __cplusplus } #endif #endif /* !Py_OBJECT_H */ python3.6m/objimpl.h 0000644 00000033644 15063602042 0010306 0 ustar 00 /* The PyObject_ memory family: high-level object memory interfaces. See pymem.h for the low-level PyMem_ family. */ #ifndef Py_OBJIMPL_H #define Py_OBJIMPL_H #include "pymem.h" #ifdef __cplusplus extern "C" { #endif /* BEWARE: Each interface exports both functions and macros. Extension modules should use the functions, to ensure binary compatibility across Python versions. Because the Python implementation is free to change internal details, and the macros may (or may not) expose details for speed, if you do use the macros you must recompile your extensions with each Python release. Never mix calls to PyObject_ memory functions with calls to the platform malloc/realloc/ calloc/free, or with calls to PyMem_. */ /* Functions and macros for modules that implement new object types. - PyObject_New(type, typeobj) allocates memory for a new object of the given type, and initializes part of it. 'type' must be the C structure type used to represent the object, and 'typeobj' the address of the corresponding type object. Reference count and type pointer are filled in; the rest of the bytes of the object are *undefined*! The resulting expression type is 'type *'. The size of the object is determined by the tp_basicsize field of the type object. - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size object with room for n items. In addition to the refcount and type pointer fields, this also fills in the ob_size field. - PyObject_Del(op) releases the memory allocated for an object. It does not run a destructor -- it only frees the memory. PyObject_Free is identical. - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't allocate memory. Instead of a 'type' parameter, they take a pointer to a new object (allocated by an arbitrary allocator), and initialize its object header fields. Note that objects created with PyObject_{New, NewVar} are allocated using the specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG is also #defined. In case a specific form of memory management is needed (for example, if you must use the platform malloc heap(s), or shared memory, or C++ local storage or operator new), you must first allocate the object with your custom allocator, then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- specific fields: reference count, type pointer, possibly others. You should be aware that Python has no control over these objects because they don't cooperate with the Python memory manager. Such objects may not be eligible for automatic garbage collection and you have to make sure that they are released accordingly whenever their destructor gets called (cf. the specific form of memory management you're using). Unless you have specific memory management requirements, use PyObject_{New, NewVar, Del}. */ /* * Raw object memory interface * =========================== */ /* Functions to call the same malloc/realloc/free as used by Python's object allocator. If WITH_PYMALLOC is enabled, these may differ from the platform malloc/realloc/free. The Python object allocator is designed for fast, cache-conscious allocation of many "small" objects, and with low hidden memory overhead. PyObject_Malloc(0) returns a unique non-NULL pointer if possible. PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n). PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory at p. Returned pointers must be checked for NULL explicitly; no action is performed on failure other than to return NULL (no warning it printed, no exception is set, etc). For allocating objects, use PyObject_{New, NewVar} instead whenever possible. The PyObject_{Malloc, Realloc, Free} family is exposed so that you can exploit Python's small-block allocator for non-object uses. If you must use these routines to allocate object memory, make sure the object gets initialized via PyObject_{Init, InitVar} after obtaining the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t size); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize); #endif PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); #ifndef Py_LIMITED_API /* This function returns the number of allocated memory blocks, regardless of size */ PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void); #endif /* !Py_LIMITED_API */ /* Macros */ #ifdef WITH_PYMALLOC #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out); #endif /* #ifndef Py_LIMITED_API */ #endif /* Macros */ #define PyObject_MALLOC PyObject_Malloc #define PyObject_REALLOC PyObject_Realloc #define PyObject_FREE PyObject_Free #define PyObject_Del PyObject_Free #define PyObject_DEL PyObject_Free /* * Generic object allocator interface * ================================== */ /* Functions */ PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *, PyTypeObject *, Py_ssize_t); PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); #define PyObject_New(type, typeobj) \ ( (type *) _PyObject_New(typeobj) ) #define PyObject_NewVar(type, typeobj, n) \ ( (type *) _PyObject_NewVar((typeobj), (n)) ) /* Macros trading binary compatibility for speed. See also pymem.h. Note that these macros expect non-NULL object pointers.*/ #define PyObject_INIT(op, typeobj) \ ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) #define PyObject_INIT_VAR(op, typeobj, size) \ ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) ) #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) /* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a vrbl-size object with nitems items, exclusive of gc overhead (if any). The value is rounded up to the closest multiple of sizeof(void *), in order to ensure that pointer fields at the end of the object are correctly aligned for the platform (this is of special importance for subclasses of, e.g., str or int, so that pointers can be stored after the embedded data). Note that there's no memory wastage in doing this, as malloc has to return (at worst) pointer-aligned memory anyway. */ #if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0 # error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2" #endif #define _PyObject_VAR_SIZE(typeobj, nitems) \ _Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \ (nitems)*(typeobj)->tp_itemsize, \ SIZEOF_VOID_P) #define PyObject_NEW(type, typeobj) \ ( (type *) PyObject_Init( \ (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) ) #define PyObject_NEW_VAR(type, typeobj, n) \ ( (type *) PyObject_InitVar( \ (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\ (typeobj), (n)) ) /* This example code implements an object constructor with a custom allocator, where PyObject_New is inlined, and shows the important distinction between two steps (at least): 1) the actual allocation of the object storage; 2) the initialization of the Python specific fields in this storage with PyObject_{Init, InitVar}. PyObject * YourObject_New(...) { PyObject *op; op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); if (op == NULL) return PyErr_NoMemory(); PyObject_Init(op, &YourTypeStruct); op->ob_field = value; ... return op; } Note that in C++, the use of the new operator usually implies that the 1st step is performed automatically for you, so in a C++ class constructor you would start directly with PyObject_Init/InitVar */ #ifndef Py_LIMITED_API typedef struct { /* user context passed as the first argument to the 2 functions */ void *ctx; /* allocate an arena of size bytes */ void* (*alloc) (void *ctx, size_t size); /* free an arena */ void (*free) (void *ctx, void *ptr, size_t size); } PyObjectArenaAllocator; /* Get the arena allocator. */ PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator); /* Set the arena allocator. */ PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator); #endif /* * Garbage Collection Support * ========================== */ /* C equivalent of gc.collect() which ignores the state of gc.enabled. */ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void); PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void); #endif /* Test if a type has a GC head */ #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) /* Test if an object has a GC head */ #define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) /* GC information is stored BEFORE the object structure. */ #ifndef Py_LIMITED_API typedef union _gc_head { struct { union _gc_head *gc_next; union _gc_head *gc_prev; Py_ssize_t gc_refs; } gc; double dummy; /* force worst-case alignment */ } PyGC_Head; extern PyGC_Head *_PyGC_generation0; #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) /* Bit 0 is set when tp_finalize is called */ #define _PyGC_REFS_MASK_FINALIZED (1 << 0) /* The (N-1) most significant bits contain the gc state / refcount */ #define _PyGC_REFS_SHIFT (1) #define _PyGC_REFS_MASK (((size_t) -1) << _PyGC_REFS_SHIFT) #define _PyGCHead_REFS(g) ((g)->gc.gc_refs >> _PyGC_REFS_SHIFT) #define _PyGCHead_SET_REFS(g, v) do { \ (g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK) \ | (((size_t)(v)) << _PyGC_REFS_SHIFT); \ } while (0) #define _PyGCHead_DECREF(g) ((g)->gc.gc_refs -= 1 << _PyGC_REFS_SHIFT) #define _PyGCHead_FINALIZED(g) (((g)->gc.gc_refs & _PyGC_REFS_MASK_FINALIZED) != 0) #define _PyGCHead_SET_FINALIZED(g, v) do { \ (g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK_FINALIZED) \ | (v != 0); \ } while (0) #define _PyGC_FINALIZED(o) _PyGCHead_FINALIZED(_Py_AS_GC(o)) #define _PyGC_SET_FINALIZED(o, v) _PyGCHead_SET_FINALIZED(_Py_AS_GC(o), v) #define _PyGC_REFS(o) _PyGCHead_REFS(_Py_AS_GC(o)) #define _PyGC_REFS_UNTRACKED (-2) #define _PyGC_REFS_REACHABLE (-3) #define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) /* Tell the GC to track this object. NB: While the object is tracked the * collector it must be safe to call the ob_traverse method. */ #define _PyObject_GC_TRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ if (_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED) \ Py_FatalError("GC object already tracked"); \ _PyGCHead_SET_REFS(g, _PyGC_REFS_REACHABLE); \ g->gc.gc_next = _PyGC_generation0; \ g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ g->gc.gc_prev->gc.gc_next = g; \ _PyGC_generation0->gc.gc_prev = g; \ } while (0); /* Tell the GC to stop tracking this object. * gc_next doesn't need to be set to NULL, but doing so is a good * way to provoke memory errors if calling code is confused. */ #define _PyObject_GC_UNTRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ assert(_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED); \ _PyGCHead_SET_REFS(g, _PyGC_REFS_UNTRACKED); \ g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ g->gc.gc_next = NULL; \ } while (0); /* True if the object is currently tracked by the GC. */ #define _PyObject_GC_IS_TRACKED(o) \ (_PyGC_REFS(o) != _PyGC_REFS_UNTRACKED) /* True if the object may be tracked by the GC in the future, or already is. This can be useful to implement some optimizations. */ #define _PyObject_GC_MAY_BE_TRACKED(obj) \ (PyObject_IS_GC(obj) && \ (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) #endif /* Py_LIMITED_API */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size); PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t); PyAPI_FUNC(void) PyObject_GC_Track(void *); PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); PyAPI_FUNC(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ ( (type *) _PyObject_GC_New(typeobj) ) #define PyObject_GC_NewVar(type, typeobj, n) \ ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) /* Utility macro to help write tp_traverse functions. * To use this macro, the tp_traverse function must name its arguments * "visit" and "arg". This is intended to keep tp_traverse functions * looking as much alike as possible. */ #define Py_VISIT(op) \ do { \ if (op) { \ int vret = visit((PyObject *)(op), arg); \ if (vret) \ return vret; \ } \ } while (0) /* Test if a type supports weak references */ #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) #define PyObject_GET_WEAKREFS_LISTPTR(o) \ ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) #ifdef __cplusplus } #endif #endif /* !Py_OBJIMPL_H */ python3.6m/odictobject.h 0000644 00000002410 15063602042 0011126 0 ustar 00 #ifndef Py_ODICTOBJECT_H #define Py_ODICTOBJECT_H #ifdef __cplusplus extern "C" { #endif /* OrderedDict */ /* This API is optional and mostly redundant. */ #ifndef Py_LIMITED_API typedef struct _odictobject PyODictObject; PyAPI_DATA(PyTypeObject) PyODict_Type; PyAPI_DATA(PyTypeObject) PyODictIter_Type; PyAPI_DATA(PyTypeObject) PyODictKeys_Type; PyAPI_DATA(PyTypeObject) PyODictItems_Type; PyAPI_DATA(PyTypeObject) PyODictValues_Type; #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) #define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used PyAPI_FUNC(PyObject *) PyODict_New(void); PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); /* wrappers around PyDict* functions */ #define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key) #define PyODict_GetItemWithError(od, key) \ PyDict_GetItemWithError((PyObject *)od, key) #define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key) #define PyODict_Size(od) PyDict_Size((PyObject *)od) #define PyODict_GetItemString(od, key) \ PyDict_GetItemString((PyObject *)od, key) #endif #ifdef __cplusplus } #endif #endif /* !Py_ODICTOBJECT_H */ python3.6m/opcode.h 0000644 00000011721 15063602042 0010113 0 ustar 00 /* Auto-generated by Tools/scripts/generate_opcode_h.py */ #ifndef Py_OPCODE_H #define Py_OPCODE_H #ifdef __cplusplus extern "C" { #endif /* Instruction opcodes for compiled code */ #define POP_TOP 1 #define ROT_TWO 2 #define ROT_THREE 3 #define DUP_TOP 4 #define DUP_TOP_TWO 5 #define NOP 9 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 #define UNARY_NOT 12 #define UNARY_INVERT 15 #define BINARY_MATRIX_MULTIPLY 16 #define INPLACE_MATRIX_MULTIPLY 17 #define BINARY_POWER 19 #define BINARY_MULTIPLY 20 #define BINARY_MODULO 22 #define BINARY_ADD 23 #define BINARY_SUBTRACT 24 #define BINARY_SUBSCR 25 #define BINARY_FLOOR_DIVIDE 26 #define BINARY_TRUE_DIVIDE 27 #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 #define GET_AITER 50 #define GET_ANEXT 51 #define BEFORE_ASYNC_WITH 52 #define INPLACE_ADD 55 #define INPLACE_SUBTRACT 56 #define INPLACE_MULTIPLY 57 #define INPLACE_MODULO 59 #define STORE_SUBSCR 60 #define DELETE_SUBSCR 61 #define BINARY_LSHIFT 62 #define BINARY_RSHIFT 63 #define BINARY_AND 64 #define BINARY_XOR 65 #define BINARY_OR 66 #define INPLACE_POWER 67 #define GET_ITER 68 #define GET_YIELD_FROM_ITER 69 #define PRINT_EXPR 70 #define LOAD_BUILD_CLASS 71 #define YIELD_FROM 72 #define GET_AWAITABLE 73 #define INPLACE_LSHIFT 75 #define INPLACE_RSHIFT 76 #define INPLACE_AND 77 #define INPLACE_XOR 78 #define INPLACE_OR 79 #define BREAK_LOOP 80 #define WITH_CLEANUP_START 81 #define WITH_CLEANUP_FINISH 82 #define RETURN_VALUE 83 #define IMPORT_STAR 84 #define SETUP_ANNOTATIONS 85 #define YIELD_VALUE 86 #define POP_BLOCK 87 #define END_FINALLY 88 #define POP_EXCEPT 89 #define HAVE_ARGUMENT 90 #define STORE_NAME 90 #define DELETE_NAME 91 #define UNPACK_SEQUENCE 92 #define FOR_ITER 93 #define UNPACK_EX 94 #define STORE_ATTR 95 #define DELETE_ATTR 96 #define STORE_GLOBAL 97 #define DELETE_GLOBAL 98 #define LOAD_CONST 100 #define LOAD_NAME 101 #define BUILD_TUPLE 102 #define BUILD_LIST 103 #define BUILD_SET 104 #define BUILD_MAP 105 #define LOAD_ATTR 106 #define COMPARE_OP 107 #define IMPORT_NAME 108 #define IMPORT_FROM 109 #define JUMP_FORWARD 110 #define JUMP_IF_FALSE_OR_POP 111 #define JUMP_IF_TRUE_OR_POP 112 #define JUMP_ABSOLUTE 113 #define POP_JUMP_IF_FALSE 114 #define POP_JUMP_IF_TRUE 115 #define LOAD_GLOBAL 116 #define CONTINUE_LOOP 119 #define SETUP_LOOP 120 #define SETUP_EXCEPT 121 #define SETUP_FINALLY 122 #define LOAD_FAST 124 #define STORE_FAST 125 #define DELETE_FAST 126 #define STORE_ANNOTATION 127 #define RAISE_VARARGS 130 #define CALL_FUNCTION 131 #define MAKE_FUNCTION 132 #define BUILD_SLICE 133 #define LOAD_CLOSURE 135 #define LOAD_DEREF 136 #define STORE_DEREF 137 #define DELETE_DEREF 138 #define CALL_FUNCTION_KW 141 #define CALL_FUNCTION_EX 142 #define SETUP_WITH 143 #define EXTENDED_ARG 144 #define LIST_APPEND 145 #define SET_ADD 146 #define MAP_ADD 147 #define LOAD_CLASSDEREF 148 #define BUILD_LIST_UNPACK 149 #define BUILD_MAP_UNPACK 150 #define BUILD_MAP_UNPACK_WITH_CALL 151 #define BUILD_TUPLE_UNPACK 152 #define BUILD_SET_UNPACK 153 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 #define BUILD_STRING 157 #define BUILD_TUPLE_UNPACK_WITH_CALL 158 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here as we want it to be available to both frameobject.c and ceval.c, while remaining private.*/ #define EXCEPT_HANDLER 257 enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) #ifdef __cplusplus } #endif #endif /* !Py_OPCODE_H */ python3.6m/osdefs.h 0000644 00000001263 15063602042 0010125 0 ustar 00 #ifndef Py_OSDEFS_H #define Py_OSDEFS_H #ifdef __cplusplus extern "C" { #endif /* Operating system dependencies */ #ifdef MS_WINDOWS #define SEP L'\\' #define ALTSEP L'/' #define MAXPATHLEN 256 #define DELIM L';' #endif /* Filename separator */ #ifndef SEP #define SEP L'/' #endif /* Max pathname length */ #ifdef __hpux #include <sys/param.h> #include <limits.h> #ifndef PATH_MAX #define PATH_MAX MAXPATHLEN #endif #endif #ifndef MAXPATHLEN #if defined(PATH_MAX) && PATH_MAX > 1024 #define MAXPATHLEN PATH_MAX #else #define MAXPATHLEN 1024 #endif #endif /* Search path entry delimiter */ #ifndef DELIM #define DELIM L':' #endif #ifdef __cplusplus } #endif #endif /* !Py_OSDEFS_H */ python3.6m/osmodule.h 0000644 00000000443 15063602042 0010470 0 ustar 00 /* os module interface */ #ifndef Py_OSMODULE_H #define Py_OSMODULE_H #ifdef __cplusplus extern "C" { #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); #endif #ifdef __cplusplus } #endif #endif /* !Py_OSMODULE_H */ python3.6m/parsetok.h 0000644 00000005505 15063602042 0010475 0 ustar 00 /* Parser-tokenizer link interface */ #ifndef Py_LIMITED_API #ifndef Py_PARSETOK_H #define Py_PARSETOK_H #ifdef __cplusplus extern "C" { #endif typedef struct { int error; #ifndef PGEN /* The filename is useless for pgen, see comment in tok_state structure */ PyObject *filename; #endif int lineno; int offset; char *text; /* UTF-8-encoded string */ int token; int expected; } perrdetail; #if 0 #define PyPARSE_YIELD_IS_KEYWORD 0x0001 #endif #define PyPARSE_DONT_IMPLY_DEDENT 0x0002 #if 0 #define PyPARSE_WITH_IS_KEYWORD 0x0003 #define PyPARSE_PRINT_IS_FUNCTION 0x0004 #define PyPARSE_UNICODE_LITERALS 0x0008 #endif #define PyPARSE_IGNORE_COOKIE 0x0010 #define PyPARSE_BARRY_AS_BDFL 0x0020 PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, perrdetail *); PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, const char *, const char *, perrdetail *); PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, perrdetail *, int); PyAPI_FUNC(node *) PyParser_ParseFileFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ const char *enc, grammar *g, int start, const char *ps1, const char *ps2, perrdetail *err_ret, int flags); PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ const char *enc, grammar *g, int start, const char *ps1, const char *ps2, perrdetail *err_ret, int *flags); PyAPI_FUNC(node *) PyParser_ParseFileObject( FILE *fp, PyObject *filename, const char *enc, grammar *g, int start, const char *ps1, const char *ps2, perrdetail *err_ret, int *flags); PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename( const char *s, const char *filename, /* decoded from the filesystem encoding */ grammar *g, int start, perrdetail *err_ret, int flags); PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx( const char *s, const char *filename, /* decoded from the filesystem encoding */ grammar *g, int start, perrdetail *err_ret, int *flags); PyAPI_FUNC(node *) PyParser_ParseStringObject( const char *s, PyObject *filename, grammar *g, int start, perrdetail *err_ret, int *flags); /* Note that the following functions are defined in pythonrun.c, not in parsetok.c */ PyAPI_FUNC(void) PyParser_SetError(perrdetail *); PyAPI_FUNC(void) PyParser_ClearError(perrdetail *); #ifdef __cplusplus } #endif #endif /* !Py_PARSETOK_H */ #endif /* !Py_LIMITED_API */ python3.6m/patchlevel.h 0000644 00000002150 15063602042 0010765 0 ustar 00 /* Python version identification scheme. When the major or minor version changes, the VERSION variable in configure.ac must also be changed. There is also (independent) API version information in modsupport.h. */ /* Values for PY_RELEASE_LEVEL */ #define PY_RELEASE_LEVEL_ALPHA 0xA #define PY_RELEASE_LEVEL_BETA 0xB #define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ #define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ /* Higher for patch releases */ /* Version parsed out into numeric values */ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 8 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ #define PY_VERSION "3.6.8" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ #define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ (PY_MINOR_VERSION << 16) | \ (PY_MICRO_VERSION << 8) | \ (PY_RELEASE_LEVEL << 4) | \ (PY_RELEASE_SERIAL << 0)) python3.6m/pgen.h 0000644 00000000375 15063602042 0007576 0 ustar 00 #ifndef Py_PGEN_H #define Py_PGEN_H #ifdef __cplusplus extern "C" { #endif /* Parser generator interface */ extern grammar *meta_grammar(void); struct _node; extern grammar *pgen(struct _node *); #ifdef __cplusplus } #endif #endif /* !Py_PGEN_H */ python3.6m/pgenheaders.h 0000644 00000002234 15063602042 0011126 0 ustar 00 #ifndef Py_PGENHEADERS_H #define Py_PGENHEADERS_H #ifdef __cplusplus extern "C" { #endif /* Include files and extern declarations used by most of the parser. */ #include "Python.h" PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); #define addarc _Py_addarc #define addbit _Py_addbit #define adddfa _Py_adddfa #define addfirstsets _Py_addfirstsets #define addlabel _Py_addlabel #define addstate _Py_addstate #define delbitset _Py_delbitset #define dumptree _Py_dumptree #define findlabel _Py_findlabel #define freegrammar _Py_freegrammar #define mergebitset _Py_mergebitset #define meta_grammar _Py_meta_grammar #define newbitset _Py_newbitset #define newgrammar _Py_newgrammar #define pgen _Py_pgen #define printgrammar _Py_printgrammar #define printnonterminals _Py_printnonterminals #define printtree _Py_printtree #define samebitset _Py_samebitset #define showtree _Py_showtree #define tok_dump _Py_tok_dump #define translatelabels _Py_translatelabels #ifdef __cplusplus } #endif #endif /* !Py_PGENHEADERS_H */ python3.6m/py_curses.h 0000644 00000010323 15063602042 0010653 0 ustar 00 #ifndef Py_CURSES_H #define Py_CURSES_H #ifdef __APPLE__ /* ** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards ** against multiple definition of wchar_t. */ #ifdef _BSD_WCHAR_T_DEFINED_ #define _WCHAR_T #endif #endif /* __APPLE__ */ #ifdef __FreeBSD__ /* ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards ** against multiple definition of wchar_t and wint_t. */ #ifdef _XOPEN_SOURCE_EXTENDED #ifndef __FreeBSD_version #include <osreldate.h> #endif #if __FreeBSD_version >= 500000 #ifndef __wchar_t #define __wchar_t #endif #ifndef __wint_t #define __wint_t #endif #else #ifndef _WCHAR_T #define _WCHAR_T #endif #ifndef _WINT_T #define _WINT_T #endif #endif #endif #endif #if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS) /* The following definition is necessary for ncurses 5.7; without it, some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python can't get at the WINDOW flags field. */ #define NCURSES_OPAQUE 0 #endif #ifdef HAVE_NCURSES_H #include <ncurses.h> #else #include <curses.h> #endif #ifdef HAVE_NCURSES_H /* configure was checking <curses.h>, but we will use <ncurses.h>, which has some or all these features. */ #if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0) #define WINDOW_HAS_FLAGS 1 #endif #if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906 #define HAVE_CURSES_IS_PAD 1 #endif #ifndef MVWDELCH_IS_EXPRESSION #define MVWDELCH_IS_EXPRESSION 1 #endif #endif #ifdef __cplusplus extern "C" { #endif #define PyCurses_API_pointers 4 /* Type declarations */ typedef struct { PyObject_HEAD WINDOW *win; char *encoding; } PyCursesWindowObject; #define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) #define PyCurses_CAPSULE_NAME "_curses._C_API" #ifdef CURSES_MODULE /* This section is used when compiling _cursesmodule.c */ #else /* This section is used in modules that use the _cursesmodule API */ static void **PyCurses_API; #define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) #define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} #define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} #define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} #define import_curses() \ PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); #endif /* general error messages */ static const char catchall_ERR[] = "curses function returned ERR"; static const char catchall_NULL[] = "curses function returned NULL"; /* Function Prototype Macros - They are ugly but very, very useful. ;-) X - function name TYPE - parameter Type ERGSTR - format string for construction of the return value PARSESTR - format string for argument parsing */ #define NoArgNoReturnFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ return PyCursesCheckERR(X(), # X); } #define NoArgOrFlagNoReturnFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \ { \ int flag = 0; \ PyCursesInitialised \ switch(PyTuple_Size(args)) { \ case 0: \ return PyCursesCheckERR(X(), # X); \ case 1: \ if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \ if (flag) return PyCursesCheckERR(X(), # X); \ else return PyCursesCheckERR(no ## X (), # X); \ default: \ PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \ return NULL; } } #define NoArgReturnIntFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ return PyLong_FromLong((long) X()); } #define NoArgReturnStringFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ return PyBytes_FromString(X()); } #define NoArgTrueFalseFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ if (X () == FALSE) { \ Py_INCREF(Py_False); \ return Py_False; \ } \ Py_INCREF(Py_True); \ return Py_True; } #define NoArgNoReturnVoidFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ X(); \ Py_INCREF(Py_None); \ return Py_None; } #ifdef __cplusplus } #endif #endif /* !defined(Py_CURSES_H) */ python3.6m/pyarena.h 0000644 00000005270 15063602042 0010303 0 ustar 00 /* An arena-like memory interface for the compiler. */ #ifndef Py_LIMITED_API #ifndef Py_PYARENA_H #define Py_PYARENA_H #ifdef __cplusplus extern "C" { #endif typedef struct _arena PyArena; /* PyArena_New() and PyArena_Free() create a new arena and free it, respectively. Once an arena has been created, it can be used to allocate memory via PyArena_Malloc(). Pointers to PyObject can also be registered with the arena via PyArena_AddPyObject(), and the arena will ensure that the PyObjects stay alive at least until PyArena_Free() is called. When an arena is freed, all the memory it allocated is freed, the arena releases internal references to registered PyObject*, and none of its pointers are valid. XXX (tim) What does "none of its pointers are valid" mean? Does it XXX mean that pointers previously obtained via PyArena_Malloc() are XXX no longer valid? (That's clearly true, but not sure that's what XXX the text is trying to say.) PyArena_New() returns an arena pointer. On error, it returns a negative number and sets an exception. XXX (tim): Not true. On error, PyArena_New() actually returns NULL, XXX and looks like it may or may not set an exception (e.g., if the XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on XXX and an exception is set; OTOH, if the internal XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but XXX an exception is not set in that case). */ PyAPI_FUNC(PyArena *) PyArena_New(void); PyAPI_FUNC(void) PyArena_Free(PyArena *); /* Mostly like malloc(), return the address of a block of memory spanning * `size` bytes, or return NULL (without setting an exception) if enough * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with * size=0 does not guarantee to return a unique pointer (the pointer * returned may equal one or more other pointers obtained from * PyArena_Malloc()). * Note that pointers obtained via PyArena_Malloc() must never be passed to * the system free() or realloc(), or to any of Python's similar memory- * management functions. PyArena_Malloc()-obtained pointers remain valid * until PyArena_Free(ar) is called, at which point all pointers obtained * from the arena `ar` become invalid simultaneously. */ PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size); /* This routine isn't a proper arena allocation routine. It takes * a PyObject* and records it so that it can be DECREFed when the * arena is freed. */ PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_PYARENA_H */ #endif /* Py_LIMITED_API */ python3.6m/pyatomic.h 0000644 00000017700 15063602042 0010472 0 ustar 00 #ifndef Py_ATOMIC_H #define Py_ATOMIC_H #ifdef Py_BUILD_CORE #include "dynamic_annotations.h" #include "pyconfig.h" #if defined(HAVE_STD_ATOMIC) #include <stdatomic.h> #endif /* This is modeled after the atomics interface from C1x, according to * the draft at * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf. * Operations and types are named the same except with a _Py_ prefix * and have the same semantics. * * Beware, the implementations here are deep magic. */ #if defined(HAVE_STD_ATOMIC) typedef enum _Py_memory_order { _Py_memory_order_relaxed = memory_order_relaxed, _Py_memory_order_acquire = memory_order_acquire, _Py_memory_order_release = memory_order_release, _Py_memory_order_acq_rel = memory_order_acq_rel, _Py_memory_order_seq_cst = memory_order_seq_cst } _Py_memory_order; typedef struct _Py_atomic_address { atomic_uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { atomic_int _value; } _Py_atomic_int; #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ atomic_signal_fence(ORDER) #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ atomic_thread_fence(ORDER) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ atomic_store_explicit(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ atomic_load_explicit(&(ATOMIC_VAL)->_value, ORDER) /* Use builtin atomic operations in GCC >= 4.7 */ #elif defined(HAVE_BUILTIN_ATOMIC) typedef enum _Py_memory_order { _Py_memory_order_relaxed = __ATOMIC_RELAXED, _Py_memory_order_acquire = __ATOMIC_ACQUIRE, _Py_memory_order_release = __ATOMIC_RELEASE, _Py_memory_order_acq_rel = __ATOMIC_ACQ_REL, _Py_memory_order_seq_cst = __ATOMIC_SEQ_CST } _Py_memory_order; typedef struct _Py_atomic_address { uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { int _value; } _Py_atomic_int; #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ __atomic_signal_fence(ORDER) #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ __atomic_thread_fence(ORDER) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ (assert((ORDER) == __ATOMIC_RELAXED \ || (ORDER) == __ATOMIC_SEQ_CST \ || (ORDER) == __ATOMIC_RELEASE), \ __atomic_store_n(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER)) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ (assert((ORDER) == __ATOMIC_RELAXED \ || (ORDER) == __ATOMIC_SEQ_CST \ || (ORDER) == __ATOMIC_ACQUIRE \ || (ORDER) == __ATOMIC_CONSUME), \ __atomic_load_n(&(ATOMIC_VAL)->_value, ORDER)) #else typedef enum _Py_memory_order { _Py_memory_order_relaxed, _Py_memory_order_acquire, _Py_memory_order_release, _Py_memory_order_acq_rel, _Py_memory_order_seq_cst } _Py_memory_order; typedef struct _Py_atomic_address { uintptr_t _value; } _Py_atomic_address; typedef struct _Py_atomic_int { int _value; } _Py_atomic_int; /* Only support GCC (for expression statements) and x86 (for simple * atomic semantics) for now */ #if defined(__GNUC__) && (defined(__i386__) || defined(__amd64)) static __inline__ void _Py_atomic_signal_fence(_Py_memory_order order) { if (order != _Py_memory_order_relaxed) __asm__ volatile("":::"memory"); } static __inline__ void _Py_atomic_thread_fence(_Py_memory_order order) { if (order != _Py_memory_order_relaxed) __asm__ volatile("mfence":::"memory"); } /* Tell the race checker about this operation's effects. */ static __inline__ void _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order) { (void)address; /* shut up -Wunused-parameter */ switch(order) { case _Py_memory_order_release: case _Py_memory_order_acq_rel: case _Py_memory_order_seq_cst: _Py_ANNOTATE_HAPPENS_BEFORE(address); break; case _Py_memory_order_relaxed: case _Py_memory_order_acquire: break; } switch(order) { case _Py_memory_order_acquire: case _Py_memory_order_acq_rel: case _Py_memory_order_seq_cst: _Py_ANNOTATE_HAPPENS_AFTER(address); break; case _Py_memory_order_relaxed: case _Py_memory_order_release: break; } } #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ __extension__ ({ \ __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ __typeof__(atomic_val->_value) new_val = NEW_VAL;\ volatile __typeof__(new_val) *volatile_data = &atomic_val->_value; \ _Py_memory_order order = ORDER; \ _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ \ /* Perform the operation. */ \ _Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \ switch(order) { \ case _Py_memory_order_release: \ _Py_atomic_signal_fence(_Py_memory_order_release); \ /* fallthrough */ \ case _Py_memory_order_relaxed: \ *volatile_data = new_val; \ break; \ \ case _Py_memory_order_acquire: \ case _Py_memory_order_acq_rel: \ case _Py_memory_order_seq_cst: \ __asm__ volatile("xchg %0, %1" \ : "+r"(new_val) \ : "m"(atomic_val->_value) \ : "memory"); \ break; \ } \ _Py_ANNOTATE_IGNORE_WRITES_END(); \ }) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ __extension__ ({ \ __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ __typeof__(atomic_val->_value) result; \ volatile __typeof__(result) *volatile_data = &atomic_val->_value; \ _Py_memory_order order = ORDER; \ _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ \ /* Perform the operation. */ \ _Py_ANNOTATE_IGNORE_READS_BEGIN(); \ switch(order) { \ case _Py_memory_order_release: \ case _Py_memory_order_acq_rel: \ case _Py_memory_order_seq_cst: \ /* Loads on x86 are not releases by default, so need a */ \ /* thread fence. */ \ _Py_atomic_thread_fence(_Py_memory_order_release); \ break; \ default: \ /* No fence */ \ break; \ } \ result = *volatile_data; \ switch(order) { \ case _Py_memory_order_acquire: \ case _Py_memory_order_acq_rel: \ case _Py_memory_order_seq_cst: \ /* Loads on x86 are automatically acquire operations so */ \ /* can get by with just a compiler fence. */ \ _Py_atomic_signal_fence(_Py_memory_order_acquire); \ break; \ default: \ /* No fence */ \ break; \ } \ _Py_ANNOTATE_IGNORE_READS_END(); \ result; \ }) #else /* !gcc x86 */ /* Fall back to other compilers and processors by assuming that simple volatile accesses are atomic. This is false, so people should port this. */ #define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0) #define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0) #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ ((ATOMIC_VAL)->_value = NEW_VAL) #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ ((ATOMIC_VAL)->_value) #endif /* !gcc x86 */ #endif /* Standardized shortcuts. */ #define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \ _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_seq_cst) #define _Py_atomic_load(ATOMIC_VAL) \ _Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_seq_cst) /* Python-local extensions */ #define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \ _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_relaxed) #define _Py_atomic_load_relaxed(ATOMIC_VAL) \ _Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed) #endif /* Py_BUILD_CORE */ #endif /* Py_ATOMIC_H */ python3.6m/pycapsule.h 0000644 00000003276 15063602042 0010655 0 ustar 00 /* Capsule objects let you wrap a C "void *" pointer in a Python object. They're a way of passing data through the Python interpreter without creating your own custom type. Capsules are used for communication between extension modules. They provide a way for an extension module to export a C interface to other extension modules, so that extension modules can use the Python import mechanism to link to one another. For more information, please see "c-api/capsule.html" in the documentation. */ #ifndef Py_CAPSULE_H #define Py_CAPSULE_H #ifdef __cplusplus extern "C" { #endif PyAPI_DATA(PyTypeObject) PyCapsule_Type; typedef void (*PyCapsule_Destructor)(PyObject *); #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) PyAPI_FUNC(PyObject *) PyCapsule_New( void *pointer, const char *name, PyCapsule_Destructor destructor); PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); PyAPI_FUNC(void *) PyCapsule_Import( const char *name, /* UTF-8 encoded string */ int no_block); #ifdef __cplusplus } #endif #endif /* !Py_CAPSULE_H */ python3.6m/pyconfig.h 0000644 00000000242 15063602042 0010454 0 ustar 00 #include <bits/wordsize.h> #if __WORDSIZE == 32 #include "pyconfig-32.h" #elif __WORDSIZE == 64 #include "pyconfig-64.h" #else #error "Unknown word size" #endif python3.6m/pyctype.h 0000644 00000002450 15063602042 0010336 0 ustar 00 #ifndef Py_LIMITED_API #ifndef PYCTYPE_H #define PYCTYPE_H #define PY_CTF_LOWER 0x01 #define PY_CTF_UPPER 0x02 #define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) #define PY_CTF_DIGIT 0x04 #define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) #define PY_CTF_SPACE 0x08 #define PY_CTF_XDIGIT 0x10 PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; /* Unlike their C counterparts, the following macros are not meant to * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument * must be a signed/unsigned char. */ #define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) #define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) #define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) #define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) #define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) #define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) #define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; #define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) #define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) #endif /* !PYCTYPE_H */ #endif /* !Py_LIMITED_API */ python3.6m/pydebug.h 0000644 00000002360 15063602042 0010300 0 ustar 00 #ifndef Py_LIMITED_API #ifndef Py_PYDEBUG_H #define Py_PYDEBUG_H #ifdef __cplusplus extern "C" { #endif /* These global variable are defined in pylifecycle.c */ /* XXX (ncoghlan): move these declarations to pylifecycle.h? */ PyAPI_DATA(int) Py_DebugFlag; PyAPI_DATA(int) Py_VerboseFlag; PyAPI_DATA(int) Py_QuietFlag; PyAPI_DATA(int) Py_InteractiveFlag; PyAPI_DATA(int) Py_InspectFlag; PyAPI_DATA(int) Py_OptimizeFlag; PyAPI_DATA(int) Py_NoSiteFlag; PyAPI_DATA(int) Py_BytesWarningFlag; PyAPI_DATA(int) Py_UseClassExceptionsFlag; PyAPI_DATA(int) Py_FrozenFlag; PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; PyAPI_DATA(int) Py_DontWriteBytecodeFlag; PyAPI_DATA(int) Py_NoUserSiteDirectory; PyAPI_DATA(int) Py_UnbufferedStdioFlag; PyAPI_DATA(int) Py_HashRandomizationFlag; PyAPI_DATA(int) Py_IsolatedFlag; #ifdef MS_WINDOWS PyAPI_DATA(int) Py_LegacyWindowsStdioFlag; #endif PyAPI_DATA(int) _Py_global_config_int_max_str_digits; /* this is a wrapper around getenv() that pays attention to Py_IgnoreEnvironmentFlag. It should be used for getting variables like PYTHONPATH and PYTHONHOME from the environment */ #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) #ifdef __cplusplus } #endif #endif /* !Py_PYDEBUG_H */ #endif /* Py_LIMITED_API */ python3.6m/pydtrace.h 0000644 00000003662 15063602042 0010462 0 ustar 00 /* Static DTrace probes interface */ #ifndef Py_DTRACE_H #define Py_DTRACE_H #ifdef __cplusplus extern "C" { #endif #ifdef WITH_DTRACE #include "pydtrace_probes.h" /* pydtrace_probes.h, on systems with DTrace, is auto-generated to include `PyDTrace_{PROBE}` and `PyDTrace_{PROBE}_ENABLED()` macros for every probe defined in pydtrace_provider.d. Calling these functions must be guarded by a `PyDTrace_{PROBE}_ENABLED()` check to minimize performance impact when probing is off. For example: if (PyDTrace_FUNCTION_ENTRY_ENABLED()) PyDTrace_FUNCTION_ENTRY(f); */ #else /* Without DTrace, compile to nothing. */ static inline void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2) {} static inline void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2) {} static inline void PyDTrace_FUNCTION_RETURN(const char *arg0, const char *arg1, int arg2) {} static inline void PyDTrace_GC_START(int arg0) {} static inline void PyDTrace_GC_DONE(int arg0) {} static inline void PyDTrace_INSTANCE_NEW_START(int arg0) {} static inline void PyDTrace_INSTANCE_NEW_DONE(int arg0) {} static inline void PyDTrace_INSTANCE_DELETE_START(int arg0) {} static inline void PyDTrace_INSTANCE_DELETE_DONE(int arg0) {} static inline int PyDTrace_LINE_ENABLED(void) { return 0; } static inline int PyDTrace_FUNCTION_ENTRY_ENABLED(void) { return 0; } static inline int PyDTrace_FUNCTION_RETURN_ENABLED(void) { return 0; } static inline int PyDTrace_GC_START_ENABLED(void) { return 0; } static inline int PyDTrace_GC_DONE_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_NEW_START_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { return 0; } static inline int PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { return 0; } #endif /* !WITH_DTRACE */ #ifdef __cplusplus } #endif #endif /* !Py_DTRACE_H */ python3.6m/pyerrors.h 0000644 00000041503 15063602042 0010530 0 ustar 00 #ifndef Py_ERRORS_H #define Py_ERRORS_H #ifdef __cplusplus extern "C" { #endif /* Error objects */ #ifndef Py_LIMITED_API /* PyException_HEAD defines the initial segment of every exception class. */ #define PyException_HEAD PyObject_HEAD PyObject *dict;\ PyObject *args; PyObject *traceback;\ PyObject *context; PyObject *cause;\ char suppress_context; typedef struct { PyException_HEAD } PyBaseExceptionObject; typedef struct { PyException_HEAD PyObject *msg; PyObject *filename; PyObject *lineno; PyObject *offset; PyObject *text; PyObject *print_file_and_line; } PySyntaxErrorObject; typedef struct { PyException_HEAD PyObject *msg; PyObject *name; PyObject *path; } PyImportErrorObject; typedef struct { PyException_HEAD PyObject *encoding; PyObject *object; Py_ssize_t start; Py_ssize_t end; PyObject *reason; } PyUnicodeErrorObject; typedef struct { PyException_HEAD PyObject *code; } PySystemExitObject; typedef struct { PyException_HEAD PyObject *myerrno; PyObject *strerror; PyObject *filename; PyObject *filename2; #ifdef MS_WINDOWS PyObject *winerror; #endif Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ } PyOSErrorObject; typedef struct { PyException_HEAD PyObject *value; } PyStopIterationObject; /* Compatibility typedefs */ typedef PyOSErrorObject PyEnvironmentErrorObject; #ifdef MS_WINDOWS typedef PyOSErrorObject PyWindowsErrorObject; #endif #endif /* !Py_LIMITED_API */ /* Error handling definitions */ PyAPI_FUNC(void) PyErr_SetNone(PyObject *); PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); #endif PyAPI_FUNC(void) PyErr_SetString( PyObject *exception, const char *string /* decoded from utf-8 */ ); PyAPI_FUNC(PyObject *) PyErr_Occurred(void); PyAPI_FUNC(void) PyErr_Clear(void); PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *); #endif #if defined(__clang__) || \ (defined(__GNUC__) && \ ((__GNUC__ >= 3) || \ (__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))) #define _Py_NO_RETURN __attribute__((__noreturn__)) #else #define _Py_NO_RETURN #endif /* Defined in Python/pylifecycle.c */ PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN; #if defined(Py_DEBUG) || defined(Py_LIMITED_API) #define _PyErr_OCCURRED() PyErr_Occurred() #else #define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type) #endif /* Error testing and normalization */ PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *); PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); /* Traceback manipulation (PEP 3134) */ PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *); /* Cause manipulation (PEP 3134) */ PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *); PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *); /* Context manipulation (PEP 3134) */ PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *); PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); #endif /* */ #define PyExceptionClass_Check(x) \ (PyType_Check((x)) && \ PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)) #define PyExceptionInstance_Check(x) \ PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS) #define PyExceptionClass_Name(x) \ ((char *)(((PyTypeObject*)(x))->tp_name)) #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type)) /* Predefined exceptions */ PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration; #endif PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; PyAPI_DATA(PyObject *) PyExc_LookupError; PyAPI_DATA(PyObject *) PyExc_AssertionError; PyAPI_DATA(PyObject *) PyExc_AttributeError; PyAPI_DATA(PyObject *) PyExc_BufferError; PyAPI_DATA(PyObject *) PyExc_EOFError; PyAPI_DATA(PyObject *) PyExc_FloatingPointError; PyAPI_DATA(PyObject *) PyExc_OSError; PyAPI_DATA(PyObject *) PyExc_ImportError; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError; #endif PyAPI_DATA(PyObject *) PyExc_IndexError; PyAPI_DATA(PyObject *) PyExc_KeyError; PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; PyAPI_DATA(PyObject *) PyExc_MemoryError; PyAPI_DATA(PyObject *) PyExc_NameError; PyAPI_DATA(PyObject *) PyExc_OverflowError; PyAPI_DATA(PyObject *) PyExc_RuntimeError; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_RecursionError; #endif PyAPI_DATA(PyObject *) PyExc_NotImplementedError; PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_IndentationError; PyAPI_DATA(PyObject *) PyExc_TabError; PyAPI_DATA(PyObject *) PyExc_ReferenceError; PyAPI_DATA(PyObject *) PyExc_SystemError; PyAPI_DATA(PyObject *) PyExc_SystemExit; PyAPI_DATA(PyObject *) PyExc_TypeError; PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; PyAPI_DATA(PyObject *) PyExc_UnicodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError; PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_DATA(PyObject *) PyExc_BlockingIOError; PyAPI_DATA(PyObject *) PyExc_BrokenPipeError; PyAPI_DATA(PyObject *) PyExc_ChildProcessError; PyAPI_DATA(PyObject *) PyExc_ConnectionError; PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError; PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError; PyAPI_DATA(PyObject *) PyExc_ConnectionResetError; PyAPI_DATA(PyObject *) PyExc_FileExistsError; PyAPI_DATA(PyObject *) PyExc_FileNotFoundError; PyAPI_DATA(PyObject *) PyExc_InterruptedError; PyAPI_DATA(PyObject *) PyExc_IsADirectoryError; PyAPI_DATA(PyObject *) PyExc_NotADirectoryError; PyAPI_DATA(PyObject *) PyExc_PermissionError; PyAPI_DATA(PyObject *) PyExc_ProcessLookupError; PyAPI_DATA(PyObject *) PyExc_TimeoutError; #endif /* Compatibility aliases */ PyAPI_DATA(PyObject *) PyExc_EnvironmentError; PyAPI_DATA(PyObject *) PyExc_IOError; #ifdef MS_WINDOWS PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif /* Predefined warning categories */ PyAPI_DATA(PyObject *) PyExc_Warning; PyAPI_DATA(PyObject *) PyExc_UserWarning; PyAPI_DATA(PyObject *) PyExc_DeprecationWarning; PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; PyAPI_DATA(PyObject *) PyExc_FutureWarning; PyAPI_DATA(PyObject *) PyExc_ImportWarning; PyAPI_DATA(PyObject *) PyExc_UnicodeWarning; PyAPI_DATA(PyObject *) PyExc_BytesWarning; PyAPI_DATA(PyObject *) PyExc_ResourceWarning; /* Convenience functions */ PyAPI_FUNC(int) PyErr_BadArgument(void); PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects( PyObject *, PyObject *, PyObject *); #endif PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( PyObject *exc, const char *filename /* decoded from the filesystem encoding */ ); #if defined(MS_WINDOWS) && !defined(Py_LIMITED_API) PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( PyObject *, const Py_UNICODE *); #endif /* MS_WINDOWS */ PyAPI_FUNC(PyObject *) PyErr_Format( PyObject *exception, const char *format, /* ASCII-encoded string */ ... ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyErr_FormatV( PyObject *exception, const char *format, va_list vargs); #endif #ifndef Py_LIMITED_API /* Like PyErr_Format(), but saves current exception as __context__ and __cause__. */ PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause( PyObject *exception, const char *format, /* ASCII-encoded string */ ... ); #endif #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( int ierr, const char *filename /* decoded from the filesystem encoding */ ); #ifndef Py_LIMITED_API /* XXX redeclare to use WSTRING */ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( int, const Py_UNICODE *); #endif PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *,int, PyObject *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects( PyObject *,int, PyObject *, PyObject *); #endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *exc, int ierr, const char *filename /* decoded from the filesystem encoding */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( PyObject *,int, const Py_UNICODE *); #endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* MS_WINDOWS */ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *, PyObject *, PyObject *); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *, PyObject *); #endif /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) /* Function to create a new exception */ PyAPI_FUNC(PyObject *) PyErr_NewException( const char *name, PyObject *base, PyObject *dict); PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc( const char *name, const char *doc, PyObject *base, PyObject *dict); PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); /* In exceptions.c */ #ifndef Py_LIMITED_API /* Helper that attempts to replace the current exception with one of the * same type but with a prefix added to the exception text. The resulting * exception description looks like: * * prefix (exc_type: original_exc_str) * * Only some exceptions can be safely replaced. If the function determines * it isn't safe to perform the replacement, it will leave the original * unmodified exception in place. * * Returns a borrowed reference to the new exception (if any), NULL if the * existing exception was left in place. */ PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause( const char *prefix_format, /* ASCII-encoded string */ ... ); #endif /* In sigcheck.c or signalmodule.c */ PyAPI_FUNC(int) PyErr_CheckSignals(void); PyAPI_FUNC(void) PyErr_SetInterrupt(void); /* In signalmodule.c */ #ifndef Py_LIMITED_API int PySignal_SetWakeupFd(int fd); #endif /* Support for adding program text to SyntaxErrors */ PyAPI_FUNC(void) PyErr_SyntaxLocation( const char *filename, /* decoded from the filesystem encoding */ int lineno); PyAPI_FUNC(void) PyErr_SyntaxLocationEx( const char *filename, /* decoded from the filesystem encoding */ int lineno, int col_offset); #ifndef Py_LIMITED_API PyAPI_FUNC(void) PyErr_SyntaxLocationObject( PyObject *filename, int lineno, int col_offset); #endif PyAPI_FUNC(PyObject *) PyErr_ProgramText( const char *filename, /* decoded from the filesystem encoding */ int lineno); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( PyObject *filename, int lineno); #endif /* The following functions are used to create and modify unicode exceptions from C */ /* create a UnicodeDecodeError object */ PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( const char *encoding, /* UTF-8 encoded string */ const char *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); /* create a UnicodeEncodeError object */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( const char *encoding, /* UTF-8 encoded string */ const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); #endif /* create a UnicodeTranslateError object */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create( PyObject *object, Py_ssize_t start, Py_ssize_t end, const char *reason /* UTF-8 encoded string */ ); #endif /* get the encoding attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); /* get the object attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *); /* get the value of the start attribute (the int * may not be NULL) return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *); /* assign a new value to the start attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t); /* get the value of the end attribute (the int *may not be NULL) return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *); /* assign a new value to the end attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t); /* get the value of the reason attribute */ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *); PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *); /* assign a new value to the reason attribute return 0 on success, -1 on failure */ PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( PyObject *exc, const char *reason /* UTF-8 encoded string */ ); PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( PyObject *exc, const char *reason /* UTF-8 encoded string */ ); PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( PyObject *exc, const char *reason /* UTF-8 encoded string */ ); /* These APIs aren't really part of the error implementation, but often needed to format error messages; the native C lib APIs are not available on all platforms, which is why we provide emulations for those platforms in Python/mysnprintf.c, WARNING: The return value of snprintf varies across platforms; do not rely on any particular behavior; eventually the C99 defn may be reliable. */ #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) # define HAVE_SNPRINTF # define snprintf _snprintf # define vsnprintf _vsnprintf #endif #include <stdarg.h> PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 3, 4))); PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) Py_GCC_ATTRIBUTE((format(printf, 3, 0))); #ifdef __cplusplus } #endif #endif /* !Py_ERRORS_H */ python3.6m/pyexpat.h 0000644 00000004622 15063602042 0010336 0 ustar 00 /* Stuff to export relevant 'expat' entry points from pyexpat to other * parser modules, such as cElementTree. */ /* note: you must import expat.h before importing this module! */ #define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1" #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" struct PyExpat_CAPI { char* magic; /* set to PyExpat_CAPI_MAGIC */ int size; /* set to sizeof(struct PyExpat_CAPI) */ int MAJOR_VERSION; int MINOR_VERSION; int MICRO_VERSION; /* pointers to selected expat functions. add new functions at the end, if needed */ const XML_LChar * (*ErrorString)(enum XML_Error code); enum XML_Error (*GetErrorCode)(XML_Parser parser); XML_Size (*GetErrorColumnNumber)(XML_Parser parser); XML_Size (*GetErrorLineNumber)(XML_Parser parser); enum XML_Status (*Parse)( XML_Parser parser, const char *s, int len, int isFinal); XML_Parser (*ParserCreate_MM)( const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator); void (*ParserFree)(XML_Parser parser); void (*SetCharacterDataHandler)( XML_Parser parser, XML_CharacterDataHandler handler); void (*SetCommentHandler)( XML_Parser parser, XML_CommentHandler handler); void (*SetDefaultHandlerExpand)( XML_Parser parser, XML_DefaultHandler handler); void (*SetElementHandler)( XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); void (*SetNamespaceDeclHandler)( XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); void (*SetProcessingInstructionHandler)( XML_Parser parser, XML_ProcessingInstructionHandler handler); void (*SetUnknownEncodingHandler)( XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData); void (*SetUserData)(XML_Parser parser, void *userData); void (*SetStartDoctypeDeclHandler)(XML_Parser parser, XML_StartDoctypeDeclHandler start); enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding); int (*DefaultUnknownEncodingHandler)( void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); /* might be none for expat < 2.1.0 */ int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt); /* always add new stuff to the end! */ }; python3.6m/pyfpe.h 0000644 00000020427 15063602042 0007770 0 ustar 00 #ifndef Py_PYFPE_H #define Py_PYFPE_H #ifdef __cplusplus extern "C" { #endif /* --------------------------------------------------------------------- / Copyright (c) 1996. \ | The Regents of the University of California. | | All rights reserved. | | | | Permission to use, copy, modify, and distribute this software for | | any purpose without fee is hereby granted, provided that this en- | | tire notice is included in all copies of any software which is or | | includes a copy or modification of this software and in all | | copies of the supporting documentation for such software. | | | | This work was produced at the University of California, Lawrence | | Livermore National Laboratory under contract no. W-7405-ENG-48 | | between the U.S. Department of Energy and The Regents of the | | University of California for the operation of UC LLNL. | | | | DISCLAIMER | | | | This software was prepared as an account of work sponsored by an | | agency of the United States Government. Neither the United States | | Government nor the University of California nor any of their em- | | ployees, makes any warranty, express or implied, or assumes any | | liability or responsibility for the accuracy, completeness, or | | usefulness of any information, apparatus, product, or process | | disclosed, or represents that its use would not infringe | | privately-owned rights. Reference herein to any specific commer- | | cial products, process, or service by trade name, trademark, | | manufacturer, or otherwise, does not necessarily constitute or | | imply its endorsement, recommendation, or favoring by the United | | States Government or the University of California. The views and | | opinions of authors expressed herein do not necessarily state or | | reflect those of the United States Government or the University | | of California, and shall not be used for advertising or product | \ endorsement purposes. / --------------------------------------------------------------------- */ /* * Define macros for handling SIGFPE. * Lee Busby, LLNL, November, 1996 * busby1@llnl.gov * ********************************************* * Overview of the system for handling SIGFPE: * * This file (Include/pyfpe.h) defines a couple of "wrapper" macros for * insertion into your Python C code of choice. Their proper use is * discussed below. The file Python/pyfpe.c defines a pair of global * variables PyFPE_jbuf and PyFPE_counter which are used by the signal * handler for SIGFPE to decide if a particular exception was protected * by the macros. The signal handler itself, and code for enabling the * generation of SIGFPE in the first place, is in a (new) Python module * named fpectl. This module is standard in every respect. It can be loaded * either statically or dynamically as you choose, and like any other * Python module, has no effect until you import it. * * In the general case, there are three steps toward handling SIGFPE in any * Python code: * * 1) Add the *_PROTECT macros to your C code as required to protect * dangerous floating point sections. * * 2) Turn on the inclusion of the code by adding the ``--with-fpectl'' * flag at the time you run configure. If the fpectl or other modules * which use the *_PROTECT macros are to be dynamically loaded, be * sure they are compiled with WANT_SIGFPE_HANDLER defined. * * 3) When python is built and running, import fpectl, and execute * fpectl.turnon_sigfpe(). This sets up the signal handler and enables * generation of SIGFPE whenever an exception occurs. From this point * on, any properly trapped SIGFPE should result in the Python * FloatingPointError exception. * * Step 1 has been done already for the Python kernel code, and should be * done soon for the NumPy array package. Step 2 is usually done once at * python install time. Python's behavior with respect to SIGFPE is not * changed unless you also do step 3. Thus you can control this new * facility at compile time, or run time, or both. * ******************************** * Using the macros in your code: * * static PyObject *foobar(PyObject *self,PyObject *args) * { * .... * PyFPE_START_PROTECT("Error in foobar", return 0) * result = dangerous_op(somearg1, somearg2, ...); * PyFPE_END_PROTECT(result) * .... * } * * If a floating point error occurs in dangerous_op, foobar returns 0 (NULL), * after setting the associated value of the FloatingPointError exception to * "Error in foobar". ``Dangerous_op'' can be a single operation, or a block * of code, function calls, or any combination, so long as no alternate * return is possible before the PyFPE_END_PROTECT macro is reached. * * The macros can only be used in a function context where an error return * can be recognized as signaling a Python exception. (Generally, most * functions that return a PyObject * will qualify.) * * Guido's original design suggestion for PyFPE_START_PROTECT and * PyFPE_END_PROTECT had them open and close a local block, with a locally * defined jmp_buf and jmp_buf pointer. This would allow recursive nesting * of the macros. The Ansi C standard makes it clear that such local * variables need to be declared with the "volatile" type qualifier to keep * setjmp from corrupting their values. Some current implementations seem * to be more restrictive. For example, the HPUX man page for setjmp says * * Upon the return from a setjmp() call caused by a longjmp(), the * values of any non-static local variables belonging to the routine * from which setjmp() was called are undefined. Code which depends on * such values is not guaranteed to be portable. * * I therefore decided on a more limited form of nesting, using a counter * variable (PyFPE_counter) to keep track of any recursion. If an exception * occurs in an ``inner'' pair of macros, the return will apparently * come from the outermost level. * */ #ifdef WANT_SIGFPE_HANDLER #include <signal.h> #include <setjmp.h> #include <math.h> extern jmp_buf PyFPE_jbuf; extern int PyFPE_counter; extern double PyFPE_dummy(void *); #define PyFPE_START_PROTECT(err_string, leave_stmt) \ if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \ PyErr_SetString(PyExc_FloatingPointError, err_string); \ PyFPE_counter = 0; \ leave_stmt; \ } /* * This (following) is a heck of a way to decrement a counter. However, * unless the macro argument is provided, code optimizers will sometimes move * this statement so that it gets executed *before* the unsafe expression * which we're trying to protect. That pretty well messes things up, * of course. * * If the expression(s) you're trying to protect don't happen to return a * value, you will need to manufacture a dummy result just to preserve the * correct ordering of statements. Note that the macro passes the address * of its argument (so you need to give it something which is addressable). * If your expression returns multiple results, pass the last such result * to PyFPE_END_PROTECT. * * Note that PyFPE_dummy returns a double, which is cast to int. * This seeming insanity is to tickle the Floating Point Unit (FPU). * If an exception has occurred in a preceding floating point operation, * some architectures (notably Intel 80x86) will not deliver the interrupt * until the *next* floating point operation. This is painful if you've * already decremented PyFPE_counter. */ #define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v)); #else #define PyFPE_START_PROTECT(err_string, leave_stmt) #define PyFPE_END_PROTECT(v) #endif #ifdef __cplusplus } #endif #endif /* !Py_PYFPE_H */ python3.6m/pygetopt.h 0000644 00000000632 15063602042 0010514 0 ustar 00 #ifndef Py_PYGETOPT_H #define Py_PYGETOPT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_DATA(int) _PyOS_opterr; PyAPI_DATA(int) _PyOS_optind; PyAPI_DATA(wchar_t *) _PyOS_optarg; PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); PyAPI_FUNC(int) _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_PYGETOPT_H */ python3.6m/pyhash.h 0000644 00000010053 15063602042 0010133 0 ustar 00 #ifndef Py_HASH_H #define Py_HASH_H #ifdef __cplusplus extern "C" { #endif /* Helpers for hash functions */ #ifndef Py_LIMITED_API PyAPI_FUNC(Py_hash_t) _Py_HashDouble(double); PyAPI_FUNC(Py_hash_t) _Py_HashPointer(void*); PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t); #endif /* Prime multiplier used in string and various other hashes. */ #define _PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */ /* Parameters used for the numeric hash implementation. See notes for _Py_HashDouble in Python/pyhash.c. Numeric hashes are based on reduction modulo the prime 2**_PyHASH_BITS - 1. */ #if SIZEOF_VOID_P >= 8 # define _PyHASH_BITS 61 #else # define _PyHASH_BITS 31 #endif #define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) #define _PyHASH_INF 314159 #define _PyHASH_NAN 0 #define _PyHASH_IMAG _PyHASH_MULTIPLIER /* hash secret * * memory layout on 64 bit systems * cccccccc cccccccc cccccccc uc -- unsigned char[24] * pppppppp ssssssss ........ fnv -- two Py_hash_t * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t * ........ ........ ssssssss djbx33a -- 16 bytes padding + one Py_hash_t * ........ ........ eeeeeeee pyexpat XML hash salt * * memory layout on 32 bit systems * cccccccc cccccccc cccccccc uc * ppppssss ........ ........ fnv -- two Py_hash_t * k0k0k0k0 k1k1k1k1 ........ siphash -- two uint64_t (*) * ........ ........ ssss.... djbx33a -- 16 bytes padding + one Py_hash_t * ........ ........ eeee.... pyexpat XML hash salt * * (*) The siphash member may not be available on 32 bit platforms without * an unsigned int64 data type. */ #ifndef Py_LIMITED_API typedef union { /* ensure 24 bytes */ unsigned char uc[24]; /* two Py_hash_t for FNV */ struct { Py_hash_t prefix; Py_hash_t suffix; } fnv; /* two uint64 for SipHash24 */ struct { uint64_t k0; uint64_t k1; } siphash; /* a different (!) Py_hash_t for small string optimization */ struct { unsigned char padding[16]; Py_hash_t suffix; } djbx33a; struct { unsigned char padding[16]; Py_hash_t hashsalt; } expat; } _Py_HashSecret_t; PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; #endif #ifdef Py_DEBUG PyAPI_DATA(int) _Py_HashSecret_Initialized; #endif /* hash function definition */ #ifndef Py_LIMITED_API typedef struct { Py_hash_t (*const hash)(const void *, Py_ssize_t); const char *name; const int hash_bits; const int seed_bits; } PyHash_FuncDef; PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void); #endif /* cutoff for small string DJBX33A optimization in range [1, cutoff). * * About 50% of the strings in a typical Python application are smaller than * 6 to 7 chars. However DJBX33A is vulnerable to hash collision attacks. * NEVER use DJBX33A for long strings! * * A Py_HASH_CUTOFF of 0 disables small string optimization. 32 bit platforms * should use a smaller cutoff because it is easier to create colliding * strings. A cutoff of 7 on 64bit platforms and 5 on 32bit platforms should * provide a decent safety margin. */ #ifndef Py_HASH_CUTOFF # define Py_HASH_CUTOFF 0 #elif (Py_HASH_CUTOFF > 7 || Py_HASH_CUTOFF < 0) # error Py_HASH_CUTOFF must in range 0...7. #endif /* Py_HASH_CUTOFF */ /* hash algorithm selection * * The values for Py_HASH_SIPHASH24 and Py_HASH_FNV are hard-coded in the * configure script. * * - FNV is available on all platforms and architectures. * - SIPHASH24 only works on plaforms that don't require aligned memory for integers. * - With EXTERNAL embedders can provide an alternative implementation with:: * * PyHash_FuncDef PyHash_Func = {...}; * * XXX: Figure out __declspec() for extern PyHash_FuncDef. */ #define Py_HASH_EXTERNAL 0 #define Py_HASH_SIPHASH24 1 #define Py_HASH_FNV 2 #ifndef Py_HASH_ALGORITHM # ifndef HAVE_ALIGNED_REQUIRED # define Py_HASH_ALGORITHM Py_HASH_SIPHASH24 # else # define Py_HASH_ALGORITHM Py_HASH_FNV # endif /* uint64_t && uint32_t && aligned */ #endif /* Py_HASH_ALGORITHM */ #ifdef __cplusplus } #endif #endif /* !Py_HASH_H */ python3.6m/pylifecycle.h 0000644 00000007756 15063602042 0011167 0 ustar 00 /* Interfaces to configure, query, create & destroy the Python runtime */ #ifndef Py_PYLIFECYCLE_H #define Py_PYLIFECYCLE_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(void) Py_SetProgramName(wchar_t *); PyAPI_FUNC(wchar_t *) Py_GetProgramName(void); PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *); PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void); #ifndef Py_LIMITED_API /* Only used by applications that embed the interpreter and need to * override the standard encoding determination mechanism */ PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding, const char *errors); #endif PyAPI_FUNC(void) Py_Initialize(void); PyAPI_FUNC(void) Py_InitializeEx(int); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int); #endif PyAPI_FUNC(void) Py_Finalize(void); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(int) Py_FinalizeEx(void); #endif PyAPI_FUNC(int) Py_IsInitialized(void); PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level * exit functions. */ #ifndef Py_LIMITED_API PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void)); #endif PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); PyAPI_FUNC(void) Py_Exit(int); /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */ #ifndef Py_LIMITED_API PyAPI_FUNC(void) _Py_RestoreSignals(void); PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); #endif /* Bootstrap __main__ (defined in Modules/main.c) */ PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv); /* In getpath.c */ PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void); PyAPI_FUNC(wchar_t *) Py_GetPrefix(void); PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void); PyAPI_FUNC(wchar_t *) Py_GetPath(void); PyAPI_FUNC(void) Py_SetPath(const wchar_t *); #ifdef MS_WINDOWS int _Py_CheckPython3(); #endif /* In their own files */ PyAPI_FUNC(const char *) Py_GetVersion(void); PyAPI_FUNC(const char *) Py_GetPlatform(void); PyAPI_FUNC(const char *) Py_GetCopyright(void); PyAPI_FUNC(const char *) Py_GetCompiler(void); PyAPI_FUNC(const char *) Py_GetBuildInfo(void); #ifndef Py_LIMITED_API PyAPI_FUNC(const char *) _Py_gitidentifier(void); PyAPI_FUNC(const char *) _Py_gitversion(void); #endif /* Internal -- various one-time initializations */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); PyAPI_FUNC(PyObject *) _PySys_Init(void); PyAPI_FUNC(void) _PyImport_Init(void); PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod); PyAPI_FUNC(void) _PyImportHooks_Init(void); PyAPI_FUNC(int) _PyFrame_Init(void); PyAPI_FUNC(int) _PyFloat_Init(void); PyAPI_FUNC(int) PyByteArray_Init(void); PyAPI_FUNC(void) _PyRandom_Init(void); #endif /* Various internal finalizers */ #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyExc_Fini(void); PyAPI_FUNC(void) _PyImport_Fini(void); PyAPI_FUNC(void) PyMethod_Fini(void); PyAPI_FUNC(void) PyFrame_Fini(void); PyAPI_FUNC(void) PyCFunction_Fini(void); PyAPI_FUNC(void) PyDict_Fini(void); PyAPI_FUNC(void) PyTuple_Fini(void); PyAPI_FUNC(void) PyList_Fini(void); PyAPI_FUNC(void) PySet_Fini(void); PyAPI_FUNC(void) PyBytes_Fini(void); PyAPI_FUNC(void) PyByteArray_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void); PyAPI_FUNC(void) _PyGC_Fini(void); PyAPI_FUNC(void) PySlice_Fini(void); PyAPI_FUNC(void) _PyType_Fini(void); PyAPI_FUNC(void) _PyRandom_Fini(void); PyAPI_FUNC(void) PyAsyncGen_Fini(void); PyAPI_DATA(PyThreadState *) _Py_Finalizing; #endif /* Signals */ typedef void (*PyOS_sighandler_t)(int); PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); #ifndef Py_LIMITED_API /* Random */ PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size); PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_PYLIFECYCLE_H */ python3.6m/pymacconfig.h 0000644 00000005655 15063602042 0011152 0 ustar 00 #ifndef PYMACCONFIG_H #define PYMACCONFIG_H /* * This file moves some of the autoconf magic to compile-time * when building on MacOSX. This is needed for building 4-way * universal binaries and for 64-bit universal binaries because * the values redefined below aren't configure-time constant but * only compile-time constant in these scenarios. */ #if defined(__APPLE__) # undef SIZEOF_LONG # undef SIZEOF_PTHREAD_T # undef SIZEOF_SIZE_T # undef SIZEOF_TIME_T # undef SIZEOF_VOID_P # undef SIZEOF__BOOL # undef SIZEOF_UINTPTR_T # undef SIZEOF_PTHREAD_T # undef WORDS_BIGENDIAN # undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 # undef DOUBLE_IS_BIG_ENDIAN_IEEE754 # undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 # undef HAVE_GCC_ASM_FOR_X87 # undef VA_LIST_IS_ARRAY # if defined(__LP64__) && defined(__x86_64__) # define VA_LIST_IS_ARRAY 1 # endif # undef HAVE_LARGEFILE_SUPPORT # ifndef __LP64__ # define HAVE_LARGEFILE_SUPPORT 1 # endif # undef SIZEOF_LONG # ifdef __LP64__ # define SIZEOF__BOOL 1 # define SIZEOF__BOOL 1 # define SIZEOF_LONG 8 # define SIZEOF_PTHREAD_T 8 # define SIZEOF_SIZE_T 8 # define SIZEOF_TIME_T 8 # define SIZEOF_VOID_P 8 # define SIZEOF_UINTPTR_T 8 # define SIZEOF_PTHREAD_T 8 # else # ifdef __ppc__ # define SIZEOF__BOOL 4 # else # define SIZEOF__BOOL 1 # endif # define SIZEOF_LONG 4 # define SIZEOF_PTHREAD_T 4 # define SIZEOF_SIZE_T 4 # define SIZEOF_TIME_T 4 # define SIZEOF_VOID_P 4 # define SIZEOF_UINTPTR_T 4 # define SIZEOF_PTHREAD_T 4 # endif # if defined(__LP64__) /* MacOSX 10.4 (the first release to support 64-bit code * at all) only supports 64-bit in the UNIX layer. * Therefore suppress the toolbox-glue in 64-bit mode. */ /* In 64-bit mode setpgrp always has no arguments, in 32-bit * mode that depends on the compilation environment */ # undef SETPGRP_HAVE_ARG # endif #ifdef __BIG_ENDIAN__ #define WORDS_BIGENDIAN 1 #define DOUBLE_IS_BIG_ENDIAN_IEEE754 #else #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 #endif /* __BIG_ENDIAN */ #ifdef __i386__ # define HAVE_GCC_ASM_FOR_X87 #endif /* * The definition in pyconfig.h is only valid on the OS release * where configure ran on and not necessarily for all systems where * the executable can be used on. * * Specifically: OSX 10.4 has limited supported for '%zd', while * 10.5 has full support for '%zd'. A binary built on 10.5 won't * work properly on 10.4 unless we suppress the definition * of PY_FORMAT_SIZE_T */ #undef PY_FORMAT_SIZE_T #endif /* defined(_APPLE__) */ #endif /* PYMACCONFIG_H */ python3.6m/pymacro.h 0000644 00000006654 15063602042 0010325 0 ustar 00 #ifndef Py_PYMACRO_H #define Py_PYMACRO_H /* Minimum value between x and y */ #define Py_MIN(x, y) (((x) > (y)) ? (y) : (x)) /* Maximum value between x and y */ #define Py_MAX(x, y) (((x) > (y)) ? (x) : (y)) /* Absolute value of the number x */ #define Py_ABS(x) ((x) < 0 ? -(x) : (x)) #define _Py_XSTRINGIFY(x) #x /* Convert the argument to a string. For example, Py_STRINGIFY(123) is replaced with "123" by the preprocessor. Defines are also replaced by their value. For example Py_STRINGIFY(__LINE__) is replaced by the line number, not by "__LINE__". */ #define Py_STRINGIFY(x) _Py_XSTRINGIFY(x) /* Get the size of a structure member in bytes */ #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) /* Argument must be a char or an int in [-128, 127] or [0, 255]. */ #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) /* Assert a build-time dependency, as an expression. Your compile will fail if the condition isn't true, or can't be evaluated by the compiler. This can be used in an expression: its value is 0. Example: #define foo_to_char(foo) \ ((char *)(foo) \ + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0)) Written by Rusty Russell, public domain, http://ccodearchive.net/ */ #define Py_BUILD_ASSERT_EXPR(cond) \ (sizeof(char [1 - 2*!(cond)]) - 1) #define Py_BUILD_ASSERT(cond) do { \ (void)Py_BUILD_ASSERT_EXPR(cond); \ } while(0) /* Get the number of elements in a visible array This does not work on pointers, or arrays declared as [], or function parameters. With correct compiler support, such usage will cause a build error (see Py_BUILD_ASSERT_EXPR). Written by Rusty Russell, public domain, http://ccodearchive.net/ Requires at GCC 3.1+ */ #if (defined(__GNUC__) && !defined(__STRICT_ANSI__) && \ (((__GNUC__ == 3) && (__GNU_MINOR__ >= 1)) || (__GNUC__ >= 4))) /* Two gcc extensions. &a[0] degrades to a pointer: a different type from an array */ #define Py_ARRAY_LENGTH(array) \ (sizeof(array) / sizeof((array)[0]) \ + Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(typeof(array), \ typeof(&(array)[0])))) #else #define Py_ARRAY_LENGTH(array) \ (sizeof(array) / sizeof((array)[0])) #endif /* Define macros for inline documentation. */ #define PyDoc_VAR(name) static char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #ifdef WITH_DOC_STRINGS #define PyDoc_STR(str) str #else #define PyDoc_STR(str) "" #endif /* Below "a" is a power of 2. */ /* Round down size "n" to be a multiple of "a". */ #define _Py_SIZE_ROUND_DOWN(n, a) ((size_t)(n) & ~(size_t)((a) - 1)) /* Round up size "n" to be a multiple of "a". */ #define _Py_SIZE_ROUND_UP(n, a) (((size_t)(n) + \ (size_t)((a) - 1)) & ~(size_t)((a) - 1)) /* Round pointer "p" down to the closest "a"-aligned address <= "p". */ #define _Py_ALIGN_DOWN(p, a) ((void *)((uintptr_t)(p) & ~(uintptr_t)((a) - 1))) /* Round pointer "p" up to the closest "a"-aligned address >= "p". */ #define _Py_ALIGN_UP(p, a) ((void *)(((uintptr_t)(p) + \ (uintptr_t)((a) - 1)) & ~(uintptr_t)((a) - 1))) /* Check if pointer "p" is aligned to "a"-bytes boundary. */ #define _Py_IS_ALIGNED(p, a) (!((uintptr_t)(p) & (uintptr_t)((a) - 1))) #ifdef __GNUC__ #define Py_UNUSED(name) _unused_ ## name __attribute__((unused)) #else #define Py_UNUSED(name) _unused_ ## name #endif #endif /* Py_PYMACRO_H */ python3.6m/pymath.h 0000644 00000020170 15063602042 0010142 0 ustar 00 #ifndef Py_PYMATH_H #define Py_PYMATH_H #include "pyconfig.h" /* include for defines */ /************************************************************************** Symbols and macros to supply platform-independent interfaces to mathematical functions and constants **************************************************************************/ /* Python provides implementations for copysign, round and hypot in * Python/pymath.c just in case your math library doesn't provide the * functions. * *Note: PC/pyconfig.h defines copysign as _copysign */ #ifndef HAVE_COPYSIGN extern double copysign(double, double); #endif #ifndef HAVE_ROUND extern double round(double); #endif #ifndef HAVE_HYPOT extern double hypot(double, double); #endif /* extra declarations */ #ifndef _MSC_VER #ifndef __STDC__ extern double fmod (double, double); extern double frexp (double, int *); extern double ldexp (double, int); extern double modf (double, double *); extern double pow(double, double); #endif /* __STDC__ */ #endif /* _MSC_VER */ /* High precision definition of pi and e (Euler) * The values are taken from libc6's math.h. */ #ifndef Py_MATH_PIl #define Py_MATH_PIl 3.1415926535897932384626433832795029L #endif #ifndef Py_MATH_PI #define Py_MATH_PI 3.14159265358979323846 #endif #ifndef Py_MATH_El #define Py_MATH_El 2.7182818284590452353602874713526625L #endif #ifndef Py_MATH_E #define Py_MATH_E 2.7182818284590452354 #endif /* Tau (2pi) to 40 digits, taken from tauday.com/tau-digits. */ #ifndef Py_MATH_TAU #define Py_MATH_TAU 6.2831853071795864769252867665590057683943L #endif /* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU register and into a 64-bit memory location, rounding from extended precision to double precision in the process. On other platforms it does nothing. */ /* we take double rounding as evidence of x87 usage */ #ifndef Py_LIMITED_API #ifndef Py_FORCE_DOUBLE # ifdef X87_DOUBLE_ROUNDING PyAPI_FUNC(double) _Py_force_double(double); # define Py_FORCE_DOUBLE(X) (_Py_force_double(X)) # else # define Py_FORCE_DOUBLE(X) (X) # endif #endif #endif #ifndef Py_LIMITED_API #ifdef HAVE_GCC_ASM_FOR_X87 PyAPI_FUNC(unsigned short) _Py_get_387controlword(void); PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); #endif #endif /* Py_IS_NAN(X) * Return 1 if float or double arg is a NaN, else 0. * Caution: * X is evaluated more than once. * This may not work on all platforms. Each platform has *some* * way to spell this, though -- override in pyconfig.h if you have * a platform where it doesn't work. * Note: PC/pyconfig.h defines Py_IS_NAN as _isnan */ #ifndef Py_IS_NAN #if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1 #define Py_IS_NAN(X) isnan(X) #else #define Py_IS_NAN(X) ((X) != (X)) #endif #endif /* Py_IS_INFINITY(X) * Return 1 if float or double arg is an infinity, else 0. * Caution: * X is evaluated more than once. * This implementation may set the underflow flag if |X| is very small; * it really can't be implemented correctly (& easily) before C99. * Override in pyconfig.h if you have a better spelling on your platform. * Py_FORCE_DOUBLE is used to avoid getting false negatives from a * non-infinite value v sitting in an 80-bit x87 register such that * v becomes infinite when spilled from the register to 64-bit memory. * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf */ #ifndef Py_IS_INFINITY # if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 # define Py_IS_INFINITY(X) isinf(X) # else # define Py_IS_INFINITY(X) ((X) && \ (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X))) # endif #endif /* Py_IS_FINITE(X) * Return 1 if float or double arg is neither infinite nor NAN, else 0. * Some compilers (e.g. VisualStudio) have intrisics for this, so a special * macro for this particular test is useful * Note: PC/pyconfig.h defines Py_IS_FINITE as _finite */ #ifndef Py_IS_FINITE #if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1 #define Py_IS_FINITE(X) isfinite(X) #elif defined HAVE_FINITE #define Py_IS_FINITE(X) finite(X) #else #define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) #endif #endif /* HUGE_VAL is supposed to expand to a positive double infinity. Python * uses Py_HUGE_VAL instead because some platforms are broken in this * respect. We used to embed code in pyport.h to try to worm around that, * but different platforms are broken in conflicting ways. If you're on * a platform where HUGE_VAL is defined incorrectly, fiddle your Python * config to #define Py_HUGE_VAL to something that works on your platform. */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif /* Py_NAN * A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or * INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform * doesn't support NaNs. */ #if !defined(Py_NAN) && !defined(Py_NO_NAN) #if !defined(__INTEL_COMPILER) #define Py_NAN (Py_HUGE_VAL * 0.) #else /* __INTEL_COMPILER */ #if defined(ICC_NAN_STRICT) #pragma float_control(push) #pragma float_control(precise, on) #pragma float_control(except, on) #if defined(_MSC_VER) __declspec(noinline) #else /* Linux */ __attribute__((noinline)) #endif /* _MSC_VER */ static double __icc_nan() { return sqrt(-1.0); } #pragma float_control (pop) #define Py_NAN __icc_nan() #else /* ICC_NAN_RELAXED as default for Intel Compiler */ static const union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f}; #define Py_NAN (__nan_store.__icc_nan) #endif /* ICC_NAN_STRICT */ #endif /* __INTEL_COMPILER */ #endif /* Py_OVERFLOWED(X) * Return 1 iff a libm function overflowed. Set errno to 0 before calling * a libm function, and invoke this macro after, passing the function * result. * Caution: * This isn't reliable. C99 no longer requires libm to set errno under * any exceptional condition, but does require +- HUGE_VAL return * values on overflow. A 754 box *probably* maps HUGE_VAL to a * double infinity, and we're cool if that's so, unless the input * was an infinity and an infinity is the expected result. A C89 * system sets errno to ERANGE, so we check for that too. We're * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or * if the returned result is a NaN, or if a C89 box returns HUGE_VAL * in non-overflow cases. * X is evaluated more than once. * Some platforms have better way to spell this, so expect some #ifdef'ery. * * OpenBSD uses 'isinf()' because a compiler bug on that platform causes * the longer macro version to be mis-compiled. This isn't optimal, and * should be removed once a newer compiler is available on that platform. * The system that had the failure was running OpenBSD 3.2 on Intel, with * gcc 2.95.3. * * According to Tim's checkin, the FreeBSD systems use isinf() to work * around a FPE bug on that platform. */ #if defined(__FreeBSD__) || defined(__OpenBSD__) #define Py_OVERFLOWED(X) isinf(X) #else #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ (X) == Py_HUGE_VAL || \ (X) == -Py_HUGE_VAL)) #endif /* Return whether integral type *type* is signed or not. */ #define _Py_IntegralTypeSigned(type) ((type)(-1) < 0) /* Return the maximum value of integral type *type*. */ #define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0) /* Return the minimum value of integral type *type*. */ #define _Py_IntegralTypeMin(type) ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0) /* Check whether *v* is in the range of integral type *type*. This is most * useful if *v* is floating-point, since demoting a floating-point *v* to an * integral type that cannot represent *v*'s integral part is undefined * behavior. */ #define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) #endif /* Py_PYMATH_H */ python3.6m/pymem.h 0000644 00000020555 15063602042 0007776 0 ustar 00 /* The PyMem_ family: low-level memory allocation interfaces. See objimpl.h for the PyObject_ memory family. */ #ifndef Py_PYMEM_H #define Py_PYMEM_H #include "pyport.h" #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size); PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize); PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_RawFree(void *ptr); /* Configure the Python memory allocators. Pass NULL to use default allocators. */ PyAPI_FUNC(int) _PyMem_SetupAllocators(const char *opt); #ifdef WITH_PYMALLOC PyAPI_FUNC(int) _PyMem_PymallocEnabled(void); #endif /* Identifier of an address space (domain) in tracemalloc */ typedef unsigned int _PyTraceMalloc_domain_t; /* Track an allocated memory block in the tracemalloc module. Return 0 on success, return -1 on error (failed to allocate memory to store the trace). Return -2 if tracemalloc is disabled. If memory block is already tracked, update the existing trace. */ PyAPI_FUNC(int) _PyTraceMalloc_Track( _PyTraceMalloc_domain_t domain, uintptr_t ptr, size_t size); /* Untrack an allocated memory block in the tracemalloc module. Do nothing if the block was not tracked. Return -2 if tracemalloc is disabled, otherwise return 0. */ PyAPI_FUNC(int) _PyTraceMalloc_Untrack( _PyTraceMalloc_domain_t domain, uintptr_t ptr); /* Get the traceback where a memory block was allocated. Return a tuple of (filename: str, lineno: int) tuples. Return None if the tracemalloc module is disabled or if the memory block is not tracked by tracemalloc. Raise an exception and return NULL on error. */ PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback( _PyTraceMalloc_domain_t domain, uintptr_t ptr); PyAPI_FUNC(int) _PyMem_IsFreed(void *ptr, size_t size); #endif /* !defined(Py_LIMITED_API) */ /* BEWARE: Each interface exports both functions and macros. Extension modules should use the functions, to ensure binary compatibility across Python versions. Because the Python implementation is free to change internal details, and the macros may (or may not) expose details for speed, if you do use the macros you must recompile your extensions with each Python release. Never mix calls to PyMem_ with calls to the platform malloc/realloc/ calloc/free. For example, on Windows different DLLs may end up using different heaps, and if you use PyMem_Malloc you'll get the memory from the heap used by the Python DLL; it could be a disaster if you free()'ed that directly in your own extension. Using PyMem_Free instead ensures Python can return the memory to the proper heap. As another example, in PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_ memory functions in special debugging wrappers that add additional debugging info to dynamic memory blocks. The system routines have no idea what to do with that stuff, and the Python wrappers have no idea what to do with raw blocks obtained directly by the system routines then. The GIL must be held when using these APIs. */ /* * Raw memory interface * ==================== */ /* Functions Functions supplying platform-independent semantics for malloc/realloc/ free. These functions make sure that allocating 0 bytes returns a distinct non-NULL pointer (whenever possible -- if we're flat out of memory, NULL may be returned), even if the platform malloc and realloc don't. Returned pointers must be checked for NULL explicitly. No action is performed on failure (no exception is set, no warning is printed, etc). */ PyAPI_FUNC(void *) PyMem_Malloc(size_t size); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); #endif PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_Free(void *ptr); #ifndef Py_LIMITED_API PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str); PyAPI_FUNC(char *) _PyMem_Strdup(const char *str); #endif /* Macros. */ /* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL for malloc(0), which would be treated as an error. Some platforms would return a pointer with no memory behind it, which would break pymalloc. To solve these problems, allocate an extra byte. */ /* Returns NULL to indicate error if a negative size or size larger than Py_ssize_t can represent is supplied. Helps prevents security holes. */ #define PyMem_MALLOC(n) PyMem_Malloc(n) #define PyMem_REALLOC(p, n) PyMem_Realloc(p, n) #define PyMem_FREE(p) PyMem_Free(p) /* * Type-oriented memory interface * ============================== * * Allocate memory for n objects of the given type. Returns a new pointer * or NULL if the request was too large or memory allocation failed. Use * these macros rather than doing the multiplication yourself so that proper * overflow checking is always done. */ #define PyMem_New(type, n) \ ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) #define PyMem_NEW(type, n) \ ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) /* * The value of (p) is always clobbered by this macro regardless of success. * The caller MUST check if (p) is NULL afterwards and deal with the memory * error if so. This means the original value of (p) MUST be saved for the * caller's memory error handler to not lose track of it. */ #define PyMem_Resize(p, type, n) \ ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) #define PyMem_RESIZE(p, type, n) \ ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) /* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. */ #define PyMem_Del PyMem_Free #define PyMem_DEL PyMem_FREE #ifndef Py_LIMITED_API typedef enum { /* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */ PYMEM_DOMAIN_RAW, /* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */ PYMEM_DOMAIN_MEM, /* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */ PYMEM_DOMAIN_OBJ } PyMemAllocatorDomain; typedef struct { /* user context passed as the first argument to the 4 functions */ void *ctx; /* allocate a memory block */ void* (*malloc) (void *ctx, size_t size); /* allocate a memory block initialized by zeros */ void* (*calloc) (void *ctx, size_t nelem, size_t elsize); /* allocate or resize a memory block */ void* (*realloc) (void *ctx, void *ptr, size_t new_size); /* release a memory block */ void (*free) (void *ctx, void *ptr); } PyMemAllocatorEx; /* Get the memory block allocator of the specified domain. */ PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator); /* Set the memory block allocator of the specified domain. The new allocator must return a distinct non-NULL pointer when requesting zero bytes. For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL is not held when the allocator is called. If the new allocator is not a hook (don't call the previous allocator), the PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks on top on the new allocator. */ PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator); /* Setup hooks to detect bugs in the following Python memory allocator functions: - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree() - PyMem_Malloc(), PyMem_Realloc(), PyMem_Free() - PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() Newly allocated memory is filled with the byte 0xCB, freed memory is filled with the byte 0xDB. Additionnal checks: - detect API violations, ex: PyObject_Free() called on a buffer allocated by PyMem_Malloc() - detect write before the start of the buffer (buffer underflow) - detect write after the end of the buffer (buffer overflow) The function does nothing if Python is not compiled is debug mode. */ PyAPI_FUNC(void) PyMem_SetupDebugHooks(void); #endif #ifdef __cplusplus } #endif #endif /* !Py_PYMEM_H */ python3.6m/pyport.h 0000644 00000065665 15063602042 0010217 0 ustar 00 #ifndef Py_PYPORT_H #define Py_PYPORT_H #include "pyconfig.h" /* include for defines */ #include <inttypes.h> /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic C language & library operations whose spellings vary across platforms. Please try to make documentation here as clear as possible: by definition, the stuff here is trying to illuminate C's darkest corners. Config #defines referenced here: SIGNED_RIGHT_SHIFT_ZERO_FILLS Meaning: To be defined iff i>>j does not extend the sign bit when i is a signed integral type and i < 0. Used in: Py_ARITHMETIC_RIGHT_SHIFT Py_DEBUG Meaning: Extra checks compiled in for debug mode. Used in: Py_SAFE_DOWNCAST **************************************************************************/ /* typedefs for some C9X-defined synonyms for integral types. * * The names in Python are exactly the same as the C9X names, except with a * Py_ prefix. Until C9X is universally implemented, this is the only way * to ensure that Python gets reliable names that don't conflict with names * in non-Python code that are playing their own tricks to define the C9X * names. * * NOTE: don't go nuts here! Python has no use for *most* of the C9X * integral synonyms. Only define the ones we actually need. */ /* long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. */ #ifndef HAVE_LONG_LONG #define HAVE_LONG_LONG 1 #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG long long /* If LLONG_MAX is defined in limits.h, use that. */ #define PY_LLONG_MIN LLONG_MIN #define PY_LLONG_MAX LLONG_MAX #define PY_ULLONG_MAX ULLONG_MAX #endif #define PY_UINT32_T uint32_t #define PY_UINT64_T uint64_t /* Signed variants of the above */ #define PY_INT32_T int32_t #define PY_INT64_T int64_t /* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all the necessary integer types are available, and we're on a 64-bit platform (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ #ifndef PYLONG_BITS_IN_DIGIT #if SIZEOF_VOID_P >= 8 #define PYLONG_BITS_IN_DIGIT 30 #else #define PYLONG_BITS_IN_DIGIT 15 #endif #endif /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again * without loss of information. Similarly for intptr_t, wrt a signed * integral type. */ typedef uintptr_t Py_uintptr_t; typedef intptr_t Py_intptr_t; /* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an * unsigned integral type). See PEP 353 for details. */ #ifdef HAVE_SSIZE_T typedef ssize_t Py_ssize_t; #elif SIZEOF_VOID_P == SIZEOF_SIZE_T typedef Py_intptr_t Py_ssize_t; #else # error "Python needs a typedef for Py_ssize_t in pyport.h." #endif /* Py_hash_t is the same size as a pointer. */ #define SIZEOF_PY_HASH_T SIZEOF_SIZE_T typedef Py_ssize_t Py_hash_t; /* Py_uhash_t is the unsigned equivalent needed to calculate numeric hash. */ #define SIZEOF_PY_UHASH_T SIZEOF_SIZE_T typedef size_t Py_uhash_t; /* Only used for compatibility with code that may not be PY_SSIZE_T_CLEAN. */ #ifdef PY_SSIZE_T_CLEAN typedef Py_ssize_t Py_ssize_clean_t; #else typedef int Py_ssize_clean_t; #endif /* Largest possible value of size_t. */ #define PY_SIZE_MAX SIZE_MAX /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) /* Smallest negative value of type Py_ssize_t. */ #define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) /* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf * format to convert an argument with the width of a size_t or Py_ssize_t. * C99 introduced "z" for this purpose, but not all platforms support that; * e.g., MS compilers use "I" instead. * * These "high level" Python format functions interpret "z" correctly on * all platforms (Python interprets the format string itself, and does whatever * the platform C requires to convert a size_t/Py_ssize_t argument): * * PyBytes_FromFormat * PyErr_Format * PyBytes_FromFormatV * PyUnicode_FromFormatV * * Lower-level uses require that you interpolate the correct format modifier * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for * example, * * Py_ssize_t index; * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index); * * That will expand to %ld, or %Id, or to something else correct for a * Py_ssize_t on the platform. */ #ifndef PY_FORMAT_SIZE_T # if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) # define PY_FORMAT_SIZE_T "" # elif SIZEOF_SIZE_T == SIZEOF_LONG # define PY_FORMAT_SIZE_T "l" # elif defined(MS_WINDOWS) # define PY_FORMAT_SIZE_T "I" # else # error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" # endif #endif /* Py_LOCAL can be used instead of static to get the fastest possible calling * convention for functions that are local to a given module. * * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, * for platforms that support that. * * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more * "aggressive" inlining/optimization is enabled for the entire module. This * may lead to code bloat, and may slow things down for those reasons. It may * also lead to errors, if the code relies on pointer aliasing. Use with * care. * * NOTE: You can only use this for functions that are entirely local to a * module; functions that are exported via method tables, callbacks, etc, * should keep using static. */ #if defined(_MSC_VER) #if defined(PY_LOCAL_AGGRESSIVE) /* enable more aggressive optimization for visual studio */ #pragma optimize("agtw", on) #endif /* ignore warnings if the compiler decides not to inline a function */ #pragma warning(disable: 4710) /* fastest possible local call under MSVC */ #define Py_LOCAL(type) static type __fastcall #define Py_LOCAL_INLINE(type) static __inline type __fastcall #elif defined(USE_INLINE) #define Py_LOCAL(type) static type #define Py_LOCAL_INLINE(type) static inline type #else #define Py_LOCAL(type) static type #define Py_LOCAL_INLINE(type) static type #endif /* Py_MEMCPY is kept for backwards compatibility, * see https://bugs.python.org/issue28126 */ #define Py_MEMCPY memcpy #include <stdlib.h> #ifdef HAVE_IEEEFP_H #include <ieeefp.h> /* needed for 'finite' declaration on some platforms */ #endif #include <math.h> /* Moved here from the math section, before extern "C" */ /******************************************** * WRAPPER FOR <time.h> and/or <sys/time.h> * ********************************************/ #ifdef TIME_WITH_SYS_TIME #include <sys/time.h> #include <time.h> #else /* !TIME_WITH_SYS_TIME */ #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #else /* !HAVE_SYS_TIME_H */ #include <time.h> #endif /* !HAVE_SYS_TIME_H */ #endif /* !TIME_WITH_SYS_TIME */ /****************************** * WRAPPER FOR <sys/select.h> * ******************************/ /* NB caller must include <sys/types.h> */ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif /* !HAVE_SYS_SELECT_H */ /******************************* * stat() and fstat() fiddling * *******************************/ #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #elif defined(HAVE_STAT_H) #include <stat.h> #endif #ifndef S_IFMT /* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */ #define S_IFMT 0170000 #endif #ifndef S_IFLNK /* Windows doesn't define S_IFLNK but posixmodule.c maps * IO_REPARSE_TAG_SYMLINK to S_IFLNK */ # define S_IFLNK 0120000 #endif #ifndef S_ISREG #define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) #endif #ifndef S_ISDIR #define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) #endif #ifndef S_ISCHR #define S_ISCHR(x) (((x) & S_IFMT) == S_IFCHR) #endif #ifdef __cplusplus /* Move this down here since some C++ #include's don't like to be included inside an extern "C" */ extern "C" { #endif /* Py_ARITHMETIC_RIGHT_SHIFT * C doesn't define whether a right-shift of a signed integer sign-extends * or zero-fills. Here a macro to force sign extension: * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) * Return I >> J, forcing sign extension. Arithmetically, return the * floor of I/2**J. * Requirements: * I should have signed integer type. In the terminology of C99, this can * be either one of the five standard signed integer types (signed char, * short, int, long, long long) or an extended signed integer type. * J is an integer >= 0 and strictly less than the number of bits in the * type of I (because C doesn't define what happens for J outside that * range either). * TYPE used to specify the type of I, but is now ignored. It's been left * in for backwards compatibility with versions <= 2.6 or 3.0. * Caution: * I may be evaluated more than once. */ #ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) #else #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) #endif /* Py_FORCE_EXPANSION(X) * "Simply" returns its argument. However, macro expansions within the * argument are evaluated. This unfortunate trickery is needed to get * token-pasting to work as desired in some cases. */ #define Py_FORCE_EXPANSION(X) X /* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this * assert-fails if any information is lost. * Caution: * VALUE may be evaluated more than once. */ #ifdef Py_DEBUG #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) #else #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) #endif /* Py_SET_ERRNO_ON_MATH_ERROR(x) * If a libm function did not set errno, but it looks like the result * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno * to 0 before calling a libm function, and invoke this macro after, * passing the function result. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; #else #define _Py_SET_EDOM_FOR_NAN(X) ; #endif #define Py_SET_ERRNO_ON_MATH_ERROR(X) \ do { \ if (errno == 0) { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ errno = ERANGE; \ else _Py_SET_EDOM_FOR_NAN(X) \ } \ } while(0) /* Py_SET_ERANGE_ON_OVERFLOW(x) * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. */ #define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) /* Py_ADJUST_ERANGE1(x) * Py_ADJUST_ERANGE2(x, y) * Set errno to 0 before calling a libm function, and invoke one of these * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful * for functions returning complex results). This makes two kinds of * adjustments to errno: (A) If it looks like the platform libm set * errno=ERANGE due to underflow, clear errno. (B) If it looks like the * platform libm overflowed but didn't set errno, force errno to ERANGE. In * effect, we're trying to force a useful implementation of C89 errno * behavior. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X and Y may be evaluated more than once. */ #define Py_ADJUST_ERANGE1(X) \ do { \ if (errno == 0) { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ errno = ERANGE; \ } \ else if (errno == ERANGE && (X) == 0.0) \ errno = 0; \ } while(0) #define Py_ADJUST_ERANGE2(X, Y) \ do { \ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ if (errno == 0) \ errno = ERANGE; \ } \ else if (errno == ERANGE) \ errno = 0; \ } while(0) /* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are * required to support the short float repr introduced in Python 3.1) require * that the floating-point unit that's being used for arithmetic operations * on C doubles is set to use 53-bit precision. It also requires that the * FPU rounding mode is round-half-to-even, but that's less often an issue. * * If your FPU isn't already set to 53-bit precision/round-half-to-even, and * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should * * #define HAVE_PY_SET_53BIT_PRECISION 1 * * and also give appropriate definitions for the following three macros: * * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and * set FPU to 53-bit precision/round-half-to-even * _PY_SET_53BIT_PRECISION_END : restore original FPU settings * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to * use the two macros above. * * The macros are designed to be used within a single C function: see * Python/pystrtod.c for an example of their use. */ /* get and set x87 control word for gcc/x86 */ #ifdef HAVE_GCC_ASM_FOR_X87 #define HAVE_PY_SET_53BIT_PRECISION 1 /* _Py_get/set_387controlword functions are defined in Python/pymath.c */ #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned short old_387controlword, new_387controlword #define _Py_SET_53BIT_PRECISION_START \ do { \ old_387controlword = _Py_get_387controlword(); \ new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ if (new_387controlword != old_387controlword) \ _Py_set_387controlword(new_387controlword); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ if (new_387controlword != old_387controlword) \ _Py_set_387controlword(old_387controlword) #endif /* get and set x87 control word for VisualStudio/x86 */ #if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */ #define HAVE_PY_SET_53BIT_PRECISION 1 #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned int old_387controlword, new_387controlword, out_387controlword /* We use the __control87_2 function to set only the x87 control word. The SSE control word is unaffected. */ #define _Py_SET_53BIT_PRECISION_START \ do { \ __control87_2(0, 0, &old_387controlword, NULL); \ new_387controlword = \ (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ if (new_387controlword != old_387controlword) \ __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ &out_387controlword, NULL); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ do { \ if (new_387controlword != old_387controlword) \ __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ &out_387controlword, NULL); \ } while (0) #endif #ifdef HAVE_GCC_ASM_FOR_MC68881 #define HAVE_PY_SET_53BIT_PRECISION 1 #define _Py_SET_53BIT_PRECISION_HEADER \ unsigned int old_fpcr, new_fpcr #define _Py_SET_53BIT_PRECISION_START \ do { \ __asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \ /* Set double precision / round to nearest. */ \ new_fpcr = (old_fpcr & ~0xf0) | 0x80; \ if (new_fpcr != old_fpcr) \ __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr)); \ } while (0) #define _Py_SET_53BIT_PRECISION_END \ do { \ if (new_fpcr != old_fpcr) \ __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \ } while (0) #endif /* default definitions are empty */ #ifndef HAVE_PY_SET_53BIT_PRECISION #define _Py_SET_53BIT_PRECISION_HEADER #define _Py_SET_53BIT_PRECISION_START #define _Py_SET_53BIT_PRECISION_END #endif /* If we can't guarantee 53-bit precision, don't use the code in Python/dtoa.c, but fall back to standard code. This means that repr of a float will be long (17 sig digits). Realistically, there are two things that could go wrong: (1) doubles aren't IEEE 754 doubles, or (2) we're on x86 with the rounding precision set to 64-bits (extended precision), and we don't know how to change the rounding precision. */ #if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) #define PY_NO_SHORT_FLOAT_REPR #endif /* double rounding is symptomatic of use of extended precision on x86. If we're seeing double rounding, and we don't have any mechanism available for changing the FPU rounding precision, then don't use Python/dtoa.c. */ #if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) #define PY_NO_SHORT_FLOAT_REPR #endif /* Py_DEPRECATED(version) * Declare a variable, type, or function deprecated. * Usage: * extern int old_var Py_DEPRECATED(2.3); * typedef int T1 Py_DEPRECATED(2.4); * extern int x() Py_DEPRECATED(2.5); */ #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) #else #define Py_DEPRECATED(VERSION_UNUSED) #endif /************************************************************************** Prototypes that are missing from the standard include files on some systems (and possibly only some versions of such systems.) Please be conservative with adding new ones, document them and enclose them in platform-specific #ifdefs. **************************************************************************/ #ifdef SOLARIS /* Unchecked */ extern int gethostname(char *, int); #endif #ifdef HAVE__GETPTY #include <sys/types.h> /* we need to import mode_t */ extern char * _getpty(int *, int, mode_t, int); #endif /* On QNX 6, struct termio must be declared by including sys/termio.h if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must be included before termios.h or it will generate an error. */ #if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) #include <sys/termio.h> #endif #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) #if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) /* BSDI does not supply a prototype for the 'openpty' and 'forkpty' functions, even though they are included in libutil. */ #include <termios.h> extern int openpty(int *, int *, char *, struct termios *, struct winsize *); extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ #endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ /* On 4.4BSD-descendants, ctype functions serves the whole range of * wchar_t character set rather than single byte code points only. * This characteristic can break some operations of string object * including str.upper() and str.split() on UTF-8 locales. This * workaround was provided by Tim Robbins of FreeBSD project. */ #ifdef __FreeBSD__ #include <osreldate.h> #if (__FreeBSD_version >= 500040 && __FreeBSD_version < 602113) || \ (__FreeBSD_version >= 700000 && __FreeBSD_version < 700054) || \ (__FreeBSD_version >= 800000 && __FreeBSD_version < 800001) # define _PY_PORT_CTYPE_UTF8_ISSUE #endif #endif #if defined(__APPLE__) # define _PY_PORT_CTYPE_UTF8_ISSUE #endif #ifdef _PY_PORT_CTYPE_UTF8_ISSUE #ifndef __cplusplus /* The workaround below is unsafe in C++ because * the <locale> defines these symbols as real functions, * with a slightly different signature. * See issue #10910 */ #include <ctype.h> #include <wctype.h> #undef isalnum #define isalnum(c) iswalnum(btowc(c)) #undef isalpha #define isalpha(c) iswalpha(btowc(c)) #undef islower #define islower(c) iswlower(btowc(c)) #undef isspace #define isspace(c) iswspace(btowc(c)) #undef isupper #define isupper(c) iswupper(btowc(c)) #undef tolower #define tolower(c) towlower(btowc(c)) #undef toupper #define toupper(c) towupper(btowc(c)) #endif #endif /* Declarations for symbol visibility. PyAPI_FUNC(type): Declares a public Python API function and return type PyAPI_DATA(type): Declares public Python data and its type PyMODINIT_FUNC: A Python module init function. If these functions are inside the Python core, they are private to the core. If in an extension module, it may be declared with external linkage depending on the platform. As a number of platforms support/require "__declspec(dllimport/dllexport)", we support a HAVE_DECLSPEC_DLL macro to save duplication. */ /* All windows ports, except cygwin, are handled in PC/pyconfig.h. Cygwin is the only other autoconf platform requiring special linkage handling and it uses __declspec(). */ #if defined(__CYGWIN__) # define HAVE_DECLSPEC_DLL #endif /* only get special linkage if built as shared or platform is Cygwin */ #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) # if defined(HAVE_DECLSPEC_DLL) # ifdef Py_BUILD_CORE # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ /* except for Cygwin to handle embedding */ # if defined(__CYGWIN__) # define PyMODINIT_FUNC __declspec(dllexport) PyObject* # else /* __CYGWIN__ */ # define PyMODINIT_FUNC PyObject* # endif /* __CYGWIN__ */ # else /* Py_BUILD_CORE */ /* Building an extension module, or an embedded situation */ /* public Python functions and data are imported */ /* Under Cygwin, auto-import functions to prevent compilation */ /* failures similar to those described at the bottom of 4.1: */ /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ # if !defined(__CYGWIN__) # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE # endif /* !__CYGWIN__ */ # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE /* module init functions outside the core must be exported */ # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" __declspec(dllexport) PyObject* # else /* __cplusplus */ # define PyMODINIT_FUNC __declspec(dllexport) PyObject* # endif /* __cplusplus */ # endif /* Py_BUILD_CORE */ # endif /* HAVE_DECLSPEC */ #endif /* Py_ENABLE_SHARED */ /* If no external linkage macros defined by now, create defaults */ #ifndef PyAPI_FUNC # define PyAPI_FUNC(RTYPE) RTYPE #endif #ifndef PyAPI_DATA # define PyAPI_DATA(RTYPE) extern RTYPE #endif #ifndef PyMODINIT_FUNC # if defined(__cplusplus) # define PyMODINIT_FUNC extern "C" PyObject* # else /* __cplusplus */ # define PyMODINIT_FUNC PyObject* # endif /* __cplusplus */ #endif /* limits.h constants that may be missing */ #ifndef INT_MAX #define INT_MAX 2147483647 #endif #ifndef LONG_MAX #if SIZEOF_LONG == 4 #define LONG_MAX 0X7FFFFFFFL #elif SIZEOF_LONG == 8 #define LONG_MAX 0X7FFFFFFFFFFFFFFFL #else #error "could not set LONG_MAX in pyport.h" #endif #endif #ifndef LONG_MIN #define LONG_MIN (-LONG_MAX-1) #endif #ifndef LONG_BIT #define LONG_BIT (8 * SIZEOF_LONG) #endif #if LONG_BIT != 8 * SIZEOF_LONG /* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent * 32-bit platforms using gcc. We try to catch that here at compile-time * rather than waiting for integer multiplication to trigger bogus * overflows. */ #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." #endif #ifdef __cplusplus } #endif /* * Hide GCC attributes from compilers that don't support them. */ #if (!defined(__GNUC__) || __GNUC__ < 2 || \ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) #define Py_GCC_ATTRIBUTE(x) #else #define Py_GCC_ATTRIBUTE(x) __attribute__(x) #endif /* * Specify alignment on compilers that support it. */ #if defined(__GNUC__) && __GNUC__ >= 3 #define Py_ALIGNED(x) __attribute__((aligned(x))) #else #define Py_ALIGNED(x) #endif /* Eliminate end-of-loop code not reached warnings from SunPro C * when using do{...}while(0) macros */ #ifdef __SUNPRO_C #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) #endif #ifndef Py_LL #define Py_LL(x) x##LL #endif #ifndef Py_ULL #define Py_ULL(x) Py_LL(x##U) #endif #define Py_VA_COPY va_copy /* * Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is * detected by configure and defined in pyconfig.h. The code in pyconfig.h * also takes care of Apple's universal builds. */ #ifdef WORDS_BIGENDIAN #define PY_BIG_ENDIAN 1 #define PY_LITTLE_ENDIAN 0 #else #define PY_BIG_ENDIAN 0 #define PY_LITTLE_ENDIAN 1 #endif #ifdef Py_BUILD_CORE /* * Macros to protect CRT calls against instant termination when passed an * invalid parameter (issue23524). */ #if defined _MSC_VER && _MSC_VER >= 1900 extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; #define _Py_BEGIN_SUPPRESS_IPH { _invalid_parameter_handler _Py_old_handler = \ _set_thread_local_invalid_parameter_handler(_Py_silent_invalid_parameter_handler); #define _Py_END_SUPPRESS_IPH _set_thread_local_invalid_parameter_handler(_Py_old_handler); } #else #define _Py_BEGIN_SUPPRESS_IPH #define _Py_END_SUPPRESS_IPH #endif /* _MSC_VER >= 1900 */ #endif /* Py_BUILD_CORE */ #ifdef __ANDROID__ #include <android/api-level.h> #endif #endif /* Py_PYPORT_H */ python3.6m/pystate.h 0000644 00000025612 15063602042 0010337 0 ustar 00 /* Thread and interpreter state structures and their interfaces */ #ifndef Py_PYSTATE_H #define Py_PYSTATE_H #ifdef __cplusplus extern "C" { #endif /* This limitation is for performance and simplicity. If needed it can be removed (with effort). */ #define MAX_CO_EXTRA_USERS 255 /* State shared between threads */ struct _ts; /* Forward */ struct _is; /* Forward */ struct _frame; /* Forward declaration for PyFrameObject. */ #ifdef Py_LIMITED_API typedef struct _is PyInterpreterState; #else typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int); typedef struct _is { struct _is *next; struct _ts *tstate_head; PyObject *modules; PyObject *modules_by_index; PyObject *sysdict; PyObject *builtins; PyObject *importlib; PyObject *codec_search_path; PyObject *codec_search_cache; PyObject *codec_error_registry; int codecs_initialized; int fscodec_initialized; #ifdef HAVE_DLOPEN int dlopenflags; #endif PyObject *builtins_copy; PyObject *import_func; /* Initialized to PyEval_EvalFrameDefault(). */ _PyFrameEvalFunction eval_frame; } PyInterpreterState; #endif typedef struct _co_extra_state { struct _co_extra_state *next; PyInterpreterState* interp; Py_ssize_t co_extra_user_count; freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; } __PyCodeExtraState; /* This is temporary for backwards compat in 3.6 and will be removed in 3.7 */ __PyCodeExtraState* __PyCodeExtraState_Get(void); /* State unique per thread */ #ifndef Py_LIMITED_API /* Py_tracefunc return -1 when raising an exception, or 0 for success. */ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); /* The following values are used for 'what' for tracefunc functions: */ #define PyTrace_CALL 0 #define PyTrace_EXCEPTION 1 #define PyTrace_LINE 2 #define PyTrace_RETURN 3 #define PyTrace_C_CALL 4 #define PyTrace_C_EXCEPTION 5 #define PyTrace_C_RETURN 6 #endif #ifdef Py_LIMITED_API typedef struct _ts PyThreadState; #else typedef struct _ts { /* See Python/ceval.c for comments explaining most fields */ struct _ts *prev; struct _ts *next; PyInterpreterState *interp; struct _frame *frame; int recursion_depth; char overflowed; /* The stack has overflowed. Allow 50 more calls to handle the runtime error. */ char recursion_critical; /* The current calls must not cause a stack overflow. */ /* 'tracing' keeps track of the execution depth when tracing/profiling. This is to prevent the actual trace/profile code from being recorded in the trace/profile. */ int tracing; int use_tracing; Py_tracefunc c_profilefunc; Py_tracefunc c_tracefunc; PyObject *c_profileobj; PyObject *c_traceobj; PyObject *curexc_type; PyObject *curexc_value; PyObject *curexc_traceback; PyObject *exc_type; PyObject *exc_value; PyObject *exc_traceback; PyObject *dict; /* Stores per-thread state */ int gilstate_counter; PyObject *async_exc; /* Asynchronous exception to raise */ long thread_id; /* Thread id where this tstate was created */ int trash_delete_nesting; PyObject *trash_delete_later; /* Called when a thread state is deleted normally, but not when it * is destroyed after fork(). * Pain: to prevent rare but fatal shutdown errors (issue 18808), * Thread.join() must wait for the join'ed thread's tstate to be unlinked * from the tstate chain. That happens at the end of a thread's life, * in pystate.c. * The obvious way doesn't quite work: create a lock which the tstate * unlinking code releases, and have Thread.join() wait to acquire that * lock. The problem is that we _are_ at the end of the thread's life: * if the thread holds the last reference to the lock, decref'ing the * lock will delete the lock, and that may trigger arbitrary Python code * if there's a weakref, with a callback, to the lock. But by this time * _PyThreadState_Current is already NULL, so only the simplest of C code * can be allowed to run (in particular it must not be possible to * release the GIL). * So instead of holding the lock directly, the tstate holds a weakref to * the lock: that's the value of on_delete_data below. Decref'ing a * weakref is harmless. * on_delete points to _threadmodule.c's static release_sentinel() function. * After the tstate is unlinked, release_sentinel is called with the * weakref-to-lock (on_delete_data) argument, and release_sentinel releases * the indirectly held lock. */ void (*on_delete)(void *); void *on_delete_data; PyObject *coroutine_wrapper; int in_coroutine_wrapper; /* Now used from PyInterpreterState, kept here for ABI compatibility with PyThreadState */ Py_ssize_t _preserve_36_ABI_1; freefunc _preserve_36_ABI_2[MAX_CO_EXTRA_USERS]; PyObject *async_gen_firstiter; PyObject *async_gen_finalizer; /* XXX signal handlers should also be here */ } PyThreadState; #endif PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyState_AddModule(PyObject*, struct PyModuleDef*); #endif /* !Py_LIMITED_API */ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* New in 3.3 */ PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*); PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*); #endif PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyState_ClearModules(void); #endif PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate); #endif /* !Py_LIMITED_API */ #ifdef WITH_THREAD PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyGILState_Reinit(void); #endif /* !Py_LIMITED_API */ #endif /* Return the current thread state. The global interpreter lock must be held. * When the current thread state is NULL, this issues a fatal error (so that * the caller needn't check for NULL). */ PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); #ifndef Py_LIMITED_API /* Similar to PyThreadState_Get(), but don't issue a fatal error * if it is NULL. */ PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *); /* Variable and macro for in-line access to current thread state */ /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ #ifdef Py_BUILD_CORE PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; # define PyThreadState_GET() \ ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) #else # define PyThreadState_GET() PyThreadState_Get() #endif typedef enum {PyGILState_LOCKED, PyGILState_UNLOCKED} PyGILState_STATE; #ifdef WITH_THREAD /* Ensure that the current thread is ready to call the Python C API, regardless of the current state of Python, or of its thread lock. This may be called as many times as desired by a thread so long as each call is matched with a call to PyGILState_Release(). In general, other thread-state APIs may be used between _Ensure() and _Release() calls, so long as the thread-state is restored to its previous state before the Release(). For example, normal use of the Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS macros are acceptable. The return value is an opaque "handle" to the thread state when PyGILState_Ensure() was called, and must be passed to PyGILState_Release() to ensure Python is left in the same state. Even though recursive calls are allowed, these handles can *not* be shared - each unique call to PyGILState_Ensure must save the handle for its call to PyGILState_Release. When the function returns, the current thread will hold the GIL. Failure is a fatal error. */ PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); /* Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding PyGILState_Ensure() call (but generally this state will be unknown to the caller, hence the use of the GILState API.) Every call to PyGILState_Ensure must be matched by a call to PyGILState_Release on the same thread. */ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); /* Helper/diagnostic function - get the current thread state for this thread. May return NULL if no GILState API has been used on the current thread. Note that the main thread always has such a thread-state, even if no auto-thread-state call has been made on the main thread. */ PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); #ifndef Py_LIMITED_API /* Issue #26558: Flag to disable PyGILState_Check(). If set to non-zero, PyGILState_Check() always return 1. */ PyAPI_DATA(int) _PyGILState_check_enabled; /* Helper/diagnostic function - return 1 if the current thread currently holds the GIL, 0 otherwise. The function returns 1 if _PyGILState_check_enabled is non-zero. */ PyAPI_FUNC(int) PyGILState_Check(void); /* Unsafe function to get the single PyInterpreterState used by this process' GILState implementation. Return NULL before _PyGILState_Init() is called and after _PyGILState_Fini() is called. */ PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void); #endif #endif /* #ifdef WITH_THREAD */ /* The implementation of sys._current_frames() Returns a dict mapping thread id to that thread's current frame. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); #endif /* Routines for advanced debuggers, requested by David Beazley. Don't use unless you know what you are doing! */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); #endif /* hook for PyEval_GetFrame(), requested for Psyco */ #ifndef Py_LIMITED_API PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; #endif #ifdef __cplusplus } #endif #endif /* !Py_PYSTATE_H */ python3.6m/pystrcmp.h 0000644 00000000664 15063602042 0010527 0 ustar 00 #ifndef Py_STRCMP_H #define Py_STRCMP_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); #ifdef MS_WINDOWS #define PyOS_strnicmp strnicmp #define PyOS_stricmp stricmp #else #define PyOS_strnicmp PyOS_mystrnicmp #define PyOS_stricmp PyOS_mystricmp #endif #ifdef __cplusplus } #endif #endif /* !Py_STRCMP_H */ python3.6m/pystrhex.h 0000644 00000000757 15063602042 0010537 0 ustar 00 #ifndef Py_STRHEX_H #define Py_STRHEX_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API /* Returns a str() containing the hex representation of argbuf. */ PyAPI_FUNC(PyObject*) _Py_strhex(const char* argbuf, const Py_ssize_t arglen); /* Returns a bytes() containing the ASCII hex representation of argbuf. */ PyAPI_FUNC(PyObject*) _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_STRHEX_H */ python3.6m/pystrtod.h 0000644 00000002713 15063602042 0010533 0 ustar 00 #ifndef Py_STRTOD_H #define Py_STRTOD_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(double) PyOS_string_to_double(const char *str, char **endptr, PyObject *overflow_exception); /* The caller is responsible for calling PyMem_Free to free the buffer that's is returned. */ PyAPI_FUNC(char *) PyOS_double_to_string(double val, char format_code, int precision, int flags, int *type); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _Py_string_to_number_with_underscores( const char *str, Py_ssize_t len, const char *what, PyObject *obj, void *arg, PyObject *(*innerfunc)(const char *, Py_ssize_t, void *)); PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); #endif /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ #define Py_DTSF_SIGN 0x01 /* always add the sign */ #define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ #define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code specific */ /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ #define Py_DTST_FINITE 0 #define Py_DTST_INFINITE 1 #define Py_DTST_NAN 2 #ifdef __cplusplus } #endif #endif /* !Py_STRTOD_H */ python3.6m/pythonrun.h 0000644 00000015176 15063602042 0010720 0 ustar 00 /* Interfaces to parse and execute pieces of python code */ #ifndef Py_PYTHONRUN_H #define Py_PYTHONRUN_H #ifdef __cplusplus extern "C" { #endif #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ CO_FUTURE_GENERATOR_STOP) #define PyCF_MASK_OBSOLETE (CO_NESTED) #define PyCF_SOURCE_IS_UTF8 0x0100 #define PyCF_DONT_IMPLY_DEDENT 0x0200 #define PyCF_ONLY_AST 0x0400 #define PyCF_IGNORE_COOKIE 0x0800 #ifndef Py_LIMITED_API typedef struct { int cf_flags; /* bitmask of CO_xxx flags relevant to future */ } PyCompilerFlags; #endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_AnyFileExFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ int closeit, PyCompilerFlags *flags); PyAPI_FUNC(int) PyRun_SimpleFileExFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ int closeit, PyCompilerFlags *flags); PyAPI_FUNC(int) PyRun_InteractiveOneFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ PyCompilerFlags *flags); PyAPI_FUNC(int) PyRun_InteractiveOneObject( FILE *fp, PyObject *filename, PyCompilerFlags *flags); PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ PyCompilerFlags *flags); PyAPI_FUNC(struct _mod *) PyParser_ASTFromString( const char *s, const char *filename, /* decoded from the filesystem encoding */ int start, PyCompilerFlags *flags, PyArena *arena); PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject( const char *s, PyObject *filename, int start, PyCompilerFlags *flags, PyArena *arena); PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ const char* enc, int start, const char *ps1, const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena); PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject( FILE *fp, PyObject *filename, const char* enc, int start, const char *ps1, const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena); #endif #ifndef PyParser_SimpleParseString #define PyParser_SimpleParseString(S, B) \ PyParser_SimpleParseStringFlags(S, B, 0) #define PyParser_SimpleParseFile(FP, S, B) \ PyParser_SimpleParseFileFlags(FP, S, B, 0) #endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *, const char *, int, int); #endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, int, int); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, PyObject *, PyCompilerFlags *); PyAPI_FUNC(PyObject *) PyRun_FileExFlags( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ int start, PyObject *globals, PyObject *locals, int closeit, PyCompilerFlags *flags); #endif #ifdef Py_LIMITED_API PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int); #else #define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1) #define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1) PyAPI_FUNC(PyObject *) Py_CompileStringExFlags( const char *str, const char *filename, /* decoded from the filesystem encoding */ int start, PyCompilerFlags *flags, int optimize); PyAPI_FUNC(PyObject *) Py_CompileStringObject( const char *str, PyObject *filename, int start, PyCompilerFlags *flags, int optimize); #endif PyAPI_FUNC(struct symtable *) Py_SymtableString( const char *str, const char *filename, /* decoded from the filesystem encoding */ int start); #ifndef Py_LIMITED_API PyAPI_FUNC(struct symtable *) Py_SymtableStringObject( const char *str, PyObject *filename, int start); #endif PyAPI_FUNC(void) PyErr_Print(void); PyAPI_FUNC(void) PyErr_PrintEx(int); PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); #ifndef Py_LIMITED_API /* Use macros for a bunch of old variants */ #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) #define PyRun_AnyFileEx(fp, name, closeit) \ PyRun_AnyFileExFlags(fp, name, closeit, NULL) #define PyRun_AnyFileFlags(fp, name, flags) \ PyRun_AnyFileExFlags(fp, name, 0, flags) #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) #define PyRun_File(fp, p, s, g, l) \ PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) #define PyRun_FileEx(fp, p, s, g, l, c) \ PyRun_FileExFlags(fp, p, s, g, l, c, NULL) #define PyRun_FileFlags(fp, p, s, g, l, flags) \ PyRun_FileExFlags(fp, p, s, g, l, 0, flags) #endif /* Stuff with no proper home (yet) */ #ifndef Py_LIMITED_API PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *); #endif PyAPI_DATA(int) (*PyOS_InputHook)(void); PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *); #ifndef Py_LIMITED_API PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; #endif /* Stack size, in "pointers" (so we get extra safety margins on 64-bit platforms). On a 32-bit platform, this translates to an 8k margin. */ #define PYOS_STACK_MARGIN 2048 #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 /* Enable stack checking under Microsoft C */ #define USE_STACKCHECK #endif #ifdef USE_STACKCHECK /* Check that we aren't overflowing our stack */ PyAPI_FUNC(int) PyOS_CheckStack(void); #endif #ifdef __cplusplus } #endif #endif /* !Py_PYTHONRUN_H */ python3.6m/pythread.h 0000644 00000005660 15063602042 0010467 0 ustar 00 #ifndef Py_PYTHREAD_H #define Py_PYTHREAD_H typedef void *PyThread_type_lock; typedef void *PyThread_type_sema; #ifdef __cplusplus extern "C" { #endif /* Return status codes for Python lock acquisition. Chosen for maximum * backwards compatibility, ie failure -> 0, success -> 1. */ typedef enum PyLockStatus { PY_LOCK_FAILURE = 0, PY_LOCK_ACQUIRED = 1, PY_LOCK_INTR } PyLockStatus; PyAPI_FUNC(void) PyThread_init_thread(void); PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); PyAPI_FUNC(void) PyThread_exit_thread(void); PyAPI_FUNC(long) PyThread_get_thread_ident(void); PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); #define WAIT_LOCK 1 #define NOWAIT_LOCK 0 /* PY_TIMEOUT_T is the integral type used to specify timeouts when waiting on a lock (see PyThread_acquire_lock_timed() below). PY_TIMEOUT_MAX is the highest usable value (in microseconds) of that type, and depends on the system threading API. NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread module exposes a higher-level API, with timeouts expressed in seconds and floating-point numbers allowed. */ #define PY_TIMEOUT_T long long #define PY_TIMEOUT_MAX PY_LLONG_MAX /* In the NT API, the timeout is a DWORD and is expressed in milliseconds */ #if defined (NT_THREADS) #if 0xFFFFFFFFLL * 1000 < PY_TIMEOUT_MAX #undef PY_TIMEOUT_MAX #define PY_TIMEOUT_MAX (0xFFFFFFFFLL * 1000) #endif #endif /* If microseconds == 0, the call is non-blocking: it returns immediately even when the lock can't be acquired. If microseconds > 0, the call waits up to the specified duration. If microseconds < 0, the call waits until success (or abnormal failure) microseconds must be less than PY_TIMEOUT_MAX. Behaviour otherwise is undefined. If intr_flag is true and the acquire is interrupted by a signal, then the call will return PY_LOCK_INTR. The caller may reattempt to acquire the lock. */ PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed(PyThread_type_lock, PY_TIMEOUT_T microseconds, int intr_flag); PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); PyAPI_FUNC(size_t) PyThread_get_stacksize(void); PyAPI_FUNC(int) PyThread_set_stacksize(size_t); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); #endif /* Thread Local Storage (TLS) API */ PyAPI_FUNC(int) PyThread_create_key(void); PyAPI_FUNC(void) PyThread_delete_key(int); PyAPI_FUNC(int) PyThread_set_key_value(int, void *); PyAPI_FUNC(void *) PyThread_get_key_value(int); PyAPI_FUNC(void) PyThread_delete_key_value(int key); /* Cleanup after a fork */ PyAPI_FUNC(void) PyThread_ReInitTLS(void); #ifdef __cplusplus } #endif #endif /* !Py_PYTHREAD_H */ python3.6m/pytime.h 0000644 00000016671 15063602042 0010162 0 ustar 00 #ifndef Py_LIMITED_API #ifndef Py_PYTIME_H #define Py_PYTIME_H #include "pyconfig.h" /* include for defines */ #include "object.h" /************************************************************************** Symbols and macros to supply platform-independent interfaces to time related functions and constants **************************************************************************/ #ifdef __cplusplus extern "C" { #endif /* _PyTime_t: Python timestamp with subsecond precision. It can be used to store a duration, and so indirectly a date (related to another date, like UNIX epoch). */ typedef int64_t _PyTime_t; #define _PyTime_MIN PY_LLONG_MIN #define _PyTime_MAX PY_LLONG_MAX typedef enum { /* Round towards minus infinity (-inf). For example, used to read a clock. */ _PyTime_ROUND_FLOOR=0, /* Round towards infinity (+inf). For example, used for timeout to wait "at least" N seconds. */ _PyTime_ROUND_CEILING=1, /* Round to nearest with ties going to nearest even integer. For example, used to round from a Python float. */ _PyTime_ROUND_HALF_EVEN=2, /* Round away from zero For example, used for timeout. _PyTime_ROUND_CEILING rounds -1e-9 to 0 milliseconds which causes bpo-31786 issue. _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps the timeout sign as expected. select.poll(timeout) must block for negative values." */ _PyTime_ROUND_UP=3, /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be used for timeouts. */ _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP } _PyTime_round_t; /* Convert a time_t to a PyLong. */ PyAPI_FUNC(PyObject *) _PyLong_FromTime_t( time_t sec); /* Convert a PyLong to a time_t. */ PyAPI_FUNC(time_t) _PyLong_AsTime_t( PyObject *obj); /* Convert a number of seconds, int or float, to time_t. */ PyAPI_FUNC(int) _PyTime_ObjectToTime_t( PyObject *obj, time_t *sec, _PyTime_round_t); /* Convert a number of seconds, int or float, to a timeval structure. usec is in the range [0; 999999] and rounded towards zero. For example, -1.2 is converted to (-2, 800000). */ PyAPI_FUNC(int) _PyTime_ObjectToTimeval( PyObject *obj, time_t *sec, long *usec, _PyTime_round_t); /* Convert a number of seconds, int or float, to a timespec structure. nsec is in the range [0; 999999999] and rounded towards zero. For example, -1.2 is converted to (-2, 800000000). */ PyAPI_FUNC(int) _PyTime_ObjectToTimespec( PyObject *obj, time_t *sec, long *nsec, _PyTime_round_t); /* Create a timestamp from a number of seconds. */ PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds); /* Macro to create a timestamp from a number of seconds, no integer overflow. Only use the macro for small values, prefer _PyTime_FromSeconds(). */ #define _PYTIME_FROMSECONDS(seconds) \ ((_PyTime_t)(seconds) * (1000 * 1000 * 1000)) /* Create a timestamp from a number of nanoseconds. */ PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(long long ns); /* Convert a number of seconds (Python float or int) to a timetamp. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round); /* Convert a number of milliseconds (Python float or int, 10^-3) to a timetamp. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round); /* Convert a timestamp to a number of seconds as a C double. */ PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t); /* Convert timestamp to a number of milliseconds (10^-3 seconds). */ PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t, _PyTime_round_t round); /* Convert timestamp to a number of microseconds (10^-6 seconds). */ PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, _PyTime_round_t round); /* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int object. */ PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); /* Convert a timestamp to a timeval structure (microsecond resolution). tv_usec is always positive. Raise an exception and return -1 if the conversion overflowed, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round); /* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */ PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t, struct timeval *tv, _PyTime_round_t round); /* Convert a timestamp to a number of seconds (secs) and microseconds (us). us is always positive. This function is similar to _PyTime_AsTimeval() except that secs is always a time_t type, whereas the timeval structure uses a C long for tv_sec on Windows. Raise an exception and return -1 if the conversion overflowed, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimevalTime_t( _PyTime_t t, time_t *secs, int *us, _PyTime_round_t round); #if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) /* Convert a timestamp to a timespec structure (nanosecond resolution). tv_nsec is always positive. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); #endif /* Get the current time from the system clock. The function cannot fail. _PyTime_Init() ensures that the system clock works. */ PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); /* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid. The function cannot fail. _PyTime_Init() ensures that a monotonic clock is available and works. */ PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); /* Structure used by time.get_clock_info() */ typedef struct { const char *implementation; int monotonic; int adjustable; double resolution; } _Py_clock_info_t; /* Get the current time from the system clock. * Fill clock information if info is not NULL. * Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo( _PyTime_t *t, _Py_clock_info_t *info); /* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid. Fill info (if set) with information of the function used to get the time. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo( _PyTime_t *t, _Py_clock_info_t *info); /* Initialize time. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_Init(void); /* Converts a timestamp to the Gregorian time, using the local time zone. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm); /* Converts a timestamp to the Gregorian time, assuming UTC. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); #ifdef __cplusplus } #endif #endif /* Py_PYTIME_H */ #endif /* Py_LIMITED_API */ python3.6m/rangeobject.h 0000644 00000001165 15063602042 0011126 0 ustar 00 /* Range object interface */ #ifndef Py_RANGEOBJECT_H #define Py_RANGEOBJECT_H #ifdef __cplusplus extern "C" { #endif /* A range object represents an integer range. This is an immutable object; a range cannot change its value after creation. Range objects behave like the corresponding tuple objects except that they are represented by a start, stop, and step datamembers. */ PyAPI_DATA(PyTypeObject) PyRange_Type; PyAPI_DATA(PyTypeObject) PyRangeIter_Type; PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type; #define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) #ifdef __cplusplus } #endif #endif /* !Py_RANGEOBJECT_H */ python3.6m/setobject.h 0000644 00000006405 15063602042 0010627 0 ustar 00 /* Set object interface */ #ifndef Py_SETOBJECT_H #define Py_SETOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API /* There are three kinds of entries in the table: 1. Unused: key == NULL and hash == 0 2. Dummy: key == dummy and hash == -1 3. Active: key != NULL and key != dummy and hash != -1 The hash field of Unused slots is always zero. The hash field of Dummy slots are set to -1 meaning that dummy entries can be detected by either entry->key==dummy or by entry->hash==-1. */ #define PySet_MINSIZE 8 typedef struct { PyObject *key; Py_hash_t hash; /* Cached hash code of the key */ } setentry; /* The SetObject data structure is shared by set and frozenset objects. Invariant for sets: - hash is -1 Invariants for frozensets: - data is immutable. - hash is the hash of the frozenset or -1 if not computed yet. */ typedef struct { PyObject_HEAD Py_ssize_t fill; /* Number active and dummy entries*/ Py_ssize_t used; /* Number active entries */ /* The table contains mask + 1 slots, and that's a power of 2. * We store the mask instead of the size because the mask is more * frequently needed. */ Py_ssize_t mask; /* The table points to a fixed-size smalltable for small tables * or to additional malloc'ed memory for bigger tables. * The table pointer is never NULL which saves us from repeated * runtime null-tests. */ setentry *table; Py_hash_t hash; /* Only used by frozenset objects */ Py_ssize_t finger; /* Search finger for pop() */ setentry smalltable[PySet_MINSIZE]; PyObject *weakreflist; /* List of weak references */ } PySetObject; #define PySet_GET_SIZE(so) (((PySetObject *)(so))->used) PyAPI_DATA(PyObject *) _PySet_Dummy; PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash); PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); PyAPI_FUNC(int) PySet_ClearFreeList(void); #endif /* Section excluded by Py_LIMITED_API */ PyAPI_DATA(PyTypeObject) PySet_Type; PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; PyAPI_DATA(PyTypeObject) PySetIter_Type; PyAPI_FUNC(PyObject *) PySet_New(PyObject *); PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); PyAPI_FUNC(int) PySet_Clear(PyObject *set); PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_CheckExact(ob) \ (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) #define PyAnySet_Check(ob) \ (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) #define PySet_Check(ob) \ (Py_TYPE(ob) == &PySet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) #define PyFrozenSet_Check(ob) \ (Py_TYPE(ob) == &PyFrozenSet_Type || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) #ifdef __cplusplus } #endif #endif /* !Py_SETOBJECT_H */ python3.6m/sliceobject.h 0000644 00000004665 15063602042 0011141 0 ustar 00 #ifndef Py_SLICEOBJECT_H #define Py_SLICEOBJECT_H #ifdef __cplusplus extern "C" { #endif /* The unique ellipsis object "..." */ PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ #define Py_Ellipsis (&_Py_EllipsisObject) /* Slice object interface */ /* A slice object containing start, stop, and step data members (the names are from range). After much talk with Guido, it was decided to let these be any arbitrary python type. Py_None stands for omitted values. */ #ifndef Py_LIMITED_API typedef struct { PyObject_HEAD PyObject *start, *stop, *step; /* not NULL */ } PySliceObject; #endif PyAPI_DATA(PyTypeObject) PySlice_Type; PyAPI_DATA(PyTypeObject) PyEllipsis_Type; #define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, PyObject* step); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length, PyObject **start_ptr, PyObject **stop_ptr, PyObject **step_ptr); #endif PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength); #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 #ifdef Py_LIMITED_API #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \ ((*(slicelen) = 0), -1) : \ ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ 0)) #endif PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step); #endif #ifdef __cplusplus } #endif #endif /* !Py_SLICEOBJECT_H */ python3.6m/structmember.h 0000644 00000003742 15063602042 0011362 0 ustar 00 #ifndef Py_STRUCTMEMBER_H #define Py_STRUCTMEMBER_H #ifdef __cplusplus extern "C" { #endif /* Interface to map C struct members to Python object attributes */ #include <stddef.h> /* For offsetof */ /* An array of PyMemberDef structures defines the name, type and offset of selected members of a C structure. These can be read by PyMember_GetOne() and set by PyMember_SetOne() (except if their READONLY flag is set). The array must be terminated with an entry whose name pointer is NULL. */ typedef struct PyMemberDef { char *name; int type; Py_ssize_t offset; int flags; char *doc; } PyMemberDef; /* Types */ #define T_SHORT 0 #define T_INT 1 #define T_LONG 2 #define T_FLOAT 3 #define T_DOUBLE 4 #define T_STRING 5 #define T_OBJECT 6 /* XXX the ordering here is weird for binary compatibility */ #define T_CHAR 7 /* 1-character string */ #define T_BYTE 8 /* 8-bit signed int */ /* unsigned variants: */ #define T_UBYTE 9 #define T_USHORT 10 #define T_UINT 11 #define T_ULONG 12 /* Added by Jack: strings contained in the structure */ #define T_STRING_INPLACE 13 /* Added by Lillo: bools contained in the structure (assumed char) */ #define T_BOOL 14 #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError when the value is NULL, instead of converting to None. */ #define T_LONGLONG 17 #define T_ULONGLONG 18 #define T_PYSSIZET 19 /* Py_ssize_t */ #define T_NONE 20 /* Value is always None */ /* Flags */ #define READONLY 1 #define READ_RESTRICTED 2 #define PY_WRITE_RESTRICTED 4 #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) /* Current API, use this */ PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); #ifdef __cplusplus } #endif #endif /* !Py_STRUCTMEMBER_H */ python3.6m/structseq.h 0000644 00000002511 15063602042 0010674 0 ustar 00 /* Named tuple object interface */ #ifndef Py_STRUCTSEQ_H #define Py_STRUCTSEQ_H #ifdef __cplusplus extern "C" { #endif typedef struct PyStructSequence_Field { char *name; char *doc; } PyStructSequence_Field; typedef struct PyStructSequence_Desc { char *name; char *doc; struct PyStructSequence_Field *fields; int n_in_sequence; } PyStructSequence_Desc; extern char* PyStructSequence_UnnamedField; #ifndef Py_LIMITED_API PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc); PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc); #endif PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc); PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); #ifndef Py_LIMITED_API typedef PyTupleObject PyStructSequence; /* Macro, *only* to be used to fill in brand new objects */ #define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v) #define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i) #endif PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*); PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t); #ifdef __cplusplus } #endif #endif /* !Py_STRUCTSEQ_H */ python3.6m/symtable.h 0000644 00000011602 15063602042 0010460 0 ustar 00 #ifndef Py_LIMITED_API #ifndef Py_SYMTABLE_H #define Py_SYMTABLE_H #ifdef __cplusplus extern "C" { #endif /* XXX(ncoghlan): This is a weird mix of public names and interpreter internal * names. */ typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } _Py_block_ty; struct _symtable_entry; struct symtable { PyObject *st_filename; /* name of file being compiled, decoded from the filesystem encoding */ struct _symtable_entry *st_cur; /* current symbol table entry */ struct _symtable_entry *st_top; /* symbol table entry for module */ PyObject *st_blocks; /* dict: map AST node addresses * to symbol table entries */ PyObject *st_stack; /* list: stack of namespace info */ PyObject *st_global; /* borrowed ref to st_top->ste_symbols */ int st_nblocks; /* number of blocks used. kept for consistency with the corresponding compiler structure */ PyObject *st_private; /* name of current class or NULL */ PyFutureFeatures *st_future; /* module's future features that affect the symbol table */ int recursion_depth; /* current recursion depth */ int recursion_limit; /* recursion limit */ }; typedef struct _symtable_entry { PyObject_HEAD PyObject *ste_id; /* int: key in ste_table->st_blocks */ PyObject *ste_symbols; /* dict: variable names to flags */ PyObject *ste_name; /* string: name of current block */ PyObject *ste_varnames; /* list of function parameters */ PyObject *ste_children; /* list of child blocks */ PyObject *ste_directives;/* locations of global and nonlocal statements */ _Py_block_ty ste_type; /* module, class, or function */ int ste_nested; /* true if block is nested */ unsigned ste_free : 1; /* true if block has free variables */ unsigned ste_child_free : 1; /* true if a child block has free vars, including free refs to globals */ unsigned ste_generator : 1; /* true if namespace is a generator */ unsigned ste_coroutine : 1; /* true if namespace is a coroutine */ unsigned ste_varargs : 1; /* true if block has varargs */ unsigned ste_varkeywords : 1; /* true if block has varkeywords */ unsigned ste_returns_value : 1; /* true if namespace uses return with an argument */ unsigned ste_needs_class_closure : 1; /* for class scopes, true if a closure over __class__ should be created */ int ste_lineno; /* first line of block */ int ste_col_offset; /* offset of first line of block */ int ste_opt_lineno; /* lineno of last exec or import * */ int ste_opt_col_offset; /* offset of last exec or import * */ int ste_tmpname; /* counter for listcomp temp vars */ struct symtable *ste_table; } PySTEntryObject; PyAPI_DATA(PyTypeObject) PySTEntry_Type; #define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); PyAPI_FUNC(struct symtable *) PySymtable_Build( mod_ty mod, const char *filename, /* decoded from the filesystem encoding */ PyFutureFeatures *future); PyAPI_FUNC(struct symtable *) PySymtable_BuildObject( mod_ty mod, PyObject *filename, PyFutureFeatures *future); PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); PyAPI_FUNC(void) PySymtable_Free(struct symtable *); /* Flags for def-use information */ #define DEF_GLOBAL 1 /* global stmt */ #define DEF_LOCAL 2 /* assignment in code block */ #define DEF_PARAM 2<<1 /* formal parameter */ #define DEF_NONLOCAL 2<<2 /* nonlocal stmt */ #define USE 2<<3 /* name is used */ #define DEF_FREE 2<<4 /* name used but not defined in nested block */ #define DEF_FREE_CLASS 2<<5 /* free variable from class's method */ #define DEF_IMPORT 2<<6 /* assignment occurred via import */ #define DEF_ANNOT 2<<7 /* this name is annotated */ #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol table. GLOBAL is returned from PyST_GetScope() for either of them. It is stored in ste_symbols at bits 12-15. */ #define SCOPE_OFFSET 11 #define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL) #define LOCAL 1 #define GLOBAL_EXPLICIT 2 #define GLOBAL_IMPLICIT 3 #define FREE 4 #define CELL 5 #define GENERATOR 1 #define GENERATOR_EXPRESSION 2 #ifdef __cplusplus } #endif #endif /* !Py_SYMTABLE_H */ #endif /* Py_LIMITED_API */ python3.6m/sysmodule.h 0000644 00000002513 15063602042 0010665 0 ustar 00 /* System module interface */ #ifndef Py_SYSMODULE_H #define Py_SYSMODULE_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(PyObject *) PySys_GetObject(const char *); PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key); PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *); #endif PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **); PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int); PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...); PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...); PyAPI_FUNC(void) PySys_ResetWarnOptions(void); PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *); PyAPI_FUNC(void) PySys_AddWarnOptionUnicode(PyObject *); PyAPI_FUNC(int) PySys_HasWarnOptions(void); PyAPI_FUNC(void) PySys_AddXOption(const wchar_t *); PyAPI_FUNC(PyObject *) PySys_GetXOptions(void); #ifndef Py_LIMITED_API PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); #endif #ifdef __cplusplus } #endif #endif /* !Py_SYSMODULE_H */ python3.6m/token.h 0000644 00000003627 15063602042 0007770 0 ustar 00 /* Token types */ #ifndef Py_LIMITED_API #ifndef Py_TOKEN_H #define Py_TOKEN_H #ifdef __cplusplus extern "C" { #endif #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ #define ENDMARKER 0 #define NAME 1 #define NUMBER 2 #define STRING 3 #define NEWLINE 4 #define INDENT 5 #define DEDENT 6 #define LPAR 7 #define RPAR 8 #define LSQB 9 #define RSQB 10 #define COLON 11 #define COMMA 12 #define SEMI 13 #define PLUS 14 #define MINUS 15 #define STAR 16 #define SLASH 17 #define VBAR 18 #define AMPER 19 #define LESS 20 #define GREATER 21 #define EQUAL 22 #define DOT 23 #define PERCENT 24 #define LBRACE 25 #define RBRACE 26 #define EQEQUAL 27 #define NOTEQUAL 28 #define LESSEQUAL 29 #define GREATEREQUAL 30 #define TILDE 31 #define CIRCUMFLEX 32 #define LEFTSHIFT 33 #define RIGHTSHIFT 34 #define DOUBLESTAR 35 #define PLUSEQUAL 36 #define MINEQUAL 37 #define STAREQUAL 38 #define SLASHEQUAL 39 #define PERCENTEQUAL 40 #define AMPEREQUAL 41 #define VBAREQUAL 42 #define CIRCUMFLEXEQUAL 43 #define LEFTSHIFTEQUAL 44 #define RIGHTSHIFTEQUAL 45 #define DOUBLESTAREQUAL 46 #define DOUBLESLASH 47 #define DOUBLESLASHEQUAL 48 #define AT 49 #define ATEQUAL 50 #define RARROW 51 #define ELLIPSIS 52 /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ #define OP 53 #define AWAIT 54 #define ASYNC 55 #define ERRORTOKEN 56 #define N_TOKENS 57 /* Special definitions for cooperation with parser */ #define NT_OFFSET 256 #define ISTERMINAL(x) ((x) < NT_OFFSET) #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) #define ISEOF(x) ((x) == ENDMARKER) PyAPI_DATA(const char *) _PyParser_TokenNames[]; /* Token names */ PyAPI_FUNC(int) PyToken_OneChar(int); PyAPI_FUNC(int) PyToken_TwoChars(int, int); PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); #ifdef __cplusplus } #endif #endif /* !Py_TOKEN_H */ #endif /* Py_LIMITED_API */ python3.6m/traceback.h 0000644 00000007074 15063602042 0010567 0 ustar 00 #ifndef Py_TRACEBACK_H #define Py_TRACEBACK_H #ifdef __cplusplus extern "C" { #endif #include "pystate.h" struct _frame; /* Traceback interface */ #ifndef Py_LIMITED_API typedef struct _traceback { PyObject_HEAD struct _traceback *tb_next; struct _frame *tb_frame; int tb_lasti; int tb_lineno; } PyTracebackObject; #endif PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int); PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int); #endif /* Reveal traceback type so we can typecheck traceback objects */ PyAPI_DATA(PyTypeObject) PyTraceBack_Type; #define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) #ifndef Py_LIMITED_API /* Write the Python traceback into the file 'fd'. For example: Traceback (most recent call first): File "xxx", line xxx in <xxx> File "xxx", line xxx in <xxx> ... File "xxx", line xxx in <xxx> This function is written for debug purpose only, to dump the traceback in the worst case: after a segmentation fault, at fatal error, etc. That's why, it is very limited. Strings are truncated to 100 characters and encoded to ASCII with backslashreplace. It doesn't write the source code, only the function name, filename and line number of each frame. Write only the first 100 frames: if the traceback is truncated, write the line " ...". This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpTraceback( int fd, PyThreadState *tstate); /* Write the traceback of all threads into the file 'fd'. current_thread can be NULL. Return NULL on success, or an error message on error. This function is written for debug purpose only. It calls _Py_DumpTraceback() for each thread, and so has the same limitations. It only write the traceback of the first 100 threads: write "..." if there are more threads. If current_tstate is NULL, the function tries to get the Python thread state of the current thread. It is not an error if the function is unable to get the current Python thread state. If interp is NULL, the function tries to get the interpreter state from the current Python thread state, or from _PyGILState_GetInterpreterStateUnsafe() in last resort. It is better to pass NULL to interp and current_tstate, the function tries different options to retrieve these informations. This function is signal safe. */ PyAPI_FUNC(const char*) _Py_DumpTracebackThreads( int fd, PyInterpreterState *interp, PyThreadState *current_tstate); #endif /* !Py_LIMITED_API */ #ifndef Py_LIMITED_API /* Write a Unicode object into the file descriptor fd. Encode the string to ASCII using the backslashreplace error handler. Do nothing if text is not a Unicode object. The function accepts Unicode string which is not ready (PyUnicode_WCHAR_KIND). This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpASCII(int fd, PyObject *text); /* Format an integer as decimal into the file descriptor fd. This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpDecimal( int fd, unsigned long value); /* Format an integer as hexadecimal into the file descriptor fd with at least width digits. The maximum width is sizeof(unsigned long)*2 digits. This function is signal safe. */ PyAPI_FUNC(void) _Py_DumpHexadecimal( int fd, unsigned long value, Py_ssize_t width); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_TRACEBACK_H */ python3.6m/tupleobject.h 0000644 00000004614 15063602042 0011165 0 ustar 00 /* Tuple object interface */ #ifndef Py_TUPLEOBJECT_H #define Py_TUPLEOBJECT_H #ifdef __cplusplus extern "C" { #endif /* Another generally useful object type is a tuple of object pointers. For Python, this is an immutable type. C code can change the tuple items (but not their number), and even use tuples are general-purpose arrays of object references, but in general only brand new tuples should be mutated, not ones that might already have been exposed to Python code. *** WARNING *** PyTuple_SetItem does not increment the new item's reference count, but does decrement the reference count of the item it replaces, if not nil. It does *decrement* the reference count if it is *not* inserted in the tuple. Similarly, PyTuple_GetItem does not increment the returned item's reference count. */ #ifndef Py_LIMITED_API typedef struct { PyObject_VAR_HEAD PyObject *ob_item[1]; /* ob_item contains space for 'ob_size' elements. * Items must normally not be NULL, except during construction when * the tuple is not yet visible outside the function that builds it. */ } PyTupleObject; #endif PyAPI_DATA(PyTypeObject) PyTuple_Type; PyAPI_DATA(PyTypeObject) PyTupleIter_Type; #define PyTuple_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) #define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); #endif PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); #endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) #define PyTuple_GET_SIZE(op) Py_SIZE(op) /* Macro, *only* to be used to fill in brand new tuples */ #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) #endif PyAPI_FUNC(int) PyTuple_ClearFreeList(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); #endif /* Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_TUPLEOBJECT_H */ python3.6m/typeslots.h 0000644 00000004315 15063602042 0010711 0 ustar 00 /* Do not renumber the file; these numbers are part of the stable ABI. */ /* Disabled, see #10181 */ #undef Py_bf_getbuffer #undef Py_bf_releasebuffer #define Py_mp_ass_subscript 3 #define Py_mp_length 4 #define Py_mp_subscript 5 #define Py_nb_absolute 6 #define Py_nb_add 7 #define Py_nb_and 8 #define Py_nb_bool 9 #define Py_nb_divmod 10 #define Py_nb_float 11 #define Py_nb_floor_divide 12 #define Py_nb_index 13 #define Py_nb_inplace_add 14 #define Py_nb_inplace_and 15 #define Py_nb_inplace_floor_divide 16 #define Py_nb_inplace_lshift 17 #define Py_nb_inplace_multiply 18 #define Py_nb_inplace_or 19 #define Py_nb_inplace_power 20 #define Py_nb_inplace_remainder 21 #define Py_nb_inplace_rshift 22 #define Py_nb_inplace_subtract 23 #define Py_nb_inplace_true_divide 24 #define Py_nb_inplace_xor 25 #define Py_nb_int 26 #define Py_nb_invert 27 #define Py_nb_lshift 28 #define Py_nb_multiply 29 #define Py_nb_negative 30 #define Py_nb_or 31 #define Py_nb_positive 32 #define Py_nb_power 33 #define Py_nb_remainder 34 #define Py_nb_rshift 35 #define Py_nb_subtract 36 #define Py_nb_true_divide 37 #define Py_nb_xor 38 #define Py_sq_ass_item 39 #define Py_sq_concat 40 #define Py_sq_contains 41 #define Py_sq_inplace_concat 42 #define Py_sq_inplace_repeat 43 #define Py_sq_item 44 #define Py_sq_length 45 #define Py_sq_repeat 46 #define Py_tp_alloc 47 #define Py_tp_base 48 #define Py_tp_bases 49 #define Py_tp_call 50 #define Py_tp_clear 51 #define Py_tp_dealloc 52 #define Py_tp_del 53 #define Py_tp_descr_get 54 #define Py_tp_descr_set 55 #define Py_tp_doc 56 #define Py_tp_getattr 57 #define Py_tp_getattro 58 #define Py_tp_hash 59 #define Py_tp_init 60 #define Py_tp_is_gc 61 #define Py_tp_iter 62 #define Py_tp_iternext 63 #define Py_tp_methods 64 #define Py_tp_new 65 #define Py_tp_repr 66 #define Py_tp_richcompare 67 #define Py_tp_setattr 68 #define Py_tp_setattro 69 #define Py_tp_str 70 #define Py_tp_traverse 71 #define Py_tp_members 72 #define Py_tp_getset 73 #define Py_tp_free 74 #define Py_nb_matrix_multiply 75 #define Py_nb_inplace_matrix_multiply 76 #define Py_am_await 77 #define Py_am_aiter 78 #define Py_am_anext 79 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ #define Py_tp_finalize 80 #endif python3.6m/ucnhash.h 0000644 00000002040 15063602042 0010265 0 ustar 00 /* Unicode name database interface */ #ifndef Py_LIMITED_API #ifndef Py_UCNHASH_H #define Py_UCNHASH_H #ifdef __cplusplus extern "C" { #endif /* revised ucnhash CAPI interface (exported through a "wrapper") */ #define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" typedef struct { /* Size of this struct */ int size; /* Get name for a given character code. Returns non-zero if success, zero if not. Does not set Python exceptions. If self is NULL, data come from the default version of the database. If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen, int with_alias_and_seq); /* Get character code for a given name. Same error handling as for getname. */ int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code, int with_named_seq); } _PyUnicode_Name_CAPI; #ifdef __cplusplus } #endif #endif /* !Py_UCNHASH_H */ #endif /* !Py_LIMITED_API */ python3.6m/unicodeobject.h 0000644 00000237563 15063602042 0011475 0 ustar 00 #ifndef Py_UNICODEOBJECT_H #define Py_UNICODEOBJECT_H #include <stdarg.h> /* Unicode implementation based on original code by Fredrik Lundh, modified by Marc-Andre Lemburg (mal@lemburg.com) according to the Unicode Integration Proposal. (See http://www.egenix.com/files/python/unicode-proposal.txt). Copyright (c) Corporation for National Research Initiatives. Original header: -------------------------------------------------------------------- * Yet another Unicode string type for Python. This type supports the * 16-bit Basic Multilingual Plane (BMP) only. * * Written by Fredrik Lundh, January 1999. * * Copyright (c) 1999 by Secret Labs AB. * Copyright (c) 1999 by Fredrik Lundh. * * fredrik@pythonware.com * http://www.pythonware.com * * -------------------------------------------------------------------- * This Unicode String Type is * * Copyright (c) 1999 by Secret Labs AB * Copyright (c) 1999 by Fredrik Lundh * * By obtaining, using, and/or copying this software and/or its * associated documentation, you agree that you have read, understood, * and will comply with the following terms and conditions: * * Permission to use, copy, modify, and distribute this software and its * associated documentation for any purpose and without fee is hereby * granted, provided that the above copyright notice appears in all * copies, and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Secret Labs * AB or the author not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. * * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * -------------------------------------------------------------------- */ #include <ctype.h> /* === Internal API ======================================================= */ /* --- Internal Unicode Format -------------------------------------------- */ /* Python 3.x requires unicode */ #define Py_USING_UNICODE #ifndef SIZEOF_WCHAR_T #error Must define SIZEOF_WCHAR_T #endif #define Py_UNICODE_SIZE SIZEOF_WCHAR_T /* If wchar_t can be used for UCS-4 storage, set Py_UNICODE_WIDE. Otherwise, Unicode strings are stored as UCS-2 (with limited support for UTF-16) */ #if Py_UNICODE_SIZE >= 4 #define Py_UNICODE_WIDE #endif /* Set these flags if the platform has "wchar.h" and the wchar_t type is a 16-bit unsigned type */ /* #define HAVE_WCHAR_H */ /* #define HAVE_USABLE_WCHAR_T */ /* Py_UNICODE was the native Unicode storage format (code unit) used by Python and represents a single Unicode element in the Unicode type. With PEP 393, Py_UNICODE is deprecated and replaced with a typedef to wchar_t. */ #ifndef Py_LIMITED_API #define PY_UNICODE_TYPE wchar_t typedef wchar_t Py_UNICODE; #endif /* If the compiler provides a wchar_t type we try to support it through the interface functions PyUnicode_FromWideChar(), PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). */ #ifdef HAVE_USABLE_WCHAR_T # ifndef HAVE_WCHAR_H # define HAVE_WCHAR_H # endif #endif #ifdef HAVE_WCHAR_H /* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */ # ifdef _HAVE_BSDI # include <time.h> # endif # include <wchar.h> #endif /* Py_UCS4 and Py_UCS2 are typedefs for the respective unicode representations. */ typedef uint32_t Py_UCS4; typedef uint16_t Py_UCS2; typedef uint8_t Py_UCS1; /* --- Internal Unicode Operations ---------------------------------------- */ /* Since splitting on whitespace is an important use case, and whitespace in most situations is solely ASCII whitespace, we optimize for the common case by using a quick look-up table _Py_ascii_whitespace (see below) with an inlined check. */ #ifndef Py_LIMITED_API #define Py_UNICODE_ISSPACE(ch) \ ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) #define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) #define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch) #define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) #define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) #define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch) #define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch) #define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) #define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) #define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) #define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) #define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch) #define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) #define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) #define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) #define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch) #define Py_UNICODE_ISALNUM(ch) \ (Py_UNICODE_ISALPHA(ch) || \ Py_UNICODE_ISDECIMAL(ch) || \ Py_UNICODE_ISDIGIT(ch) || \ Py_UNICODE_ISNUMERIC(ch)) #define Py_UNICODE_COPY(target, source, length) \ memcpy((target), (source), (length)*sizeof(Py_UNICODE)) #define Py_UNICODE_FILL(target, value, length) \ do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ } while (0) /* macros to work with surrogates */ #define Py_UNICODE_IS_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDFFF) #define Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDBFF) #define Py_UNICODE_IS_LOW_SURROGATE(ch) (0xDC00 <= (ch) && (ch) <= 0xDFFF) /* Join two surrogate characters and return a single Py_UCS4 value. */ #define Py_UNICODE_JOIN_SURROGATES(high, low) \ (((((Py_UCS4)(high) & 0x03FF) << 10) | \ ((Py_UCS4)(low) & 0x03FF)) + 0x10000) /* high surrogate = top 10 bits added to D800 */ #define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 - (0x10000 >> 10) + ((ch) >> 10)) /* low surrogate = bottom 10 bits added to DC00 */ #define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 + ((ch) & 0x3FF)) /* Check if substring matches at given offset. The offset must be valid, and the substring must not be empty. */ #define Py_UNICODE_MATCH(string, offset, substring) \ ((*((string)->wstr + (offset)) == *((substring)->wstr)) && \ ((*((string)->wstr + (offset) + (substring)->wstr_length-1) == *((substring)->wstr + (substring)->wstr_length-1))) && \ !memcmp((string)->wstr + (offset), (substring)->wstr, (substring)->wstr_length*sizeof(Py_UNICODE))) #endif /* Py_LIMITED_API */ #ifdef __cplusplus extern "C" { #endif /* --- Unicode Type ------------------------------------------------------- */ #ifndef Py_LIMITED_API /* ASCII-only strings created through PyUnicode_New use the PyASCIIObject structure. state.ascii and state.compact are set, and the data immediately follow the structure. utf8_length and wstr_length can be found in the length field; the utf8 pointer is equal to the data pointer. */ typedef struct { /* There are 4 forms of Unicode strings: - compact ascii: * structure = PyASCIIObject * test: PyUnicode_IS_COMPACT_ASCII(op) * kind = PyUnicode_1BYTE_KIND * compact = 1 * ascii = 1 * ready = 1 * (length is the length of the utf8 and wstr strings) * (data starts just after the structure) * (since ASCII is decoded from UTF-8, the utf8 string are the data) - compact: * structure = PyCompactUnicodeObject * test: PyUnicode_IS_COMPACT(op) && !PyUnicode_IS_ASCII(op) * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or PyUnicode_4BYTE_KIND * compact = 1 * ready = 1 * ascii = 0 * utf8 is not shared with data * utf8_length = 0 if utf8 is NULL * wstr is shared with data and wstr_length=length if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2 or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_t)=4 * wstr_length = 0 if wstr is NULL * (data starts just after the structure) - legacy string, not ready: * structure = PyUnicodeObject * test: kind == PyUnicode_WCHAR_KIND * length = 0 (use wstr_length) * hash = -1 * kind = PyUnicode_WCHAR_KIND * compact = 0 * ascii = 0 * ready = 0 * interned = SSTATE_NOT_INTERNED * wstr is not NULL * data.any is NULL * utf8 is NULL * utf8_length = 0 - legacy string, ready: * structure = PyUnicodeObject structure * test: !PyUnicode_IS_COMPACT(op) && kind != PyUnicode_WCHAR_KIND * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or PyUnicode_4BYTE_KIND * compact = 0 * ready = 1 * data.any is not NULL * utf8 is shared and utf8_length = length with data.any if ascii = 1 * utf8_length = 0 if utf8 is NULL * wstr is shared with data.any and wstr_length = length if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2 or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_4)=4 * wstr_length = 0 if wstr is NULL Compact strings use only one memory block (structure + characters), whereas legacy strings use one block for the structure and one block for characters. Legacy strings are created by PyUnicode_FromUnicode() and PyUnicode_FromStringAndSize(NULL, size) functions. They become ready when PyUnicode_READY() is called. See also _PyUnicode_CheckConsistency(). */ PyObject_HEAD Py_ssize_t length; /* Number of code points in the string */ Py_hash_t hash; /* Hash value; -1 if not set */ struct { /* SSTATE_NOT_INTERNED (0) SSTATE_INTERNED_MORTAL (1) SSTATE_INTERNED_IMMORTAL (2) If interned != SSTATE_NOT_INTERNED, the two references from the dictionary to this object are *not* counted in ob_refcnt. */ unsigned int interned:2; /* Character size: - PyUnicode_WCHAR_KIND (0): * character type = wchar_t (16 or 32 bits, depending on the platform) - PyUnicode_1BYTE_KIND (1): * character type = Py_UCS1 (8 bits, unsigned) * all characters are in the range U+0000-U+00FF (latin1) * if ascii is set, all characters are in the range U+0000-U+007F (ASCII), otherwise at least one character is in the range U+0080-U+00FF - PyUnicode_2BYTE_KIND (2): * character type = Py_UCS2 (16 bits, unsigned) * all characters are in the range U+0000-U+FFFF (BMP) * at least one character is in the range U+0100-U+FFFF - PyUnicode_4BYTE_KIND (4): * character type = Py_UCS4 (32 bits, unsigned) * all characters are in the range U+0000-U+10FFFF * at least one character is in the range U+10000-U+10FFFF */ unsigned int kind:3; /* Compact is with respect to the allocation scheme. Compact unicode objects only require one memory block while non-compact objects use one block for the PyUnicodeObject struct and another for its data buffer. */ unsigned int compact:1; /* The string only contains characters in the range U+0000-U+007F (ASCII) and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is set, use the PyASCIIObject structure. */ unsigned int ascii:1; /* The ready flag indicates whether the object layout is initialized completely. This means that this is either a compact object, or the data pointer is filled out. The bit is redundant, and helps to minimize the test in PyUnicode_IS_READY(). */ unsigned int ready:1; /* Padding to ensure that PyUnicode_DATA() is always aligned to 4 bytes (see issue #19537 on m68k). */ unsigned int :24; } state; wchar_t *wstr; /* wchar_t representation (null-terminated) */ } PyASCIIObject; /* Non-ASCII strings allocated through PyUnicode_New use the PyCompactUnicodeObject structure. state.compact is set, and the data immediately follow the structure. */ typedef struct { PyASCIIObject _base; Py_ssize_t utf8_length; /* Number of bytes in utf8, excluding the * terminating \0. */ char *utf8; /* UTF-8 representation (null-terminated) */ Py_ssize_t wstr_length; /* Number of code points in wstr, possible * surrogates count as two code points. */ } PyCompactUnicodeObject; /* Strings allocated through PyUnicode_FromUnicode(NULL, len) use the PyUnicodeObject structure. The actual string data is initially in the wstr block, and copied into the data block using _PyUnicode_Ready. */ typedef struct { PyCompactUnicodeObject _base; union { void *any; Py_UCS1 *latin1; Py_UCS2 *ucs2; Py_UCS4 *ucs4; } data; /* Canonical, smallest-form Unicode buffer */ } PyUnicodeObject; #endif PyAPI_DATA(PyTypeObject) PyUnicode_Type; PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; #define PyUnicode_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) #define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) /* Fast access macros */ #ifndef Py_LIMITED_API #define PyUnicode_WSTR_LENGTH(op) \ (PyUnicode_IS_COMPACT_ASCII(op) ? \ ((PyASCIIObject*)op)->length : \ ((PyCompactUnicodeObject*)op)->wstr_length) /* Returns the deprecated Py_UNICODE representation's size in code units (this includes surrogate pairs as 2 units). If the Py_UNICODE representation is not available, it will be computed on request. Use PyUnicode_GET_LENGTH() for the length in code points. */ #define PyUnicode_GET_SIZE(op) \ (assert(PyUnicode_Check(op)), \ (((PyASCIIObject *)(op))->wstr) ? \ PyUnicode_WSTR_LENGTH(op) : \ ((void)PyUnicode_AsUnicode((PyObject *)(op)), \ assert(((PyASCIIObject *)(op))->wstr), \ PyUnicode_WSTR_LENGTH(op))) #define PyUnicode_GET_DATA_SIZE(op) \ (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE) /* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE representation on demand. Using this macro is very inefficient now, try to port your code to use the new PyUnicode_*BYTE_DATA() macros or use PyUnicode_WRITE() and PyUnicode_READ(). */ #define PyUnicode_AS_UNICODE(op) \ (assert(PyUnicode_Check(op)), \ (((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \ PyUnicode_AsUnicode((PyObject *)(op))) #define PyUnicode_AS_DATA(op) \ ((const char *)(PyUnicode_AS_UNICODE(op))) /* --- Flexible String Representation Helper Macros (PEP 393) -------------- */ /* Values for PyASCIIObject.state: */ /* Interning state. */ #define SSTATE_NOT_INTERNED 0 #define SSTATE_INTERNED_MORTAL 1 #define SSTATE_INTERNED_IMMORTAL 2 /* Return true if the string contains only ASCII characters, or 0 if not. The string may be compact (PyUnicode_IS_COMPACT_ASCII) or not, but must be ready. */ #define PyUnicode_IS_ASCII(op) \ (assert(PyUnicode_Check(op)), \ assert(PyUnicode_IS_READY(op)), \ ((PyASCIIObject*)op)->state.ascii) /* Return true if the string is compact or 0 if not. No type checks or Ready calls are performed. */ #define PyUnicode_IS_COMPACT(op) \ (((PyASCIIObject*)(op))->state.compact) /* Return true if the string is a compact ASCII string (use PyASCIIObject structure), or 0 if not. No type checks or Ready calls are performed. */ #define PyUnicode_IS_COMPACT_ASCII(op) \ (((PyASCIIObject*)op)->state.ascii && PyUnicode_IS_COMPACT(op)) enum PyUnicode_Kind { /* String contains only wstr byte characters. This is only possible when the string was created with a legacy API and _PyUnicode_Ready() has not been called yet. */ PyUnicode_WCHAR_KIND = 0, /* Return values of the PyUnicode_KIND() macro: */ PyUnicode_1BYTE_KIND = 1, PyUnicode_2BYTE_KIND = 2, PyUnicode_4BYTE_KIND = 4 }; /* Return pointers to the canonical representation cast to unsigned char, Py_UCS2, or Py_UCS4 for direct character access. No checks are performed, use PyUnicode_KIND() before to ensure these will work correctly. */ #define PyUnicode_1BYTE_DATA(op) ((Py_UCS1*)PyUnicode_DATA(op)) #define PyUnicode_2BYTE_DATA(op) ((Py_UCS2*)PyUnicode_DATA(op)) #define PyUnicode_4BYTE_DATA(op) ((Py_UCS4*)PyUnicode_DATA(op)) /* Return one of the PyUnicode_*_KIND values defined above. */ #define PyUnicode_KIND(op) \ (assert(PyUnicode_Check(op)), \ assert(PyUnicode_IS_READY(op)), \ ((PyASCIIObject *)(op))->state.kind) /* Return a void pointer to the raw unicode buffer. */ #define _PyUnicode_COMPACT_DATA(op) \ (PyUnicode_IS_ASCII(op) ? \ ((void*)((PyASCIIObject*)(op) + 1)) : \ ((void*)((PyCompactUnicodeObject*)(op) + 1))) #define _PyUnicode_NONCOMPACT_DATA(op) \ (assert(((PyUnicodeObject*)(op))->data.any), \ ((((PyUnicodeObject *)(op))->data.any))) #define PyUnicode_DATA(op) \ (assert(PyUnicode_Check(op)), \ PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) : \ _PyUnicode_NONCOMPACT_DATA(op)) /* In the access macros below, "kind" may be evaluated more than once. All other macro parameters are evaluated exactly once, so it is safe to put side effects into them (such as increasing the index). */ /* Write into the canonical representation, this macro does not do any sanity checks and is intended for usage in loops. The caller should cache the kind and data pointers obtained from other macro calls. index is the index in the string (starts at 0) and value is the new code point value which should be written to that location. */ #define PyUnicode_WRITE(kind, data, index, value) \ do { \ switch ((kind)) { \ case PyUnicode_1BYTE_KIND: { \ ((Py_UCS1 *)(data))[(index)] = (Py_UCS1)(value); \ break; \ } \ case PyUnicode_2BYTE_KIND: { \ ((Py_UCS2 *)(data))[(index)] = (Py_UCS2)(value); \ break; \ } \ default: { \ assert((kind) == PyUnicode_4BYTE_KIND); \ ((Py_UCS4 *)(data))[(index)] = (Py_UCS4)(value); \ } \ } \ } while (0) /* Read a code point from the string's canonical representation. No checks or ready calls are performed. */ #define PyUnicode_READ(kind, data, index) \ ((Py_UCS4) \ ((kind) == PyUnicode_1BYTE_KIND ? \ ((const Py_UCS1 *)(data))[(index)] : \ ((kind) == PyUnicode_2BYTE_KIND ? \ ((const Py_UCS2 *)(data))[(index)] : \ ((const Py_UCS4 *)(data))[(index)] \ ) \ )) /* PyUnicode_READ_CHAR() is less efficient than PyUnicode_READ() because it calls PyUnicode_KIND() and might call it twice. For single reads, use PyUnicode_READ_CHAR, for multiple consecutive reads callers should cache kind and use PyUnicode_READ instead. */ #define PyUnicode_READ_CHAR(unicode, index) \ (assert(PyUnicode_Check(unicode)), \ assert(PyUnicode_IS_READY(unicode)), \ (Py_UCS4) \ (PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND ? \ ((const Py_UCS1 *)(PyUnicode_DATA((unicode))))[(index)] : \ (PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND ? \ ((const Py_UCS2 *)(PyUnicode_DATA((unicode))))[(index)] : \ ((const Py_UCS4 *)(PyUnicode_DATA((unicode))))[(index)] \ ) \ )) /* Returns the length of the unicode string. The caller has to make sure that the string has it's canonical representation set before calling this macro. Call PyUnicode_(FAST_)Ready to ensure that. */ #define PyUnicode_GET_LENGTH(op) \ (assert(PyUnicode_Check(op)), \ assert(PyUnicode_IS_READY(op)), \ ((PyASCIIObject *)(op))->length) /* Fast check to determine whether an object is ready. Equivalent to PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any) */ #define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready) /* PyUnicode_READY() does less work than _PyUnicode_Ready() in the best case. If the canonical representation is not yet set, it will still call _PyUnicode_Ready(). Returns 0 on success and -1 on errors. */ #define PyUnicode_READY(op) \ (assert(PyUnicode_Check(op)), \ (PyUnicode_IS_READY(op) ? \ 0 : _PyUnicode_Ready((PyObject *)(op)))) /* Return a maximum character value which is suitable for creating another string based on op. This is always an approximation but more efficient than iterating over the string. */ #define PyUnicode_MAX_CHAR_VALUE(op) \ (assert(PyUnicode_IS_READY(op)), \ (PyUnicode_IS_ASCII(op) ? \ (0x7f) : \ (PyUnicode_KIND(op) == PyUnicode_1BYTE_KIND ? \ (0xffU) : \ (PyUnicode_KIND(op) == PyUnicode_2BYTE_KIND ? \ (0xffffU) : \ (0x10ffffU))))) #endif /* --- Constants ---------------------------------------------------------- */ /* This Unicode character will be used as replacement character during decoding if the errors argument is set to "replace". Note: the Unicode character U+FFFD is the official REPLACEMENT CHARACTER in Unicode 3.0. */ #define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UCS4) 0xFFFD) /* === Public API ========================================================= */ /* --- Plain Py_UNICODE --------------------------------------------------- */ /* With PEP 393, this is the recommended way to allocate a new unicode object. This function will allocate the object and its buffer in a single memory block. Objects created using this function are not resizable. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_New( Py_ssize_t size, /* Number of code points in the new string */ Py_UCS4 maxchar /* maximum code point value in the string */ ); #endif /* Initializes the canonical string representation from the deprecated wstr/Py_UNICODE representation. This function is used to convert Unicode objects which were created using the old API to the new flexible format introduced with PEP 393. Don't call this function directly, use the public PyUnicode_READY() macro instead. */ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyUnicode_Ready( PyObject *unicode /* Unicode object */ ); #endif /* Get a copy of a Unicode string. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_Copy( PyObject *unicode ); #endif /* Copy character from one unicode object into another, this function performs character conversion when necessary and falls back to memcpy() if possible. Fail if to is too small (smaller than *how_many* or smaller than len(from)-from_start), or if kind(from[from_start:from_start+how_many]) > kind(to), or if *to* has more than 1 reference. Return the number of written character, or return -1 and raise an exception on error. Pseudo-code: how_many = min(how_many, len(from) - from_start) to[to_start:to_start+how_many] = from[from_start:from_start+how_many] return how_many Note: The function doesn't write a terminating null character. */ #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters( PyObject *to, Py_ssize_t to_start, PyObject *from, Py_ssize_t from_start, Py_ssize_t how_many ); /* Unsafe version of PyUnicode_CopyCharacters(): don't check arguments and so may crash if parameters are invalid (e.g. if the output string is too short). */ PyAPI_FUNC(void) _PyUnicode_FastCopyCharacters( PyObject *to, Py_ssize_t to_start, PyObject *from, Py_ssize_t from_start, Py_ssize_t how_many ); #endif #ifndef Py_LIMITED_API /* Fill a string with a character: write fill_char into unicode[start:start+length]. Fail if fill_char is bigger than the string maximum character, or if the string has more than 1 reference. Return the number of written character, or return -1 and raise an exception on error. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill( PyObject *unicode, Py_ssize_t start, Py_ssize_t length, Py_UCS4 fill_char ); /* Unsafe version of PyUnicode_Fill(): don't check arguments and so may crash if parameters are invalid (e.g. if length is longer than the string). */ PyAPI_FUNC(void) _PyUnicode_FastFill( PyObject *unicode, Py_ssize_t start, Py_ssize_t length, Py_UCS4 fill_char ); #endif /* Create a Unicode Object from the Py_UNICODE buffer u of the given size. u may be NULL which causes the contents to be undefined. It is the user's responsibility to fill in the needed data afterwards. Note that modifying the Unicode object contents after construction is only allowed if u was set to NULL. The buffer is copied into the new object. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( const Py_UNICODE *u, /* Unicode buffer */ Py_ssize_t size /* size of buffer */ ); #endif /* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */ PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( const char *u, /* UTF-8 encoded string */ Py_ssize_t size /* size of buffer */ ); /* Similar to PyUnicode_FromUnicode(), but u points to null-terminated UTF-8 encoded bytes. The size is determined with strlen(). */ PyAPI_FUNC(PyObject*) PyUnicode_FromString( const char *u /* UTF-8 encoded string */ ); #ifndef Py_LIMITED_API /* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters. Scan the string to find the maximum character. */ PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData( int kind, const void *buffer, Py_ssize_t size); /* Create a new string from a buffer of ASCII characters. WARNING: Don't check if the string contains any non-ASCII character. */ PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII( const char *buffer, Py_ssize_t size); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_Substring( PyObject *str, Py_ssize_t start, Py_ssize_t end); #endif #ifndef Py_LIMITED_API /* Compute the maximum character of the substring unicode[start:end]. Return 127 for an empty string. */ PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar ( PyObject *unicode, Py_ssize_t start, Py_ssize_t end); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Copy the string into a UCS4 buffer including the null character if copy_null is set. Return NULL and raise an exception on error. Raise a SystemError if the buffer is smaller than the string. Return buffer on success. buflen is the length of the buffer in (Py_UCS4) characters. */ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4( PyObject *unicode, Py_UCS4* buffer, Py_ssize_t buflen, int copy_null); /* Copy the string into a UCS4 buffer. A new buffer is allocated using * PyMem_Malloc; if this fails, NULL is returned with a memory error exception set. */ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode); #endif #ifndef Py_LIMITED_API /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. If the wchar_t/Py_UNICODE representation is not yet available, this function will calculate it. */ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); /* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string contains null characters. */ PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer and save the length at size. If the wchar_t/Py_UNICODE representation is not yet available, this function will calculate it. */ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize( PyObject *unicode, /* Unicode object */ Py_ssize_t *size /* location where to save the length */ ); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Get the length of the Unicode object. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength( PyObject *unicode ); #endif /* Get the number of Py_UNICODE units in the string representation. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( PyObject *unicode /* Unicode object */ ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Read a character from the string. */ PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar( PyObject *unicode, Py_ssize_t index ); /* Write a character to the string. The string must have been created through PyUnicode_New, must not be shared, and must not have been hashed yet. Return 0 on success, -1 on error. */ PyAPI_FUNC(int) PyUnicode_WriteChar( PyObject *unicode, Py_ssize_t index, Py_UCS4 character ); #endif #ifndef Py_LIMITED_API /* Get the maximum ordinal for a Unicode character. */ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); #endif /* Resize a Unicode object. The length is the number of characters, except if the kind of the string is PyUnicode_WCHAR_KIND: in this case, the length is the number of Py_UNICODE characters. *unicode is modified to point to the new (resized) object and 0 returned on success. Try to resize the string in place (which is usually faster than allocating a new string and copy characters), or create a new string. Error handling is implemented as follows: an exception is set, -1 is returned and *unicode left untouched. WARNING: The function doesn't check string content, the result may not be a string in canonical representation. */ PyAPI_FUNC(int) PyUnicode_Resize( PyObject **unicode, /* Pointer to the Unicode object */ Py_ssize_t length /* New length */ ); /* Decode obj to a Unicode object. bytes, bytearray and other bytes-like objects are decoded according to the given encoding and error handler. The encoding and error handler can be NULL to have the interface use UTF-8 and "strict". All other objects (including Unicode objects) raise an exception. The API returns NULL in case of an error. The caller is responsible for decref'ing the returned objects. */ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( PyObject *obj, /* Object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Copy an instance of a Unicode subtype to a new true Unicode object if necessary. If obj is already a true Unicode object (not a subtype), return the reference with *incremented* refcount. The API returns NULL in case of an error. The caller is responsible for decref'ing the returned objects. */ PyAPI_FUNC(PyObject*) PyUnicode_FromObject( PyObject *obj /* Object */ ); PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV( const char *format, /* ASCII-encoded string */ va_list vargs ); PyAPI_FUNC(PyObject *) PyUnicode_FromFormat( const char *format, /* ASCII-encoded string */ ... ); #ifndef Py_LIMITED_API typedef struct { PyObject *buffer; void *data; enum PyUnicode_Kind kind; Py_UCS4 maxchar; Py_ssize_t size; Py_ssize_t pos; /* minimum number of allocated characters (default: 0) */ Py_ssize_t min_length; /* minimum character (default: 127, ASCII) */ Py_UCS4 min_char; /* If non-zero, overallocate the buffer (default: 0). */ unsigned char overallocate; /* If readonly is 1, buffer is a shared string (cannot be modified) and size is set to 0. */ unsigned char readonly; } _PyUnicodeWriter ; /* Initialize a Unicode writer. * * By default, the minimum buffer size is 0 character and overallocation is * disabled. Set min_length, min_char and overallocate attributes to control * the allocation of the buffer. */ PyAPI_FUNC(void) _PyUnicodeWriter_Init(_PyUnicodeWriter *writer); /* Prepare the buffer to write 'length' characters with the specified maximum character. Return 0 on success, raise an exception and return -1 on error. */ #define _PyUnicodeWriter_Prepare(WRITER, LENGTH, MAXCHAR) \ (((MAXCHAR) <= (WRITER)->maxchar \ && (LENGTH) <= (WRITER)->size - (WRITER)->pos) \ ? 0 \ : (((LENGTH) == 0) \ ? 0 \ : _PyUnicodeWriter_PrepareInternal((WRITER), (LENGTH), (MAXCHAR)))) /* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro instead. */ PyAPI_FUNC(int) _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer, Py_ssize_t length, Py_UCS4 maxchar); /* Prepare the buffer to have at least the kind KIND. For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will support characters in range U+000-U+FFFF. Return 0 on success, raise an exception and return -1 on error. */ #define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \ (assert((KIND) != PyUnicode_WCHAR_KIND), \ (KIND) <= (WRITER)->kind \ ? 0 \ : _PyUnicodeWriter_PrepareKindInternal((WRITER), (KIND))) /* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind() macro instead. */ PyAPI_FUNC(int) _PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer, enum PyUnicode_Kind kind); /* Append a Unicode character. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyUnicodeWriter_WriteChar(_PyUnicodeWriter *writer, Py_UCS4 ch ); /* Append a Unicode string. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer, PyObject *str /* Unicode string */ ); /* Append a substring of a Unicode string. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyUnicodeWriter_WriteSubstring(_PyUnicodeWriter *writer, PyObject *str, /* Unicode string */ Py_ssize_t start, Py_ssize_t end ); /* Append an ASCII-encoded byte string. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer, const char *str, /* ASCII-encoded byte string */ Py_ssize_t len /* number of bytes, or -1 if unknown */ ); /* Append a latin1-encoded byte string. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer, const char *str, /* latin1-encoded byte string */ Py_ssize_t len /* length in bytes */ ); /* Get the value of the writer as a Unicode string. Clear the buffer of the writer. Raise an exception and return NULL on error. */ PyAPI_FUNC(PyObject *) _PyUnicodeWriter_Finish(_PyUnicodeWriter *writer); /* Deallocate memory of a writer (clear its internal buffer). */ PyAPI_FUNC(void) _PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer); #endif #ifndef Py_LIMITED_API /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter( _PyUnicodeWriter *writer, PyObject *obj, PyObject *format_spec, Py_ssize_t start, Py_ssize_t end); #endif PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **); PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **); PyAPI_FUNC(PyObject *) PyUnicode_InternFromString( const char *u /* UTF-8 encoded string */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void); #endif /* Use only if you know it's a string */ #define PyUnicode_CHECK_INTERNED(op) \ (((PyASCIIObject *)(op))->state.interned) /* --- wchar_t support for platforms which support it --------------------- */ #ifdef HAVE_WCHAR_H /* Create a Unicode Object from the wchar_t buffer w of the given size. The buffer is copied into the new object. */ PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( const wchar_t *w, /* wchar_t buffer */ Py_ssize_t size /* size of buffer */ ); /* Copies the Unicode Object contents into the wchar_t buffer w. At most size wchar_t characters are copied. Note that the resulting wchar_t string may or may not be 0-terminated. It is the responsibility of the caller to make sure that the wchar_t string is 0-terminated in case this is required by the application. Returns the number of wchar_t characters copied (excluding a possibly trailing 0-termination character) or -1 in case of an error. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( PyObject *unicode, /* Unicode object */ wchar_t *w, /* wchar_t buffer */ Py_ssize_t size /* size of buffer */ ); /* Convert the Unicode object to a wide character string. The output string always ends with a nul character. If size is not NULL, write the number of wide characters (excluding the null character) into *size. Returns a buffer allocated by PyMem_Malloc() (use PyMem_Free() to free it) on success. On error, returns NULL, *size is undefined and raises a MemoryError. */ PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString( PyObject *unicode, /* Unicode object */ Py_ssize_t *size /* number of characters of the result */ ); #ifndef Py_LIMITED_API /* Similar to PyUnicode_AsWideCharString(unicode, NULL), but check if the string contains null characters. */ PyAPI_FUNC(wchar_t*) _PyUnicode_AsWideCharString( PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind); #endif #endif /* --- Unicode ordinals --------------------------------------------------- */ /* Create a Unicode Object from the given Unicode code point ordinal. The ordinal must be in range(0x110000). A ValueError is raised in case it is not. */ PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); /* --- Free-list management ----------------------------------------------- */ /* Clear the free list used by the Unicode implementation. This can be used to release memory used for objects on the free list back to the Python memory allocator. */ PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); /* === Builtin Codecs ===================================================== Many of these APIs take two arguments encoding and errors. These parameters encoding and errors have the same semantics as the ones of the builtin str() API. Setting encoding to NULL causes the default encoding (UTF-8) to be used. Error handling is set by errors which may also be set to NULL meaning to use the default handling defined for the codec. Default error handling for all builtin codecs is "strict" (ValueErrors are raised). The codecs all use a similar interface. Only deviation from the generic ones are documented. */ /* --- Manage the default encoding ---------------------------------------- */ /* Returns a pointer to the default encoding (UTF-8) of the Unicode object unicode and the size of the encoded representation in bytes stored in *size. In case of an error, no *size is set. This function caches the UTF-8 encoded string in the unicodeobject and subsequent calls will return the same string. The memory is released when the unicodeobject is deallocated. _PyUnicode_AsStringAndSize is a #define for PyUnicode_AsUTF8AndSize to support the previous internal function with the same behaviour. *** This API is for interpreter INTERNAL USE ONLY and will likely *** be removed or changed in the future. *** If you need to access the Unicode object as UTF-8 bytes string, *** please use PyUnicode_AsUTF8String() instead. */ #ifndef Py_LIMITED_API PyAPI_FUNC(char *) PyUnicode_AsUTF8AndSize( PyObject *unicode, Py_ssize_t *size); #define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize #endif /* Returns a pointer to the default encoding (UTF-8) of the Unicode object unicode. Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation in the unicodeobject. _PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to support the previous internal function with the same behaviour. Use of this API is DEPRECATED since no size information can be extracted from the returned data. *** This API is for interpreter INTERNAL USE ONLY and will likely *** be removed or changed for Python 3.1. *** If you need to access the Unicode object as UTF-8 bytes string, *** please use PyUnicode_AsUTF8String() instead. */ #ifndef Py_LIMITED_API PyAPI_FUNC(char *) PyUnicode_AsUTF8(PyObject *unicode); #define _PyUnicode_AsString PyUnicode_AsUTF8 #endif /* Returns "utf-8". */ PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); /* --- Generic Codecs ----------------------------------------------------- */ /* Create a Unicode object by decoding the encoded string s of the given size. */ PyAPI_FUNC(PyObject*) PyUnicode_Decode( const char *s, /* encoded string */ Py_ssize_t size, /* size of buffer */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Decode a Unicode object unicode and return the result as Python object. This API is DEPRECATED. The only supported standard encoding is rot13. Use PyCodec_Decode() to decode with rot13 and non-standard codecs that decode from str. */ PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedObject( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ) Py_DEPRECATED(3.6); /* Decode a Unicode object unicode and return the result as Unicode object. This API is DEPRECATED. The only supported standard encoding is rot13. Use PyCodec_Decode() to decode with rot13 and non-standard codecs that decode from str to str. */ PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedUnicode( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ) Py_DEPRECATED(3.6); /* Encodes a Py_UNICODE buffer of the given size and returns a Python string object. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_Encode( const Py_UNICODE *s, /* Unicode char buffer */ Py_ssize_t size, /* number of Py_UNICODE chars to encode */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); #endif /* Encodes a Unicode object and returns the result as Python object. This API is DEPRECATED. It is superceeded by PyUnicode_AsEncodedString() since all standard encodings (except rot13) encode str to bytes. Use PyCodec_Encode() for encoding with rot13 and non-standard codecs that encode form str to non-bytes. */ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ) Py_DEPRECATED(3.6); /* Encodes a Unicode object and returns the result as Python string object. */ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Encodes a Unicode object and returns the result as Unicode object. This API is DEPRECATED. The only supported standard encodings is rot13. Use PyCodec_Encode() to encode with rot13 and non-standard codecs that encode from str to str. */ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedUnicode( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ) Py_DEPRECATED(3.6); /* Build an encoding map. */ PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( PyObject* string /* 256 character map */ ); /* --- UTF-7 Codecs ------------------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( const char *string, /* UTF-7 encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( const char *string, /* UTF-7 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ int base64SetO, /* Encode RFC2152 Set O characters in base64 */ int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7( PyObject *unicode, /* Unicode object */ int base64SetO, /* Encode RFC2152 Set O characters in base64 */ int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ const char *errors /* error handling */ ); #endif /* --- UTF-8 Codecs ------------------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( const char *string, /* UTF-8 encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( const char *string, /* UTF-8 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( PyObject *unicode /* Unicode object */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String( PyObject *unicode, const char *errors); PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); #endif /* --- UTF-32 Codecs ------------------------------------------------------ */ /* Decodes length bytes from a UTF-32 encoded buffer string and returns the corresponding Unicode object. errors (if non-NULL) defines the error handling. It defaults to "strict". If byteorder is non-NULL, the decoder starts decoding using the given byte order: *byteorder == -1: little endian *byteorder == 0: native order *byteorder == 1: big endian In native mode, the first four bytes of the stream are checked for a BOM mark. If found, the BOM mark is analysed, the byte order adjusted and the BOM skipped. In the other modes, no BOM mark interpretation is done. After completion, *byteorder is set to the current byte order at the end of input data. If byteorder is NULL, the codec starts in native order mode. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( const char *string, /* UTF-32 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( const char *string, /* UTF-32 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder, /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ Py_ssize_t *consumed /* bytes consumed */ ); /* Returns a Python string using the UTF-32 encoding in native byte order. The string always starts with a BOM mark. */ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( PyObject *unicode /* Unicode object */ ); /* Returns a Python string object holding the UTF-32 encoded value of the Unicode data. If byteorder is not 0, output is written according to the following byte order: byteorder == -1: little endian byteorder == 0: native byte order (writes a BOM mark) byteorder == 1: big endian If byteorder is 0, the output string will always start with the Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is prepended. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32( PyObject *object, /* Unicode object */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); #endif /* --- UTF-16 Codecs ------------------------------------------------------ */ /* Decodes length bytes from a UTF-16 encoded buffer string and returns the corresponding Unicode object. errors (if non-NULL) defines the error handling. It defaults to "strict". If byteorder is non-NULL, the decoder starts decoding using the given byte order: *byteorder == -1: little endian *byteorder == 0: native order *byteorder == 1: big endian In native mode, the first two bytes of the stream are checked for a BOM mark. If found, the BOM mark is analysed, the byte order adjusted and the BOM skipped. In the other modes, no BOM mark interpretation is done. After completion, *byteorder is set to the current byte order at the end of input data. If byteorder is NULL, the codec starts in native order mode. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( const char *string, /* UTF-16 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( const char *string, /* UTF-16 encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ int *byteorder, /* pointer to byteorder to use 0=native;-1=LE,1=BE; updated on exit */ Py_ssize_t *consumed /* bytes consumed */ ); /* Returns a Python string using the UTF-16 encoding in native byte order. The string always starts with a BOM mark. */ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( PyObject *unicode /* Unicode object */ ); /* Returns a Python string object holding the UTF-16 encoded value of the Unicode data. If byteorder is not 0, output is written according to the following byte order: byteorder == -1: little endian byteorder == 0: native byte order (writes a BOM mark) byteorder == 1: big endian If byteorder is 0, the output string will always start with the Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is prepended. Note that Py_UNICODE data is being interpreted as UTF-16 reduced to UCS-2. This trick makes it possible to add full UTF-16 capabilities at a later point without compromising the APIs. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16( PyObject* unicode, /* Unicode object */ const char *errors, /* error handling */ int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); #endif /* --- Unicode-Escape Codecs ---------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( const char *string, /* Unicode-Escape encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); #ifndef Py_LIMITED_API /* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( const char *string, /* Unicode-Escape encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ const char **first_invalid_escape /* on return, points to first invalid escaped char in string. */ ); #endif PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); #endif /* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( const char *string, /* Raw-Unicode-Escape encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); #endif /* --- Unicode Internal Codec --------------------------------------------- Only for internal use in _codecsmodule.c */ #ifndef Py_LIMITED_API PyObject *_PyUnicode_DecodeUnicodeInternal( const char *string, Py_ssize_t length, const char *errors ); #endif /* --- Latin-1 Codecs ----------------------------------------------------- Note: Latin-1 corresponds to the first 256 Unicode ordinals. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( const char *string, /* Latin-1 encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( PyObject *unicode /* Unicode object */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_AsLatin1String( PyObject* unicode, const char* errors); PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); #endif /* --- ASCII Codecs ------------------------------------------------------- Only 7-bit ASCII data is excepted. All other codes generate errors. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( const char *string, /* ASCII encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( PyObject *unicode /* Unicode object */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_AsASCIIString( PyObject* unicode, const char* errors); PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); #endif /* --- Character Map Codecs ----------------------------------------------- This codec uses mappings to encode and decode characters. Decoding mappings must map byte ordinals (integers in the range from 0 to 255) to Unicode strings, integers (which are then interpreted as Unicode ordinals) or None. Unmapped data bytes (ones which cause a LookupError) as well as mapped to None, 0xFFFE or '\ufffe' are treated as "undefined mapping" and cause an error. Encoding mappings must map Unicode ordinal integers to bytes objects, integers in the range from 0 to 255 or None. Unmapped character ordinals (ones which cause a LookupError) as well as mapped to None are treated as "undefined mapping" and cause an error. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( const char *string, /* Encoded string */ Py_ssize_t length, /* size of string */ PyObject *mapping, /* decoding mapping */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( PyObject *unicode, /* Unicode object */ PyObject *mapping /* encoding mapping */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ PyObject *mapping, /* encoding mapping */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap( PyObject *unicode, /* Unicode object */ PyObject *mapping, /* encoding mapping */ const char *errors /* error handling */ ); #endif /* Translate a Py_UNICODE buffer of the given length by applying a character mapping table to it and return the resulting Unicode object. The mapping table must map Unicode ordinal integers to Unicode strings, Unicode ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and are copied as-is. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ PyObject *table, /* Translate table */ const char *errors /* error handling */ ); #endif #ifdef MS_WINDOWS /* --- MBCS codecs for Windows -------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( const char *string, /* MBCS encoded string */ Py_ssize_t length, /* size of string */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( const char *string, /* MBCS encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( int code_page, /* code page number */ const char *string, /* encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); #endif PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* number of Py_UNICODE chars to encode */ const char *errors /* error handling */ ); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( int code_page, /* code page number */ PyObject *unicode, /* Unicode object */ const char *errors /* error handling */ ); #endif #endif /* MS_WINDOWS */ /* --- Decimal Encoder ---------------------------------------------------- */ /* Takes a Unicode string holding a decimal value and writes it into an output buffer using standard ASCII digit codes. The output buffer has to provide at least length+1 bytes of storage area. The output string is 0-terminated. The encoder converts whitespace to ' ', decimal characters to their corresponding ASCII digit and all other Latin-1 characters except \0 as-is. Characters outside this range (Unicode ordinals 1-256) are treated as errors. This includes embedded NULL bytes. Error handling is defined by the errors argument: NULL or "strict": raise a ValueError "ignore": ignore the wrong characters (these are not copied to the output buffer) "replace": replaces illegal characters with '?' Returns 0 on success, -1 on failure. */ #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyUnicode_EncodeDecimal( Py_UNICODE *s, /* Unicode buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ char *output, /* Output buffer; must have size >= length */ const char *errors /* error handling */ ); #endif /* Transforms code points that have decimal digit property to the corresponding ASCII digit code points. Returns a new Unicode string on success, NULL on failure. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII( Py_UNICODE *s, /* Unicode buffer */ Py_ssize_t length /* Number of Py_UNICODE chars to transform */ ); #endif /* Similar to PyUnicode_TransformDecimalToASCII(), but takes a PyObject as argument instead of a raw buffer and length. This function additionally transforms spaces to ASCII because this is what the callers in longobject, floatobject, and complexobject did anyways. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII( PyObject *unicode /* Unicode object */ ); #endif /* --- Locale encoding --------------------------------------------------- */ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Decode a string from the current locale encoding. The decoder is strict if *surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape' error handler (PEP 383) to escape undecodable bytes. If a byte sequence can be decoded as a surrogate character and *surrogateescape* is not equal to zero, the byte sequence is escaped using the 'surrogateescape' error handler instead of being decoded. *str* must end with a null character but cannot contain embedded null characters. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocaleAndSize( const char *str, Py_ssize_t len, const char *errors); /* Similar to PyUnicode_DecodeLocaleAndSize(), but compute the string length using strlen(). */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocale( const char *str, const char *errors); /* Encode a Unicode object to the current locale encoding. The encoder is strict is *surrogateescape* is equal to zero, otherwise the "surrogateescape" error handler is used. Return a bytes object. The string cannot contain embedded null characters. */ PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale( PyObject *unicode, const char *errors ); #endif /* --- File system encoding ---------------------------------------------- */ /* ParseTuple converter: encode str objects to bytes using PyUnicode_EncodeFSDefault(); bytes objects are output as-is. */ PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*); /* ParseTuple converter: decode bytes objects to unicode using PyUnicode_DecodeFSDefaultAndSize(); str objects are output as-is. */ PyAPI_FUNC(int) PyUnicode_FSDecoder(PyObject*, void*); /* Decode a null-terminated string using Py_FileSystemDefaultEncoding and the "surrogateescape" error handler. If Py_FileSystemDefaultEncoding is not set, fall back to the locale encoding. Use PyUnicode_DecodeFSDefaultAndSize() if the string length is known. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefault( const char *s /* encoded string */ ); /* Decode a string using Py_FileSystemDefaultEncoding and the "surrogateescape" error handler. If Py_FileSystemDefaultEncoding is not set, fall back to the locale encoding. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize( const char *s, /* encoded string */ Py_ssize_t size /* size */ ); /* Encode a Unicode object to Py_FileSystemDefaultEncoding with the "surrogateescape" error handler, and return bytes. If Py_FileSystemDefaultEncoding is not set, fall back to the locale encoding. */ PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault( PyObject *unicode ); /* --- Methods & Slots ---------------------------------------------------- These are capable of handling Unicode objects and strings on input (we refer to them as strings in the descriptions) and return Unicode objects or integers as appropriate. */ /* Concat two strings giving a new Unicode string. */ PyAPI_FUNC(PyObject*) PyUnicode_Concat( PyObject *left, /* Left string */ PyObject *right /* Right string */ ); /* Concat two strings and put the result in *pleft (sets *pleft to NULL on error) */ PyAPI_FUNC(void) PyUnicode_Append( PyObject **pleft, /* Pointer to left string */ PyObject *right /* Right string */ ); /* Concat two strings, put the result in *pleft and drop the right object (sets *pleft to NULL on error) */ PyAPI_FUNC(void) PyUnicode_AppendAndDel( PyObject **pleft, /* Pointer to left string */ PyObject *right /* Right string */ ); /* Split a string giving a list of Unicode strings. If sep is NULL, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given separator. At most maxsplit splits will be done. If negative, no limit is set. Separators are not included in the resulting list. */ PyAPI_FUNC(PyObject*) PyUnicode_Split( PyObject *s, /* String to split */ PyObject *sep, /* String separator */ Py_ssize_t maxsplit /* Maxsplit count */ ); /* Dito, but split at line breaks. CRLF is considered to be one line break. Line breaks are not included in the resulting list. */ PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( PyObject *s, /* String to split */ int keepends /* If true, line end markers are included */ ); /* Partition a string using a given separator. */ PyAPI_FUNC(PyObject*) PyUnicode_Partition( PyObject *s, /* String to partition */ PyObject *sep /* String separator */ ); /* Partition a string using a given separator, searching from the end of the string. */ PyAPI_FUNC(PyObject*) PyUnicode_RPartition( PyObject *s, /* String to partition */ PyObject *sep /* String separator */ ); /* Split a string giving a list of Unicode strings. If sep is NULL, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given separator. At most maxsplit splits will be done. But unlike PyUnicode_Split PyUnicode_RSplit splits from the end of the string. If negative, no limit is set. Separators are not included in the resulting list. */ PyAPI_FUNC(PyObject*) PyUnicode_RSplit( PyObject *s, /* String to split */ PyObject *sep, /* String separator */ Py_ssize_t maxsplit /* Maxsplit count */ ); /* Translate a string by applying a character mapping table to it and return the resulting Unicode object. The mapping table must map Unicode ordinal integers to Unicode strings, Unicode ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and are copied as-is. */ PyAPI_FUNC(PyObject *) PyUnicode_Translate( PyObject *str, /* String */ PyObject *table, /* Translate table */ const char *errors /* error handling */ ); /* Join a sequence of strings using the given separator and return the resulting Unicode string. */ PyAPI_FUNC(PyObject*) PyUnicode_Join( PyObject *separator, /* Separator string */ PyObject *seq /* Sequence object */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyUnicode_JoinArray( PyObject *separator, PyObject **items, Py_ssize_t seqlen ); #endif /* Py_LIMITED_API */ /* Return 1 if substr matches str[start:end] at the given tail end, 0 otherwise. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( PyObject *str, /* String */ PyObject *substr, /* Prefix or Suffix string */ Py_ssize_t start, /* Start index */ Py_ssize_t end, /* Stop index */ int direction /* Tail end: -1 prefix, +1 suffix */ ); /* Return the first position of substr in str[start:end] using the given search direction or -1 if not found. -2 is returned in case an error occurred and an exception is set. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ Py_ssize_t start, /* Start index */ Py_ssize_t end, /* Stop index */ int direction /* Find direction: +1 forward, -1 backward */ ); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Like PyUnicode_Find, but search for single character only. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( PyObject *str, Py_UCS4 ch, Py_ssize_t start, Py_ssize_t end, int direction ); #endif /* Count the number of occurrences of substr in str[start:end]. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( PyObject *str, /* String */ PyObject *substr, /* Substring to count */ Py_ssize_t start, /* Start index */ Py_ssize_t end /* Stop index */ ); /* Replace at most maxcount occurrences of substr in str with replstr and return the resulting Unicode object. */ PyAPI_FUNC(PyObject *) PyUnicode_Replace( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ PyObject *replstr, /* Substring to replace */ Py_ssize_t maxcount /* Max. number of replacements to apply; -1 = all */ ); /* Compare two strings and return -1, 0, 1 for less than, equal, greater than resp. Raise an exception and return -1 on error. */ PyAPI_FUNC(int) PyUnicode_Compare( PyObject *left, /* Left string */ PyObject *right /* Right string */ ); #ifndef Py_LIMITED_API /* Test whether a unicode is equal to ASCII identifier. Return 1 if true, 0 otherwise. The right argument must be ASCII identifier. Any error occurs inside will be cleared before return. */ PyAPI_FUNC(int) _PyUnicode_EqualToASCIIId( PyObject *left, /* Left string */ _Py_Identifier *right /* Right identifier */ ); #endif /* Compare a Unicode object with C string and return -1, 0, 1 for less than, equal, and greater than, respectively. It is best to pass only ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters. This function does not raise exceptions. */ PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( PyObject *left, const char *right /* ASCII-encoded string */ ); #ifndef Py_LIMITED_API /* Test whether a unicode is equal to ASCII string. Return 1 if true, 0 otherwise. The right argument must be ASCII-encoded string. Any error occurs inside will be cleared before return. */ PyAPI_FUNC(int) _PyUnicode_EqualToASCIIString( PyObject *left, const char *right /* ASCII-encoded string */ ); #endif /* Rich compare two strings and return one of the following: - NULL in case an exception was raised - Py_True or Py_False for successful comparisons - Py_NotImplemented in case the type combination is unknown Possible values for op: Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE */ PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( PyObject *left, /* Left string */ PyObject *right, /* Right string */ int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ ); /* Apply an argument tuple or dictionary to a format string and return the resulting Unicode string. */ PyAPI_FUNC(PyObject *) PyUnicode_Format( PyObject *format, /* Format string */ PyObject *args /* Argument tuple or dictionary */ ); /* Checks whether element is contained in container and return 1/0 accordingly. element has to coerce to a one element Unicode string. -1 is returned in case of an error. */ PyAPI_FUNC(int) PyUnicode_Contains( PyObject *container, /* Container string */ PyObject *element /* Element string */ ); /* Checks whether argument is a valid identifier. */ PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s); #ifndef Py_LIMITED_API /* Externally visible for str.strip(unicode) */ PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( PyObject *self, int striptype, PyObject *sepobj ); #endif /* Using explicit passed-in values, insert the thousands grouping into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping( _PyUnicodeWriter *writer, Py_ssize_t n_buffer, PyObject *digits, Py_ssize_t d_pos, Py_ssize_t n_digits, Py_ssize_t min_width, const char *grouping, PyObject *thousands_sep, Py_UCS4 *maxchar); #endif /* === Characters Type APIs =============================================== */ /* Helper array used by Py_UNICODE_ISSPACE(). */ #ifndef Py_LIMITED_API PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; /* These should not be used directly. Use the Py_UNICODE_IS* and Py_UNICODE_TO* macros instead. These APIs are implemented in Objects/unicodectype.c. */ PyAPI_FUNC(int) _PyUnicode_IsLowercase( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsUppercase( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsTitlecase( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsXidStart( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsXidContinue( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsWhitespace( const Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsLinebreak( const Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToLowerFull( Py_UCS4 ch, /* Unicode character */ Py_UCS4 *res ); PyAPI_FUNC(int) _PyUnicode_ToTitleFull( Py_UCS4 ch, /* Unicode character */ Py_UCS4 *res ); PyAPI_FUNC(int) _PyUnicode_ToUpperFull( Py_UCS4 ch, /* Unicode character */ Py_UCS4 *res ); PyAPI_FUNC(int) _PyUnicode_ToFoldedFull( Py_UCS4 ch, /* Unicode character */ Py_UCS4 *res ); PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsCased( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToDigit( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(double) _PyUnicode_ToNumeric( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsDigit( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsNumeric( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsPrintable( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsAlpha( Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(size_t) Py_UNICODE_strlen( const Py_UNICODE *u ); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy( Py_UNICODE *s1, const Py_UNICODE *s2); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat( Py_UNICODE *s1, const Py_UNICODE *s2); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy( Py_UNICODE *s1, const Py_UNICODE *s2, size_t n); PyAPI_FUNC(int) Py_UNICODE_strcmp( const Py_UNICODE *s1, const Py_UNICODE *s2 ); PyAPI_FUNC(int) Py_UNICODE_strncmp( const Py_UNICODE *s1, const Py_UNICODE *s2, size_t n ); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr( const Py_UNICODE *s, Py_UNICODE c ); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr( const Py_UNICODE *s, Py_UNICODE c ); PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int); /* Create a copy of a unicode string ending with a nul character. Return NULL and raise a MemoryError exception on memory allocation failure, otherwise return a new allocated buffer (use PyMem_Free() to free the buffer). */ PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy( PyObject *unicode ); #endif /* Py_LIMITED_API */ #if defined(Py_DEBUG) && !defined(Py_LIMITED_API) PyAPI_FUNC(int) _PyUnicode_CheckConsistency( PyObject *op, int check_content); #elif !defined(NDEBUG) /* For asserts that call _PyUnicode_CheckConsistency(), which would * otherwise be a problem when building with asserts but without Py_DEBUG. */ #define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) #endif #ifndef Py_LIMITED_API /* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/ PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*); /* Clear all static strings. */ PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void); /* Fast equality check when the inputs are known to be exact unicode types and where the hash values are equal (i.e. a very probable match) */ PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* !Py_UNICODEOBJECT_H */ python3.6m/warnings.h 0000644 00000003235 15063602043 0010474 0 ustar 00 #ifndef Py_WARNINGS_H #define Py_WARNINGS_H #ifdef __cplusplus extern "C" { #endif #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyWarnings_Init(void); #endif PyAPI_FUNC(int) PyErr_WarnEx( PyObject *category, const char *message, /* UTF-8 encoded string */ Py_ssize_t stack_level); PyAPI_FUNC(int) PyErr_WarnFormat( PyObject *category, Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 /* Emit a ResourceWarning warning */ PyAPI_FUNC(int) PyErr_ResourceWarning( PyObject *source, Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); #endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitObject( PyObject *category, PyObject *message, PyObject *filename, int lineno, PyObject *module, PyObject *registry); #endif PyAPI_FUNC(int) PyErr_WarnExplicit( PyObject *category, const char *message, /* UTF-8 encoded string */ const char *filename, /* decoded from the filesystem encoding */ int lineno, const char *module, /* UTF-8 encoded string */ PyObject *registry); #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitFormat(PyObject *category, const char *filename, int lineno, const char *module, PyObject *registry, const char *format, ...); #endif /* DEPRECATED: Use PyErr_WarnEx() instead. */ #ifndef Py_LIMITED_API #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) #endif #ifdef __cplusplus } #endif #endif /* !Py_WARNINGS_H */ python3.6m/weakrefobject.h 0000644 00000005462 15063602043 0011463 0 ustar 00 /* Weak references objects for Python. */ #ifndef Py_WEAKREFOBJECT_H #define Py_WEAKREFOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct _PyWeakReference PyWeakReference; /* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, * and CallableProxyType. */ #ifndef Py_LIMITED_API struct _PyWeakReference { PyObject_HEAD /* The object to which this is a weak reference, or Py_None if none. * Note that this is a stealth reference: wr_object's refcount is * not incremented to reflect this pointer. */ PyObject *wr_object; /* A callable to invoke when wr_object dies, or NULL if none. */ PyObject *wr_callback; /* A cache for wr_object's hash code. As usual for hashes, this is -1 * if the hash code isn't known yet. */ Py_hash_t hash; /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- * terminated list of weak references to it. These are the list pointers. * If wr_object goes away, wr_object is set to Py_None, and these pointers * have no meaning then. */ PyWeakReference *wr_prev; PyWeakReference *wr_next; }; #endif PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) #define PyWeakref_CheckRefExact(op) \ (Py_TYPE(op) == &_PyWeakref_RefType) #define PyWeakref_CheckProxy(op) \ ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) #define PyWeakref_Check(op) \ (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, PyObject *callback); PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, PyObject *callback); PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); #ifndef Py_LIMITED_API PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); #endif /* Explanation for the Py_REFCNT() check: when a weakref's target is part of a long chain of deallocations which triggers the trashcan mechanism, clearing the weakrefs can be delayed long after the target's refcount has dropped to zero. In the meantime, code accessing the weakref will be able to "see" the target object even though it is supposed to be unreachable. See issue #16602. */ #define PyWeakref_GET_OBJECT(ref) \ (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ ? ((PyWeakReference *)(ref))->wr_object \ : Py_None) #ifdef __cplusplus } #endif #endif /* !Py_WEAKREFOBJECT_H */ python3.6m/Python-ast.h 0000644 00000053402 15063602043 0010713 0 ustar 00 /* File automatically generated by Parser/asdl_c.py. */ #include "asdl.h" typedef struct _mod *mod_ty; typedef struct _stmt *stmt_ty; typedef struct _expr *expr_ty; typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5, Param=6 } expr_context_ty; typedef struct _slice *slice_ty; typedef enum _boolop { And=1, Or=2 } boolop_ty; typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7, LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12, FloorDiv=13 } operator_ty; typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty; typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, In=9, NotIn=10 } cmpop_ty; typedef struct _comprehension *comprehension_ty; typedef struct _excepthandler *excepthandler_ty; typedef struct _arguments *arguments_ty; typedef struct _arg *arg_ty; typedef struct _keyword *keyword_ty; typedef struct _alias *alias_ty; typedef struct _withitem *withitem_ty; enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3, Suite_kind=4}; struct _mod { enum _mod_kind kind; union { struct { asdl_seq *body; } Module; struct { asdl_seq *body; } Interactive; struct { expr_ty body; } Expression; struct { asdl_seq *body; } Suite; } v; }; enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3, Return_kind=4, Delete_kind=5, Assign_kind=6, AugAssign_kind=7, AnnAssign_kind=8, For_kind=9, AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13, AsyncWith_kind=14, Raise_kind=15, Try_kind=16, Assert_kind=17, Import_kind=18, ImportFrom_kind=19, Global_kind=20, Nonlocal_kind=21, Expr_kind=22, Pass_kind=23, Break_kind=24, Continue_kind=25}; struct _stmt { enum _stmt_kind kind; union { struct { identifier name; arguments_ty args; asdl_seq *body; asdl_seq *decorator_list; expr_ty returns; } FunctionDef; struct { identifier name; arguments_ty args; asdl_seq *body; asdl_seq *decorator_list; expr_ty returns; } AsyncFunctionDef; struct { identifier name; asdl_seq *bases; asdl_seq *keywords; asdl_seq *body; asdl_seq *decorator_list; } ClassDef; struct { expr_ty value; } Return; struct { asdl_seq *targets; } Delete; struct { asdl_seq *targets; expr_ty value; } Assign; struct { expr_ty target; operator_ty op; expr_ty value; } AugAssign; struct { expr_ty target; expr_ty annotation; expr_ty value; int simple; } AnnAssign; struct { expr_ty target; expr_ty iter; asdl_seq *body; asdl_seq *orelse; } For; struct { expr_ty target; expr_ty iter; asdl_seq *body; asdl_seq *orelse; } AsyncFor; struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } While; struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } If; struct { asdl_seq *items; asdl_seq *body; } With; struct { asdl_seq *items; asdl_seq *body; } AsyncWith; struct { expr_ty exc; expr_ty cause; } Raise; struct { asdl_seq *body; asdl_seq *handlers; asdl_seq *orelse; asdl_seq *finalbody; } Try; struct { expr_ty test; expr_ty msg; } Assert; struct { asdl_seq *names; } Import; struct { identifier module; asdl_seq *names; int level; } ImportFrom; struct { asdl_seq *names; } Global; struct { asdl_seq *names; } Nonlocal; struct { expr_ty value; } Expr; } v; int lineno; int col_offset; }; enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11, Await_kind=12, Yield_kind=13, YieldFrom_kind=14, Compare_kind=15, Call_kind=16, Num_kind=17, Str_kind=18, FormattedValue_kind=19, JoinedStr_kind=20, Bytes_kind=21, NameConstant_kind=22, Ellipsis_kind=23, Constant_kind=24, Attribute_kind=25, Subscript_kind=26, Starred_kind=27, Name_kind=28, List_kind=29, Tuple_kind=30}; struct _expr { enum _expr_kind kind; union { struct { boolop_ty op; asdl_seq *values; } BoolOp; struct { expr_ty left; operator_ty op; expr_ty right; } BinOp; struct { unaryop_ty op; expr_ty operand; } UnaryOp; struct { arguments_ty args; expr_ty body; } Lambda; struct { expr_ty test; expr_ty body; expr_ty orelse; } IfExp; struct { asdl_seq *keys; asdl_seq *values; } Dict; struct { asdl_seq *elts; } Set; struct { expr_ty elt; asdl_seq *generators; } ListComp; struct { expr_ty elt; asdl_seq *generators; } SetComp; struct { expr_ty key; expr_ty value; asdl_seq *generators; } DictComp; struct { expr_ty elt; asdl_seq *generators; } GeneratorExp; struct { expr_ty value; } Await; struct { expr_ty value; } Yield; struct { expr_ty value; } YieldFrom; struct { expr_ty left; asdl_int_seq *ops; asdl_seq *comparators; } Compare; struct { expr_ty func; asdl_seq *args; asdl_seq *keywords; } Call; struct { object n; } Num; struct { string s; } Str; struct { expr_ty value; int conversion; expr_ty format_spec; } FormattedValue; struct { asdl_seq *values; } JoinedStr; struct { bytes s; } Bytes; struct { singleton value; } NameConstant; struct { constant value; } Constant; struct { expr_ty value; identifier attr; expr_context_ty ctx; } Attribute; struct { expr_ty value; slice_ty slice; expr_context_ty ctx; } Subscript; struct { expr_ty value; expr_context_ty ctx; } Starred; struct { identifier id; expr_context_ty ctx; } Name; struct { asdl_seq *elts; expr_context_ty ctx; } List; struct { asdl_seq *elts; expr_context_ty ctx; } Tuple; } v; int lineno; int col_offset; }; enum _slice_kind {Slice_kind=1, ExtSlice_kind=2, Index_kind=3}; struct _slice { enum _slice_kind kind; union { struct { expr_ty lower; expr_ty upper; expr_ty step; } Slice; struct { asdl_seq *dims; } ExtSlice; struct { expr_ty value; } Index; } v; }; struct _comprehension { expr_ty target; expr_ty iter; asdl_seq *ifs; int is_async; }; enum _excepthandler_kind {ExceptHandler_kind=1}; struct _excepthandler { enum _excepthandler_kind kind; union { struct { expr_ty type; identifier name; asdl_seq *body; } ExceptHandler; } v; int lineno; int col_offset; }; struct _arguments { asdl_seq *args; arg_ty vararg; asdl_seq *kwonlyargs; asdl_seq *kw_defaults; arg_ty kwarg; asdl_seq *defaults; }; struct _arg { identifier arg; expr_ty annotation; int lineno; int col_offset; }; struct _keyword { identifier arg; expr_ty value; }; struct _alias { identifier name; identifier asname; }; struct _withitem { expr_ty context_expr; expr_ty optional_vars; }; #define Module(a0, a1) _Py_Module(a0, a1) mod_ty _Py_Module(asdl_seq * body, PyArena *arena); #define Interactive(a0, a1) _Py_Interactive(a0, a1) mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena); #define Expression(a0, a1) _Py_Expression(a0, a1) mod_ty _Py_Expression(expr_ty body, PyArena *arena); #define Suite(a0, a1) _Py_Suite(a0, a1) mod_ty _Py_Suite(asdl_seq * body, PyArena *arena); #define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * decorator_list, expr_ty returns, int lineno, int col_offset, PyArena *arena); #define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) stmt_ty _Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * decorator_list, expr_ty returns, int lineno, int col_offset, PyArena *arena); #define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7) stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, asdl_seq * body, asdl_seq * decorator_list, int lineno, int col_offset, PyArena *arena); #define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3) stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3) stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena); #define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4) stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena *arena); #define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5) stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int col_offset, PyArena *arena); #define AnnAssign(a0, a1, a2, a3, a4, a5, a6) _Py_AnnAssign(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int lineno, int col_offset, PyArena *arena); #define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define AsyncFor(a0, a1, a2, a3, a4, a5, a6) _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5) stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5) stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena); #define With(a0, a1, a2, a3, a4) _Py_With(a0, a1, a2, a3, a4) stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, int lineno, int col_offset, PyArena *arena); #define AsyncWith(a0, a1, a2, a3, a4) _Py_AsyncWith(a0, a1, a2, a3, a4) stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, int lineno, int col_offset, PyArena *arena); #define Raise(a0, a1, a2, a3, a4) _Py_Raise(a0, a1, a2, a3, a4) stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, PyArena *arena); #define Try(a0, a1, a2, a3, a4, a5, a6) _Py_Try(a0, a1, a2, a3, a4, a5, a6) stmt_ty _Py_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, asdl_seq * finalbody, int lineno, int col_offset, PyArena *arena); #define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4) stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena); #define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3) stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena); #define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5) stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int col_offset, PyArena *arena); #define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3) stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena); #define Nonlocal(a0, a1, a2, a3) _Py_Nonlocal(a0, a1, a2, a3) stmt_ty _Py_Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena *arena); #define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3) stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2) stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena); #define Break(a0, a1, a2) _Py_Break(a0, a1, a2) stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena); #define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2) stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena); #define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4) expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena *arena); #define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5) expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, PyArena *arena); #define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4) expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena *arena); #define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4) expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena *arena); #define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5) expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, PyArena *arena); #define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4) expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena *arena); #define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3) expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena); #define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4) expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4) expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5) expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); #define Await(a0, a1, a2, a3) _Py_Await(a0, a1, a2, a3) expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3) expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena); #define YieldFrom(a0, a1, a2, a3) _Py_YieldFrom(a0, a1, a2, a3) expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, PyArena *arena); #define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5) expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, int col_offset, PyArena *arena); #define Call(a0, a1, a2, a3, a4, a5) _Py_Call(a0, a1, a2, a3, a4, a5) expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int lineno, int col_offset, PyArena *arena); #define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3) expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena); #define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3) expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena); #define FormattedValue(a0, a1, a2, a3, a4, a5) _Py_FormattedValue(a0, a1, a2, a3, a4, a5) expr_ty _Py_FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno, int col_offset, PyArena *arena); #define JoinedStr(a0, a1, a2, a3) _Py_JoinedStr(a0, a1, a2, a3) expr_ty _Py_JoinedStr(asdl_seq * values, int lineno, int col_offset, PyArena *arena); #define Bytes(a0, a1, a2, a3) _Py_Bytes(a0, a1, a2, a3) expr_ty _Py_Bytes(bytes s, int lineno, int col_offset, PyArena *arena); #define NameConstant(a0, a1, a2, a3) _Py_NameConstant(a0, a1, a2, a3) expr_ty _Py_NameConstant(singleton value, int lineno, int col_offset, PyArena *arena); #define Ellipsis(a0, a1, a2) _Py_Ellipsis(a0, a1, a2) expr_ty _Py_Ellipsis(int lineno, int col_offset, PyArena *arena); #define Constant(a0, a1, a2, a3) _Py_Constant(a0, a1, a2, a3) expr_ty _Py_Constant(constant value, int lineno, int col_offset, PyArena *arena); #define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5) expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5) expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Starred(a0, a1, a2, a3, a4) _Py_Starred(a0, a1, a2, a3, a4) expr_ty _Py_Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4) expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4) expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4) expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); #define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3) slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena); #define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1) slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena); #define Index(a0, a1) _Py_Index(a0, a1) slice_ty _Py_Index(expr_ty value, PyArena *arena); #define comprehension(a0, a1, a2, a3, a4) _Py_comprehension(a0, a1, a2, a3, a4) comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async, PyArena *arena); #define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5) excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int col_offset, PyArena *arena); #define arguments(a0, a1, a2, a3, a4, a5, a6) _Py_arguments(a0, a1, a2, a3, a4, a5, a6) arguments_ty _Py_arguments(asdl_seq * args, arg_ty vararg, asdl_seq * kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg, asdl_seq * defaults, PyArena *arena); #define arg(a0, a1, a2, a3, a4) _Py_arg(a0, a1, a2, a3, a4) arg_ty _Py_arg(identifier arg, expr_ty annotation, int lineno, int col_offset, PyArena *arena); #define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena); #define alias(a0, a1, a2) _Py_alias(a0, a1, a2) alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena); #define withitem(a0, a1, a2) _Py_withitem(a0, a1, a2) withitem_ty _Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena); PyObject* PyAST_mod2obj(mod_ty t); mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode); int PyAST_Check(PyObject* obj); python3.6m/Python.h 0000644 00000006225 15063602043 0010127 0 ustar 00 #ifndef Py_PYTHON_H #define Py_PYTHON_H /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ /* Include nearly all Python header files */ #include "patchlevel.h" #include "pyconfig.h" #include "pymacconfig.h" #include <limits.h> #ifndef UCHAR_MAX #error "Something's broken. UCHAR_MAX should be defined in limits.h." #endif #if UCHAR_MAX != 255 #error "Python's source code assumes C's unsigned char is an 8-bit type." #endif #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) #define _SGI_MP_SOURCE #endif #include <stdio.h> #ifndef NULL # error "Python.h requires that stdio.h define NULL." #endif #include <string.h> #ifdef HAVE_ERRNO_H #include <errno.h> #endif #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_CRYPT_H #include <crypt.h> #endif /* For size_t? */ #ifdef HAVE_STDDEF_H #include <stddef.h> #endif /* CAUTION: Build setups should ensure that NDEBUG is defined on the * compiler command line when building Python in release mode; else * assert() calls won't be removed. */ #include <assert.h> #include "pyport.h" #include "pymacro.h" /* A convenient way for code to know if clang's memory sanitizer is enabled. */ #if defined(__has_feature) # if __has_feature(memory_sanitizer) # if !defined(_Py_MEMORY_SANITIZER) # define _Py_MEMORY_SANITIZER # endif # endif #endif #include "pyatomic.h" /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. * PYMALLOC_DEBUG is in error if pymalloc is not in use. */ #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) #define PYMALLOC_DEBUG #endif #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" #endif #include "pymath.h" #include "pytime.h" #include "pymem.h" #include "object.h" #include "objimpl.h" #include "typeslots.h" #include "pyhash.h" #include "pydebug.h" #include "bytearrayobject.h" #include "bytesobject.h" #include "unicodeobject.h" #include "longobject.h" #include "longintrepr.h" #include "boolobject.h" #include "floatobject.h" #include "complexobject.h" #include "rangeobject.h" #include "memoryobject.h" #include "tupleobject.h" #include "listobject.h" #include "dictobject.h" #include "odictobject.h" #include "enumobject.h" #include "setobject.h" #include "methodobject.h" #include "moduleobject.h" #include "funcobject.h" #include "classobject.h" #include "fileobject.h" #include "pycapsule.h" #include "traceback.h" #include "sliceobject.h" #include "cellobject.h" #include "iterobject.h" #include "genobject.h" #include "descrobject.h" #include "warnings.h" #include "weakrefobject.h" #include "structseq.h" #include "namespaceobject.h" #include "codecs.h" #include "pyerrors.h" #include "pystate.h" #include "pyarena.h" #include "modsupport.h" #include "pythonrun.h" #include "pylifecycle.h" #include "ceval.h" #include "sysmodule.h" #include "osmodule.h" #include "intrcheck.h" #include "import.h" #include "abstract.h" #include "bltinmodule.h" #include "compile.h" #include "eval.h" #include "pyctype.h" #include "pystrtod.h" #include "pystrcmp.h" #include "dtoa.h" #include "fileutils.h" #include "pyfpe.h" #endif /* !Py_PYTHON_H */ python3.6m/_hashopenssl.h 0000644 00000002525 15063602043 0011333 0 ustar 00 #ifndef Py_HASHOPENSSL_H #define Py_HASHOPENSSL_H #include "Python.h" #include <openssl/crypto.h> #include <openssl/err.h> /* LCOV_EXCL_START */ static PyObject * _setException(PyObject *exc) { unsigned long errcode; const char *lib, *func, *reason; errcode = ERR_peek_last_error(); if (!errcode) { PyErr_SetString(exc, "unknown reasons"); return NULL; } ERR_clear_error(); lib = ERR_lib_error_string(errcode); func = ERR_func_error_string(errcode); reason = ERR_reason_error_string(errcode); if (lib && func) { PyErr_Format(exc, "[%s: %s] %s", lib, func, reason); } else if (lib) { PyErr_Format(exc, "[%s] %s", lib, reason); } else { PyErr_SetString(exc, reason); } return NULL; } /* LCOV_EXCL_STOP */ __attribute__((__unused__)) static int _Py_hashlib_fips_error(PyObject *exc, char *name) { int result = FIPS_mode(); if (result == 0) { // XXX: This function skips error checking. // This is only appropriate for RHEL. // See _hashlib.get_fips_mode for details. return 0; } PyErr_Format(exc, "%s is not available in FIPS mode", name); return 1; } #define FAIL_RETURN_IN_FIPS_MODE(exc, name) do { \ if (_Py_hashlib_fips_error(exc, name)) return NULL; \ } while (0) #endif // !Py_HASHOPENSSL_H python3.6m/abstract.h 0000644 00000134533 15063602043 0010455 0 ustar 00 #ifndef Py_ABSTRACTOBJECT_H #define Py_ABSTRACTOBJECT_H #ifdef __cplusplus extern "C" { #endif #ifdef PY_SSIZE_T_CLEAN #define PyObject_CallFunction _PyObject_CallFunction_SizeT #define PyObject_CallMethod _PyObject_CallMethod_SizeT #ifndef Py_LIMITED_API #define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT #endif /* !Py_LIMITED_API */ #endif /* Abstract Object Interface (many thanks to Jim Fulton) */ /* PROPOSAL: A Generic Python Object Interface for Python C Modules Problem Python modules written in C that must access Python objects must do so through routines whose interfaces are described by a set of include files. Unfortunately, these routines vary according to the object accessed. To use these routines, the C programmer must check the type of the object being used and must call a routine based on the object type. For example, to access an element of a sequence, the programmer must determine whether the sequence is a list or a tuple: if(is_tupleobject(o)) e=gettupleitem(o,i) else if(is_listitem(o)) e=getlistitem(o,i) If the programmer wants to get an item from another type of object that provides sequence behavior, there is no clear way to do it correctly. The persistent programmer may peruse object.h and find that the _typeobject structure provides a means of invoking up to (currently about) 41 special operators. So, for example, a routine can get an item from any object that provides sequence behavior. However, to use this mechanism, the programmer must make their code dependent on the current Python implementation. Also, certain semantics, especially memory management semantics, may differ by the type of object being used. Unfortunately, these semantics are not clearly described in the current include files. An abstract interface providing more consistent semantics is needed. Proposal I propose the creation of a standard interface (with an associated library of routines and/or macros) for generically obtaining the services of Python objects. This proposal can be viewed as one components of a Python C interface consisting of several components. From the viewpoint of C access to Python services, we have (as suggested by Guido in off-line discussions): - "Very high level layer": two or three functions that let you exec or eval arbitrary Python code given as a string in a module whose name is given, passing C values in and getting C values out using mkvalue/getargs style format strings. This does not require the user to declare any variables of type "PyObject *". This should be enough to write a simple application that gets Python code from the user, execs it, and returns the output or errors. (Error handling must also be part of this API.) - "Abstract objects layer": which is the subject of this proposal. It has many functions operating on objects, and lest you do many things from C that you can also write in Python, without going through the Python parser. - "Concrete objects layer": This is the public type-dependent interface provided by the standard built-in types, such as floats, strings, and lists. This interface exists and is currently documented by the collection of include files provided with the Python distributions. From the point of view of Python accessing services provided by C modules: - "Python module interface": this interface consist of the basic routines used to define modules and their members. Most of the current extensions-writing guide deals with this interface. - "Built-in object interface": this is the interface that a new built-in type must provide and the mechanisms and rules that a developer of a new built-in type must use and follow. This proposal is a "first-cut" that is intended to spur discussion. See especially the lists of notes. The Python C object interface will provide four protocols: object, numeric, sequence, and mapping. Each protocol consists of a collection of related operations. If an operation that is not provided by a particular type is invoked, then a standard exception, NotImplementedError is raised with an operation name as an argument. In addition, for convenience this interface defines a set of constructors for building objects of built-in types. This is needed so new objects can be returned from C functions that otherwise treat objects generically. Memory Management For all of the functions described in this proposal, if a function retains a reference to a Python object passed as an argument, then the function will increase the reference count of the object. It is unnecessary for the caller to increase the reference count of an argument in anticipation of the object's retention. All Python objects returned from functions should be treated as new objects. Functions that return objects assume that the caller will retain a reference and the reference count of the object has already been incremented to account for this fact. A caller that does not retain a reference to an object that is returned from a function must decrement the reference count of the object (using DECREF(object)) to prevent memory leaks. Note that the behavior mentioned here is different from the current behavior for some objects (e.g. lists and tuples) when certain type-specific routines are called directly (e.g. setlistitem). The proposed abstraction layer will provide a consistent memory management interface, correcting for inconsistent behavior for some built-in types. Protocols xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /* Object Protocol: */ /* Implemented elsewhere: int PyObject_Print(PyObject *o, FILE *fp, int flags); Print an object, o, on file, fp. Returns -1 on error. The flags argument is used to enable certain printing options. The only option currently supported is Py_Print_RAW. (What should be said about Py_Print_RAW?) */ /* Implemented elsewhere: int PyObject_HasAttrString(PyObject *o, const char *attr_name); Returns 1 if o has the attribute attr_name, and 0 otherwise. This is equivalent to the Python expression: hasattr(o,attr_name). This function always succeeds. */ /* Implemented elsewhere: PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); Retrieve an attributed named attr_name form object o. Returns the attribute value on success, or NULL on failure. This is the equivalent of the Python expression: o.attr_name. */ /* Implemented elsewhere: int PyObject_HasAttr(PyObject *o, PyObject *attr_name); Returns 1 if o has the attribute attr_name, and 0 otherwise. This is equivalent to the Python expression: hasattr(o,attr_name). This function always succeeds. */ /* Implemented elsewhere: PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); Retrieve an attributed named attr_name form object o. Returns the attribute value on success, or NULL on failure. This is the equivalent of the Python expression: o.attr_name. */ /* Implemented elsewhere: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); Set the value of the attribute named attr_name, for object o, to the value v. Raise an exception and return -1 on failure; return 0 on success. This is the equivalent of the Python statement o.attr_name=v. */ /* Implemented elsewhere: int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); Set the value of the attribute named attr_name, for object o, to the value v. Raise an exception and return -1 on failure; return 0 on success. This is the equivalent of the Python statement o.attr_name=v. */ /* implemented as a macro: int PyObject_DelAttrString(PyObject *o, const char *attr_name); Delete attribute named attr_name, for object o. Returns -1 on failure. This is the equivalent of the Python statement: del o.attr_name. */ #define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A),NULL) /* implemented as a macro: int PyObject_DelAttr(PyObject *o, PyObject *attr_name); Delete attribute named attr_name, for object o. Returns -1 on failure. This is the equivalent of the Python statement: del o.attr_name. */ #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) /* Implemented elsewhere: PyObject *PyObject_Repr(PyObject *o); Compute the string representation of object, o. Returns the string representation on success, NULL on failure. This is the equivalent of the Python expression: repr(o). Called by the repr() built-in function. */ /* Implemented elsewhere: PyObject *PyObject_Str(PyObject *o); Compute the string representation of object, o. Returns the string representation on success, NULL on failure. This is the equivalent of the Python expression: str(o).) Called by the str() and print() built-in functions. */ /* Declared elsewhere PyAPI_FUNC(int) PyCallable_Check(PyObject *o); Determine if the object, o, is callable. Return 1 if the object is callable and 0 otherwise. This function always succeeds. */ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kwargs); /* Call a callable Python object, callable_object, with arguments and keywords arguments. The 'args' argument can not be NULL. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyStack_AsTuple( PyObject **stack, Py_ssize_t nargs); /* Convert keyword arguments from the (stack, kwnames) format to a Python dictionary. kwnames must only contains str strings, no subclass, and all keys must be unique. kwnames is not checked, usually these checks are done before or later calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an error if a key is not a string. */ PyAPI_FUNC(PyObject *) _PyStack_AsDict( PyObject **values, PyObject *kwnames); /* Convert (args, nargs, kwargs: dict) into (stack, nargs, kwnames: tuple). Return 0 on success, raise an exception and return -1 on error. Write the new stack into *p_stack. If *p_stack is differen than args, it must be released by PyMem_Free(). The stack uses borrowed references. The type of keyword keys is not checked, these checks should be done later (ex: _PyArg_ParseStackAndKeywords). */ PyAPI_FUNC(int) _PyStack_UnpackDict( PyObject **args, Py_ssize_t nargs, PyObject *kwargs, PyObject ***p_stack, PyObject **p_kwnames); /* Call the callable object func with the "fast call" calling convention: args is a C array for positional arguments (nargs is the number of positional arguments), kwargs is a dictionary for keyword arguments. If nargs is equal to zero, args can be NULL. kwargs can be NULL. nargs must be greater or equal to zero. Return the result on success. Raise an exception on return NULL on error. */ PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); /* Call the callable object func with the "fast call" calling convention: args is a C array for positional arguments followed by values of keyword arguments. Keys of keyword arguments are stored as a tuple of strings in kwnames. nargs is the number of positional parameters at the beginning of stack. The size of kwnames gives the number of keyword values in the stack after positional arguments. kwnames must only contains str strings, no subclass, and all keys must be unique. If nargs is equal to zero and there is no keyword argument (kwnames is NULL or its size is zero), args can be NULL. Return the result on success. Raise an exception and return NULL on error. */ PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords (PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); #define _PyObject_FastCall(func, args, nargs) \ _PyObject_FastCallDict((func), (args), (nargs), NULL) #define _PyObject_CallNoArg(func) \ _PyObject_FastCall((func), NULL, 0) #define _PyObject_CallArg1(func, arg) \ _PyObject_FastCall((func), &(arg), 1) PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args, PyObject *kwargs); PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where); #endif /* Py_LIMITED_API */ PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, PyObject *args); /* Call a callable Python object, callable_object, with arguments given by the tuple, args. If no arguments are needed, then args may be NULL. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: o(*args). */ PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object, const char *format, ...); /* Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are described using a mkvalue-style format string. The format may be NULL, indicating that no arguments are provided. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: o(*args). */ PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, const char *method, const char *format, ...); /* Call the method named m of object o with a variable number of C arguments. The C arguments are described by a mkvalue format string. The format may be NULL, indicating that no arguments are provided. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: o.method(args). */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *o, _Py_Identifier *method, const char *format, ...); /* Like PyObject_CallMethod, but expect a _Py_Identifier* as the method name. */ #endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...); PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o, const char *name, const char *format, ...); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *o, _Py_Identifier *name, const char *format, ...); #endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, ...); /* Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are provided as PyObject * values, terminated by a NULL. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: o(*args). */ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o, PyObject *method, ...); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *o, struct _Py_Identifier *method, ...); #endif /* !Py_LIMITED_API */ /* Call the method named m of object o with a variable number of C arguments. The C arguments are provided as PyObject * values, terminated by NULL. Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: o.method(args). */ /* Implemented elsewhere: long PyObject_Hash(PyObject *o); Compute and return the hash, hash_value, of an object, o. On failure, return -1. This is the equivalent of the Python expression: hash(o). */ /* Implemented elsewhere: int PyObject_IsTrue(PyObject *o); Returns 1 if the object, o, is considered to be true, 0 if o is considered to be false and -1 on failure. This is equivalent to the Python expression: not not o */ /* Implemented elsewhere: int PyObject_Not(PyObject *o); Returns 0 if the object, o, is considered to be true, 1 if o is considered to be false and -1 on failure. This is equivalent to the Python expression: not o */ PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); /* On success, returns a type object corresponding to the object type of object o. On failure, returns NULL. This is equivalent to the Python expression: type(o). */ PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); /* Return the size of object o. If the object, o, provides both sequence and mapping protocols, the sequence size is returned. On error, -1 is returned. This is the equivalent to the Python expression: len(o). */ /* For DLL compatibility */ #undef PyObject_Length PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); #define PyObject_Length PyObject_Size #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); #endif /* Guess the size of object o using len(o) or o.__length_hint__(). If neither of those return a non-negative value, then return the default value. If one of the calls fails, this function returns -1. */ PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); /* Return element of o corresponding to the object, key, or NULL on failure. This is the equivalent of the Python expression: o[key]. */ PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); /* Map the object key to the value v. Raise an exception and return -1 on failure; return 0 on success. This is the equivalent of the Python statement o[key]=v. */ PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key); /* Remove the mapping for object, key, from the object *o. Returns -1 on failure. This is equivalent to the Python statement: del o[key]. */ PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); /* Delete the mapping for key from *o. Returns -1 on failure. This is the equivalent of the Python statement: del o[key]. */ /* old buffer API FIXME: usage of these should all be replaced in Python itself but for backwards compatibility we will implement them. Their usage without a corresponding "unlock" mechanism may create issues (but they would already be there). */ PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, const char **buffer, Py_ssize_t *buffer_len); /* Takes an arbitrary object which must support the (character, single segment) buffer interface and returns a pointer to a read-only memory location useable as character based input for subsequent processing. 0 is returned on success. buffer and buffer_len are only set in case no error occurs. Otherwise, -1 is returned and an exception set. */ PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj); /* Checks whether an arbitrary object supports the (character, single segment) buffer interface. Returns 1 on success, 0 on failure. */ PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len); /* Same as PyObject_AsCharBuffer() except that this API expects (readable, single segment) buffer interface and returns a pointer to a read-only memory location which can contain arbitrary data. 0 is returned on success. buffer and buffer_len are only set in case no error occurs. Otherwise, -1 is returned and an exception set. */ PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len); /* Takes an arbitrary object which must support the (writable, single segment) buffer interface and returns a pointer to a writable memory location in buffer of size buffer_len. 0 is returned on success. buffer and buffer_len are only set in case no error occurs. Otherwise, -1 is returned and an exception set. */ /* new buffer API */ #ifndef Py_LIMITED_API #define PyObject_CheckBuffer(obj) \ (((obj)->ob_type->tp_as_buffer != NULL) && \ ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) /* Return 1 if the getbuffer function is available, otherwise return 0 */ PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags); /* This is a C-API version of the getbuffer function call. It checks to make sure object has the required function pointer and issues the call. Returns -1 and raises an error on failure and returns 0 on success */ PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); /* Get the memory area pointed to by the indices for the buffer given. Note that view->ndim is the assumed size of indices */ PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); /* Return the implied itemsize of the data-format area from a struct-style description */ /* Implementation in memoryobject.c */ PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char order); PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char order); /* Copy len bytes of data from the contiguous chunk of memory pointed to by buf into the buffer exported by obj. Return 0 on success and return -1 and raise a PyBuffer_Error on error (i.e. the object does not have a buffer interface or it is not working). If fort is 'F', then if the object is multi-dimensional, then the data will be copied into the array in Fortran-style (first dimension varies the fastest). If fort is 'C', then the data will be copied into the array in C-style (last dimension varies the fastest). If fort is 'A', then it does not matter and the copy will be made in whatever way is more efficient. */ PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); /* Copy the data from the src buffer to the buffer of destination */ PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort); PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char fort); /* Fill the strides array with byte-strides of a contiguous (Fortran-style if fort is 'F' or C-style otherwise) array of the given shape with the given number of bytes per element. */ PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, Py_ssize_t len, int readonly, int flags); /* Fills in a buffer-info structure correctly for an exporter that can only share a contiguous chunk of memory of "unsigned bytes" of the given length. Returns 0 on success and -1 (with raising an error) on error. */ PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. */ #endif /* Py_LIMITED_API */ PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, PyObject *format_spec); /* Takes an arbitrary object and returns the result of calling obj.__format__(format_spec). */ /* Iterators */ PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); /* Takes an object and returns an iterator for it. This is typically a new iterator but if the argument is an iterator, this returns itself. */ #define PyIter_Check(obj) \ ((obj)->ob_type->tp_iternext != NULL && \ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); /* Takes an iterator object and calls its tp_iternext slot, returning the next value. If the iterator is exhausted, this returns NULL without setting an exception. NULL with an exception means an error occurred. */ /* Number Protocol:*/ PyAPI_FUNC(int) PyNumber_Check(PyObject *o); /* Returns 1 if the object, o, provides numeric protocols, and false otherwise. This function always succeeds. */ PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); /* Returns the result of adding o1 and o2, or null on failure. This is the equivalent of the Python expression: o1+o2. */ PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); /* Returns the result of subtracting o2 from o1, or null on failure. This is the equivalent of the Python expression: o1-o2. */ PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); /* Returns the result of multiplying o1 and o2, or null on failure. This is the equivalent of the Python expression: o1*o2. */ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); /* This is the equivalent of the Python expression: o1 @ o2. */ #endif PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving an integral result, or null on failure. This is the equivalent of the Python expression: o1//o2. */ PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving a float result, or null on failure. This is the equivalent of the Python expression: o1/o2. */ PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); /* Returns the remainder of dividing o1 by o2, or null on failure. This is the equivalent of the Python expression: o1%o2. */ PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); /* See the built-in function divmod. Returns NULL on failure. This is the equivalent of the Python expression: divmod(o1,o2). */ PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3); /* See the built-in function pow. Returns NULL on failure. This is the equivalent of the Python expression: pow(o1,o2,o3), where o3 is optional. */ PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); /* Returns the negation of o on success, or null on failure. This is the equivalent of the Python expression: -o. */ PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); /* Returns the (what?) of o on success, or NULL on failure. This is the equivalent of the Python expression: +o. */ PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); /* Returns the absolute value of o, or null on failure. This is the equivalent of the Python expression: abs(o). */ PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); /* Returns the bitwise negation of o on success, or NULL on failure. This is the equivalent of the Python expression: ~o. */ PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); /* Returns the result of left shifting o1 by o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1 << o2. */ PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); /* Returns the result of right shifting o1 by o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1 >> o2. */ PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); /* Returns the result of bitwise and of o1 and o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1&o2. */ PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); /* Returns the bitwise exclusive or of o1 by o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1^o2. */ PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); /* Returns the result of bitwise or on o1 and o2 on success, or NULL on failure. This is the equivalent of the Python expression: o1|o2. */ #define PyIndex_Check(obj) \ ((obj)->ob_type->tp_as_number != NULL && \ (obj)->ob_type->tp_as_number->nb_index != NULL) PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); /* Returns the object converted to a Python int or NULL with an error raised on failure. */ PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); /* Returns the object converted to Py_ssize_t by going through PyNumber_Index first. If an overflow error occurs while converting the int to Py_ssize_t, then the second argument is the error-type to return. If it is NULL, then the overflow error is cleared and the value is clipped. */ PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); /* Returns the o converted to an integer object on success, or NULL on failure. This is the equivalent of the Python expression: int(o). */ PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); /* Returns the o converted to a float object on success, or NULL on failure. This is the equivalent of the Python expression: float(o). */ /* In-place variants of (some of) the above number protocol functions */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); /* Returns the result of adding o2 to o1, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 += o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); /* Returns the result of subtracting o2 from o1, possibly in-place or null on failure. This is the equivalent of the Python expression: o1 -= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); /* Returns the result of multiplying o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 *= o2. */ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); /* This is the equivalent of the Python expression: o1 @= o2. */ #endif PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving an integral result, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 /= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2); /* Returns the result of dividing o1 by o2 giving a float result, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 /= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); /* Returns the remainder of dividing o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 %= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3); /* Returns the result of raising o1 to the power of o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); /* Returns the result of left shifting o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 <<= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); /* Returns the result of right shifting o1 by o2, possibly in-place or null on failure. This is the equivalent of the Python expression: o1 >>= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); /* Returns the result of bitwise and of o1 and o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 &= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); /* Returns the bitwise exclusive or of o1 by o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 ^= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); /* Returns the result of bitwise or of o1 and o2, possibly in-place, or null on failure. This is the equivalent of the Python expression: o1 |= o2. */ PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); /* Returns the integer n converted to a string with a base, with a base marker of 0b, 0o or 0x prefixed if applicable. If n is not an int object, it is converted with PyNumber_Index first. */ /* Sequence protocol:*/ PyAPI_FUNC(int) PySequence_Check(PyObject *o); /* Return 1 if the object provides sequence protocol, and zero otherwise. This function always succeeds. */ PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); /* Return the size of sequence object o, or -1 on failure. */ /* For DLL compatibility */ #undef PySequence_Length PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); #define PySequence_Length PySequence_Size PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); /* Return the concatenation of o1 and o2 on success, and NULL on failure. This is the equivalent of the Python expression: o1+o2. */ PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); /* Return the result of repeating sequence object o count times, or NULL on failure. This is the equivalent of the Python expression: o1*count. */ PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); /* Return the ith element of o, or NULL on failure. This is the equivalent of the Python expression: o[i]. */ PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); /* Return the slice of sequence object o between i1 and i2, or NULL on failure. This is the equivalent of the Python expression: o[i1:i2]. */ PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); /* Assign object v to the ith element of o. Raise an exception and return -1 on failure; return 0 on success. This is the equivalent of the Python statement o[i]=v. */ PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); /* Delete the ith element of object v. Returns -1 on failure. This is the equivalent of the Python statement: del o[i]. */ PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v); /* Assign the sequence object, v, to the slice in sequence object, o, from i1 to i2. Returns -1 on failure. This is the equivalent of the Python statement: o[i1:i2]=v. */ PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); /* Delete the slice in sequence object, o, from i1 to i2. Returns -1 on failure. This is the equivalent of the Python statement: del o[i1:i2]. */ PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); /* Returns the sequence, o, as a tuple on success, and NULL on failure. This is equivalent to the Python expression: tuple(o) */ PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); /* Returns the sequence, o, as a list on success, and NULL on failure. This is equivalent to the Python expression: list(o) */ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); /* Return the sequence, o, as a list, unless it's already a tuple or list. Use PySequence_Fast_GET_ITEM to access the members of this list, and PySequence_Fast_GET_SIZE to get its length. Returns NULL on failure. If the object does not support iteration, raises a TypeError exception with m as the message text. */ #define PySequence_Fast_GET_SIZE(o) \ (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) /* Return the size of o, assuming that o was returned by PySequence_Fast and is not NULL. */ #define PySequence_Fast_GET_ITEM(o, i)\ (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) /* Return the ith element of o, assuming that o was returned by PySequence_Fast, and that i is within bounds. */ #define PySequence_ITEM(o, i)\ ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) /* Assume tp_as_sequence and sq_item exist and that i does not need to be corrected for a negative index */ #define PySequence_Fast_ITEMS(sf) \ (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ : ((PyTupleObject *)(sf))->ob_item) /* Return a pointer to the underlying item array for an object retured by PySequence_Fast */ PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); /* Return the number of occurrences on value on o, that is, return the number of keys for which o[key]==value. On failure, return -1. This is equivalent to the Python expression: o.count(value). */ PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); /* Return -1 if error; 1 if ob in seq; 0 if ob not in seq. Use __contains__ if possible, else _PySequence_IterSearch(). */ #ifndef Py_LIMITED_API #define PY_ITERSEARCH_COUNT 1 #define PY_ITERSEARCH_INDEX 2 #define PY_ITERSEARCH_CONTAINS 3 PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, PyObject *obj, int operation); #endif /* Iterate over seq. Result depends on the operation: PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if error. PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of obj in seq; set ValueError and return -1 if none found; also return -1 on error. PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on error. */ /* For DLL-level backwards compatibility */ #undef PySequence_In PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); /* For source-level backwards compatibility */ #define PySequence_In PySequence_Contains /* Determine if o contains value. If an item in o is equal to X, return 1, otherwise return 0. On error, return -1. This is equivalent to the Python expression: value in o. */ PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); /* Return the first index for which o[i]=value. On error, return -1. This is equivalent to the Python expression: o.index(value). */ /* In-place versions of some of the above Sequence functions. */ PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); /* Append o2 to o1, in-place when possible. Return the resulting object, which could be o1, or NULL on failure. This is the equivalent of the Python expression: o1 += o2. */ PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); /* Repeat o1 by count, in-place when possible. Return the resulting object, which could be o1, or NULL on failure. This is the equivalent of the Python expression: o1 *= count. */ /* Mapping protocol:*/ PyAPI_FUNC(int) PyMapping_Check(PyObject *o); /* Return 1 if the object provides mapping protocol, and zero otherwise. This function always succeeds. */ PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); /* Returns the number of keys in object o on success, and -1 on failure. For objects that do not provide sequence protocol, this is equivalent to the Python expression: len(o). */ /* For DLL compatibility */ #undef PyMapping_Length PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); #define PyMapping_Length PyMapping_Size /* implemented as a macro: int PyMapping_DelItemString(PyObject *o, const char *key); Remove the mapping for object, key, from the object *o. Returns -1 on failure. This is equivalent to the Python statement: del o[key]. */ #define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) /* implemented as a macro: int PyMapping_DelItem(PyObject *o, PyObject *key); Remove the mapping for object, key, from the object *o. Returns -1 on failure. This is equivalent to the Python statement: del o[key]. */ #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key); /* On success, return 1 if the mapping object has the key, key, and 0 otherwise. This is equivalent to the Python expression: key in o. This function always succeeds. */ PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); /* Return 1 if the mapping object has the key, key, and 0 otherwise. This is equivalent to the Python expression: key in o. This function always succeeds. */ PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o); /* On success, return a list or tuple of the keys in object o. On failure, return NULL. */ PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o); /* On success, return a list or tuple of the values in object o. On failure, return NULL. */ PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o); /* On success, return a list or tuple of the items in object o, where each item is a tuple containing a key-value pair. On failure, return NULL. */ PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, const char *key); /* Return element of o corresponding to the object, key, or NULL on failure. This is the equivalent of the Python expression: o[key]. */ PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value); /* Map the object, key, to the value, v. Returns -1 on failure. This is the equivalent of the Python statement: o[key]=v. */ PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); /* isinstance(object, typeorclass) */ PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); /* issubclass(object, typeorclass) */ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self); PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]); /* For internal use by buffer API functions */ PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, const Py_ssize_t *shape); PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, const Py_ssize_t *shape); #endif /* !Py_LIMITED_API */ #ifdef __cplusplus } #endif #endif /* Py_ABSTRACTOBJECT_H */ python3.6m/accu.h 0000644 00000001770 15063602043 0007561 0 ustar 00 #ifndef Py_LIMITED_API #ifndef Py_ACCU_H #define Py_ACCU_H /*** This is a private API for use by the interpreter and the stdlib. *** Its definition may be changed or removed at any moment. ***/ /* * A two-level accumulator of unicode objects that avoids both the overhead * of keeping a huge number of small separate objects, and the quadratic * behaviour of using a naive repeated concatenation scheme. */ #ifdef __cplusplus extern "C" { #endif #undef small /* defined by some Windows headers */ typedef struct { PyObject *large; /* A list of previously accumulated large strings */ PyObject *small; /* Pending small strings */ } _PyAccu; PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc); PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode); PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc); PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc); PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); #ifdef __cplusplus } #endif #endif /* Py_ACCU_H */ #endif /* Py_LIMITED_API */ python3.6m/asdl.h 0000644 00000002275 15063602043 0007572 0 ustar 00 #ifndef Py_ASDL_H #define Py_ASDL_H typedef PyObject * identifier; typedef PyObject * string; typedef PyObject * bytes; typedef PyObject * object; typedef PyObject * singleton; typedef PyObject * constant; /* It would be nice if the code generated by asdl_c.py was completely independent of Python, but it is a goal the requires too much work at this stage. So, for example, I'll represent identifiers as interned Python strings. */ /* XXX A sequence should be typed so that its use can be typechecked. */ typedef struct { Py_ssize_t size; void *elements[1]; } asdl_seq; typedef struct { Py_ssize_t size; int elements[1]; } asdl_int_seq; asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena); asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena); #define asdl_seq_GET(S, I) (S)->elements[(I)] #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) #ifdef Py_DEBUG #define asdl_seq_SET(S, I, V) \ do { \ Py_ssize_t _asdl_i = (I); \ assert((S) != NULL); \ assert(_asdl_i < (S)->size); \ (S)->elements[_asdl_i] = (V); \ } while (0) #else #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) #endif #endif /* !Py_ASDL_H */ python3.6m/ast.h 0000644 00000000735 15063602043 0007435 0 ustar 00 #ifndef Py_AST_H #define Py_AST_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(int) PyAST_Validate(mod_ty); PyAPI_FUNC(mod_ty) PyAST_FromNode( const node *n, PyCompilerFlags *flags, const char *filename, /* decoded from the filesystem encoding */ PyArena *arena); PyAPI_FUNC(mod_ty) PyAST_FromNodeObject( const node *n, PyCompilerFlags *flags, PyObject *filename, PyArena *arena); #ifdef __cplusplus } #endif #endif /* !Py_AST_H */ sys/sdt-config.h 0000644 00000000424 15063602043 0007567 0 ustar 00 /* includes/sys/sdt-config.h. Generated from sdt-config.h.in by configure. This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to indicate whether the assembler supports "?" in .pushsection directives. */ #define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1 sys/sdt.h 0000644 00000053215 15063602043 0006332 0 ustar 00 /* <sys/sdt.h> - Systemtap static probe definition macros. This file is dedicated to the public domain, pursuant to CC0 (https://creativecommons.org/publicdomain/zero/1.0/) */ #ifndef _SYS_SDT_H #define _SYS_SDT_H 1 /* This file defines a family of macros STAP_PROBEn(op1, ..., opn) that emit a nop into the instruction stream, and some data into an auxiliary note section. The data in the note section describes the operands, in terms of size and location. Each location is encoded as assembler operand string. Consumer tools such as gdb or systemtap insert breakpoints on top of the nop, and decode the location operand-strings, like an assembler, to find the values being passed. The operand strings are selected by the compiler for each operand. They are constrained by gcc inline-assembler codes. The default is: #define STAP_SDT_ARG_CONSTRAINT nor This is a good default if the operands tend to be integral and moderate in number (smaller than number of registers). In other cases, the compiler may report "'asm' requires impossible reload" or similar. In this case, consider simplifying the macro call (fewer and simpler operands), reduce optimization, or override the default constraints string via: #define STAP_SDT_ARG_CONSTRAINT g #include <sys/sdt.h> See also: https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation https://gcc.gnu.org/onlinedocs/gcc/Constraints.html */ #ifdef __ASSEMBLER__ # define _SDT_PROBE(provider, name, n, arglist) \ _SDT_ASM_BODY(provider, name, _SDT_ASM_SUBSTR_1, (_SDT_DEPAREN_##n arglist)) \ _SDT_ASM_BASE # define _SDT_ASM_1(x) x; # define _SDT_ASM_2(a, b) a,b; # define _SDT_ASM_3(a, b, c) a,b,c; # define _SDT_ASM_5(a, b, c, d, e) a,b,c,d,e; # define _SDT_ASM_STRING_1(x) .asciz #x; # define _SDT_ASM_SUBSTR_1(x) .ascii #x; # define _SDT_DEPAREN_0() /* empty */ # define _SDT_DEPAREN_1(a) a # define _SDT_DEPAREN_2(a,b) a b # define _SDT_DEPAREN_3(a,b,c) a b c # define _SDT_DEPAREN_4(a,b,c,d) a b c d # define _SDT_DEPAREN_5(a,b,c,d,e) a b c d e # define _SDT_DEPAREN_6(a,b,c,d,e,f) a b c d e f # define _SDT_DEPAREN_7(a,b,c,d,e,f,g) a b c d e f g # define _SDT_DEPAREN_8(a,b,c,d,e,f,g,h) a b c d e f g h # define _SDT_DEPAREN_9(a,b,c,d,e,f,g,h,i) a b c d e f g h i # define _SDT_DEPAREN_10(a,b,c,d,e,f,g,h,i,j) a b c d e f g h i j # define _SDT_DEPAREN_11(a,b,c,d,e,f,g,h,i,j,k) a b c d e f g h i j k # define _SDT_DEPAREN_12(a,b,c,d,e,f,g,h,i,j,k,l) a b c d e f g h i j k l #else #if defined _SDT_HAS_SEMAPHORES #define _SDT_NOTE_SEMAPHORE_USE(provider, name) \ __asm__ __volatile__ ("" :: "m" (provider##_##name##_semaphore)); #else #define _SDT_NOTE_SEMAPHORE_USE(provider, name) #endif # define _SDT_PROBE(provider, name, n, arglist) \ do { \ _SDT_NOTE_SEMAPHORE_USE(provider, name); \ __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \ :: _SDT_ASM_OPERANDS_##n arglist); \ __asm__ __volatile__ (_SDT_ASM_BASE); \ } while (0) # define _SDT_S(x) #x # define _SDT_ASM_1(x) _SDT_S(x) "\n" # define _SDT_ASM_2(a, b) _SDT_S(a) "," _SDT_S(b) "\n" # define _SDT_ASM_3(a, b, c) _SDT_S(a) "," _SDT_S(b) "," \ _SDT_S(c) "\n" # define _SDT_ASM_5(a, b, c, d, e) _SDT_S(a) "," _SDT_S(b) "," \ _SDT_S(c) "," _SDT_S(d) "," \ _SDT_S(e) "\n" # define _SDT_ASM_ARGS(n) _SDT_ASM_TEMPLATE_##n # define _SDT_ASM_STRING_1(x) _SDT_ASM_1(.asciz #x) # define _SDT_ASM_SUBSTR_1(x) _SDT_ASM_1(.ascii #x) # define _SDT_ARGFMT(no) _SDT_ASM_1(_SDT_SIGN %n[_SDT_S##no]) \ _SDT_ASM_1(_SDT_SIZE %n[_SDT_S##no]) \ _SDT_ASM_1(_SDT_TYPE %n[_SDT_S##no]) \ _SDT_ASM_SUBSTR(_SDT_ARGTMPL(_SDT_A##no)) # ifndef STAP_SDT_ARG_CONSTRAINT # if defined __powerpc__ # define STAP_SDT_ARG_CONSTRAINT nZr # elif defined __arm__ # define STAP_SDT_ARG_CONSTRAINT g # else # define STAP_SDT_ARG_CONSTRAINT nor # endif # endif # define _SDT_STRINGIFY(x) #x # define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x) /* _SDT_S encodes the size and type as 0xSSTT which is decoded by the assembler macros _SDT_SIZE and _SDT_TYPE */ # define _SDT_ARG(n, x) \ [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? (int)-1 : 1) * (-(((int) _SDT_ARGSIZE (x)) << 8) + (-(0x7f & __builtin_classify_type (x))))), \ [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x)) #endif #define _SDT_ASM_STRING(x) _SDT_ASM_STRING_1(x) #define _SDT_ASM_SUBSTR(x) _SDT_ASM_SUBSTR_1(x) #define _SDT_ARGARRAY(x) (__builtin_classify_type (x) == 14 \ || __builtin_classify_type (x) == 5) #ifdef __cplusplus # define _SDT_ARGSIGNED(x) (!_SDT_ARGARRAY (x) \ && __sdt_type<__typeof (x)>::__sdt_signed) # define _SDT_ARGSIZE(x) (_SDT_ARGARRAY (x) \ ? sizeof (void *) : sizeof (x)) # define _SDT_ARGVAL(x) (x) # include <cstddef> template<typename __sdt_T> struct __sdt_type { static const bool __sdt_signed = false; }; #define __SDT_ALWAYS_SIGNED(T) \ template<> struct __sdt_type<T> { static const bool __sdt_signed = true; }; #define __SDT_COND_SIGNED(T,CT) \ template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); }; __SDT_ALWAYS_SIGNED(signed char) __SDT_ALWAYS_SIGNED(short) __SDT_ALWAYS_SIGNED(int) __SDT_ALWAYS_SIGNED(long) __SDT_ALWAYS_SIGNED(long long) __SDT_ALWAYS_SIGNED(volatile signed char) __SDT_ALWAYS_SIGNED(volatile short) __SDT_ALWAYS_SIGNED(volatile int) __SDT_ALWAYS_SIGNED(volatile long) __SDT_ALWAYS_SIGNED(volatile long long) __SDT_ALWAYS_SIGNED(const signed char) __SDT_ALWAYS_SIGNED(const short) __SDT_ALWAYS_SIGNED(const int) __SDT_ALWAYS_SIGNED(const long) __SDT_ALWAYS_SIGNED(const long long) __SDT_ALWAYS_SIGNED(const volatile signed char) __SDT_ALWAYS_SIGNED(const volatile short) __SDT_ALWAYS_SIGNED(const volatile int) __SDT_ALWAYS_SIGNED(const volatile long) __SDT_ALWAYS_SIGNED(const volatile long long) __SDT_COND_SIGNED(char, char) __SDT_COND_SIGNED(wchar_t, wchar_t) __SDT_COND_SIGNED(volatile char, char) __SDT_COND_SIGNED(volatile wchar_t, wchar_t) __SDT_COND_SIGNED(const char, char) __SDT_COND_SIGNED(const wchar_t, wchar_t) __SDT_COND_SIGNED(const volatile char, char) __SDT_COND_SIGNED(const volatile wchar_t, wchar_t) #if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) /* __SDT_COND_SIGNED(char16_t) */ /* __SDT_COND_SIGNED(char32_t) */ #endif template<typename __sdt_E> struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {}; template<typename __sdt_E, size_t __sdt_N> struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {}; #elif !defined(__ASSEMBLER__) __extension__ extern unsigned long long __sdt_unsp; # define _SDT_ARGINTTYPE(x) \ __typeof (__builtin_choose_expr (((__builtin_classify_type (x) \ + 3) & -4) == 4, (x), 0U)) # define _SDT_ARGSIGNED(x) \ (!__extension__ \ (__builtin_constant_p ((((unsigned long long) \ (_SDT_ARGINTTYPE (x)) __sdt_unsp) \ & ((unsigned long long)1 << (sizeof (unsigned long long) \ * __CHAR_BIT__ - 1))) == 0) \ || (_SDT_ARGINTTYPE (x)) -1 > (_SDT_ARGINTTYPE (x)) 0)) # define _SDT_ARGSIZE(x) \ (_SDT_ARGARRAY (x) ? sizeof (void *) : sizeof (x)) # define _SDT_ARGVAL(x) (x) #endif #if defined __powerpc__ || defined __powerpc64__ # define _SDT_ARGTMPL(id) %I[id]%[id] #elif defined __i386__ # define _SDT_ARGTMPL(id) %k[id] /* gcc.gnu.org/PR80115 sourceware.org/PR24541 */ #else # define _SDT_ARGTMPL(id) %[id] #endif /* NB: gdb PR24541 highlighted an unspecified corner of the sdt.h operand note format. The named register may be a longer or shorter (!) alias for the storage where the value in question is found. For example, on i386, 64-bit value may be put in register pairs, and the register name stored would identify just one of them. Previously, gcc was asked to emit the %w[id] (16-bit alias of some registers holding operands), even when a wider 32-bit value was used. Bottom line: the byte-width given before the @ sign governs. If there is a mismatch between that width and that of the named register, then a sys/sdt.h note consumer may need to employ architecture-specific heuristics to figure out where the compiler has actually put the complete value. */ #ifdef __LP64__ # define _SDT_ASM_ADDR .8byte #else # define _SDT_ASM_ADDR .4byte #endif /* The ia64 and s390 nop instructions take an argument. */ #if defined(__ia64__) || defined(__s390__) || defined(__s390x__) #define _SDT_NOP nop 0 #else #define _SDT_NOP nop #endif #define _SDT_NOTE_NAME "stapsdt" #define _SDT_NOTE_TYPE 3 /* If the assembler supports the necessary feature, then we can play nice with code in COMDAT sections, which comes up in C++ code. Without that assembler support, some combinations of probe placements in certain kinds of C++ code may produce link-time errors. */ #include "sdt-config.h" #if _SDT_ASM_SECTION_AUTOGROUP_SUPPORT # define _SDT_ASM_AUTOGROUP "?" #else # define _SDT_ASM_AUTOGROUP "" #endif #define _SDT_DEF_MACROS \ _SDT_ASM_1(.altmacro) \ _SDT_ASM_1(.macro _SDT_SIGN x) \ _SDT_ASM_1(.iflt \\x) \ _SDT_ASM_1(.ascii "-") \ _SDT_ASM_1(.endif) \ _SDT_ASM_1(.endm) \ _SDT_ASM_1(.macro _SDT_SIZE_ x) \ _SDT_ASM_1(.ascii "\x") \ _SDT_ASM_1(.endm) \ _SDT_ASM_1(.macro _SDT_SIZE x) \ _SDT_ASM_1(_SDT_SIZE_ %%((-(-\\x*((-\\x>0)-(-\\x<0))))>>8)) \ _SDT_ASM_1(.endm) \ _SDT_ASM_1(.macro _SDT_TYPE_ x) \ _SDT_ASM_2(.ifc 8,\\x) \ _SDT_ASM_1(.ascii "f") \ _SDT_ASM_1(.endif) \ _SDT_ASM_1(.ascii "@") \ _SDT_ASM_1(.endm) \ _SDT_ASM_1(.macro _SDT_TYPE x) \ _SDT_ASM_1(_SDT_TYPE_ %%((\\x)&(0xff))) \ _SDT_ASM_1(.endm) #define _SDT_UNDEF_MACROS \ _SDT_ASM_1(.purgem _SDT_SIGN) \ _SDT_ASM_1(.purgem _SDT_SIZE_) \ _SDT_ASM_1(.purgem _SDT_SIZE) \ _SDT_ASM_1(.purgem _SDT_TYPE_) \ _SDT_ASM_1(.purgem _SDT_TYPE) #define _SDT_ASM_BODY(provider, name, pack_args, args, ...) \ _SDT_DEF_MACROS \ _SDT_ASM_1(990: _SDT_NOP) \ _SDT_ASM_3( .pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \ _SDT_ASM_1( .balign 4) \ _SDT_ASM_3( .4byte 992f-991f, 994f-993f, _SDT_NOTE_TYPE) \ _SDT_ASM_1(991: .asciz _SDT_NOTE_NAME) \ _SDT_ASM_1(992: .balign 4) \ _SDT_ASM_1(993: _SDT_ASM_ADDR 990b) \ _SDT_ASM_1( _SDT_ASM_ADDR _.stapsdt.base) \ _SDT_SEMAPHORE(provider,name) \ _SDT_ASM_STRING(provider) \ _SDT_ASM_STRING(name) \ pack_args args \ _SDT_ASM_SUBSTR(\x00) \ _SDT_UNDEF_MACROS \ _SDT_ASM_1(994: .balign 4) \ _SDT_ASM_1( .popsection) #define _SDT_ASM_BASE \ _SDT_ASM_1(.ifndef _.stapsdt.base) \ _SDT_ASM_5( .pushsection .stapsdt.base,"aG","progbits", \ .stapsdt.base,comdat) \ _SDT_ASM_1( .weak _.stapsdt.base) \ _SDT_ASM_1( .hidden _.stapsdt.base) \ _SDT_ASM_1( _.stapsdt.base: .space 1) \ _SDT_ASM_2( .size _.stapsdt.base, 1) \ _SDT_ASM_1( .popsection) \ _SDT_ASM_1(.endif) #if defined _SDT_HAS_SEMAPHORES #define _SDT_SEMAPHORE(p,n) \ _SDT_ASM_1( _SDT_ASM_ADDR p##_##n##_semaphore) #else #define _SDT_SEMAPHORE(p,n) _SDT_ASM_1( _SDT_ASM_ADDR 0) #endif #define _SDT_ASM_BLANK _SDT_ASM_SUBSTR(\x20) #define _SDT_ASM_TEMPLATE_0 /* no arguments */ #define _SDT_ASM_TEMPLATE_1 _SDT_ARGFMT(1) #define _SDT_ASM_TEMPLATE_2 _SDT_ASM_TEMPLATE_1 _SDT_ASM_BLANK _SDT_ARGFMT(2) #define _SDT_ASM_TEMPLATE_3 _SDT_ASM_TEMPLATE_2 _SDT_ASM_BLANK _SDT_ARGFMT(3) #define _SDT_ASM_TEMPLATE_4 _SDT_ASM_TEMPLATE_3 _SDT_ASM_BLANK _SDT_ARGFMT(4) #define _SDT_ASM_TEMPLATE_5 _SDT_ASM_TEMPLATE_4 _SDT_ASM_BLANK _SDT_ARGFMT(5) #define _SDT_ASM_TEMPLATE_6 _SDT_ASM_TEMPLATE_5 _SDT_ASM_BLANK _SDT_ARGFMT(6) #define _SDT_ASM_TEMPLATE_7 _SDT_ASM_TEMPLATE_6 _SDT_ASM_BLANK _SDT_ARGFMT(7) #define _SDT_ASM_TEMPLATE_8 _SDT_ASM_TEMPLATE_7 _SDT_ASM_BLANK _SDT_ARGFMT(8) #define _SDT_ASM_TEMPLATE_9 _SDT_ASM_TEMPLATE_8 _SDT_ASM_BLANK _SDT_ARGFMT(9) #define _SDT_ASM_TEMPLATE_10 _SDT_ASM_TEMPLATE_9 _SDT_ASM_BLANK _SDT_ARGFMT(10) #define _SDT_ASM_TEMPLATE_11 _SDT_ASM_TEMPLATE_10 _SDT_ASM_BLANK _SDT_ARGFMT(11) #define _SDT_ASM_TEMPLATE_12 _SDT_ASM_TEMPLATE_11 _SDT_ASM_BLANK _SDT_ARGFMT(12) #define _SDT_ASM_OPERANDS_0() [__sdt_dummy] "g" (0) #define _SDT_ASM_OPERANDS_1(arg1) _SDT_ARG(1, arg1) #define _SDT_ASM_OPERANDS_2(arg1, arg2) \ _SDT_ASM_OPERANDS_1(arg1), _SDT_ARG(2, arg2) #define _SDT_ASM_OPERANDS_3(arg1, arg2, arg3) \ _SDT_ASM_OPERANDS_2(arg1, arg2), _SDT_ARG(3, arg3) #define _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4) \ _SDT_ASM_OPERANDS_3(arg1, arg2, arg3), _SDT_ARG(4, arg4) #define _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5) \ _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4), _SDT_ARG(5, arg5) #define _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5), _SDT_ARG(6, arg6) #define _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6), _SDT_ARG(7, arg7) #define _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7), \ _SDT_ARG(8, arg8) #define _SDT_ASM_OPERANDS_9(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \ _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), \ _SDT_ARG(9, arg9) #define _SDT_ASM_OPERANDS_10(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ _SDT_ASM_OPERANDS_9(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), \ _SDT_ARG(10, arg10) #define _SDT_ASM_OPERANDS_11(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \ _SDT_ASM_OPERANDS_10(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), \ _SDT_ARG(11, arg11) #define _SDT_ASM_OPERANDS_12(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \ _SDT_ASM_OPERANDS_11(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), \ _SDT_ARG(12, arg12) /* These macros can be used in C, C++, or assembly code. In assembly code the arguments should use normal assembly operand syntax. */ #define STAP_PROBE(provider, name) \ _SDT_PROBE(provider, name, 0, ()) #define STAP_PROBE1(provider, name, arg1) \ _SDT_PROBE(provider, name, 1, (arg1)) #define STAP_PROBE2(provider, name, arg1, arg2) \ _SDT_PROBE(provider, name, 2, (arg1, arg2)) #define STAP_PROBE3(provider, name, arg1, arg2, arg3) \ _SDT_PROBE(provider, name, 3, (arg1, arg2, arg3)) #define STAP_PROBE4(provider, name, arg1, arg2, arg3, arg4) \ _SDT_PROBE(provider, name, 4, (arg1, arg2, arg3, arg4)) #define STAP_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) \ _SDT_PROBE(provider, name, 5, (arg1, arg2, arg3, arg4, arg5)) #define STAP_PROBE6(provider, name, arg1, arg2, arg3, arg4, arg5, arg6) \ _SDT_PROBE(provider, name, 6, (arg1, arg2, arg3, arg4, arg5, arg6)) #define STAP_PROBE7(provider, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ _SDT_PROBE(provider, name, 7, (arg1, arg2, arg3, arg4, arg5, arg6, arg7)) #define STAP_PROBE8(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \ _SDT_PROBE(provider, name, 8, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) #define STAP_PROBE9(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\ _SDT_PROBE(provider, name, 9, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)) #define STAP_PROBE10(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ _SDT_PROBE(provider, name, 10, \ (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)) #define STAP_PROBE11(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \ _SDT_PROBE(provider, name, 11, \ (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)) #define STAP_PROBE12(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \ _SDT_PROBE(provider, name, 12, \ (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12)) /* This STAP_PROBEV macro can be used in variadic scenarios, where the number of probe arguments is not known until compile time. Since variadic macro support may vary with compiler options, you must pre-#define SDT_USE_VARIADIC to enable this type of probe. The trick to count __VA_ARGS__ was inspired by this post by Laurent Deniau <laurent.deniau@cern.ch>: http://groups.google.com/group/comp.std.c/msg/346fc464319b1ee5 Note that our _SDT_NARG is called with an extra 0 arg that's not counted, so we don't have to worry about the behavior of macros called without any arguments. */ #define _SDT_NARG(...) __SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0) #define __SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N #ifdef SDT_USE_VARIADIC #define _SDT_PROBE_N(provider, name, N, ...) \ _SDT_PROBE(provider, name, N, (__VA_ARGS__)) #define STAP_PROBEV(provider, name, ...) \ _SDT_PROBE_N(provider, name, _SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__) #endif /* These macros are for use in asm statements. You must compile with -std=gnu99 or -std=c99 to use the STAP_PROBE_ASM macro. The STAP_PROBE_ASM macro generates a quoted string to be used in the template portion of the asm statement, concatenated with strings that contain the actual assembly code around the probe site. For example: asm ("before\n" STAP_PROBE_ASM(provider, fooprobe, %eax 4(%esi)) "after"); emits the assembly code for "before\nafter", with a probe in between. The probe arguments are the %eax register, and the value of the memory word located 4 bytes past the address in the %esi register. Note that because this is a simple asm, not a GNU C extended asm statement, these % characters do not need to be doubled to generate literal %reg names. In a GNU C extended asm statement, the probe arguments can be specified using the macro STAP_PROBE_ASM_TEMPLATE(n) for n arguments. The paired macro STAP_PROBE_ASM_OPERANDS gives the C values of these probe arguments, and appears in the input operand list of the asm statement. For example: asm ("someinsn %0,%1\n" // %0 is output operand, %1 is input operand STAP_PROBE_ASM(provider, fooprobe, STAP_PROBE_ASM_TEMPLATE(3)) "otherinsn %[namedarg]" : "r" (outvar) : "g" (some_value), [namedarg] "i" (1234), STAP_PROBE_ASM_OPERANDS(3, some_value, some_ptr->field, 1234)); This is just like writing: STAP_PROBE3(provider, fooprobe, some_value, some_ptr->field, 1234)); but the probe site is right between "someinsn" and "otherinsn". The probe arguments in STAP_PROBE_ASM can be given as assembly operands instead, even inside a GNU C extended asm statement. Note that these can use operand templates like %0 or %[name], and likewise they must write %%reg for a literal operand of %reg. */ #define _SDT_ASM_BODY_1(p,n,...) _SDT_ASM_BODY(p,n,_SDT_ASM_SUBSTR,(__VA_ARGS__)) #define _SDT_ASM_BODY_2(p,n,...) _SDT_ASM_BODY(p,n,/*_SDT_ASM_STRING */,__VA_ARGS__) #define _SDT_ASM_BODY_N2(p,n,no,...) _SDT_ASM_BODY_ ## no(p,n,__VA_ARGS__) #define _SDT_ASM_BODY_N1(p,n,no,...) _SDT_ASM_BODY_N2(p,n,no,__VA_ARGS__) #define _SDT_ASM_BODY_N(p,n,...) _SDT_ASM_BODY_N1(p,n,_SDT_NARG(0, __VA_ARGS__),__VA_ARGS__) #if __STDC_VERSION__ >= 199901L # define STAP_PROBE_ASM(provider, name, ...) \ _SDT_ASM_BODY_N(provider, name, __VA_ARGS__) \ _SDT_ASM_BASE # define STAP_PROBE_ASM_OPERANDS(n, ...) _SDT_ASM_OPERANDS_##n(__VA_ARGS__) #else # define STAP_PROBE_ASM(provider, name, args) \ _SDT_ASM_BODY(provider, name, /* _SDT_ASM_STRING */, (args)) \ _SDT_ASM_BASE #endif #define STAP_PROBE_ASM_TEMPLATE(n) _SDT_ASM_TEMPLATE_##n,"use _SDT_ASM_TEMPLATE_" /* DTrace compatible macro names. */ #define DTRACE_PROBE(provider,probe) \ STAP_PROBE(provider,probe) #define DTRACE_PROBE1(provider,probe,parm1) \ STAP_PROBE1(provider,probe,parm1) #define DTRACE_PROBE2(provider,probe,parm1,parm2) \ STAP_PROBE2(provider,probe,parm1,parm2) #define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3) \ STAP_PROBE3(provider,probe,parm1,parm2,parm3) #define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) #define DTRACE_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) #define DTRACE_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) #define DTRACE_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \ STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) #define DTRACE_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \ STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) #define DTRACE_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \ STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) #define DTRACE_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \ STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) #define DTRACE_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) \ STAP_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) #define DTRACE_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) \ STAP_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) #endif /* sys/sdt.h */ sys/fanotify.h 0000644 00000002413 15063602043 0007351 0 ustar 00 /* Copyright (C) 2010-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_FANOTIFY_H #define _SYS_FANOTIFY_H 1 #include <stdint.h> #include <linux/fanotify.h> __BEGIN_DECLS /* Create and initialize fanotify group. */ extern int fanotify_init (unsigned int __flags, unsigned int __event_f_flags) __THROW; /* Add, remove, or modify an fanotify mark on a filesystem object. */ extern int fanotify_mark (int __fanotify_fd, unsigned int __flags, uint64_t __mask, int __dfd, const char *__pathname) __THROW; __END_DECLS #endif /* sys/fanotify.h */ sys/fcntl.h 0000644 00000000023 15063602043 0006633 0 ustar 00 #include <fcntl.h> sys/file.h 0000644 00000003212 15063602043 0006447 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_FILE_H #define _SYS_FILE_H 1 #include <features.h> #ifndef _FCNTL_H # include <fcntl.h> #endif __BEGIN_DECLS /* Alternate names for values for the WHENCE argument to `lseek'. These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */ #ifndef L_SET # define L_SET 0 /* Seek from beginning of file. */ # define L_INCR 1 /* Seek from current position. */ # define L_XTND 2 /* Seek from end of file. */ #endif /* Operations for the `flock' call. */ #define LOCK_SH 1 /* Shared lock. */ #define LOCK_EX 2 /* Exclusive lock. */ #define LOCK_UN 8 /* Unlock. */ /* Can be OR'd in to one of the above. */ #define LOCK_NB 4 /* Don't block when locking. */ /* Apply or remove an advisory lock, according to OPERATION, on the file FD refers to. */ extern int flock (int __fd, int __operation) __THROW; __END_DECLS #endif /* sys/file.h */ sys/fsuid.h 0000644 00000002243 15063602043 0006645 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_FSUID_H #define _SYS_FSUID_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* Change uid used for file access control to UID, without affecting other privileges (such as who can send signals at the process). */ extern int setfsuid (__uid_t __uid) __THROW; /* Ditto for group id. */ extern int setfsgid (__gid_t __gid) __THROW; __END_DECLS #endif /* fsuid.h */ sys/gmon.h 0000644 00000014126 15063602043 0006476 0 ustar 00 /*- * Copyright (c) 1982, 1986, 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)gmon.h 8.2 (Berkeley) 1/4/94 */ #ifndef _SYS_GMON_H #define _SYS_GMON_H 1 #include <features.h> #include <sys/types.h> /* * See gmon_out.h for gmon.out format. */ /* structure emitted by "gcc -a". This must match struct bb in gcc/libgcc2.c. It is OK for gcc to declare a longer structure as long as the members below are present. */ struct __bb { long zero_word; const char *filename; long *counts; long ncounts; struct __bb *next; const unsigned long *addresses; }; extern struct __bb *__bb_head; /* * histogram counters are unsigned shorts (according to the kernel). */ #define HISTCOUNTER unsigned short /* * fraction of text space to allocate for histogram counters here, 1/2 */ #define HISTFRACTION 2 /* * Fraction of text space to allocate for from hash buckets. * The value of HASHFRACTION is based on the minimum number of bytes * of separation between two subroutine call points in the object code. * Given MIN_SUBR_SEPARATION bytes of separation the value of * HASHFRACTION is calculated as: * * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); * * For example, on the VAX, the shortest two call sequence is: * * calls $0,(r0) * calls $0,(r0) * * which is separated by only three bytes, thus HASHFRACTION is * calculated as: * * HASHFRACTION = 3 / (2 * 2 - 1) = 1 * * Note that the division above rounds down, thus if MIN_SUBR_FRACTION * is less than three, this algorithm will not work! * * In practice, however, call instructions are rarely at a minimal * distance. Hence, we will define HASHFRACTION to be 2 across all * architectures. This saves a reasonable amount of space for * profiling data structures without (in practice) sacrificing * any granularity. */ #define HASHFRACTION 2 /* * Percent of text space to allocate for tostructs. * This is a heuristic; we will fail with a warning when profiling programs * with a very large number of very small functions, but that's * normally OK. * 2 is probably still a good value for normal programs. * Profiling a test case with 64000 small functions will work if * you raise this value to 3 and link statically (which bloats the * text size, thus raising the number of arcs expected by the heuristic). */ #define ARCDENSITY 3 /* * Always allocate at least this many tostructs. This * hides the inadequacy of the ARCDENSITY heuristic, at least * for small programs. * * Value can be overridden at runtime by glibc.gmon.minarcs tunable. */ #define MINARCS 50 /* * The type used to represent indices into gmonparam.tos[]. */ #define ARCINDEX unsigned long /* * Maximum number of arcs we want to allow. * Used to be max representable value of ARCINDEX minus 2, but now * that ARCINDEX is a long, that's too large; we don't really want * to allow a 48 gigabyte table. * * Value can be overridden at runtime by glibc.gmon.maxarcs tunable. */ #define MAXARCS (1 << 20) struct tostruct { unsigned long selfpc; long count; ARCINDEX link; }; /* * a raw arc, with pointers to the calling site and * the called site and a count. */ struct rawarc { unsigned long raw_frompc; unsigned long raw_selfpc; long raw_count; }; /* * general rounding functions. */ #define ROUNDDOWN(x,y) (((x)/(y))*(y)) #define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) /* * The profiling data structures are housed in this structure. */ struct gmonparam { long int state; unsigned short *kcount; unsigned long kcountsize; ARCINDEX *froms; unsigned long fromssize; struct tostruct *tos; unsigned long tossize; long tolimit; unsigned long lowpc; unsigned long highpc; unsigned long textsize; unsigned long hashfraction; long log_hashfraction; }; /* * Possible states of profiling. */ #define GMON_PROF_ON 0 #define GMON_PROF_BUSY 1 #define GMON_PROF_ERROR 2 #define GMON_PROF_OFF 3 /* * Sysctl definitions for extracting profiling information from the kernel. */ #define GPROF_STATE 0 /* int: profiling enabling variable */ #define GPROF_COUNT 1 /* struct: profile tick count buffer */ #define GPROF_FROMS 2 /* struct: from location hash bucket */ #define GPROF_TOS 3 /* struct: destination/count structure */ #define GPROF_GMONPARAM 4 /* struct: profiling parameters (see above) */ __BEGIN_DECLS /* Set up data structures and start profiling. */ extern void __monstartup (unsigned long __lowpc, unsigned long __highpc) __THROW; extern void monstartup (unsigned long __lowpc, unsigned long __highpc) __THROW; /* Clean up profiling and write out gmon.out. */ extern void _mcleanup (void) __THROW; __END_DECLS #endif /* sys/gmon.h */ sys/gmon_out.h 0000644 00000005113 15063602043 0007361 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger <davidm@cs.arizona.edu>. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This file specifies the format of gmon.out files. It should have as few external dependencies as possible as it is going to be included in many different programs. That is, minimize the number of #include's. A gmon.out file consists of a header (defined by gmon_hdr) followed by a sequence of records. Each record starts with a one-byte tag identifying the type of records, followed by records specific data. */ #ifndef _SYS_GMON_OUT_H #define _SYS_GMON_OUT_H 1 #include <features.h> #define GMON_MAGIC "gmon" /* magic cookie */ #define GMON_VERSION 1 /* version number */ /* For profiling shared object we need a new format. */ #define GMON_SHOBJ_VERSION 0x1ffff __BEGIN_DECLS /* * Raw header as it appears on file (without padding). This header * always comes first in gmon.out and is then followed by a series * records defined below. */ struct gmon_hdr { char cookie[4]; char version[4]; char spare[3 * 4]; }; /* types of records in this file: */ typedef enum { GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2 } GMON_Record_Tag; struct gmon_hist_hdr { char low_pc[sizeof (char *)]; /* base pc address of sample buffer */ char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */ char hist_size[4]; /* size of sample buffer */ char prof_rate[4]; /* profiling clock rate */ char dimen[15]; /* phys. dim., usually "seconds" */ char dimen_abbrev; /* usually 's' for "seconds" */ }; struct gmon_cg_arc_record { char from_pc[sizeof (char *)]; /* address within caller's body */ char self_pc[sizeof (char *)]; /* address within callee's body */ char count[4]; /* number of arc traversals */ }; __END_DECLS #endif /* sys/gmon_out.h */ sys/inotify.h 0000644 00000007375 15063602043 0007227 0 ustar 00 /* Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_INOTIFY_H #define _SYS_INOTIFY_H 1 #include <stdint.h> /* Get the platform-dependent flags. */ #include <bits/inotify.h> /* Structure describing an inotify event. */ struct inotify_event { int wd; /* Watch descriptor. */ uint32_t mask; /* Watch mask. */ uint32_t cookie; /* Cookie to synchronize two events. */ uint32_t len; /* Length (including NULs) of name. */ char name __flexarr; /* Name. */ }; /* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */ #define IN_ACCESS 0x00000001 /* File was accessed. */ #define IN_MODIFY 0x00000002 /* File was modified. */ #define IN_ATTRIB 0x00000004 /* Metadata changed. */ #define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */ #define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */ #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ #define IN_OPEN 0x00000020 /* File was opened. */ #define IN_MOVED_FROM 0x00000040 /* File was moved from X. */ #define IN_MOVED_TO 0x00000080 /* File was moved to Y. */ #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ #define IN_CREATE 0x00000100 /* Subfile was created. */ #define IN_DELETE 0x00000200 /* Subfile was deleted. */ #define IN_DELETE_SELF 0x00000400 /* Self was deleted. */ #define IN_MOVE_SELF 0x00000800 /* Self was moved. */ /* Events sent by the kernel. */ #define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */ #define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */ #define IN_IGNORED 0x00008000 /* File was ignored. */ /* Helper events. */ #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ /* Special flags. */ #define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a directory. */ #define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */ #define IN_EXCL_UNLINK 0x04000000 /* Exclude events on unlinked objects. */ #define IN_MASK_ADD 0x20000000 /* Add to the mask of an already existing watch. */ #define IN_ISDIR 0x40000000 /* Event occurred against dir. */ #define IN_ONESHOT 0x80000000 /* Only send event once. */ /* All events which a program can wait on. */ #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \ | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \ | IN_MOVED_TO | IN_CREATE | IN_DELETE \ | IN_DELETE_SELF | IN_MOVE_SELF) __BEGIN_DECLS /* Create and initialize inotify instance. */ extern int inotify_init (void) __THROW; /* Create and initialize inotify instance. */ extern int inotify_init1 (int __flags) __THROW; /* Add watch of object NAME to inotify instance FD. Notify about events specified by MASK. */ extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) __THROW; /* Remove the watch specified by WD from the inotify instance FD. */ extern int inotify_rm_watch (int __fd, int __wd) __THROW; __END_DECLS #endif /* sys/inotify.h */ sys/io.h 0000644 00000011735 15063602043 0006150 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IO_H #define _SYS_IO_H 1 #include <features.h> __BEGIN_DECLS /* If TURN_ON is TRUE, request for permission to do direct i/o on the port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O permission off for that range. This call requires root privileges. Portability note: not all Linux platforms support this call. Most platforms based on the PC I/O architecture probably will, however. E.g., Linux/Alpha for Alpha PCs supports this. */ extern int ioperm (unsigned long int __from, unsigned long int __num, int __turn_on) __THROW; /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to access any I/O port is granted. This call requires root privileges. */ extern int iopl (int __level) __THROW; #if defined __GNUC__ && __GNUC__ >= 2 static __inline unsigned char inb (unsigned short int __port) { unsigned char _v; __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned char inb_p (unsigned short int __port) { unsigned char _v; __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned short int inw (unsigned short int __port) { unsigned short _v; __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned short int inw_p (unsigned short int __port) { unsigned short int _v; __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned int inl (unsigned short int __port) { unsigned int _v; __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port)); return _v; } static __inline unsigned int inl_p (unsigned short int __port) { unsigned int _v; __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port)); return _v; } static __inline void outb (unsigned char __value, unsigned short int __port) { __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port)); } static __inline void outb_p (unsigned char __value, unsigned short int __port) { __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value), "Nd" (__port)); } static __inline void outw (unsigned short int __value, unsigned short int __port) { __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port)); } static __inline void outw_p (unsigned short int __value, unsigned short int __port) { __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value), "Nd" (__port)); } static __inline void outl (unsigned int __value, unsigned short int __port) { __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port)); } static __inline void outl_p (unsigned int __value, unsigned short int __port) { __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value), "Nd" (__port)); } static __inline void insb (unsigned short int __port, void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void insw (unsigned short int __port, void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void insl (unsigned short int __port, void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void outsb (unsigned short int __port, const void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void outsw (unsigned short int __port, const void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } static __inline void outsl (unsigned short int __port, const void *__addr, unsigned long int __count) { __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count) :"d" (__port), "0" (__addr), "1" (__count)); } #endif /* GNU C */ __END_DECLS #endif /* _SYS_IO_H */ sys/ioctl.h 0000644 00000003313 15063602043 0006644 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H #define _SYS_IOCTL_H 1 #include <features.h> __BEGIN_DECLS /* Get the list of `ioctl' requests and related constants. */ #include <bits/ioctls.h> /* Define some types used by `ioctl' requests. */ #include <bits/ioctl-types.h> /* On a Unix system, the system <sys/ioctl.h> probably defines some of the symbols we define in <sys/ttydefaults.h> (usually with the same values). The code to generate <bits/ioctls.h> has omitted these symbols to avoid the conflict, but a Unix program expects <sys/ioctl.h> to define them, so we must include <sys/ttydefaults.h> here. */ #include <sys/ttydefaults.h> /* Perform the I/O control operation specified by REQUEST on FD. One argument may follow; its presence and type depend on REQUEST. Return value depends on REQUEST. Usually -1 indicates error. */ extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; __END_DECLS #endif /* sys/ioctl.h */ sys/ipc.h 0000644 00000002665 15063602043 0006316 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IPC_H #define _SYS_IPC_H 1 #include <features.h> /* Get system dependent definition of `struct ipc_perm' and more. */ #include <bits/ipctypes.h> #include <bits/ipc.h> #ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined #endif #ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined #endif #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #ifndef __key_t_defined typedef __key_t key_t; # define __key_t_defined #endif __BEGIN_DECLS /* Generates key for System V style IPC. */ extern key_t ftok (const char *__pathname, int __proj_id) __THROW; __END_DECLS #endif /* sys/ipc.h */ sys/kd.h 0000644 00000002127 15063602043 0006132 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_KD_H #define _SYS_KD_H 1 /* Make sure the <linux/types.h> header is not loaded. */ #ifndef _LINUX_TYPES_H # define _LINUX_TYPES_H 1 # define __undef_LINUX_TYPES_H #endif #include <linux/kd.h> #ifdef __undef_LINUX_TYPES_H # undef _LINUX_TYPES_H # undef __undef_LINUX_TYPES_H #endif #endif /* sys/kd.h */ sys/klog.h 0000644 00000002263 15063602043 0006471 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_KLOG_H #define _SYS_KLOG_H 1 #include <features.h> __BEGIN_DECLS /* Control the kernel's logging facility. This corresponds exactly to the kernel's syslog system call, but that name is easily confused with the user-level syslog facility, which is something completely different. */ extern int klogctl (int __type, char *__bufp, int __len) __THROW; __END_DECLS #endif /* _SYS_KLOG_H */ sys/mman.h 0000644 00000012657 15063602043 0006475 0 ustar 00 /* Definitions for BSD-style memory management. Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MMAN_H #define _SYS_MMAN_H 1 #include <features.h> #include <bits/types.h> #define __need_size_t #include <stddef.h> #ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined #endif #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #include <bits/mman.h> /* Return value of `mmap' in case of an error. */ #define MAP_FAILED ((void *) -1) __BEGIN_DECLS /* Map addresses starting near ADDR and extending for LEN bytes. from OFFSET into the file FD describes according to PROT and FLAGS. If ADDR is nonzero, it is the desired mapping address. If the MAP_FIXED bit is set in FLAGS, the mapping will be at ADDR exactly (which must be page-aligned); otherwise the system chooses a convenient nearby address. The return value is the actual mapping address chosen or MAP_FAILED for errors (in which case `errno' is set). A successful `mmap' call deallocates any previous mapping for the affected region. */ #ifndef __USE_FILE_OFFSET64 extern void *mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off_t __offset) __THROW; #else # ifdef __REDIRECT_NTH extern void * __REDIRECT_NTH (mmap, (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset), mmap64); # else # define mmap mmap64 # endif #endif #ifdef __USE_LARGEFILE64 extern void *mmap64 (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset) __THROW; #endif /* Deallocate any mapping for the region starting at ADDR and extending LEN bytes. Returns 0 if successful, -1 for errors (and sets errno). */ extern int munmap (void *__addr, size_t __len) __THROW; /* Change the memory protection of the region starting at ADDR and extending LEN bytes to PROT. Returns 0 if successful, -1 for errors (and sets errno). */ extern int mprotect (void *__addr, size_t __len, int __prot) __THROW; /* Synchronize the region starting at ADDR and extending LEN bytes with the file it maps. Filesystem operations on a file being mapped are unpredictable before this is done. Flags are from the MS_* set. This function is a cancellation point and therefore not marked with __THROW. */ extern int msync (void *__addr, size_t __len, int __flags); #ifdef __USE_MISC /* Advise the system about particular usage patterns the program follows for the region starting at ADDR and extending LEN bytes. */ extern int madvise (void *__addr, size_t __len, int __advice) __THROW; #endif #ifdef __USE_XOPEN2K /* This is the POSIX name for this function. */ extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW; #endif /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to be memory resident. */ extern int mlock (const void *__addr, size_t __len) __THROW; /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */ extern int munlock (const void *__addr, size_t __len) __THROW; /* Cause all currently mapped pages of the process to be memory resident until unlocked by a call to the `munlockall', until the process exits, or until the process calls `execve'. */ extern int mlockall (int __flags) __THROW; /* All currently mapped pages of the process' address space become unlocked. */ extern int munlockall (void) __THROW; #ifdef __USE_MISC /* mincore returns the memory residency status of the pages in the current process's address space specified by [start, start + len). The status is returned in a vector of bytes. The least significant bit of each byte is 1 if the referenced page is in memory, otherwise it is zero. */ extern int mincore (void *__start, size_t __len, unsigned char *__vec) __THROW; #endif #ifdef __USE_GNU /* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length NEW_LEN. If MREMAP_MAYMOVE is set in FLAGS the returned address may differ from ADDR. If MREMAP_FIXED is set in FLAGS the function takes another parameter which is a fixed address at which the block resides after a successful call. */ extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, int __flags, ...) __THROW; /* Remap arbitrary pages of a shared backing store within an existing VMA. */ extern int remap_file_pages (void *__start, size_t __size, int __prot, size_t __pgoff, int __flags) __THROW; #endif /* Open shared memory segment. */ extern int shm_open (const char *__name, int __oflag, mode_t __mode); /* Remove shared memory segment. */ extern int shm_unlink (const char *__name); __END_DECLS #endif /* sys/mman.h */ sys/mount.h 0000644 00000012753 15063602043 0006704 0 ustar 00 /* Header file for mounting/unmount Linux filesystems. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This is taken from /usr/include/linux/fs.h. */ #ifndef _SYS_MOUNT_H #define _SYS_MOUNT_H 1 #include <features.h> #include <sys/ioctl.h> #define BLOCK_SIZE 1024 #define BLOCK_SIZE_BITS 10 /* These are the fs-independent mount-flags: up to 16 flags are supported */ enum { MS_RDONLY = 1, /* Mount read-only. */ #define MS_RDONLY MS_RDONLY MS_NOSUID = 2, /* Ignore suid and sgid bits. */ #define MS_NOSUID MS_NOSUID MS_NODEV = 4, /* Disallow access to device special files. */ #define MS_NODEV MS_NODEV MS_NOEXEC = 8, /* Disallow program execution. */ #define MS_NOEXEC MS_NOEXEC MS_SYNCHRONOUS = 16, /* Writes are synced at once. */ #define MS_SYNCHRONOUS MS_SYNCHRONOUS MS_REMOUNT = 32, /* Alter flags of a mounted FS. */ #define MS_REMOUNT MS_REMOUNT MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ #define MS_MANDLOCK MS_MANDLOCK MS_DIRSYNC = 128, /* Directory modifications are synchronous. */ #define MS_DIRSYNC MS_DIRSYNC MS_NOATIME = 1024, /* Do not update access times. */ #define MS_NOATIME MS_NOATIME MS_NODIRATIME = 2048, /* Do not update directory access times. */ #define MS_NODIRATIME MS_NODIRATIME MS_BIND = 4096, /* Bind directory at different place. */ #define MS_BIND MS_BIND MS_MOVE = 8192, #define MS_MOVE MS_MOVE MS_REC = 16384, #define MS_REC MS_REC MS_SILENT = 32768, #define MS_SILENT MS_SILENT MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */ #define MS_POSIXACL MS_POSIXACL MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */ #define MS_UNBINDABLE MS_UNBINDABLE MS_PRIVATE = 1 << 18, /* Change to private. */ #define MS_PRIVATE MS_PRIVATE MS_SLAVE = 1 << 19, /* Change to slave. */ #define MS_SLAVE MS_SLAVE MS_SHARED = 1 << 20, /* Change to shared. */ #define MS_SHARED MS_SHARED MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */ #define MS_RELATIME MS_RELATIME MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */ #define MS_KERNMOUNT MS_KERNMOUNT MS_I_VERSION = 1 << 23, /* Update inode I_version field. */ #define MS_I_VERSION MS_I_VERSION MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */ #define MS_STRICTATIME MS_STRICTATIME MS_LAZYTIME = 1 << 25, /* Update the on-disk [acm]times lazily. */ #define MS_LAZYTIME MS_LAZYTIME MS_ACTIVE = 1 << 30, #define MS_ACTIVE MS_ACTIVE MS_NOUSER = 1 << 31 #define MS_NOUSER MS_NOUSER }; /* Flags that can be altered by MS_REMOUNT */ #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION \ |MS_LAZYTIME) /* Magic mount flag number. Has to be or-ed to the flag values. */ #define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ #define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ /* The read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ #define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */ #define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */ #define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */ #define BLKGETSIZE _IO(0x12, 96) /* Return device size. */ #define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ #define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ #define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ #define BLKFRASET _IO(0x12,100) /* Set filesystem read-ahead. */ #define BLKFRAGET _IO(0x12,101) /* Get filesystem read-ahead. */ #define BLKSECTSET _IO(0x12,102) /* Set max sectors per request. */ #define BLKSECTGET _IO(0x12,103) /* Get max sectors per request. */ #define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */ #define BLKBSZGET _IOR(0x12,112,size_t) #define BLKBSZSET _IOW(0x12,113,size_t) #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */ /* Possible value for FLAGS parameter of `umount2'. */ enum { MNT_FORCE = 1, /* Force unmounting. */ #define MNT_FORCE MNT_FORCE MNT_DETACH = 2, /* Just detach from the tree. */ #define MNT_DETACH MNT_DETACH MNT_EXPIRE = 4, /* Mark for expiry. */ #define MNT_EXPIRE MNT_EXPIRE UMOUNT_NOFOLLOW = 8 /* Don't follow symlink on umount. */ #define UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW }; __BEGIN_DECLS /* Mount a filesystem. */ extern int mount (const char *__special_file, const char *__dir, const char *__fstype, unsigned long int __rwflag, const void *__data) __THROW; /* Unmount a filesystem. */ extern int umount (const char *__special_file) __THROW; /* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */ extern int umount2 (const char *__special_file, int __flags) __THROW; __END_DECLS #endif /* _SYS_MOUNT_H */ sys/msg.h 0000644 00000004475 15063602043 0006332 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MSG_H #define _SYS_MSG_H #include <features.h> #define __need_size_t #include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> /* Get system dependent definition of `struct msqid_ds' and more. */ #include <bits/msq.h> /* Define types required by the standard. */ #include <bits/types/time_t.h> #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif #ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined #endif /* The following System V style IPC functions implement a message queue system. The definition is found in XPG2. */ #ifdef __USE_GNU /* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */ struct msgbuf { __syscall_slong_t mtype; /* type of received/sent message */ char mtext[1]; /* text of the message */ }; #endif __BEGIN_DECLS /* Message queue control operation. */ extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; /* Get messages queue. */ extern int msgget (key_t __key, int __msgflg) __THROW; /* Receive message from message queue. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz, long int __msgtyp, int __msgflg); /* Send message to message queue. This function is a cancellation point and therefore not marked with __THROW. */ extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz, int __msgflg); __END_DECLS #endif /* sys/msg.h */ sys/mtio.h 0000644 00000025632 15063602043 0006512 0 ustar 00 /* Structures and definitions for magnetic tape I/O control commands. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Written by H. Bergman <hennus@cybercomm.nl>. */ #ifndef _SYS_MTIO_H #define _SYS_MTIO_H 1 /* Get necessary definitions from system and kernel headers. */ #include <sys/types.h> #include <sys/ioctl.h> /* Structure for MTIOCTOP - magnetic tape operation command. */ struct mtop { short int mt_op; /* Operations defined below. */ int mt_count; /* How many of them. */ }; #define _IOT_mtop /* Hurd ioctl type field. */ \ _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0) /* Magnetic Tape operations [Not all operations supported by all drivers]. */ #define MTRESET 0 /* +reset drive in case of problems. */ #define MTFSF 1 /* Forward space over FileMark, * position at first record of next file. */ #define MTBSF 2 /* Backward space FileMark (position before FM). */ #define MTFSR 3 /* Forward space record. */ #define MTBSR 4 /* Backward space record. */ #define MTWEOF 5 /* Write an end-of-file record (mark). */ #define MTREW 6 /* Rewind. */ #define MTOFFL 7 /* Rewind and put the drive offline (eject?). */ #define MTNOP 8 /* No op, set status only (read with MTIOCGET). */ #define MTRETEN 9 /* Retension tape. */ #define MTBSFM 10 /* +backward space FileMark, position at FM. */ #define MTFSFM 11 /* +forward space FileMark, position at FM. */ #define MTEOM 12 /* Goto end of recorded media (for appending files). MTEOM positions after the last FM, ready for appending another file. */ #define MTERASE 13 /* Erase tape -- be careful! */ #define MTRAS1 14 /* Run self test 1 (nondestructive). */ #define MTRAS2 15 /* Run self test 2 (destructive). */ #define MTRAS3 16 /* Reserved for self test 3. */ #define MTSETBLK 20 /* Set block length (SCSI). */ #define MTSETDENSITY 21 /* Set tape density (SCSI). */ #define MTSEEK 22 /* Seek to block (Tandberg, etc.). */ #define MTTELL 23 /* Tell block (Tandberg, etc.). */ #define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2. Ordinary buffered operation with code 1. */ #define MTFSS 25 /* Space forward over setmarks. */ #define MTBSS 26 /* Space backward over setmarks. */ #define MTWSM 27 /* Write setmarks. */ #define MTLOCK 28 /* Lock the drive door. */ #define MTUNLOCK 29 /* Unlock the drive door. */ #define MTLOAD 30 /* Execute the SCSI load command. */ #define MTUNLOAD 31 /* Execute the SCSI unload command. */ #define MTCOMPRESSION 32/* Control compression with SCSI mode page 15. */ #define MTSETPART 33 /* Change the active tape partition. */ #define MTMKPART 34 /* Format the tape with one or two partitions. */ /* structure for MTIOCGET - mag tape get status command */ struct mtget { long int mt_type; /* Type of magtape device. */ long int mt_resid; /* Residual count: (not sure) number of bytes ignored, or number of files not skipped, or number of records not skipped. */ /* The following registers are device dependent. */ long int mt_dsreg; /* Status register. */ long int mt_gstat; /* Generic (device independent) status. */ long int mt_erreg; /* Error register. */ /* The next two fields are not always used. */ __daddr_t mt_fileno; /* Number of current file on tape. */ __daddr_t mt_blkno; /* Current block number. */ }; #define _IOT_mtget /* Hurd ioctl type field. */ \ _IOT (_IOTS (long), 7, 0, 0, 0, 0) /* Constants for mt_type. Not all of these are supported, and these are not all of the ones that are supported. */ #define MT_ISUNKNOWN 0x01 #define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer. */ #define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02. */ #define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02?. */ #define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?). */ #define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24. */ #define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02. */ #define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L. */ #define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L. */ #define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller. */ #define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features. */ #define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24. */ #define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type). */ #define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40). */ #define MT_ISDDS1 0x51 /* DDS device without partitions. */ #define MT_ISDDS2 0x52 /* DDS device with partitions. */ #define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit. */ #define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit. */ /* QIC-40/80/3010/3020 ftape supported drives. 20bit vendor ID + 0x800000 (see vendors.h in ftape distribution). */ #define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ #define MT_ISFTAPE_FLAG 0x800000 struct mt_tape_info { long int t_type; /* Device type id (mt_type). */ char *t_name; /* Descriptive name. */ }; #define MT_TAPE_INFO \ { \ {MT_ISUNKNOWN, "Unknown type of tape device"}, \ {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ {MT_ISCMSJ500, "CMS Jumbo 500"}, \ {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ {0, NULL} \ } /* Structure for MTIOCPOS - mag tape get position command. */ struct mtpos { long int mt_blkno; /* Current block number. */ }; #define _IOT_mtpos /* Hurd ioctl type field. */ \ _IOT_SIMPLE (long) /* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended as an interim solution for QIC-02 until DDI is fully implemented. */ struct mtconfiginfo { long int mt_type; /* Drive type. */ long int ifc_type; /* Interface card type. */ unsigned short int irqnr; /* IRQ number to use. */ unsigned short int dmanr; /* DMA channel to use. */ unsigned short int port; /* IO port base address. */ unsigned long int debug; /* Debugging flags. */ unsigned have_dens:1; unsigned have_bsf:1; unsigned have_fsr:1; unsigned have_bsr:1; unsigned have_eod:1; unsigned have_seek:1; unsigned have_tell:1; unsigned have_ras1:1; unsigned have_ras2:1; unsigned have_ras3:1; unsigned have_qfa:1; unsigned pad1:5; char reserved[10]; }; #define _IOT_mtconfiginfo /* Hurd ioctl type field. */ \ _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1) /* XXX wrong */ /* Magnetic tape I/O control commands. */ #define MTIOCTOP _IOW('m', 1, struct mtop) /* Do a mag tape op. */ #define MTIOCGET _IOR('m', 2, struct mtget) /* Get tape status. */ #define MTIOCPOS _IOR('m', 3, struct mtpos) /* Get tape position.*/ /* The next two are used by the QIC-02 driver for runtime reconfiguration. See tpqic02.h for struct mtconfiginfo. */ #define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/ #define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/ /* Generic Mag Tape (device independent) status macros for examining mt_gstat -- HP-UX compatible. There is room for more generic status bits here, but I don't know which of them are reserved. At least three or so should be added to make this really useful. */ #define GMT_EOF(x) ((x) & 0x80000000) #define GMT_BOT(x) ((x) & 0x40000000) #define GMT_EOT(x) ((x) & 0x20000000) #define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ #define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ #define GMT_WR_PROT(x) ((x) & 0x04000000) /* #define GMT_ ? ((x) & 0x02000000) */ #define GMT_ONLINE(x) ((x) & 0x01000000) #define GMT_D_6250(x) ((x) & 0x00800000) #define GMT_D_1600(x) ((x) & 0x00400000) #define GMT_D_800(x) ((x) & 0x00200000) /* #define GMT_ ? ((x) & 0x00100000) */ /* #define GMT_ ? ((x) & 0x00080000) */ #define GMT_DR_OPEN(x) ((x) & 0x00040000) /* Door open (no tape). */ /* #define GMT_ ? ((x) & 0x00020000) */ #define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* Immediate report mode.*/ /* 16 generic status bits unused. */ /* SCSI-tape specific definitions. Bitfield shifts in the status */ #define MT_ST_BLKSIZE_SHIFT 0 #define MT_ST_BLKSIZE_MASK 0xffffff #define MT_ST_DENSITY_SHIFT 24 #define MT_ST_DENSITY_MASK 0xff000000 #define MT_ST_SOFTERR_SHIFT 0 #define MT_ST_SOFTERR_MASK 0xffff /* Bitfields for the MTSETDRVBUFFER ioctl. */ #define MT_ST_OPTIONS 0xf0000000 #define MT_ST_BOOLEANS 0x10000000 #define MT_ST_SETBOOLEANS 0x30000000 #define MT_ST_CLEARBOOLEANS 0x40000000 #define MT_ST_WRITE_THRESHOLD 0x20000000 #define MT_ST_DEF_BLKSIZE 0x50000000 #define MT_ST_DEF_OPTIONS 0x60000000 #define MT_ST_BUFFER_WRITES 0x1 #define MT_ST_ASYNC_WRITES 0x2 #define MT_ST_READ_AHEAD 0x4 #define MT_ST_DEBUGGING 0x8 #define MT_ST_TWO_FM 0x10 #define MT_ST_FAST_MTEOM 0x20 #define MT_ST_AUTO_LOCK 0x40 #define MT_ST_DEF_WRITES 0x80 #define MT_ST_CAN_BSR 0x100 #define MT_ST_NO_BLKLIMS 0x200 #define MT_ST_CAN_PARTITIONS 0x400 #define MT_ST_SCSI2LOGICAL 0x800 /* The mode parameters to be controlled. Parameter chosen with bits 20-28. */ #define MT_ST_CLEAR_DEFAULT 0xfffff #define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) /* The offset for the arguments for the special HP changer load command. */ #define MT_ST_HPLOADER_OFFSET 10000 /* Specify default tape device. */ #ifndef DEFTAPE # define DEFTAPE "/dev/tape" #endif #endif /* mtio.h */ sys/param.h 0000644 00000006114 15063602043 0006634 0 ustar 00 /* Compatibility header for old-style Unix parameters and limits. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PARAM_H #define _SYS_PARAM_H 1 #define __need_NULL #include <stddef.h> #include <sys/types.h> #include <limits.h> #include <endian.h> /* Define BYTE_ORDER et al. */ #include <signal.h> /* Define NSIG. */ /* This file defines some things in system-specific ways. */ #include <bits/param.h> /* BSD names for some <limits.h> values. */ #define NBBY CHAR_BIT #if !defined NGROUPS && defined NGROUPS_MAX # define NGROUPS NGROUPS_MAX #endif #if !defined MAXSYMLINKS && defined SYMLOOP_MAX # define MAXSYMLINKS SYMLOOP_MAX #endif #if !defined CANBSIZ && defined MAX_CANON # define CANBSIZ MAX_CANON #endif #if !defined MAXPATHLEN && defined PATH_MAX # define MAXPATHLEN PATH_MAX #endif #if !defined NOFILE && defined OPEN_MAX # define NOFILE OPEN_MAX #endif #if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX # define MAXHOSTNAMELEN HOST_NAME_MAX #endif #ifndef NCARGS # ifdef ARG_MAX # define NCARGS ARG_MAX # else /* ARG_MAX is unlimited, but we define NCARGS for BSD programs that want to compare against some fixed limit. */ # define NCARGS INT_MAX # endif #endif /* Magical constants. */ #ifndef NOGROUP # define NOGROUP 65535 /* Marker for empty group set member. */ #endif #ifndef NODEV # define NODEV ((dev_t) -1) /* Non-existent device. */ #endif /* Unit of `st_blocks'. */ #ifndef DEV_BSIZE # define DEV_BSIZE 512 #endif /* Bit map related macros. */ #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) /* Macros for counting and rounding. */ #ifndef howmany # define howmany(x, y) (((x) + ((y) - 1)) / (y)) #endif #ifdef __GNUC__ # define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ ? (((x) + (y) - 1) & ~((y) - 1)) \ : ((((x) + ((y) - 1)) / (y)) * (y))) #else # define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) #endif #define powerof2(x) ((((x) - 1) & (x)) == 0) /* Macros for min/max. */ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #endif /* sys/param.h */ sys/pci.h 0000644 00000001632 15063602043 0006307 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PCI_H #define _SYS_PCI_H 1 /* We use the constants from the kernel. */ #include <linux/pci.h> #endif /* sys/pci.h */ sys/perm.h 0000644 00000002146 15063602043 0006500 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PERM_H #define _SYS_PERM_H 1 #include <features.h> __BEGIN_DECLS /* Set port input/output permissions. */ extern int ioperm (unsigned long int __from, unsigned long int __num, int __turn_on) __THROW; /* Change I/O privilege level. */ extern int iopl (int __level) __THROW; __END_DECLS #endif /* _SYS_PERM_H */ sys/personality.h 0000644 00000005242 15063602043 0010106 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Taken verbatim from Linux 2.6 (include/linux/personality.h). */ #ifndef _SYS_PERSONALITY_H #define _SYS_PERSONALITY_H 1 #include <features.h> /* Flags for bug emulation. These occupy the top three bytes. */ enum { UNAME26 = 0x0020000, ADDR_NO_RANDOMIZE = 0x0040000, FDPIC_FUNCPTRS = 0x0080000, MMAP_PAGE_ZERO = 0x0100000, ADDR_COMPAT_LAYOUT = 0x0200000, READ_IMPLIES_EXEC = 0x0400000, ADDR_LIMIT_32BIT = 0x0800000, SHORT_INODE = 0x1000000, WHOLE_SECONDS = 0x2000000, STICKY_TIMEOUTS = 0x4000000, ADDR_LIMIT_3GB = 0x8000000 }; /* Personality types. These go in the low byte. Avoid using the top bit, it will conflict with error returns. */ enum { PER_LINUX = 0x0000, PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, PER_BSD = 0x0006, PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, PER_LINUX32 = 0x0008, PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, /* IRIX5 32-bit */ PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, /* IRIX6 new 32-bit */ PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, /* IRIX6 64-bit */ PER_RISCOS = 0x000c, PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_OSF4 = 0x000f, PER_HPUX = 0x0010, PER_MASK = 0x00ff, }; __BEGIN_DECLS /* Set different ABIs (personalities). */ extern int personality (unsigned long int __persona) __THROW; __END_DECLS #endif /* sys/personality.h */ sys/poll.h 0000644 00000004765 15063602043 0006514 0 ustar 00 /* Compatibility definitions for System V `poll' interface. Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H #define _SYS_POLL_H 1 #include <features.h> /* Get the platform dependent bits of `poll'. */ #include <bits/poll.h> #ifdef __USE_GNU # include <bits/types/__sigset_t.h> # include <bits/types/struct_timespec.h> #endif /* Type used for the number of file descriptors. */ typedef unsigned long int nfds_t; /* Data structure describing a polling request. */ struct pollfd { int fd; /* File descriptor to poll. */ short int events; /* Types of events poller cares about. */ short int revents; /* Types of events that actually occurred. */ }; __BEGIN_DECLS /* Poll the file descriptors described by the NFDS structures starting at FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for an event to occur; if TIMEOUT is -1, block until an event occurs. Returns the number of file descriptors with events, zero if timed out, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); #ifdef __USE_GNU /* Like poll, but before waiting the threads signal mask is replaced with that specified in the fourth parameter. For better usability, the timeout value is specified using a TIMESPEC object. This function is a cancellation point and therefore not marked with __THROW. */ extern int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss); #endif __END_DECLS /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/poll2.h> #endif #endif /* sys/poll.h */ sys/prctl.h 0000644 00000002042 15063602043 0006654 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PRCTL_H #define _SYS_PRCTL_H 1 #include <features.h> #include <linux/prctl.h> /* The magic values come from here */ __BEGIN_DECLS /* Control process execution. */ extern int prctl (int __option, ...) __THROW; __END_DECLS #endif /* sys/prctl.h */ sys/procfs.h 0000644 00000011571 15063602043 0007033 0 ustar 00 /* Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PROCFS_H #define _SYS_PROCFS_H 1 /* This is somewhat modelled after the file of the same name on SVR4 systems. It provides a definition of the core file format for ELF used on Linux. It doesn't have anything to do with the /proc file system, even though Linux has one. Anyway, the whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ #include <features.h> #include <sys/time.h> #include <sys/types.h> #include <sys/user.h> __BEGIN_DECLS /* Type for a general-purpose register. */ #ifdef __x86_64__ __extension__ typedef unsigned long long elf_greg_t; #else typedef unsigned long elf_greg_t; #endif /* And the whole bunch of them. We could have used `struct user_regs_struct' directly in the typedef, but tradition says that the register set is an array, which does have some peculiar semantics, so leave it that way. */ #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; #ifndef __x86_64__ /* Register set for the floating-point registers. */ typedef struct user_fpregs_struct elf_fpregset_t; /* Register set for the extended floating-point registers. Includes the Pentium III SSE registers in addition to the classic floating-point stuff. */ typedef struct user_fpxregs_struct elf_fpxregset_t; #else /* Register set for the extended floating-point registers. Includes the Pentium III SSE registers in addition to the classic floating-point stuff. */ typedef struct user_fpregs_struct elf_fpregset_t; #endif /* Signal info. */ struct elf_siginfo { int si_signo; /* Signal number. */ int si_code; /* Extra code. */ int si_errno; /* Errno. */ }; /* Definitions to generate Intel SVR4-like core files. These mostly have the same names as the SVR4 types with "elf_" tacked on the front to prevent clashes with Linux definitions, and the typedef forms have been avoided. This is mostly like the SVR4 structure, but more Linuxy, with things that Linux does not support and which GDB doesn't really use excluded. */ struct elf_prstatus { struct elf_siginfo pr_info; /* Info associated with signal. */ short int pr_cursig; /* Current signal. */ unsigned long int pr_sigpend; /* Set of pending signals. */ unsigned long int pr_sighold; /* Set of held signals. */ __pid_t pr_pid; __pid_t pr_ppid; __pid_t pr_pgrp; __pid_t pr_sid; struct timeval pr_utime; /* User time. */ struct timeval pr_stime; /* System time. */ struct timeval pr_cutime; /* Cumulative user time. */ struct timeval pr_cstime; /* Cumulative system time. */ elf_gregset_t pr_reg; /* GP registers. */ int pr_fpvalid; /* True if math copro being used. */ }; #define ELF_PRARGSZ (80) /* Number of chars for args. */ struct elf_prpsinfo { char pr_state; /* Numeric process state. */ char pr_sname; /* Char for pr_state. */ char pr_zomb; /* Zombie. */ char pr_nice; /* Nice val. */ unsigned long int pr_flag; /* Flags. */ #if __WORDSIZE == 32 unsigned short int pr_uid; unsigned short int pr_gid; #else unsigned int pr_uid; unsigned int pr_gid; #endif int pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ char pr_fname[16]; /* Filename of executable. */ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ }; /* The rest of this file provides the types for emulation of the Solaris <proc_service.h> interfaces that should be implemented by users of libthread_db. */ /* Addresses. */ typedef void *psaddr_t; /* Register sets. Linux has different names. */ typedef elf_gregset_t prgregset_t; typedef elf_fpregset_t prfpregset_t; /* We don't have any differences between processes and threads, therefore have only one PID type. */ typedef __pid_t lwpid_t; /* Process status and info. In the end we do provide typedefs for them. */ typedef struct elf_prstatus prstatus_t; typedef struct elf_prpsinfo prpsinfo_t; __END_DECLS #endif /* sys/procfs.h */ sys/profil.h 0000644 00000003646 15063602043 0007036 0 ustar 00 /* Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PROFIL_H #define _PROFIL_H 1 #include <features.h> #include <sys/time.h> #include <sys/types.h> /* This interface is intended to follow the sprofil() system calls as described by the sprofil(2) man page of Irix v6.5, except that: - there is no a priori limit on number of text sections - pr_scale is declared as unsigned long (instead of "unsigned int") - pr_size is declared as size_t (instead of "unsigned int") - pr_off is declared as void * (instead of "__psunsigned_t") - the overflow bin (pr_base==0, pr_scale==2) can appear anywhere in the profp array - PROF_FAST has no effect */ struct prof { void *pr_base; /* buffer base */ size_t pr_size; /* buffer size */ size_t pr_off; /* pc offset */ unsigned long int pr_scale; /* pc scaling (fixed-point number) */ }; enum { PROF_USHORT = 0, /* use 16-bit counters (default) */ PROF_UINT = 1 << 0, /* use 32-bit counters */ PROF_FAST = 1 << 1 /* profile faster than usual */ }; __BEGIN_DECLS extern int sprofil (struct prof *__profp, int __profcnt, struct timeval *__tvp, unsigned int __flags) __THROW; __END_DECLS #endif /* profil.h */ sys/ptrace.h 0000644 00000013544 15063602043 0007017 0 ustar 00 /* `ptrace' debugger support interface. Linux/x86 version. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PTRACE_H #define _SYS_PTRACE_H 1 #include <features.h> #include <bits/types.h> __BEGIN_DECLS /* Type of the REQUEST argument to `ptrace.' */ enum __ptrace_request { /* Indicate that the process making this request should be traced. All signals received by this process can be intercepted by its parent, and its parent can use the other `ptrace' requests. */ PTRACE_TRACEME = 0, #define PT_TRACE_ME PTRACE_TRACEME /* Return the word in the process's text space at address ADDR. */ PTRACE_PEEKTEXT = 1, #define PT_READ_I PTRACE_PEEKTEXT /* Return the word in the process's data space at address ADDR. */ PTRACE_PEEKDATA = 2, #define PT_READ_D PTRACE_PEEKDATA /* Return the word in the process's user area at offset ADDR. */ PTRACE_PEEKUSER = 3, #define PT_READ_U PTRACE_PEEKUSER /* Write the word DATA into the process's text space at address ADDR. */ PTRACE_POKETEXT = 4, #define PT_WRITE_I PTRACE_POKETEXT /* Write the word DATA into the process's data space at address ADDR. */ PTRACE_POKEDATA = 5, #define PT_WRITE_D PTRACE_POKEDATA /* Write the word DATA into the process's user area at offset ADDR. */ PTRACE_POKEUSER = 6, #define PT_WRITE_U PTRACE_POKEUSER /* Continue the process. */ PTRACE_CONT = 7, #define PT_CONTINUE PTRACE_CONT /* Kill the process. */ PTRACE_KILL = 8, #define PT_KILL PTRACE_KILL /* Single step the process. */ PTRACE_SINGLESTEP = 9, #define PT_STEP PTRACE_SINGLESTEP /* Get all general purpose registers used by a processes. */ PTRACE_GETREGS = 12, #define PT_GETREGS PTRACE_GETREGS /* Set all general purpose registers used by a processes. */ PTRACE_SETREGS = 13, #define PT_SETREGS PTRACE_SETREGS /* Get all floating point registers used by a processes. */ PTRACE_GETFPREGS = 14, #define PT_GETFPREGS PTRACE_GETFPREGS /* Set all floating point registers used by a processes. */ PTRACE_SETFPREGS = 15, #define PT_SETFPREGS PTRACE_SETFPREGS /* Attach to a process that is already running. */ PTRACE_ATTACH = 16, #define PT_ATTACH PTRACE_ATTACH /* Detach from a process attached to with PTRACE_ATTACH. */ PTRACE_DETACH = 17, #define PT_DETACH PTRACE_DETACH /* Get all extended floating point registers used by a processes. */ PTRACE_GETFPXREGS = 18, #define PT_GETFPXREGS PTRACE_GETFPXREGS /* Set all extended floating point registers used by a processes. */ PTRACE_SETFPXREGS = 19, #define PT_SETFPXREGS PTRACE_SETFPXREGS /* Continue and stop at the next entry to or return from syscall. */ PTRACE_SYSCALL = 24, #define PT_SYSCALL PTRACE_SYSCALL /* Get a TLS entry in the GDT. */ PTRACE_GET_THREAD_AREA = 25, #define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA /* Change a TLS entry in the GDT. */ PTRACE_SET_THREAD_AREA = 26, #define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA #ifdef __x86_64__ /* Access TLS data. */ PTRACE_ARCH_PRCTL = 30, # define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL #endif /* Continue and stop at the next syscall, it will not be executed. */ PTRACE_SYSEMU = 31, #define PT_SYSEMU PTRACE_SYSEMU /* Single step the process, the next syscall will not be executed. */ PTRACE_SYSEMU_SINGLESTEP = 32, #define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP /* Execute process until next taken branch. */ PTRACE_SINGLEBLOCK = 33, #define PT_STEPBLOCK PTRACE_SINGLEBLOCK /* Set ptrace filter options. */ PTRACE_SETOPTIONS = 0x4200, #define PT_SETOPTIONS PTRACE_SETOPTIONS /* Get last ptrace message. */ PTRACE_GETEVENTMSG = 0x4201, #define PT_GETEVENTMSG PTRACE_GETEVENTMSG /* Get siginfo for process. */ PTRACE_GETSIGINFO = 0x4202, #define PT_GETSIGINFO PTRACE_GETSIGINFO /* Set new siginfo for process. */ PTRACE_SETSIGINFO = 0x4203, #define PT_SETSIGINFO PTRACE_SETSIGINFO /* Get register content. */ PTRACE_GETREGSET = 0x4204, #define PTRACE_GETREGSET PTRACE_GETREGSET /* Set register content. */ PTRACE_SETREGSET = 0x4205, #define PTRACE_SETREGSET PTRACE_SETREGSET /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect signal or group stop state. */ PTRACE_SEIZE = 0x4206, #define PTRACE_SEIZE PTRACE_SEIZE /* Trap seized tracee. */ PTRACE_INTERRUPT = 0x4207, #define PTRACE_INTERRUPT PTRACE_INTERRUPT /* Wait for next group event. */ PTRACE_LISTEN = 0x4208, #define PTRACE_LISTEN PTRACE_LISTEN /* Retrieve siginfo_t structures without removing signals from a queue. */ PTRACE_PEEKSIGINFO = 0x4209, #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO /* Get the mask of blocked signals. */ PTRACE_GETSIGMASK = 0x420a, #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK /* Change the mask of blocked signals. */ PTRACE_SETSIGMASK = 0x420b, #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK /* Get seccomp BPF filters. */ PTRACE_SECCOMP_GET_FILTER = 0x420c, #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER /* Get seccomp BPF filter metadata. */ PTRACE_SECCOMP_GET_METADATA = 0x420d #define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA }; #include <bits/ptrace-shared.h> __END_DECLS #endif /* _SYS_PTRACE_H */ sys/queue.h 0000644 00000046123 15063602043 0006664 0 ustar 00 /* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 */ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ /* * This file defines five types of data structures: singly-linked lists, * lists, simple queues, tail queues, and circular queues. * * A singly-linked list is headed by a single forward pointer. The * elements are singly linked for minimum space and pointer manipulation * overhead at the expense of O(n) removal for arbitrary elements. New * elements can be added to the list after an existing element or at the * head of the list. Elements being removed from the head of the list * should use the explicit macro for this purpose for optimum * efficiency. A singly-linked list may only be traversed in the forward * direction. Singly-linked lists are ideal for applications with large * datasets and few or no removals or for implementing a LIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may only be traversed in the forward direction. * * A simple queue is headed by a pair of pointers, one the head of the * list and the other to the tail of the list. The elements are singly * linked to save space, so elements can only be removed from the * head of the list. New elements can be added to the list after * an existing element, at the head of the list, or at the end of the * list. A simple queue may only be traversed in the forward direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * A circle queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the list. * A circle queue may be traversed in either direction, but has a more * complex end of list detection. * * For details on the use of these macros, see the queue(3) manual page. */ /* * List definitions. */ #define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } #define LIST_HEAD_INITIALIZER(head) \ { NULL } #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } /* * List functions. */ #define LIST_INIT(head) do { \ (head)->lh_first = NULL; \ } while (/*CONSTCOND*/0) #define LIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ (listelm)->field.le_next = (elm); \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } while (/*CONSTCOND*/0) #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.le_prev = (listelm)->field.le_prev; \ (elm)->field.le_next = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &(elm)->field.le_next; \ } while (/*CONSTCOND*/0) #define LIST_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (/*CONSTCOND*/0) #define LIST_REMOVE(elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = (elm)->field.le_next; \ } while (/*CONSTCOND*/0) #define LIST_FOREACH(var, head, field) \ for ((var) = ((head)->lh_first); \ (var); \ (var) = ((var)->field.le_next)) /* * List access methods. */ #define LIST_EMPTY(head) ((head)->lh_first == NULL) #define LIST_FIRST(head) ((head)->lh_first) #define LIST_NEXT(elm, field) ((elm)->field.le_next) /* * Singly-linked List definitions. */ #define SLIST_HEAD(name, type) \ struct name { \ struct type *slh_first; /* first element */ \ } #define SLIST_HEAD_INITIALIZER(head) \ { NULL } #define SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } /* * Singly-linked List functions. */ #define SLIST_INIT(head) do { \ (head)->slh_first = NULL; \ } while (/*CONSTCOND*/0) #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ (elm)->field.sle_next = (slistelm)->field.sle_next; \ (slistelm)->field.sle_next = (elm); \ } while (/*CONSTCOND*/0) #define SLIST_INSERT_HEAD(head, elm, field) do { \ (elm)->field.sle_next = (head)->slh_first; \ (head)->slh_first = (elm); \ } while (/*CONSTCOND*/0) #define SLIST_REMOVE_HEAD(head, field) do { \ (head)->slh_first = (head)->slh_first->field.sle_next; \ } while (/*CONSTCOND*/0) #define SLIST_REMOVE(head, elm, type, field) do { \ if ((head)->slh_first == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = (head)->slh_first; \ while(curelm->field.sle_next != (elm)) \ curelm = curelm->field.sle_next; \ curelm->field.sle_next = \ curelm->field.sle_next->field.sle_next; \ } \ } while (/*CONSTCOND*/0) #define SLIST_FOREACH(var, head, field) \ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) /* * Singly-linked List access methods. */ #define SLIST_EMPTY(head) ((head)->slh_first == NULL) #define SLIST_FIRST(head) ((head)->slh_first) #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) /* * Singly-linked Tail queue declarations. */ #define STAILQ_HEAD(name, type) \ struct name { \ struct type *stqh_first; /* first element */ \ struct type **stqh_last; /* addr of last next element */ \ } #define STAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).stqh_first } #define STAILQ_ENTRY(type) \ struct { \ struct type *stqe_next; /* next element */ \ } /* * Singly-linked Tail queue functions. */ #define STAILQ_INIT(head) do { \ (head)->stqh_first = NULL; \ (head)->stqh_last = &(head)->stqh_first; \ } while (/*CONSTCOND*/0) #define STAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ (head)->stqh_last = &(elm)->field.stqe_next; \ (head)->stqh_first = (elm); \ } while (/*CONSTCOND*/0) #define STAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.stqe_next = NULL; \ *(head)->stqh_last = (elm); \ (head)->stqh_last = &(elm)->field.stqe_next; \ } while (/*CONSTCOND*/0) #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ (head)->stqh_last = &(elm)->field.stqe_next; \ (listelm)->field.stqe_next = (elm); \ } while (/*CONSTCOND*/0) #define STAILQ_REMOVE_HEAD(head, field) do { \ if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ (head)->stqh_last = &(head)->stqh_first; \ } while (/*CONSTCOND*/0) #define STAILQ_REMOVE(head, elm, type, field) do { \ if ((head)->stqh_first == (elm)) { \ STAILQ_REMOVE_HEAD((head), field); \ } else { \ struct type *curelm = (head)->stqh_first; \ while (curelm->field.stqe_next != (elm)) \ curelm = curelm->field.stqe_next; \ if ((curelm->field.stqe_next = \ curelm->field.stqe_next->field.stqe_next) == NULL) \ (head)->stqh_last = &(curelm)->field.stqe_next; \ } \ } while (/*CONSTCOND*/0) #define STAILQ_FOREACH(var, head, field) \ for ((var) = ((head)->stqh_first); \ (var); \ (var) = ((var)->field.stqe_next)) #define STAILQ_CONCAT(head1, head2) do { \ if (!STAILQ_EMPTY((head2))) { \ *(head1)->stqh_last = (head2)->stqh_first; \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_INIT((head2)); \ } \ } while (/*CONSTCOND*/0) /* * Singly-linked Tail queue access methods. */ #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) #define STAILQ_FIRST(head) ((head)->stqh_first) #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) /* * Simple queue definitions. */ #define SIMPLEQ_HEAD(name, type) \ struct name { \ struct type *sqh_first; /* first element */ \ struct type **sqh_last; /* addr of last next element */ \ } #define SIMPLEQ_HEAD_INITIALIZER(head) \ { NULL, &(head).sqh_first } #define SIMPLEQ_ENTRY(type) \ struct { \ struct type *sqe_next; /* next element */ \ } /* * Simple queue functions. */ #define SIMPLEQ_INIT(head) do { \ (head)->sqh_first = NULL; \ (head)->sqh_last = &(head)->sqh_first; \ } while (/*CONSTCOND*/0) #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ (head)->sqh_last = &(elm)->field.sqe_next; \ (head)->sqh_first = (elm); \ } while (/*CONSTCOND*/0) #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.sqe_next = NULL; \ *(head)->sqh_last = (elm); \ (head)->sqh_last = &(elm)->field.sqe_next; \ } while (/*CONSTCOND*/0) #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ (head)->sqh_last = &(elm)->field.sqe_next; \ (listelm)->field.sqe_next = (elm); \ } while (/*CONSTCOND*/0) #define SIMPLEQ_REMOVE_HEAD(head, field) do { \ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ (head)->sqh_last = &(head)->sqh_first; \ } while (/*CONSTCOND*/0) #define SIMPLEQ_REMOVE(head, elm, type, field) do { \ if ((head)->sqh_first == (elm)) { \ SIMPLEQ_REMOVE_HEAD((head), field); \ } else { \ struct type *curelm = (head)->sqh_first; \ while (curelm->field.sqe_next != (elm)) \ curelm = curelm->field.sqe_next; \ if ((curelm->field.sqe_next = \ curelm->field.sqe_next->field.sqe_next) == NULL) \ (head)->sqh_last = &(curelm)->field.sqe_next; \ } \ } while (/*CONSTCOND*/0) #define SIMPLEQ_FOREACH(var, head, field) \ for ((var) = ((head)->sqh_first); \ (var); \ (var) = ((var)->field.sqe_next)) /* * Simple queue access methods. */ #define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) #define SIMPLEQ_FIRST(head) ((head)->sqh_first) #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) /* * Tail queue definitions. */ #define _TAILQ_HEAD(name, type, qual) \ struct name { \ qual type *tqh_first; /* first element */ \ qual type *qual *tqh_last; /* addr of last next element */ \ } #define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) #define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } #define _TAILQ_ENTRY(type, qual) \ struct { \ qual type *tqe_next; /* next element */ \ qual type *qual *tqe_prev; /* address of previous next element */\ } #define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) /* * Tail queue functions. */ #define TAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ (head)->tqh_last = &(head)->tqh_first; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ (head)->tqh_first->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (head)->tqh_first = (elm); \ (elm)->field.tqe_prev = &(head)->tqh_first; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &(elm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (listelm)->field.tqe_next = (elm); \ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ (elm)->field.tqe_next = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ (elm)->field.tqe_prev; \ else \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ } while (/*CONSTCOND*/0) #define TAILQ_FOREACH(var, head, field) \ for ((var) = ((head)->tqh_first); \ (var); \ (var) = ((var)->field.tqe_next)) #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ (var); \ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) #define TAILQ_CONCAT(head1, head2, field) do { \ if (!TAILQ_EMPTY(head2)) { \ *(head1)->tqh_last = (head2)->tqh_first; \ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ (head1)->tqh_last = (head2)->tqh_last; \ TAILQ_INIT((head2)); \ } \ } while (/*CONSTCOND*/0) /* * Tail queue access methods. */ #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) /* * Circular queue definitions. */ #define CIRCLEQ_HEAD(name, type) \ struct name { \ struct type *cqh_first; /* first element */ \ struct type *cqh_last; /* last element */ \ } #define CIRCLEQ_HEAD_INITIALIZER(head) \ { (void *)&head, (void *)&head } #define CIRCLEQ_ENTRY(type) \ struct { \ struct type *cqe_next; /* next element */ \ struct type *cqe_prev; /* previous element */ \ } /* * Circular queue functions. */ #define CIRCLEQ_INIT(head) do { \ (head)->cqh_first = (void *)(head); \ (head)->cqh_last = (void *)(head); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ (elm)->field.cqe_prev = (listelm); \ if ((listelm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ (listelm)->field.cqe_next = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm); \ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ if ((listelm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ (listelm)->field.cqe_prev = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ (elm)->field.cqe_next = (head)->cqh_first; \ (elm)->field.cqe_prev = (void *)(head); \ if ((head)->cqh_last == (void *)(head)) \ (head)->cqh_last = (elm); \ else \ (head)->cqh_first->field.cqe_prev = (elm); \ (head)->cqh_first = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.cqe_next = (void *)(head); \ (elm)->field.cqe_prev = (head)->cqh_last; \ if ((head)->cqh_first == (void *)(head)) \ (head)->cqh_first = (elm); \ else \ (head)->cqh_last->field.cqe_next = (elm); \ (head)->cqh_last = (elm); \ } while (/*CONSTCOND*/0) #define CIRCLEQ_REMOVE(head, elm, field) do { \ if ((elm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm)->field.cqe_prev; \ else \ (elm)->field.cqe_next->field.cqe_prev = \ (elm)->field.cqe_prev; \ if ((elm)->field.cqe_prev == (void *)(head)) \ (head)->cqh_first = (elm)->field.cqe_next; \ else \ (elm)->field.cqe_prev->field.cqe_next = \ (elm)->field.cqe_next; \ } while (/*CONSTCOND*/0) #define CIRCLEQ_FOREACH(var, head, field) \ for ((var) = ((head)->cqh_first); \ (var) != (const void *)(head); \ (var) = ((var)->field.cqe_next)) #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ for ((var) = ((head)->cqh_last); \ (var) != (const void *)(head); \ (var) = ((var)->field.cqe_prev)) /* * Circular queue access methods. */ #define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) #define CIRCLEQ_FIRST(head) ((head)->cqh_first) #define CIRCLEQ_LAST(head) ((head)->cqh_last) #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) #define CIRCLEQ_LOOP_NEXT(head, elm, field) \ (((elm)->field.cqe_next == (void *)(head)) \ ? ((head)->cqh_first) \ : (elm->field.cqe_next)) #define CIRCLEQ_LOOP_PREV(head, elm, field) \ (((elm)->field.cqe_prev == (void *)(head)) \ ? ((head)->cqh_last) \ : (elm->field.cqe_prev)) #endif /* sys/queue.h */ sys/quota.h 0000644 00000012064 15063602043 0006666 0 ustar 00 /* This just represents the non-kernel parts of <linux/quota.h>. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Robert Elz at The University of Melbourne. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _SYS_QUOTA_H #define _SYS_QUOTA_H 1 #include <features.h> #include <sys/types.h> #include <linux/quota.h> /* * Convert diskblocks to blocks and the other way around. * currently only to fool the BSD source. :-) */ #define dbtob(num) ((num) << 10) #define btodb(num) ((num) >> 10) /* * Convert count of filesystem blocks to diskquota blocks, meant for * filesystems where i_blksize != 1024. */ #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024) /* * Definitions for disk quotas imposed on the average user * (big brother finally hits Linux). * * The following constants define the amount of time given a user * before the soft limits are treated as hard limits (usually resulting * in an allocation failure). The timer is started when the user crosses * their soft limit, it is reset when they go below their soft limit. */ #define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */ #define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */ #define QUOTAFILENAME "quota" #define QUOTAGROUP "staff" #define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */ #define NR_DQUOTS 256 /* Number of quotas active at one time */ /* Old name for struct if_dqblk. */ struct dqblk { __uint64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */ __uint64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */ __uint64_t dqb_curspace; /* current quota block count */ __uint64_t dqb_ihardlimit; /* maximum # allocated inodes */ __uint64_t dqb_isoftlimit; /* preferred inode limit */ __uint64_t dqb_curinodes; /* current # allocated inodes */ __uint64_t dqb_btime; /* time limit for excessive disk use */ __uint64_t dqb_itime; /* time limit for excessive files */ __uint32_t dqb_valid; /* bitmask of QIF_* constants */ }; /* * Shorthand notation. */ #define dq_bhardlimit dq_dqb.dqb_bhardlimit #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit #define dq_curspace dq_dqb.dqb_curspace #define dq_valid dq_dqb.dqb_valid #define dq_ihardlimit dq_dqb.dqb_ihardlimit #define dq_isoftlimit dq_dqb.dqb_isoftlimit #define dq_curinodes dq_dqb.dqb_curinodes #define dq_btime dq_dqb.dqb_btime #define dq_itime dq_dqb.dqb_itime #define dqoff(UID) ((__loff_t)((UID) * sizeof (struct dqblk))) /* Old name for struct if_dqinfo. */ struct dqinfo { __uint64_t dqi_bgrace; __uint64_t dqi_igrace; __uint32_t dqi_flags; __uint32_t dqi_valid; }; __BEGIN_DECLS extern int quotactl (int __cmd, const char *__special, int __id, __caddr_t __addr) __THROW; __END_DECLS #endif /* sys/quota.h */ sys/random.h 0000644 00000002643 15063602043 0007017 0 ustar 00 /* Interfaces for obtaining random bytes. Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RANDOM_H #define _SYS_RANDOM_H 1 #include <features.h> #include <sys/types.h> /* Flags for use with getrandom. */ #define GRND_NONBLOCK 0x01 #define GRND_RANDOM 0x02 __BEGIN_DECLS /* Write LENGTH bytes of randomness starting at BUFFER. Return the number of bytes written, or -1 on error. */ ssize_t getrandom (void *__buffer, size_t __length, unsigned int __flags) __wur; /* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on success or -1 on error. */ int getentropy (void *__buffer, size_t __length) __wur; __END_DECLS #endif /* _SYS_RANDOM_H */ sys/raw.h 0000644 00000002235 15063602043 0006325 0 ustar 00 /* Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RAW_H #define _SYS_RAW_H 1 #include <stdint.h> #include <sys/ioctl.h> /* The major device number for raw devices. */ #define RAW_MAJOR 162 /* `ioctl' commands for raw devices. */ #define RAW_SETBIND _IO(0xac, 0) #define RAW_GETBIND _IO(0xac, 1) struct raw_config_request { int raw_minor; uint64_t block_major; uint64_t block_minor; }; #endif /* sys/raw.h */ sys/reboot.h 0000644 00000003140 15063602043 0007022 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This file should define RB_* macros to be used as flag bits in the argument to the `reboot' system call. */ #ifndef _SYS_REBOOT_H #define _SYS_REBOOT_H 1 #include <features.h> /* Perform a hard reset now. */ #define RB_AUTOBOOT 0x01234567 /* Halt the system. */ #define RB_HALT_SYSTEM 0xcdef0123 /* Enable reboot using Ctrl-Alt-Delete keystroke. */ #define RB_ENABLE_CAD 0x89abcdef /* Disable reboot using Ctrl-Alt-Delete keystroke. */ #define RB_DISABLE_CAD 0 /* Stop system and switch power off if possible. */ #define RB_POWER_OFF 0x4321fedc /* Suspend system using software suspend. */ #define RB_SW_SUSPEND 0xd000fce2 /* Reboot system into new kernel. */ #define RB_KEXEC 0x45584543 __BEGIN_DECLS /* Reboot or halt the system. */ extern int reboot (int __howto) __THROW; __END_DECLS #endif /* _SYS_REBOOT_H */ sys/reg.h 0000644 00000003442 15063602043 0006312 0 ustar 00 /* Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_REG_H #define _SYS_REG_H 1 #ifdef __x86_64__ /* Index into an array of 8 byte longs returned from ptrace for location of the users' stored general purpose registers. */ # define R15 0 # define R14 1 # define R13 2 # define R12 3 # define RBP 4 # define RBX 5 # define R11 6 # define R10 7 # define R9 8 # define R8 9 # define RAX 10 # define RCX 11 # define RDX 12 # define RSI 13 # define RDI 14 # define ORIG_RAX 15 # define RIP 16 # define CS 17 # define EFLAGS 18 # define RSP 19 # define SS 20 # define FS_BASE 21 # define GS_BASE 22 # define DS 23 # define ES 24 # define FS 25 # define GS 26 #else /* Index into an array of 4 byte integers returned from ptrace for * location of the users' stored general purpose registers. */ # define EBX 0 # define ECX 1 # define EDX 2 # define ESI 3 # define EDI 4 # define EBP 5 # define EAX 6 # define DS 7 # define ES 8 # define FS 9 # define GS 10 # define ORIG_EAX 11 # define EIP 12 # define CS 13 # define EFL 14 # define UESP 15 # define SS 16 #endif #endif sys/resource.h 0000644 00000007075 15063602043 0007372 0 ustar 00 /* Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RESOURCE_H #define _SYS_RESOURCE_H 1 #include <features.h> /* Get the system-dependent definitions of structures and bit values. */ #include <bits/resource.h> #ifndef __id_t_defined typedef __id_t id_t; # define __id_t_defined #endif __BEGIN_DECLS /* The X/Open standard defines that all the functions below must use `int' as the type for the first argument. When we are compiling with GNU extensions we change this slightly to provide better error checking. */ #if defined __USE_GNU && !defined __cplusplus typedef enum __rlimit_resource __rlimit_resource_t; typedef enum __rusage_who __rusage_who_t; typedef enum __priority_which __priority_which_t; #else typedef int __rlimit_resource_t; typedef int __rusage_who_t; typedef int __priority_which_t; #endif /* Put the soft and hard limits for RESOURCE in *RLIMITS. Returns 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int getrlimit (__rlimit_resource_t __resource, struct rlimit *__rlimits) __THROW; #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource, struct rlimit *__rlimits), getrlimit64); # else # define getrlimit getrlimit64 # endif #endif #ifdef __USE_LARGEFILE64 extern int getrlimit64 (__rlimit_resource_t __resource, struct rlimit64 *__rlimits) __THROW; #endif /* Set the soft and hard limits for RESOURCE to *RLIMITS. Only the super-user can increase hard limits. Return 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int setrlimit (__rlimit_resource_t __resource, const struct rlimit *__rlimits) __THROW; #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource, const struct rlimit *__rlimits), setrlimit64); # else # define setrlimit setrlimit64 # endif #endif #ifdef __USE_LARGEFILE64 extern int setrlimit64 (__rlimit_resource_t __resource, const struct rlimit64 *__rlimits) __THROW; #endif /* Return resource usage information on process indicated by WHO and put it in *USAGE. Returns 0 for success, -1 for failure. */ extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; /* Return the highest priority of any process specified by WHICH and WHO (see above); if WHO is zero, the current process, process group, or user (as specified by WHO) is used. A lower priority number means higher priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */ extern int getpriority (__priority_which_t __which, id_t __who) __THROW; /* Set the priority of all processes specified by WHICH and WHO (see above) to PRIO. Returns 0 on success, -1 on errors. */ extern int setpriority (__priority_which_t __which, id_t __who, int __prio) __THROW; __END_DECLS #endif /* sys/resource.h */ sys/select.h 0000644 00000010054 15063602043 0007011 0 ustar 00 /* `fd_set' type and related macros, and `select'/`pselect' declarations. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */ #ifndef _SYS_SELECT_H #define _SYS_SELECT_H 1 #include <features.h> /* Get definition of needed basic types. */ #include <bits/types.h> /* Get __FD_* definitions. */ #include <bits/select.h> /* Get sigset_t. */ #include <bits/types/sigset_t.h> /* Get definition of timer specification structures. */ #include <bits/types/time_t.h> #include <bits/types/struct_timeval.h> #ifdef __USE_XOPEN2K # include <bits/types/struct_timespec.h> #endif #ifndef __suseconds_t_defined typedef __suseconds_t suseconds_t; # define __suseconds_t_defined #endif /* The fd_set member is required to be an array of longs. */ typedef long int __fd_mask; /* Some versions of <linux/posix_types.h> define this macros. */ #undef __NFDBITS /* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ #define __NFDBITS (8 * (int) sizeof (__fd_mask)) #define __FD_ELT(d) ((d) / __NFDBITS) #define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS))) /* fd_set for select and pselect. */ typedef struct { /* XPG4.2 requires this member name. Otherwise avoid the name from the global namespace. */ #ifdef __USE_XOPEN __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; # define __FDS_BITS(set) ((set)->fds_bits) #else __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; # define __FDS_BITS(set) ((set)->__fds_bits) #endif } fd_set; /* Maximum number of file descriptors in `fd_set'. */ #define FD_SETSIZE __FD_SETSIZE #ifdef __USE_MISC /* Sometimes the fd_set member is assumed to have this type. */ typedef __fd_mask fd_mask; /* Number of bits per word of `fd_set' (some code assumes this is 32). */ # define NFDBITS __NFDBITS #endif /* Access macros for `fd_set'. */ #define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp) #define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp) #define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp) #define FD_ZERO(fdsetp) __FD_ZERO (fdsetp) __BEGIN_DECLS /* Check the first NFDS descriptors each in READFDS (if not NULL) for read readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out after waiting the interval specified therein. Returns the number of ready descriptors, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); #ifdef __USE_XOPEN2K /* Same as above only that the TIMEOUT value is given with higher resolution and a sigmask which is been set temporarily. This version should be used. This function is a cancellation point and therefore not marked with __THROW. */ extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, const struct timespec *__restrict __timeout, const __sigset_t *__restrict __sigmask); #endif /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__ # include <bits/select2.h> #endif __END_DECLS #endif /* sys/select.h */ sys/sem.h 0000644 00000003764 15063602043 0006330 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SEM_H #define _SYS_SEM_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> /* Get system dependent definition of `struct semid_ds' and more. */ #include <bits/sem.h> #ifdef __USE_GNU # include <bits/types/struct_timespec.h> #endif /* The following System V style IPC functions implement a semaphore handling. The definition is found in XPG2. */ /* Structure used for argument to `semop' to describe operations. */ struct sembuf { unsigned short int sem_num; /* semaphore number */ short int sem_op; /* semaphore operation */ short int sem_flg; /* operation flag */ }; __BEGIN_DECLS /* Semaphore control operation. */ extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; /* Get semaphore. */ extern int semget (key_t __key, int __nsems, int __semflg) __THROW; /* Operate on semaphore. */ extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; #ifdef __USE_GNU /* Operate on semaphore with timeout. */ extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, const struct timespec *__timeout) __THROW; #endif __END_DECLS #endif /* sys/sem.h */ sys/sendfile.h 0000644 00000003415 15063602043 0007326 0 ustar 00 /* sendfile -- copy data directly from one file descriptor to another Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SENDFILE_H #define _SYS_SENDFILE_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* Send up to COUNT bytes from file associated with IN_FD starting at *OFFSET to descriptor OUT_FD. Set *OFFSET to the IN_FD's file position following the read bytes. If OFFSET is a null pointer, use the normal file position instead. Return the number of written bytes, or -1 in case of error. */ #ifndef __USE_FILE_OFFSET64 extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset, size_t __count) __THROW; #else # ifdef __REDIRECT_NTH extern ssize_t __REDIRECT_NTH (sendfile, (int __out_fd, int __in_fd, __off64_t *__offset, size_t __count), sendfile64); # else # define sendfile sendfile64 # endif #endif #ifdef __USE_LARGEFILE64 extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset, size_t __count) __THROW; #endif __END_DECLS #endif /* sys/sendfile.h */ sys/shm.h 0000644 00000003521 15063602043 0006322 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SHM_H #define _SYS_SHM_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> /* Get system dependent definition of `struct shmid_ds' and more. */ #include <bits/shm.h> /* Define types required by the standard. */ #include <bits/types/time_t.h> #ifdef __USE_XOPEN # ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined # endif #endif /* X/Open */ __BEGIN_DECLS /* The following System V style IPC functions implement a shared memory facility. The definition is found in XPG4.2. */ /* Shared memory control operation. */ extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; /* Get shared memory segment. */ extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW; /* Attach shared memory segment. */ extern void *shmat (int __shmid, const void *__shmaddr, int __shmflg) __THROW; /* Detach shared memory segment. */ extern int shmdt (const void *__shmaddr) __THROW; __END_DECLS #endif /* sys/shm.h */ sys/signal.h 0000644 00000000024 15063602043 0007003 0 ustar 00 #include <signal.h> sys/signalfd.h 0000644 00000003077 15063602043 0007330 0 ustar 00 /* Copyright (C) 2007-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SIGNALFD_H #define _SYS_SIGNALFD_H 1 #include <stdint.h> #include <bits/types/sigset_t.h> /* Get the platform-dependent flags. */ #include <bits/signalfd.h> struct signalfd_siginfo { uint32_t ssi_signo; int32_t ssi_errno; int32_t ssi_code; uint32_t ssi_pid; uint32_t ssi_uid; int32_t ssi_fd; uint32_t ssi_tid; uint32_t ssi_band; uint32_t ssi_overrun; uint32_t ssi_trapno; int32_t ssi_status; int32_t ssi_int; uint64_t ssi_ptr; uint64_t ssi_utime; uint64_t ssi_stime; uint64_t ssi_addr; uint8_t __pad[48]; }; __BEGIN_DECLS /* Request notification for delivery of signals in MASK to be performed using descriptor FD.*/ extern int signalfd (int __fd, const sigset_t *__mask, int __flags) __THROW __nonnull ((2)); __END_DECLS #endif /* sys/signalfd.h */ sys/socket.h 0000644 00000023733 15063602043 0007032 0 ustar 00 /* Declarations of socket constants, types, and functions. Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SOCKET_H #define _SYS_SOCKET_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types/struct_iovec.h> #define __need_size_t #include <stddef.h> /* This operating system-specific header file defines the SOCK_*, PF_*, AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', `struct msghdr', and `struct linger' types. */ #include <bits/socket.h> #ifdef __USE_MISC # include <bits/types/struct_osockaddr.h> #endif /* The following constants should be used for the second parameter of `shutdown'. */ enum { SHUT_RD = 0, /* No more receptions. */ #define SHUT_RD SHUT_RD SHUT_WR, /* No more transmissions. */ #define SHUT_WR SHUT_WR SHUT_RDWR /* No more receptions or transmissions. */ #define SHUT_RDWR SHUT_RDWR }; /* This is the type we use for generic socket address arguments. With GCC 2.7 and later, the funky union causes redeclarations or uses with any of the listed types to be allowed without complaint. G++ 2.7 does not support transparent unions so there we want the old-style declaration, too. */ #if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU # define __SOCKADDR_ARG struct sockaddr *__restrict # define __CONST_SOCKADDR_ARG const struct sockaddr * #else /* Add more `struct sockaddr_AF' types here as necessary. These are all the ones I found on NetBSD and Linux. */ # define __SOCKADDR_ALLTYPES \ __SOCKADDR_ONETYPE (sockaddr) \ __SOCKADDR_ONETYPE (sockaddr_at) \ __SOCKADDR_ONETYPE (sockaddr_ax25) \ __SOCKADDR_ONETYPE (sockaddr_dl) \ __SOCKADDR_ONETYPE (sockaddr_eon) \ __SOCKADDR_ONETYPE (sockaddr_in) \ __SOCKADDR_ONETYPE (sockaddr_in6) \ __SOCKADDR_ONETYPE (sockaddr_inarp) \ __SOCKADDR_ONETYPE (sockaddr_ipx) \ __SOCKADDR_ONETYPE (sockaddr_iso) \ __SOCKADDR_ONETYPE (sockaddr_ns) \ __SOCKADDR_ONETYPE (sockaddr_un) \ __SOCKADDR_ONETYPE (sockaddr_x25) # define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__; typedef union { __SOCKADDR_ALLTYPES } __SOCKADDR_ARG __attribute__ ((__transparent_union__)); # undef __SOCKADDR_ONETYPE # define __SOCKADDR_ONETYPE(type) const struct type *__restrict __##type##__; typedef union { __SOCKADDR_ALLTYPES } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__)); # undef __SOCKADDR_ONETYPE #endif #ifdef __USE_GNU /* For `recvmmsg' and `sendmmsg'. */ struct mmsghdr { struct msghdr msg_hdr; /* Actual message header. */ unsigned int msg_len; /* Number of received or sent bytes for the entry. */ }; #endif /* Create a new socket of type TYPE in domain DOMAIN, using protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. Returns a file descriptor for the new socket, or -1 for errors. */ extern int socket (int __domain, int __type, int __protocol) __THROW; /* Create two new sockets, of type TYPE in domain DOMAIN and using protocol PROTOCOL, which are connected to each other, and put file descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, one will be chosen automatically. Returns 0 on success, -1 for errors. */ extern int socketpair (int __domain, int __type, int __protocol, int __fds[2]) __THROW; /* Give the socket FD the local address ADDR (which is LEN bytes long). */ extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) __THROW; /* Put the local address of FD into *ADDR and its length in *LEN. */ extern int getsockname (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len) __THROW; /* Open a connection on socket FD to peer at ADDR (which LEN bytes long). For connectionless socket types, just set the default address to send to and the only address from which to accept transmissions. Return 0 on success, -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len); /* Put the address of the peer connected to socket FD into *ADDR (which is *LEN bytes long), and its actual length into *LEN. */ extern int getpeername (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len) __THROW; /* Send N bytes of BUF to socket FD. Returns the number sent or -1. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags); /* Read N bytes into BUF from socket FD. Returns the number read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags); /* Send N bytes of BUF on socket FD to peer at address ADDR (which is ADDR_LEN bytes long). Returns the number sent, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t sendto (int __fd, const void *__buf, size_t __n, int __flags, __CONST_SOCKADDR_ARG __addr, socklen_t __addr_len); /* Read N bytes into BUF through socket FD. If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of the sender, and store the actual size of the address in *ADDR_LEN. Returns the number of bytes read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); /* Send a message described MESSAGE on socket FD. Returns the number of bytes sent, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t sendmsg (int __fd, const struct msghdr *__message, int __flags); #ifdef __USE_GNU /* Send a VLEN messages as described by VMESSAGES to socket FD. Returns the number of datagrams successfully written or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags); #endif /* Receive a message as described by MESSAGE from socket FD. Returns the number of bytes read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); #ifdef __USE_GNU /* Receive up to VLEN messages as described by VMESSAGES from socket FD. Returns the number of messages received or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags, struct timespec *__tmo); #endif /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's actual length. Returns 0 on success, -1 for errors. */ extern int getsockopt (int __fd, int __level, int __optname, void *__restrict __optval, socklen_t *__restrict __optlen) __THROW; /* Set socket FD's option OPTNAME at protocol level LEVEL to *OPTVAL (which is OPTLEN bytes long). Returns 0 on success, -1 for errors. */ extern int setsockopt (int __fd, int __level, int __optname, const void *__optval, socklen_t __optlen) __THROW; /* Prepare to accept connections on socket FD. N connection requests will be queued before further requests are refused. Returns 0 on success, -1 for errors. */ extern int listen (int __fd, int __n) __THROW; /* Await a connection on socket FD. When a connection arrives, open a new socket to communicate with it, set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting peer and *ADDR_LEN to the address's actual length, and return the new socket's descriptor, or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ extern int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); #ifdef __USE_GNU /* Similar to 'accept' but takes an additional parameter to specify flags. This function is a cancellation point and therefore not marked with __THROW. */ extern int accept4 (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len, int __flags); #endif /* Shut down all or part of the connection open on socket FD. HOW determines what to shut down: SHUT_RD = No more receptions; SHUT_WR = No more transmissions; SHUT_RDWR = No more receptions or transmissions. Returns 0 on success, -1 for errors. */ extern int shutdown (int __fd, int __how) __THROW; #ifdef __USE_XOPEN2K /* Determine wheter socket is at a out-of-band mark. */ extern int sockatmark (int __fd) __THROW; #endif #ifdef __USE_MISC /* FDTYPE is S_IFSOCK or another S_IF* macro defined in <sys/stat.h>; returns 1 if FD is open on an object of the indicated type, 0 if not, or -1 for errors (setting errno). */ extern int isfdtype (int __fd, int __fdtype) __THROW; #endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/socket2.h> #endif __END_DECLS #endif /* sys/socket.h */ sys/socketvar.h 0000644 00000000215 15063602043 0007531 0 ustar 00 /* This header is used on many systems but for GNU we have everything already defined in the standard header. */ #include <sys/socket.h> sys/soundcard.h 0000644 00000000035 15063602043 0007512 0 ustar 00 #include <linux/soundcard.h> sys/stat.h 0000644 00000037554 15063602043 0006523 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 5.6 File Characteristics <sys/stat.h> */ #ifndef _SYS_STAT_H #define _SYS_STAT_H 1 #include <features.h> #include <bits/types.h> /* For __mode_t and __dev_t. */ #ifdef __USE_XOPEN2K8 # include <bits/types/struct_timespec.h> #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ # include <bits/types/time_t.h> # ifndef __dev_t_defined typedef __dev_t dev_t; # define __dev_t_defined # endif # ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined # endif # ifndef __ino_t_defined # ifndef __USE_FILE_OFFSET64 typedef __ino_t ino_t; # else typedef __ino64_t ino_t; # endif # define __ino_t_defined # endif # ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined # endif # ifndef __nlink_t_defined typedef __nlink_t nlink_t; # define __nlink_t_defined # endif # ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined # endif # ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined # endif #endif /* X/Open */ #ifdef __USE_UNIX98 # ifndef __blkcnt_t_defined # ifndef __USE_FILE_OFFSET64 typedef __blkcnt_t blkcnt_t; # else typedef __blkcnt64_t blkcnt_t; # endif # define __blkcnt_t_defined # endif # ifndef __blksize_t_defined typedef __blksize_t blksize_t; # define __blksize_t_defined # endif #endif /* Unix98 */ __BEGIN_DECLS #include <bits/stat.h> #if defined __USE_MISC || defined __USE_XOPEN # define S_IFMT __S_IFMT # define S_IFDIR __S_IFDIR # define S_IFCHR __S_IFCHR # define S_IFBLK __S_IFBLK # define S_IFREG __S_IFREG # ifdef __S_IFIFO # define S_IFIFO __S_IFIFO # endif # ifdef __S_IFLNK # define S_IFLNK __S_IFLNK # endif # if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) \ && defined __S_IFSOCK # define S_IFSOCK __S_IFSOCK # endif #endif /* Test macros for file types. */ #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) #define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR) #define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK) #define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) #ifdef __S_IFIFO # define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO) #endif #ifdef __S_IFLNK # define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) #endif #if defined __USE_MISC && !defined __S_IFLNK # define S_ISLNK(mode) 0 #endif #if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K) \ && defined __S_IFSOCK # define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK) #elif defined __USE_XOPEN2K # define S_ISSOCK(mode) 0 #endif /* These are from POSIX.1b. If the objects are not implemented using separate distinct file types, the macros always will evaluate to zero. Unlike the other S_* macros the following three take a pointer to a `struct stat' object as the argument. */ #ifdef __USE_POSIX199309 # define S_TYPEISMQ(buf) __S_TYPEISMQ(buf) # define S_TYPEISSEM(buf) __S_TYPEISSEM(buf) # define S_TYPEISSHM(buf) __S_TYPEISSHM(buf) #endif /* Protection bits. */ #define S_ISUID __S_ISUID /* Set user ID on execution. */ #define S_ISGID __S_ISGID /* Set group ID on execution. */ #if defined __USE_MISC || defined __USE_XOPEN /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ # define S_ISVTX __S_ISVTX #endif #define S_IRUSR __S_IREAD /* Read by owner. */ #define S_IWUSR __S_IWRITE /* Write by owner. */ #define S_IXUSR __S_IEXEC /* Execute by owner. */ /* Read, write, and execute by owner. */ #define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) #ifdef __USE_MISC # define S_IREAD S_IRUSR # define S_IWRITE S_IWUSR # define S_IEXEC S_IXUSR #endif #define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ #define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ #define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ /* Read, write, and execute by group. */ #define S_IRWXG (S_IRWXU >> 3) #define S_IROTH (S_IRGRP >> 3) /* Read by others. */ #define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ #define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ /* Read, write, and execute by others. */ #define S_IRWXO (S_IRWXG >> 3) #ifdef __USE_MISC /* Macros for common mode bit masks. */ # define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ # define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */ # define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ # define S_BLKSIZE 512 /* Block size for `st_blocks'. */ #endif #ifndef __USE_FILE_OFFSET64 /* Get file attributes for FILE and put them in BUF. */ extern int stat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); /* Get file attributes for the file, device, pipe, or socket that file descriptor FD is open on and put them in BUF. */ extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (stat, (const char *__restrict __file, struct stat *__restrict __buf), stat64) __nonnull ((1, 2)); extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) __nonnull ((2)); # else # define stat stat64 # define fstat fstat64 # endif #endif #ifdef __USE_LARGEFILE64 extern int stat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); #endif #ifdef __USE_ATFILE /* Similar to stat, get the attributes for FILE and put them in BUF. Relative path names are interpreted relative to FD unless FD is AT_FDCWD. */ # ifndef __USE_FILE_OFFSET64 extern int fstatat (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag), fstatat64) __nonnull ((2, 3)); # else # define fstatat fstatat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int fstatat64 (int __fd, const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # endif #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K # ifndef __USE_FILE_OFFSET64 /* Get file attributes about FILE and put them in BUF. If FILE is a symbolic link, do not follow it. */ extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (lstat, (const char *__restrict __file, struct stat *__restrict __buf), lstat64) __nonnull ((1, 2)); # else # define lstat lstat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int lstat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); # endif #endif /* Set file access permissions for FILE to MODE. If FILE is a symbolic link, this affects its target instead. */ extern int chmod (const char *__file, __mode_t __mode) __THROW __nonnull ((1)); #ifdef __USE_MISC /* Set file access permissions for FILE to MODE. If FILE is a symbolic link, this affects the link itself rather than its target. */ extern int lchmod (const char *__file, __mode_t __mode) __THROW __nonnull ((1)); #endif /* Set file access permissions of the file FD is open on to MODE. */ #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED extern int fchmod (int __fd, __mode_t __mode) __THROW; #endif #ifdef __USE_ATFILE /* Set file access permissions of FILE relative to the directory FD is open on. */ extern int fchmodat (int __fd, const char *__file, __mode_t __mode, int __flag) __THROW __nonnull ((2)) __wur; #endif /* Use ATFILE. */ /* Set the file creation mask of the current process to MASK, and return the old creation mask. */ extern __mode_t umask (__mode_t __mask) __THROW; #ifdef __USE_GNU /* Get the current `umask' value without changing it. This function is only available under the GNU Hurd. */ extern __mode_t getumask (void) __THROW; #endif /* Create a new directory named PATH, with permission bits MODE. */ extern int mkdir (const char *__path, __mode_t __mode) __THROW __nonnull ((1)); #ifdef __USE_ATFILE /* Like mkdir, create a new directory with permission bits MODE. But interpret relative PATH names relative to the directory associated with FD. */ extern int mkdirat (int __fd, const char *__path, __mode_t __mode) __THROW __nonnull ((2)); #endif /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev) __THROW __nonnull ((1)); # ifdef __USE_ATFILE /* Like mknod, create a new device file with permission bits MODE and device number DEV. But interpret relative PATH names relative to the directory associated with FD. */ extern int mknodat (int __fd, const char *__path, __mode_t __mode, __dev_t __dev) __THROW __nonnull ((2)); # endif #endif /* Create a new FIFO named PATH, with permission bits MODE. */ extern int mkfifo (const char *__path, __mode_t __mode) __THROW __nonnull ((1)); #ifdef __USE_ATFILE /* Like mkfifo, create a new FIFO with permission bits MODE. But interpret relative PATH names relative to the directory associated with FD. */ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) __THROW __nonnull ((2)); #endif #ifdef __USE_ATFILE /* Set file access and modification times relative to directory file descriptor. */ extern int utimensat (int __fd, const char *__path, const struct timespec __times[2], int __flags) __THROW __nonnull ((2)); #endif #ifdef __USE_XOPEN2K8 /* Set file access and modification times of the file associated with FD. */ extern int futimens (int __fd, const struct timespec __times[2]) __THROW; #endif /* To allow the `struct stat' structure and the file type `mode_t' bits to vary without changing shared library major version number, the `stat' family of functions and `mknod' are in fact inline wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', which all take a leading version-number argument designating the data structure and bits used. <bits/stat.h> defines _STAT_VER with the version number corresponding to `struct stat' as defined in that file; and _MKNOD_VER with the version number corresponding to the S_IF* macros defined therein. It is arranged that when not inlined these function are always statically linked; that way a dynamically-linked executable always encodes the version number corresponding to the data structures it uses, so the `x' functions in the shared library can adapt without needing to recompile all callers. */ #ifndef _STAT_VER # define _STAT_VER 0 #endif #ifndef _MKNOD_VER # define _MKNOD_VER 0 #endif /* Wrappers for stat and mknod system calls. */ #ifndef __USE_FILE_OFFSET64 extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) __THROW __nonnull ((3)); extern int __xstat (int __ver, const char *__filename, struct stat *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf) __THROW __nonnull ((2, 3)); extern int __fxstatat (int __ver, int __fildes, const char *__filename, struct stat *__stat_buf, int __flag) __THROW __nonnull ((3, 4)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, struct stat *__stat_buf), __fxstat64) __nonnull ((3)); extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, struct stat *__stat_buf), __xstat64) __nonnull ((2, 3)); extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, struct stat *__stat_buf), __lxstat64) __nonnull ((2, 3)); extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, const char *__filename, struct stat *__stat_buf, int __flag), __fxstatat64) __nonnull ((3, 4)); # else # define __fxstat __fxstat64 # define __xstat __xstat64 # define __lxstat __lxstat64 # endif #endif #ifdef __USE_LARGEFILE64 extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) __THROW __nonnull ((3)); extern int __xstat64 (int __ver, const char *__filename, struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); extern int __lxstat64 (int __ver, const char *__filename, struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); extern int __fxstatat64 (int __ver, int __fildes, const char *__filename, struct stat64 *__stat_buf, int __flag) __THROW __nonnull ((3, 4)); #endif extern int __xmknod (int __ver, const char *__path, __mode_t __mode, __dev_t *__dev) __THROW __nonnull ((2, 4)); extern int __xmknodat (int __ver, int __fd, const char *__path, __mode_t __mode, __dev_t *__dev) __THROW __nonnull ((3, 5)); #ifdef __USE_GNU # include <bits/statx.h> #endif #ifdef __USE_EXTERN_INLINES /* Inlined versions of the real stat and mknod functions. */ __extern_inline int __NTH (stat (const char *__path, struct stat *__statbuf)) { return __xstat (_STAT_VER, __path, __statbuf); } # if defined __USE_MISC || defined __USE_XOPEN_EXTENDED __extern_inline int __NTH (lstat (const char *__path, struct stat *__statbuf)) { return __lxstat (_STAT_VER, __path, __statbuf); } # endif __extern_inline int __NTH (fstat (int __fd, struct stat *__statbuf)) { return __fxstat (_STAT_VER, __fd, __statbuf); } # ifdef __USE_ATFILE __extern_inline int __NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf, int __flag)) { return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag); } # endif # ifdef __USE_MISC __extern_inline int __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) { return __xmknod (_MKNOD_VER, __path, __mode, &__dev); } # endif # ifdef __USE_ATFILE __extern_inline int __NTH (mknodat (int __fd, const char *__path, __mode_t __mode, __dev_t __dev)) { return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); } # endif # if defined __USE_LARGEFILE64 \ && (! defined __USE_FILE_OFFSET64 \ || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) __extern_inline int __NTH (stat64 (const char *__path, struct stat64 *__statbuf)) { return __xstat64 (_STAT_VER, __path, __statbuf); } # if defined __USE_MISC || defined __USE_XOPEN_EXTENDED __extern_inline int __NTH (lstat64 (const char *__path, struct stat64 *__statbuf)) { return __lxstat64 (_STAT_VER, __path, __statbuf); } # endif __extern_inline int __NTH (fstat64 (int __fd, struct stat64 *__statbuf)) { return __fxstat64 (_STAT_VER, __fd, __statbuf); } # ifdef __USE_ATFILE __extern_inline int __NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf, int __flag)) { return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag); } # endif # endif #endif __END_DECLS #endif /* sys/stat.h */ sys/statfs.h 0000644 00000004055 15063602043 0007042 0 ustar 00 /* Definitions for getting information about a filesystem. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATFS_H #define _SYS_STATFS_H 1 #include <features.h> /* Get the system-specific definition of `struct statfs'. */ #include <bits/statfs.h> __BEGIN_DECLS /* Return information about the filesystem on which FILE resides. */ #ifndef __USE_FILE_OFFSET64 extern int statfs (const char *__file, struct statfs *__buf) __THROW __nonnull ((1, 2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (statfs, (const char *__file, struct statfs *__buf), statfs64) __nonnull ((1, 2)); # else # define statfs statfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int statfs64 (const char *__file, struct statfs64 *__buf) __THROW __nonnull ((1, 2)); #endif /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 extern int fstatfs (int __fildes, struct statfs *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf), fstatfs64) __nonnull ((2)); # else # define fstatfs fstatfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int fstatfs64 (int __fildes, struct statfs64 *__buf) __THROW __nonnull ((2)); #endif __END_DECLS #endif /* sys/statfs.h */ sys/statvfs.h 0000644 00000005403 15063602043 0007226 0 ustar 00 /* Definitions for getting information about a filesystem. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATVFS_H #define _SYS_STATVFS_H 1 #include <features.h> /* Get the system-specific definition of `struct statfs'. */ #include <bits/statvfs.h> #ifndef __USE_FILE_OFFSET64 # ifndef __fsblkcnt_t_defined typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #else # ifndef __fsblkcnt_t_defined typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #endif __BEGIN_DECLS /* Return information about the filesystem on which FILE resides. */ #ifndef __USE_FILE_OFFSET64 extern int statvfs (const char *__restrict __file, struct statvfs *__restrict __buf) __THROW __nonnull ((1, 2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (statvfs, (const char *__restrict __file, struct statvfs *__restrict __buf), statvfs64) __nonnull ((1, 2)); # else # define statvfs statvfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int statvfs64 (const char *__restrict __file, struct statvfs64 *__restrict __buf) __THROW __nonnull ((1, 2)); #endif /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 extern int fstatvfs (int __fildes, struct statvfs *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatvfs, (int __fildes, struct statvfs *__buf), fstatvfs64) __nonnull ((2)); # else # define fstatvfs fstatvfs64 # endif #endif #ifdef __USE_LARGEFILE64 extern int fstatvfs64 (int __fildes, struct statvfs64 *__buf) __THROW __nonnull ((2)); #endif __END_DECLS #endif /* sys/statvfs.h */ sys/swap.h 0000644 00000003070 15063602043 0006504 0 ustar 00 /* Calls to enable and disable swapping on specified locations. Linux version. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SWAP_H #define _SYS_SWAP_H 1 #include <features.h> /* The swap priority is encoded as: (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK */ #define SWAP_FLAG_PREFER 0x8000 /* Set if swap priority is specified. */ #define SWAP_FLAG_PRIO_MASK 0x7fff #define SWAP_FLAG_PRIO_SHIFT 0 #define SWAP_FLAG_DISCARD 0x10000 /* Discard swap cluster after use. */ __BEGIN_DECLS /* Make the block special device PATH available to the system for swapping. This call is restricted to the super-user. */ extern int swapon (const char *__path, int __flags) __THROW; /* Stop using block special device PATH for swapping. */ extern int swapoff (const char *__path) __THROW; __END_DECLS #endif /* _SYS_SWAP_H */ sys/syscall.h 0000644 00000002467 15063602043 0007215 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYSCALL_H #define _SYSCALL_H 1 /* This file should list the numbers of the system calls the system knows. But instead of duplicating this we use the information available from the kernel sources. */ #include <asm/unistd.h> #ifndef _LIBC /* The Linux kernel header file defines macros `__NR_<name>', but some programs expect the traditional form `SYS_<name>'. So in building libc we scan the kernel's list and produce <bits/syscall.h> with macros for all the `SYS_' names. */ # include <bits/syscall.h> #endif #endif sys/sysctl.h 0000644 00000003724 15063602043 0007061 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSCTL_H #define _SYS_SYSCTL_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* Prevent more kernel headers than necessary to be included. */ #ifndef _LINUX_KERNEL_H # define _LINUX_KERNEL_H 1 # define __undef_LINUX_KERNEL_H #endif #ifndef _LINUX_TYPES_H # define _LINUX_TYPES_H 1 # define __undef_LINUX_TYPES_H #endif #ifndef _LINUX_LIST_H # define _LINUX_LIST_H 1 # define __undef_LINUX_LIST_H #endif #ifndef __LINUX_COMPILER_H # define __LINUX_COMPILER_H 1 # define __user # define __undef__LINUX_COMPILER_H #endif #include <linux/sysctl.h> #ifdef __undef_LINUX_KERNEL_H # undef _LINUX_KERNEL_H # undef __undef_LINUX_KERNEL_H #endif #ifdef __undef_LINUX_TYPES_H # undef _LINUX_TYPES_H # undef __undef_LINUX_TYPES_H #endif #ifdef __undef_LINUX_LIST_H # undef _LINUX_LIST_H # undef __undef_LINUX_LIST_H #endif #ifdef __undef__LINUX_COMPILER_H # undef __LINUX_COMPILER_H # undef __user # undef __undef__LINUX_COMPILER_H #endif #include <bits/sysctl.h> __BEGIN_DECLS /* Read or write system parameters. */ extern int sysctl (int *__name, int __nlen, void *__oldval, size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; __END_DECLS #endif /* _SYS_SYSCTL_H */ sys/sysinfo.h 0000644 00000002755 15063602043 0007235 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSINFO_H #define _SYS_SYSINFO_H 1 #include <features.h> /* Get sysinfo structure from kernel header. */ #include <linux/kernel.h> __BEGIN_DECLS /* Returns information on overall system statistics. */ extern int sysinfo (struct sysinfo *__info) __THROW; /* Return number of configured processors. */ extern int get_nprocs_conf (void) __THROW; /* Return number of available processors. */ extern int get_nprocs (void) __THROW; /* Return number of physical pages of memory in the system. */ extern long int get_phys_pages (void) __THROW; /* Return number of available physical pages of memory in the system. */ extern long int get_avphys_pages (void) __THROW; __END_DECLS #endif /* sys/sysinfo.h */ sys/syslog.h 0000644 00000017026 15063602043 0007060 0 ustar 00 /* * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)syslog.h 8.1 (Berkeley) 6/2/93 */ #ifndef _SYS_SYSLOG_H #define _SYS_SYSLOG_H 1 #include <features.h> #define __need___va_list #include <stdarg.h> /* This file defines _PATH_LOG. */ #include <bits/syslog-path.h> /* * priorities/facilities are encoded into a single 32-bit quantity, where the * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility * (0-big number). Both the priorities and the facilities map roughly * one-to-one to strings in the syslogd(8) source code. This mapping is * included in this file. * * priorities (these are ordered) */ #define LOG_EMERG 0 /* system is unusable */ #define LOG_ALERT 1 /* action must be taken immediately */ #define LOG_CRIT 2 /* critical conditions */ #define LOG_ERR 3 /* error conditions */ #define LOG_WARNING 4 /* warning conditions */ #define LOG_NOTICE 5 /* normal but significant condition */ #define LOG_INFO 6 /* informational */ #define LOG_DEBUG 7 /* debug-level messages */ #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ /* extract priority */ #define LOG_PRI(p) ((p) & LOG_PRIMASK) #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) #ifdef SYSLOG_NAMES #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ /* mark "facility" */ #define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES << 3, 0) typedef struct _code { char *c_name; int c_val; } CODE; CODE prioritynames[] = { { "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, { "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, /* DEPRECATED */ { "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, /* INTERNAL */ { "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, /* DEPRECATED */ { "warn", LOG_WARNING }, /* DEPRECATED */ { "warning", LOG_WARNING }, { NULL, -1 } }; #endif /* facility codes */ #define LOG_KERN (0<<3) /* kernel messages */ #define LOG_USER (1<<3) /* random user-level messages */ #define LOG_MAIL (2<<3) /* mail system */ #define LOG_DAEMON (3<<3) /* system daemons */ #define LOG_AUTH (4<<3) /* security/authorization messages */ #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ #define LOG_LPR (6<<3) /* line printer subsystem */ #define LOG_NEWS (7<<3) /* network news subsystem */ #define LOG_UUCP (8<<3) /* UUCP subsystem */ #define LOG_CRON (9<<3) /* clock daemon */ #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ #define LOG_FTP (11<<3) /* ftp daemon */ /* other codes through 15 reserved for system use */ #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ #define LOG_LOCAL3 (19<<3) /* reserved for local use */ #define LOG_LOCAL4 (20<<3) /* reserved for local use */ #define LOG_LOCAL5 (21<<3) /* reserved for local use */ #define LOG_LOCAL6 (22<<3) /* reserved for local use */ #define LOG_LOCAL7 (23<<3) /* reserved for local use */ #define LOG_NFACILITIES 24 /* current number of facilities */ #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ /* facility of pri */ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #ifdef SYSLOG_NAMES CODE facilitynames[] = { { "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, { "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, { "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, { "mark", INTERNAL_MARK }, /* INTERNAL */ { "news", LOG_NEWS }, { "security", LOG_AUTH }, /* DEPRECATED */ { "syslog", LOG_SYSLOG }, { "user", LOG_USER }, { "uucp", LOG_UUCP }, { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { NULL, -1 } }; #endif /* * arguments to setlogmask. */ #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ /* * Option flags for openlog. * * LOG_ODELAY no longer does anything. * LOG_NDELAY is the inverse of what it used to be. */ #define LOG_PID 0x01 /* log the pid with each message */ #define LOG_CONS 0x02 /* log on the console if errors in sending */ #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ #define LOG_NDELAY 0x08 /* don't delay open */ #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ #define LOG_PERROR 0x20 /* log to stderr as well */ __BEGIN_DECLS /* Close descriptor used to write to system logger. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void closelog (void); /* Open connection to system logger. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void openlog (const char *__ident, int __option, int __facility); /* Set the log mask level. */ extern int setlogmask (int __mask) __THROW; /* Generate a log message using FMT string and option arguments. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void syslog (int __pri, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); #ifdef __USE_MISC /* Generate a log message using FMT and using arguments pointed to by AP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) __attribute__ ((__format__ (__printf__, 2, 0))); #endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include <bits/syslog.h> #endif #ifdef __LDBL_COMPAT # include <bits/syslog-ldbl.h> #endif __END_DECLS #endif /* sys/syslog.h */ sys/sysmacros.h 0000644 00000004066 15063602043 0007563 0 ustar 00 /* Definitions of macros to access `dev_t' values. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSMACROS_H #define _SYS_SYSMACROS_H 1 #include <features.h> #include <bits/types.h> #include <bits/sysmacros.h> #define __SYSMACROS_DECL_TEMPL(rtype, name, proto) \ extern rtype gnu_dev_##name proto __THROW __attribute_const__; #define __SYSMACROS_IMPL_TEMPL(rtype, name, proto) \ __extension__ __extern_inline __attribute_const__ rtype \ __NTH (gnu_dev_##name proto) __BEGIN_DECLS __SYSMACROS_DECLARE_MAJOR (__SYSMACROS_DECL_TEMPL) __SYSMACROS_DECLARE_MINOR (__SYSMACROS_DECL_TEMPL) __SYSMACROS_DECLARE_MAKEDEV (__SYSMACROS_DECL_TEMPL) #ifdef __USE_EXTERN_INLINES __SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL) __SYSMACROS_DEFINE_MINOR (__SYSMACROS_IMPL_TEMPL) __SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_IMPL_TEMPL) #endif __END_DECLS #ifndef __SYSMACROS_NEED_IMPLEMENTATION # undef __SYSMACROS_DECL_TEMPL # undef __SYSMACROS_IMPL_TEMPL # undef __SYSMACROS_DECLARE_MAJOR # undef __SYSMACROS_DECLARE_MINOR # undef __SYSMACROS_DECLARE_MAKEDEV # undef __SYSMACROS_DEFINE_MAJOR # undef __SYSMACROS_DEFINE_MINOR # undef __SYSMACROS_DEFINE_MAKEDEV #endif #define major(dev) gnu_dev_major (dev) #define minor(dev) gnu_dev_minor (dev) #define makedev(maj, min) gnu_dev_makedev (maj, min) #endif /* sys/sysmacros.h */ sys/termios.h 0000644 00000000112 15063602043 0007206 0 ustar 00 #ifndef _SYS_TERMIOS_H #define _SYS_TERMIOS_H #include <termios.h> #endif sys/time.h 0000644 00000015000 15063602043 0006464 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIME_H #define _SYS_TIME_H 1 #include <features.h> #include <bits/types.h> #include <bits/types/time_t.h> #include <bits/types/struct_timeval.h> #ifndef __suseconds_t_defined typedef __suseconds_t suseconds_t; # define __suseconds_t_defined #endif #include <sys/select.h> __BEGIN_DECLS #ifdef __USE_GNU /* Macros for converting between `struct timeval' and `struct timespec'. */ # define TIMEVAL_TO_TIMESPEC(tv, ts) { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } # define TIMESPEC_TO_TIMEVAL(tv, ts) { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } #endif #ifdef __USE_MISC /* Structure crudely representing a timezone. This is obsolete and should never be used. */ struct timezone { int tz_minuteswest; /* Minutes west of GMT. */ int tz_dsttime; /* Nonzero if DST is ever in effect. */ }; typedef struct timezone *__restrict __timezone_ptr_t; #else typedef void *__restrict __timezone_ptr_t; #endif /* Get the current time of day and timezone information, putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. Returns 0 on success, -1 on errors. NOTE: This form of timezone information is obsolete. Use the functions and variables declared in <time.h> instead. */ extern int gettimeofday (struct timeval *__restrict __tv, __timezone_ptr_t __tz) __THROW __nonnull ((1)); #ifdef __USE_MISC /* Set the current time of day and timezone information. This call is restricted to the super-user. */ extern int settimeofday (const struct timeval *__tv, const struct timezone *__tz) __THROW; /* Adjust the current time of day by the amount in DELTA. If OLDDELTA is not NULL, it is filled in with the amount of time adjustment remaining to be done from the last `adjtime' call. This call is restricted to the super-user. */ extern int adjtime (const struct timeval *__delta, struct timeval *__olddelta) __THROW; #endif /* Values for the first argument to `getitimer' and `setitimer'. */ enum __itimer_which { /* Timers run in real time. */ ITIMER_REAL = 0, #define ITIMER_REAL ITIMER_REAL /* Timers run only when the process is executing. */ ITIMER_VIRTUAL = 1, #define ITIMER_VIRTUAL ITIMER_VIRTUAL /* Timers run when the process is executing and when the system is executing on behalf of the process. */ ITIMER_PROF = 2 #define ITIMER_PROF ITIMER_PROF }; /* Type of the second argument to `getitimer' and the second and third arguments `setitimer'. */ struct itimerval { /* Value to put into `it_value' when the timer expires. */ struct timeval it_interval; /* Time to the next timer expiration. */ struct timeval it_value; }; #if defined __USE_GNU && !defined __cplusplus /* Use the nicer parameter type only in GNU mode and not for C++ since the strict C++ rules prevent the automatic promotion. */ typedef enum __itimer_which __itimer_which_t; #else typedef int __itimer_which_t; #endif /* Set *VALUE to the current setting of timer WHICH. Return 0 on success, -1 on errors. */ extern int getitimer (__itimer_which_t __which, struct itimerval *__value) __THROW; /* Set the timer WHICH to *NEW. If OLD is not NULL, set *OLD to the old value of timer WHICH. Returns 0 on success, -1 on errors. */ extern int setitimer (__itimer_which_t __which, const struct itimerval *__restrict __new, struct itimerval *__restrict __old) __THROW; /* Change the access time of FILE to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ extern int utimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); #ifdef __USE_MISC /* Same as `utimes', but does not follow symbolic links. */ extern int lutimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); /* Same as `utimes', but takes an open file descriptor instead of a name. */ extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW; #endif #ifdef __USE_GNU /* Change the access time of FILE relative to FD to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ extern int futimesat (int __fd, const char *__file, const struct timeval __tvp[2]) __THROW; #endif #ifdef __USE_MISC /* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */ # define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) # define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) # define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) # define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ if ((result)->tv_usec >= 1000000) \ { \ ++(result)->tv_sec; \ (result)->tv_usec -= 1000000; \ } \ } while (0) # define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ } while (0) #endif /* Misc. */ __END_DECLS #endif /* sys/time.h */ sys/timeb.h 0000644 00000002540 15063602043 0006633 0 ustar 00 /* Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMEB_H #define _SYS_TIMEB_H 1 #include <features.h> #include <bits/types/time_t.h> __BEGIN_DECLS /* Structure returned by the `ftime' function. */ struct timeb { time_t time; /* Seconds since epoch, as from `time'. */ unsigned short int millitm; /* Additional milliseconds. */ short int timezone; /* Minutes west of GMT. */ short int dstflag; /* Nonzero if Daylight Savings Time used. */ }; /* Fill in TIMEBUF with information about the current time. */ extern int ftime (struct timeb *__timebuf); __END_DECLS #endif /* sys/timeb.h */ sys/timerfd.h 0000644 00000003521 15063602043 0007165 0 ustar 00 /* Copyright (C) 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMERFD_H #define _SYS_TIMERFD_H 1 #include <time.h> #include <bits/types/struct_itimerspec.h> /* Get the platform-dependent flags. */ #include <bits/timerfd.h> /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ enum { TFD_TIMER_ABSTIME = 1 << 0, #define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME TFD_TIMER_CANCEL_ON_SET = 1 << 1 #define TFD_TIMER_CANCEL_ON_SET TFD_TIMER_CANCEL_ON_SET }; __BEGIN_DECLS /* Return file descriptor for new interval timer source. */ extern int timerfd_create (__clockid_t __clock_id, int __flags) __THROW; /* Set next expiration time of interval timer source UFD to UTMR. If FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is absolute. Optionally return the old expiration time in OTMR. */ extern int timerfd_settime (int __ufd, int __flags, const struct itimerspec *__utmr, struct itimerspec *__otmr) __THROW; /* Return the next expiration time of UFD. */ extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; __END_DECLS #endif /* sys/timerfd.h */ sys/times.h 0000644 00000003074 15063602043 0006657 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 4.5.2 Process Times <sys/times.h> */ #ifndef _SYS_TIMES_H #define _SYS_TIMES_H 1 #include <features.h> #include <bits/types/clock_t.h> __BEGIN_DECLS /* Structure describing CPU time used by a process and its children. */ struct tms { clock_t tms_utime; /* User CPU time. */ clock_t tms_stime; /* System CPU time. */ clock_t tms_cutime; /* User CPU time of dead children. */ clock_t tms_cstime; /* System CPU time of dead children. */ }; /* Store the CPU time used by this process and all its dead children (and their dead children) in BUFFER. Return the elapsed real time, or (clock_t) -1 for errors. All times are in CLK_TCKths of a second. */ extern clock_t times (struct tms *__buffer) __THROW; __END_DECLS #endif /* sys/times.h */ sys/timex.h 0000644 00000004235 15063602043 0006664 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMEX_H #define _SYS_TIMEX_H 1 #include <features.h> #include <sys/time.h> /* These definitions from linux/timex.h as of 2.6.30. */ #include <bits/timex.h> #define NTP_API 4 /* NTP API version */ struct ntptimeval { struct timeval time; /* current time (ro) */ long int maxerror; /* maximum error (us) (ro) */ long int esterror; /* estimated error (us) (ro) */ long int tai; /* TAI offset (ro) */ long int __glibc_reserved1; long int __glibc_reserved2; long int __glibc_reserved3; long int __glibc_reserved4; }; /* Clock states (time_state) */ #define TIME_OK 0 /* clock synchronized, no leap second */ #define TIME_INS 1 /* insert leap second */ #define TIME_DEL 2 /* delete leap second */ #define TIME_OOP 3 /* leap second in progress */ #define TIME_WAIT 4 /* leap second has occurred */ #define TIME_ERROR 5 /* clock not synchronized */ #define TIME_BAD TIME_ERROR /* bw compat */ /* Maximum time constant of the PLL. */ #define MAXTC 6 __BEGIN_DECLS extern int __adjtimex (struct timex *__ntx) __THROW; extern int adjtimex (struct timex *__ntx) __THROW; #ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), ntp_gettimex); #else extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; # define ntp_gettime ntp_gettimex #endif extern int ntp_adjtime (struct timex *__tntx) __THROW; __END_DECLS #endif /* sys/timex.h */ sys/ttychars.h 0000644 00000004703 15063602043 0007377 0 ustar 00 /*- * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ttychars.h 8.2 (Berkeley) 1/4/94 */ /* * 4.3 COMPATIBILITY FILE * * User visible structures and constants related to terminal handling. */ #ifndef _SYS_TTYCHARS_H #define _SYS_TTYCHARS_H 1 struct ttychars { char tc_erase; /* erase last character */ char tc_kill; /* erase entire line */ char tc_intrc; /* interrupt */ char tc_quitc; /* quit */ char tc_startc; /* start output */ char tc_stopc; /* stop output */ char tc_eofc; /* end-of-file */ char tc_brkc; /* input delimiter (like nl) */ char tc_suspc; /* stop process signal */ char tc_dsuspc; /* delayed stop process signal */ char tc_rprntc; /* reprint line */ char tc_flushc; /* flush output (toggles) */ char tc_werasc; /* word erase */ char tc_lnextc; /* literal next character */ }; #ifdef __USE_OLD_TTY #include <sys/ttydefaults.h> /* to pick up character defaults */ #endif #endif /* sys/ttychars.h */ sys/ttydefaults.h 0000644 00000006760 15063602043 0010113 0 ustar 00 /*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 */ /* * System wide defaults for terminal state. Linux version. */ #ifndef _SYS_TTYDEFAULTS_H_ #define _SYS_TTYDEFAULTS_H_ /* * Defaults on "first" open. */ #define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) #define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) #define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) #define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) #define TTYDEF_SPEED (B9600) /* * Control Character Defaults */ #define CTRL(x) (x&037) #define CEOF CTRL('d') #ifdef _POSIX_VDISABLE # define CEOL _POSIX_VDISABLE #else # define CEOL '\0' /* XXX avoid _POSIX_VDISABLE */ #endif #define CERASE 0177 #define CINTR CTRL('c') #ifdef _POSIX_VDISABLE # define CSTATUS _POSIX_VDISABLE #else # define CSTATUS '\0' /* XXX avoid _POSIX_VDISABLE */ #endif #define CKILL CTRL('u') #define CMIN 1 #define CQUIT 034 /* FS, ^\ */ #define CSUSP CTRL('z') #define CTIME 0 #define CDSUSP CTRL('y') #define CSTART CTRL('q') #define CSTOP CTRL('s') #define CLNEXT CTRL('v') #define CDISCARD CTRL('o') #define CWERASE CTRL('w') #define CREPRINT CTRL('r') #define CEOT CEOF /* compat */ #define CBRK CEOL #define CRPRNT CREPRINT #define CFLUSH CDISCARD /* PROTECTED INCLUSION ENDS HERE */ #endif /* !_SYS_TTYDEFAULTS_H_ */ /* * #define TTYDEFCHARS to include an array of default control characters. */ #ifdef TTYDEFCHARS cc_t ttydefchars[NCCS] = { CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE }; #undef TTYDEFCHARS #endif sys/types.h 0000644 00000013120 15063602043 0006673 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h> */ #ifndef _SYS_TYPES_H #define _SYS_TYPES_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #ifdef __USE_MISC # ifndef __u_char_defined typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; # define __u_char_defined # endif typedef __loff_t loff_t; #endif #ifndef __ino_t_defined # ifndef __USE_FILE_OFFSET64 typedef __ino_t ino_t; # else typedef __ino64_t ino_t; # endif # define __ino_t_defined #endif #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined typedef __ino64_t ino64_t; # define __ino64_t_defined #endif #ifndef __dev_t_defined typedef __dev_t dev_t; # define __dev_t_defined #endif #ifndef __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined #endif #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #ifndef __nlink_t_defined typedef __nlink_t nlink_t; # define __nlink_t_defined #endif #ifndef __uid_t_defined typedef __uid_t uid_t; # define __uid_t_defined #endif #ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined #endif #if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; # define __off64_t_defined #endif #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif #if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \ && !defined __id_t_defined typedef __id_t id_t; # define __id_t_defined #endif #ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined #endif #ifdef __USE_MISC # ifndef __daddr_t_defined typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; # define __daddr_t_defined # endif #endif #if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined typedef __key_t key_t; # define __key_t_defined #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # include <bits/types/clock_t.h> #endif #include <bits/types/clockid_t.h> #include <bits/types/time_t.h> #include <bits/types/timer_t.h> #ifdef __USE_XOPEN # ifndef __useconds_t_defined typedef __useconds_t useconds_t; # define __useconds_t_defined # endif # ifndef __suseconds_t_defined typedef __suseconds_t suseconds_t; # define __suseconds_t_defined # endif #endif #define __need_size_t #include <stddef.h> #ifdef __USE_MISC /* Old compatibility names for C types. */ typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; #endif /* These size-specific names are used by some of the inet code. */ #include <bits/stdint-intn.h> /* These were defined by ISO C without the first `_'. */ typedef __uint8_t u_int8_t; typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; #if __GNUC_PREREQ (2, 7) typedef int register_t __attribute__ ((__mode__ (__word__))); #else typedef int register_t; #endif /* Some code from BIND tests this macro to see if the types above are defined. */ #define __BIT_TYPES_DEFINED__ 1 #ifdef __USE_MISC /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */ # include <endian.h> /* It also defines `fd_set' and the FD_* macros for `select'. */ # include <sys/select.h> #endif /* Use misc. */ #if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \ && !defined __blksize_t_defined typedef __blksize_t blksize_t; # define __blksize_t_defined #endif /* Types from the Large File Support interface. */ #ifndef __USE_FILE_OFFSET64 # ifndef __blkcnt_t_defined typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ # define __blkcnt_t_defined # endif # ifndef __fsblkcnt_t_defined typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #else # ifndef __blkcnt_t_defined typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ # define __blkcnt_t_defined # endif # ifndef __fsblkcnt_t_defined typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ # define __fsblkcnt_t_defined # endif # ifndef __fsfilcnt_t_defined typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ # define __fsfilcnt_t_defined # endif #endif #ifdef __USE_LARGEFILE64 typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ #endif /* Now add the thread types. */ #if defined __USE_POSIX199506 || defined __USE_UNIX98 # include <bits/pthreadtypes.h> #endif __END_DECLS #endif /* sys/types.h */ sys/ucontext.h 0000644 00000013321 15063602043 0007403 0 ustar 00 /* Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UCONTEXT_H #define _SYS_UCONTEXT_H 1 #include <features.h> #include <bits/types.h> #include <bits/types/sigset_t.h> #include <bits/types/stack_t.h> #ifdef __USE_MISC # define __ctx(fld) fld #else # define __ctx(fld) __ ## fld #endif #ifdef __x86_64__ /* Type for general register. */ __extension__ typedef long long int greg_t; /* Number of general registers. */ #define __NGREG 23 #ifdef __USE_MISC # define NGREG __NGREG #endif /* Container for all general registers. */ typedef greg_t gregset_t[__NGREG]; #ifdef __USE_GNU /* Number of each register in the `gregset_t' array. */ enum { REG_R8 = 0, # define REG_R8 REG_R8 REG_R9, # define REG_R9 REG_R9 REG_R10, # define REG_R10 REG_R10 REG_R11, # define REG_R11 REG_R11 REG_R12, # define REG_R12 REG_R12 REG_R13, # define REG_R13 REG_R13 REG_R14, # define REG_R14 REG_R14 REG_R15, # define REG_R15 REG_R15 REG_RDI, # define REG_RDI REG_RDI REG_RSI, # define REG_RSI REG_RSI REG_RBP, # define REG_RBP REG_RBP REG_RBX, # define REG_RBX REG_RBX REG_RDX, # define REG_RDX REG_RDX REG_RAX, # define REG_RAX REG_RAX REG_RCX, # define REG_RCX REG_RCX REG_RSP, # define REG_RSP REG_RSP REG_RIP, # define REG_RIP REG_RIP REG_EFL, # define REG_EFL REG_EFL REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */ # define REG_CSGSFS REG_CSGSFS REG_ERR, # define REG_ERR REG_ERR REG_TRAPNO, # define REG_TRAPNO REG_TRAPNO REG_OLDMASK, # define REG_OLDMASK REG_OLDMASK REG_CR2 # define REG_CR2 REG_CR2 }; #endif struct _libc_fpxreg { unsigned short int __ctx(significand)[4]; unsigned short int __ctx(exponent); unsigned short int __glibc_reserved1[3]; }; struct _libc_xmmreg { __uint32_t __ctx(element)[4]; }; struct _libc_fpstate { /* 64-bit FXSAVE format. */ __uint16_t __ctx(cwd); __uint16_t __ctx(swd); __uint16_t __ctx(ftw); __uint16_t __ctx(fop); __uint64_t __ctx(rip); __uint64_t __ctx(rdp); __uint32_t __ctx(mxcsr); __uint32_t __ctx(mxcr_mask); struct _libc_fpxreg _st[8]; struct _libc_xmmreg _xmm[16]; __uint32_t __glibc_reserved1[24]; }; /* Structure to describe FPU registers. */ typedef struct _libc_fpstate *fpregset_t; /* Context to describe whole processor state. */ typedef struct { gregset_t __ctx(gregs); /* Note that fpregs is a pointer. */ fpregset_t __ctx(fpregs); __extension__ unsigned long long __reserved1 [8]; } mcontext_t; /* Userlevel context. */ typedef struct ucontext_t { unsigned long int __ctx(uc_flags); struct ucontext_t *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; __extension__ unsigned long long int __ssp[4]; } ucontext_t; #else /* !__x86_64__ */ /* Type for general register. */ typedef int greg_t; /* Number of general registers. */ #define __NGREG 19 #ifdef __USE_MISC # define NGREG __NGREG #endif /* Container for all general registers. */ typedef greg_t gregset_t[__NGREG]; #ifdef __USE_GNU /* Number of each register is the `gregset_t' array. */ enum { REG_GS = 0, # define REG_GS REG_GS REG_FS, # define REG_FS REG_FS REG_ES, # define REG_ES REG_ES REG_DS, # define REG_DS REG_DS REG_EDI, # define REG_EDI REG_EDI REG_ESI, # define REG_ESI REG_ESI REG_EBP, # define REG_EBP REG_EBP REG_ESP, # define REG_ESP REG_ESP REG_EBX, # define REG_EBX REG_EBX REG_EDX, # define REG_EDX REG_EDX REG_ECX, # define REG_ECX REG_ECX REG_EAX, # define REG_EAX REG_EAX REG_TRAPNO, # define REG_TRAPNO REG_TRAPNO REG_ERR, # define REG_ERR REG_ERR REG_EIP, # define REG_EIP REG_EIP REG_CS, # define REG_CS REG_CS REG_EFL, # define REG_EFL REG_EFL REG_UESP, # define REG_UESP REG_UESP REG_SS # define REG_SS REG_SS }; #endif /* Definitions taken from the kernel headers. */ struct _libc_fpreg { unsigned short int __ctx(significand)[4]; unsigned short int __ctx(exponent); }; struct _libc_fpstate { unsigned long int __ctx(cw); unsigned long int __ctx(sw); unsigned long int __ctx(tag); unsigned long int __ctx(ipoff); unsigned long int __ctx(cssel); unsigned long int __ctx(dataoff); unsigned long int __ctx(datasel); struct _libc_fpreg _st[8]; unsigned long int __ctx(status); }; /* Structure to describe FPU registers. */ typedef struct _libc_fpstate *fpregset_t; /* Context to describe whole processor state. */ typedef struct { gregset_t __ctx(gregs); /* Due to Linux's history we have to use a pointer here. The SysV/i386 ABI requires a struct with the values. */ fpregset_t __ctx(fpregs); unsigned long int __ctx(oldmask); unsigned long int __ctx(cr2); } mcontext_t; /* Userlevel context. */ typedef struct ucontext_t { unsigned long int __ctx(uc_flags); struct ucontext_t *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; unsigned long int __ssp[4]; } ucontext_t; #endif /* !__x86_64__ */ #undef __ctx #endif /* sys/ucontext.h */ sys/uio.h 0000644 00000014207 15063602043 0006332 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UIO_H #define _SYS_UIO_H 1 #include <features.h> #include <sys/types.h> #include <bits/types/struct_iovec.h> #include <bits/uio_lim.h> #ifdef __IOV_MAX # define UIO_MAXIOV __IOV_MAX #else # undef UIO_MAXIOV #endif __BEGIN_DECLS /* Read data from file descriptor FD, and put the result in the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. The buffers are filled in the order specified. Operates just like 'read' (see <unistd.h>) except that data are put in IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count) __wur; /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD. The data is written in the order specified. Operates just like 'write' (see <unistd.h>) except that the data are taken from IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count) __wur; #ifdef __USE_MISC # ifndef __USE_FILE_OFFSET64 /* Read data from file descriptor FD at the given position OFFSET without change the file pointer, and put the result in the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. The buffers are filled in the order specified. Operates just like 'pread' (see <unistd.h>) except that data are put in IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count, __off_t __offset) __wur; /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD at the given position OFFSET without change the file pointer. The data is written in the order specified. Operates just like 'pwrite' (see <unistd.h>) except that the data are taken from IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count, __off_t __offset) __wur; # else # ifdef __REDIRECT extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset), preadv64) __wur; extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset), pwritev64) __wur; # else # define preadv preadv64 # define pwritev pwritev64 # endif # endif # ifdef __USE_LARGEFILE64 /* Read data from file descriptor FD at the given position OFFSET without change the file pointer, and put the result in the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. The buffers are filled in the order specified. Operates just like 'pread' (see <unistd.h>) except that data are put in IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset) __wur; /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD at the given position OFFSET without change the file pointer. The data is written in the order specified. Operates just like 'pwrite' (see <unistd.h>) except that the data are taken from IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset) __wur; # endif #endif /* Use misc. */ #ifdef __USE_GNU # ifndef __USE_FILE_OFFSET64 /* Same as preadv but with an additional flag argumenti defined at uio.h. */ extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count, __off_t __offset, int ___flags) __wur; /* Same as preadv but with an additional flag argument defined at uio.h. */ extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count, __off_t __offset, int __flags) __wur; # else # ifdef __REDIRECT extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset, int __flags), pwritev64v2) __wur; extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset, int __flags), preadv64v2) __wur; # else # define preadv2 preadv64v2 # define pwritev2 pwritev64v2 # endif # endif # ifdef __USE_LARGEFILE64 /* Same as preadv but with an additional flag argumenti defined at uio.h. */ extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec, int __count, __off64_t __offset, int ___flags) __wur; /* Same as preadv but with an additional flag argument defined at uio.h. */ extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev, int __count, __off64_t __offset, int __flags) __wur; # endif #endif /* Use GNU. */ __END_DECLS /* Some operating systems provide system-specific extensions to this header. */ #ifdef __USE_GNU # include <bits/uio-ext.h> #endif #endif /* sys/uio.h */ sys/un.h 0000644 00000002654 15063602043 0006163 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UN_H #define _SYS_UN_H 1 #include <sys/cdefs.h> /* Get the definition of the macro to define the common sockaddr members. */ #include <bits/sockaddr.h> __BEGIN_DECLS /* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ struct sockaddr_un { __SOCKADDR_COMMON (sun_); char sun_path[108]; /* Path name. */ }; #ifdef __USE_MISC # include <string.h> /* For prototype of `strlen'. */ /* Evaluate to actual length of the `sockaddr_un' structure. */ # define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ + strlen ((ptr)->sun_path)) #endif __END_DECLS #endif /* sys/un.h */ sys/unistd.h 0000644 00000000024 15063602043 0007034 0 ustar 00 #include <unistd.h> sys/user.h 0000644 00000012127 15063602043 0006513 0 ustar 00 /* Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_USER_H #define _SYS_USER_H 1 /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ #ifdef __x86_64__ struct user_fpregs_struct { unsigned short int cwd; unsigned short int swd; unsigned short int ftw; unsigned short int fop; __extension__ unsigned long long int rip; __extension__ unsigned long long int rdp; unsigned int mxcsr; unsigned int mxcr_mask; unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ unsigned int padding[24]; }; struct user_regs_struct { __extension__ unsigned long long int r15; __extension__ unsigned long long int r14; __extension__ unsigned long long int r13; __extension__ unsigned long long int r12; __extension__ unsigned long long int rbp; __extension__ unsigned long long int rbx; __extension__ unsigned long long int r11; __extension__ unsigned long long int r10; __extension__ unsigned long long int r9; __extension__ unsigned long long int r8; __extension__ unsigned long long int rax; __extension__ unsigned long long int rcx; __extension__ unsigned long long int rdx; __extension__ unsigned long long int rsi; __extension__ unsigned long long int rdi; __extension__ unsigned long long int orig_rax; __extension__ unsigned long long int rip; __extension__ unsigned long long int cs; __extension__ unsigned long long int eflags; __extension__ unsigned long long int rsp; __extension__ unsigned long long int ss; __extension__ unsigned long long int fs_base; __extension__ unsigned long long int gs_base; __extension__ unsigned long long int ds; __extension__ unsigned long long int es; __extension__ unsigned long long int fs; __extension__ unsigned long long int gs; }; struct user { struct user_regs_struct regs; int u_fpvalid; struct user_fpregs_struct i387; __extension__ unsigned long long int u_tsize; __extension__ unsigned long long int u_dsize; __extension__ unsigned long long int u_ssize; __extension__ unsigned long long int start_code; __extension__ unsigned long long int start_stack; __extension__ long long int signal; int reserved; __extension__ union { struct user_regs_struct* u_ar0; __extension__ unsigned long long int __u_ar0_word; }; __extension__ union { struct user_fpregs_struct* u_fpstate; __extension__ unsigned long long int __u_fpstate_word; }; __extension__ unsigned long long int magic; char u_comm [32]; __extension__ unsigned long long int u_debugreg [8]; }; #else /* These are the 32-bit x86 structures. */ struct user_fpregs_struct { long int cwd; long int swd; long int twd; long int fip; long int fcs; long int foo; long int fos; long int st_space [20]; }; struct user_fpxregs_struct { unsigned short int cwd; unsigned short int swd; unsigned short int twd; unsigned short int fop; long int fip; long int fcs; long int foo; long int fos; long int mxcsr; long int reserved; long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ long int padding[56]; }; struct user_regs_struct { long int ebx; long int ecx; long int edx; long int esi; long int edi; long int ebp; long int eax; long int xds; long int xes; long int xfs; long int xgs; long int orig_eax; long int eip; long int xcs; long int eflags; long int esp; long int xss; }; struct user { struct user_regs_struct regs; int u_fpvalid; struct user_fpregs_struct i387; unsigned long int u_tsize; unsigned long int u_dsize; unsigned long int u_ssize; unsigned long int start_code; unsigned long int start_stack; long int signal; int reserved; struct user_regs_struct* u_ar0; struct user_fpregs_struct* u_fpstate; unsigned long int magic; char u_comm [32]; int u_debugreg [8]; }; #endif /* __x86_64__ */ #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) #define NBPG PAGE_SIZE #define UPAGES 1 #define HOST_TEXT_START_ADDR (u.start_code) #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) #endif /* _SYS_USER_H */ sys/utsname.h 0000644 00000004660 15063602043 0007214 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 4.4 System Identification <sys/utsname.h> */ #ifndef _SYS_UTSNAME_H #define _SYS_UTSNAME_H 1 #include <features.h> __BEGIN_DECLS #include <bits/utsname.h> #ifndef _UTSNAME_SYSNAME_LENGTH # define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_NODENAME_LENGTH # define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_RELEASE_LENGTH # define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_VERSION_LENGTH # define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH #endif #ifndef _UTSNAME_MACHINE_LENGTH # define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH #endif /* Structure describing the system and machine. */ struct utsname { /* Name of the implementation of the operating system. */ char sysname[_UTSNAME_SYSNAME_LENGTH]; /* Name of this node on the network. */ char nodename[_UTSNAME_NODENAME_LENGTH]; /* Current release level of this implementation. */ char release[_UTSNAME_RELEASE_LENGTH]; /* Current version level of this release. */ char version[_UTSNAME_VERSION_LENGTH]; /* Name of the hardware type the system is running on. */ char machine[_UTSNAME_MACHINE_LENGTH]; #if _UTSNAME_DOMAIN_LENGTH - 0 /* Name of the domain of this node on the network. */ # ifdef __USE_GNU char domainname[_UTSNAME_DOMAIN_LENGTH]; # else char __domainname[_UTSNAME_DOMAIN_LENGTH]; # endif #endif }; #ifdef __USE_MISC /* Note that SVID assumes all members have the same size. */ # define SYS_NMLN _UTSNAME_LENGTH #endif /* Put information about the system in NAME. */ extern int uname (struct utsname *__name) __THROW; __END_DECLS #endif /* sys/utsname.h */ sys/vfs.h 0000644 00000000241 15063602043 0006325 0 ustar 00 /* Other systems declare `struct statfs' et al in <sys/vfs.h>, so we have this file to be compatible with programs expecting it. */ #include <sys/statfs.h> sys/vlimit.h 0000644 00000003527 15063602043 0007045 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_VLIMIT_H #define _SYS_VLIMIT_H 1 #include <features.h> __BEGIN_DECLS /* This interface is obsolete, and is superseded by <sys/resource.h>. */ /* Kinds of resource limit. */ enum __vlimit_resource { /* Setting this non-zero makes it impossible to raise limits. Only the super-use can set it to zero. This is not implemented in recent versions of BSD, nor by the GNU C library. */ LIM_NORAISE, /* CPU time available for each process (seconds). */ LIM_CPU, /* Largest file which can be created (bytes). */ LIM_FSIZE, /* Maximum size of the data segment (bytes). */ LIM_DATA, /* Maximum size of the stack segment (bytes). */ LIM_STACK, /* Largest core file that will be created (bytes). */ LIM_CORE, /* Resident set size (bytes). */ LIM_MAXRSS }; /* This means no limit. */ #define INFINITY 0x7fffffff /* Set the soft limit for RESOURCE to be VALUE. Returns 0 for success, -1 for failure. */ extern int vlimit (enum __vlimit_resource __resource, int __value) __THROW; __END_DECLS #endif /* sys/vlimit.h */ sys/vm86.h 0000644 00000002256 15063602043 0006337 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_VM86_H #define _SYS_VM86_H 1 #include <features.h> #ifdef __x86_64__ # error This header is unsupported on x86-64. #else /* Get constants and data types from kernel header file. */ # include <asm/vm86.h> __BEGIN_DECLS /* Enter virtual 8086 mode. */ extern int vm86 (unsigned long int __subfunction, struct vm86plus_struct *__info) __THROW; __END_DECLS # endif #endif /* _SYS_VM86_H */ sys/vt.h 0000644 00000000026 15063602043 0006161 0 ustar 00 #include <linux/vt.h> sys/vtimes.h 0000644 00000004636 15063602043 0007052 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_VTIMES_H #define _SYS_VTIMES_H 1 #include <features.h> __BEGIN_DECLS /* This interface is obsolete; use `getrusage' instead. */ /* Granularity of the `vm_utime' and `vm_stime' fields of a `struct vtimes'. (This is the frequency of the machine's power supply, in Hz.) */ #define VTIMES_UNITS_PER_SECOND 60 struct vtimes { /* User time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ int vm_utime; /* System time used in units of 1/VTIMES_UNITS_PER_SECOND seconds. */ int vm_stime; /* Amount of data and stack memory used (kilobyte-seconds). */ unsigned int vm_idsrss; /* Amount of text memory used (kilobyte-seconds). */ unsigned int vm_ixrss; /* Maximum resident set size (text, data, and stack) (kilobytes). */ int vm_maxrss; /* Number of hard page faults (i.e. those that required I/O). */ int vm_majflt; /* Number of soft page faults (i.e. those serviced by reclaiming a page from the list of pages awaiting reallocation. */ int vm_minflt; /* Number of times a process was swapped out of physical memory. */ int vm_nswap; /* Number of input operations via the file system. Note: This and `ru_oublock' do not include operations with the cache. */ int vm_inblk; /* Number of output operations via the file system. */ int vm_oublk; }; /* If CURRENT is not NULL, write statistics for the current process into *CURRENT. If CHILD is not NULL, write statistics for all terminated child processes into *CHILD. Returns 0 for success, -1 for failure. */ extern int vtimes (struct vtimes * __current, struct vtimes * __child) __THROW; __END_DECLS #endif /* sys/vtimes.h */ sys/wait.h 0000644 00000012744 15063602043 0006506 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 3.2.1 Wait for Process Termination <sys/wait.h> */ #ifndef _SYS_WAIT_H #define _SYS_WAIT_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 # include <signal.h> #endif #if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8 /* Some older standards require the contents of struct rusage to be defined here. */ # include <bits/types/struct_rusage.h> #endif /* These macros could also be defined in <stdlib.h>. */ #if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8) /* This will define the `W*' macros for the flag bits to `waitpid', `wait3', and `wait4'. */ # include <bits/waitflags.h> /* This will define all the `__W*' macros. */ # include <bits/waitstatus.h> # define WEXITSTATUS(status) __WEXITSTATUS (status) # define WTERMSIG(status) __WTERMSIG (status) # define WSTOPSIG(status) __WSTOPSIG (status) # define WIFEXITED(status) __WIFEXITED (status) # define WIFSIGNALED(status) __WIFSIGNALED (status) # define WIFSTOPPED(status) __WIFSTOPPED (status) # ifdef __WIFCONTINUED # define WIFCONTINUED(status) __WIFCONTINUED (status) # endif #endif /* <stdlib.h> not included. */ #ifdef __USE_MISC # define WCOREFLAG __WCOREFLAG # define WCOREDUMP(status) __WCOREDUMP (status) # define W_EXITCODE(ret, sig) __W_EXITCODE (ret, sig) # define W_STOPCODE(sig) __W_STOPCODE (sig) #endif /* The following values are used by the `waitid' function. */ #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 typedef enum { P_ALL, /* Wait for any child. */ P_PID, /* Wait for specified process. */ P_PGID /* Wait for members of process group. */ } idtype_t; #endif /* Wait for a child to die. When one does, put its status in *STAT_LOC and return its process ID. For errors, return (pid_t) -1. This function is a cancellation point and therefore not marked with __THROW. */ extern __pid_t wait (int *__stat_loc); #ifdef __USE_MISC /* Special values for the PID argument to `waitpid' and `wait4'. */ # define WAIT_ANY (-1) /* Any process. */ # define WAIT_MYPGRP 0 /* Any process in my process group. */ #endif /* Wait for a child matching PID to die. If PID is greater than 0, match any process whose process ID is PID. If PID is (pid_t) -1, match any process. If PID is (pid_t) 0, match any process with the same process group as the current process. If PID is less than -1, match any process whose process group is the absolute value of PID. If the WNOHANG bit is set in OPTIONS, and that child is not already dead, return (pid_t) 0. If successful, return PID and store the dead child's status in STAT_LOC. Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. This function is a cancellation point and therefore not marked with __THROW. */ extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 # ifndef __id_t_defined typedef __id_t id_t; # define __id_t_defined # endif # include <bits/types/siginfo_t.h> /* Wait for a childing matching IDTYPE and ID to change the status and place appropriate information in *INFOP. If IDTYPE is P_PID, match any process whose process ID is ID. If IDTYPE is P_PGID, match any process whose process group is ID. If IDTYPE is P_ALL, match any process. If the WNOHANG bit is set in OPTIONS, and that child is not already dead, clear *INFOP and return 0. If successful, store exit code and status in *INFOP. This function is a cancellation point and therefore not marked with __THROW. */ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop, int __options); #endif #if defined __USE_MISC \ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) /* This being here makes the prototypes valid whether or not we have already included <sys/resource.h> to define `struct rusage'. */ struct rusage; /* Wait for a child to exit. When one does, put its status in *STAT_LOC and return its process ID. For errors return (pid_t) -1. If USAGE is not nil, store information about the child's resource usage there. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. */ extern __pid_t wait3 (int *__stat_loc, int __options, struct rusage * __usage) __THROWNL; #endif #ifdef __USE_MISC /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options, struct rusage *__usage) __THROWNL; #endif /* Use misc. */ __END_DECLS #endif /* sys/wait.h */ sys/xattr.h 0000644 00000010262 15063602043 0006675 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_XATTR_H #define _SYS_XATTR_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* The following constants should be used for the fifth parameter of `*setxattr'. */ #ifndef __USE_KERNEL_XATTR_DEFS enum { XATTR_CREATE = 1, /* set value, fail if attr already exists. */ #define XATTR_CREATE XATTR_CREATE XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */ #define XATTR_REPLACE XATTR_REPLACE }; #endif /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern int setxattr (const char *__path, const char *__name, const void *__value, size_t __size, int __flags) __THROW; /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long), not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern int lsetxattr (const char *__path, const char *__name, const void *__value, size_t __size, int __flags) __THROW; /* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern int fsetxattr (int __fd, const char *__name, const void *__value, size_t __size, int __flags) __THROW; /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern ssize_t getxattr (const char *__path, const char *__name, void *__value, size_t __size) __THROW; /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is SIZE bytes long), not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern ssize_t lgetxattr (const char *__path, const char *__name, void *__value, size_t __size) __THROW; /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE bytes long). Return 0 on success, -1 for errors. */ extern ssize_t fgetxattr (int __fd, const char *__name, void *__value, size_t __size) __THROW; /* List attributes of the file pointed to by PATH into the user-supplied buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */ extern ssize_t listxattr (const char *__path, char *__list, size_t __size) __THROW; /* List attributes of the file pointed to by PATH into the user-supplied buffer LIST (which is SIZE bytes big), not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern ssize_t llistxattr (const char *__path, char *__list, size_t __size) __THROW; /* List attributes of the file descriptor FD into the user-supplied buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */ extern ssize_t flistxattr (int __fd, char *__list, size_t __size) __THROW; /* Remove the attribute NAME from the file pointed to by PATH. Return 0 on success, -1 for errors. */ extern int removexattr (const char *__path, const char *__name) __THROW; /* Remove the attribute NAME from the file pointed to by PATH, not following symlinks for the last pathname component. Return 0 on success, -1 for errors. */ extern int lremovexattr (const char *__path, const char *__name) __THROW; /* Remove the attribute NAME from the file descriptor FD. Return 0 on success, -1 for errors. */ extern int fremovexattr (int __fd, const char *__name) __THROW; __END_DECLS #endif /* sys/xattr.h */ sys/capability.h 0000644 00000016101 15063602043 0007652 0 ustar 00 /* * <sys/capability.h> * * Copyright (C) 1997 Aleph One * Copyright (C) 1997,8, 2008,19,20 Andrew G. Morgan <morgan@kernel.org> * * defunct POSIX.1e Standard: 25.2 Capabilities <sys/capability.h> */ #ifndef _SYS_CAPABILITY_H #define _SYS_CAPABILITY_H #ifdef __cplusplus extern "C" { #endif /* * This file complements the kernel file by providing prototype * information for the user library. */ #include <sys/types.h> #include <stdint.h> #include <linux/types.h> #ifndef __user #define __user #endif #include <linux/capability.h> /* * POSIX capability types */ /* * Opaque capability handle (defined internally by libcap) * internal capability representation */ typedef struct _cap_struct *cap_t; /* "external" capability representation is a (void *) */ /* * This is the type used to identify capabilities */ typedef int cap_value_t; /* * libcap initialized first unnamed capability of the running kernel. * capsh includes a runtime test to flag when this is larger than * what is known to libcap... Time for a new libcap release! */ extern cap_value_t cap_max_bits(void); /* * Set identifiers */ typedef enum { CAP_EFFECTIVE = 0, /* Specifies the effective flag */ CAP_PERMITTED = 1, /* Specifies the permitted flag */ CAP_INHERITABLE = 2 /* Specifies the inheritable flag */ } cap_flag_t; typedef enum { CAP_IAB_INH = 2, CAP_IAB_AMB = 3, CAP_IAB_BOUND = 4 } cap_iab_vector_t; /* * An opaque generalization of the inheritable bits that includes both * what ambient bits to raise and what bounding bits to *lower* (aka * drop). None of these bits once set, using cap_iab_set(), affect * the running process but are consulted, through the execve() system * call, by the kernel. Note, the ambient bits ('A') of the running * process are fragile with respect to other aspects of the "posix" * (cap_t) operations: most importantly, 'A' cannot ever hold bits not * present in the intersection of 'pI' and 'pP'. The kernel * immediately drops all ambient caps whenever such a situation * arises. Typically, the ambient bits are used to support a naive * capability inheritance model - at odds with the POSIX (sic) model * of inheritance where inherited (pI) capabilities need to also be * wanted by the executed binary (fI) in order to become raised * through exec. */ typedef struct cap_iab_s *cap_iab_t; /* * These are the states available to each capability */ typedef enum { CAP_CLEAR=0, /* The flag is cleared/disabled */ CAP_SET=1 /* The flag is set/enabled */ } cap_flag_value_t; /* * User-space capability manipulation routines */ typedef unsigned cap_mode_t; #define CAP_MODE_UNCERTAIN ((cap_mode_t) 0) #define CAP_MODE_NOPRIV ((cap_mode_t) 1) #define CAP_MODE_PURE1E_INIT ((cap_mode_t) 2) #define CAP_MODE_PURE1E ((cap_mode_t) 3) /* libcap/cap_alloc.c */ extern cap_t cap_dup(cap_t); extern int cap_free(void *); extern cap_t cap_init(void); extern cap_iab_t cap_iab_init(void); /* libcap/cap_flag.c */ extern int cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *); extern int cap_set_flag(cap_t, cap_flag_t, int, const cap_value_t *, cap_flag_value_t); extern int cap_clear(cap_t); extern int cap_clear_flag(cap_t, cap_flag_t); extern cap_flag_value_t cap_iab_get_vector(cap_iab_t, cap_iab_vector_t, cap_value_t); extern int cap_iab_set_vector(cap_iab_t, cap_iab_vector_t, cap_value_t, cap_flag_value_t); extern int cap_iab_fill(cap_iab_t, cap_iab_vector_t, cap_t, cap_flag_t); /* libcap/cap_file.c */ extern cap_t cap_get_fd(int); extern cap_t cap_get_file(const char *); extern uid_t cap_get_nsowner(cap_t); extern int cap_set_fd(int, cap_t); extern int cap_set_file(const char *, cap_t); extern int cap_set_nsowner(cap_t, uid_t); /* libcap/cap_proc.c */ extern cap_t cap_get_proc(void); extern cap_t cap_get_pid(pid_t); extern int cap_set_proc(cap_t); extern int cap_get_bound(cap_value_t); extern int cap_drop_bound(cap_value_t); #define CAP_IS_SUPPORTED(cap) (cap_get_bound(cap) >= 0) extern int cap_get_ambient(cap_value_t); extern int cap_set_ambient(cap_value_t, cap_flag_value_t); extern int cap_reset_ambient(void); #define CAP_AMBIENT_SUPPORTED() (cap_get_ambient(CAP_CHOWN) >= 0) /* libcap/cap_extint.c */ extern ssize_t cap_size(cap_t); extern ssize_t cap_copy_ext(void *, cap_t, ssize_t); extern cap_t cap_copy_int(const void *); /* libcap/cap_text.c */ extern cap_t cap_from_text(const char *); extern char * cap_to_text(cap_t, ssize_t *); extern int cap_from_name(const char *, cap_value_t *); extern char * cap_to_name(cap_value_t); extern char * cap_iab_to_text(cap_iab_t iab); extern cap_iab_t cap_iab_from_text(const char *text); #define CAP_DIFFERS(result, flag) (((result) & (1 << (flag))) != 0) extern int cap_compare(cap_t, cap_t); /* libcap/cap_proc.c */ extern void cap_set_syscall(long int (*new_syscall)(long int, long int, long int, long int), long int (*new_syscall6)(long int, long int, long int, long int, long int, long int, long int)); extern int cap_set_mode(cap_mode_t flavor); extern cap_mode_t cap_get_mode(void); extern const char *cap_mode_name(cap_mode_t flavor); extern unsigned cap_get_secbits(void); extern int cap_set_secbits(unsigned bits); extern int cap_prctl(long int pr_cmd, long int arg1, long int arg2, long int arg3, long int arg4, long int arg5); extern int cap_prctlw(long int pr_cmd, long int arg1, long int arg2, long int arg3, long int arg4, long int arg5); extern int cap_setuid(uid_t uid); extern int cap_setgroups(gid_t gid, size_t ngroups, const gid_t groups[]); extern cap_iab_t cap_iab_get_proc(void); extern int cap_iab_set_proc(cap_iab_t iab); typedef struct cap_launch_s *cap_launch_t; extern cap_launch_t cap_new_launcher(const char *arg0, const char * const *argv, const char * const *envp); extern void cap_launcher_callback(cap_launch_t attr, int (callback_fn)(void *detail)); extern void cap_launcher_setuid(cap_launch_t attr, uid_t uid); extern void cap_launcher_setgroups(cap_launch_t attr, gid_t gid, int ngroups, const gid_t *groups); extern void cap_launcher_set_mode(cap_launch_t attr, cap_mode_t flavor); extern cap_iab_t cap_launcher_set_iab(cap_launch_t attr, cap_iab_t iab); extern void cap_launcher_set_chroot(cap_launch_t attr, const char *chroot); extern pid_t cap_launch(cap_launch_t attr, void *data); /* * system calls - look to libc for function to system call * mapping. Note, libcap does not use capset directly, but permits the * cap_set_syscall() to redirect the system call function. */ extern int capget(cap_user_header_t header, cap_user_data_t data); extern int capset(cap_user_header_t header, const cap_user_data_t data); /* deprecated - use cap_get_pid() */ extern int capgetp(pid_t pid, cap_t cap_d); /* not valid with filesystem capability support - use cap_set_proc() */ extern int capsetp(pid_t pid, cap_t cap_d); #ifdef __cplusplus } #endif #endif /* _SYS_CAPABILITY_H */ sys/psx_syscall.h 0000644 00000005421 15063602044 0010101 0 ustar 00 /* * Copyright (c) 2019 Andrew G. Morgan <morgan@kernel.org> * * This header, and the -lpsx library, provide a number of things to * support POSIX semantics for syscalls associated with the pthread * library. Linking this code is tricky and is done as follows: * * ld ... -lpsx -lpthread --wrap=pthread_create * or, gcc ... -lpsx -lpthread -Wl,-wrap,pthread_create * * glibc provides a subset of this functionality natively through the * nptl:setxid mechanism and could implement psx_syscall() directly * using that style of functionality but, as of 2019-11-30, the setxid * mechanism is limited to 9 specific set*() syscalls that do not * support the syscall6 API (needed for prctl functions and the ambient * capabilities set for example). */ #ifndef _SYS_PSX_SYSCALL_H #define _SYS_PSX_SYSCALL_H #ifdef __cplusplus extern "C" { #endif #include <pthread.h> /* * psx_syscall performs the specified syscall on all psx registered * threads. The mechanism by which this occurs is much less efficient * than a standard system call on Linux, so it should only be used * when POSIX semantics are required to change process relevant * security state. * * Glibc has native support for POSIX semantics on setgroups() and the * 8 set*[gu]id() functions. So, there is no need to use psx_syscall() * for these calls. This call exists for all the other system calls * that need to maintain parity on all pthreads of a program. * * Some macrology is used to allow the caller to provide only as many * arguments as needed, thus psx_syscall() cannot be used as a * function pointer. For those situations, we define psx_syscall3() * and psx_syscall6(). */ #define psx_syscall(syscall_nr, ...) \ __psx_syscall(syscall_nr, __VA_ARGS__, (long int) 6, (long int) 5, \ (long int) 4, (long int) 3, (long int) 2, \ (long int) 1, (long int) 0) long int __psx_syscall(long int syscall_nr, ...); long int psx_syscall3(long int syscall_nr, long int arg1, long int arg2, long int arg3); long int psx_syscall6(long int syscall_nr, long int arg1, long int arg2, long int arg3, long int arg4, long int arg5, long int arg6); /* * This function should be used by systems to obtain pointers to the * two syscall functions provided by the PSX library. A linkage trick * is to define this function as weak in a library that can optionally * use libpsx and then, should the caller link -lpsx, that library can * implicitly use these POSIX semantics syscalls. See libcap for an * example of this useage. */ void psx_load_syscalls(long int (**syscall_fn)(long int, long int, long int, long int), long int (**syscall6_fn)(long int, long int, long int, long int, long int, long int, long int)); #ifdef __cplusplus } #endif #endif /* _SYS_PSX_SYSCALL_H */ sys/acct.h 0000644 00000006340 15063602044 0006450 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_ACCT_H #define _SYS_ACCT_H 1 #include <sys/types.h> #include <stdint.h> #include <endian.h> #include <bits/types/time_t.h> __BEGIN_DECLS #define ACCT_COMM 16 /* comp_t is a 16-bit "floating" point number with a 3-bit base 8 exponent and a 13-bit fraction. See linux/kernel/acct.c for the specific encoding system used. */ typedef uint16_t comp_t; struct acct { char ac_flag; /* Flags. */ uint16_t ac_uid; /* Real user ID. */ uint16_t ac_gid; /* Real group ID. */ uint16_t ac_tty; /* Controlling terminal. */ uint32_t ac_btime; /* Beginning time. */ comp_t ac_utime; /* User time. */ comp_t ac_stime; /* System time. */ comp_t ac_etime; /* Elapsed time. */ comp_t ac_mem; /* Average memory usage. */ comp_t ac_io; /* Chars transferred. */ comp_t ac_rw; /* Blocks read or written. */ comp_t ac_minflt; /* Minor pagefaults. */ comp_t ac_majflt; /* Major pagefaults. */ comp_t ac_swaps; /* Number of swaps. */ uint32_t ac_exitcode; /* Process exitcode. */ char ac_comm[ACCT_COMM+1]; /* Command name. */ char ac_pad[10]; /* Padding bytes. */ }; struct acct_v3 { char ac_flag; /* Flags */ char ac_version; /* Always set to ACCT_VERSION */ uint16_t ac_tty; /* Control Terminal */ uint32_t ac_exitcode; /* Exitcode */ uint32_t ac_uid; /* Real User ID */ uint32_t ac_gid; /* Real Group ID */ uint32_t ac_pid; /* Process ID */ uint32_t ac_ppid; /* Parent Process ID */ uint32_t ac_btime; /* Process Creation Time */ float ac_etime; /* Elapsed Time */ comp_t ac_utime; /* User Time */ comp_t ac_stime; /* System Time */ comp_t ac_mem; /* Average Memory Usage */ comp_t ac_io; /* Chars Transferred */ comp_t ac_rw; /* Blocks Read or Written */ comp_t ac_minflt; /* Minor Pagefaults */ comp_t ac_majflt; /* Major Pagefaults */ comp_t ac_swaps; /* Number of Swaps */ char ac_comm[ACCT_COMM]; /* Command Name */ }; enum { AFORK = 0x01, /* Has executed fork, but no exec. */ ASU = 0x02, /* Used super-user privileges. */ ACORE = 0x08, /* Dumped core. */ AXSIG = 0x10 /* Killed by a signal. */ }; #if __BYTE_ORDER == __BIG_ENDIAN # define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */ #else # define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */ #endif #define AHZ 100 /* Switch process accounting on and off. */ extern int acct (const char *__filename) __THROW; __END_DECLS #endif /* sys/acct.h */ sys/auxv.h 0000644 00000002353 15063602044 0006521 0 ustar 00 /* Access to the auxiliary vector. Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_AUXV_H #define _SYS_AUXV_H 1 #include <elf.h> #include <sys/cdefs.h> #include <bits/hwcap.h> __BEGIN_DECLS /* Return the value associated with an Elf*_auxv_t type from the auxv list passed to the program on startup. If TYPE was not present in the auxv list, returns zero and sets errno to ENOENT. */ extern unsigned long int getauxval (unsigned long int __type) __THROW; __END_DECLS #endif /* sys/auxv.h */ sys/bitypes.h 0000644 00000000126 15063602044 0007211 0 ustar 00 /* The GNU <sys/types.h> defines all the necessary types. */ #include <sys/types.h> sys/cdefs.h 0000644 00000050312 15063602044 0006620 0 ustar 00 /* Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_CDEFS_H #define _SYS_CDEFS_H 1 /* We are almost always included from features.h. */ #ifndef _FEATURES_H # include <features.h> #endif /* The GNU libc does not support any K&R compilers or the traditional mode of ISO C compilers anymore. Check for some of the combinations not anymore supported. */ #if defined __GNUC__ && !defined __STDC__ # error "You need a ISO C conforming compiler to use the glibc headers" #endif /* Some user header file might have defined this before. */ #undef __P #undef __PMT #ifdef __GNUC__ /* All functions, except those with callbacks or those that synchronize memory, are leaf functions. */ # if __GNUC_PREREQ (4, 6) && !defined _LIBC # define __LEAF , __leaf__ # define __LEAF_ATTR __attribute__ ((__leaf__)) # else # define __LEAF # define __LEAF_ATTR # endif /* GCC can always grok prototypes. For C++ programs we add throw() to help it optimize the function calls. But this works only with gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions as non-throwing using a function attribute since programs can use the -fexceptions options for C code as well. */ # if !defined __cplusplus && __GNUC_PREREQ (3, 3) # define __THROW __attribute__ ((__nothrow__ __LEAF)) # define __THROWNL __attribute__ ((__nothrow__)) # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # define __THROWNL throw () # define __NTH(fct) __LEAF_ATTR fct throw () # define __NTHNL(fct) fct throw () # else # define __THROW # define __THROWNL # define __NTH(fct) fct # define __NTHNL(fct) fct # endif # endif #else /* Not GCC. */ # if (defined __cplusplus \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) # define __inline inline # else # define __inline /* No inline functions. */ # endif # define __THROW # define __THROWNL # define __NTH(fct) fct #endif /* GCC. */ /* Compilers that are not clang may object to #if defined __clang__ && __has_extension(...) even though they do not need to evaluate the right-hand side of the &&. */ #if defined __clang__ && defined __has_extension # define __glibc_clang_has_extension(ext) __has_extension (ext) #else # define __glibc_clang_has_extension(ext) 0 #endif /* These two macros are not used in glibc anymore. They are kept here only because some other projects expect the macros to be defined. */ #define __P(args) args #define __PMT(args) args /* For these things, GCC behaves the ANSI way normally, and the non-ANSI way under -traditional. */ #define __CONCAT(x,y) x ## y #define __STRING(x) #x /* This is not a typedef so `const __ptr_t' does the right thing. */ #define __ptr_t void * /* C++ needs to know that types and declarations are C, not C++. */ #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS # define __END_DECLS #endif /* Fortify support. */ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ #if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ || __GNUC_PREREQ (12, 0)) # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) #else # define __glibc_objsize0(__o) __bos0 (__o) # define __glibc_objsize(__o) __bos (__o) #endif #if __USE_FORTIFY_LEVEL > 0 /* Compile time conditions to choose between the regular, _chk and _chk_warn variants. These conditions should get evaluated to constant and optimized away. */ #define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) #define __glibc_unsigned_or_positive(__l) \ ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ || (__builtin_constant_p (__l) && (__l) > 0)) /* Length is known to be safe at compile time if the __L * __S <= __OBJSZ condition can be folded to a constant and if it is true, or unknown (-1) */ #define __glibc_safe_or_unknown_len(__l, __s, __osz) \ ((__builtin_constant_p (__osz) && (__osz) == (__SIZE_TYPE__) -1) \ || (__glibc_unsigned_or_positive (__l) \ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ (__s), (__osz))) \ && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), (__s), (__osz)))) /* Conversely, we know at compile time that the length is unsafe if the __L * __S <= __OBJSZ condition can be folded to a constant and if it is false. */ #define __glibc_unsafe_len(__l, __s, __osz) \ (__glibc_unsigned_or_positive (__l) \ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ __s, __osz)) \ && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz)) /* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be declared. */ #define __glibc_fortify(f, __l, __s, __osz, ...) \ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \ : __ ## f ## _chk (__VA_ARGS__, __osz))) /* Fortify function f, where object size argument passed to f is the number of elements and not total size. */ #define __glibc_fortify_n(f, __l, __s, __osz, ...) \ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) #endif #if __GNUC_PREREQ (4,3) # define __warndecl(name, msg) \ extern void name (void) __attribute__((__warning__ (msg))) # define __warnattr(msg) __attribute__((__warning__ (msg))) # define __errordecl(name, msg) \ extern void name (void) __attribute__((__error__ (msg))) #else # define __warndecl(name, msg) extern void name (void) # define __warnattr(msg) # define __errordecl(name, msg) extern void name (void) #endif /* Support for flexible arrays. Headers that should use flexible arrays only if they're "real" (e.g. only if they won't affect sizeof()) should test #if __glibc_c99_flexarr_available. */ #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif __GNUC_PREREQ (2,97) /* GCC 2.97 supports C99 flexible array members as an extension, even when in C89 mode or compiling C++ (any version). */ # define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif defined __GNUC__ /* Pre-2.97 GCC did not support C99 flexible arrays but did have an equivalent extension with slightly different notation. */ # define __flexarr [0] # define __glibc_c99_flexarr_available 1 #else /* Some other non-C99 compiler. Approximate with [1]. */ # define __flexarr [1] # define __glibc_c99_flexarr_available 0 #endif /* __asm__ ("xyz") is used throughout the headers to rename functions at the assembly language level. This is wrapped by the __REDIRECT macro, in order to support compilers that can do this some other way. When compilers don't support asm-names at all, we have to do preprocessor tricks instead (which don't have exactly the right semantics, but it's the best we can do). Example: int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ #if defined __GNUC__ && __GNUC__ >= 2 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) # ifdef __cplusplus # define __REDIRECT_NTH(name, proto, alias) \ name proto __THROW __asm__ (__ASMNAME (#alias)) # define __REDIRECT_NTHNL(name, proto, alias) \ name proto __THROWNL __asm__ (__ASMNAME (#alias)) # else # define __REDIRECT_NTH(name, proto, alias) \ name proto __asm__ (__ASMNAME (#alias)) __THROW # define __REDIRECT_NTHNL(name, proto, alias) \ name proto __asm__ (__ASMNAME (#alias)) __THROWNL # endif # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) # define __ASMNAME2(prefix, cname) __STRING (prefix) cname /* #elif __SOME_OTHER_COMPILER__ # define __REDIRECT(name, proto, alias) name proto; \ _Pragma("let " #name " = " #alias) */ #endif /* GCC has various useful declarations that can be made with the `__attribute__' syntax. All of the ways we use this do fine if they are omitted for compilers that don't understand it. */ #if !defined __GNUC__ || __GNUC__ < 2 # define __attribute__(xyz) /* Ignore */ #endif /* At some point during the gcc 2.96 development the `malloc' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,96) # define __attribute_malloc__ __attribute__ ((__malloc__)) #else # define __attribute_malloc__ /* Ignore */ #endif /* Tell the compiler which arguments to an allocation function indicate the size of the allocation. */ #if __GNUC_PREREQ (4, 3) # define __attribute_alloc_size__(params) \ __attribute__ ((__alloc_size__ params)) #else # define __attribute_alloc_size__(params) /* Ignore. */ #endif /* At some point during the gcc 2.96 development the `pure' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,96) # define __attribute_pure__ __attribute__ ((__pure__)) #else # define __attribute_pure__ /* Ignore */ #endif /* This declaration tells the compiler that the value is constant. */ #if __GNUC_PREREQ (2,5) # define __attribute_const__ __attribute__ ((__const__)) #else # define __attribute_const__ /* Ignore */ #endif /* At some point during the gcc 3.1 development the `used' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (3,1) # define __attribute_used__ __attribute__ ((__used__)) # define __attribute_noinline__ __attribute__ ((__noinline__)) #else # define __attribute_used__ __attribute__ ((__unused__)) # define __attribute_noinline__ /* Ignore */ #endif /* Since version 3.2, gcc allows marking deprecated functions. */ #if __GNUC_PREREQ (3,2) # define __attribute_deprecated__ __attribute__ ((__deprecated__)) #else # define __attribute_deprecated__ /* Ignore */ #endif /* Since version 4.5, gcc also allows one to specify the message printed when a deprecated function is used. clang claims to be gcc 4.2, but may also support this feature. */ #if __GNUC_PREREQ (4,5) || \ __glibc_clang_has_extension (__attribute_deprecated_with_message__) # define __attribute_deprecated_msg__(msg) \ __attribute__ ((__deprecated__ (msg))) #else # define __attribute_deprecated_msg__(msg) __attribute_deprecated__ #endif /* At some point during the gcc 2.8 development the `format_arg' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. If several `format_arg' attributes are given for the same function, in gcc-3.0 and older, all but the last one are ignored. In newer gccs, all designated arguments are considered. */ #if __GNUC_PREREQ (2,8) # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) #else # define __attribute_format_arg__(x) /* Ignore */ #endif /* At some point during the gcc 2.97 development the `strfmon' format attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ #if __GNUC_PREREQ (2,97) # define __attribute_format_strfmon__(a,b) \ __attribute__ ((__format__ (__strfmon__, a, b))) #else # define __attribute_format_strfmon__(a,b) /* Ignore */ #endif /* The nonull function attribute allows to mark pointer parameters which must not be NULL. */ #if __GNUC_PREREQ (3,3) # define __nonnull(params) __attribute__ ((__nonnull__ params)) #else # define __nonnull(params) #endif /* If fortification mode, we warn about unused results of certain function calls which can lead to problems. */ #if __GNUC_PREREQ (3,4) # define __attribute_warn_unused_result__ \ __attribute__ ((__warn_unused_result__)) # if __USE_FORTIFY_LEVEL > 0 # define __wur __attribute_warn_unused_result__ # endif #else # define __attribute_warn_unused_result__ /* empty */ #endif #ifndef __wur # define __wur /* Ignore */ #endif /* Forces a function to be always inlined. */ #if __GNUC_PREREQ (3,2) /* The Linux kernel defines __always_inline in stddef.h (283d7573), and it conflicts with this definition. Therefore undefine it first to allow either header to be included first. */ # undef __always_inline # define __always_inline __inline __attribute__ ((__always_inline__)) #else # undef __always_inline # define __always_inline __inline #endif /* Associate error messages with the source location of the call site rather than with the source location inside the function. */ #if __GNUC_PREREQ (4,3) # define __attribute_artificial__ __attribute__ ((__artificial__)) #else # define __attribute_artificial__ /* Ignore */ #endif /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions older than 4.3 may define these macros and still not guarantee GNU inlining semantics. clang++ identifies itself as gcc-4.2, but has support for GNU inlining semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and __GNUC_GNU_INLINE__ macro definitions. */ #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ || defined __GNUC_GNU_INLINE__))) # if defined __GNUC_STDC_INLINE__ || defined __cplusplus # define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) # define __extern_always_inline \ extern __always_inline __attribute__ ((__gnu_inline__)) # else # define __extern_inline extern __inline # define __extern_always_inline extern __always_inline # endif #endif #ifdef __extern_always_inline # define __fortify_function __extern_always_inline __attribute_artificial__ #endif /* GCC 4.3 and above allow passing all anonymous arguments of an __extern_always_inline function to some other vararg function. */ #if __GNUC_PREREQ (4,3) # define __va_arg_pack() __builtin_va_arg_pack () # define __va_arg_pack_len() __builtin_va_arg_pack_len () #endif /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before version 2.8. */ #if !__GNUC_PREREQ (2,8) # define __extension__ /* Ignore */ #endif /* __restrict is known in EGCS 1.2 and above. */ #if !__GNUC_PREREQ (2,92) # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __restrict restrict # else # define __restrict /* Ignore */ # endif #endif /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is array_name[restrict] GCC 3.1 supports this. */ #if __GNUC_PREREQ (3,1) && !defined __GNUG__ # define __restrict_arr __restrict #else # ifdef __GNUC__ # define __restrict_arr /* Not supported in old GCC. */ # else # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __restrict_arr restrict # else /* Some other non-C99 compiler. */ # define __restrict_arr /* Not supported. */ # endif # endif #endif #if __GNUC__ >= 3 # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) # define __glibc_likely(cond) __builtin_expect ((cond), 1) #else # define __glibc_unlikely(cond) (cond) # define __glibc_likely(cond) (cond) #endif #ifdef __has_attribute # define __glibc_has_attribute(attr) __has_attribute (attr) #else # define __glibc_has_attribute(attr) 0 #endif #if (!defined _Noreturn \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ && !__GNUC_PREREQ (4,7)) # if __GNUC_PREREQ (2,8) # define _Noreturn __attribute__ ((__noreturn__)) # else # define _Noreturn # endif #endif #if __GNUC_PREREQ (8, 0) /* Describes a char array whose address can safely be passed as the first argument to strncpy and strncat, as the char array is not necessarily a NUL-terminated string. */ # define __attribute_nonstring__ __attribute__ ((__nonstring__)) #else # define __attribute_nonstring__ #endif #if (!defined _Static_assert && !defined __cplusplus \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) # define _Static_assert(expr, diagnostic) \ extern int (*__Static_assert_function (void)) \ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] #endif #include <bits/wordsize.h> #include <bits/long-double.h> #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH # define __LDBL_COMPAT 1 # ifdef __REDIRECT # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) # define __LDBL_REDIR(name, proto) \ __LDBL_REDIR1 (name, proto, __nldbl_##name) # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) # define __LDBL_REDIR_NTH(name, proto) \ __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) # define __LDBL_REDIR1_DECL(name, alias) \ extern __typeof (name) name __asm (__ASMNAME (#alias)); # define __LDBL_REDIR_DECL(name) \ extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); # define __REDIRECT_LDBL(name, proto, alias) \ __LDBL_REDIR1 (name, proto, __nldbl_##alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) # endif #endif #if !defined __LDBL_COMPAT || !defined __REDIRECT # define __LDBL_REDIR1(name, proto, alias) name proto # define __LDBL_REDIR(name, proto) name proto # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW # define __LDBL_REDIR_NTH(name, proto) name proto __THROW # define __LDBL_REDIR_DECL(name) # ifdef __REDIRECT # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) # define __REDIRECT_NTH_LDBL(name, proto, alias) \ __REDIRECT_NTH (name, proto, alias) # endif #endif /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is intended for use in preprocessor macros. Note: MESSAGE must be a _single_ string; concatenation of string literals is not supported. */ #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) # define __glibc_macro_warning1(message) _Pragma (#message) # define __glibc_macro_warning(message) \ __glibc_macro_warning1 (GCC warning message) #else # define __glibc_macro_warning(msg) #endif /* Generic selection (ISO C11) is a C-only feature, available in GCC since version 4.9. Previous versions do not provide generic selection, even though they might set __STDC_VERSION__ to 201112L, when in -std=c11 mode. Thus, we must check for !defined __GNUC__ when testing __STDC_VERSION__ for generic selection support. On the other hand, Clang also defines __GNUC__, so a clang-specific check is required to enable the use of generic selection. */ #if !defined __cplusplus \ && (__GNUC_PREREQ (4, 9) \ || __glibc_clang_has_extension (c_generic_selections) \ || (!defined __GNUC__ && defined __STDC_VERSION__ \ && __STDC_VERSION__ >= 201112L)) # define __HAVE_GENERIC_SELECTION 1 #else # define __HAVE_GENERIC_SELECTION 0 #endif #endif /* sys/cdefs.h */ sys/debugreg.h 0000644 00000006767 15063602044 0007337 0 ustar 00 /* Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_DEBUGREG_H #define _SYS_DEBUGREG_H 1 /* Indicate the register numbers for a number of the specific debug registers. Registers 0-3 contain the addresses we wish to trap on */ #define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */ #define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */ #define DR_STATUS 6 /* u_debugreg[DR_STATUS] */ #define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */ /* Define a few things for the status register. We can use this to determine which debugging register was responsible for the trap. The other bits are either reserved or not of interest to us. */ #define DR_TRAP0 (0x1) /* db0 */ #define DR_TRAP1 (0x2) /* db1 */ #define DR_TRAP2 (0x4) /* db2 */ #define DR_TRAP3 (0x8) /* db3 */ #define DR_STEP (0x4000) /* single-step */ #define DR_SWITCH (0x8000) /* task switch */ /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 bits - each field corresponds to one of the four debug registers, and indicates what types of access we trap on, and how large the data field is that we are looking at */ #define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */ #define DR_CONTROL_SIZE 4 /* 4 control bits per register */ #define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */ #define DR_RW_WRITE (0x1) #define DR_RW_READ (0x3) #define DR_LEN_1 (0x0) /* Settings for data length to trap on */ #define DR_LEN_2 (0x4) #define DR_LEN_4 (0xC) #ifdef __x86_64__ # define DR_LEN_8 (0x8) #endif /* The low byte to the control register determine which registers are enabled. There are 4 fields of two bits. One bit is "local", meaning that the processor will reset the bit after a task switch and the other is global meaning that we have to explicitly reset the bit. With linux, you can use either one, since we explicitly zero the register when we enter kernel mode. */ #define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */ #define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */ #define DR_ENABLE_SIZE 2 /* 2 enable bits per register */ #define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */ #define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */ /* The second byte to the control register has a few special things. */ #ifdef __x86_64__ # define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00ULL) /* Reserved */ #else # define DR_CONTROL_RESERVED (0x00FC00U) /* Reserved */ #endif #define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ #define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ #endif /* sys/debugreg.h */ sys/dir.h 0000644 00000001631 15063602044 0006312 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_DIR_H #define _SYS_DIR_H 1 #include <features.h> #include <dirent.h> #define direct dirent #endif /* sys/dir.h */ sys/elf.h 0000644 00000001777 15063602044 0006315 0 ustar 00 /* Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_ELF_H #define _SYS_ELF_H 1 #ifdef __x86_64__ # error This header is unsupported on x86-64. #else # warning "This header is obsolete; use <sys/procfs.h> instead." # include <sys/procfs.h> #endif #endif /* _SYS_ELF_H */ sys/epoll.h 0000644 00000010472 15063602044 0006652 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EPOLL_H #define _SYS_EPOLL_H 1 #include <stdint.h> #include <sys/types.h> #include <bits/types/sigset_t.h> /* Get the platform-dependent flags. */ #include <bits/epoll.h> #ifndef __EPOLL_PACKED # define __EPOLL_PACKED #endif enum EPOLL_EVENTS { EPOLLIN = 0x001, #define EPOLLIN EPOLLIN EPOLLPRI = 0x002, #define EPOLLPRI EPOLLPRI EPOLLOUT = 0x004, #define EPOLLOUT EPOLLOUT EPOLLRDNORM = 0x040, #define EPOLLRDNORM EPOLLRDNORM EPOLLRDBAND = 0x080, #define EPOLLRDBAND EPOLLRDBAND EPOLLWRNORM = 0x100, #define EPOLLWRNORM EPOLLWRNORM EPOLLWRBAND = 0x200, #define EPOLLWRBAND EPOLLWRBAND EPOLLMSG = 0x400, #define EPOLLMSG EPOLLMSG EPOLLERR = 0x008, #define EPOLLERR EPOLLERR EPOLLHUP = 0x010, #define EPOLLHUP EPOLLHUP EPOLLRDHUP = 0x2000, #define EPOLLRDHUP EPOLLRDHUP EPOLLEXCLUSIVE = 1u << 28, #define EPOLLEXCLUSIVE EPOLLEXCLUSIVE EPOLLWAKEUP = 1u << 29, #define EPOLLWAKEUP EPOLLWAKEUP EPOLLONESHOT = 1u << 30, #define EPOLLONESHOT EPOLLONESHOT EPOLLET = 1u << 31 #define EPOLLET EPOLLET }; /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ #define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ #define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ #define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ typedef union epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64; } epoll_data_t; struct epoll_event { uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */ } __EPOLL_PACKED; __BEGIN_DECLS /* Creates an epoll instance. Returns an fd for the new instance. The "size" parameter is a hint specifying the number of file descriptors to be associated with the new instance. The fd returned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW; /* Same as epoll_create but with an FLAGS parameter. The unused SIZE parameter has been dropped. */ extern int epoll_create1 (int __flags) __THROW; /* Manipulate an epoll instance "epfd". Returns 0 in case of success, -1 in case of error ( the "errno" variable will contain the specific error code ) The "op" parameter is one of the EPOLL_CTL_* constants defined above. The "fd" parameter is the target of the operation. The "event" parameter describes which events the caller is interested in and any associated user data. */ extern int epoll_ctl (int __epfd, int __op, int __fd, struct epoll_event *__event) __THROW; /* Wait for events on an epoll instance "epfd". Returns the number of triggered events returned in "events" buffer. Or -1 in case of error with the "errno" variable set to the specific error code. The "events" parameter is a buffer that will contain triggered events. The "maxevents" is the maximum number of events to be returned ( usually size of "events" ). The "timeout" parameter specifies the maximum wait time in milliseconds (-1 == infinite). This function is a cancellation point and therefore not marked with __THROW. */ extern int epoll_wait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout); /* Same as epoll_wait, but the thread's signal mask is temporarily and atomically replaced with the one provided as parameter. This function is a cancellation point and therefore not marked with __THROW. */ extern int epoll_pwait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout, const __sigset_t *__ss); __END_DECLS #endif /* sys/epoll.h */ sys/errno.h 0000644 00000000023 15063602044 0006653 0 ustar 00 #include <errno.h> sys/eventfd.h 0000644 00000002567 15063602044 0007200 0 ustar 00 /* Copyright (C) 2007-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EVENTFD_H #define _SYS_EVENTFD_H 1 #include <stdint.h> /* Get the platform-dependent flags. */ #include <bits/eventfd.h> /* Type for event counter. */ typedef uint64_t eventfd_t; __BEGIN_DECLS /* Return file descriptor for generic event channel. Set initial value to COUNT. */ extern int eventfd (unsigned int __count, int __flags) __THROW; /* Read event counter and possibly wait for events. */ extern int eventfd_read (int __fd, eventfd_t *__value); /* Increment event counter. */ extern int eventfd_write (int __fd, eventfd_t __value); __END_DECLS #endif /* sys/eventfd.h */ selinux/av_permissions.h 0000644 00000177420 15063602044 0011460 0 ustar 00 #warning "Please remove any #include of this header in your source code." #warning "Instead, use string_to_av_perm() to map the permission name to a value." /* This file is automatically generated. Do not edit. */ #define COMMON_FILE__IOCTL 0x00000001UL #define COMMON_FILE__READ 0x00000002UL #define COMMON_FILE__WRITE 0x00000004UL #define COMMON_FILE__CREATE 0x00000008UL #define COMMON_FILE__GETATTR 0x00000010UL #define COMMON_FILE__SETATTR 0x00000020UL #define COMMON_FILE__LOCK 0x00000040UL #define COMMON_FILE__RELABELFROM 0x00000080UL #define COMMON_FILE__RELABELTO 0x00000100UL #define COMMON_FILE__APPEND 0x00000200UL #define COMMON_FILE__UNLINK 0x00000400UL #define COMMON_FILE__LINK 0x00000800UL #define COMMON_FILE__RENAME 0x00001000UL #define COMMON_FILE__EXECUTE 0x00002000UL #define COMMON_FILE__SWAPON 0x00004000UL #define COMMON_FILE__QUOTAON 0x00008000UL #define COMMON_FILE__MOUNTON 0x00010000UL #define COMMON_SOCKET__IOCTL 0x00000001UL #define COMMON_SOCKET__READ 0x00000002UL #define COMMON_SOCKET__WRITE 0x00000004UL #define COMMON_SOCKET__CREATE 0x00000008UL #define COMMON_SOCKET__GETATTR 0x00000010UL #define COMMON_SOCKET__SETATTR 0x00000020UL #define COMMON_SOCKET__LOCK 0x00000040UL #define COMMON_SOCKET__RELABELFROM 0x00000080UL #define COMMON_SOCKET__RELABELTO 0x00000100UL #define COMMON_SOCKET__APPEND 0x00000200UL #define COMMON_SOCKET__BIND 0x00000400UL #define COMMON_SOCKET__CONNECT 0x00000800UL #define COMMON_SOCKET__LISTEN 0x00001000UL #define COMMON_SOCKET__ACCEPT 0x00002000UL #define COMMON_SOCKET__GETOPT 0x00004000UL #define COMMON_SOCKET__SETOPT 0x00008000UL #define COMMON_SOCKET__SHUTDOWN 0x00010000UL #define COMMON_SOCKET__RECVFROM 0x00020000UL #define COMMON_SOCKET__SENDTO 0x00040000UL #define COMMON_SOCKET__RECV_MSG 0x00080000UL #define COMMON_SOCKET__SEND_MSG 0x00100000UL #define COMMON_SOCKET__NAME_BIND 0x00200000UL #define COMMON_IPC__CREATE 0x00000001UL #define COMMON_IPC__DESTROY 0x00000002UL #define COMMON_IPC__GETATTR 0x00000004UL #define COMMON_IPC__SETATTR 0x00000008UL #define COMMON_IPC__READ 0x00000010UL #define COMMON_IPC__WRITE 0x00000020UL #define COMMON_IPC__ASSOCIATE 0x00000040UL #define COMMON_IPC__UNIX_READ 0x00000080UL #define COMMON_IPC__UNIX_WRITE 0x00000100UL #define COMMON_DATABASE__CREATE 0x00000001UL #define COMMON_DATABASE__DROP 0x00000002UL #define COMMON_DATABASE__GETATTR 0x00000004UL #define COMMON_DATABASE__SETATTR 0x00000008UL #define COMMON_DATABASE__RELABELFROM 0x00000010UL #define COMMON_DATABASE__RELABELTO 0x00000020UL #define FILESYSTEM__MOUNT 0x00000001UL #define FILESYSTEM__REMOUNT 0x00000002UL #define FILESYSTEM__UNMOUNT 0x00000004UL #define FILESYSTEM__GETATTR 0x00000008UL #define FILESYSTEM__RELABELFROM 0x00000010UL #define FILESYSTEM__RELABELTO 0x00000020UL #define FILESYSTEM__TRANSITION 0x00000040UL #define FILESYSTEM__ASSOCIATE 0x00000080UL #define FILESYSTEM__QUOTAMOD 0x00000100UL #define FILESYSTEM__QUOTAGET 0x00000200UL #define DIR__IOCTL 0x00000001UL #define DIR__READ 0x00000002UL #define DIR__WRITE 0x00000004UL #define DIR__CREATE 0x00000008UL #define DIR__GETATTR 0x00000010UL #define DIR__SETATTR 0x00000020UL #define DIR__LOCK 0x00000040UL #define DIR__RELABELFROM 0x00000080UL #define DIR__RELABELTO 0x00000100UL #define DIR__APPEND 0x00000200UL #define DIR__UNLINK 0x00000400UL #define DIR__LINK 0x00000800UL #define DIR__RENAME 0x00001000UL #define DIR__EXECUTE 0x00002000UL #define DIR__SWAPON 0x00004000UL #define DIR__QUOTAON 0x00008000UL #define DIR__MOUNTON 0x00010000UL #define DIR__ADD_NAME 0x00020000UL #define DIR__REMOVE_NAME 0x00040000UL #define DIR__REPARENT 0x00080000UL #define DIR__SEARCH 0x00100000UL #define DIR__RMDIR 0x00200000UL #define DIR__OPEN 0x00400000UL #define FILE__IOCTL 0x00000001UL #define FILE__READ 0x00000002UL #define FILE__WRITE 0x00000004UL #define FILE__CREATE 0x00000008UL #define FILE__GETATTR 0x00000010UL #define FILE__SETATTR 0x00000020UL #define FILE__LOCK 0x00000040UL #define FILE__RELABELFROM 0x00000080UL #define FILE__RELABELTO 0x00000100UL #define FILE__APPEND 0x00000200UL #define FILE__UNLINK 0x00000400UL #define FILE__LINK 0x00000800UL #define FILE__RENAME 0x00001000UL #define FILE__EXECUTE 0x00002000UL #define FILE__SWAPON 0x00004000UL #define FILE__QUOTAON 0x00008000UL #define FILE__MOUNTON 0x00010000UL #define FILE__EXECUTE_NO_TRANS 0x00020000UL #define FILE__ENTRYPOINT 0x00040000UL #define FILE__EXECMOD 0x00080000UL #define FILE__OPEN 0x00100000UL #define LNK_FILE__IOCTL 0x00000001UL #define LNK_FILE__READ 0x00000002UL #define LNK_FILE__WRITE 0x00000004UL #define LNK_FILE__CREATE 0x00000008UL #define LNK_FILE__GETATTR 0x00000010UL #define LNK_FILE__SETATTR 0x00000020UL #define LNK_FILE__LOCK 0x00000040UL #define LNK_FILE__RELABELFROM 0x00000080UL #define LNK_FILE__RELABELTO 0x00000100UL #define LNK_FILE__APPEND 0x00000200UL #define LNK_FILE__UNLINK 0x00000400UL #define LNK_FILE__LINK 0x00000800UL #define LNK_FILE__RENAME 0x00001000UL #define LNK_FILE__EXECUTE 0x00002000UL #define LNK_FILE__SWAPON 0x00004000UL #define LNK_FILE__QUOTAON 0x00008000UL #define LNK_FILE__MOUNTON 0x00010000UL #define CHR_FILE__IOCTL 0x00000001UL #define CHR_FILE__READ 0x00000002UL #define CHR_FILE__WRITE 0x00000004UL #define CHR_FILE__CREATE 0x00000008UL #define CHR_FILE__GETATTR 0x00000010UL #define CHR_FILE__SETATTR 0x00000020UL #define CHR_FILE__LOCK 0x00000040UL #define CHR_FILE__RELABELFROM 0x00000080UL #define CHR_FILE__RELABELTO 0x00000100UL #define CHR_FILE__APPEND 0x00000200UL #define CHR_FILE__UNLINK 0x00000400UL #define CHR_FILE__LINK 0x00000800UL #define CHR_FILE__RENAME 0x00001000UL #define CHR_FILE__EXECUTE 0x00002000UL #define CHR_FILE__SWAPON 0x00004000UL #define CHR_FILE__QUOTAON 0x00008000UL #define CHR_FILE__MOUNTON 0x00010000UL #define CHR_FILE__EXECUTE_NO_TRANS 0x00020000UL #define CHR_FILE__ENTRYPOINT 0x00040000UL #define CHR_FILE__EXECMOD 0x00080000UL #define CHR_FILE__OPEN 0x00100000UL #define BLK_FILE__IOCTL 0x00000001UL #define BLK_FILE__READ 0x00000002UL #define BLK_FILE__WRITE 0x00000004UL #define BLK_FILE__CREATE 0x00000008UL #define BLK_FILE__GETATTR 0x00000010UL #define BLK_FILE__SETATTR 0x00000020UL #define BLK_FILE__LOCK 0x00000040UL #define BLK_FILE__RELABELFROM 0x00000080UL #define BLK_FILE__RELABELTO 0x00000100UL #define BLK_FILE__APPEND 0x00000200UL #define BLK_FILE__UNLINK 0x00000400UL #define BLK_FILE__LINK 0x00000800UL #define BLK_FILE__RENAME 0x00001000UL #define BLK_FILE__EXECUTE 0x00002000UL #define BLK_FILE__SWAPON 0x00004000UL #define BLK_FILE__QUOTAON 0x00008000UL #define BLK_FILE__MOUNTON 0x00010000UL #define BLK_FILE__OPEN 0x00020000UL #define SOCK_FILE__IOCTL 0x00000001UL #define SOCK_FILE__READ 0x00000002UL #define SOCK_FILE__WRITE 0x00000004UL #define SOCK_FILE__CREATE 0x00000008UL #define SOCK_FILE__GETATTR 0x00000010UL #define SOCK_FILE__SETATTR 0x00000020UL #define SOCK_FILE__LOCK 0x00000040UL #define SOCK_FILE__RELABELFROM 0x00000080UL #define SOCK_FILE__RELABELTO 0x00000100UL #define SOCK_FILE__APPEND 0x00000200UL #define SOCK_FILE__UNLINK 0x00000400UL #define SOCK_FILE__LINK 0x00000800UL #define SOCK_FILE__RENAME 0x00001000UL #define SOCK_FILE__EXECUTE 0x00002000UL #define SOCK_FILE__SWAPON 0x00004000UL #define SOCK_FILE__QUOTAON 0x00008000UL #define SOCK_FILE__MOUNTON 0x00010000UL #define FIFO_FILE__IOCTL 0x00000001UL #define FIFO_FILE__READ 0x00000002UL #define FIFO_FILE__WRITE 0x00000004UL #define FIFO_FILE__CREATE 0x00000008UL #define FIFO_FILE__GETATTR 0x00000010UL #define FIFO_FILE__SETATTR 0x00000020UL #define FIFO_FILE__LOCK 0x00000040UL #define FIFO_FILE__RELABELFROM 0x00000080UL #define FIFO_FILE__RELABELTO 0x00000100UL #define FIFO_FILE__APPEND 0x00000200UL #define FIFO_FILE__UNLINK 0x00000400UL #define FIFO_FILE__LINK 0x00000800UL #define FIFO_FILE__RENAME 0x00001000UL #define FIFO_FILE__EXECUTE 0x00002000UL #define FIFO_FILE__SWAPON 0x00004000UL #define FIFO_FILE__QUOTAON 0x00008000UL #define FIFO_FILE__MOUNTON 0x00010000UL #define FIFO_FILE__OPEN 0x00020000UL #define FD__USE 0x00000001UL #define SOCKET__IOCTL 0x00000001UL #define SOCKET__READ 0x00000002UL #define SOCKET__WRITE 0x00000004UL #define SOCKET__CREATE 0x00000008UL #define SOCKET__GETATTR 0x00000010UL #define SOCKET__SETATTR 0x00000020UL #define SOCKET__LOCK 0x00000040UL #define SOCKET__RELABELFROM 0x00000080UL #define SOCKET__RELABELTO 0x00000100UL #define SOCKET__APPEND 0x00000200UL #define SOCKET__BIND 0x00000400UL #define SOCKET__CONNECT 0x00000800UL #define SOCKET__LISTEN 0x00001000UL #define SOCKET__ACCEPT 0x00002000UL #define SOCKET__GETOPT 0x00004000UL #define SOCKET__SETOPT 0x00008000UL #define SOCKET__SHUTDOWN 0x00010000UL #define SOCKET__RECVFROM 0x00020000UL #define SOCKET__SENDTO 0x00040000UL #define SOCKET__RECV_MSG 0x00080000UL #define SOCKET__SEND_MSG 0x00100000UL #define SOCKET__NAME_BIND 0x00200000UL #define TCP_SOCKET__IOCTL 0x00000001UL #define TCP_SOCKET__READ 0x00000002UL #define TCP_SOCKET__WRITE 0x00000004UL #define TCP_SOCKET__CREATE 0x00000008UL #define TCP_SOCKET__GETATTR 0x00000010UL #define TCP_SOCKET__SETATTR 0x00000020UL #define TCP_SOCKET__LOCK 0x00000040UL #define TCP_SOCKET__RELABELFROM 0x00000080UL #define TCP_SOCKET__RELABELTO 0x00000100UL #define TCP_SOCKET__APPEND 0x00000200UL #define TCP_SOCKET__BIND 0x00000400UL #define TCP_SOCKET__CONNECT 0x00000800UL #define TCP_SOCKET__LISTEN 0x00001000UL #define TCP_SOCKET__ACCEPT 0x00002000UL #define TCP_SOCKET__GETOPT 0x00004000UL #define TCP_SOCKET__SETOPT 0x00008000UL #define TCP_SOCKET__SHUTDOWN 0x00010000UL #define TCP_SOCKET__RECVFROM 0x00020000UL #define TCP_SOCKET__SENDTO 0x00040000UL #define TCP_SOCKET__RECV_MSG 0x00080000UL #define TCP_SOCKET__SEND_MSG 0x00100000UL #define TCP_SOCKET__NAME_BIND 0x00200000UL #define TCP_SOCKET__CONNECTTO 0x00400000UL #define TCP_SOCKET__NEWCONN 0x00800000UL #define TCP_SOCKET__ACCEPTFROM 0x01000000UL #define TCP_SOCKET__NODE_BIND 0x02000000UL #define TCP_SOCKET__NAME_CONNECT 0x04000000UL #define UDP_SOCKET__IOCTL 0x00000001UL #define UDP_SOCKET__READ 0x00000002UL #define UDP_SOCKET__WRITE 0x00000004UL #define UDP_SOCKET__CREATE 0x00000008UL #define UDP_SOCKET__GETATTR 0x00000010UL #define UDP_SOCKET__SETATTR 0x00000020UL #define UDP_SOCKET__LOCK 0x00000040UL #define UDP_SOCKET__RELABELFROM 0x00000080UL #define UDP_SOCKET__RELABELTO 0x00000100UL #define UDP_SOCKET__APPEND 0x00000200UL #define UDP_SOCKET__BIND 0x00000400UL #define UDP_SOCKET__CONNECT 0x00000800UL #define UDP_SOCKET__LISTEN 0x00001000UL #define UDP_SOCKET__ACCEPT 0x00002000UL #define UDP_SOCKET__GETOPT 0x00004000UL #define UDP_SOCKET__SETOPT 0x00008000UL #define UDP_SOCKET__SHUTDOWN 0x00010000UL #define UDP_SOCKET__RECVFROM 0x00020000UL #define UDP_SOCKET__SENDTO 0x00040000UL #define UDP_SOCKET__RECV_MSG 0x00080000UL #define UDP_SOCKET__SEND_MSG 0x00100000UL #define UDP_SOCKET__NAME_BIND 0x00200000UL #define UDP_SOCKET__NODE_BIND 0x00400000UL #define RAWIP_SOCKET__IOCTL 0x00000001UL #define RAWIP_SOCKET__READ 0x00000002UL #define RAWIP_SOCKET__WRITE 0x00000004UL #define RAWIP_SOCKET__CREATE 0x00000008UL #define RAWIP_SOCKET__GETATTR 0x00000010UL #define RAWIP_SOCKET__SETATTR 0x00000020UL #define RAWIP_SOCKET__LOCK 0x00000040UL #define RAWIP_SOCKET__RELABELFROM 0x00000080UL #define RAWIP_SOCKET__RELABELTO 0x00000100UL #define RAWIP_SOCKET__APPEND 0x00000200UL #define RAWIP_SOCKET__BIND 0x00000400UL #define RAWIP_SOCKET__CONNECT 0x00000800UL #define RAWIP_SOCKET__LISTEN 0x00001000UL #define RAWIP_SOCKET__ACCEPT 0x00002000UL #define RAWIP_SOCKET__GETOPT 0x00004000UL #define RAWIP_SOCKET__SETOPT 0x00008000UL #define RAWIP_SOCKET__SHUTDOWN 0x00010000UL #define RAWIP_SOCKET__RECVFROM 0x00020000UL #define RAWIP_SOCKET__SENDTO 0x00040000UL #define RAWIP_SOCKET__RECV_MSG 0x00080000UL #define RAWIP_SOCKET__SEND_MSG 0x00100000UL #define RAWIP_SOCKET__NAME_BIND 0x00200000UL #define RAWIP_SOCKET__NODE_BIND 0x00400000UL #define NODE__TCP_RECV 0x00000001UL #define NODE__TCP_SEND 0x00000002UL #define NODE__UDP_RECV 0x00000004UL #define NODE__UDP_SEND 0x00000008UL #define NODE__RAWIP_RECV 0x00000010UL #define NODE__RAWIP_SEND 0x00000020UL #define NODE__ENFORCE_DEST 0x00000040UL #define NODE__DCCP_RECV 0x00000080UL #define NODE__DCCP_SEND 0x00000100UL #define NODE__RECVFROM 0x00000200UL #define NODE__SENDTO 0x00000400UL #define NETIF__TCP_RECV 0x00000001UL #define NETIF__TCP_SEND 0x00000002UL #define NETIF__UDP_RECV 0x00000004UL #define NETIF__UDP_SEND 0x00000008UL #define NETIF__RAWIP_RECV 0x00000010UL #define NETIF__RAWIP_SEND 0x00000020UL #define NETIF__DCCP_RECV 0x00000040UL #define NETIF__DCCP_SEND 0x00000080UL #define NETIF__INGRESS 0x00000100UL #define NETIF__EGRESS 0x00000200UL #define NETLINK_SOCKET__IOCTL 0x00000001UL #define NETLINK_SOCKET__READ 0x00000002UL #define NETLINK_SOCKET__WRITE 0x00000004UL #define NETLINK_SOCKET__CREATE 0x00000008UL #define NETLINK_SOCKET__GETATTR 0x00000010UL #define NETLINK_SOCKET__SETATTR 0x00000020UL #define NETLINK_SOCKET__LOCK 0x00000040UL #define NETLINK_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_SOCKET__RELABELTO 0x00000100UL #define NETLINK_SOCKET__APPEND 0x00000200UL #define NETLINK_SOCKET__BIND 0x00000400UL #define NETLINK_SOCKET__CONNECT 0x00000800UL #define NETLINK_SOCKET__LISTEN 0x00001000UL #define NETLINK_SOCKET__ACCEPT 0x00002000UL #define NETLINK_SOCKET__GETOPT 0x00004000UL #define NETLINK_SOCKET__SETOPT 0x00008000UL #define NETLINK_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_SOCKET__RECVFROM 0x00020000UL #define NETLINK_SOCKET__SENDTO 0x00040000UL #define NETLINK_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_SOCKET__NAME_BIND 0x00200000UL #define PACKET_SOCKET__IOCTL 0x00000001UL #define PACKET_SOCKET__READ 0x00000002UL #define PACKET_SOCKET__WRITE 0x00000004UL #define PACKET_SOCKET__CREATE 0x00000008UL #define PACKET_SOCKET__GETATTR 0x00000010UL #define PACKET_SOCKET__SETATTR 0x00000020UL #define PACKET_SOCKET__LOCK 0x00000040UL #define PACKET_SOCKET__RELABELFROM 0x00000080UL #define PACKET_SOCKET__RELABELTO 0x00000100UL #define PACKET_SOCKET__APPEND 0x00000200UL #define PACKET_SOCKET__BIND 0x00000400UL #define PACKET_SOCKET__CONNECT 0x00000800UL #define PACKET_SOCKET__LISTEN 0x00001000UL #define PACKET_SOCKET__ACCEPT 0x00002000UL #define PACKET_SOCKET__GETOPT 0x00004000UL #define PACKET_SOCKET__SETOPT 0x00008000UL #define PACKET_SOCKET__SHUTDOWN 0x00010000UL #define PACKET_SOCKET__RECVFROM 0x00020000UL #define PACKET_SOCKET__SENDTO 0x00040000UL #define PACKET_SOCKET__RECV_MSG 0x00080000UL #define PACKET_SOCKET__SEND_MSG 0x00100000UL #define PACKET_SOCKET__NAME_BIND 0x00200000UL #define KEY_SOCKET__IOCTL 0x00000001UL #define KEY_SOCKET__READ 0x00000002UL #define KEY_SOCKET__WRITE 0x00000004UL #define KEY_SOCKET__CREATE 0x00000008UL #define KEY_SOCKET__GETATTR 0x00000010UL #define KEY_SOCKET__SETATTR 0x00000020UL #define KEY_SOCKET__LOCK 0x00000040UL #define KEY_SOCKET__RELABELFROM 0x00000080UL #define KEY_SOCKET__RELABELTO 0x00000100UL #define KEY_SOCKET__APPEND 0x00000200UL #define KEY_SOCKET__BIND 0x00000400UL #define KEY_SOCKET__CONNECT 0x00000800UL #define KEY_SOCKET__LISTEN 0x00001000UL #define KEY_SOCKET__ACCEPT 0x00002000UL #define KEY_SOCKET__GETOPT 0x00004000UL #define KEY_SOCKET__SETOPT 0x00008000UL #define KEY_SOCKET__SHUTDOWN 0x00010000UL #define KEY_SOCKET__RECVFROM 0x00020000UL #define KEY_SOCKET__SENDTO 0x00040000UL #define KEY_SOCKET__RECV_MSG 0x00080000UL #define KEY_SOCKET__SEND_MSG 0x00100000UL #define KEY_SOCKET__NAME_BIND 0x00200000UL #define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL #define UNIX_STREAM_SOCKET__READ 0x00000002UL #define UNIX_STREAM_SOCKET__WRITE 0x00000004UL #define UNIX_STREAM_SOCKET__CREATE 0x00000008UL #define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL #define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL #define UNIX_STREAM_SOCKET__LOCK 0x00000040UL #define UNIX_STREAM_SOCKET__RELABELFROM 0x00000080UL #define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL #define UNIX_STREAM_SOCKET__APPEND 0x00000200UL #define UNIX_STREAM_SOCKET__BIND 0x00000400UL #define UNIX_STREAM_SOCKET__CONNECT 0x00000800UL #define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL #define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL #define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL #define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL #define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL #define UNIX_STREAM_SOCKET__RECVFROM 0x00020000UL #define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL #define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL #define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL #define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL #define UNIX_STREAM_SOCKET__CONNECTTO 0x00400000UL #define UNIX_STREAM_SOCKET__NEWCONN 0x00800000UL #define UNIX_STREAM_SOCKET__ACCEPTFROM 0x01000000UL #define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL #define UNIX_DGRAM_SOCKET__READ 0x00000002UL #define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL #define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL #define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL #define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL #define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL #define UNIX_DGRAM_SOCKET__RELABELFROM 0x00000080UL #define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL #define UNIX_DGRAM_SOCKET__APPEND 0x00000200UL #define UNIX_DGRAM_SOCKET__BIND 0x00000400UL #define UNIX_DGRAM_SOCKET__CONNECT 0x00000800UL #define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL #define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL #define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL #define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL #define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL #define UNIX_DGRAM_SOCKET__RECVFROM 0x00020000UL #define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL #define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL #define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL #define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL #define PROCESS__FORK 0x00000001UL #define PROCESS__TRANSITION 0x00000002UL #define PROCESS__SIGCHLD 0x00000004UL #define PROCESS__SIGKILL 0x00000008UL #define PROCESS__SIGSTOP 0x00000010UL #define PROCESS__SIGNULL 0x00000020UL #define PROCESS__SIGNAL 0x00000040UL #define PROCESS__PTRACE 0x00000080UL #define PROCESS__GETSCHED 0x00000100UL #define PROCESS__SETSCHED 0x00000200UL #define PROCESS__GETSESSION 0x00000400UL #define PROCESS__GETPGID 0x00000800UL #define PROCESS__SETPGID 0x00001000UL #define PROCESS__GETCAP 0x00002000UL #define PROCESS__SETCAP 0x00004000UL #define PROCESS__SHARE 0x00008000UL #define PROCESS__GETATTR 0x00010000UL #define PROCESS__SETEXEC 0x00020000UL #define PROCESS__SETFSCREATE 0x00040000UL #define PROCESS__NOATSECURE 0x00080000UL #define PROCESS__SIGINH 0x00100000UL #define PROCESS__SETRLIMIT 0x00200000UL #define PROCESS__RLIMITINH 0x00400000UL #define PROCESS__DYNTRANSITION 0x00800000UL #define PROCESS__SETCURRENT 0x01000000UL #define PROCESS__EXECMEM 0x02000000UL #define PROCESS__EXECSTACK 0x04000000UL #define PROCESS__EXECHEAP 0x08000000UL #define PROCESS__SETKEYCREATE 0x10000000UL #define PROCESS__SETSOCKCREATE 0x20000000UL #define IPC__CREATE 0x00000001UL #define IPC__DESTROY 0x00000002UL #define IPC__GETATTR 0x00000004UL #define IPC__SETATTR 0x00000008UL #define IPC__READ 0x00000010UL #define IPC__WRITE 0x00000020UL #define IPC__ASSOCIATE 0x00000040UL #define IPC__UNIX_READ 0x00000080UL #define IPC__UNIX_WRITE 0x00000100UL #define SEM__CREATE 0x00000001UL #define SEM__DESTROY 0x00000002UL #define SEM__GETATTR 0x00000004UL #define SEM__SETATTR 0x00000008UL #define SEM__READ 0x00000010UL #define SEM__WRITE 0x00000020UL #define SEM__ASSOCIATE 0x00000040UL #define SEM__UNIX_READ 0x00000080UL #define SEM__UNIX_WRITE 0x00000100UL #define MSGQ__CREATE 0x00000001UL #define MSGQ__DESTROY 0x00000002UL #define MSGQ__GETATTR 0x00000004UL #define MSGQ__SETATTR 0x00000008UL #define MSGQ__READ 0x00000010UL #define MSGQ__WRITE 0x00000020UL #define MSGQ__ASSOCIATE 0x00000040UL #define MSGQ__UNIX_READ 0x00000080UL #define MSGQ__UNIX_WRITE 0x00000100UL #define MSGQ__ENQUEUE 0x00000200UL #define MSG__SEND 0x00000001UL #define MSG__RECEIVE 0x00000002UL #define SHM__CREATE 0x00000001UL #define SHM__DESTROY 0x00000002UL #define SHM__GETATTR 0x00000004UL #define SHM__SETATTR 0x00000008UL #define SHM__READ 0x00000010UL #define SHM__WRITE 0x00000020UL #define SHM__ASSOCIATE 0x00000040UL #define SHM__UNIX_READ 0x00000080UL #define SHM__UNIX_WRITE 0x00000100UL #define SHM__LOCK 0x00000200UL #define SECURITY__COMPUTE_AV 0x00000001UL #define SECURITY__COMPUTE_CREATE 0x00000002UL #define SECURITY__COMPUTE_MEMBER 0x00000004UL #define SECURITY__CHECK_CONTEXT 0x00000008UL #define SECURITY__LOAD_POLICY 0x00000010UL #define SECURITY__COMPUTE_RELABEL 0x00000020UL #define SECURITY__COMPUTE_USER 0x00000040UL #define SECURITY__SETENFORCE 0x00000080UL #define SECURITY__SETBOOL 0x00000100UL #define SECURITY__SETSECPARAM 0x00000200UL #define SECURITY__SETCHECKREQPROT 0x00000400UL #define SYSTEM__IPC_INFO 0x00000001UL #define SYSTEM__SYSLOG_READ 0x00000002UL #define SYSTEM__SYSLOG_MOD 0x00000004UL #define SYSTEM__SYSLOG_CONSOLE 0x00000008UL #define CAPABILITY__CHOWN 0x00000001UL #define CAPABILITY__DAC_OVERRIDE 0x00000002UL #define CAPABILITY__DAC_READ_SEARCH 0x00000004UL #define CAPABILITY__FOWNER 0x00000008UL #define CAPABILITY__FSETID 0x00000010UL #define CAPABILITY__KILL 0x00000020UL #define CAPABILITY__SETGID 0x00000040UL #define CAPABILITY__SETUID 0x00000080UL #define CAPABILITY__SETPCAP 0x00000100UL #define CAPABILITY__LINUX_IMMUTABLE 0x00000200UL #define CAPABILITY__NET_BIND_SERVICE 0x00000400UL #define CAPABILITY__NET_BROADCAST 0x00000800UL #define CAPABILITY__NET_ADMIN 0x00001000UL #define CAPABILITY__NET_RAW 0x00002000UL #define CAPABILITY__IPC_LOCK 0x00004000UL #define CAPABILITY__IPC_OWNER 0x00008000UL #define CAPABILITY__SYS_MODULE 0x00010000UL #define CAPABILITY__SYS_RAWIO 0x00020000UL #define CAPABILITY__SYS_CHROOT 0x00040000UL #define CAPABILITY__SYS_PTRACE 0x00080000UL #define CAPABILITY__SYS_PACCT 0x00100000UL #define CAPABILITY__SYS_ADMIN 0x00200000UL #define CAPABILITY__SYS_BOOT 0x00400000UL #define CAPABILITY__SYS_NICE 0x00800000UL #define CAPABILITY__SYS_RESOURCE 0x01000000UL #define CAPABILITY__SYS_TIME 0x02000000UL #define CAPABILITY__SYS_TTY_CONFIG 0x04000000UL #define CAPABILITY__MKNOD 0x08000000UL #define CAPABILITY__LEASE 0x10000000UL #define CAPABILITY__AUDIT_WRITE 0x20000000UL #define CAPABILITY__AUDIT_CONTROL 0x40000000UL #define CAPABILITY__SETFCAP 0x80000000UL #define CAPABILITY2__MAC_OVERRIDE 0x00000001UL #define CAPABILITY2__MAC_ADMIN 0x00000002UL #define PASSWD__PASSWD 0x00000001UL #define PASSWD__CHFN 0x00000002UL #define PASSWD__CHSH 0x00000004UL #define PASSWD__ROOTOK 0x00000008UL #define PASSWD__CRONTAB 0x00000010UL #define X_DRAWABLE__CREATE 0x00000001UL #define X_DRAWABLE__DESTROY 0x00000002UL #define X_DRAWABLE__READ 0x00000004UL #define X_DRAWABLE__WRITE 0x00000008UL #define X_DRAWABLE__BLEND 0x00000010UL #define X_DRAWABLE__GETATTR 0x00000020UL #define X_DRAWABLE__SETATTR 0x00000040UL #define X_DRAWABLE__LIST_CHILD 0x00000080UL #define X_DRAWABLE__ADD_CHILD 0x00000100UL #define X_DRAWABLE__REMOVE_CHILD 0x00000200UL #define X_DRAWABLE__LIST_PROPERTY 0x00000400UL #define X_DRAWABLE__GET_PROPERTY 0x00000800UL #define X_DRAWABLE__SET_PROPERTY 0x00001000UL #define X_DRAWABLE__MANAGE 0x00002000UL #define X_DRAWABLE__OVERRIDE 0x00004000UL #define X_DRAWABLE__SHOW 0x00008000UL #define X_DRAWABLE__HIDE 0x00010000UL #define X_DRAWABLE__SEND 0x00020000UL #define X_DRAWABLE__RECEIVE 0x00040000UL #define X_SCREEN__GETATTR 0x00000001UL #define X_SCREEN__SETATTR 0x00000002UL #define X_SCREEN__HIDE_CURSOR 0x00000004UL #define X_SCREEN__SHOW_CURSOR 0x00000008UL #define X_SCREEN__SAVER_GETATTR 0x00000010UL #define X_SCREEN__SAVER_SETATTR 0x00000020UL #define X_SCREEN__SAVER_HIDE 0x00000040UL #define X_SCREEN__SAVER_SHOW 0x00000080UL #define X_GC__CREATE 0x00000001UL #define X_GC__DESTROY 0x00000002UL #define X_GC__GETATTR 0x00000004UL #define X_GC__SETATTR 0x00000008UL #define X_GC__USE 0x00000010UL #define X_FONT__CREATE 0x00000001UL #define X_FONT__DESTROY 0x00000002UL #define X_FONT__GETATTR 0x00000004UL #define X_FONT__ADD_GLYPH 0x00000008UL #define X_FONT__REMOVE_GLYPH 0x00000010UL #define X_FONT__USE 0x00000020UL #define X_COLORMAP__CREATE 0x00000001UL #define X_COLORMAP__DESTROY 0x00000002UL #define X_COLORMAP__READ 0x00000004UL #define X_COLORMAP__WRITE 0x00000008UL #define X_COLORMAP__GETATTR 0x00000010UL #define X_COLORMAP__ADD_COLOR 0x00000020UL #define X_COLORMAP__REMOVE_COLOR 0x00000040UL #define X_COLORMAP__INSTALL 0x00000080UL #define X_COLORMAP__UNINSTALL 0x00000100UL #define X_COLORMAP__USE 0x00000200UL #define X_PROPERTY__CREATE 0x00000001UL #define X_PROPERTY__DESTROY 0x00000002UL #define X_PROPERTY__READ 0x00000004UL #define X_PROPERTY__WRITE 0x00000008UL #define X_PROPERTY__APPEND 0x00000010UL #define X_PROPERTY__GETATTR 0x00000020UL #define X_PROPERTY__SETATTR 0x00000040UL #define X_SELECTION__READ 0x00000001UL #define X_SELECTION__WRITE 0x00000002UL #define X_SELECTION__GETATTR 0x00000004UL #define X_SELECTION__SETATTR 0x00000008UL #define X_CURSOR__CREATE 0x00000001UL #define X_CURSOR__DESTROY 0x00000002UL #define X_CURSOR__READ 0x00000004UL #define X_CURSOR__WRITE 0x00000008UL #define X_CURSOR__GETATTR 0x00000010UL #define X_CURSOR__SETATTR 0x00000020UL #define X_CURSOR__USE 0x00000040UL #define X_CLIENT__DESTROY 0x00000001UL #define X_CLIENT__GETATTR 0x00000002UL #define X_CLIENT__SETATTR 0x00000004UL #define X_CLIENT__MANAGE 0x00000008UL #define X_DEVICE__GETATTR 0x00000001UL #define X_DEVICE__SETATTR 0x00000002UL #define X_DEVICE__USE 0x00000004UL #define X_DEVICE__READ 0x00000008UL #define X_DEVICE__WRITE 0x00000010UL #define X_DEVICE__GETFOCUS 0x00000020UL #define X_DEVICE__SETFOCUS 0x00000040UL #define X_DEVICE__BELL 0x00000080UL #define X_DEVICE__FORCE_CURSOR 0x00000100UL #define X_DEVICE__FREEZE 0x00000200UL #define X_DEVICE__GRAB 0x00000400UL #define X_DEVICE__MANAGE 0x00000800UL #define X_SERVER__GETATTR 0x00000001UL #define X_SERVER__SETATTR 0x00000002UL #define X_SERVER__RECORD 0x00000004UL #define X_SERVER__DEBUG 0x00000008UL #define X_SERVER__GRAB 0x00000010UL #define X_SERVER__MANAGE 0x00000020UL #define X_EXTENSION__QUERY 0x00000001UL #define X_EXTENSION__USE 0x00000002UL #define X_RESOURCE__READ 0x00000001UL #define X_RESOURCE__WRITE 0x00000002UL #define X_EVENT__SEND 0x00000001UL #define X_EVENT__RECEIVE 0x00000002UL #define X_SYNTHETIC_EVENT__SEND 0x00000001UL #define X_SYNTHETIC_EVENT__RECEIVE 0x00000002UL #define NETLINK_ROUTE_SOCKET__IOCTL 0x00000001UL #define NETLINK_ROUTE_SOCKET__READ 0x00000002UL #define NETLINK_ROUTE_SOCKET__WRITE 0x00000004UL #define NETLINK_ROUTE_SOCKET__CREATE 0x00000008UL #define NETLINK_ROUTE_SOCKET__GETATTR 0x00000010UL #define NETLINK_ROUTE_SOCKET__SETATTR 0x00000020UL #define NETLINK_ROUTE_SOCKET__LOCK 0x00000040UL #define NETLINK_ROUTE_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_ROUTE_SOCKET__RELABELTO 0x00000100UL #define NETLINK_ROUTE_SOCKET__APPEND 0x00000200UL #define NETLINK_ROUTE_SOCKET__BIND 0x00000400UL #define NETLINK_ROUTE_SOCKET__CONNECT 0x00000800UL #define NETLINK_ROUTE_SOCKET__LISTEN 0x00001000UL #define NETLINK_ROUTE_SOCKET__ACCEPT 0x00002000UL #define NETLINK_ROUTE_SOCKET__GETOPT 0x00004000UL #define NETLINK_ROUTE_SOCKET__SETOPT 0x00008000UL #define NETLINK_ROUTE_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_ROUTE_SOCKET__RECVFROM 0x00020000UL #define NETLINK_ROUTE_SOCKET__SENDTO 0x00040000UL #define NETLINK_ROUTE_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_ROUTE_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_ROUTE_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_ROUTE_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_ROUTE_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_FIREWALL_SOCKET__IOCTL 0x00000001UL #define NETLINK_FIREWALL_SOCKET__READ 0x00000002UL #define NETLINK_FIREWALL_SOCKET__WRITE 0x00000004UL #define NETLINK_FIREWALL_SOCKET__CREATE 0x00000008UL #define NETLINK_FIREWALL_SOCKET__GETATTR 0x00000010UL #define NETLINK_FIREWALL_SOCKET__SETATTR 0x00000020UL #define NETLINK_FIREWALL_SOCKET__LOCK 0x00000040UL #define NETLINK_FIREWALL_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_FIREWALL_SOCKET__RELABELTO 0x00000100UL #define NETLINK_FIREWALL_SOCKET__APPEND 0x00000200UL #define NETLINK_FIREWALL_SOCKET__BIND 0x00000400UL #define NETLINK_FIREWALL_SOCKET__CONNECT 0x00000800UL #define NETLINK_FIREWALL_SOCKET__LISTEN 0x00001000UL #define NETLINK_FIREWALL_SOCKET__ACCEPT 0x00002000UL #define NETLINK_FIREWALL_SOCKET__GETOPT 0x00004000UL #define NETLINK_FIREWALL_SOCKET__SETOPT 0x00008000UL #define NETLINK_FIREWALL_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_FIREWALL_SOCKET__RECVFROM 0x00020000UL #define NETLINK_FIREWALL_SOCKET__SENDTO 0x00040000UL #define NETLINK_FIREWALL_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_FIREWALL_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_FIREWALL_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_FIREWALL_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_FIREWALL_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_TCPDIAG_SOCKET__IOCTL 0x00000001UL #define NETLINK_TCPDIAG_SOCKET__READ 0x00000002UL #define NETLINK_TCPDIAG_SOCKET__WRITE 0x00000004UL #define NETLINK_TCPDIAG_SOCKET__CREATE 0x00000008UL #define NETLINK_TCPDIAG_SOCKET__GETATTR 0x00000010UL #define NETLINK_TCPDIAG_SOCKET__SETATTR 0x00000020UL #define NETLINK_TCPDIAG_SOCKET__LOCK 0x00000040UL #define NETLINK_TCPDIAG_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_TCPDIAG_SOCKET__RELABELTO 0x00000100UL #define NETLINK_TCPDIAG_SOCKET__APPEND 0x00000200UL #define NETLINK_TCPDIAG_SOCKET__BIND 0x00000400UL #define NETLINK_TCPDIAG_SOCKET__CONNECT 0x00000800UL #define NETLINK_TCPDIAG_SOCKET__LISTEN 0x00001000UL #define NETLINK_TCPDIAG_SOCKET__ACCEPT 0x00002000UL #define NETLINK_TCPDIAG_SOCKET__GETOPT 0x00004000UL #define NETLINK_TCPDIAG_SOCKET__SETOPT 0x00008000UL #define NETLINK_TCPDIAG_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_TCPDIAG_SOCKET__RECVFROM 0x00020000UL #define NETLINK_TCPDIAG_SOCKET__SENDTO 0x00040000UL #define NETLINK_TCPDIAG_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_TCPDIAG_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_TCPDIAG_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_TCPDIAG_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_NFLOG_SOCKET__IOCTL 0x00000001UL #define NETLINK_NFLOG_SOCKET__READ 0x00000002UL #define NETLINK_NFLOG_SOCKET__WRITE 0x00000004UL #define NETLINK_NFLOG_SOCKET__CREATE 0x00000008UL #define NETLINK_NFLOG_SOCKET__GETATTR 0x00000010UL #define NETLINK_NFLOG_SOCKET__SETATTR 0x00000020UL #define NETLINK_NFLOG_SOCKET__LOCK 0x00000040UL #define NETLINK_NFLOG_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_NFLOG_SOCKET__RELABELTO 0x00000100UL #define NETLINK_NFLOG_SOCKET__APPEND 0x00000200UL #define NETLINK_NFLOG_SOCKET__BIND 0x00000400UL #define NETLINK_NFLOG_SOCKET__CONNECT 0x00000800UL #define NETLINK_NFLOG_SOCKET__LISTEN 0x00001000UL #define NETLINK_NFLOG_SOCKET__ACCEPT 0x00002000UL #define NETLINK_NFLOG_SOCKET__GETOPT 0x00004000UL #define NETLINK_NFLOG_SOCKET__SETOPT 0x00008000UL #define NETLINK_NFLOG_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_NFLOG_SOCKET__RECVFROM 0x00020000UL #define NETLINK_NFLOG_SOCKET__SENDTO 0x00040000UL #define NETLINK_NFLOG_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_NFLOG_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_NFLOG_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_XFRM_SOCKET__IOCTL 0x00000001UL #define NETLINK_XFRM_SOCKET__READ 0x00000002UL #define NETLINK_XFRM_SOCKET__WRITE 0x00000004UL #define NETLINK_XFRM_SOCKET__CREATE 0x00000008UL #define NETLINK_XFRM_SOCKET__GETATTR 0x00000010UL #define NETLINK_XFRM_SOCKET__SETATTR 0x00000020UL #define NETLINK_XFRM_SOCKET__LOCK 0x00000040UL #define NETLINK_XFRM_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_XFRM_SOCKET__RELABELTO 0x00000100UL #define NETLINK_XFRM_SOCKET__APPEND 0x00000200UL #define NETLINK_XFRM_SOCKET__BIND 0x00000400UL #define NETLINK_XFRM_SOCKET__CONNECT 0x00000800UL #define NETLINK_XFRM_SOCKET__LISTEN 0x00001000UL #define NETLINK_XFRM_SOCKET__ACCEPT 0x00002000UL #define NETLINK_XFRM_SOCKET__GETOPT 0x00004000UL #define NETLINK_XFRM_SOCKET__SETOPT 0x00008000UL #define NETLINK_XFRM_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_XFRM_SOCKET__RECVFROM 0x00020000UL #define NETLINK_XFRM_SOCKET__SENDTO 0x00040000UL #define NETLINK_XFRM_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_XFRM_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_XFRM_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_XFRM_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_XFRM_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_SELINUX_SOCKET__IOCTL 0x00000001UL #define NETLINK_SELINUX_SOCKET__READ 0x00000002UL #define NETLINK_SELINUX_SOCKET__WRITE 0x00000004UL #define NETLINK_SELINUX_SOCKET__CREATE 0x00000008UL #define NETLINK_SELINUX_SOCKET__GETATTR 0x00000010UL #define NETLINK_SELINUX_SOCKET__SETATTR 0x00000020UL #define NETLINK_SELINUX_SOCKET__LOCK 0x00000040UL #define NETLINK_SELINUX_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_SELINUX_SOCKET__RELABELTO 0x00000100UL #define NETLINK_SELINUX_SOCKET__APPEND 0x00000200UL #define NETLINK_SELINUX_SOCKET__BIND 0x00000400UL #define NETLINK_SELINUX_SOCKET__CONNECT 0x00000800UL #define NETLINK_SELINUX_SOCKET__LISTEN 0x00001000UL #define NETLINK_SELINUX_SOCKET__ACCEPT 0x00002000UL #define NETLINK_SELINUX_SOCKET__GETOPT 0x00004000UL #define NETLINK_SELINUX_SOCKET__SETOPT 0x00008000UL #define NETLINK_SELINUX_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_SELINUX_SOCKET__RECVFROM 0x00020000UL #define NETLINK_SELINUX_SOCKET__SENDTO 0x00040000UL #define NETLINK_SELINUX_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_SELINUX_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_SELINUX_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_AUDIT_SOCKET__IOCTL 0x00000001UL #define NETLINK_AUDIT_SOCKET__READ 0x00000002UL #define NETLINK_AUDIT_SOCKET__WRITE 0x00000004UL #define NETLINK_AUDIT_SOCKET__CREATE 0x00000008UL #define NETLINK_AUDIT_SOCKET__GETATTR 0x00000010UL #define NETLINK_AUDIT_SOCKET__SETATTR 0x00000020UL #define NETLINK_AUDIT_SOCKET__LOCK 0x00000040UL #define NETLINK_AUDIT_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_AUDIT_SOCKET__RELABELTO 0x00000100UL #define NETLINK_AUDIT_SOCKET__APPEND 0x00000200UL #define NETLINK_AUDIT_SOCKET__BIND 0x00000400UL #define NETLINK_AUDIT_SOCKET__CONNECT 0x00000800UL #define NETLINK_AUDIT_SOCKET__LISTEN 0x00001000UL #define NETLINK_AUDIT_SOCKET__ACCEPT 0x00002000UL #define NETLINK_AUDIT_SOCKET__GETOPT 0x00004000UL #define NETLINK_AUDIT_SOCKET__SETOPT 0x00008000UL #define NETLINK_AUDIT_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_AUDIT_SOCKET__RECVFROM 0x00020000UL #define NETLINK_AUDIT_SOCKET__SENDTO 0x00040000UL #define NETLINK_AUDIT_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_AUDIT_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_AUDIT_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL #define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL #define NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT 0x04000000UL #define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL #define NETLINK_IP6FW_SOCKET__READ 0x00000002UL #define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL #define NETLINK_IP6FW_SOCKET__CREATE 0x00000008UL #define NETLINK_IP6FW_SOCKET__GETATTR 0x00000010UL #define NETLINK_IP6FW_SOCKET__SETATTR 0x00000020UL #define NETLINK_IP6FW_SOCKET__LOCK 0x00000040UL #define NETLINK_IP6FW_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_IP6FW_SOCKET__RELABELTO 0x00000100UL #define NETLINK_IP6FW_SOCKET__APPEND 0x00000200UL #define NETLINK_IP6FW_SOCKET__BIND 0x00000400UL #define NETLINK_IP6FW_SOCKET__CONNECT 0x00000800UL #define NETLINK_IP6FW_SOCKET__LISTEN 0x00001000UL #define NETLINK_IP6FW_SOCKET__ACCEPT 0x00002000UL #define NETLINK_IP6FW_SOCKET__GETOPT 0x00004000UL #define NETLINK_IP6FW_SOCKET__SETOPT 0x00008000UL #define NETLINK_IP6FW_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_IP6FW_SOCKET__RECVFROM 0x00020000UL #define NETLINK_IP6FW_SOCKET__SENDTO 0x00040000UL #define NETLINK_IP6FW_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_IP6FW_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_IP6FW_SOCKET__NAME_BIND 0x00200000UL #define NETLINK_IP6FW_SOCKET__NLMSG_READ 0x00400000UL #define NETLINK_IP6FW_SOCKET__NLMSG_WRITE 0x00800000UL #define NETLINK_DNRT_SOCKET__IOCTL 0x00000001UL #define NETLINK_DNRT_SOCKET__READ 0x00000002UL #define NETLINK_DNRT_SOCKET__WRITE 0x00000004UL #define NETLINK_DNRT_SOCKET__CREATE 0x00000008UL #define NETLINK_DNRT_SOCKET__GETATTR 0x00000010UL #define NETLINK_DNRT_SOCKET__SETATTR 0x00000020UL #define NETLINK_DNRT_SOCKET__LOCK 0x00000040UL #define NETLINK_DNRT_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_DNRT_SOCKET__RELABELTO 0x00000100UL #define NETLINK_DNRT_SOCKET__APPEND 0x00000200UL #define NETLINK_DNRT_SOCKET__BIND 0x00000400UL #define NETLINK_DNRT_SOCKET__CONNECT 0x00000800UL #define NETLINK_DNRT_SOCKET__LISTEN 0x00001000UL #define NETLINK_DNRT_SOCKET__ACCEPT 0x00002000UL #define NETLINK_DNRT_SOCKET__GETOPT 0x00004000UL #define NETLINK_DNRT_SOCKET__SETOPT 0x00008000UL #define NETLINK_DNRT_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_DNRT_SOCKET__RECVFROM 0x00020000UL #define NETLINK_DNRT_SOCKET__SENDTO 0x00040000UL #define NETLINK_DNRT_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_DNRT_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_DNRT_SOCKET__NAME_BIND 0x00200000UL #define DBUS__ACQUIRE_SVC 0x00000001UL #define DBUS__SEND_MSG 0x00000002UL #define NSCD__GETPWD 0x00000001UL #define NSCD__GETGRP 0x00000002UL #define NSCD__GETHOST 0x00000004UL #define NSCD__GETSTAT 0x00000008UL #define NSCD__ADMIN 0x00000010UL #define NSCD__SHMEMPWD 0x00000020UL #define NSCD__SHMEMGRP 0x00000040UL #define NSCD__SHMEMHOST 0x00000080UL #define NSCD__GETSERV 0x00000100UL #define NSCD__SHMEMSERV 0x00000200UL #define NSCD__GETNETGRP 0x00000400UL #define NSCD__SHMEMNETGRP 0x00000800UL #define ASSOCIATION__SENDTO 0x00000001UL #define ASSOCIATION__RECVFROM 0x00000002UL #define ASSOCIATION__SETCONTEXT 0x00000004UL #define ASSOCIATION__POLMATCH 0x00000008UL #define NETLINK_KOBJECT_UEVENT_SOCKET__IOCTL 0x00000001UL #define NETLINK_KOBJECT_UEVENT_SOCKET__READ 0x00000002UL #define NETLINK_KOBJECT_UEVENT_SOCKET__WRITE 0x00000004UL #define NETLINK_KOBJECT_UEVENT_SOCKET__CREATE 0x00000008UL #define NETLINK_KOBJECT_UEVENT_SOCKET__GETATTR 0x00000010UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SETATTR 0x00000020UL #define NETLINK_KOBJECT_UEVENT_SOCKET__LOCK 0x00000040UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELFROM 0x00000080UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELTO 0x00000100UL #define NETLINK_KOBJECT_UEVENT_SOCKET__APPEND 0x00000200UL #define NETLINK_KOBJECT_UEVENT_SOCKET__BIND 0x00000400UL #define NETLINK_KOBJECT_UEVENT_SOCKET__CONNECT 0x00000800UL #define NETLINK_KOBJECT_UEVENT_SOCKET__LISTEN 0x00001000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__ACCEPT 0x00002000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__GETOPT 0x00004000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SETOPT 0x00008000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RECVFROM 0x00020000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SENDTO 0x00040000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__RECV_MSG 0x00080000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL #define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL #define APPLETALK_SOCKET__IOCTL 0x00000001UL #define APPLETALK_SOCKET__READ 0x00000002UL #define APPLETALK_SOCKET__WRITE 0x00000004UL #define APPLETALK_SOCKET__CREATE 0x00000008UL #define APPLETALK_SOCKET__GETATTR 0x00000010UL #define APPLETALK_SOCKET__SETATTR 0x00000020UL #define APPLETALK_SOCKET__LOCK 0x00000040UL #define APPLETALK_SOCKET__RELABELFROM 0x00000080UL #define APPLETALK_SOCKET__RELABELTO 0x00000100UL #define APPLETALK_SOCKET__APPEND 0x00000200UL #define APPLETALK_SOCKET__BIND 0x00000400UL #define APPLETALK_SOCKET__CONNECT 0x00000800UL #define APPLETALK_SOCKET__LISTEN 0x00001000UL #define APPLETALK_SOCKET__ACCEPT 0x00002000UL #define APPLETALK_SOCKET__GETOPT 0x00004000UL #define APPLETALK_SOCKET__SETOPT 0x00008000UL #define APPLETALK_SOCKET__SHUTDOWN 0x00010000UL #define APPLETALK_SOCKET__RECVFROM 0x00020000UL #define APPLETALK_SOCKET__SENDTO 0x00040000UL #define APPLETALK_SOCKET__RECV_MSG 0x00080000UL #define APPLETALK_SOCKET__SEND_MSG 0x00100000UL #define APPLETALK_SOCKET__NAME_BIND 0x00200000UL #define PACKET__SEND 0x00000001UL #define PACKET__RECV 0x00000002UL #define PACKET__RELABELTO 0x00000004UL #define PACKET__FLOW_IN 0x00000008UL #define PACKET__FLOW_OUT 0x00000010UL #define PACKET__FORWARD_IN 0x00000020UL #define PACKET__FORWARD_OUT 0x00000040UL #define KEY__VIEW 0x00000001UL #define KEY__READ 0x00000002UL #define KEY__WRITE 0x00000004UL #define KEY__SEARCH 0x00000008UL #define KEY__LINK 0x00000010UL #define KEY__SETATTR 0x00000020UL #define KEY__CREATE 0x00000040UL #define CONTEXT__TRANSLATE 0x00000001UL #define CONTEXT__CONTAINS 0x00000002UL #define DCCP_SOCKET__IOCTL 0x00000001UL #define DCCP_SOCKET__READ 0x00000002UL #define DCCP_SOCKET__WRITE 0x00000004UL #define DCCP_SOCKET__CREATE 0x00000008UL #define DCCP_SOCKET__GETATTR 0x00000010UL #define DCCP_SOCKET__SETATTR 0x00000020UL #define DCCP_SOCKET__LOCK 0x00000040UL #define DCCP_SOCKET__RELABELFROM 0x00000080UL #define DCCP_SOCKET__RELABELTO 0x00000100UL #define DCCP_SOCKET__APPEND 0x00000200UL #define DCCP_SOCKET__BIND 0x00000400UL #define DCCP_SOCKET__CONNECT 0x00000800UL #define DCCP_SOCKET__LISTEN 0x00001000UL #define DCCP_SOCKET__ACCEPT 0x00002000UL #define DCCP_SOCKET__GETOPT 0x00004000UL #define DCCP_SOCKET__SETOPT 0x00008000UL #define DCCP_SOCKET__SHUTDOWN 0x00010000UL #define DCCP_SOCKET__RECVFROM 0x00020000UL #define DCCP_SOCKET__SENDTO 0x00040000UL #define DCCP_SOCKET__RECV_MSG 0x00080000UL #define DCCP_SOCKET__SEND_MSG 0x00100000UL #define DCCP_SOCKET__NAME_BIND 0x00200000UL #define DCCP_SOCKET__NODE_BIND 0x00400000UL #define DCCP_SOCKET__NAME_CONNECT 0x00800000UL #define MEMPROTECT__MMAP_ZERO 0x00000001UL #define DB_DATABASE__CREATE 0x00000001UL #define DB_DATABASE__DROP 0x00000002UL #define DB_DATABASE__GETATTR 0x00000004UL #define DB_DATABASE__SETATTR 0x00000008UL #define DB_DATABASE__RELABELFROM 0x00000010UL #define DB_DATABASE__RELABELTO 0x00000020UL #define DB_DATABASE__ACCESS 0x00000040UL #define DB_DATABASE__INSTALL_MODULE 0x00000080UL #define DB_DATABASE__LOAD_MODULE 0x00000100UL #define DB_DATABASE__GET_PARAM 0x00000200UL #define DB_DATABASE__SET_PARAM 0x00000400UL #define DB_TABLE__CREATE 0x00000001UL #define DB_TABLE__DROP 0x00000002UL #define DB_TABLE__GETATTR 0x00000004UL #define DB_TABLE__SETATTR 0x00000008UL #define DB_TABLE__RELABELFROM 0x00000010UL #define DB_TABLE__RELABELTO 0x00000020UL #define DB_TABLE__USE 0x00000040UL #define DB_TABLE__SELECT 0x00000080UL #define DB_TABLE__UPDATE 0x00000100UL #define DB_TABLE__INSERT 0x00000200UL #define DB_TABLE__DELETE 0x00000400UL #define DB_TABLE__LOCK 0x00000800UL #define DB_PROCEDURE__CREATE 0x00000001UL #define DB_PROCEDURE__DROP 0x00000002UL #define DB_PROCEDURE__GETATTR 0x00000004UL #define DB_PROCEDURE__SETATTR 0x00000008UL #define DB_PROCEDURE__RELABELFROM 0x00000010UL #define DB_PROCEDURE__RELABELTO 0x00000020UL #define DB_PROCEDURE__EXECUTE 0x00000040UL #define DB_PROCEDURE__ENTRYPOINT 0x00000080UL #define DB_COLUMN__CREATE 0x00000001UL #define DB_COLUMN__DROP 0x00000002UL #define DB_COLUMN__GETATTR 0x00000004UL #define DB_COLUMN__SETATTR 0x00000008UL #define DB_COLUMN__RELABELFROM 0x00000010UL #define DB_COLUMN__RELABELTO 0x00000020UL #define DB_COLUMN__USE 0x00000040UL #define DB_COLUMN__SELECT 0x00000080UL #define DB_COLUMN__UPDATE 0x00000100UL #define DB_COLUMN__INSERT 0x00000200UL #define DB_TUPLE__RELABELFROM 0x00000001UL #define DB_TUPLE__RELABELTO 0x00000002UL #define DB_TUPLE__USE 0x00000004UL #define DB_TUPLE__SELECT 0x00000008UL #define DB_TUPLE__UPDATE 0x00000010UL #define DB_TUPLE__INSERT 0x00000020UL #define DB_TUPLE__DELETE 0x00000040UL #define DB_BLOB__CREATE 0x00000001UL #define DB_BLOB__DROP 0x00000002UL #define DB_BLOB__GETATTR 0x00000004UL #define DB_BLOB__SETATTR 0x00000008UL #define DB_BLOB__RELABELFROM 0x00000010UL #define DB_BLOB__RELABELTO 0x00000020UL #define DB_BLOB__READ 0x00000040UL #define DB_BLOB__WRITE 0x00000080UL #define DB_BLOB__IMPORT 0x00000100UL #define DB_BLOB__EXPORT 0x00000200UL #define PEER__RECV 0x00000001UL #define X_APPLICATION_DATA__PASTE 0x00000001UL #define X_APPLICATION_DATA__PASTE_AFTER_CONFIRM 0x00000002UL #define X_APPLICATION_DATA__COPY 0x00000004UL selinux/avc.h 0000644 00000040076 15063602044 0007164 0 ustar 00 /* * Access vector cache interface for object managers. * * Author : Eamon Walsh <ewalsh@epoch.ncsc.mil> */ #ifndef _SELINUX_AVC_H_ #define _SELINUX_AVC_H_ #include <stdint.h> #include <errno.h> #include <stdlib.h> #include <selinux/selinux.h> #ifdef __cplusplus extern "C" { #endif /* * SID format and operations */ struct security_id { char * ctx; unsigned int refcnt; }; typedef struct security_id *security_id_t; #define SECSID_WILD (security_id_t)NULL /* unspecified SID */ /** * avc_sid_to_context - get copy of context corresponding to SID. * @sid: input SID * @ctx: pointer to context reference * * Return a copy of the security context corresponding to the input * @sid in the memory referenced by @ctx. The caller is expected to * free the context with freecon(). Return %0 on success, -%1 on * failure, with @errno set to %ENOMEM if insufficient memory was * available to make the copy, or %EINVAL if the input SID is invalid. */ int avc_sid_to_context(security_id_t sid, char ** ctx); int avc_sid_to_context_raw(security_id_t sid, char ** ctx); /** * avc_context_to_sid - get SID for context. * @ctx: input security context * @sid: pointer to SID reference * * Look up security context @ctx in SID table, making * a new entry if @ctx is not found. Increment the * reference counter for the SID. Store a pointer * to the SID structure into the memory referenced by @sid, * returning %0 on success or -%1 on error with @errno set. */ int avc_context_to_sid(const char * ctx, security_id_t * sid); int avc_context_to_sid_raw(const char * ctx, security_id_t * sid); /** * sidget - increment SID reference counter. * @sid: SID reference * * Increment the reference counter for @sid, indicating that * @sid is in use by an (additional) object. Return the * new reference count, or zero if @sid is invalid (has zero * reference count). Note that avc_context_to_sid() also * increments reference counts. */ int sidget(security_id_t sid); /** * sidput - decrement SID reference counter. * @sid: SID reference * * Decrement the reference counter for @sid, indicating that * a reference to @sid is no longer in use. Return the * new reference count. When the reference count reaches * zero, the SID is invalid, and avc_context_to_sid() must * be called to obtain a new SID for the security context. */ int sidput(security_id_t sid); /** * avc_get_initial_sid - get SID for an initial kernel security identifier * @name: input name of initial kernel security identifier * @sid: pointer to a SID reference * * Get the context for an initial kernel security identifier specified by * @name using security_get_initial_context() and then call * avc_context_to_sid() to get the corresponding SID. */ int avc_get_initial_sid(const char *name, security_id_t * sid); /* * AVC entry */ struct avc_entry; struct avc_entry_ref { struct avc_entry *ae; }; /** * avc_entry_ref_init - initialize an AVC entry reference. * @aeref: pointer to avc entry reference structure * * Use this macro to initialize an avc entry reference structure * before first use. These structures are passed to avc_has_perm(), * which stores cache entry references in them. They can increase * performance on repeated queries. */ #define avc_entry_ref_init(aeref) ((aeref)->ae = NULL) /* * User-provided callbacks for memory, auditing, and locking */ /* These structures are passed by reference to avc_init(). Passing * a NULL reference will cause the AVC to use a default. The default * memory callbacks are malloc() and free(). The default logging method * is to print on stderr. If no thread callbacks are passed, a separate * listening thread won't be started for kernel policy change messages. * If no locking callbacks are passed, no locking will take place. */ struct avc_memory_callback { /* malloc() equivalent. */ void *(*func_malloc) (size_t size); /* free() equivalent. */ void (*func_free) (void *ptr); /* Note that these functions should set errno on failure. If not, some avc routines may return -1 without errno set. */ }; struct avc_log_callback { /* log the printf-style format and arguments. */ void #ifdef __GNUC__ __attribute__ ((format(printf, 1, 2))) #endif (*func_log) (const char *fmt, ...); /* store a string representation of auditdata (corresponding to the given security class) into msgbuf. */ void (*func_audit) (void *auditdata, security_class_t cls, char *msgbuf, size_t msgbufsize); }; struct avc_thread_callback { /* create and start a thread, returning an opaque pointer to it; the thread should run the given function. */ void *(*func_create_thread) (void (*run) (void)); /* cancel a given thread and free its resources. */ void (*func_stop_thread) (void *thread); }; struct avc_lock_callback { /* create a lock and return an opaque pointer to it. */ void *(*func_alloc_lock) (void); /* obtain a given lock, blocking if necessary. */ void (*func_get_lock) (void *lock); /* release a given lock. */ void (*func_release_lock) (void *lock); /* destroy a given lock (free memory, etc.) */ void (*func_free_lock) (void *lock); }; /* * Available options */ /* no-op option, useful for unused slots in an array of options */ #define AVC_OPT_UNUSED 0 /* override kernel enforcing mode (boolean value) */ #define AVC_OPT_SETENFORCE 1 /* * AVC operations */ /** * avc_init - Initialize the AVC. * @msgprefix: prefix for log messages * @mem_callbacks: user-supplied memory callbacks * @log_callbacks: user-supplied logging callbacks * @thread_callbacks: user-supplied threading callbacks * @lock_callbacks: user-supplied locking callbacks * * Initialize the access vector cache. Return %0 on * success or -%1 with @errno set on failure. * If @msgprefix is NULL, use "uavc". If any callback * structure references are NULL, use default methods * for those callbacks (see the definition of the callback * structures above). */ int avc_init(const char *msgprefix, const struct avc_memory_callback *mem_callbacks, const struct avc_log_callback *log_callbacks, const struct avc_thread_callback *thread_callbacks, const struct avc_lock_callback *lock_callbacks); /** * avc_open - Initialize the AVC. * @opts: array of selabel_opt structures specifying AVC options or NULL. * @nopts: number of elements in opts array or zero for no options. * * This function is identical to avc_init(), except the message prefix * is set to "avc" and any callbacks desired should be specified via * selinux_set_callback(). Available options are listed above. */ int avc_open(struct selinux_opt *opts, unsigned nopts); /** * avc_cleanup - Remove unused SIDs and AVC entries. * * Search the SID table for SID structures with zero * reference counts, and remove them along with all * AVC entries that reference them. This can be used * to return memory to the system. */ void avc_cleanup(void); /** * avc_reset - Flush the cache and reset statistics. * * Remove all entries from the cache and reset all access * statistics (as returned by avc_cache_stats()) to zero. * The SID mapping is not affected. Return %0 on success, * -%1 with @errno set on error. */ int avc_reset(void); /** * avc_destroy - Free all AVC structures. * * Destroy all AVC structures and free all allocated * memory. User-supplied locking, memory, and audit * callbacks will be retained, but security-event * callbacks will not. All SID's will be invalidated. * User must call avc_init() if further use of AVC is desired. */ void avc_destroy(void); /** * avc_has_perm_noaudit - Check permissions but perform no auditing. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @requested: requested permissions, interpreted based on @tclass * @aeref: AVC entry reference * @avd: access vector decisions * * Check the AVC to determine whether the @requested permissions are granted * for the SID pair (@ssid, @tsid), interpreting the permissions * based on @tclass, and call the security server on a cache miss to obtain * a new decision and add it to the cache. Update @aeref to refer to an AVC * entry with the resulting decisions, and return a copy of the decisions * in @avd. Return %0 if all @requested permissions are granted, -%1 with * @errno set to %EACCES if any permissions are denied, or to another value * upon other errors. This function is typically called by avc_has_perm(), * but may also be called directly to separate permission checking from * auditing, e.g. in cases where a lock must be held for the check but * should be released for the auditing. */ int avc_has_perm_noaudit(security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t requested, struct avc_entry_ref *aeref, struct av_decision *avd); /** * avc_has_perm - Check permissions and perform any appropriate auditing. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @requested: requested permissions, interpreted based on @tclass * @aeref: AVC entry reference * @auditdata: auxiliary audit data * * Check the AVC to determine whether the @requested permissions are granted * for the SID pair (@ssid, @tsid), interpreting the permissions * based on @tclass, and call the security server on a cache miss to obtain * a new decision and add it to the cache. Update @aeref to refer to an AVC * entry with the resulting decisions. Audit the granting or denial of * permissions in accordance with the policy. Return %0 if all @requested * permissions are granted, -%1 with @errno set to %EACCES if any permissions * are denied or to another value upon other errors. */ int avc_has_perm(security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t requested, struct avc_entry_ref *aeref, void *auditdata); /** * avc_audit - Audit the granting or denial of permissions. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @requested: requested permissions * @avd: access vector decisions * @result: result from avc_has_perm_noaudit * @auditdata: auxiliary audit data * * Audit the granting or denial of permissions in accordance * with the policy. This function is typically called by * avc_has_perm() after a permission check, but can also be * called directly by callers who use avc_has_perm_noaudit() * in order to separate the permission check from the auditing. * For example, this separation is useful when the permission check must * be performed under a lock, to allow the lock to be released * before calling the auditing code. */ void avc_audit(security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t requested, struct av_decision *avd, int result, void *auditdata); /** * avc_compute_create - Compute SID for labeling a new object. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @newsid: pointer to SID reference * * Call the security server to obtain a context for labeling a * new object. Look up the context in the SID table, making * a new entry if not found. Increment the reference counter * for the SID. Store a pointer to the SID structure into the * memory referenced by @newsid, returning %0 on success or -%1 on * error with @errno set. */ int avc_compute_create(security_id_t ssid, security_id_t tsid, security_class_t tclass, security_id_t * newsid); /** * avc_compute_member - Compute SID for polyinstantation. * @ssid: source security identifier * @tsid: target security identifier * @tclass: target security class * @newsid: pointer to SID reference * * Call the security server to obtain a context for labeling an * object instance. Look up the context in the SID table, making * a new entry if not found. Increment the reference counter * for the SID. Store a pointer to the SID structure into the * memory referenced by @newsid, returning %0 on success or -%1 on * error with @errno set. */ int avc_compute_member(security_id_t ssid, security_id_t tsid, security_class_t tclass, security_id_t * newsid); /* * security event callback facility */ /* security events */ #define AVC_CALLBACK_GRANT 1 #define AVC_CALLBACK_TRY_REVOKE 2 #define AVC_CALLBACK_REVOKE 4 #define AVC_CALLBACK_RESET 8 #define AVC_CALLBACK_AUDITALLOW_ENABLE 16 #define AVC_CALLBACK_AUDITALLOW_DISABLE 32 #define AVC_CALLBACK_AUDITDENY_ENABLE 64 #define AVC_CALLBACK_AUDITDENY_DISABLE 128 /** * avc_add_callback - Register a callback for security events. * @callback: callback function * @events: bitwise OR of desired security events * @ssid: source security identifier or %SECSID_WILD * @tsid: target security identifier or %SECSID_WILD * @tclass: target security class * @perms: permissions * * Register a callback function for events in the set @events * related to the SID pair (@ssid, @tsid) and * and the permissions @perms, interpreting * @perms based on @tclass. Returns %0 on success or * -%1 if insufficient memory exists to add the callback. */ int avc_add_callback(int (*callback) (uint32_t event, security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t perms, access_vector_t * out_retained), uint32_t events, security_id_t ssid, security_id_t tsid, security_class_t tclass, access_vector_t perms); /* * AVC statistics */ /* If set, cache statistics are tracked. This may * become a compile-time option in the future. */ #define AVC_CACHE_STATS 1 struct avc_cache_stats { unsigned entry_lookups; unsigned entry_hits; unsigned entry_misses; unsigned entry_discards; unsigned cav_lookups; unsigned cav_hits; unsigned cav_probes; unsigned cav_misses; }; /** * avc_cache_stats - get cache access statistics. * @stats: reference to statistics structure * * Fill the supplied structure with information about AVC * activity since the last call to avc_init() or * avc_reset(). See the structure definition for * details. */ void avc_cache_stats(struct avc_cache_stats *stats); /** * avc_av_stats - log av table statistics. * * Log a message with information about the size and * distribution of the access vector table. The audit * callback is used to print the message. */ void avc_av_stats(void); /** * avc_sid_stats - log SID table statistics. * * Log a message with information about the size and * distribution of the SID table. The audit callback * is used to print the message. */ void avc_sid_stats(void); /** * avc_netlink_open - Create a netlink socket and connect to the kernel. */ int avc_netlink_open(int blocking); /** * avc_netlink_loop - Wait for netlink messages from the kernel */ void avc_netlink_loop(void); /** * avc_netlink_close - Close the netlink socket */ void avc_netlink_close(void); /** * avc_netlink_acquire_fd - Acquire netlink socket fd. * * Allows the application to manage messages from the netlink socket in * its own main loop. */ int avc_netlink_acquire_fd(void); /** * avc_netlink_release_fd - Release netlink socket fd. * * Returns ownership of the netlink socket to the library. */ void avc_netlink_release_fd(void); /** * avc_netlink_check_nb - Check netlink socket for new messages. * * Called by the application when using avc_netlink_acquire_fd() to * process kernel netlink events. */ int avc_netlink_check_nb(void); /** * selinux_status_open - Open and map SELinux kernel status page * */ int selinux_status_open(int fallback); /** * selinux_status_close - Unmap and close SELinux kernel status page * */ void selinux_status_close(void); /** * selinux_status_updated - Inform us whether the kernel status has been updated * */ int selinux_status_updated(void); /** * selinux_status_getenforce - Get the enforce flag value * */ int selinux_status_getenforce(void); /** * selinux_status_policyload - Get the number of policy reloaded * */ int selinux_status_policyload(void); /** * selinux_status_deny_unknown - Get the behavior for undefined classes/permissions * */ int selinux_status_deny_unknown(void); #ifdef __cplusplus } #endif #endif /* _SELINUX_AVC_H_ */ selinux/context.h 0000644 00000002271 15063602044 0010072 0 ustar 00 #ifndef _SELINUX_CONTEXT_H_ #define _SELINUX_CONTEXT_H_ #ifdef __cplusplus extern "C" { #endif /* * Functions to deal with security contexts in user space. */ typedef struct { void *ptr; } context_s_t; typedef context_s_t *context_t; /* Return a new context initialized to a context string */ extern context_t context_new(const char *); /* * Return a pointer to the string value of the context_t * Valid until the next call to context_str or context_free * for the same context_t* */ extern char *context_str(context_t); /* Free the storage used by a context */ extern void context_free(context_t); /* Get a pointer to the string value of a context component */ extern const char *context_type_get(context_t); extern const char *context_range_get(context_t); extern const char *context_role_get(context_t); extern const char *context_user_get(context_t); /* Set a context component. Returns nonzero if unsuccessful */ extern int context_type_set(context_t, const char *); extern int context_range_set(context_t, const char *); extern int context_role_set(context_t, const char *); extern int context_user_set(context_t, const char *); #ifdef __cplusplus } #endif #endif selinux/flask.h 0000644 00000014400 15063602044 0007503 0 ustar 00 /* This file is automatically generated. Do not edit. */ #ifndef _SELINUX_FLASK_H_ #define _SELINUX_FLASK_H_ #warning "Please remove any #include's of this header in your source code." #warning "Instead, use string_to_security_class() to map the class name to a value." /* * Security object class definitions */ #define SECCLASS_SECURITY 1 #define SECCLASS_PROCESS 2 #define SECCLASS_SYSTEM 3 #define SECCLASS_CAPABILITY 4 #define SECCLASS_FILESYSTEM 5 #define SECCLASS_FILE 6 #define SECCLASS_DIR 7 #define SECCLASS_FD 8 #define SECCLASS_LNK_FILE 9 #define SECCLASS_CHR_FILE 10 #define SECCLASS_BLK_FILE 11 #define SECCLASS_SOCK_FILE 12 #define SECCLASS_FIFO_FILE 13 #define SECCLASS_SOCKET 14 #define SECCLASS_TCP_SOCKET 15 #define SECCLASS_UDP_SOCKET 16 #define SECCLASS_RAWIP_SOCKET 17 #define SECCLASS_NODE 18 #define SECCLASS_NETIF 19 #define SECCLASS_NETLINK_SOCKET 20 #define SECCLASS_PACKET_SOCKET 21 #define SECCLASS_KEY_SOCKET 22 #define SECCLASS_UNIX_STREAM_SOCKET 23 #define SECCLASS_UNIX_DGRAM_SOCKET 24 #define SECCLASS_SEM 25 #define SECCLASS_MSG 26 #define SECCLASS_MSGQ 27 #define SECCLASS_SHM 28 #define SECCLASS_IPC 29 #define SECCLASS_PASSWD 30 #define SECCLASS_X_DRAWABLE 31 #define SECCLASS_X_SCREEN 32 #define SECCLASS_X_GC 33 #define SECCLASS_X_FONT 34 #define SECCLASS_X_COLORMAP 35 #define SECCLASS_X_PROPERTY 36 #define SECCLASS_X_SELECTION 37 #define SECCLASS_X_CURSOR 38 #define SECCLASS_X_CLIENT 39 #define SECCLASS_X_DEVICE 40 #define SECCLASS_X_SERVER 41 #define SECCLASS_X_EXTENSION 42 #define SECCLASS_NETLINK_ROUTE_SOCKET 43 #define SECCLASS_NETLINK_FIREWALL_SOCKET 44 #define SECCLASS_NETLINK_TCPDIAG_SOCKET 45 #define SECCLASS_NETLINK_NFLOG_SOCKET 46 #define SECCLASS_NETLINK_XFRM_SOCKET 47 #define SECCLASS_NETLINK_SELINUX_SOCKET 48 #define SECCLASS_NETLINK_AUDIT_SOCKET 49 #define SECCLASS_NETLINK_IP6FW_SOCKET 50 #define SECCLASS_NETLINK_DNRT_SOCKET 51 #define SECCLASS_DBUS 52 #define SECCLASS_NSCD 53 #define SECCLASS_ASSOCIATION 54 #define SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET 55 #define SECCLASS_APPLETALK_SOCKET 56 #define SECCLASS_PACKET 57 #define SECCLASS_KEY 58 #define SECCLASS_CONTEXT 59 #define SECCLASS_DCCP_SOCKET 60 #define SECCLASS_MEMPROTECT 61 #define SECCLASS_DB_DATABASE 62 #define SECCLASS_DB_TABLE 63 #define SECCLASS_DB_PROCEDURE 64 #define SECCLASS_DB_COLUMN 65 #define SECCLASS_DB_TUPLE 66 #define SECCLASS_DB_BLOB 67 #define SECCLASS_PEER 68 #define SECCLASS_CAPABILITY2 69 #define SECCLASS_X_RESOURCE 70 #define SECCLASS_X_EVENT 71 #define SECCLASS_X_SYNTHETIC_EVENT 72 #define SECCLASS_X_APPLICATION_DATA 73 /* * Security identifier indices for initial entities */ #define SECINITSID_KERNEL 1 #define SECINITSID_SECURITY 2 #define SECINITSID_UNLABELED 3 #define SECINITSID_FS 4 #define SECINITSID_FILE 5 #define SECINITSID_FILE_LABELS 6 #define SECINITSID_INIT 7 #define SECINITSID_ANY_SOCKET 8 #define SECINITSID_PORT 9 #define SECINITSID_NETIF 10 #define SECINITSID_NETMSG 11 #define SECINITSID_NODE 12 #define SECINITSID_IGMP_PACKET 13 #define SECINITSID_ICMP_SOCKET 14 #define SECINITSID_TCP_SOCKET 15 #define SECINITSID_SYSCTL_MODPROBE 16 #define SECINITSID_SYSCTL 17 #define SECINITSID_SYSCTL_FS 18 #define SECINITSID_SYSCTL_KERNEL 19 #define SECINITSID_SYSCTL_NET 20 #define SECINITSID_SYSCTL_NET_UNIX 21 #define SECINITSID_SYSCTL_VM 22 #define SECINITSID_SYSCTL_DEV 23 #define SECINITSID_KMOD 24 #define SECINITSID_POLICY 25 #define SECINITSID_SCMP_PACKET 26 #define SECINITSID_DEVNULL 27 #define SECINITSID_NUM 27 #endif selinux/get_context_list.h 0000644 00000005550 15063602044 0011767 0 ustar 00 #ifndef _SELINUX_GET_SID_LIST_H_ #define _SELINUX_GET_SID_LIST_H_ #include <selinux/selinux.h> #ifdef __cplusplus extern "C" { #endif #define SELINUX_DEFAULTUSER "user_u" /* Get an ordered list of authorized security contexts for a user session for 'user' spawned by 'fromcon' and set *conary to refer to the NULL-terminated array of contexts. Every entry in the list will be authorized by the policy, but the ordering is subject to user customizable preferences. Returns number of entries in *conary. If 'fromcon' is NULL, defaults to current context. Caller must free via freeconary. */ extern int get_ordered_context_list(const char *user, char * fromcon, char *** list); /* As above, but use the provided MLS level rather than the default level for the user. */ int get_ordered_context_list_with_level(const char *user, const char *level, char * fromcon, char *** list); /* Get the default security context for a user session for 'user' spawned by 'fromcon' and set *newcon to refer to it. The context will be one of those authorized by the policy, but the selection of a default is subject to user customizable preferences. If 'fromcon' is NULL, defaults to current context. Returns 0 on success or -1 otherwise. Caller must free via freecon. */ extern int get_default_context(const char *user, char * fromcon, char ** newcon); /* As above, but use the provided MLS level rather than the default level for the user. */ int get_default_context_with_level(const char *user, const char *level, char * fromcon, char ** newcon); /* Same as get_default_context, but only return a context that has the specified role. If no reachable context exists for the user with that role, then return -1. */ int get_default_context_with_role(const char *user, const char *role, char * fromcon, char ** newcon); /* Same as get_default_context, but only return a context that has the specified role and level. If no reachable context exists for the user with that role, then return -1. */ int get_default_context_with_rolelevel(const char *user, const char *role, const char *level, char * fromcon, char ** newcon); /* Given a list of authorized security contexts for the user, query the user to select one and set *newcon to refer to it. Caller must free via freecon. Returns 0 on sucess or -1 otherwise. */ extern int query_user_context(char ** list, char ** newcon); /* Allow the user to manually enter a context as a fallback if a list of authorized contexts could not be obtained. Caller must free via freecon. Returns 0 on success or -1 otherwise. */ extern int manual_user_enter_context(const char *user, char ** newcon); #ifdef __cplusplus } #endif #endif selinux/get_default_type.h 0000644 00000001165 15063602044 0011733 0 ustar 00 /* get_default_type.h - contains header information and function prototypes * for functions to get the default type for a role */ #ifndef _SELINUX_GET_DEFAULT_TYPE_H_ #define _SELINUX_GET_DEFAULT_TYPE_H_ #ifdef __cplusplus extern "C" { #endif /* Return path to default type file. */ const char *selinux_default_type_path(void); /* Get the default type (domain) for 'role' and set 'type' to refer to it. Caller must free via free(). Return 0 on success or -1 otherwise. */ int get_default_type(const char *role, char **type); #ifdef __cplusplus } #endif #endif /* ifndef _GET_DEFAULT_TYPE_H_ */ selinux/label.h 0000644 00000013532 15063602044 0007467 0 ustar 00 /* * Labeling interface for userspace object managers and others. * * Author : Eamon Walsh <ewalsh@tycho.nsa.gov> */ #ifndef _SELABEL_H_ #define _SELABEL_H_ #include <stdbool.h> #include <sys/types.h> #include <selinux/selinux.h> #ifdef __cplusplus extern "C" { #endif /* * Opaque type used for all label handles. */ struct selabel_handle; /* * Available backends. */ /* file contexts */ #define SELABEL_CTX_FILE 0 /* media contexts */ #define SELABEL_CTX_MEDIA 1 /* x contexts */ #define SELABEL_CTX_X 2 /* db objects */ #define SELABEL_CTX_DB 3 /* Android property service contexts */ #define SELABEL_CTX_ANDROID_PROP 4 /* Android service contexts */ #define SELABEL_CTX_ANDROID_SERVICE 5 /* * Available options */ /* no-op option, useful for unused slots in an array of options */ #define SELABEL_OPT_UNUSED 0 /* validate contexts before returning them (boolean value) */ #define SELABEL_OPT_VALIDATE 1 /* don't use local customizations to backend data (boolean value) */ #define SELABEL_OPT_BASEONLY 2 /* specify an alternate path to use when loading backend data */ #define SELABEL_OPT_PATH 3 /* select a subset of the search space as an optimization (file backend) */ #define SELABEL_OPT_SUBSET 4 /* require a hash calculation on spec files */ #define SELABEL_OPT_DIGEST 5 /* total number of options */ #define SELABEL_NOPT 6 /* * Label operations */ /** * selabel_open - Create a labeling handle. * @backend: one of the constants specifying a supported labeling backend. * @opts: array of selabel_opt structures specifying label options or NULL. * @nopts: number of elements in opts array or zero for no options. * * Open a labeling backend for use. The available backend identifiers are * listed above. Options may be provided via the opts parameter; available * options are listed above. Not all options may be supported by every * backend. Return value is the created handle on success or NULL with * @errno set on failure. */ struct selabel_handle *selabel_open(unsigned int backend, const struct selinux_opt *opts, unsigned nopts); /** * selabel_close - Close a labeling handle. * @handle: specifies handle to close * * Destroy the specified handle, closing files, freeing allocated memory, * etc. The handle may not be further used after it has been closed. */ void selabel_close(struct selabel_handle *handle); /** * selabel_lookup - Perform labeling lookup operation. * @handle: specifies backend instance to query * @con: returns the appropriate context with which to label the object * @key: string input to lookup operation * @type: numeric input to the lookup operation * * Perform a labeling lookup operation. Return %0 on success, -%1 with * @errno set on failure. The key and type arguments are the inputs to the * lookup operation; appropriate values are dictated by the backend in use. * The result is returned in the memory pointed to by @con and must be freed * by the user with freecon(). */ int selabel_lookup(struct selabel_handle *handle, char **con, const char *key, int type); int selabel_lookup_raw(struct selabel_handle *handle, char **con, const char *key, int type); bool selabel_partial_match(struct selabel_handle *handle, const char *key); int selabel_lookup_best_match(struct selabel_handle *rec, char **con, const char *key, const char **aliases, int type); int selabel_lookup_best_match_raw(struct selabel_handle *rec, char **con, const char *key, const char **aliases, int type); /** * selabel_digest - Retrieve the SHA1 digest and the list of specfiles used to * generate the digest. The SELABEL_OPT_DIGEST option must * be set in selabel_open() to initiate the digest generation. * @handle: specifies backend instance to query * @digest: returns a pointer to the SHA1 digest. * @digest_len: returns length of digest in bytes. * @specfiles: a list of specfiles used in the SHA1 digest generation. * The list is NULL terminated and will hold @num_specfiles entries. * @num_specfiles: number of specfiles in the list. * * Return %0 on success, -%1 with @errno set on failure. */ int selabel_digest(struct selabel_handle *rec, unsigned char **digest, size_t *digest_len, char ***specfiles, size_t *num_specfiles); enum selabel_cmp_result { SELABEL_SUBSET, SELABEL_EQUAL, SELABEL_SUPERSET, SELABEL_INCOMPARABLE }; /** * selabel_cmp - Compare two label configurations. * @h1: handle for the first label configuration * @h2: handle for the first label configuration * * Compare two label configurations. * Return %SELABEL_SUBSET if @h1 is a subset of @h2, %SELABEL_EQUAL * if @h1 is identical to @h2, %SELABEL_SUPERSET if @h1 is a superset * of @h2, and %SELABEL_INCOMPARABLE if @h1 and @h2 are incomparable. */ enum selabel_cmp_result selabel_cmp(struct selabel_handle *h1, struct selabel_handle *h2); /** * selabel_stats - log labeling operation statistics. * @handle: specifies backend instance to query * * Log a message with information about the number of queries performed, * number of unused matching entries, or other operational statistics. * Message is backend-specific, some backends may not output a message. */ void selabel_stats(struct selabel_handle *handle); /* * Type codes used by specific backends */ /* X backend */ #define SELABEL_X_PROP 1 #define SELABEL_X_EXT 2 #define SELABEL_X_CLIENT 3 #define SELABEL_X_EVENT 4 #define SELABEL_X_SELN 5 #define SELABEL_X_POLYPROP 6 #define SELABEL_X_POLYSELN 7 /* DB backend */ #define SELABEL_DB_DATABASE 1 #define SELABEL_DB_SCHEMA 2 #define SELABEL_DB_TABLE 3 #define SELABEL_DB_COLUMN 4 #define SELABEL_DB_SEQUENCE 5 #define SELABEL_DB_VIEW 6 #define SELABEL_DB_PROCEDURE 7 #define SELABEL_DB_BLOB 8 #define SELABEL_DB_TUPLE 9 #define SELABEL_DB_LANGUAGE 10 #define SELABEL_DB_EXCEPTION 11 #define SELABEL_DB_DATATYPE 12 #ifdef __cplusplus } #endif #endif /* _SELABEL_H_ */ selinux/restorecon.h 0000644 00000013626 15063602044 0010577 0 ustar 00 #ifndef _RESTORECON_H_ #define _RESTORECON_H_ #include <selinux/label.h> #include <sys/types.h> #include <stdarg.h> #ifdef __cplusplus extern "C" { #endif /** * selinux_restorecon - Relabel files. * @pathname: specifies file/directory to relabel. * @restorecon_flags: specifies the actions to be performed when relabeling. * * selinux_restorecon(3) will automatically call * selinux_restorecon_default_handle(3) and selinux_restorecon_set_sehandle(3) * first time through to set the selabel_open(3) parameters to use the * currently loaded policy file_contexts and request their computed digest. * * Should other selabel_open(3) parameters be required see * selinux_restorecon_set_sehandle(3). */ extern int selinux_restorecon(const char *pathname, unsigned int restorecon_flags); /* * restorecon_flags options */ /* * Force the checking of labels even if the stored SHA1 * digest matches the specfiles SHA1 digest. */ #define SELINUX_RESTORECON_IGNORE_DIGEST 0x0001 /* * Do not change file labels. */ #define SELINUX_RESTORECON_NOCHANGE 0x0002 /* * If set, change file label to that in spec file. * If not, only change type component to that in spec file. */ #define SELINUX_RESTORECON_SET_SPECFILE_CTX 0x0004 /* * Recursively descend directories. */ #define SELINUX_RESTORECON_RECURSE 0x0008 /* * Log changes to selinux log. Note that if VERBOSE and * PROGRESS are set, then PROGRESS will take precedence. */ #define SELINUX_RESTORECON_VERBOSE 0x0010 /* * If SELINUX_RESTORECON_PROGRESS is true and * SELINUX_RESTORECON_MASS_RELABEL is true, then output approx % complete, * else output the number of files in 1k blocks processed to stdout. */ #define SELINUX_RESTORECON_PROGRESS 0x0020 /* * Convert passed-in pathname to canonical pathname. */ #define SELINUX_RESTORECON_REALPATH 0x0040 /* * Prevent descending into directories that have a different * device number than the pathname from which the descent began. */ #define SELINUX_RESTORECON_XDEV 0x0080 /* * Attempt to add an association between an inode and a specification. * If there is already an association for the inode and it conflicts * with the specification, then use the last matching specification. */ #define SELINUX_RESTORECON_ADD_ASSOC 0x0100 /* * Abort on errors during the file tree walk. */ #define SELINUX_RESTORECON_ABORT_ON_ERROR 0x0200 /* * Log any label changes to syslog. */ #define SELINUX_RESTORECON_SYSLOG_CHANGES 0x0400 /* * Log what spec matched each file. */ #define SELINUX_RESTORECON_LOG_MATCHES 0x0800 /* * Ignore files that do not exist. */ #define SELINUX_RESTORECON_IGNORE_NOENTRY 0x1000 /* * Do not read /proc/mounts to obtain a list of non-seclabel * mounts to be excluded from relabeling checks. */ #define SELINUX_RESTORECON_IGNORE_MOUNTS 0x2000 /* * Set if there is a mass relabel required. * See SELINUX_RESTORECON_PROGRESS flag for details. */ #define SELINUX_RESTORECON_MASS_RELABEL 0x4000 /** * selinux_restorecon_set_sehandle - Set the global fc handle. * @hndl: specifies handle to set as the global fc handle. * * Called by a process that has already called selabel_open(3) with it's * required parameters, or if selinux_restorecon_default_handle(3) has been * called to set the default selabel_open(3) parameters. */ extern void selinux_restorecon_set_sehandle(struct selabel_handle *hndl); /** * selinux_restorecon_default_handle - Sets default selabel_open(3) parameters * to use the currently loaded policy and * file_contexts, also requests the digest. * * Return value is the created handle on success or NULL with @errno set on * failure. */ extern struct selabel_handle *selinux_restorecon_default_handle(void); /** * selinux_restorecon_set_exclude_list - Add a list of directories that are * to be excluded from relabeling. * @exclude_list: containing a NULL terminated list of one or more * directories not to be relabeled. */ extern void selinux_restorecon_set_exclude_list(const char **exclude_list); /** * selinux_restorecon_set_alt_rootpath - Use alternate rootpath. * @alt_rootpath: containing the alternate rootpath to be used. * * Return %0 on success, -%1 with @errno set on failure. */ extern int selinux_restorecon_set_alt_rootpath(const char *alt_rootpath); /** * selinux_restorecon_xattr - Read/remove RESTORECON_LAST xattr entries. * @pathname: specifies directory path to check. * @xattr_flags: specifies the actions to be performed. * @xattr_list: a linked list of struct dir_xattr structures containing * the directory, digest and result of the action on the * RESTORECON_LAST entry. * * selinux_restorecon_xattr(3) will automatically call * selinux_restorecon_default_handle(3) and selinux_restorecon_set_sehandle(3) * first time through to set the selabel_open(3) parameters to use the * currently loaded policy file_contexts and request their computed digest. * * Should other selabel_open(3) parameters be required see * selinux_restorecon_set_sehandle(3), however note that a file_contexts * computed digest is required for selinux_restorecon_xattr(). */ enum digest_result { MATCH = 0, NOMATCH, DELETED_MATCH, DELETED_NOMATCH, ERROR }; struct dir_xattr { char *directory; char *digest; /* A hex encoded string that can be printed. */ enum digest_result result; struct dir_xattr *next; }; extern int selinux_restorecon_xattr(const char *pathname, unsigned int xattr_flags, struct dir_xattr ***xattr_list); /* * xattr_flags options */ /* Recursively descend directories. */ #define SELINUX_RESTORECON_XATTR_RECURSE 0x0001 /* Delete non-matching digests from each directory in pathname. */ #define SELINUX_RESTORECON_XATTR_DELETE_NONMATCH_DIGESTS 0x0002 /* Delete all digests found in pathname. */ #define SELINUX_RESTORECON_XATTR_DELETE_ALL_DIGESTS 0x0004 /* Do not read /proc/mounts. */ #define SELINUX_RESTORECON_XATTR_IGNORE_MOUNTS 0x0008 #ifdef __cplusplus } #endif #endif selinux/selinux.h 0000644 00000065623 15063602044 0010107 0 ustar 00 #ifndef _SELINUX_H_ #define _SELINUX_H_ #include <sys/types.h> #include <stdarg.h> #ifdef __cplusplus extern "C" { #endif /* Return 1 if we are running on a SELinux kernel, or 0 if not or -1 if we get an error. */ extern int is_selinux_enabled(void); /* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */ extern int is_selinux_mls_enabled(void); /* No longer used; here for compatibility with legacy callers. */ typedef char *security_context_t; /* Free the memory allocated for a context by any of the below get* calls. */ extern void freecon(char * con); /* Free the memory allocated for a context array by security_compute_user. */ extern void freeconary(char ** con); /* Wrappers for the /proc/pid/attr API. */ /* Get current context, and set *con to refer to it. Caller must free via freecon. */ extern int getcon(char ** con); extern int getcon_raw(char ** con); /* Set the current security context to con. Note that use of this function requires that the entire application be trusted to maintain any desired separation between the old and new security contexts, unlike exec-based transitions performed via setexeccon. When possible, decompose your application and use setexeccon()+execve() instead. Note that the application may lose access to its open descriptors as a result of a setcon() unless policy allows it to use descriptors opened by the old context. */ extern int setcon(const char * con); extern int setcon_raw(const char * con); /* Get context of process identified by pid, and set *con to refer to it. Caller must free via freecon. */ extern int getpidcon(pid_t pid, char ** con); extern int getpidcon_raw(pid_t pid, char ** con); /* Get previous context (prior to last exec), and set *con to refer to it. Caller must free via freecon. */ extern int getprevcon(char ** con); extern int getprevcon_raw(char ** con); /* Get exec context, and set *con to refer to it. Sets *con to NULL if no exec context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getexeccon(char ** con); extern int getexeccon_raw(char ** con); /* Set exec security context for the next execve. Call with NULL if you want to reset to the default. */ extern int setexeccon(const char * con); extern int setexeccon_raw(const char * con); /* Get fscreate context, and set *con to refer to it. Sets *con to NULL if no fs create context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getfscreatecon(char ** con); extern int getfscreatecon_raw(char ** con); /* Set the fscreate security context for subsequent file creations. Call with NULL if you want to reset to the default. */ extern int setfscreatecon(const char * context); extern int setfscreatecon_raw(const char * context); /* Get keycreate context, and set *con to refer to it. Sets *con to NULL if no key create context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getkeycreatecon(char ** con); extern int getkeycreatecon_raw(char ** con); /* Set the keycreate security context for subsequent key creations. Call with NULL if you want to reset to the default. */ extern int setkeycreatecon(const char * context); extern int setkeycreatecon_raw(const char * context); /* Get sockcreate context, and set *con to refer to it. Sets *con to NULL if no socket create context has been set, i.e. using default. If non-NULL, caller must free via freecon. */ extern int getsockcreatecon(char ** con); extern int getsockcreatecon_raw(char ** con); /* Set the sockcreate security context for subsequent socket creations. Call with NULL if you want to reset to the default. */ extern int setsockcreatecon(const char * context); extern int setsockcreatecon_raw(const char * context); /* Wrappers for the xattr API. */ /* Get file context, and set *con to refer to it. Caller must free via freecon. */ extern int getfilecon(const char *path, char ** con); extern int getfilecon_raw(const char *path, char ** con); extern int lgetfilecon(const char *path, char ** con); extern int lgetfilecon_raw(const char *path, char ** con); extern int fgetfilecon(int fd, char ** con); extern int fgetfilecon_raw(int fd, char ** con); /* Set file context */ extern int setfilecon(const char *path, const char * con); extern int setfilecon_raw(const char *path, const char * con); extern int lsetfilecon(const char *path, const char * con); extern int lsetfilecon_raw(const char *path, const char * con); extern int fsetfilecon(int fd, const char * con); extern int fsetfilecon_raw(int fd, const char * con); /* Wrappers for the socket API */ /* Get context of peer socket, and set *con to refer to it. Caller must free via freecon. */ extern int getpeercon(int fd, char ** con); extern int getpeercon_raw(int fd, char ** con); /* Wrappers for the selinuxfs (policy) API. */ typedef unsigned int access_vector_t; typedef unsigned short security_class_t; struct av_decision { access_vector_t allowed; access_vector_t decided; access_vector_t auditallow; access_vector_t auditdeny; unsigned int seqno; unsigned int flags; }; /* Definitions of av_decision.flags */ #define SELINUX_AVD_FLAGS_PERMISSIVE 0x0001 /* Structure for passing options, used by AVC and label subsystems */ struct selinux_opt { int type; const char *value; }; /* Callback facilities */ union selinux_callback { /* log the printf-style format and arguments, with the type code indicating the type of message */ int #ifdef __GNUC__ __attribute__ ((format(printf, 2, 3))) #endif (*func_log) (int type, const char *fmt, ...); /* store a string representation of auditdata (corresponding to the given security class) into msgbuf. */ int (*func_audit) (void *auditdata, security_class_t cls, char *msgbuf, size_t msgbufsize); /* validate the supplied context, modifying if necessary */ int (*func_validate) (char **ctx); /* netlink callback for setenforce message */ int (*func_setenforce) (int enforcing); /* netlink callback for policyload message */ int (*func_policyload) (int seqno); }; #define SELINUX_CB_LOG 0 #define SELINUX_CB_AUDIT 1 #define SELINUX_CB_VALIDATE 2 #define SELINUX_CB_SETENFORCE 3 #define SELINUX_CB_POLICYLOAD 4 extern union selinux_callback selinux_get_callback(int type); extern void selinux_set_callback(int type, union selinux_callback cb); /* Logging type codes, passed to the logging callback */ #define SELINUX_ERROR 0 #define SELINUX_WARNING 1 #define SELINUX_INFO 2 #define SELINUX_AVC 3 #define SELINUX_TRANS_DIR "/var/run/setrans" /* Compute an access decision. */ extern int security_compute_av(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); extern int security_compute_av_raw(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); extern int security_compute_av_flags(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); extern int security_compute_av_flags_raw(const char * scon, const char * tcon, security_class_t tclass, access_vector_t requested, struct av_decision *avd); /* Compute a labeling decision and set *newcon to refer to it. Caller must free via freecon. */ extern int security_compute_create(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_create_raw(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_create_name(const char * scon, const char * tcon, security_class_t tclass, const char *objname, char ** newcon); extern int security_compute_create_name_raw(const char * scon, const char * tcon, security_class_t tclass, const char *objname, char ** newcon); /* Compute a relabeling decision and set *newcon to refer to it. Caller must free via freecon. */ extern int security_compute_relabel(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_relabel_raw(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); /* Compute a polyinstantiation member decision and set *newcon to refer to it. Caller must free via freecon. */ extern int security_compute_member(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); extern int security_compute_member_raw(const char * scon, const char * tcon, security_class_t tclass, char ** newcon); /* * Compute the set of reachable user contexts and set *con to refer to * the NULL-terminated array of contexts. Caller must free via freeconary. * These interfaces are deprecated. Use get_ordered_context_list() or * one of its variant interfaces instead. */ extern int security_compute_user(const char * scon, const char *username, char *** con); extern int security_compute_user_raw(const char * scon, const char *username, char *** con); /* Load a policy configuration. */ extern int security_load_policy(void *data, size_t len); /* Get the context of an initial kernel security identifier by name. Caller must free via freecon */ extern int security_get_initial_context(const char *name, char ** con); extern int security_get_initial_context_raw(const char *name, char ** con); /* * Make a policy image and load it. * This function provides a higher level interface for loading policy * than security_load_policy, internally determining the right policy * version, locating and opening the policy file, mapping it into memory, * manipulating it as needed for current boolean settings and/or local * definitions, and then calling security_load_policy to load it. * * 'preservebools' is a boolean flag indicating whether current * policy boolean values should be preserved into the new policy (if 1) * or reset to the saved policy settings (if 0). The former case is the * default for policy reloads, while the latter case is an option for policy * reloads but is primarily for the initial policy load. */ extern int selinux_mkload_policy(int preservebools); /* * Perform the initial policy load. * This function determines the desired enforcing mode, sets the * the *enforce argument accordingly for the caller to use, sets the * SELinux kernel enforcing status to match it, and loads the policy. * It also internally handles the initial selinuxfs mount required to * perform these actions. * * The function returns 0 if everything including the policy load succeeds. * In this case, init is expected to re-exec itself in order to transition * to the proper security context. * Otherwise, the function returns -1, and init must check *enforce to * determine how to proceed. If enforcing (*enforce > 0), then init should * halt the system. Otherwise, init may proceed normally without a re-exec. */ extern int selinux_init_load_policy(int *enforce); /* Translate boolean strict to name value pair. */ typedef struct { char *name; int value; } SELboolean; /* save a list of booleans in a single transaction. */ extern int security_set_boolean_list(size_t boolcnt, SELboolean * boollist, int permanent); /* Load policy boolean settings. Path may be NULL, in which case the booleans are loaded from the active policy boolean configuration file. */ extern int security_load_booleans(char *path); /* Check the validity of a security context. */ extern int security_check_context(const char * con); extern int security_check_context_raw(const char * con); /* Canonicalize a security context. */ extern int security_canonicalize_context(const char * con, char ** canoncon); extern int security_canonicalize_context_raw(const char * con, char ** canoncon); /* Get the enforce flag value. */ extern int security_getenforce(void); /* Set the enforce flag value. */ extern int security_setenforce(int value); /* Get the load-time behavior for undefined classes/permissions */ extern int security_reject_unknown(void); /* Get the runtime behavior for undefined classes/permissions */ extern int security_deny_unknown(void); /* Get the checkreqprot value */ extern int security_get_checkreqprot(void); /* Disable SELinux at runtime (must be done prior to initial policy load). */ extern int security_disable(void); /* Get the policy version number. */ extern int security_policyvers(void); /* Get the boolean names */ extern int security_get_boolean_names(char ***names, int *len); /* Get the pending value for the boolean */ extern int security_get_boolean_pending(const char *name); /* Get the active value for the boolean */ extern int security_get_boolean_active(const char *name); /* Set the pending value for the boolean */ extern int security_set_boolean(const char *name, int value); /* Commit the pending values for the booleans */ extern int security_commit_booleans(void); /* Userspace class mapping support */ struct security_class_mapping { const char *name; const char *perms[sizeof(access_vector_t) * 8 + 1]; }; /** * selinux_set_mapping - Enable dynamic mapping between integer offsets and security class names * @map: array of security_class_mapping structures * * The core avc_has_perm() API uses integers to represent security * classes; previous to the introduction of this function, it was * common for userspace object managers to be compiled using generated * offsets for a particular policy. However, that strongly ties the build of the userspace components to a particular policy. * * By using this function to map between integer offsets and security * class names, it's possible to replace a system policies that have * at least the same set of security class names as used by the * userspace object managers. * * To correctly use this function, you should override the generated * security class defines from the system policy in a local header, * starting at 1, and have one security_class_mapping structure entry * per define. */ extern int selinux_set_mapping(struct security_class_mapping *map); /* Common helpers */ /* Convert between mode and security class values */ extern security_class_t mode_to_security_class(mode_t mode); /* Convert between security class values and string names */ extern security_class_t string_to_security_class(const char *name); extern const char *security_class_to_string(security_class_t cls); /* Convert between individual access vector permissions and string names */ extern const char *security_av_perm_to_string(security_class_t tclass, access_vector_t perm); extern access_vector_t string_to_av_perm(security_class_t tclass, const char *name); /* Returns an access vector in a string representation. User must free the * returned string via free(). */ extern int security_av_string(security_class_t tclass, access_vector_t av, char **result); /* Display an access vector in a string representation. */ extern void print_access_vector(security_class_t tclass, access_vector_t av); /* Set the function used by matchpathcon_init when displaying errors about the file_contexts configuration. If not set, then this defaults to fprintf(stderr, fmt, ...). */ extern void set_matchpathcon_printf(void (*f) (const char *fmt, ...)); /* Set the function used by matchpathcon_init when checking the validity of a context in the file contexts configuration. If not set, then this defaults to a test based on security_check_context(). The function is also responsible for reporting any such error, and may include the 'path' and 'lineno' in such error messages. */ extern void set_matchpathcon_invalidcon(int (*f) (const char *path, unsigned lineno, char *context)); /* Same as above, but also allows canonicalization of the context, by changing *context to refer to the canonical form. If not set, and invalidcon is also not set, then this defaults to calling security_canonicalize_context(). */ extern void set_matchpathcon_canoncon(int (*f) (const char *path, unsigned lineno, char **context)); /* Set flags controlling operation of matchpathcon_init or matchpathcon. */ #define MATCHPATHCON_BASEONLY 1 /* Only process the base file_contexts file. */ #define MATCHPATHCON_NOTRANS 2 /* Do not perform any context translation. */ #define MATCHPATHCON_VALIDATE 4 /* Validate/canonicalize contexts at init time. */ extern void set_matchpathcon_flags(unsigned int flags); /* Load the file contexts configuration specified by 'path' into memory for use by subsequent matchpathcon calls. If 'path' is NULL, then load the active file contexts configuration, i.e. the path returned by selinux_file_context_path(). Unless the MATCHPATHCON_BASEONLY flag has been set, this function also checks for a 'path'.homedirs file and a 'path'.local file and loads additional specifications from them if present. */ extern int matchpathcon_init(const char *path); /* Same as matchpathcon_init, but only load entries with regexes that have stems that are prefixes of 'prefix'. */ extern int matchpathcon_init_prefix(const char *path, const char *prefix); /* Free the memory allocated by matchpathcon_init. */ extern void matchpathcon_fini(void); /* Resolve all of the symlinks and relative portions of a pathname, but NOT * the final component (same a realpath() unless the final component is a * symlink. Resolved path must be a path of size PATH_MAX + 1 */ extern int realpath_not_final(const char *name, char *resolved_path); /* Match the specified pathname and mode against the file contexts configuration and set *con to refer to the resulting context. 'mode' can be 0 to disable mode matching. Caller must free via freecon. If matchpathcon_init has not already been called, then this function will call it upon its first invocation with a NULL path. */ extern int matchpathcon(const char *path, mode_t mode, char ** con); /* Same as above, but return a specification index for later use in a matchpathcon_filespec_add() call - see below. */ extern int matchpathcon_index(const char *path, mode_t mode, char ** con); /* Maintain an association between an inode and a specification index, and check whether a conflicting specification is already associated with the same inode (e.g. due to multiple hard links). If so, then use the latter of the two specifications based on their order in the file contexts configuration. Return the used specification index. */ extern int matchpathcon_filespec_add(ino_t ino, int specind, const char *file); /* Destroy any inode associations that have been added, e.g. to restart for a new filesystem. */ extern void matchpathcon_filespec_destroy(void); /* Display statistics on the hash table usage for the associations. */ extern void matchpathcon_filespec_eval(void); /* Check to see whether any specifications had no matches and report them. The 'str' is used as a prefix for any warning messages. */ extern void matchpathcon_checkmatches(char *str); /* Match the specified media and against the media contexts configuration and set *con to refer to the resulting context. Caller must free con via freecon. */ extern int matchmediacon(const char *media, char ** con); /* selinux_getenforcemode reads the /etc/selinux/config file and determines whether the machine should be started in enforcing (1), permissive (0) or disabled (-1) mode. */ extern int selinux_getenforcemode(int *enforce); /* selinux_boolean_sub reads the /etc/selinux/TYPE/booleans.subs_dist file looking for a record with boolean_name. If a record exists selinux_boolean_sub returns the translated name otherwise it returns the original name. The returned value needs to be freed. On failure NULL will be returned. */ extern char *selinux_boolean_sub(const char *boolean_name); /* selinux_getpolicytype reads the /etc/selinux/config file and determines what the default policy for the machine is. Calling application must free policytype. */ extern int selinux_getpolicytype(char **policytype); /* selinux_policy_root reads the /etc/selinux/config file and returns the directory path under which the compiled policy file and context configuration files exist. */ extern const char *selinux_policy_root(void); /* selinux_set_policy_root sets an alternate policy root directory path under which the compiled policy file and context configuration files exist. */ extern int selinux_set_policy_root(const char *rootpath); /* These functions return the paths to specific files under the policy root directory. */ extern const char *selinux_current_policy_path(void); extern const char *selinux_binary_policy_path(void); extern const char *selinux_failsafe_context_path(void); extern const char *selinux_removable_context_path(void); extern const char *selinux_default_context_path(void); extern const char *selinux_user_contexts_path(void); extern const char *selinux_file_context_path(void); extern const char *selinux_file_context_homedir_path(void); extern const char *selinux_file_context_local_path(void); extern const char *selinux_file_context_subs_path(void); extern const char *selinux_file_context_subs_dist_path(void); extern const char *selinux_homedir_context_path(void); extern const char *selinux_media_context_path(void); extern const char *selinux_virtual_domain_context_path(void); extern const char *selinux_virtual_image_context_path(void); extern const char *selinux_lxc_contexts_path(void); extern const char *selinux_x_context_path(void); extern const char *selinux_sepgsql_context_path(void); extern const char *selinux_openrc_contexts_path(void); extern const char *selinux_openssh_contexts_path(void); extern const char *selinux_snapperd_contexts_path(void); extern const char *selinux_systemd_contexts_path(void); extern const char *selinux_contexts_path(void); extern const char *selinux_securetty_types_path(void); extern const char *selinux_booleans_subs_path(void); extern const char *selinux_booleans_path(void); extern const char *selinux_customizable_types_path(void); extern const char *selinux_users_path(void); extern const char *selinux_usersconf_path(void); extern const char *selinux_translations_path(void); extern const char *selinux_colors_path(void); extern const char *selinux_netfilter_context_path(void); extern const char *selinux_path(void); /** * selinux_check_access - Check permissions and perform appropriate auditing. * @scon: source security context * @tcon: target security context * @tclass: target security class string * @perm: requested permissions string, interpreted based on @tclass * @auditdata: auxiliary audit data * * Check the AVC to determine whether the @perm permissions are granted * for the SID pair (@scon, @tcon), interpreting the permissions * based on @tclass. * Return %0 if all @perm permissions are granted, -%1 with * @errno set to %EACCES if any permissions are denied or to another * value upon other errors. * If auditing or logging is configured the appropriate callbacks will be called * and passed the auditdata field */ extern int selinux_check_access(const char * scon, const char * tcon, const char *tclass, const char *perm, void *auditdata); /* Check a permission in the passwd class. Return 0 if granted or -1 otherwise. */ extern int selinux_check_passwd_access(access_vector_t requested); extern int checkPasswdAccess(access_vector_t requested); /* Check if the tty_context is defined as a securetty Return 0 if secure, < 0 otherwise. */ extern int selinux_check_securetty_context(const char * tty_context); /* Set the path to the selinuxfs mount point explicitly. Normally, this is determined automatically during libselinux initialization, but this is not always possible, e.g. for /sbin/init which performs the initial mount of selinuxfs. */ void set_selinuxmnt(const char *mnt); /* Check if selinuxfs exists as a kernel filesystem */ int selinuxfs_exists(void); /* clear selinuxmnt variable and free allocated memory */ void fini_selinuxmnt(void); /* Set an appropriate security context based on the filename of a helper * program, falling back to a new context with the specified type. */ extern int setexecfilecon(const char *filename, const char *fallback_type); #ifndef DISABLE_RPM /* Execute a helper for rpm in an appropriate security context. */ extern int rpm_execcon(unsigned int verified, const char *filename, char *const argv[], char *const envp[]); #endif /* Returns whether a file context is customizable, and should not be relabeled . */ extern int is_context_customizable(const char * scontext); /* Perform context translation between the human-readable format ("translated") and the internal system format ("raw"). Caller must free the resulting context via freecon. Returns -1 upon an error or 0 otherwise. If passed NULL, sets the returned context to NULL and returns 0. */ extern int selinux_trans_to_raw_context(const char * trans, char ** rawp); extern int selinux_raw_to_trans_context(const char * raw, char ** transp); /* Perform context translation between security contexts and display colors. Returns a space-separated list of ten ten hex RGB triples prefixed by hash marks, e.g. "#ff0000". Caller must free the resulting string via free. Returns -1 upon an error or 0 otherwise. */ extern int selinux_raw_context_to_color(const char * raw, char **color_str); /* Get the SELinux username and level to use for a given Linux username. These values may then be passed into the get_ordered_context_list* and get_default_context* functions to obtain a context for the user. Returns 0 on success or -1 otherwise. Caller must free the returned strings via free. */ extern int getseuserbyname(const char *linuxuser, char **seuser, char **level); /* Get the SELinux username and level to use for a given Linux username and service. These values may then be passed into the get_ordered_context_list* and get_default_context* functions to obtain a context for the user. Returns 0 on success or -1 otherwise. Caller must free the returned strings via free. */ extern int getseuser(const char *username, const char *service, char **r_seuser, char **r_level); /* Compare two file contexts, return 0 if equivalent. */ extern int selinux_file_context_cmp(const char * a, const char * b); /* * Verify the context of the file 'path' against policy. * Return 1 if match, 0 if not and -1 on error. */ extern int selinux_file_context_verify(const char *path, mode_t mode); /* This function sets the file context on to the system defaults returns 0 on success */ extern int selinux_lsetfilecon_default(const char *path); /* * Force a reset of the loaded configuration * WARNING: This is not thread safe. Be very sure that no other threads * are calling into libselinux when this is called. */ extern void selinux_reset_config(void); #ifdef __cplusplus } #endif #endif gnumake.h 0000644 00000005540 15063602044 0006350 0 ustar 00 /* External interfaces usable by dynamic objects loaded into GNU Make. --THIS API IS A "TECHNOLOGY PREVIEW" ONLY. IT IS NOT A STABLE INTERFACE-- Copyright (C) 2013-2016 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GNUMAKE_H_ #define _GNUMAKE_H_ /* Specify the location of elements read from makefiles. */ typedef struct { const char *filenm; unsigned long lineno; } gmk_floc; typedef char *(*gmk_func_ptr)(const char *nm, unsigned int argc, char **argv); #ifdef _WIN32 # ifdef GMK_BUILDING_MAKE # define GMK_EXPORT __declspec(dllexport) # else # define GMK_EXPORT __declspec(dllimport) # endif #else # define GMK_EXPORT #endif /* Free memory returned by the gmk_expand() function. */ GMK_EXPORT void gmk_free (char *str); /* Allocate memory in GNU make's context. */ GMK_EXPORT char *gmk_alloc (unsigned int len); /* Run $(eval ...) on the provided string BUFFER. */ GMK_EXPORT void gmk_eval (const char *buffer, const gmk_floc *floc); /* Run GNU make expansion on the provided string STR. Returns an allocated buffer that the caller must free with gmk_free(). */ GMK_EXPORT char *gmk_expand (const char *str); /* Register a new GNU make function NAME (maximum of 255 chars long). When the function is expanded in the makefile, FUNC will be invoked with the appropriate arguments. The return value of FUNC must be either NULL, in which case it expands to the empty string, or a pointer to the result of the expansion in a string created by gmk_alloc(). GNU make will free the memory when it's done. MIN_ARGS is the minimum number of arguments the function requires. MAX_ARGS is the maximum number of arguments (or 0 if there's no maximum). MIN_ARGS and MAX_ARGS may not exceed 255. The FLAGS value may be GMK_FUNC_DEFAULT, or one or more of the following flags OR'd together: GMK_FUNC_NOEXPAND: the arguments to the function will be not be expanded before FUNC is called. */ GMK_EXPORT void gmk_add_function (const char *name, gmk_func_ptr func, unsigned int min_args, unsigned int max_args, unsigned int flags); #define GMK_FUNC_DEFAULT 0x00 #define GMK_FUNC_NOEXPAND 0x01 #endif /* _GNUMAKE_H_ */ asm/mman.h 0000644 00000001752 15063602044 0006432 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_MMAN_H #define _ASM_X86_MMAN_H #define MAP_32BIT 0x40 /* only give out 32bit addresses */ #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS /* * Take the 4 protection key bits out of the vma->vm_flags * value and turn them in to the bits that we can put in * to a pte. * * Only override these if Protection Keys are available * (which is only on 64-bit). */ #define arch_vm_get_page_prot(vm_flags) __pgprot( \ ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \ ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \ ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \ ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0)) #define arch_calc_vm_prot_bits(prot, key) ( \ ((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \ ((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \ ((key) & 0x4 ? VM_PKEY_BIT2 : 0) | \ ((key) & 0x8 ? VM_PKEY_BIT3 : 0)) #endif #include <asm-generic/mman.h> #endif /* _ASM_X86_MMAN_H */ asm/msgbuf.h 0000644 00000002035 15063602044 0006760 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_X64_MSGBUF_H #define __ASM_X64_MSGBUF_H #if !defined(__x86_64__) || !defined(__ILP32__) #include <asm-generic/msgbuf.h> #else /* * The msqid64_ds structure for x86 architecture with x32 ABI. * * On x86-32 and x86-64 we can just use the generic definition, but * x32 uses the same binary layout as x86_64, which is differnet * from other 32-bit architectures. */ struct msqid64_ds { struct ipc64_perm msg_perm; __kernel_time_t msg_stime; /* last msgsnd time */ __kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_time_t msg_ctime; /* last change time */ __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ __kernel_ulong_t msg_qnum; /* number of messages in queue */ __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ __kernel_pid_t msg_lspid; /* pid of last msgsnd */ __kernel_pid_t msg_lrpid; /* last receive pid */ __kernel_ulong_t __unused4; __kernel_ulong_t __unused5; }; #endif #endif /* __ASM_GENERIC_MSGBUF_H */ asm/msr.h 0000644 00000000532 15063602044 0006276 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_MSR_H #define _ASM_X86_MSR_H #ifndef __ASSEMBLY__ #include <linux/types.h> #include <linux/ioctl.h> #define X86_IOC_RDMSR_REGS _IOWR('c', 0xA0, __u32[8]) #define X86_IOC_WRMSR_REGS _IOWR('c', 0xA1, __u32[8]) #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_MSR_H */ asm/mtrr.h 0000644 00000010201 15063602044 0006453 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* Generic MTRR (Memory Type Range Register) ioctls. Copyright (C) 1997-1999 Richard Gooch This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Richard Gooch may be reached by email at rgooch@atnf.csiro.au The postal address is: Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. */ #ifndef _ASM_X86_MTRR_H #define _ASM_X86_MTRR_H #include <linux/types.h> #include <linux/ioctl.h> #include <linux/errno.h> #define MTRR_IOCTL_BASE 'M' /* Warning: this structure has a different order from i386 on x86-64. The 32bit emulation code takes care of that. But you need to use this for 64bit, otherwise your X server will break. */ #ifdef __i386__ struct mtrr_sentry { unsigned long base; /* Base address */ unsigned int size; /* Size of region */ unsigned int type; /* Type of region */ }; struct mtrr_gentry { unsigned int regnum; /* Register number */ unsigned long base; /* Base address */ unsigned int size; /* Size of region */ unsigned int type; /* Type of region */ }; #else /* __i386__ */ struct mtrr_sentry { __u64 base; /* Base address */ __u32 size; /* Size of region */ __u32 type; /* Type of region */ }; struct mtrr_gentry { __u64 base; /* Base address */ __u32 size; /* Size of region */ __u32 regnum; /* Register number */ __u32 type; /* Type of region */ __u32 _pad; /* Unused */ }; #endif /* !__i386__ */ struct mtrr_var_range { __u32 base_lo; __u32 base_hi; __u32 mask_lo; __u32 mask_hi; }; /* In the Intel processor's MTRR interface, the MTRR type is always held in an 8 bit field: */ typedef __u8 mtrr_type; #define MTRR_NUM_FIXED_RANGES 88 #define MTRR_MAX_VAR_RANGES 256 struct mtrr_state_type { struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES]; mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES]; unsigned char enabled; unsigned char have_fixed; mtrr_type def_type; }; #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1) /* These are the various ioctls */ #define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry) #define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry) #define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry) #define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry) #define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry) #define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry) #define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry) #define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry) #define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry) #define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry) /* MTRR memory types, which are defined in SDM */ #define MTRR_TYPE_UNCACHABLE 0 #define MTRR_TYPE_WRCOMB 1 /*#define MTRR_TYPE_ 2*/ /*#define MTRR_TYPE_ 3*/ #define MTRR_TYPE_WRTHROUGH 4 #define MTRR_TYPE_WRPROT 5 #define MTRR_TYPE_WRBACK 6 #define MTRR_NUM_TYPES 7 /* * Invalid MTRR memory type. mtrr_type_lookup() returns this value when * MTRRs are disabled. Note, this value is allocated from the reserved * values (0x7-0xff) of the MTRR memory types. */ #define MTRR_TYPE_INVALID 0xff #endif /* _ASM_X86_MTRR_H */ asm/param.h 0000644 00000000037 15063602044 0006575 0 ustar 00 #include <asm-generic/param.h> asm/perf_regs.h 0000644 00000002573 15063602044 0007460 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PERF_REGS_H #define _ASM_X86_PERF_REGS_H enum perf_event_x86_regs { PERF_REG_X86_AX, PERF_REG_X86_BX, PERF_REG_X86_CX, PERF_REG_X86_DX, PERF_REG_X86_SI, PERF_REG_X86_DI, PERF_REG_X86_BP, PERF_REG_X86_SP, PERF_REG_X86_IP, PERF_REG_X86_FLAGS, PERF_REG_X86_CS, PERF_REG_X86_SS, PERF_REG_X86_DS, PERF_REG_X86_ES, PERF_REG_X86_FS, PERF_REG_X86_GS, PERF_REG_X86_R8, PERF_REG_X86_R9, PERF_REG_X86_R10, PERF_REG_X86_R11, PERF_REG_X86_R12, PERF_REG_X86_R13, PERF_REG_X86_R14, PERF_REG_X86_R15, /* These are the limits for the GPRs. */ PERF_REG_X86_32_MAX = PERF_REG_X86_GS + 1, PERF_REG_X86_64_MAX = PERF_REG_X86_R15 + 1, /* These all need two bits set because they are 128bit */ PERF_REG_X86_XMM0 = 32, PERF_REG_X86_XMM1 = 34, PERF_REG_X86_XMM2 = 36, PERF_REG_X86_XMM3 = 38, PERF_REG_X86_XMM4 = 40, PERF_REG_X86_XMM5 = 42, PERF_REG_X86_XMM6 = 44, PERF_REG_X86_XMM7 = 46, PERF_REG_X86_XMM8 = 48, PERF_REG_X86_XMM9 = 50, PERF_REG_X86_XMM10 = 52, PERF_REG_X86_XMM11 = 54, PERF_REG_X86_XMM12 = 56, PERF_REG_X86_XMM13 = 58, PERF_REG_X86_XMM14 = 60, PERF_REG_X86_XMM15 = 62, /* These include both GPRs and XMMX registers */ PERF_REG_X86_XMM_MAX = PERF_REG_X86_XMM15 + 2, }; #define PERF_REG_EXTENDED_MASK (~((1ULL << PERF_REG_X86_XMM0) - 1)) #endif /* _ASM_X86_PERF_REGS_H */ asm/poll.h 0000644 00000000036 15063602044 0006442 0 ustar 00 #include <asm-generic/poll.h> asm/posix_types.h 0000644 00000000340 15063602044 0010060 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ # ifdef __i386__ # include <asm/posix_types_32.h> # elif defined(__ILP32__) # include <asm/posix_types_x32.h> # else # include <asm/posix_types_64.h> # endif asm/posix_types_32.h 0000644 00000001375 15063602044 0010375 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_POSIX_TYPES_32_H #define _ASM_X86_POSIX_TYPES_32_H /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. */ typedef unsigned short __kernel_mode_t; #define __kernel_mode_t __kernel_mode_t typedef unsigned short __kernel_ipc_pid_t; #define __kernel_ipc_pid_t __kernel_ipc_pid_t typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; #define __kernel_uid_t __kernel_uid_t typedef unsigned short __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t #include <asm-generic/posix_types.h> #endif /* _ASM_X86_POSIX_TYPES_32_H */ asm/posix_types_64.h 0000644 00000001141 15063602044 0010371 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_POSIX_TYPES_64_H #define _ASM_X86_POSIX_TYPES_64_H /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. */ typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; #define __kernel_old_uid_t __kernel_old_uid_t typedef unsigned long __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t #include <asm-generic/posix_types.h> #endif /* _ASM_X86_POSIX_TYPES_64_H */ asm/posix_types_x32.h 0000644 00000001105 15063602044 0010554 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_POSIX_TYPES_X32_H #define _ASM_X86_POSIX_TYPES_X32_H /* * This file is only used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. * * These types should generally match the ones used by the 64-bit kernel, * */ typedef long long __kernel_long_t; typedef unsigned long long __kernel_ulong_t; #define __kernel_long_t __kernel_long_t #include <asm/posix_types_64.h> #endif /* _ASM_X86_POSIX_TYPES_X32_H */ asm/prctl.h 0000644 00000001152 15063602044 0006620 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PRCTL_H #define _ASM_X86_PRCTL_H #define ARCH_SET_GS 0x1001 #define ARCH_SET_FS 0x1002 #define ARCH_GET_FS 0x1003 #define ARCH_GET_GS 0x1004 #define ARCH_GET_CPUID 0x1011 #define ARCH_SET_CPUID 0x1012 #define ARCH_GET_XCOMP_SUPP 0x1021 #define ARCH_GET_XCOMP_PERM 0x1022 #define ARCH_REQ_XCOMP_PERM 0x1023 #define ARCH_GET_XCOMP_GUEST_PERM 0x1024 #define ARCH_REQ_XCOMP_GUEST_PERM 0x1025 #define ARCH_MAP_VDSO_X32 0x2001 #define ARCH_MAP_VDSO_32 0x2002 #define ARCH_MAP_VDSO_64 0x2003 #endif /* _ASM_X86_PRCTL_H */ asm/processor-flags.h 0000644 00000014737 15063602044 0010622 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PROCESSOR_FLAGS_H #define _ASM_X86_PROCESSOR_FLAGS_H /* Various flags defined: can be included from assembler. */ #include <linux/const.h> /* * EFLAGS bits */ #define X86_EFLAGS_CF_BIT 0 /* Carry Flag */ #define X86_EFLAGS_CF _BITUL(X86_EFLAGS_CF_BIT) #define X86_EFLAGS_FIXED_BIT 1 /* Bit 1 - always on */ #define X86_EFLAGS_FIXED _BITUL(X86_EFLAGS_FIXED_BIT) #define X86_EFLAGS_PF_BIT 2 /* Parity Flag */ #define X86_EFLAGS_PF _BITUL(X86_EFLAGS_PF_BIT) #define X86_EFLAGS_AF_BIT 4 /* Auxiliary carry Flag */ #define X86_EFLAGS_AF _BITUL(X86_EFLAGS_AF_BIT) #define X86_EFLAGS_ZF_BIT 6 /* Zero Flag */ #define X86_EFLAGS_ZF _BITUL(X86_EFLAGS_ZF_BIT) #define X86_EFLAGS_SF_BIT 7 /* Sign Flag */ #define X86_EFLAGS_SF _BITUL(X86_EFLAGS_SF_BIT) #define X86_EFLAGS_TF_BIT 8 /* Trap Flag */ #define X86_EFLAGS_TF _BITUL(X86_EFLAGS_TF_BIT) #define X86_EFLAGS_IF_BIT 9 /* Interrupt Flag */ #define X86_EFLAGS_IF _BITUL(X86_EFLAGS_IF_BIT) #define X86_EFLAGS_DF_BIT 10 /* Direction Flag */ #define X86_EFLAGS_DF _BITUL(X86_EFLAGS_DF_BIT) #define X86_EFLAGS_OF_BIT 11 /* Overflow Flag */ #define X86_EFLAGS_OF _BITUL(X86_EFLAGS_OF_BIT) #define X86_EFLAGS_IOPL_BIT 12 /* I/O Privilege Level (2 bits) */ #define X86_EFLAGS_IOPL (_AC(3,UL) << X86_EFLAGS_IOPL_BIT) #define X86_EFLAGS_NT_BIT 14 /* Nested Task */ #define X86_EFLAGS_NT _BITUL(X86_EFLAGS_NT_BIT) #define X86_EFLAGS_RF_BIT 16 /* Resume Flag */ #define X86_EFLAGS_RF _BITUL(X86_EFLAGS_RF_BIT) #define X86_EFLAGS_VM_BIT 17 /* Virtual Mode */ #define X86_EFLAGS_VM _BITUL(X86_EFLAGS_VM_BIT) #define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */ #define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT) #define X86_EFLAGS_VIF_BIT 19 /* Virtual Interrupt Flag */ #define X86_EFLAGS_VIF _BITUL(X86_EFLAGS_VIF_BIT) #define X86_EFLAGS_VIP_BIT 20 /* Virtual Interrupt Pending */ #define X86_EFLAGS_VIP _BITUL(X86_EFLAGS_VIP_BIT) #define X86_EFLAGS_ID_BIT 21 /* CPUID detection */ #define X86_EFLAGS_ID _BITUL(X86_EFLAGS_ID_BIT) /* * Basic CPU control in CR0 */ #define X86_CR0_PE_BIT 0 /* Protection Enable */ #define X86_CR0_PE _BITUL(X86_CR0_PE_BIT) #define X86_CR0_MP_BIT 1 /* Monitor Coprocessor */ #define X86_CR0_MP _BITUL(X86_CR0_MP_BIT) #define X86_CR0_EM_BIT 2 /* Emulation */ #define X86_CR0_EM _BITUL(X86_CR0_EM_BIT) #define X86_CR0_TS_BIT 3 /* Task Switched */ #define X86_CR0_TS _BITUL(X86_CR0_TS_BIT) #define X86_CR0_ET_BIT 4 /* Extension Type */ #define X86_CR0_ET _BITUL(X86_CR0_ET_BIT) #define X86_CR0_NE_BIT 5 /* Numeric Error */ #define X86_CR0_NE _BITUL(X86_CR0_NE_BIT) #define X86_CR0_WP_BIT 16 /* Write Protect */ #define X86_CR0_WP _BITUL(X86_CR0_WP_BIT) #define X86_CR0_AM_BIT 18 /* Alignment Mask */ #define X86_CR0_AM _BITUL(X86_CR0_AM_BIT) #define X86_CR0_NW_BIT 29 /* Not Write-through */ #define X86_CR0_NW _BITUL(X86_CR0_NW_BIT) #define X86_CR0_CD_BIT 30 /* Cache Disable */ #define X86_CR0_CD _BITUL(X86_CR0_CD_BIT) #define X86_CR0_PG_BIT 31 /* Paging */ #define X86_CR0_PG _BITUL(X86_CR0_PG_BIT) /* * Paging options in CR3 */ #define X86_CR3_PWT_BIT 3 /* Page Write Through */ #define X86_CR3_PWT _BITUL(X86_CR3_PWT_BIT) #define X86_CR3_PCD_BIT 4 /* Page Cache Disable */ #define X86_CR3_PCD _BITUL(X86_CR3_PCD_BIT) #define X86_CR3_PCID_BITS 12 #define X86_CR3_PCID_MASK (_AC((1UL << X86_CR3_PCID_BITS) - 1, UL)) #define X86_CR3_PCID_NOFLUSH_BIT 63 /* Preserve old PCID */ #define X86_CR3_PCID_NOFLUSH _BITULL(X86_CR3_PCID_NOFLUSH_BIT) /* * Intel CPU features in CR4 */ #define X86_CR4_VME_BIT 0 /* enable vm86 extensions */ #define X86_CR4_VME _BITUL(X86_CR4_VME_BIT) #define X86_CR4_PVI_BIT 1 /* virtual interrupts flag enable */ #define X86_CR4_PVI _BITUL(X86_CR4_PVI_BIT) #define X86_CR4_TSD_BIT 2 /* disable time stamp at ipl 3 */ #define X86_CR4_TSD _BITUL(X86_CR4_TSD_BIT) #define X86_CR4_DE_BIT 3 /* enable debugging extensions */ #define X86_CR4_DE _BITUL(X86_CR4_DE_BIT) #define X86_CR4_PSE_BIT 4 /* enable page size extensions */ #define X86_CR4_PSE _BITUL(X86_CR4_PSE_BIT) #define X86_CR4_PAE_BIT 5 /* enable physical address extensions */ #define X86_CR4_PAE _BITUL(X86_CR4_PAE_BIT) #define X86_CR4_MCE_BIT 6 /* Machine check enable */ #define X86_CR4_MCE _BITUL(X86_CR4_MCE_BIT) #define X86_CR4_PGE_BIT 7 /* enable global pages */ #define X86_CR4_PGE _BITUL(X86_CR4_PGE_BIT) #define X86_CR4_PCE_BIT 8 /* enable performance counters at ipl 3 */ #define X86_CR4_PCE _BITUL(X86_CR4_PCE_BIT) #define X86_CR4_OSFXSR_BIT 9 /* enable fast FPU save and restore */ #define X86_CR4_OSFXSR _BITUL(X86_CR4_OSFXSR_BIT) #define X86_CR4_OSXMMEXCPT_BIT 10 /* enable unmasked SSE exceptions */ #define X86_CR4_OSXMMEXCPT _BITUL(X86_CR4_OSXMMEXCPT_BIT) #define X86_CR4_UMIP_BIT 11 /* enable UMIP support */ #define X86_CR4_UMIP _BITUL(X86_CR4_UMIP_BIT) #define X86_CR4_LA57_BIT 12 /* enable 5-level page tables */ #define X86_CR4_LA57 _BITUL(X86_CR4_LA57_BIT) #define X86_CR4_VMXE_BIT 13 /* enable VMX virtualization */ #define X86_CR4_VMXE _BITUL(X86_CR4_VMXE_BIT) #define X86_CR4_SMXE_BIT 14 /* enable safer mode (TXT) */ #define X86_CR4_SMXE _BITUL(X86_CR4_SMXE_BIT) #define X86_CR4_FSGSBASE_BIT 16 /* enable RDWRFSGS support */ #define X86_CR4_FSGSBASE _BITUL(X86_CR4_FSGSBASE_BIT) #define X86_CR4_PCIDE_BIT 17 /* enable PCID support */ #define X86_CR4_PCIDE _BITUL(X86_CR4_PCIDE_BIT) #define X86_CR4_OSXSAVE_BIT 18 /* enable xsave and xrestore */ #define X86_CR4_OSXSAVE _BITUL(X86_CR4_OSXSAVE_BIT) #define X86_CR4_SMEP_BIT 20 /* enable SMEP support */ #define X86_CR4_SMEP _BITUL(X86_CR4_SMEP_BIT) #define X86_CR4_SMAP_BIT 21 /* enable SMAP support */ #define X86_CR4_SMAP _BITUL(X86_CR4_SMAP_BIT) #define X86_CR4_PKE_BIT 22 /* enable Protection Keys support */ #define X86_CR4_PKE _BITUL(X86_CR4_PKE_BIT) /* * x86-64 Task Priority Register, CR8 */ #define X86_CR8_TPR _AC(0x0000000f,UL) /* task priority register */ /* * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h> */ /* * NSC/Cyrix CPU configuration register indexes */ #define CX86_PCR0 0x20 #define CX86_GCR 0xb8 #define CX86_CCR0 0xc0 #define CX86_CCR1 0xc1 #define CX86_CCR2 0xc2 #define CX86_CCR3 0xc3 #define CX86_CCR4 0xe8 #define CX86_CCR5 0xe9 #define CX86_CCR6 0xea #define CX86_CCR7 0xeb #define CX86_PCR1 0xf0 #define CX86_DIR0 0xfe #define CX86_DIR1 0xff #define CX86_ARR_BASE 0xc4 #define CX86_RCR_BASE 0xdc #define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \ X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \ X86_CR0_PG) #endif /* _ASM_X86_PROCESSOR_FLAGS_H */ asm/ptrace-abi.h 0000644 00000003765 15063602044 0007517 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PTRACE_ABI_H #define _ASM_X86_PTRACE_ABI_H #ifdef __i386__ #define EBX 0 #define ECX 1 #define EDX 2 #define ESI 3 #define EDI 4 #define EBP 5 #define EAX 6 #define DS 7 #define ES 8 #define FS 9 #define GS 10 #define ORIG_EAX 11 #define EIP 12 #define CS 13 #define EFL 14 #define UESP 15 #define SS 16 #define FRAME_SIZE 17 #else /* __i386__ */ #if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) /* * C ABI says these regs are callee-preserved. They aren't saved on kernel entry * unless syscall needs a complete, fully filled "struct pt_regs". */ #define R15 0 #define R14 8 #define R13 16 #define R12 24 #define RBP 32 #define RBX 40 /* These regs are callee-clobbered. Always saved on kernel entry. */ #define R11 48 #define R10 56 #define R9 64 #define R8 72 #define RAX 80 #define RCX 88 #define RDX 96 #define RSI 104 #define RDI 112 /* * On syscall entry, this is syscall#. On CPU exception, this is error code. * On hw interrupt, it's IRQ number: */ #define ORIG_RAX 120 /* Return frame for iretq */ #define RIP 128 #define CS 136 #define EFLAGS 144 #define RSP 152 #define SS 160 #endif /* __ASSEMBLY__ */ /* top of stack page */ #define FRAME_SIZE 168 #endif /* !__i386__ */ /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ #define PTRACE_GETREGS 12 #define PTRACE_SETREGS 13 #define PTRACE_GETFPREGS 14 #define PTRACE_SETFPREGS 15 #define PTRACE_GETFPXREGS 18 #define PTRACE_SETFPXREGS 19 #define PTRACE_OLDSETOPTIONS 21 /* only useful for access 32bit programs / kernels */ #define PTRACE_GET_THREAD_AREA 25 #define PTRACE_SET_THREAD_AREA 26 #ifdef __x86_64__ # define PTRACE_ARCH_PRCTL 30 #endif #define PTRACE_SYSEMU 31 #define PTRACE_SYSEMU_SINGLESTEP 32 #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */ #ifndef __ASSEMBLY__ #include <linux/types.h> #endif #endif /* _ASM_X86_PTRACE_ABI_H */ asm/ptrace.h 0000644 00000002727 15063602044 0006763 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_PTRACE_H #define _ASM_X86_PTRACE_H /* For */ #include <asm/ptrace-abi.h> #include <asm/processor-flags.h> #ifndef __ASSEMBLY__ #ifdef __i386__ /* this struct defines the way the registers are stored on the stack during a system call. */ struct pt_regs { long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; int xds; int xes; int xfs; int xgs; long orig_eax; long eip; int xcs; long eflags; long esp; int xss; }; #else /* __i386__ */ struct pt_regs { /* * C ABI says these regs are callee-preserved. They aren't saved on kernel entry * unless syscall needs a complete, fully filled "struct pt_regs". */ unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long rbp; unsigned long rbx; /* These regs are callee-clobbered. Always saved on kernel entry. */ unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long rax; unsigned long rcx; unsigned long rdx; unsigned long rsi; unsigned long rdi; /* * On syscall entry, this is syscall#. On CPU exception, this is error code. * On hw interrupt, it's IRQ number: */ unsigned long orig_rax; /* Return frame for iretq */ unsigned long rip; unsigned long cs; unsigned long eflags; unsigned long rsp; unsigned long ss; /* top of stack page */ }; #endif /* !__i386__ */ #endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_PTRACE_H */ asm/resource.h 0000644 00000000042 15063602044 0007320 0 ustar 00 #include <asm-generic/resource.h> asm/sembuf.h 0000644 00000002025 15063602044 0006755 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SEMBUF_H #define _ASM_X86_SEMBUF_H /* * The semid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * * Pad space is left for: * - 2 miscellaneous 32-bit values * * x86_64 and x32 incorrectly added padding here, so the structures * are still incompatible with the padding on x86. */ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #ifdef __i386__ unsigned long sem_otime; /* last semop time */ unsigned long sem_otime_high; unsigned long sem_ctime; /* last change time */ unsigned long sem_ctime_high; #else __kernel_time_t sem_otime; /* last semop time */ __kernel_ulong_t __unused1; __kernel_time_t sem_ctime; /* last change time */ __kernel_ulong_t __unused2; #endif __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ __kernel_ulong_t __unused3; __kernel_ulong_t __unused4; }; #endif /* _ASM_X86_SEMBUF_H */ asm/setup.h 0000644 00000000006 15063602044 0006631 0 ustar 00 /* */ asm/sgx.h 0000644 00000020226 15063602044 0006300 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2016-20 Intel Corporation. */ #ifndef _ASM_X86_SGX_H #define _ASM_X86_SGX_H #include <linux/types.h> #include <linux/ioctl.h> /** * enum sgx_page_flags - page control flags * %SGX_PAGE_MEASURE: Measure the page contents with a sequence of * ENCLS[EEXTEND] operations. */ enum sgx_page_flags { SGX_PAGE_MEASURE = 0x01, }; #define SGX_MAGIC 0xA4 #define SGX_IOC_ENCLAVE_CREATE \ _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) #define SGX_IOC_ENCLAVE_ADD_PAGES \ _IOWR(SGX_MAGIC, 0x01, struct sgx_enclave_add_pages) #define SGX_IOC_ENCLAVE_INIT \ _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) #define SGX_IOC_ENCLAVE_PROVISION \ _IOW(SGX_MAGIC, 0x03, struct sgx_enclave_provision) #define SGX_IOC_VEPC_REMOVE_ALL \ _IO(SGX_MAGIC, 0x04) #define SGX_IOC_ENCLAVE_RESTRICT_PERMISSIONS \ _IOWR(SGX_MAGIC, 0x05, struct sgx_enclave_restrict_permissions) #define SGX_IOC_ENCLAVE_MODIFY_TYPES \ _IOWR(SGX_MAGIC, 0x06, struct sgx_enclave_modify_types) #define SGX_IOC_ENCLAVE_REMOVE_PAGES \ _IOWR(SGX_MAGIC, 0x07, struct sgx_enclave_remove_pages) /** * struct sgx_enclave_create - parameter structure for the * %SGX_IOC_ENCLAVE_CREATE ioctl * @src: address for the SECS page data */ struct sgx_enclave_create { __u64 src; }; /** * struct sgx_enclave_add_pages - parameter structure for the * %SGX_IOC_ENCLAVE_ADD_PAGE ioctl * @src: start address for the page data * @offset: starting page offset * @length: length of the data (multiple of the page size) * @secinfo: address for the SECINFO data * @flags: page control flags * @count: number of bytes added (multiple of the page size) */ struct sgx_enclave_add_pages { __u64 src; __u64 offset; __u64 length; __u64 secinfo; __u64 flags; __u64 count; }; /** * struct sgx_enclave_init - parameter structure for the * %SGX_IOC_ENCLAVE_INIT ioctl * @sigstruct: address for the SIGSTRUCT data */ struct sgx_enclave_init { __u64 sigstruct; }; /** * struct sgx_enclave_provision - parameter structure for the * %SGX_IOC_ENCLAVE_PROVISION ioctl * @fd: file handle of /dev/sgx_provision */ struct sgx_enclave_provision { __u64 fd; }; /** * struct sgx_enclave_restrict_permissions - parameters for ioctl * %SGX_IOC_ENCLAVE_RESTRICT_PERMISSIONS * @offset: starting page offset (page aligned relative to enclave base * address defined in SECS) * @length: length of memory (multiple of the page size) * @permissions:new permission bits for pages in range described by @offset * and @length * @result: (output) SGX result code of ENCLS[EMODPR] function * @count: (output) bytes successfully changed (multiple of page size) */ struct sgx_enclave_restrict_permissions { __u64 offset; __u64 length; __u64 permissions; __u64 result; __u64 count; }; /** * struct sgx_enclave_modify_types - parameters for ioctl * %SGX_IOC_ENCLAVE_MODIFY_TYPES * @offset: starting page offset (page aligned relative to enclave base * address defined in SECS) * @length: length of memory (multiple of the page size) * @page_type: new type for pages in range described by @offset and @length * @result: (output) SGX result code of ENCLS[EMODT] function * @count: (output) bytes successfully changed (multiple of page size) */ struct sgx_enclave_modify_types { __u64 offset; __u64 length; __u64 page_type; __u64 result; __u64 count; }; /** * struct sgx_enclave_remove_pages - %SGX_IOC_ENCLAVE_REMOVE_PAGES parameters * @offset: starting page offset (page aligned relative to enclave base * address defined in SECS) * @length: length of memory (multiple of the page size) * @count: (output) bytes successfully changed (multiple of page size) * * Regular (PT_REG) or TCS (PT_TCS) can be removed from an initialized * enclave if the system supports SGX2. First, the %SGX_IOC_ENCLAVE_MODIFY_TYPES * ioctl() should be used to change the page type to PT_TRIM. After that * succeeds ENCLU[EACCEPT] should be run from within the enclave and then * %SGX_IOC_ENCLAVE_REMOVE_PAGES can be used to complete the page removal. */ struct sgx_enclave_remove_pages { __u64 offset; __u64 length; __u64 count; }; struct sgx_enclave_run; /** * typedef sgx_enclave_user_handler_t - Exit handler function accepted by * __vdso_sgx_enter_enclave() * @run: The run instance given by the caller * * The register parameters contain the snapshot of their values at enclave * exit. An invalid ENCLU function number will cause -EINVAL to be returned * to the caller. * * Return: * - <= 0: The given value is returned back to the caller. * - > 0: ENCLU function to invoke, either EENTER or ERESUME. */ typedef int (*sgx_enclave_user_handler_t)(long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run *run); /** * struct sgx_enclave_run - the execution context of __vdso_sgx_enter_enclave() * @tcs: TCS used to enter the enclave * @function: The last seen ENCLU function (EENTER, ERESUME or EEXIT) * @exception_vector: The interrupt vector of the exception * @exception_error_code: The exception error code pulled out of the stack * @exception_addr: The address that triggered the exception * @user_handler: User provided callback run on exception * @user_data: Data passed to the user handler * @reserved Reserved for future extensions * * If @user_handler is provided, the handler will be invoked on all return paths * of the normal flow. The user handler may transfer control, e.g. via a * longjmp() call or a C++ exception, without returning to * __vdso_sgx_enter_enclave(). */ struct sgx_enclave_run { __u64 tcs; __u32 function; __u16 exception_vector; __u16 exception_error_code; __u64 exception_addr; __u64 user_handler; __u64 user_data; __u8 reserved[216]; }; /** * typedef vdso_sgx_enter_enclave_t - Prototype for __vdso_sgx_enter_enclave(), * a vDSO function to enter an SGX enclave. * @rdi: Pass-through value for RDI * @rsi: Pass-through value for RSI * @rdx: Pass-through value for RDX * @function: ENCLU function, must be EENTER or ERESUME * @r8: Pass-through value for R8 * @r9: Pass-through value for R9 * @run: struct sgx_enclave_run, must be non-NULL * * NOTE: __vdso_sgx_enter_enclave() does not ensure full compliance with the * x86-64 ABI, e.g. doesn't handle XSAVE state. Except for non-volatile * general purpose registers, EFLAGS.DF, and RSP alignment, preserving/setting * state in accordance with the x86-64 ABI is the responsibility of the enclave * and its runtime, i.e. __vdso_sgx_enter_enclave() cannot be called from C * code without careful consideration by both the enclave and its runtime. * * All general purpose registers except RAX, RBX and RCX are passed as-is to the * enclave. RAX, RBX and RCX are consumed by EENTER and ERESUME and are loaded * with @function, asynchronous exit pointer, and @run.tcs respectively. * * RBP and the stack are used to anchor __vdso_sgx_enter_enclave() to the * pre-enclave state, e.g. to retrieve @run.exception and @run.user_handler * after an enclave exit. All other registers are available for use by the * enclave and its runtime, e.g. an enclave can push additional data onto the * stack (and modify RSP) to pass information to the optional user handler (see * below). * * Most exceptions reported on ENCLU, including those that occur within the * enclave, are fixed up and reported synchronously instead of being delivered * via a standard signal. Debug Exceptions (#DB) and Breakpoints (#BP) are * never fixed up and are always delivered via standard signals. On synchrously * reported exceptions, -EFAULT is returned and details about the exception are * recorded in @run.exception, the optional sgx_enclave_exception struct. * * Return: * - 0: ENCLU function was successfully executed. * - -EINVAL: Invalid ENCL number (neither EENTER nor ERESUME). */ typedef int (*vdso_sgx_enter_enclave_t)(unsigned long rdi, unsigned long rsi, unsigned long rdx, unsigned int function, unsigned long r8, unsigned long r9, struct sgx_enclave_run *run); #endif /* _ASM_X86_SGX_H */ asm/shmbuf.h 0000644 00000002352 15063602044 0006763 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_X86_SHMBUF_H #define __ASM_X86_SHMBUF_H #if !defined(__x86_64__) || !defined(__ILP32__) #include <asm-generic/shmbuf.h> #else /* * The shmid64_ds structure for x86 architecture with x32 ABI. * * On x86-32 and x86-64 we can just use the generic definition, but * x32 uses the same binary layout as x86_64, which is differnet * from other 32-bit architectures. */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ __kernel_time_t shm_atime; /* last attach time */ __kernel_time_t shm_dtime; /* last detach time */ __kernel_time_t shm_ctime; /* last change time */ __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ __kernel_ulong_t shm_nattch; /* no. of current attaches */ __kernel_ulong_t __unused4; __kernel_ulong_t __unused5; }; struct shminfo64 { __kernel_ulong_t shmmax; __kernel_ulong_t shmmin; __kernel_ulong_t shmmni; __kernel_ulong_t shmseg; __kernel_ulong_t shmall; __kernel_ulong_t __unused1; __kernel_ulong_t __unused2; __kernel_ulong_t __unused3; __kernel_ulong_t __unused4; }; #endif #endif /* __ASM_X86_SHMBUF_H */ asm/sigcontext.h 0000644 00000022774 15063602044 0007700 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SIGCONTEXT_H #define _ASM_X86_SIGCONTEXT_H /* * Linux signal context definitions. The sigcontext includes a complex * hierarchy of CPU and FPU state, available to user-space (on the stack) when * a signal handler is executed. * * As over the years this ABI grew from its very simple roots towards * supporting more and more CPU state organically, some of the details (which * were rather clever hacks back in the days) became a bit quirky by today. * * The current ABI includes flexible provisions for future extensions, so we * won't have to grow new quirks for quite some time. Promise! */ #include <linux/types.h> #define FP_XSTATE_MAGIC1 0x46505853U #define FP_XSTATE_MAGIC2 0x46505845U #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2) /* * Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes are * used to extend the fpstate pointer in the sigcontext, which now includes the * extended state information along with fpstate information. * * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a * sw_reserved.extended_size bytes large extended context area present. (The * last 32-bit word of this extended area (at the * fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to * FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.) * * This extended area typically grows with newer CPUs that have larger and * larger XSAVE areas. */ struct _fpx_sw_bytes { /* * If set to FP_XSTATE_MAGIC1 then this is an xstate context. * 0 if a legacy frame. */ __u32 magic1; /* * Total size of the fpstate area: * * - if magic1 == 0 then it's sizeof(struct _fpstate) * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate) * plus extensions (if any) */ __u32 extended_size; /* * Feature bit mask (including FP/SSE/extended state) that is present * in the memory layout: */ __u64 xfeatures; /* * Actual XSAVE state size, based on the xfeatures saved in the layout. * 'extended_size' is greater than 'xstate_size': */ __u32 xstate_size; /* For future use: */ __u32 padding[7]; }; /* * As documented in the iBCS2 standard: * * The first part of "struct _fpstate" is just the normal i387 hardware setup, * the extra "status" word is used to save the coprocessor status word before * entering the handler. * * The FPU state data structure has had to grow to accommodate the extended FPU * state required by the Streaming SIMD Extensions. There is no documented * standard to accomplish this at the moment. */ /* 10-byte legacy floating point register: */ struct _fpreg { __u16 significand[4]; __u16 exponent; }; /* 16-byte floating point register: */ struct _fpxreg { __u16 significand[4]; __u16 exponent; __u16 padding[3]; }; /* 16-byte XMM register: */ struct _xmmreg { __u32 element[4]; }; #define X86_FXSR_MAGIC 0x0000 /* * The 32-bit FPU frame: */ struct _fpstate_32 { /* Legacy FPU environment: */ __u32 cw; __u32 sw; __u32 tag; __u32 ipoff; __u32 cssel; __u32 dataoff; __u32 datasel; struct _fpreg _st[8]; __u16 status; __u16 magic; /* 0xffff: regular FPU data only */ /* 0x0000: FXSR FPU data */ /* FXSR FPU environment */ __u32 _fxsr_env[6]; /* FXSR FPU env is ignored */ __u32 mxcsr; __u32 reserved; struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ struct _xmmreg _xmm[8]; /* First 8 XMM registers */ union { __u32 padding1[44]; /* Second 8 XMM registers plus padding */ __u32 padding[44]; /* Alias name for old user-space */ }; union { __u32 padding2[12]; struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */ }; }; /* * The 64-bit FPU frame. (FXSAVE format and later) * * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is * larger: 'struct _xstate'. Note that 'struct _xstate' embedds * 'struct _fpstate' so that you can always assume the _fpstate portion * exists so that you can check the magic value. * * Note2: Reserved fields may someday contain valuable data. Always * save/restore them when you change signal frames. */ struct _fpstate_64 { __u16 cwd; __u16 swd; /* Note this is not the same as the 32-bit/x87/FSAVE twd: */ __u16 twd; __u16 fop; __u64 rip; __u64 rdp; __u32 mxcsr; __u32 mxcsr_mask; __u32 st_space[32]; /* 8x FP registers, 16 bytes each */ __u32 xmm_space[64]; /* 16x XMM registers, 16 bytes each */ __u32 reserved2[12]; union { __u32 reserved3[12]; struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */ }; }; #ifdef __i386__ # define _fpstate _fpstate_32 #else # define _fpstate _fpstate_64 #endif struct _header { __u64 xfeatures; __u64 reserved1[2]; __u64 reserved2[5]; }; struct _ymmh_state { /* 16x YMM registers, 16 bytes each: */ __u32 ymmh_space[64]; }; /* * Extended state pointed to by sigcontext::fpstate. * * In addition to the fpstate, information encoded in _xstate::xstate_hdr * indicates the presence of other extended state information supported * by the CPU and kernel: */ struct _xstate { struct _fpstate fpstate; struct _header xstate_hdr; struct _ymmh_state ymmh; /* New processor state extensions go here: */ }; /* * The 32-bit signal frame: */ struct sigcontext_32 { __u16 gs, __gsh; __u16 fs, __fsh; __u16 es, __esh; __u16 ds, __dsh; __u32 di; __u32 si; __u32 bp; __u32 sp; __u32 bx; __u32 dx; __u32 cx; __u32 ax; __u32 trapno; __u32 err; __u32 ip; __u16 cs, __csh; __u32 flags; __u32 sp_at_signal; __u16 ss, __ssh; /* * fpstate is really (struct _fpstate *) or (struct _xstate *) * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end * of extended memory layout. See comments at the definition of * (struct _fpx_sw_bytes) */ __u32 fpstate; /* Zero when no FPU/extended context */ __u32 oldmask; __u32 cr2; }; /* * The 64-bit signal frame: */ struct sigcontext_64 { __u64 r8; __u64 r9; __u64 r10; __u64 r11; __u64 r12; __u64 r13; __u64 r14; __u64 r15; __u64 di; __u64 si; __u64 bp; __u64 bx; __u64 dx; __u64 ax; __u64 cx; __u64 sp; __u64 ip; __u64 flags; __u16 cs; __u16 gs; __u16 fs; __u16 ss; __u64 err; __u64 trapno; __u64 oldmask; __u64 cr2; /* * fpstate is really (struct _fpstate *) or (struct _xstate *) * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end * of extended memory layout. See comments at the definition of * (struct _fpx_sw_bytes) */ __u64 fpstate; /* Zero when no FPU/extended context */ __u64 reserved1[8]; }; /* * Create the real 'struct sigcontext' type: */ /* * The old user-space sigcontext definition, just in case user-space still * relies on it. The kernel definition (in asm/sigcontext.h) has unified * field names but otherwise the same layout. */ #define _fpstate_ia32 _fpstate_32 #define sigcontext_ia32 sigcontext_32 # ifdef __i386__ struct sigcontext { __u16 gs, __gsh; __u16 fs, __fsh; __u16 es, __esh; __u16 ds, __dsh; __u32 edi; __u32 esi; __u32 ebp; __u32 esp; __u32 ebx; __u32 edx; __u32 ecx; __u32 eax; __u32 trapno; __u32 err; __u32 eip; __u16 cs, __csh; __u32 eflags; __u32 esp_at_signal; __u16 ss, __ssh; struct _fpstate *fpstate; __u32 oldmask; __u32 cr2; }; # else /* __x86_64__: */ struct sigcontext { __u64 r8; __u64 r9; __u64 r10; __u64 r11; __u64 r12; __u64 r13; __u64 r14; __u64 r15; __u64 rdi; __u64 rsi; __u64 rbp; __u64 rbx; __u64 rdx; __u64 rax; __u64 rcx; __u64 rsp; __u64 rip; __u64 eflags; /* RFLAGS */ __u16 cs; /* * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"), * Linux saved and restored fs and gs in these slots. This * was counterproductive, as fsbase and gsbase were never * saved, so arch_prctl was presumably unreliable. * * These slots should never be reused without extreme caution: * * - Some DOSEMU versions stash fs and gs in these slots manually, * thus overwriting anything the kernel expects to be preserved * in these slots. * * - If these slots are ever needed for any other purpose, * there is some risk that very old 64-bit binaries could get * confused. I doubt that many such binaries still work, * though, since the same patch in 2.5.64 also removed the * 64-bit set_thread_area syscall, so it appears that there * is no TLS API beyond modify_ldt that works in both pre- * and post-2.5.64 kernels. * * If the kernel ever adds explicit fs, gs, fsbase, and gsbase * save/restore, it will most likely need to be opt-in and use * different context slots. */ __u16 gs; __u16 fs; union { __u16 ss; /* If UC_SIGCONTEXT_SS */ __u16 __pad0; /* Alias name for old (!UC_SIGCONTEXT_SS) user-space */ }; __u64 err; __u64 trapno; __u64 oldmask; __u64 cr2; struct _fpstate *fpstate; /* Zero when no FPU context */ # ifdef __ILP32__ __u32 __fpstate_pad; # endif __u64 reserved1[8]; }; # endif /* __x86_64__ */ #endif /* _ASM_X86_SIGCONTEXT_H */ asm/sigcontext32.h 0000644 00000000367 15063602044 0010037 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_SIGCONTEXT32_H #define _ASM_X86_SIGCONTEXT32_H /* This is a legacy file - all the type definitions are in sigcontext.h: */ #include <asm/sigcontext.h> #endif /* _ASM_X86_SIGCONTEXT32_H */ asm/siginfo.h 0000644 00000000646 15063602044 0007141 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SIGINFO_H #define _ASM_X86_SIGINFO_H #ifdef __x86_64__ # ifdef __ILP32__ /* x32 */ typedef long long __kernel_si_clock_t __attribute__((aligned(4))); # define __ARCH_SI_CLOCK_T __kernel_si_clock_t # define __ARCH_SI_ATTRIBUTES __attribute__((aligned(8))) # endif #endif #include <asm-generic/siginfo.h> #endif /* _ASM_X86_SIGINFO_H */ asm/signal.h 0000644 00000005525 15063602044 0006761 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SIGNAL_H #define _ASM_X86_SIGNAL_H #ifndef __ASSEMBLY__ #include <linux/types.h> #include <linux/time.h> /* Avoid too many header ordering problems. */ struct siginfo; /* Here we must cater to libcs that poke about in kernel headers. */ #define NSIG 32 typedef unsigned long sigset_t; #endif /* __ASSEMBLY__ */ #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGIOT 6 #define SIGBUS 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGUSR1 10 #define SIGSEGV 11 #define SIGUSR2 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGSTKFLT 16 #define SIGCHLD 17 #define SIGCONT 18 #define SIGSTOP 19 #define SIGTSTP 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGURG 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGVTALRM 26 #define SIGPROF 27 #define SIGWINCH 28 #define SIGIO 29 #define SIGPOLL SIGIO /* #define SIGLOST 29 */ #define SIGPWR 30 #define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ #define SIGRTMIN 32 #define SIGRTMAX _NSIG /* * SA_FLAGS values: * * SA_ONSTACK indicates that a registered stack_t will be used. * SA_RESTART flag to get restarting signals (which were the default long ago) * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. * SA_RESETHAND clears the handler when the signal is delivered. * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. * SA_NODEFER prevents the current signal from being masked in the handler. * * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single * Unix names RESETHAND and NODEFER respectively. */ #define SA_NOCLDSTOP 0x00000001u #define SA_NOCLDWAIT 0x00000002u #define SA_SIGINFO 0x00000004u #define SA_ONSTACK 0x08000000u #define SA_RESTART 0x10000000u #define SA_NODEFER 0x40000000u #define SA_RESETHAND 0x80000000u #define SA_NOMASK SA_NODEFER #define SA_ONESHOT SA_RESETHAND #define SA_RESTORER 0x04000000 #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 #include <asm-generic/signal-defs.h> #ifndef __ASSEMBLY__ /* Here we must cater to libcs that poke about in kernel headers. */ #ifdef __i386__ struct sigaction { union { __sighandler_t _sa_handler; void (*_sa_sigaction)(int, struct siginfo *, void *); } _u; sigset_t sa_mask; unsigned long sa_flags; void (*sa_restorer)(void); }; #define sa_handler _u._sa_handler #define sa_sigaction _u._sa_sigaction #else /* __i386__ */ struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; /* mask last for extensibility */ }; #endif /* !__i386__ */ typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_SIGNAL_H */ asm/socket.h 0000644 00000000040 15063602044 0006757 0 ustar 00 #include <asm-generic/socket.h> asm/sockios.h 0000644 00000000041 15063602044 0007142 0 ustar 00 #include <asm-generic/sockios.h> asm/stat.h 0000644 00000006073 15063602044 0006456 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_STAT_H #define _ASM_X86_STAT_H #include <asm/posix_types.h> #define STAT_HAVE_NSEC 1 #ifdef __i386__ struct stat { unsigned long st_dev; unsigned long st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned long st_rdev; unsigned long st_size; unsigned long st_blksize; unsigned long st_blocks; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned long st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; unsigned long __unused4; unsigned long __unused5; }; /* We don't need to memset the whole thing just to initialize the padding */ #define INIT_STRUCT_STAT_PADDING(st) do { \ st.__unused4 = 0; \ st.__unused5 = 0; \ } while (0) #define STAT64_HAS_BROKEN_ST_INO 1 /* This matches struct stat64 in glibc2.1, hence the absolutely * insane amounts of padding around dev_t's. */ struct stat64 { unsigned long long st_dev; unsigned char __pad0[4]; unsigned long __st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned long st_uid; unsigned long st_gid; unsigned long long st_rdev; unsigned char __pad3[4]; long long st_size; unsigned long st_blksize; /* Number 512-byte blocks allocated. */ unsigned long long st_blocks; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned int st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; unsigned long long st_ino; }; /* We don't need to memset the whole thing just to initialize the padding */ #define INIT_STRUCT_STAT64_PADDING(st) do { \ memset(&st.__pad0, 0, sizeof(st.__pad0)); \ memset(&st.__pad3, 0, sizeof(st.__pad3)); \ } while (0) #else /* __i386__ */ struct stat { __kernel_ulong_t st_dev; __kernel_ulong_t st_ino; __kernel_ulong_t st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; unsigned int __pad0; __kernel_ulong_t st_rdev; __kernel_long_t st_size; __kernel_long_t st_blksize; __kernel_long_t st_blocks; /* Number 512-byte blocks allocated. */ __kernel_ulong_t st_atime; __kernel_ulong_t st_atime_nsec; __kernel_ulong_t st_mtime; __kernel_ulong_t st_mtime_nsec; __kernel_ulong_t st_ctime; __kernel_ulong_t st_ctime_nsec; __kernel_long_t __unused[3]; }; /* We don't need to memset the whole thing just to initialize the padding */ #define INIT_STRUCT_STAT_PADDING(st) do { \ st.__pad0 = 0; \ st.__unused[0] = 0; \ st.__unused[1] = 0; \ st.__unused[2] = 0; \ } while (0) #endif /* for 32bit emulation and 32 bit kernels */ struct __old_kernel_stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; #ifdef __i386__ unsigned long st_size; unsigned long st_atime; unsigned long st_mtime; unsigned long st_ctime; #else unsigned int st_size; unsigned int st_atime; unsigned int st_mtime; unsigned int st_ctime; #endif }; #endif /* _ASM_X86_STAT_H */ asm/statfs.h 0000644 00000000640 15063602044 0007001 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_STATFS_H #define _ASM_X86_STATFS_H /* * We need compat_statfs64 to be packed, because the i386 ABI won't * add padding at the end to bring it to a multiple of 8 bytes, but * the x86_64 ABI will. */ #define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4))) #include <asm-generic/statfs.h> #endif /* _ASM_X86_STATFS_H */ asm/svm.h 0000644 00000023055 15063602044 0006307 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __SVM_H #define __SVM_H #define SVM_EXIT_READ_CR0 0x000 #define SVM_EXIT_READ_CR2 0x002 #define SVM_EXIT_READ_CR3 0x003 #define SVM_EXIT_READ_CR4 0x004 #define SVM_EXIT_READ_CR8 0x008 #define SVM_EXIT_WRITE_CR0 0x010 #define SVM_EXIT_WRITE_CR2 0x012 #define SVM_EXIT_WRITE_CR3 0x013 #define SVM_EXIT_WRITE_CR4 0x014 #define SVM_EXIT_WRITE_CR8 0x018 #define SVM_EXIT_READ_DR0 0x020 #define SVM_EXIT_READ_DR1 0x021 #define SVM_EXIT_READ_DR2 0x022 #define SVM_EXIT_READ_DR3 0x023 #define SVM_EXIT_READ_DR4 0x024 #define SVM_EXIT_READ_DR5 0x025 #define SVM_EXIT_READ_DR6 0x026 #define SVM_EXIT_READ_DR7 0x027 #define SVM_EXIT_WRITE_DR0 0x030 #define SVM_EXIT_WRITE_DR1 0x031 #define SVM_EXIT_WRITE_DR2 0x032 #define SVM_EXIT_WRITE_DR3 0x033 #define SVM_EXIT_WRITE_DR4 0x034 #define SVM_EXIT_WRITE_DR5 0x035 #define SVM_EXIT_WRITE_DR6 0x036 #define SVM_EXIT_WRITE_DR7 0x037 #define SVM_EXIT_EXCP_BASE 0x040 #define SVM_EXIT_LAST_EXCP 0x05f #define SVM_EXIT_INTR 0x060 #define SVM_EXIT_NMI 0x061 #define SVM_EXIT_SMI 0x062 #define SVM_EXIT_INIT 0x063 #define SVM_EXIT_VINTR 0x064 #define SVM_EXIT_CR0_SEL_WRITE 0x065 #define SVM_EXIT_IDTR_READ 0x066 #define SVM_EXIT_GDTR_READ 0x067 #define SVM_EXIT_LDTR_READ 0x068 #define SVM_EXIT_TR_READ 0x069 #define SVM_EXIT_IDTR_WRITE 0x06a #define SVM_EXIT_GDTR_WRITE 0x06b #define SVM_EXIT_LDTR_WRITE 0x06c #define SVM_EXIT_TR_WRITE 0x06d #define SVM_EXIT_RDTSC 0x06e #define SVM_EXIT_RDPMC 0x06f #define SVM_EXIT_PUSHF 0x070 #define SVM_EXIT_POPF 0x071 #define SVM_EXIT_CPUID 0x072 #define SVM_EXIT_RSM 0x073 #define SVM_EXIT_IRET 0x074 #define SVM_EXIT_SWINT 0x075 #define SVM_EXIT_INVD 0x076 #define SVM_EXIT_PAUSE 0x077 #define SVM_EXIT_HLT 0x078 #define SVM_EXIT_INVLPG 0x079 #define SVM_EXIT_INVLPGA 0x07a #define SVM_EXIT_IOIO 0x07b #define SVM_EXIT_MSR 0x07c #define SVM_EXIT_TASK_SWITCH 0x07d #define SVM_EXIT_FERR_FREEZE 0x07e #define SVM_EXIT_SHUTDOWN 0x07f #define SVM_EXIT_VMRUN 0x080 #define SVM_EXIT_VMMCALL 0x081 #define SVM_EXIT_VMLOAD 0x082 #define SVM_EXIT_VMSAVE 0x083 #define SVM_EXIT_STGI 0x084 #define SVM_EXIT_CLGI 0x085 #define SVM_EXIT_SKINIT 0x086 #define SVM_EXIT_RDTSCP 0x087 #define SVM_EXIT_ICEBP 0x088 #define SVM_EXIT_WBINVD 0x089 #define SVM_EXIT_MONITOR 0x08a #define SVM_EXIT_MWAIT 0x08b #define SVM_EXIT_MWAIT_COND 0x08c #define SVM_EXIT_XSETBV 0x08d #define SVM_EXIT_RDPRU 0x08e #define SVM_EXIT_EFER_WRITE_TRAP 0x08f #define SVM_EXIT_CR0_WRITE_TRAP 0x090 #define SVM_EXIT_CR1_WRITE_TRAP 0x091 #define SVM_EXIT_CR2_WRITE_TRAP 0x092 #define SVM_EXIT_CR3_WRITE_TRAP 0x093 #define SVM_EXIT_CR4_WRITE_TRAP 0x094 #define SVM_EXIT_CR5_WRITE_TRAP 0x095 #define SVM_EXIT_CR6_WRITE_TRAP 0x096 #define SVM_EXIT_CR7_WRITE_TRAP 0x097 #define SVM_EXIT_CR8_WRITE_TRAP 0x098 #define SVM_EXIT_CR9_WRITE_TRAP 0x099 #define SVM_EXIT_CR10_WRITE_TRAP 0x09a #define SVM_EXIT_CR11_WRITE_TRAP 0x09b #define SVM_EXIT_CR12_WRITE_TRAP 0x09c #define SVM_EXIT_CR13_WRITE_TRAP 0x09d #define SVM_EXIT_CR14_WRITE_TRAP 0x09e #define SVM_EXIT_CR15_WRITE_TRAP 0x09f #define SVM_EXIT_INVPCID 0x0a2 #define SVM_EXIT_NPF 0x400 #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402 #define SVM_EXIT_VMGEXIT 0x403 /* SEV-ES software-defined VMGEXIT events */ #define SVM_VMGEXIT_MMIO_READ 0x80000001 #define SVM_VMGEXIT_MMIO_WRITE 0x80000002 #define SVM_VMGEXIT_NMI_COMPLETE 0x80000003 #define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004 #define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005 #define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0 #define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1 #define SVM_VMGEXIT_PSC 0x80000010 #define SVM_VMGEXIT_GUEST_REQUEST 0x80000011 #define SVM_VMGEXIT_EXT_GUEST_REQUEST 0x80000012 #define SVM_VMGEXIT_AP_CREATION 0x80000013 #define SVM_VMGEXIT_AP_CREATE_ON_INIT 0 #define SVM_VMGEXIT_AP_CREATE 1 #define SVM_VMGEXIT_AP_DESTROY 2 #define SVM_VMGEXIT_HV_FEATURES 0x8000fffd #define SVM_VMGEXIT_TERM_REQUEST 0x8000fffe #define SVM_VMGEXIT_TERM_REASON(reason_set, reason_code) \ /* SW_EXITINFO1[3:0] */ \ (((((u64)reason_set) & 0xf)) | \ /* SW_EXITINFO1[11:4] */ \ ((((u64)reason_code) & 0xff) << 4)) #define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff /* Exit code reserved for hypervisor/software use */ #define SVM_EXIT_SW 0xf0000000 #define SVM_EXIT_ERR -1 #define SVM_EXIT_REASONS \ { SVM_EXIT_READ_CR0, "read_cr0" }, \ { SVM_EXIT_READ_CR2, "read_cr2" }, \ { SVM_EXIT_READ_CR3, "read_cr3" }, \ { SVM_EXIT_READ_CR4, "read_cr4" }, \ { SVM_EXIT_READ_CR8, "read_cr8" }, \ { SVM_EXIT_WRITE_CR0, "write_cr0" }, \ { SVM_EXIT_WRITE_CR2, "write_cr2" }, \ { SVM_EXIT_WRITE_CR3, "write_cr3" }, \ { SVM_EXIT_WRITE_CR4, "write_cr4" }, \ { SVM_EXIT_WRITE_CR8, "write_cr8" }, \ { SVM_EXIT_READ_DR0, "read_dr0" }, \ { SVM_EXIT_READ_DR1, "read_dr1" }, \ { SVM_EXIT_READ_DR2, "read_dr2" }, \ { SVM_EXIT_READ_DR3, "read_dr3" }, \ { SVM_EXIT_READ_DR4, "read_dr4" }, \ { SVM_EXIT_READ_DR5, "read_dr5" }, \ { SVM_EXIT_READ_DR6, "read_dr6" }, \ { SVM_EXIT_READ_DR7, "read_dr7" }, \ { SVM_EXIT_WRITE_DR0, "write_dr0" }, \ { SVM_EXIT_WRITE_DR1, "write_dr1" }, \ { SVM_EXIT_WRITE_DR2, "write_dr2" }, \ { SVM_EXIT_WRITE_DR3, "write_dr3" }, \ { SVM_EXIT_WRITE_DR4, "write_dr4" }, \ { SVM_EXIT_WRITE_DR5, "write_dr5" }, \ { SVM_EXIT_WRITE_DR6, "write_dr6" }, \ { SVM_EXIT_WRITE_DR7, "write_dr7" }, \ { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, \ { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, \ { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, \ { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, \ { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, \ { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, \ { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, \ { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, \ { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, \ { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, \ { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, \ { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, \ { SVM_EXIT_INTR, "interrupt" }, \ { SVM_EXIT_NMI, "nmi" }, \ { SVM_EXIT_SMI, "smi" }, \ { SVM_EXIT_INIT, "init" }, \ { SVM_EXIT_VINTR, "vintr" }, \ { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, \ { SVM_EXIT_IDTR_READ, "read_idtr" }, \ { SVM_EXIT_GDTR_READ, "read_gdtr" }, \ { SVM_EXIT_LDTR_READ, "read_ldtr" }, \ { SVM_EXIT_TR_READ, "read_rt" }, \ { SVM_EXIT_IDTR_WRITE, "write_idtr" }, \ { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, \ { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, \ { SVM_EXIT_TR_WRITE, "write_rt" }, \ { SVM_EXIT_RDTSC, "rdtsc" }, \ { SVM_EXIT_RDPMC, "rdpmc" }, \ { SVM_EXIT_PUSHF, "pushf" }, \ { SVM_EXIT_POPF, "popf" }, \ { SVM_EXIT_CPUID, "cpuid" }, \ { SVM_EXIT_RSM, "rsm" }, \ { SVM_EXIT_IRET, "iret" }, \ { SVM_EXIT_SWINT, "swint" }, \ { SVM_EXIT_INVD, "invd" }, \ { SVM_EXIT_PAUSE, "pause" }, \ { SVM_EXIT_HLT, "hlt" }, \ { SVM_EXIT_INVLPG, "invlpg" }, \ { SVM_EXIT_INVLPGA, "invlpga" }, \ { SVM_EXIT_IOIO, "io" }, \ { SVM_EXIT_MSR, "msr" }, \ { SVM_EXIT_TASK_SWITCH, "task_switch" }, \ { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, \ { SVM_EXIT_SHUTDOWN, "shutdown" }, \ { SVM_EXIT_VMRUN, "vmrun" }, \ { SVM_EXIT_VMMCALL, "hypercall" }, \ { SVM_EXIT_VMLOAD, "vmload" }, \ { SVM_EXIT_VMSAVE, "vmsave" }, \ { SVM_EXIT_STGI, "stgi" }, \ { SVM_EXIT_CLGI, "clgi" }, \ { SVM_EXIT_SKINIT, "skinit" }, \ { SVM_EXIT_RDTSCP, "rdtscp" }, \ { SVM_EXIT_ICEBP, "icebp" }, \ { SVM_EXIT_WBINVD, "wbinvd" }, \ { SVM_EXIT_MONITOR, "monitor" }, \ { SVM_EXIT_MWAIT, "mwait" }, \ { SVM_EXIT_XSETBV, "xsetbv" }, \ { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, \ { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, \ { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, \ { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, \ { SVM_EXIT_INVPCID, "invpcid" }, \ { SVM_EXIT_NPF, "npf" }, \ { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ { SVM_EXIT_VMGEXIT, "vmgexit" }, \ { SVM_VMGEXIT_MMIO_READ, "vmgexit_mmio_read" }, \ { SVM_VMGEXIT_MMIO_WRITE, "vmgexit_mmio_write" }, \ { SVM_VMGEXIT_NMI_COMPLETE, "vmgexit_nmi_complete" }, \ { SVM_VMGEXIT_AP_HLT_LOOP, "vmgexit_ap_hlt_loop" }, \ { SVM_VMGEXIT_AP_JUMP_TABLE, "vmgexit_ap_jump_table" }, \ { SVM_VMGEXIT_PSC, "vmgexit_page_state_change" }, \ { SVM_VMGEXIT_GUEST_REQUEST, "vmgexit_guest_request" }, \ { SVM_VMGEXIT_EXT_GUEST_REQUEST, "vmgexit_ext_guest_request" }, \ { SVM_VMGEXIT_AP_CREATION, "vmgexit_ap_creation" }, \ { SVM_VMGEXIT_HV_FEATURES, "vmgexit_hypervisor_feature" }, \ { SVM_EXIT_ERR, "invalid_guest_state" } #endif /* __SVM_H */ asm/swab.h 0000644 00000001324 15063602044 0006431 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SWAB_H #define _ASM_X86_SWAB_H #include <linux/types.h> static __inline__ __u32 __arch_swab32(__u32 val) { __asm__("bswapl %0" : "=r" (val) : "0" (val)); return val; } #define __arch_swab32 __arch_swab32 static __inline__ __u64 __arch_swab64(__u64 val) { #ifdef __i386__ union { struct { __u32 a; __u32 b; } s; __u64 u; } v; v.u = val; __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b)); return v.u; #else /* __i386__ */ __asm__("bswapq %0" : "=r" (val) : "0" (val)); return val; #endif } #define __arch_swab64 __arch_swab64 #endif /* _ASM_X86_SWAB_H */ asm/termbits.h 0000644 00000000042 15063602044 0007322 0 ustar 00 #include <asm-generic/termbits.h> asm/termios.h 0000644 00000000041 15063602044 0007152 0 ustar 00 #include <asm-generic/termios.h> asm/types.h 0000644 00000000230 15063602044 0006634 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_TYPES_H #define _ASM_X86_TYPES_H #include <asm-generic/types.h> #endif /* _ASM_X86_TYPES_H */ asm/ucontext.h 0000644 00000004105 15063602044 0007346 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_UCONTEXT_H #define _ASM_X86_UCONTEXT_H /* * Indicates the presence of extended state information in the memory * layout pointed by the fpstate pointer in the ucontext's sigcontext * struct (uc_mcontext). */ #define UC_FP_XSTATE 0x1 #ifdef __x86_64__ /* * UC_SIGCONTEXT_SS will be set when delivering 64-bit or x32 signals on * kernels that save SS in the sigcontext. All kernels that set * UC_SIGCONTEXT_SS will correctly restore at least the low 32 bits of esp * regardless of SS (i.e. they implement espfix). * * Kernels that set UC_SIGCONTEXT_SS will also set UC_STRICT_RESTORE_SS * when delivering a signal that came from 64-bit code. * * Sigreturn restores SS as follows: * * if (saved SS is valid || UC_STRICT_RESTORE_SS is set || * saved CS is not 64-bit) * new SS = saved SS (will fail IRET and signal if invalid) * else * new SS = a flat 32-bit data segment * * This behavior serves three purposes: * * - Legacy programs that construct a 64-bit sigcontext from scratch * with zero or garbage in the SS slot (e.g. old CRIU) and call * sigreturn will still work. * * - Old DOSEMU versions sometimes catch a signal from a segmented * context, delete the old SS segment (with modify_ldt), and change * the saved CS to a 64-bit segment. These DOSEMU versions expect * sigreturn to send them back to 64-bit mode without killing them, * despite the fact that the SS selector when the signal was raised is * no longer valid. UC_STRICT_RESTORE_SS will be clear, so the kernel * will fix up SS for these DOSEMU versions. * * - Old and new programs that catch a signal and return without * modifying the saved context will end up in exactly the state they * started in, even if they were running in a segmented context when * the signal was raised.. Old kernels would lose track of the * previous SS value. */ #define UC_SIGCONTEXT_SS 0x2 #define UC_STRICT_RESTORE_SS 0x4 #endif #include <asm-generic/ucontext.h> #endif /* _ASM_X86_UCONTEXT_H */ asm/unistd.h 0000644 00000000547 15063602044 0007011 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_UNISTD_H #define _ASM_X86_UNISTD_H /* x32 syscall flag bit */ #define __X32_SYSCALL_BIT 0x40000000 # ifdef __i386__ # include <asm/unistd_32.h> # elif defined(__ILP32__) # include <asm/unistd_x32.h> # else # include <asm/unistd_64.h> # endif #endif /* _ASM_X86_UNISTD_H */ asm/unistd_32.h 0000644 00000025573 15063602044 0007323 0 ustar 00 #ifndef _ASM_X86_UNISTD_32_H #define _ASM_X86_UNISTD_32_H 1 #define __NR_restart_syscall 0 #define __NR_exit 1 #define __NR_fork 2 #define __NR_read 3 #define __NR_write 4 #define __NR_open 5 #define __NR_close 6 #define __NR_waitpid 7 #define __NR_creat 8 #define __NR_link 9 #define __NR_unlink 10 #define __NR_execve 11 #define __NR_chdir 12 #define __NR_time 13 #define __NR_mknod 14 #define __NR_chmod 15 #define __NR_lchown 16 #define __NR_break 17 #define __NR_oldstat 18 #define __NR_lseek 19 #define __NR_getpid 20 #define __NR_mount 21 #define __NR_umount 22 #define __NR_setuid 23 #define __NR_getuid 24 #define __NR_stime 25 #define __NR_ptrace 26 #define __NR_alarm 27 #define __NR_oldfstat 28 #define __NR_pause 29 #define __NR_utime 30 #define __NR_stty 31 #define __NR_gtty 32 #define __NR_access 33 #define __NR_nice 34 #define __NR_ftime 35 #define __NR_sync 36 #define __NR_kill 37 #define __NR_rename 38 #define __NR_mkdir 39 #define __NR_rmdir 40 #define __NR_dup 41 #define __NR_pipe 42 #define __NR_times 43 #define __NR_prof 44 #define __NR_brk 45 #define __NR_setgid 46 #define __NR_getgid 47 #define __NR_signal 48 #define __NR_geteuid 49 #define __NR_getegid 50 #define __NR_acct 51 #define __NR_umount2 52 #define __NR_lock 53 #define __NR_ioctl 54 #define __NR_fcntl 55 #define __NR_mpx 56 #define __NR_setpgid 57 #define __NR_ulimit 58 #define __NR_oldolduname 59 #define __NR_umask 60 #define __NR_chroot 61 #define __NR_ustat 62 #define __NR_dup2 63 #define __NR_getppid 64 #define __NR_getpgrp 65 #define __NR_setsid 66 #define __NR_sigaction 67 #define __NR_sgetmask 68 #define __NR_ssetmask 69 #define __NR_setreuid 70 #define __NR_setregid 71 #define __NR_sigsuspend 72 #define __NR_sigpending 73 #define __NR_sethostname 74 #define __NR_setrlimit 75 #define __NR_getrlimit 76 #define __NR_getrusage 77 #define __NR_gettimeofday 78 #define __NR_settimeofday 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 #define __NR_symlink 83 #define __NR_oldlstat 84 #define __NR_readlink 85 #define __NR_uselib 86 #define __NR_swapon 87 #define __NR_reboot 88 #define __NR_readdir 89 #define __NR_mmap 90 #define __NR_munmap 91 #define __NR_truncate 92 #define __NR_ftruncate 93 #define __NR_fchmod 94 #define __NR_fchown 95 #define __NR_getpriority 96 #define __NR_setpriority 97 #define __NR_profil 98 #define __NR_statfs 99 #define __NR_fstatfs 100 #define __NR_ioperm 101 #define __NR_socketcall 102 #define __NR_syslog 103 #define __NR_setitimer 104 #define __NR_getitimer 105 #define __NR_stat 106 #define __NR_lstat 107 #define __NR_fstat 108 #define __NR_olduname 109 #define __NR_iopl 110 #define __NR_vhangup 111 #define __NR_idle 112 #define __NR_vm86old 113 #define __NR_wait4 114 #define __NR_swapoff 115 #define __NR_sysinfo 116 #define __NR_ipc 117 #define __NR_fsync 118 #define __NR_sigreturn 119 #define __NR_clone 120 #define __NR_setdomainname 121 #define __NR_uname 122 #define __NR_modify_ldt 123 #define __NR_adjtimex 124 #define __NR_mprotect 125 #define __NR_sigprocmask 126 #define __NR_create_module 127 #define __NR_init_module 128 #define __NR_delete_module 129 #define __NR_get_kernel_syms 130 #define __NR_quotactl 131 #define __NR_getpgid 132 #define __NR_fchdir 133 #define __NR_bdflush 134 #define __NR_sysfs 135 #define __NR_personality 136 #define __NR_afs_syscall 137 #define __NR_setfsuid 138 #define __NR_setfsgid 139 #define __NR__llseek 140 #define __NR_getdents 141 #define __NR__newselect 142 #define __NR_flock 143 #define __NR_msync 144 #define __NR_readv 145 #define __NR_writev 146 #define __NR_getsid 147 #define __NR_fdatasync 148 #define __NR__sysctl 149 #define __NR_mlock 150 #define __NR_munlock 151 #define __NR_mlockall 152 #define __NR_munlockall 153 #define __NR_sched_setparam 154 #define __NR_sched_getparam 155 #define __NR_sched_setscheduler 156 #define __NR_sched_getscheduler 157 #define __NR_sched_yield 158 #define __NR_sched_get_priority_max 159 #define __NR_sched_get_priority_min 160 #define __NR_sched_rr_get_interval 161 #define __NR_nanosleep 162 #define __NR_mremap 163 #define __NR_setresuid 164 #define __NR_getresuid 165 #define __NR_vm86 166 #define __NR_query_module 167 #define __NR_poll 168 #define __NR_nfsservctl 169 #define __NR_setresgid 170 #define __NR_getresgid 171 #define __NR_prctl 172 #define __NR_rt_sigreturn 173 #define __NR_rt_sigaction 174 #define __NR_rt_sigprocmask 175 #define __NR_rt_sigpending 176 #define __NR_rt_sigtimedwait 177 #define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigsuspend 179 #define __NR_pread64 180 #define __NR_pwrite64 181 #define __NR_chown 182 #define __NR_getcwd 183 #define __NR_capget 184 #define __NR_capset 185 #define __NR_sigaltstack 186 #define __NR_sendfile 187 #define __NR_getpmsg 188 #define __NR_putpmsg 189 #define __NR_vfork 190 #define __NR_ugetrlimit 191 #define __NR_mmap2 192 #define __NR_truncate64 193 #define __NR_ftruncate64 194 #define __NR_stat64 195 #define __NR_lstat64 196 #define __NR_fstat64 197 #define __NR_lchown32 198 #define __NR_getuid32 199 #define __NR_getgid32 200 #define __NR_geteuid32 201 #define __NR_getegid32 202 #define __NR_setreuid32 203 #define __NR_setregid32 204 #define __NR_getgroups32 205 #define __NR_setgroups32 206 #define __NR_fchown32 207 #define __NR_setresuid32 208 #define __NR_getresuid32 209 #define __NR_setresgid32 210 #define __NR_getresgid32 211 #define __NR_chown32 212 #define __NR_setuid32 213 #define __NR_setgid32 214 #define __NR_setfsuid32 215 #define __NR_setfsgid32 216 #define __NR_pivot_root 217 #define __NR_mincore 218 #define __NR_madvise 219 #define __NR_getdents64 220 #define __NR_fcntl64 221 #define __NR_gettid 224 #define __NR_readahead 225 #define __NR_setxattr 226 #define __NR_lsetxattr 227 #define __NR_fsetxattr 228 #define __NR_getxattr 229 #define __NR_lgetxattr 230 #define __NR_fgetxattr 231 #define __NR_listxattr 232 #define __NR_llistxattr 233 #define __NR_flistxattr 234 #define __NR_removexattr 235 #define __NR_lremovexattr 236 #define __NR_fremovexattr 237 #define __NR_tkill 238 #define __NR_sendfile64 239 #define __NR_futex 240 #define __NR_sched_setaffinity 241 #define __NR_sched_getaffinity 242 #define __NR_set_thread_area 243 #define __NR_get_thread_area 244 #define __NR_io_setup 245 #define __NR_io_destroy 246 #define __NR_io_getevents 247 #define __NR_io_submit 248 #define __NR_io_cancel 249 #define __NR_fadvise64 250 #define __NR_exit_group 252 #define __NR_lookup_dcookie 253 #define __NR_epoll_create 254 #define __NR_epoll_ctl 255 #define __NR_epoll_wait 256 #define __NR_remap_file_pages 257 #define __NR_set_tid_address 258 #define __NR_timer_create 259 #define __NR_timer_settime 260 #define __NR_timer_gettime 261 #define __NR_timer_getoverrun 262 #define __NR_timer_delete 263 #define __NR_clock_settime 264 #define __NR_clock_gettime 265 #define __NR_clock_getres 266 #define __NR_clock_nanosleep 267 #define __NR_statfs64 268 #define __NR_fstatfs64 269 #define __NR_tgkill 270 #define __NR_utimes 271 #define __NR_fadvise64_64 272 #define __NR_vserver 273 #define __NR_mbind 274 #define __NR_get_mempolicy 275 #define __NR_set_mempolicy 276 #define __NR_mq_open 277 #define __NR_mq_unlink 278 #define __NR_mq_timedsend 279 #define __NR_mq_timedreceive 280 #define __NR_mq_notify 281 #define __NR_mq_getsetattr 282 #define __NR_kexec_load 283 #define __NR_waitid 284 #define __NR_add_key 286 #define __NR_request_key 287 #define __NR_keyctl 288 #define __NR_ioprio_set 289 #define __NR_ioprio_get 290 #define __NR_inotify_init 291 #define __NR_inotify_add_watch 292 #define __NR_inotify_rm_watch 293 #define __NR_migrate_pages 294 #define __NR_openat 295 #define __NR_mkdirat 296 #define __NR_mknodat 297 #define __NR_fchownat 298 #define __NR_futimesat 299 #define __NR_fstatat64 300 #define __NR_unlinkat 301 #define __NR_renameat 302 #define __NR_linkat 303 #define __NR_symlinkat 304 #define __NR_readlinkat 305 #define __NR_fchmodat 306 #define __NR_faccessat 307 #define __NR_pselect6 308 #define __NR_ppoll 309 #define __NR_unshare 310 #define __NR_set_robust_list 311 #define __NR_get_robust_list 312 #define __NR_splice 313 #define __NR_sync_file_range 314 #define __NR_tee 315 #define __NR_vmsplice 316 #define __NR_move_pages 317 #define __NR_getcpu 318 #define __NR_epoll_pwait 319 #define __NR_utimensat 320 #define __NR_signalfd 321 #define __NR_timerfd_create 322 #define __NR_eventfd 323 #define __NR_fallocate 324 #define __NR_timerfd_settime 325 #define __NR_timerfd_gettime 326 #define __NR_signalfd4 327 #define __NR_eventfd2 328 #define __NR_epoll_create1 329 #define __NR_dup3 330 #define __NR_pipe2 331 #define __NR_inotify_init1 332 #define __NR_preadv 333 #define __NR_pwritev 334 #define __NR_rt_tgsigqueueinfo 335 #define __NR_perf_event_open 336 #define __NR_recvmmsg 337 #define __NR_fanotify_init 338 #define __NR_fanotify_mark 339 #define __NR_prlimit64 340 #define __NR_name_to_handle_at 341 #define __NR_open_by_handle_at 342 #define __NR_clock_adjtime 343 #define __NR_syncfs 344 #define __NR_sendmmsg 345 #define __NR_setns 346 #define __NR_process_vm_readv 347 #define __NR_process_vm_writev 348 #define __NR_kcmp 349 #define __NR_finit_module 350 #define __NR_sched_setattr 351 #define __NR_sched_getattr 352 #define __NR_renameat2 353 #define __NR_seccomp 354 #define __NR_getrandom 355 #define __NR_memfd_create 356 #define __NR_bpf 357 #define __NR_execveat 358 #define __NR_socket 359 #define __NR_socketpair 360 #define __NR_bind 361 #define __NR_connect 362 #define __NR_listen 363 #define __NR_accept4 364 #define __NR_getsockopt 365 #define __NR_setsockopt 366 #define __NR_getsockname 367 #define __NR_getpeername 368 #define __NR_sendto 369 #define __NR_sendmsg 370 #define __NR_recvfrom 371 #define __NR_recvmsg 372 #define __NR_shutdown 373 #define __NR_userfaultfd 374 #define __NR_membarrier 375 #define __NR_mlock2 376 #define __NR_copy_file_range 377 #define __NR_preadv2 378 #define __NR_pwritev2 379 #define __NR_pkey_mprotect 380 #define __NR_pkey_alloc 381 #define __NR_pkey_free 382 #define __NR_statx 383 #define __NR_arch_prctl 384 #define __NR_io_pgetevents 385 #define __NR_rseq 386 #define __NR_clock_gettime64 403 #define __NR_clock_settime64 404 #define __NR_clock_adjtime64 405 #define __NR_clock_getres_time64 406 #define __NR_clock_nanosleep_time64 407 #define __NR_timer_gettime64 408 #define __NR_timer_settime64 409 #define __NR_timerfd_gettime64 410 #define __NR_timerfd_settime64 411 #define __NR_utimensat_time64 412 #define __NR_io_pgetevents_time64 416 #define __NR_mq_timedsend_time64 418 #define __NR_mq_timedreceive_time64 419 #define __NR_semtimedop_time64 420 #define __NR_futex_time64 422 #define __NR_sched_rr_get_interval_time64 423 #define __NR_pidfd_send_signal 424 #define __NR_io_uring_setup 425 #define __NR_io_uring_enter 426 #define __NR_io_uring_register 427 #define __NR_open_tree 428 #define __NR_move_mount 429 #define __NR_fsopen 430 #define __NR_fsconfig 431 #define __NR_fsmount 432 #define __NR_fspick 433 #define __NR_close_range 436 #define __NR_openat2 437 #define __NR_faccessat2 439 #endif /* _ASM_X86_UNISTD_32_H */ asm/unistd_64.h 0000644 00000022144 15063602044 0007317 0 ustar 00 #ifndef _ASM_X86_UNISTD_64_H #define _ASM_X86_UNISTD_64_H 1 #define __NR_read 0 #define __NR_write 1 #define __NR_open 2 #define __NR_close 3 #define __NR_stat 4 #define __NR_fstat 5 #define __NR_lstat 6 #define __NR_poll 7 #define __NR_lseek 8 #define __NR_mmap 9 #define __NR_mprotect 10 #define __NR_munmap 11 #define __NR_brk 12 #define __NR_rt_sigaction 13 #define __NR_rt_sigprocmask 14 #define __NR_rt_sigreturn 15 #define __NR_ioctl 16 #define __NR_pread64 17 #define __NR_pwrite64 18 #define __NR_readv 19 #define __NR_writev 20 #define __NR_access 21 #define __NR_pipe 22 #define __NR_select 23 #define __NR_sched_yield 24 #define __NR_mremap 25 #define __NR_msync 26 #define __NR_mincore 27 #define __NR_madvise 28 #define __NR_shmget 29 #define __NR_shmat 30 #define __NR_shmctl 31 #define __NR_dup 32 #define __NR_dup2 33 #define __NR_pause 34 #define __NR_nanosleep 35 #define __NR_getitimer 36 #define __NR_alarm 37 #define __NR_setitimer 38 #define __NR_getpid 39 #define __NR_sendfile 40 #define __NR_socket 41 #define __NR_connect 42 #define __NR_accept 43 #define __NR_sendto 44 #define __NR_recvfrom 45 #define __NR_sendmsg 46 #define __NR_recvmsg 47 #define __NR_shutdown 48 #define __NR_bind 49 #define __NR_listen 50 #define __NR_getsockname 51 #define __NR_getpeername 52 #define __NR_socketpair 53 #define __NR_setsockopt 54 #define __NR_getsockopt 55 #define __NR_clone 56 #define __NR_fork 57 #define __NR_vfork 58 #define __NR_execve 59 #define __NR_exit 60 #define __NR_wait4 61 #define __NR_kill 62 #define __NR_uname 63 #define __NR_semget 64 #define __NR_semop 65 #define __NR_semctl 66 #define __NR_shmdt 67 #define __NR_msgget 68 #define __NR_msgsnd 69 #define __NR_msgrcv 70 #define __NR_msgctl 71 #define __NR_fcntl 72 #define __NR_flock 73 #define __NR_fsync 74 #define __NR_fdatasync 75 #define __NR_truncate 76 #define __NR_ftruncate 77 #define __NR_getdents 78 #define __NR_getcwd 79 #define __NR_chdir 80 #define __NR_fchdir 81 #define __NR_rename 82 #define __NR_mkdir 83 #define __NR_rmdir 84 #define __NR_creat 85 #define __NR_link 86 #define __NR_unlink 87 #define __NR_symlink 88 #define __NR_readlink 89 #define __NR_chmod 90 #define __NR_fchmod 91 #define __NR_chown 92 #define __NR_fchown 93 #define __NR_lchown 94 #define __NR_umask 95 #define __NR_gettimeofday 96 #define __NR_getrlimit 97 #define __NR_getrusage 98 #define __NR_sysinfo 99 #define __NR_times 100 #define __NR_ptrace 101 #define __NR_getuid 102 #define __NR_syslog 103 #define __NR_getgid 104 #define __NR_setuid 105 #define __NR_setgid 106 #define __NR_geteuid 107 #define __NR_getegid 108 #define __NR_setpgid 109 #define __NR_getppid 110 #define __NR_getpgrp 111 #define __NR_setsid 112 #define __NR_setreuid 113 #define __NR_setregid 114 #define __NR_getgroups 115 #define __NR_setgroups 116 #define __NR_setresuid 117 #define __NR_getresuid 118 #define __NR_setresgid 119 #define __NR_getresgid 120 #define __NR_getpgid 121 #define __NR_setfsuid 122 #define __NR_setfsgid 123 #define __NR_getsid 124 #define __NR_capget 125 #define __NR_capset 126 #define __NR_rt_sigpending 127 #define __NR_rt_sigtimedwait 128 #define __NR_rt_sigqueueinfo 129 #define __NR_rt_sigsuspend 130 #define __NR_sigaltstack 131 #define __NR_utime 132 #define __NR_mknod 133 #define __NR_uselib 134 #define __NR_personality 135 #define __NR_ustat 136 #define __NR_statfs 137 #define __NR_fstatfs 138 #define __NR_sysfs 139 #define __NR_getpriority 140 #define __NR_setpriority 141 #define __NR_sched_setparam 142 #define __NR_sched_getparam 143 #define __NR_sched_setscheduler 144 #define __NR_sched_getscheduler 145 #define __NR_sched_get_priority_max 146 #define __NR_sched_get_priority_min 147 #define __NR_sched_rr_get_interval 148 #define __NR_mlock 149 #define __NR_munlock 150 #define __NR_mlockall 151 #define __NR_munlockall 152 #define __NR_vhangup 153 #define __NR_modify_ldt 154 #define __NR_pivot_root 155 #define __NR__sysctl 156 #define __NR_prctl 157 #define __NR_arch_prctl 158 #define __NR_adjtimex 159 #define __NR_setrlimit 160 #define __NR_chroot 161 #define __NR_sync 162 #define __NR_acct 163 #define __NR_settimeofday 164 #define __NR_mount 165 #define __NR_umount2 166 #define __NR_swapon 167 #define __NR_swapoff 168 #define __NR_reboot 169 #define __NR_sethostname 170 #define __NR_setdomainname 171 #define __NR_iopl 172 #define __NR_ioperm 173 #define __NR_create_module 174 #define __NR_init_module 175 #define __NR_delete_module 176 #define __NR_get_kernel_syms 177 #define __NR_query_module 178 #define __NR_quotactl 179 #define __NR_nfsservctl 180 #define __NR_getpmsg 181 #define __NR_putpmsg 182 #define __NR_afs_syscall 183 #define __NR_tuxcall 184 #define __NR_security 185 #define __NR_gettid 186 #define __NR_readahead 187 #define __NR_setxattr 188 #define __NR_lsetxattr 189 #define __NR_fsetxattr 190 #define __NR_getxattr 191 #define __NR_lgetxattr 192 #define __NR_fgetxattr 193 #define __NR_listxattr 194 #define __NR_llistxattr 195 #define __NR_flistxattr 196 #define __NR_removexattr 197 #define __NR_lremovexattr 198 #define __NR_fremovexattr 199 #define __NR_tkill 200 #define __NR_time 201 #define __NR_futex 202 #define __NR_sched_setaffinity 203 #define __NR_sched_getaffinity 204 #define __NR_set_thread_area 205 #define __NR_io_setup 206 #define __NR_io_destroy 207 #define __NR_io_getevents 208 #define __NR_io_submit 209 #define __NR_io_cancel 210 #define __NR_get_thread_area 211 #define __NR_lookup_dcookie 212 #define __NR_epoll_create 213 #define __NR_epoll_ctl_old 214 #define __NR_epoll_wait_old 215 #define __NR_remap_file_pages 216 #define __NR_getdents64 217 #define __NR_set_tid_address 218 #define __NR_restart_syscall 219 #define __NR_semtimedop 220 #define __NR_fadvise64 221 #define __NR_timer_create 222 #define __NR_timer_settime 223 #define __NR_timer_gettime 224 #define __NR_timer_getoverrun 225 #define __NR_timer_delete 226 #define __NR_clock_settime 227 #define __NR_clock_gettime 228 #define __NR_clock_getres 229 #define __NR_clock_nanosleep 230 #define __NR_exit_group 231 #define __NR_epoll_wait 232 #define __NR_epoll_ctl 233 #define __NR_tgkill 234 #define __NR_utimes 235 #define __NR_vserver 236 #define __NR_mbind 237 #define __NR_set_mempolicy 238 #define __NR_get_mempolicy 239 #define __NR_mq_open 240 #define __NR_mq_unlink 241 #define __NR_mq_timedsend 242 #define __NR_mq_timedreceive 243 #define __NR_mq_notify 244 #define __NR_mq_getsetattr 245 #define __NR_kexec_load 246 #define __NR_waitid 247 #define __NR_add_key 248 #define __NR_request_key 249 #define __NR_keyctl 250 #define __NR_ioprio_set 251 #define __NR_ioprio_get 252 #define __NR_inotify_init 253 #define __NR_inotify_add_watch 254 #define __NR_inotify_rm_watch 255 #define __NR_migrate_pages 256 #define __NR_openat 257 #define __NR_mkdirat 258 #define __NR_mknodat 259 #define __NR_fchownat 260 #define __NR_futimesat 261 #define __NR_newfstatat 262 #define __NR_unlinkat 263 #define __NR_renameat 264 #define __NR_linkat 265 #define __NR_symlinkat 266 #define __NR_readlinkat 267 #define __NR_fchmodat 268 #define __NR_faccessat 269 #define __NR_pselect6 270 #define __NR_ppoll 271 #define __NR_unshare 272 #define __NR_set_robust_list 273 #define __NR_get_robust_list 274 #define __NR_splice 275 #define __NR_tee 276 #define __NR_sync_file_range 277 #define __NR_vmsplice 278 #define __NR_move_pages 279 #define __NR_utimensat 280 #define __NR_epoll_pwait 281 #define __NR_signalfd 282 #define __NR_timerfd_create 283 #define __NR_eventfd 284 #define __NR_fallocate 285 #define __NR_timerfd_settime 286 #define __NR_timerfd_gettime 287 #define __NR_accept4 288 #define __NR_signalfd4 289 #define __NR_eventfd2 290 #define __NR_epoll_create1 291 #define __NR_dup3 292 #define __NR_pipe2 293 #define __NR_inotify_init1 294 #define __NR_preadv 295 #define __NR_pwritev 296 #define __NR_rt_tgsigqueueinfo 297 #define __NR_perf_event_open 298 #define __NR_recvmmsg 299 #define __NR_fanotify_init 300 #define __NR_fanotify_mark 301 #define __NR_prlimit64 302 #define __NR_name_to_handle_at 303 #define __NR_open_by_handle_at 304 #define __NR_clock_adjtime 305 #define __NR_syncfs 306 #define __NR_sendmmsg 307 #define __NR_setns 308 #define __NR_getcpu 309 #define __NR_process_vm_readv 310 #define __NR_process_vm_writev 311 #define __NR_kcmp 312 #define __NR_finit_module 313 #define __NR_sched_setattr 314 #define __NR_sched_getattr 315 #define __NR_renameat2 316 #define __NR_seccomp 317 #define __NR_getrandom 318 #define __NR_memfd_create 319 #define __NR_kexec_file_load 320 #define __NR_bpf 321 #define __NR_execveat 322 #define __NR_userfaultfd 323 #define __NR_membarrier 324 #define __NR_mlock2 325 #define __NR_copy_file_range 326 #define __NR_preadv2 327 #define __NR_pwritev2 328 #define __NR_pkey_mprotect 329 #define __NR_pkey_alloc 330 #define __NR_pkey_free 331 #define __NR_statx 332 #define __NR_io_pgetevents 333 #define __NR_rseq 334 #define __NR_pidfd_send_signal 424 #define __NR_io_uring_setup 425 #define __NR_io_uring_enter 426 #define __NR_io_uring_register 427 #define __NR_open_tree 428 #define __NR_move_mount 429 #define __NR_fsopen 430 #define __NR_fsconfig 431 #define __NR_fsmount 432 #define __NR_fspick 433 #define __NR_close_range 436 #define __NR_openat2 437 #define __NR_faccessat2 439 #endif /* _ASM_X86_UNISTD_64_H */ asm/unistd_x32.h 0000644 00000040043 15063602044 0007500 0 ustar 00 #ifndef _ASM_X86_UNISTD_X32_H #define _ASM_X86_UNISTD_X32_H 1 #define __NR_read (__X32_SYSCALL_BIT + 0) #define __NR_write (__X32_SYSCALL_BIT + 1) #define __NR_open (__X32_SYSCALL_BIT + 2) #define __NR_close (__X32_SYSCALL_BIT + 3) #define __NR_stat (__X32_SYSCALL_BIT + 4) #define __NR_fstat (__X32_SYSCALL_BIT + 5) #define __NR_lstat (__X32_SYSCALL_BIT + 6) #define __NR_poll (__X32_SYSCALL_BIT + 7) #define __NR_lseek (__X32_SYSCALL_BIT + 8) #define __NR_mmap (__X32_SYSCALL_BIT + 9) #define __NR_mprotect (__X32_SYSCALL_BIT + 10) #define __NR_munmap (__X32_SYSCALL_BIT + 11) #define __NR_brk (__X32_SYSCALL_BIT + 12) #define __NR_rt_sigprocmask (__X32_SYSCALL_BIT + 14) #define __NR_pread64 (__X32_SYSCALL_BIT + 17) #define __NR_pwrite64 (__X32_SYSCALL_BIT + 18) #define __NR_access (__X32_SYSCALL_BIT + 21) #define __NR_pipe (__X32_SYSCALL_BIT + 22) #define __NR_select (__X32_SYSCALL_BIT + 23) #define __NR_sched_yield (__X32_SYSCALL_BIT + 24) #define __NR_mremap (__X32_SYSCALL_BIT + 25) #define __NR_msync (__X32_SYSCALL_BIT + 26) #define __NR_mincore (__X32_SYSCALL_BIT + 27) #define __NR_madvise (__X32_SYSCALL_BIT + 28) #define __NR_shmget (__X32_SYSCALL_BIT + 29) #define __NR_shmat (__X32_SYSCALL_BIT + 30) #define __NR_shmctl (__X32_SYSCALL_BIT + 31) #define __NR_dup (__X32_SYSCALL_BIT + 32) #define __NR_dup2 (__X32_SYSCALL_BIT + 33) #define __NR_pause (__X32_SYSCALL_BIT + 34) #define __NR_nanosleep (__X32_SYSCALL_BIT + 35) #define __NR_getitimer (__X32_SYSCALL_BIT + 36) #define __NR_alarm (__X32_SYSCALL_BIT + 37) #define __NR_setitimer (__X32_SYSCALL_BIT + 38) #define __NR_getpid (__X32_SYSCALL_BIT + 39) #define __NR_sendfile (__X32_SYSCALL_BIT + 40) #define __NR_socket (__X32_SYSCALL_BIT + 41) #define __NR_connect (__X32_SYSCALL_BIT + 42) #define __NR_accept (__X32_SYSCALL_BIT + 43) #define __NR_sendto (__X32_SYSCALL_BIT + 44) #define __NR_shutdown (__X32_SYSCALL_BIT + 48) #define __NR_bind (__X32_SYSCALL_BIT + 49) #define __NR_listen (__X32_SYSCALL_BIT + 50) #define __NR_getsockname (__X32_SYSCALL_BIT + 51) #define __NR_getpeername (__X32_SYSCALL_BIT + 52) #define __NR_socketpair (__X32_SYSCALL_BIT + 53) #define __NR_clone (__X32_SYSCALL_BIT + 56) #define __NR_fork (__X32_SYSCALL_BIT + 57) #define __NR_vfork (__X32_SYSCALL_BIT + 58) #define __NR_exit (__X32_SYSCALL_BIT + 60) #define __NR_wait4 (__X32_SYSCALL_BIT + 61) #define __NR_kill (__X32_SYSCALL_BIT + 62) #define __NR_uname (__X32_SYSCALL_BIT + 63) #define __NR_semget (__X32_SYSCALL_BIT + 64) #define __NR_semop (__X32_SYSCALL_BIT + 65) #define __NR_semctl (__X32_SYSCALL_BIT + 66) #define __NR_shmdt (__X32_SYSCALL_BIT + 67) #define __NR_msgget (__X32_SYSCALL_BIT + 68) #define __NR_msgsnd (__X32_SYSCALL_BIT + 69) #define __NR_msgrcv (__X32_SYSCALL_BIT + 70) #define __NR_msgctl (__X32_SYSCALL_BIT + 71) #define __NR_fcntl (__X32_SYSCALL_BIT + 72) #define __NR_flock (__X32_SYSCALL_BIT + 73) #define __NR_fsync (__X32_SYSCALL_BIT + 74) #define __NR_fdatasync (__X32_SYSCALL_BIT + 75) #define __NR_truncate (__X32_SYSCALL_BIT + 76) #define __NR_ftruncate (__X32_SYSCALL_BIT + 77) #define __NR_getdents (__X32_SYSCALL_BIT + 78) #define __NR_getcwd (__X32_SYSCALL_BIT + 79) #define __NR_chdir (__X32_SYSCALL_BIT + 80) #define __NR_fchdir (__X32_SYSCALL_BIT + 81) #define __NR_rename (__X32_SYSCALL_BIT + 82) #define __NR_mkdir (__X32_SYSCALL_BIT + 83) #define __NR_rmdir (__X32_SYSCALL_BIT + 84) #define __NR_creat (__X32_SYSCALL_BIT + 85) #define __NR_link (__X32_SYSCALL_BIT + 86) #define __NR_unlink (__X32_SYSCALL_BIT + 87) #define __NR_symlink (__X32_SYSCALL_BIT + 88) #define __NR_readlink (__X32_SYSCALL_BIT + 89) #define __NR_chmod (__X32_SYSCALL_BIT + 90) #define __NR_fchmod (__X32_SYSCALL_BIT + 91) #define __NR_chown (__X32_SYSCALL_BIT + 92) #define __NR_fchown (__X32_SYSCALL_BIT + 93) #define __NR_lchown (__X32_SYSCALL_BIT + 94) #define __NR_umask (__X32_SYSCALL_BIT + 95) #define __NR_gettimeofday (__X32_SYSCALL_BIT + 96) #define __NR_getrlimit (__X32_SYSCALL_BIT + 97) #define __NR_getrusage (__X32_SYSCALL_BIT + 98) #define __NR_sysinfo (__X32_SYSCALL_BIT + 99) #define __NR_times (__X32_SYSCALL_BIT + 100) #define __NR_getuid (__X32_SYSCALL_BIT + 102) #define __NR_syslog (__X32_SYSCALL_BIT + 103) #define __NR_getgid (__X32_SYSCALL_BIT + 104) #define __NR_setuid (__X32_SYSCALL_BIT + 105) #define __NR_setgid (__X32_SYSCALL_BIT + 106) #define __NR_geteuid (__X32_SYSCALL_BIT + 107) #define __NR_getegid (__X32_SYSCALL_BIT + 108) #define __NR_setpgid (__X32_SYSCALL_BIT + 109) #define __NR_getppid (__X32_SYSCALL_BIT + 110) #define __NR_getpgrp (__X32_SYSCALL_BIT + 111) #define __NR_setsid (__X32_SYSCALL_BIT + 112) #define __NR_setreuid (__X32_SYSCALL_BIT + 113) #define __NR_setregid (__X32_SYSCALL_BIT + 114) #define __NR_getgroups (__X32_SYSCALL_BIT + 115) #define __NR_setgroups (__X32_SYSCALL_BIT + 116) #define __NR_setresuid (__X32_SYSCALL_BIT + 117) #define __NR_getresuid (__X32_SYSCALL_BIT + 118) #define __NR_setresgid (__X32_SYSCALL_BIT + 119) #define __NR_getresgid (__X32_SYSCALL_BIT + 120) #define __NR_getpgid (__X32_SYSCALL_BIT + 121) #define __NR_setfsuid (__X32_SYSCALL_BIT + 122) #define __NR_setfsgid (__X32_SYSCALL_BIT + 123) #define __NR_getsid (__X32_SYSCALL_BIT + 124) #define __NR_capget (__X32_SYSCALL_BIT + 125) #define __NR_capset (__X32_SYSCALL_BIT + 126) #define __NR_rt_sigsuspend (__X32_SYSCALL_BIT + 130) #define __NR_utime (__X32_SYSCALL_BIT + 132) #define __NR_mknod (__X32_SYSCALL_BIT + 133) #define __NR_personality (__X32_SYSCALL_BIT + 135) #define __NR_ustat (__X32_SYSCALL_BIT + 136) #define __NR_statfs (__X32_SYSCALL_BIT + 137) #define __NR_fstatfs (__X32_SYSCALL_BIT + 138) #define __NR_sysfs (__X32_SYSCALL_BIT + 139) #define __NR_getpriority (__X32_SYSCALL_BIT + 140) #define __NR_setpriority (__X32_SYSCALL_BIT + 141) #define __NR_sched_setparam (__X32_SYSCALL_BIT + 142) #define __NR_sched_getparam (__X32_SYSCALL_BIT + 143) #define __NR_sched_setscheduler (__X32_SYSCALL_BIT + 144) #define __NR_sched_getscheduler (__X32_SYSCALL_BIT + 145) #define __NR_sched_get_priority_max (__X32_SYSCALL_BIT + 146) #define __NR_sched_get_priority_min (__X32_SYSCALL_BIT + 147) #define __NR_sched_rr_get_interval (__X32_SYSCALL_BIT + 148) #define __NR_mlock (__X32_SYSCALL_BIT + 149) #define __NR_munlock (__X32_SYSCALL_BIT + 150) #define __NR_mlockall (__X32_SYSCALL_BIT + 151) #define __NR_munlockall (__X32_SYSCALL_BIT + 152) #define __NR_vhangup (__X32_SYSCALL_BIT + 153) #define __NR_modify_ldt (__X32_SYSCALL_BIT + 154) #define __NR_pivot_root (__X32_SYSCALL_BIT + 155) #define __NR_prctl (__X32_SYSCALL_BIT + 157) #define __NR_arch_prctl (__X32_SYSCALL_BIT + 158) #define __NR_adjtimex (__X32_SYSCALL_BIT + 159) #define __NR_setrlimit (__X32_SYSCALL_BIT + 160) #define __NR_chroot (__X32_SYSCALL_BIT + 161) #define __NR_sync (__X32_SYSCALL_BIT + 162) #define __NR_acct (__X32_SYSCALL_BIT + 163) #define __NR_settimeofday (__X32_SYSCALL_BIT + 164) #define __NR_mount (__X32_SYSCALL_BIT + 165) #define __NR_umount2 (__X32_SYSCALL_BIT + 166) #define __NR_swapon (__X32_SYSCALL_BIT + 167) #define __NR_swapoff (__X32_SYSCALL_BIT + 168) #define __NR_reboot (__X32_SYSCALL_BIT + 169) #define __NR_sethostname (__X32_SYSCALL_BIT + 170) #define __NR_setdomainname (__X32_SYSCALL_BIT + 171) #define __NR_iopl (__X32_SYSCALL_BIT + 172) #define __NR_ioperm (__X32_SYSCALL_BIT + 173) #define __NR_init_module (__X32_SYSCALL_BIT + 175) #define __NR_delete_module (__X32_SYSCALL_BIT + 176) #define __NR_quotactl (__X32_SYSCALL_BIT + 179) #define __NR_getpmsg (__X32_SYSCALL_BIT + 181) #define __NR_putpmsg (__X32_SYSCALL_BIT + 182) #define __NR_afs_syscall (__X32_SYSCALL_BIT + 183) #define __NR_tuxcall (__X32_SYSCALL_BIT + 184) #define __NR_security (__X32_SYSCALL_BIT + 185) #define __NR_gettid (__X32_SYSCALL_BIT + 186) #define __NR_readahead (__X32_SYSCALL_BIT + 187) #define __NR_setxattr (__X32_SYSCALL_BIT + 188) #define __NR_lsetxattr (__X32_SYSCALL_BIT + 189) #define __NR_fsetxattr (__X32_SYSCALL_BIT + 190) #define __NR_getxattr (__X32_SYSCALL_BIT + 191) #define __NR_lgetxattr (__X32_SYSCALL_BIT + 192) #define __NR_fgetxattr (__X32_SYSCALL_BIT + 193) #define __NR_listxattr (__X32_SYSCALL_BIT + 194) #define __NR_llistxattr (__X32_SYSCALL_BIT + 195) #define __NR_flistxattr (__X32_SYSCALL_BIT + 196) #define __NR_removexattr (__X32_SYSCALL_BIT + 197) #define __NR_lremovexattr (__X32_SYSCALL_BIT + 198) #define __NR_fremovexattr (__X32_SYSCALL_BIT + 199) #define __NR_tkill (__X32_SYSCALL_BIT + 200) #define __NR_time (__X32_SYSCALL_BIT + 201) #define __NR_futex (__X32_SYSCALL_BIT + 202) #define __NR_sched_setaffinity (__X32_SYSCALL_BIT + 203) #define __NR_sched_getaffinity (__X32_SYSCALL_BIT + 204) #define __NR_io_destroy (__X32_SYSCALL_BIT + 207) #define __NR_io_getevents (__X32_SYSCALL_BIT + 208) #define __NR_io_cancel (__X32_SYSCALL_BIT + 210) #define __NR_lookup_dcookie (__X32_SYSCALL_BIT + 212) #define __NR_epoll_create (__X32_SYSCALL_BIT + 213) #define __NR_remap_file_pages (__X32_SYSCALL_BIT + 216) #define __NR_getdents64 (__X32_SYSCALL_BIT + 217) #define __NR_set_tid_address (__X32_SYSCALL_BIT + 218) #define __NR_restart_syscall (__X32_SYSCALL_BIT + 219) #define __NR_semtimedop (__X32_SYSCALL_BIT + 220) #define __NR_fadvise64 (__X32_SYSCALL_BIT + 221) #define __NR_timer_settime (__X32_SYSCALL_BIT + 223) #define __NR_timer_gettime (__X32_SYSCALL_BIT + 224) #define __NR_timer_getoverrun (__X32_SYSCALL_BIT + 225) #define __NR_timer_delete (__X32_SYSCALL_BIT + 226) #define __NR_clock_settime (__X32_SYSCALL_BIT + 227) #define __NR_clock_gettime (__X32_SYSCALL_BIT + 228) #define __NR_clock_getres (__X32_SYSCALL_BIT + 229) #define __NR_clock_nanosleep (__X32_SYSCALL_BIT + 230) #define __NR_exit_group (__X32_SYSCALL_BIT + 231) #define __NR_epoll_wait (__X32_SYSCALL_BIT + 232) #define __NR_epoll_ctl (__X32_SYSCALL_BIT + 233) #define __NR_tgkill (__X32_SYSCALL_BIT + 234) #define __NR_utimes (__X32_SYSCALL_BIT + 235) #define __NR_mbind (__X32_SYSCALL_BIT + 237) #define __NR_set_mempolicy (__X32_SYSCALL_BIT + 238) #define __NR_get_mempolicy (__X32_SYSCALL_BIT + 239) #define __NR_mq_open (__X32_SYSCALL_BIT + 240) #define __NR_mq_unlink (__X32_SYSCALL_BIT + 241) #define __NR_mq_timedsend (__X32_SYSCALL_BIT + 242) #define __NR_mq_timedreceive (__X32_SYSCALL_BIT + 243) #define __NR_mq_getsetattr (__X32_SYSCALL_BIT + 245) #define __NR_add_key (__X32_SYSCALL_BIT + 248) #define __NR_request_key (__X32_SYSCALL_BIT + 249) #define __NR_keyctl (__X32_SYSCALL_BIT + 250) #define __NR_ioprio_set (__X32_SYSCALL_BIT + 251) #define __NR_ioprio_get (__X32_SYSCALL_BIT + 252) #define __NR_inotify_init (__X32_SYSCALL_BIT + 253) #define __NR_inotify_add_watch (__X32_SYSCALL_BIT + 254) #define __NR_inotify_rm_watch (__X32_SYSCALL_BIT + 255) #define __NR_migrate_pages (__X32_SYSCALL_BIT + 256) #define __NR_openat (__X32_SYSCALL_BIT + 257) #define __NR_mkdirat (__X32_SYSCALL_BIT + 258) #define __NR_mknodat (__X32_SYSCALL_BIT + 259) #define __NR_fchownat (__X32_SYSCALL_BIT + 260) #define __NR_futimesat (__X32_SYSCALL_BIT + 261) #define __NR_newfstatat (__X32_SYSCALL_BIT + 262) #define __NR_unlinkat (__X32_SYSCALL_BIT + 263) #define __NR_renameat (__X32_SYSCALL_BIT + 264) #define __NR_linkat (__X32_SYSCALL_BIT + 265) #define __NR_symlinkat (__X32_SYSCALL_BIT + 266) #define __NR_readlinkat (__X32_SYSCALL_BIT + 267) #define __NR_fchmodat (__X32_SYSCALL_BIT + 268) #define __NR_faccessat (__X32_SYSCALL_BIT + 269) #define __NR_pselect6 (__X32_SYSCALL_BIT + 270) #define __NR_ppoll (__X32_SYSCALL_BIT + 271) #define __NR_unshare (__X32_SYSCALL_BIT + 272) #define __NR_splice (__X32_SYSCALL_BIT + 275) #define __NR_tee (__X32_SYSCALL_BIT + 276) #define __NR_sync_file_range (__X32_SYSCALL_BIT + 277) #define __NR_utimensat (__X32_SYSCALL_BIT + 280) #define __NR_epoll_pwait (__X32_SYSCALL_BIT + 281) #define __NR_signalfd (__X32_SYSCALL_BIT + 282) #define __NR_timerfd_create (__X32_SYSCALL_BIT + 283) #define __NR_eventfd (__X32_SYSCALL_BIT + 284) #define __NR_fallocate (__X32_SYSCALL_BIT + 285) #define __NR_timerfd_settime (__X32_SYSCALL_BIT + 286) #define __NR_timerfd_gettime (__X32_SYSCALL_BIT + 287) #define __NR_accept4 (__X32_SYSCALL_BIT + 288) #define __NR_signalfd4 (__X32_SYSCALL_BIT + 289) #define __NR_eventfd2 (__X32_SYSCALL_BIT + 290) #define __NR_epoll_create1 (__X32_SYSCALL_BIT + 291) #define __NR_dup3 (__X32_SYSCALL_BIT + 292) #define __NR_pipe2 (__X32_SYSCALL_BIT + 293) #define __NR_inotify_init1 (__X32_SYSCALL_BIT + 294) #define __NR_perf_event_open (__X32_SYSCALL_BIT + 298) #define __NR_fanotify_init (__X32_SYSCALL_BIT + 300) #define __NR_fanotify_mark (__X32_SYSCALL_BIT + 301) #define __NR_prlimit64 (__X32_SYSCALL_BIT + 302) #define __NR_name_to_handle_at (__X32_SYSCALL_BIT + 303) #define __NR_open_by_handle_at (__X32_SYSCALL_BIT + 304) #define __NR_clock_adjtime (__X32_SYSCALL_BIT + 305) #define __NR_syncfs (__X32_SYSCALL_BIT + 306) #define __NR_setns (__X32_SYSCALL_BIT + 308) #define __NR_getcpu (__X32_SYSCALL_BIT + 309) #define __NR_kcmp (__X32_SYSCALL_BIT + 312) #define __NR_finit_module (__X32_SYSCALL_BIT + 313) #define __NR_sched_setattr (__X32_SYSCALL_BIT + 314) #define __NR_sched_getattr (__X32_SYSCALL_BIT + 315) #define __NR_renameat2 (__X32_SYSCALL_BIT + 316) #define __NR_seccomp (__X32_SYSCALL_BIT + 317) #define __NR_getrandom (__X32_SYSCALL_BIT + 318) #define __NR_memfd_create (__X32_SYSCALL_BIT + 319) #define __NR_kexec_file_load (__X32_SYSCALL_BIT + 320) #define __NR_bpf (__X32_SYSCALL_BIT + 321) #define __NR_userfaultfd (__X32_SYSCALL_BIT + 323) #define __NR_membarrier (__X32_SYSCALL_BIT + 324) #define __NR_mlock2 (__X32_SYSCALL_BIT + 325) #define __NR_copy_file_range (__X32_SYSCALL_BIT + 326) #define __NR_pkey_mprotect (__X32_SYSCALL_BIT + 329) #define __NR_pkey_alloc (__X32_SYSCALL_BIT + 330) #define __NR_pkey_free (__X32_SYSCALL_BIT + 331) #define __NR_statx (__X32_SYSCALL_BIT + 332) #define __NR_io_pgetevents (__X32_SYSCALL_BIT + 333) #define __NR_rseq (__X32_SYSCALL_BIT + 334) #define __NR_pidfd_send_signal (__X32_SYSCALL_BIT + 424) #define __NR_io_uring_setup (__X32_SYSCALL_BIT + 425) #define __NR_io_uring_enter (__X32_SYSCALL_BIT + 426) #define __NR_io_uring_register (__X32_SYSCALL_BIT + 427) #define __NR_open_tree (__X32_SYSCALL_BIT + 428) #define __NR_move_mount (__X32_SYSCALL_BIT + 429) #define __NR_fsopen (__X32_SYSCALL_BIT + 430) #define __NR_fsconfig (__X32_SYSCALL_BIT + 431) #define __NR_fsmount (__X32_SYSCALL_BIT + 432) #define __NR_fspick (__X32_SYSCALL_BIT + 433) #define __NR_close_range (__X32_SYSCALL_BIT + 436) #define __NR_openat2 (__X32_SYSCALL_BIT + 437) #define __NR_faccessat2 (__X32_SYSCALL_BIT + 439) #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512) #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513) #define __NR_ioctl (__X32_SYSCALL_BIT + 514) #define __NR_readv (__X32_SYSCALL_BIT + 515) #define __NR_writev (__X32_SYSCALL_BIT + 516) #define __NR_recvfrom (__X32_SYSCALL_BIT + 517) #define __NR_sendmsg (__X32_SYSCALL_BIT + 518) #define __NR_recvmsg (__X32_SYSCALL_BIT + 519) #define __NR_execve (__X32_SYSCALL_BIT + 520) #define __NR_ptrace (__X32_SYSCALL_BIT + 521) #define __NR_rt_sigpending (__X32_SYSCALL_BIT + 522) #define __NR_rt_sigtimedwait (__X32_SYSCALL_BIT + 523) #define __NR_rt_sigqueueinfo (__X32_SYSCALL_BIT + 524) #define __NR_sigaltstack (__X32_SYSCALL_BIT + 525) #define __NR_timer_create (__X32_SYSCALL_BIT + 526) #define __NR_mq_notify (__X32_SYSCALL_BIT + 527) #define __NR_kexec_load (__X32_SYSCALL_BIT + 528) #define __NR_waitid (__X32_SYSCALL_BIT + 529) #define __NR_set_robust_list (__X32_SYSCALL_BIT + 530) #define __NR_get_robust_list (__X32_SYSCALL_BIT + 531) #define __NR_vmsplice (__X32_SYSCALL_BIT + 532) #define __NR_move_pages (__X32_SYSCALL_BIT + 533) #define __NR_preadv (__X32_SYSCALL_BIT + 534) #define __NR_pwritev (__X32_SYSCALL_BIT + 535) #define __NR_rt_tgsigqueueinfo (__X32_SYSCALL_BIT + 536) #define __NR_recvmmsg (__X32_SYSCALL_BIT + 537) #define __NR_sendmmsg (__X32_SYSCALL_BIT + 538) #define __NR_process_vm_readv (__X32_SYSCALL_BIT + 539) #define __NR_process_vm_writev (__X32_SYSCALL_BIT + 540) #define __NR_setsockopt (__X32_SYSCALL_BIT + 541) #define __NR_getsockopt (__X32_SYSCALL_BIT + 542) #define __NR_io_setup (__X32_SYSCALL_BIT + 543) #define __NR_io_submit (__X32_SYSCALL_BIT + 544) #define __NR_execveat (__X32_SYSCALL_BIT + 545) #define __NR_preadv2 (__X32_SYSCALL_BIT + 546) #define __NR_pwritev2 (__X32_SYSCALL_BIT + 547) #endif /* _ASM_X86_UNISTD_X32_H */ asm/vm86.h 0000644 00000006056 15063602044 0006304 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_VM86_H #define _ASM_X86_VM86_H /* * I'm guessing at the VIF/VIP flag usage, but hope that this is how * the Pentium uses them. Linux will return from vm86 mode when both * VIF and VIP is set. * * On a Pentium, we could probably optimize the virtual flags directly * in the eflags register instead of doing it "by hand" in vflags... * * Linus */ #include <asm/processor-flags.h> #define BIOSSEG 0x0f000 #define CPU_086 0 #define CPU_186 1 #define CPU_286 2 #define CPU_386 3 #define CPU_486 4 #define CPU_586 5 /* * Return values for the 'vm86()' system call */ #define VM86_TYPE(retval) ((retval) & 0xff) #define VM86_ARG(retval) ((retval) >> 8) #define VM86_SIGNAL 0 /* return due to signal */ #define VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */ #define VM86_INTx 2 /* int3/int x instruction (ARG = x) */ #define VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */ /* * Additional return values when invoking new vm86() */ #define VM86_PICRETURN 4 /* return due to pending PIC request */ #define VM86_TRAP 6 /* return due to DOS-debugger request */ /* * function codes when invoking new vm86() */ #define VM86_PLUS_INSTALL_CHECK 0 #define VM86_ENTER 1 #define VM86_ENTER_NO_BYPASS 2 #define VM86_REQUEST_IRQ 3 #define VM86_FREE_IRQ 4 #define VM86_GET_IRQ_BITS 5 #define VM86_GET_AND_RESET_IRQ 6 /* * This is the stack-layout seen by the user space program when we have * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout * is 'kernel_vm86_regs' (see below). */ struct vm86_regs { /* * normal regs, with special meaning for the segment descriptors.. */ long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; long __null_ds; long __null_es; long __null_fs; long __null_gs; long orig_eax; long eip; unsigned short cs, __csh; long eflags; long esp; unsigned short ss, __ssh; /* * these are specific to v86 mode: */ unsigned short es, __esh; unsigned short ds, __dsh; unsigned short fs, __fsh; unsigned short gs, __gsh; }; struct revectored_struct { unsigned long __map[8]; /* 256 bits */ }; struct vm86_struct { struct vm86_regs regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; struct revectored_struct int_revectored; struct revectored_struct int21_revectored; }; /* * flags masks */ #define VM86_SCREEN_BITMAP 0x0001 struct vm86plus_info_struct { unsigned long force_return_for_pic:1; unsigned long vm86dbg_active:1; /* for debugger */ unsigned long vm86dbg_TFpendig:1; /* for debugger */ unsigned long unused:28; unsigned long is_vm86pus:1; /* for vm86 internal use */ unsigned char vm86dbg_intxxtab[32]; /* for debugger */ }; struct vm86plus_struct { struct vm86_regs regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; struct revectored_struct int_revectored; struct revectored_struct int21_revectored; struct vm86plus_info_struct vm86plus; }; #endif /* _ASM_X86_VM86_H */ asm/vmx.h 0000644 00000016310 15063602044 0006310 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * vmx.h: VMX Architecture related definitions * Copyright (c) 2004, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * A few random additions are: * Copyright (C) 2006 Qumranet * Avi Kivity <avi@qumranet.com> * Yaniv Kamay <yaniv@qumranet.com> * */ #ifndef VMX_H #define VMX_H #define VMX_EXIT_REASONS_FAILED_VMENTRY 0x80000000 #define VMX_EXIT_REASONS_SGX_ENCLAVE_MODE 0x08000000 #define EXIT_REASON_EXCEPTION_NMI 0 #define EXIT_REASON_EXTERNAL_INTERRUPT 1 #define EXIT_REASON_TRIPLE_FAULT 2 #define EXIT_REASON_INIT_SIGNAL 3 #define EXIT_REASON_SIPI_SIGNAL 4 #define EXIT_REASON_INTERRUPT_WINDOW 7 #define EXIT_REASON_NMI_WINDOW 8 #define EXIT_REASON_TASK_SWITCH 9 #define EXIT_REASON_CPUID 10 #define EXIT_REASON_HLT 12 #define EXIT_REASON_INVD 13 #define EXIT_REASON_INVLPG 14 #define EXIT_REASON_RDPMC 15 #define EXIT_REASON_RDTSC 16 #define EXIT_REASON_VMCALL 18 #define EXIT_REASON_VMCLEAR 19 #define EXIT_REASON_VMLAUNCH 20 #define EXIT_REASON_VMPTRLD 21 #define EXIT_REASON_VMPTRST 22 #define EXIT_REASON_VMREAD 23 #define EXIT_REASON_VMRESUME 24 #define EXIT_REASON_VMWRITE 25 #define EXIT_REASON_VMOFF 26 #define EXIT_REASON_VMON 27 #define EXIT_REASON_CR_ACCESS 28 #define EXIT_REASON_DR_ACCESS 29 #define EXIT_REASON_IO_INSTRUCTION 30 #define EXIT_REASON_MSR_READ 31 #define EXIT_REASON_MSR_WRITE 32 #define EXIT_REASON_INVALID_STATE 33 #define EXIT_REASON_MSR_LOAD_FAIL 34 #define EXIT_REASON_MWAIT_INSTRUCTION 36 #define EXIT_REASON_MONITOR_TRAP_FLAG 37 #define EXIT_REASON_MONITOR_INSTRUCTION 39 #define EXIT_REASON_PAUSE_INSTRUCTION 40 #define EXIT_REASON_MCE_DURING_VMENTRY 41 #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 #define EXIT_REASON_APIC_ACCESS 44 #define EXIT_REASON_EOI_INDUCED 45 #define EXIT_REASON_GDTR_IDTR 46 #define EXIT_REASON_LDTR_TR 47 #define EXIT_REASON_EPT_VIOLATION 48 #define EXIT_REASON_EPT_MISCONFIG 49 #define EXIT_REASON_INVEPT 50 #define EXIT_REASON_RDTSCP 51 #define EXIT_REASON_PREEMPTION_TIMER 52 #define EXIT_REASON_INVVPID 53 #define EXIT_REASON_WBINVD 54 #define EXIT_REASON_XSETBV 55 #define EXIT_REASON_APIC_WRITE 56 #define EXIT_REASON_RDRAND 57 #define EXIT_REASON_INVPCID 58 #define EXIT_REASON_VMFUNC 59 #define EXIT_REASON_ENCLS 60 #define EXIT_REASON_RDSEED 61 #define EXIT_REASON_PML_FULL 62 #define EXIT_REASON_XSAVES 63 #define EXIT_REASON_XRSTORS 64 #define EXIT_REASON_UMWAIT 67 #define EXIT_REASON_TPAUSE 68 #define EXIT_REASON_BUS_LOCK 74 #define VMX_EXIT_REASONS \ { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, \ { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, \ { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, \ { EXIT_REASON_SIPI_SIGNAL, "SIPI_SIGNAL" }, \ { EXIT_REASON_INTERRUPT_WINDOW, "INTERRUPT_WINDOW" }, \ { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, \ { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \ { EXIT_REASON_CPUID, "CPUID" }, \ { EXIT_REASON_HLT, "HLT" }, \ { EXIT_REASON_INVD, "INVD" }, \ { EXIT_REASON_INVLPG, "INVLPG" }, \ { EXIT_REASON_RDPMC, "RDPMC" }, \ { EXIT_REASON_RDTSC, "RDTSC" }, \ { EXIT_REASON_VMCALL, "VMCALL" }, \ { EXIT_REASON_VMCLEAR, "VMCLEAR" }, \ { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, \ { EXIT_REASON_VMPTRLD, "VMPTRLD" }, \ { EXIT_REASON_VMPTRST, "VMPTRST" }, \ { EXIT_REASON_VMREAD, "VMREAD" }, \ { EXIT_REASON_VMRESUME, "VMRESUME" }, \ { EXIT_REASON_VMWRITE, "VMWRITE" }, \ { EXIT_REASON_VMOFF, "VMOFF" }, \ { EXIT_REASON_VMON, "VMON" }, \ { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, \ { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, \ { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, \ { EXIT_REASON_MSR_READ, "MSR_READ" }, \ { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, \ { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, \ { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, \ { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, \ { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, \ { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, \ { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, \ { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, \ { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, \ { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \ { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, \ { EXIT_REASON_LDTR_TR, "LDTR_TR" }, \ { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, \ { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, \ { EXIT_REASON_INVEPT, "INVEPT" }, \ { EXIT_REASON_RDTSCP, "RDTSCP" }, \ { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, \ { EXIT_REASON_INVVPID, "INVVPID" }, \ { EXIT_REASON_WBINVD, "WBINVD" }, \ { EXIT_REASON_XSETBV, "XSETBV" }, \ { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, \ { EXIT_REASON_RDRAND, "RDRAND" }, \ { EXIT_REASON_INVPCID, "INVPCID" }, \ { EXIT_REASON_VMFUNC, "VMFUNC" }, \ { EXIT_REASON_ENCLS, "ENCLS" }, \ { EXIT_REASON_RDSEED, "RDSEED" }, \ { EXIT_REASON_PML_FULL, "PML_FULL" }, \ { EXIT_REASON_XSAVES, "XSAVES" }, \ { EXIT_REASON_XRSTORS, "XRSTORS" }, \ { EXIT_REASON_UMWAIT, "UMWAIT" }, \ { EXIT_REASON_TPAUSE, "TPAUSE" }, \ { EXIT_REASON_BUS_LOCK, "BUS_LOCK" } #define VMX_EXIT_REASON_FLAGS \ { VMX_EXIT_REASONS_FAILED_VMENTRY, "FAILED_VMENTRY" } #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 #endif /* VMX_H */ asm/vsyscall.h 0000644 00000000407 15063602044 0007336 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_VSYSCALL_H #define _ASM_X86_VSYSCALL_H enum vsyscall_num { __NR_vgettimeofday, __NR_vtime, __NR_vgetcpu, }; #define VSYSCALL_ADDR (-10UL << 20) #endif /* _ASM_X86_VSYSCALL_H */ asm/a.out.h 0000644 00000001364 15063602044 0006527 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_A_OUT_H #define _ASM_X86_A_OUT_H struct exec { unsigned int a_info; /* Use macros N_MAGIC, etc for access */ unsigned a_text; /* length of text, in bytes */ unsigned a_data; /* length of data, in bytes */ unsigned a_bss; /* length of uninitialized data area for file, in bytes */ unsigned a_syms; /* length of symbol table data in file, in bytes */ unsigned a_entry; /* start address */ unsigned a_trsize; /* length of relocation info for text, in bytes */ unsigned a_drsize; /* length of relocation info for data, in bytes */ }; #define N_TRSIZE(a) ((a).a_trsize) #define N_DRSIZE(a) ((a).a_drsize) #define N_SYMSIZE(a) ((a).a_syms) #endif /* _ASM_X86_A_OUT_H */ asm/amd_hsmp.h 0000644 00000021274 15063602044 0007273 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_AMD_HSMP_H_ #define _ASM_X86_AMD_HSMP_H_ #include <linux/types.h> #pragma pack(4) #define HSMP_MAX_MSG_LEN 8 /* * HSMP Messages supported */ enum hsmp_message_ids { HSMP_TEST = 1, /* 01h Increments input value by 1 */ HSMP_GET_SMU_VER, /* 02h SMU FW version */ HSMP_GET_PROTO_VER, /* 03h HSMP interface version */ HSMP_GET_SOCKET_POWER, /* 04h average package power consumption */ HSMP_SET_SOCKET_POWER_LIMIT, /* 05h Set the socket power limit */ HSMP_GET_SOCKET_POWER_LIMIT, /* 06h Get current socket power limit */ HSMP_GET_SOCKET_POWER_LIMIT_MAX,/* 07h Get maximum socket power value */ HSMP_SET_BOOST_LIMIT, /* 08h Set a core maximum frequency limit */ HSMP_SET_BOOST_LIMIT_SOCKET, /* 09h Set socket maximum frequency level */ HSMP_GET_BOOST_LIMIT, /* 0Ah Get current frequency limit */ HSMP_GET_PROC_HOT, /* 0Bh Get PROCHOT status */ HSMP_SET_XGMI_LINK_WIDTH, /* 0Ch Set max and min width of xGMI Link */ HSMP_SET_DF_PSTATE, /* 0Dh Alter APEnable/Disable messages behavior */ HSMP_SET_AUTO_DF_PSTATE, /* 0Eh Enable DF P-State Performance Boost algorithm */ HSMP_GET_FCLK_MCLK, /* 0Fh Get FCLK and MEMCLK for current socket */ HSMP_GET_CCLK_THROTTLE_LIMIT, /* 10h Get CCLK frequency limit in socket */ HSMP_GET_C0_PERCENT, /* 11h Get average C0 residency in socket */ HSMP_SET_NBIO_DPM_LEVEL, /* 12h Set max/min LCLK DPM Level for a given NBIO */ HSMP_GET_NBIO_DPM_LEVEL, /* 13h Get LCLK DPM level min and max for a given NBIO */ HSMP_GET_DDR_BANDWIDTH, /* 14h Get theoretical maximum and current DDR Bandwidth */ HSMP_GET_TEMP_MONITOR, /* 15h Get socket temperature */ HSMP_GET_DIMM_TEMP_RANGE, /* 16h Get per-DIMM temperature range and refresh rate */ HSMP_GET_DIMM_POWER, /* 17h Get per-DIMM power consumption */ HSMP_GET_DIMM_THERMAL, /* 18h Get per-DIMM thermal sensors */ HSMP_GET_SOCKET_FREQ_LIMIT, /* 19h Get current active frequency per socket */ HSMP_GET_CCLK_CORE_LIMIT, /* 1Ah Get CCLK frequency limit per core */ HSMP_GET_RAILS_SVI, /* 1Bh Get SVI-based Telemetry for all rails */ HSMP_GET_SOCKET_FMAX_FMIN, /* 1Ch Get Fmax and Fmin per socket */ HSMP_GET_IOLINK_BANDWITH, /* 1Dh Get current bandwidth on IO Link */ HSMP_GET_XGMI_BANDWITH, /* 1Eh Get current bandwidth on xGMI Link */ HSMP_SET_GMI3_WIDTH, /* 1Fh Set max and min GMI3 Link width */ HSMP_SET_PCI_RATE, /* 20h Control link rate on PCIe devices */ HSMP_SET_POWER_MODE, /* 21h Select power efficiency profile policy */ HSMP_SET_PSTATE_MAX_MIN, /* 22h Set the max and min DF P-State */ HSMP_MSG_ID_MAX, }; struct hsmp_message { __u32 msg_id; /* Message ID */ __u16 num_args; /* Number of input argument words in message */ __u16 response_sz; /* Number of expected output/response words */ __u32 args[HSMP_MAX_MSG_LEN]; /* argument/response buffer */ __u16 sock_ind; /* socket number */ }; enum hsmp_msg_type { HSMP_RSVD = -1, HSMP_SET = 0, HSMP_GET = 1, }; struct hsmp_msg_desc { int num_args; int response_sz; enum hsmp_msg_type type; }; /* * User may use these comments as reference, please find the * supported list of messages and message definition in the * HSMP chapter of respective family/model PPR. * * Not supported messages would return -ENOMSG. */ static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { /* RESERVED */ {0, 0, HSMP_RSVD}, /* * HSMP_TEST, num_args = 1, response_sz = 1 * input: args[0] = xx * output: args[0] = xx + 1 */ {1, 1, HSMP_GET}, /* * HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 * output: args[0] = smu fw ver */ {0, 1, HSMP_GET}, /* * HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 * output: args[0] = proto version */ {0, 1, HSMP_GET}, /* * HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 * output: args[0] = socket power in mWatts */ {0, 1, HSMP_GET}, /* * HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 * input: args[0] = power limit value in mWatts */ {1, 0, HSMP_SET}, /* * HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 * output: args[0] = socket power limit value in mWatts */ {0, 1, HSMP_GET}, /* * HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 * output: args[0] = maximuam socket power limit in mWatts */ {0, 1, HSMP_GET}, /* * HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 * input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] */ {1, 0, HSMP_SET}, /* * HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 * input: args[0] = boost limit value in MHz */ {1, 0, HSMP_SET}, /* * HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 * input: args[0] = apic id * output: args[0] = boost limit value in MHz */ {1, 1, HSMP_GET}, /* * HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 * output: args[0] = proc hot status */ {0, 1, HSMP_GET}, /* * HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 * input: args[0] = min link width[15:8] + max link width[7:0] */ {1, 0, HSMP_SET}, /* * HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 * input: args[0] = df pstate[7:0] */ {1, 0, HSMP_SET}, /* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ {0, 0, HSMP_SET}, /* * HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 * output: args[0] = fclk in MHz, args[1] = mclk in MHz */ {0, 2, HSMP_GET}, /* * HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 * output: args[0] = core clock in MHz */ {0, 1, HSMP_GET}, /* * HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 * output: args[0] = average c0 residency */ {0, 1, HSMP_GET}, /* * HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 * input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0] */ {1, 0, HSMP_SET}, /* * HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 * input: args[0] = nbioid[23:16] * output: args[0] = max dpm level[15:8] + min dpm level[7:0] */ {1, 1, HSMP_GET}, /* * HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 * output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] + * bw in percentage[7:0] */ {0, 1, HSMP_GET}, /* * HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 * output: args[0] = temperature in degree celsius. [15:8] integer part + * [7:5] fractional part */ {0, 1, HSMP_GET}, /* * HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 * input: args[0] = DIMM address[7:0] * output: args[0] = refresh rate[3] + temperature range[2:0] */ {1, 1, HSMP_GET}, /* * HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 * input: args[0] = DIMM address[7:0] * output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] + * DIMM address[7:0] */ {1, 1, HSMP_GET}, /* * HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 * input: args[0] = DIMM address[7:0] * output: args[0] = temperature in degree celcius[31:21] + update rate in ms[16:8] + * DIMM address[7:0] */ {1, 1, HSMP_GET}, /* * HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 * output: args[0] = frequency in MHz[31:16] + frequency source[15:0] */ {0, 1, HSMP_GET}, /* * HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 * input: args[0] = apic id [31:0] * output: args[0] = frequency in MHz[31:0] */ {1, 1, HSMP_GET}, /* * HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 * output: args[0] = power in mW[31:0] */ {0, 1, HSMP_GET}, /* * HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 * output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] */ {0, 1, HSMP_GET}, /* * HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 * input: args[0] = link id[15:8] + bw type[2:0] * output: args[0] = io bandwidth in Mbps[31:0] */ {1, 1, HSMP_GET}, /* * HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 * input: args[0] = link id[15:8] + bw type[2:0] * output: args[0] = xgmi bandwidth in Mbps[31:0] */ {1, 1, HSMP_GET}, /* * HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 * input: args[0] = min link width[15:8] + max link width[7:0] */ {1, 0, HSMP_SET}, /* * HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 * input: args[0] = link rate control value * output: args[0] = previous link rate control value */ {1, 1, HSMP_SET}, /* * HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 * input: args[0] = power efficiency mode[2:0] */ {1, 0, HSMP_SET}, /* * HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 * input: args[0] = min df pstate[15:8] + max df pstate[7:0] */ {1, 0, HSMP_SET}, }; /* Reset to default packing */ #pragma pack() /* Define unique ioctl command for hsmp msgs using generic _IOWR */ #define HSMP_BASE_IOCTL_NR 0xF8 #define HSMP_IOCTL_CMD _IOWR(HSMP_BASE_IOCTL_NR, 0, struct hsmp_message) #endif /*_ASM_X86_AMD_HSMP_H_*/ asm/auxvec.h 0000644 00000001152 15063602044 0006767 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_AUXVEC_H #define _ASM_X86_AUXVEC_H /* * Architecture-neutral AT_ values in 0-17, leave some room * for more of them, start the x86-specific ones at 32. */ #ifdef __i386__ #define AT_SYSINFO 32 #endif #define AT_SYSINFO_EHDR 33 /* entries in ARCH_DLINFO: */ #if defined(CONFIG_IA32_EMULATION) || !defined(CONFIG_X86_64) # define AT_VECTOR_SIZE_ARCH 3 # define ORIG_AT_VECTOR_SIZE_ARCH 2 #else /* else it's non-compat x86-64 */ # define AT_VECTOR_SIZE_ARCH 2 # define ORIG_AT_VECTOR_SIZE_ARCH 1 #endif #endif /* _ASM_X86_AUXVEC_H */ asm/bitsperlong.h 0000644 00000000501 15063602044 0010021 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_X86_BITSPERLONG_H #define __ASM_X86_BITSPERLONG_H #if defined(__x86_64__) && !defined(__ILP32__) # define __BITS_PER_LONG 64 #else # define __BITS_PER_LONG 32 #endif #include <asm-generic/bitsperlong.h> #endif /* __ASM_X86_BITSPERLONG_H */ asm/boot.h 0000644 00000000503 15063602044 0006436 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_BOOT_H #define _ASM_X86_BOOT_H /* Internal svga startup constants */ #define NORMAL_VGA 0xffff /* 80x25 mode */ #define EXTENDED_VGA 0xfffe /* 80x50 mode */ #define ASK_VGA 0xfffd /* ask for it at bootup */ #endif /* _ASM_X86_BOOT_H */ asm/bootparam.h 0000644 00000017117 15063602044 0007470 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_BOOTPARAM_H #define _ASM_X86_BOOTPARAM_H /* setup_data types */ #define SETUP_NONE 0 #define SETUP_E820_EXT 1 #define SETUP_DTB 2 #define SETUP_PCI 3 #define SETUP_EFI 4 #define SETUP_APPLE_PROPERTIES 5 #define SETUP_JAILHOUSE 6 #define SETUP_CC_BLOB 7 /* ram_size flags */ #define RAMDISK_IMAGE_START_MASK 0x07FF #define RAMDISK_PROMPT_FLAG 0x8000 #define RAMDISK_LOAD_FLAG 0x4000 /* loadflags */ #define LOADED_HIGH (1<<0) #define KASLR_FLAG (1<<1) #define QUIET_FLAG (1<<5) #define KEEP_SEGMENTS (1<<6) #define CAN_USE_HEAP (1<<7) /* xloadflags */ #define XLF_KERNEL_64 (1<<0) #define XLF_CAN_BE_LOADED_ABOVE_4G (1<<1) #define XLF_EFI_HANDOVER_32 (1<<2) #define XLF_EFI_HANDOVER_64 (1<<3) #define XLF_EFI_KEXEC (1<<4) #ifndef __ASSEMBLY__ #include <linux/types.h> #include <linux/screen_info.h> #include <linux/apm_bios.h> #include <linux/edd.h> #include <asm/ist.h> #include <video/edid.h> /* extensible setup data list node */ struct setup_data { __u64 next; __u32 type; __u32 len; __u8 data[0]; }; struct setup_header { __u8 setup_sects; __u16 root_flags; __u32 syssize; __u16 ram_size; __u16 vid_mode; __u16 root_dev; __u16 boot_flag; __u16 jump; __u32 header; __u16 version; __u32 realmode_swtch; __u16 start_sys_seg; __u16 kernel_version; __u8 type_of_loader; __u8 loadflags; __u16 setup_move_size; __u32 code32_start; __u32 ramdisk_image; __u32 ramdisk_size; __u32 bootsect_kludge; __u16 heap_end_ptr; __u8 ext_loader_ver; __u8 ext_loader_type; __u32 cmd_line_ptr; __u32 initrd_addr_max; __u32 kernel_alignment; __u8 relocatable_kernel; __u8 min_alignment; __u16 xloadflags; __u32 cmdline_size; __u32 hardware_subarch; __u64 hardware_subarch_data; __u32 payload_offset; __u32 payload_length; __u64 setup_data; __u64 pref_address; __u32 init_size; __u32 handover_offset; } __attribute__((packed)); struct sys_desc_table { __u16 length; __u8 table[14]; }; /* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */ struct olpc_ofw_header { __u32 ofw_magic; /* OFW signature */ __u32 ofw_version; __u32 cif_handler; /* callback into OFW */ __u32 irq_desc_table; } __attribute__((packed)); struct efi_info { __u32 efi_loader_signature; __u32 efi_systab; __u32 efi_memdesc_size; __u32 efi_memdesc_version; __u32 efi_memmap; __u32 efi_memmap_size; __u32 efi_systab_hi; __u32 efi_memmap_hi; }; /* * This is the maximum number of entries in struct boot_params::e820_table * (the zeropage), which is part of the x86 boot protocol ABI: */ #define E820_MAX_ENTRIES_ZEROPAGE 128 /* * The E820 memory region entry of the boot protocol ABI: */ struct boot_e820_entry { __u64 addr; __u64 size; __u32 type; } __attribute__((packed)); /* * Smallest compatible version of jailhouse_setup_data required by this kernel. */ #define JAILHOUSE_SETUP_REQUIRED_VERSION 1 /* * The boot loader is passing platform information via this Jailhouse-specific * setup data structure. */ struct jailhouse_setup_data { __u16 version; __u16 compatible_version; __u16 pm_timer_address; __u16 num_cpus; __u64 pci_mmconfig_base; __u32 tsc_khz; __u32 apic_khz; __u8 standard_ioapic; __u8 cpu_ids[255]; } __attribute__((packed)); /* The so-called "zeropage" */ struct boot_params { struct screen_info screen_info; /* 0x000 */ struct apm_bios_info apm_bios_info; /* 0x040 */ __u8 _pad2[4]; /* 0x054 */ __u64 tboot_addr; /* 0x058 */ struct ist_info ist_info; /* 0x060 */ __u64 acpi_rsdp_addr; /* 0x070 */ __u8 _pad3[8]; /* 0x078 */ __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */ struct olpc_ofw_header olpc_ofw_header; /* 0x0b0 */ __u32 ext_ramdisk_image; /* 0x0c0 */ __u32 ext_ramdisk_size; /* 0x0c4 */ __u32 ext_cmd_line_ptr; /* 0x0c8 */ __u8 _pad4[112]; /* 0x0cc */ __u32 cc_blob_address; /* 0x13c */ struct edid_info edid_info; /* 0x140 */ struct efi_info efi_info; /* 0x1c0 */ __u32 alt_mem_k; /* 0x1e0 */ __u32 scratch; /* Scratch field! */ /* 0x1e4 */ __u8 e820_entries; /* 0x1e8 */ __u8 eddbuf_entries; /* 0x1e9 */ __u8 edd_mbr_sig_buf_entries; /* 0x1ea */ __u8 kbd_status; /* 0x1eb */ __u8 secure_boot; /* 0x1ec */ __u8 _pad5[2]; /* 0x1ed */ /* * The sentinel is set to a nonzero value (0xff) in header.S. * * A bootloader is supposed to only take setup_header and put * it into a clean boot_params buffer. If it turns out that * it is clumsy or too generous with the buffer, it most * probably will pick up the sentinel variable too. The fact * that this variable then is still 0xff will let kernel * know that some variables in boot_params are invalid and * kernel should zero out certain portions of boot_params. */ __u8 sentinel; /* 0x1ef */ __u8 _pad6[1]; /* 0x1f0 */ struct setup_header hdr; /* setup header */ /* 0x1f1 */ __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ struct boot_e820_entry e820_table[E820_MAX_ENTRIES_ZEROPAGE]; /* 0x2d0 */ __u8 _pad8[48]; /* 0xcd0 */ struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ __u8 _pad9[276]; /* 0xeec */ } __attribute__((packed)); /** * enum x86_hardware_subarch - x86 hardware subarchitecture * * The x86 hardware_subarch and hardware_subarch_data were added as of the x86 * boot protocol 2.07 to help distinguish and support custom x86 boot * sequences. This enum represents accepted values for the x86 * hardware_subarch. Custom x86 boot sequences (not X86_SUBARCH_PC) do not * have or simply *cannot* make use of natural stubs like BIOS or EFI, the * hardware_subarch can be used on the Linux entry path to revector to a * subarchitecture stub when needed. This subarchitecture stub can be used to * set up Linux boot parameters or for special care to account for nonstandard * handling of page tables. * * These enums should only ever be used by x86 code, and the code that uses * it should be well contained and compartamentalized. * * KVM and Xen HVM do not have a subarch as these are expected to follow * standard x86 boot entries. If there is a genuine need for "hypervisor" type * that should be considered separately in the future. Future guest types * should seriously consider working with standard x86 boot stubs such as * the BIOS or EFI boot stubs. * * WARNING: this enum is only used for legacy hacks, for platform features that * are not easily enumerated or discoverable. You should not ever use * this for new features. * * @X86_SUBARCH_PC: Should be used if the hardware is enumerable using standard * PC mechanisms (PCI, ACPI) and doesn't need a special boot flow. * @X86_SUBARCH_LGUEST: Used for x86 hypervisor demo, lguest, deprecated * @X86_SUBARCH_XEN: Used for Xen guest types which follow the PV boot path, * which start at __asm__ startup_xen() entry point and later jump to the C * xen_start_kernel() entry point. Both domU and dom0 type of guests are * currently supportd through this PV boot path. * @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet Device) platform * systems which do not have the PCI legacy interfaces. * @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC for * for settop boxes and media devices, the use of a subarch for CE4100 * is more of a hack... */ enum x86_hardware_subarch { X86_SUBARCH_PC = 0, X86_SUBARCH_LGUEST, X86_SUBARCH_XEN, X86_SUBARCH_INTEL_MID, X86_SUBARCH_CE4100, X86_NR_SUBARCHS, }; #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_BOOTPARAM_H */ asm/bpf_perf_event.h 0000644 00000000050 15063602044 0010454 0 ustar 00 #include <asm-generic/bpf_perf_event.h> asm/byteorder.h 0000644 00000000260 15063602044 0007472 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_BYTEORDER_H #define _ASM_X86_BYTEORDER_H #include <linux/byteorder/little_endian.h> #endif /* _ASM_X86_BYTEORDER_H */ asm/debugreg.h 0000644 00000006401 15063602044 0007262 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_DEBUGREG_H #define _ASM_X86_DEBUGREG_H /* Indicate the register numbers for a number of the specific debug registers. Registers 0-3 contain the addresses we wish to trap on */ #define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */ #define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */ #define DR_STATUS 6 /* u_debugreg[DR_STATUS] */ #define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */ /* Define a few things for the status register. We can use this to determine which debugging register was responsible for the trap. The other bits are either reserved or not of interest to us. */ /* Define reserved bits in DR6 which are always set to 1 */ #define DR6_RESERVED (0xFFFF0FF0) #define DR_TRAP0 (0x1) /* db0 */ #define DR_TRAP1 (0x2) /* db1 */ #define DR_TRAP2 (0x4) /* db2 */ #define DR_TRAP3 (0x8) /* db3 */ #define DR_TRAP_BITS (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3) #define DR_BUS_LOCK (0x800) /* bus_lock */ #define DR_STEP (0x4000) /* single-step */ #define DR_SWITCH (0x8000) /* task switch */ /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 bits - each field corresponds to one of the four debug registers, and indicates what types of access we trap on, and how large the data field is that we are looking at */ #define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */ #define DR_CONTROL_SIZE 4 /* 4 control bits per register */ #define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */ #define DR_RW_WRITE (0x1) #define DR_RW_READ (0x3) #define DR_LEN_1 (0x0) /* Settings for data length to trap on */ #define DR_LEN_2 (0x4) #define DR_LEN_4 (0xC) #define DR_LEN_8 (0x8) /* The low byte to the control register determine which registers are enabled. There are 4 fields of two bits. One bit is "local", meaning that the processor will reset the bit after a task switch and the other is global meaning that we have to explicitly reset the bit. With linux, you can use either one, since we explicitly zero the register when we enter kernel mode. */ #define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */ #define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */ #define DR_LOCAL_ENABLE (0x1) /* Local enable for reg 0 */ #define DR_GLOBAL_ENABLE (0x2) /* Global enable for reg 0 */ #define DR_ENABLE_SIZE 2 /* 2 enable bits per register */ #define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */ #define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */ /* The second byte to the control register has a few special things. We can slow the instruction pipeline for instructions coming via the gdt or the ldt if we want to. I am not sure why this is an advantage */ #ifdef __i386__ #define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */ #else #define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */ #endif #define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ #define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ /* * HW breakpoint additions */ #endif /* _ASM_X86_DEBUGREG_H */ asm/e820.h 0000644 00000005023 15063602044 0006153 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_E820_H #define _ASM_X86_E820_H #define E820MAP 0x2d0 /* our map */ #define E820MAX 128 /* number of entries in E820MAP */ /* * Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the * constrained space in the zeropage. If we have more nodes than * that, and if we've booted off EFI firmware, then the EFI tables * passed us from the EFI firmware can list more nodes. Size our * internal memory map tables to have room for these additional * nodes, based on up to three entries per node for which the * kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT), * plus E820MAX, allowing space for the possible duplicate E820 * entries that might need room in the same arrays, prior to the * call to sanitize_e820_map() to remove duplicates. The allowance * of three memory map entries per node is "enough" entries for * the initial hardware platform motivating this mechanism to make * use of additional EFI map entries. Future platforms may want * to allow more than three entries per node or otherwise refine * this size. */ #define E820_X_MAX E820MAX #define E820NR 0x1e8 /* # entries in E820MAP */ #define E820_RAM 1 #define E820_RESERVED 2 #define E820_ACPI 3 #define E820_NVS 4 #define E820_UNUSABLE 5 #define E820_PMEM 7 /* * This is a non-standardized way to represent ADR or NVDIMM regions that * persist over a reboot. The kernel will ignore their special capabilities * unless the CONFIG_X86_PMEM_LEGACY option is set. * * ( Note that older platforms also used 6 for the same type of memory, * but newer versions switched to 12 as 6 was assigned differently. Some * time they will learn... ) */ #define E820_PRAM 12 /* * reserved RAM used by kernel itself * if CONFIG_INTEL_TXT is enabled, memory of this type will be * included in the S3 integrity calculation and so should not include * any memory that BIOS might alter over the S3 transition */ #define E820_RESERVED_KERN 128 #ifndef __ASSEMBLY__ #include <linux/types.h> struct e820entry { __u64 addr; /* start of memory segment */ __u64 size; /* size of memory segment */ __u32 type; /* type of memory segment */ } __attribute__((packed)); struct e820map { __u32 nr_map; struct e820entry map[E820_X_MAX]; }; #define ISA_START_ADDRESS 0xa0000 #define ISA_END_ADDRESS 0x100000 #define BIOS_BEGIN 0x000a0000 #define BIOS_END 0x00100000 #define BIOS_ROM_BASE 0xffe00000 #define BIOS_ROM_END 0xffffffff #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_E820_H */ asm/errno.h 0000644 00000000037 15063602044 0006622 0 ustar 00 #include <asm-generic/errno.h> asm/fcntl.h 0000644 00000000037 15063602044 0006603 0 ustar 00 #include <asm-generic/fcntl.h> asm/hw_breakpoint.h 0000644 00000000105 15063602044 0010325 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* */ asm/hwcap2.h 0000644 00000000416 15063602044 0006662 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_HWCAP2_H #define _ASM_X86_HWCAP2_H /* MONITOR/MWAIT enabled in Ring 3 */ #define HWCAP2_RING3MWAIT (1 << 0) /* Kernel allows FSGSBASE instructions available in Ring 3 */ #define HWCAP2_FSGSBASE BIT(1) #endif asm/ioctl.h 0000644 00000000037 15063602044 0006607 0 ustar 00 #include <asm-generic/ioctl.h> asm/ioctls.h 0000644 00000000040 15063602044 0006764 0 ustar 00 #include <asm-generic/ioctls.h> asm/ipcbuf.h 0000644 00000000040 15063602044 0006737 0 ustar 00 #include <asm-generic/ipcbuf.h> asm/ist.h 0000644 00000001526 15063602044 0006300 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Include file for the interface to IST BIOS * Copyright 2002 Andy Grover <andrew.grover@intel.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _ASM_X86_IST_H #define _ASM_X86_IST_H #include <linux/types.h> struct ist_info { __u32 signature; __u32 command; __u32 event; __u32 perf_level; }; #endif /* _ASM_X86_IST_H */ asm/kvm.h 0000644 00000026707 15063602044 0006306 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_H #define _ASM_X86_KVM_H /* * KVM x86 specific structures and definitions * */ #include <linux/types.h> #include <linux/ioctl.h> #define KVM_PIO_PAGE_OFFSET 1 #define KVM_COALESCED_MMIO_PAGE_OFFSET 2 #define KVM_DIRTY_LOG_PAGE_OFFSET 64 #define DE_VECTOR 0 #define DB_VECTOR 1 #define BP_VECTOR 3 #define OF_VECTOR 4 #define BR_VECTOR 5 #define UD_VECTOR 6 #define NM_VECTOR 7 #define DF_VECTOR 8 #define TS_VECTOR 10 #define NP_VECTOR 11 #define SS_VECTOR 12 #define GP_VECTOR 13 #define PF_VECTOR 14 #define MF_VECTOR 16 #define AC_VECTOR 17 #define MC_VECTOR 18 #define XM_VECTOR 19 #define VE_VECTOR 20 /* Select x86 specific features in <linux/kvm.h> */ #define __KVM_HAVE_PIT #define __KVM_HAVE_IOAPIC #define __KVM_HAVE_IRQ_LINE #define __KVM_HAVE_MSI #define __KVM_HAVE_USER_NMI #define __KVM_HAVE_GUEST_DEBUG #define __KVM_HAVE_MSIX #define __KVM_HAVE_MCE #define __KVM_HAVE_PIT_STATE2 #define __KVM_HAVE_XEN_HVM #define __KVM_HAVE_VCPU_EVENTS #define __KVM_HAVE_DEBUGREGS #define __KVM_HAVE_XSAVE #define __KVM_HAVE_XCRS #define __KVM_HAVE_READONLY_MEM /* Architectural interrupt line count. */ #define KVM_NR_INTERRUPTS 256 struct kvm_memory_alias { __u32 slot; /* this has a different namespace than memory slots */ __u32 flags; __u64 guest_phys_addr; __u64 memory_size; __u64 target_phys_addr; }; /* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */ struct kvm_pic_state { __u8 last_irr; /* edge detection */ __u8 irr; /* interrupt request register */ __u8 imr; /* interrupt mask register */ __u8 isr; /* interrupt service register */ __u8 priority_add; /* highest irq priority */ __u8 irq_base; __u8 read_reg_select; __u8 poll; __u8 special_mask; __u8 init_state; __u8 auto_eoi; __u8 rotate_on_auto_eoi; __u8 special_fully_nested_mode; __u8 init4; /* true if 4 byte init */ __u8 elcr; /* PIIX edge/trigger selection */ __u8 elcr_mask; }; #define KVM_IOAPIC_NUM_PINS 24 struct kvm_ioapic_state { __u64 base_address; __u32 ioregsel; __u32 id; __u32 irr; __u32 pad; union { __u64 bits; struct { __u8 vector; __u8 delivery_mode:3; __u8 dest_mode:1; __u8 delivery_status:1; __u8 polarity:1; __u8 remote_irr:1; __u8 trig_mode:1; __u8 mask:1; __u8 reserve:7; __u8 reserved[4]; __u8 dest_id; } fields; } redirtbl[KVM_IOAPIC_NUM_PINS]; }; #define KVM_IRQCHIP_PIC_MASTER 0 #define KVM_IRQCHIP_PIC_SLAVE 1 #define KVM_IRQCHIP_IOAPIC 2 #define KVM_NR_IRQCHIPS 3 #define KVM_RUN_X86_SMM (1 << 0) #define KVM_RUN_X86_BUS_LOCK (1 << 1) /* for KVM_GET_REGS and KVM_SET_REGS */ struct kvm_regs { /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ __u64 rax, rbx, rcx, rdx; __u64 rsi, rdi, rsp, rbp; __u64 r8, r9, r10, r11; __u64 r12, r13, r14, r15; __u64 rip, rflags; }; /* for KVM_GET_LAPIC and KVM_SET_LAPIC */ #define KVM_APIC_REG_SIZE 0x400 struct kvm_lapic_state { char regs[KVM_APIC_REG_SIZE]; }; struct kvm_segment { __u64 base; __u32 limit; __u16 selector; __u8 type; __u8 present, dpl, db, s, l, g, avl; __u8 unusable; __u8 padding; }; struct kvm_dtable { __u64 base; __u16 limit; __u16 padding[3]; }; /* for KVM_GET_SREGS and KVM_SET_SREGS */ struct kvm_sregs { /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ struct kvm_segment cs, ds, es, fs, gs, ss; struct kvm_segment tr, ldt; struct kvm_dtable gdt, idt; __u64 cr0, cr2, cr3, cr4, cr8; __u64 efer; __u64 apic_base; __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; }; struct kvm_sregs2 { /* out (KVM_GET_SREGS2) / in (KVM_SET_SREGS2) */ struct kvm_segment cs, ds, es, fs, gs, ss; struct kvm_segment tr, ldt; struct kvm_dtable gdt, idt; __u64 cr0, cr2, cr3, cr4, cr8; __u64 efer; __u64 apic_base; __u64 flags; __u64 pdptrs[4]; }; #define KVM_SREGS2_FLAGS_PDPTRS_VALID 1 /* for KVM_GET_FPU and KVM_SET_FPU */ struct kvm_fpu { __u8 fpr[8][16]; __u16 fcw; __u16 fsw; __u8 ftwx; /* in fxsave format */ __u8 pad1; __u16 last_opcode; __u64 last_ip; __u64 last_dp; __u8 xmm[16][16]; __u32 mxcsr; __u32 pad2; }; struct kvm_msr_entry { __u32 index; __u32 reserved; __u64 data; }; /* for KVM_GET_MSRS and KVM_SET_MSRS */ struct kvm_msrs { __u32 nmsrs; /* number of msrs in entries */ __u32 pad; struct kvm_msr_entry entries[0]; }; /* for KVM_GET_MSR_INDEX_LIST */ struct kvm_msr_list { __u32 nmsrs; /* number of msrs in entries */ __u32 indices[0]; }; /* Maximum size of any access bitmap in bytes */ #define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600 /* for KVM_X86_SET_MSR_FILTER */ struct kvm_msr_filter_range { #define KVM_MSR_FILTER_READ (1 << 0) #define KVM_MSR_FILTER_WRITE (1 << 1) __u32 flags; __u32 nmsrs; /* number of msrs in bitmap */ __u32 base; /* MSR index the bitmap starts at */ __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */ }; #define KVM_MSR_FILTER_MAX_RANGES 16 struct kvm_msr_filter { #define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0) #define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0) __u32 flags; struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES]; }; struct kvm_cpuid_entry { __u32 function; __u32 eax; __u32 ebx; __u32 ecx; __u32 edx; __u32 padding; }; /* for KVM_SET_CPUID */ struct kvm_cpuid { __u32 nent; __u32 padding; struct kvm_cpuid_entry entries[0]; }; struct kvm_cpuid_entry2 { __u32 function; __u32 index; __u32 flags; __u32 eax; __u32 ebx; __u32 ecx; __u32 edx; __u32 padding[3]; }; #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX (1 << 0) #define KVM_CPUID_FLAG_STATEFUL_FUNC (1 << 1) #define KVM_CPUID_FLAG_STATE_READ_NEXT (1 << 2) /* for KVM_SET_CPUID2 */ struct kvm_cpuid2 { __u32 nent; __u32 padding; struct kvm_cpuid_entry2 entries[0]; }; /* for KVM_GET_PIT and KVM_SET_PIT */ struct kvm_pit_channel_state { __u32 count; /* can be 65536 */ __u16 latched_count; __u8 count_latched; __u8 status_latched; __u8 status; __u8 read_state; __u8 write_state; __u8 write_latch; __u8 rw_mode; __u8 mode; __u8 bcd; __u8 gate; __s64 count_load_time; }; struct kvm_debug_exit_arch { __u32 exception; __u32 pad; __u64 pc; __u64 dr6; __u64 dr7; }; #define KVM_GUESTDBG_USE_SW_BP 0x00010000 #define KVM_GUESTDBG_USE_HW_BP 0x00020000 #define KVM_GUESTDBG_INJECT_DB 0x00040000 #define KVM_GUESTDBG_INJECT_BP 0x00080000 #define KVM_GUESTDBG_BLOCKIRQ 0x00100000 /* for KVM_SET_GUEST_DEBUG */ struct kvm_guest_debug_arch { __u64 debugreg[8]; }; struct kvm_pit_state { struct kvm_pit_channel_state channels[3]; }; #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 struct kvm_pit_state2 { struct kvm_pit_channel_state channels[3]; __u32 flags; __u32 reserved[9]; }; struct kvm_reinject_control { __u8 pit_reinject; __u8 reserved[31]; }; /* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */ #define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001 #define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002 #define KVM_VCPUEVENT_VALID_SHADOW 0x00000004 #define KVM_VCPUEVENT_VALID_SMM 0x00000008 #define KVM_VCPUEVENT_VALID_PAYLOAD 0x00000010 /* Interrupt shadow states */ #define KVM_X86_SHADOW_INT_MOV_SS 0x01 #define KVM_X86_SHADOW_INT_STI 0x02 /* for KVM_GET/SET_VCPU_EVENTS */ struct kvm_vcpu_events { struct { __u8 injected; __u8 nr; __u8 has_error_code; __u8 pending; __u32 error_code; } exception; struct { __u8 injected; __u8 nr; __u8 soft; __u8 shadow; } interrupt; struct { __u8 injected; __u8 pending; __u8 masked; __u8 pad; } nmi; __u32 sipi_vector; __u32 flags; struct { __u8 smm; __u8 pending; __u8 smm_inside_nmi; __u8 latched_init; } smi; __u8 reserved[27]; __u8 exception_has_payload; __u64 exception_payload; }; /* for KVM_GET/SET_DEBUGREGS */ struct kvm_debugregs { __u64 db[4]; __u64 dr6; __u64 dr7; __u64 flags; __u64 reserved[9]; }; /* for KVM_CAP_XSAVE and KVM_CAP_XSAVE2 */ struct kvm_xsave { /* * KVM_GET_XSAVE2 and KVM_SET_XSAVE write and read as many bytes * as are returned by KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2) * respectively, when invoked on the vm file descriptor. * * The size value returned by KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2) * will always be at least 4096. Currently, it is only greater * than 4096 if a dynamic feature has been enabled with * ``arch_prctl()``, but this may change in the future. * * The offsets of the state save areas in struct kvm_xsave follow * the contents of CPUID leaf 0xD on the host. */ __u32 region[1024]; __u32 extra[0]; }; #define KVM_MAX_XCRS 16 struct kvm_xcr { __u32 xcr; __u32 reserved; __u64 value; }; struct kvm_xcrs { __u32 nr_xcrs; __u32 flags; struct kvm_xcr xcrs[KVM_MAX_XCRS]; __u64 padding[16]; }; #define KVM_SYNC_X86_REGS (1UL << 0) #define KVM_SYNC_X86_SREGS (1UL << 1) #define KVM_SYNC_X86_EVENTS (1UL << 2) #define KVM_SYNC_X86_VALID_FIELDS \ (KVM_SYNC_X86_REGS| \ KVM_SYNC_X86_SREGS| \ KVM_SYNC_X86_EVENTS) /* kvm_sync_regs struct included by kvm_run struct */ struct kvm_sync_regs { /* Members of this structure are potentially malicious. * Care must be taken by code reading, esp. interpreting, * data fields from them inside KVM to prevent TOCTOU and * double-fetch types of vulnerabilities. */ struct kvm_regs regs; struct kvm_sregs sregs; struct kvm_vcpu_events events; }; #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) #define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3) #define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4) #define KVM_STATE_NESTED_FORMAT_VMX 0 #define KVM_STATE_NESTED_FORMAT_SVM 1 #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 #define KVM_STATE_NESTED_EVMCS 0x00000004 #define KVM_STATE_NESTED_MTF_PENDING 0x00000008 #define KVM_STATE_NESTED_GIF_SET 0x00000100 #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_SMM_VMXON 0x00000002 #define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000 #define KVM_STATE_NESTED_SVM_VMCB_SIZE 0x1000 #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001 /* attributes for system fd (group 0) */ #define KVM_X86_XCOMP_GUEST_SUPP 0 struct kvm_vmx_nested_state_data { __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; }; struct kvm_vmx_nested_state_hdr { __u64 vmxon_pa; __u64 vmcs12_pa; struct { __u16 flags; } smm; __u16 pad; __u32 flags; __u64 preemption_timer_deadline; }; struct kvm_svm_nested_state_data { /* Save area only used if KVM_STATE_NESTED_RUN_PENDING. */ __u8 vmcb12[KVM_STATE_NESTED_SVM_VMCB_SIZE]; }; struct kvm_svm_nested_state_hdr { __u64 vmcb_pa; }; /* for KVM_CAP_NESTED_STATE */ struct kvm_nested_state { __u16 flags; __u16 format; __u32 size; union { struct kvm_vmx_nested_state_hdr vmx; struct kvm_svm_nested_state_hdr svm; /* Pad the header to 128 bytes. */ __u8 pad[120]; } hdr; /* * Define data region as 0 bytes to preserve backwards-compatability * to old definition of kvm_nested_state in order to avoid changing * KVM_{GET,PUT}_NESTED_STATE ioctl values. */ union { struct kvm_vmx_nested_state_data vmx[0]; struct kvm_svm_nested_state_data svm[0]; } data; }; /* for KVM_CAP_PMU_EVENT_FILTER */ struct kvm_pmu_event_filter { __u32 action; __u32 nevents; __u32 fixed_counter_bitmap; __u32 flags; __u32 pad[4]; __u64 events[0]; }; #define KVM_PMU_EVENT_ALLOW 0 #define KVM_PMU_EVENT_DENY 1 /* for KVM_{GET,SET,HAS}_DEVICE_ATTR */ #define KVM_VCPU_TSC_CTRL 0 /* control group for the timestamp counter (TSC) */ #define KVM_VCPU_TSC_OFFSET 0 /* attribute for the TSC offset */ #endif /* _ASM_X86_KVM_H */ asm/kvm_para.h 0000644 00000010364 15063602044 0007301 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_PARA_H #define _ASM_X86_KVM_PARA_H #include <linux/types.h> /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It * should be used to determine that a VM is running under KVM. */ #define KVM_CPUID_SIGNATURE 0x40000000 #define KVM_SIGNATURE "KVMKVMKVM\0\0\0" /* This CPUID returns two feature bitmaps in eax, edx. Before enabling * a particular paravirtualization, the appropriate feature bit should * be checked in eax. The performance hint feature bit should be checked * in edx. */ #define KVM_CPUID_FEATURES 0x40000001 #define KVM_FEATURE_CLOCKSOURCE 0 #define KVM_FEATURE_NOP_IO_DELAY 1 #define KVM_FEATURE_MMU_OP 2 /* This indicates that the new set of kvmclock msrs * are available. The use of 0x11 and 0x12 is deprecated */ #define KVM_FEATURE_CLOCKSOURCE2 3 #define KVM_FEATURE_ASYNC_PF 4 #define KVM_FEATURE_STEAL_TIME 5 #define KVM_FEATURE_PV_EOI 6 #define KVM_FEATURE_PV_UNHALT 7 #define KVM_FEATURE_PV_TLB_FLUSH 9 #define KVM_FEATURE_ASYNC_PF_VMEXIT 10 #define KVM_FEATURE_PV_SEND_IPI 11 #define KVM_FEATURE_POLL_CONTROL 12 #define KVM_FEATURE_PV_SCHED_YIELD 13 #define KVM_FEATURE_ASYNC_PF_INT 14 #define KVM_FEATURE_MSI_EXT_DEST_ID 15 #define KVM_FEATURE_HC_MAP_GPA_RANGE 16 #define KVM_FEATURE_MIGRATION_CONTROL 17 #define KVM_HINTS_REALTIME 0 /* The last 8 bits are used to indicate how to interpret the flags field * in pvclock structure. If no bits are set, all flags are ignored. */ #define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24 #define MSR_KVM_WALL_CLOCK 0x11 #define MSR_KVM_SYSTEM_TIME 0x12 #define KVM_MSR_ENABLED 1 /* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */ #define MSR_KVM_WALL_CLOCK_NEW 0x4b564d00 #define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01 #define MSR_KVM_ASYNC_PF_EN 0x4b564d02 #define MSR_KVM_STEAL_TIME 0x4b564d03 #define MSR_KVM_PV_EOI_EN 0x4b564d04 #define MSR_KVM_POLL_CONTROL 0x4b564d05 #define MSR_KVM_ASYNC_PF_INT 0x4b564d06 #define MSR_KVM_ASYNC_PF_ACK 0x4b564d07 #define MSR_KVM_MIGRATION_CONTROL 0x4b564d08 struct kvm_steal_time { __u64 steal; __u32 version; __u32 flags; __u8 preempted; __u8 u8_pad[3]; __u32 pad[11]; }; #define KVM_VCPU_PREEMPTED (1 << 0) #define KVM_VCPU_FLUSH_TLB (1 << 1) #define KVM_CLOCK_PAIRING_WALLCLOCK 0 struct kvm_clock_pairing { __s64 sec; __s64 nsec; __u64 tsc; __u32 flags; __u32 pad[9]; }; #define KVM_STEAL_ALIGNMENT_BITS 5 #define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1))) #define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1) #define KVM_MAX_MMU_OP_BATCH 32 #define KVM_ASYNC_PF_ENABLED (1 << 0) #define KVM_ASYNC_PF_SEND_ALWAYS (1 << 1) #define KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT (1 << 2) #define KVM_ASYNC_PF_DELIVERY_AS_INT (1 << 3) /* MSR_KVM_ASYNC_PF_INT */ #define KVM_ASYNC_PF_VEC_MASK GENMASK(7, 0) /* MSR_KVM_MIGRATION_CONTROL */ #define KVM_MIGRATION_READY (1 << 0) /* KVM_HC_MAP_GPA_RANGE */ #define KVM_MAP_GPA_RANGE_PAGE_SZ_4K 0 #define KVM_MAP_GPA_RANGE_PAGE_SZ_2M (1 << 0) #define KVM_MAP_GPA_RANGE_PAGE_SZ_1G (1 << 1) #define KVM_MAP_GPA_RANGE_ENC_STAT(n) (n << 4) #define KVM_MAP_GPA_RANGE_ENCRYPTED KVM_MAP_GPA_RANGE_ENC_STAT(1) #define KVM_MAP_GPA_RANGE_DECRYPTED KVM_MAP_GPA_RANGE_ENC_STAT(0) /* Operations for KVM_HC_MMU_OP */ #define KVM_MMU_OP_WRITE_PTE 1 #define KVM_MMU_OP_FLUSH_TLB 2 #define KVM_MMU_OP_RELEASE_PT 3 /* Payload for KVM_HC_MMU_OP */ struct kvm_mmu_op_header { __u32 op; __u32 pad; }; struct kvm_mmu_op_write_pte { struct kvm_mmu_op_header header; __u64 pte_phys; __u64 pte_val; }; struct kvm_mmu_op_flush_tlb { struct kvm_mmu_op_header header; }; struct kvm_mmu_op_release_pt { struct kvm_mmu_op_header header; __u64 pt_phys; }; #define KVM_PV_REASON_PAGE_NOT_PRESENT 1 #define KVM_PV_REASON_PAGE_READY 2 struct kvm_vcpu_pv_apf_data { /* Used for 'page not present' events delivered via #PF */ __u32 flags; /* Used for 'page ready' events delivered via interrupt notification */ __u32 token; __u8 pad[56]; __u32 enabled; }; #define KVM_PV_EOI_BIT 0 #define KVM_PV_EOI_MASK (0x1 << KVM_PV_EOI_BIT) #define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK #define KVM_PV_EOI_DISABLED 0x0 #endif /* _ASM_X86_KVM_PARA_H */ asm/kvm_perf.h 0000644 00000000604 15063602044 0007306 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_KVM_PERF_H #define _ASM_X86_KVM_PERF_H #include <asm/svm.h> #include <asm/vmx.h> #include <asm/kvm.h> #define DECODE_STR_LEN 20 #define VCPU_ID "vcpu_id" #define KVM_ENTRY_TRACE "kvm:kvm_entry" #define KVM_EXIT_TRACE "kvm:kvm_exit" #define KVM_EXIT_REASON "exit_reason" #endif /* _ASM_X86_KVM_PERF_H */ asm/ldt.h 0000644 00000002432 15063602044 0006261 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ldt.h * * Definitions of structures used with the modify_ldt system call. */ #ifndef _ASM_X86_LDT_H #define _ASM_X86_LDT_H /* Maximum number of LDT entries supported. */ #define LDT_ENTRIES 8192 /* The size of each LDT entry. */ #define LDT_ENTRY_SIZE 8 #ifndef __ASSEMBLY__ /* * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS * not to the default values if you still want to do syscalls. This * call is more for 32bit mode therefore. */ struct user_desc { unsigned int entry_number; unsigned int base_addr; unsigned int limit; unsigned int seg_32bit:1; unsigned int contents:2; unsigned int read_exec_only:1; unsigned int limit_in_pages:1; unsigned int seg_not_present:1; unsigned int useable:1; #ifdef __x86_64__ /* * Because this bit is not present in 32-bit user code, user * programs can pass uninitialized values here. Therefore, in * any context in which a user_desc comes from a 32-bit program, * the kernel must act as though lm == 0, regardless of the * actual value. */ unsigned int lm:1; #endif }; #define MODIFY_LDT_CONTENTS_DATA 0 #define MODIFY_LDT_CONTENTS_STACK 1 #define MODIFY_LDT_CONTENTS_CODE 2 #endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_LDT_H */ asm/mce.h 0000644 00000003230 15063602044 0006237 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_MCE_H #define _ASM_X86_MCE_H #include <linux/types.h> #include <linux/ioctl.h> /* * Fields are zero when not available. Also, this struct is shared with * userspace mcelog and thus must keep existing fields at current offsets. * Only add new fields to the end of the structure */ struct mce { __u64 status; /* Bank's MCi_STATUS MSR */ __u64 misc; /* Bank's MCi_MISC MSR */ __u64 addr; /* Bank's MCi_ADDR MSR */ __u64 mcgstatus; /* Machine Check Global Status MSR */ __u64 ip; /* Instruction Pointer when the error happened */ __u64 tsc; /* CPU time stamp counter */ __u64 time; /* Wall time_t when error was detected */ __u8 cpuvendor; /* Kernel's X86_VENDOR enum */ __u8 inject_flags; /* Software inject flags */ __u8 severity; /* Error severity */ __u8 pad; __u32 cpuid; /* CPUID 1 EAX */ __u8 cs; /* Code segment */ __u8 bank; /* Machine check bank reporting the error */ __u8 cpu; /* CPU number; obsoleted by extcpu */ __u8 finished; /* Entry is valid */ __u32 extcpu; /* Linux CPU number that detected the error */ __u32 socketid; /* CPU socket ID */ __u32 apicid; /* CPU initial APIC ID */ __u64 mcgcap; /* MCGCAP MSR: machine check capabilities of CPU */ __u64 synd; /* MCA_SYND MSR: only valid on SMCA systems */ __u64 ipid; /* MCA_IPID MSR: only valid on SMCA systems */ __u64 ppin; /* Protected Processor Inventory Number */ __u32 microcode; /* Microcode revision */ }; #define MCE_GET_RECORD_LEN _IOR('M', 1, int) #define MCE_GET_LOG_LEN _IOR('M', 2, int) #define MCE_GETCLEAR_FLAGS _IOR('M', 3, int) #endif /* _ASM_X86_MCE_H */ asm-generic/auxvec.h 0000644 00000000332 15063602044 0010400 0 ustar 00 #ifndef __ASM_GENERIC_AUXVEC_H #define __ASM_GENERIC_AUXVEC_H /* * Not all architectures need their own auxvec.h, the most * common definitions are already in linux/auxvec.h. */ #endif /* __ASM_GENERIC_AUXVEC_H */ asm-generic/bitsperlong.h 0000644 00000001064 15063602044 0011440 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_BITS_PER_LONG #define __ASM_GENERIC_BITS_PER_LONG /* * There seems to be no way of detecting this automatically from user * space, so 64 bit architectures should override this in their * bitsperlong.h. In particular, an architecture that supports * both 32 and 64 bit user space must not rely on CONFIG_64BIT * to decide it, but rather check a compiler provided macro. */ #ifndef __BITS_PER_LONG #define __BITS_PER_LONG 32 #endif #endif /* __ASM_GENERIC_BITS_PER_LONG */ asm-generic/bpf_perf_event.h 0000644 00000000356 15063602044 0012077 0 ustar 00 #ifndef __ASM_GENERIC_BPF_PERF_EVENT_H__ #define __ASM_GENERIC_BPF_PERF_EVENT_H__ #include <linux/ptrace.h> /* Export kernel pt_regs structure */ typedef struct pt_regs bpf_user_pt_regs_t; #endif /* __ASM_GENERIC_BPF_PERF_EVENT_H__ */ asm-generic/errno-base.h 0000644 00000003114 15063602044 0011143 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_ERRNO_BASE_H #define _ASM_GENERIC_ERRNO_BASE_H #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* I/O error */ #define ENXIO 6 /* No such device or address */ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file number */ #define ECHILD 10 /* No child processes */ #define EAGAIN 11 /* Try again */ #define ENOMEM 12 /* Out of memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #define ENOTBLK 15 /* Block device required */ #define EBUSY 16 /* Device or resource busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* No such device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* File table overflow */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Not a typewriter */ #define ETXTBSY 26 /* Text file busy */ #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only file system */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ #define EDOM 33 /* Math argument out of domain of func */ #define ERANGE 34 /* Math result not representable */ #endif asm-generic/errno.h 0000644 00000013020 15063602044 0010230 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_ERRNO_H #define _ASM_GENERIC_ERRNO_H #include <asm-generic/errno-base.h> #define EDEADLK 35 /* Resource deadlock would occur */ #define ENAMETOOLONG 36 /* File name too long */ #define ENOLCK 37 /* No record locks available */ /* * This error code is special: arch syscall entry code will return * -ENOSYS if users try to call a syscall that doesn't exist. To keep * failures of syscalls that really do exist distinguishable from * failures due to attempts to use a nonexistent syscall, syscall * implementations should refrain from returning -ENOSYS. */ #define ENOSYS 38 /* Invalid system call number */ #define ENOTEMPTY 39 /* Directory not empty */ #define ELOOP 40 /* Too many symbolic links encountered */ #define EWOULDBLOCK EAGAIN /* Operation would block */ #define ENOMSG 42 /* No message of desired type */ #define EIDRM 43 /* Identifier removed */ #define ECHRNG 44 /* Channel number out of range */ #define EL2NSYNC 45 /* Level 2 not synchronized */ #define EL3HLT 46 /* Level 3 halted */ #define EL3RST 47 /* Level 3 reset */ #define ELNRNG 48 /* Link number out of range */ #define EUNATCH 49 /* Protocol driver not attached */ #define ENOCSI 50 /* No CSI structure available */ #define EL2HLT 51 /* Level 2 halted */ #define EBADE 52 /* Invalid exchange */ #define EBADR 53 /* Invalid request descriptor */ #define EXFULL 54 /* Exchange full */ #define ENOANO 55 /* No anode */ #define EBADRQC 56 /* Invalid request code */ #define EBADSLT 57 /* Invalid slot */ #define EDEADLOCK EDEADLK #define EBFONT 59 /* Bad font file format */ #define ENOSTR 60 /* Device not a stream */ #define ENODATA 61 /* No data available */ #define ETIME 62 /* Timer expired */ #define ENOSR 63 /* Out of streams resources */ #define ENONET 64 /* Machine is not on the network */ #define ENOPKG 65 /* Package not installed */ #define EREMOTE 66 /* Object is remote */ #define ENOLINK 67 /* Link has been severed */ #define EADV 68 /* Advertise error */ #define ESRMNT 69 /* Srmount error */ #define ECOMM 70 /* Communication error on send */ #define EPROTO 71 /* Protocol error */ #define EMULTIHOP 72 /* Multihop attempted */ #define EDOTDOT 73 /* RFS specific error */ #define EBADMSG 74 /* Not a data message */ #define EOVERFLOW 75 /* Value too large for defined data type */ #define ENOTUNIQ 76 /* Name not unique on network */ #define EBADFD 77 /* File descriptor in bad state */ #define EREMCHG 78 /* Remote address changed */ #define ELIBACC 79 /* Can not access a needed shared library */ #define ELIBBAD 80 /* Accessing a corrupted shared library */ #define ELIBSCN 81 /* .lib section in a.out corrupted */ #define ELIBMAX 82 /* Attempting to link in too many shared libraries */ #define ELIBEXEC 83 /* Cannot exec a shared library directly */ #define EILSEQ 84 /* Illegal byte sequence */ #define ERESTART 85 /* Interrupted system call should be restarted */ #define ESTRPIPE 86 /* Streams pipe error */ #define EUSERS 87 /* Too many users */ #define ENOTSOCK 88 /* Socket operation on non-socket */ #define EDESTADDRREQ 89 /* Destination address required */ #define EMSGSIZE 90 /* Message too long */ #define EPROTOTYPE 91 /* Protocol wrong type for socket */ #define ENOPROTOOPT 92 /* Protocol not available */ #define EPROTONOSUPPORT 93 /* Protocol not supported */ #define ESOCKTNOSUPPORT 94 /* Socket type not supported */ #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ #define EPFNOSUPPORT 96 /* Protocol family not supported */ #define EAFNOSUPPORT 97 /* Address family not supported by protocol */ #define EADDRINUSE 98 /* Address already in use */ #define EADDRNOTAVAIL 99 /* Cannot assign requested address */ #define ENETDOWN 100 /* Network is down */ #define ENETUNREACH 101 /* Network is unreachable */ #define ENETRESET 102 /* Network dropped connection because of reset */ #define ECONNABORTED 103 /* Software caused connection abort */ #define ECONNRESET 104 /* Connection reset by peer */ #define ENOBUFS 105 /* No buffer space available */ #define EISCONN 106 /* Transport endpoint is already connected */ #define ENOTCONN 107 /* Transport endpoint is not connected */ #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ #define ETOOMANYREFS 109 /* Too many references: cannot splice */ #define ETIMEDOUT 110 /* Connection timed out */ #define ECONNREFUSED 111 /* Connection refused */ #define EHOSTDOWN 112 /* Host is down */ #define EHOSTUNREACH 113 /* No route to host */ #define EALREADY 114 /* Operation already in progress */ #define EINPROGRESS 115 /* Operation now in progress */ #define ESTALE 116 /* Stale file handle */ #define EUCLEAN 117 /* Structure needs cleaning */ #define ENOTNAM 118 /* Not a XENIX named type file */ #define ENAVAIL 119 /* No XENIX semaphores available */ #define EISNAM 120 /* Is a named type file */ #define EREMOTEIO 121 /* Remote I/O error */ #define EDQUOT 122 /* Quota exceeded */ #define ENOMEDIUM 123 /* No medium found */ #define EMEDIUMTYPE 124 /* Wrong medium type */ #define ECANCELED 125 /* Operation Canceled */ #define ENOKEY 126 /* Required key not available */ #define EKEYEXPIRED 127 /* Key has expired */ #define EKEYREVOKED 128 /* Key has been revoked */ #define EKEYREJECTED 129 /* Key was rejected by service */ /* for robust mutexes */ #define EOWNERDEAD 130 /* Owner died */ #define ENOTRECOVERABLE 131 /* State not recoverable */ #define ERFKILL 132 /* Operation not possible due to RF-kill */ #define EHWPOISON 133 /* Memory page has hardware error */ #endif asm-generic/fcntl.h 0000644 00000012457 15063602044 0010226 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_FCNTL_H #define _ASM_GENERIC_FCNTL_H #include <linux/types.h> /* * FMODE_EXEC is 0x20 * FMODE_NONOTIFY is 0x4000000 * These cannot be used by userspace O_* until internal and external open * flags are split. * -Eric Paris */ /* * When introducing new O_* bits, please check its uniqueness in fcntl_init(). */ #define O_ACCMODE 00000003 #define O_RDONLY 00000000 #define O_WRONLY 00000001 #define O_RDWR 00000002 #ifndef O_CREAT #define O_CREAT 00000100 /* not fcntl */ #endif #ifndef O_EXCL #define O_EXCL 00000200 /* not fcntl */ #endif #ifndef O_NOCTTY #define O_NOCTTY 00000400 /* not fcntl */ #endif #ifndef O_TRUNC #define O_TRUNC 00001000 /* not fcntl */ #endif #ifndef O_APPEND #define O_APPEND 00002000 #endif #ifndef O_NONBLOCK #define O_NONBLOCK 00004000 #endif #ifndef O_DSYNC #define O_DSYNC 00010000 /* used to be O_SYNC, see below */ #endif #ifndef FASYNC #define FASYNC 00020000 /* fcntl, for BSD compatibility */ #endif #ifndef O_DIRECT #define O_DIRECT 00040000 /* direct disk access hint */ #endif #ifndef O_LARGEFILE #define O_LARGEFILE 00100000 #endif #ifndef O_DIRECTORY #define O_DIRECTORY 00200000 /* must be a directory */ #endif #ifndef O_NOFOLLOW #define O_NOFOLLOW 00400000 /* don't follow links */ #endif #ifndef O_NOATIME #define O_NOATIME 01000000 #endif #ifndef O_CLOEXEC #define O_CLOEXEC 02000000 /* set close_on_exec */ #endif /* * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using * the O_SYNC flag. We continue to use the existing numerical value * for O_DSYNC semantics now, but using the correct symbolic name for it. * This new value is used to request true Posix O_SYNC semantics. It is * defined in this strange way to make sure applications compiled against * new headers get at least O_DSYNC semantics on older kernels. * * This has the nice side-effect that we can simply test for O_DSYNC * wherever we do not care if O_DSYNC or O_SYNC is used. * * Note: __O_SYNC must never be used directly. */ #ifndef O_SYNC #define __O_SYNC 04000000 #define O_SYNC (__O_SYNC|O_DSYNC) #endif #ifndef O_PATH #define O_PATH 010000000 #endif #ifndef __O_TMPFILE #define __O_TMPFILE 020000000 #endif /* a horrid kludge trying to make sure that this will fail on old kernels */ #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) #define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT) #ifndef O_NDELAY #define O_NDELAY O_NONBLOCK #endif #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ #define F_SETFD 2 /* set/clear close_on_exec */ #define F_GETFL 3 /* get file->f_flags */ #define F_SETFL 4 /* set file->f_flags */ #ifndef F_GETLK #define F_GETLK 5 #define F_SETLK 6 #define F_SETLKW 7 #endif #ifndef F_SETOWN #define F_SETOWN 8 /* for sockets. */ #define F_GETOWN 9 /* for sockets. */ #endif #ifndef F_SETSIG #define F_SETSIG 10 /* for sockets. */ #define F_GETSIG 11 /* for sockets. */ #endif #ifndef CONFIG_64BIT #ifndef F_GETLK64 #define F_GETLK64 12 /* using 'struct flock64' */ #define F_SETLK64 13 #define F_SETLKW64 14 #endif #endif #ifndef F_SETOWN_EX #define F_SETOWN_EX 15 #define F_GETOWN_EX 16 #endif #ifndef F_GETOWNER_UIDS #define F_GETOWNER_UIDS 17 #endif /* * Open File Description Locks * * Usually record locks held by a process are released on *any* close and are * not inherited across a fork(). * * These cmd values will set locks that conflict with process-associated * record locks, but are "owned" by the open file description, not the * process. This means that they are inherited across fork() like BSD (flock) * locks, and they are only released automatically when the last reference to * the the open file against which they were acquired is put. */ #define F_OFD_GETLK 36 #define F_OFD_SETLK 37 #define F_OFD_SETLKW 38 #define F_OWNER_TID 0 #define F_OWNER_PID 1 #define F_OWNER_PGRP 2 struct f_owner_ex { int type; __kernel_pid_t pid; }; /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ /* for posix fcntl() and lockf() */ #ifndef F_RDLCK #define F_RDLCK 0 #define F_WRLCK 1 #define F_UNLCK 2 #endif /* for old implementation of bsd flock () */ #ifndef F_EXLCK #define F_EXLCK 4 /* or 3 */ #define F_SHLCK 8 /* or 4 */ #endif /* operations for bsd flock(), also used by the kernel implementation */ #define LOCK_SH 1 /* shared lock */ #define LOCK_EX 2 /* exclusive lock */ #define LOCK_NB 4 /* or'd with one of the above to prevent blocking */ #define LOCK_UN 8 /* remove lock */ #define LOCK_MAND 32 /* This is a mandatory flock ... */ #define LOCK_READ 64 /* which allows concurrent read operations */ #define LOCK_WRITE 128 /* which allows concurrent write operations */ #define LOCK_RW 192 /* which allows concurrent read & write ops */ #define F_LINUX_SPECIFIC_BASE 1024 #ifndef HAVE_ARCH_STRUCT_FLOCK #ifndef __ARCH_FLOCK_PAD #define __ARCH_FLOCK_PAD #endif struct flock { short l_type; short l_whence; __kernel_off_t l_start; __kernel_off_t l_len; __kernel_pid_t l_pid; __ARCH_FLOCK_PAD }; #endif #ifndef HAVE_ARCH_STRUCT_FLOCK64 #ifndef __ARCH_FLOCK64_PAD #define __ARCH_FLOCK64_PAD #endif struct flock64 { short l_type; short l_whence; __kernel_loff_t l_start; __kernel_loff_t l_len; __kernel_pid_t l_pid; __ARCH_FLOCK64_PAD }; #endif #endif /* _ASM_GENERIC_FCNTL_H */ asm-generic/hugetlb_encode.h 0000644 00000003417 15063602044 0012063 0 ustar 00 #ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_ #define _ASM_GENERIC_HUGETLB_ENCODE_H_ /* * Several system calls take a flag to request "hugetlb" huge pages. * Without further specification, these system calls will use the * system's default huge page size. If a system supports multiple * huge page sizes, the desired huge page size can be specified in * bits [26:31] of the flag arguments. The value in these 6 bits * will encode the log2 of the huge page size. * * The following definitions are associated with this huge page size * encoding in flag arguments. System call specific header files * that use this encoding should include this file. They can then * provide definitions based on these with their own specific prefix. * for example: * #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT */ #define HUGETLB_FLAG_ENCODE_SHIFT 26 #define HUGETLB_FLAG_ENCODE_MASK 0x3f #define HUGETLB_FLAG_ENCODE_16KB (14 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT) #define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT) #endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */ asm-generic/int-l64.h 0000644 00000001316 15063602044 0010305 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * asm-generic/int-l64.h * * Integer declarations for architectures which use "long" * for 64-bit types. */ #ifndef _ASM_GENERIC_INT_L64_H #define _ASM_GENERIC_INT_L64_H #include <asm/bitsperlong.h> #ifndef __ASSEMBLY__ /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space */ typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; typedef __signed__ long __s64; typedef unsigned long __u64; #endif /* __ASSEMBLY__ */ #endif /* _ASM_GENERIC_INT_L64_H */ asm-generic/int-ll64.h 0000644 00000001540 15063602045 0010461 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * asm-generic/int-ll64.h * * Integer declarations for architectures which use "long long" * for 64-bit types. */ #ifndef _ASM_GENERIC_INT_LL64_H #define _ASM_GENERIC_INT_LL64_H #include <asm/bitsperlong.h> #ifndef __ASSEMBLY__ /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space */ typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; #ifdef __GNUC__ __extension__ typedef __signed__ long long __s64; __extension__ typedef unsigned long long __u64; #else typedef __signed__ long long __s64; typedef unsigned long long __u64; #endif #endif /* __ASSEMBLY__ */ #endif /* _ASM_GENERIC_INT_LL64_H */ asm-generic/ioctl.h 0000644 00000006626 15063602045 0010234 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_IOCTL_H #define _ASM_GENERIC_IOCTL_H /* ioctl command encoding: 32 bits total, command in lower 16 bits, * size of the parameter structure in the lower 14 bits of the * upper 16 bits. * Encoding the size of the parameter structure in the ioctl request * is useful for catching programs compiled with old versions * and to avoid overwriting user space outside the user buffer area. * The highest 2 bits are reserved for indicating the ``access mode''. * NOTE: This limits the max parameter size to 16kB -1 ! */ /* * The following is for compatibility across the various Linux * platforms. The generic ioctl numbering scheme doesn't really enforce * a type field. De facto, however, the top 8 bits of the lower 16 * bits are indeed used as a type field, so we might just as well make * this explicit here. Please be sure to use the decoding macros * below from now on. */ #define _IOC_NRBITS 8 #define _IOC_TYPEBITS 8 /* * Let any architecture override either of the following before * including this file. */ #ifndef _IOC_SIZEBITS # define _IOC_SIZEBITS 14 #endif #ifndef _IOC_DIRBITS # define _IOC_DIRBITS 2 #endif #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) #define _IOC_NRSHIFT 0 #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) /* * Direction bits, which any architecture can choose to override * before including this file. * * NOTE: _IOC_WRITE means userland is writing and kernel is * reading. _IOC_READ means userland is reading and kernel is writing. */ #ifndef _IOC_NONE # define _IOC_NONE 0U #endif #ifndef _IOC_WRITE # define _IOC_WRITE 1U #endif #ifndef _IOC_READ # define _IOC_READ 2U #endif #define _IOC(dir,type,nr,size) \ (((dir) << _IOC_DIRSHIFT) | \ ((type) << _IOC_TYPESHIFT) | \ ((nr) << _IOC_NRSHIFT) | \ ((size) << _IOC_SIZESHIFT)) #define _IOC_TYPECHECK(t) (sizeof(t)) /* * Used to create numbers. * * NOTE: _IOW means userland is writing and kernel is reading. _IOR * means userland is reading and kernel is writing. */ #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) /* used to decode ioctl numbers.. */ #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) /* ...and for the drivers/sound files... */ #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) #endif /* _ASM_GENERIC_IOCTL_H */ asm-generic/ioctls.h 0000644 00000007623 15063602045 0010415 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_IOCTLS_H #define __ASM_GENERIC_IOCTLS_H #include <linux/ioctl.h> /* * These are the most common definitions for tty ioctl numbers. * Most of them do not use the recommended _IOC(), but there is * probably some source code out there hardcoding the number, * so we might as well use them for all new platforms. * * The architectures that use different values here typically * try to be compatible with some Unix variants for the same * architecture. */ /* 0x54 is just a magic number to make these relatively unique ('T') */ #define TCGETS 0x5401 #define TCSETS 0x5402 #define TCSETSW 0x5403 #define TCSETSF 0x5404 #define TCGETA 0x5405 #define TCSETA 0x5406 #define TCSETAW 0x5407 #define TCSETAF 0x5408 #define TCSBRK 0x5409 #define TCXONC 0x540A #define TCFLSH 0x540B #define TIOCEXCL 0x540C #define TIOCNXCL 0x540D #define TIOCSCTTY 0x540E #define TIOCGPGRP 0x540F #define TIOCSPGRP 0x5410 #define TIOCOUTQ 0x5411 #define TIOCSTI 0x5412 #define TIOCGWINSZ 0x5413 #define TIOCSWINSZ 0x5414 #define TIOCMGET 0x5415 #define TIOCMBIS 0x5416 #define TIOCMBIC 0x5417 #define TIOCMSET 0x5418 #define TIOCGSOFTCAR 0x5419 #define TIOCSSOFTCAR 0x541A #define FIONREAD 0x541B #define TIOCINQ FIONREAD #define TIOCLINUX 0x541C #define TIOCCONS 0x541D #define TIOCGSERIAL 0x541E #define TIOCSSERIAL 0x541F #define TIOCPKT 0x5420 #define FIONBIO 0x5421 #define TIOCNOTTY 0x5422 #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ #define TCGETS2 _IOR('T', 0x2A, struct termios2) #define TCSETS2 _IOW('T', 0x2B, struct termios2) #define TCSETSW2 _IOW('T', 0x2C, struct termios2) #define TCSETSF2 _IOW('T', 0x2D, struct termios2) #define TIOCGRS485 0x542E #ifndef TIOCSRS485 #define TIOCSRS485 0x542F #endif #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ #define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ #define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ #define TCSETX 0x5433 #define TCSETXF 0x5434 #define TCSETXW 0x5435 #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ #define TIOCVHANGUP 0x5437 #define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ #define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ #define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ #define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */ #define TIOCGISO7816 _IOR('T', 0x42, struct serial_iso7816) #define TIOCSISO7816 _IOWR('T', 0x43, struct serial_iso7816) #define FIONCLEX 0x5450 #define FIOCLEX 0x5451 #define FIOASYNC 0x5452 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 #define TIOCSERSWILD 0x5455 #define TIOCGLCKTRMIOS 0x5456 #define TIOCSLCKTRMIOS 0x5457 #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ #define TIOCSERGETLSR 0x5459 /* Get line status register */ #define TIOCSERGETMULTI 0x545A /* Get multiport config */ #define TIOCSERSETMULTI 0x545B /* Set multiport config */ #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ #define TIOCGICOUNT 0x545D /* read serial port __inline__ interrupt counts */ /* * Some arches already define FIOQSIZE due to a historical * conflict with a Hayes modem-specific ioctl value. */ #ifndef FIOQSIZE # define FIOQSIZE 0x5460 #endif /* Used for packet mode */ #define TIOCPKT_DATA 0 #define TIOCPKT_FLUSHREAD 1 #define TIOCPKT_FLUSHWRITE 2 #define TIOCPKT_STOP 4 #define TIOCPKT_START 8 #define TIOCPKT_NOSTOP 16 #define TIOCPKT_DOSTOP 32 #define TIOCPKT_IOCTL 64 #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ #endif /* __ASM_GENERIC_IOCTLS_H */ asm-generic/ipcbuf.h 0000644 00000001753 15063602045 0010366 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_IPCBUF_H #define __ASM_GENERIC_IPCBUF_H /* * The generic ipc64_perm structure: * Note extra padding because this structure is passed back and forth * between kernel and user space. * * ipc64_perm was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * Pad space is left for: * - 32-bit mode_t on architectures that only had 16 bit * - 32-bit seq * - 2 miscellaneous 32-bit values */ struct ipc64_perm { __kernel_key_t key; __kernel_uid32_t uid; __kernel_gid32_t gid; __kernel_uid32_t cuid; __kernel_gid32_t cgid; __kernel_mode_t mode; /* pad if mode_t is u16: */ unsigned char __pad1[4 - sizeof(__kernel_mode_t)]; unsigned short seq; unsigned short __pad2; __kernel_ulong_t __unused1; __kernel_ulong_t __unused2; }; #endif /* __ASM_GENERIC_IPCBUF_H */ asm-generic/kvm_para.h 0000644 00000000140 15063602045 0010703 0 ustar 00 /* * There isn't anything here, but the file must not be empty or patch * will delete it. */ asm-generic/mman-common.h 0000644 00000006724 15063602045 0011337 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_MMAN_COMMON_H #define __ASM_GENERIC_MMAN_COMMON_H /* Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd. Based on: asm-xxx/mman.h */ #define PROT_READ 0x1 /* page can be read */ #define PROT_WRITE 0x2 /* page can be written */ #define PROT_EXEC 0x4 /* page can be executed */ #define PROT_SEM 0x8 /* page may be used for atomic ops */ #define PROT_NONE 0x0 /* page can not be accessed */ #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ #define MAP_SHARED 0x01 /* Share changes */ #define MAP_PRIVATE 0x02 /* Changes are private */ #define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */ #define MAP_TYPE 0x0f /* Mask for type of mapping */ #define MAP_FIXED 0x10 /* Interpret addr exactly */ #define MAP_ANONYMOUS 0x20 /* don't use a file */ /* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */ #define MAP_POPULATE 0x008000 /* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x010000 /* do not block on IO */ #define MAP_STACK 0x020000 /* give out an address that is best suited for process/thread stacks */ #define MAP_HUGETLB 0x040000 /* create a huge page mapping */ #define MAP_SYNC 0x080000 /* perform synchronous page faults for the mapping */ #define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ #define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be * uninitialized */ /* * Flags for mlock */ #define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ #define MS_ASYNC 1 /* sync memory asynchronously */ #define MS_INVALIDATE 2 /* invalidate the caches */ #define MS_SYNC 4 /* synchronous memory sync */ #define MADV_NORMAL 0 /* no further special treatment */ #define MADV_RANDOM 1 /* expect random page references */ #define MADV_SEQUENTIAL 2 /* expect sequential page references */ #define MADV_WILLNEED 3 /* will need these pages */ #define MADV_DONTNEED 4 /* don't need these pages */ /* common parameters: try to keep these consistent across architectures */ #define MADV_FREE 8 /* free pages only if memory pressure */ #define MADV_REMOVE 9 /* remove these pages & resources */ #define MADV_DONTFORK 10 /* don't inherit across fork */ #define MADV_DOFORK 11 /* do inherit across fork */ #define MADV_HWPOISON 100 /* poison a page for testing */ #define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */ #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, overrides the coredump filter bits */ #define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */ #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ #define MADV_COLD 20 /* deactivate these pages */ #define MADV_PAGEOUT 21 /* reclaim these pages */ /* compatibility flags */ #define MAP_FILE 0 #define PKEY_DISABLE_ACCESS 0x1 #define PKEY_DISABLE_WRITE 0x2 #define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ PKEY_DISABLE_WRITE) #endif /* __ASM_GENERIC_MMAN_COMMON_H */ asm-generic/mman.h 0000644 00000001344 15063602045 0010042 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_MMAN_H #define __ASM_GENERIC_MMAN_H #include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ #define MAP_LOCKED 0x2000 /* pages are locked */ #define MAP_NORESERVE 0x4000 /* don't check for reservations */ /* * Bits [26:31] are reserved, see asm-generic/hugetlb_encode.h * for MAP_HUGETLB usage */ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ #define MCL_ONFAULT 4 /* lock all pages that are faulted in */ #endif /* __ASM_GENERIC_MMAN_H */ asm-generic/msgbuf.h 0000644 00000003122 15063602045 0010371 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_MSGBUF_H #define __ASM_GENERIC_MSGBUF_H #include <asm/bitsperlong.h> /* * generic msqid64_ds structure. * * Note extra padding because this structure is passed back and forth * between kernel and user space. * * msqid64_ds was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * 64 bit architectures typically define a 64 bit __kernel_time_t, * so they do not need the first three padding words. * On big-endian systems, the padding is in the wrong place. * * Pad space is left for: * - 2 miscellaneous 32-bit values */ struct msqid64_ds { struct ipc64_perm msg_perm; #if __BITS_PER_LONG == 64 __kernel_time_t msg_stime; /* last msgsnd time */ __kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_time_t msg_ctime; /* last change time */ #else unsigned long msg_stime; /* last msgsnd time */ unsigned long msg_stime_high; unsigned long msg_rtime; /* last msgrcv time */ unsigned long msg_rtime_high; unsigned long msg_ctime; /* last change time */ unsigned long msg_ctime_high; #endif unsigned long msg_cbytes; /* current number of bytes on queue */ unsigned long msg_qnum; /* number of messages in queue */ unsigned long msg_qbytes; /* max number of bytes on queue */ __kernel_pid_t msg_lspid; /* pid of last msgsnd */ __kernel_pid_t msg_lrpid; /* last receive pid */ unsigned long __unused4; unsigned long __unused5; }; #endif /* __ASM_GENERIC_MSGBUF_H */ asm-generic/param.h 0000644 00000000541 15063602045 0010210 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_PARAM_H #define __ASM_GENERIC_PARAM_H #ifndef HZ #define HZ 100 #endif #ifndef EXEC_PAGESIZE #define EXEC_PAGESIZE 4096 #endif #ifndef NOGROUP #define NOGROUP (-1) #endif #define MAXHOSTNAMELEN 64 /* max length of hostname */ #endif /* __ASM_GENERIC_PARAM_H */ asm-generic/poll.h 0000644 00000001556 15063602045 0010065 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_POLL_H #define __ASM_GENERIC_POLL_H /* These are specified by iBCS2 */ #define POLLIN 0x0001 #define POLLPRI 0x0002 #define POLLOUT 0x0004 #define POLLERR 0x0008 #define POLLHUP 0x0010 #define POLLNVAL 0x0020 /* The rest seem to be more-or-less nonstandard. Check them! */ #define POLLRDNORM 0x0040 #define POLLRDBAND 0x0080 #ifndef POLLWRNORM #define POLLWRNORM 0x0100 #endif #ifndef POLLWRBAND #define POLLWRBAND 0x0200 #endif #ifndef POLLMSG #define POLLMSG 0x0400 #endif #ifndef POLLREMOVE #define POLLREMOVE 0x1000 #endif #ifndef POLLRDHUP #define POLLRDHUP 0x2000 #endif #define POLLFREE (__poll_t)0x4000 /* currently only for epoll */ #define POLL_BUSY_LOOP (__poll_t)0x8000 struct pollfd { int fd; short events; short revents; }; #endif /* __ASM_GENERIC_POLL_H */ asm-generic/posix_types.h 0000644 00000004510 15063602045 0011476 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_POSIX_TYPES_H #define __ASM_GENERIC_POSIX_TYPES_H #include <asm/bitsperlong.h> /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. * * First the types that are often defined in different ways across * architectures, so that you can override them. */ #ifndef __kernel_long_t typedef long __kernel_long_t; typedef unsigned long __kernel_ulong_t; #endif #ifndef __kernel_ino_t typedef __kernel_ulong_t __kernel_ino_t; #endif #ifndef __kernel_mode_t typedef unsigned int __kernel_mode_t; #endif #ifndef __kernel_pid_t typedef int __kernel_pid_t; #endif #ifndef __kernel_ipc_pid_t typedef int __kernel_ipc_pid_t; #endif #ifndef __kernel_uid_t typedef unsigned int __kernel_uid_t; typedef unsigned int __kernel_gid_t; #endif #ifndef __kernel_suseconds_t typedef __kernel_long_t __kernel_suseconds_t; #endif #ifndef __kernel_daddr_t typedef int __kernel_daddr_t; #endif #ifndef __kernel_uid32_t typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; #endif #ifndef __kernel_old_uid_t typedef __kernel_uid_t __kernel_old_uid_t; typedef __kernel_gid_t __kernel_old_gid_t; #endif #ifndef __kernel_old_dev_t typedef unsigned int __kernel_old_dev_t; #endif /* * Most 32 bit architectures use "unsigned int" size_t, * and all 64 bit architectures use "unsigned long" size_t. */ #ifndef __kernel_size_t #if __BITS_PER_LONG != 64 typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; #else typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; #endif #endif #ifndef __kernel_fsid_t typedef struct { int val[2]; } __kernel_fsid_t; #endif /* * anything below here should be completely generic */ typedef __kernel_long_t __kernel_off_t; typedef long long __kernel_loff_t; typedef __kernel_long_t __kernel_old_time_t; typedef __kernel_long_t __kernel_time_t; typedef long long __kernel_time64_t; typedef __kernel_long_t __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; #endif /* __ASM_GENERIC_POSIX_TYPES_H */ asm-generic/resource.h 0000644 00000003520 15063602045 0010737 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_RESOURCE_H #define _ASM_GENERIC_RESOURCE_H /* * Resource limit IDs * * ( Compatibility detail: there are architectures that have * a different rlimit ID order in the 5-9 range and want * to keep that order for binary compatibility. The reasons * are historic and all new rlimits are identical across all * arches. If an arch has such special order for some rlimits * then it defines them prior including asm-generic/resource.h. ) */ #define RLIMIT_CPU 0 /* CPU time in sec */ #define RLIMIT_FSIZE 1 /* Maximum filesize */ #define RLIMIT_DATA 2 /* max data size */ #define RLIMIT_STACK 3 /* max stack size */ #define RLIMIT_CORE 4 /* max core file size */ #ifndef RLIMIT_RSS # define RLIMIT_RSS 5 /* max resident set size */ #endif #ifndef RLIMIT_NPROC # define RLIMIT_NPROC 6 /* max number of processes */ #endif #ifndef RLIMIT_NOFILE # define RLIMIT_NOFILE 7 /* max number of open files */ #endif #ifndef RLIMIT_MEMLOCK # define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ #endif #ifndef RLIMIT_AS # define RLIMIT_AS 9 /* address space limit */ #endif #define RLIMIT_LOCKS 10 /* maximum file locks held */ #define RLIMIT_SIGPENDING 11 /* max number of pending signals */ #define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */ #define RLIMIT_NICE 13 /* max nice prio allowed to raise to 0-39 for nice level 19 .. -20 */ #define RLIMIT_RTPRIO 14 /* maximum realtime priority */ #define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */ #define RLIM_NLIMITS 16 /* * SuS says limits have to be unsigned. * Which makes a ton more sense anyway. * * Some architectures override this (for compatibility reasons): */ #ifndef RLIM_INFINITY # define RLIM_INFINITY (~0UL) #endif #endif /* _ASM_GENERIC_RESOURCE_H */ asm-generic/sembuf.h 0000644 00000003016 15063602045 0010371 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SEMBUF_H #define __ASM_GENERIC_SEMBUF_H #include <asm/bitsperlong.h> /* * The semid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * * semid64_ds was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * 64 bit architectures use a 64-bit __kernel_time_t here, while * 32 bit architectures have a pair of unsigned long values. * so they do not need the first two padding words. * * On big-endian systems, the padding is in the wrong place for * historic reasons, so user space has to reconstruct a time_t * value using * * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + * ((long long)kernel_semid64_ds.sem_otime_high << 32) * * Pad space is left for 2 miscellaneous 32-bit values */ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #if __BITS_PER_LONG == 64 __kernel_time_t sem_otime; /* last semop time */ __kernel_time_t sem_ctime; /* last change time */ #else unsigned long sem_otime; /* last semop time */ unsigned long sem_otime_high; unsigned long sem_ctime; /* last change time */ unsigned long sem_ctime_high; #endif unsigned long sem_nsems; /* no. of semaphores in array */ unsigned long __unused3; unsigned long __unused4; }; #endif /* __ASM_GENERIC_SEMBUF_H */ asm-generic/setup.h 0000644 00000000276 15063602045 0010255 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SETUP_H #define __ASM_GENERIC_SETUP_H #define COMMAND_LINE_SIZE 512 #endif /* __ASM_GENERIC_SETUP_H */ asm-generic/shmbuf.h 0000644 00000003455 15063602045 0010403 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SHMBUF_H #define __ASM_GENERIC_SHMBUF_H #include <asm/bitsperlong.h> /* * The shmid64_ds structure for x86 architecture. * Note extra padding because this structure is passed back and forth * between kernel and user space. * * shmid64_ds was originally meant to be architecture specific, but * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * * 64 bit architectures typically define a 64 bit __kernel_time_t, * so they do not need the first two padding words. * On big-endian systems, the padding is in the wrong place. * * * Pad space is left for: * - 2 miscellaneous 32-bit values */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ #if __BITS_PER_LONG == 64 __kernel_time_t shm_atime; /* last attach time */ __kernel_time_t shm_dtime; /* last detach time */ __kernel_time_t shm_ctime; /* last change time */ #else unsigned long shm_atime; /* last attach time */ unsigned long shm_atime_high; unsigned long shm_dtime; /* last detach time */ unsigned long shm_dtime_high; unsigned long shm_ctime; /* last change time */ unsigned long shm_ctime_high; #endif __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ unsigned long shm_nattch; /* no. of current attaches */ unsigned long __unused4; unsigned long __unused5; }; struct shminfo64 { unsigned long shmmax; unsigned long shmmin; unsigned long shmmni; unsigned long shmseg; unsigned long shmall; unsigned long __unused1; unsigned long __unused2; unsigned long __unused3; unsigned long __unused4; }; #endif /* __ASM_GENERIC_SHMBUF_H */ asm-generic/shmparam.h 0000644 00000000347 15063602045 0010724 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SHMPARAM_H #define __ASM_GENERIC_SHMPARAM_H #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ #endif /* _ASM_GENERIC_SHMPARAM_H */ asm-generic/siginfo.h 0000644 00000030334 15063602045 0010551 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_SIGINFO_H #define _ASM_GENERIC_SIGINFO_H #include <linux/types.h> typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; #define SI_MAX_SIZE 128 /* * The default "si_band" type is "long", as specified by POSIX. * However, some architectures want to override this to "int" * for historical compatibility reasons, so we allow that. */ #ifndef __ARCH_SI_BAND_T #define __ARCH_SI_BAND_T long #endif #ifndef __ARCH_SI_CLOCK_T #define __ARCH_SI_CLOCK_T __kernel_clock_t #endif #ifndef __ARCH_SI_ATTRIBUTES #define __ARCH_SI_ATTRIBUTES #endif /* * RHEL8: The old and new siginfo structures have the same offsets for * their fields. They are just constructed in different ways. */ #ifdef __GENKSYMS__ #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) #define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) typedef struct siginfo { int si_signo; #ifndef __ARCH_HAS_SWAPPED_SIGINFO int si_errno; int si_code; #else int si_code; int si_errno; #endif union { int _pad[SI_PAD_SIZE]; /* kill() */ struct { __kernel_pid_t _pid; /* sender's pid */ __kernel_uid32_t _uid; /* sender's uid */ } _kill; /* POSIX.1b timers */ struct { __kernel_timer_t _tid; /* timer id */ int _overrun; /* overrun count */ sigval_t _sigval; /* same as below */ int _sys_private; /* not to be passed to user */ } _timer; /* POSIX.1b signals */ struct { __kernel_pid_t _pid; /* sender's pid */ __kernel_uid32_t _uid; /* sender's uid */ sigval_t _sigval; } _rt; /* SIGCHLD */ struct { __kernel_pid_t _pid; /* which child */ __kernel_uid32_t _uid; /* sender's uid */ int _status; /* exit code */ __ARCH_SI_CLOCK_T _utime; __ARCH_SI_CLOCK_T _stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */ struct { void *_addr; /* faulting insn/memory ref. */ #ifdef __ARCH_SI_TRAPNO int _trapno; /* TRAP # which caused the signal */ #endif #ifdef __ia64__ int _imm; /* immediate value for "break" */ unsigned int _flags; /* see ia64 si_flags */ unsigned long _isr; /* isr */ #endif #define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \ sizeof(short) : __alignof__(void *)) union { /* * used when si_code=BUS_MCEERR_AR or * used when si_code=BUS_MCEERR_AO */ short _addr_lsb; /* LSB of the reported address */ /* used when si_code=SEGV_BNDERR */ struct { char _dummy_bnd[__ADDR_BND_PKEY_PAD]; void *_lower; void *_upper; } _addr_bnd; /* used when si_code=SEGV_PKUERR */ struct { char _dummy_pkey[__ADDR_BND_PKEY_PAD]; __u32 _pkey; } _addr_pkey; }; } _sigfault; /* SIGPOLL */ struct { __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ int _fd; } _sigpoll; /* SIGSYS */ struct { void *_call_addr; /* calling user insn */ int _syscall; /* triggering system call number */ unsigned int _arch; /* AUDIT_ARCH_* of syscall */ } _sigsys; } _sifields; } __ARCH_SI_ATTRIBUTES siginfo_t; #else /* __GENKSYMS__ */ union __sifields { /* kill() */ struct { __kernel_pid_t _pid; /* sender's pid */ __kernel_uid32_t _uid; /* sender's uid */ } _kill; /* POSIX.1b timers */ struct { __kernel_timer_t _tid; /* timer id */ int _overrun; /* overrun count */ sigval_t _sigval; /* same as below */ int _sys_private; /* not to be passed to user */ } _timer; /* POSIX.1b signals */ struct { __kernel_pid_t _pid; /* sender's pid */ __kernel_uid32_t _uid; /* sender's uid */ sigval_t _sigval; } _rt; /* SIGCHLD */ struct { __kernel_pid_t _pid; /* which child */ __kernel_uid32_t _uid; /* sender's uid */ int _status; /* exit code */ __ARCH_SI_CLOCK_T _utime; __ARCH_SI_CLOCK_T _stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */ struct { void *_addr; /* faulting insn/memory ref. */ #ifdef __ARCH_SI_TRAPNO int _trapno; /* TRAP # which caused the signal */ #endif #ifdef __ia64__ int _imm; /* immediate value for "break" */ unsigned int _flags; /* see ia64 si_flags */ unsigned long _isr; /* isr */ #endif #define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \ sizeof(short) : __alignof__(void *)) union { /* * used when si_code=BUS_MCEERR_AR or * used when si_code=BUS_MCEERR_AO */ short _addr_lsb; /* LSB of the reported address */ /* used when si_code=SEGV_BNDERR */ struct { char _dummy_bnd[__ADDR_BND_PKEY_PAD]; void *_lower; void *_upper; } _addr_bnd; /* used when si_code=SEGV_PKUERR */ struct { char _dummy_pkey[__ADDR_BND_PKEY_PAD]; __u32 _pkey; } _addr_pkey; }; } _sigfault; /* SIGPOLL */ struct { __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ int _fd; } _sigpoll; /* SIGSYS */ struct { void *_call_addr; /* calling user insn */ int _syscall; /* triggering system call number */ unsigned int _arch; /* AUDIT_ARCH_* of syscall */ } _sigsys; }; #ifndef __ARCH_HAS_SWAPPED_SIGINFO #define __SIGINFO \ struct { \ int si_signo; \ int si_errno; \ int si_code; \ union __sifields _sifields; \ } #else #define __SIGINFO \ struct { \ int si_signo; \ int si_code; \ int si_errno; \ union __sifields _sifields; \ } #endif /* __ARCH_HAS_SWAPPED_SIGINFO */ typedef struct siginfo { union { __SIGINFO; int _si_pad[SI_MAX_SIZE/sizeof(int)]; }; } __ARCH_SI_ATTRIBUTES siginfo_t; #endif /* __GENKSYMS__ */ /* * How these fields are to be accessed. */ #define si_pid _sifields._kill._pid #define si_uid _sifields._kill._uid #define si_tid _sifields._timer._tid #define si_overrun _sifields._timer._overrun #define si_sys_private _sifields._timer._sys_private #define si_status _sifields._sigchld._status #define si_utime _sifields._sigchld._utime #define si_stime _sifields._sigchld._stime #define si_value _sifields._rt._sigval #define si_int _sifields._rt._sigval.sival_int #define si_ptr _sifields._rt._sigval.sival_ptr #define si_addr _sifields._sigfault._addr #ifdef __ARCH_SI_TRAPNO #define si_trapno _sifields._sigfault._trapno #endif #define si_addr_lsb _sifields._sigfault._addr_lsb #define si_lower _sifields._sigfault._addr_bnd._lower #define si_upper _sifields._sigfault._addr_bnd._upper #define si_pkey _sifields._sigfault._addr_pkey._pkey #define si_band _sifields._sigpoll._band #define si_fd _sifields._sigpoll._fd #define si_call_addr _sifields._sigsys._call_addr #define si_syscall _sifields._sigsys._syscall #define si_arch _sifields._sigsys._arch /* * si_code values * Digital reserves positive values for kernel-generated signals. */ #define SI_USER 0 /* sent by kill, sigsend, raise */ #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ #define SI_QUEUE -1 /* sent by sigqueue */ #define SI_TIMER -2 /* sent by timer expiration */ #define SI_MESGQ -3 /* sent by real time mesq state change */ #define SI_ASYNCIO -4 /* sent by AIO completion */ #define SI_SIGIO -5 /* sent by queued SIGIO */ #define SI_TKILL -6 /* sent by tkill system call */ #define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ #define SI_ASYNCNL -60 /* sent by glibc async name lookup completion */ #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) /* * SIGILL si_codes */ #define ILL_ILLOPC 1 /* illegal opcode */ #define ILL_ILLOPN 2 /* illegal operand */ #define ILL_ILLADR 3 /* illegal addressing mode */ #define ILL_ILLTRP 4 /* illegal trap */ #define ILL_PRVOPC 5 /* privileged opcode */ #define ILL_PRVREG 6 /* privileged register */ #define ILL_COPROC 7 /* coprocessor error */ #define ILL_BADSTK 8 /* internal stack error */ #define ILL_BADIADDR 9 /* unimplemented instruction address */ #define __ILL_BREAK 10 /* illegal break */ #define __ILL_BNDMOD 11 /* bundle-update (modification) in progress */ #define NSIGILL 11 /* * SIGFPE si_codes */ #define FPE_INTDIV 1 /* integer divide by zero */ #define FPE_INTOVF 2 /* integer overflow */ #define FPE_FLTDIV 3 /* floating point divide by zero */ #define FPE_FLTOVF 4 /* floating point overflow */ #define FPE_FLTUND 5 /* floating point underflow */ #define FPE_FLTRES 6 /* floating point inexact result */ #define FPE_FLTINV 7 /* floating point invalid operation */ #define FPE_FLTSUB 8 /* subscript out of range */ #define __FPE_DECOVF 9 /* decimal overflow */ #define __FPE_DECDIV 10 /* decimal division by zero */ #define __FPE_DECERR 11 /* packed decimal error */ #define __FPE_INVASC 12 /* invalid ASCII digit */ #define __FPE_INVDEC 13 /* invalid decimal digit */ #define FPE_FLTUNK 14 /* undiagnosed floating-point exception */ #define FPE_CONDTRAP 15 /* trap on condition */ #define NSIGFPE 15 /* * SIGSEGV si_codes */ #define SEGV_MAPERR 1 /* address not mapped to object */ #define SEGV_ACCERR 2 /* invalid permissions for mapped object */ #define SEGV_BNDERR 3 /* failed address bound checks */ #ifdef __ia64__ # define __SEGV_PSTKOVF 4 /* paragraph stack overflow */ #else # define SEGV_PKUERR 4 /* failed protection key checks */ #endif #define SEGV_ACCADI 5 /* ADI not enabled for mapped object */ #define SEGV_ADIDERR 6 /* Disrupting MCD error */ #define SEGV_ADIPERR 7 /* Precise MCD exception */ #define NSIGSEGV 7 /* * SIGBUS si_codes */ #define BUS_ADRALN 1 /* invalid address alignment */ #define BUS_ADRERR 2 /* non-existent physical address */ #define BUS_OBJERR 3 /* object specific hardware error */ /* hardware memory error consumed on a machine check: action required */ #define BUS_MCEERR_AR 4 /* hardware memory error detected in process but not consumed: action optional*/ #define BUS_MCEERR_AO 5 #define NSIGBUS 5 /* * SIGTRAP si_codes */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ #define TRAP_BRANCH 3 /* process taken branch trap */ #define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */ #define TRAP_UNK 5 /* undiagnosed trap */ #define NSIGTRAP 5 /* * There is an additional set of SIGTRAP si_codes used by ptrace * that are of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP) */ /* * SIGCHLD si_codes */ #define CLD_EXITED 1 /* child has exited */ #define CLD_KILLED 2 /* child was killed */ #define CLD_DUMPED 3 /* child terminated abnormally */ #define CLD_TRAPPED 4 /* traced child has trapped */ #define CLD_STOPPED 5 /* child has stopped */ #define CLD_CONTINUED 6 /* stopped child has continued */ #define NSIGCHLD 6 /* * SIGPOLL (or any other signal without signal specific si_codes) si_codes */ #define POLL_IN 1 /* data input available */ #define POLL_OUT 2 /* output buffers available */ #define POLL_MSG 3 /* input message available */ #define POLL_ERR 4 /* i/o error */ #define POLL_PRI 5 /* high priority input available */ #define POLL_HUP 6 /* device disconnected */ #define NSIGPOLL 6 /* * SIGSYS si_codes */ #define SYS_SECCOMP 1 /* seccomp triggered */ #define NSIGSYS 1 /* * SIGEMT si_codes */ #define EMT_TAGOVF 1 /* tag overflow */ #define NSIGEMT 1 /* * sigevent definitions * * It seems likely that SIGEV_THREAD will have to be handled from * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the * thread manager then catches and does the appropriate nonsense. * However, everything is written out here so as to not get lost. */ #define SIGEV_SIGNAL 0 /* notify via signal */ #define SIGEV_NONE 1 /* other notification: meaningless */ #define SIGEV_THREAD 2 /* deliver via thread creation */ #define SIGEV_THREAD_ID 4 /* deliver to thread */ /* * This works because the alignment is ok on all current architectures * but we leave open this being overridden in the future */ #ifndef __ARCH_SIGEV_PREAMBLE_SIZE #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) #endif #define SIGEV_MAX_SIZE 64 #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ / sizeof(int)) typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[SIGEV_PAD_SIZE]; int _tid; struct { void (*_function)(sigval_t); void *_attribute; /* really pthread_attr_t */ } _sigev_thread; } _sigev_un; } sigevent_t; #define sigev_notify_function _sigev_un._sigev_thread._function #define sigev_notify_attributes _sigev_un._sigev_thread._attribute #define sigev_notify_thread_id _sigev_un._tid #endif /* _ASM_GENERIC_SIGINFO_H */ asm-generic/signal-defs.h 0000644 00000001440 15063602045 0011303 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SIGNAL_DEFS_H #define __ASM_GENERIC_SIGNAL_DEFS_H #ifndef SIG_BLOCK #define SIG_BLOCK 0 /* for blocking signals */ #endif #ifndef SIG_UNBLOCK #define SIG_UNBLOCK 1 /* for unblocking signals */ #endif #ifndef SIG_SETMASK #define SIG_SETMASK 2 /* for setting the signal mask */ #endif #ifndef __ASSEMBLY__ typedef void __signalfn_t(int); typedef __signalfn_t *__sighandler_t; typedef void __restorefn_t(void); typedef __restorefn_t *__sigrestore_t; #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #endif #endif /* __ASM_GENERIC_SIGNAL_DEFS_H */ asm-generic/signal.h 0000644 00000005225 15063602045 0010371 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SIGNAL_H #define __ASM_GENERIC_SIGNAL_H #include <linux/types.h> #define _NSIG 64 #define _NSIG_BPW __BITS_PER_LONG #define _NSIG_WORDS (_NSIG / _NSIG_BPW) #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGIOT 6 #define SIGBUS 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGUSR1 10 #define SIGSEGV 11 #define SIGUSR2 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGSTKFLT 16 #define SIGCHLD 17 #define SIGCONT 18 #define SIGSTOP 19 #define SIGTSTP 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGURG 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGVTALRM 26 #define SIGPROF 27 #define SIGWINCH 28 #define SIGIO 29 #define SIGPOLL SIGIO /* #define SIGLOST 29 */ #define SIGPWR 30 #define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ #define SIGRTMIN 32 #ifndef SIGRTMAX #define SIGRTMAX _NSIG #endif /* * SA_FLAGS values: * * SA_ONSTACK indicates that a registered stack_t will be used. * SA_RESTART flag to get restarting signals (which were the default long ago) * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. * SA_RESETHAND clears the handler when the signal is delivered. * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. * SA_NODEFER prevents the current signal from being masked in the handler. * * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single * Unix names RESETHAND and NODEFER respectively. */ #define SA_NOCLDSTOP 0x00000001 #define SA_NOCLDWAIT 0x00000002 #define SA_SIGINFO 0x00000004 #define SA_ONSTACK 0x08000000 #define SA_RESTART 0x10000000 #define SA_NODEFER 0x40000000 #define SA_RESETHAND 0x80000000 #define SA_NOMASK SA_NODEFER #define SA_ONESHOT SA_RESETHAND /* * New architectures should not define the obsolete * SA_RESTORER 0x04000000 */ #if !defined MINSIGSTKSZ || !defined SIGSTKSZ #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 #endif #ifndef __ASSEMBLY__ typedef struct { unsigned long sig[_NSIG_WORDS]; } sigset_t; /* not actually used, but required for linux/syscalls.h */ typedef unsigned long old_sigset_t; #include <asm-generic/signal-defs.h> #ifdef SA_RESTORER #define __ARCH_HAS_SA_RESTORER #endif struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; #ifdef SA_RESTORER __sigrestore_t sa_restorer; #endif sigset_t sa_mask; /* mask last for extensibility */ }; typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; #endif /* __ASSEMBLY__ */ #endif /* __ASM_GENERIC_SIGNAL_H */ asm-generic/socket.h 0000644 00000004651 15063602045 0010406 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SOCKET_H #define __ASM_GENERIC_SOCKET_H #include <asm/sockios.h> /* For setsockopt(2) */ #define SOL_SOCKET 1 #define SO_DEBUG 1 #define SO_REUSEADDR 2 #define SO_TYPE 3 #define SO_ERROR 4 #define SO_DONTROUTE 5 #define SO_BROADCAST 6 #define SO_SNDBUF 7 #define SO_RCVBUF 8 #define SO_SNDBUFFORCE 32 #define SO_RCVBUFFORCE 33 #define SO_KEEPALIVE 9 #define SO_OOBINLINE 10 #define SO_NO_CHECK 11 #define SO_PRIORITY 12 #define SO_LINGER 13 #define SO_BSDCOMPAT 14 #define SO_REUSEPORT 15 #ifndef SO_PASSCRED /* powerpc only differs in these */ #define SO_PASSCRED 16 #define SO_PEERCRED 17 #define SO_RCVLOWAT 18 #define SO_SNDLOWAT 19 #define SO_RCVTIMEO 20 #define SO_SNDTIMEO 21 #endif /* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 22 #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 #define SO_SECURITY_ENCRYPTION_NETWORK 24 #define SO_BINDTODEVICE 25 /* Socket filtering */ #define SO_ATTACH_FILTER 26 #define SO_DETACH_FILTER 27 #define SO_GET_FILTER SO_ATTACH_FILTER #define SO_PEERNAME 28 #define SO_TIMESTAMP 29 #define SCM_TIMESTAMP SO_TIMESTAMP #define SO_ACCEPTCONN 30 #define SO_PEERSEC 31 #define SO_PASSSEC 34 #define SO_TIMESTAMPNS 35 #define SCM_TIMESTAMPNS SO_TIMESTAMPNS #define SO_MARK 36 #define SO_TIMESTAMPING 37 #define SCM_TIMESTAMPING SO_TIMESTAMPING #define SO_PROTOCOL 38 #define SO_DOMAIN 39 #define SO_RXQ_OVFL 40 #define SO_WIFI_STATUS 41 #define SCM_WIFI_STATUS SO_WIFI_STATUS #define SO_PEEK_OFF 42 /* Instruct lower device to use last 4-bytes of skb data as FCS */ #define SO_NOFCS 43 #define SO_LOCK_FILTER 44 #define SO_SELECT_ERR_QUEUE 45 #define SO_BUSY_POLL 46 #define SO_MAX_PACING_RATE 47 #define SO_BPF_EXTENSIONS 48 #define SO_INCOMING_CPU 49 #define SO_ATTACH_BPF 50 #define SO_DETACH_BPF SO_DETACH_FILTER #define SO_ATTACH_REUSEPORT_CBPF 51 #define SO_ATTACH_REUSEPORT_EBPF 52 #define SO_CNX_ADVICE 53 #define SCM_TIMESTAMPING_OPT_STATS 54 #define SO_MEMINFO 55 #define SO_INCOMING_NAPI_ID 56 #define SO_COOKIE 57 #define SCM_TIMESTAMPING_PKTINFO 58 #define SO_PEERGROUPS 59 #define SO_ZEROCOPY 60 #define SO_TXTIME 61 #define SCM_TXTIME SO_TXTIME #define SO_BINDTOIFINDEX 62 #define SO_DETACH_REUSEPORT_BPF 68 #define SO_PREFER_BUSY_POLL 69 #define SO_BUSY_POLL_BUDGET 70 #endif /* __ASM_GENERIC_SOCKET_H */ asm-generic/sockios.h 0000644 00000000667 15063602045 0010573 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_SOCKIOS_H #define __ASM_GENERIC_SOCKIOS_H /* Socket-level I/O control calls. */ #define FIOSETOWN 0x8901 #define SIOCSPGRP 0x8902 #define FIOGETOWN 0x8903 #define SIOCGPGRP 0x8904 #define SIOCATMARK 0x8905 #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ #endif /* __ASM_GENERIC_SOCKIOS_H */ asm-generic/stat.h 0000644 00000005111 15063602045 0010061 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_STAT_H #define __ASM_GENERIC_STAT_H /* * Everybody gets this wrong and has to stick with it for all * eternity. Hopefully, this version gets used by new architectures * so they don't fall into the same traps. * * stat64 is copied from powerpc64, with explicit padding added. * stat is the same structure layout on 64-bit, without the 'long long' * types. * * By convention, 64 bit architectures use the stat interface, while * 32 bit architectures use the stat64 interface. Note that we don't * provide an __old_kernel_stat here, which new architecture should * not have to start with. */ #include <asm/bitsperlong.h> #define STAT_HAVE_NSEC 1 struct stat { unsigned long st_dev; /* Device. */ unsigned long st_ino; /* File serial number. */ unsigned int st_mode; /* File mode. */ unsigned int st_nlink; /* Link count. */ unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ unsigned long st_rdev; /* Device number, if device. */ unsigned long __pad1; long st_size; /* Size of file, in bytes. */ int st_blksize; /* Optimal block size for I/O. */ int __pad2; long st_blocks; /* Number 512-byte blocks allocated. */ long st_atime; /* Time of last access. */ unsigned long st_atime_nsec; long st_mtime; /* Time of last modification. */ unsigned long st_mtime_nsec; long st_ctime; /* Time of last status change. */ unsigned long st_ctime_nsec; unsigned int __unused4; unsigned int __unused5; }; /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */ #if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64) struct stat64 { unsigned long long st_dev; /* Device. */ unsigned long long st_ino; /* File serial number. */ unsigned int st_mode; /* File mode. */ unsigned int st_nlink; /* Link count. */ unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ unsigned long long st_rdev; /* Device number, if device. */ unsigned long long __pad1; long long st_size; /* Size of file, in bytes. */ int st_blksize; /* Optimal block size for I/O. */ int __pad2; long long st_blocks; /* Number 512-byte blocks allocated. */ int st_atime; /* Time of last access. */ unsigned int st_atime_nsec; int st_mtime; /* Time of last modification. */ unsigned int st_mtime_nsec; int st_ctime; /* Time of last status change. */ unsigned int st_ctime_nsec; unsigned int __unused4; unsigned int __unused5; }; #endif #endif /* __ASM_GENERIC_STAT_H */ asm-generic/statfs.h 0000644 00000003457 15063602045 0010425 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _GENERIC_STATFS_H #define _GENERIC_STATFS_H #include <linux/types.h> /* * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'. * Yes, they differ in signedness as well as size. * Special cases can override it for themselves -- except for S390x, which * is just a little too special for us. And MIPS, which I'm not touching * with a 10' pole. */ #ifndef __statfs_word #if __BITS_PER_LONG == 64 #define __statfs_word __kernel_long_t #else #define __statfs_word __u32 #endif #endif struct statfs { __statfs_word f_type; __statfs_word f_bsize; __statfs_word f_blocks; __statfs_word f_bfree; __statfs_word f_bavail; __statfs_word f_files; __statfs_word f_ffree; __kernel_fsid_t f_fsid; __statfs_word f_namelen; __statfs_word f_frsize; __statfs_word f_flags; __statfs_word f_spare[4]; }; /* * ARM needs to avoid the 32-bit padding at the end, for consistency * between EABI and OABI */ #ifndef ARCH_PACK_STATFS64 #define ARCH_PACK_STATFS64 #endif struct statfs64 { __statfs_word f_type; __statfs_word f_bsize; __u64 f_blocks; __u64 f_bfree; __u64 f_bavail; __u64 f_files; __u64 f_ffree; __kernel_fsid_t f_fsid; __statfs_word f_namelen; __statfs_word f_frsize; __statfs_word f_flags; __statfs_word f_spare[4]; } ARCH_PACK_STATFS64; /* * IA64 and x86_64 need to avoid the 32-bit padding at the end, * to be compatible with the i386 ABI */ #ifndef ARCH_PACK_COMPAT_STATFS64 #define ARCH_PACK_COMPAT_STATFS64 #endif struct compat_statfs64 { __u32 f_type; __u32 f_bsize; __u64 f_blocks; __u64 f_bfree; __u64 f_bavail; __u64 f_files; __u64 f_ffree; __kernel_fsid_t f_fsid; __u32 f_namelen; __u32 f_frsize; __u32 f_flags; __u32 f_spare[4]; } ARCH_PACK_COMPAT_STATFS64; #endif /* _GENERIC_STATFS_H */ asm-generic/swab.h 0000644 00000000766 15063602045 0010055 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_SWAB_H #define _ASM_GENERIC_SWAB_H #include <asm/bitsperlong.h> /* * 32 bit architectures typically (but not always) want to * set __SWAB_64_THRU_32__. In user space, this is only * valid if the compiler supports 64 bit data types. */ #if __BITS_PER_LONG == 32 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) #define __SWAB_64_THRU_32__ #endif #endif #endif /* _ASM_GENERIC_SWAB_H */ asm-generic/termbits.h 0000644 00000011154 15063602045 0010743 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_TERMBITS_H #define __ASM_GENERIC_TERMBITS_H #include <linux/posix_types.h> typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; #define NCCS 19 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ }; struct termios2 { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; struct ktermios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; /* c_cc characters */ #define VINTR 0 #define VQUIT 1 #define VERASE 2 #define VKILL 3 #define VEOF 4 #define VTIME 5 #define VMIN 6 #define VSWTC 7 #define VSTART 8 #define VSTOP 9 #define VSUSP 10 #define VEOL 11 #define VREPRINT 12 #define VDISCARD 13 #define VWERASE 14 #define VLNEXT 15 #define VEOL2 16 /* c_iflag bits */ #define IGNBRK 0000001 #define BRKINT 0000002 #define IGNPAR 0000004 #define PARMRK 0000010 #define INPCK 0000020 #define ISTRIP 0000040 #define INLCR 0000100 #define IGNCR 0000200 #define ICRNL 0000400 #define IUCLC 0001000 #define IXON 0002000 #define IXANY 0004000 #define IXOFF 0010000 #define IMAXBEL 0020000 #define IUTF8 0040000 /* c_oflag bits */ #define OPOST 0000001 #define OLCUC 0000002 #define ONLCR 0000004 #define OCRNL 0000010 #define ONOCR 0000020 #define ONLRET 0000040 #define OFILL 0000100 #define OFDEL 0000200 #define NLDLY 0000400 #define NL0 0000000 #define NL1 0000400 #define CRDLY 0003000 #define CR0 0000000 #define CR1 0001000 #define CR2 0002000 #define CR3 0003000 #define TABDLY 0014000 #define TAB0 0000000 #define TAB1 0004000 #define TAB2 0010000 #define TAB3 0014000 #define XTABS 0014000 #define BSDLY 0020000 #define BS0 0000000 #define BS1 0020000 #define VTDLY 0040000 #define VT0 0000000 #define VT1 0040000 #define FFDLY 0100000 #define FF0 0000000 #define FF1 0100000 /* c_cflag bit meaning */ #define CBAUD 0010017 #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 #define B110 0000003 #define B134 0000004 #define B150 0000005 #define B200 0000006 #define B300 0000007 #define B600 0000010 #define B1200 0000011 #define B1800 0000012 #define B2400 0000013 #define B4800 0000014 #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 #define EXTA B19200 #define EXTB B38400 #define CSIZE 0000060 #define CS5 0000000 #define CS6 0000020 #define CS7 0000040 #define CS8 0000060 #define CSTOPB 0000100 #define CREAD 0000200 #define PARENB 0000400 #define PARODD 0001000 #define HUPCL 0002000 #define CLOCAL 0004000 #define CBAUDEX 0010000 #define BOTHER 0010000 #define B57600 0010001 #define B115200 0010002 #define B230400 0010003 #define B460800 0010004 #define B500000 0010005 #define B576000 0010006 #define B921600 0010007 #define B1000000 0010010 #define B1152000 0010011 #define B1500000 0010012 #define B2000000 0010013 #define B2500000 0010014 #define B3000000 0010015 #define B3500000 0010016 #define B4000000 0010017 #define CIBAUD 002003600000 /* input baud rate */ #define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CRTSCTS 020000000000 /* flow control */ #define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ /* c_lflag bits */ #define ISIG 0000001 #define ICANON 0000002 #define XCASE 0000004 #define ECHO 0000010 #define ECHOE 0000020 #define ECHOK 0000040 #define ECHONL 0000100 #define NOFLSH 0000200 #define TOSTOP 0000400 #define ECHOCTL 0001000 #define ECHOPRT 0002000 #define ECHOKE 0004000 #define FLUSHO 0010000 #define PENDIN 0040000 #define IEXTEN 0100000 #define EXTPROC 0200000 /* tcflow() and TCXONC use these */ #define TCOOFF 0 #define TCOON 1 #define TCIOFF 2 #define TCION 3 /* tcflush() and TCFLSH use these */ #define TCIFLUSH 0 #define TCOFLUSH 1 #define TCIOFLUSH 2 /* tcsetattr uses these */ #define TCSANOW 0 #define TCSADRAIN 1 #define TCSAFLUSH 2 #endif /* __ASM_GENERIC_TERMBITS_H */ asm-generic/termios.h 0000644 00000002541 15063602045 0010574 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_TERMIOS_H #define _ASM_GENERIC_TERMIOS_H /* * Most architectures have straight copies of the x86 code, with * varying levels of bug fixes on top. Usually it's a good idea * to use this generic version instead, but be careful to avoid * ABI changes. * New architectures should not provide their own version. */ #include <asm/termbits.h> #include <asm/ioctls.h> struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; }; #define NCC 8 struct termio { unsigned short c_iflag; /* input mode flags */ unsigned short c_oflag; /* output mode flags */ unsigned short c_cflag; /* control mode flags */ unsigned short c_lflag; /* local mode flags */ unsigned char c_line; /* line discipline */ unsigned char c_cc[NCC]; /* control characters */ }; /* modem lines */ #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 #define TIOCM_RTS 0x004 #define TIOCM_ST 0x008 #define TIOCM_SR 0x010 #define TIOCM_CTS 0x020 #define TIOCM_CAR 0x040 #define TIOCM_RNG 0x080 #define TIOCM_DSR 0x100 #define TIOCM_CD TIOCM_CAR #define TIOCM_RI TIOCM_RNG #define TIOCM_OUT1 0x2000 #define TIOCM_OUT2 0x4000 #define TIOCM_LOOP 0x8000 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ #endif /* _ASM_GENERIC_TERMIOS_H */ asm-generic/types.h 0000644 00000000351 15063602045 0010253 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_TYPES_H #define _ASM_GENERIC_TYPES_H /* * int-ll64 is used everywhere now. */ #include <asm-generic/int-ll64.h> #endif /* _ASM_GENERIC_TYPES_H */ asm-generic/ucontext.h 0000644 00000000545 15063602045 0010765 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_UCONTEXT_H #define __ASM_GENERIC_UCONTEXT_H struct ucontext { unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; struct sigcontext uc_mcontext; sigset_t uc_sigmask; /* mask last for extensibility */ }; #endif /* __ASM_GENERIC_UCONTEXT_H */ asm-generic/unistd.h 0000644 00000067026 15063602045 0010431 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #include <asm/bitsperlong.h> /* * This file contains the system call numbers, based on the * layout of the x86-64 architecture, which embeds the * pointer to the syscall in the table. * * As a basic principle, no duplication of functionality * should be added, e.g. we don't use lseek when llseek * is present. New architectures should use this file * and implement the less feature-full calls in user space. */ #ifndef __SYSCALL #define __SYSCALL(x, y) #endif #if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT) #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) #else #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) #endif #ifdef __SYSCALL_COMPAT #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp) #define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp) #else #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys) #define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64) #endif #define __NR_io_setup 0 __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup) #define __NR_io_destroy 1 __SYSCALL(__NR_io_destroy, sys_io_destroy) #define __NR_io_submit 2 __SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit) #define __NR_io_cancel 3 __SYSCALL(__NR_io_cancel, sys_io_cancel) #define __NR_io_getevents 4 __SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents) /* fs/xattr.c */ #define __NR_setxattr 5 __SYSCALL(__NR_setxattr, sys_setxattr) #define __NR_lsetxattr 6 __SYSCALL(__NR_lsetxattr, sys_lsetxattr) #define __NR_fsetxattr 7 __SYSCALL(__NR_fsetxattr, sys_fsetxattr) #define __NR_getxattr 8 __SYSCALL(__NR_getxattr, sys_getxattr) #define __NR_lgetxattr 9 __SYSCALL(__NR_lgetxattr, sys_lgetxattr) #define __NR_fgetxattr 10 __SYSCALL(__NR_fgetxattr, sys_fgetxattr) #define __NR_listxattr 11 __SYSCALL(__NR_listxattr, sys_listxattr) #define __NR_llistxattr 12 __SYSCALL(__NR_llistxattr, sys_llistxattr) #define __NR_flistxattr 13 __SYSCALL(__NR_flistxattr, sys_flistxattr) #define __NR_removexattr 14 __SYSCALL(__NR_removexattr, sys_removexattr) #define __NR_lremovexattr 15 __SYSCALL(__NR_lremovexattr, sys_lremovexattr) #define __NR_fremovexattr 16 __SYSCALL(__NR_fremovexattr, sys_fremovexattr) /* fs/dcache.c */ #define __NR_getcwd 17 __SYSCALL(__NR_getcwd, sys_getcwd) /* fs/cookies.c */ #define __NR_lookup_dcookie 18 __SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie) /* fs/eventfd.c */ #define __NR_eventfd2 19 __SYSCALL(__NR_eventfd2, sys_eventfd2) /* fs/eventpoll.c */ #define __NR_epoll_create1 20 __SYSCALL(__NR_epoll_create1, sys_epoll_create1) #define __NR_epoll_ctl 21 __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) #define __NR_epoll_pwait 22 __SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait) /* fs/fcntl.c */ #define __NR_dup 23 __SYSCALL(__NR_dup, sys_dup) #define __NR_dup3 24 __SYSCALL(__NR_dup3, sys_dup3) #define __NR3264_fcntl 25 __SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64) /* fs/inotify_user.c */ #define __NR_inotify_init1 26 __SYSCALL(__NR_inotify_init1, sys_inotify_init1) #define __NR_inotify_add_watch 27 __SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) #define __NR_inotify_rm_watch 28 __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) /* fs/ioctl.c */ #define __NR_ioctl 29 __SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl) /* fs/ioprio.c */ #define __NR_ioprio_set 30 __SYSCALL(__NR_ioprio_set, sys_ioprio_set) #define __NR_ioprio_get 31 __SYSCALL(__NR_ioprio_get, sys_ioprio_get) /* fs/locks.c */ #define __NR_flock 32 __SYSCALL(__NR_flock, sys_flock) /* fs/namei.c */ #define __NR_mknodat 33 __SYSCALL(__NR_mknodat, sys_mknodat) #define __NR_mkdirat 34 __SYSCALL(__NR_mkdirat, sys_mkdirat) #define __NR_unlinkat 35 __SYSCALL(__NR_unlinkat, sys_unlinkat) #define __NR_symlinkat 36 __SYSCALL(__NR_symlinkat, sys_symlinkat) #define __NR_linkat 37 __SYSCALL(__NR_linkat, sys_linkat) #ifdef __ARCH_WANT_RENAMEAT /* renameat is superseded with flags by renameat2 */ #define __NR_renameat 38 __SYSCALL(__NR_renameat, sys_renameat) #endif /* __ARCH_WANT_RENAMEAT */ /* fs/namespace.c */ #define __NR_umount2 39 __SYSCALL(__NR_umount2, sys_umount) #define __NR_mount 40 __SC_COMP(__NR_mount, sys_mount, compat_sys_mount) #define __NR_pivot_root 41 __SYSCALL(__NR_pivot_root, sys_pivot_root) /* fs/nfsctl.c */ #define __NR_nfsservctl 42 __SYSCALL(__NR_nfsservctl, sys_ni_syscall) /* fs/open.c */ #define __NR3264_statfs 43 __SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \ compat_sys_statfs64) #define __NR3264_fstatfs 44 __SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \ compat_sys_fstatfs64) #define __NR3264_truncate 45 __SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \ compat_sys_truncate64) #define __NR3264_ftruncate 46 __SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \ compat_sys_ftruncate64) #define __NR_fallocate 47 __SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate) #define __NR_faccessat 48 __SYSCALL(__NR_faccessat, sys_faccessat) #define __NR_chdir 49 __SYSCALL(__NR_chdir, sys_chdir) #define __NR_fchdir 50 __SYSCALL(__NR_fchdir, sys_fchdir) #define __NR_chroot 51 __SYSCALL(__NR_chroot, sys_chroot) #define __NR_fchmod 52 __SYSCALL(__NR_fchmod, sys_fchmod) #define __NR_fchmodat 53 __SYSCALL(__NR_fchmodat, sys_fchmodat) #define __NR_fchownat 54 __SYSCALL(__NR_fchownat, sys_fchownat) #define __NR_fchown 55 __SYSCALL(__NR_fchown, sys_fchown) #define __NR_openat 56 __SC_COMP(__NR_openat, sys_openat, compat_sys_openat) #define __NR_close 57 __SYSCALL(__NR_close, sys_close) #define __NR_vhangup 58 __SYSCALL(__NR_vhangup, sys_vhangup) /* fs/pipe.c */ #define __NR_pipe2 59 __SYSCALL(__NR_pipe2, sys_pipe2) /* fs/quota.c */ #define __NR_quotactl 60 __SYSCALL(__NR_quotactl, sys_quotactl) /* fs/readdir.c */ #define __NR_getdents64 61 __SYSCALL(__NR_getdents64, sys_getdents64) /* fs/read_write.c */ #define __NR3264_lseek 62 __SC_3264(__NR3264_lseek, sys_llseek, sys_lseek) #define __NR_read 63 __SYSCALL(__NR_read, sys_read) #define __NR_write 64 __SYSCALL(__NR_write, sys_write) #define __NR_readv 65 __SC_COMP(__NR_readv, sys_readv, compat_sys_readv) #define __NR_writev 66 __SC_COMP(__NR_writev, sys_writev, compat_sys_writev) #define __NR_pread64 67 __SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64) #define __NR_pwrite64 68 __SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64) #define __NR_preadv 69 __SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv) #define __NR_pwritev 70 __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev) /* fs/sendfile.c */ #define __NR3264_sendfile 71 __SYSCALL(__NR3264_sendfile, sys_sendfile64) /* fs/select.c */ #define __NR_pselect6 72 __SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6) #define __NR_ppoll 73 __SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll) /* fs/signalfd.c */ #define __NR_signalfd4 74 __SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4) /* fs/splice.c */ #define __NR_vmsplice 75 __SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice) #define __NR_splice 76 __SYSCALL(__NR_splice, sys_splice) #define __NR_tee 77 __SYSCALL(__NR_tee, sys_tee) /* fs/stat.c */ #define __NR_readlinkat 78 __SYSCALL(__NR_readlinkat, sys_readlinkat) #define __NR3264_fstatat 79 __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat) #define __NR3264_fstat 80 __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat) /* fs/sync.c */ #define __NR_sync 81 __SYSCALL(__NR_sync, sys_sync) #define __NR_fsync 82 __SYSCALL(__NR_fsync, sys_fsync) #define __NR_fdatasync 83 __SYSCALL(__NR_fdatasync, sys_fdatasync) #ifdef __ARCH_WANT_SYNC_FILE_RANGE2 #define __NR_sync_file_range2 84 __SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \ compat_sys_sync_file_range2) #else #define __NR_sync_file_range 84 __SC_COMP(__NR_sync_file_range, sys_sync_file_range, \ compat_sys_sync_file_range) #endif /* fs/timerfd.c */ #define __NR_timerfd_create 85 __SYSCALL(__NR_timerfd_create, sys_timerfd_create) #define __NR_timerfd_settime 86 __SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \ compat_sys_timerfd_settime) #define __NR_timerfd_gettime 87 __SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \ compat_sys_timerfd_gettime) /* fs/utimes.c */ #define __NR_utimensat 88 __SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat) /* kernel/acct.c */ #define __NR_acct 89 __SYSCALL(__NR_acct, sys_acct) /* kernel/capability.c */ #define __NR_capget 90 __SYSCALL(__NR_capget, sys_capget) #define __NR_capset 91 __SYSCALL(__NR_capset, sys_capset) /* kernel/exec_domain.c */ #define __NR_personality 92 __SYSCALL(__NR_personality, sys_personality) /* kernel/exit.c */ #define __NR_exit 93 __SYSCALL(__NR_exit, sys_exit) #define __NR_exit_group 94 __SYSCALL(__NR_exit_group, sys_exit_group) #define __NR_waitid 95 __SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid) /* kernel/fork.c */ #define __NR_set_tid_address 96 __SYSCALL(__NR_set_tid_address, sys_set_tid_address) #define __NR_unshare 97 __SYSCALL(__NR_unshare, sys_unshare) /* kernel/futex.c */ #define __NR_futex 98 __SC_COMP(__NR_futex, sys_futex, compat_sys_futex) #define __NR_set_robust_list 99 __SC_COMP(__NR_set_robust_list, sys_set_robust_list, \ compat_sys_set_robust_list) #define __NR_get_robust_list 100 __SC_COMP(__NR_get_robust_list, sys_get_robust_list, \ compat_sys_get_robust_list) /* kernel/hrtimer.c */ #define __NR_nanosleep 101 __SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep) /* kernel/itimer.c */ #define __NR_getitimer 102 __SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer) #define __NR_setitimer 103 __SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer) /* kernel/kexec.c */ #define __NR_kexec_load 104 __SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load) /* kernel/module.c */ #define __NR_init_module 105 __SYSCALL(__NR_init_module, sys_init_module) #define __NR_delete_module 106 __SYSCALL(__NR_delete_module, sys_delete_module) /* kernel/posix-timers.c */ #define __NR_timer_create 107 __SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create) #define __NR_timer_gettime 108 __SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime) #define __NR_timer_getoverrun 109 __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) #define __NR_timer_settime 110 __SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime) #define __NR_timer_delete 111 __SYSCALL(__NR_timer_delete, sys_timer_delete) #define __NR_clock_settime 112 __SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime) #define __NR_clock_gettime 113 __SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime) #define __NR_clock_getres 114 __SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres) #define __NR_clock_nanosleep 115 __SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \ compat_sys_clock_nanosleep) /* kernel/printk.c */ #define __NR_syslog 116 __SYSCALL(__NR_syslog, sys_syslog) /* kernel/ptrace.c */ #define __NR_ptrace 117 __SYSCALL(__NR_ptrace, sys_ptrace) /* kernel/sched/core.c */ #define __NR_sched_setparam 118 __SYSCALL(__NR_sched_setparam, sys_sched_setparam) #define __NR_sched_setscheduler 119 __SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) #define __NR_sched_getscheduler 120 __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) #define __NR_sched_getparam 121 __SYSCALL(__NR_sched_getparam, sys_sched_getparam) #define __NR_sched_setaffinity 122 __SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \ compat_sys_sched_setaffinity) #define __NR_sched_getaffinity 123 __SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \ compat_sys_sched_getaffinity) #define __NR_sched_yield 124 __SYSCALL(__NR_sched_yield, sys_sched_yield) #define __NR_sched_get_priority_max 125 __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) #define __NR_sched_get_priority_min 126 __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) #define __NR_sched_rr_get_interval 127 __SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \ compat_sys_sched_rr_get_interval) /* kernel/signal.c */ #define __NR_restart_syscall 128 __SYSCALL(__NR_restart_syscall, sys_restart_syscall) #define __NR_kill 129 __SYSCALL(__NR_kill, sys_kill) #define __NR_tkill 130 __SYSCALL(__NR_tkill, sys_tkill) #define __NR_tgkill 131 __SYSCALL(__NR_tgkill, sys_tgkill) #define __NR_sigaltstack 132 __SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack) #define __NR_rt_sigsuspend 133 __SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend) #define __NR_rt_sigaction 134 __SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction) #define __NR_rt_sigprocmask 135 __SC_COMP(__NR_rt_sigprocmask, sys_rt_sigprocmask, compat_sys_rt_sigprocmask) #define __NR_rt_sigpending 136 __SC_COMP(__NR_rt_sigpending, sys_rt_sigpending, compat_sys_rt_sigpending) #define __NR_rt_sigtimedwait 137 __SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \ compat_sys_rt_sigtimedwait) #define __NR_rt_sigqueueinfo 138 __SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \ compat_sys_rt_sigqueueinfo) #define __NR_rt_sigreturn 139 __SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn) /* kernel/sys.c */ #define __NR_setpriority 140 __SYSCALL(__NR_setpriority, sys_setpriority) #define __NR_getpriority 141 __SYSCALL(__NR_getpriority, sys_getpriority) #define __NR_reboot 142 __SYSCALL(__NR_reboot, sys_reboot) #define __NR_setregid 143 __SYSCALL(__NR_setregid, sys_setregid) #define __NR_setgid 144 __SYSCALL(__NR_setgid, sys_setgid) #define __NR_setreuid 145 __SYSCALL(__NR_setreuid, sys_setreuid) #define __NR_setuid 146 __SYSCALL(__NR_setuid, sys_setuid) #define __NR_setresuid 147 __SYSCALL(__NR_setresuid, sys_setresuid) #define __NR_getresuid 148 __SYSCALL(__NR_getresuid, sys_getresuid) #define __NR_setresgid 149 __SYSCALL(__NR_setresgid, sys_setresgid) #define __NR_getresgid 150 __SYSCALL(__NR_getresgid, sys_getresgid) #define __NR_setfsuid 151 __SYSCALL(__NR_setfsuid, sys_setfsuid) #define __NR_setfsgid 152 __SYSCALL(__NR_setfsgid, sys_setfsgid) #define __NR_times 153 __SC_COMP(__NR_times, sys_times, compat_sys_times) #define __NR_setpgid 154 __SYSCALL(__NR_setpgid, sys_setpgid) #define __NR_getpgid 155 __SYSCALL(__NR_getpgid, sys_getpgid) #define __NR_getsid 156 __SYSCALL(__NR_getsid, sys_getsid) #define __NR_setsid 157 __SYSCALL(__NR_setsid, sys_setsid) #define __NR_getgroups 158 __SYSCALL(__NR_getgroups, sys_getgroups) #define __NR_setgroups 159 __SYSCALL(__NR_setgroups, sys_setgroups) #define __NR_uname 160 __SYSCALL(__NR_uname, sys_newuname) #define __NR_sethostname 161 __SYSCALL(__NR_sethostname, sys_sethostname) #define __NR_setdomainname 162 __SYSCALL(__NR_setdomainname, sys_setdomainname) #define __NR_getrlimit 163 __SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit) #define __NR_setrlimit 164 __SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit) #define __NR_getrusage 165 __SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage) #define __NR_umask 166 __SYSCALL(__NR_umask, sys_umask) #define __NR_prctl 167 __SYSCALL(__NR_prctl, sys_prctl) #define __NR_getcpu 168 __SYSCALL(__NR_getcpu, sys_getcpu) /* kernel/time.c */ #define __NR_gettimeofday 169 __SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday) #define __NR_settimeofday 170 __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday) #define __NR_adjtimex 171 __SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex) /* kernel/timer.c */ #define __NR_getpid 172 __SYSCALL(__NR_getpid, sys_getpid) #define __NR_getppid 173 __SYSCALL(__NR_getppid, sys_getppid) #define __NR_getuid 174 __SYSCALL(__NR_getuid, sys_getuid) #define __NR_geteuid 175 __SYSCALL(__NR_geteuid, sys_geteuid) #define __NR_getgid 176 __SYSCALL(__NR_getgid, sys_getgid) #define __NR_getegid 177 __SYSCALL(__NR_getegid, sys_getegid) #define __NR_gettid 178 __SYSCALL(__NR_gettid, sys_gettid) #define __NR_sysinfo 179 __SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo) /* ipc/mqueue.c */ #define __NR_mq_open 180 __SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open) #define __NR_mq_unlink 181 __SYSCALL(__NR_mq_unlink, sys_mq_unlink) #define __NR_mq_timedsend 182 __SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend) #define __NR_mq_timedreceive 183 __SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \ compat_sys_mq_timedreceive) #define __NR_mq_notify 184 __SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify) #define __NR_mq_getsetattr 185 __SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr) /* ipc/msg.c */ #define __NR_msgget 186 __SYSCALL(__NR_msgget, sys_msgget) #define __NR_msgctl 187 __SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl) #define __NR_msgrcv 188 __SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv) #define __NR_msgsnd 189 __SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd) /* ipc/sem.c */ #define __NR_semget 190 __SYSCALL(__NR_semget, sys_semget) #define __NR_semctl 191 __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl) #define __NR_semtimedop 192 __SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop) #define __NR_semop 193 __SYSCALL(__NR_semop, sys_semop) /* ipc/shm.c */ #define __NR_shmget 194 __SYSCALL(__NR_shmget, sys_shmget) #define __NR_shmctl 195 __SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl) #define __NR_shmat 196 __SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat) #define __NR_shmdt 197 __SYSCALL(__NR_shmdt, sys_shmdt) /* net/socket.c */ #define __NR_socket 198 __SYSCALL(__NR_socket, sys_socket) #define __NR_socketpair 199 __SYSCALL(__NR_socketpair, sys_socketpair) #define __NR_bind 200 __SYSCALL(__NR_bind, sys_bind) #define __NR_listen 201 __SYSCALL(__NR_listen, sys_listen) #define __NR_accept 202 __SYSCALL(__NR_accept, sys_accept) #define __NR_connect 203 __SYSCALL(__NR_connect, sys_connect) #define __NR_getsockname 204 __SYSCALL(__NR_getsockname, sys_getsockname) #define __NR_getpeername 205 __SYSCALL(__NR_getpeername, sys_getpeername) #define __NR_sendto 206 __SYSCALL(__NR_sendto, sys_sendto) #define __NR_recvfrom 207 __SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom) #define __NR_setsockopt 208 __SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt) #define __NR_getsockopt 209 __SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt) #define __NR_shutdown 210 __SYSCALL(__NR_shutdown, sys_shutdown) #define __NR_sendmsg 211 __SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg) #define __NR_recvmsg 212 __SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg) /* mm/filemap.c */ #define __NR_readahead 213 __SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead) /* mm/nommu.c, also with MMU */ #define __NR_brk 214 __SYSCALL(__NR_brk, sys_brk) #define __NR_munmap 215 __SYSCALL(__NR_munmap, sys_munmap) #define __NR_mremap 216 __SYSCALL(__NR_mremap, sys_mremap) /* security/keys/keyctl.c */ #define __NR_add_key 217 __SYSCALL(__NR_add_key, sys_add_key) #define __NR_request_key 218 __SYSCALL(__NR_request_key, sys_request_key) #define __NR_keyctl 219 __SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl) /* arch/example/kernel/sys_example.c */ #define __NR_clone 220 __SYSCALL(__NR_clone, sys_clone) #define __NR_execve 221 __SC_COMP(__NR_execve, sys_execve, compat_sys_execve) #define __NR3264_mmap 222 __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) /* mm/fadvise.c */ #define __NR3264_fadvise64 223 __SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64) /* mm/, CONFIG_MMU only */ #ifndef __ARCH_NOMMU #define __NR_swapon 224 __SYSCALL(__NR_swapon, sys_swapon) #define __NR_swapoff 225 __SYSCALL(__NR_swapoff, sys_swapoff) #define __NR_mprotect 226 __SYSCALL(__NR_mprotect, sys_mprotect) #define __NR_msync 227 __SYSCALL(__NR_msync, sys_msync) #define __NR_mlock 228 __SYSCALL(__NR_mlock, sys_mlock) #define __NR_munlock 229 __SYSCALL(__NR_munlock, sys_munlock) #define __NR_mlockall 230 __SYSCALL(__NR_mlockall, sys_mlockall) #define __NR_munlockall 231 __SYSCALL(__NR_munlockall, sys_munlockall) #define __NR_mincore 232 __SYSCALL(__NR_mincore, sys_mincore) #define __NR_madvise 233 __SYSCALL(__NR_madvise, sys_madvise) #define __NR_remap_file_pages 234 __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) #define __NR_mbind 235 __SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind) #define __NR_get_mempolicy 236 __SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy) #define __NR_set_mempolicy 237 __SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy) #define __NR_migrate_pages 238 __SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages) #define __NR_move_pages 239 __SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages) #endif #define __NR_rt_tgsigqueueinfo 240 __SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \ compat_sys_rt_tgsigqueueinfo) #define __NR_perf_event_open 241 __SYSCALL(__NR_perf_event_open, sys_perf_event_open) #define __NR_accept4 242 __SYSCALL(__NR_accept4, sys_accept4) #define __NR_recvmmsg 243 __SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg) /* * Architectures may provide up to 16 syscalls of their own * starting with this value. */ #define __NR_arch_specific_syscall 244 #define __NR_wait4 260 __SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4) #define __NR_prlimit64 261 __SYSCALL(__NR_prlimit64, sys_prlimit64) #define __NR_fanotify_init 262 __SYSCALL(__NR_fanotify_init, sys_fanotify_init) #define __NR_fanotify_mark 263 __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) #define __NR_name_to_handle_at 264 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) #define __NR_open_by_handle_at 265 __SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ compat_sys_open_by_handle_at) #define __NR_clock_adjtime 266 __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) #define __NR_syncfs 267 __SYSCALL(__NR_syncfs, sys_syncfs) #define __NR_setns 268 __SYSCALL(__NR_setns, sys_setns) #define __NR_sendmmsg 269 __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) #define __NR_process_vm_readv 270 __SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ compat_sys_process_vm_readv) #define __NR_process_vm_writev 271 __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ compat_sys_process_vm_writev) #define __NR_kcmp 272 __SYSCALL(__NR_kcmp, sys_kcmp) #define __NR_finit_module 273 __SYSCALL(__NR_finit_module, sys_finit_module) #define __NR_sched_setattr 274 __SYSCALL(__NR_sched_setattr, sys_sched_setattr) #define __NR_sched_getattr 275 __SYSCALL(__NR_sched_getattr, sys_sched_getattr) #define __NR_renameat2 276 __SYSCALL(__NR_renameat2, sys_renameat2) #define __NR_seccomp 277 __SYSCALL(__NR_seccomp, sys_seccomp) #define __NR_getrandom 278 __SYSCALL(__NR_getrandom, sys_getrandom) #define __NR_memfd_create 279 __SYSCALL(__NR_memfd_create, sys_memfd_create) #define __NR_bpf 280 __SYSCALL(__NR_bpf, sys_bpf) #define __NR_execveat 281 __SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat) #define __NR_userfaultfd 282 __SYSCALL(__NR_userfaultfd, sys_userfaultfd) #define __NR_membarrier 283 __SYSCALL(__NR_membarrier, sys_membarrier) #define __NR_mlock2 284 __SYSCALL(__NR_mlock2, sys_mlock2) #define __NR_copy_file_range 285 __SYSCALL(__NR_copy_file_range, sys_copy_file_range) #define __NR_preadv2 286 __SC_COMP(__NR_preadv2, sys_preadv2, compat_sys_preadv2) #define __NR_pwritev2 287 __SC_COMP(__NR_pwritev2, sys_pwritev2, compat_sys_pwritev2) #define __NR_pkey_mprotect 288 __SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect) #define __NR_pkey_alloc 289 __SYSCALL(__NR_pkey_alloc, sys_pkey_alloc) #define __NR_pkey_free 290 __SYSCALL(__NR_pkey_free, sys_pkey_free) #define __NR_statx 291 __SYSCALL(__NR_statx, sys_statx) #define __NR_io_pgetevents 292 __SC_COMP(__NR_io_pgetevents, sys_io_pgetevents, compat_sys_io_pgetevents) #define __NR_rseq 293 __SYSCALL(__NR_rseq, sys_rseq) #define __NR_kexec_file_load 294 __SYSCALL(__NR_kexec_file_load, sys_kexec_file_load) #if __BITS_PER_LONG == 32 #define __NR_clock_gettime64 403 __SYSCALL(__NR_clock_gettime64, sys_clock_gettime) #define __NR_clock_settime64 404 __SYSCALL(__NR_clock_settime64, sys_clock_settime) #define __NR_clock_adjtime64 405 __SYSCALL(__NR_clock_adjtime64, sys_clock_adjtime) #define __NR_clock_getres_time64 406 __SYSCALL(__NR_clock_getres_time64, sys_clock_getres) #define __NR_clock_nanosleep_time64 407 __SYSCALL(__NR_clock_nanosleep_time64, sys_clock_nanosleep) #define __NR_timer_gettime64 408 __SYSCALL(__NR_timer_gettime64, sys_timer_gettime) #define __NR_timer_settime64 409 __SYSCALL(__NR_timer_settime64, sys_timer_settime) #define __NR_timerfd_gettime64 410 __SYSCALL(__NR_timerfd_gettime64, sys_timerfd_gettime) #define __NR_timerfd_settime64 411 __SYSCALL(__NR_timerfd_settime64, sys_timerfd_settime) #define __NR_utimensat_time64 412 __SYSCALL(__NR_utimensat_time64, sys_utimensat) #define __NR_io_pgetevents_time64 416 __SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents) #define __NR_mq_timedsend_time64 418 __SYSCALL(__NR_mq_timedsend_time64, sys_mq_timedsend) #define __NR_mq_timedreceive_time64 419 __SYSCALL(__NR_mq_timedreceive_time64, sys_mq_timedreceive) #define __NR_semtimedop_time64 420 __SYSCALL(__NR_semtimedop_time64, sys_semtimedop) #define __NR_futex_time64 422 __SYSCALL(__NR_futex_time64, sys_futex) #define __NR_sched_rr_get_interval_time64 423 __SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) #endif #define __NR_pidfd_send_signal 424 __SYSCALL(__NR_pidfd_send_signal, sys_pidfd_send_signal) #define __NR_io_uring_setup 425 __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup) #define __NR_io_uring_enter 426 __SYSCALL(__NR_io_uring_enter, sys_io_uring_enter) #define __NR_io_uring_register 427 __SYSCALL(__NR_io_uring_register, sys_io_uring_register) #define __NR_open_tree 428 __SYSCALL(__NR_open_tree, sys_open_tree) #define __NR_move_mount 429 __SYSCALL(__NR_move_mount, sys_move_mount) #define __NR_fsopen 430 __SYSCALL(__NR_fsopen, sys_fsopen) #define __NR_fsconfig 431 __SYSCALL(__NR_fsconfig, sys_fsconfig) #define __NR_fsmount 432 __SYSCALL(__NR_fsmount, sys_fsmount) #define __NR_fspick 433 __SYSCALL(__NR_fspick, sys_fspick) #define __NR_close_range 436 __SYSCALL(__NR_close_range, sys_close_range) #define __NR_faccessat2 439 __SYSCALL(__NR_faccessat2, sys_faccessat2) #define __NR_openat2 437 __SYSCALL(__NR_openat2, sys_openat2) #undef __NR_syscalls #define __NR_syscalls 441 /* * 32 bit systems traditionally used different * syscalls for off_t and loff_t arguments, while * 64 bit systems only need the off_t version. * For new 32 bit platforms, there is no need to * implement the old 32 bit off_t syscalls, so * they take different names. * Here we map the numbers so that both versions * use the same syscall table layout. */ #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) #define __NR_fcntl __NR3264_fcntl #define __NR_statfs __NR3264_statfs #define __NR_fstatfs __NR3264_fstatfs #define __NR_truncate __NR3264_truncate #define __NR_ftruncate __NR3264_ftruncate #define __NR_lseek __NR3264_lseek #define __NR_sendfile __NR3264_sendfile #define __NR_newfstatat __NR3264_fstatat #define __NR_fstat __NR3264_fstat #define __NR_mmap __NR3264_mmap #define __NR_fadvise64 __NR3264_fadvise64 #ifdef __NR3264_stat #define __NR_stat __NR3264_stat #define __NR_lstat __NR3264_lstat #endif #else #define __NR_fcntl64 __NR3264_fcntl #define __NR_statfs64 __NR3264_statfs #define __NR_fstatfs64 __NR3264_fstatfs #define __NR_truncate64 __NR3264_truncate #define __NR_ftruncate64 __NR3264_ftruncate #define __NR_llseek __NR3264_lseek #define __NR_sendfile64 __NR3264_sendfile #define __NR_fstatat64 __NR3264_fstatat #define __NR_fstat64 __NR3264_fstat #define __NR_mmap2 __NR3264_mmap #define __NR_fadvise64_64 __NR3264_fadvise64 #ifdef __NR3264_stat #define __NR_stat64 __NR3264_stat #define __NR_lstat64 __NR3264_lstat #endif #endif verto-module.h 0000644 00000014760 15063602045 0007350 0 ustar 00 /* * Copyright 2011 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /*** THE FOLLOWING ARE FOR IMPLEMENTATION MODULES ONLY ***/ #ifndef VERTO_MODULE_H_ #define VERTO_MODULE_H_ #include <verto.h> #ifndef VERTO_MODULE_TYPES #define VERTO_MODULE_TYPES typedef void verto_mod_ctx; typedef void verto_mod_ev; #endif #define VERTO_MODULE_VERSION 3 #define VERTO_MODULE_TABLE(name) verto_module_table_ ## name #define VERTO_MODULE(name, symb, types) \ static verto_ctx_funcs name ## _funcs = { \ name ## _ctx_new, \ name ## _ctx_default, \ name ## _ctx_free, \ name ## _ctx_run, \ name ## _ctx_run_once, \ name ## _ctx_break, \ name ## _ctx_reinitialize, \ name ## _ctx_set_flags, \ name ## _ctx_add, \ name ## _ctx_del \ }; \ verto_module VERTO_MODULE_TABLE(name) = { \ VERTO_MODULE_VERSION, \ # name, \ # symb, \ types, \ &name ## _funcs, \ }; \ verto_ctx * \ verto_new_ ## name() \ { \ return verto_convert(name, 0, NULL); \ } \ verto_ctx * \ verto_default_ ## name() \ { \ return verto_convert(name, 1, NULL); \ } typedef struct { /* Required */ verto_mod_ctx *(*ctx_new)(); /* Optional */ verto_mod_ctx *(*ctx_default)(); /* Required */ void (*ctx_free)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_run)(verto_mod_ctx *ctx); /* Required */ void (*ctx_run_once)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_break)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_reinitialize)(verto_mod_ctx *ctx); /* Optional */ void (*ctx_set_flags)(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *modev); /* Required */ verto_mod_ev *(*ctx_add)(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags); /* Required */ void (*ctx_del)(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *modev); } verto_ctx_funcs; typedef struct { unsigned int vers; const char *name; const char *symb; verto_ev_type types; verto_ctx_funcs *funcs; } verto_module; /** * Converts an existing implementation specific loop to a verto_ctx. * * This function also sets the internal default implementation so that future * calls to verto_new(NULL) or verto_default(NULL) will use this specific * implementation if it was not already set. * * @param name The name of the module (unquoted) * @param deflt Whether the ctx is the default context or not * @param ctx The context to store * @return A new verto_ctx, or NULL on error. Call verto_free() when done. */ #define verto_convert(name, deflt, ctx) \ verto_convert_module(&VERTO_MODULE_TABLE(name), deflt, ctx) /** * Converts an existing implementation specific loop to a verto_ctx. * * If you are a module implementation, you probably want the macro above. This * function is generally used directly only when an application is attempting * to expose a home-grown event loop to verto. * * If deflt is non-zero and a default ctx was already defined for this module * and ctx is not NULL, than ctx will be free'd and the previously defined * default will be returned. * * If ctx is non-NULL, than the pre-existing verto_mod_ctx will be converted to * to a verto_ctx; if deflt is non-zero than this verto_mod_ctx will also be * marked as the default loop for this process. If ctx is NULL, than the * appropriate constructor will be called: either module->ctx_new() or * module->ctx_default() depending on the boolean value of deflt. If * module->ctx_default is NULL and deflt is non-zero, than module->ctx_new() * will be called and the resulting verto_mod_ctx will be utilized as the * default. * * This function also sets the internal default implementation so that future * calls to verto_new(NULL) or verto_default(NULL) will use this specific * implementation if it was not already set. * * @param name The name of the module (unquoted) * @param ctx The context private to store * @return A new verto_ctx, or NULL on error. Call verto_free() when done. */ verto_ctx * verto_convert_module(const verto_module *module, int deflt, verto_mod_ctx *ctx); /** * Calls the callback of the verto_ev and then frees it via verto_del(). * * The verto_ev is not freed (verto_del() is not called) if it is a signal event. * * @see verto_add_read() * @see verto_add_write() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @see verto_del() * @param ev The verto_ev */ void verto_fire(verto_ev *ev); /** * Sets the status of the pid/handle which caused this event to fire. * * This function does nothing if the verto_ev is not a child type. * * @see verto_add_child() * @param ev The verto_ev to set the status in. * @param status The pid/handle status. */ void verto_set_proc_status(verto_ev *ev, verto_proc_status status); /** * Sets the state of the fd which caused this event to fire. * * This function does nothing if the verto_ev is not a io type. * * Only the flags VERTO_EV_FLAG_IO_(READ|WRITE|ERROR) are supported. All other * flags are unset. * * @see verto_add_io() * @param ev The verto_ev to set the state in. * @param state The fd state. */ void verto_set_fd_state(verto_ev *ev, verto_ev_flag state); #endif /* VERTO_MODULE_H_ */ drm/amdgpu_drm.h 0000644 00000111046 15063602045 0007622 0 ustar 00 /* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*- * * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. * Copyright 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef __AMDGPU_DRM_H__ #define __AMDGPU_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_AMDGPU_GEM_CREATE 0x00 #define DRM_AMDGPU_GEM_MMAP 0x01 #define DRM_AMDGPU_CTX 0x02 #define DRM_AMDGPU_BO_LIST 0x03 #define DRM_AMDGPU_CS 0x04 #define DRM_AMDGPU_INFO 0x05 #define DRM_AMDGPU_GEM_METADATA 0x06 #define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 #define DRM_AMDGPU_GEM_VA 0x08 #define DRM_AMDGPU_WAIT_CS 0x09 #define DRM_AMDGPU_GEM_OP 0x10 #define DRM_AMDGPU_GEM_USERPTR 0x11 #define DRM_AMDGPU_WAIT_FENCES 0x12 #define DRM_AMDGPU_VM 0x13 #define DRM_AMDGPU_FENCE_TO_HANDLE 0x14 #define DRM_AMDGPU_SCHED 0x15 #define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) #define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) #define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx) #define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list) #define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs) #define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info) #define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata) #define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle) #define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va) #define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs) #define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) #define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) #define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences) #define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm) #define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle) #define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched) /** * DOC: memory domains * * %AMDGPU_GEM_DOMAIN_CPU System memory that is not GPU accessible. * Memory in this pool could be swapped out to disk if there is pressure. * * %AMDGPU_GEM_DOMAIN_GTT GPU accessible system memory, mapped into the * GPU's virtual address space via gart. Gart memory linearizes non-contiguous * pages of system memory, allows GPU access system memory in a linearized * fashion. * * %AMDGPU_GEM_DOMAIN_VRAM Local video memory. For APUs, it is memory * carved out by the BIOS. * * %AMDGPU_GEM_DOMAIN_GDS Global on-chip data storage used to share data * across shader threads. * * %AMDGPU_GEM_DOMAIN_GWS Global wave sync, used to synchronize the * execution of all the waves on a device. * * %AMDGPU_GEM_DOMAIN_OA Ordered append, used by 3D or Compute engines * for appending data. */ #define AMDGPU_GEM_DOMAIN_CPU 0x1 #define AMDGPU_GEM_DOMAIN_GTT 0x2 #define AMDGPU_GEM_DOMAIN_VRAM 0x4 #define AMDGPU_GEM_DOMAIN_GDS 0x8 #define AMDGPU_GEM_DOMAIN_GWS 0x10 #define AMDGPU_GEM_DOMAIN_OA 0x20 #define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \ AMDGPU_GEM_DOMAIN_GTT | \ AMDGPU_GEM_DOMAIN_VRAM | \ AMDGPU_GEM_DOMAIN_GDS | \ AMDGPU_GEM_DOMAIN_GWS | \ AMDGPU_GEM_DOMAIN_OA) /* Flag that CPU access will be required for the case of VRAM domain */ #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0) /* Flag that CPU access will not work, this VRAM domain is invisible */ #define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1) /* Flag that USWC attributes should be used for GTT */ #define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2) /* Flag that the memory should be in VRAM and cleared */ #define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3) /* Flag that allocating the BO should use linear VRAM */ #define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5) /* Flag that BO is always valid in this VM */ #define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6) /* Flag that BO sharing will be explicitly synchronized */ #define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7) /* Flag that indicates allocating MQD gart on GFX9, where the mtype * for the second page onward should be set to NC. It should never * be used by user space applications. */ #define AMDGPU_GEM_CREATE_CP_MQD_GFX9 (1 << 8) /* Flag that BO may contain sensitive data that must be wiped before * releasing the memory */ #define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9) /* Flag that BO will be encrypted and that the TMZ bit should be * set in the PTEs when mapping this buffer via GPUVM or * accessing it with various hw blocks */ #define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10) /* Flag that BO will be used only in preemptible context, which does * not require GTT memory accounting */ #define AMDGPU_GEM_CREATE_PREEMPTIBLE (1 << 11) /* Flag that BO can be discarded under memory pressure without keeping the * content. */ #define AMDGPU_GEM_CREATE_DISCARDABLE (1 << 12) /* Flag that BO is shared coherently between multiple devices or CPU threads. * May depend on GPU instructions to flush caches explicitly * * This influences the choice of MTYPE in the PTEs on GFXv9 and later GPUs and * may override the MTYPE selected in AMDGPU_VA_OP_MAP. */ #define AMDGPU_GEM_CREATE_COHERENT (1 << 13) /* Flag that BO should not be cached by GPU. Coherent without having to flush * GPU caches explicitly * * This influences the choice of MTYPE in the PTEs on GFXv9 and later GPUs and * may override the MTYPE selected in AMDGPU_VA_OP_MAP. */ #define AMDGPU_GEM_CREATE_UNCACHED (1 << 14) struct drm_amdgpu_gem_create_in { /** the requested memory size */ __u64 bo_size; /** physical start_addr alignment in bytes for some HW requirements */ __u64 alignment; /** the requested memory domains */ __u64 domains; /** allocation flags */ __u64 domain_flags; }; struct drm_amdgpu_gem_create_out { /** returned GEM object handle */ __u32 handle; __u32 _pad; }; union drm_amdgpu_gem_create { struct drm_amdgpu_gem_create_in in; struct drm_amdgpu_gem_create_out out; }; /** Opcode to create new residency list. */ #define AMDGPU_BO_LIST_OP_CREATE 0 /** Opcode to destroy previously created residency list */ #define AMDGPU_BO_LIST_OP_DESTROY 1 /** Opcode to update resource information in the list */ #define AMDGPU_BO_LIST_OP_UPDATE 2 struct drm_amdgpu_bo_list_in { /** Type of operation */ __u32 operation; /** Handle of list or 0 if we want to create one */ __u32 list_handle; /** Number of BOs in list */ __u32 bo_number; /** Size of each element describing BO */ __u32 bo_info_size; /** Pointer to array describing BOs */ __u64 bo_info_ptr; }; struct drm_amdgpu_bo_list_entry { /** Handle of BO */ __u32 bo_handle; /** New (if specified) BO priority to be used during migration */ __u32 bo_priority; }; struct drm_amdgpu_bo_list_out { /** Handle of resource list */ __u32 list_handle; __u32 _pad; }; union drm_amdgpu_bo_list { struct drm_amdgpu_bo_list_in in; struct drm_amdgpu_bo_list_out out; }; /* context related */ #define AMDGPU_CTX_OP_ALLOC_CTX 1 #define AMDGPU_CTX_OP_FREE_CTX 2 #define AMDGPU_CTX_OP_QUERY_STATE 3 #define AMDGPU_CTX_OP_QUERY_STATE2 4 #define AMDGPU_CTX_OP_GET_STABLE_PSTATE 5 #define AMDGPU_CTX_OP_SET_STABLE_PSTATE 6 /* GPU reset status */ #define AMDGPU_CTX_NO_RESET 0 /* this the context caused it */ #define AMDGPU_CTX_GUILTY_RESET 1 /* some other context caused it */ #define AMDGPU_CTX_INNOCENT_RESET 2 /* unknown cause */ #define AMDGPU_CTX_UNKNOWN_RESET 3 /* indicate gpu reset occured after ctx created */ #define AMDGPU_CTX_QUERY2_FLAGS_RESET (1<<0) /* indicate vram lost occured after ctx created */ #define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1) /* indicate some job from this context once cause gpu hang */ #define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1<<2) /* indicate some errors are detected by RAS */ #define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE (1<<3) #define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE (1<<4) /* Context priority level */ #define AMDGPU_CTX_PRIORITY_UNSET -2048 #define AMDGPU_CTX_PRIORITY_VERY_LOW -1023 #define AMDGPU_CTX_PRIORITY_LOW -512 #define AMDGPU_CTX_PRIORITY_NORMAL 0 /* * When used in struct drm_amdgpu_ctx_in, a priority above NORMAL requires * CAP_SYS_NICE or DRM_MASTER */ #define AMDGPU_CTX_PRIORITY_HIGH 512 #define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023 /* select a stable profiling pstate for perfmon tools */ #define AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK 0xf #define AMDGPU_CTX_STABLE_PSTATE_NONE 0 #define AMDGPU_CTX_STABLE_PSTATE_STANDARD 1 #define AMDGPU_CTX_STABLE_PSTATE_MIN_SCLK 2 #define AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK 3 #define AMDGPU_CTX_STABLE_PSTATE_PEAK 4 struct drm_amdgpu_ctx_in { /** AMDGPU_CTX_OP_* */ __u32 op; /** Flags */ __u32 flags; __u32 ctx_id; /** AMDGPU_CTX_PRIORITY_* */ __s32 priority; }; union drm_amdgpu_ctx_out { struct { __u32 ctx_id; __u32 _pad; } alloc; struct { /** For future use, no flags defined so far */ __u64 flags; /** Number of resets caused by this context so far. */ __u32 hangs; /** Reset status since the last call of the ioctl. */ __u32 reset_status; } state; struct { __u32 flags; __u32 _pad; } pstate; }; union drm_amdgpu_ctx { struct drm_amdgpu_ctx_in in; union drm_amdgpu_ctx_out out; }; /* vm ioctl */ #define AMDGPU_VM_OP_RESERVE_VMID 1 #define AMDGPU_VM_OP_UNRESERVE_VMID 2 struct drm_amdgpu_vm_in { /** AMDGPU_VM_OP_* */ __u32 op; __u32 flags; }; struct drm_amdgpu_vm_out { /** For future use, no flags defined so far */ __u64 flags; }; union drm_amdgpu_vm { struct drm_amdgpu_vm_in in; struct drm_amdgpu_vm_out out; }; /* sched ioctl */ #define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1 #define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE 2 struct drm_amdgpu_sched_in { /* AMDGPU_SCHED_OP_* */ __u32 op; __u32 fd; /** AMDGPU_CTX_PRIORITY_* */ __s32 priority; __u32 ctx_id; }; union drm_amdgpu_sched { struct drm_amdgpu_sched_in in; }; /* * This is not a reliable API and you should expect it to fail for any * number of reasons and have fallback path that do not use userptr to * perform any operation. */ #define AMDGPU_GEM_USERPTR_READONLY (1 << 0) #define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1) #define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2) #define AMDGPU_GEM_USERPTR_REGISTER (1 << 3) struct drm_amdgpu_gem_userptr { __u64 addr; __u64 size; /* AMDGPU_GEM_USERPTR_* */ __u32 flags; /* Resulting GEM handle */ __u32 handle; }; /* SI-CI-VI: */ /* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */ #define AMDGPU_TILING_ARRAY_MODE_SHIFT 0 #define AMDGPU_TILING_ARRAY_MODE_MASK 0xf #define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4 #define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f #define AMDGPU_TILING_TILE_SPLIT_SHIFT 9 #define AMDGPU_TILING_TILE_SPLIT_MASK 0x7 #define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12 #define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7 #define AMDGPU_TILING_BANK_WIDTH_SHIFT 15 #define AMDGPU_TILING_BANK_WIDTH_MASK 0x3 #define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17 #define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3 #define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19 #define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3 #define AMDGPU_TILING_NUM_BANKS_SHIFT 21 #define AMDGPU_TILING_NUM_BANKS_MASK 0x3 /* GFX9 and later: */ #define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0 #define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f #define AMDGPU_TILING_DCC_OFFSET_256B_SHIFT 5 #define AMDGPU_TILING_DCC_OFFSET_256B_MASK 0xFFFFFF #define AMDGPU_TILING_DCC_PITCH_MAX_SHIFT 29 #define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF #define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1 #define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44 #define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1 #define AMDGPU_TILING_SCANOUT_SHIFT 63 #define AMDGPU_TILING_SCANOUT_MASK 0x1 /* Set/Get helpers for tiling flags. */ #define AMDGPU_TILING_SET(field, value) \ (((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT) #define AMDGPU_TILING_GET(value, field) \ (((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK) #define AMDGPU_GEM_METADATA_OP_SET_METADATA 1 #define AMDGPU_GEM_METADATA_OP_GET_METADATA 2 /** The same structure is shared for input/output */ struct drm_amdgpu_gem_metadata { /** GEM Object handle */ __u32 handle; /** Do we want get or set metadata */ __u32 op; struct { /** For future use, no flags defined so far */ __u64 flags; /** family specific tiling info */ __u64 tiling_info; __u32 data_size_bytes; __u32 data[64]; } data; }; struct drm_amdgpu_gem_mmap_in { /** the GEM object handle */ __u32 handle; __u32 _pad; }; struct drm_amdgpu_gem_mmap_out { /** mmap offset from the vma offset manager */ __u64 addr_ptr; }; union drm_amdgpu_gem_mmap { struct drm_amdgpu_gem_mmap_in in; struct drm_amdgpu_gem_mmap_out out; }; struct drm_amdgpu_gem_wait_idle_in { /** GEM object handle */ __u32 handle; /** For future use, no flags defined so far */ __u32 flags; /** Absolute timeout to wait */ __u64 timeout; }; struct drm_amdgpu_gem_wait_idle_out { /** BO status: 0 - BO is idle, 1 - BO is busy */ __u32 status; /** Returned current memory domain */ __u32 domain; }; union drm_amdgpu_gem_wait_idle { struct drm_amdgpu_gem_wait_idle_in in; struct drm_amdgpu_gem_wait_idle_out out; }; struct drm_amdgpu_wait_cs_in { /* Command submission handle * handle equals 0 means none to wait for * handle equals ~0ull means wait for the latest sequence number */ __u64 handle; /** Absolute timeout to wait */ __u64 timeout; __u32 ip_type; __u32 ip_instance; __u32 ring; __u32 ctx_id; }; struct drm_amdgpu_wait_cs_out { /** CS status: 0 - CS completed, 1 - CS still busy */ __u64 status; }; union drm_amdgpu_wait_cs { struct drm_amdgpu_wait_cs_in in; struct drm_amdgpu_wait_cs_out out; }; struct drm_amdgpu_fence { __u32 ctx_id; __u32 ip_type; __u32 ip_instance; __u32 ring; __u64 seq_no; }; struct drm_amdgpu_wait_fences_in { /** This points to uint64_t * which points to fences */ __u64 fences; __u32 fence_count; __u32 wait_all; __u64 timeout_ns; }; struct drm_amdgpu_wait_fences_out { __u32 status; __u32 first_signaled; }; union drm_amdgpu_wait_fences { struct drm_amdgpu_wait_fences_in in; struct drm_amdgpu_wait_fences_out out; }; #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0 #define AMDGPU_GEM_OP_SET_PLACEMENT 1 /* Sets or returns a value associated with a buffer. */ struct drm_amdgpu_gem_op { /** GEM object handle */ __u32 handle; /** AMDGPU_GEM_OP_* */ __u32 op; /** Input or return value */ __u64 value; }; #define AMDGPU_VA_OP_MAP 1 #define AMDGPU_VA_OP_UNMAP 2 #define AMDGPU_VA_OP_CLEAR 3 #define AMDGPU_VA_OP_REPLACE 4 /* Delay the page table update till the next CS */ #define AMDGPU_VM_DELAY_UPDATE (1 << 0) /* Mapping flags */ /* readable mapping */ #define AMDGPU_VM_PAGE_READABLE (1 << 1) /* writable mapping */ #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2) /* executable mapping, new for VI */ #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) /* partially resident texture */ #define AMDGPU_VM_PAGE_PRT (1 << 4) /* MTYPE flags use bit 5 to 8 */ #define AMDGPU_VM_MTYPE_MASK (0xf << 5) /* Default MTYPE. Pre-AI must use this. Recommended for newer ASICs. */ #define AMDGPU_VM_MTYPE_DEFAULT (0 << 5) /* Use Non Coherent MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_NC (1 << 5) /* Use Write Combine MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_WC (2 << 5) /* Use Cache Coherent MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_CC (3 << 5) /* Use UnCached MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_UC (4 << 5) /* Use Read Write MTYPE instead of default MTYPE */ #define AMDGPU_VM_MTYPE_RW (5 << 5) /* don't allocate MALL */ #define AMDGPU_VM_PAGE_NOALLOC (1 << 9) struct drm_amdgpu_gem_va { /** GEM object handle */ __u32 handle; __u32 _pad; /** AMDGPU_VA_OP_* */ __u32 operation; /** AMDGPU_VM_PAGE_* */ __u32 flags; /** va address to assign . Must be correctly aligned.*/ __u64 va_address; /** Specify offset inside of BO to assign. Must be correctly aligned.*/ __u64 offset_in_bo; /** Specify mapping size. Must be correctly aligned. */ __u64 map_size; }; #define AMDGPU_HW_IP_GFX 0 #define AMDGPU_HW_IP_COMPUTE 1 #define AMDGPU_HW_IP_DMA 2 #define AMDGPU_HW_IP_UVD 3 #define AMDGPU_HW_IP_VCE 4 #define AMDGPU_HW_IP_UVD_ENC 5 #define AMDGPU_HW_IP_VCN_DEC 6 /* * From VCN4, AMDGPU_HW_IP_VCN_ENC is re-used to support * both encoding and decoding jobs. */ #define AMDGPU_HW_IP_VCN_ENC 7 #define AMDGPU_HW_IP_VCN_JPEG 8 #define AMDGPU_HW_IP_NUM 9 #define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1 #define AMDGPU_CHUNK_ID_IB 0x01 #define AMDGPU_CHUNK_ID_FENCE 0x02 #define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03 #define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04 #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05 #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06 #define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07 #define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08 #define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09 struct drm_amdgpu_cs_chunk { __u32 chunk_id; __u32 length_dw; __u64 chunk_data; }; struct drm_amdgpu_cs_in { /** Rendering context id */ __u32 ctx_id; /** Handle of resource list associated with CS */ __u32 bo_list_handle; __u32 num_chunks; __u32 flags; /** this points to __u64 * which point to cs chunks */ __u64 chunks; }; struct drm_amdgpu_cs_out { __u64 handle; }; union drm_amdgpu_cs { struct drm_amdgpu_cs_in in; struct drm_amdgpu_cs_out out; }; /* Specify flags to be used for IB */ /* This IB should be submitted to CE */ #define AMDGPU_IB_FLAG_CE (1<<0) /* Preamble flag, which means the IB could be dropped if no context switch */ #define AMDGPU_IB_FLAG_PREAMBLE (1<<1) /* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */ #define AMDGPU_IB_FLAG_PREEMPT (1<<2) /* The IB fence should do the L2 writeback but not invalidate any shader * caches (L2/vL1/sL1/I$). */ #define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3) /* Set GDS_COMPUTE_MAX_WAVE_ID = DEFAULT before PACKET3_INDIRECT_BUFFER. * This will reset wave ID counters for the IB. */ #define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4) /* Flag the IB as secure (TMZ) */ #define AMDGPU_IB_FLAGS_SECURE (1 << 5) /* Tell KMD to flush and invalidate caches */ #define AMDGPU_IB_FLAG_EMIT_MEM_SYNC (1 << 6) struct drm_amdgpu_cs_chunk_ib { __u32 _pad; /** AMDGPU_IB_FLAG_* */ __u32 flags; /** Virtual address to begin IB execution */ __u64 va_start; /** Size of submission */ __u32 ib_bytes; /** HW IP to submit to */ __u32 ip_type; /** HW IP index of the same type to submit to */ __u32 ip_instance; /** Ring index to submit to */ __u32 ring; }; struct drm_amdgpu_cs_chunk_dep { __u32 ip_type; __u32 ip_instance; __u32 ring; __u32 ctx_id; __u64 handle; }; struct drm_amdgpu_cs_chunk_fence { __u32 handle; __u32 offset; }; struct drm_amdgpu_cs_chunk_sem { __u32 handle; }; struct drm_amdgpu_cs_chunk_syncobj { __u32 handle; __u32 flags; __u64 point; }; #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2 union drm_amdgpu_fence_to_handle { struct { struct drm_amdgpu_fence fence; __u32 what; __u32 pad; } in; struct { __u32 handle; } out; }; struct drm_amdgpu_cs_chunk_data { union { struct drm_amdgpu_cs_chunk_ib ib_data; struct drm_amdgpu_cs_chunk_fence fence_data; }; }; /* * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU * */ #define AMDGPU_IDS_FLAGS_FUSION 0x1 #define AMDGPU_IDS_FLAGS_PREEMPTION 0x2 #define AMDGPU_IDS_FLAGS_TMZ 0x4 #define AMDGPU_IDS_FLAGS_CONFORMANT_TRUNC_COORD 0x8 /* indicate if acceleration can be working */ #define AMDGPU_INFO_ACCEL_WORKING 0x00 /* get the crtc_id from the mode object id? */ #define AMDGPU_INFO_CRTC_FROM_ID 0x01 /* query hw IP info */ #define AMDGPU_INFO_HW_IP_INFO 0x02 /* query hw IP instance count for the specified type */ #define AMDGPU_INFO_HW_IP_COUNT 0x03 /* timestamp for GL_ARB_timer_query */ #define AMDGPU_INFO_TIMESTAMP 0x05 /* Query the firmware version */ #define AMDGPU_INFO_FW_VERSION 0x0e /* Subquery id: Query VCE firmware version */ #define AMDGPU_INFO_FW_VCE 0x1 /* Subquery id: Query UVD firmware version */ #define AMDGPU_INFO_FW_UVD 0x2 /* Subquery id: Query GMC firmware version */ #define AMDGPU_INFO_FW_GMC 0x03 /* Subquery id: Query GFX ME firmware version */ #define AMDGPU_INFO_FW_GFX_ME 0x04 /* Subquery id: Query GFX PFP firmware version */ #define AMDGPU_INFO_FW_GFX_PFP 0x05 /* Subquery id: Query GFX CE firmware version */ #define AMDGPU_INFO_FW_GFX_CE 0x06 /* Subquery id: Query GFX RLC firmware version */ #define AMDGPU_INFO_FW_GFX_RLC 0x07 /* Subquery id: Query GFX MEC firmware version */ #define AMDGPU_INFO_FW_GFX_MEC 0x08 /* Subquery id: Query SMC firmware version */ #define AMDGPU_INFO_FW_SMC 0x0a /* Subquery id: Query SDMA firmware version */ #define AMDGPU_INFO_FW_SDMA 0x0b /* Subquery id: Query PSP SOS firmware version */ #define AMDGPU_INFO_FW_SOS 0x0c /* Subquery id: Query PSP ASD firmware version */ #define AMDGPU_INFO_FW_ASD 0x0d /* Subquery id: Query VCN firmware version */ #define AMDGPU_INFO_FW_VCN 0x0e /* Subquery id: Query GFX RLC SRLC firmware version */ #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f /* Subquery id: Query GFX RLC SRLG firmware version */ #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10 /* Subquery id: Query GFX RLC SRLS firmware version */ #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11 /* Subquery id: Query DMCU firmware version */ #define AMDGPU_INFO_FW_DMCU 0x12 #define AMDGPU_INFO_FW_TA 0x13 /* Subquery id: Query DMCUB firmware version */ #define AMDGPU_INFO_FW_DMCUB 0x14 /* Subquery id: Query TOC firmware version */ #define AMDGPU_INFO_FW_TOC 0x15 /* Subquery id: Query CAP firmware version */ #define AMDGPU_INFO_FW_CAP 0x16 /* Subquery id: Query GFX RLCP firmware version */ #define AMDGPU_INFO_FW_GFX_RLCP 0x17 /* Subquery id: Query GFX RLCV firmware version */ #define AMDGPU_INFO_FW_GFX_RLCV 0x18 /* Subquery id: Query MES_KIQ firmware version */ #define AMDGPU_INFO_FW_MES_KIQ 0x19 /* Subquery id: Query MES firmware version */ #define AMDGPU_INFO_FW_MES 0x1a /* Subquery id: Query IMU firmware version */ #define AMDGPU_INFO_FW_IMU 0x1b /* number of bytes moved for TTM migration */ #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f /* the used VRAM size */ #define AMDGPU_INFO_VRAM_USAGE 0x10 /* the used GTT size */ #define AMDGPU_INFO_GTT_USAGE 0x11 /* Information about GDS, etc. resource configuration */ #define AMDGPU_INFO_GDS_CONFIG 0x13 /* Query information about VRAM and GTT domains */ #define AMDGPU_INFO_VRAM_GTT 0x14 /* Query information about register in MMR address space*/ #define AMDGPU_INFO_READ_MMR_REG 0x15 /* Query information about device: rev id, family, etc. */ #define AMDGPU_INFO_DEV_INFO 0x16 /* visible vram usage */ #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17 /* number of TTM buffer evictions */ #define AMDGPU_INFO_NUM_EVICTIONS 0x18 /* Query memory about VRAM and GTT domains */ #define AMDGPU_INFO_MEMORY 0x19 /* Query vce clock table */ #define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A /* Query vbios related information */ #define AMDGPU_INFO_VBIOS 0x1B /* Subquery id: Query vbios size */ #define AMDGPU_INFO_VBIOS_SIZE 0x1 /* Subquery id: Query vbios image */ #define AMDGPU_INFO_VBIOS_IMAGE 0x2 /* Subquery id: Query vbios info */ #define AMDGPU_INFO_VBIOS_INFO 0x3 /* Query UVD handles */ #define AMDGPU_INFO_NUM_HANDLES 0x1C /* Query sensor related information */ #define AMDGPU_INFO_SENSOR 0x1D /* Subquery id: Query GPU shader clock */ #define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1 /* Subquery id: Query GPU memory clock */ #define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2 /* Subquery id: Query GPU temperature */ #define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3 /* Subquery id: Query GPU load */ #define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4 /* Subquery id: Query average GPU power */ #define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5 /* Subquery id: Query northbridge voltage */ #define AMDGPU_INFO_SENSOR_VDDNB 0x6 /* Subquery id: Query graphics voltage */ #define AMDGPU_INFO_SENSOR_VDDGFX 0x7 /* Subquery id: Query GPU stable pstate shader clock */ #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8 /* Subquery id: Query GPU stable pstate memory clock */ #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9 /* Subquery id: Query GPU peak pstate shader clock */ #define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_SCLK 0xa /* Subquery id: Query GPU peak pstate memory clock */ #define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_MCLK 0xb /* Number of VRAM page faults on CPU access. */ #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E #define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F /* query ras mask of enabled features*/ #define AMDGPU_INFO_RAS_ENABLED_FEATURES 0x20 /* RAS MASK: UMC (VRAM) */ #define AMDGPU_INFO_RAS_ENABLED_UMC (1 << 0) /* RAS MASK: SDMA */ #define AMDGPU_INFO_RAS_ENABLED_SDMA (1 << 1) /* RAS MASK: GFX */ #define AMDGPU_INFO_RAS_ENABLED_GFX (1 << 2) /* RAS MASK: MMHUB */ #define AMDGPU_INFO_RAS_ENABLED_MMHUB (1 << 3) /* RAS MASK: ATHUB */ #define AMDGPU_INFO_RAS_ENABLED_ATHUB (1 << 4) /* RAS MASK: PCIE */ #define AMDGPU_INFO_RAS_ENABLED_PCIE (1 << 5) /* RAS MASK: HDP */ #define AMDGPU_INFO_RAS_ENABLED_HDP (1 << 6) /* RAS MASK: XGMI */ #define AMDGPU_INFO_RAS_ENABLED_XGMI (1 << 7) /* RAS MASK: DF */ #define AMDGPU_INFO_RAS_ENABLED_DF (1 << 8) /* RAS MASK: SMN */ #define AMDGPU_INFO_RAS_ENABLED_SMN (1 << 9) /* RAS MASK: SEM */ #define AMDGPU_INFO_RAS_ENABLED_SEM (1 << 10) /* RAS MASK: MP0 */ #define AMDGPU_INFO_RAS_ENABLED_MP0 (1 << 11) /* RAS MASK: MP1 */ #define AMDGPU_INFO_RAS_ENABLED_MP1 (1 << 12) /* RAS MASK: FUSE */ #define AMDGPU_INFO_RAS_ENABLED_FUSE (1 << 13) /* query video encode/decode caps */ #define AMDGPU_INFO_VIDEO_CAPS 0x21 /* Subquery id: Decode */ #define AMDGPU_INFO_VIDEO_CAPS_DECODE 0 /* Subquery id: Encode */ #define AMDGPU_INFO_VIDEO_CAPS_ENCODE 1 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff #define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8 #define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff struct drm_amdgpu_query_fw { /** AMDGPU_INFO_FW_* */ __u32 fw_type; /** * Index of the IP if there are more IPs of * the same type. */ __u32 ip_instance; /** * Index of the engine. Whether this is used depends * on the firmware type. (e.g. MEC, SDMA) */ __u32 index; __u32 _pad; }; /* Input structure for the INFO ioctl */ struct drm_amdgpu_info { /* Where the return value will be stored */ __u64 return_pointer; /* The size of the return value. Just like "size" in "snprintf", * it limits how many bytes the kernel can write. */ __u32 return_size; /* The query request id. */ __u32 query; union { struct { __u32 id; __u32 _pad; } mode_crtc; struct { /** AMDGPU_HW_IP_* */ __u32 type; /** * Index of the IP if there are more IPs of the same * type. Ignored by AMDGPU_INFO_HW_IP_COUNT. */ __u32 ip_instance; } query_hw_ip; struct { __u32 dword_offset; /** number of registers to read */ __u32 count; __u32 instance; /** For future use, no flags defined so far */ __u32 flags; } read_mmr_reg; struct drm_amdgpu_query_fw query_fw; struct { __u32 type; __u32 offset; } vbios_info; struct { __u32 type; } sensor_info; struct { __u32 type; } video_cap; }; }; struct drm_amdgpu_info_gds { /** GDS GFX partition size */ __u32 gds_gfx_partition_size; /** GDS compute partition size */ __u32 compute_partition_size; /** total GDS memory size */ __u32 gds_total_size; /** GWS size per GFX partition */ __u32 gws_per_gfx_partition; /** GSW size per compute partition */ __u32 gws_per_compute_partition; /** OA size per GFX partition */ __u32 oa_per_gfx_partition; /** OA size per compute partition */ __u32 oa_per_compute_partition; __u32 _pad; }; struct drm_amdgpu_info_vram_gtt { __u64 vram_size; __u64 vram_cpu_accessible_size; __u64 gtt_size; }; struct drm_amdgpu_heap_info { /** max. physical memory */ __u64 total_heap_size; /** Theoretical max. available memory in the given heap */ __u64 usable_heap_size; /** * Number of bytes allocated in the heap. This includes all processes * and private allocations in the kernel. It changes when new buffers * are allocated, freed, and moved. It cannot be larger than * heap_size. */ __u64 heap_usage; /** * Theoretical possible max. size of buffer which * could be allocated in the given heap */ __u64 max_allocation; }; struct drm_amdgpu_memory_info { struct drm_amdgpu_heap_info vram; struct drm_amdgpu_heap_info cpu_accessible_vram; struct drm_amdgpu_heap_info gtt; }; struct drm_amdgpu_info_firmware { __u32 ver; __u32 feature; }; struct drm_amdgpu_info_vbios { __u8 name[64]; __u8 vbios_pn[64]; __u32 version; __u32 pad; __u8 vbios_ver_str[32]; __u8 date[32]; }; #define AMDGPU_VRAM_TYPE_UNKNOWN 0 #define AMDGPU_VRAM_TYPE_GDDR1 1 #define AMDGPU_VRAM_TYPE_DDR2 2 #define AMDGPU_VRAM_TYPE_GDDR3 3 #define AMDGPU_VRAM_TYPE_GDDR4 4 #define AMDGPU_VRAM_TYPE_GDDR5 5 #define AMDGPU_VRAM_TYPE_HBM 6 #define AMDGPU_VRAM_TYPE_DDR3 7 #define AMDGPU_VRAM_TYPE_DDR4 8 #define AMDGPU_VRAM_TYPE_GDDR6 9 #define AMDGPU_VRAM_TYPE_DDR5 10 #define AMDGPU_VRAM_TYPE_LPDDR4 11 #define AMDGPU_VRAM_TYPE_LPDDR5 12 struct drm_amdgpu_info_device { /** PCI Device ID */ __u32 device_id; /** Internal chip revision: A0, A1, etc.) */ __u32 chip_rev; __u32 external_rev; /** Revision id in PCI Config space */ __u32 pci_rev; __u32 family; __u32 num_shader_engines; __u32 num_shader_arrays_per_engine; /* in KHz */ __u32 gpu_counter_freq; __u64 max_engine_clock; __u64 max_memory_clock; /* cu information */ __u32 cu_active_number; /* NOTE: cu_ao_mask is INVALID, DON'T use it */ __u32 cu_ao_mask; __u32 cu_bitmap[4][4]; /** Render backend pipe mask. One render backend is CB+DB. */ __u32 enabled_rb_pipes_mask; __u32 num_rb_pipes; __u32 num_hw_gfx_contexts; /* PCIe version (the smaller of the GPU and the CPU/motherboard) */ __u32 pcie_gen; __u64 ids_flags; /** Starting virtual address for UMDs. */ __u64 virtual_address_offset; /** The maximum virtual address */ __u64 virtual_address_max; /** Required alignment of virtual addresses. */ __u32 virtual_address_alignment; /** Page table entry - fragment size */ __u32 pte_fragment_size; __u32 gart_page_size; /** constant engine ram size*/ __u32 ce_ram_size; /** video memory type info*/ __u32 vram_type; /** video memory bit width*/ __u32 vram_bit_width; /* vce harvesting instance */ __u32 vce_harvest_config; /* gfx double offchip LDS buffers */ __u32 gc_double_offchip_lds_buf; /* NGG Primitive Buffer */ __u64 prim_buf_gpu_addr; /* NGG Position Buffer */ __u64 pos_buf_gpu_addr; /* NGG Control Sideband */ __u64 cntl_sb_buf_gpu_addr; /* NGG Parameter Cache */ __u64 param_buf_gpu_addr; __u32 prim_buf_size; __u32 pos_buf_size; __u32 cntl_sb_buf_size; __u32 param_buf_size; /* wavefront size*/ __u32 wave_front_size; /* shader visible vgprs*/ __u32 num_shader_visible_vgprs; /* CU per shader array*/ __u32 num_cu_per_sh; /* number of tcc blocks*/ __u32 num_tcc_blocks; /* gs vgt table depth*/ __u32 gs_vgt_table_depth; /* gs primitive buffer depth*/ __u32 gs_prim_buffer_depth; /* max gs wavefront per vgt*/ __u32 max_gs_waves_per_vgt; /* PCIe number of lanes (the smaller of the GPU and the CPU/motherboard) */ __u32 pcie_num_lanes; /* always on cu bitmap */ __u32 cu_ao_bitmap[4][4]; /** Starting high virtual address for UMDs. */ __u64 high_va_offset; /** The maximum high virtual address */ __u64 high_va_max; /* gfx10 pa_sc_tile_steering_override */ __u32 pa_sc_tile_steering_override; /* disabled TCCs */ __u64 tcc_disabled_mask; __u64 min_engine_clock; __u64 min_memory_clock; /* The following fields are only set on gfx11+, older chips set 0. */ __u32 tcp_cache_size; /* AKA GL0, VMEM cache */ __u32 num_sqc_per_wgp; __u32 sqc_data_cache_size; /* AKA SMEM cache */ __u32 sqc_inst_cache_size; __u32 gl1c_cache_size; __u32 gl2c_cache_size; __u64 mall_size; /* AKA infinity cache */ /* high 32 bits of the rb pipes mask */ __u32 enabled_rb_pipes_mask_hi; }; struct drm_amdgpu_info_hw_ip { /** Version of h/w IP */ __u32 hw_ip_version_major; __u32 hw_ip_version_minor; /** Capabilities */ __u64 capabilities_flags; /** command buffer address start alignment*/ __u32 ib_start_alignment; /** command buffer size alignment*/ __u32 ib_size_alignment; /** Bitmask of available rings. Bit 0 means ring 0, etc. */ __u32 available_rings; /** version info: bits 23:16 major, 15:8 minor, 7:0 revision */ __u32 ip_discovery_version; }; struct drm_amdgpu_info_num_handles { /** Max handles as supported by firmware for UVD */ __u32 uvd_max_handles; /** Handles currently in use for UVD */ __u32 uvd_used_handles; }; #define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6 struct drm_amdgpu_info_vce_clock_table_entry { /** System clock */ __u32 sclk; /** Memory clock */ __u32 mclk; /** VCE clock */ __u32 eclk; __u32 pad; }; struct drm_amdgpu_info_vce_clock_table { struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES]; __u32 num_valid_entries; __u32 pad; }; /* query video encode/decode caps */ #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 0 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 1 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 2 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC 3 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC 4 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG 5 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 6 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 7 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT 8 struct drm_amdgpu_info_video_codec_info { __u32 valid; __u32 max_width; __u32 max_height; __u32 max_pixels_per_frame; __u32 max_level; __u32 pad; }; struct drm_amdgpu_info_video_caps { struct drm_amdgpu_info_video_codec_info codec_info[AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT]; }; /* * Supported GPU families */ #define AMDGPU_FAMILY_UNKNOWN 0 #define AMDGPU_FAMILY_SI 110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */ #define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */ #define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */ #define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */ #define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */ #define AMDGPU_FAMILY_AI 141 /* Vega10 */ #define AMDGPU_FAMILY_RV 142 /* Raven */ #define AMDGPU_FAMILY_NV 143 /* Navi10 */ #define AMDGPU_FAMILY_VGH 144 /* Van Gogh */ #define AMDGPU_FAMILY_GC_11_0_0 145 /* GC 11.0.0 */ #define AMDGPU_FAMILY_YC 146 /* Yellow Carp */ #define AMDGPU_FAMILY_GC_11_0_1 148 /* GC 11.0.1 */ #define AMDGPU_FAMILY_GC_10_3_6 149 /* GC 10.3.6 */ #define AMDGPU_FAMILY_GC_10_3_7 151 /* GC 10.3.7 */ #if defined(__cplusplus) } #endif #endif drm/armada_drm.h 0000644 00000002274 15063602045 0007574 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2012 Russell King * With inspiration from the i915 driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef DRM_ARMADA_IOCTL_H #define DRM_ARMADA_IOCTL_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_ARMADA_GEM_CREATE 0x00 #define DRM_ARMADA_GEM_MMAP 0x02 #define DRM_ARMADA_GEM_PWRITE 0x03 #define ARMADA_IOCTL(dir, name, str) \ DRM_##dir(DRM_COMMAND_BASE + DRM_ARMADA_##name, struct drm_armada_##str) struct drm_armada_gem_create { __u32 handle; __u32 size; }; #define DRM_IOCTL_ARMADA_GEM_CREATE \ ARMADA_IOCTL(IOWR, GEM_CREATE, gem_create) struct drm_armada_gem_mmap { __u32 handle; __u32 pad; __u64 offset; __u64 size; __u64 addr; }; #define DRM_IOCTL_ARMADA_GEM_MMAP \ ARMADA_IOCTL(IOWR, GEM_MMAP, gem_mmap) struct drm_armada_gem_pwrite { __u64 ptr; __u32 handle; __u32 offset; __u32 size; }; #define DRM_IOCTL_ARMADA_GEM_PWRITE \ ARMADA_IOCTL(IOW, GEM_PWRITE, gem_pwrite) #if defined(__cplusplus) } #endif #endif drm/drm.h 0000644 00000111622 15063602045 0006265 0 ustar 00 /* * Header for the Direct Rendering Manager * * Author: Rickard E. (Rik) Faith <faith@valinux.com> * * Acknowledgments: * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg. */ /* * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_H_ #define _DRM_H_ #if defined(__linux__) #include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t; #else /* One of the BSDs */ #include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> typedef int8_t __s8; typedef uint8_t __u8; typedef int16_t __s16; typedef uint16_t __u16; typedef int32_t __s32; typedef uint32_t __u32; typedef int64_t __s64; typedef uint64_t __u64; typedef size_t __kernel_size_t; typedef unsigned long drm_handle_t; #endif #if defined(__cplusplus) extern "C" { #endif #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) typedef unsigned int drm_context_t; typedef unsigned int drm_drawable_t; typedef unsigned int drm_magic_t; /* * Cliprect. * * \warning: If you change this structure, make sure you change * XF86DRIClipRectRec in the server as well * * \note KW: Actually it's illegal to change either for * backwards-compatibility reasons. */ struct drm_clip_rect { unsigned short x1; unsigned short y1; unsigned short x2; unsigned short y2; }; /* * Drawable information. */ struct drm_drawable_info { unsigned int num_rects; struct drm_clip_rect *rects; }; /* * Texture region, */ struct drm_tex_region { unsigned char next; unsigned char prev; unsigned char in_use; unsigned char padding; unsigned int age; }; /* * Hardware lock. * * The lock structure is a simple cache-line aligned integer. To avoid * processor bus contention on a multiprocessor system, there should not be any * other data stored in the same cache line. */ struct drm_hw_lock { __volatile__ unsigned int lock; /**< lock variable */ char padding[60]; /**< Pad to cache line */ }; /* * DRM_IOCTL_VERSION ioctl argument type. * * \sa drmGetVersion(). */ struct drm_version { int version_major; /**< Major version */ int version_minor; /**< Minor version */ int version_patchlevel; /**< Patch level */ __kernel_size_t name_len; /**< Length of name buffer */ char *name; /**< Name of driver */ __kernel_size_t date_len; /**< Length of date buffer */ char *date; /**< User-space buffer to hold date */ __kernel_size_t desc_len; /**< Length of desc buffer */ char *desc; /**< User-space buffer to hold desc */ }; /* * DRM_IOCTL_GET_UNIQUE ioctl argument type. * * \sa drmGetBusid() and drmSetBusId(). */ struct drm_unique { __kernel_size_t unique_len; /**< Length of unique */ char *unique; /**< Unique name for driver instantiation */ }; struct drm_list { int count; /**< Length of user-space structures */ struct drm_version *version; }; struct drm_block { int unused; }; /* * DRM_IOCTL_CONTROL ioctl argument type. * * \sa drmCtlInstHandler() and drmCtlUninstHandler(). */ struct drm_control { enum { DRM_ADD_COMMAND, DRM_RM_COMMAND, DRM_INST_HANDLER, DRM_UNINST_HANDLER } func; int irq; }; /* * Type of memory to map. */ enum drm_map_type { _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ _DRM_REGISTERS = 1, /**< no caching, no core dump */ _DRM_SHM = 2, /**< shared, cached */ _DRM_AGP = 3, /**< AGP/GART */ _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ }; /* * Memory mapping flags. */ enum drm_map_flags { _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ _DRM_READ_ONLY = 0x02, _DRM_LOCKED = 0x04, /**< shared, cached, locked */ _DRM_KERNEL = 0x08, /**< kernel requires access */ _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ _DRM_REMOVABLE = 0x40, /**< Removable mapping */ _DRM_DRIVER = 0x80 /**< Managed by driver */ }; struct drm_ctx_priv_map { unsigned int ctx_id; /**< Context requesting private mapping */ void *handle; /**< Handle of map */ }; /* * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls * argument type. * * \sa drmAddMap(). */ struct drm_map { unsigned long offset; /**< Requested physical address (0 for SAREA)*/ unsigned long size; /**< Requested physical size (bytes) */ enum drm_map_type type; /**< Type of memory to map */ enum drm_map_flags flags; /**< Flags */ void *handle; /**< User-space: "Handle" to pass to mmap() */ /**< Kernel-space: kernel-virtual address */ int mtrr; /**< MTRR slot used */ /* Private data */ }; /* * DRM_IOCTL_GET_CLIENT ioctl argument type. */ struct drm_client { int idx; /**< Which client desired? */ int auth; /**< Is client authenticated? */ unsigned long pid; /**< Process ID */ unsigned long uid; /**< User ID */ unsigned long magic; /**< Magic */ unsigned long iocs; /**< Ioctl count */ }; enum drm_stat_type { _DRM_STAT_LOCK, _DRM_STAT_OPENS, _DRM_STAT_CLOSES, _DRM_STAT_IOCTLS, _DRM_STAT_LOCKS, _DRM_STAT_UNLOCKS, _DRM_STAT_VALUE, /**< Generic value */ _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ _DRM_STAT_IRQ, /**< IRQ */ _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ _DRM_STAT_DMA, /**< DMA */ _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /**< Missed DMA opportunity */ /* Add to the *END* of the list */ }; /* * DRM_IOCTL_GET_STATS ioctl argument type. */ struct drm_stats { unsigned long count; struct { unsigned long value; enum drm_stat_type type; } data[15]; }; /* * Hardware locking flags. */ enum drm_lock_flags { _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ /* These *HALT* flags aren't supported yet -- they will be used to support the full-screen DGA-like mode. */ _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ }; /* * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. * * \sa drmGetLock() and drmUnlock(). */ struct drm_lock { int context; enum drm_lock_flags flags; }; /* * DMA flags * * \warning * These values \e must match xf86drm.h. * * \sa drm_dma. */ enum drm_dma_flags { /* Flags for DMA buffer dispatch */ _DRM_DMA_BLOCK = 0x01, /**< * Block until buffer dispatched. * * \note The buffer may not yet have * been processed by the hardware -- * getting a hardware lock with the * hardware quiescent will ensure * that the buffer has been * processed. */ _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ /* Flags for DMA buffer request */ _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ }; /* * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. * * \sa drmAddBufs(). */ struct drm_buf_desc { int count; /**< Number of buffers of this size */ int size; /**< Size in bytes */ int low_mark; /**< Low water mark */ int high_mark; /**< High water mark */ enum { _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ } flags; unsigned long agp_start; /**< * Start address of where the AGP buffers are * in the AGP aperture */ }; /* * DRM_IOCTL_INFO_BUFS ioctl argument type. */ struct drm_buf_info { int count; /**< Entries in list */ struct drm_buf_desc *list; }; /* * DRM_IOCTL_FREE_BUFS ioctl argument type. */ struct drm_buf_free { int count; int *list; }; /* * Buffer information * * \sa drm_buf_map. */ struct drm_buf_pub { int idx; /**< Index into the master buffer list */ int total; /**< Buffer size */ int used; /**< Amount of buffer in use (for DMA) */ void *address; /**< Address of buffer */ }; /* * DRM_IOCTL_MAP_BUFS ioctl argument type. */ struct drm_buf_map { int count; /**< Length of the buffer list */ #ifdef __cplusplus void *virt; #else void *virtual; /**< Mmap'd area in user-virtual */ #endif struct drm_buf_pub *list; /**< Buffer information */ }; /* * DRM_IOCTL_DMA ioctl argument type. * * Indices here refer to the offset into the buffer list in drm_buf_get. * * \sa drmDMA(). */ struct drm_dma { int context; /**< Context handle */ int send_count; /**< Number of buffers to send */ int *send_indices; /**< List of handles to buffers */ int *send_sizes; /**< Lengths of data to send */ enum drm_dma_flags flags; /**< Flags */ int request_count; /**< Number of buffers requested */ int request_size; /**< Desired size for buffers */ int *request_indices; /**< Buffer information */ int *request_sizes; int granted_count; /**< Number of buffers granted */ }; enum drm_ctx_flags { _DRM_CONTEXT_PRESERVED = 0x01, _DRM_CONTEXT_2DONLY = 0x02 }; /* * DRM_IOCTL_ADD_CTX ioctl argument type. * * \sa drmCreateContext() and drmDestroyContext(). */ struct drm_ctx { drm_context_t handle; enum drm_ctx_flags flags; }; /* * DRM_IOCTL_RES_CTX ioctl argument type. */ struct drm_ctx_res { int count; struct drm_ctx *contexts; }; /* * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. */ struct drm_draw { drm_drawable_t handle; }; /* * DRM_IOCTL_UPDATE_DRAW ioctl argument type. */ typedef enum { DRM_DRAWABLE_CLIPRECTS } drm_drawable_info_type_t; struct drm_update_draw { drm_drawable_t handle; unsigned int type; unsigned int num; unsigned long long data; }; /* * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. */ struct drm_auth { drm_magic_t magic; }; /* * DRM_IOCTL_IRQ_BUSID ioctl argument type. * * \sa drmGetInterruptFromBusID(). */ struct drm_irq_busid { int irq; /**< IRQ number */ int busnum; /**< bus number */ int devnum; /**< device number */ int funcnum; /**< function number */ }; enum drm_vblank_seq_type { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ /* bits 1-6 are reserved for high crtcs */ _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ }; #define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) struct drm_wait_vblank_request { enum drm_vblank_seq_type type; unsigned int sequence; unsigned long signal; }; struct drm_wait_vblank_reply { enum drm_vblank_seq_type type; unsigned int sequence; long tval_sec; long tval_usec; }; /* * DRM_IOCTL_WAIT_VBLANK ioctl argument type. * * \sa drmWaitVBlank(). */ union drm_wait_vblank { struct drm_wait_vblank_request request; struct drm_wait_vblank_reply reply; }; #define _DRM_PRE_MODESET 1 #define _DRM_POST_MODESET 2 /* * DRM_IOCTL_MODESET_CTL ioctl argument type * * \sa drmModesetCtl(). */ struct drm_modeset_ctl { __u32 crtc; __u32 cmd; }; /* * DRM_IOCTL_AGP_ENABLE ioctl argument type. * * \sa drmAgpEnable(). */ struct drm_agp_mode { unsigned long mode; /**< AGP mode */ }; /* * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. * * \sa drmAgpAlloc() and drmAgpFree(). */ struct drm_agp_buffer { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for binding / unbinding */ unsigned long type; /**< Type of memory to allocate */ unsigned long physical; /**< Physical used by i810 */ }; /* * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. * * \sa drmAgpBind() and drmAgpUnbind(). */ struct drm_agp_binding { unsigned long handle; /**< From drm_agp_buffer */ unsigned long offset; /**< In bytes -- will round to page boundary */ }; /* * DRM_IOCTL_AGP_INFO ioctl argument type. * * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), * drmAgpVendorId() and drmAgpDeviceId(). */ struct drm_agp_info { int agp_version_major; int agp_version_minor; unsigned long mode; unsigned long aperture_base; /* physical address */ unsigned long aperture_size; /* bytes */ unsigned long memory_allowed; /* bytes */ unsigned long memory_used; /* PCI information */ unsigned short id_vendor; unsigned short id_device; }; /* * DRM_IOCTL_SG_ALLOC ioctl argument type. */ struct drm_scatter_gather { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for mapping / unmapping */ }; /* * DRM_IOCTL_SET_VERSION ioctl argument type. */ struct drm_set_version { int drm_di_major; int drm_di_minor; int drm_dd_major; int drm_dd_minor; }; /* DRM_IOCTL_GEM_CLOSE ioctl argument type */ struct drm_gem_close { /** Handle of the object to be closed. */ __u32 handle; __u32 pad; }; /* DRM_IOCTL_GEM_FLINK ioctl argument type */ struct drm_gem_flink { /** Handle for the object being named */ __u32 handle; /** Returned global name */ __u32 name; }; /* DRM_IOCTL_GEM_OPEN ioctl argument type */ struct drm_gem_open { /** Name of object being opened */ __u32 name; /** Returned handle for the object */ __u32 handle; /** Returned size of the object */ __u64 size; }; /** * DRM_CAP_DUMB_BUFFER * * If set to 1, the driver supports creating dumb buffers via the * &DRM_IOCTL_MODE_CREATE_DUMB ioctl. */ #define DRM_CAP_DUMB_BUFFER 0x1 /** * DRM_CAP_VBLANK_HIGH_CRTC * * If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>` * in the high bits of &drm_wait_vblank_request.type. * * Starting kernel version 2.6.39, this capability is always set to 1. */ #define DRM_CAP_VBLANK_HIGH_CRTC 0x2 /** * DRM_CAP_DUMB_PREFERRED_DEPTH * * The preferred bit depth for dumb buffers. * * The bit depth is the number of bits used to indicate the color of a single * pixel excluding any padding. This is different from the number of bits per * pixel. For instance, XRGB8888 has a bit depth of 24 but has 32 bits per * pixel. * * Note that this preference only applies to dumb buffers, it's irrelevant for * other types of buffers. */ #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 /** * DRM_CAP_DUMB_PREFER_SHADOW * * If set to 1, the driver prefers userspace to render to a shadow buffer * instead of directly rendering to a dumb buffer. For best speed, userspace * should do streaming ordered memory copies into the dumb buffer and never * read from it. * * Note that this preference only applies to dumb buffers, it's irrelevant for * other types of buffers. */ #define DRM_CAP_DUMB_PREFER_SHADOW 0x4 /** * DRM_CAP_PRIME * * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT * and &DRM_PRIME_CAP_EXPORT. * * PRIME buffers are exposed as dma-buf file descriptors. See * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing". */ #define DRM_CAP_PRIME 0x5 /** * DRM_PRIME_CAP_IMPORT * * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl. */ #define DRM_PRIME_CAP_IMPORT 0x1 /** * DRM_PRIME_CAP_EXPORT * * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl. */ #define DRM_PRIME_CAP_EXPORT 0x2 /** * DRM_CAP_TIMESTAMP_MONOTONIC * * If set to 0, the kernel will report timestamps with ``CLOCK_REALTIME`` in * struct drm_event_vblank. If set to 1, the kernel will report timestamps with * ``CLOCK_MONOTONIC``. See ``clock_gettime(2)`` for the definition of these * clocks. * * Starting from kernel version 2.6.39, the default value for this capability * is 1. Starting kernel version 4.15, this capability is always set to 1. */ #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 /** * DRM_CAP_ASYNC_PAGE_FLIP * * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC. */ #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 /** * DRM_CAP_CURSOR_WIDTH * * The ``CURSOR_WIDTH`` and ``CURSOR_HEIGHT`` capabilities return a valid * width x height combination for the hardware cursor. The intention is that a * hardware agnostic userspace can query a cursor plane size to use. * * Note that the cross-driver contract is to merely return a valid size; * drivers are free to attach another meaning on top, eg. i915 returns the * maximum plane size. */ #define DRM_CAP_CURSOR_WIDTH 0x8 /** * DRM_CAP_CURSOR_HEIGHT * * See &DRM_CAP_CURSOR_WIDTH. */ #define DRM_CAP_CURSOR_HEIGHT 0x9 /** * DRM_CAP_ADDFB2_MODIFIERS * * If set to 1, the driver supports supplying modifiers in the * &DRM_IOCTL_MODE_ADDFB2 ioctl. */ #define DRM_CAP_ADDFB2_MODIFIERS 0x10 /** * DRM_CAP_PAGE_FLIP_TARGET * * If set to 1, the driver supports the &DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE and * &DRM_MODE_PAGE_FLIP_TARGET_RELATIVE flags in * &drm_mode_crtc_page_flip_target.flags for the &DRM_IOCTL_MODE_PAGE_FLIP * ioctl. */ #define DRM_CAP_PAGE_FLIP_TARGET 0x11 /** * DRM_CAP_CRTC_IN_VBLANK_EVENT * * If set to 1, the kernel supports reporting the CRTC ID in * &drm_event_vblank.crtc_id for the &DRM_EVENT_VBLANK and * &DRM_EVENT_FLIP_COMPLETE events. * * Starting kernel version 4.12, this capability is always set to 1. */ #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 /** * DRM_CAP_SYNCOBJ * * If set to 1, the driver supports sync objects. See * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects". */ #define DRM_CAP_SYNCOBJ 0x13 /** * DRM_CAP_SYNCOBJ_TIMELINE * * If set to 1, the driver supports timeline operations on sync objects. See * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects". */ #define DRM_CAP_SYNCOBJ_TIMELINE 0x14 /* DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap { __u64 capability; __u64 value; }; /** * DRM_CLIENT_CAP_STEREO_3D * * If set to 1, the DRM core will expose the stereo 3D capabilities of the * monitor by advertising the supported 3D layouts in the flags of struct * drm_mode_modeinfo. See ``DRM_MODE_FLAG_3D_*``. * * This capability is always supported for all drivers starting from kernel * version 3.13. */ #define DRM_CLIENT_CAP_STEREO_3D 1 /** * DRM_CLIENT_CAP_UNIVERSAL_PLANES * * If set to 1, the DRM core will expose all planes (overlay, primary, and * cursor) to userspace. * * This capability has been introduced in kernel version 3.15. Starting from * kernel version 3.17, this capability is always supported for all drivers. */ #define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 /** * DRM_CLIENT_CAP_ATOMIC * * If set to 1, the DRM core will expose atomic properties to userspace. This * implicitly enables &DRM_CLIENT_CAP_UNIVERSAL_PLANES and * &DRM_CLIENT_CAP_ASPECT_RATIO. * * If the driver doesn't support atomic mode-setting, enabling this capability * will fail with -EOPNOTSUPP. * * This capability has been introduced in kernel version 4.0. Starting from * kernel version 4.2, this capability is always supported for atomic-capable * drivers. */ #define DRM_CLIENT_CAP_ATOMIC 3 /** * DRM_CLIENT_CAP_ASPECT_RATIO * * If set to 1, the DRM core will provide aspect ratio information in modes. * See ``DRM_MODE_FLAG_PIC_AR_*``. * * This capability is always supported for all drivers starting from kernel * version 4.18. */ #define DRM_CLIENT_CAP_ASPECT_RATIO 4 /** * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS * * If set to 1, the DRM core will expose special connectors to be used for * writing back to memory the scene setup in the commit. The client must enable * &DRM_CLIENT_CAP_ATOMIC first. * * This capability is always supported for atomic-capable drivers starting from * kernel version 4.19. */ #define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { __u64 capability; __u64 value; }; #define DRM_RDWR O_RDWR #define DRM_CLOEXEC O_CLOEXEC struct drm_prime_handle { __u32 handle; /** Flags.. only applicable for handle->fd */ __u32 flags; /** Returned dmabuf file descriptor */ __s32 fd; }; struct drm_syncobj_create { __u32 handle; #define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) __u32 flags; }; struct drm_syncobj_destroy { __u32 handle; __u32 pad; }; #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) struct drm_syncobj_handle { __u32 handle; __u32 flags; __s32 fd; __u32 pad; }; struct drm_syncobj_transfer { __u32 src_handle; __u32 dst_handle; __u64 src_point; __u64 dst_point; __u32 flags; __u32 pad; }; #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */ struct drm_syncobj_wait { __u64 handles; /* absolute timeout */ __s64 timeout_nsec; __u32 count_handles; __u32 flags; __u32 first_signaled; /* only valid when not waiting all */ __u32 pad; }; struct drm_syncobj_timeline_wait { __u64 handles; /* wait on specific timeline point for every handles*/ __u64 points; /* absolute timeout */ __s64 timeout_nsec; __u32 count_handles; __u32 flags; __u32 first_signaled; /* only valid when not waiting all */ __u32 pad; }; struct drm_syncobj_array { __u64 handles; __u32 count_handles; __u32 pad; }; #define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */ struct drm_syncobj_timeline_array { __u64 handles; __u64 points; __u32 count_handles; __u32 flags; }; /* Query current scanout sequence number */ struct drm_crtc_get_sequence { __u32 crtc_id; /* requested crtc_id */ __u32 active; /* return: crtc output is active */ __u64 sequence; /* return: most recent vblank sequence */ __s64 sequence_ns; /* return: most recent time of first pixel out */ }; /* Queue event to be delivered at specified sequence. Time stamp marks * when the first pixel of the refresh cycle leaves the display engine * for the display */ #define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ #define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ struct drm_crtc_queue_sequence { __u32 crtc_id; __u32 flags; __u64 sequence; /* on input, target sequence. on output, actual sequence */ __u64 user_data; /* user data passed to event */ }; #if defined(__cplusplus) } #endif #include "drm_mode.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) #define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) #define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) #define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) #define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) /** * DRM_IOCTL_MODE_RMFB - Remove a framebuffer. * * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL * argument is a framebuffer object ID. * * Warning: removing a framebuffer currently in-use on an enabled plane will * disable that plane. The CRTC the plane is linked to may also be disabled * (depending on driver capabilities). */ #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) #define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) #define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) #define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) #define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) #define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) #define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) #define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) #define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) #define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) #define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) #define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) /** * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata. * * This queries metadata about a framebuffer. User-space fills * &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the * struct as the output. * * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles * will be filled with GEM buffer handles. Planes are valid until one has a * zero handle -- this can be used to compute the number of planes. * * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid * until one has a zero &drm_mode_fb_cmd2.pitches. * * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier. */ #define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) /* * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. * Generic IOCTLS restart at 0xA0. * * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and * drmCommandReadWrite(). */ #define DRM_COMMAND_BASE 0x40 #define DRM_COMMAND_END 0xA0 /* * Header for events written back to userspace on the drm fd. The * type defines the type of event, the length specifies the total * length of the event (including the header), and user_data is * typically a 64 bit value passed with the ioctl that triggered the * event. A read on the drm fd will always only return complete * events, that is, if for example the read buffer is 100 bytes, and * there are two 64 byte events pending, only one will be returned. * * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and * up are chipset specific. */ struct drm_event { __u32 type; __u32 length; }; #define DRM_EVENT_VBLANK 0x01 #define DRM_EVENT_FLIP_COMPLETE 0x02 #define DRM_EVENT_CRTC_SEQUENCE 0x03 struct drm_event_vblank { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 sequence; __u32 crtc_id; /* 0 on older kernels that do not support this */ }; /* Event delivered at sequence. Time stamp marks when the first pixel * of the refresh cycle leaves the display engine for the display */ struct drm_event_crtc_sequence { struct drm_event base; __u64 user_data; __s64 time_ns; __u64 sequence; }; /* typedef area */ typedef struct drm_clip_rect drm_clip_rect_t; typedef struct drm_drawable_info drm_drawable_info_t; typedef struct drm_tex_region drm_tex_region_t; typedef struct drm_hw_lock drm_hw_lock_t; typedef struct drm_version drm_version_t; typedef struct drm_unique drm_unique_t; typedef struct drm_list drm_list_t; typedef struct drm_block drm_block_t; typedef struct drm_control drm_control_t; typedef enum drm_map_type drm_map_type_t; typedef enum drm_map_flags drm_map_flags_t; typedef struct drm_ctx_priv_map drm_ctx_priv_map_t; typedef struct drm_map drm_map_t; typedef struct drm_client drm_client_t; typedef enum drm_stat_type drm_stat_type_t; typedef struct drm_stats drm_stats_t; typedef enum drm_lock_flags drm_lock_flags_t; typedef struct drm_lock drm_lock_t; typedef enum drm_dma_flags drm_dma_flags_t; typedef struct drm_buf_desc drm_buf_desc_t; typedef struct drm_buf_info drm_buf_info_t; typedef struct drm_buf_free drm_buf_free_t; typedef struct drm_buf_pub drm_buf_pub_t; typedef struct drm_buf_map drm_buf_map_t; typedef struct drm_dma drm_dma_t; typedef union drm_wait_vblank drm_wait_vblank_t; typedef struct drm_agp_mode drm_agp_mode_t; typedef enum drm_ctx_flags drm_ctx_flags_t; typedef struct drm_ctx drm_ctx_t; typedef struct drm_ctx_res drm_ctx_res_t; typedef struct drm_draw drm_draw_t; typedef struct drm_update_draw drm_update_draw_t; typedef struct drm_auth drm_auth_t; typedef struct drm_irq_busid drm_irq_busid_t; typedef enum drm_vblank_seq_type drm_vblank_seq_type_t; typedef struct drm_agp_buffer drm_agp_buffer_t; typedef struct drm_agp_binding drm_agp_binding_t; typedef struct drm_agp_info drm_agp_info_t; typedef struct drm_scatter_gather drm_scatter_gather_t; typedef struct drm_set_version drm_set_version_t; #if defined(__cplusplus) } #endif #endif drm/drm_fourcc.h 0000644 00000202040 15063602045 0007621 0 ustar 00 /* * Copyright 2011 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /** * DOC: overview * * In the DRM subsystem, framebuffer pixel formats are described using the * fourcc codes defined in `include/uapi/drm/drm_fourcc.h`. In addition to the * fourcc code, a Format Modifier may optionally be provided, in order to * further describe the buffer's format - for example tiling or compression. * * Format Modifiers * ---------------- * * Format modifiers are used in conjunction with a fourcc code, forming a * unique fourcc:modifier pair. This format:modifier pair must fully define the * format and data layout of the buffer, and should be the only way to describe * that particular buffer. * * Having multiple fourcc:modifier pairs which describe the same layout should * be avoided, as such aliases run the risk of different drivers exposing * different names for the same data format, forcing userspace to understand * that they are aliases. * * Format modifiers may change any property of the buffer, including the number * of planes and/or the required allocation size. Format modifiers are * vendor-namespaced, and as such the relationship between a fourcc code and a * modifier is specific to the modifer being used. For example, some modifiers * may preserve meaning - such as number of planes - from the fourcc code, * whereas others may not. * * Modifiers must uniquely encode buffer layout. In other words, a buffer must * match only a single modifier. A modifier must not be a subset of layouts of * another modifier. For instance, it's incorrect to encode pitch alignment in * a modifier: a buffer may match a 64-pixel aligned modifier and a 32-pixel * aligned modifier. That said, modifiers can have implicit minimal * requirements. * * For modifiers where the combination of fourcc code and modifier can alias, * a canonical pair needs to be defined and used by all drivers. Preferred * combinations are also encouraged where all combinations might lead to * confusion and unnecessarily reduced interoperability. An example for the * latter is AFBC, where the ABGR layouts are preferred over ARGB layouts. * * There are two kinds of modifier users: * * - Kernel and user-space drivers: for drivers it's important that modifiers * don't alias, otherwise two drivers might support the same format but use * different aliases, preventing them from sharing buffers in an efficient * format. * - Higher-level programs interfacing with KMS/GBM/EGL/Vulkan/etc: these users * see modifiers as opaque tokens they can check for equality and intersect. * These users musn't need to know to reason about the modifier value * (i.e. they are not expected to extract information out of the modifier). * * Vendors should document their modifier usage in as much detail as * possible, to ensure maximum compatibility across devices, drivers and * applications. * * The authoritative list of format modifier codes is found in * `include/uapi/drm/drm_fourcc.h` * * Open Source User Waiver * ----------------------- * * Because this is the authoritative source for pixel formats and modifiers * referenced by GL, Vulkan extensions and other standards and hence used both * by open source and closed source driver stacks, the usual requirement for an * upstream in-kernel or open source userspace user does not apply. * * To ensure, as much as feasible, compatibility across stacks and avoid * confusion with incompatible enumerations stakeholders for all relevant driver * stacks should approve additions. */ #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ ((__u32)(c) << 16) | ((__u32)(d) << 24)) #define DRM_FORMAT_BIG_ENDIAN (1U<<31) /* format is big endian instead of little endian */ /* Reserve 0 for the invalid format specifier */ #define DRM_FORMAT_INVALID 0 /* color index */ #define DRM_FORMAT_C1 fourcc_code('C', '1', ' ', ' ') /* [7:0] C0:C1:C2:C3:C4:C5:C6:C7 1:1:1:1:1:1:1:1 eight pixels/byte */ #define DRM_FORMAT_C2 fourcc_code('C', '2', ' ', ' ') /* [7:0] C0:C1:C2:C3 2:2:2:2 four pixels/byte */ #define DRM_FORMAT_C4 fourcc_code('C', '4', ' ', ' ') /* [7:0] C0:C1 4:4 two pixels/byte */ #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ /* 1 bpp Darkness (inverse relationship between channel value and brightness) */ #define DRM_FORMAT_D1 fourcc_code('D', '1', ' ', ' ') /* [7:0] D0:D1:D2:D3:D4:D5:D6:D7 1:1:1:1:1:1:1:1 eight pixels/byte */ /* 2 bpp Darkness (inverse relationship between channel value and brightness) */ #define DRM_FORMAT_D2 fourcc_code('D', '2', ' ', ' ') /* [7:0] D0:D1:D2:D3 2:2:2:2 four pixels/byte */ /* 4 bpp Darkness (inverse relationship between channel value and brightness) */ #define DRM_FORMAT_D4 fourcc_code('D', '4', ' ', ' ') /* [7:0] D0:D1 4:4 two pixels/byte */ /* 8 bpp Darkness (inverse relationship between channel value and brightness) */ #define DRM_FORMAT_D8 fourcc_code('D', '8', ' ', ' ') /* [7:0] D */ /* 1 bpp Red (direct relationship between channel value and brightness) */ #define DRM_FORMAT_R1 fourcc_code('R', '1', ' ', ' ') /* [7:0] R0:R1:R2:R3:R4:R5:R6:R7 1:1:1:1:1:1:1:1 eight pixels/byte */ /* 2 bpp Red (direct relationship between channel value and brightness) */ #define DRM_FORMAT_R2 fourcc_code('R', '2', ' ', ' ') /* [7:0] R0:R1:R2:R3 2:2:2:2 four pixels/byte */ /* 4 bpp Red (direct relationship between channel value and brightness) */ #define DRM_FORMAT_R4 fourcc_code('R', '4', ' ', ' ') /* [7:0] R0:R1 4:4 two pixels/byte */ /* 8 bpp Red (direct relationship between channel value and brightness) */ #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ /* 10 bpp Red (direct relationship between channel value and brightness) */ #define DRM_FORMAT_R10 fourcc_code('R', '1', '0', ' ') /* [15:0] x:R 6:10 little endian */ /* 12 bpp Red (direct relationship between channel value and brightness) */ #define DRM_FORMAT_R12 fourcc_code('R', '1', '2', ' ') /* [15:0] x:R 4:12 little endian */ /* 16 bpp Red (direct relationship between channel value and brightness) */ #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ /* 16 bpp RG */ #define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ #define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ /* 32 bpp RG */ #define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */ #define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */ /* 8 bpp RGB */ #define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ #define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ /* 16 bpp RGB */ #define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ #define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ #define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ #define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ #define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ #define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ #define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ #define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ #define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ #define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ #define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ #define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ #define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ #define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ #define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ #define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ #define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ #define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ /* 24 bpp RGB */ #define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ #define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ /* 32 bpp RGB */ #define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ #define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ #define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ #define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ #define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ #define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ #define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ #define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ #define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ #define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ #define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ #define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ #define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ #define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ /* 64 bpp RGB */ #define DRM_FORMAT_XRGB16161616 fourcc_code('X', 'R', '4', '8') /* [63:0] x:R:G:B 16:16:16:16 little endian */ #define DRM_FORMAT_XBGR16161616 fourcc_code('X', 'B', '4', '8') /* [63:0] x:B:G:R 16:16:16:16 little endian */ #define DRM_FORMAT_ARGB16161616 fourcc_code('A', 'R', '4', '8') /* [63:0] A:R:G:B 16:16:16:16 little endian */ #define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8') /* [63:0] A:B:G:R 16:16:16:16 little endian */ /* * Floating point 64bpp RGB * IEEE 754-2008 binary16 half-precision float * [15:0] sign:exponent:mantissa 1:5:10 */ #define DRM_FORMAT_XRGB16161616F fourcc_code('X', 'R', '4', 'H') /* [63:0] x:R:G:B 16:16:16:16 little endian */ #define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H') /* [63:0] x:B:G:R 16:16:16:16 little endian */ #define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */ #define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */ /* * RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits * of unused padding per component: */ #define DRM_FORMAT_AXBXGXRX106106106106 fourcc_code('A', 'B', '1', '0') /* [63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian */ /* packed YCbCr */ #define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ #define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ #define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ #define DRM_FORMAT_AVUY8888 fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */ #define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */ #define DRM_FORMAT_XVUY8888 fourcc_code('X', 'V', 'U', 'Y') /* [31:0] X:Cr:Cb:Y 8:8:8:8 little endian */ #define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */ #define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */ /* * packed Y2xx indicate for each component, xx valid data occupy msb * 16-xx padding occupy lsb */ #define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels */ #define DRM_FORMAT_Y212 fourcc_code('Y', '2', '1', '2') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels */ #define DRM_FORMAT_Y216 fourcc_code('Y', '2', '1', '6') /* [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels */ /* * packed Y4xx indicate for each component, xx valid data occupy msb * 16-xx padding occupy lsb except Y410 */ #define DRM_FORMAT_Y410 fourcc_code('Y', '4', '1', '0') /* [31:0] A:Cr:Y:Cb 2:10:10:10 little endian */ #define DRM_FORMAT_Y412 fourcc_code('Y', '4', '1', '2') /* [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */ #define DRM_FORMAT_Y416 fourcc_code('Y', '4', '1', '6') /* [63:0] A:Cr:Y:Cb 16:16:16:16 little endian */ #define DRM_FORMAT_XVYU2101010 fourcc_code('X', 'V', '3', '0') /* [31:0] X:Cr:Y:Cb 2:10:10:10 little endian */ #define DRM_FORMAT_XVYU12_16161616 fourcc_code('X', 'V', '3', '6') /* [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */ #define DRM_FORMAT_XVYU16161616 fourcc_code('X', 'V', '4', '8') /* [63:0] X:Cr:Y:Cb 16:16:16:16 little endian */ /* * packed YCbCr420 2x2 tiled formats * first 64 bits will contain Y,Cb,Cr components for a 2x2 tile */ /* [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */ #define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0') /* [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */ #define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0') /* [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ #define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2') /* [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */ #define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2') /* * 1-plane YUV 4:2:0 * In these formats, the component ordering is specified (Y, followed by U * then V), but the exact Linear layout is undefined. * These formats can only be used with a non-Linear modifier. */ #define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') #define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') /* * 2 plane RGB + A * index 0 = RGB plane, same format as the corresponding non _A8 format has * index 1 = A plane, [7:0] A */ #define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8') #define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8') #define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8') #define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8') #define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8') #define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8') #define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8') #define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8') /* * 2 plane YCbCr * index 0 = Y plane, [7:0] Y * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian * or * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian */ #define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ /* * 2 plane YCbCr * index 0 = Y plane, [39:0] Y3:Y2:Y1:Y0 little endian * index 1 = Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian */ #define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled Cr:Cb plane */ /* * 2 plane YCbCr MSB aligned * index 0 = Y plane, [15:0] Y:x [10:6] little endian * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian */ #define DRM_FORMAT_P210 fourcc_code('P', '2', '1', '0') /* 2x1 subsampled Cr:Cb plane, 10 bit per channel */ /* * 2 plane YCbCr MSB aligned * index 0 = Y plane, [15:0] Y:x [10:6] little endian * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian */ #define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel */ /* * 2 plane YCbCr MSB aligned * index 0 = Y plane, [15:0] Y:x [12:4] little endian * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [12:4:12:4] little endian */ #define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cr:Cb plane 12 bits per channel */ /* * 2 plane YCbCr MSB aligned * index 0 = Y plane, [15:0] Y little endian * index 1 = Cr:Cb plane, [31:0] Cr:Cb [16:16] little endian */ #define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */ /* 2 plane YCbCr420. * 3 10 bit components and 2 padding bits packed into 4 bytes. * index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian * index 1 = Cr:Cb plane, [63:0] x:Cr2:Cb2:Cr1:x:Cb1:Cr0:Cb0 [2:10:10:10:2:10:10:10] little endian */ #define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel packed */ /* 3 plane non-subsampled (444) YCbCr * 16 bits per component, but only 10 bits are used and 6 bits are padded * index 0: Y plane, [15:0] Y:x [10:6] little endian * index 1: Cb plane, [15:0] Cb:x [10:6] little endian * index 2: Cr plane, [15:0] Cr:x [10:6] little endian */ #define DRM_FORMAT_Q410 fourcc_code('Q', '4', '1', '0') /* 3 plane non-subsampled (444) YCrCb * 16 bits per component, but only 10 bits are used and 6 bits are padded * index 0: Y plane, [15:0] Y:x [10:6] little endian * index 1: Cr plane, [15:0] Cr:x [10:6] little endian * index 2: Cb plane, [15:0] Cb:x [10:6] little endian */ #define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') /* * 3 plane YCbCr * index 0: Y plane, [7:0] Y * index 1: Cb plane, [7:0] Cb * index 2: Cr plane, [7:0] Cr * or * index 1: Cr plane, [7:0] Cr * index 2: Cb plane, [7:0] Cb */ #define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ /* * Format Modifiers: * * Format modifiers describe, typically, a re-ordering or modification * of the data in a plane of an FB. This can be used to express tiled/ * swizzled formats, or compression, or a combination of the two. * * The upper 8 bits of the format modifier are a vendor-id as assigned * below. The lower 56 bits are assigned as vendor sees fit. */ /* Vendor Ids: */ #define DRM_FORMAT_MOD_VENDOR_NONE 0 #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 #define DRM_FORMAT_MOD_VENDOR_AMD 0x02 #define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 #define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 #define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 #define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a /* add more to the end as needed */ #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) #define fourcc_mod_get_vendor(modifier) \ (((modifier) >> 56) & 0xff) #define fourcc_mod_is_vendor(modifier, vendor) \ (fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor) #define fourcc_mod_code(vendor, val) \ ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) /* * Format Modifier tokens: * * When adding a new token please document the layout with a code comment, * similar to the fourcc codes above. drm_fourcc.h is considered the * authoritative source for all of these. * * Generic modifier names: * * DRM_FORMAT_MOD_GENERIC_* definitions are used to provide vendor-neutral names * for layouts which are common across multiple vendors. To preserve * compatibility, in cases where a vendor-specific definition already exists and * a generic name for it is desired, the common name is a purely symbolic alias * and must use the same numerical value as the original definition. * * Note that generic names should only be used for modifiers which describe * generic layouts (such as pixel re-ordering), which may have * independently-developed support across multiple vendors. * * In future cases where a generic layout is identified before merging with a * vendor-specific modifier, a new 'GENERIC' vendor or modifier using vendor * 'NONE' could be considered. This should only be for obvious, exceptional * cases to avoid polluting the 'GENERIC' namespace with modifiers which only * apply to a single vendor. * * Generic names should not be used for cases where multiple hardware vendors * have implementations of the same standardised compression scheme (such as * AFBC). In those cases, all implementations should use the same format * modifier(s), reflecting the vendor of the standard. */ #define DRM_FORMAT_MOD_GENERIC_16_16_TILE DRM_FORMAT_MOD_SAMSUNG_16_16_TILE /* * Invalid Modifier * * This modifier can be used as a sentinel to terminate the format modifiers * list, or to initialize a variable with an invalid modifier. It might also be * used to report an error back to userspace for certain APIs. */ #define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) /* * Linear Layout * * Just plain linear layout. Note that this is different from no specifying any * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl), * which tells the driver to also take driver-internal information into account * and so might actually result in a tiled framebuffer. */ #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) /* * Deprecated: use DRM_FORMAT_MOD_LINEAR instead * * The "none" format modifier doesn't actually mean that the modifier is * implicit, instead it means that the layout is linear. Whether modifiers are * used is out-of-band information carried in an API-specific way (e.g. in a * flag for drm_mode_fb_cmd2). */ #define DRM_FORMAT_MOD_NONE 0 /* Intel framebuffer modifiers */ /* * Intel X-tiling layout * * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) * in row-major layout. Within the tile bytes are laid out row-major, with * a platform-dependent stride. On top of that the memory can apply * platform-depending swizzling of some higher address bits into bit6. * * Note that this layout is only accurate on intel gen 8+ or valleyview chipsets. * On earlier platforms the is highly platforms specific and not useful for * cross-driver sharing. It exists since on a given platform it does uniquely * identify the layout in a simple way for i915-specific userspace, which * facilitated conversion of userspace to modifiers. Additionally the exact * format on some really old platforms is not known. */ #define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1) /* * Intel Y-tiling layout * * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes) * chunks column-major, with a platform-dependent height. On top of that the * memory can apply platform-depending swizzling of some higher address bits * into bit6. * * Note that this layout is only accurate on intel gen 8+ or valleyview chipsets. * On earlier platforms the is highly platforms specific and not useful for * cross-driver sharing. It exists since on a given platform it does uniquely * identify the layout in a simple way for i915-specific userspace, which * facilitated conversion of userspace to modifiers. Additionally the exact * format on some really old platforms is not known. */ #define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2) /* * Intel Yf-tiling layout * * This is a tiled layout using 4Kb tiles in row-major layout. * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which * are arranged in four groups (two wide, two high) with column-major layout. * Each group therefore consits out of four 256 byte units, which are also laid * out as 2x2 column-major. * 256 byte units are made out of four 64 byte blocks of pixels, producing * either a square block or a 2:1 unit. * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width * in pixel depends on the pixel depth. */ #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) /* * Intel color control surface (CCS) for render compression * * The framebuffer format must be one of the 8:8:8:8 RGB formats. * The main surface will be plane index 0 and must be Y/Yf-tiled, * the CCS will be plane index 1. * * Each CCS tile matches a 1024x512 pixel area of the main surface. * To match certain aspects of the 3D hardware the CCS is * considered to be made up of normal 128Bx32 Y tiles, Thus * the CCS pitch must be specified in multiples of 128 bytes. * * In reality the CCS tile appears to be a 64Bx64 Y tile, composed * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks. * But that fact is not relevant unless the memory is accessed * directly. */ #define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4) #define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5) /* * Intel color control surfaces (CCS) for Gen-12 render compression. * * The main surface is Y-tiled and at plane index 0, the CCS is linear and * at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in * main surface. In other words, 4 bits in CCS map to a main surface cache * line pair. The main surface pitch is required to be a multiple of four * Y-tile widths. */ #define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS fourcc_mod_code(INTEL, 6) /* * Intel color control surfaces (CCS) for Gen-12 media compression * * The main surface is Y-tiled and at plane index 0, the CCS is linear and * at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in * main surface. In other words, 4 bits in CCS map to a main surface cache * line pair. The main surface pitch is required to be a multiple of four * Y-tile widths. For semi-planar formats like NV12, CCS planes follow the * Y and UV planes i.e., planes 0 and 1 are used for Y and UV surfaces, * planes 2 and 3 for the respective CCS. */ #define I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS fourcc_mod_code(INTEL, 7) /* * Intel Color Control Surface with Clear Color (CCS) for Gen-12 render * compression. * * The main surface is Y-tiled and is at plane index 0 whereas CCS is linear * and at index 1. The clear color is stored at index 2, and the pitch should * be 64 bytes aligned. The clear color structure is 256 bits. The first 128 bits * represents Raw Clear Color Red, Green, Blue and Alpha color each represented * by 32 bits. The raw clear color is consumed by the 3d engine and generates * the converted clear color of size 64 bits. The first 32 bits store the Lower * Converted Clear Color value and the next 32 bits store the Higher Converted * Clear Color value when applicable. The Converted Clear Color values are * consumed by the DE. The last 64 bits are used to store Color Discard Enable * and Depth Clear Value Valid which are ignored by the DE. A CCS cache line * corresponds to an area of 4x1 tiles in the main surface. The main surface * pitch is required to be a multiple of 4 tile widths. */ #define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC fourcc_mod_code(INTEL, 8) /* * Intel Tile 4 layout * * This is a tiled layout using 4KB tiles in a row-major layout. It has the same * shape as Tile Y at two granularities: 4KB (128B x 32) and 64B (16B x 4). It * only differs from Tile Y at the 256B granularity in between. At this * granularity, Tile Y has a shape of 16B x 32 rows, but this tiling has a shape * of 64B x 8 rows. */ #define I915_FORMAT_MOD_4_TILED fourcc_mod_code(INTEL, 9) /* * Intel color control surfaces (CCS) for DG2 render compression. * * The main surface is Tile 4 and at plane index 0. The CCS data is stored * outside of the GEM object in a reserved memory area dedicated for the * storage of the CCS data for all RC/RC_CC/MC compressible GEM objects. The * main surface pitch is required to be a multiple of four Tile 4 widths. */ #define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS fourcc_mod_code(INTEL, 10) /* * Intel color control surfaces (CCS) for DG2 media compression. * * The main surface is Tile 4 and at plane index 0. For semi-planar formats * like NV12, the Y and UV planes are Tile 4 and are located at plane indices * 0 and 1, respectively. The CCS for all planes are stored outside of the * GEM object in a reserved memory area dedicated for the storage of the * CCS data for all RC/RC_CC/MC compressible GEM objects. The main surface * pitch is required to be a multiple of four Tile 4 widths. */ #define I915_FORMAT_MOD_4_TILED_DG2_MC_CCS fourcc_mod_code(INTEL, 11) /* * Intel Color Control Surface with Clear Color (CCS) for DG2 render compression. * * The main surface is Tile 4 and at plane index 0. The CCS data is stored * outside of the GEM object in a reserved memory area dedicated for the * storage of the CCS data for all RC/RC_CC/MC compressible GEM objects. The * main surface pitch is required to be a multiple of four Tile 4 widths. The * clear color is stored at plane index 1 and the pitch should be 64 bytes * aligned. The format of the 256 bits of clear color data matches the one used * for the I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC modifier, see its description * for details. */ #define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC fourcc_mod_code(INTEL, 12) /* * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks * * Macroblocks are laid in a Z-shape, and each pixel data is following the * standard NV12 style. * As for NV12, an image is the result of two frame buffers: one for Y, * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer). * Alignment requirements are (for each buffer): * - multiple of 128 pixels for the width * - multiple of 32 pixels for the height * * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) /* * Tiled, 16 (pixels) x 16 (lines) - sized macroblocks * * This is a simple tiled layout using tiles of 16x16 pixels in a row-major * layout. For YCbCr formats Cb/Cr components are taken in such a way that * they correspond to their 16x16 luma block. */ #define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2) /* * Qualcomm Compressed Format * * Refers to a compressed variant of the base format that is compressed. * Implementation may be platform and base-format specific. * * Each macrotile consists of m x n (mostly 4 x 4) tiles. * Pixel data pitch/stride is aligned with macrotile width. * Pixel data height is aligned with macrotile height. * Entire pixel data buffer is aligned with 4k(bytes). */ #define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1) /* * Qualcomm Tiled Format * * Similar to DRM_FORMAT_MOD_QCOM_COMPRESSED but not compressed. * Implementation may be platform and base-format specific. * * Each macrotile consists of m x n (mostly 4 x 4) tiles. * Pixel data pitch/stride is aligned with macrotile width. * Pixel data height is aligned with macrotile height. * Entire pixel data buffer is aligned with 4k(bytes). */ #define DRM_FORMAT_MOD_QCOM_TILED3 fourcc_mod_code(QCOM, 3) /* * Qualcomm Alternate Tiled Format * * Alternate tiled format typically only used within GMEM. * Implementation may be platform and base-format specific. */ #define DRM_FORMAT_MOD_QCOM_TILED2 fourcc_mod_code(QCOM, 2) /* Vivante framebuffer modifiers */ /* * Vivante 4x4 tiling layout * * This is a simple tiled layout using tiles of 4x4 pixels in a row-major * layout. */ #define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1) /* * Vivante 64x64 super-tiling layout * * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row- * major layout. * * For more information: see * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling */ #define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2) /* * Vivante 4x4 tiling layout for dual-pipe * * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a * different base address. Offsets from the base addresses are therefore halved * compared to the non-split tiled layout. */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3) /* * Vivante 64x64 super-tiling layout for dual-pipe * * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile * starts at a different base address. Offsets from the base addresses are * therefore halved compared to the non-split super-tiled layout. */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) /* * Vivante TS (tile-status) buffer modifiers. They can be combined with all of * the color buffer tiling modifiers defined above. When TS is present it's a * separate buffer containing the clear/compression status of each tile. The * modifiers are defined as VIVANTE_MOD_TS_c_s, where c is the color buffer * tile size in bytes covered by one entry in the status buffer and s is the * number of status bits per entry. * We reserve the top 8 bits of the Vivante modifier space for tile status * clear/compression modifiers, as future cores might add some more TS layout * variations. */ #define VIVANTE_MOD_TS_64_4 (1ULL << 48) #define VIVANTE_MOD_TS_64_2 (2ULL << 48) #define VIVANTE_MOD_TS_128_4 (3ULL << 48) #define VIVANTE_MOD_TS_256_4 (4ULL << 48) #define VIVANTE_MOD_TS_MASK (0xfULL << 48) /* * Vivante compression modifiers. Those depend on a TS modifier being present * as the TS bits get reinterpreted as compression tags instead of simple * clear markers when compression is enabled. */ #define VIVANTE_MOD_COMP_DEC400 (1ULL << 52) #define VIVANTE_MOD_COMP_MASK (0xfULL << 52) /* Masking out the extension bits will yield the base modifier. */ #define VIVANTE_MOD_EXT_MASK (VIVANTE_MOD_TS_MASK | \ VIVANTE_MOD_COMP_MASK) /* NVIDIA frame buffer modifiers */ /* * Tegra Tiled Layout, used by Tegra 2, 3 and 4. * * Pixels are arranged in simple tiles of 16 x 16 bytes. */ #define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1) /* * Generalized Block Linear layout, used by desktop GPUs starting with NV50/G80, * and Tegra GPUs starting with Tegra K1. * * Pixels are arranged in Groups of Bytes (GOBs). GOB size and layout varies * based on the architecture generation. GOBs themselves are then arranged in * 3D blocks, with the block dimensions (in terms of GOBs) always being a power * of two, and hence expressible as their log2 equivalent (E.g., "2" represents * a block depth or height of "4"). * * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format * in full detail. * * Macro * Bits Param Description * ---- ----- ----------------------------------------------------------------- * * 3:0 h log2(height) of each block, in GOBs. Placed here for * compatibility with the existing * DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK()-based modifiers. * * 4:4 - Must be 1, to indicate block-linear layout. Necessary for * compatibility with the existing * DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK()-based modifiers. * * 8:5 - Reserved (To support 3D-surfaces with variable log2(depth) block * size). Must be zero. * * Note there is no log2(width) parameter. Some portions of the * hardware support a block width of two gobs, but it is impractical * to use due to lack of support elsewhere, and has no known * benefits. * * 11:9 - Reserved (To support 2D-array textures with variable array stride * in blocks, specified via log2(tile width in blocks)). Must be * zero. * * 19:12 k Page Kind. This value directly maps to a field in the page * tables of all GPUs >= NV50. It affects the exact layout of bits * in memory and can be derived from the tuple * * (format, GPU model, compression type, samples per pixel) * * Where compression type is defined below. If GPU model were * implied by the format modifier, format, or memory buffer, page * kind would not need to be included in the modifier itself, but * since the modifier should define the layout of the associated * memory buffer independent from any device or other context, it * must be included here. * * 21:20 g GOB Height and Page Kind Generation. The height of a GOB changed * starting with Fermi GPUs. Additionally, the mapping between page * kind and bit layout has changed at various points. * * 0 = Gob Height 8, Fermi - Volta, Tegra K1+ Page Kind mapping * 1 = Gob Height 4, G80 - GT2XX Page Kind mapping * 2 = Gob Height 8, Turing+ Page Kind mapping * 3 = Reserved for future use. * * 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further * bit remapping step that occurs at an even lower level than the * page kind and block linear swizzles. This causes the layout of * surfaces mapped in those SOC's GPUs to be incompatible with the * equivalent mapping on other GPUs in the same system. * * 0 = Tegra K1 - Tegra Parker/TX2 Layout. * 1 = Desktop GPU and Tegra Xavier+ Layout * * 25:23 c Lossless Framebuffer Compression type. * * 0 = none * 1 = ROP/3D, layout 1, exact compression format implied by Page * Kind field * 2 = ROP/3D, layout 2, exact compression format implied by Page * Kind field * 3 = CDE horizontal * 4 = CDE vertical * 5 = Reserved for future use * 6 = Reserved for future use * 7 = Reserved for future use * * 55:25 - Reserved for future use. Must be zero. */ #define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \ fourcc_mod_code(NVIDIA, (0x10 | \ ((h) & 0xf) | \ (((k) & 0xff) << 12) | \ (((g) & 0x3) << 20) | \ (((s) & 0x1) << 22) | \ (((c) & 0x7) << 23))) /* To grandfather in prior block linear format modifiers to the above layout, * the page kind "0", which corresponds to "pitch/linear" and hence is unusable * with block-linear layouts, is remapped within drivers to the value 0xfe, * which corresponds to the "generic" kind used for simple single-sample * uncompressed color formats on Fermi - Volta GPUs. */ static __inline__ __u64 drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) { if (!(modifier & 0x10) || (modifier & (0xff << 12))) return modifier; else return modifier | (0xfe << 12); } /* * 16Bx2 Block Linear layout, used by Tegra K1 and later * * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked * vertically by a power of 2 (1 to 32 GOBs) to form a block. * * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape. * * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically. * Valid values are: * * 0 == ONE_GOB * 1 == TWO_GOBS * 2 == FOUR_GOBS * 3 == EIGHT_GOBS * 4 == SIXTEEN_GOBS * 5 == THIRTYTWO_GOBS * * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format * in full detail. */ #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \ DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(0, 0, 0, 0, (v)) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB \ DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(0) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB \ DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(1) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB \ DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(2) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \ DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(3) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \ DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(4) #define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \ DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(5) /* * Some Broadcom modifiers take parameters, for example the number of * vertical lines in the image. Reserve the lower 32 bits for modifier * type, and the next 24 bits for parameters. Top 8 bits are the * vendor code. */ #define __fourcc_mod_broadcom_param_shift 8 #define __fourcc_mod_broadcom_param_bits 48 #define fourcc_mod_broadcom_code(val, params) \ fourcc_mod_code(BROADCOM, ((((__u64)params) << __fourcc_mod_broadcom_param_shift) | val)) #define fourcc_mod_broadcom_param(m) \ ((int)(((m) >> __fourcc_mod_broadcom_param_shift) & \ ((1ULL << __fourcc_mod_broadcom_param_bits) - 1))) #define fourcc_mod_broadcom_mod(m) \ ((m) & ~(((1ULL << __fourcc_mod_broadcom_param_bits) - 1) << \ __fourcc_mod_broadcom_param_shift)) /* * Broadcom VC4 "T" format * * This is the primary layout that the V3D GPU can texture from (it * can't do linear). The T format has: * * - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4 * pixels at 32 bit depth. * * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually * 16x16 pixels). * * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On * even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows * they're (TR, BR, BL, TL), where bottom left is start of memory. * * - an image made of 4k tiles in rows either left-to-right (even rows of 4k * tiles) or right-to-left (odd rows of 4k tiles). */ #define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1) /* * Broadcom SAND format * * This is the native format that the H.264 codec block uses. For VC4 * HVS, it is only valid for H.264 (NV12/21) and RGBA modes. * * The image can be considered to be split into columns, and the * columns are placed consecutively into memory. The width of those * columns can be either 32, 64, 128, or 256 pixels, but in practice * only 128 pixel columns are used. * * The pitch between the start of each column is set to optimally * switch between SDRAM banks. This is passed as the number of lines * of column width in the modifier (we can't use the stride value due * to various core checks that look at it , so you should set the * stride to width*cpp). * * Note that the column height for this format modifier is the same * for all of the planes, assuming that each column contains both Y * and UV. Some SAND-using hardware stores UV in a separate tiled * image from Y to reduce the column height, which is not supported * with these modifiers. * * The DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT modifier is also * supported for DRM_FORMAT_P030 where the columns remain as 128 bytes * wide, but as this is a 10 bpp format that translates to 96 pixels. */ #define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(2, v) #define DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(3, v) #define DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(4, v) #define DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(v) \ fourcc_mod_broadcom_code(5, v) #define DRM_FORMAT_MOD_BROADCOM_SAND32 \ DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(0) #define DRM_FORMAT_MOD_BROADCOM_SAND64 \ DRM_FORMAT_MOD_BROADCOM_SAND64_COL_HEIGHT(0) #define DRM_FORMAT_MOD_BROADCOM_SAND128 \ DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(0) #define DRM_FORMAT_MOD_BROADCOM_SAND256 \ DRM_FORMAT_MOD_BROADCOM_SAND256_COL_HEIGHT(0) /* Broadcom UIF format * * This is the common format for the current Broadcom multimedia * blocks, including V3D 3.x and newer, newer video codecs, and * displays. * * The image consists of utiles (64b blocks), UIF blocks (2x2 utiles), * and macroblocks (4x4 UIF blocks). Those 4x4 UIF block groups are * stored in columns, with padding between the columns to ensure that * moving from one column to the next doesn't hit the same SDRAM page * bank. * * To calculate the padding, it is assumed that each hardware block * and the software driving it knows the platform's SDRAM page size, * number of banks, and XOR address, and that it's identical between * all blocks using the format. This tiling modifier will use XOR as * necessary to reduce the padding. If a hardware block can't do XOR, * the assumption is that a no-XOR tiling modifier will be created. */ #define DRM_FORMAT_MOD_BROADCOM_UIF fourcc_mod_code(BROADCOM, 6) /* * Arm Framebuffer Compression (AFBC) modifiers * * AFBC is a proprietary lossless image compression protocol and format. * It provides fine-grained random access and minimizes the amount of data * transferred between IP blocks. * * AFBC has several features which may be supported and/or used, which are * represented using bits in the modifier. Not all combinations are valid, * and different devices or use-cases may support different combinations. * * Further information on the use of AFBC modifiers can be found in * Documentation/gpu/afbc.rst */ /* * The top 4 bits (out of the 56 bits alloted for specifying vendor specific * modifiers) denote the category for modifiers. Currently we have three * categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of * sixteen different categories. */ #define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \ fourcc_mod_code(ARM, ((__u64)(__type) << 52) | ((__val) & 0x000fffffffffffffULL)) #define DRM_FORMAT_MOD_ARM_TYPE_AFBC 0x00 #define DRM_FORMAT_MOD_ARM_TYPE_MISC 0x01 #define DRM_FORMAT_MOD_ARM_AFBC(__afbc_mode) \ DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFBC, __afbc_mode) /* * AFBC superblock size * * Indicates the superblock size(s) used for the AFBC buffer. The buffer * size (in pixels) must be aligned to a multiple of the superblock size. * Four lowest significant bits(LSBs) are reserved for block size. * * Where one superblock size is specified, it applies to all planes of the * buffer (e.g. 16x16, 32x8). When multiple superblock sizes are specified, * the first applies to the Luma plane and the second applies to the Chroma * plane(s). e.g. (32x8_64x4 means 32x8 Luma, with 64x4 Chroma). * Multiple superblock sizes are only valid for multi-plane YCbCr formats. */ #define AFBC_FORMAT_MOD_BLOCK_SIZE_MASK 0xf #define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL) #define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 (2ULL) #define AFBC_FORMAT_MOD_BLOCK_SIZE_64x4 (3ULL) #define AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4 (4ULL) /* * AFBC lossless colorspace transform * * Indicates that the buffer makes use of the AFBC lossless colorspace * transform. */ #define AFBC_FORMAT_MOD_YTR (1ULL << 4) /* * AFBC block-split * * Indicates that the payload of each superblock is split. The second * half of the payload is positioned at a predefined offset from the start * of the superblock payload. */ #define AFBC_FORMAT_MOD_SPLIT (1ULL << 5) /* * AFBC sparse layout * * This flag indicates that the payload of each superblock must be stored at a * predefined position relative to the other superblocks in the same AFBC * buffer. This order is the same order used by the header buffer. In this mode * each superblock is given the same amount of space as an uncompressed * superblock of the particular format would require, rounding up to the next * multiple of 128 bytes in size. */ #define AFBC_FORMAT_MOD_SPARSE (1ULL << 6) /* * AFBC copy-block restrict * * Buffers with this flag must obey the copy-block restriction. The restriction * is such that there are no copy-blocks referring across the border of 8x8 * blocks. For the subsampled data the 8x8 limitation is also subsampled. */ #define AFBC_FORMAT_MOD_CBR (1ULL << 7) /* * AFBC tiled layout * * The tiled layout groups superblocks in 8x8 or 4x4 tiles, where all * superblocks inside a tile are stored together in memory. 8x8 tiles are used * for pixel formats up to and including 32 bpp while 4x4 tiles are used for * larger bpp formats. The order between the tiles is scan line. * When the tiled layout is used, the buffer size (in pixels) must be aligned * to the tile size. */ #define AFBC_FORMAT_MOD_TILED (1ULL << 8) /* * AFBC solid color blocks * * Indicates that the buffer makes use of solid-color blocks, whereby bandwidth * can be reduced if a whole superblock is a single color. */ #define AFBC_FORMAT_MOD_SC (1ULL << 9) /* * AFBC double-buffer * * Indicates that the buffer is allocated in a layout safe for front-buffer * rendering. */ #define AFBC_FORMAT_MOD_DB (1ULL << 10) /* * AFBC buffer content hints * * Indicates that the buffer includes per-superblock content hints. */ #define AFBC_FORMAT_MOD_BCH (1ULL << 11) /* AFBC uncompressed storage mode * * Indicates that the buffer is using AFBC uncompressed storage mode. * In this mode all superblock payloads in the buffer use the uncompressed * storage mode, which is usually only used for data which cannot be compressed. * The buffer layout is the same as for AFBC buffers without USM set, this only * affects the storage mode of the individual superblocks. Note that even a * buffer without USM set may use uncompressed storage mode for some or all * superblocks, USM just guarantees it for all. */ #define AFBC_FORMAT_MOD_USM (1ULL << 12) /* * Arm Fixed-Rate Compression (AFRC) modifiers * * AFRC is a proprietary fixed rate image compression protocol and format, * designed to provide guaranteed bandwidth and memory footprint * reductions in graphics and media use-cases. * * AFRC buffers consist of one or more planes, with the same components * and meaning as an uncompressed buffer using the same pixel format. * * Within each plane, the pixel/luma/chroma values are grouped into * "coding unit" blocks which are individually compressed to a * fixed size (in bytes). All coding units within a given plane of a buffer * store the same number of values, and have the same compressed size. * * The coding unit size is configurable, allowing different rates of compression. * * The start of each AFRC buffer plane must be aligned to an alignment granule which * depends on the coding unit size. * * Coding Unit Size Plane Alignment * ---------------- --------------- * 16 bytes 1024 bytes * 24 bytes 512 bytes * 32 bytes 2048 bytes * * Coding units are grouped into paging tiles. AFRC buffer dimensions must be aligned * to a multiple of the paging tile dimensions. * The dimensions of each paging tile depend on whether the buffer is optimised for * scanline (SCAN layout) or rotated (ROT layout) access. * * Layout Paging Tile Width Paging Tile Height * ------ ----------------- ------------------ * SCAN 16 coding units 4 coding units * ROT 8 coding units 8 coding units * * The dimensions of each coding unit depend on the number of components * in the compressed plane and whether the buffer is optimised for * scanline (SCAN layout) or rotated (ROT layout) access. * * Number of Components in Plane Layout Coding Unit Width Coding Unit Height * ----------------------------- --------- ----------------- ------------------ * 1 SCAN 16 samples 4 samples * Example: 16x4 luma samples in a 'Y' plane * 16x4 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer * ----------------------------- --------- ----------------- ------------------ * 1 ROT 8 samples 8 samples * Example: 8x8 luma samples in a 'Y' plane * 8x8 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer * ----------------------------- --------- ----------------- ------------------ * 2 DONT CARE 8 samples 4 samples * Example: 8x4 chroma pairs in the 'UV' plane of a semi-planar YUV buffer * ----------------------------- --------- ----------------- ------------------ * 3 DONT CARE 4 samples 4 samples * Example: 4x4 pixels in an RGB buffer without alpha * ----------------------------- --------- ----------------- ------------------ * 4 DONT CARE 4 samples 4 samples * Example: 4x4 pixels in an RGB buffer with alpha */ #define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02 #define DRM_FORMAT_MOD_ARM_AFRC(__afrc_mode) \ DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFRC, __afrc_mode) /* * AFRC coding unit size modifier. * * Indicates the number of bytes used to store each compressed coding unit for * one or more planes in an AFRC encoded buffer. The coding unit size for chrominance * is the same for both Cb and Cr, which may be stored in separate planes. * * AFRC_FORMAT_MOD_CU_SIZE_P0 indicates the number of bytes used to store * each compressed coding unit in the first plane of the buffer. For RGBA buffers * this is the only plane, while for semi-planar and fully-planar YUV buffers, * this corresponds to the luma plane. * * AFRC_FORMAT_MOD_CU_SIZE_P12 indicates the number of bytes used to store * each compressed coding unit in the second and third planes in the buffer. * For semi-planar and fully-planar YUV buffers, this corresponds to the chroma plane(s). * * For single-plane buffers, AFRC_FORMAT_MOD_CU_SIZE_P0 must be specified * and AFRC_FORMAT_MOD_CU_SIZE_P12 must be zero. * For semi-planar and fully-planar buffers, both AFRC_FORMAT_MOD_CU_SIZE_P0 and * AFRC_FORMAT_MOD_CU_SIZE_P12 must be specified. */ #define AFRC_FORMAT_MOD_CU_SIZE_MASK 0xf #define AFRC_FORMAT_MOD_CU_SIZE_16 (1ULL) #define AFRC_FORMAT_MOD_CU_SIZE_24 (2ULL) #define AFRC_FORMAT_MOD_CU_SIZE_32 (3ULL) #define AFRC_FORMAT_MOD_CU_SIZE_P0(__afrc_cu_size) (__afrc_cu_size) #define AFRC_FORMAT_MOD_CU_SIZE_P12(__afrc_cu_size) ((__afrc_cu_size) << 4) /* * AFRC scanline memory layout. * * Indicates if the buffer uses the scanline-optimised layout * for an AFRC encoded buffer, otherwise, it uses the rotation-optimised layout. * The memory layout is the same for all planes. */ #define AFRC_FORMAT_MOD_LAYOUT_SCAN (1ULL << 8) /* * Arm 16x16 Block U-Interleaved modifier * * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels * in the block are reordered. */ #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) /* * Allwinner tiled modifier * * This tiling mode is implemented by the VPU found on all Allwinner platforms, * codenamed sunxi. It is associated with a YUV format that uses either 2 or 3 * planes. * * With this tiling, the luminance samples are disposed in tiles representing * 32x32 pixels and the chrominance samples in tiles representing 32x64 pixels. * The pixel order in each tile is linear and the tiles are disposed linearly, * both in row-major order. */ #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) /* * Amlogic Video Framebuffer Compression modifiers * * Amlogic uses a proprietary lossless image compression protocol and format * for their hardware video codec accelerators, either video decoders or * video input encoders. * * It considerably reduces memory bandwidth while writing and reading * frames in memory. * * The underlying storage is considered to be 3 components, 8bit or 10-bit * per component YCbCr 420, single plane : * - DRM_FORMAT_YUV420_8BIT * - DRM_FORMAT_YUV420_10BIT * * The first 8 bits of the mode defines the layout, then the following 8 bits * defines the options changing the layout. * * Not all combinations are valid, and different SoCs may support different * combinations of layout and options. */ #define __fourcc_mod_amlogic_layout_mask 0xff #define __fourcc_mod_amlogic_options_shift 8 #define __fourcc_mod_amlogic_options_mask 0xff #define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \ fourcc_mod_code(AMLOGIC, \ ((__layout) & __fourcc_mod_amlogic_layout_mask) | \ (((__options) & __fourcc_mod_amlogic_options_mask) \ << __fourcc_mod_amlogic_options_shift)) /* Amlogic FBC Layouts */ /* * Amlogic FBC Basic Layout * * The basic layout is composed of: * - a body content organized in 64x32 superblocks with 4096 bytes per * superblock in default mode. * - a 32 bytes per 128x64 header block * * This layout is transferrable between Amlogic SoCs supporting this modifier. */ #define AMLOGIC_FBC_LAYOUT_BASIC (1ULL) /* * Amlogic FBC Scatter Memory layout * * Indicates the header contains IOMMU references to the compressed * frames content to optimize memory access and layout. * * In this mode, only the header memory address is needed, thus the * content memory organization is tied to the current producer * execution and cannot be saved/dumped neither transferrable between * Amlogic SoCs supporting this modifier. * * Due to the nature of the layout, these buffers are not expected to * be accessible by the user-space clients, but only accessible by the * hardware producers and consumers. * * The user-space clients should expect a failure while trying to mmap * the DMA-BUF handle returned by the producer. */ #define AMLOGIC_FBC_LAYOUT_SCATTER (2ULL) /* Amlogic FBC Layout Options Bit Mask */ /* * Amlogic FBC Memory Saving mode * * Indicates the storage is packed when pixel size is multiple of word * boudaries, i.e. 8bit should be stored in this mode to save allocation * memory. * * This mode reduces body layout to 3072 bytes per 64x32 superblock with * the basic layout and 3200 bytes per 64x32 superblock combined with * the scatter layout. */ #define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0) /* * AMD modifiers * * Memory layout: * * without DCC: * - main surface * * with DCC & without DCC_RETILE: * - main surface in plane 0 * - DCC surface in plane 1 (RB-aligned, pipe-aligned if DCC_PIPE_ALIGN is set) * * with DCC & DCC_RETILE: * - main surface in plane 0 * - displayable DCC surface in plane 1 (not RB-aligned & not pipe-aligned) * - pipe-aligned DCC surface in plane 2 (RB-aligned & pipe-aligned) * * For multi-plane formats the above surfaces get merged into one plane for * each format plane, based on the required alignment only. * * Bits Parameter Notes * ----- ------------------------ --------------------------------------------- * * 7:0 TILE_VERSION Values are AMD_FMT_MOD_TILE_VER_* * 12:8 TILE Values are AMD_FMT_MOD_TILE_<version>_* * 13 DCC * 14 DCC_RETILE * 15 DCC_PIPE_ALIGN * 16 DCC_INDEPENDENT_64B * 17 DCC_INDEPENDENT_128B * 19:18 DCC_MAX_COMPRESSED_BLOCK Values are AMD_FMT_MOD_DCC_BLOCK_* * 20 DCC_CONSTANT_ENCODE * 23:21 PIPE_XOR_BITS Only for some chips * 26:24 BANK_XOR_BITS Only for some chips * 29:27 PACKERS Only for some chips * 32:30 RB Only for some chips * 35:33 PIPE Only for some chips * 55:36 - Reserved for future use, must be zero */ #define AMD_FMT_MOD fourcc_mod_code(AMD, 0) #define IS_AMD_FMT_MOD(val) (((val) >> 56) == DRM_FORMAT_MOD_VENDOR_AMD) /* Reserve 0 for GFX8 and older */ #define AMD_FMT_MOD_TILE_VER_GFX9 1 #define AMD_FMT_MOD_TILE_VER_GFX10 2 #define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3 #define AMD_FMT_MOD_TILE_VER_GFX11 4 /* * 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical * version. */ #define AMD_FMT_MOD_TILE_GFX9_64K_S 9 /* * 64K_D for non-32 bpp is the same for GFX9/GFX10/GFX10_RBPLUS and hence has * GFX9 as canonical version. */ #define AMD_FMT_MOD_TILE_GFX9_64K_D 10 #define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25 #define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26 #define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27 #define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31 #define AMD_FMT_MOD_DCC_BLOCK_64B 0 #define AMD_FMT_MOD_DCC_BLOCK_128B 1 #define AMD_FMT_MOD_DCC_BLOCK_256B 2 #define AMD_FMT_MOD_TILE_VERSION_SHIFT 0 #define AMD_FMT_MOD_TILE_VERSION_MASK 0xFF #define AMD_FMT_MOD_TILE_SHIFT 8 #define AMD_FMT_MOD_TILE_MASK 0x1F /* Whether DCC compression is enabled. */ #define AMD_FMT_MOD_DCC_SHIFT 13 #define AMD_FMT_MOD_DCC_MASK 0x1 /* * Whether to include two DCC surfaces, one which is rb & pipe aligned, and * one which is not-aligned. */ #define AMD_FMT_MOD_DCC_RETILE_SHIFT 14 #define AMD_FMT_MOD_DCC_RETILE_MASK 0x1 /* Only set if DCC_RETILE = false */ #define AMD_FMT_MOD_DCC_PIPE_ALIGN_SHIFT 15 #define AMD_FMT_MOD_DCC_PIPE_ALIGN_MASK 0x1 #define AMD_FMT_MOD_DCC_INDEPENDENT_64B_SHIFT 16 #define AMD_FMT_MOD_DCC_INDEPENDENT_64B_MASK 0x1 #define AMD_FMT_MOD_DCC_INDEPENDENT_128B_SHIFT 17 #define AMD_FMT_MOD_DCC_INDEPENDENT_128B_MASK 0x1 #define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_SHIFT 18 #define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3 /* * DCC supports embedding some clear colors directly in the DCC surface. * However, on older GPUs the rendering HW ignores the embedded clear color * and prefers the driver provided color. This necessitates doing a fastclear * eliminate operation before a process transfers control. * * If this bit is set that means the fastclear eliminate is not needed for these * embeddable colors. */ #define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_SHIFT 20 #define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_MASK 0x1 /* * The below fields are for accounting for per GPU differences. These are only * relevant for GFX9 and later and if the tile field is *_X/_T. * * PIPE_XOR_BITS = always needed * BANK_XOR_BITS = only for TILE_VER_GFX9 * PACKERS = only for TILE_VER_GFX10_RBPLUS * RB = only for TILE_VER_GFX9 & DCC * PIPE = only for TILE_VER_GFX9 & DCC & (DCC_RETILE | DCC_PIPE_ALIGN) */ #define AMD_FMT_MOD_PIPE_XOR_BITS_SHIFT 21 #define AMD_FMT_MOD_PIPE_XOR_BITS_MASK 0x7 #define AMD_FMT_MOD_BANK_XOR_BITS_SHIFT 24 #define AMD_FMT_MOD_BANK_XOR_BITS_MASK 0x7 #define AMD_FMT_MOD_PACKERS_SHIFT 27 #define AMD_FMT_MOD_PACKERS_MASK 0x7 #define AMD_FMT_MOD_RB_SHIFT 30 #define AMD_FMT_MOD_RB_MASK 0x7 #define AMD_FMT_MOD_PIPE_SHIFT 33 #define AMD_FMT_MOD_PIPE_MASK 0x7 #define AMD_FMT_MOD_SET(field, value) \ ((__u64)(value) << AMD_FMT_MOD_##field##_SHIFT) #define AMD_FMT_MOD_GET(field, value) \ (((value) >> AMD_FMT_MOD_##field##_SHIFT) & AMD_FMT_MOD_##field##_MASK) #define AMD_FMT_MOD_CLEAR(field) \ (~((__u64)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT)) #if defined(__cplusplus) } #endif #endif /* DRM_FOURCC_H */ drm/drm_mode.h 0000644 00000115555 15063602045 0007302 0 ustar 00 /* * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> * Copyright (c) 2007 Jakob Bornecrantz <wallbraker@gmail.com> * Copyright (c) 2008 Red Hat Inc. * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA * Copyright (c) 2007-2008 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _DRM_MODE_H #define _DRM_MODE_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /** * DOC: overview * * DRM exposes many UAPI and structure definition to have a consistent * and standardized interface with user. * Userspace can refer to these structure definitions and UAPI formats * to communicate to driver */ #define DRM_CONNECTOR_NAME_LEN 32 #define DRM_DISPLAY_MODE_LEN 32 #define DRM_PROP_NAME_LEN 32 #define DRM_MODE_TYPE_BUILTIN (1<<0) /* deprecated */ #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */ #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */ #define DRM_MODE_TYPE_PREFERRED (1<<3) #define DRM_MODE_TYPE_DEFAULT (1<<4) /* deprecated */ #define DRM_MODE_TYPE_USERDEF (1<<5) #define DRM_MODE_TYPE_DRIVER (1<<6) #define DRM_MODE_TYPE_ALL (DRM_MODE_TYPE_PREFERRED | \ DRM_MODE_TYPE_USERDEF | \ DRM_MODE_TYPE_DRIVER) /* Video mode flags */ /* bit compatible with the xrandr RR_ definitions (bits 0-13) * * ABI warning: Existing userspace really expects * the mode flags to match the xrandr definitions. Any * changes that don't match the xrandr definitions will * likely need a new client cap or some other mechanism * to avoid breaking existing userspace. This includes * allocating new flags in the previously unused bits! */ #define DRM_MODE_FLAG_PHSYNC (1<<0) #define DRM_MODE_FLAG_NHSYNC (1<<1) #define DRM_MODE_FLAG_PVSYNC (1<<2) #define DRM_MODE_FLAG_NVSYNC (1<<3) #define DRM_MODE_FLAG_INTERLACE (1<<4) #define DRM_MODE_FLAG_DBLSCAN (1<<5) #define DRM_MODE_FLAG_CSYNC (1<<6) #define DRM_MODE_FLAG_PCSYNC (1<<7) #define DRM_MODE_FLAG_NCSYNC (1<<8) #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ #define DRM_MODE_FLAG_BCAST (1<<10) /* deprecated */ #define DRM_MODE_FLAG_PIXMUX (1<<11) /* deprecated */ #define DRM_MODE_FLAG_DBLCLK (1<<12) #define DRM_MODE_FLAG_CLKDIV2 (1<<13) /* * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX * (define not exposed to user space). */ #define DRM_MODE_FLAG_3D_MASK (0x1f<<14) #define DRM_MODE_FLAG_3D_NONE (0<<14) #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14) #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14) #define DRM_MODE_FLAG_3D_L_DEPTH (5<<14) #define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14) #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14) /* Picture aspect ratio options */ #define DRM_MODE_PICTURE_ASPECT_NONE 0 #define DRM_MODE_PICTURE_ASPECT_4_3 1 #define DRM_MODE_PICTURE_ASPECT_16_9 2 #define DRM_MODE_PICTURE_ASPECT_64_27 3 #define DRM_MODE_PICTURE_ASPECT_256_135 4 /* Content type options */ #define DRM_MODE_CONTENT_TYPE_NO_DATA 0 #define DRM_MODE_CONTENT_TYPE_GRAPHICS 1 #define DRM_MODE_CONTENT_TYPE_PHOTO 2 #define DRM_MODE_CONTENT_TYPE_CINEMA 3 #define DRM_MODE_CONTENT_TYPE_GAME 4 /* Aspect ratio flag bitmask (4 bits 22:19) */ #define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19) #define DRM_MODE_FLAG_PIC_AR_NONE \ (DRM_MODE_PICTURE_ASPECT_NONE<<19) #define DRM_MODE_FLAG_PIC_AR_4_3 \ (DRM_MODE_PICTURE_ASPECT_4_3<<19) #define DRM_MODE_FLAG_PIC_AR_16_9 \ (DRM_MODE_PICTURE_ASPECT_16_9<<19) #define DRM_MODE_FLAG_PIC_AR_64_27 \ (DRM_MODE_PICTURE_ASPECT_64_27<<19) #define DRM_MODE_FLAG_PIC_AR_256_135 \ (DRM_MODE_PICTURE_ASPECT_256_135<<19) #define DRM_MODE_FLAG_ALL (DRM_MODE_FLAG_PHSYNC | \ DRM_MODE_FLAG_NHSYNC | \ DRM_MODE_FLAG_PVSYNC | \ DRM_MODE_FLAG_NVSYNC | \ DRM_MODE_FLAG_INTERLACE | \ DRM_MODE_FLAG_DBLSCAN | \ DRM_MODE_FLAG_CSYNC | \ DRM_MODE_FLAG_PCSYNC | \ DRM_MODE_FLAG_NCSYNC | \ DRM_MODE_FLAG_HSKEW | \ DRM_MODE_FLAG_DBLCLK | \ DRM_MODE_FLAG_CLKDIV2 | \ DRM_MODE_FLAG_3D_MASK) /* DPMS flags */ /* bit compatible with the xorg definitions. */ #define DRM_MODE_DPMS_ON 0 #define DRM_MODE_DPMS_STANDBY 1 #define DRM_MODE_DPMS_SUSPEND 2 #define DRM_MODE_DPMS_OFF 3 /* Scaling mode options */ #define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or software can still scale) */ #define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */ #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ /* Dithering mode options */ #define DRM_MODE_DITHERING_OFF 0 #define DRM_MODE_DITHERING_ON 1 #define DRM_MODE_DITHERING_AUTO 2 /* Dirty info options */ #define DRM_MODE_DIRTY_OFF 0 #define DRM_MODE_DIRTY_ON 1 #define DRM_MODE_DIRTY_ANNOTATE 2 /* Link Status options */ #define DRM_MODE_LINK_STATUS_GOOD 0 #define DRM_MODE_LINK_STATUS_BAD 1 /* * DRM_MODE_ROTATE_<degrees> * * Signals that a drm plane is been rotated <degrees> degrees in counter * clockwise direction. * * This define is provided as a convenience, looking up the property id * using the name->prop id lookup is the preferred method. */ #define DRM_MODE_ROTATE_0 (1<<0) #define DRM_MODE_ROTATE_90 (1<<1) #define DRM_MODE_ROTATE_180 (1<<2) #define DRM_MODE_ROTATE_270 (1<<3) /* * DRM_MODE_ROTATE_MASK * * Bitmask used to look for drm plane rotations. */ #define DRM_MODE_ROTATE_MASK (\ DRM_MODE_ROTATE_0 | \ DRM_MODE_ROTATE_90 | \ DRM_MODE_ROTATE_180 | \ DRM_MODE_ROTATE_270) /* * DRM_MODE_REFLECT_<axis> * * Signals that the contents of a drm plane is reflected along the <axis> axis, * in the same way as mirroring. * See kerneldoc chapter "Plane Composition Properties" for more details. * * This define is provided as a convenience, looking up the property id * using the name->prop id lookup is the preferred method. */ #define DRM_MODE_REFLECT_X (1<<4) #define DRM_MODE_REFLECT_Y (1<<5) /* * DRM_MODE_REFLECT_MASK * * Bitmask used to look for drm plane reflections. */ #define DRM_MODE_REFLECT_MASK (\ DRM_MODE_REFLECT_X | \ DRM_MODE_REFLECT_Y) /* Content Protection Flags */ #define DRM_MODE_CONTENT_PROTECTION_UNDESIRED 0 #define DRM_MODE_CONTENT_PROTECTION_DESIRED 1 #define DRM_MODE_CONTENT_PROTECTION_ENABLED 2 /** * struct drm_mode_modeinfo - Display mode information. * @clock: pixel clock in kHz * @hdisplay: horizontal display size * @hsync_start: horizontal sync start * @hsync_end: horizontal sync end * @htotal: horizontal total size * @hskew: horizontal skew * @vdisplay: vertical display size * @vsync_start: vertical sync start * @vsync_end: vertical sync end * @vtotal: vertical total size * @vscan: vertical scan * @vrefresh: approximate vertical refresh rate in Hz * @flags: bitmask of misc. flags, see DRM_MODE_FLAG_* defines * @type: bitmask of type flags, see DRM_MODE_TYPE_* defines * @name: string describing the mode resolution * * This is the user-space API display mode information structure. For the * kernel version see struct drm_display_mode. */ struct drm_mode_modeinfo { __u32 clock; __u16 hdisplay; __u16 hsync_start; __u16 hsync_end; __u16 htotal; __u16 hskew; __u16 vdisplay; __u16 vsync_start; __u16 vsync_end; __u16 vtotal; __u16 vscan; __u32 vrefresh; __u32 flags; __u32 type; char name[DRM_DISPLAY_MODE_LEN]; }; struct drm_mode_card_res { __u64 fb_id_ptr; __u64 crtc_id_ptr; __u64 connector_id_ptr; __u64 encoder_id_ptr; __u32 count_fbs; __u32 count_crtcs; __u32 count_connectors; __u32 count_encoders; __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; }; struct drm_mode_crtc { __u64 set_connectors_ptr; __u32 count_connectors; __u32 crtc_id; /**< Id */ __u32 fb_id; /**< Id of framebuffer */ __u32 x; /**< x Position on the framebuffer */ __u32 y; /**< y Position on the framebuffer */ __u32 gamma_size; __u32 mode_valid; struct drm_mode_modeinfo mode; }; #define DRM_MODE_PRESENT_TOP_FIELD (1<<0) #define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) /* Planes blend with or override other bits on the CRTC */ struct drm_mode_set_plane { __u32 plane_id; __u32 crtc_id; __u32 fb_id; /* fb object contains surface format type */ __u32 flags; /* see above flags */ /* Signed dest location allows it to be partially off screen */ __s32 crtc_x; __s32 crtc_y; __u32 crtc_w; __u32 crtc_h; /* Source values are 16.16 fixed point */ __u32 src_x; __u32 src_y; __u32 src_h; __u32 src_w; }; /** * struct drm_mode_get_plane - Get plane metadata. * * Userspace can perform a GETPLANE ioctl to retrieve information about a * plane. * * To retrieve the number of formats supported, set @count_format_types to zero * and call the ioctl. @count_format_types will be updated with the value. * * To retrieve these formats, allocate an array with the memory needed to store * @count_format_types formats. Point @format_type_ptr to this array and call * the ioctl again (with @count_format_types still set to the value returned in * the first ioctl call). */ struct drm_mode_get_plane { /** * @plane_id: Object ID of the plane whose information should be * retrieved. Set by caller. */ __u32 plane_id; /** @crtc_id: Object ID of the current CRTC. */ __u32 crtc_id; /** @fb_id: Object ID of the current fb. */ __u32 fb_id; /** * @possible_crtcs: Bitmask of CRTC's compatible with the plane. CRTC's * are created and they receive an index, which corresponds to their * position in the bitmask. Bit N corresponds to * :ref:`CRTC index<crtc_index>` N. */ __u32 possible_crtcs; /** @gamma_size: Never used. */ __u32 gamma_size; /** @count_format_types: Number of formats. */ __u32 count_format_types; /** * @format_type_ptr: Pointer to ``__u32`` array of formats that are * supported by the plane. These formats do not require modifiers. */ __u64 format_type_ptr; }; struct drm_mode_get_plane_res { __u64 plane_id_ptr; __u32 count_planes; }; #define DRM_MODE_ENCODER_NONE 0 #define DRM_MODE_ENCODER_DAC 1 #define DRM_MODE_ENCODER_TMDS 2 #define DRM_MODE_ENCODER_LVDS 3 #define DRM_MODE_ENCODER_TVDAC 4 #define DRM_MODE_ENCODER_VIRTUAL 5 #define DRM_MODE_ENCODER_DSI 6 #define DRM_MODE_ENCODER_DPMST 7 #define DRM_MODE_ENCODER_DPI 8 struct drm_mode_get_encoder { __u32 encoder_id; __u32 encoder_type; __u32 crtc_id; /**< Id of crtc */ __u32 possible_crtcs; __u32 possible_clones; }; /* This is for connectors with multiple signal types. */ /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ enum drm_mode_subconnector { DRM_MODE_SUBCONNECTOR_Automatic = 0, /* DVI-I, TV */ DRM_MODE_SUBCONNECTOR_Unknown = 0, /* DVI-I, TV, DP */ DRM_MODE_SUBCONNECTOR_VGA = 1, /* DP */ DRM_MODE_SUBCONNECTOR_DVID = 3, /* DVI-I DP */ DRM_MODE_SUBCONNECTOR_DVIA = 4, /* DVI-I */ DRM_MODE_SUBCONNECTOR_Composite = 5, /* TV */ DRM_MODE_SUBCONNECTOR_SVIDEO = 6, /* TV */ DRM_MODE_SUBCONNECTOR_Component = 8, /* TV */ DRM_MODE_SUBCONNECTOR_SCART = 9, /* TV */ DRM_MODE_SUBCONNECTOR_DisplayPort = 10, /* DP */ DRM_MODE_SUBCONNECTOR_HDMIA = 11, /* DP */ DRM_MODE_SUBCONNECTOR_Native = 15, /* DP */ DRM_MODE_SUBCONNECTOR_Wireless = 18, /* DP */ }; #define DRM_MODE_CONNECTOR_Unknown 0 #define DRM_MODE_CONNECTOR_VGA 1 #define DRM_MODE_CONNECTOR_DVII 2 #define DRM_MODE_CONNECTOR_DVID 3 #define DRM_MODE_CONNECTOR_DVIA 4 #define DRM_MODE_CONNECTOR_Composite 5 #define DRM_MODE_CONNECTOR_SVIDEO 6 #define DRM_MODE_CONNECTOR_LVDS 7 #define DRM_MODE_CONNECTOR_Component 8 #define DRM_MODE_CONNECTOR_9PinDIN 9 #define DRM_MODE_CONNECTOR_DisplayPort 10 #define DRM_MODE_CONNECTOR_HDMIA 11 #define DRM_MODE_CONNECTOR_HDMIB 12 #define DRM_MODE_CONNECTOR_TV 13 #define DRM_MODE_CONNECTOR_eDP 14 #define DRM_MODE_CONNECTOR_VIRTUAL 15 #define DRM_MODE_CONNECTOR_DSI 16 #define DRM_MODE_CONNECTOR_DPI 17 #define DRM_MODE_CONNECTOR_WRITEBACK 18 #define DRM_MODE_CONNECTOR_SPI 19 #define DRM_MODE_CONNECTOR_USB 20 /** * struct drm_mode_get_connector - Get connector metadata. * * User-space can perform a GETCONNECTOR ioctl to retrieve information about a * connector. User-space is expected to retrieve encoders, modes and properties * by performing this ioctl at least twice: the first time to retrieve the * number of elements, the second time to retrieve the elements themselves. * * To retrieve the number of elements, set @count_props and @count_encoders to * zero, set @count_modes to 1, and set @modes_ptr to a temporary struct * drm_mode_modeinfo element. * * To retrieve the elements, allocate arrays for @encoders_ptr, @modes_ptr, * @props_ptr and @prop_values_ptr, then set @count_modes, @count_props and * @count_encoders to their capacity. * * Performing the ioctl only twice may be racy: the number of elements may have * changed with a hotplug event in-between the two ioctls. User-space is * expected to retry the last ioctl until the number of elements stabilizes. * The kernel won't fill any array which doesn't have the expected length. * * **Force-probing a connector** * * If the @count_modes field is set to zero and the DRM client is the current * DRM master, the kernel will perform a forced probe on the connector to * refresh the connector status, modes and EDID. A forced-probe can be slow, * might cause flickering and the ioctl will block. * * User-space needs to force-probe connectors to ensure their metadata is * up-to-date at startup and after receiving a hot-plug event. User-space * may perform a forced-probe when the user explicitly requests it. User-space * shouldn't perform a forced-probe in other situations. */ struct drm_mode_get_connector { /** @encoders_ptr: Pointer to ``__u32`` array of object IDs. */ __u64 encoders_ptr; /** @modes_ptr: Pointer to struct drm_mode_modeinfo array. */ __u64 modes_ptr; /** @props_ptr: Pointer to ``__u32`` array of property IDs. */ __u64 props_ptr; /** @prop_values_ptr: Pointer to ``__u64`` array of property values. */ __u64 prop_values_ptr; /** @count_modes: Number of modes. */ __u32 count_modes; /** @count_props: Number of properties. */ __u32 count_props; /** @count_encoders: Number of encoders. */ __u32 count_encoders; /** @encoder_id: Object ID of the current encoder. */ __u32 encoder_id; /** @connector_id: Object ID of the connector. */ __u32 connector_id; /** * @connector_type: Type of the connector. * * See DRM_MODE_CONNECTOR_* defines. */ __u32 connector_type; /** * @connector_type_id: Type-specific connector number. * * This is not an object ID. This is a per-type connector number. Each * (type, type_id) combination is unique across all connectors of a DRM * device. */ __u32 connector_type_id; /** * @connection: Status of the connector. * * See enum drm_connector_status. */ __u32 connection; /** @mm_width: Width of the connected sink in millimeters. */ __u32 mm_width; /** @mm_height: Height of the connected sink in millimeters. */ __u32 mm_height; /** * @subpixel: Subpixel order of the connected sink. * * See enum subpixel_order. */ __u32 subpixel; /** @pad: Padding, must be zero. */ __u32 pad; }; #define DRM_MODE_PROP_PENDING (1<<0) /* deprecated, do not use */ #define DRM_MODE_PROP_RANGE (1<<1) #define DRM_MODE_PROP_IMMUTABLE (1<<2) #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ #define DRM_MODE_PROP_BLOB (1<<4) #define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ /* non-extended types: legacy bitmask, one bit per type: */ #define DRM_MODE_PROP_LEGACY_TYPE ( \ DRM_MODE_PROP_RANGE | \ DRM_MODE_PROP_ENUM | \ DRM_MODE_PROP_BLOB | \ DRM_MODE_PROP_BITMASK) /* extended-types: rather than continue to consume a bit per type, * grab a chunk of the bits to use as integer type id. */ #define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0 #define DRM_MODE_PROP_TYPE(n) ((n) << 6) #define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1) #define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2) /* the PROP_ATOMIC flag is used to hide properties from userspace that * is not aware of atomic properties. This is mostly to work around * older userspace (DDX drivers) that read/write each prop they find, * witout being aware that this could be triggering a lengthy modeset. */ #define DRM_MODE_PROP_ATOMIC 0x80000000 /** * struct drm_mode_property_enum - Description for an enum/bitfield entry. * @value: numeric value for this enum entry. * @name: symbolic name for this enum entry. * * See struct drm_property_enum for details. */ struct drm_mode_property_enum { __u64 value; char name[DRM_PROP_NAME_LEN]; }; /** * struct drm_mode_get_property - Get property metadata. * * User-space can perform a GETPROPERTY ioctl to retrieve information about a * property. The same property may be attached to multiple objects, see * "Modeset Base Object Abstraction". * * The meaning of the @values_ptr field changes depending on the property type. * See &drm_property.flags for more details. * * The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the * property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For * backwards compatibility, the kernel will always set @count_enum_blobs to * zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must * ignore these two fields if the property has a different type. * * User-space is expected to retrieve values and enums by performing this ioctl * at least twice: the first time to retrieve the number of elements, the * second time to retrieve the elements themselves. * * To retrieve the number of elements, set @count_values and @count_enum_blobs * to zero, then call the ioctl. @count_values will be updated with the number * of elements. If the property has the type &DRM_MODE_PROP_ENUM or * &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well. * * To retrieve the elements themselves, allocate an array for @values_ptr and * set @count_values to its capacity. If the property has the type * &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for * @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl * again will fill the arrays. */ struct drm_mode_get_property { /** @values_ptr: Pointer to a ``__u64`` array. */ __u64 values_ptr; /** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */ __u64 enum_blob_ptr; /** * @prop_id: Object ID of the property which should be retrieved. Set * by the caller. */ __u32 prop_id; /** * @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for * a definition of the flags. */ __u32 flags; /** * @name: Symbolic property name. User-space should use this field to * recognize properties. */ char name[DRM_PROP_NAME_LEN]; /** @count_values: Number of elements in @values_ptr. */ __u32 count_values; /** @count_enum_blobs: Number of elements in @enum_blob_ptr. */ __u32 count_enum_blobs; }; struct drm_mode_connector_set_property { __u64 value; __u32 prop_id; __u32 connector_id; }; #define DRM_MODE_OBJECT_CRTC 0xcccccccc #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0 #define DRM_MODE_OBJECT_MODE 0xdededede #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 #define DRM_MODE_OBJECT_FB 0xfbfbfbfb #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee #define DRM_MODE_OBJECT_ANY 0 struct drm_mode_obj_get_properties { __u64 props_ptr; __u64 prop_values_ptr; __u32 count_props; __u32 obj_id; __u32 obj_type; }; struct drm_mode_obj_set_property { __u64 value; __u32 prop_id; __u32 obj_id; __u32 obj_type; }; struct drm_mode_get_blob { __u32 blob_id; __u32 length; __u64 data; }; struct drm_mode_fb_cmd { __u32 fb_id; __u32 width; __u32 height; __u32 pitch; __u32 bpp; __u32 depth; /* driver specific handle */ __u32 handle; }; #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */ #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */ /** * struct drm_mode_fb_cmd2 - Frame-buffer metadata. * * This struct holds frame-buffer metadata. There are two ways to use it: * * - User-space can fill this struct and perform a &DRM_IOCTL_MODE_ADDFB2 * ioctl to register a new frame-buffer. The new frame-buffer object ID will * be set by the kernel in @fb_id. * - User-space can set @fb_id and perform a &DRM_IOCTL_MODE_GETFB2 ioctl to * fetch metadata about an existing frame-buffer. * * In case of planar formats, this struct allows up to 4 buffer objects with * offsets and pitches per plane. The pitch and offset order are dictated by * the format FourCC as defined by ``drm_fourcc.h``, e.g. NV12 is described as: * * YUV 4:2:0 image with a plane of 8-bit Y samples followed by an * interleaved U/V plane containing 8-bit 2x2 subsampled colour difference * samples. * * So it would consist of a Y plane at ``offsets[0]`` and a UV plane at * ``offsets[1]``. * * To accommodate tiled, compressed, etc formats, a modifier can be specified. * For more information see the "Format Modifiers" section. Note that even * though it looks like we have a modifier per-plane, we in fact do not. The * modifier for each plane must be identical. Thus all combinations of * different data layouts for multi-plane formats must be enumerated as * separate modifiers. * * All of the entries in @handles, @pitches, @offsets and @modifier must be * zero when unused. Warning, for @offsets and @modifier zero can't be used to * figure out whether the entry is used or not since it's a valid value (a zero * offset is common, and a zero modifier is &DRM_FORMAT_MOD_LINEAR). */ struct drm_mode_fb_cmd2 { /** @fb_id: Object ID of the frame-buffer. */ __u32 fb_id; /** @width: Width of the frame-buffer. */ __u32 width; /** @height: Height of the frame-buffer. */ __u32 height; /** * @pixel_format: FourCC format code, see ``DRM_FORMAT_*`` constants in * ``drm_fourcc.h``. */ __u32 pixel_format; /** * @flags: Frame-buffer flags (see &DRM_MODE_FB_INTERLACED and * &DRM_MODE_FB_MODIFIERS). */ __u32 flags; /** * @handles: GEM buffer handle, one per plane. Set to 0 if the plane is * unused. The same handle can be used for multiple planes. */ __u32 handles[4]; /** @pitches: Pitch (aka. stride) in bytes, one per plane. */ __u32 pitches[4]; /** @offsets: Offset into the buffer in bytes, one per plane. */ __u32 offsets[4]; /** * @modifier: Format modifier, one per plane. See ``DRM_FORMAT_MOD_*`` * constants in ``drm_fourcc.h``. All planes must use the same * modifier. Ignored unless &DRM_MODE_FB_MODIFIERS is set in @flags. */ __u64 modifier[4]; }; #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 #define DRM_MODE_FB_DIRTY_FLAGS 0x03 #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256 /* * Mark a region of a framebuffer as dirty. * * Some hardware does not automatically update display contents * as a hardware or software draw to a framebuffer. This ioctl * allows userspace to tell the kernel and the hardware what * regions of the framebuffer have changed. * * The kernel or hardware is free to update more then just the * region specified by the clip rects. The kernel or hardware * may also delay and/or coalesce several calls to dirty into a * single update. * * Userspace may annotate the updates, the annotates are a * promise made by the caller that the change is either a copy * of pixels or a fill of a single color in the region specified. * * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then * the number of updated regions are half of num_clips given, * where the clip rects are paired in src and dst. The width and * height of each one of the pairs must match. * * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller * promises that the region specified of the clip rects is filled * completely with a single color as given in the color argument. */ struct drm_mode_fb_dirty_cmd { __u32 fb_id; __u32 flags; __u32 color; __u32 num_clips; __u64 clips_ptr; }; struct drm_mode_mode_cmd { __u32 connector_id; struct drm_mode_modeinfo mode; }; #define DRM_MODE_CURSOR_BO 0x01 #define DRM_MODE_CURSOR_MOVE 0x02 #define DRM_MODE_CURSOR_FLAGS 0x03 /* * depending on the value in flags different members are used. * * CURSOR_BO uses * crtc_id * width * height * handle - if 0 turns the cursor off * * CURSOR_MOVE uses * crtc_id * x * y */ struct drm_mode_cursor { __u32 flags; __u32 crtc_id; __s32 x; __s32 y; __u32 width; __u32 height; /* driver specific handle */ __u32 handle; }; struct drm_mode_cursor2 { __u32 flags; __u32 crtc_id; __s32 x; __s32 y; __u32 width; __u32 height; /* driver specific handle */ __u32 handle; __s32 hot_x; __s32 hot_y; }; struct drm_mode_crtc_lut { __u32 crtc_id; __u32 gamma_size; /* pointers to arrays */ __u64 red; __u64 green; __u64 blue; }; struct drm_color_ctm { /* * Conversion matrix in S31.32 sign-magnitude * (not two's complement!) format. */ __u64 matrix[9]; }; struct drm_color_lut { /* * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and * 0xffff == 1.0. */ __u16 red; __u16 green; __u16 blue; __u16 reserved; }; /** * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data. * * HDR Metadata Infoframe as per CTA 861.G spec. This is expected * to match exactly with the spec. * * Userspace is expected to pass the metadata information as per * the format described in this structure. */ struct hdr_metadata_infoframe { /** * @eotf: Electro-Optical Transfer Function (EOTF) * used in the stream. */ __u8 eotf; /** * @metadata_type: Static_Metadata_Descriptor_ID. */ __u8 metadata_type; /** * @display_primaries: Color Primaries of the Data. * These are coded as unsigned 16-bit values in units of * 0.00002, where 0x0000 represents zero and 0xC350 * represents 1.0000. * @display_primaries.x: X cordinate of color primary. * @display_primaries.y: Y cordinate of color primary. */ struct { __u16 x, y; } display_primaries[3]; /** * @white_point: White Point of Colorspace Data. * These are coded as unsigned 16-bit values in units of * 0.00002, where 0x0000 represents zero and 0xC350 * represents 1.0000. * @white_point.x: X cordinate of whitepoint of color primary. * @white_point.y: Y cordinate of whitepoint of color primary. */ struct { __u16 x, y; } white_point; /** * @max_display_mastering_luminance: Max Mastering Display Luminance. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2, * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. */ __u16 max_display_mastering_luminance; /** * @min_display_mastering_luminance: Min Mastering Display Luminance. * This value is coded as an unsigned 16-bit value in units of * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF * represents 6.5535 cd/m2. */ __u16 min_display_mastering_luminance; /** * @max_cll: Max Content Light Level. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2, * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. */ __u16 max_cll; /** * @max_fall: Max Frame Average Light Level. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2, * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. */ __u16 max_fall; }; /** * struct hdr_output_metadata - HDR output metadata * * Metadata Information to be passed from userspace */ struct hdr_output_metadata { /** * @metadata_type: Static_Metadata_Descriptor_ID. */ __u32 metadata_type; /** * @hdmi_metadata_type1: HDR Metadata Infoframe. */ union { struct hdr_metadata_infoframe hdmi_metadata_type1; }; }; /** * DRM_MODE_PAGE_FLIP_EVENT * * Request that the kernel sends back a vblank event (see * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the * page-flip is done. */ #define DRM_MODE_PAGE_FLIP_EVENT 0x01 /** * DRM_MODE_PAGE_FLIP_ASYNC * * Request that the page-flip is performed as soon as possible, ie. with no * delay due to waiting for vblank. This may cause tearing to be visible on * the screen. */ #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8 #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \ DRM_MODE_PAGE_FLIP_TARGET_RELATIVE) /** * DRM_MODE_PAGE_FLIP_FLAGS * * Bitmask of flags suitable for &drm_mode_crtc_page_flip_target.flags. */ #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \ DRM_MODE_PAGE_FLIP_ASYNC | \ DRM_MODE_PAGE_FLIP_TARGET) /* * Request a page flip on the specified crtc. * * This ioctl will ask KMS to schedule a page flip for the specified * crtc. Once any pending rendering targeting the specified fb (as of * ioctl time) has completed, the crtc will be reprogrammed to display * that fb after the next vertical refresh. The ioctl returns * immediately, but subsequent rendering to the current fb will block * in the execbuffer ioctl until the page flip happens. If a page * flip is already pending as the ioctl is called, EBUSY will be * returned. * * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank * event (see drm.h: struct drm_event_vblank) when the page flip is * done. The user_data field passed in with this ioctl will be * returned as the user_data field in the vblank event struct. * * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen * 'as soon as possible', meaning that it not delay waiting for vblank. * This may cause tearing on the screen. * * The reserved field must be zero. */ struct drm_mode_crtc_page_flip { __u32 crtc_id; __u32 fb_id; __u32 flags; __u32 reserved; __u64 user_data; }; /* * Request a page flip on the specified crtc. * * Same as struct drm_mode_crtc_page_flip, but supports new flags and * re-purposes the reserved field: * * The sequence field must be zero unless either of the * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When * the ABSOLUTE flag is specified, the sequence field denotes the absolute * vblank sequence when the flip should take effect. When the RELATIVE * flag is specified, the sequence field denotes the relative (to the * current one when the ioctl is called) vblank sequence when the flip * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to * make sure the vblank sequence before the target one has passed before * calling this ioctl. The purpose of the * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify * the target for when code dealing with a page flip runs during a * vertical blank period. */ struct drm_mode_crtc_page_flip_target { __u32 crtc_id; __u32 fb_id; __u32 flags; __u32 sequence; __u64 user_data; }; /* create a dumb scanout buffer */ struct drm_mode_create_dumb { __u32 height; __u32 width; __u32 bpp; __u32 flags; /* handle, pitch, size will be returned */ __u32 handle; __u32 pitch; __u64 size; }; /* set up for mmap of a dumb scanout buffer */ struct drm_mode_map_dumb { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** * Fake offset to use for subsequent mmap call * * This is a fixed-size type for 32/64 compatibility. */ __u64 offset; }; struct drm_mode_destroy_dumb { __u32 handle; }; /** * DRM_MODE_ATOMIC_TEST_ONLY * * Do not apply the atomic commit, instead check whether the hardware supports * this configuration. * * See &drm_mode_config_funcs.atomic_check for more details on test-only * commits. */ #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 /** * DRM_MODE_ATOMIC_NONBLOCK * * Do not block while applying the atomic commit. The &DRM_IOCTL_MODE_ATOMIC * IOCTL returns immediately instead of waiting for the changes to be applied * in hardware. Note, the driver will still check that the update can be * applied before retuning. */ #define DRM_MODE_ATOMIC_NONBLOCK 0x0200 /** * DRM_MODE_ATOMIC_ALLOW_MODESET * * Allow the update to result in temporary or transient visible artifacts while * the update is being applied. Applying the update may also take significantly * more time than a page flip. All visual artifacts will disappear by the time * the update is completed, as signalled through the vblank event's timestamp * (see struct drm_event_vblank). * * This flag must be set when the KMS update might cause visible artifacts. * Without this flag such KMS update will return a EINVAL error. What kind of * update may cause visible artifacts depends on the driver and the hardware. * User-space that needs to know beforehand if an update might cause visible * artifacts can use &DRM_MODE_ATOMIC_TEST_ONLY without * &DRM_MODE_ATOMIC_ALLOW_MODESET to see if it fails. * * To the best of the driver's knowledge, visual artifacts are guaranteed to * not appear when this flag is not set. Some sinks might display visual * artifacts outside of the driver's control. */ #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 /** * DRM_MODE_ATOMIC_FLAGS * * Bitfield of flags accepted by the &DRM_IOCTL_MODE_ATOMIC IOCTL in * &drm_mode_atomic.flags. */ #define DRM_MODE_ATOMIC_FLAGS (\ DRM_MODE_PAGE_FLIP_EVENT |\ DRM_MODE_PAGE_FLIP_ASYNC |\ DRM_MODE_ATOMIC_TEST_ONLY |\ DRM_MODE_ATOMIC_NONBLOCK |\ DRM_MODE_ATOMIC_ALLOW_MODESET) struct drm_mode_atomic { __u32 flags; __u32 count_objs; __u64 objs_ptr; __u64 count_props_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u64 reserved; __u64 user_data; }; struct drm_format_modifier_blob { #define FORMAT_BLOB_CURRENT 1 /* Version of this blob format */ __u32 version; /* Flags */ __u32 flags; /* Number of fourcc formats supported */ __u32 count_formats; /* Where in this blob the formats exist (in bytes) */ __u32 formats_offset; /* Number of drm_format_modifiers */ __u32 count_modifiers; /* Where in this blob the modifiers exist (in bytes) */ __u32 modifiers_offset; /* __u32 formats[] */ /* struct drm_format_modifier modifiers[] */ }; struct drm_format_modifier { /* Bitmask of formats in get_plane format list this info applies to. The * offset allows a sliding window of which 64 formats (bits). * * Some examples: * In today's world with < 65 formats, and formats 0, and 2 are * supported * 0x0000000000000005 * ^-offset = 0, formats = 5 * * If the number formats grew to 128, and formats 98-102 are * supported with the modifier: * * 0x0000007c00000000 0000000000000000 * ^ * |__offset = 64, formats = 0x7c00000000 * */ __u64 formats; __u32 offset; __u32 pad; /* The modifier that applies to the >get_plane format list bitmask. */ __u64 modifier; }; /** * struct drm_mode_create_blob - Create New blob property * * Create a new 'blob' data property, copying length bytes from data pointer, * and returning new blob ID. */ struct drm_mode_create_blob { /** @data: Pointer to data to copy. */ __u64 data; /** @length: Length of data to copy. */ __u32 length; /** @blob_id: Return: new property ID. */ __u32 blob_id; }; /** * struct drm_mode_destroy_blob - Destroy user blob * @blob_id: blob_id to destroy * * Destroy a user-created blob property. * * User-space can release blobs as soon as they do not need to refer to them by * their blob object ID. For instance, if you are using a MODE_ID blob in an * atomic commit and you will not make another commit re-using the same ID, you * can destroy the blob as soon as the commit has been issued, without waiting * for it to complete. */ struct drm_mode_destroy_blob { __u32 blob_id; }; /** * struct drm_mode_create_lease - Create lease * * Lease mode resources, creating another drm_master. * * The @object_ids array must reference at least one CRTC, one connector and * one plane if &DRM_CLIENT_CAP_UNIVERSAL_PLANES is enabled. Alternatively, * the lease can be completely empty. */ struct drm_mode_create_lease { /** @object_ids: Pointer to array of object ids (__u32) */ __u64 object_ids; /** @object_count: Number of object ids */ __u32 object_count; /** @flags: flags for new FD (O_CLOEXEC, etc) */ __u32 flags; /** @lessee_id: Return: unique identifier for lessee. */ __u32 lessee_id; /** @fd: Return: file descriptor to new drm_master file */ __u32 fd; }; /** * struct drm_mode_list_lessees - List lessees * * List lesses from a drm_master. */ struct drm_mode_list_lessees { /** * @count_lessees: Number of lessees. * * On input, provides length of the array. * On output, provides total number. No * more than the input number will be written * back, so two calls can be used to get * the size and then the data. */ __u32 count_lessees; /** @pad: Padding. */ __u32 pad; /** * @lessees_ptr: Pointer to lessees. * * Pointer to __u64 array of lessee ids */ __u64 lessees_ptr; }; /** * struct drm_mode_get_lease - Get Lease * * Get leased objects. */ struct drm_mode_get_lease { /** * @count_objects: Number of leased objects. * * On input, provides length of the array. * On output, provides total number. No * more than the input number will be written * back, so two calls can be used to get * the size and then the data. */ __u32 count_objects; /** @pad: Padding. */ __u32 pad; /** * @objects_ptr: Pointer to objects. * * Pointer to __u32 array of object ids. */ __u64 objects_ptr; }; /** * struct drm_mode_revoke_lease - Revoke lease */ struct drm_mode_revoke_lease { /** @lessee_id: Unique ID of lessee */ __u32 lessee_id; }; /** * struct drm_mode_rect - Two dimensional rectangle. * @x1: Horizontal starting coordinate (inclusive). * @y1: Vertical starting coordinate (inclusive). * @x2: Horizontal ending coordinate (exclusive). * @y2: Vertical ending coordinate (exclusive). * * With drm subsystem using struct drm_rect to manage rectangular area this * export it to user-space. * * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS. */ struct drm_mode_rect { __s32 x1; __s32 y1; __s32 x2; __s32 y2; }; #if defined(__cplusplus) } #endif #endif drm/drm_sarea.h 0000644 00000005336 15063602045 0007444 0 ustar 00 /** * \file drm_sarea.h * \brief SAREA definitions * * \author Michel Dänzer <michel@daenzer.net> */ /* * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_SAREA_H_ #define _DRM_SAREA_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000U #elif defined(__mips__) #define SAREA_MAX 0x4000U #elif defined(__ia64__) #define SAREA_MAX 0x10000U /* 64kB */ #else /* Intel 830M driver needs at least 8k SAREA */ #define SAREA_MAX 0x2000U #endif /** Maximum number of drawables in the SAREA */ #define SAREA_MAX_DRAWABLES 256 #define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 /** SAREA drawable */ struct drm_sarea_drawable { unsigned int stamp; unsigned int flags; }; /** SAREA frame */ struct drm_sarea_frame { unsigned int x; unsigned int y; unsigned int width; unsigned int height; unsigned int fullscreen; }; /** SAREA */ struct drm_sarea { /** first thing is always the DRM locking structure */ struct drm_hw_lock lock; /** \todo Use readers/writer lock for drm_sarea::drawable_lock */ struct drm_hw_lock drawable_lock; struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */ struct drm_sarea_frame frame; /**< frame */ drm_context_t dummy_context; }; typedef struct drm_sarea_drawable drm_sarea_drawable_t; typedef struct drm_sarea_frame drm_sarea_frame_t; typedef struct drm_sarea drm_sarea_t; #if defined(__cplusplus) } #endif #endif /* _DRM_SAREA_H_ */ drm/etnaviv_drm.h 0000644 00000027331 15063602045 0010024 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2015 Etnaviv Project * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __ETNAVIV_DRM_H__ #define __ETNAVIV_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints: * 1) Do not use pointers, use __u64 instead for 32 bit / 64 bit * user/kernel compatibility * 2) Keep fields aligned to their size * 3) Because of how drm_ioctl() works, we can add new fields at * the end of an ioctl if some care is taken: drm_ioctl() will * zero out the new fields at the tail of the ioctl, so a zero * value should have a backwards compatible meaning. And for * output params, userspace won't see the newly added output * fields.. so that has to be somehow ok. */ /* timeouts are specified in clock-monotonic absolute times (to simplify * restarting interrupted ioctls). The following struct is logically the * same as 'struct timespec' but 32/64b ABI safe. */ struct drm_etnaviv_timespec { __s64 tv_sec; /* seconds */ __s64 tv_nsec; /* nanoseconds */ }; #define ETNAVIV_PARAM_GPU_MODEL 0x01 #define ETNAVIV_PARAM_GPU_REVISION 0x02 #define ETNAVIV_PARAM_GPU_FEATURES_0 0x03 #define ETNAVIV_PARAM_GPU_FEATURES_1 0x04 #define ETNAVIV_PARAM_GPU_FEATURES_2 0x05 #define ETNAVIV_PARAM_GPU_FEATURES_3 0x06 #define ETNAVIV_PARAM_GPU_FEATURES_4 0x07 #define ETNAVIV_PARAM_GPU_FEATURES_5 0x08 #define ETNAVIV_PARAM_GPU_FEATURES_6 0x09 #define ETNAVIV_PARAM_GPU_FEATURES_7 0x0a #define ETNAVIV_PARAM_GPU_FEATURES_8 0x0b #define ETNAVIV_PARAM_GPU_FEATURES_9 0x0c #define ETNAVIV_PARAM_GPU_FEATURES_10 0x0d #define ETNAVIV_PARAM_GPU_FEATURES_11 0x0e #define ETNAVIV_PARAM_GPU_FEATURES_12 0x0f #define ETNAVIV_PARAM_GPU_STREAM_COUNT 0x10 #define ETNAVIV_PARAM_GPU_REGISTER_MAX 0x11 #define ETNAVIV_PARAM_GPU_THREAD_COUNT 0x12 #define ETNAVIV_PARAM_GPU_VERTEX_CACHE_SIZE 0x13 #define ETNAVIV_PARAM_GPU_SHADER_CORE_COUNT 0x14 #define ETNAVIV_PARAM_GPU_PIXEL_PIPES 0x15 #define ETNAVIV_PARAM_GPU_VERTEX_OUTPUT_BUFFER_SIZE 0x16 #define ETNAVIV_PARAM_GPU_BUFFER_SIZE 0x17 #define ETNAVIV_PARAM_GPU_INSTRUCTION_COUNT 0x18 #define ETNAVIV_PARAM_GPU_NUM_CONSTANTS 0x19 #define ETNAVIV_PARAM_GPU_NUM_VARYINGS 0x1a #define ETNAVIV_PARAM_SOFTPIN_START_ADDR 0x1b #define ETNAVIV_PARAM_GPU_PRODUCT_ID 0x1c #define ETNAVIV_PARAM_GPU_CUSTOMER_ID 0x1d #define ETNAVIV_PARAM_GPU_ECO_ID 0x1e #define ETNA_MAX_PIPES 4 struct drm_etnaviv_param { __u32 pipe; /* in */ __u32 param; /* in, ETNAVIV_PARAM_x */ __u64 value; /* out (get_param) or in (set_param) */ }; /* * GEM buffers: */ #define ETNA_BO_CACHE_MASK 0x000f0000 /* cache modes */ #define ETNA_BO_CACHED 0x00010000 #define ETNA_BO_WC 0x00020000 #define ETNA_BO_UNCACHED 0x00040000 /* map flags */ #define ETNA_BO_FORCE_MMU 0x00100000 struct drm_etnaviv_gem_new { __u64 size; /* in */ __u32 flags; /* in, mask of ETNA_BO_x */ __u32 handle; /* out */ }; struct drm_etnaviv_gem_info { __u32 handle; /* in */ __u32 pad; __u64 offset; /* out, offset to pass to mmap() */ }; #define ETNA_PREP_READ 0x01 #define ETNA_PREP_WRITE 0x02 #define ETNA_PREP_NOSYNC 0x04 struct drm_etnaviv_gem_cpu_prep { __u32 handle; /* in */ __u32 op; /* in, mask of ETNA_PREP_x */ struct drm_etnaviv_timespec timeout; /* in */ }; struct drm_etnaviv_gem_cpu_fini { __u32 handle; /* in */ __u32 flags; /* in, placeholder for now, no defined values */ }; /* * Cmdstream Submission: */ /* The value written into the cmdstream is logically: * relocbuf->gpuaddr + reloc_offset * * NOTE that reloc's must be sorted by order of increasing submit_offset, * otherwise EINVAL. */ struct drm_etnaviv_gem_submit_reloc { __u32 submit_offset; /* in, offset from submit_bo */ __u32 reloc_idx; /* in, index of reloc_bo buffer */ __u64 reloc_offset; /* in, offset from start of reloc_bo */ __u32 flags; /* in, placeholder for now, no defined values */ }; /* Each buffer referenced elsewhere in the cmdstream submit (ie. the * cmdstream buffer(s) themselves or reloc entries) has one (and only * one) entry in the submit->bos[] table. * * As a optimization, the current buffer (gpu virtual address) can be * passed back through the 'presumed' field. If on a subsequent reloc, * userspace passes back a 'presumed' address that is still valid, * then patching the cmdstream for this entry is skipped. This can * avoid kernel needing to map/access the cmdstream bo in the common * case. * If the submit is a softpin submit (ETNA_SUBMIT_SOFTPIN) the 'presumed' * field is interpreted as the fixed location to map the bo into the gpu * virtual address space. If the kernel is unable to map the buffer at * this location the submit will fail. This means userspace is responsible * for the whole gpu virtual address management. */ #define ETNA_SUBMIT_BO_READ 0x0001 #define ETNA_SUBMIT_BO_WRITE 0x0002 struct drm_etnaviv_gem_submit_bo { __u32 flags; /* in, mask of ETNA_SUBMIT_BO_x */ __u32 handle; /* in, GEM handle */ __u64 presumed; /* in/out, presumed buffer address */ }; /* performance monitor request (pmr) */ #define ETNA_PM_PROCESS_PRE 0x0001 #define ETNA_PM_PROCESS_POST 0x0002 struct drm_etnaviv_gem_submit_pmr { __u32 flags; /* in, when to process request (ETNA_PM_PROCESS_x) */ __u8 domain; /* in, pm domain */ __u8 pad; __u16 signal; /* in, pm signal */ __u32 sequence; /* in, sequence number */ __u32 read_offset; /* in, offset from read_bo */ __u32 read_idx; /* in, index of read_bo buffer */ }; /* Each cmdstream submit consists of a table of buffers involved, and * one or more cmdstream buffers. This allows for conditional execution * (context-restore), and IB buffers needed for per tile/bin draw cmds. */ #define ETNA_SUBMIT_NO_IMPLICIT 0x0001 #define ETNA_SUBMIT_FENCE_FD_IN 0x0002 #define ETNA_SUBMIT_FENCE_FD_OUT 0x0004 #define ETNA_SUBMIT_SOFTPIN 0x0008 #define ETNA_SUBMIT_FLAGS (ETNA_SUBMIT_NO_IMPLICIT | \ ETNA_SUBMIT_FENCE_FD_IN | \ ETNA_SUBMIT_FENCE_FD_OUT| \ ETNA_SUBMIT_SOFTPIN) #define ETNA_PIPE_3D 0x00 #define ETNA_PIPE_2D 0x01 #define ETNA_PIPE_VG 0x02 struct drm_etnaviv_gem_submit { __u32 fence; /* out */ __u32 pipe; /* in */ __u32 exec_state; /* in, initial execution state (ETNA_PIPE_x) */ __u32 nr_bos; /* in, number of submit_bo's */ __u32 nr_relocs; /* in, number of submit_reloc's */ __u32 stream_size; /* in, cmdstream size */ __u64 bos; /* in, ptr to array of submit_bo's */ __u64 relocs; /* in, ptr to array of submit_reloc's */ __u64 stream; /* in, ptr to cmdstream */ __u32 flags; /* in, mask of ETNA_SUBMIT_x */ __s32 fence_fd; /* in/out, fence fd (see ETNA_SUBMIT_FENCE_FD_x) */ __u64 pmrs; /* in, ptr to array of submit_pmr's */ __u32 nr_pmrs; /* in, number of submit_pmr's */ __u32 pad; }; /* The normal way to synchronize with the GPU is just to CPU_PREP on * a buffer if you need to access it from the CPU (other cmdstream * submission from same or other contexts, PAGE_FLIP ioctl, etc, all * handle the required synchronization under the hood). This ioctl * mainly just exists as a way to implement the gallium pipe_fence * APIs without requiring a dummy bo to synchronize on. */ #define ETNA_WAIT_NONBLOCK 0x01 struct drm_etnaviv_wait_fence { __u32 pipe; /* in */ __u32 fence; /* in */ __u32 flags; /* in, mask of ETNA_WAIT_x */ __u32 pad; struct drm_etnaviv_timespec timeout; /* in */ }; #define ETNA_USERPTR_READ 0x01 #define ETNA_USERPTR_WRITE 0x02 struct drm_etnaviv_gem_userptr { __u64 user_ptr; /* in, page aligned user pointer */ __u64 user_size; /* in, page aligned user size */ __u32 flags; /* in, flags */ __u32 handle; /* out, non-zero handle */ }; struct drm_etnaviv_gem_wait { __u32 pipe; /* in */ __u32 handle; /* in, bo to be waited for */ __u32 flags; /* in, mask of ETNA_WAIT_x */ __u32 pad; struct drm_etnaviv_timespec timeout; /* in */ }; /* * Performance Monitor (PM): */ struct drm_etnaviv_pm_domain { __u32 pipe; /* in */ __u8 iter; /* in/out, select pm domain at index iter */ __u8 id; /* out, id of domain */ __u16 nr_signals; /* out, how many signals does this domain provide */ char name[64]; /* out, name of domain */ }; struct drm_etnaviv_pm_signal { __u32 pipe; /* in */ __u8 domain; /* in, pm domain index */ __u8 pad; __u16 iter; /* in/out, select pm source at index iter */ __u16 id; /* out, id of signal */ char name[64]; /* out, name of domain */ }; #define DRM_ETNAVIV_GET_PARAM 0x00 /* placeholder: #define DRM_ETNAVIV_SET_PARAM 0x01 */ #define DRM_ETNAVIV_GEM_NEW 0x02 #define DRM_ETNAVIV_GEM_INFO 0x03 #define DRM_ETNAVIV_GEM_CPU_PREP 0x04 #define DRM_ETNAVIV_GEM_CPU_FINI 0x05 #define DRM_ETNAVIV_GEM_SUBMIT 0x06 #define DRM_ETNAVIV_WAIT_FENCE 0x07 #define DRM_ETNAVIV_GEM_USERPTR 0x08 #define DRM_ETNAVIV_GEM_WAIT 0x09 #define DRM_ETNAVIV_PM_QUERY_DOM 0x0a #define DRM_ETNAVIV_PM_QUERY_SIG 0x0b #define DRM_ETNAVIV_NUM_IOCTLS 0x0c #define DRM_IOCTL_ETNAVIV_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GET_PARAM, struct drm_etnaviv_param) #define DRM_IOCTL_ETNAVIV_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_NEW, struct drm_etnaviv_gem_new) #define DRM_IOCTL_ETNAVIV_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_INFO, struct drm_etnaviv_gem_info) #define DRM_IOCTL_ETNAVIV_GEM_CPU_PREP DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_CPU_PREP, struct drm_etnaviv_gem_cpu_prep) #define DRM_IOCTL_ETNAVIV_GEM_CPU_FINI DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_CPU_FINI, struct drm_etnaviv_gem_cpu_fini) #define DRM_IOCTL_ETNAVIV_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_SUBMIT, struct drm_etnaviv_gem_submit) #define DRM_IOCTL_ETNAVIV_WAIT_FENCE DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_WAIT_FENCE, struct drm_etnaviv_wait_fence) #define DRM_IOCTL_ETNAVIV_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_USERPTR, struct drm_etnaviv_gem_userptr) #define DRM_IOCTL_ETNAVIV_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_WAIT, struct drm_etnaviv_gem_wait) #define DRM_IOCTL_ETNAVIV_PM_QUERY_DOM DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_DOM, struct drm_etnaviv_pm_domain) #define DRM_IOCTL_ETNAVIV_PM_QUERY_SIG DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_SIG, struct drm_etnaviv_pm_signal) #if defined(__cplusplus) } #endif #endif /* __ETNAVIV_DRM_H__ */ drm/exynos_drm.h 0000644 00000025575 15063602045 0007705 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* exynos_drm.h * * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Authors: * Inki Dae <inki.dae@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #ifndef _EXYNOS_DRM_H_ #define _EXYNOS_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /** * User-desired buffer creation information structure. * * @size: user-desired memory allocation size. * - this size value would be page-aligned internally. * @flags: user request for setting memory type or cache attributes. * @handle: returned a handle to created gem object. * - this handle will be set by gem module of kernel side. */ struct drm_exynos_gem_create { __u64 size; __u32 flags; __u32 handle; }; /** * A structure for getting a fake-offset that can be used with mmap. * * @handle: handle of gem object. * @reserved: just padding to be 64-bit aligned. * @offset: a fake-offset of gem object. */ struct drm_exynos_gem_map { __u32 handle; __u32 reserved; __u64 offset; }; /** * A structure to gem information. * * @handle: a handle to gem object created. * @flags: flag value including memory type and cache attribute and * this value would be set by driver. * @size: size to memory region allocated by gem and this size would * be set by driver. */ struct drm_exynos_gem_info { __u32 handle; __u32 flags; __u64 size; }; /** * A structure for user connection request of virtual display. * * @connection: indicate whether doing connection or not by user. * @extensions: if this value is 1 then the vidi driver would need additional * 128bytes edid data. * @edid: the edid data pointer from user side. */ struct drm_exynos_vidi_connection { __u32 connection; __u32 extensions; __u64 edid; }; /* memory type definitions. */ enum e_drm_exynos_gem_mem_type { /* Physically Continuous memory and used as default. */ EXYNOS_BO_CONTIG = 0 << 0, /* Physically Non-Continuous memory. */ EXYNOS_BO_NONCONTIG = 1 << 0, /* non-cachable mapping and used as default. */ EXYNOS_BO_NONCACHABLE = 0 << 1, /* cachable mapping. */ EXYNOS_BO_CACHABLE = 1 << 1, /* write-combine mapping. */ EXYNOS_BO_WC = 1 << 2, EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE | EXYNOS_BO_WC }; struct drm_exynos_g2d_get_ver { __u32 major; __u32 minor; }; struct drm_exynos_g2d_cmd { __u32 offset; __u32 data; }; enum drm_exynos_g2d_buf_type { G2D_BUF_USERPTR = 1 << 31, }; enum drm_exynos_g2d_event_type { G2D_EVENT_NOT, G2D_EVENT_NONSTOP, G2D_EVENT_STOP, /* not yet */ }; struct drm_exynos_g2d_userptr { unsigned long userptr; unsigned long size; }; struct drm_exynos_g2d_set_cmdlist { __u64 cmd; __u64 cmd_buf; __u32 cmd_nr; __u32 cmd_buf_nr; /* for g2d event */ __u64 event_type; __u64 user_data; }; struct drm_exynos_g2d_exec { __u64 async; }; /* Exynos DRM IPP v2 API */ /** * Enumerate available IPP hardware modules. * * @count_ipps: size of ipp_id array / number of ipp modules (set by driver) * @reserved: padding * @ipp_id_ptr: pointer to ipp_id array or NULL */ struct drm_exynos_ioctl_ipp_get_res { __u32 count_ipps; __u32 reserved; __u64 ipp_id_ptr; }; enum drm_exynos_ipp_format_type { DRM_EXYNOS_IPP_FORMAT_SOURCE = 0x01, DRM_EXYNOS_IPP_FORMAT_DESTINATION = 0x02, }; struct drm_exynos_ipp_format { __u32 fourcc; __u32 type; __u64 modifier; }; enum drm_exynos_ipp_capability { DRM_EXYNOS_IPP_CAP_CROP = 0x01, DRM_EXYNOS_IPP_CAP_ROTATE = 0x02, DRM_EXYNOS_IPP_CAP_SCALE = 0x04, DRM_EXYNOS_IPP_CAP_CONVERT = 0x08, }; /** * Get IPP hardware capabilities and supported image formats. * * @ipp_id: id of IPP module to query * @capabilities: bitmask of drm_exynos_ipp_capability (set by driver) * @reserved: padding * @formats_count: size of formats array (in entries) / number of filled * formats (set by driver) * @formats_ptr: pointer to formats array or NULL */ struct drm_exynos_ioctl_ipp_get_caps { __u32 ipp_id; __u32 capabilities; __u32 reserved; __u32 formats_count; __u64 formats_ptr; }; enum drm_exynos_ipp_limit_type { /* size (horizontal/vertial) limits, in pixels (min, max, alignment) */ DRM_EXYNOS_IPP_LIMIT_TYPE_SIZE = 0x0001, /* scale ratio (horizonta/vertial), 16.16 fixed point (min, max) */ DRM_EXYNOS_IPP_LIMIT_TYPE_SCALE = 0x0002, /* image buffer area */ DRM_EXYNOS_IPP_LIMIT_SIZE_BUFFER = 0x0001 << 16, /* src/dst rectangle area */ DRM_EXYNOS_IPP_LIMIT_SIZE_AREA = 0x0002 << 16, /* src/dst rectangle area when rotation enabled */ DRM_EXYNOS_IPP_LIMIT_SIZE_ROTATED = 0x0003 << 16, DRM_EXYNOS_IPP_LIMIT_TYPE_MASK = 0x000f, DRM_EXYNOS_IPP_LIMIT_SIZE_MASK = 0x000f << 16, }; struct drm_exynos_ipp_limit_val { __u32 min; __u32 max; __u32 align; __u32 reserved; }; /** * IPP module limitation. * * @type: limit type (see drm_exynos_ipp_limit_type enum) * @reserved: padding * @h: horizontal limits * @v: vertical limits */ struct drm_exynos_ipp_limit { __u32 type; __u32 reserved; struct drm_exynos_ipp_limit_val h; struct drm_exynos_ipp_limit_val v; }; /** * Get IPP limits for given image format. * * @ipp_id: id of IPP module to query * @fourcc: image format code (see DRM_FORMAT_* in drm_fourcc.h) * @modifier: image format modifier (see DRM_FORMAT_MOD_* in drm_fourcc.h) * @type: source/destination identifier (drm_exynos_ipp_format_flag enum) * @limits_count: size of limits array (in entries) / number of filled entries * (set by driver) * @limits_ptr: pointer to limits array or NULL */ struct drm_exynos_ioctl_ipp_get_limits { __u32 ipp_id; __u32 fourcc; __u64 modifier; __u32 type; __u32 limits_count; __u64 limits_ptr; }; enum drm_exynos_ipp_task_id { /* buffer described by struct drm_exynos_ipp_task_buffer */ DRM_EXYNOS_IPP_TASK_BUFFER = 0x0001, /* rectangle described by struct drm_exynos_ipp_task_rect */ DRM_EXYNOS_IPP_TASK_RECTANGLE = 0x0002, /* transformation described by struct drm_exynos_ipp_task_transform */ DRM_EXYNOS_IPP_TASK_TRANSFORM = 0x0003, /* alpha configuration described by struct drm_exynos_ipp_task_alpha */ DRM_EXYNOS_IPP_TASK_ALPHA = 0x0004, /* source image data (for buffer and rectangle chunks) */ DRM_EXYNOS_IPP_TASK_TYPE_SOURCE = 0x0001 << 16, /* destination image data (for buffer and rectangle chunks) */ DRM_EXYNOS_IPP_TASK_TYPE_DESTINATION = 0x0002 << 16, }; /** * Memory buffer with image data. * * @id: must be DRM_EXYNOS_IPP_TASK_BUFFER * other parameters are same as for AddFB2 generic DRM ioctl */ struct drm_exynos_ipp_task_buffer { __u32 id; __u32 fourcc; __u32 width, height; __u32 gem_id[4]; __u32 offset[4]; __u32 pitch[4]; __u64 modifier; }; /** * Rectangle for processing. * * @id: must be DRM_EXYNOS_IPP_TASK_RECTANGLE * @reserved: padding * @x,@y: left corner in pixels * @w,@h: width/height in pixels */ struct drm_exynos_ipp_task_rect { __u32 id; __u32 reserved; __u32 x; __u32 y; __u32 w; __u32 h; }; /** * Image tranformation description. * * @id: must be DRM_EXYNOS_IPP_TASK_TRANSFORM * @rotation: DRM_MODE_ROTATE_* and DRM_MODE_REFLECT_* values */ struct drm_exynos_ipp_task_transform { __u32 id; __u32 rotation; }; /** * Image global alpha configuration for formats without alpha values. * * @id: must be DRM_EXYNOS_IPP_TASK_ALPHA * @value: global alpha value (0-255) */ struct drm_exynos_ipp_task_alpha { __u32 id; __u32 value; }; enum drm_exynos_ipp_flag { /* generate DRM event after processing */ DRM_EXYNOS_IPP_FLAG_EVENT = 0x01, /* dry run, only check task parameters */ DRM_EXYNOS_IPP_FLAG_TEST_ONLY = 0x02, /* non-blocking processing */ DRM_EXYNOS_IPP_FLAG_NONBLOCK = 0x04, }; #define DRM_EXYNOS_IPP_FLAGS (DRM_EXYNOS_IPP_FLAG_EVENT |\ DRM_EXYNOS_IPP_FLAG_TEST_ONLY | DRM_EXYNOS_IPP_FLAG_NONBLOCK) /** * Perform image processing described by array of drm_exynos_ipp_task_* * structures (parameters array). * * @ipp_id: id of IPP module to run the task * @flags: bitmask of drm_exynos_ipp_flag values * @reserved: padding * @params_size: size of parameters array (in bytes) * @params_ptr: pointer to parameters array or NULL * @user_data: (optional) data for drm event */ struct drm_exynos_ioctl_ipp_commit { __u32 ipp_id; __u32 flags; __u32 reserved; __u32 params_size; __u64 params_ptr; __u64 user_data; }; #define DRM_EXYNOS_GEM_CREATE 0x00 #define DRM_EXYNOS_GEM_MAP 0x01 /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ #define DRM_EXYNOS_GEM_GET 0x04 #define DRM_EXYNOS_VIDI_CONNECTION 0x07 /* G2D */ #define DRM_EXYNOS_G2D_GET_VER 0x20 #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21 #define DRM_EXYNOS_G2D_EXEC 0x22 /* Reserved 0x30 ~ 0x33 for obsolete Exynos IPP ioctls */ /* IPP - Image Post Processing */ #define DRM_EXYNOS_IPP_GET_RESOURCES 0x40 #define DRM_EXYNOS_IPP_GET_CAPS 0x41 #define DRM_EXYNOS_IPP_GET_LIMITS 0x42 #define DRM_EXYNOS_IPP_COMMIT 0x43 #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) #define DRM_IOCTL_EXYNOS_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_MAP, struct drm_exynos_gem_map) #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info) #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection) #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver) #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist) #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec) #define DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_GET_RESOURCES, \ struct drm_exynos_ioctl_ipp_get_res) #define DRM_IOCTL_EXYNOS_IPP_GET_CAPS DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_GET_CAPS, struct drm_exynos_ioctl_ipp_get_caps) #define DRM_IOCTL_EXYNOS_IPP_GET_LIMITS DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_GET_LIMITS, \ struct drm_exynos_ioctl_ipp_get_limits) #define DRM_IOCTL_EXYNOS_IPP_COMMIT DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_IPP_COMMIT, struct drm_exynos_ioctl_ipp_commit) /* Exynos specific events */ #define DRM_EXYNOS_G2D_EVENT 0x80000000 #define DRM_EXYNOS_IPP_EVENT 0x80000002 struct drm_exynos_g2d_event { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 cmdlist_no; __u32 reserved; }; struct drm_exynos_ipp_event { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 ipp_id; __u32 sequence; __u64 reserved; }; #if defined(__cplusplus) } #endif #endif /* _EXYNOS_DRM_H_ */ drm/habanalabs_accel.h 0000644 00000224536 15063602045 0010717 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note * * Copyright 2016-2022 HabanaLabs, Ltd. * All Rights Reserved. * */ #ifndef HABANALABS_H_ #define HABANALABS_H_ #include <linux/types.h> #include <linux/ioctl.h> /* * Defines that are asic-specific but constitutes as ABI between kernel driver * and userspace */ #define GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START 0x8000 /* 32KB */ #define GAUDI_DRIVER_SRAM_RESERVED_SIZE_FROM_START 0x80 /* 128 bytes */ /* * 128 SOBs reserved for collective wait * 16 SOBs reserved for sync stream */ #define GAUDI_FIRST_AVAILABLE_W_S_SYNC_OBJECT 144 /* * 64 monitors reserved for collective wait * 8 monitors reserved for sync stream */ #define GAUDI_FIRST_AVAILABLE_W_S_MONITOR 72 /* Max number of elements in timestamps registration buffers */ #define TS_MAX_ELEMENTS_NUM (1 << 20) /* 1MB */ /* * Goya queue Numbering * * The external queues (PCI DMA channels) MUST be before the internal queues * and each group (PCI DMA channels and internal) must be contiguous inside * itself but there can be a gap between the two groups (although not * recommended) */ enum goya_queue_id { GOYA_QUEUE_ID_DMA_0 = 0, GOYA_QUEUE_ID_DMA_1 = 1, GOYA_QUEUE_ID_DMA_2 = 2, GOYA_QUEUE_ID_DMA_3 = 3, GOYA_QUEUE_ID_DMA_4 = 4, GOYA_QUEUE_ID_CPU_PQ = 5, GOYA_QUEUE_ID_MME = 6, /* Internal queues start here */ GOYA_QUEUE_ID_TPC0 = 7, GOYA_QUEUE_ID_TPC1 = 8, GOYA_QUEUE_ID_TPC2 = 9, GOYA_QUEUE_ID_TPC3 = 10, GOYA_QUEUE_ID_TPC4 = 11, GOYA_QUEUE_ID_TPC5 = 12, GOYA_QUEUE_ID_TPC6 = 13, GOYA_QUEUE_ID_TPC7 = 14, GOYA_QUEUE_ID_SIZE }; /* * Gaudi queue Numbering * External queues (PCI DMA channels) are DMA_0_*, DMA_1_* and DMA_5_*. * Except one CPU queue, all the rest are internal queues. */ enum gaudi_queue_id { GAUDI_QUEUE_ID_DMA_0_0 = 0, /* external */ GAUDI_QUEUE_ID_DMA_0_1 = 1, /* external */ GAUDI_QUEUE_ID_DMA_0_2 = 2, /* external */ GAUDI_QUEUE_ID_DMA_0_3 = 3, /* external */ GAUDI_QUEUE_ID_DMA_1_0 = 4, /* external */ GAUDI_QUEUE_ID_DMA_1_1 = 5, /* external */ GAUDI_QUEUE_ID_DMA_1_2 = 6, /* external */ GAUDI_QUEUE_ID_DMA_1_3 = 7, /* external */ GAUDI_QUEUE_ID_CPU_PQ = 8, /* CPU */ GAUDI_QUEUE_ID_DMA_2_0 = 9, /* internal */ GAUDI_QUEUE_ID_DMA_2_1 = 10, /* internal */ GAUDI_QUEUE_ID_DMA_2_2 = 11, /* internal */ GAUDI_QUEUE_ID_DMA_2_3 = 12, /* internal */ GAUDI_QUEUE_ID_DMA_3_0 = 13, /* internal */ GAUDI_QUEUE_ID_DMA_3_1 = 14, /* internal */ GAUDI_QUEUE_ID_DMA_3_2 = 15, /* internal */ GAUDI_QUEUE_ID_DMA_3_3 = 16, /* internal */ GAUDI_QUEUE_ID_DMA_4_0 = 17, /* internal */ GAUDI_QUEUE_ID_DMA_4_1 = 18, /* internal */ GAUDI_QUEUE_ID_DMA_4_2 = 19, /* internal */ GAUDI_QUEUE_ID_DMA_4_3 = 20, /* internal */ GAUDI_QUEUE_ID_DMA_5_0 = 21, /* internal */ GAUDI_QUEUE_ID_DMA_5_1 = 22, /* internal */ GAUDI_QUEUE_ID_DMA_5_2 = 23, /* internal */ GAUDI_QUEUE_ID_DMA_5_3 = 24, /* internal */ GAUDI_QUEUE_ID_DMA_6_0 = 25, /* internal */ GAUDI_QUEUE_ID_DMA_6_1 = 26, /* internal */ GAUDI_QUEUE_ID_DMA_6_2 = 27, /* internal */ GAUDI_QUEUE_ID_DMA_6_3 = 28, /* internal */ GAUDI_QUEUE_ID_DMA_7_0 = 29, /* internal */ GAUDI_QUEUE_ID_DMA_7_1 = 30, /* internal */ GAUDI_QUEUE_ID_DMA_7_2 = 31, /* internal */ GAUDI_QUEUE_ID_DMA_7_3 = 32, /* internal */ GAUDI_QUEUE_ID_MME_0_0 = 33, /* internal */ GAUDI_QUEUE_ID_MME_0_1 = 34, /* internal */ GAUDI_QUEUE_ID_MME_0_2 = 35, /* internal */ GAUDI_QUEUE_ID_MME_0_3 = 36, /* internal */ GAUDI_QUEUE_ID_MME_1_0 = 37, /* internal */ GAUDI_QUEUE_ID_MME_1_1 = 38, /* internal */ GAUDI_QUEUE_ID_MME_1_2 = 39, /* internal */ GAUDI_QUEUE_ID_MME_1_3 = 40, /* internal */ GAUDI_QUEUE_ID_TPC_0_0 = 41, /* internal */ GAUDI_QUEUE_ID_TPC_0_1 = 42, /* internal */ GAUDI_QUEUE_ID_TPC_0_2 = 43, /* internal */ GAUDI_QUEUE_ID_TPC_0_3 = 44, /* internal */ GAUDI_QUEUE_ID_TPC_1_0 = 45, /* internal */ GAUDI_QUEUE_ID_TPC_1_1 = 46, /* internal */ GAUDI_QUEUE_ID_TPC_1_2 = 47, /* internal */ GAUDI_QUEUE_ID_TPC_1_3 = 48, /* internal */ GAUDI_QUEUE_ID_TPC_2_0 = 49, /* internal */ GAUDI_QUEUE_ID_TPC_2_1 = 50, /* internal */ GAUDI_QUEUE_ID_TPC_2_2 = 51, /* internal */ GAUDI_QUEUE_ID_TPC_2_3 = 52, /* internal */ GAUDI_QUEUE_ID_TPC_3_0 = 53, /* internal */ GAUDI_QUEUE_ID_TPC_3_1 = 54, /* internal */ GAUDI_QUEUE_ID_TPC_3_2 = 55, /* internal */ GAUDI_QUEUE_ID_TPC_3_3 = 56, /* internal */ GAUDI_QUEUE_ID_TPC_4_0 = 57, /* internal */ GAUDI_QUEUE_ID_TPC_4_1 = 58, /* internal */ GAUDI_QUEUE_ID_TPC_4_2 = 59, /* internal */ GAUDI_QUEUE_ID_TPC_4_3 = 60, /* internal */ GAUDI_QUEUE_ID_TPC_5_0 = 61, /* internal */ GAUDI_QUEUE_ID_TPC_5_1 = 62, /* internal */ GAUDI_QUEUE_ID_TPC_5_2 = 63, /* internal */ GAUDI_QUEUE_ID_TPC_5_3 = 64, /* internal */ GAUDI_QUEUE_ID_TPC_6_0 = 65, /* internal */ GAUDI_QUEUE_ID_TPC_6_1 = 66, /* internal */ GAUDI_QUEUE_ID_TPC_6_2 = 67, /* internal */ GAUDI_QUEUE_ID_TPC_6_3 = 68, /* internal */ GAUDI_QUEUE_ID_TPC_7_0 = 69, /* internal */ GAUDI_QUEUE_ID_TPC_7_1 = 70, /* internal */ GAUDI_QUEUE_ID_TPC_7_2 = 71, /* internal */ GAUDI_QUEUE_ID_TPC_7_3 = 72, /* internal */ GAUDI_QUEUE_ID_NIC_0_0 = 73, /* internal */ GAUDI_QUEUE_ID_NIC_0_1 = 74, /* internal */ GAUDI_QUEUE_ID_NIC_0_2 = 75, /* internal */ GAUDI_QUEUE_ID_NIC_0_3 = 76, /* internal */ GAUDI_QUEUE_ID_NIC_1_0 = 77, /* internal */ GAUDI_QUEUE_ID_NIC_1_1 = 78, /* internal */ GAUDI_QUEUE_ID_NIC_1_2 = 79, /* internal */ GAUDI_QUEUE_ID_NIC_1_3 = 80, /* internal */ GAUDI_QUEUE_ID_NIC_2_0 = 81, /* internal */ GAUDI_QUEUE_ID_NIC_2_1 = 82, /* internal */ GAUDI_QUEUE_ID_NIC_2_2 = 83, /* internal */ GAUDI_QUEUE_ID_NIC_2_3 = 84, /* internal */ GAUDI_QUEUE_ID_NIC_3_0 = 85, /* internal */ GAUDI_QUEUE_ID_NIC_3_1 = 86, /* internal */ GAUDI_QUEUE_ID_NIC_3_2 = 87, /* internal */ GAUDI_QUEUE_ID_NIC_3_3 = 88, /* internal */ GAUDI_QUEUE_ID_NIC_4_0 = 89, /* internal */ GAUDI_QUEUE_ID_NIC_4_1 = 90, /* internal */ GAUDI_QUEUE_ID_NIC_4_2 = 91, /* internal */ GAUDI_QUEUE_ID_NIC_4_3 = 92, /* internal */ GAUDI_QUEUE_ID_NIC_5_0 = 93, /* internal */ GAUDI_QUEUE_ID_NIC_5_1 = 94, /* internal */ GAUDI_QUEUE_ID_NIC_5_2 = 95, /* internal */ GAUDI_QUEUE_ID_NIC_5_3 = 96, /* internal */ GAUDI_QUEUE_ID_NIC_6_0 = 97, /* internal */ GAUDI_QUEUE_ID_NIC_6_1 = 98, /* internal */ GAUDI_QUEUE_ID_NIC_6_2 = 99, /* internal */ GAUDI_QUEUE_ID_NIC_6_3 = 100, /* internal */ GAUDI_QUEUE_ID_NIC_7_0 = 101, /* internal */ GAUDI_QUEUE_ID_NIC_7_1 = 102, /* internal */ GAUDI_QUEUE_ID_NIC_7_2 = 103, /* internal */ GAUDI_QUEUE_ID_NIC_7_3 = 104, /* internal */ GAUDI_QUEUE_ID_NIC_8_0 = 105, /* internal */ GAUDI_QUEUE_ID_NIC_8_1 = 106, /* internal */ GAUDI_QUEUE_ID_NIC_8_2 = 107, /* internal */ GAUDI_QUEUE_ID_NIC_8_3 = 108, /* internal */ GAUDI_QUEUE_ID_NIC_9_0 = 109, /* internal */ GAUDI_QUEUE_ID_NIC_9_1 = 110, /* internal */ GAUDI_QUEUE_ID_NIC_9_2 = 111, /* internal */ GAUDI_QUEUE_ID_NIC_9_3 = 112, /* internal */ GAUDI_QUEUE_ID_SIZE }; /* * In GAUDI2 we have two modes of operation in regard to queues: * 1. Legacy mode, where each QMAN exposes 4 streams to the user * 2. F/W mode, where we use F/W to schedule the JOBS to the different queues. * * When in legacy mode, the user sends the queue id per JOB according to * enum gaudi2_queue_id below. * * When in F/W mode, the user sends a stream id per Command Submission. The * stream id is a running number from 0 up to (N-1), where N is the number * of streams the F/W exposes and is passed to the user in * struct hl_info_hw_ip_info */ enum gaudi2_queue_id { GAUDI2_QUEUE_ID_PDMA_0_0 = 0, GAUDI2_QUEUE_ID_PDMA_0_1 = 1, GAUDI2_QUEUE_ID_PDMA_0_2 = 2, GAUDI2_QUEUE_ID_PDMA_0_3 = 3, GAUDI2_QUEUE_ID_PDMA_1_0 = 4, GAUDI2_QUEUE_ID_PDMA_1_1 = 5, GAUDI2_QUEUE_ID_PDMA_1_2 = 6, GAUDI2_QUEUE_ID_PDMA_1_3 = 7, GAUDI2_QUEUE_ID_DCORE0_EDMA_0_0 = 8, GAUDI2_QUEUE_ID_DCORE0_EDMA_0_1 = 9, GAUDI2_QUEUE_ID_DCORE0_EDMA_0_2 = 10, GAUDI2_QUEUE_ID_DCORE0_EDMA_0_3 = 11, GAUDI2_QUEUE_ID_DCORE0_EDMA_1_0 = 12, GAUDI2_QUEUE_ID_DCORE0_EDMA_1_1 = 13, GAUDI2_QUEUE_ID_DCORE0_EDMA_1_2 = 14, GAUDI2_QUEUE_ID_DCORE0_EDMA_1_3 = 15, GAUDI2_QUEUE_ID_DCORE0_MME_0_0 = 16, GAUDI2_QUEUE_ID_DCORE0_MME_0_1 = 17, GAUDI2_QUEUE_ID_DCORE0_MME_0_2 = 18, GAUDI2_QUEUE_ID_DCORE0_MME_0_3 = 19, GAUDI2_QUEUE_ID_DCORE0_TPC_0_0 = 20, GAUDI2_QUEUE_ID_DCORE0_TPC_0_1 = 21, GAUDI2_QUEUE_ID_DCORE0_TPC_0_2 = 22, GAUDI2_QUEUE_ID_DCORE0_TPC_0_3 = 23, GAUDI2_QUEUE_ID_DCORE0_TPC_1_0 = 24, GAUDI2_QUEUE_ID_DCORE0_TPC_1_1 = 25, GAUDI2_QUEUE_ID_DCORE0_TPC_1_2 = 26, GAUDI2_QUEUE_ID_DCORE0_TPC_1_3 = 27, GAUDI2_QUEUE_ID_DCORE0_TPC_2_0 = 28, GAUDI2_QUEUE_ID_DCORE0_TPC_2_1 = 29, GAUDI2_QUEUE_ID_DCORE0_TPC_2_2 = 30, GAUDI2_QUEUE_ID_DCORE0_TPC_2_3 = 31, GAUDI2_QUEUE_ID_DCORE0_TPC_3_0 = 32, GAUDI2_QUEUE_ID_DCORE0_TPC_3_1 = 33, GAUDI2_QUEUE_ID_DCORE0_TPC_3_2 = 34, GAUDI2_QUEUE_ID_DCORE0_TPC_3_3 = 35, GAUDI2_QUEUE_ID_DCORE0_TPC_4_0 = 36, GAUDI2_QUEUE_ID_DCORE0_TPC_4_1 = 37, GAUDI2_QUEUE_ID_DCORE0_TPC_4_2 = 38, GAUDI2_QUEUE_ID_DCORE0_TPC_4_3 = 39, GAUDI2_QUEUE_ID_DCORE0_TPC_5_0 = 40, GAUDI2_QUEUE_ID_DCORE0_TPC_5_1 = 41, GAUDI2_QUEUE_ID_DCORE0_TPC_5_2 = 42, GAUDI2_QUEUE_ID_DCORE0_TPC_5_3 = 43, GAUDI2_QUEUE_ID_DCORE0_TPC_6_0 = 44, GAUDI2_QUEUE_ID_DCORE0_TPC_6_1 = 45, GAUDI2_QUEUE_ID_DCORE0_TPC_6_2 = 46, GAUDI2_QUEUE_ID_DCORE0_TPC_6_3 = 47, GAUDI2_QUEUE_ID_DCORE1_EDMA_0_0 = 48, GAUDI2_QUEUE_ID_DCORE1_EDMA_0_1 = 49, GAUDI2_QUEUE_ID_DCORE1_EDMA_0_2 = 50, GAUDI2_QUEUE_ID_DCORE1_EDMA_0_3 = 51, GAUDI2_QUEUE_ID_DCORE1_EDMA_1_0 = 52, GAUDI2_QUEUE_ID_DCORE1_EDMA_1_1 = 53, GAUDI2_QUEUE_ID_DCORE1_EDMA_1_2 = 54, GAUDI2_QUEUE_ID_DCORE1_EDMA_1_3 = 55, GAUDI2_QUEUE_ID_DCORE1_MME_0_0 = 56, GAUDI2_QUEUE_ID_DCORE1_MME_0_1 = 57, GAUDI2_QUEUE_ID_DCORE1_MME_0_2 = 58, GAUDI2_QUEUE_ID_DCORE1_MME_0_3 = 59, GAUDI2_QUEUE_ID_DCORE1_TPC_0_0 = 60, GAUDI2_QUEUE_ID_DCORE1_TPC_0_1 = 61, GAUDI2_QUEUE_ID_DCORE1_TPC_0_2 = 62, GAUDI2_QUEUE_ID_DCORE1_TPC_0_3 = 63, GAUDI2_QUEUE_ID_DCORE1_TPC_1_0 = 64, GAUDI2_QUEUE_ID_DCORE1_TPC_1_1 = 65, GAUDI2_QUEUE_ID_DCORE1_TPC_1_2 = 66, GAUDI2_QUEUE_ID_DCORE1_TPC_1_3 = 67, GAUDI2_QUEUE_ID_DCORE1_TPC_2_0 = 68, GAUDI2_QUEUE_ID_DCORE1_TPC_2_1 = 69, GAUDI2_QUEUE_ID_DCORE1_TPC_2_2 = 70, GAUDI2_QUEUE_ID_DCORE1_TPC_2_3 = 71, GAUDI2_QUEUE_ID_DCORE1_TPC_3_0 = 72, GAUDI2_QUEUE_ID_DCORE1_TPC_3_1 = 73, GAUDI2_QUEUE_ID_DCORE1_TPC_3_2 = 74, GAUDI2_QUEUE_ID_DCORE1_TPC_3_3 = 75, GAUDI2_QUEUE_ID_DCORE1_TPC_4_0 = 76, GAUDI2_QUEUE_ID_DCORE1_TPC_4_1 = 77, GAUDI2_QUEUE_ID_DCORE1_TPC_4_2 = 78, GAUDI2_QUEUE_ID_DCORE1_TPC_4_3 = 79, GAUDI2_QUEUE_ID_DCORE1_TPC_5_0 = 80, GAUDI2_QUEUE_ID_DCORE1_TPC_5_1 = 81, GAUDI2_QUEUE_ID_DCORE1_TPC_5_2 = 82, GAUDI2_QUEUE_ID_DCORE1_TPC_5_3 = 83, GAUDI2_QUEUE_ID_DCORE2_EDMA_0_0 = 84, GAUDI2_QUEUE_ID_DCORE2_EDMA_0_1 = 85, GAUDI2_QUEUE_ID_DCORE2_EDMA_0_2 = 86, GAUDI2_QUEUE_ID_DCORE2_EDMA_0_3 = 87, GAUDI2_QUEUE_ID_DCORE2_EDMA_1_0 = 88, GAUDI2_QUEUE_ID_DCORE2_EDMA_1_1 = 89, GAUDI2_QUEUE_ID_DCORE2_EDMA_1_2 = 90, GAUDI2_QUEUE_ID_DCORE2_EDMA_1_3 = 91, GAUDI2_QUEUE_ID_DCORE2_MME_0_0 = 92, GAUDI2_QUEUE_ID_DCORE2_MME_0_1 = 93, GAUDI2_QUEUE_ID_DCORE2_MME_0_2 = 94, GAUDI2_QUEUE_ID_DCORE2_MME_0_3 = 95, GAUDI2_QUEUE_ID_DCORE2_TPC_0_0 = 96, GAUDI2_QUEUE_ID_DCORE2_TPC_0_1 = 97, GAUDI2_QUEUE_ID_DCORE2_TPC_0_2 = 98, GAUDI2_QUEUE_ID_DCORE2_TPC_0_3 = 99, GAUDI2_QUEUE_ID_DCORE2_TPC_1_0 = 100, GAUDI2_QUEUE_ID_DCORE2_TPC_1_1 = 101, GAUDI2_QUEUE_ID_DCORE2_TPC_1_2 = 102, GAUDI2_QUEUE_ID_DCORE2_TPC_1_3 = 103, GAUDI2_QUEUE_ID_DCORE2_TPC_2_0 = 104, GAUDI2_QUEUE_ID_DCORE2_TPC_2_1 = 105, GAUDI2_QUEUE_ID_DCORE2_TPC_2_2 = 106, GAUDI2_QUEUE_ID_DCORE2_TPC_2_3 = 107, GAUDI2_QUEUE_ID_DCORE2_TPC_3_0 = 108, GAUDI2_QUEUE_ID_DCORE2_TPC_3_1 = 109, GAUDI2_QUEUE_ID_DCORE2_TPC_3_2 = 110, GAUDI2_QUEUE_ID_DCORE2_TPC_3_3 = 111, GAUDI2_QUEUE_ID_DCORE2_TPC_4_0 = 112, GAUDI2_QUEUE_ID_DCORE2_TPC_4_1 = 113, GAUDI2_QUEUE_ID_DCORE2_TPC_4_2 = 114, GAUDI2_QUEUE_ID_DCORE2_TPC_4_3 = 115, GAUDI2_QUEUE_ID_DCORE2_TPC_5_0 = 116, GAUDI2_QUEUE_ID_DCORE2_TPC_5_1 = 117, GAUDI2_QUEUE_ID_DCORE2_TPC_5_2 = 118, GAUDI2_QUEUE_ID_DCORE2_TPC_5_3 = 119, GAUDI2_QUEUE_ID_DCORE3_EDMA_0_0 = 120, GAUDI2_QUEUE_ID_DCORE3_EDMA_0_1 = 121, GAUDI2_QUEUE_ID_DCORE3_EDMA_0_2 = 122, GAUDI2_QUEUE_ID_DCORE3_EDMA_0_3 = 123, GAUDI2_QUEUE_ID_DCORE3_EDMA_1_0 = 124, GAUDI2_QUEUE_ID_DCORE3_EDMA_1_1 = 125, GAUDI2_QUEUE_ID_DCORE3_EDMA_1_2 = 126, GAUDI2_QUEUE_ID_DCORE3_EDMA_1_3 = 127, GAUDI2_QUEUE_ID_DCORE3_MME_0_0 = 128, GAUDI2_QUEUE_ID_DCORE3_MME_0_1 = 129, GAUDI2_QUEUE_ID_DCORE3_MME_0_2 = 130, GAUDI2_QUEUE_ID_DCORE3_MME_0_3 = 131, GAUDI2_QUEUE_ID_DCORE3_TPC_0_0 = 132, GAUDI2_QUEUE_ID_DCORE3_TPC_0_1 = 133, GAUDI2_QUEUE_ID_DCORE3_TPC_0_2 = 134, GAUDI2_QUEUE_ID_DCORE3_TPC_0_3 = 135, GAUDI2_QUEUE_ID_DCORE3_TPC_1_0 = 136, GAUDI2_QUEUE_ID_DCORE3_TPC_1_1 = 137, GAUDI2_QUEUE_ID_DCORE3_TPC_1_2 = 138, GAUDI2_QUEUE_ID_DCORE3_TPC_1_3 = 139, GAUDI2_QUEUE_ID_DCORE3_TPC_2_0 = 140, GAUDI2_QUEUE_ID_DCORE3_TPC_2_1 = 141, GAUDI2_QUEUE_ID_DCORE3_TPC_2_2 = 142, GAUDI2_QUEUE_ID_DCORE3_TPC_2_3 = 143, GAUDI2_QUEUE_ID_DCORE3_TPC_3_0 = 144, GAUDI2_QUEUE_ID_DCORE3_TPC_3_1 = 145, GAUDI2_QUEUE_ID_DCORE3_TPC_3_2 = 146, GAUDI2_QUEUE_ID_DCORE3_TPC_3_3 = 147, GAUDI2_QUEUE_ID_DCORE3_TPC_4_0 = 148, GAUDI2_QUEUE_ID_DCORE3_TPC_4_1 = 149, GAUDI2_QUEUE_ID_DCORE3_TPC_4_2 = 150, GAUDI2_QUEUE_ID_DCORE3_TPC_4_3 = 151, GAUDI2_QUEUE_ID_DCORE3_TPC_5_0 = 152, GAUDI2_QUEUE_ID_DCORE3_TPC_5_1 = 153, GAUDI2_QUEUE_ID_DCORE3_TPC_5_2 = 154, GAUDI2_QUEUE_ID_DCORE3_TPC_5_3 = 155, GAUDI2_QUEUE_ID_NIC_0_0 = 156, GAUDI2_QUEUE_ID_NIC_0_1 = 157, GAUDI2_QUEUE_ID_NIC_0_2 = 158, GAUDI2_QUEUE_ID_NIC_0_3 = 159, GAUDI2_QUEUE_ID_NIC_1_0 = 160, GAUDI2_QUEUE_ID_NIC_1_1 = 161, GAUDI2_QUEUE_ID_NIC_1_2 = 162, GAUDI2_QUEUE_ID_NIC_1_3 = 163, GAUDI2_QUEUE_ID_NIC_2_0 = 164, GAUDI2_QUEUE_ID_NIC_2_1 = 165, GAUDI2_QUEUE_ID_NIC_2_2 = 166, GAUDI2_QUEUE_ID_NIC_2_3 = 167, GAUDI2_QUEUE_ID_NIC_3_0 = 168, GAUDI2_QUEUE_ID_NIC_3_1 = 169, GAUDI2_QUEUE_ID_NIC_3_2 = 170, GAUDI2_QUEUE_ID_NIC_3_3 = 171, GAUDI2_QUEUE_ID_NIC_4_0 = 172, GAUDI2_QUEUE_ID_NIC_4_1 = 173, GAUDI2_QUEUE_ID_NIC_4_2 = 174, GAUDI2_QUEUE_ID_NIC_4_3 = 175, GAUDI2_QUEUE_ID_NIC_5_0 = 176, GAUDI2_QUEUE_ID_NIC_5_1 = 177, GAUDI2_QUEUE_ID_NIC_5_2 = 178, GAUDI2_QUEUE_ID_NIC_5_3 = 179, GAUDI2_QUEUE_ID_NIC_6_0 = 180, GAUDI2_QUEUE_ID_NIC_6_1 = 181, GAUDI2_QUEUE_ID_NIC_6_2 = 182, GAUDI2_QUEUE_ID_NIC_6_3 = 183, GAUDI2_QUEUE_ID_NIC_7_0 = 184, GAUDI2_QUEUE_ID_NIC_7_1 = 185, GAUDI2_QUEUE_ID_NIC_7_2 = 186, GAUDI2_QUEUE_ID_NIC_7_3 = 187, GAUDI2_QUEUE_ID_NIC_8_0 = 188, GAUDI2_QUEUE_ID_NIC_8_1 = 189, GAUDI2_QUEUE_ID_NIC_8_2 = 190, GAUDI2_QUEUE_ID_NIC_8_3 = 191, GAUDI2_QUEUE_ID_NIC_9_0 = 192, GAUDI2_QUEUE_ID_NIC_9_1 = 193, GAUDI2_QUEUE_ID_NIC_9_2 = 194, GAUDI2_QUEUE_ID_NIC_9_3 = 195, GAUDI2_QUEUE_ID_NIC_10_0 = 196, GAUDI2_QUEUE_ID_NIC_10_1 = 197, GAUDI2_QUEUE_ID_NIC_10_2 = 198, GAUDI2_QUEUE_ID_NIC_10_3 = 199, GAUDI2_QUEUE_ID_NIC_11_0 = 200, GAUDI2_QUEUE_ID_NIC_11_1 = 201, GAUDI2_QUEUE_ID_NIC_11_2 = 202, GAUDI2_QUEUE_ID_NIC_11_3 = 203, GAUDI2_QUEUE_ID_NIC_12_0 = 204, GAUDI2_QUEUE_ID_NIC_12_1 = 205, GAUDI2_QUEUE_ID_NIC_12_2 = 206, GAUDI2_QUEUE_ID_NIC_12_3 = 207, GAUDI2_QUEUE_ID_NIC_13_0 = 208, GAUDI2_QUEUE_ID_NIC_13_1 = 209, GAUDI2_QUEUE_ID_NIC_13_2 = 210, GAUDI2_QUEUE_ID_NIC_13_3 = 211, GAUDI2_QUEUE_ID_NIC_14_0 = 212, GAUDI2_QUEUE_ID_NIC_14_1 = 213, GAUDI2_QUEUE_ID_NIC_14_2 = 214, GAUDI2_QUEUE_ID_NIC_14_3 = 215, GAUDI2_QUEUE_ID_NIC_15_0 = 216, GAUDI2_QUEUE_ID_NIC_15_1 = 217, GAUDI2_QUEUE_ID_NIC_15_2 = 218, GAUDI2_QUEUE_ID_NIC_15_3 = 219, GAUDI2_QUEUE_ID_NIC_16_0 = 220, GAUDI2_QUEUE_ID_NIC_16_1 = 221, GAUDI2_QUEUE_ID_NIC_16_2 = 222, GAUDI2_QUEUE_ID_NIC_16_3 = 223, GAUDI2_QUEUE_ID_NIC_17_0 = 224, GAUDI2_QUEUE_ID_NIC_17_1 = 225, GAUDI2_QUEUE_ID_NIC_17_2 = 226, GAUDI2_QUEUE_ID_NIC_17_3 = 227, GAUDI2_QUEUE_ID_NIC_18_0 = 228, GAUDI2_QUEUE_ID_NIC_18_1 = 229, GAUDI2_QUEUE_ID_NIC_18_2 = 230, GAUDI2_QUEUE_ID_NIC_18_3 = 231, GAUDI2_QUEUE_ID_NIC_19_0 = 232, GAUDI2_QUEUE_ID_NIC_19_1 = 233, GAUDI2_QUEUE_ID_NIC_19_2 = 234, GAUDI2_QUEUE_ID_NIC_19_3 = 235, GAUDI2_QUEUE_ID_NIC_20_0 = 236, GAUDI2_QUEUE_ID_NIC_20_1 = 237, GAUDI2_QUEUE_ID_NIC_20_2 = 238, GAUDI2_QUEUE_ID_NIC_20_3 = 239, GAUDI2_QUEUE_ID_NIC_21_0 = 240, GAUDI2_QUEUE_ID_NIC_21_1 = 241, GAUDI2_QUEUE_ID_NIC_21_2 = 242, GAUDI2_QUEUE_ID_NIC_21_3 = 243, GAUDI2_QUEUE_ID_NIC_22_0 = 244, GAUDI2_QUEUE_ID_NIC_22_1 = 245, GAUDI2_QUEUE_ID_NIC_22_2 = 246, GAUDI2_QUEUE_ID_NIC_22_3 = 247, GAUDI2_QUEUE_ID_NIC_23_0 = 248, GAUDI2_QUEUE_ID_NIC_23_1 = 249, GAUDI2_QUEUE_ID_NIC_23_2 = 250, GAUDI2_QUEUE_ID_NIC_23_3 = 251, GAUDI2_QUEUE_ID_ROT_0_0 = 252, GAUDI2_QUEUE_ID_ROT_0_1 = 253, GAUDI2_QUEUE_ID_ROT_0_2 = 254, GAUDI2_QUEUE_ID_ROT_0_3 = 255, GAUDI2_QUEUE_ID_ROT_1_0 = 256, GAUDI2_QUEUE_ID_ROT_1_1 = 257, GAUDI2_QUEUE_ID_ROT_1_2 = 258, GAUDI2_QUEUE_ID_ROT_1_3 = 259, GAUDI2_QUEUE_ID_CPU_PQ = 260, GAUDI2_QUEUE_ID_SIZE }; /* * Engine Numbering * * Used in the "busy_engines_mask" field in `struct hl_info_hw_idle' */ enum goya_engine_id { GOYA_ENGINE_ID_DMA_0 = 0, GOYA_ENGINE_ID_DMA_1, GOYA_ENGINE_ID_DMA_2, GOYA_ENGINE_ID_DMA_3, GOYA_ENGINE_ID_DMA_4, GOYA_ENGINE_ID_MME_0, GOYA_ENGINE_ID_TPC_0, GOYA_ENGINE_ID_TPC_1, GOYA_ENGINE_ID_TPC_2, GOYA_ENGINE_ID_TPC_3, GOYA_ENGINE_ID_TPC_4, GOYA_ENGINE_ID_TPC_5, GOYA_ENGINE_ID_TPC_6, GOYA_ENGINE_ID_TPC_7, GOYA_ENGINE_ID_SIZE }; enum gaudi_engine_id { GAUDI_ENGINE_ID_DMA_0 = 0, GAUDI_ENGINE_ID_DMA_1, GAUDI_ENGINE_ID_DMA_2, GAUDI_ENGINE_ID_DMA_3, GAUDI_ENGINE_ID_DMA_4, GAUDI_ENGINE_ID_DMA_5, GAUDI_ENGINE_ID_DMA_6, GAUDI_ENGINE_ID_DMA_7, GAUDI_ENGINE_ID_MME_0, GAUDI_ENGINE_ID_MME_1, GAUDI_ENGINE_ID_MME_2, GAUDI_ENGINE_ID_MME_3, GAUDI_ENGINE_ID_TPC_0, GAUDI_ENGINE_ID_TPC_1, GAUDI_ENGINE_ID_TPC_2, GAUDI_ENGINE_ID_TPC_3, GAUDI_ENGINE_ID_TPC_4, GAUDI_ENGINE_ID_TPC_5, GAUDI_ENGINE_ID_TPC_6, GAUDI_ENGINE_ID_TPC_7, GAUDI_ENGINE_ID_NIC_0, GAUDI_ENGINE_ID_NIC_1, GAUDI_ENGINE_ID_NIC_2, GAUDI_ENGINE_ID_NIC_3, GAUDI_ENGINE_ID_NIC_4, GAUDI_ENGINE_ID_NIC_5, GAUDI_ENGINE_ID_NIC_6, GAUDI_ENGINE_ID_NIC_7, GAUDI_ENGINE_ID_NIC_8, GAUDI_ENGINE_ID_NIC_9, GAUDI_ENGINE_ID_SIZE }; enum gaudi2_engine_id { GAUDI2_DCORE0_ENGINE_ID_EDMA_0 = 0, GAUDI2_DCORE0_ENGINE_ID_EDMA_1, GAUDI2_DCORE0_ENGINE_ID_MME, GAUDI2_DCORE0_ENGINE_ID_TPC_0, GAUDI2_DCORE0_ENGINE_ID_TPC_1, GAUDI2_DCORE0_ENGINE_ID_TPC_2, GAUDI2_DCORE0_ENGINE_ID_TPC_3, GAUDI2_DCORE0_ENGINE_ID_TPC_4, GAUDI2_DCORE0_ENGINE_ID_TPC_5, GAUDI2_DCORE0_ENGINE_ID_DEC_0, GAUDI2_DCORE0_ENGINE_ID_DEC_1, GAUDI2_DCORE1_ENGINE_ID_EDMA_0, GAUDI2_DCORE1_ENGINE_ID_EDMA_1, GAUDI2_DCORE1_ENGINE_ID_MME, GAUDI2_DCORE1_ENGINE_ID_TPC_0, GAUDI2_DCORE1_ENGINE_ID_TPC_1, GAUDI2_DCORE1_ENGINE_ID_TPC_2, GAUDI2_DCORE1_ENGINE_ID_TPC_3, GAUDI2_DCORE1_ENGINE_ID_TPC_4, GAUDI2_DCORE1_ENGINE_ID_TPC_5, GAUDI2_DCORE1_ENGINE_ID_DEC_0, GAUDI2_DCORE1_ENGINE_ID_DEC_1, GAUDI2_DCORE2_ENGINE_ID_EDMA_0, GAUDI2_DCORE2_ENGINE_ID_EDMA_1, GAUDI2_DCORE2_ENGINE_ID_MME, GAUDI2_DCORE2_ENGINE_ID_TPC_0, GAUDI2_DCORE2_ENGINE_ID_TPC_1, GAUDI2_DCORE2_ENGINE_ID_TPC_2, GAUDI2_DCORE2_ENGINE_ID_TPC_3, GAUDI2_DCORE2_ENGINE_ID_TPC_4, GAUDI2_DCORE2_ENGINE_ID_TPC_5, GAUDI2_DCORE2_ENGINE_ID_DEC_0, GAUDI2_DCORE2_ENGINE_ID_DEC_1, GAUDI2_DCORE3_ENGINE_ID_EDMA_0, GAUDI2_DCORE3_ENGINE_ID_EDMA_1, GAUDI2_DCORE3_ENGINE_ID_MME, GAUDI2_DCORE3_ENGINE_ID_TPC_0, GAUDI2_DCORE3_ENGINE_ID_TPC_1, GAUDI2_DCORE3_ENGINE_ID_TPC_2, GAUDI2_DCORE3_ENGINE_ID_TPC_3, GAUDI2_DCORE3_ENGINE_ID_TPC_4, GAUDI2_DCORE3_ENGINE_ID_TPC_5, GAUDI2_DCORE3_ENGINE_ID_DEC_0, GAUDI2_DCORE3_ENGINE_ID_DEC_1, GAUDI2_DCORE0_ENGINE_ID_TPC_6, GAUDI2_ENGINE_ID_PDMA_0, GAUDI2_ENGINE_ID_PDMA_1, GAUDI2_ENGINE_ID_ROT_0, GAUDI2_ENGINE_ID_ROT_1, GAUDI2_PCIE_ENGINE_ID_DEC_0, GAUDI2_PCIE_ENGINE_ID_DEC_1, GAUDI2_ENGINE_ID_NIC0_0, GAUDI2_ENGINE_ID_NIC0_1, GAUDI2_ENGINE_ID_NIC1_0, GAUDI2_ENGINE_ID_NIC1_1, GAUDI2_ENGINE_ID_NIC2_0, GAUDI2_ENGINE_ID_NIC2_1, GAUDI2_ENGINE_ID_NIC3_0, GAUDI2_ENGINE_ID_NIC3_1, GAUDI2_ENGINE_ID_NIC4_0, GAUDI2_ENGINE_ID_NIC4_1, GAUDI2_ENGINE_ID_NIC5_0, GAUDI2_ENGINE_ID_NIC5_1, GAUDI2_ENGINE_ID_NIC6_0, GAUDI2_ENGINE_ID_NIC6_1, GAUDI2_ENGINE_ID_NIC7_0, GAUDI2_ENGINE_ID_NIC7_1, GAUDI2_ENGINE_ID_NIC8_0, GAUDI2_ENGINE_ID_NIC8_1, GAUDI2_ENGINE_ID_NIC9_0, GAUDI2_ENGINE_ID_NIC9_1, GAUDI2_ENGINE_ID_NIC10_0, GAUDI2_ENGINE_ID_NIC10_1, GAUDI2_ENGINE_ID_NIC11_0, GAUDI2_ENGINE_ID_NIC11_1, GAUDI2_ENGINE_ID_PCIE, GAUDI2_ENGINE_ID_PSOC, GAUDI2_ENGINE_ID_ARC_FARM, GAUDI2_ENGINE_ID_KDMA, GAUDI2_ENGINE_ID_SIZE }; /* * ASIC specific PLL index * * Used to retrieve in frequency info of different IPs via * HL_INFO_PLL_FREQUENCY under HL_IOCTL_INFO IOCTL. The enums need to be * used as an index in struct hl_pll_frequency_info */ enum hl_goya_pll_index { HL_GOYA_CPU_PLL = 0, HL_GOYA_IC_PLL, HL_GOYA_MC_PLL, HL_GOYA_MME_PLL, HL_GOYA_PCI_PLL, HL_GOYA_EMMC_PLL, HL_GOYA_TPC_PLL, HL_GOYA_PLL_MAX }; enum hl_gaudi_pll_index { HL_GAUDI_CPU_PLL = 0, HL_GAUDI_PCI_PLL, HL_GAUDI_SRAM_PLL, HL_GAUDI_HBM_PLL, HL_GAUDI_NIC_PLL, HL_GAUDI_DMA_PLL, HL_GAUDI_MESH_PLL, HL_GAUDI_MME_PLL, HL_GAUDI_TPC_PLL, HL_GAUDI_IF_PLL, HL_GAUDI_PLL_MAX }; enum hl_gaudi2_pll_index { HL_GAUDI2_CPU_PLL = 0, HL_GAUDI2_PCI_PLL, HL_GAUDI2_SRAM_PLL, HL_GAUDI2_HBM_PLL, HL_GAUDI2_NIC_PLL, HL_GAUDI2_DMA_PLL, HL_GAUDI2_MESH_PLL, HL_GAUDI2_MME_PLL, HL_GAUDI2_TPC_PLL, HL_GAUDI2_IF_PLL, HL_GAUDI2_VID_PLL, HL_GAUDI2_MSS_PLL, HL_GAUDI2_PLL_MAX }; /** * enum hl_goya_dma_direction - Direction of DMA operation inside a LIN_DMA packet that is * submitted to the GOYA's DMA QMAN. This attribute is not relevant * to the H/W but the kernel driver use it to parse the packet's * addresses and patch/validate them. * @HL_DMA_HOST_TO_DRAM: DMA operation from Host memory to GOYA's DDR. * @HL_DMA_HOST_TO_SRAM: DMA operation from Host memory to GOYA's SRAM. * @HL_DMA_DRAM_TO_SRAM: DMA operation from GOYA's DDR to GOYA's SRAM. * @HL_DMA_SRAM_TO_DRAM: DMA operation from GOYA's SRAM to GOYA's DDR. * @HL_DMA_SRAM_TO_HOST: DMA operation from GOYA's SRAM to Host memory. * @HL_DMA_DRAM_TO_HOST: DMA operation from GOYA's DDR to Host memory. * @HL_DMA_DRAM_TO_DRAM: DMA operation from GOYA's DDR to GOYA's DDR. * @HL_DMA_SRAM_TO_SRAM: DMA operation from GOYA's SRAM to GOYA's SRAM. * @HL_DMA_ENUM_MAX: number of values in enum */ enum hl_goya_dma_direction { HL_DMA_HOST_TO_DRAM, HL_DMA_HOST_TO_SRAM, HL_DMA_DRAM_TO_SRAM, HL_DMA_SRAM_TO_DRAM, HL_DMA_SRAM_TO_HOST, HL_DMA_DRAM_TO_HOST, HL_DMA_DRAM_TO_DRAM, HL_DMA_SRAM_TO_SRAM, HL_DMA_ENUM_MAX }; /** * enum hl_device_status - Device status information. * @HL_DEVICE_STATUS_OPERATIONAL: Device is operational. * @HL_DEVICE_STATUS_IN_RESET: Device is currently during reset. * @HL_DEVICE_STATUS_MALFUNCTION: Device is unusable. * @HL_DEVICE_STATUS_NEEDS_RESET: Device needs reset because auto reset was disabled. * @HL_DEVICE_STATUS_IN_DEVICE_CREATION: Device is operational but its creation is still in * progress. * @HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE: Device is currently during reset that was * triggered because the user released the device * @HL_DEVICE_STATUS_LAST: Last status. */ enum hl_device_status { HL_DEVICE_STATUS_OPERATIONAL, HL_DEVICE_STATUS_IN_RESET, HL_DEVICE_STATUS_MALFUNCTION, HL_DEVICE_STATUS_NEEDS_RESET, HL_DEVICE_STATUS_IN_DEVICE_CREATION, HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE, HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE }; enum hl_server_type { HL_SERVER_TYPE_UNKNOWN = 0, HL_SERVER_GAUDI_HLS1 = 1, HL_SERVER_GAUDI_HLS1H = 2, HL_SERVER_GAUDI_TYPE1 = 3, HL_SERVER_GAUDI_TYPE2 = 4, HL_SERVER_GAUDI2_HLS2 = 5 }; /* * Notifier event values - for the notification mechanism and the HL_INFO_GET_EVENTS command * * HL_NOTIFIER_EVENT_TPC_ASSERT - Indicates TPC assert event * HL_NOTIFIER_EVENT_UNDEFINED_OPCODE - Indicates undefined operation code * HL_NOTIFIER_EVENT_DEVICE_RESET - Indicates device requires a reset * HL_NOTIFIER_EVENT_CS_TIMEOUT - Indicates CS timeout error * HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE - Indicates device is unavailable * HL_NOTIFIER_EVENT_USER_ENGINE_ERR - Indicates device engine in error state * HL_NOTIFIER_EVENT_GENERAL_HW_ERR - Indicates device HW error * HL_NOTIFIER_EVENT_RAZWI - Indicates razwi happened * HL_NOTIFIER_EVENT_PAGE_FAULT - Indicates page fault happened */ #define HL_NOTIFIER_EVENT_TPC_ASSERT (1ULL << 0) #define HL_NOTIFIER_EVENT_UNDEFINED_OPCODE (1ULL << 1) #define HL_NOTIFIER_EVENT_DEVICE_RESET (1ULL << 2) #define HL_NOTIFIER_EVENT_CS_TIMEOUT (1ULL << 3) #define HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE (1ULL << 4) #define HL_NOTIFIER_EVENT_USER_ENGINE_ERR (1ULL << 5) #define HL_NOTIFIER_EVENT_GENERAL_HW_ERR (1ULL << 6) #define HL_NOTIFIER_EVENT_RAZWI (1ULL << 7) #define HL_NOTIFIER_EVENT_PAGE_FAULT (1ULL << 8) /* Opcode for management ioctl * * HW_IP_INFO - Receive information about different IP blocks in the * device. * HL_INFO_HW_EVENTS - Receive an array describing how many times each event * occurred since the last hard reset. * HL_INFO_DRAM_USAGE - Retrieve the dram usage inside the device and of the * specific context. This is relevant only for devices * where the dram is managed by the kernel driver * HL_INFO_HW_IDLE - Retrieve information about the idle status of each * internal engine. * HL_INFO_DEVICE_STATUS - Retrieve the device's status. This opcode doesn't * require an open context. * HL_INFO_DEVICE_UTILIZATION - Retrieve the total utilization of the device * over the last period specified by the user. * The period can be between 100ms to 1s, in * resolution of 100ms. The return value is a * percentage of the utilization rate. * HL_INFO_HW_EVENTS_AGGREGATE - Receive an array describing how many times each * event occurred since the driver was loaded. * HL_INFO_CLK_RATE - Retrieve the current and maximum clock rate * of the device in MHz. The maximum clock rate is * configurable via sysfs parameter * HL_INFO_RESET_COUNT - Retrieve the counts of the soft and hard reset * operations performed on the device since the last * time the driver was loaded. * HL_INFO_TIME_SYNC - Retrieve the device's time alongside the host's time * for synchronization. * HL_INFO_CS_COUNTERS - Retrieve command submission counters * HL_INFO_PCI_COUNTERS - Retrieve PCI counters * HL_INFO_CLK_THROTTLE_REASON - Retrieve clock throttling reason * HL_INFO_SYNC_MANAGER - Retrieve sync manager info per dcore * HL_INFO_TOTAL_ENERGY - Retrieve total energy consumption * HL_INFO_PLL_FREQUENCY - Retrieve PLL frequency * HL_INFO_POWER - Retrieve power information * HL_INFO_OPEN_STATS - Retrieve info regarding recent device open calls * HL_INFO_DRAM_REPLACED_ROWS - Retrieve DRAM replaced rows info * HL_INFO_DRAM_PENDING_ROWS - Retrieve DRAM pending rows num * HL_INFO_LAST_ERR_OPEN_DEV_TIME - Retrieve timestamp of the last time the device was opened * and CS timeout or razwi error occurred. * HL_INFO_CS_TIMEOUT_EVENT - Retrieve CS timeout timestamp and its related CS sequence number. * HL_INFO_RAZWI_EVENT - Retrieve parameters of razwi: * Timestamp of razwi. * The address which accessing it caused the razwi. * Razwi initiator. * Razwi cause, was it a page fault or MMU access error. * HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES - Retrieve valid page sizes for device memory allocation * HL_INFO_SECURED_ATTESTATION - Retrieve attestation report of the boot. * HL_INFO_REGISTER_EVENTFD - Register eventfd for event notifications. * HL_INFO_UNREGISTER_EVENTFD - Unregister eventfd * HL_INFO_GET_EVENTS - Retrieve the last occurred events * HL_INFO_UNDEFINED_OPCODE_EVENT - Retrieve last undefined opcode error information. * HL_INFO_ENGINE_STATUS - Retrieve the status of all the h/w engines in the asic. * HL_INFO_PAGE_FAULT_EVENT - Retrieve parameters of captured page fault. * HL_INFO_USER_MAPPINGS - Retrieve user mappings, captured after page fault event. * HL_INFO_FW_GENERIC_REQ - Send generic request to FW. */ #define HL_INFO_HW_IP_INFO 0 #define HL_INFO_HW_EVENTS 1 #define HL_INFO_DRAM_USAGE 2 #define HL_INFO_HW_IDLE 3 #define HL_INFO_DEVICE_STATUS 4 #define HL_INFO_DEVICE_UTILIZATION 6 #define HL_INFO_HW_EVENTS_AGGREGATE 7 #define HL_INFO_CLK_RATE 8 #define HL_INFO_RESET_COUNT 9 #define HL_INFO_TIME_SYNC 10 #define HL_INFO_CS_COUNTERS 11 #define HL_INFO_PCI_COUNTERS 12 #define HL_INFO_CLK_THROTTLE_REASON 13 #define HL_INFO_SYNC_MANAGER 14 #define HL_INFO_TOTAL_ENERGY 15 #define HL_INFO_PLL_FREQUENCY 16 #define HL_INFO_POWER 17 #define HL_INFO_OPEN_STATS 18 #define HL_INFO_DRAM_REPLACED_ROWS 21 #define HL_INFO_DRAM_PENDING_ROWS 22 #define HL_INFO_LAST_ERR_OPEN_DEV_TIME 23 #define HL_INFO_CS_TIMEOUT_EVENT 24 #define HL_INFO_RAZWI_EVENT 25 #define HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES 26 #define HL_INFO_SECURED_ATTESTATION 27 #define HL_INFO_REGISTER_EVENTFD 28 #define HL_INFO_UNREGISTER_EVENTFD 29 #define HL_INFO_GET_EVENTS 30 #define HL_INFO_UNDEFINED_OPCODE_EVENT 31 #define HL_INFO_ENGINE_STATUS 32 #define HL_INFO_PAGE_FAULT_EVENT 33 #define HL_INFO_USER_MAPPINGS 34 #define HL_INFO_FW_GENERIC_REQ 35 #define HL_INFO_VERSION_MAX_LEN 128 #define HL_INFO_CARD_NAME_MAX_LEN 16 /* Maximum buffer size for retrieving engines status */ #define HL_ENGINES_DATA_MAX_SIZE SZ_1M /** * struct hl_info_hw_ip_info - hardware information on various IPs in the ASIC * @sram_base_address: The first SRAM physical base address that is free to be * used by the user. * @dram_base_address: The first DRAM virtual or physical base address that is * free to be used by the user. * @dram_size: The DRAM size that is available to the user. * @sram_size: The SRAM size that is available to the user. * @num_of_events: The number of events that can be received from the f/w. This * is needed so the user can what is the size of the h/w events * array he needs to pass to the kernel when he wants to fetch * the event counters. * @device_id: PCI device ID of the ASIC. * @module_id: Module ID of the ASIC for mezzanine cards in servers * (From OCP spec). * @decoder_enabled_mask: Bit-mask that represents which decoders are enabled. * @first_available_interrupt_id: The first available interrupt ID for the user * to be used when it works with user interrupts. * Relevant for Gaudi2 and later. * @server_type: Server type that the Gaudi ASIC is currently installed in. * The value is according to enum hl_server_type * @cpld_version: CPLD version on the board. * @psoc_pci_pll_nr: PCI PLL NR value. Needed by the profiler in some ASICs. * @psoc_pci_pll_nf: PCI PLL NF value. Needed by the profiler in some ASICs. * @psoc_pci_pll_od: PCI PLL OD value. Needed by the profiler in some ASICs. * @psoc_pci_pll_div_factor: PCI PLL DIV factor value. Needed by the profiler * in some ASICs. * @tpc_enabled_mask: Bit-mask that represents which TPCs are enabled. Relevant * for Goya/Gaudi only. * @dram_enabled: Whether the DRAM is enabled. * @security_enabled: Whether security is enabled on device. * @mme_master_slave_mode: Indicate whether the MME is working in master/slave * configuration. Relevant for Greco and later. * @cpucp_version: The CPUCP f/w version. * @card_name: The card name as passed by the f/w. * @tpc_enabled_mask_ext: Bit-mask that represents which TPCs are enabled. * Relevant for Greco and later. * @dram_page_size: The DRAM physical page size. * @edma_enabled_mask: Bit-mask that represents which EDMAs are enabled. * Relevant for Gaudi2 and later. * @number_of_user_interrupts: The number of interrupts that are available to the userspace * application to use. Relevant for Gaudi2 and later. * @device_mem_alloc_default_page_size: default page size used in device memory allocation. * @revision_id: PCI revision ID of the ASIC. */ struct hl_info_hw_ip_info { __u64 sram_base_address; __u64 dram_base_address; __u64 dram_size; __u32 sram_size; __u32 num_of_events; __u32 device_id; __u32 module_id; __u32 decoder_enabled_mask; __u16 first_available_interrupt_id; __u16 server_type; __u32 cpld_version; __u32 psoc_pci_pll_nr; __u32 psoc_pci_pll_nf; __u32 psoc_pci_pll_od; __u32 psoc_pci_pll_div_factor; __u8 tpc_enabled_mask; __u8 dram_enabled; __u8 security_enabled; __u8 mme_master_slave_mode; __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN]; __u8 card_name[HL_INFO_CARD_NAME_MAX_LEN]; __u64 tpc_enabled_mask_ext; __u64 dram_page_size; __u32 edma_enabled_mask; __u16 number_of_user_interrupts; __u16 pad2; __u64 reserved4; __u64 device_mem_alloc_default_page_size; __u64 reserved5; __u64 reserved6; __u32 reserved7; __u8 reserved8; __u8 revision_id; __u8 pad[2]; }; struct hl_info_dram_usage { __u64 dram_free_mem; __u64 ctx_dram_mem; }; #define HL_BUSY_ENGINES_MASK_EXT_SIZE 4 struct hl_info_hw_idle { __u32 is_idle; /* * Bitmask of busy engines. * Bits definition is according to `enum <chip>_engine_id'. */ __u32 busy_engines_mask; /* * Extended Bitmask of busy engines. * Bits definition is according to `enum <chip>_engine_id'. */ __u64 busy_engines_mask_ext[HL_BUSY_ENGINES_MASK_EXT_SIZE]; }; struct hl_info_device_status { __u32 status; __u32 pad; }; struct hl_info_device_utilization { __u32 utilization; __u32 pad; }; struct hl_info_clk_rate { __u32 cur_clk_rate_mhz; __u32 max_clk_rate_mhz; }; struct hl_info_reset_count { __u32 hard_reset_cnt; __u32 soft_reset_cnt; }; struct hl_info_time_sync { __u64 device_time; __u64 host_time; }; /** * struct hl_info_pci_counters - pci counters * @rx_throughput: PCI rx throughput KBps * @tx_throughput: PCI tx throughput KBps * @replay_cnt: PCI replay counter */ struct hl_info_pci_counters { __u64 rx_throughput; __u64 tx_throughput; __u64 replay_cnt; }; enum hl_clk_throttling_type { HL_CLK_THROTTLE_TYPE_POWER, HL_CLK_THROTTLE_TYPE_THERMAL, HL_CLK_THROTTLE_TYPE_MAX }; /* clk_throttling_reason masks */ #define HL_CLK_THROTTLE_POWER (1 << HL_CLK_THROTTLE_TYPE_POWER) #define HL_CLK_THROTTLE_THERMAL (1 << HL_CLK_THROTTLE_TYPE_THERMAL) /** * struct hl_info_clk_throttle - clock throttling reason * @clk_throttling_reason: each bit represents a clk throttling reason * @clk_throttling_timestamp_us: represents CPU timestamp in microseconds of the start-event * @clk_throttling_duration_ns: the clock throttle time in nanosec */ struct hl_info_clk_throttle { __u32 clk_throttling_reason; __u32 pad; __u64 clk_throttling_timestamp_us[HL_CLK_THROTTLE_TYPE_MAX]; __u64 clk_throttling_duration_ns[HL_CLK_THROTTLE_TYPE_MAX]; }; /** * struct hl_info_energy - device energy information * @total_energy_consumption: total device energy consumption */ struct hl_info_energy { __u64 total_energy_consumption; }; #define HL_PLL_NUM_OUTPUTS 4 struct hl_pll_frequency_info { __u16 output[HL_PLL_NUM_OUTPUTS]; }; /** * struct hl_open_stats_info - device open statistics information * @open_counter: ever growing counter, increased on each successful dev open * @last_open_period_ms: duration (ms) device was open last time * @is_compute_ctx_active: Whether there is an active compute context executing * @compute_ctx_in_release: true if the current compute context is being released */ struct hl_open_stats_info { __u64 open_counter; __u64 last_open_period_ms; __u8 is_compute_ctx_active; __u8 compute_ctx_in_release; __u8 pad[6]; }; /** * struct hl_power_info - power information * @power: power consumption */ struct hl_power_info { __u64 power; }; /** * struct hl_info_sync_manager - sync manager information * @first_available_sync_object: first available sob * @first_available_monitor: first available monitor * @first_available_cq: first available cq */ struct hl_info_sync_manager { __u32 first_available_sync_object; __u32 first_available_monitor; __u32 first_available_cq; __u32 reserved; }; /** * struct hl_info_cs_counters - command submission counters * @total_out_of_mem_drop_cnt: total dropped due to memory allocation issue * @ctx_out_of_mem_drop_cnt: context dropped due to memory allocation issue * @total_parsing_drop_cnt: total dropped due to error in packet parsing * @ctx_parsing_drop_cnt: context dropped due to error in packet parsing * @total_queue_full_drop_cnt: total dropped due to queue full * @ctx_queue_full_drop_cnt: context dropped due to queue full * @total_device_in_reset_drop_cnt: total dropped due to device in reset * @ctx_device_in_reset_drop_cnt: context dropped due to device in reset * @total_max_cs_in_flight_drop_cnt: total dropped due to maximum CS in-flight * @ctx_max_cs_in_flight_drop_cnt: context dropped due to maximum CS in-flight * @total_validation_drop_cnt: total dropped due to validation error * @ctx_validation_drop_cnt: context dropped due to validation error */ struct hl_info_cs_counters { __u64 total_out_of_mem_drop_cnt; __u64 ctx_out_of_mem_drop_cnt; __u64 total_parsing_drop_cnt; __u64 ctx_parsing_drop_cnt; __u64 total_queue_full_drop_cnt; __u64 ctx_queue_full_drop_cnt; __u64 total_device_in_reset_drop_cnt; __u64 ctx_device_in_reset_drop_cnt; __u64 total_max_cs_in_flight_drop_cnt; __u64 ctx_max_cs_in_flight_drop_cnt; __u64 total_validation_drop_cnt; __u64 ctx_validation_drop_cnt; }; /** * struct hl_info_last_err_open_dev_time - last error boot information. * @timestamp: timestamp of last time the device was opened and error occurred. */ struct hl_info_last_err_open_dev_time { __s64 timestamp; }; /** * struct hl_info_cs_timeout_event - last CS timeout information. * @timestamp: timestamp when last CS timeout event occurred. * @seq: sequence number of last CS timeout event. */ struct hl_info_cs_timeout_event { __s64 timestamp; __u64 seq; }; #define HL_RAZWI_NA_ENG_ID U16_MAX #define HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR 128 #define HL_RAZWI_READ BIT(0) #define HL_RAZWI_WRITE BIT(1) #define HL_RAZWI_LBW BIT(2) #define HL_RAZWI_HBW BIT(3) #define HL_RAZWI_RR BIT(4) #define HL_RAZWI_ADDR_DEC BIT(5) /** * struct hl_info_razwi_event - razwi information. * @timestamp: timestamp of razwi. * @addr: address which accessing it caused razwi. * @engine_id: engine id of the razwi initiator, if it was initiated by engine that does not * have engine id it will be set to HL_RAZWI_NA_ENG_ID. If there are several possible * engines which caused the razwi, it will hold all of them. * @num_of_possible_engines: contains number of possible engine ids. In some asics, razwi indication * might be common for several engines and there is no way to get the * exact engine. In this way, engine_id array will be filled with all * possible engines caused this razwi. Also, there might be possibility * in gaudi, where we don't indication on specific engine, in that case * the value of this parameter will be zero. * @flags: bitmask for additional data: HL_RAZWI_READ - razwi caused by read operation * HL_RAZWI_WRITE - razwi caused by write operation * HL_RAZWI_LBW - razwi caused by lbw fabric transaction * HL_RAZWI_HBW - razwi caused by hbw fabric transaction * HL_RAZWI_RR - razwi caused by range register * HL_RAZWI_ADDR_DEC - razwi caused by address decode error * Note: this data is not supported by all asics, in that case the relevant bits will not * be set. */ struct hl_info_razwi_event { __s64 timestamp; __u64 addr; __u16 engine_id[HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR]; __u16 num_of_possible_engines; __u8 flags; __u8 pad[5]; }; #define MAX_QMAN_STREAMS_INFO 4 #define OPCODE_INFO_MAX_ADDR_SIZE 8 /** * struct hl_info_undefined_opcode_event - info about last undefined opcode error * @timestamp: timestamp of the undefined opcode error * @cb_addr_streams: CB addresses (per stream) that are currently exists in the PQ * entries. In case all streams array entries are * filled with values, it means the execution was in Lower-CP. * @cq_addr: the address of the current handled command buffer * @cq_size: the size of the current handled command buffer * @cb_addr_streams_len: num of streams - actual len of cb_addr_streams array. * should be equal to 1 in case of undefined opcode * in Upper-CP (specific stream) and equal to 4 incase * of undefined opcode in Lower-CP. * @engine_id: engine-id that the error occurred on * @stream_id: the stream id the error occurred on. In case the stream equals to * MAX_QMAN_STREAMS_INFO it means the error occurred on a Lower-CP. */ struct hl_info_undefined_opcode_event { __s64 timestamp; __u64 cb_addr_streams[MAX_QMAN_STREAMS_INFO][OPCODE_INFO_MAX_ADDR_SIZE]; __u64 cq_addr; __u32 cq_size; __u32 cb_addr_streams_len; __u32 engine_id; __u32 stream_id; }; /** * struct hl_info_dev_memalloc_page_sizes - valid page sizes in device mem alloc information. * @page_order_bitmask: bitmap in which a set bit represents the order of the supported page size * (e.g. 0x2100000 means that 1MB and 32MB pages are supported). */ struct hl_info_dev_memalloc_page_sizes { __u64 page_order_bitmask; }; #define SEC_PCR_DATA_BUF_SZ 256 #define SEC_PCR_QUOTE_BUF_SZ 510 /* (512 - 2) 2 bytes used for size */ #define SEC_SIGNATURE_BUF_SZ 255 /* (256 - 1) 1 byte used for size */ #define SEC_PUB_DATA_BUF_SZ 510 /* (512 - 2) 2 bytes used for size */ #define SEC_CERTIFICATE_BUF_SZ 2046 /* (2048 - 2) 2 bytes used for size */ /* * struct hl_info_sec_attest - attestation report of the boot * @nonce: number only used once. random number provided by host. this also passed to the quote * command as a qualifying data. * @pcr_quote_len: length of the attestation quote data (bytes) * @pub_data_len: length of the public data (bytes) * @certificate_len: length of the certificate (bytes) * @pcr_num_reg: number of PCR registers in the pcr_data array * @pcr_reg_len: length of each PCR register in the pcr_data array (bytes) * @quote_sig_len: length of the attestation report signature (bytes) * @pcr_data: raw values of the PCR registers * @pcr_quote: attestation report data structure * @quote_sig: signature structure of the attestation report * @public_data: public key for the signed attestation * (outPublic + name + qualifiedName) * @certificate: certificate for the attestation signing key */ struct hl_info_sec_attest { __u32 nonce; __u16 pcr_quote_len; __u16 pub_data_len; __u16 certificate_len; __u8 pcr_num_reg; __u8 pcr_reg_len; __u8 quote_sig_len; __u8 pcr_data[SEC_PCR_DATA_BUF_SZ]; __u8 pcr_quote[SEC_PCR_QUOTE_BUF_SZ]; __u8 quote_sig[SEC_SIGNATURE_BUF_SZ]; __u8 public_data[SEC_PUB_DATA_BUF_SZ]; __u8 certificate[SEC_CERTIFICATE_BUF_SZ]; __u8 pad0[2]; }; /** * struct hl_page_fault_info - page fault information. * @timestamp: timestamp of page fault. * @addr: address which accessing it caused page fault. * @engine_id: engine id which caused the page fault, supported only in gaudi3. */ struct hl_page_fault_info { __s64 timestamp; __u64 addr; __u16 engine_id; __u8 pad[6]; }; /** * struct hl_user_mapping - user mapping information. * @dev_va: device virtual address. * @size: virtual address mapping size. */ struct hl_user_mapping { __u64 dev_va; __u64 size; }; enum gaudi_dcores { HL_GAUDI_WS_DCORE, HL_GAUDI_WN_DCORE, HL_GAUDI_EN_DCORE, HL_GAUDI_ES_DCORE }; /** * struct hl_info_args - Main structure to retrieve device related information. * @return_pointer: User space address of the relevant structure related to HL_INFO_* operation * mentioned in @op. * @return_size: Size of the structure used in @return_pointer, just like "size" in "snprintf", it * limits how many bytes the kernel can write. For hw_events array, the size should be * hl_info_hw_ip_info.num_of_events * sizeof(__u32). * @op: Defines which type of information to be retrieved. Refer HL_INFO_* for details. * @dcore_id: DCORE id for which the information is relevant (for Gaudi refer to enum gaudi_dcores). * @ctx_id: Context ID of the user. Currently not in use. * @period_ms: Period value, in milliseconds, for utilization rate in range 100ms - 1000ms in 100 ms * resolution. Currently not in use. * @pll_index: Index as defined in hl_<asic type>_pll_index enumeration. * @eventfd: event file descriptor for event notifications. * @user_buffer_actual_size: Actual data size which was copied to user allocated buffer by the * driver. It is possible for the user to allocate buffer larger than * needed, hence updating this variable so user will know the exact amount * of bytes copied by the kernel to the buffer. * @sec_attest_nonce: Nonce number used for attestation report. * @array_size: Number of array members copied to user buffer. * Relevant for HL_INFO_USER_MAPPINGS info ioctl. * @fw_sub_opcode: generic requests sub opcodes. * @pad: Padding to 64 bit. */ struct hl_info_args { __u64 return_pointer; __u32 return_size; __u32 op; union { __u32 dcore_id; __u32 ctx_id; __u32 period_ms; __u32 pll_index; __u32 eventfd; __u32 user_buffer_actual_size; __u32 sec_attest_nonce; __u32 array_size; __u32 fw_sub_opcode; }; __u32 pad; }; /* Opcode to create a new command buffer */ #define HL_CB_OP_CREATE 0 /* Opcode to destroy previously created command buffer */ #define HL_CB_OP_DESTROY 1 /* Opcode to retrieve information about a command buffer */ #define HL_CB_OP_INFO 2 /* 2MB minus 32 bytes for 2xMSG_PROT */ #define HL_MAX_CB_SIZE (0x200000 - 32) /* Indicates whether the command buffer should be mapped to the device's MMU */ #define HL_CB_FLAGS_MAP 0x1 /* Used with HL_CB_OP_INFO opcode to get the device va address for kernel mapped CB */ #define HL_CB_FLAGS_GET_DEVICE_VA 0x2 struct hl_cb_in { /* Handle of CB or 0 if we want to create one */ __u64 cb_handle; /* HL_CB_OP_* */ __u32 op; /* Size of CB. Maximum size is HL_MAX_CB_SIZE. The minimum size that * will be allocated, regardless of this parameter's value, is PAGE_SIZE */ __u32 cb_size; /* Context ID - Currently not in use */ __u32 ctx_id; /* HL_CB_FLAGS_* */ __u32 flags; }; struct hl_cb_out { union { /* Handle of CB */ __u64 cb_handle; union { /* Information about CB */ struct { /* Usage count of CB */ __u32 usage_cnt; __u32 pad; }; /* CB mapped address to device MMU */ __u64 device_va; }; }; }; union hl_cb_args { struct hl_cb_in in; struct hl_cb_out out; }; /* HL_CS_CHUNK_FLAGS_ values * * HL_CS_CHUNK_FLAGS_USER_ALLOC_CB: * Indicates if the CB was allocated and mapped by userspace * (relevant to greco and above). User allocated CB is a command buffer, * allocated by the user, via malloc (or similar). After allocating the * CB, the user invokes - “memory ioctl” to map the user memory into a * device virtual address. The user provides this address via the * cb_handle field. The interface provides the ability to create a * large CBs, Which aren’t limited to “HL_MAX_CB_SIZE”. Therefore, it * increases the PCI-DMA queues throughput. This CB allocation method * also reduces the use of Linux DMA-able memory pool. Which are limited * and used by other Linux sub-systems. */ #define HL_CS_CHUNK_FLAGS_USER_ALLOC_CB 0x1 /* * This structure size must always be fixed to 64-bytes for backward * compatibility */ struct hl_cs_chunk { union { /* Goya/Gaudi: * For external queue, this represents a Handle of CB on the * Host. * For internal queue in Goya, this represents an SRAM or * a DRAM address of the internal CB. In Gaudi, this might also * represent a mapped host address of the CB. * * Greco onwards: * For H/W queue, this represents either a Handle of CB on the * Host, or an SRAM, a DRAM, or a mapped host address of the CB. * * A mapped host address is in the device address space, after * a host address was mapped by the device MMU. */ __u64 cb_handle; /* Relevant only when HL_CS_FLAGS_WAIT or * HL_CS_FLAGS_COLLECTIVE_WAIT is set * This holds address of array of u64 values that contain * signal CS sequence numbers. The wait described by * this job will listen on all those signals * (wait event per signal) */ __u64 signal_seq_arr; /* * Relevant only when HL_CS_FLAGS_WAIT or * HL_CS_FLAGS_COLLECTIVE_WAIT is set * along with HL_CS_FLAGS_ENCAP_SIGNALS. * This is the CS sequence which has the encapsulated signals. */ __u64 encaps_signal_seq; }; /* Index of queue to put the CB on */ __u32 queue_index; union { /* * Size of command buffer with valid packets * Can be smaller then actual CB size */ __u32 cb_size; /* Relevant only when HL_CS_FLAGS_WAIT or * HL_CS_FLAGS_COLLECTIVE_WAIT is set. * Number of entries in signal_seq_arr */ __u32 num_signal_seq_arr; /* Relevant only when HL_CS_FLAGS_WAIT or * HL_CS_FLAGS_COLLECTIVE_WAIT is set along * with HL_CS_FLAGS_ENCAP_SIGNALS * This set the signals range that the user want to wait for * out of the whole reserved signals range. * e.g if the signals range is 20, and user don't want * to wait for signal 8, so he set this offset to 7, then * he call the API again with 9 and so on till 20. */ __u32 encaps_signal_offset; }; /* HL_CS_CHUNK_FLAGS_* */ __u32 cs_chunk_flags; /* Relevant only when HL_CS_FLAGS_COLLECTIVE_WAIT is set. * This holds the collective engine ID. The wait described by this job * will sync with this engine and with all NICs before completion. */ __u32 collective_engine_id; /* Align structure to 64 bytes */ __u32 pad[10]; }; /* SIGNAL/WAIT/COLLECTIVE_WAIT flags are mutually exclusive */ #define HL_CS_FLAGS_FORCE_RESTORE 0x1 #define HL_CS_FLAGS_SIGNAL 0x2 #define HL_CS_FLAGS_WAIT 0x4 #define HL_CS_FLAGS_COLLECTIVE_WAIT 0x8 #define HL_CS_FLAGS_TIMESTAMP 0x20 #define HL_CS_FLAGS_STAGED_SUBMISSION 0x40 #define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80 #define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100 #define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200 #define HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT 0x400 /* * The encapsulated signals CS is merged into the existing CS ioctls. * In order to use this feature need to follow the below procedure: * 1. Reserve signals, set the CS type to HL_CS_FLAGS_RESERVE_SIGNALS_ONLY * the output of this API will be the SOB offset from CFG_BASE. * this address will be used to patch CB cmds to do the signaling for this * SOB by incrementing it's value. * for reverting the reservation use HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY * CS type, note that this might fail if out-of-sync happened to the SOB * value, in case other signaling request to the same SOB occurred between * reserve-unreserve calls. * 2. Use the staged CS to do the encapsulated signaling jobs. * use HL_CS_FLAGS_STAGED_SUBMISSION and HL_CS_FLAGS_STAGED_SUBMISSION_FIRST * along with HL_CS_FLAGS_ENCAP_SIGNALS flag, and set encaps_signal_offset * field. This offset allows app to wait on part of the reserved signals. * 3. Use WAIT/COLLECTIVE WAIT CS along with HL_CS_FLAGS_ENCAP_SIGNALS flag * to wait for the encapsulated signals. */ #define HL_CS_FLAGS_ENCAP_SIGNALS 0x800 #define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000 #define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000 /* * The engine cores CS is merged into the existing CS ioctls. * Use it to control the engine cores mode. */ #define HL_CS_FLAGS_ENGINE_CORE_COMMAND 0x4000 /* * The flush HBW PCI writes is merged into the existing CS ioctls. * Used to flush all HBW PCI writes. * This is a blocking operation and for this reason the user shall not use * the return sequence number (which will be invalid anyway) */ #define HL_CS_FLAGS_FLUSH_PCI_HBW_WRITES 0x8000 #define HL_CS_STATUS_SUCCESS 0 #define HL_MAX_JOBS_PER_CS 512 /* HL_ENGINE_CORE_ values * * HL_ENGINE_CORE_HALT: engine core halt * HL_ENGINE_CORE_RUN: engine core run */ #define HL_ENGINE_CORE_HALT (1 << 0) #define HL_ENGINE_CORE_RUN (1 << 1) struct hl_cs_in { union { struct { /* this holds address of array of hl_cs_chunk for restore phase */ __u64 chunks_restore; /* holds address of array of hl_cs_chunk for execution phase */ __u64 chunks_execute; }; /* Valid only when HL_CS_FLAGS_ENGINE_CORE_COMMAND is set */ struct { /* this holds address of array of uint32 for engine_cores */ __u64 engine_cores; /* number of engine cores in engine_cores array */ __u32 num_engine_cores; /* the core command to be sent towards engine cores */ __u32 core_command; }; }; union { /* * Sequence number of a staged submission CS * valid only if HL_CS_FLAGS_STAGED_SUBMISSION is set and * HL_CS_FLAGS_STAGED_SUBMISSION_FIRST is unset. */ __u64 seq; /* * Encapsulated signals handle id * Valid for two flows: * 1. CS with encapsulated signals: * when HL_CS_FLAGS_STAGED_SUBMISSION and * HL_CS_FLAGS_STAGED_SUBMISSION_FIRST * and HL_CS_FLAGS_ENCAP_SIGNALS are set. * 2. unreserve signals: * valid when HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY is set. */ __u32 encaps_sig_handle_id; /* Valid only when HL_CS_FLAGS_RESERVE_SIGNALS_ONLY is set */ struct { /* Encapsulated signals number */ __u32 encaps_signals_count; /* Encapsulated signals queue index (stream) */ __u32 encaps_signals_q_idx; }; }; /* Number of chunks in restore phase array. Maximum number is * HL_MAX_JOBS_PER_CS */ __u32 num_chunks_restore; /* Number of chunks in execution array. Maximum number is * HL_MAX_JOBS_PER_CS */ __u32 num_chunks_execute; /* timeout in seconds - valid only if HL_CS_FLAGS_CUSTOM_TIMEOUT * is set */ __u32 timeout; /* HL_CS_FLAGS_* */ __u32 cs_flags; /* Context ID - Currently not in use */ __u32 ctx_id; __u8 pad[4]; }; struct hl_cs_out { union { /* * seq holds the sequence number of the CS to pass to wait * ioctl. All values are valid except for 0 and ULLONG_MAX */ __u64 seq; /* Valid only when HL_CS_FLAGS_RESERVE_SIGNALS_ONLY is set */ struct { /* This is the reserved signal handle id */ __u32 handle_id; /* This is the signals count */ __u32 count; }; }; /* HL_CS_STATUS */ __u32 status; /* * SOB base address offset * Valid only when HL_CS_FLAGS_RESERVE_SIGNALS_ONLY or HL_CS_FLAGS_SIGNAL is set */ __u32 sob_base_addr_offset; /* * Count of completed signals in SOB before current signal submission. * Valid only when (HL_CS_FLAGS_ENCAP_SIGNALS & HL_CS_FLAGS_STAGED_SUBMISSION) * or HL_CS_FLAGS_SIGNAL is set */ __u16 sob_count_before_submission; __u16 pad[3]; }; union hl_cs_args { struct hl_cs_in in; struct hl_cs_out out; }; #define HL_WAIT_CS_FLAGS_INTERRUPT 0x2 #define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000 #define HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT 0xFFF00000 #define HL_WAIT_CS_FLAGS_ANY_DEC_INTERRUPT 0xFFE00000 #define HL_WAIT_CS_FLAGS_MULTI_CS 0x4 #define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10 #define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20 #define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32 struct hl_wait_cs_in { union { struct { /* * In case of wait_cs holds the CS sequence number. * In case of wait for multi CS hold a user pointer to * an array of CS sequence numbers */ __u64 seq; /* Absolute timeout to wait for command submission * in microseconds */ __u64 timeout_us; }; struct { union { /* User address for completion comparison. * upon interrupt, driver will compare the value pointed * by this address with the supplied target value. * in order not to perform any comparison, set address * to all 1s. * Relevant only when HL_WAIT_CS_FLAGS_INTERRUPT is set */ __u64 addr; /* cq_counters_handle to a kernel mapped cb which contains * cq counters. * Relevant only when HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ is set */ __u64 cq_counters_handle; }; /* Target value for completion comparison */ __u64 target; }; }; /* Context ID - Currently not in use */ __u32 ctx_id; /* HL_WAIT_CS_FLAGS_* * If HL_WAIT_CS_FLAGS_INTERRUPT is set, this field should include * interrupt id according to HL_WAIT_CS_FLAGS_INTERRUPT_MASK * * in order to wait for any CQ interrupt, set interrupt value to * HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT. * * in order to wait for any decoder interrupt, set interrupt value to * HL_WAIT_CS_FLAGS_ANY_DEC_INTERRUPT. */ __u32 flags; union { struct { /* Multi CS API info- valid entries in multi-CS array */ __u8 seq_arr_len; __u8 pad[7]; }; /* Absolute timeout to wait for an interrupt in microseconds. * Relevant only when HL_WAIT_CS_FLAGS_INTERRUPT is set */ __u64 interrupt_timeout_us; }; /* * cq counter offset inside the counters cb pointed by cq_counters_handle above. * upon interrupt, driver will compare the value pointed * by this address (cq_counters_handle + cq_counters_offset) * with the supplied target value. * relevant only when HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ is set */ __u64 cq_counters_offset; /* * Timestamp_handle timestamps buffer handle. * relevant only when HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT is set */ __u64 timestamp_handle; /* * Timestamp_offset is offset inside the timestamp buffer pointed by timestamp_handle above. * upon interrupt, if the cq reached the target value then driver will write * timestamp to this offset. * relevant only when HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT is set */ __u64 timestamp_offset; }; #define HL_WAIT_CS_STATUS_COMPLETED 0 #define HL_WAIT_CS_STATUS_BUSY 1 #define HL_WAIT_CS_STATUS_TIMEDOUT 2 #define HL_WAIT_CS_STATUS_ABORTED 3 #define HL_WAIT_CS_STATUS_FLAG_GONE 0x1 #define HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD 0x2 struct hl_wait_cs_out { /* HL_WAIT_CS_STATUS_* */ __u32 status; /* HL_WAIT_CS_STATUS_FLAG* */ __u32 flags; /* * valid only if HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD is set * for wait_cs: timestamp of CS completion * for wait_multi_cs: timestamp of FIRST CS completion */ __s64 timestamp_nsec; /* multi CS completion bitmap */ __u32 cs_completion_map; __u32 pad; }; union hl_wait_cs_args { struct hl_wait_cs_in in; struct hl_wait_cs_out out; }; /* Opcode to allocate device memory */ #define HL_MEM_OP_ALLOC 0 /* Opcode to free previously allocated device memory */ #define HL_MEM_OP_FREE 1 /* Opcode to map host and device memory */ #define HL_MEM_OP_MAP 2 /* Opcode to unmap previously mapped host and device memory */ #define HL_MEM_OP_UNMAP 3 /* Opcode to map a hw block */ #define HL_MEM_OP_MAP_BLOCK 4 /* Opcode to create DMA-BUF object for an existing device memory allocation * and to export an FD of that DMA-BUF back to the caller */ #define HL_MEM_OP_EXPORT_DMABUF_FD 5 /* Opcode to create timestamps pool for user interrupts registration support * The memory will be allocated by the kernel driver, A timestamp buffer which the user * will get handle to it for mmap, and another internal buffer used by the * driver for registration management * The memory will be freed when the user closes the file descriptor(ctx close) */ #define HL_MEM_OP_TS_ALLOC 6 /* Memory flags */ #define HL_MEM_CONTIGUOUS 0x1 #define HL_MEM_SHARED 0x2 #define HL_MEM_USERPTR 0x4 #define HL_MEM_FORCE_HINT 0x8 #define HL_MEM_PREFETCH 0x40 /** * structure hl_mem_in - structure that handle input args for memory IOCTL * @union arg: union of structures to be used based on the input operation * @op: specify the requested memory operation (one of the HL_MEM_OP_* definitions). * @flags: flags for the memory operation (one of the HL_MEM_* definitions). * For the HL_MEM_OP_EXPORT_DMABUF_FD opcode, this field holds the DMA-BUF file/FD flags. * @ctx_id: context ID - currently not in use. * @num_of_elements: number of timestamp elements used only with HL_MEM_OP_TS_ALLOC opcode. */ struct hl_mem_in { union { /** * structure for device memory allocation (used with the HL_MEM_OP_ALLOC op) * @mem_size: memory size to allocate * @page_size: page size to use on allocation. when the value is 0 the default page * size will be taken. */ struct { __u64 mem_size; __u64 page_size; } alloc; /** * structure for free-ing device memory (used with the HL_MEM_OP_FREE op) * @handle: handle returned from HL_MEM_OP_ALLOC */ struct { __u64 handle; } free; /** * structure for mapping device memory (used with the HL_MEM_OP_MAP op) * @hint_addr: requested virtual address of mapped memory. * the driver will try to map the requested region to this hint * address, as long as the address is valid and not already mapped. * the user should check the returned address of the IOCTL to make * sure he got the hint address. * passing 0 here means that the driver will choose the address itself. * @handle: handle returned from HL_MEM_OP_ALLOC. */ struct { __u64 hint_addr; __u64 handle; } map_device; /** * structure for mapping host memory (used with the HL_MEM_OP_MAP op) * @host_virt_addr: address of allocated host memory. * @hint_addr: requested virtual address of mapped memory. * the driver will try to map the requested region to this hint * address, as long as the address is valid and not already mapped. * the user should check the returned address of the IOCTL to make * sure he got the hint address. * passing 0 here means that the driver will choose the address itself. * @size: size of allocated host memory. */ struct { __u64 host_virt_addr; __u64 hint_addr; __u64 mem_size; } map_host; /** * structure for mapping hw block (used with the HL_MEM_OP_MAP_BLOCK op) * @block_addr:HW block address to map, a handle and size will be returned * to the user and will be used to mmap the relevant block. * only addresses from configuration space are allowed. */ struct { __u64 block_addr; } map_block; /** * structure for unmapping host memory (used with the HL_MEM_OP_UNMAP op) * @device_virt_addr: virtual address returned from HL_MEM_OP_MAP */ struct { __u64 device_virt_addr; } unmap; /** * structure for exporting DMABUF object (used with * the HL_MEM_OP_EXPORT_DMABUF_FD op) * @addr: for Gaudi1, the driver expects a physical address * inside the device's DRAM. this is because in Gaudi1 * we don't have MMU that covers the device's DRAM. * for all other ASICs, the driver expects a device * virtual address that represents the start address of * a mapped DRAM memory area inside the device. * the address must be the same as was received from the * driver during a previous HL_MEM_OP_MAP operation. * @mem_size: size of memory to export. * @offset: for Gaudi1, this value must be 0. For all other ASICs, * the driver expects an offset inside of the memory area * describe by addr. the offset represents the start * address of that the exported dma-buf object describes. */ struct { __u64 addr; __u64 mem_size; __u64 offset; } export_dmabuf_fd; }; __u32 op; __u32 flags; __u32 ctx_id; __u32 num_of_elements; }; struct hl_mem_out { union { /* * Used for HL_MEM_OP_MAP as the virtual address that was * assigned in the device VA space. * A value of 0 means the requested operation failed. */ __u64 device_virt_addr; /* * Used in HL_MEM_OP_ALLOC * This is the assigned handle for the allocated memory */ __u64 handle; struct { /* * Used in HL_MEM_OP_MAP_BLOCK. * This is the assigned handle for the mapped block */ __u64 block_handle; /* * Used in HL_MEM_OP_MAP_BLOCK * This is the size of the mapped block */ __u32 block_size; __u32 pad; }; /* Returned in HL_MEM_OP_EXPORT_DMABUF_FD. Represents the * DMA-BUF object that was created to describe a memory * allocation on the device's memory space. The FD should be * passed to the importer driver */ __s32 fd; }; }; union hl_mem_args { struct hl_mem_in in; struct hl_mem_out out; }; #define HL_DEBUG_MAX_AUX_VALUES 10 struct hl_debug_params_etr { /* Address in memory to allocate buffer */ __u64 buffer_address; /* Size of buffer to allocate */ __u64 buffer_size; /* Sink operation mode: SW fifo, HW fifo, Circular buffer */ __u32 sink_mode; __u32 pad; }; struct hl_debug_params_etf { /* Address in memory to allocate buffer */ __u64 buffer_address; /* Size of buffer to allocate */ __u64 buffer_size; /* Sink operation mode: SW fifo, HW fifo, Circular buffer */ __u32 sink_mode; __u32 pad; }; struct hl_debug_params_stm { /* Two bit masks for HW event and Stimulus Port */ __u64 he_mask; __u64 sp_mask; /* Trace source ID */ __u32 id; /* Frequency for the timestamp register */ __u32 frequency; }; struct hl_debug_params_bmon { /* Two address ranges that the user can request to filter */ __u64 start_addr0; __u64 addr_mask0; __u64 start_addr1; __u64 addr_mask1; /* Capture window configuration */ __u32 bw_win; __u32 win_capture; /* Trace source ID */ __u32 id; /* Control register */ __u32 control; /* Two more address ranges that the user can request to filter */ __u64 start_addr2; __u64 end_addr2; __u64 start_addr3; __u64 end_addr3; }; struct hl_debug_params_spmu { /* Event types selection */ __u64 event_types[HL_DEBUG_MAX_AUX_VALUES]; /* Number of event types selection */ __u32 event_types_num; /* TRC configuration register values */ __u32 pmtrc_val; __u32 trc_ctrl_host_val; __u32 trc_en_host_val; }; /* Opcode for ETR component */ #define HL_DEBUG_OP_ETR 0 /* Opcode for ETF component */ #define HL_DEBUG_OP_ETF 1 /* Opcode for STM component */ #define HL_DEBUG_OP_STM 2 /* Opcode for FUNNEL component */ #define HL_DEBUG_OP_FUNNEL 3 /* Opcode for BMON component */ #define HL_DEBUG_OP_BMON 4 /* Opcode for SPMU component */ #define HL_DEBUG_OP_SPMU 5 /* Opcode for timestamp (deprecated) */ #define HL_DEBUG_OP_TIMESTAMP 6 /* Opcode for setting the device into or out of debug mode. The enable * variable should be 1 for enabling debug mode and 0 for disabling it */ #define HL_DEBUG_OP_SET_MODE 7 struct hl_debug_args { /* * Pointer to user input structure. * This field is relevant to specific opcodes. */ __u64 input_ptr; /* Pointer to user output structure */ __u64 output_ptr; /* Size of user input structure */ __u32 input_size; /* Size of user output structure */ __u32 output_size; /* HL_DEBUG_OP_* */ __u32 op; /* * Register index in the component, taken from the debug_regs_index enum * in the various ASIC header files */ __u32 reg_idx; /* Enable/disable */ __u32 enable; /* Context ID - Currently not in use */ __u32 ctx_id; }; /* * Various information operations such as: * - H/W IP information * - Current dram usage * * The user calls this IOCTL with an opcode that describes the required * information. The user should supply a pointer to a user-allocated memory * chunk, which will be filled by the driver with the requested information. * * The user supplies the maximum amount of size to copy into the user's memory, * in order to prevent data corruption in case of differences between the * definitions of structures in kernel and userspace, e.g. in case of old * userspace and new kernel driver */ #define HL_IOCTL_INFO \ _IOWR('H', 0x01, struct hl_info_args) /* * Command Buffer * - Request a Command Buffer * - Destroy a Command Buffer * * The command buffers are memory blocks that reside in DMA-able address * space and are physically contiguous so they can be accessed by the device * directly. They are allocated using the coherent DMA API. * * When creating a new CB, the IOCTL returns a handle of it, and the user-space * process needs to use that handle to mmap the buffer so it can access them. * * In some instances, the device must access the command buffer through the * device's MMU, and thus its memory should be mapped. In these cases, user can * indicate the driver that such a mapping is required. * The resulting device virtual address will be used internally by the driver, * and won't be returned to user. * */ #define HL_IOCTL_CB \ _IOWR('H', 0x02, union hl_cb_args) /* * Command Submission * * To submit work to the device, the user need to call this IOCTL with a set * of JOBS. That set of JOBS constitutes a CS object. * Each JOB will be enqueued on a specific queue, according to the user's input. * There can be more then one JOB per queue. * * The CS IOCTL will receive two sets of JOBS. One set is for "restore" phase * and a second set is for "execution" phase. * The JOBS on the "restore" phase are enqueued only after context-switch * (or if its the first CS for this context). The user can also order the * driver to run the "restore" phase explicitly * * Goya/Gaudi: * There are two types of queues - external and internal. External queues * are DMA queues which transfer data from/to the Host. All other queues are * internal. The driver will get completion notifications from the device only * on JOBS which are enqueued in the external queues. * * Greco onwards: * There is a single type of queue for all types of engines, either DMA engines * for transfers from/to the host or inside the device, or compute engines. * The driver will get completion notifications from the device for all queues. * * For jobs on external queues, the user needs to create command buffers * through the CB ioctl and give the CB's handle to the CS ioctl. For jobs on * internal queues, the user needs to prepare a "command buffer" with packets * on either the device SRAM/DRAM or the host, and give the device address of * that buffer to the CS ioctl. * For jobs on H/W queues both options of command buffers are valid. * * This IOCTL is asynchronous in regard to the actual execution of the CS. This * means it returns immediately after ALL the JOBS were enqueued on their * relevant queues. Therefore, the user mustn't assume the CS has been completed * or has even started to execute. * * Upon successful enqueue, the IOCTL returns a sequence number which the user * can use with the "Wait for CS" IOCTL to check whether the handle's CS * non-internal JOBS have been completed. Note that if the CS has internal JOBS * which can execute AFTER the external JOBS have finished, the driver might * report that the CS has finished executing BEFORE the internal JOBS have * actually finished executing. * * Even though the sequence number increments per CS, the user can NOT * automatically assume that if CS with sequence number N finished, then CS * with sequence number N-1 also finished. The user can make this assumption if * and only if CS N and CS N-1 are exactly the same (same CBs for the same * queues). */ #define HL_IOCTL_CS \ _IOWR('H', 0x03, union hl_cs_args) /* * Wait for Command Submission * * The user can call this IOCTL with a handle it received from the CS IOCTL * to wait until the handle's CS has finished executing. The user will wait * inside the kernel until the CS has finished or until the user-requested * timeout has expired. * * If the timeout value is 0, the driver won't sleep at all. It will check * the status of the CS and return immediately * * The return value of the IOCTL is a standard Linux error code. The possible * values are: * * EINTR - Kernel waiting has been interrupted, e.g. due to OS signal * that the user process received * ETIMEDOUT - The CS has caused a timeout on the device * EIO - The CS was aborted (usually because the device was reset) * ENODEV - The device wants to do hard-reset (so user need to close FD) * * The driver also returns a custom define in case the IOCTL call returned 0. * The define can be one of the following: * * HL_WAIT_CS_STATUS_COMPLETED - The CS has been completed successfully (0) * HL_WAIT_CS_STATUS_BUSY - The CS is still executing (0) * HL_WAIT_CS_STATUS_TIMEDOUT - The CS has caused a timeout on the device * (ETIMEDOUT) * HL_WAIT_CS_STATUS_ABORTED - The CS was aborted, usually because the * device was reset (EIO) */ #define HL_IOCTL_WAIT_CS \ _IOWR('H', 0x04, union hl_wait_cs_args) /* * Memory * - Map host memory to device MMU * - Unmap host memory from device MMU * * This IOCTL allows the user to map host memory to the device MMU * * For host memory, the IOCTL doesn't allocate memory. The user is supposed * to allocate the memory in user-space (malloc/new). The driver pins the * physical pages (up to the allowed limit by the OS), assigns a virtual * address in the device VA space and initializes the device MMU. * * There is an option for the user to specify the requested virtual address. * */ #define HL_IOCTL_MEMORY \ _IOWR('H', 0x05, union hl_mem_args) /* * Debug * - Enable/disable the ETR/ETF/FUNNEL/STM/BMON/SPMU debug traces * * This IOCTL allows the user to get debug traces from the chip. * * Before the user can send configuration requests of the various * debug/profile engines, it needs to set the device into debug mode. * This is because the debug/profile infrastructure is shared component in the * device and we can't allow multiple users to access it at the same time. * * Once a user set the device into debug mode, the driver won't allow other * users to "work" with the device, i.e. open a FD. If there are multiple users * opened on the device, the driver won't allow any user to debug the device. * * For each configuration request, the user needs to provide the register index * and essential data such as buffer address and size. * * Once the user has finished using the debug/profile engines, he should * set the device into non-debug mode, i.e. disable debug mode. * * The driver can decide to "kick out" the user if he abuses this interface. * */ #define HL_IOCTL_DEBUG \ _IOWR('H', 0x06, struct hl_debug_args) #define HL_COMMAND_START 0x01 #define HL_COMMAND_END 0x07 #endif /* HABANALABS_H_ */ drm/i915_drm.h 0000644 00000364217 15063602045 0007046 0 ustar 00 /* * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _I915_DRM_H_ #define _I915_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. */ /** * DOC: uevents generated by i915 on it's device node * * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch * event from the gpu l3 cache. Additional information supplied is ROW, * BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep * track of these events and if a specific cache-line seems to have a * persistent error remap it with the l3 remapping tool supplied in * intel-gpu-tools. The value supplied with the event is always 1. * * I915_ERROR_UEVENT - Generated upon error detection, currently only via * hangcheck. The error detection event is a good indicator of when things * began to go badly. The value supplied with the event is a 1 upon error * detection, and a 0 upon reset completion, signifying no more error * exists. NOTE: Disabling hangcheck or reset via module parameter will * cause the related events to not be seen. * * I915_RESET_UEVENT - Event is generated just before an attempt to reset the * GPU. The value supplied with the event is always 1. NOTE: Disable * reset via module parameter will cause this event to not be seen. */ #define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR" #define I915_ERROR_UEVENT "ERROR" #define I915_RESET_UEVENT "RESET" /** * struct i915_user_extension - Base class for defining a chain of extensions * * Many interfaces need to grow over time. In most cases we can simply * extend the struct and have userspace pass in more data. Another option, * as demonstrated by Vulkan's approach to providing extensions for forward * and backward compatibility, is to use a list of optional structs to * provide those extra details. * * The key advantage to using an extension chain is that it allows us to * redefine the interface more easily than an ever growing struct of * increasing complexity, and for large parts of that interface to be * entirely optional. The downside is more pointer chasing; chasing across * the boundary with pointers encapsulated inside u64. * * Example chaining: * * .. code-block:: C * * struct i915_user_extension ext3 { * .next_extension = 0, // end * .name = ..., * }; * struct i915_user_extension ext2 { * .next_extension = (uintptr_t)&ext3, * .name = ..., * }; * struct i915_user_extension ext1 { * .next_extension = (uintptr_t)&ext2, * .name = ..., * }; * * Typically the struct i915_user_extension would be embedded in some uAPI * struct, and in this case we would feed it the head of the chain(i.e ext1), * which would then apply all of the above extensions. * */ struct i915_user_extension { /** * @next_extension: * * Pointer to the next struct i915_user_extension, or zero if the end. */ __u64 next_extension; /** * @name: Name of the extension. * * Note that the name here is just some integer. * * Also note that the name space for this is not global for the whole * driver, but rather its scope/meaning is limited to the specific piece * of uAPI which has embedded the struct i915_user_extension. */ __u32 name; /** * @flags: MBZ * * All undefined bits must be zero. */ __u32 flags; /** * @rsvd: MBZ * * Reserved for future use; must be zero. */ __u32 rsvd[4]; }; /* * MOCS indexes used for GPU surfaces, defining the cacheability of the * surface data and the coherency for this data wrt. CPU vs. GPU accesses. */ enum i915_mocs_table_index { /* * Not cached anywhere, coherency between CPU and GPU accesses is * guaranteed. */ I915_MOCS_UNCACHED, /* * Cacheability and coherency controlled by the kernel automatically * based on the DRM_I915_GEM_SET_CACHING IOCTL setting and the current * usage of the surface (used for display scanout or not). */ I915_MOCS_PTE, /* * Cached in all GPU caches available on the platform. * Coherency between CPU and GPU accesses to the surface is not * guaranteed without extra synchronization. */ I915_MOCS_CACHED, }; /** * enum drm_i915_gem_engine_class - uapi engine type enumeration * * Different engines serve different roles, and there may be more than one * engine serving each role. This enum provides a classification of the role * of the engine, which may be used when requesting operations to be performed * on a certain subset of engines, or for providing information about that * group. */ enum drm_i915_gem_engine_class { /** * @I915_ENGINE_CLASS_RENDER: * * Render engines support instructions used for 3D, Compute (GPGPU), * and programmable media workloads. These instructions fetch data and * dispatch individual work items to threads that operate in parallel. * The threads run small programs (called "kernels" or "shaders") on * the GPU's execution units (EUs). */ I915_ENGINE_CLASS_RENDER = 0, /** * @I915_ENGINE_CLASS_COPY: * * Copy engines (also referred to as "blitters") support instructions * that move blocks of data from one location in memory to another, * or that fill a specified location of memory with fixed data. * Copy engines can perform pre-defined logical or bitwise operations * on the source, destination, or pattern data. */ I915_ENGINE_CLASS_COPY = 1, /** * @I915_ENGINE_CLASS_VIDEO: * * Video engines (also referred to as "bit stream decode" (BSD) or * "vdbox") support instructions that perform fixed-function media * decode and encode. */ I915_ENGINE_CLASS_VIDEO = 2, /** * @I915_ENGINE_CLASS_VIDEO_ENHANCE: * * Video enhancement engines (also referred to as "vebox") support * instructions related to image enhancement. */ I915_ENGINE_CLASS_VIDEO_ENHANCE = 3, /** * @I915_ENGINE_CLASS_COMPUTE: * * Compute engines support a subset of the instructions available * on render engines: compute engines support Compute (GPGPU) and * programmable media workloads, but do not support the 3D pipeline. */ I915_ENGINE_CLASS_COMPUTE = 4, /* Values in this enum should be kept compact. */ /** * @I915_ENGINE_CLASS_INVALID: * * Placeholder value to represent an invalid engine class assignment. */ I915_ENGINE_CLASS_INVALID = -1 }; /** * struct i915_engine_class_instance - Engine class/instance identifier * * There may be more than one engine fulfilling any role within the system. * Each engine of a class is given a unique instance number and therefore * any engine can be specified by its class:instance tuplet. APIs that allow * access to any engine in the system will use struct i915_engine_class_instance * for this identification. */ struct i915_engine_class_instance { /** * @engine_class: * * Engine class from enum drm_i915_gem_engine_class */ __u16 engine_class; #define I915_ENGINE_CLASS_INVALID_NONE -1 #define I915_ENGINE_CLASS_INVALID_VIRTUAL -2 /** * @engine_instance: * * Engine instance. */ __u16 engine_instance; }; /** * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915 * */ enum drm_i915_pmu_engine_sample { I915_SAMPLE_BUSY = 0, I915_SAMPLE_WAIT = 1, I915_SAMPLE_SEMA = 2 }; #define I915_PMU_SAMPLE_BITS (4) #define I915_PMU_SAMPLE_MASK (0xf) #define I915_PMU_SAMPLE_INSTANCE_BITS (8) #define I915_PMU_CLASS_SHIFT \ (I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS) #define __I915_PMU_ENGINE(class, instance, sample) \ ((class) << I915_PMU_CLASS_SHIFT | \ (instance) << I915_PMU_SAMPLE_BITS | \ (sample)) #define I915_PMU_ENGINE_BUSY(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_BUSY) #define I915_PMU_ENGINE_WAIT(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_WAIT) #define I915_PMU_ENGINE_SEMA(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA) #define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) #define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0) #define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1) #define I915_PMU_INTERRUPTS __I915_PMU_OTHER(2) #define I915_PMU_RC6_RESIDENCY __I915_PMU_OTHER(3) #define I915_PMU_SOFTWARE_GT_AWAKE_TIME __I915_PMU_OTHER(4) #define I915_PMU_LAST /* Deprecated - do not use */ I915_PMU_RC6_RESIDENCY /* Each region is a minimum of 16k, and there are at most 255 of them. */ #define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use * of chars for next/prev indices */ #define I915_LOG_MIN_TEX_REGION_SIZE 14 typedef struct _drm_i915_init { enum { I915_INIT_DMA = 0x01, I915_CLEANUP_DMA = 0x02, I915_RESUME_DMA = 0x03 } func; unsigned int mmio_offset; int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; unsigned int ring_size; unsigned int front_offset; unsigned int back_offset; unsigned int depth_offset; unsigned int w; unsigned int h; unsigned int pitch; unsigned int pitch_bits; unsigned int back_pitch; unsigned int depth_pitch; unsigned int cpp; unsigned int chipset; } drm_i915_init_t; typedef struct _drm_i915_sarea { struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1]; int last_upload; /* last time texture was uploaded */ int last_enqueue; /* last time a buffer was enqueued */ int last_dispatch; /* age of the most recently dispatched buffer */ int ctxOwner; /* last context to upload state */ int texAge; int pf_enabled; /* is pageflipping allowed? */ int pf_active; int pf_current_page; /* which buffer is being displayed? */ int perf_boxes; /* performance boxes to be displayed */ int width, height; /* screen size in pixels */ drm_handle_t front_handle; int front_offset; int front_size; drm_handle_t back_handle; int back_offset; int back_size; drm_handle_t depth_handle; int depth_offset; int depth_size; drm_handle_t tex_handle; int tex_offset; int tex_size; int log_tex_granularity; int pitch; int rotation; /* 0, 90, 180 or 270 */ int rotated_offset; int rotated_size; int rotated_pitch; int virtualX, virtualY; unsigned int front_tiled; unsigned int back_tiled; unsigned int depth_tiled; unsigned int rotated_tiled; unsigned int rotated2_tiled; int pipeA_x; int pipeA_y; int pipeA_w; int pipeA_h; int pipeB_x; int pipeB_y; int pipeB_w; int pipeB_h; /* fill out some space for old userspace triple buffer */ drm_handle_t unused_handle; __u32 unused1, unused2, unused3; /* buffer object handles for static buffers. May change * over the lifetime of the client. */ __u32 front_bo_handle; __u32 back_bo_handle; __u32 unused_bo_handle; __u32 depth_bo_handle; } drm_i915_sarea_t; /* due to userspace building against these headers we need some compat here */ #define planeA_x pipeA_x #define planeA_y pipeA_y #define planeA_w pipeA_w #define planeA_h pipeA_h #define planeB_x pipeB_x #define planeB_y pipeB_y #define planeB_w pipeB_w #define planeB_h pipeB_h /* Flags for perf_boxes */ #define I915_BOX_RING_EMPTY 0x1 #define I915_BOX_FLIP 0x2 #define I915_BOX_WAIT 0x4 #define I915_BOX_TEXTURE_LOAD 0x8 #define I915_BOX_LOST_CONTEXT 0x10 /* * i915 specific ioctls. * * The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie * [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset * against DRM_COMMAND_BASE and should be between [0x0, 0x60). */ #define DRM_I915_INIT 0x00 #define DRM_I915_FLUSH 0x01 #define DRM_I915_FLIP 0x02 #define DRM_I915_BATCHBUFFER 0x03 #define DRM_I915_IRQ_EMIT 0x04 #define DRM_I915_IRQ_WAIT 0x05 #define DRM_I915_GETPARAM 0x06 #define DRM_I915_SETPARAM 0x07 #define DRM_I915_ALLOC 0x08 #define DRM_I915_FREE 0x09 #define DRM_I915_INIT_HEAP 0x0a #define DRM_I915_CMDBUFFER 0x0b #define DRM_I915_DESTROY_HEAP 0x0c #define DRM_I915_SET_VBLANK_PIPE 0x0d #define DRM_I915_GET_VBLANK_PIPE 0x0e #define DRM_I915_VBLANK_SWAP 0x0f #define DRM_I915_HWS_ADDR 0x11 #define DRM_I915_GEM_INIT 0x13 #define DRM_I915_GEM_EXECBUFFER 0x14 #define DRM_I915_GEM_PIN 0x15 #define DRM_I915_GEM_UNPIN 0x16 #define DRM_I915_GEM_BUSY 0x17 #define DRM_I915_GEM_THROTTLE 0x18 #define DRM_I915_GEM_ENTERVT 0x19 #define DRM_I915_GEM_LEAVEVT 0x1a #define DRM_I915_GEM_CREATE 0x1b #define DRM_I915_GEM_PREAD 0x1c #define DRM_I915_GEM_PWRITE 0x1d #define DRM_I915_GEM_MMAP 0x1e #define DRM_I915_GEM_SET_DOMAIN 0x1f #define DRM_I915_GEM_SW_FINISH 0x20 #define DRM_I915_GEM_SET_TILING 0x21 #define DRM_I915_GEM_GET_TILING 0x22 #define DRM_I915_GEM_GET_APERTURE 0x23 #define DRM_I915_GEM_MMAP_GTT 0x24 #define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 #define DRM_I915_GEM_MADVISE 0x26 #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 #define DRM_I915_OVERLAY_ATTRS 0x28 #define DRM_I915_GEM_EXECBUFFER2 0x29 #define DRM_I915_GEM_EXECBUFFER2_WR DRM_I915_GEM_EXECBUFFER2 #define DRM_I915_GET_SPRITE_COLORKEY 0x2a #define DRM_I915_SET_SPRITE_COLORKEY 0x2b #define DRM_I915_GEM_WAIT 0x2c #define DRM_I915_GEM_CONTEXT_CREATE 0x2d #define DRM_I915_GEM_CONTEXT_DESTROY 0x2e #define DRM_I915_GEM_SET_CACHING 0x2f #define DRM_I915_GEM_GET_CACHING 0x30 #define DRM_I915_REG_READ 0x31 #define DRM_I915_GET_RESET_STATS 0x32 #define DRM_I915_GEM_USERPTR 0x33 #define DRM_I915_GEM_CONTEXT_GETPARAM 0x34 #define DRM_I915_GEM_CONTEXT_SETPARAM 0x35 #define DRM_I915_PERF_OPEN 0x36 #define DRM_I915_PERF_ADD_CONFIG 0x37 #define DRM_I915_PERF_REMOVE_CONFIG 0x38 #define DRM_I915_QUERY 0x39 #define DRM_I915_GEM_VM_CREATE 0x3a #define DRM_I915_GEM_VM_DESTROY 0x3b #define DRM_I915_GEM_CREATE_EXT 0x3c /* Must be kept compact -- no holes */ #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) #define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) #define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) #define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) #define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init) #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) #define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) #define DRM_IOCTL_I915_GEM_EXECBUFFER2_WR DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2_WR, struct drm_i915_gem_execbuffer2) #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) #define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching) #define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching) #define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) #define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) #define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) #define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) #define DRM_IOCTL_I915_GEM_CREATE_EXT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext) #define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) #define DRM_IOCTL_I915_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset) #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id) #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) #define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) #define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) #define DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create_ext) #define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) #define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) #define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) #define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr) #define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param) #define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param) #define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param) #define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config) #define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64) #define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query) #define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control) #define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control) /* Allow drivers to submit batchbuffers directly to hardware, relying * on the security mechanisms provided by hardware. */ typedef struct drm_i915_batchbuffer { int start; /* agp offset */ int used; /* nr bytes in use */ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ } drm_i915_batchbuffer_t; /* As above, but pass a pointer to userspace buffer which can be * validated by the kernel prior to sending to hardware. */ typedef struct _drm_i915_cmdbuffer { char *buf; /* pointer to userspace command buffer */ int sz; /* nr bytes in buf */ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ } drm_i915_cmdbuffer_t; /* Userspace can request & wait on irq's: */ typedef struct drm_i915_irq_emit { int *irq_seq; } drm_i915_irq_emit_t; typedef struct drm_i915_irq_wait { int irq_seq; } drm_i915_irq_wait_t; /* * Different modes of per-process Graphics Translation Table, * see I915_PARAM_HAS_ALIASING_PPGTT */ #define I915_GEM_PPGTT_NONE 0 #define I915_GEM_PPGTT_ALIASING 1 #define I915_GEM_PPGTT_FULL 2 /* Ioctl to query kernel params: */ #define I915_PARAM_IRQ_ACTIVE 1 #define I915_PARAM_ALLOW_BATCHBUFFER 2 #define I915_PARAM_LAST_DISPATCH 3 #define I915_PARAM_CHIPSET_ID 4 #define I915_PARAM_HAS_GEM 5 #define I915_PARAM_NUM_FENCES_AVAIL 6 #define I915_PARAM_HAS_OVERLAY 7 #define I915_PARAM_HAS_PAGEFLIPPING 8 #define I915_PARAM_HAS_EXECBUF2 9 #define I915_PARAM_HAS_BSD 10 #define I915_PARAM_HAS_BLT 11 #define I915_PARAM_HAS_RELAXED_FENCING 12 #define I915_PARAM_HAS_COHERENT_RINGS 13 #define I915_PARAM_HAS_EXEC_CONSTANTS 14 #define I915_PARAM_HAS_RELAXED_DELTA 15 #define I915_PARAM_HAS_GEN7_SOL_RESET 16 #define I915_PARAM_HAS_LLC 17 #define I915_PARAM_HAS_ALIASING_PPGTT 18 #define I915_PARAM_HAS_WAIT_TIMEOUT 19 #define I915_PARAM_HAS_SEMAPHORES 20 #define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 #define I915_PARAM_HAS_VEBOX 22 #define I915_PARAM_HAS_SECURE_BATCHES 23 #define I915_PARAM_HAS_PINNED_BATCHES 24 #define I915_PARAM_HAS_EXEC_NO_RELOC 25 #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 #define I915_PARAM_HAS_WT 27 #define I915_PARAM_CMD_PARSER_VERSION 28 #define I915_PARAM_HAS_COHERENT_PHYS_GTT 29 #define I915_PARAM_MMAP_VERSION 30 #define I915_PARAM_HAS_BSD2 31 #define I915_PARAM_REVISION 32 #define I915_PARAM_SUBSLICE_TOTAL 33 #define I915_PARAM_EU_TOTAL 34 #define I915_PARAM_HAS_GPU_RESET 35 #define I915_PARAM_HAS_RESOURCE_STREAMER 36 #define I915_PARAM_HAS_EXEC_SOFTPIN 37 #define I915_PARAM_HAS_POOLED_EU 38 #define I915_PARAM_MIN_EU_IN_POOL 39 #define I915_PARAM_MMAP_GTT_VERSION 40 /* * Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution * priorities and the driver will attempt to execute batches in priority order. * The param returns a capability bitmask, nonzero implies that the scheduler * is enabled, with different features present according to the mask. * * The initial priority for each batch is supplied by the context and is * controlled via I915_CONTEXT_PARAM_PRIORITY. */ #define I915_PARAM_HAS_SCHEDULER 41 #define I915_SCHEDULER_CAP_ENABLED (1ul << 0) #define I915_SCHEDULER_CAP_PRIORITY (1ul << 1) #define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2) #define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3) #define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4) /* * Indicates the 2k user priority levels are statically mapped into 3 buckets as * follows: * * -1k to -1 Low priority * 0 Normal priority * 1 to 1k Highest priority */ #define I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP (1ul << 5) /* * Query the status of HuC load. * * The query can fail in the following scenarios with the listed error codes: * -ENODEV if HuC is not present on this platform, * -EOPNOTSUPP if HuC firmware usage is disabled, * -ENOPKG if HuC firmware fetch failed, * -ENOEXEC if HuC firmware is invalid or mismatched, * -ENOMEM if i915 failed to prepare the FW objects for transfer to the uC, * -EIO if the FW transfer or the FW authentication failed. * * If the IOCTL is successful, the returned parameter will be set to one of the * following values: * * 0 if HuC firmware load is not complete, * * 1 if HuC firmware is authenticated and running. */ #define I915_PARAM_HUC_STATUS 42 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to opt-out of * synchronisation with implicit fencing on individual objects. * See EXEC_OBJECT_ASYNC. */ #define I915_PARAM_HAS_EXEC_ASYNC 43 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports explicit fence support - * both being able to pass in a sync_file fd to wait upon before executing, * and being able to return a new sync_file fd that is signaled when the * current request is complete. See I915_EXEC_FENCE_IN and I915_EXEC_FENCE_OUT. */ #define I915_PARAM_HAS_EXEC_FENCE 44 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture * user specified bufffers for post-mortem debugging of GPU hangs. See * EXEC_OBJECT_CAPTURE. */ #define I915_PARAM_HAS_EXEC_CAPTURE 45 #define I915_PARAM_SLICE_MASK 46 /* Assuming it's uniform for each slice, this queries the mask of subslices * per-slice for this system. */ #define I915_PARAM_SUBSLICE_MASK 47 /* * Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying the batch buffer * as the first execobject as opposed to the last. See I915_EXEC_BATCH_FIRST. */ #define I915_PARAM_HAS_EXEC_BATCH_FIRST 48 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of * drm_i915_gem_exec_fence structures. See I915_EXEC_FENCE_ARRAY. */ #define I915_PARAM_HAS_EXEC_FENCE_ARRAY 49 /* * Query whether every context (both per-file default and user created) is * isolated (insofar as HW supports). If this parameter is not true, then * freshly created contexts may inherit values from an existing context, * rather than default HW values. If true, it also ensures (insofar as HW * supports) that all state set by this context will not leak to any other * context. * * As not every engine across every gen support contexts, the returned * value reports the support of context isolation for individual engines by * returning a bitmask of each engine class set to true if that class supports * isolation. */ #define I915_PARAM_HAS_CONTEXT_ISOLATION 50 /* Frequency of the command streamer timestamps given by the *_TIMESTAMP * registers. This used to be fixed per platform but from CNL onwards, this * might vary depending on the parts. */ #define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51 /* * Once upon a time we supposed that writes through the GGTT would be * immediately in physical memory (once flushed out of the CPU path). However, * on a few different processors and chipsets, this is not necessarily the case * as the writes appear to be buffered internally. Thus a read of the backing * storage (physical memory) via a different path (with different physical tags * to the indirect write via the GGTT) will see stale values from before * the GGTT write. Inside the kernel, we can for the most part keep track of * the different read/write domains in use (e.g. set-domain), but the assumption * of coherency is baked into the ABI, hence reporting its true state in this * parameter. * * Reports true when writes via mmap_gtt are immediately visible following an * lfence to flush the WCB. * * Reports false when writes via mmap_gtt are indeterminately delayed in an in * internal buffer and are _not_ immediately visible to third parties accessing * directly via mmap_cpu/mmap_wc. Use of mmap_gtt as part of an IPC * communications channel when reporting false is strongly disadvised. */ #define I915_PARAM_MMAP_GTT_COHERENT 52 /* * Query whether DRM_I915_GEM_EXECBUFFER2 supports coordination of parallel * execution through use of explicit fence support. * See I915_EXEC_FENCE_OUT and I915_EXEC_FENCE_SUBMIT. */ #define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53 /* * Revision of the i915-perf uAPI. The value returned helps determine what * i915-perf features are available. See drm_i915_perf_property_id. */ #define I915_PARAM_PERF_REVISION 54 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of * timeline syncobj through drm_i915_gem_execbuffer_ext_timeline_fences. See * I915_EXEC_USE_EXTENSIONS. */ #define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55 /* Query if the kernel supports the I915_USERPTR_PROBE flag. */ #define I915_PARAM_HAS_USERPTR_PROBE 56 /* * Frequency of the timestamps in OA reports. This used to be the same as the CS * timestamp frequency, but differs on some platforms. */ #define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57 /* Must be kept compact -- no holes and well documented */ /** * struct drm_i915_getparam - Driver parameter query structure. */ struct drm_i915_getparam { /** @param: Driver parameter to query. */ __s32 param; /** * @value: Address of memory where queried value should be put. * * WARNING: Using pointers instead of fixed-size u64 means we need to write * compat32 code. Don't repeat this mistake. */ int *value; }; /** * typedef drm_i915_getparam_t - Driver parameter query structure. * See struct drm_i915_getparam. */ typedef struct drm_i915_getparam drm_i915_getparam_t; /* Ioctl to set kernel params: */ #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 #define I915_SETPARAM_ALLOW_BATCHBUFFER 3 #define I915_SETPARAM_NUM_USED_FENCES 4 /* Must be kept compact -- no holes */ typedef struct drm_i915_setparam { int param; int value; } drm_i915_setparam_t; /* A memory manager for regions of shared memory: */ #define I915_MEM_REGION_AGP 1 typedef struct drm_i915_mem_alloc { int region; int alignment; int size; int *region_offset; /* offset from start of fb or agp */ } drm_i915_mem_alloc_t; typedef struct drm_i915_mem_free { int region; int region_offset; } drm_i915_mem_free_t; typedef struct drm_i915_mem_init_heap { int region; int size; int start; } drm_i915_mem_init_heap_t; /* Allow memory manager to be torn down and re-initialized (eg on * rotate): */ typedef struct drm_i915_mem_destroy_heap { int region; } drm_i915_mem_destroy_heap_t; /* Allow X server to configure which pipes to monitor for vblank signals */ #define DRM_I915_VBLANK_PIPE_A 1 #define DRM_I915_VBLANK_PIPE_B 2 typedef struct drm_i915_vblank_pipe { int pipe; } drm_i915_vblank_pipe_t; /* Schedule buffer swap at given vertical blank: */ typedef struct drm_i915_vblank_swap { drm_drawable_t drawable; enum drm_vblank_seq_type seqtype; unsigned int sequence; } drm_i915_vblank_swap_t; typedef struct drm_i915_hws_addr { __u64 addr; } drm_i915_hws_addr_t; struct drm_i915_gem_init { /** * Beginning offset in the GTT to be managed by the DRM memory * manager. */ __u64 gtt_start; /** * Ending offset in the GTT to be managed by the DRM memory * manager. */ __u64 gtt_end; }; struct drm_i915_gem_create { /** * Requested size for the object. * * The (page-aligned) allocated size for the object will be returned. */ __u64 size; /** * Returned handle for the object. * * Object handles are nonzero. */ __u32 handle; __u32 pad; }; struct drm_i915_gem_pread { /** Handle for the object being read. */ __u32 handle; __u32 pad; /** Offset into the object to read from */ __u64 offset; /** Length of data to read */ __u64 size; /** * Pointer to write the data into. * * This is a fixed-size type for 32/64 compatibility. */ __u64 data_ptr; }; struct drm_i915_gem_pwrite { /** Handle for the object being written to. */ __u32 handle; __u32 pad; /** Offset into the object to write to */ __u64 offset; /** Length of data to write */ __u64 size; /** * Pointer to read the data from. * * This is a fixed-size type for 32/64 compatibility. */ __u64 data_ptr; }; struct drm_i915_gem_mmap { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** Offset in the object to map. */ __u64 offset; /** * Length of data to map. * * The value will be page-aligned. */ __u64 size; /** * Returned pointer the data was mapped at. * * This is a fixed-size type for 32/64 compatibility. */ __u64 addr_ptr; /** * Flags for extended behaviour. * * Added in version 2. */ __u64 flags; #define I915_MMAP_WC 0x1 }; struct drm_i915_gem_mmap_gtt { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** * Fake offset to use for subsequent mmap call * * This is a fixed-size type for 32/64 compatibility. */ __u64 offset; }; /** * struct drm_i915_gem_mmap_offset - Retrieve an offset so we can mmap this buffer object. * * This struct is passed as argument to the `DRM_IOCTL_I915_GEM_MMAP_OFFSET` ioctl, * and is used to retrieve the fake offset to mmap an object specified by &handle. * * The legacy way of using `DRM_IOCTL_I915_GEM_MMAP` is removed on gen12+. * `DRM_IOCTL_I915_GEM_MMAP_GTT` is an older supported alias to this struct, but will behave * as setting the &extensions to 0, and &flags to `I915_MMAP_OFFSET_GTT`. */ struct drm_i915_gem_mmap_offset { /** @handle: Handle for the object being mapped. */ __u32 handle; /** @pad: Must be zero */ __u32 pad; /** * @offset: The fake offset to use for subsequent mmap call * * This is a fixed-size type for 32/64 compatibility. */ __u64 offset; /** * @flags: Flags for extended behaviour. * * It is mandatory that one of the `MMAP_OFFSET` types * should be included: * * - `I915_MMAP_OFFSET_GTT`: Use mmap with the object bound to GTT. (Write-Combined) * - `I915_MMAP_OFFSET_WC`: Use Write-Combined caching. * - `I915_MMAP_OFFSET_WB`: Use Write-Back caching. * - `I915_MMAP_OFFSET_FIXED`: Use object placement to determine caching. * * On devices with local memory `I915_MMAP_OFFSET_FIXED` is the only valid * type. On devices without local memory, this caching mode is invalid. * * As caching mode when specifying `I915_MMAP_OFFSET_FIXED`, WC or WB will * be used, depending on the object placement on creation. WB will be used * when the object can only exist in system memory, WC otherwise. */ __u64 flags; #define I915_MMAP_OFFSET_GTT 0 #define I915_MMAP_OFFSET_WC 1 #define I915_MMAP_OFFSET_WB 2 #define I915_MMAP_OFFSET_UC 3 #define I915_MMAP_OFFSET_FIXED 4 /** * @extensions: Zero-terminated chain of extensions. * * No current extensions defined; mbz. */ __u64 extensions; }; /** * struct drm_i915_gem_set_domain - Adjust the objects write or read domain, in * preparation for accessing the pages via some CPU domain. * * Specifying a new write or read domain will flush the object out of the * previous domain(if required), before then updating the objects domain * tracking with the new domain. * * Note this might involve waiting for the object first if it is still active on * the GPU. * * Supported values for @read_domains and @write_domain: * * - I915_GEM_DOMAIN_WC: Uncached write-combined domain * - I915_GEM_DOMAIN_CPU: CPU cache domain * - I915_GEM_DOMAIN_GTT: Mappable aperture domain * * All other domains are rejected. * * Note that for discrete, starting from DG1, this is no longer supported, and * is instead rejected. On such platforms the CPU domain is effectively static, * where we also only support a single &drm_i915_gem_mmap_offset cache mode, * which can't be set explicitly and instead depends on the object placements, * as per the below. * * Implicit caching rules, starting from DG1: * * - If any of the object placements (see &drm_i915_gem_create_ext_memory_regions) * contain I915_MEMORY_CLASS_DEVICE then the object will be allocated and * mapped as write-combined only. * * - Everything else is always allocated and mapped as write-back, with the * guarantee that everything is also coherent with the GPU. * * Note that this is likely to change in the future again, where we might need * more flexibility on future devices, so making this all explicit as part of a * new &drm_i915_gem_create_ext extension is probable. */ struct drm_i915_gem_set_domain { /** @handle: Handle for the object. */ __u32 handle; /** @read_domains: New read domains. */ __u32 read_domains; /** * @write_domain: New write domain. * * Note that having something in the write domain implies it's in the * read domain, and only that read domain. */ __u32 write_domain; }; struct drm_i915_gem_sw_finish { /** Handle for the object */ __u32 handle; }; struct drm_i915_gem_relocation_entry { /** * Handle of the buffer being pointed to by this relocation entry. * * It's appealing to make this be an index into the mm_validate_entry * list to refer to the buffer, but this allows the driver to create * a relocation list for state buffers and not re-write it per * exec using the buffer. */ __u32 target_handle; /** * Value to be added to the offset of the target buffer to make up * the relocation entry. */ __u32 delta; /** Offset in the buffer the relocation entry will be written into */ __u64 offset; /** * Offset value of the target buffer that the relocation entry was last * written as. * * If the buffer has the same offset as last time, we can skip syncing * and writing the relocation. This value is written back out by * the execbuffer ioctl when the relocation is written. */ __u64 presumed_offset; /** * Target memory domains read by this operation. */ __u32 read_domains; /** * Target memory domains written by this operation. * * Note that only one domain may be written by the whole * execbuffer operation, so that where there are conflicts, * the application will get -EINVAL back. */ __u32 write_domain; }; /** @{ * Intel memory domains * * Most of these just align with the various caches in * the system and are used to flush and invalidate as * objects end up cached in different domains. */ /** CPU cache */ #define I915_GEM_DOMAIN_CPU 0x00000001 /** Render cache, used by 2D and 3D drawing */ #define I915_GEM_DOMAIN_RENDER 0x00000002 /** Sampler cache, used by texture engine */ #define I915_GEM_DOMAIN_SAMPLER 0x00000004 /** Command queue, used to load batch buffers */ #define I915_GEM_DOMAIN_COMMAND 0x00000008 /** Instruction cache, used by shader programs */ #define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 /** Vertex address cache */ #define I915_GEM_DOMAIN_VERTEX 0x00000020 /** GTT domain - aperture and scanout */ #define I915_GEM_DOMAIN_GTT 0x00000040 /** WC domain - uncached access */ #define I915_GEM_DOMAIN_WC 0x00000080 /** @} */ struct drm_i915_gem_exec_object { /** * User's handle for a buffer to be bound into the GTT for this * operation. */ __u32 handle; /** Number of relocations to be performed on this buffer */ __u32 relocation_count; /** * Pointer to array of struct drm_i915_gem_relocation_entry containing * the relocations to be performed in this buffer. */ __u64 relocs_ptr; /** Required alignment in graphics aperture */ __u64 alignment; /** * Returned value of the updated offset of the object, for future * presumed_offset writes. */ __u64 offset; }; /* DRM_IOCTL_I915_GEM_EXECBUFFER was removed in Linux 5.13 */ struct drm_i915_gem_execbuffer { /** * List of buffers to be validated with their relocations to be * performend on them. * * This is a pointer to an array of struct drm_i915_gem_validate_entry. * * These buffers must be listed in an order such that all relocations * a buffer is performing refer to buffers that have already appeared * in the validate list. */ __u64 buffers_ptr; __u32 buffer_count; /** Offset in the batchbuffer to start execution from. */ __u32 batch_start_offset; /** Bytes used in batchbuffer from batch_start_offset */ __u32 batch_len; __u32 DR1; __u32 DR4; __u32 num_cliprects; /** This is a struct drm_clip_rect *cliprects */ __u64 cliprects_ptr; }; struct drm_i915_gem_exec_object2 { /** * User's handle for a buffer to be bound into the GTT for this * operation. */ __u32 handle; /** Number of relocations to be performed on this buffer */ __u32 relocation_count; /** * Pointer to array of struct drm_i915_gem_relocation_entry containing * the relocations to be performed in this buffer. */ __u64 relocs_ptr; /** Required alignment in graphics aperture */ __u64 alignment; /** * When the EXEC_OBJECT_PINNED flag is specified this is populated by * the user with the GTT offset at which this object will be pinned. * * When the I915_EXEC_NO_RELOC flag is specified this must contain the * presumed_offset of the object. * * During execbuffer2 the kernel populates it with the value of the * current GTT offset of the object, for future presumed_offset writes. * * See struct drm_i915_gem_create_ext for the rules when dealing with * alignment restrictions with I915_MEMORY_CLASS_DEVICE, on devices with * minimum page sizes, like DG2. */ __u64 offset; #define EXEC_OBJECT_NEEDS_FENCE (1<<0) #define EXEC_OBJECT_NEEDS_GTT (1<<1) #define EXEC_OBJECT_WRITE (1<<2) #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) #define EXEC_OBJECT_PINNED (1<<4) #define EXEC_OBJECT_PAD_TO_SIZE (1<<5) /* The kernel implicitly tracks GPU activity on all GEM objects, and * synchronises operations with outstanding rendering. This includes * rendering on other devices if exported via dma-buf. However, sometimes * this tracking is too coarse and the user knows better. For example, * if the object is split into non-overlapping ranges shared between different * clients or engines (i.e. suballocating objects), the implicit tracking * by kernel assumes that each operation affects the whole object rather * than an individual range, causing needless synchronisation between clients. * The kernel will also forgo any CPU cache flushes prior to rendering from * the object as the client is expected to be also handling such domain * tracking. * * The kernel maintains the implicit tracking in order to manage resources * used by the GPU - this flag only disables the synchronisation prior to * rendering with this object in this execbuf. * * Opting out of implicit synhronisation requires the user to do its own * explicit tracking to avoid rendering corruption. See, for example, * I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously. */ #define EXEC_OBJECT_ASYNC (1<<6) /* Request that the contents of this execobject be copied into the error * state upon a GPU hang involving this batch for post-mortem debugging. * These buffers are recorded in no particular order as "user" in * /sys/class/drm/cardN/error. Query I915_PARAM_HAS_EXEC_CAPTURE to see * if the kernel supports this flag. */ #define EXEC_OBJECT_CAPTURE (1<<7) /* All remaining bits are MBZ and RESERVED FOR FUTURE USE */ #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1) __u64 flags; union { __u64 rsvd1; __u64 pad_to_size; }; __u64 rsvd2; }; /** * struct drm_i915_gem_exec_fence - An input or output fence for the execbuf * ioctl. * * The request will wait for input fence to signal before submission. * * The returned output fence will be signaled after the completion of the * request. */ struct drm_i915_gem_exec_fence { /** @handle: User's handle for a drm_syncobj to wait on or signal. */ __u32 handle; /** * @flags: Supported flags are: * * I915_EXEC_FENCE_WAIT: * Wait for the input fence before request submission. * * I915_EXEC_FENCE_SIGNAL: * Return request completion fence as output */ __u32 flags; #define I915_EXEC_FENCE_WAIT (1<<0) #define I915_EXEC_FENCE_SIGNAL (1<<1) #define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1)) }; /** * struct drm_i915_gem_execbuffer_ext_timeline_fences - Timeline fences * for execbuf ioctl. * * This structure describes an array of drm_syncobj and associated points for * timeline variants of drm_syncobj. It is invalid to append this structure to * the execbuf if I915_EXEC_FENCE_ARRAY is set. */ struct drm_i915_gem_execbuffer_ext_timeline_fences { #define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0 /** @base: Extension link. See struct i915_user_extension. */ struct i915_user_extension base; /** * @fence_count: Number of elements in the @handles_ptr & @value_ptr * arrays. */ __u64 fence_count; /** * @handles_ptr: Pointer to an array of struct drm_i915_gem_exec_fence * of length @fence_count. */ __u64 handles_ptr; /** * @values_ptr: Pointer to an array of u64 values of length * @fence_count. * Values must be 0 for a binary drm_syncobj. A Value of 0 for a * timeline drm_syncobj is invalid as it turns a drm_syncobj into a * binary one. */ __u64 values_ptr; }; /** * struct drm_i915_gem_execbuffer2 - Structure for DRM_I915_GEM_EXECBUFFER2 * ioctl. */ struct drm_i915_gem_execbuffer2 { /** @buffers_ptr: Pointer to a list of gem_exec_object2 structs */ __u64 buffers_ptr; /** @buffer_count: Number of elements in @buffers_ptr array */ __u32 buffer_count; /** * @batch_start_offset: Offset in the batchbuffer to start execution * from. */ __u32 batch_start_offset; /** * @batch_len: Length in bytes of the batch buffer, starting from the * @batch_start_offset. If 0, length is assumed to be the batch buffer * object size. */ __u32 batch_len; /** @DR1: deprecated */ __u32 DR1; /** @DR4: deprecated */ __u32 DR4; /** @num_cliprects: See @cliprects_ptr */ __u32 num_cliprects; /** * @cliprects_ptr: Kernel clipping was a DRI1 misfeature. * * It is invalid to use this field if I915_EXEC_FENCE_ARRAY or * I915_EXEC_USE_EXTENSIONS flags are not set. * * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array * of &drm_i915_gem_exec_fence and @num_cliprects is the length of the * array. * * If I915_EXEC_USE_EXTENSIONS is set, then this is a pointer to a * single &i915_user_extension and num_cliprects is 0. */ __u64 cliprects_ptr; /** @flags: Execbuf flags */ __u64 flags; #define I915_EXEC_RING_MASK (0x3f) #define I915_EXEC_DEFAULT (0<<0) #define I915_EXEC_RENDER (1<<0) #define I915_EXEC_BSD (2<<0) #define I915_EXEC_BLT (3<<0) #define I915_EXEC_VEBOX (4<<0) /* Used for switching the constants addressing mode on gen4+ RENDER ring. * Gen6+ only supports relative addressing to dynamic state (default) and * absolute addressing. * * These flags are ignored for the BSD and BLT rings. */ #define I915_EXEC_CONSTANTS_MASK (3<<6) #define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ #define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) #define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ /** Resets the SO write offset registers for transform feedback on gen7. */ #define I915_EXEC_GEN7_SOL_RESET (1<<8) /** Request a privileged ("secure") batch buffer. Note only available for * DRM_ROOT_ONLY | DRM_MASTER processes. */ #define I915_EXEC_SECURE (1<<9) /** Inform the kernel that the batch is and will always be pinned. This * negates the requirement for a workaround to be performed to avoid * an incoherent CS (such as can be found on 830/845). If this flag is * not passed, the kernel will endeavour to make sure the batch is * coherent with the CS before execution. If this flag is passed, * userspace assumes the responsibility for ensuring the same. */ #define I915_EXEC_IS_PINNED (1<<10) /** Provide a hint to the kernel that the command stream and auxiliary * state buffers already holds the correct presumed addresses and so the * relocation process may be skipped if no buffers need to be moved in * preparation for the execbuffer. */ #define I915_EXEC_NO_RELOC (1<<11) /** Use the reloc.handle as an index into the exec object array rather * than as the per-file handle. */ #define I915_EXEC_HANDLE_LUT (1<<12) /** Used for switching BSD rings on the platforms with two BSD rings */ #define I915_EXEC_BSD_SHIFT (13) #define I915_EXEC_BSD_MASK (3 << I915_EXEC_BSD_SHIFT) /* default ping-pong mode */ #define I915_EXEC_BSD_DEFAULT (0 << I915_EXEC_BSD_SHIFT) #define I915_EXEC_BSD_RING1 (1 << I915_EXEC_BSD_SHIFT) #define I915_EXEC_BSD_RING2 (2 << I915_EXEC_BSD_SHIFT) /** Tell the kernel that the batchbuffer is processed by * the resource streamer. */ #define I915_EXEC_RESOURCE_STREAMER (1<<15) /* Setting I915_EXEC_FENCE_IN implies that lower_32_bits(rsvd2) represent * a sync_file fd to wait upon (in a nonblocking manner) prior to executing * the batch. * * Returns -EINVAL if the sync_file fd cannot be found. */ #define I915_EXEC_FENCE_IN (1<<16) /* Setting I915_EXEC_FENCE_OUT causes the ioctl to return a sync_file fd * in the upper_32_bits(rsvd2) upon success. Ownership of the fd is given * to the caller, and it should be close() after use. (The fd is a regular * file descriptor and will be cleaned up on process termination. It holds * a reference to the request, but nothing else.) * * The sync_file fd can be combined with other sync_file and passed either * to execbuf using I915_EXEC_FENCE_IN, to atomic KMS ioctls (so that a flip * will only occur after this request completes), or to other devices. * * Using I915_EXEC_FENCE_OUT requires use of * DRM_IOCTL_I915_GEM_EXECBUFFER2_WR ioctl so that the result is written * back to userspace. Failure to do so will cause the out-fence to always * be reported as zero, and the real fence fd to be leaked. */ #define I915_EXEC_FENCE_OUT (1<<17) /* * Traditionally the execbuf ioctl has only considered the final element in * the execobject[] to be the executable batch. Often though, the client * will known the batch object prior to construction and being able to place * it into the execobject[] array first can simplify the relocation tracking. * Setting I915_EXEC_BATCH_FIRST tells execbuf to use element 0 of the * execobject[] as the * batch instead (the default is to use the last * element). */ #define I915_EXEC_BATCH_FIRST (1<<18) /* Setting I915_FENCE_ARRAY implies that num_cliprects and cliprects_ptr * define an array of i915_gem_exec_fence structures which specify a set of * dma fences to wait upon or signal. */ #define I915_EXEC_FENCE_ARRAY (1<<19) /* * Setting I915_EXEC_FENCE_SUBMIT implies that lower_32_bits(rsvd2) represent * a sync_file fd to wait upon (in a nonblocking manner) prior to executing * the batch. * * Returns -EINVAL if the sync_file fd cannot be found. */ #define I915_EXEC_FENCE_SUBMIT (1 << 20) /* * Setting I915_EXEC_USE_EXTENSIONS implies that * drm_i915_gem_execbuffer2.cliprects_ptr is treated as a pointer to an linked * list of i915_user_extension. Each i915_user_extension node is the base of a * larger structure. The list of supported structures are listed in the * drm_i915_gem_execbuffer_ext enum. */ #define I915_EXEC_USE_EXTENSIONS (1 << 21) #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_USE_EXTENSIONS << 1)) /** @rsvd1: Context id */ __u64 rsvd1; /** * @rsvd2: in and out sync_file file descriptors. * * When I915_EXEC_FENCE_IN or I915_EXEC_FENCE_SUBMIT flag is set, the * lower 32 bits of this field will have the in sync_file fd (input). * * When I915_EXEC_FENCE_OUT flag is set, the upper 32 bits of this * field will have the out sync_file fd (output). */ __u64 rsvd2; }; #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) #define i915_execbuffer2_set_context_id(eb2, context) \ (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK #define i915_execbuffer2_get_context_id(eb2) \ ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) struct drm_i915_gem_pin { /** Handle of the buffer to be pinned. */ __u32 handle; __u32 pad; /** alignment required within the aperture */ __u64 alignment; /** Returned GTT offset of the buffer. */ __u64 offset; }; struct drm_i915_gem_unpin { /** Handle of the buffer to be unpinned. */ __u32 handle; __u32 pad; }; struct drm_i915_gem_busy { /** Handle of the buffer to check for busy */ __u32 handle; /** Return busy status * * A return of 0 implies that the object is idle (after * having flushed any pending activity), and a non-zero return that * the object is still in-flight on the GPU. (The GPU has not yet * signaled completion for all pending requests that reference the * object.) An object is guaranteed to become idle eventually (so * long as no new GPU commands are executed upon it). Due to the * asynchronous nature of the hardware, an object reported * as busy may become idle before the ioctl is completed. * * Furthermore, if the object is busy, which engine is busy is only * provided as a guide and only indirectly by reporting its class * (there may be more than one engine in each class). There are race * conditions which prevent the report of which engines are busy from * being always accurate. However, the converse is not true. If the * object is idle, the result of the ioctl, that all engines are idle, * is accurate. * * The returned dword is split into two fields to indicate both * the engine classess on which the object is being read, and the * engine class on which it is currently being written (if any). * * The low word (bits 0:15) indicate if the object is being written * to by any engine (there can only be one, as the GEM implicit * synchronisation rules force writes to be serialised). Only the * engine class (offset by 1, I915_ENGINE_CLASS_RENDER is reported as * 1 not 0 etc) for the last write is reported. * * The high word (bits 16:31) are a bitmask of which engines classes * are currently reading from the object. Multiple engines may be * reading from the object simultaneously. * * The value of each engine class is the same as specified in the * I915_CONTEXT_PARAM_ENGINES context parameter and via perf, i.e. * I915_ENGINE_CLASS_RENDER, I915_ENGINE_CLASS_COPY, etc. * Some hardware may have parallel execution engines, e.g. multiple * media engines, which are mapped to the same class identifier and so * are not separately reported for busyness. * * Caveat emptor: * Only the boolean result of this query is reliable; that is whether * the object is idle or busy. The report of which engines are busy * should be only used as a heuristic. */ __u32 busy; }; /** * struct drm_i915_gem_caching - Set or get the caching for given object * handle. * * Allow userspace to control the GTT caching bits for a given object when the * object is later mapped through the ppGTT(or GGTT on older platforms lacking * ppGTT support, or if the object is used for scanout). Note that this might * require unbinding the object from the GTT first, if its current caching value * doesn't match. * * Note that this all changes on discrete platforms, starting from DG1, the * set/get caching is no longer supported, and is now rejected. Instead the CPU * caching attributes(WB vs WC) will become an immutable creation time property * for the object, along with the GTT caching level. For now we don't expose any * new uAPI for this, instead on DG1 this is all implicit, although this largely * shouldn't matter since DG1 is coherent by default(without any way of * controlling it). * * Implicit caching rules, starting from DG1: * * - If any of the object placements (see &drm_i915_gem_create_ext_memory_regions) * contain I915_MEMORY_CLASS_DEVICE then the object will be allocated and * mapped as write-combined only. * * - Everything else is always allocated and mapped as write-back, with the * guarantee that everything is also coherent with the GPU. * * Note that this is likely to change in the future again, where we might need * more flexibility on future devices, so making this all explicit as part of a * new &drm_i915_gem_create_ext extension is probable. * * Side note: Part of the reason for this is that changing the at-allocation-time CPU * caching attributes for the pages might be required(and is expensive) if we * need to then CPU map the pages later with different caching attributes. This * inconsistent caching behaviour, while supported on x86, is not universally * supported on other architectures. So for simplicity we opt for setting * everything at creation time, whilst also making it immutable, on discrete * platforms. */ struct drm_i915_gem_caching { /** * @handle: Handle of the buffer to set/get the caching level. */ __u32 handle; /** * @caching: The GTT caching level to apply or possible return value. * * The supported @caching values: * * I915_CACHING_NONE: * * GPU access is not coherent with CPU caches. Default for machines * without an LLC. This means manual flushing might be needed, if we * want GPU access to be coherent. * * I915_CACHING_CACHED: * * GPU access is coherent with CPU caches and furthermore the data is * cached in last-level caches shared between CPU cores and the GPU GT. * * I915_CACHING_DISPLAY: * * Special GPU caching mode which is coherent with the scanout engines. * Transparently falls back to I915_CACHING_NONE on platforms where no * special cache mode (like write-through or gfdt flushing) is * available. The kernel automatically sets this mode when using a * buffer as a scanout target. Userspace can manually set this mode to * avoid a costly stall and clflush in the hotpath of drawing the first * frame. */ #define I915_CACHING_NONE 0 #define I915_CACHING_CACHED 1 #define I915_CACHING_DISPLAY 2 __u32 caching; }; #define I915_TILING_NONE 0 #define I915_TILING_X 1 #define I915_TILING_Y 2 /* * Do not add new tiling types here. The I915_TILING_* values are for * de-tiling fence registers that no longer exist on modern platforms. Although * the hardware may support new types of tiling in general (e.g., Tile4), we * do not need to add them to the uapi that is specific to now-defunct ioctls. */ #define I915_TILING_LAST I915_TILING_Y #define I915_BIT_6_SWIZZLE_NONE 0 #define I915_BIT_6_SWIZZLE_9 1 #define I915_BIT_6_SWIZZLE_9_10 2 #define I915_BIT_6_SWIZZLE_9_11 3 #define I915_BIT_6_SWIZZLE_9_10_11 4 /* Not seen by userland */ #define I915_BIT_6_SWIZZLE_UNKNOWN 5 /* Seen by userland. */ #define I915_BIT_6_SWIZZLE_9_17 6 #define I915_BIT_6_SWIZZLE_9_10_17 7 struct drm_i915_gem_set_tiling { /** Handle of the buffer to have its tiling state updated */ __u32 handle; /** * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, * I915_TILING_Y). * * This value is to be set on request, and will be updated by the * kernel on successful return with the actual chosen tiling layout. * * The tiling mode may be demoted to I915_TILING_NONE when the system * has bit 6 swizzling that can't be managed correctly by GEM. * * Buffer contents become undefined when changing tiling_mode. */ __u32 tiling_mode; /** * Stride in bytes for the object when in I915_TILING_X or * I915_TILING_Y. */ __u32 stride; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping. */ __u32 swizzle_mode; }; struct drm_i915_gem_get_tiling { /** Handle of the buffer to get tiling state for. */ __u32 handle; /** * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, * I915_TILING_Y). */ __u32 tiling_mode; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping. */ __u32 swizzle_mode; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping whilst bound. */ __u32 phys_swizzle_mode; }; struct drm_i915_gem_get_aperture { /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ __u64 aper_size; /** * Available space in the aperture used by i915_gem_execbuffer, in * bytes */ __u64 aper_available_size; }; struct drm_i915_get_pipe_from_crtc_id { /** ID of CRTC being requested **/ __u32 crtc_id; /** pipe of requested CRTC **/ __u32 pipe; }; #define I915_MADV_WILLNEED 0 #define I915_MADV_DONTNEED 1 #define __I915_MADV_PURGED 2 /* internal state */ struct drm_i915_gem_madvise { /** Handle of the buffer to change the backing store advice */ __u32 handle; /* Advice: either the buffer will be needed again in the near future, * or wont be and could be discarded under memory pressure. */ __u32 madv; /** Whether the backing store still exists. */ __u32 retained; }; /* flags */ #define I915_OVERLAY_TYPE_MASK 0xff #define I915_OVERLAY_YUV_PLANAR 0x01 #define I915_OVERLAY_YUV_PACKED 0x02 #define I915_OVERLAY_RGB 0x03 #define I915_OVERLAY_DEPTH_MASK 0xff00 #define I915_OVERLAY_RGB24 0x1000 #define I915_OVERLAY_RGB16 0x2000 #define I915_OVERLAY_RGB15 0x3000 #define I915_OVERLAY_YUV422 0x0100 #define I915_OVERLAY_YUV411 0x0200 #define I915_OVERLAY_YUV420 0x0300 #define I915_OVERLAY_YUV410 0x0400 #define I915_OVERLAY_SWAP_MASK 0xff0000 #define I915_OVERLAY_NO_SWAP 0x000000 #define I915_OVERLAY_UV_SWAP 0x010000 #define I915_OVERLAY_Y_SWAP 0x020000 #define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 #define I915_OVERLAY_FLAGS_MASK 0xff000000 #define I915_OVERLAY_ENABLE 0x01000000 struct drm_intel_overlay_put_image { /* various flags and src format description */ __u32 flags; /* source picture description */ __u32 bo_handle; /* stride values and offsets are in bytes, buffer relative */ __u16 stride_Y; /* stride for packed formats */ __u16 stride_UV; __u32 offset_Y; /* offset for packet formats */ __u32 offset_U; __u32 offset_V; /* in pixels */ __u16 src_width; __u16 src_height; /* to compensate the scaling factors for partially covered surfaces */ __u16 src_scan_width; __u16 src_scan_height; /* output crtc description */ __u32 crtc_id; __u16 dst_x; __u16 dst_y; __u16 dst_width; __u16 dst_height; }; /* flags */ #define I915_OVERLAY_UPDATE_ATTRS (1<<0) #define I915_OVERLAY_UPDATE_GAMMA (1<<1) #define I915_OVERLAY_DISABLE_DEST_COLORKEY (1<<2) struct drm_intel_overlay_attrs { __u32 flags; __u32 color_key; __s32 brightness; __u32 contrast; __u32 saturation; __u32 gamma0; __u32 gamma1; __u32 gamma2; __u32 gamma3; __u32 gamma4; __u32 gamma5; }; /* * Intel sprite handling * * Color keying works with a min/mask/max tuple. Both source and destination * color keying is allowed. * * Source keying: * Sprite pixels within the min & max values, masked against the color channels * specified in the mask field, will be transparent. All other pixels will * be displayed on top of the primary plane. For RGB surfaces, only the min * and mask fields will be used; ranged compares are not allowed. * * Destination keying: * Primary plane pixels that match the min value, masked against the color * channels specified in the mask field, will be replaced by corresponding * pixels from the sprite plane. * * Note that source & destination keying are exclusive; only one can be * active on a given plane. */ #define I915_SET_COLORKEY_NONE (1<<0) /* Deprecated. Instead set * flags==0 to disable colorkeying. */ #define I915_SET_COLORKEY_DESTINATION (1<<1) #define I915_SET_COLORKEY_SOURCE (1<<2) struct drm_intel_sprite_colorkey { __u32 plane_id; __u32 min_value; __u32 channel_mask; __u32 max_value; __u32 flags; }; struct drm_i915_gem_wait { /** Handle of BO we shall wait on */ __u32 bo_handle; __u32 flags; /** Number of nanoseconds to wait, Returns time remaining. */ __s64 timeout_ns; }; struct drm_i915_gem_context_create { __u32 ctx_id; /* output: id of new context*/ __u32 pad; }; /** * struct drm_i915_gem_context_create_ext - Structure for creating contexts. */ struct drm_i915_gem_context_create_ext { /** @ctx_id: Id of the created context (output) */ __u32 ctx_id; /** * @flags: Supported flags are: * * I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS: * * Extensions may be appended to this structure and driver must check * for those. See @extensions. * * I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE * * Created context will have single timeline. */ __u32 flags; #define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0) #define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE (1u << 1) #define I915_CONTEXT_CREATE_FLAGS_UNKNOWN \ (-(I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1)) /** * @extensions: Zero-terminated chain of extensions. * * I915_CONTEXT_CREATE_EXT_SETPARAM: * Context parameter to set or query during context creation. * See struct drm_i915_gem_context_create_ext_setparam. * * I915_CONTEXT_CREATE_EXT_CLONE: * This extension has been removed. On the off chance someone somewhere * has attempted to use it, never re-use this extension number. */ __u64 extensions; #define I915_CONTEXT_CREATE_EXT_SETPARAM 0 #define I915_CONTEXT_CREATE_EXT_CLONE 1 }; /** * struct drm_i915_gem_context_param - Context parameter to set or query. */ struct drm_i915_gem_context_param { /** @ctx_id: Context id */ __u32 ctx_id; /** @size: Size of the parameter @value */ __u32 size; /** @param: Parameter to set or query */ __u64 param; #define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 /* I915_CONTEXT_PARAM_NO_ZEROMAP has been removed. On the off chance * someone somewhere has attempted to use it, never re-use this context * param number. */ #define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2 #define I915_CONTEXT_PARAM_GTT_SIZE 0x3 #define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 #define I915_CONTEXT_PARAM_BANNABLE 0x5 #define I915_CONTEXT_PARAM_PRIORITY 0x6 #define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */ #define I915_CONTEXT_DEFAULT_PRIORITY 0 #define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */ /* * When using the following param, value should be a pointer to * drm_i915_gem_context_param_sseu. */ #define I915_CONTEXT_PARAM_SSEU 0x7 /* * Not all clients may want to attempt automatic recover of a context after * a hang (for example, some clients may only submit very small incremental * batches relying on known logical state of previous batches which will never * recover correctly and each attempt will hang), and so would prefer that * the context is forever banned instead. * * If set to false (0), after a reset, subsequent (and in flight) rendering * from this context is discarded, and the client will need to create a new * context to use instead. * * If set to true (1), the kernel will automatically attempt to recover the * context by skipping the hanging batch and executing the next batch starting * from the default context state (discarding the incomplete logical context * state lost due to the reset). * * On creation, all new contexts are marked as recoverable. */ #define I915_CONTEXT_PARAM_RECOVERABLE 0x8 /* * The id of the associated virtual memory address space (ppGTT) of * this context. Can be retrieved and passed to another context * (on the same fd) for both to use the same ppGTT and so share * address layouts, and avoid reloading the page tables on context * switches between themselves. * * See DRM_I915_GEM_VM_CREATE and DRM_I915_GEM_VM_DESTROY. */ #define I915_CONTEXT_PARAM_VM 0x9 /* * I915_CONTEXT_PARAM_ENGINES: * * Bind this context to operate on this subset of available engines. Henceforth, * the I915_EXEC_RING selector for DRM_IOCTL_I915_GEM_EXECBUFFER2 operates as * an index into this array of engines; I915_EXEC_DEFAULT selecting engine[0] * and upwards. Slots 0...N are filled in using the specified (class, instance). * Use * engine_class: I915_ENGINE_CLASS_INVALID, * engine_instance: I915_ENGINE_CLASS_INVALID_NONE * to specify a gap in the array that can be filled in later, e.g. by a * virtual engine used for load balancing. * * Setting the number of engines bound to the context to 0, by passing a zero * sized argument, will revert back to default settings. * * See struct i915_context_param_engines. * * Extensions: * i915_context_engines_load_balance (I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE) * i915_context_engines_bond (I915_CONTEXT_ENGINES_EXT_BOND) * i915_context_engines_parallel_submit (I915_CONTEXT_ENGINES_EXT_PARALLEL_SUBMIT) */ #define I915_CONTEXT_PARAM_ENGINES 0xa /* * I915_CONTEXT_PARAM_PERSISTENCE: * * Allow the context and active rendering to survive the process until * completion. Persistence allows fire-and-forget clients to queue up a * bunch of work, hand the output over to a display server and then quit. * If the context is marked as not persistent, upon closing (either via * an explicit DRM_I915_GEM_CONTEXT_DESTROY or implicitly from file closure * or process termination), the context and any outstanding requests will be * cancelled (and exported fences for cancelled requests marked as -EIO). * * By default, new contexts allow persistence. */ #define I915_CONTEXT_PARAM_PERSISTENCE 0xb /* This API has been removed. On the off chance someone somewhere has * attempted to use it, never re-use this context param number. */ #define I915_CONTEXT_PARAM_RINGSIZE 0xc /* * I915_CONTEXT_PARAM_PROTECTED_CONTENT: * * Mark that the context makes use of protected content, which will result * in the context being invalidated when the protected content session is. * Given that the protected content session is killed on suspend, the device * is kept awake for the lifetime of a protected context, so the user should * make sure to dispose of them once done. * This flag can only be set at context creation time and, when set to true, * must be preceded by an explicit setting of I915_CONTEXT_PARAM_RECOVERABLE * to false. This flag can't be set to true in conjunction with setting the * I915_CONTEXT_PARAM_BANNABLE flag to false. Creation example: * * .. code-block:: C * * struct drm_i915_gem_context_create_ext_setparam p_protected = { * .base = { * .name = I915_CONTEXT_CREATE_EXT_SETPARAM, * }, * .param = { * .param = I915_CONTEXT_PARAM_PROTECTED_CONTENT, * .value = 1, * } * }; * struct drm_i915_gem_context_create_ext_setparam p_norecover = { * .base = { * .name = I915_CONTEXT_CREATE_EXT_SETPARAM, * .next_extension = to_user_pointer(&p_protected), * }, * .param = { * .param = I915_CONTEXT_PARAM_RECOVERABLE, * .value = 0, * } * }; * struct drm_i915_gem_context_create_ext create = { * .flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS, * .extensions = to_user_pointer(&p_norecover); * }; * * ctx_id = gem_context_create_ext(drm_fd, &create); * * In addition to the normal failure cases, setting this flag during context * creation can result in the following errors: * * -ENODEV: feature not available * -EPERM: trying to mark a recoverable or not bannable context as protected */ #define I915_CONTEXT_PARAM_PROTECTED_CONTENT 0xd /* Must be kept compact -- no holes and well documented */ /** @value: Context parameter value to be set or queried */ __u64 value; }; /* * Context SSEU programming * * It may be necessary for either functional or performance reason to configure * a context to run with a reduced number of SSEU (where SSEU stands for Slice/ * Sub-slice/EU). * * This is done by configuring SSEU configuration using the below * @struct drm_i915_gem_context_param_sseu for every supported engine which * userspace intends to use. * * Not all GPUs or engines support this functionality in which case an error * code -ENODEV will be returned. * * Also, flexibility of possible SSEU configuration permutations varies between * GPU generations and software imposed limitations. Requesting such a * combination will return an error code of -EINVAL. * * NOTE: When perf/OA is active the context's SSEU configuration is ignored in * favour of a single global setting. */ struct drm_i915_gem_context_param_sseu { /* * Engine class & instance to be configured or queried. */ struct i915_engine_class_instance engine; /* * Unknown flags must be cleared to zero. */ __u32 flags; #define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0) /* * Mask of slices to enable for the context. Valid values are a subset * of the bitmask value returned for I915_PARAM_SLICE_MASK. */ __u64 slice_mask; /* * Mask of subslices to enable for the context. Valid values are a * subset of the bitmask value return by I915_PARAM_SUBSLICE_MASK. */ __u64 subslice_mask; /* * Minimum/Maximum number of EUs to enable per subslice for the * context. min_eus_per_subslice must be inferior or equal to * max_eus_per_subslice. */ __u16 min_eus_per_subslice; __u16 max_eus_per_subslice; /* * Unused for now. Must be cleared to zero. */ __u32 rsvd; }; /** * DOC: Virtual Engine uAPI * * Virtual engine is a concept where userspace is able to configure a set of * physical engines, submit a batch buffer, and let the driver execute it on any * engine from the set as it sees fit. * * This is primarily useful on parts which have multiple instances of a same * class engine, like for example GT3+ Skylake parts with their two VCS engines. * * For instance userspace can enumerate all engines of a certain class using the * previously described `Engine Discovery uAPI`_. After that userspace can * create a GEM context with a placeholder slot for the virtual engine (using * `I915_ENGINE_CLASS_INVALID` and `I915_ENGINE_CLASS_INVALID_NONE` for class * and instance respectively) and finally using the * `I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE` extension place a virtual engine in * the same reserved slot. * * Example of creating a virtual engine and submitting a batch buffer to it: * * .. code-block:: C * * I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(virtual, 2) = { * .base.name = I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE, * .engine_index = 0, // Place this virtual engine into engine map slot 0 * .num_siblings = 2, * .engines = { { I915_ENGINE_CLASS_VIDEO, 0 }, * { I915_ENGINE_CLASS_VIDEO, 1 }, }, * }; * I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = { * .engines = { { I915_ENGINE_CLASS_INVALID, * I915_ENGINE_CLASS_INVALID_NONE } }, * .extensions = to_user_pointer(&virtual), // Chains after load_balance extension * }; * struct drm_i915_gem_context_create_ext_setparam p_engines = { * .base = { * .name = I915_CONTEXT_CREATE_EXT_SETPARAM, * }, * .param = { * .param = I915_CONTEXT_PARAM_ENGINES, * .value = to_user_pointer(&engines), * .size = sizeof(engines), * }, * }; * struct drm_i915_gem_context_create_ext create = { * .flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS, * .extensions = to_user_pointer(&p_engines); * }; * * ctx_id = gem_context_create_ext(drm_fd, &create); * * // Now we have created a GEM context with its engine map containing a * // single virtual engine. Submissions to this slot can go either to * // vcs0 or vcs1, depending on the load balancing algorithm used inside * // the driver. The load balancing is dynamic from one batch buffer to * // another and transparent to userspace. * * ... * execbuf.rsvd1 = ctx_id; * execbuf.flags = 0; // Submits to index 0 which is the virtual engine * gem_execbuf(drm_fd, &execbuf); */ /* * i915_context_engines_load_balance: * * Enable load balancing across this set of engines. * * Into the I915_EXEC_DEFAULT slot [0], a virtual engine is created that when * used will proxy the execbuffer request onto one of the set of engines * in such a way as to distribute the load evenly across the set. * * The set of engines must be compatible (e.g. the same HW class) as they * will share the same logical GPU context and ring. * * To intermix rendering with the virtual engine and direct rendering onto * the backing engines (bypassing the load balancing proxy), the context must * be defined to use a single timeline for all engines. */ struct i915_context_engines_load_balance { struct i915_user_extension base; __u16 engine_index; __u16 num_siblings; __u32 flags; /* all undefined flags must be zero */ __u64 mbz64; /* reserved for future use; must be zero */ struct i915_engine_class_instance engines[]; } __attribute__((packed)); #define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__, N__) struct { \ struct i915_user_extension base; \ __u16 engine_index; \ __u16 num_siblings; \ __u32 flags; \ __u64 mbz64; \ struct i915_engine_class_instance engines[N__]; \ } __attribute__((packed)) name__ /* * i915_context_engines_bond: * * Constructed bonded pairs for execution within a virtual engine. * * All engines are equal, but some are more equal than others. Given * the distribution of resources in the HW, it may be preferable to run * a request on a given subset of engines in parallel to a request on a * specific engine. We enable this selection of engines within a virtual * engine by specifying bonding pairs, for any given master engine we will * only execute on one of the corresponding siblings within the virtual engine. * * To execute a request in parallel on the master engine and a sibling requires * coordination with a I915_EXEC_FENCE_SUBMIT. */ struct i915_context_engines_bond { struct i915_user_extension base; struct i915_engine_class_instance master; __u16 virtual_index; /* index of virtual engine in ctx->engines[] */ __u16 num_bonds; __u64 flags; /* all undefined flags must be zero */ __u64 mbz64[4]; /* reserved for future use; must be zero */ struct i915_engine_class_instance engines[]; } __attribute__((packed)); #define I915_DEFINE_CONTEXT_ENGINES_BOND(name__, N__) struct { \ struct i915_user_extension base; \ struct i915_engine_class_instance master; \ __u16 virtual_index; \ __u16 num_bonds; \ __u64 flags; \ __u64 mbz64[4]; \ struct i915_engine_class_instance engines[N__]; \ } __attribute__((packed)) name__ /** * struct i915_context_engines_parallel_submit - Configure engine for * parallel submission. * * Setup a slot in the context engine map to allow multiple BBs to be submitted * in a single execbuf IOCTL. Those BBs will then be scheduled to run on the GPU * in parallel. Multiple hardware contexts are created internally in the i915 to * run these BBs. Once a slot is configured for N BBs only N BBs can be * submitted in each execbuf IOCTL and this is implicit behavior e.g. The user * doesn't tell the execbuf IOCTL there are N BBs, the execbuf IOCTL knows how * many BBs there are based on the slot's configuration. The N BBs are the last * N buffer objects or first N if I915_EXEC_BATCH_FIRST is set. * * The default placement behavior is to create implicit bonds between each * context if each context maps to more than 1 physical engine (e.g. context is * a virtual engine). Also we only allow contexts of same engine class and these * contexts must be in logically contiguous order. Examples of the placement * behavior are described below. Lastly, the default is to not allow BBs to be * preempted mid-batch. Rather insert coordinated preemption points on all * hardware contexts between each set of BBs. Flags could be added in the future * to change both of these default behaviors. * * Returns -EINVAL if hardware context placement configuration is invalid or if * the placement configuration isn't supported on the platform / submission * interface. * Returns -ENODEV if extension isn't supported on the platform / submission * interface. * * .. code-block:: none * * Examples syntax: * CS[X] = generic engine of same class, logical instance X * INVALID = I915_ENGINE_CLASS_INVALID, I915_ENGINE_CLASS_INVALID_NONE * * Example 1 pseudo code: * set_engines(INVALID) * set_parallel(engine_index=0, width=2, num_siblings=1, * engines=CS[0],CS[1]) * * Results in the following valid placement: * CS[0], CS[1] * * Example 2 pseudo code: * set_engines(INVALID) * set_parallel(engine_index=0, width=2, num_siblings=2, * engines=CS[0],CS[2],CS[1],CS[3]) * * Results in the following valid placements: * CS[0], CS[1] * CS[2], CS[3] * * This can be thought of as two virtual engines, each containing two * engines thereby making a 2D array. However, there are bonds tying the * entries together and placing restrictions on how they can be scheduled. * Specifically, the scheduler can choose only vertical columns from the 2D * array. That is, CS[0] is bonded to CS[1] and CS[2] to CS[3]. So if the * scheduler wants to submit to CS[0], it must also choose CS[1] and vice * versa. Same for CS[2] requires also using CS[3]. * VE[0] = CS[0], CS[2] * VE[1] = CS[1], CS[3] * * Example 3 pseudo code: * set_engines(INVALID) * set_parallel(engine_index=0, width=2, num_siblings=2, * engines=CS[0],CS[1],CS[1],CS[3]) * * Results in the following valid and invalid placements: * CS[0], CS[1] * CS[1], CS[3] - Not logically contiguous, return -EINVAL */ struct i915_context_engines_parallel_submit { /** * @base: base user extension. */ struct i915_user_extension base; /** * @engine_index: slot for parallel engine */ __u16 engine_index; /** * @width: number of contexts per parallel engine or in other words the * number of batches in each submission */ __u16 width; /** * @num_siblings: number of siblings per context or in other words the * number of possible placements for each submission */ __u16 num_siblings; /** * @mbz16: reserved for future use; must be zero */ __u16 mbz16; /** * @flags: all undefined flags must be zero, currently not defined flags */ __u64 flags; /** * @mbz64: reserved for future use; must be zero */ __u64 mbz64[3]; /** * @engines: 2-d array of engine instances to configure parallel engine * * length = width (i) * num_siblings (j) * index = j + i * num_siblings */ struct i915_engine_class_instance engines[]; } __attribute__((packed)); #define I915_DEFINE_CONTEXT_ENGINES_PARALLEL_SUBMIT(name__, N__) struct { \ struct i915_user_extension base; \ __u16 engine_index; \ __u16 width; \ __u16 num_siblings; \ __u16 mbz16; \ __u64 flags; \ __u64 mbz64[3]; \ struct i915_engine_class_instance engines[N__]; \ } __attribute__((packed)) name__ /** * DOC: Context Engine Map uAPI * * Context engine map is a new way of addressing engines when submitting batch- * buffers, replacing the existing way of using identifiers like `I915_EXEC_BLT` * inside the flags field of `struct drm_i915_gem_execbuffer2`. * * To use it created GEM contexts need to be configured with a list of engines * the user is intending to submit to. This is accomplished using the * `I915_CONTEXT_PARAM_ENGINES` parameter and `struct * i915_context_param_engines`. * * For such contexts the `I915_EXEC_RING_MASK` field becomes an index into the * configured map. * * Example of creating such context and submitting against it: * * .. code-block:: C * * I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 2) = { * .engines = { { I915_ENGINE_CLASS_RENDER, 0 }, * { I915_ENGINE_CLASS_COPY, 0 } } * }; * struct drm_i915_gem_context_create_ext_setparam p_engines = { * .base = { * .name = I915_CONTEXT_CREATE_EXT_SETPARAM, * }, * .param = { * .param = I915_CONTEXT_PARAM_ENGINES, * .value = to_user_pointer(&engines), * .size = sizeof(engines), * }, * }; * struct drm_i915_gem_context_create_ext create = { * .flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS, * .extensions = to_user_pointer(&p_engines); * }; * * ctx_id = gem_context_create_ext(drm_fd, &create); * * // We have now created a GEM context with two engines in the map: * // Index 0 points to rcs0 while index 1 points to bcs0. Other engines * // will not be accessible from this context. * * ... * execbuf.rsvd1 = ctx_id; * execbuf.flags = 0; // Submits to index 0, which is rcs0 for this context * gem_execbuf(drm_fd, &execbuf); * * ... * execbuf.rsvd1 = ctx_id; * execbuf.flags = 1; // Submits to index 0, which is bcs0 for this context * gem_execbuf(drm_fd, &execbuf); */ struct i915_context_param_engines { __u64 extensions; /* linked chain of extension blocks, 0 terminates */ #define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0 /* see i915_context_engines_load_balance */ #define I915_CONTEXT_ENGINES_EXT_BOND 1 /* see i915_context_engines_bond */ #define I915_CONTEXT_ENGINES_EXT_PARALLEL_SUBMIT 2 /* see i915_context_engines_parallel_submit */ struct i915_engine_class_instance engines[0]; } __attribute__((packed)); #define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__, N__) struct { \ __u64 extensions; \ struct i915_engine_class_instance engines[N__]; \ } __attribute__((packed)) name__ /** * struct drm_i915_gem_context_create_ext_setparam - Context parameter * to set or query during context creation. */ struct drm_i915_gem_context_create_ext_setparam { /** @base: Extension link. See struct i915_user_extension. */ struct i915_user_extension base; /** * @param: Context parameter to set or query. * See struct drm_i915_gem_context_param. */ struct drm_i915_gem_context_param param; }; struct drm_i915_gem_context_destroy { __u32 ctx_id; __u32 pad; }; /** * struct drm_i915_gem_vm_control - Structure to create or destroy VM. * * DRM_I915_GEM_VM_CREATE - * * Create a new virtual memory address space (ppGTT) for use within a context * on the same file. Extensions can be provided to configure exactly how the * address space is setup upon creation. * * The id of new VM (bound to the fd) for use with I915_CONTEXT_PARAM_VM is * returned in the outparam @id. * * An extension chain maybe provided, starting with @extensions, and terminated * by the @next_extension being 0. Currently, no extensions are defined. * * DRM_I915_GEM_VM_DESTROY - * * Destroys a previously created VM id, specified in @vm_id. * * No extensions or flags are allowed currently, and so must be zero. */ struct drm_i915_gem_vm_control { /** @extensions: Zero-terminated chain of extensions. */ __u64 extensions; /** @flags: reserved for future usage, currently MBZ */ __u32 flags; /** @vm_id: Id of the VM created or to be destroyed */ __u32 vm_id; }; struct drm_i915_reg_read { /* * Register offset. * For 64bit wide registers where the upper 32bits don't immediately * follow the lower 32bits, the offset of the lower 32bits must * be specified */ __u64 offset; #define I915_REG_READ_8B_WA (1ul << 0) __u64 val; /* Return value */ }; /* Known registers: * * Render engine timestamp - 0x2358 + 64bit - gen7+ * - Note this register returns an invalid value if using the default * single instruction 8byte read, in order to workaround that pass * flag I915_REG_READ_8B_WA in offset field. * */ struct drm_i915_reset_stats { __u32 ctx_id; __u32 flags; /* All resets since boot/module reload, for all contexts */ __u32 reset_count; /* Number of batches lost when active in GPU, for this context */ __u32 batch_active; /* Number of batches lost pending for execution, for this context */ __u32 batch_pending; __u32 pad; }; /** * struct drm_i915_gem_userptr - Create GEM object from user allocated memory. * * Userptr objects have several restrictions on what ioctls can be used with the * object handle. */ struct drm_i915_gem_userptr { /** * @user_ptr: The pointer to the allocated memory. * * Needs to be aligned to PAGE_SIZE. */ __u64 user_ptr; /** * @user_size: * * The size in bytes for the allocated memory. This will also become the * object size. * * Needs to be aligned to PAGE_SIZE, and should be at least PAGE_SIZE, * or larger. */ __u64 user_size; /** * @flags: * * Supported flags: * * I915_USERPTR_READ_ONLY: * * Mark the object as readonly, this also means GPU access can only be * readonly. This is only supported on HW which supports readonly access * through the GTT. If the HW can't support readonly access, an error is * returned. * * I915_USERPTR_PROBE: * * Probe the provided @user_ptr range and validate that the @user_ptr is * indeed pointing to normal memory and that the range is also valid. * For example if some garbage address is given to the kernel, then this * should complain. * * Returns -EFAULT if the probe failed. * * Note that this doesn't populate the backing pages, and also doesn't * guarantee that the object will remain valid when the object is * eventually used. * * The kernel supports this feature if I915_PARAM_HAS_USERPTR_PROBE * returns a non-zero value. * * I915_USERPTR_UNSYNCHRONIZED: * * NOT USED. Setting this flag will result in an error. */ __u32 flags; #define I915_USERPTR_READ_ONLY 0x1 #define I915_USERPTR_PROBE 0x2 #define I915_USERPTR_UNSYNCHRONIZED 0x80000000 /** * @handle: Returned handle for the object. * * Object handles are nonzero. */ __u32 handle; }; enum drm_i915_oa_format { I915_OA_FORMAT_A13 = 1, /* HSW only */ I915_OA_FORMAT_A29, /* HSW only */ I915_OA_FORMAT_A13_B8_C8, /* HSW only */ I915_OA_FORMAT_B4_C8, /* HSW only */ I915_OA_FORMAT_A45_B8_C8, /* HSW only */ I915_OA_FORMAT_B4_C8_A16, /* HSW only */ I915_OA_FORMAT_C4_B8, /* HSW+ */ /* Gen8+ */ I915_OA_FORMAT_A12, I915_OA_FORMAT_A12_B8_C8, I915_OA_FORMAT_A32u40_A4u32_B8_C8, /* DG2 */ I915_OAR_FORMAT_A32u40_A4u32_B8_C8, I915_OA_FORMAT_A24u40_A14u32_B8_C8, I915_OA_FORMAT_MAX /* non-ABI */ }; enum drm_i915_perf_property_id { /** * Open the stream for a specific context handle (as used with * execbuffer2). A stream opened for a specific context this way * won't typically require root privileges. * * This property is available in perf revision 1. */ DRM_I915_PERF_PROP_CTX_HANDLE = 1, /** * A value of 1 requests the inclusion of raw OA unit reports as * part of stream samples. * * This property is available in perf revision 1. */ DRM_I915_PERF_PROP_SAMPLE_OA, /** * The value specifies which set of OA unit metrics should be * configured, defining the contents of any OA unit reports. * * This property is available in perf revision 1. */ DRM_I915_PERF_PROP_OA_METRICS_SET, /** * The value specifies the size and layout of OA unit reports. * * This property is available in perf revision 1. */ DRM_I915_PERF_PROP_OA_FORMAT, /** * Specifying this property implicitly requests periodic OA unit * sampling and (at least on Haswell) the sampling frequency is derived * from this exponent as follows: * * 80ns * 2^(period_exponent + 1) * * This property is available in perf revision 1. */ DRM_I915_PERF_PROP_OA_EXPONENT, /** * Specifying this property is only valid when specify a context to * filter with DRM_I915_PERF_PROP_CTX_HANDLE. Specifying this property * will hold preemption of the particular context we want to gather * performance data about. The execbuf2 submissions must include a * drm_i915_gem_execbuffer_ext_perf parameter for this to apply. * * This property is available in perf revision 3. */ DRM_I915_PERF_PROP_HOLD_PREEMPTION, /** * Specifying this pins all contexts to the specified SSEU power * configuration for the duration of the recording. * * This parameter's value is a pointer to a struct * drm_i915_gem_context_param_sseu. * * This property is available in perf revision 4. */ DRM_I915_PERF_PROP_GLOBAL_SSEU, /** * This optional parameter specifies the timer interval in nanoseconds * at which the i915 driver will check the OA buffer for available data. * Minimum allowed value is 100 microseconds. A default value is used by * the driver if this parameter is not specified. Note that larger timer * values will reduce cpu consumption during OA perf captures. However, * excessively large values would potentially result in OA buffer * overwrites as captures reach end of the OA buffer. * * This property is available in perf revision 5. */ DRM_I915_PERF_PROP_POLL_OA_PERIOD, DRM_I915_PERF_PROP_MAX /* non-ABI */ }; struct drm_i915_perf_open_param { __u32 flags; #define I915_PERF_FLAG_FD_CLOEXEC (1<<0) #define I915_PERF_FLAG_FD_NONBLOCK (1<<1) #define I915_PERF_FLAG_DISABLED (1<<2) /** The number of u64 (id, value) pairs */ __u32 num_properties; /** * Pointer to array of u64 (id, value) pairs configuring the stream * to open. */ __u64 properties_ptr; }; /* * Enable data capture for a stream that was either opened in a disabled state * via I915_PERF_FLAG_DISABLED or was later disabled via * I915_PERF_IOCTL_DISABLE. * * It is intended to be cheaper to disable and enable a stream than it may be * to close and re-open a stream with the same configuration. * * It's undefined whether any pending data for the stream will be lost. * * This ioctl is available in perf revision 1. */ #define I915_PERF_IOCTL_ENABLE _IO('i', 0x0) /* * Disable data capture for a stream. * * It is an error to try and read a stream that is disabled. * * This ioctl is available in perf revision 1. */ #define I915_PERF_IOCTL_DISABLE _IO('i', 0x1) /* * Change metrics_set captured by a stream. * * If the stream is bound to a specific context, the configuration change * will performed __inline__ with that context such that it takes effect before * the next execbuf submission. * * Returns the previously bound metrics set id, or a negative error code. * * This ioctl is available in perf revision 2. */ #define I915_PERF_IOCTL_CONFIG _IO('i', 0x2) /* * Common to all i915 perf records */ struct drm_i915_perf_record_header { __u32 type; __u16 pad; __u16 size; }; enum drm_i915_perf_record_type { /** * Samples are the work horse record type whose contents are extensible * and defined when opening an i915 perf stream based on the given * properties. * * Boolean properties following the naming convention * DRM_I915_PERF_SAMPLE_xyz_PROP request the inclusion of 'xyz' data in * every sample. * * The order of these sample properties given by userspace has no * affect on the ordering of data within a sample. The order is * documented here. * * struct { * struct drm_i915_perf_record_header header; * * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */ DRM_I915_PERF_RECORD_SAMPLE = 1, /* * Indicates that one or more OA reports were not written by the * hardware. This can happen for example if an MI_REPORT_PERF_COUNT * command collides with periodic sampling - which would be more likely * at higher sampling frequencies. */ DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2, /** * An error occurred that resulted in all pending OA reports being lost. */ DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3, DRM_I915_PERF_RECORD_MAX /* non-ABI */ }; /** * struct drm_i915_perf_oa_config * * Structure to upload perf dynamic configuration into the kernel. */ struct drm_i915_perf_oa_config { /** * @uuid: * * String formatted like "%\08x-%\04x-%\04x-%\04x-%\012x" */ char uuid[36]; /** * @n_mux_regs: * * Number of mux regs in &mux_regs_ptr. */ __u32 n_mux_regs; /** * @n_boolean_regs: * * Number of boolean regs in &boolean_regs_ptr. */ __u32 n_boolean_regs; /** * @n_flex_regs: * * Number of flex regs in &flex_regs_ptr. */ __u32 n_flex_regs; /** * @mux_regs_ptr: * * Pointer to tuples of u32 values (register address, value) for mux * registers. Expected length of buffer is (2 * sizeof(u32) * * &n_mux_regs). */ __u64 mux_regs_ptr; /** * @boolean_regs_ptr: * * Pointer to tuples of u32 values (register address, value) for mux * registers. Expected length of buffer is (2 * sizeof(u32) * * &n_boolean_regs). */ __u64 boolean_regs_ptr; /** * @flex_regs_ptr: * * Pointer to tuples of u32 values (register address, value) for mux * registers. Expected length of buffer is (2 * sizeof(u32) * * &n_flex_regs). */ __u64 flex_regs_ptr; }; /** * struct drm_i915_query_item - An individual query for the kernel to process. * * The behaviour is determined by the @query_id. Note that exactly what * @data_ptr is also depends on the specific @query_id. */ struct drm_i915_query_item { /** * @query_id: * * The id for this query. Currently accepted query IDs are: * - %DRM_I915_QUERY_TOPOLOGY_INFO (see struct drm_i915_query_topology_info) * - %DRM_I915_QUERY_ENGINE_INFO (see struct drm_i915_engine_info) * - %DRM_I915_QUERY_PERF_CONFIG (see struct drm_i915_query_perf_config) * - %DRM_I915_QUERY_MEMORY_REGIONS (see struct drm_i915_query_memory_regions) * - %DRM_I915_QUERY_HWCONFIG_BLOB (see `GuC HWCONFIG blob uAPI`) * - %DRM_I915_QUERY_GEOMETRY_SUBSLICES (see struct drm_i915_query_topology_info) */ __u64 query_id; #define DRM_I915_QUERY_TOPOLOGY_INFO 1 #define DRM_I915_QUERY_ENGINE_INFO 2 #define DRM_I915_QUERY_PERF_CONFIG 3 #define DRM_I915_QUERY_MEMORY_REGIONS 4 #define DRM_I915_QUERY_HWCONFIG_BLOB 5 #define DRM_I915_QUERY_GEOMETRY_SUBSLICES 6 /* Must be kept compact -- no holes and well documented */ /** * @length: * * When set to zero by userspace, this is filled with the size of the * data to be written at the @data_ptr pointer. The kernel sets this * value to a negative value to signal an error on a particular query * item. */ __s32 length; /** * @flags: * * When &query_id == %DRM_I915_QUERY_TOPOLOGY_INFO, must be 0. * * When &query_id == %DRM_I915_QUERY_PERF_CONFIG, must be one of the * following: * * - %DRM_I915_QUERY_PERF_CONFIG_LIST * - %DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID * - %DRM_I915_QUERY_PERF_CONFIG_FOR_UUID * * When &query_id == %DRM_I915_QUERY_GEOMETRY_SUBSLICES must contain * a struct i915_engine_class_instance that references a render engine. */ __u32 flags; #define DRM_I915_QUERY_PERF_CONFIG_LIST 1 #define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID 2 #define DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_ID 3 /** * @data_ptr: * * Data will be written at the location pointed by @data_ptr when the * value of @length matches the length of the data to be written by the * kernel. */ __u64 data_ptr; }; /** * struct drm_i915_query - Supply an array of struct drm_i915_query_item for the * kernel to fill out. * * Note that this is generally a two step process for each struct * drm_i915_query_item in the array: * * 1. Call the DRM_IOCTL_I915_QUERY, giving it our array of struct * drm_i915_query_item, with &drm_i915_query_item.length set to zero. The * kernel will then fill in the size, in bytes, which tells userspace how * memory it needs to allocate for the blob(say for an array of properties). * * 2. Next we call DRM_IOCTL_I915_QUERY again, this time with the * &drm_i915_query_item.data_ptr equal to our newly allocated blob. Note that * the &drm_i915_query_item.length should still be the same as what the * kernel previously set. At this point the kernel can fill in the blob. * * Note that for some query items it can make sense for userspace to just pass * in a buffer/blob equal to or larger than the required size. In this case only * a single ioctl call is needed. For some smaller query items this can work * quite well. * */ struct drm_i915_query { /** @num_items: The number of elements in the @items_ptr array */ __u32 num_items; /** * @flags: Unused for now. Must be cleared to zero. */ __u32 flags; /** * @items_ptr: * * Pointer to an array of struct drm_i915_query_item. The number of * array elements is @num_items. */ __u64 items_ptr; }; /** * struct drm_i915_query_topology_info * * Describes slice/subslice/EU information queried by * %DRM_I915_QUERY_TOPOLOGY_INFO */ struct drm_i915_query_topology_info { /** * @flags: * * Unused for now. Must be cleared to zero. */ __u16 flags; /** * @max_slices: * * The number of bits used to express the slice mask. */ __u16 max_slices; /** * @max_subslices: * * The number of bits used to express the subslice mask. */ __u16 max_subslices; /** * @max_eus_per_subslice: * * The number of bits in the EU mask that correspond to a single * subslice's EUs. */ __u16 max_eus_per_subslice; /** * @subslice_offset: * * Offset in data[] at which the subslice masks are stored. */ __u16 subslice_offset; /** * @subslice_stride: * * Stride at which each of the subslice masks for each slice are * stored. */ __u16 subslice_stride; /** * @eu_offset: * * Offset in data[] at which the EU masks are stored. */ __u16 eu_offset; /** * @eu_stride: * * Stride at which each of the EU masks for each subslice are stored. */ __u16 eu_stride; /** * @data: * * Contains 3 pieces of information : * * - The slice mask with one bit per slice telling whether a slice is * available. The availability of slice X can be queried with the * following formula : * * .. code:: c * * (data[X / 8] >> (X % 8)) & 1 * * Starting with Xe_HP platforms, Intel hardware no longer has * traditional slices so i915 will always report a single slice * (hardcoded slicemask = 0x1) which contains all of the platform's * subslices. I.e., the mask here does not reflect any of the newer * hardware concepts such as "gslices" or "cslices" since userspace * is capable of inferring those from the subslice mask. * * - The subslice mask for each slice with one bit per subslice telling * whether a subslice is available. Starting with Gen12 we use the * term "subslice" to refer to what the hardware documentation * describes as a "dual-subslices." The availability of subslice Y * in slice X can be queried with the following formula : * * .. code:: c * * (data[subslice_offset + X * subslice_stride + Y / 8] >> (Y % 8)) & 1 * * - The EU mask for each subslice in each slice, with one bit per EU * telling whether an EU is available. The availability of EU Z in * subslice Y in slice X can be queried with the following formula : * * .. code:: c * * (data[eu_offset + * (X * max_subslices + Y) * eu_stride + * Z / 8 * ] >> (Z % 8)) & 1 */ __u8 data[]; }; /** * DOC: Engine Discovery uAPI * * Engine discovery uAPI is a way of enumerating physical engines present in a * GPU associated with an open i915 DRM file descriptor. This supersedes the old * way of using `DRM_IOCTL_I915_GETPARAM` and engine identifiers like * `I915_PARAM_HAS_BLT`. * * The need for this interface came starting with Icelake and newer GPUs, which * started to establish a pattern of having multiple engines of a same class, * where not all instances were always completely functionally equivalent. * * Entry point for this uapi is `DRM_IOCTL_I915_QUERY` with the * `DRM_I915_QUERY_ENGINE_INFO` as the queried item id. * * Example for getting the list of engines: * * .. code-block:: C * * struct drm_i915_query_engine_info *info; * struct drm_i915_query_item item = { * .query_id = DRM_I915_QUERY_ENGINE_INFO; * }; * struct drm_i915_query query = { * .num_items = 1, * .items_ptr = (uintptr_t)&item, * }; * int err, i; * * // First query the size of the blob we need, this needs to be large * // enough to hold our array of engines. The kernel will fill out the * // item.length for us, which is the number of bytes we need. * // * // Alternatively a large buffer can be allocated straight away enabling * // querying in one pass, in which case item.length should contain the * // length of the provided buffer. * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query); * if (err) ... * * info = calloc(1, item.length); * // Now that we allocated the required number of bytes, we call the ioctl * // again, this time with the data_ptr pointing to our newly allocated * // blob, which the kernel can then populate with info on all engines. * item.data_ptr = (uintptr_t)&info, * * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query); * if (err) ... * * // We can now access each engine in the array * for (i = 0; i < info->num_engines; i++) { * struct drm_i915_engine_info einfo = info->engines[i]; * u16 class = einfo.engine.class; * u16 instance = einfo.engine.instance; * .... * } * * free(info); * * Each of the enumerated engines, apart from being defined by its class and * instance (see `struct i915_engine_class_instance`), also can have flags and * capabilities defined as documented in i915_drm.h. * * For instance video engines which support HEVC encoding will have the * `I915_VIDEO_CLASS_CAPABILITY_HEVC` capability bit set. * * Engine discovery only fully comes to its own when combined with the new way * of addressing engines when submitting batch buffers using contexts with * engine maps configured. */ /** * struct drm_i915_engine_info * * Describes one engine and it's capabilities as known to the driver. */ struct drm_i915_engine_info { /** @engine: Engine class and instance. */ struct i915_engine_class_instance engine; /** @rsvd0: Reserved field. */ __u32 rsvd0; /** @flags: Engine flags. */ __u64 flags; #define I915_ENGINE_INFO_HAS_LOGICAL_INSTANCE (1 << 0) /** @capabilities: Capabilities of this engine. */ __u64 capabilities; #define I915_VIDEO_CLASS_CAPABILITY_HEVC (1 << 0) #define I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC (1 << 1) /** @logical_instance: Logical instance of engine */ __u16 logical_instance; /** @rsvd1: Reserved fields. */ __u16 rsvd1[3]; /** @rsvd2: Reserved fields. */ __u64 rsvd2[3]; }; /** * struct drm_i915_query_engine_info * * Engine info query enumerates all engines known to the driver by filling in * an array of struct drm_i915_engine_info structures. */ struct drm_i915_query_engine_info { /** @num_engines: Number of struct drm_i915_engine_info structs following. */ __u32 num_engines; /** @rsvd: MBZ */ __u32 rsvd[3]; /** @engines: Marker for drm_i915_engine_info structures. */ struct drm_i915_engine_info engines[]; }; /** * struct drm_i915_query_perf_config * * Data written by the kernel with query %DRM_I915_QUERY_PERF_CONFIG and * %DRM_I915_QUERY_GEOMETRY_SUBSLICES. */ struct drm_i915_query_perf_config { union { /** * @n_configs: * * When &drm_i915_query_item.flags == * %DRM_I915_QUERY_PERF_CONFIG_LIST, i915 sets this fields to * the number of configurations available. */ __u64 n_configs; /** * @config: * * When &drm_i915_query_item.flags == * %DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_ID, i915 will use the * value in this field as configuration identifier to decide * what data to write into config_ptr. */ __u64 config; /** * @uuid: * * When &drm_i915_query_item.flags == * %DRM_I915_QUERY_PERF_CONFIG_DATA_FOR_UUID, i915 will use the * value in this field as configuration identifier to decide * what data to write into config_ptr. * * String formatted like "%08x-%04x-%04x-%04x-%012x" */ char uuid[36]; }; /** * @flags: * * Unused for now. Must be cleared to zero. */ __u32 flags; /** * @data: * * When &drm_i915_query_item.flags == %DRM_I915_QUERY_PERF_CONFIG_LIST, * i915 will write an array of __u64 of configuration identifiers. * * When &drm_i915_query_item.flags == %DRM_I915_QUERY_PERF_CONFIG_DATA, * i915 will write a struct drm_i915_perf_oa_config. If the following * fields of struct drm_i915_perf_oa_config are not set to 0, i915 will * write into the associated pointers the values of submitted when the * configuration was created : * * - &drm_i915_perf_oa_config.n_mux_regs * - &drm_i915_perf_oa_config.n_boolean_regs * - &drm_i915_perf_oa_config.n_flex_regs */ __u8 data[]; }; /** * enum drm_i915_gem_memory_class - Supported memory classes */ enum drm_i915_gem_memory_class { /** @I915_MEMORY_CLASS_SYSTEM: System memory */ I915_MEMORY_CLASS_SYSTEM = 0, /** @I915_MEMORY_CLASS_DEVICE: Device local-memory */ I915_MEMORY_CLASS_DEVICE, }; /** * struct drm_i915_gem_memory_class_instance - Identify particular memory region */ struct drm_i915_gem_memory_class_instance { /** @memory_class: See enum drm_i915_gem_memory_class */ __u16 memory_class; /** @memory_instance: Which instance */ __u16 memory_instance; }; /** * struct drm_i915_memory_region_info - Describes one region as known to the * driver. * * Note this is using both struct drm_i915_query_item and struct drm_i915_query. * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS * at &drm_i915_query_item.query_id. */ struct drm_i915_memory_region_info { /** @region: The class:instance pair encoding */ struct drm_i915_gem_memory_class_instance region; /** @rsvd0: MBZ */ __u32 rsvd0; /** * @probed_size: Memory probed by the driver * * Note that it should not be possible to ever encounter a zero value * here, also note that no current region type will ever return -1 here. * Although for future region types, this might be a possibility. The * same applies to the other size fields. */ __u64 probed_size; /** * @unallocated_size: Estimate of memory remaining * * Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable accounting. * Without this (or if this is an older kernel) the value here will * always equal the @probed_size. Note this is only currently tracked * for I915_MEMORY_CLASS_DEVICE regions (for other types the value here * will always equal the @probed_size). */ __u64 unallocated_size; union { /** @rsvd1: MBZ */ __u64 rsvd1[8]; struct { /** * @probed_cpu_visible_size: Memory probed by the driver * that is CPU accessible. * * This will be always be <= @probed_size, and the * remainder (if there is any) will not be CPU * accessible. * * On systems without small BAR, the @probed_size will * always equal the @probed_cpu_visible_size, since all * of it will be CPU accessible. * * Note this is only tracked for * I915_MEMORY_CLASS_DEVICE regions (for other types the * value here will always equal the @probed_size). * * Note that if the value returned here is zero, then * this must be an old kernel which lacks the relevant * small-bar uAPI support (including * I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS), but on * such systems we should never actually end up with a * small BAR configuration, assuming we are able to load * the kernel module. Hence it should be safe to treat * this the same as when @probed_cpu_visible_size == * @probed_size. */ __u64 probed_cpu_visible_size; /** * @unallocated_cpu_visible_size: Estimate of CPU * visible memory remaining. * * Note this is only tracked for * I915_MEMORY_CLASS_DEVICE regions (for other types the * value here will always equal the * @probed_cpu_visible_size). * * Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable * accounting. Without this the value here will always * equal the @probed_cpu_visible_size. Note this is only * currently tracked for I915_MEMORY_CLASS_DEVICE * regions (for other types the value here will also * always equal the @probed_cpu_visible_size). * * If this is an older kernel the value here will be * zero, see also @probed_cpu_visible_size. */ __u64 unallocated_cpu_visible_size; }; }; }; /** * struct drm_i915_query_memory_regions * * The region info query enumerates all regions known to the driver by filling * in an array of struct drm_i915_memory_region_info structures. * * Example for getting the list of supported regions: * * .. code-block:: C * * struct drm_i915_query_memory_regions *info; * struct drm_i915_query_item item = { * .query_id = DRM_I915_QUERY_MEMORY_REGIONS; * }; * struct drm_i915_query query = { * .num_items = 1, * .items_ptr = (uintptr_t)&item, * }; * int err, i; * * // First query the size of the blob we need, this needs to be large * // enough to hold our array of regions. The kernel will fill out the * // item.length for us, which is the number of bytes we need. * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query); * if (err) ... * * info = calloc(1, item.length); * // Now that we allocated the required number of bytes, we call the ioctl * // again, this time with the data_ptr pointing to our newly allocated * // blob, which the kernel can then populate with the all the region info. * item.data_ptr = (uintptr_t)&info, * * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query); * if (err) ... * * // We can now access each region in the array * for (i = 0; i < info->num_regions; i++) { * struct drm_i915_memory_region_info mr = info->regions[i]; * u16 class = mr.region.class; * u16 instance = mr.region.instance; * * .... * } * * free(info); */ struct drm_i915_query_memory_regions { /** @num_regions: Number of supported regions */ __u32 num_regions; /** @rsvd: MBZ */ __u32 rsvd[3]; /** @regions: Info about each supported region */ struct drm_i915_memory_region_info regions[]; }; /** * DOC: GuC HWCONFIG blob uAPI * * The GuC produces a blob with information about the current device. * i915 reads this blob from GuC and makes it available via this uAPI. * * The format and meaning of the blob content are documented in the * Programmer's Reference Manual. */ /** * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added * extension support using struct i915_user_extension. * * Note that new buffer flags should be added here, at least for the stuff that * is immutable. Previously we would have two ioctls, one to create the object * with gem_create, and another to apply various parameters, however this * creates some ambiguity for the params which are considered immutable. Also in * general we're phasing out the various SET/GET ioctls. */ struct drm_i915_gem_create_ext { /** * @size: Requested size for the object. * * The (page-aligned) allocated size for the object will be returned. * * On platforms like DG2/ATS the kernel will always use 64K or larger * pages for I915_MEMORY_CLASS_DEVICE. The kernel also requires a * minimum of 64K GTT alignment for such objects. * * NOTE: Previously the ABI here required a minimum GTT alignment of 2M * on DG2/ATS, due to how the hardware implemented 64K GTT page support, * where we had the following complications: * * 1) The entire PDE (which covers a 2MB virtual address range), must * contain only 64K PTEs, i.e mixing 4K and 64K PTEs in the same * PDE is forbidden by the hardware. * * 2) We still need to support 4K PTEs for I915_MEMORY_CLASS_SYSTEM * objects. * * However on actual production HW this was completely changed to now * allow setting a TLB hint at the PTE level (see PS64), which is a lot * more flexible than the above. With this the 2M restriction was * dropped where we now only require 64K. */ __u64 size; /** * @handle: Returned handle for the object. * * Object handles are nonzero. */ __u32 handle; /** * @flags: Optional flags. * * Supported values: * * I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS - Signal to the kernel that * the object will need to be accessed via the CPU. * * Only valid when placing objects in I915_MEMORY_CLASS_DEVICE, and only * strictly required on configurations where some subset of the device * memory is directly visible/mappable through the CPU (which we also * call small BAR), like on some DG2+ systems. Note that this is quite * undesirable, but due to various factors like the client CPU, BIOS etc * it's something we can expect to see in the wild. See * &drm_i915_memory_region_info.probed_cpu_visible_size for how to * determine if this system applies. * * Note that one of the placements MUST be I915_MEMORY_CLASS_SYSTEM, to * ensure the kernel can always spill the allocation to system memory, * if the object can't be allocated in the mappable part of * I915_MEMORY_CLASS_DEVICE. * * Also note that since the kernel only supports flat-CCS on objects * that can *only* be placed in I915_MEMORY_CLASS_DEVICE, we therefore * don't support I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS together with * flat-CCS. * * Without this hint, the kernel will assume that non-mappable * I915_MEMORY_CLASS_DEVICE is preferred for this object. Note that the * kernel can still migrate the object to the mappable part, as a last * resort, if userspace ever CPU faults this object, but this might be * expensive, and so ideally should be avoided. * * On older kernels which lack the relevant small-bar uAPI support (see * also &drm_i915_memory_region_info.probed_cpu_visible_size), * usage of the flag will result in an error, but it should NEVER be * possible to end up with a small BAR configuration, assuming we can * also successfully load the i915 kernel module. In such cases the * entire I915_MEMORY_CLASS_DEVICE region will be CPU accessible, and as * such there are zero restrictions on where the object can be placed. */ #define I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS (1 << 0) __u32 flags; /** * @extensions: The chain of extensions to apply to this object. * * This will be useful in the future when we need to support several * different extensions, and we need to apply more than one when * creating the object. See struct i915_user_extension. * * If we don't supply any extensions then we get the same old gem_create * behaviour. * * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see * struct drm_i915_gem_create_ext_memory_regions. * * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see * struct drm_i915_gem_create_ext_protected_content. */ #define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0 #define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1 __u64 extensions; }; /** * struct drm_i915_gem_create_ext_memory_regions - The * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension. * * Set the object with the desired set of placements/regions in priority * order. Each entry must be unique and supported by the device. * * This is provided as an array of struct drm_i915_gem_memory_class_instance, or * an equivalent layout of class:instance pair encodings. See struct * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to * query the supported regions for a device. * * As an example, on discrete devices, if we wish to set the placement as * device local-memory we can do something like: * * .. code-block:: C * * struct drm_i915_gem_memory_class_instance region_lmem = { * .memory_class = I915_MEMORY_CLASS_DEVICE, * .memory_instance = 0, * }; * struct drm_i915_gem_create_ext_memory_regions regions = { * .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS }, * .regions = (uintptr_t)®ion_lmem, * .num_regions = 1, * }; * struct drm_i915_gem_create_ext create_ext = { * .size = 16 * PAGE_SIZE, * .extensions = (uintptr_t)®ions, * }; * * int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext); * if (err) ... * * At which point we get the object handle in &drm_i915_gem_create_ext.handle, * along with the final object size in &drm_i915_gem_create_ext.size, which * should account for any rounding up, if required. * * Note that userspace has no means of knowing the current backing region * for objects where @num_regions is larger than one. The kernel will only * ensure that the priority order of the @regions array is honoured, either * when initially placing the object, or when moving memory around due to * memory pressure * * On Flat-CCS capable HW, compression is supported for the objects residing * in I915_MEMORY_CLASS_DEVICE. When such objects (compressed) have other * memory class in @regions and migrated (by i915, due to memory * constraints) to the non I915_MEMORY_CLASS_DEVICE region, then i915 needs to * decompress the content. But i915 doesn't have the required information to * decompress the userspace compressed objects. * * So i915 supports Flat-CCS, on the objects which can reside only on * I915_MEMORY_CLASS_DEVICE regions. */ struct drm_i915_gem_create_ext_memory_regions { /** @base: Extension link. See struct i915_user_extension. */ struct i915_user_extension base; /** @pad: MBZ */ __u32 pad; /** @num_regions: Number of elements in the @regions array. */ __u32 num_regions; /** * @regions: The regions/placements array. * * An array of struct drm_i915_gem_memory_class_instance. */ __u64 regions; }; /** * struct drm_i915_gem_create_ext_protected_content - The * I915_OBJECT_PARAM_PROTECTED_CONTENT extension. * * If this extension is provided, buffer contents are expected to be protected * by PXP encryption and require decryption for scan out and processing. This * is only possible on platforms that have PXP enabled, on all other scenarios * using this extension will cause the ioctl to fail and return -ENODEV. The * flags parameter is reserved for future expansion and must currently be set * to zero. * * The buffer contents are considered invalid after a PXP session teardown. * * The encryption is guaranteed to be processed correctly only if the object * is submitted with a context created using the * I915_CONTEXT_PARAM_PROTECTED_CONTENT flag. This will also enable extra checks * at submission time on the validity of the objects involved. * * Below is an example on how to create a protected object: * * .. code-block:: C * * struct drm_i915_gem_create_ext_protected_content protected_ext = { * .base = { .name = I915_GEM_CREATE_EXT_PROTECTED_CONTENT }, * .flags = 0, * }; * struct drm_i915_gem_create_ext create_ext = { * .size = PAGE_SIZE, * .extensions = (uintptr_t)&protected_ext, * }; * * int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext); * if (err) ... */ struct drm_i915_gem_create_ext_protected_content { /** @base: Extension link. See struct i915_user_extension. */ struct i915_user_extension base; /** @flags: reserved for future usage, currently MBZ */ __u32 flags; }; /* ID of the protected content session managed by i915 when PXP is active */ #define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf #if defined(__cplusplus) } #endif #endif /* _I915_DRM_H_ */ drm/ivpu_accel.h 0000644 00000020325 15063602046 0007615 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* * Copyright (C) 2020-2023 Intel Corporation */ #ifndef __UAPI_IVPU_DRM_H__ #define __UAPI_IVPU_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_IVPU_DRIVER_MAJOR 1 #define DRM_IVPU_DRIVER_MINOR 0 #define DRM_IVPU_GET_PARAM 0x00 #define DRM_IVPU_SET_PARAM 0x01 #define DRM_IVPU_BO_CREATE 0x02 #define DRM_IVPU_BO_INFO 0x03 #define DRM_IVPU_SUBMIT 0x05 #define DRM_IVPU_BO_WAIT 0x06 #define DRM_IOCTL_IVPU_GET_PARAM \ DRM_IOWR(DRM_COMMAND_BASE + DRM_IVPU_GET_PARAM, struct drm_ivpu_param) #define DRM_IOCTL_IVPU_SET_PARAM \ DRM_IOW(DRM_COMMAND_BASE + DRM_IVPU_SET_PARAM, struct drm_ivpu_param) #define DRM_IOCTL_IVPU_BO_CREATE \ DRM_IOWR(DRM_COMMAND_BASE + DRM_IVPU_BO_CREATE, struct drm_ivpu_bo_create) #define DRM_IOCTL_IVPU_BO_INFO \ DRM_IOWR(DRM_COMMAND_BASE + DRM_IVPU_BO_INFO, struct drm_ivpu_bo_info) #define DRM_IOCTL_IVPU_SUBMIT \ DRM_IOW(DRM_COMMAND_BASE + DRM_IVPU_SUBMIT, struct drm_ivpu_submit) #define DRM_IOCTL_IVPU_BO_WAIT \ DRM_IOWR(DRM_COMMAND_BASE + DRM_IVPU_BO_WAIT, struct drm_ivpu_bo_wait) /** * DOC: contexts * * VPU contexts have private virtual address space, job queues and priority. * Each context is identified by an unique ID. Context is created on open(). */ #define DRM_IVPU_PARAM_DEVICE_ID 0 #define DRM_IVPU_PARAM_DEVICE_REVISION 1 #define DRM_IVPU_PARAM_PLATFORM_TYPE 2 #define DRM_IVPU_PARAM_CORE_CLOCK_RATE 3 #define DRM_IVPU_PARAM_NUM_CONTEXTS 4 #define DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS 5 #define DRM_IVPU_PARAM_CONTEXT_PRIORITY 6 #define DRM_IVPU_PARAM_CONTEXT_ID 7 #define DRM_IVPU_PARAM_FW_API_VERSION 8 #define DRM_IVPU_PARAM_ENGINE_HEARTBEAT 9 #define DRM_IVPU_PARAM_UNIQUE_INFERENCE_ID 10 #define DRM_IVPU_PARAM_TILE_CONFIG 11 #define DRM_IVPU_PARAM_SKU 12 #define DRM_IVPU_PLATFORM_TYPE_SILICON 0 #define DRM_IVPU_CONTEXT_PRIORITY_IDLE 0 #define DRM_IVPU_CONTEXT_PRIORITY_NORMAL 1 #define DRM_IVPU_CONTEXT_PRIORITY_FOCUS 2 #define DRM_IVPU_CONTEXT_PRIORITY_REALTIME 3 /** * struct drm_ivpu_param - Get/Set VPU parameters */ struct drm_ivpu_param { /** * @param: * * Supported params: * * %DRM_IVPU_PARAM_DEVICE_ID: * PCI Device ID of the VPU device (read-only) * * %DRM_IVPU_PARAM_DEVICE_REVISION: * VPU device revision (read-only) * * %DRM_IVPU_PARAM_PLATFORM_TYPE: * Returns %DRM_IVPU_PLATFORM_TYPE_SILICON on real hardware or device specific * platform type when executing on a simulator or emulator (read-only) * * %DRM_IVPU_PARAM_CORE_CLOCK_RATE: * Current PLL frequency (read-only) * * %DRM_IVPU_PARAM_NUM_CONTEXTS: * Maximum number of simultaneously existing contexts (read-only) * * %DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS: * Lowest VPU virtual address available in the current context (read-only) * * %DRM_IVPU_PARAM_CONTEXT_PRIORITY: * Value of current context scheduling priority (read-write). * See DRM_IVPU_CONTEXT_PRIORITY_* for possible values. * * %DRM_IVPU_PARAM_CONTEXT_ID: * Current context ID, always greater than 0 (read-only) * * %DRM_IVPU_PARAM_FW_API_VERSION: * Firmware API version array (read-only) * * %DRM_IVPU_PARAM_ENGINE_HEARTBEAT: * Heartbeat value from an engine (read-only). * Engine ID (i.e. DRM_IVPU_ENGINE_COMPUTE) is given via index. * * %DRM_IVPU_PARAM_UNIQUE_INFERENCE_ID: * Device-unique inference ID (read-only) * * %DRM_IVPU_PARAM_TILE_CONFIG: * VPU tile configuration (read-only) * * %DRM_IVPU_PARAM_SKU: * VPU SKU ID (read-only) * */ __u32 param; /** @index: Index for params that have multiple instances */ __u32 index; /** @value: Param value */ __u64 value; }; #define DRM_IVPU_BO_HIGH_MEM 0x00000001 #define DRM_IVPU_BO_MAPPABLE 0x00000002 #define DRM_IVPU_BO_CACHED 0x00000000 #define DRM_IVPU_BO_UNCACHED 0x00010000 #define DRM_IVPU_BO_WC 0x00020000 #define DRM_IVPU_BO_CACHE_MASK 0x00030000 #define DRM_IVPU_BO_FLAGS \ (DRM_IVPU_BO_HIGH_MEM | \ DRM_IVPU_BO_MAPPABLE | \ DRM_IVPU_BO_CACHE_MASK) /** * struct drm_ivpu_bo_create - Create BO backed by SHMEM * * Create GEM buffer object allocated in SHMEM memory. */ struct drm_ivpu_bo_create { /** @size: The size in bytes of the allocated memory */ __u64 size; /** * @flags: * * Supported flags: * * %DRM_IVPU_BO_HIGH_MEM: * * Allocate VPU address from >4GB range. * Buffer object with vpu address >4GB can be always accessed by the * VPU DMA engine, but some HW generation may not be able to access * this memory from then firmware running on the VPU management processor. * Suitable for input, output and some scratch buffers. * * %DRM_IVPU_BO_MAPPABLE: * * Buffer object can be mapped using mmap(). * * %DRM_IVPU_BO_CACHED: * * Allocated BO will be cached on host side (WB) and snooped on the VPU side. * This is the default caching mode. * * %DRM_IVPU_BO_UNCACHED: * * Allocated BO will not be cached on host side nor snooped on the VPU side. * * %DRM_IVPU_BO_WC: * * Allocated BO will use write combining buffer for writes but reads will be * uncached. */ __u32 flags; /** @handle: Returned GEM object handle */ __u32 handle; /** @vpu_addr: Returned VPU virtual address */ __u64 vpu_addr; }; /** * struct drm_ivpu_bo_info - Query buffer object info */ struct drm_ivpu_bo_info { /** @handle: Handle of the queried BO */ __u32 handle; /** @flags: Returned flags used to create the BO */ __u32 flags; /** @vpu_addr: Returned VPU virtual address */ __u64 vpu_addr; /** * @mmap_offset: * * Returned offset to be used in mmap(). 0 in case the BO is not mappable. */ __u64 mmap_offset; /** @size: Returned GEM object size, aligned to PAGE_SIZE */ __u64 size; }; /* drm_ivpu_submit engines */ #define DRM_IVPU_ENGINE_COMPUTE 0 #define DRM_IVPU_ENGINE_COPY 1 /** * struct drm_ivpu_submit - Submit commands to the VPU * * Execute a single command buffer on a given VPU engine. * Handles to all referenced buffer objects have to be provided in @buffers_ptr. * * User space may wait on job completion using %DRM_IVPU_BO_WAIT ioctl. */ struct drm_ivpu_submit { /** * @buffers_ptr: * * A pointer to an u32 array of GEM handles of the BOs required for this job. * The number of elements in the array must be equal to the value given by @buffer_count. * * The first BO is the command buffer. The rest of array has to contain all * BOs referenced from the command buffer. */ __u64 buffers_ptr; /** @buffer_count: Number of elements in the @buffers_ptr */ __u32 buffer_count; /** * @engine: Select the engine this job should be executed on * * %DRM_IVPU_ENGINE_COMPUTE: * * Performs Deep Learning Neural Compute Inference Operations * * %DRM_IVPU_ENGINE_COPY: * * Performs memory copy operations to/from system memory allocated for VPU */ __u32 engine; /** @flags: Reserved for future use - must be zero */ __u32 flags; /** * @commands_offset: * * Offset inside the first buffer in @buffers_ptr containing commands * to be executed. The offset has to be 8-byte aligned. */ __u32 commands_offset; }; /* drm_ivpu_bo_wait job status codes */ #define DRM_IVPU_JOB_STATUS_SUCCESS 0 /** * struct drm_ivpu_bo_wait - Wait for BO to become inactive * * Blocks until a given buffer object becomes inactive. * With @timeout_ms set to 0 returns immediately. */ struct drm_ivpu_bo_wait { /** @handle: Handle to the buffer object to be waited on */ __u32 handle; /** @flags: Reserved for future use - must be zero */ __u32 flags; /** @timeout_ns: Absolute timeout in nanoseconds (may be zero) */ __s64 timeout_ns; /** * @job_status: * * Job status code which is updated after the job is completed. * &DRM_IVPU_JOB_STATUS_SUCCESS or device specific error otherwise. * Valid only if @handle points to a command buffer. */ __u32 job_status; /** @pad: Padding - must be zero */ __u32 pad; }; #if defined(__cplusplus) } #endif #endif /* __UAPI_IVPU_DRM_H__ */ drm/lima_drm.h 0000644 00000011674 15063602046 0007276 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */ /* Copyright 2017-2018 Qiang Yu <yuq825@gmail.com> */ #ifndef __LIMA_DRM_H__ #define __LIMA_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif enum drm_lima_param_gpu_id { DRM_LIMA_PARAM_GPU_ID_UNKNOWN, DRM_LIMA_PARAM_GPU_ID_MALI400, DRM_LIMA_PARAM_GPU_ID_MALI450, }; enum drm_lima_param { DRM_LIMA_PARAM_GPU_ID, DRM_LIMA_PARAM_NUM_PP, DRM_LIMA_PARAM_GP_VERSION, DRM_LIMA_PARAM_PP_VERSION, }; /** * get various information of the GPU */ struct drm_lima_get_param { __u32 param; /* in, value in enum drm_lima_param */ __u32 pad; /* pad, must be zero */ __u64 value; /* out, parameter value */ }; /* * heap buffer dynamically increase backup memory size when GP task fail * due to lack of heap memory. size field of heap buffer is an up bound of * the backup memory which can be set to a fairly large value. */ #define LIMA_BO_FLAG_HEAP (1 << 0) /** * create a buffer for used by GPU */ struct drm_lima_gem_create { __u32 size; /* in, buffer size */ __u32 flags; /* in, buffer flags */ __u32 handle; /* out, GEM buffer handle */ __u32 pad; /* pad, must be zero */ }; /** * get information of a buffer */ struct drm_lima_gem_info { __u32 handle; /* in, GEM buffer handle */ __u32 va; /* out, virtual address mapped into GPU MMU */ __u64 offset; /* out, used to mmap this buffer to CPU */ }; #define LIMA_SUBMIT_BO_READ 0x01 #define LIMA_SUBMIT_BO_WRITE 0x02 /* buffer information used by one task */ struct drm_lima_gem_submit_bo { __u32 handle; /* in, GEM buffer handle */ __u32 flags; /* in, buffer read/write by GPU */ }; #define LIMA_GP_FRAME_REG_NUM 6 /* frame used to setup GP for each task */ struct drm_lima_gp_frame { __u32 frame[LIMA_GP_FRAME_REG_NUM]; }; #define LIMA_PP_FRAME_REG_NUM 23 #define LIMA_PP_WB_REG_NUM 12 /* frame used to setup mali400 GPU PP for each task */ struct drm_lima_m400_pp_frame { __u32 frame[LIMA_PP_FRAME_REG_NUM]; __u32 num_pp; __u32 wb[3 * LIMA_PP_WB_REG_NUM]; __u32 plbu_array_address[4]; __u32 fragment_stack_address[4]; }; /* frame used to setup mali450 GPU PP for each task */ struct drm_lima_m450_pp_frame { __u32 frame[LIMA_PP_FRAME_REG_NUM]; __u32 num_pp; __u32 wb[3 * LIMA_PP_WB_REG_NUM]; __u32 use_dlbu; __u32 _pad; union { __u32 plbu_array_address[8]; __u32 dlbu_regs[4]; }; __u32 fragment_stack_address[8]; }; #define LIMA_PIPE_GP 0x00 #define LIMA_PIPE_PP 0x01 #define LIMA_SUBMIT_FLAG_EXPLICIT_FENCE (1 << 0) /** * submit a task to GPU * * User can always merge multi sync_file and drm_syncobj * into one drm_syncobj as in_sync[0], but we reserve * in_sync[1] for another task's out_sync to avoid the * export/import/merge pass when explicit sync. */ struct drm_lima_gem_submit { __u32 ctx; /* in, context handle task is submitted to */ __u32 pipe; /* in, which pipe to use, GP/PP */ __u32 nr_bos; /* in, array length of bos field */ __u32 frame_size; /* in, size of frame field */ __u64 bos; /* in, array of drm_lima_gem_submit_bo */ __u64 frame; /* in, GP/PP frame */ __u32 flags; /* in, submit flags */ __u32 out_sync; /* in, drm_syncobj handle used to wait task finish after submission */ __u32 in_sync[2]; /* in, drm_syncobj handle used to wait before start this task */ }; #define LIMA_GEM_WAIT_READ 0x01 #define LIMA_GEM_WAIT_WRITE 0x02 /** * wait pending GPU task finish of a buffer */ struct drm_lima_gem_wait { __u32 handle; /* in, GEM buffer handle */ __u32 op; /* in, CPU want to read/write this buffer */ __s64 timeout_ns; /* in, wait timeout in absulute time */ }; /** * create a context */ struct drm_lima_ctx_create { __u32 id; /* out, context handle */ __u32 _pad; /* pad, must be zero */ }; /** * free a context */ struct drm_lima_ctx_free { __u32 id; /* in, context handle */ __u32 _pad; /* pad, must be zero */ }; #define DRM_LIMA_GET_PARAM 0x00 #define DRM_LIMA_GEM_CREATE 0x01 #define DRM_LIMA_GEM_INFO 0x02 #define DRM_LIMA_GEM_SUBMIT 0x03 #define DRM_LIMA_GEM_WAIT 0x04 #define DRM_LIMA_CTX_CREATE 0x05 #define DRM_LIMA_CTX_FREE 0x06 #define DRM_IOCTL_LIMA_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_LIMA_GET_PARAM, struct drm_lima_get_param) #define DRM_IOCTL_LIMA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_LIMA_GEM_CREATE, struct drm_lima_gem_create) #define DRM_IOCTL_LIMA_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_LIMA_GEM_INFO, struct drm_lima_gem_info) #define DRM_IOCTL_LIMA_GEM_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_LIMA_GEM_SUBMIT, struct drm_lima_gem_submit) #define DRM_IOCTL_LIMA_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + DRM_LIMA_GEM_WAIT, struct drm_lima_gem_wait) #define DRM_IOCTL_LIMA_CTX_CREATE DRM_IOR(DRM_COMMAND_BASE + DRM_LIMA_CTX_CREATE, struct drm_lima_ctx_create) #define DRM_IOCTL_LIMA_CTX_FREE DRM_IOW(DRM_COMMAND_BASE + DRM_LIMA_CTX_FREE, struct drm_lima_ctx_free) #if defined(__cplusplus) } #endif #endif /* __LIMA_DRM_H__ */ drm/msm_drm.h 0000644 00000037127 15063602046 0007151 0 ustar 00 /* * Copyright (C) 2013 Red Hat * Author: Rob Clark <robdclark@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef __MSM_DRM_H__ #define __MSM_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints: * 1) Do not use pointers, use __u64 instead for 32 bit / 64 bit * user/kernel compatibility * 2) Keep fields aligned to their size * 3) Because of how drm_ioctl() works, we can add new fields at * the end of an ioctl if some care is taken: drm_ioctl() will * zero out the new fields at the tail of the ioctl, so a zero * value should have a backwards compatible meaning. And for * output params, userspace won't see the newly added output * fields.. so that has to be somehow ok. */ #define MSM_PIPE_NONE 0x00 #define MSM_PIPE_2D0 0x01 #define MSM_PIPE_2D1 0x02 #define MSM_PIPE_3D0 0x10 /* The pipe-id just uses the lower bits, so can be OR'd with flags in * the upper 16 bits (which could be extended further, if needed, maybe * we extend/overload the pipe-id some day to deal with multiple rings, * but even then I don't think we need the full lower 16 bits). */ #define MSM_PIPE_ID_MASK 0xffff #define MSM_PIPE_ID(x) ((x) & MSM_PIPE_ID_MASK) #define MSM_PIPE_FLAGS(x) ((x) & ~MSM_PIPE_ID_MASK) /* timeouts are specified in clock-monotonic absolute times (to simplify * restarting interrupted ioctls). The following struct is logically the * same as 'struct timespec' but 32/64b ABI safe. */ struct drm_msm_timespec { __s64 tv_sec; /* seconds */ __s64 tv_nsec; /* nanoseconds */ }; /* Below "RO" indicates a read-only param, "WO" indicates write-only, and * "RW" indicates a param that can be both read (GET_PARAM) and written * (SET_PARAM) */ #define MSM_PARAM_GPU_ID 0x01 /* RO */ #define MSM_PARAM_GMEM_SIZE 0x02 /* RO */ #define MSM_PARAM_CHIP_ID 0x03 /* RO */ #define MSM_PARAM_MAX_FREQ 0x04 /* RO */ #define MSM_PARAM_TIMESTAMP 0x05 /* RO */ #define MSM_PARAM_GMEM_BASE 0x06 /* RO */ #define MSM_PARAM_PRIORITIES 0x07 /* RO: The # of priority levels */ #define MSM_PARAM_PP_PGTABLE 0x08 /* RO: Deprecated, always returns zero */ #define MSM_PARAM_FAULTS 0x09 /* RO */ #define MSM_PARAM_SUSPENDS 0x0a /* RO */ #define MSM_PARAM_SYSPROF 0x0b /* WO: 1 preserves perfcntrs, 2 also disables suspend */ #define MSM_PARAM_COMM 0x0c /* WO: override for task->comm */ #define MSM_PARAM_CMDLINE 0x0d /* WO: override for task cmdline */ #define MSM_PARAM_VA_START 0x0e /* RO: start of valid GPU iova range */ #define MSM_PARAM_VA_SIZE 0x0f /* RO: size of valid GPU iova range (bytes) */ /* For backwards compat. The original support for preemption was based on * a single ring per priority level so # of priority levels equals the # * of rings. With drm/scheduler providing additional levels of priority, * the number of priorities is greater than the # of rings. The param is * renamed to better reflect this. */ #define MSM_PARAM_NR_RINGS MSM_PARAM_PRIORITIES struct drm_msm_param { __u32 pipe; /* in, MSM_PIPE_x */ __u32 param; /* in, MSM_PARAM_x */ __u64 value; /* out (get_param) or in (set_param) */ __u32 len; /* zero for non-pointer params */ __u32 pad; /* must be zero */ }; /* * GEM buffers: */ #define MSM_BO_SCANOUT 0x00000001 /* scanout capable */ #define MSM_BO_GPU_READONLY 0x00000002 #define MSM_BO_CACHE_MASK 0x000f0000 /* cache modes */ #define MSM_BO_CACHED 0x00010000 #define MSM_BO_WC 0x00020000 #define MSM_BO_UNCACHED 0x00040000 /* deprecated, use MSM_BO_WC */ #define MSM_BO_CACHED_COHERENT 0x080000 #define MSM_BO_FLAGS (MSM_BO_SCANOUT | \ MSM_BO_GPU_READONLY | \ MSM_BO_CACHE_MASK) struct drm_msm_gem_new { __u64 size; /* in */ __u32 flags; /* in, mask of MSM_BO_x */ __u32 handle; /* out */ }; /* Get or set GEM buffer info. The requested value can be passed * directly in 'value', or for data larger than 64b 'value' is a * pointer to userspace buffer, with 'len' specifying the number of * bytes copied into that buffer. For info returned by pointer, * calling the GEM_INFO ioctl with null 'value' will return the * required buffer size in 'len' */ #define MSM_INFO_GET_OFFSET 0x00 /* get mmap() offset, returned by value */ #define MSM_INFO_GET_IOVA 0x01 /* get iova, returned by value */ #define MSM_INFO_SET_NAME 0x02 /* set the debug name (by pointer) */ #define MSM_INFO_GET_NAME 0x03 /* get debug name, returned by pointer */ #define MSM_INFO_SET_IOVA 0x04 /* set the iova, passed by value */ #define MSM_INFO_GET_FLAGS 0x05 /* get the MSM_BO_x flags */ struct drm_msm_gem_info { __u32 handle; /* in */ __u32 info; /* in - one of MSM_INFO_* */ __u64 value; /* in or out */ __u32 len; /* in or out */ __u32 pad; }; #define MSM_PREP_READ 0x01 #define MSM_PREP_WRITE 0x02 #define MSM_PREP_NOSYNC 0x04 #define MSM_PREP_FLAGS (MSM_PREP_READ | MSM_PREP_WRITE | MSM_PREP_NOSYNC) struct drm_msm_gem_cpu_prep { __u32 handle; /* in */ __u32 op; /* in, mask of MSM_PREP_x */ struct drm_msm_timespec timeout; /* in */ }; struct drm_msm_gem_cpu_fini { __u32 handle; /* in */ }; /* * Cmdstream Submission: */ /* The value written into the cmdstream is logically: * * ((relocbuf->gpuaddr + reloc_offset) << shift) | or * * When we have GPU's w/ >32bit ptrs, it should be possible to deal * with this by emit'ing two reloc entries with appropriate shift * values. Or a new MSM_SUBMIT_CMD_x type would also be an option. * * NOTE that reloc's must be sorted by order of increasing submit_offset, * otherwise EINVAL. */ struct drm_msm_gem_submit_reloc { __u32 submit_offset; /* in, offset from submit_bo */ __u32 or; /* in, value OR'd with result */ __s32 shift; /* in, amount of left shift (can be negative) */ __u32 reloc_idx; /* in, index of reloc_bo buffer */ __u64 reloc_offset; /* in, offset from start of reloc_bo */ }; /* submit-types: * BUF - this cmd buffer is executed normally. * IB_TARGET_BUF - this cmd buffer is an IB target. Reloc's are * processed normally, but the kernel does not setup an IB to * this buffer in the first-level ringbuffer * CTX_RESTORE_BUF - only executed if there has been a GPU context * switch since the last SUBMIT ioctl */ #define MSM_SUBMIT_CMD_BUF 0x0001 #define MSM_SUBMIT_CMD_IB_TARGET_BUF 0x0002 #define MSM_SUBMIT_CMD_CTX_RESTORE_BUF 0x0003 struct drm_msm_gem_submit_cmd { __u32 type; /* in, one of MSM_SUBMIT_CMD_x */ __u32 submit_idx; /* in, index of submit_bo cmdstream buffer */ __u32 submit_offset; /* in, offset into submit_bo */ __u32 size; /* in, cmdstream size */ __u32 pad; __u32 nr_relocs; /* in, number of submit_reloc's */ __u64 relocs; /* in, ptr to array of submit_reloc's */ }; /* Each buffer referenced elsewhere in the cmdstream submit (ie. the * cmdstream buffer(s) themselves or reloc entries) has one (and only * one) entry in the submit->bos[] table. * * As a optimization, the current buffer (gpu virtual address) can be * passed back through the 'presumed' field. If on a subsequent reloc, * userspace passes back a 'presumed' address that is still valid, * then patching the cmdstream for this entry is skipped. This can * avoid kernel needing to map/access the cmdstream bo in the common * case. */ #define MSM_SUBMIT_BO_READ 0x0001 #define MSM_SUBMIT_BO_WRITE 0x0002 #define MSM_SUBMIT_BO_DUMP 0x0004 #define MSM_SUBMIT_BO_NO_IMPLICIT 0x0008 #define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | \ MSM_SUBMIT_BO_WRITE | \ MSM_SUBMIT_BO_DUMP | \ MSM_SUBMIT_BO_NO_IMPLICIT) struct drm_msm_gem_submit_bo { __u32 flags; /* in, mask of MSM_SUBMIT_BO_x */ __u32 handle; /* in, GEM handle */ __u64 presumed; /* in/out, presumed buffer address */ }; /* Valid submit ioctl flags: */ #define MSM_SUBMIT_NO_IMPLICIT 0x80000000 /* disable implicit sync */ #define MSM_SUBMIT_FENCE_FD_IN 0x40000000 /* enable input fence_fd */ #define MSM_SUBMIT_FENCE_FD_OUT 0x20000000 /* enable output fence_fd */ #define MSM_SUBMIT_SUDO 0x10000000 /* run submitted cmds from RB */ #define MSM_SUBMIT_SYNCOBJ_IN 0x08000000 /* enable input syncobj */ #define MSM_SUBMIT_SYNCOBJ_OUT 0x04000000 /* enable output syncobj */ #define MSM_SUBMIT_FENCE_SN_IN 0x02000000 /* userspace passes in seqno fence */ #define MSM_SUBMIT_FLAGS ( \ MSM_SUBMIT_NO_IMPLICIT | \ MSM_SUBMIT_FENCE_FD_IN | \ MSM_SUBMIT_FENCE_FD_OUT | \ MSM_SUBMIT_SUDO | \ MSM_SUBMIT_SYNCOBJ_IN | \ MSM_SUBMIT_SYNCOBJ_OUT | \ MSM_SUBMIT_FENCE_SN_IN | \ 0) #define MSM_SUBMIT_SYNCOBJ_RESET 0x00000001 /* Reset syncobj after wait. */ #define MSM_SUBMIT_SYNCOBJ_FLAGS ( \ MSM_SUBMIT_SYNCOBJ_RESET | \ 0) struct drm_msm_gem_submit_syncobj { __u32 handle; /* in, syncobj handle. */ __u32 flags; /* in, from MSM_SUBMIT_SYNCOBJ_FLAGS */ __u64 point; /* in, timepoint for timeline syncobjs. */ }; /* Each cmdstream submit consists of a table of buffers involved, and * one or more cmdstream buffers. This allows for conditional execution * (context-restore), and IB buffers needed for per tile/bin draw cmds. */ struct drm_msm_gem_submit { __u32 flags; /* MSM_PIPE_x | MSM_SUBMIT_x */ __u32 fence; /* out (or in with MSM_SUBMIT_FENCE_SN_IN flag) */ __u32 nr_bos; /* in, number of submit_bo's */ __u32 nr_cmds; /* in, number of submit_cmd's */ __u64 bos; /* in, ptr to array of submit_bo's */ __u64 cmds; /* in, ptr to array of submit_cmd's */ __s32 fence_fd; /* in/out fence fd (see MSM_SUBMIT_FENCE_FD_IN/OUT) */ __u32 queueid; /* in, submitqueue id */ __u64 in_syncobjs; /* in, ptr to array of drm_msm_gem_submit_syncobj */ __u64 out_syncobjs; /* in, ptr to array of drm_msm_gem_submit_syncobj */ __u32 nr_in_syncobjs; /* in, number of entries in in_syncobj */ __u32 nr_out_syncobjs; /* in, number of entries in out_syncobj. */ __u32 syncobj_stride; /* in, stride of syncobj arrays. */ __u32 pad; /*in, reserved for future use, always 0. */ }; /* The normal way to synchronize with the GPU is just to CPU_PREP on * a buffer if you need to access it from the CPU (other cmdstream * submission from same or other contexts, PAGE_FLIP ioctl, etc, all * handle the required synchronization under the hood). This ioctl * mainly just exists as a way to implement the gallium pipe_fence * APIs without requiring a dummy bo to synchronize on. */ struct drm_msm_wait_fence { __u32 fence; /* in */ __u32 pad; struct drm_msm_timespec timeout; /* in */ __u32 queueid; /* in, submitqueue id */ }; /* madvise provides a way to tell the kernel in case a buffers contents * can be discarded under memory pressure, which is useful for userspace * bo cache where we want to optimistically hold on to buffer allocate * and potential mmap, but allow the pages to be discarded under memory * pressure. * * Typical usage would involve madvise(DONTNEED) when buffer enters BO * cache, and madvise(WILLNEED) if trying to recycle buffer from BO cache. * In the WILLNEED case, 'retained' indicates to userspace whether the * backing pages still exist. */ #define MSM_MADV_WILLNEED 0 /* backing pages are needed, status returned in 'retained' */ #define MSM_MADV_DONTNEED 1 /* backing pages not needed */ #define __MSM_MADV_PURGED 2 /* internal state */ struct drm_msm_gem_madvise { __u32 handle; /* in, GEM handle */ __u32 madv; /* in, MSM_MADV_x */ __u32 retained; /* out, whether backing store still exists */ }; /* * Draw queues allow the user to set specific submission parameter. Command * submissions specify a specific submitqueue to use. ID 0 is reserved for * backwards compatibility as a "default" submitqueue */ #define MSM_SUBMITQUEUE_FLAGS (0) /* * The submitqueue priority should be between 0 and MSM_PARAM_PRIORITIES-1, * a lower numeric value is higher priority. */ struct drm_msm_submitqueue { __u32 flags; /* in, MSM_SUBMITQUEUE_x */ __u32 prio; /* in, Priority level */ __u32 id; /* out, identifier */ }; #define MSM_SUBMITQUEUE_PARAM_FAULTS 0 struct drm_msm_submitqueue_query { __u64 data; __u32 id; __u32 param; __u32 len; __u32 pad; }; #define DRM_MSM_GET_PARAM 0x00 #define DRM_MSM_SET_PARAM 0x01 #define DRM_MSM_GEM_NEW 0x02 #define DRM_MSM_GEM_INFO 0x03 #define DRM_MSM_GEM_CPU_PREP 0x04 #define DRM_MSM_GEM_CPU_FINI 0x05 #define DRM_MSM_GEM_SUBMIT 0x06 #define DRM_MSM_WAIT_FENCE 0x07 #define DRM_MSM_GEM_MADVISE 0x08 /* placeholder: #define DRM_MSM_GEM_SVM_NEW 0x09 */ #define DRM_MSM_SUBMITQUEUE_NEW 0x0A #define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B #define DRM_MSM_SUBMITQUEUE_QUERY 0x0C #define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param) #define DRM_IOCTL_MSM_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SET_PARAM, struct drm_msm_param) #define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) #define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info) #define DRM_IOCTL_MSM_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_PREP, struct drm_msm_gem_cpu_prep) #define DRM_IOCTL_MSM_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_FINI, struct drm_msm_gem_cpu_fini) #define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit) #define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence) #define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise) #define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue) #define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32) #define DRM_IOCTL_MSM_SUBMITQUEUE_QUERY DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_QUERY, struct drm_msm_submitqueue_query) #if defined(__cplusplus) } #endif #endif /* __MSM_DRM_H__ */ drm/nouveau_drm.h 0000644 00000014760 15063602046 0010035 0 ustar 00 /* * Copyright 2005 Stephane Marchesin. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __NOUVEAU_DRM_H__ #define __NOUVEAU_DRM_H__ #define DRM_NOUVEAU_EVENT_NVIF 0x80000000 #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) #define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) #define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4) #define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */ #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 #define NOUVEAU_GEM_TILE_16BPP 0x00000001 #define NOUVEAU_GEM_TILE_32BPP 0x00000002 #define NOUVEAU_GEM_TILE_ZETA 0x00000004 #define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008 struct drm_nouveau_gem_info { __u32 handle; __u32 domain; __u64 size; __u64 offset; __u64 map_handle; __u32 tile_mode; __u32 tile_flags; }; struct drm_nouveau_gem_new { struct drm_nouveau_gem_info info; __u32 channel_hint; __u32 align; }; #define NOUVEAU_GEM_MAX_BUFFERS 1024 struct drm_nouveau_gem_pushbuf_bo_presumed { __u32 valid; __u32 domain; __u64 offset; }; struct drm_nouveau_gem_pushbuf_bo { __u64 user_priv; __u32 handle; __u32 read_domains; __u32 write_domains; __u32 valid_domains; struct drm_nouveau_gem_pushbuf_bo_presumed presumed; }; #define NOUVEAU_GEM_RELOC_LOW (1 << 0) #define NOUVEAU_GEM_RELOC_HIGH (1 << 1) #define NOUVEAU_GEM_RELOC_OR (1 << 2) #define NOUVEAU_GEM_MAX_RELOCS 1024 struct drm_nouveau_gem_pushbuf_reloc { __u32 reloc_bo_index; __u32 reloc_bo_offset; __u32 bo_index; __u32 flags; __u32 data; __u32 vor; __u32 tor; }; #define NOUVEAU_GEM_MAX_PUSH 512 struct drm_nouveau_gem_pushbuf_push { __u32 bo_index; __u32 pad; __u64 offset; __u64 length; }; struct drm_nouveau_gem_pushbuf { __u32 channel; __u32 nr_buffers; __u64 buffers; __u32 nr_relocs; __u32 nr_push; __u64 relocs; __u64 push; __u32 suffix0; __u32 suffix1; #define NOUVEAU_GEM_PUSHBUF_SYNC (1ULL << 0) __u64 vram_available; __u64 gart_available; }; #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 struct drm_nouveau_gem_cpu_prep { __u32 handle; __u32 flags; }; struct drm_nouveau_gem_cpu_fini { __u32 handle; }; #define DRM_NOUVEAU_GETPARAM 0x00 /* deprecated */ #define DRM_NOUVEAU_SETPARAM 0x01 /* deprecated */ #define DRM_NOUVEAU_CHANNEL_ALLOC 0x02 /* deprecated */ #define DRM_NOUVEAU_CHANNEL_FREE 0x03 /* deprecated */ #define DRM_NOUVEAU_GROBJ_ALLOC 0x04 /* deprecated */ #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 /* deprecated */ #define DRM_NOUVEAU_GPUOBJ_FREE 0x06 /* deprecated */ #define DRM_NOUVEAU_NVIF 0x07 #define DRM_NOUVEAU_SVM_INIT 0x08 #define DRM_NOUVEAU_SVM_BIND 0x09 #define DRM_NOUVEAU_GEM_NEW 0x40 #define DRM_NOUVEAU_GEM_PUSHBUF 0x41 #define DRM_NOUVEAU_GEM_CPU_PREP 0x42 #define DRM_NOUVEAU_GEM_CPU_FINI 0x43 #define DRM_NOUVEAU_GEM_INFO 0x44 struct drm_nouveau_svm_init { __u64 unmanaged_addr; __u64 unmanaged_size; }; struct drm_nouveau_svm_bind { __u64 header; __u64 va_start; __u64 va_end; __u64 npages; __u64 stride; __u64 result; __u64 reserved0; __u64 reserved1; }; #define NOUVEAU_SVM_BIND_COMMAND_SHIFT 0 #define NOUVEAU_SVM_BIND_COMMAND_BITS 8 #define NOUVEAU_SVM_BIND_COMMAND_MASK ((1 << 8) - 1) #define NOUVEAU_SVM_BIND_PRIORITY_SHIFT 8 #define NOUVEAU_SVM_BIND_PRIORITY_BITS 8 #define NOUVEAU_SVM_BIND_PRIORITY_MASK ((1 << 8) - 1) #define NOUVEAU_SVM_BIND_TARGET_SHIFT 16 #define NOUVEAU_SVM_BIND_TARGET_BITS 32 #define NOUVEAU_SVM_BIND_TARGET_MASK 0xffffffff /* * Below is use to validate ioctl argument, userspace can also use it to make * sure that no bit are set beyond known fields for a given kernel version. */ #define NOUVEAU_SVM_BIND_VALID_BITS 48 #define NOUVEAU_SVM_BIND_VALID_MASK ((1ULL << NOUVEAU_SVM_BIND_VALID_BITS) - 1) /* * NOUVEAU_BIND_COMMAND__MIGRATE: synchronous migrate to target memory. * result: number of page successfuly migrate to the target memory. */ #define NOUVEAU_SVM_BIND_COMMAND__MIGRATE 0 /* * NOUVEAU_SVM_BIND_HEADER_TARGET__GPU_VRAM: target the GPU VRAM memory. */ #define NOUVEAU_SVM_BIND_TARGET__GPU_VRAM (1UL << 31) #define DRM_IOCTL_NOUVEAU_SVM_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_INIT, struct drm_nouveau_svm_init) #define DRM_IOCTL_NOUVEAU_SVM_BIND DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_BIND, struct drm_nouveau_svm_bind) #define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new) #define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf) #define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep) #define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini) #define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info) #if defined(__cplusplus) } #endif #endif /* __NOUVEAU_DRM_H__ */ drm/omap_drm.h 0000644 00000007673 15063602046 0007314 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/uapi/drm/omap_drm.h * * Copyright (C) 2011 Texas Instruments * Author: Rob Clark <rob@ti.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __OMAP_DRM_H__ #define __OMAP_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. */ #define OMAP_PARAM_CHIPSET_ID 1 /* ie. 0x3430, 0x4430, etc */ struct drm_omap_param { __u64 param; /* in */ __u64 value; /* in (set_param), out (get_param) */ }; /* Scanout buffer, consumable by DSS */ #define OMAP_BO_SCANOUT 0x00000001 /* Buffer CPU caching mode: cached, write-combining or uncached. */ #define OMAP_BO_CACHED 0x00000000 #define OMAP_BO_WC 0x00000002 #define OMAP_BO_UNCACHED 0x00000004 #define OMAP_BO_CACHE_MASK 0x00000006 /* Use TILER for the buffer. The TILER container unit can be 8, 16 or 32 bits. */ #define OMAP_BO_TILED_8 0x00000100 #define OMAP_BO_TILED_16 0x00000200 #define OMAP_BO_TILED_32 0x00000300 #define OMAP_BO_TILED_MASK 0x00000f00 union omap_gem_size { __u32 bytes; /* (for non-tiled formats) */ struct { __u16 width; __u16 height; } tiled; /* (for tiled formats) */ }; struct drm_omap_gem_new { union omap_gem_size size; /* in */ __u32 flags; /* in */ __u32 handle; /* out */ __u32 __pad; }; /* mask of operations: */ enum omap_gem_op { OMAP_GEM_READ = 0x01, OMAP_GEM_WRITE = 0x02, }; struct drm_omap_gem_cpu_prep { __u32 handle; /* buffer handle (in) */ __u32 op; /* mask of omap_gem_op (in) */ }; struct drm_omap_gem_cpu_fini { __u32 handle; /* buffer handle (in) */ __u32 op; /* mask of omap_gem_op (in) */ /* TODO maybe here we pass down info about what regions are touched * by sw so we can be clever about cache ops? For now a placeholder, * set to zero and we just do full buffer flush.. */ __u32 nregions; __u32 __pad; }; struct drm_omap_gem_info { __u32 handle; /* buffer handle (in) */ __u32 pad; __u64 offset; /* mmap offset (out) */ /* note: in case of tiled buffers, the user virtual size can be * different from the physical size (ie. how many pages are needed * to back the object) which is returned in DRM_IOCTL_GEM_OPEN.. * This size here is the one that should be used if you want to * mmap() the buffer: */ __u32 size; /* virtual size for mmap'ing (out) */ __u32 __pad; }; #define DRM_OMAP_GET_PARAM 0x00 #define DRM_OMAP_SET_PARAM 0x01 #define DRM_OMAP_GEM_NEW 0x03 #define DRM_OMAP_GEM_CPU_PREP 0x04 /* Deprecated, to be removed */ #define DRM_OMAP_GEM_CPU_FINI 0x05 /* Deprecated, to be removed */ #define DRM_OMAP_GEM_INFO 0x06 #define DRM_OMAP_NUM_IOCTLS 0x07 #define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param) #define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param) #define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new) #define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep) #define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini) #define DRM_IOCTL_OMAP_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_INFO, struct drm_omap_gem_info) #if defined(__cplusplus) } #endif #endif /* __OMAP_DRM_H__ */ drm/panfrost_drm.h 0000644 00000020400 15063602046 0010173 0 ustar 00 /* SPDX-License-Identifier: MIT */ /* * Copyright © 2014-2018 Broadcom * Copyright © 2019 Collabora ltd. */ #ifndef _PANFROST_DRM_H_ #define _PANFROST_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_PANFROST_SUBMIT 0x00 #define DRM_PANFROST_WAIT_BO 0x01 #define DRM_PANFROST_CREATE_BO 0x02 #define DRM_PANFROST_MMAP_BO 0x03 #define DRM_PANFROST_GET_PARAM 0x04 #define DRM_PANFROST_GET_BO_OFFSET 0x05 #define DRM_PANFROST_PERFCNT_ENABLE 0x06 #define DRM_PANFROST_PERFCNT_DUMP 0x07 #define DRM_PANFROST_MADVISE 0x08 #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) #define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo) #define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo) #define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) #define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset) #define DRM_IOCTL_PANFROST_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MADVISE, struct drm_panfrost_madvise) /* * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module * param is set to true. * All these ioctl(s) are subject to deprecation, so please don't rely on * them for anything but debugging purpose. */ #define DRM_IOCTL_PANFROST_PERFCNT_ENABLE DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_ENABLE, struct drm_panfrost_perfcnt_enable) #define DRM_IOCTL_PANFROST_PERFCNT_DUMP DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct drm_panfrost_perfcnt_dump) #define PANFROST_JD_REQ_FS (1 << 0) /** * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D * engine. * * This asks the kernel to have the GPU execute a render command list. */ struct drm_panfrost_submit { /** Address to GPU mapping of job descriptor */ __u64 jc; /** An optional array of sync objects to wait on before starting this job. */ __u64 in_syncs; /** Number of sync objects to wait on before starting this job. */ __u32 in_sync_count; /** An optional sync object to place the completion fence in. */ __u32 out_sync; /** Pointer to a u32 array of the BOs that are referenced by the job. */ __u64 bo_handles; /** Number of BO handles passed in (size is that times 4). */ __u32 bo_handle_count; /** A combination of PANFROST_JD_REQ_* */ __u32 requirements; }; /** * struct drm_panfrost_wait_bo - ioctl argument for waiting for * completion of the last DRM_PANFROST_SUBMIT on a BO. * * This is useful for cases where multiple processes might be * rendering to a BO and you want to wait for all rendering to be * completed. */ struct drm_panfrost_wait_bo { __u32 handle; __u32 pad; __s64 timeout_ns; /* absolute */ }; /* Valid flags to pass to drm_panfrost_create_bo */ #define PANFROST_BO_NOEXEC 1 #define PANFROST_BO_HEAP 2 /** * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs. * * The flags argument is a bit mask of PANFROST_BO_* flags. */ struct drm_panfrost_create_bo { __u32 size; __u32 flags; /** Returned GEM handle for the BO. */ __u32 handle; /* Pad, must be zero-filled. */ __u32 pad; /** * Returned offset for the BO in the GPU address space. This offset * is private to the DRM fd and is valid for the lifetime of the GEM * handle. * * This offset value will always be nonzero, since various HW * units treat 0 specially. */ __u64 offset; }; /** * struct drm_panfrost_mmap_bo - ioctl argument for mapping Panfrost BOs. * * This doesn't actually perform an mmap. Instead, it returns the * offset you need to use in an mmap on the DRM device node. This * means that tools like valgrind end up knowing about the mapped * memory. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_panfrost_mmap_bo { /** Handle for the object being mapped. */ __u32 handle; __u32 flags; /** offset into the drm node to use for subsequent mmap call. */ __u64 offset; }; enum drm_panfrost_param { DRM_PANFROST_PARAM_GPU_PROD_ID, DRM_PANFROST_PARAM_GPU_REVISION, DRM_PANFROST_PARAM_SHADER_PRESENT, DRM_PANFROST_PARAM_TILER_PRESENT, DRM_PANFROST_PARAM_L2_PRESENT, DRM_PANFROST_PARAM_STACK_PRESENT, DRM_PANFROST_PARAM_AS_PRESENT, DRM_PANFROST_PARAM_JS_PRESENT, DRM_PANFROST_PARAM_L2_FEATURES, DRM_PANFROST_PARAM_CORE_FEATURES, DRM_PANFROST_PARAM_TILER_FEATURES, DRM_PANFROST_PARAM_MEM_FEATURES, DRM_PANFROST_PARAM_MMU_FEATURES, DRM_PANFROST_PARAM_THREAD_FEATURES, DRM_PANFROST_PARAM_MAX_THREADS, DRM_PANFROST_PARAM_THREAD_MAX_WORKGROUP_SZ, DRM_PANFROST_PARAM_THREAD_MAX_BARRIER_SZ, DRM_PANFROST_PARAM_COHERENCY_FEATURES, DRM_PANFROST_PARAM_TEXTURE_FEATURES0, DRM_PANFROST_PARAM_TEXTURE_FEATURES1, DRM_PANFROST_PARAM_TEXTURE_FEATURES2, DRM_PANFROST_PARAM_TEXTURE_FEATURES3, DRM_PANFROST_PARAM_JS_FEATURES0, DRM_PANFROST_PARAM_JS_FEATURES1, DRM_PANFROST_PARAM_JS_FEATURES2, DRM_PANFROST_PARAM_JS_FEATURES3, DRM_PANFROST_PARAM_JS_FEATURES4, DRM_PANFROST_PARAM_JS_FEATURES5, DRM_PANFROST_PARAM_JS_FEATURES6, DRM_PANFROST_PARAM_JS_FEATURES7, DRM_PANFROST_PARAM_JS_FEATURES8, DRM_PANFROST_PARAM_JS_FEATURES9, DRM_PANFROST_PARAM_JS_FEATURES10, DRM_PANFROST_PARAM_JS_FEATURES11, DRM_PANFROST_PARAM_JS_FEATURES12, DRM_PANFROST_PARAM_JS_FEATURES13, DRM_PANFROST_PARAM_JS_FEATURES14, DRM_PANFROST_PARAM_JS_FEATURES15, DRM_PANFROST_PARAM_NR_CORE_GROUPS, DRM_PANFROST_PARAM_THREAD_TLS_ALLOC, DRM_PANFROST_PARAM_AFBC_FEATURES, }; struct drm_panfrost_get_param { __u32 param; __u32 pad; __u64 value; }; /** * Returns the offset for the BO in the GPU address space for this DRM fd. * This is the same value returned by drm_panfrost_create_bo, if that was called * from this DRM fd. */ struct drm_panfrost_get_bo_offset { __u32 handle; __u32 pad; __u64 offset; }; struct drm_panfrost_perfcnt_enable { __u32 enable; /* * On bifrost we have 2 sets of counters, this parameter defines the * one to track. */ __u32 counterset; }; struct drm_panfrost_perfcnt_dump { __u64 buf_ptr; }; /* madvise provides a way to tell the kernel in case a buffers contents * can be discarded under memory pressure, which is useful for userspace * bo cache where we want to optimistically hold on to buffer allocate * and potential mmap, but allow the pages to be discarded under memory * pressure. * * Typical usage would involve madvise(DONTNEED) when buffer enters BO * cache, and madvise(WILLNEED) if trying to recycle buffer from BO cache. * In the WILLNEED case, 'retained' indicates to userspace whether the * backing pages still exist. */ #define PANFROST_MADV_WILLNEED 0 /* backing pages are needed, status returned in 'retained' */ #define PANFROST_MADV_DONTNEED 1 /* backing pages not needed */ struct drm_panfrost_madvise { __u32 handle; /* in, GEM handle */ __u32 madv; /* in, PANFROST_MADV_x */ __u32 retained; /* out, whether backing store still exists */ }; /* Definitions for coredump decoding in user space */ #define PANFROSTDUMP_MAJOR 1 #define PANFROSTDUMP_MINOR 0 #define PANFROSTDUMP_MAGIC 0x464E4150 /* PANF */ #define PANFROSTDUMP_BUF_REG 0 #define PANFROSTDUMP_BUF_BOMAP (PANFROSTDUMP_BUF_REG + 1) #define PANFROSTDUMP_BUF_BO (PANFROSTDUMP_BUF_BOMAP + 1) #define PANFROSTDUMP_BUF_TRAILER (PANFROSTDUMP_BUF_BO + 1) /* * This structure is the native endianness of the dumping machine, tools can * detect the endianness by looking at the value in 'magic'. */ struct panfrost_dump_object_header { __u32 magic; __u32 type; __u32 file_size; __u32 file_offset; union { struct { __u64 jc; __u32 gpu_id; __u32 major; __u32 minor; __u64 nbos; } reghdr; struct { __u32 valid; __u64 iova; __u32 data[2]; } bomap; /* * Force same size in case we want to expand the header * with new fields and also keep it 512-byte aligned */ __u32 sizer[496]; }; }; /* Registers object, an array of these */ struct panfrost_dump_registers { __u32 reg; __u32 value; }; #if defined(__cplusplus) } #endif #endif /* _PANFROST_DRM_H_ */ drm/qxl_drm.h 0000644 00000010043 15063602046 0007145 0 ustar 00 /* * Copyright 2013 Red Hat * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef QXL_DRM_H #define QXL_DRM_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. * * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel * compatibility Keep fields aligned to their size */ #define QXL_GEM_DOMAIN_CPU 0 #define QXL_GEM_DOMAIN_VRAM 1 #define QXL_GEM_DOMAIN_SURFACE 2 #define DRM_QXL_ALLOC 0x00 #define DRM_QXL_MAP 0x01 #define DRM_QXL_EXECBUFFER 0x02 #define DRM_QXL_UPDATE_AREA 0x03 #define DRM_QXL_GETPARAM 0x04 #define DRM_QXL_CLIENTCAP 0x05 #define DRM_QXL_ALLOC_SURF 0x06 struct drm_qxl_alloc { __u32 size; __u32 handle; /* 0 is an invalid handle */ }; struct drm_qxl_map { __u64 offset; /* use for mmap system call */ __u32 handle; __u32 pad; }; /* * dest is the bo we are writing the relocation into * src is bo we are relocating. * *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr + * src_offset) */ #define QXL_RELOC_TYPE_BO 1 #define QXL_RELOC_TYPE_SURF 2 struct drm_qxl_reloc { __u64 src_offset; /* offset into src_handle or src buffer */ __u64 dst_offset; /* offset in dest handle */ __u32 src_handle; /* dest handle to compute address from */ __u32 dst_handle; /* 0 if to command buffer */ __u32 reloc_type; __u32 pad; }; struct drm_qxl_command { __u64 command; /* void* */ __u64 relocs; /* struct drm_qxl_reloc* */ __u32 type; __u32 command_size; __u32 relocs_num; __u32 pad; }; struct drm_qxl_execbuffer { __u32 flags; /* for future use */ __u32 commands_num; __u64 commands; /* struct drm_qxl_command* */ }; struct drm_qxl_update_area { __u32 handle; __u32 top; __u32 left; __u32 bottom; __u32 right; __u32 pad; }; #define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */ #define QXL_PARAM_MAX_RELOCS 2 struct drm_qxl_getparam { __u64 param; __u64 value; }; /* these are one bit values */ struct drm_qxl_clientcap { __u32 index; __u32 pad; }; struct drm_qxl_alloc_surf { __u32 format; __u32 width; __u32 height; __s32 stride; __u32 handle; __u32 pad; }; #define DRM_IOCTL_QXL_ALLOC \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc) #define DRM_IOCTL_QXL_MAP \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map) #define DRM_IOCTL_QXL_EXECBUFFER \ DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\ struct drm_qxl_execbuffer) #define DRM_IOCTL_QXL_UPDATE_AREA \ DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\ struct drm_qxl_update_area) #define DRM_IOCTL_QXL_GETPARAM \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\ struct drm_qxl_getparam) #define DRM_IOCTL_QXL_CLIENTCAP \ DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\ struct drm_qxl_clientcap) #define DRM_IOCTL_QXL_ALLOC_SURF \ DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\ struct drm_qxl_alloc_surf) #if defined(__cplusplus) } #endif #endif drm/radeon_drm.h 0000644 00000112534 15063602046 0007621 0 ustar 00 /* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- * * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef __RADEON_DRM_H__ #define __RADEON_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* WARNING: If you change any of these defines, make sure to change the * defines in the X server file (radeon_sarea.h) */ #ifndef __RADEON_SAREA_DEFINES__ #define __RADEON_SAREA_DEFINES__ /* Old style state flags, required for sarea interface (1.1 and 1.2 * clears) and 1.2 drm_vertex2 ioctl. */ #define RADEON_UPLOAD_CONTEXT 0x00000001 #define RADEON_UPLOAD_VERTFMT 0x00000002 #define RADEON_UPLOAD_LINE 0x00000004 #define RADEON_UPLOAD_BUMPMAP 0x00000008 #define RADEON_UPLOAD_MASKS 0x00000010 #define RADEON_UPLOAD_VIEWPORT 0x00000020 #define RADEON_UPLOAD_SETUP 0x00000040 #define RADEON_UPLOAD_TCL 0x00000080 #define RADEON_UPLOAD_MISC 0x00000100 #define RADEON_UPLOAD_TEX0 0x00000200 #define RADEON_UPLOAD_TEX1 0x00000400 #define RADEON_UPLOAD_TEX2 0x00000800 #define RADEON_UPLOAD_TEX0IMAGES 0x00001000 #define RADEON_UPLOAD_TEX1IMAGES 0x00002000 #define RADEON_UPLOAD_TEX2IMAGES 0x00004000 #define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ #define RADEON_REQUIRE_QUIESCENCE 0x00010000 #define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */ #define RADEON_UPLOAD_ALL 0x003effff #define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff /* New style per-packet identifiers for use in cmd_buffer ioctl with * the RADEON_EMIT_PACKET command. Comments relate new packets to old * state bits and the packet size: */ #define RADEON_EMIT_PP_MISC 0 /* context/7 */ #define RADEON_EMIT_PP_CNTL 1 /* context/3 */ #define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ #define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ #define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ #define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ #define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ #define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ #define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ #define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ #define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ #define RADEON_EMIT_RE_MISC 11 /* misc/1 */ #define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ #define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ #define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ #define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ #define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ #define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ #define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ #define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ #define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ #define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ #define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ #define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ #define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ #define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ #define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ #define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ #define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ #define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */ #define R200_EMIT_TFACTOR_0 30 /* tf/7 */ #define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */ #define R200_EMIT_VAP_CTL 32 /* vap/1 */ #define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ #define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ #define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ #define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ #define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ #define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ #define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ #define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ #define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ #define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ #define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ #define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ #define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ #define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ #define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ #define R200_EMIT_VTE_CNTL 48 /* vte/1 */ #define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ #define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ #define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ #define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ #define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ #define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ #define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ #define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ #define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ #define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ #define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ #define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ #define R200_EMIT_PP_CUBIC_FACES_0 61 #define R200_EMIT_PP_CUBIC_OFFSETS_0 62 #define R200_EMIT_PP_CUBIC_FACES_1 63 #define R200_EMIT_PP_CUBIC_OFFSETS_1 64 #define R200_EMIT_PP_CUBIC_FACES_2 65 #define R200_EMIT_PP_CUBIC_OFFSETS_2 66 #define R200_EMIT_PP_CUBIC_FACES_3 67 #define R200_EMIT_PP_CUBIC_OFFSETS_3 68 #define R200_EMIT_PP_CUBIC_FACES_4 69 #define R200_EMIT_PP_CUBIC_OFFSETS_4 70 #define R200_EMIT_PP_CUBIC_FACES_5 71 #define R200_EMIT_PP_CUBIC_OFFSETS_5 72 #define RADEON_EMIT_PP_TEX_SIZE_0 73 #define RADEON_EMIT_PP_TEX_SIZE_1 74 #define RADEON_EMIT_PP_TEX_SIZE_2 75 #define R200_EMIT_RB3D_BLENDCOLOR 76 #define R200_EMIT_TCL_POINT_SPRITE_CNTL 77 #define RADEON_EMIT_PP_CUBIC_FACES_0 78 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T0 79 #define RADEON_EMIT_PP_CUBIC_FACES_1 80 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T1 81 #define RADEON_EMIT_PP_CUBIC_FACES_2 82 #define RADEON_EMIT_PP_CUBIC_OFFSETS_T2 83 #define R200_EMIT_PP_TRI_PERF_CNTL 84 #define R200_EMIT_PP_AFS_0 85 #define R200_EMIT_PP_AFS_1 86 #define R200_EMIT_ATF_TFACTOR 87 #define R200_EMIT_PP_TXCTLALL_0 88 #define R200_EMIT_PP_TXCTLALL_1 89 #define R200_EMIT_PP_TXCTLALL_2 90 #define R200_EMIT_PP_TXCTLALL_3 91 #define R200_EMIT_PP_TXCTLALL_4 92 #define R200_EMIT_PP_TXCTLALL_5 93 #define R200_EMIT_VAP_PVS_CNTL 94 #define RADEON_MAX_STATE_PACKETS 95 /* Commands understood by cmd_buffer ioctl. More can be added but * obviously these can't be removed or changed: */ #define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ #define RADEON_CMD_SCALARS 2 /* emit scalar data */ #define RADEON_CMD_VECTORS 3 /* emit vector data */ #define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ #define RADEON_CMD_PACKET3 5 /* emit hw packet */ #define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ #define RADEON_CMD_SCALARS2 7 /* r200 stopgap */ #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: * doesn't make the cpu wait, just * the graphics hardware */ #define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */ typedef union { int i; struct { unsigned char cmd_type, pad0, pad1, pad2; } header; struct { unsigned char cmd_type, packet_id, pad0, pad1; } packet; struct { unsigned char cmd_type, offset, stride, count; } scalars; struct { unsigned char cmd_type, offset, stride, count; } vectors; struct { unsigned char cmd_type, addr_lo, addr_hi, count; } veclinear; struct { unsigned char cmd_type, buf_idx, pad0, pad1; } dma; struct { unsigned char cmd_type, flags, pad0, pad1; } wait; } drm_radeon_cmd_header_t; #define RADEON_WAIT_2D 0x1 #define RADEON_WAIT_3D 0x2 /* Allowed parameters for R300_CMD_PACKET3 */ #define R300_CMD_PACKET3_CLEAR 0 #define R300_CMD_PACKET3_RAW 1 /* Commands understood by cmd_buffer ioctl for R300. * The interface has not been stabilized, so some of these may be removed * and eventually reordered before stabilization. */ #define R300_CMD_PACKET0 1 #define R300_CMD_VPU 2 /* emit vertex program upload */ #define R300_CMD_PACKET3 3 /* emit a packet3 */ #define R300_CMD_END3D 4 /* emit sequence ending 3d rendering */ #define R300_CMD_CP_DELAY 5 #define R300_CMD_DMA_DISCARD 6 #define R300_CMD_WAIT 7 # define R300_WAIT_2D 0x1 # define R300_WAIT_3D 0x2 /* these two defines are DOING IT WRONG - however * we have userspace which relies on using these. * The wait interface is backwards compat new * code should use the NEW_WAIT defines below * THESE ARE NOT BIT FIELDS */ # define R300_WAIT_2D_CLEAN 0x3 # define R300_WAIT_3D_CLEAN 0x4 # define R300_NEW_WAIT_2D_3D 0x3 # define R300_NEW_WAIT_2D_2D_CLEAN 0x4 # define R300_NEW_WAIT_3D_3D_CLEAN 0x6 # define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8 #define R300_CMD_SCRATCH 8 #define R300_CMD_R500FP 9 typedef union { unsigned int u; struct { unsigned char cmd_type, pad0, pad1, pad2; } header; struct { unsigned char cmd_type, count, reglo, reghi; } packet0; struct { unsigned char cmd_type, count, adrlo, adrhi; } vpu; struct { unsigned char cmd_type, packet, pad0, pad1; } packet3; struct { unsigned char cmd_type, packet; unsigned short count; /* amount of packet2 to emit */ } delay; struct { unsigned char cmd_type, buf_idx, pad0, pad1; } dma; struct { unsigned char cmd_type, flags, pad0, pad1; } wait; struct { unsigned char cmd_type, reg, n_bufs, flags; } scratch; struct { unsigned char cmd_type, count, adrlo, adrhi_flags; } r500fp; } drm_r300_cmd_header_t; #define RADEON_FRONT 0x1 #define RADEON_BACK 0x2 #define RADEON_DEPTH 0x4 #define RADEON_STENCIL 0x8 #define RADEON_CLEAR_FASTZ 0x80000000 #define RADEON_USE_HIERZ 0x40000000 #define RADEON_USE_COMP_ZBUF 0x20000000 #define R500FP_CONSTANT_TYPE (1 << 1) #define R500FP_CONSTANT_CLAMP (1 << 2) /* Primitive types */ #define RADEON_POINTS 0x1 #define RADEON_LINES 0x2 #define RADEON_LINE_STRIP 0x3 #define RADEON_TRIANGLES 0x4 #define RADEON_TRIANGLE_FAN 0x5 #define RADEON_TRIANGLE_STRIP 0x6 /* Vertex/indirect buffer size */ #define RADEON_BUFFER_SIZE 65536 /* Byte offsets for indirect buffer data */ #define RADEON_INDEX_PRIM_OFFSET 20 #define RADEON_SCRATCH_REG_OFFSET 32 #define R600_SCRATCH_REG_OFFSET 256 #define RADEON_NR_SAREA_CLIPRECTS 12 /* There are 2 heaps (local/GART). Each region within a heap is a * minimum of 64k, and there are at most 64 of them per heap. */ #define RADEON_LOCAL_TEX_HEAP 0 #define RADEON_GART_TEX_HEAP 1 #define RADEON_NR_TEX_HEAPS 2 #define RADEON_NR_TEX_REGIONS 64 #define RADEON_LOG_TEX_GRANULARITY 16 #define RADEON_MAX_TEXTURE_LEVELS 12 #define RADEON_MAX_TEXTURE_UNITS 3 #define RADEON_MAX_SURFACES 8 /* Blits have strict offset rules. All blit offset must be aligned on * a 1K-byte boundary. */ #define RADEON_OFFSET_SHIFT 10 #define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) #define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) #endif /* __RADEON_SAREA_DEFINES__ */ typedef struct { unsigned int red; unsigned int green; unsigned int blue; unsigned int alpha; } radeon_color_regs_t; typedef struct { /* Context state */ unsigned int pp_misc; /* 0x1c14 */ unsigned int pp_fog_color; unsigned int re_solid_color; unsigned int rb3d_blendcntl; unsigned int rb3d_depthoffset; unsigned int rb3d_depthpitch; unsigned int rb3d_zstencilcntl; unsigned int pp_cntl; /* 0x1c38 */ unsigned int rb3d_cntl; unsigned int rb3d_coloroffset; unsigned int re_width_height; unsigned int rb3d_colorpitch; unsigned int se_cntl; /* Vertex format state */ unsigned int se_coord_fmt; /* 0x1c50 */ /* Line state */ unsigned int re_line_pattern; /* 0x1cd0 */ unsigned int re_line_state; unsigned int se_line_width; /* 0x1db8 */ /* Bumpmap state */ unsigned int pp_lum_matrix; /* 0x1d00 */ unsigned int pp_rot_matrix_0; /* 0x1d58 */ unsigned int pp_rot_matrix_1; /* Mask state */ unsigned int rb3d_stencilrefmask; /* 0x1d7c */ unsigned int rb3d_ropcntl; unsigned int rb3d_planemask; /* Viewport state */ unsigned int se_vport_xscale; /* 0x1d98 */ unsigned int se_vport_xoffset; unsigned int se_vport_yscale; unsigned int se_vport_yoffset; unsigned int se_vport_zscale; unsigned int se_vport_zoffset; /* Setup state */ unsigned int se_cntl_status; /* 0x2140 */ /* Misc state */ unsigned int re_top_left; /* 0x26c0 */ unsigned int re_misc; } drm_radeon_context_regs_t; typedef struct { /* Zbias state */ unsigned int se_zbias_factor; /* 0x1dac */ unsigned int se_zbias_constant; } drm_radeon_context2_regs_t; /* Setup registers for each texture unit */ typedef struct { unsigned int pp_txfilter; unsigned int pp_txformat; unsigned int pp_txoffset; unsigned int pp_txcblend; unsigned int pp_txablend; unsigned int pp_tfactor; unsigned int pp_border_color; } drm_radeon_texture_regs_t; typedef struct { unsigned int start; unsigned int finish; unsigned int prim:8; unsigned int stateidx:8; unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ unsigned int vc_format; /* vertex format */ } drm_radeon_prim_t; typedef struct { drm_radeon_context_regs_t context; drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS]; drm_radeon_context2_regs_t context2; unsigned int dirty; } drm_radeon_state_t; typedef struct { /* The channel for communication of state information to the * kernel on firing a vertex buffer with either of the * obsoleted vertex/index ioctls. */ drm_radeon_context_regs_t context_state; drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; unsigned int dirty; unsigned int vertsize; unsigned int vc_format; /* The current cliprects, or a subset thereof. */ struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS]; unsigned int nbox; /* Counters for client-side throttling of rendering clients. */ unsigned int last_frame; unsigned int last_dispatch; unsigned int last_clear; struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS + 1]; unsigned int tex_age[RADEON_NR_TEX_HEAPS]; int ctx_owner; int pfState; /* number of 3d windows (0,1,2ormore) */ int pfCurrentPage; /* which buffer is being displayed? */ int crtc2_base; /* CRTC2 frame offset */ int tiling_enabled; /* set by drm, read by 2d + 3d clients */ } drm_radeon_sarea_t; /* WARNING: If you change any of these defines, make sure to change the * defines in the Xserver file (xf86drmRadeon.h) * * KW: actually it's illegal to change any of this (backwards compatibility). */ /* Radeon specific ioctls * The device specific ioctl range is 0x40 to 0x79. */ #define DRM_RADEON_CP_INIT 0x00 #define DRM_RADEON_CP_START 0x01 #define DRM_RADEON_CP_STOP 0x02 #define DRM_RADEON_CP_RESET 0x03 #define DRM_RADEON_CP_IDLE 0x04 #define DRM_RADEON_RESET 0x05 #define DRM_RADEON_FULLSCREEN 0x06 #define DRM_RADEON_SWAP 0x07 #define DRM_RADEON_CLEAR 0x08 #define DRM_RADEON_VERTEX 0x09 #define DRM_RADEON_INDICES 0x0A #define DRM_RADEON_NOT_USED #define DRM_RADEON_STIPPLE 0x0C #define DRM_RADEON_INDIRECT 0x0D #define DRM_RADEON_TEXTURE 0x0E #define DRM_RADEON_VERTEX2 0x0F #define DRM_RADEON_CMDBUF 0x10 #define DRM_RADEON_GETPARAM 0x11 #define DRM_RADEON_FLIP 0x12 #define DRM_RADEON_ALLOC 0x13 #define DRM_RADEON_FREE 0x14 #define DRM_RADEON_INIT_HEAP 0x15 #define DRM_RADEON_IRQ_EMIT 0x16 #define DRM_RADEON_IRQ_WAIT 0x17 #define DRM_RADEON_CP_RESUME 0x18 #define DRM_RADEON_SETPARAM 0x19 #define DRM_RADEON_SURF_ALLOC 0x1a #define DRM_RADEON_SURF_FREE 0x1b /* KMS ioctl */ #define DRM_RADEON_GEM_INFO 0x1c #define DRM_RADEON_GEM_CREATE 0x1d #define DRM_RADEON_GEM_MMAP 0x1e #define DRM_RADEON_GEM_PREAD 0x21 #define DRM_RADEON_GEM_PWRITE 0x22 #define DRM_RADEON_GEM_SET_DOMAIN 0x23 #define DRM_RADEON_GEM_WAIT_IDLE 0x24 #define DRM_RADEON_CS 0x26 #define DRM_RADEON_INFO 0x27 #define DRM_RADEON_GEM_SET_TILING 0x28 #define DRM_RADEON_GEM_GET_TILING 0x29 #define DRM_RADEON_GEM_BUSY 0x2a #define DRM_RADEON_GEM_VA 0x2b #define DRM_RADEON_GEM_OP 0x2c #define DRM_RADEON_GEM_USERPTR 0x2d #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) #define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t) #define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET) #define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE) #define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET) #define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t) #define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP) #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t) #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t) #define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t) #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t) #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t) #define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t) #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t) #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t) #define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP) #define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t) #define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t) #define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t) #define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t) #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t) #define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME) #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) #define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) /* KMS */ #define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info) #define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create) #define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap) #define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread) #define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite) #define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain) #define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle) #define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs) #define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) #define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) #define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) #define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) #define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va) #define DRM_IOCTL_RADEON_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_OP, struct drm_radeon_gem_op) #define DRM_IOCTL_RADEON_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_USERPTR, struct drm_radeon_gem_userptr) typedef struct drm_radeon_init { enum { RADEON_INIT_CP = 0x01, RADEON_CLEANUP_CP = 0x02, RADEON_INIT_R200_CP = 0x03, RADEON_INIT_R300_CP = 0x04, RADEON_INIT_R600_CP = 0x05 } func; unsigned long sarea_priv_offset; int is_pci; int cp_mode; int gart_size; int ring_size; int usec_timeout; unsigned int fb_bpp; unsigned int front_offset, front_pitch; unsigned int back_offset, back_pitch; unsigned int depth_bpp; unsigned int depth_offset, depth_pitch; unsigned long fb_offset; unsigned long mmio_offset; unsigned long ring_offset; unsigned long ring_rptr_offset; unsigned long buffers_offset; unsigned long gart_textures_offset; } drm_radeon_init_t; typedef struct drm_radeon_cp_stop { int flush; int idle; } drm_radeon_cp_stop_t; typedef struct drm_radeon_fullscreen { enum { RADEON_INIT_FULLSCREEN = 0x01, RADEON_CLEANUP_FULLSCREEN = 0x02 } func; } drm_radeon_fullscreen_t; #define CLEAR_X1 0 #define CLEAR_Y1 1 #define CLEAR_X2 2 #define CLEAR_Y2 3 #define CLEAR_DEPTH 4 typedef union drm_radeon_clear_rect { float f[5]; unsigned int ui[5]; } drm_radeon_clear_rect_t; typedef struct drm_radeon_clear { unsigned int flags; unsigned int clear_color; unsigned int clear_depth; unsigned int color_mask; unsigned int depth_mask; /* misnamed field: should be stencil */ drm_radeon_clear_rect_t *depth_boxes; } drm_radeon_clear_t; typedef struct drm_radeon_vertex { int prim; int idx; /* Index of vertex buffer */ int count; /* Number of vertices in buffer */ int discard; /* Client finished with buffer? */ } drm_radeon_vertex_t; typedef struct drm_radeon_indices { int prim; int idx; int start; int end; int discard; /* Client finished with buffer? */ } drm_radeon_indices_t; /* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices * - allows multiple primitives and state changes in a single ioctl * - supports driver change to emit native primitives */ typedef struct drm_radeon_vertex2 { int idx; /* Index of vertex buffer */ int discard; /* Client finished with buffer? */ int nr_states; drm_radeon_state_t *state; int nr_prims; drm_radeon_prim_t *prim; } drm_radeon_vertex2_t; /* v1.3 - obsoletes drm_radeon_vertex2 * - allows arbitrarily large cliprect list * - allows updating of tcl packet, vector and scalar state * - allows memory-efficient description of state updates * - allows state to be emitted without a primitive * (for clears, ctx switches) * - allows more than one dma buffer to be referenced per ioctl * - supports tcl driver * - may be extended in future versions with new cmd types, packets */ typedef struct drm_radeon_cmd_buffer { int bufsz; char *buf; int nbox; struct drm_clip_rect *boxes; } drm_radeon_cmd_buffer_t; typedef struct drm_radeon_tex_image { unsigned int x, y; /* Blit coordinates */ unsigned int width, height; const void *data; } drm_radeon_tex_image_t; typedef struct drm_radeon_texture { unsigned int offset; int pitch; int format; int width; /* Texture image coordinates */ int height; drm_radeon_tex_image_t *image; } drm_radeon_texture_t; typedef struct drm_radeon_stipple { unsigned int *mask; } drm_radeon_stipple_t; typedef struct drm_radeon_indirect { int idx; int start; int end; int discard; } drm_radeon_indirect_t; /* enum for card type parameters */ #define RADEON_CARD_PCI 0 #define RADEON_CARD_AGP 1 #define RADEON_CARD_PCIE 2 /* 1.3: An ioctl to get parameters that aren't available to the 3d * client any other way. */ #define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */ #define RADEON_PARAM_LAST_FRAME 2 #define RADEON_PARAM_LAST_DISPATCH 3 #define RADEON_PARAM_LAST_CLEAR 4 /* Added with DRM version 1.6. */ #define RADEON_PARAM_IRQ_NR 5 #define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */ /* Added with DRM version 1.8. */ #define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */ #define RADEON_PARAM_STATUS_HANDLE 8 #define RADEON_PARAM_SAREA_HANDLE 9 #define RADEON_PARAM_GART_TEX_HANDLE 10 #define RADEON_PARAM_SCRATCH_OFFSET 11 #define RADEON_PARAM_CARD_TYPE 12 #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ #define RADEON_PARAM_DEVICE_ID 16 #define RADEON_PARAM_NUM_Z_PIPES 17 /* num Z pipes */ typedef struct drm_radeon_getparam { int param; void *value; } drm_radeon_getparam_t; /* 1.6: Set up a memory manager for regions of shared memory: */ #define RADEON_MEM_REGION_GART 1 #define RADEON_MEM_REGION_FB 2 typedef struct drm_radeon_mem_alloc { int region; int alignment; int size; int *region_offset; /* offset from start of fb or GART */ } drm_radeon_mem_alloc_t; typedef struct drm_radeon_mem_free { int region; int region_offset; } drm_radeon_mem_free_t; typedef struct drm_radeon_mem_init_heap { int region; int size; int start; } drm_radeon_mem_init_heap_t; /* 1.6: Userspace can request & wait on irq's: */ typedef struct drm_radeon_irq_emit { int *irq_seq; } drm_radeon_irq_emit_t; typedef struct drm_radeon_irq_wait { int irq_seq; } drm_radeon_irq_wait_t; /* 1.10: Clients tell the DRM where they think the framebuffer is located in * the card's address space, via a new generic ioctl to set parameters */ typedef struct drm_radeon_setparam { unsigned int param; __s64 value; } drm_radeon_setparam_t; #define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ #define RADEON_SETPARAM_SWITCH_TILING 2 /* enable/disable color tiling */ #define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */ #define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */ #define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */ #define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */ /* 1.14: Clients can allocate/free a surface */ typedef struct drm_radeon_surface_alloc { unsigned int address; unsigned int size; unsigned int flags; } drm_radeon_surface_alloc_t; typedef struct drm_radeon_surface_free { unsigned int address; } drm_radeon_surface_free_t; #define DRM_RADEON_VBLANK_CRTC1 1 #define DRM_RADEON_VBLANK_CRTC2 2 /* * Kernel modesetting world below. */ #define RADEON_GEM_DOMAIN_CPU 0x1 #define RADEON_GEM_DOMAIN_GTT 0x2 #define RADEON_GEM_DOMAIN_VRAM 0x4 struct drm_radeon_gem_info { __u64 gart_size; __u64 vram_size; __u64 vram_visible; }; #define RADEON_GEM_NO_BACKING_STORE (1 << 0) #define RADEON_GEM_GTT_UC (1 << 1) #define RADEON_GEM_GTT_WC (1 << 2) /* BO is expected to be accessed by the CPU */ #define RADEON_GEM_CPU_ACCESS (1 << 3) /* CPU access is not expected to work for this BO */ #define RADEON_GEM_NO_CPU_ACCESS (1 << 4) struct drm_radeon_gem_create { __u64 size; __u64 alignment; __u32 handle; __u32 initial_domain; __u32 flags; }; /* * This is not a reliable API and you should expect it to fail for any * number of reasons and have fallback path that do not use userptr to * perform any operation. */ #define RADEON_GEM_USERPTR_READONLY (1 << 0) #define RADEON_GEM_USERPTR_ANONONLY (1 << 1) #define RADEON_GEM_USERPTR_VALIDATE (1 << 2) #define RADEON_GEM_USERPTR_REGISTER (1 << 3) struct drm_radeon_gem_userptr { __u64 addr; __u64 size; __u32 flags; __u32 handle; }; #define RADEON_TILING_MACRO 0x1 #define RADEON_TILING_MICRO 0x2 #define RADEON_TILING_SWAP_16BIT 0x4 #define RADEON_TILING_SWAP_32BIT 0x8 /* this object requires a surface when mapped - i.e. front buffer */ #define RADEON_TILING_SURFACE 0x10 #define RADEON_TILING_MICRO_SQUARE 0x20 #define RADEON_TILING_EG_BANKW_SHIFT 8 #define RADEON_TILING_EG_BANKW_MASK 0xf #define RADEON_TILING_EG_BANKH_SHIFT 12 #define RADEON_TILING_EG_BANKH_MASK 0xf #define RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT 16 #define RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK 0xf #define RADEON_TILING_EG_TILE_SPLIT_SHIFT 24 #define RADEON_TILING_EG_TILE_SPLIT_MASK 0xf #define RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT 28 #define RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK 0xf struct drm_radeon_gem_set_tiling { __u32 handle; __u32 tiling_flags; __u32 pitch; }; struct drm_radeon_gem_get_tiling { __u32 handle; __u32 tiling_flags; __u32 pitch; }; struct drm_radeon_gem_mmap { __u32 handle; __u32 pad; __u64 offset; __u64 size; __u64 addr_ptr; }; struct drm_radeon_gem_set_domain { __u32 handle; __u32 read_domains; __u32 write_domain; }; struct drm_radeon_gem_wait_idle { __u32 handle; __u32 pad; }; struct drm_radeon_gem_busy { __u32 handle; __u32 domain; }; struct drm_radeon_gem_pread { /** Handle for the object being read. */ __u32 handle; __u32 pad; /** Offset into the object to read from */ __u64 offset; /** Length of data to read */ __u64 size; /** Pointer to write the data into. */ /* void *, but pointers are not 32/64 compatible */ __u64 data_ptr; }; struct drm_radeon_gem_pwrite { /** Handle for the object being written to. */ __u32 handle; __u32 pad; /** Offset into the object to write to */ __u64 offset; /** Length of data to write */ __u64 size; /** Pointer to read the data from. */ /* void *, but pointers are not 32/64 compatible */ __u64 data_ptr; }; /* Sets or returns a value associated with a buffer. */ struct drm_radeon_gem_op { __u32 handle; /* buffer */ __u32 op; /* RADEON_GEM_OP_* */ __u64 value; /* input or return value */ }; #define RADEON_GEM_OP_GET_INITIAL_DOMAIN 0 #define RADEON_GEM_OP_SET_INITIAL_DOMAIN 1 #define RADEON_VA_MAP 1 #define RADEON_VA_UNMAP 2 #define RADEON_VA_RESULT_OK 0 #define RADEON_VA_RESULT_ERROR 1 #define RADEON_VA_RESULT_VA_EXIST 2 #define RADEON_VM_PAGE_VALID (1 << 0) #define RADEON_VM_PAGE_READABLE (1 << 1) #define RADEON_VM_PAGE_WRITEABLE (1 << 2) #define RADEON_VM_PAGE_SYSTEM (1 << 3) #define RADEON_VM_PAGE_SNOOPED (1 << 4) struct drm_radeon_gem_va { __u32 handle; __u32 operation; __u32 vm_id; __u32 flags; __u64 offset; }; #define RADEON_CHUNK_ID_RELOCS 0x01 #define RADEON_CHUNK_ID_IB 0x02 #define RADEON_CHUNK_ID_FLAGS 0x03 #define RADEON_CHUNK_ID_CONST_IB 0x04 /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ #define RADEON_CS_KEEP_TILING_FLAGS 0x01 #define RADEON_CS_USE_VM 0x02 #define RADEON_CS_END_OF_FRAME 0x04 /* a hint from userspace which CS is the last one */ /* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */ #define RADEON_CS_RING_GFX 0 #define RADEON_CS_RING_COMPUTE 1 #define RADEON_CS_RING_DMA 2 #define RADEON_CS_RING_UVD 3 #define RADEON_CS_RING_VCE 4 /* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */ /* 0 = normal, + = higher priority, - = lower priority */ struct drm_radeon_cs_chunk { __u32 chunk_id; __u32 length_dw; __u64 chunk_data; }; /* drm_radeon_cs_reloc.flags */ #define RADEON_RELOC_PRIO_MASK (0xf << 0) struct drm_radeon_cs_reloc { __u32 handle; __u32 read_domains; __u32 write_domain; __u32 flags; }; struct drm_radeon_cs { __u32 num_chunks; __u32 cs_id; /* this points to __u64 * which point to cs chunks */ __u64 chunks; /* updates to the limits after this CS ioctl */ __u64 gart_limit; __u64 vram_limit; }; #define RADEON_INFO_DEVICE_ID 0x00 #define RADEON_INFO_NUM_GB_PIPES 0x01 #define RADEON_INFO_NUM_Z_PIPES 0x02 #define RADEON_INFO_ACCEL_WORKING 0x03 #define RADEON_INFO_CRTC_FROM_ID 0x04 #define RADEON_INFO_ACCEL_WORKING2 0x05 #define RADEON_INFO_TILING_CONFIG 0x06 #define RADEON_INFO_WANT_HYPERZ 0x07 #define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ #define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */ #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ #define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ #define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ /* virtual address start, va < start are reserved by the kernel */ #define RADEON_INFO_VA_START 0x0e /* maximum size of ib using the virtual memory cs */ #define RADEON_INFO_IB_VM_MAX_SIZE 0x0f /* max pipes - needed for compute shaders */ #define RADEON_INFO_MAX_PIPES 0x10 /* timestamp for GL_ARB_timer_query (OpenGL), returns the current GPU clock */ #define RADEON_INFO_TIMESTAMP 0x11 /* max shader engines (SE) - needed for geometry shaders, etc. */ #define RADEON_INFO_MAX_SE 0x12 /* max SH per SE */ #define RADEON_INFO_MAX_SH_PER_SE 0x13 /* fast fb access is enabled */ #define RADEON_INFO_FASTFB_WORKING 0x14 /* query if a RADEON_CS_RING_* submission is supported */ #define RADEON_INFO_RING_WORKING 0x15 /* SI tile mode array */ #define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16 /* query if CP DMA is supported on the compute ring */ #define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17 /* CIK macrotile mode array */ #define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18 /* query the number of render backends */ #define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19 /* max engine clock - needed for OpenCL */ #define RADEON_INFO_MAX_SCLK 0x1a /* version of VCE firmware */ #define RADEON_INFO_VCE_FW_VERSION 0x1b /* version of VCE feedback */ #define RADEON_INFO_VCE_FB_VERSION 0x1c #define RADEON_INFO_NUM_BYTES_MOVED 0x1d #define RADEON_INFO_VRAM_USAGE 0x1e #define RADEON_INFO_GTT_USAGE 0x1f #define RADEON_INFO_ACTIVE_CU_COUNT 0x20 #define RADEON_INFO_CURRENT_GPU_TEMP 0x21 #define RADEON_INFO_CURRENT_GPU_SCLK 0x22 #define RADEON_INFO_CURRENT_GPU_MCLK 0x23 #define RADEON_INFO_READ_REG 0x24 #define RADEON_INFO_VA_UNMAP_WORKING 0x25 #define RADEON_INFO_GPU_RESET_COUNTER 0x26 struct drm_radeon_info { __u32 request; __u32 pad; __u64 value; }; /* Those correspond to the tile index to use, this is to explicitly state * the API that is implicitly defined by the tile mode array. */ #define SI_TILE_MODE_COLOR_LINEAR_ALIGNED 8 #define SI_TILE_MODE_COLOR_1D 13 #define SI_TILE_MODE_COLOR_1D_SCANOUT 9 #define SI_TILE_MODE_COLOR_2D_8BPP 14 #define SI_TILE_MODE_COLOR_2D_16BPP 15 #define SI_TILE_MODE_COLOR_2D_32BPP 16 #define SI_TILE_MODE_COLOR_2D_64BPP 17 #define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP 11 #define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP 12 #define SI_TILE_MODE_DEPTH_STENCIL_1D 4 #define SI_TILE_MODE_DEPTH_STENCIL_2D 0 #define SI_TILE_MODE_DEPTH_STENCIL_2D_2AA 3 #define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3 #define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2 #define CIK_TILE_MODE_DEPTH_STENCIL_1D 5 #if defined(__cplusplus) } #endif #endif drm/tegra_drm.h 0000644 00000052211 15063602046 0007446 0 ustar 00 /* SPDX-License-Identifier: MIT */ /* Copyright (c) 2012-2020 NVIDIA Corporation */ #ifndef _TEGRA_DRM_H_ #define _TEGRA_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Tegra DRM legacy UAPI. Only enabled with STAGING */ #define DRM_TEGRA_GEM_CREATE_TILED (1 << 0) #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1) /** * struct drm_tegra_gem_create - parameters for the GEM object creation IOCTL */ struct drm_tegra_gem_create { /** * @size: * * The size, in bytes, of the buffer object to be created. */ __u64 size; /** * @flags: * * A bitmask of flags that influence the creation of GEM objects: * * DRM_TEGRA_GEM_CREATE_TILED * Use the 16x16 tiling format for this buffer. * * DRM_TEGRA_GEM_CREATE_BOTTOM_UP * The buffer has a bottom-up layout. */ __u32 flags; /** * @handle: * * The handle of the created GEM object. Set by the kernel upon * successful completion of the IOCTL. */ __u32 handle; }; /** * struct drm_tegra_gem_mmap - parameters for the GEM mmap IOCTL */ struct drm_tegra_gem_mmap { /** * @handle: * * Handle of the GEM object to obtain an mmap offset for. */ __u32 handle; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; /** * @offset: * * The mmap offset for the given GEM object. Set by the kernel upon * successful completion of the IOCTL. */ __u64 offset; }; /** * struct drm_tegra_syncpt_read - parameters for the read syncpoint IOCTL */ struct drm_tegra_syncpt_read { /** * @id: * * ID of the syncpoint to read the current value from. */ __u32 id; /** * @value: * * The current syncpoint value. Set by the kernel upon successful * completion of the IOCTL. */ __u32 value; }; /** * struct drm_tegra_syncpt_incr - parameters for the increment syncpoint IOCTL */ struct drm_tegra_syncpt_incr { /** * @id: * * ID of the syncpoint to increment. */ __u32 id; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_syncpt_wait - parameters for the wait syncpoint IOCTL */ struct drm_tegra_syncpt_wait { /** * @id: * * ID of the syncpoint to wait on. */ __u32 id; /** * @thresh: * * Threshold value for which to wait. */ __u32 thresh; /** * @timeout: * * Timeout, in milliseconds, to wait. */ __u32 timeout; /** * @value: * * The new syncpoint value after the wait. Set by the kernel upon * successful completion of the IOCTL. */ __u32 value; }; #define DRM_TEGRA_NO_TIMEOUT (0xffffffff) /** * struct drm_tegra_open_channel - parameters for the open channel IOCTL */ struct drm_tegra_open_channel { /** * @client: * * The client ID for this channel. */ __u32 client; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; /** * @context: * * The application context of this channel. Set by the kernel upon * successful completion of the IOCTL. This context needs to be passed * to the DRM_TEGRA_CHANNEL_CLOSE or the DRM_TEGRA_SUBMIT IOCTLs. */ __u64 context; }; /** * struct drm_tegra_close_channel - parameters for the close channel IOCTL */ struct drm_tegra_close_channel { /** * @context: * * The application context of this channel. This is obtained from the * DRM_TEGRA_OPEN_CHANNEL IOCTL. */ __u64 context; }; /** * struct drm_tegra_get_syncpt - parameters for the get syncpoint IOCTL */ struct drm_tegra_get_syncpt { /** * @context: * * The application context identifying the channel for which to obtain * the syncpoint ID. */ __u64 context; /** * @index: * * Index of the client syncpoint for which to obtain the ID. */ __u32 index; /** * @id: * * The ID of the given syncpoint. Set by the kernel upon successful * completion of the IOCTL. */ __u32 id; }; /** * struct drm_tegra_get_syncpt_base - parameters for the get wait base IOCTL */ struct drm_tegra_get_syncpt_base { /** * @context: * * The application context identifying for which channel to obtain the * wait base. */ __u64 context; /** * @syncpt: * * ID of the syncpoint for which to obtain the wait base. */ __u32 syncpt; /** * @id: * * The ID of the wait base corresponding to the client syncpoint. Set * by the kernel upon successful completion of the IOCTL. */ __u32 id; }; /** * struct drm_tegra_syncpt - syncpoint increment operation */ struct drm_tegra_syncpt { /** * @id: * * ID of the syncpoint to operate on. */ __u32 id; /** * @incrs: * * Number of increments to perform for the syncpoint. */ __u32 incrs; }; /** * struct drm_tegra_cmdbuf - structure describing a command buffer */ struct drm_tegra_cmdbuf { /** * @handle: * * Handle to a GEM object containing the command buffer. */ __u32 handle; /** * @offset: * * Offset, in bytes, into the GEM object identified by @handle at * which the command buffer starts. */ __u32 offset; /** * @words: * * Number of 32-bit words in this command buffer. */ __u32 words; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_reloc - GEM object relocation structure */ struct drm_tegra_reloc { struct { /** * @cmdbuf.handle: * * Handle to the GEM object containing the command buffer for * which to perform this GEM object relocation. */ __u32 handle; /** * @cmdbuf.offset: * * Offset, in bytes, into the command buffer at which to * insert the relocated address. */ __u32 offset; } cmdbuf; struct { /** * @target.handle: * * Handle to the GEM object to be relocated. */ __u32 handle; /** * @target.offset: * * Offset, in bytes, into the target GEM object at which the * relocated data starts. */ __u32 offset; } target; /** * @shift: * * The number of bits by which to shift relocated addresses. */ __u32 shift; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_waitchk - wait check structure */ struct drm_tegra_waitchk { /** * @handle: * * Handle to the GEM object containing a command stream on which to * perform the wait check. */ __u32 handle; /** * @offset: * * Offset, in bytes, of the location in the command stream to perform * the wait check on. */ __u32 offset; /** * @syncpt: * * ID of the syncpoint to wait check. */ __u32 syncpt; /** * @thresh: * * Threshold value for which to check. */ __u32 thresh; }; /** * struct drm_tegra_submit - job submission structure */ struct drm_tegra_submit { /** * @context: * * The application context identifying the channel to use for the * execution of this job. */ __u64 context; /** * @num_syncpts: * * The number of syncpoints operated on by this job. This defines the * length of the array pointed to by @syncpts. */ __u32 num_syncpts; /** * @num_cmdbufs: * * The number of command buffers to execute as part of this job. This * defines the length of the array pointed to by @cmdbufs. */ __u32 num_cmdbufs; /** * @num_relocs: * * The number of relocations to perform before executing this job. * This defines the length of the array pointed to by @relocs. */ __u32 num_relocs; /** * @num_waitchks: * * The number of wait checks to perform as part of this job. This * defines the length of the array pointed to by @waitchks. */ __u32 num_waitchks; /** * @waitchk_mask: * * Bitmask of valid wait checks. */ __u32 waitchk_mask; /** * @timeout: * * Timeout, in milliseconds, before this job is cancelled. */ __u32 timeout; /** * @syncpts: * * A pointer to an array of &struct drm_tegra_syncpt structures that * specify the syncpoint operations performed as part of this job. * The number of elements in the array must be equal to the value * given by @num_syncpts. */ __u64 syncpts; /** * @cmdbufs: * * A pointer to an array of &struct drm_tegra_cmdbuf structures that * define the command buffers to execute as part of this job. The * number of elements in the array must be equal to the value given * by @num_syncpts. */ __u64 cmdbufs; /** * @relocs: * * A pointer to an array of &struct drm_tegra_reloc structures that * specify the relocations that need to be performed before executing * this job. The number of elements in the array must be equal to the * value given by @num_relocs. */ __u64 relocs; /** * @waitchks: * * A pointer to an array of &struct drm_tegra_waitchk structures that * specify the wait checks to be performed while executing this job. * The number of elements in the array must be equal to the value * given by @num_waitchks. */ __u64 waitchks; /** * @fence: * * The threshold of the syncpoint associated with this job after it * has been completed. Set by the kernel upon successful completion of * the IOCTL. This can be used with the DRM_TEGRA_SYNCPT_WAIT IOCTL to * wait for this job to be finished. */ __u32 fence; /** * @reserved: * * This field is reserved for future use. Must be 0. */ __u32 reserved[5]; }; #define DRM_TEGRA_GEM_TILING_MODE_PITCH 0 #define DRM_TEGRA_GEM_TILING_MODE_TILED 1 #define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2 /** * struct drm_tegra_gem_set_tiling - parameters for the set tiling IOCTL */ struct drm_tegra_gem_set_tiling { /** * @handle: * * Handle to the GEM object for which to set the tiling parameters. */ __u32 handle; /** * @mode: * * The tiling mode to set. Must be one of: * * DRM_TEGRA_GEM_TILING_MODE_PITCH * pitch linear format * * DRM_TEGRA_GEM_TILING_MODE_TILED * 16x16 tiling format * * DRM_TEGRA_GEM_TILING_MODE_BLOCK * 16Bx2 tiling format */ __u32 mode; /** * @value: * * The value to set for the tiling mode parameter. */ __u32 value; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; /** * struct drm_tegra_gem_get_tiling - parameters for the get tiling IOCTL */ struct drm_tegra_gem_get_tiling { /** * @handle: * * Handle to the GEM object for which to query the tiling parameters. */ __u32 handle; /** * @mode: * * The tiling mode currently associated with the GEM object. Set by * the kernel upon successful completion of the IOCTL. */ __u32 mode; /** * @value: * * The tiling mode parameter currently associated with the GEM object. * Set by the kernel upon successful completion of the IOCTL. */ __u32 value; /** * @pad: * * Structure padding that may be used in the future. Must be 0. */ __u32 pad; }; #define DRM_TEGRA_GEM_BOTTOM_UP (1 << 0) #define DRM_TEGRA_GEM_FLAGS (DRM_TEGRA_GEM_BOTTOM_UP) /** * struct drm_tegra_gem_set_flags - parameters for the set flags IOCTL */ struct drm_tegra_gem_set_flags { /** * @handle: * * Handle to the GEM object for which to set the flags. */ __u32 handle; /** * @flags: * * The flags to set for the GEM object. */ __u32 flags; }; /** * struct drm_tegra_gem_get_flags - parameters for the get flags IOCTL */ struct drm_tegra_gem_get_flags { /** * @handle: * * Handle to the GEM object for which to query the flags. */ __u32 handle; /** * @flags: * * The flags currently associated with the GEM object. Set by the * kernel upon successful completion of the IOCTL. */ __u32 flags; }; #define DRM_TEGRA_GEM_CREATE 0x00 #define DRM_TEGRA_GEM_MMAP 0x01 #define DRM_TEGRA_SYNCPT_READ 0x02 #define DRM_TEGRA_SYNCPT_INCR 0x03 #define DRM_TEGRA_SYNCPT_WAIT 0x04 #define DRM_TEGRA_OPEN_CHANNEL 0x05 #define DRM_TEGRA_CLOSE_CHANNEL 0x06 #define DRM_TEGRA_GET_SYNCPT 0x07 #define DRM_TEGRA_SUBMIT 0x08 #define DRM_TEGRA_GET_SYNCPT_BASE 0x09 #define DRM_TEGRA_GEM_SET_TILING 0x0a #define DRM_TEGRA_GEM_GET_TILING 0x0b #define DRM_TEGRA_GEM_SET_FLAGS 0x0c #define DRM_TEGRA_GEM_GET_FLAGS 0x0d #define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create) #define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap) #define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read) #define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr) #define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait) #define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel) #define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_close_channel) #define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt) #define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit) #define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base) #define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling) #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling) #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags) #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags) /* New Tegra DRM UAPI */ /* * Reported by the driver in the `capabilities` field. * * DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT: If set, the engine is cache coherent * with regard to the system memory. */ #define DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT (1 << 0) struct drm_tegra_channel_open { /** * @host1x_class: [in] * * Host1x class of the engine that will be programmed using this * channel. */ __u32 host1x_class; /** * @flags: [in] * * Flags. */ __u32 flags; /** * @context: [out] * * Opaque identifier corresponding to the opened channel. */ __u32 context; /** * @version: [out] * * Version of the engine hardware. This can be used by userspace * to determine how the engine needs to be programmed. */ __u32 version; /** * @capabilities: [out] * * Flags describing the hardware capabilities. */ __u32 capabilities; __u32 padding; }; struct drm_tegra_channel_close { /** * @context: [in] * * Identifier of the channel to close. */ __u32 context; __u32 padding; }; /* * Mapping flags that can be used to influence how the mapping is created. * * DRM_TEGRA_CHANNEL_MAP_READ: create mapping that allows HW read access * DRM_TEGRA_CHANNEL_MAP_WRITE: create mapping that allows HW write access */ #define DRM_TEGRA_CHANNEL_MAP_READ (1 << 0) #define DRM_TEGRA_CHANNEL_MAP_WRITE (1 << 1) #define DRM_TEGRA_CHANNEL_MAP_READ_WRITE (DRM_TEGRA_CHANNEL_MAP_READ | \ DRM_TEGRA_CHANNEL_MAP_WRITE) struct drm_tegra_channel_map { /** * @context: [in] * * Identifier of the channel to which make memory available for. */ __u32 context; /** * @handle: [in] * * GEM handle of the memory to map. */ __u32 handle; /** * @flags: [in] * * Flags. */ __u32 flags; /** * @mapping: [out] * * Identifier corresponding to the mapping, to be used for * relocations or unmapping later. */ __u32 mapping; }; struct drm_tegra_channel_unmap { /** * @context: [in] * * Channel identifier of the channel to unmap memory from. */ __u32 context; /** * @mapping: [in] * * Mapping identifier of the memory mapping to unmap. */ __u32 mapping; }; /* Submission */ /** * Specify that bit 39 of the patched-in address should be set to switch * swizzling between Tegra and non-Tegra sector layout on systems that store * surfaces in system memory in non-Tegra sector layout. */ #define DRM_TEGRA_SUBMIT_RELOC_SECTOR_LAYOUT (1 << 0) struct drm_tegra_submit_buf { /** * @mapping: [in] * * Identifier of the mapping to use in the submission. */ __u32 mapping; /** * @flags: [in] * * Flags. */ __u32 flags; /** * Information for relocation patching. */ struct { /** * @target_offset: [in] * * Offset from the start of the mapping of the data whose * address is to be patched into the gather. */ __u64 target_offset; /** * @gather_offset_words: [in] * * Offset in words from the start of the gather data to * where the address should be patched into. */ __u32 gather_offset_words; /** * @shift: [in] * * Number of bits the address should be shifted right before * patching in. */ __u32 shift; } reloc; }; /** * Execute `words` words of Host1x opcodes specified in the `gather_data_ptr` * buffer. Each GATHER_UPTR command uses successive words from the buffer. */ #define DRM_TEGRA_SUBMIT_CMD_GATHER_UPTR 0 /** * Wait for a syncpoint to reach a value before continuing with further * commands. */ #define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT 1 /** * Wait for a syncpoint to reach a value before continuing with further * commands. The threshold is calculated relative to the start of the job. */ #define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT_RELATIVE 2 struct drm_tegra_submit_cmd_gather_uptr { __u32 words; __u32 reserved[3]; }; struct drm_tegra_submit_cmd_wait_syncpt { __u32 id; __u32 value; __u32 reserved[2]; }; struct drm_tegra_submit_cmd { /** * @type: [in] * * Command type to execute. One of the DRM_TEGRA_SUBMIT_CMD* * defines. */ __u32 type; /** * @flags: [in] * * Flags. */ __u32 flags; union { struct drm_tegra_submit_cmd_gather_uptr gather_uptr; struct drm_tegra_submit_cmd_wait_syncpt wait_syncpt; __u32 reserved[4]; }; }; struct drm_tegra_submit_syncpt { /** * @id: [in] * * ID of the syncpoint that the job will increment. */ __u32 id; /** * @flags: [in] * * Flags. */ __u32 flags; /** * @increments: [in] * * Number of times the job will increment this syncpoint. */ __u32 increments; /** * @value: [out] * * Value the syncpoint will have once the job has completed all * its specified syncpoint increments. * * Note that the kernel may increment the syncpoint before or after * the job. These increments are not reflected in this field. * * If the job hangs or times out, not all of the increments may * get executed. */ __u32 value; }; struct drm_tegra_channel_submit { /** * @context: [in] * * Identifier of the channel to submit this job to. */ __u32 context; /** * @num_bufs: [in] * * Number of elements in the `bufs_ptr` array. */ __u32 num_bufs; /** * @num_cmds: [in] * * Number of elements in the `cmds_ptr` array. */ __u32 num_cmds; /** * @gather_data_words: [in] * * Number of 32-bit words in the `gather_data_ptr` array. */ __u32 gather_data_words; /** * @bufs_ptr: [in] * * Pointer to an array of drm_tegra_submit_buf structures. */ __u64 bufs_ptr; /** * @cmds_ptr: [in] * * Pointer to an array of drm_tegra_submit_cmd structures. */ __u64 cmds_ptr; /** * @gather_data_ptr: [in] * * Pointer to an array of Host1x opcodes to be used by GATHER_UPTR * commands. */ __u64 gather_data_ptr; /** * @syncobj_in: [in] * * Handle for DRM syncobj that will be waited before submission. * Ignored if zero. */ __u32 syncobj_in; /** * @syncobj_out: [in] * * Handle for DRM syncobj that will have its fence replaced with * the job's completion fence. Ignored if zero. */ __u32 syncobj_out; /** * @syncpt_incr: [in,out] * * Information about the syncpoint the job will increment. */ struct drm_tegra_submit_syncpt syncpt; }; struct drm_tegra_syncpoint_allocate { /** * @id: [out] * * ID of allocated syncpoint. */ __u32 id; __u32 padding; }; struct drm_tegra_syncpoint_free { /** * @id: [in] * * ID of syncpoint to free. */ __u32 id; __u32 padding; }; struct drm_tegra_syncpoint_wait { /** * @timeout: [in] * * Absolute timestamp at which the wait will time out. */ __s64 timeout_ns; /** * @id: [in] * * ID of syncpoint to wait on. */ __u32 id; /** * @threshold: [in] * * Threshold to wait for. */ __u32 threshold; /** * @value: [out] * * Value of the syncpoint upon wait completion. */ __u32 value; __u32 padding; }; #define DRM_IOCTL_TEGRA_CHANNEL_OPEN DRM_IOWR(DRM_COMMAND_BASE + 0x10, struct drm_tegra_channel_open) #define DRM_IOCTL_TEGRA_CHANNEL_CLOSE DRM_IOWR(DRM_COMMAND_BASE + 0x11, struct drm_tegra_channel_close) #define DRM_IOCTL_TEGRA_CHANNEL_MAP DRM_IOWR(DRM_COMMAND_BASE + 0x12, struct drm_tegra_channel_map) #define DRM_IOCTL_TEGRA_CHANNEL_UNMAP DRM_IOWR(DRM_COMMAND_BASE + 0x13, struct drm_tegra_channel_unmap) #define DRM_IOCTL_TEGRA_CHANNEL_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + 0x14, struct drm_tegra_channel_submit) #define DRM_IOCTL_TEGRA_SYNCPOINT_ALLOCATE DRM_IOWR(DRM_COMMAND_BASE + 0x20, struct drm_tegra_syncpoint_allocate) #define DRM_IOCTL_TEGRA_SYNCPOINT_FREE DRM_IOWR(DRM_COMMAND_BASE + 0x21, struct drm_tegra_syncpoint_free) #define DRM_IOCTL_TEGRA_SYNCPOINT_WAIT DRM_IOWR(DRM_COMMAND_BASE + 0x22, struct drm_tegra_syncpoint_wait) #if defined(__cplusplus) } #endif #endif drm/v3d_drm.h 0000644 00000035063 15063602046 0007046 0 ustar 00 /* * Copyright © 2014-2018 Broadcom * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _V3D_DRM_H_ #define _V3D_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_V3D_SUBMIT_CL 0x00 #define DRM_V3D_WAIT_BO 0x01 #define DRM_V3D_CREATE_BO 0x02 #define DRM_V3D_MMAP_BO 0x03 #define DRM_V3D_GET_PARAM 0x04 #define DRM_V3D_GET_BO_OFFSET 0x05 #define DRM_V3D_SUBMIT_TFU 0x06 #define DRM_V3D_SUBMIT_CSD 0x07 #define DRM_V3D_PERFMON_CREATE 0x08 #define DRM_V3D_PERFMON_DESTROY 0x09 #define DRM_V3D_PERFMON_GET_VALUES 0x0a #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl) #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo) #define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo) #define DRM_IOCTL_V3D_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_MMAP_BO, struct drm_v3d_mmap_bo) #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param) #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset) #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu) #define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd) #define DRM_IOCTL_V3D_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_CREATE, \ struct drm_v3d_perfmon_create) #define DRM_IOCTL_V3D_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_DESTROY, \ struct drm_v3d_perfmon_destroy) #define DRM_IOCTL_V3D_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_GET_VALUES, \ struct drm_v3d_perfmon_get_values) #define DRM_V3D_SUBMIT_CL_FLUSH_CACHE 0x01 #define DRM_V3D_SUBMIT_EXTENSION 0x02 /* struct drm_v3d_extension - ioctl extensions * * Linked-list of generic extensions where the id identify which struct is * pointed by ext_data. Therefore, DRM_V3D_EXT_ID_* is used on id to identify * the extension type. */ struct drm_v3d_extension { __u64 next; __u32 id; #define DRM_V3D_EXT_ID_MULTI_SYNC 0x01 __u32 flags; /* mbz */ }; /* struct drm_v3d_sem - wait/signal semaphore * * If binary semaphore, it only takes syncobj handle and ignores flags and * point fields. Point is defined for timeline syncobj feature. */ struct drm_v3d_sem { __u32 handle; /* syncobj */ /* rsv below, for future uses */ __u32 flags; __u64 point; /* for timeline sem support */ __u64 mbz[2]; /* must be zero, rsv */ }; /* Enum for each of the V3D queues. */ enum v3d_queue { V3D_BIN, V3D_RENDER, V3D_TFU, V3D_CSD, V3D_CACHE_CLEAN, }; /** * struct drm_v3d_multi_sync - ioctl extension to add support multiples * syncobjs for commands submission. * * When an extension of DRM_V3D_EXT_ID_MULTI_SYNC id is defined, it points to * this extension to define wait and signal dependencies, instead of single * in/out sync entries on submitting commands. The field flags is used to * determine the stage to set wait dependencies. */ struct drm_v3d_multi_sync { struct drm_v3d_extension base; /* Array of wait and signal semaphores */ __u64 in_syncs; __u64 out_syncs; /* Number of entries */ __u32 in_sync_count; __u32 out_sync_count; /* set the stage (v3d_queue) to sync */ __u32 wait_stage; __u32 pad; /* mbz */ }; /** * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D * engine. * * This asks the kernel to have the GPU execute an optional binner * command list, and a render command list. * * The L1T, slice, L2C, L2T, and GCA caches will be flushed before * each CL executes. The VCD cache should be flushed (if necessary) * by the submitted CLs. The TLB writes are guaranteed to have been * flushed by the time the render done IRQ happens, which is the * trigger for out_sync. Any dirtying of cachelines by the job (only * possible using TMU writes) must be flushed by the caller using the * DRM_V3D_SUBMIT_CL_FLUSH_CACHE_FLAG flag. */ struct drm_v3d_submit_cl { /* Pointer to the binner command list. * * This is the first set of commands executed, which runs the * coordinate shader to determine where primitives land on the screen, * then writes out the state updates and draw calls necessary per tile * to the tile allocation BO. * * This BCL will block on any previous BCL submitted on the * same FD, but not on any RCL or BCLs submitted by other * clients -- that is left up to the submitter to control * using in_sync_bcl if necessary. */ __u32 bcl_start; /** End address of the BCL (first byte after the BCL) */ __u32 bcl_end; /* Offset of the render command list. * * This is the second set of commands executed, which will either * execute the tiles that have been set up by the BCL, or a fixed set * of tiles (in the case of RCL-only blits). * * This RCL will block on this submit's BCL, and any previous * RCL submitted on the same FD, but not on any RCL or BCLs * submitted by other clients -- that is left up to the * submitter to control using in_sync_rcl if necessary. */ __u32 rcl_start; /** End address of the RCL (first byte after the RCL) */ __u32 rcl_end; /** An optional sync object to wait on before starting the BCL. */ __u32 in_sync_bcl; /** An optional sync object to wait on before starting the RCL. */ __u32 in_sync_rcl; /** An optional sync object to place the completion fence in. */ __u32 out_sync; /* Offset of the tile alloc memory * * This is optional on V3D 3.3 (where the CL can set the value) but * required on V3D 4.1. */ __u32 qma; /** Size of the tile alloc memory. */ __u32 qms; /** Offset of the tile state data array. */ __u32 qts; /* Pointer to a u32 array of the BOs that are referenced by the job. */ __u64 bo_handles; /* Number of BO handles passed in (size is that times 4). */ __u32 bo_handle_count; /* DRM_V3D_SUBMIT_* properties */ __u32 flags; /* ID of the perfmon to attach to this job. 0 means no perfmon. */ __u32 perfmon_id; __u32 pad; /* Pointer to an array of ioctl extensions*/ __u64 extensions; }; /** * struct drm_v3d_wait_bo - ioctl argument for waiting for * completion of the last DRM_V3D_SUBMIT_CL on a BO. * * This is useful for cases where multiple processes might be * rendering to a BO and you want to wait for all rendering to be * completed. */ struct drm_v3d_wait_bo { __u32 handle; __u32 pad; __u64 timeout_ns; }; /** * struct drm_v3d_create_bo - ioctl argument for creating V3D BOs. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_v3d_create_bo { __u32 size; __u32 flags; /** Returned GEM handle for the BO. */ __u32 handle; /** * Returned offset for the BO in the V3D address space. This offset * is private to the DRM fd and is valid for the lifetime of the GEM * handle. * * This offset value will always be nonzero, since various HW * units treat 0 specially. */ __u32 offset; }; /** * struct drm_v3d_mmap_bo - ioctl argument for mapping V3D BOs. * * This doesn't actually perform an mmap. Instead, it returns the * offset you need to use in an mmap on the DRM device node. This * means that tools like valgrind end up knowing about the mapped * memory. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_v3d_mmap_bo { /** Handle for the object being mapped. */ __u32 handle; __u32 flags; /** offset into the drm node to use for subsequent mmap call. */ __u64 offset; }; enum drm_v3d_param { DRM_V3D_PARAM_V3D_UIFCFG, DRM_V3D_PARAM_V3D_HUB_IDENT1, DRM_V3D_PARAM_V3D_HUB_IDENT2, DRM_V3D_PARAM_V3D_HUB_IDENT3, DRM_V3D_PARAM_V3D_CORE0_IDENT0, DRM_V3D_PARAM_V3D_CORE0_IDENT1, DRM_V3D_PARAM_V3D_CORE0_IDENT2, DRM_V3D_PARAM_SUPPORTS_TFU, DRM_V3D_PARAM_SUPPORTS_CSD, DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH, DRM_V3D_PARAM_SUPPORTS_PERFMON, DRM_V3D_PARAM_SUPPORTS_MULTISYNC_EXT, }; struct drm_v3d_get_param { __u32 param; __u32 pad; __u64 value; }; /** * Returns the offset for the BO in the V3D address space for this DRM fd. * This is the same value returned by drm_v3d_create_bo, if that was called * from this DRM fd. */ struct drm_v3d_get_bo_offset { __u32 handle; __u32 offset; }; struct drm_v3d_submit_tfu { __u32 icfg; __u32 iia; __u32 iis; __u32 ica; __u32 iua; __u32 ioa; __u32 ios; __u32 coef[4]; /* First handle is the output BO, following are other inputs. * 0 for unused. */ __u32 bo_handles[4]; /* sync object to block on before running the TFU job. Each TFU * job will execute in the order submitted to its FD. Synchronization * against rendering jobs requires using sync objects. */ __u32 in_sync; /* Sync object to signal when the TFU job is done. */ __u32 out_sync; __u32 flags; /* Pointer to an array of ioctl extensions*/ __u64 extensions; }; /* Submits a compute shader for dispatch. This job will block on any * previous compute shaders submitted on this fd, and any other * synchronization must be performed with in_sync/out_sync. */ struct drm_v3d_submit_csd { __u32 cfg[7]; __u32 coef[4]; /* Pointer to a u32 array of the BOs that are referenced by the job. */ __u64 bo_handles; /* Number of BO handles passed in (size is that times 4). */ __u32 bo_handle_count; /* sync object to block on before running the CSD job. Each * CSD job will execute in the order submitted to its FD. * Synchronization against rendering/TFU jobs or CSD from * other fds requires using sync objects. */ __u32 in_sync; /* Sync object to signal when the CSD job is done. */ __u32 out_sync; /* ID of the perfmon to attach to this job. 0 means no perfmon. */ __u32 perfmon_id; /* Pointer to an array of ioctl extensions*/ __u64 extensions; __u32 flags; __u32 pad; }; enum { V3D_PERFCNT_FEP_VALID_PRIMTS_NO_PIXELS, V3D_PERFCNT_FEP_VALID_PRIMS, V3D_PERFCNT_FEP_EZ_NFCLIP_QUADS, V3D_PERFCNT_FEP_VALID_QUADS, V3D_PERFCNT_TLB_QUADS_STENCIL_FAIL, V3D_PERFCNT_TLB_QUADS_STENCILZ_FAIL, V3D_PERFCNT_TLB_QUADS_STENCILZ_PASS, V3D_PERFCNT_TLB_QUADS_ZERO_COV, V3D_PERFCNT_TLB_QUADS_NONZERO_COV, V3D_PERFCNT_TLB_QUADS_WRITTEN, V3D_PERFCNT_PTB_PRIM_VIEWPOINT_DISCARD, V3D_PERFCNT_PTB_PRIM_CLIP, V3D_PERFCNT_PTB_PRIM_REV, V3D_PERFCNT_QPU_IDLE_CYCLES, V3D_PERFCNT_QPU_ACTIVE_CYCLES_VERTEX_COORD_USER, V3D_PERFCNT_QPU_ACTIVE_CYCLES_FRAG, V3D_PERFCNT_QPU_CYCLES_VALID_INSTR, V3D_PERFCNT_QPU_CYCLES_TMU_STALL, V3D_PERFCNT_QPU_CYCLES_SCOREBOARD_STALL, V3D_PERFCNT_QPU_CYCLES_VARYINGS_STALL, V3D_PERFCNT_QPU_IC_HIT, V3D_PERFCNT_QPU_IC_MISS, V3D_PERFCNT_QPU_UC_HIT, V3D_PERFCNT_QPU_UC_MISS, V3D_PERFCNT_TMU_TCACHE_ACCESS, V3D_PERFCNT_TMU_TCACHE_MISS, V3D_PERFCNT_VPM_VDW_STALL, V3D_PERFCNT_VPM_VCD_STALL, V3D_PERFCNT_BIN_ACTIVE, V3D_PERFCNT_RDR_ACTIVE, V3D_PERFCNT_L2T_HITS, V3D_PERFCNT_L2T_MISSES, V3D_PERFCNT_CYCLE_COUNT, V3D_PERFCNT_QPU_CYCLES_STALLED_VERTEX_COORD_USER, V3D_PERFCNT_QPU_CYCLES_STALLED_FRAGMENT, V3D_PERFCNT_PTB_PRIMS_BINNED, V3D_PERFCNT_AXI_WRITES_WATCH_0, V3D_PERFCNT_AXI_READS_WATCH_0, V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_0, V3D_PERFCNT_AXI_READ_STALLS_WATCH_0, V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_0, V3D_PERFCNT_AXI_READ_BYTES_WATCH_0, V3D_PERFCNT_AXI_WRITES_WATCH_1, V3D_PERFCNT_AXI_READS_WATCH_1, V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_1, V3D_PERFCNT_AXI_READ_STALLS_WATCH_1, V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_1, V3D_PERFCNT_AXI_READ_BYTES_WATCH_1, V3D_PERFCNT_TLB_PARTIAL_QUADS, V3D_PERFCNT_TMU_CONFIG_ACCESSES, V3D_PERFCNT_L2T_NO_ID_STALL, V3D_PERFCNT_L2T_COM_QUE_STALL, V3D_PERFCNT_L2T_TMU_WRITES, V3D_PERFCNT_TMU_ACTIVE_CYCLES, V3D_PERFCNT_TMU_STALLED_CYCLES, V3D_PERFCNT_CLE_ACTIVE, V3D_PERFCNT_L2T_TMU_READS, V3D_PERFCNT_L2T_CLE_READS, V3D_PERFCNT_L2T_VCD_READS, V3D_PERFCNT_L2T_TMUCFG_READS, V3D_PERFCNT_L2T_SLC0_READS, V3D_PERFCNT_L2T_SLC1_READS, V3D_PERFCNT_L2T_SLC2_READS, V3D_PERFCNT_L2T_TMU_W_MISSES, V3D_PERFCNT_L2T_TMU_R_MISSES, V3D_PERFCNT_L2T_CLE_MISSES, V3D_PERFCNT_L2T_VCD_MISSES, V3D_PERFCNT_L2T_TMUCFG_MISSES, V3D_PERFCNT_L2T_SLC0_MISSES, V3D_PERFCNT_L2T_SLC1_MISSES, V3D_PERFCNT_L2T_SLC2_MISSES, V3D_PERFCNT_CORE_MEM_WRITES, V3D_PERFCNT_L2T_MEM_WRITES, V3D_PERFCNT_PTB_MEM_WRITES, V3D_PERFCNT_TLB_MEM_WRITES, V3D_PERFCNT_CORE_MEM_READS, V3D_PERFCNT_L2T_MEM_READS, V3D_PERFCNT_PTB_MEM_READS, V3D_PERFCNT_PSE_MEM_READS, V3D_PERFCNT_TLB_MEM_READS, V3D_PERFCNT_GMP_MEM_READS, V3D_PERFCNT_PTB_W_MEM_WORDS, V3D_PERFCNT_TLB_W_MEM_WORDS, V3D_PERFCNT_PSE_R_MEM_WORDS, V3D_PERFCNT_TLB_R_MEM_WORDS, V3D_PERFCNT_TMU_MRU_HITS, V3D_PERFCNT_COMPUTE_ACTIVE, V3D_PERFCNT_NUM, }; #define DRM_V3D_MAX_PERF_COUNTERS 32 struct drm_v3d_perfmon_create { __u32 id; __u32 ncounters; __u8 counters[DRM_V3D_MAX_PERF_COUNTERS]; }; struct drm_v3d_perfmon_destroy { __u32 id; }; /* * Returns the values of the performance counters tracked by this * perfmon (as an array of ncounters u64 values). * * No implicit synchronization is performed, so the user has to * guarantee that any jobs using this perfmon have already been * completed (probably by blocking on the seqno returned by the * last exec that used the perfmon). */ struct drm_v3d_perfmon_get_values { __u32 id; __u32 pad; __u64 values_ptr; }; #if defined(__cplusplus) } #endif #endif /* _V3D_DRM_H_ */ drm/vc4_drm.h 0000644 00000034171 15063602046 0007045 0 ustar 00 /* * Copyright © 2014-2015 Broadcom * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _VC4_DRM_H_ #define _VC4_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_VC4_SUBMIT_CL 0x00 #define DRM_VC4_WAIT_SEQNO 0x01 #define DRM_VC4_WAIT_BO 0x02 #define DRM_VC4_CREATE_BO 0x03 #define DRM_VC4_MMAP_BO 0x04 #define DRM_VC4_CREATE_SHADER_BO 0x05 #define DRM_VC4_GET_HANG_STATE 0x06 #define DRM_VC4_GET_PARAM 0x07 #define DRM_VC4_SET_TILING 0x08 #define DRM_VC4_GET_TILING 0x09 #define DRM_VC4_LABEL_BO 0x0a #define DRM_VC4_GEM_MADVISE 0x0b #define DRM_VC4_PERFMON_CREATE 0x0c #define DRM_VC4_PERFMON_DESTROY 0x0d #define DRM_VC4_PERFMON_GET_VALUES 0x0e #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) #define DRM_IOCTL_VC4_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_BO, struct drm_vc4_wait_bo) #define DRM_IOCTL_VC4_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_BO, struct drm_vc4_create_bo) #define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) #define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) #define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) #define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) #define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) #define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) #define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) #define DRM_IOCTL_VC4_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GEM_MADVISE, struct drm_vc4_gem_madvise) #define DRM_IOCTL_VC4_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_CREATE, struct drm_vc4_perfmon_create) #define DRM_IOCTL_VC4_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_DESTROY, struct drm_vc4_perfmon_destroy) #define DRM_IOCTL_VC4_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_PERFMON_GET_VALUES, struct drm_vc4_perfmon_get_values) struct drm_vc4_submit_rcl_surface { __u32 hindex; /* Handle index, or ~0 if not present. */ __u32 offset; /* Offset to start of buffer. */ /* * Bits for either render config (color_write) or load/store packet. * Bits should all be 0 for MSAA load/stores. */ __u16 bits; #define VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES (1 << 0) __u16 flags; }; /** * struct drm_vc4_submit_cl - ioctl argument for submitting commands to the 3D * engine. * * Drivers typically use GPU BOs to store batchbuffers / command lists and * their associated state. However, because the VC4 lacks an MMU, we have to * do validation of memory accesses by the GPU commands. If we were to store * our commands in BOs, we'd need to do uncached readback from them to do the * validation process, which is too expensive. Instead, userspace accumulates * commands and associated state in plain memory, then the kernel copies the * data to its own address space, and then validates and stores it in a GPU * BO. */ struct drm_vc4_submit_cl { /* Pointer to the binner command list. * * This is the first set of commands executed, which runs the * coordinate shader to determine where primitives land on the screen, * then writes out the state updates and draw calls necessary per tile * to the tile allocation BO. */ __u64 bin_cl; /* Pointer to the shader records. * * Shader records are the structures read by the hardware that contain * pointers to uniforms, shaders, and vertex attributes. The * reference to the shader record has enough information to determine * how many pointers are necessary (fixed number for shaders/uniforms, * and an attribute count), so those BO indices into bo_handles are * just stored as __u32s before each shader record passed in. */ __u64 shader_rec; /* Pointer to uniform data and texture handles for the textures * referenced by the shader. * * For each shader state record, there is a set of uniform data in the * order referenced by the record (FS, VS, then CS). Each set of * uniform data has a __u32 index into bo_handles per texture * sample operation, in the order the QPU_W_TMUn_S writes appear in * the program. Following the texture BO handle indices is the actual * uniform data. * * The individual uniform state blocks don't have sizes passed in, * because the kernel has to determine the sizes anyway during shader * code validation. */ __u64 uniforms; __u64 bo_handles; /* Size in bytes of the binner command list. */ __u32 bin_cl_size; /* Size in bytes of the set of shader records. */ __u32 shader_rec_size; /* Number of shader records. * * This could just be computed from the contents of shader_records and * the address bits of references to them from the bin CL, but it * keeps the kernel from having to resize some allocations it makes. */ __u32 shader_rec_count; /* Size in bytes of the uniform state. */ __u32 uniforms_size; /* Number of BO handles passed in (size is that times 4). */ __u32 bo_handle_count; /* RCL setup: */ __u16 width; __u16 height; __u8 min_x_tile; __u8 min_y_tile; __u8 max_x_tile; __u8 max_y_tile; struct drm_vc4_submit_rcl_surface color_read; struct drm_vc4_submit_rcl_surface color_write; struct drm_vc4_submit_rcl_surface zs_read; struct drm_vc4_submit_rcl_surface zs_write; struct drm_vc4_submit_rcl_surface msaa_color_write; struct drm_vc4_submit_rcl_surface msaa_zs_write; __u32 clear_color[2]; __u32 clear_z; __u8 clear_s; __u32 pad:24; #define VC4_SUBMIT_CL_USE_CLEAR_COLOR (1 << 0) /* By default, the kernel gets to choose the order that the tiles are * rendered in. If this is set, then the tiles will be rendered in a * raster order, with the right-to-left vs left-to-right and * top-to-bottom vs bottom-to-top dictated by * VC4_SUBMIT_CL_RCL_ORDER_INCREASING_*. This allows overlapping * blits to be implemented using the 3D engine. */ #define VC4_SUBMIT_CL_FIXED_RCL_ORDER (1 << 1) #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X (1 << 2) #define VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y (1 << 3) __u32 flags; /* Returned value of the seqno of this render job (for the * wait ioctl). */ __u64 seqno; /* ID of the perfmon to attach to this job. 0 means no perfmon. */ __u32 perfmonid; /* Syncobj handle to wait on. If set, processing of this render job * will not start until the syncobj is signaled. 0 means ignore. */ __u32 in_sync; /* Syncobj handle to export fence to. If set, the fence in the syncobj * will be replaced with a fence that signals upon completion of this * render job. 0 means ignore. */ __u32 out_sync; __u32 pad2; }; /** * struct drm_vc4_wait_seqno - ioctl argument for waiting for * DRM_VC4_SUBMIT_CL completion using its returned seqno. * * timeout_ns is the timeout in nanoseconds, where "0" means "don't * block, just return the status." */ struct drm_vc4_wait_seqno { __u64 seqno; __u64 timeout_ns; }; /** * struct drm_vc4_wait_bo - ioctl argument for waiting for * completion of the last DRM_VC4_SUBMIT_CL on a BO. * * This is useful for cases where multiple processes might be * rendering to a BO and you want to wait for all rendering to be * completed. */ struct drm_vc4_wait_bo { __u32 handle; __u32 pad; __u64 timeout_ns; }; /** * struct drm_vc4_create_bo - ioctl argument for creating VC4 BOs. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_vc4_create_bo { __u32 size; __u32 flags; /** Returned GEM handle for the BO. */ __u32 handle; __u32 pad; }; /** * struct drm_vc4_mmap_bo - ioctl argument for mapping VC4 BOs. * * This doesn't actually perform an mmap. Instead, it returns the * offset you need to use in an mmap on the DRM device node. This * means that tools like valgrind end up knowing about the mapped * memory. * * There are currently no values for the flags argument, but it may be * used in a future extension. */ struct drm_vc4_mmap_bo { /** Handle for the object being mapped. */ __u32 handle; __u32 flags; /** offset into the drm node to use for subsequent mmap call. */ __u64 offset; }; /** * struct drm_vc4_create_shader_bo - ioctl argument for creating VC4 * shader BOs. * * Since allowing a shader to be overwritten while it's also being * executed from would allow privlege escalation, shaders must be * created using this ioctl, and they can't be mmapped later. */ struct drm_vc4_create_shader_bo { /* Size of the data argument. */ __u32 size; /* Flags, currently must be 0. */ __u32 flags; /* Pointer to the data. */ __u64 data; /** Returned GEM handle for the BO. */ __u32 handle; /* Pad, must be 0. */ __u32 pad; }; struct drm_vc4_get_hang_state_bo { __u32 handle; __u32 paddr; __u32 size; __u32 pad; }; /** * struct drm_vc4_hang_state - ioctl argument for collecting state * from a GPU hang for analysis. */ struct drm_vc4_get_hang_state { /** Pointer to array of struct drm_vc4_get_hang_state_bo. */ __u64 bo; /** * On input, the size of the bo array. Output is the number * of bos to be returned. */ __u32 bo_count; __u32 start_bin, start_render; __u32 ct0ca, ct0ea; __u32 ct1ca, ct1ea; __u32 ct0cs, ct1cs; __u32 ct0ra0, ct1ra0; __u32 bpca, bpcs; __u32 bpoa, bpos; __u32 vpmbase; __u32 dbge; __u32 fdbgo; __u32 fdbgb; __u32 fdbgr; __u32 fdbgs; __u32 errstat; /* Pad that we may save more registers into in the future. */ __u32 pad[16]; }; #define DRM_VC4_PARAM_V3D_IDENT0 0 #define DRM_VC4_PARAM_V3D_IDENT1 1 #define DRM_VC4_PARAM_V3D_IDENT2 2 #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 #define DRM_VC4_PARAM_SUPPORTS_ETC1 4 #define DRM_VC4_PARAM_SUPPORTS_THREADED_FS 5 #define DRM_VC4_PARAM_SUPPORTS_FIXED_RCL_ORDER 6 #define DRM_VC4_PARAM_SUPPORTS_MADVISE 7 #define DRM_VC4_PARAM_SUPPORTS_PERFMON 8 struct drm_vc4_get_param { __u32 param; __u32 pad; __u64 value; }; struct drm_vc4_get_tiling { __u32 handle; __u32 flags; __u64 modifier; }; struct drm_vc4_set_tiling { __u32 handle; __u32 flags; __u64 modifier; }; /** * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. */ struct drm_vc4_label_bo { __u32 handle; __u32 len; __u64 name; }; /* * States prefixed with '__' are internal states and cannot be passed to the * DRM_IOCTL_VC4_GEM_MADVISE ioctl. */ #define VC4_MADV_WILLNEED 0 #define VC4_MADV_DONTNEED 1 #define __VC4_MADV_PURGED 2 #define __VC4_MADV_NOTSUPP 3 struct drm_vc4_gem_madvise { __u32 handle; __u32 madv; __u32 retained; __u32 pad; }; enum { VC4_PERFCNT_FEP_VALID_PRIMS_NO_RENDER, VC4_PERFCNT_FEP_VALID_PRIMS_RENDER, VC4_PERFCNT_FEP_CLIPPED_QUADS, VC4_PERFCNT_FEP_VALID_QUADS, VC4_PERFCNT_TLB_QUADS_NOT_PASSING_STENCIL, VC4_PERFCNT_TLB_QUADS_NOT_PASSING_Z_AND_STENCIL, VC4_PERFCNT_TLB_QUADS_PASSING_Z_AND_STENCIL, VC4_PERFCNT_TLB_QUADS_ZERO_COVERAGE, VC4_PERFCNT_TLB_QUADS_NON_ZERO_COVERAGE, VC4_PERFCNT_TLB_QUADS_WRITTEN_TO_COLOR_BUF, VC4_PERFCNT_PLB_PRIMS_OUTSIDE_VIEWPORT, VC4_PERFCNT_PLB_PRIMS_NEED_CLIPPING, VC4_PERFCNT_PSE_PRIMS_REVERSED, VC4_PERFCNT_QPU_TOTAL_IDLE_CYCLES, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_FRAGMENT_SHADING, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_EXEC_VALID_INST, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_TMUS, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD, VC4_PERFCNT_QPU_TOTAL_CLK_CYCLES_WAITING_VARYINGS, VC4_PERFCNT_QPU_TOTAL_INST_CACHE_HIT, VC4_PERFCNT_QPU_TOTAL_INST_CACHE_MISS, VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_HIT, VC4_PERFCNT_QPU_TOTAL_UNIFORM_CACHE_MISS, VC4_PERFCNT_TMU_TOTAL_TEXT_QUADS_PROCESSED, VC4_PERFCNT_TMU_TOTAL_TEXT_CACHE_MISS, VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VDW_STALLED, VC4_PERFCNT_VPM_TOTAL_CLK_CYCLES_VCD_STALLED, VC4_PERFCNT_L2C_TOTAL_L2_CACHE_HIT, VC4_PERFCNT_L2C_TOTAL_L2_CACHE_MISS, VC4_PERFCNT_NUM_EVENTS, }; #define DRM_VC4_MAX_PERF_COUNTERS 16 struct drm_vc4_perfmon_create { __u32 id; __u32 ncounters; __u8 events[DRM_VC4_MAX_PERF_COUNTERS]; }; struct drm_vc4_perfmon_destroy { __u32 id; }; /* * Returns the values of the performance counters tracked by this * perfmon (as an array of ncounters u64 values). * * No implicit synchronization is performed, so the user has to * guarantee that any jobs using this perfmon have already been * completed (probably by blocking on the seqno returned by the * last exec that used the perfmon). */ struct drm_vc4_perfmon_get_values { __u32 id; __u64 values_ptr; }; #if defined(__cplusplus) } #endif #endif /* _VC4_DRM_H_ */ drm/vgem_drm.h 0000644 00000003663 15063602046 0007311 0 ustar 00 /* * Copyright 2016 Intel Corporation * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _VGEM_DRM_H_ #define _VGEM_DRM_H_ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. */ #define DRM_VGEM_FENCE_ATTACH 0x1 #define DRM_VGEM_FENCE_SIGNAL 0x2 #define DRM_IOCTL_VGEM_FENCE_ATTACH DRM_IOWR( DRM_COMMAND_BASE + DRM_VGEM_FENCE_ATTACH, struct drm_vgem_fence_attach) #define DRM_IOCTL_VGEM_FENCE_SIGNAL DRM_IOW( DRM_COMMAND_BASE + DRM_VGEM_FENCE_SIGNAL, struct drm_vgem_fence_signal) struct drm_vgem_fence_attach { __u32 handle; __u32 flags; #define VGEM_FENCE_WRITE 0x1 __u32 out_fence; __u32 pad; }; struct drm_vgem_fence_signal { __u32 fence; __u32 flags; }; #if defined(__cplusplus) } #endif #endif /* _VGEM_DRM_H_ */ drm/virtgpu_drm.h 0000644 00000016254 15063602046 0010053 0 ustar 00 /* * Copyright 2013 Red Hat * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef VIRTGPU_DRM_H #define VIRTGPU_DRM_H #include "drm.h" #if defined(__cplusplus) extern "C" { #endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. * * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel * compatibility Keep fields aligned to their size */ #define DRM_VIRTGPU_MAP 0x01 #define DRM_VIRTGPU_EXECBUFFER 0x02 #define DRM_VIRTGPU_GETPARAM 0x03 #define DRM_VIRTGPU_RESOURCE_CREATE 0x04 #define DRM_VIRTGPU_RESOURCE_INFO 0x05 #define DRM_VIRTGPU_TRANSFER_FROM_HOST 0x06 #define DRM_VIRTGPU_TRANSFER_TO_HOST 0x07 #define DRM_VIRTGPU_WAIT 0x08 #define DRM_VIRTGPU_GET_CAPS 0x09 #define DRM_VIRTGPU_RESOURCE_CREATE_BLOB 0x0a #define DRM_VIRTGPU_CONTEXT_INIT 0x0b #define VIRTGPU_EXECBUF_FENCE_FD_IN 0x01 #define VIRTGPU_EXECBUF_FENCE_FD_OUT 0x02 #define VIRTGPU_EXECBUF_RING_IDX 0x04 #define VIRTGPU_EXECBUF_FLAGS (\ VIRTGPU_EXECBUF_FENCE_FD_IN |\ VIRTGPU_EXECBUF_FENCE_FD_OUT |\ VIRTGPU_EXECBUF_RING_IDX |\ 0) struct drm_virtgpu_map { __u64 offset; /* use for mmap system call */ __u32 handle; __u32 pad; }; /* fence_fd is modified on success if VIRTGPU_EXECBUF_FENCE_FD_OUT flag is set. */ struct drm_virtgpu_execbuffer { __u32 flags; __u32 size; __u64 command; /* void* */ __u64 bo_handles; __u32 num_bo_handles; __s32 fence_fd; /* in/out fence fd (see VIRTGPU_EXECBUF_FENCE_FD_IN/OUT) */ __u32 ring_idx; /* command ring index (see VIRTGPU_EXECBUF_RING_IDX) */ __u32 pad; }; #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */ #define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */ #define VIRTGPU_PARAM_RESOURCE_BLOB 3 /* DRM_VIRTGPU_RESOURCE_CREATE_BLOB */ #define VIRTGPU_PARAM_HOST_VISIBLE 4 /* Host blob resources are mappable */ #define VIRTGPU_PARAM_CROSS_DEVICE 5 /* Cross virtio-device resource sharing */ #define VIRTGPU_PARAM_CONTEXT_INIT 6 /* DRM_VIRTGPU_CONTEXT_INIT */ #define VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs 7 /* Bitmask of supported capability set ids */ struct drm_virtgpu_getparam { __u64 param; __u64 value; }; /* NO_BO flags? NO resource flag? */ /* resource flag for y_0_top */ struct drm_virtgpu_resource_create { __u32 target; __u32 format; __u32 bind; __u32 width; __u32 height; __u32 depth; __u32 array_size; __u32 last_level; __u32 nr_samples; __u32 flags; __u32 bo_handle; /* if this is set - recreate a new resource attached to this bo ? */ __u32 res_handle; /* returned by kernel */ __u32 size; /* validate transfer in the host */ __u32 stride; /* validate transfer in the host */ }; struct drm_virtgpu_resource_info { __u32 bo_handle; __u32 res_handle; __u32 size; __u32 blob_mem; }; struct drm_virtgpu_3d_box { __u32 x; __u32 y; __u32 z; __u32 w; __u32 h; __u32 d; }; struct drm_virtgpu_3d_transfer_to_host { __u32 bo_handle; struct drm_virtgpu_3d_box box; __u32 level; __u32 offset; __u32 stride; __u32 layer_stride; }; struct drm_virtgpu_3d_transfer_from_host { __u32 bo_handle; struct drm_virtgpu_3d_box box; __u32 level; __u32 offset; __u32 stride; __u32 layer_stride; }; #define VIRTGPU_WAIT_NOWAIT 1 /* like it */ struct drm_virtgpu_3d_wait { __u32 handle; /* 0 is an invalid handle */ __u32 flags; }; struct drm_virtgpu_get_caps { __u32 cap_set_id; __u32 cap_set_ver; __u64 addr; __u32 size; __u32 pad; }; struct drm_virtgpu_resource_create_blob { #define VIRTGPU_BLOB_MEM_GUEST 0x0001 #define VIRTGPU_BLOB_MEM_HOST3D 0x0002 #define VIRTGPU_BLOB_MEM_HOST3D_GUEST 0x0003 #define VIRTGPU_BLOB_FLAG_USE_MAPPABLE 0x0001 #define VIRTGPU_BLOB_FLAG_USE_SHAREABLE 0x0002 #define VIRTGPU_BLOB_FLAG_USE_CROSS_DEVICE 0x0004 /* zero is invalid blob_mem */ __u32 blob_mem; __u32 blob_flags; __u32 bo_handle; __u32 res_handle; __u64 size; /* * for 3D contexts with VIRTGPU_BLOB_MEM_HOST3D_GUEST and * VIRTGPU_BLOB_MEM_HOST3D otherwise, must be zero. */ __u32 pad; __u32 cmd_size; __u64 cmd; __u64 blob_id; }; #define VIRTGPU_CONTEXT_PARAM_CAPSET_ID 0x0001 #define VIRTGPU_CONTEXT_PARAM_NUM_RINGS 0x0002 #define VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK 0x0003 struct drm_virtgpu_context_set_param { __u64 param; __u64 value; }; struct drm_virtgpu_context_init { __u32 num_params; __u32 pad; /* pointer to drm_virtgpu_context_set_param array */ __u64 ctx_set_params; }; /* * Event code that's given when VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK is in * effect. The event size is sizeof(drm_event), since there is no additional * payload. */ #define VIRTGPU_EVENT_FENCE_SIGNALED 0x90000000 #define DRM_IOCTL_VIRTGPU_MAP \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map) #define DRM_IOCTL_VIRTGPU_EXECBUFFER \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_EXECBUFFER,\ struct drm_virtgpu_execbuffer) #define DRM_IOCTL_VIRTGPU_GETPARAM \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GETPARAM,\ struct drm_virtgpu_getparam) #define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE, \ struct drm_virtgpu_resource_create) #define DRM_IOCTL_VIRTGPU_RESOURCE_INFO \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_INFO, \ struct drm_virtgpu_resource_info) #define DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_TRANSFER_FROM_HOST, \ struct drm_virtgpu_3d_transfer_from_host) #define DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_TRANSFER_TO_HOST, \ struct drm_virtgpu_3d_transfer_to_host) #define DRM_IOCTL_VIRTGPU_WAIT \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_WAIT, \ struct drm_virtgpu_3d_wait) #define DRM_IOCTL_VIRTGPU_GET_CAPS \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GET_CAPS, \ struct drm_virtgpu_get_caps) #define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE_BLOB, \ struct drm_virtgpu_resource_create_blob) #define DRM_IOCTL_VIRTGPU_CONTEXT_INIT \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_CONTEXT_INIT, \ struct drm_virtgpu_context_init) #if defined(__cplusplus) } #endif #endif drm/vmwgfx_drm.h 0000644 00000111147 15063602046 0007666 0 ustar 00 /************************************************************************** * * Copyright © 2009-2022 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ #ifndef __VMWGFX_DRM_H__ #define __VMWGFX_DRM_H__ #include "drm.h" #if defined(__cplusplus) extern "C" { #endif #define DRM_VMW_MAX_SURFACE_FACES 6 #define DRM_VMW_MAX_MIP_LEVELS 24 #define DRM_VMW_GET_PARAM 0 #define DRM_VMW_ALLOC_DMABUF 1 #define DRM_VMW_ALLOC_BO 1 #define DRM_VMW_UNREF_DMABUF 2 #define DRM_VMW_HANDLE_CLOSE 2 #define DRM_VMW_CURSOR_BYPASS 3 /* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ #define DRM_VMW_CONTROL_STREAM 4 #define DRM_VMW_CLAIM_STREAM 5 #define DRM_VMW_UNREF_STREAM 6 /* guarded by DRM_VMW_PARAM_3D == 1 */ #define DRM_VMW_CREATE_CONTEXT 7 #define DRM_VMW_UNREF_CONTEXT 8 #define DRM_VMW_CREATE_SURFACE 9 #define DRM_VMW_UNREF_SURFACE 10 #define DRM_VMW_REF_SURFACE 11 #define DRM_VMW_EXECBUF 12 #define DRM_VMW_GET_3D_CAP 13 #define DRM_VMW_FENCE_WAIT 14 #define DRM_VMW_FENCE_SIGNALED 15 #define DRM_VMW_FENCE_UNREF 16 #define DRM_VMW_FENCE_EVENT 17 #define DRM_VMW_PRESENT 18 #define DRM_VMW_PRESENT_READBACK 19 #define DRM_VMW_UPDATE_LAYOUT 20 #define DRM_VMW_CREATE_SHADER 21 #define DRM_VMW_UNREF_SHADER 22 #define DRM_VMW_GB_SURFACE_CREATE 23 #define DRM_VMW_GB_SURFACE_REF 24 #define DRM_VMW_SYNCCPU 25 #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26 #define DRM_VMW_GB_SURFACE_CREATE_EXT 27 #define DRM_VMW_GB_SURFACE_REF_EXT 28 #define DRM_VMW_MSG 29 #define DRM_VMW_MKSSTAT_RESET 30 #define DRM_VMW_MKSSTAT_ADD 31 #define DRM_VMW_MKSSTAT_REMOVE 32 /*************************************************************************/ /** * DRM_VMW_GET_PARAM - get device information. * * DRM_VMW_PARAM_FIFO_OFFSET: * Offset to use to map the first page of the FIFO read-only. * The fifo is mapped using the mmap() system call on the drm device. * * DRM_VMW_PARAM_OVERLAY_IOCTL: * Does the driver support the overlay ioctl. * * DRM_VMW_PARAM_SM4_1 * SM4_1 support is enabled. * * DRM_VMW_PARAM_SM5 * SM5 support is enabled. * * DRM_VMW_PARAM_GL43 * SM5.1+GL4.3 support is enabled. * * DRM_VMW_PARAM_DEVICE_ID * PCI ID of the underlying SVGA device. */ #define DRM_VMW_PARAM_NUM_STREAMS 0 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 #define DRM_VMW_PARAM_3D 2 #define DRM_VMW_PARAM_HW_CAPS 3 #define DRM_VMW_PARAM_FIFO_CAPS 4 #define DRM_VMW_PARAM_MAX_FB_SIZE 5 #define DRM_VMW_PARAM_FIFO_HW_VERSION 6 #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7 #define DRM_VMW_PARAM_3D_CAPS_SIZE 8 #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9 #define DRM_VMW_PARAM_MAX_MOB_SIZE 10 #define DRM_VMW_PARAM_SCREEN_TARGET 11 #define DRM_VMW_PARAM_DX 12 #define DRM_VMW_PARAM_HW_CAPS2 13 #define DRM_VMW_PARAM_SM4_1 14 #define DRM_VMW_PARAM_SM5 15 #define DRM_VMW_PARAM_GL43 16 #define DRM_VMW_PARAM_DEVICE_ID 17 /** * enum drm_vmw_handle_type - handle type for ref ioctls * */ enum drm_vmw_handle_type { DRM_VMW_HANDLE_LEGACY = 0, DRM_VMW_HANDLE_PRIME = 1 }; /** * struct drm_vmw_getparam_arg * * @value: Returned value. //Out * @param: Parameter to query. //In. * * Argument to the DRM_VMW_GET_PARAM Ioctl. */ struct drm_vmw_getparam_arg { __u64 value; __u32 param; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_CREATE_CONTEXT - Create a host context. * * Allocates a device unique context id, and queues a create context command * for the host. Does not wait for host completion. */ /** * struct drm_vmw_context_arg * * @cid: Device unique context ID. * * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. */ struct drm_vmw_context_arg { __s32 cid; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_UNREF_CONTEXT - Create a host context. * * Frees a global context id, and queues a destroy host command for the host. * Does not wait for host completion. The context ID can be used directly * in the command stream and shows up as the same context ID on the host. */ /*************************************************************************/ /** * DRM_VMW_CREATE_SURFACE - Create a host suface. * * Allocates a device unique surface id, and queues a create surface command * for the host. Does not wait for host completion. The surface ID can be * used directly in the command stream and shows up as the same surface * ID on the host. */ /** * struct drm_wmv_surface_create_req * * @flags: Surface flags as understood by the host. * @format: Surface format as understood by the host. * @mip_levels: Number of mip levels for each face. * An unused face should have 0 encoded. * @size_addr: Address of a user-space array of sruct drm_vmw_size * cast to an __u64 for 32-64 bit compatibility. * The size of the array should equal the total number of mipmap levels. * @shareable: Boolean whether other clients (as identified by file descriptors) * may reference this surface. * @scanout: Boolean whether the surface is intended to be used as a * scanout. * * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. * Output data from the DRM_VMW_REF_SURFACE Ioctl. */ struct drm_vmw_surface_create_req { __u32 flags; __u32 format; __u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES]; __u64 size_addr; __s32 shareable; __s32 scanout; }; /** * struct drm_wmv_surface_arg * * @sid: Surface id of created surface or surface to destroy or reference. * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl. * * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. * Input argument to the DRM_VMW_REF_SURFACE Ioctl. */ struct drm_vmw_surface_arg { __s32 sid; enum drm_vmw_handle_type handle_type; }; /** * struct drm_vmw_size ioctl. * * @width - mip level width * @height - mip level height * @depth - mip level depth * * Description of a mip level. * Input data to the DRM_WMW_CREATE_SURFACE Ioctl. */ struct drm_vmw_size { __u32 width; __u32 height; __u32 depth; __u32 pad64; }; /** * union drm_vmw_surface_create_arg * * @rep: Output data as described above. * @req: Input data as described above. * * Argument to the DRM_VMW_CREATE_SURFACE Ioctl. */ union drm_vmw_surface_create_arg { struct drm_vmw_surface_arg rep; struct drm_vmw_surface_create_req req; }; /*************************************************************************/ /** * DRM_VMW_REF_SURFACE - Reference a host surface. * * Puts a reference on a host surface with a give sid, as previously * returned by the DRM_VMW_CREATE_SURFACE ioctl. * A reference will make sure the surface isn't destroyed while we hold * it and will allow the calling client to use the surface ID in the command * stream. * * On successful return, the Ioctl returns the surface information given * in the DRM_VMW_CREATE_SURFACE ioctl. */ /** * union drm_vmw_surface_reference_arg * * @rep: Output data as described above. * @req: Input data as described above. * * Argument to the DRM_VMW_REF_SURFACE Ioctl. */ union drm_vmw_surface_reference_arg { struct drm_vmw_surface_create_req rep; struct drm_vmw_surface_arg req; }; /*************************************************************************/ /** * DRM_VMW_UNREF_SURFACE - Unreference a host surface. * * Clear a reference previously put on a host surface. * When all references are gone, including the one implicitly placed * on creation, * a destroy surface command will be queued for the host. * Does not wait for completion. */ /*************************************************************************/ /** * DRM_VMW_EXECBUF * * Submit a command buffer for execution on the host, and return a * fence seqno that when signaled, indicates that the command buffer has * executed. */ /** * struct drm_vmw_execbuf_arg * * @commands: User-space address of a command buffer cast to an __u64. * @command-size: Size in bytes of the command buffer. * @throttle-us: Sleep until software is less than @throttle_us * microseconds ahead of hardware. The driver may round this value * to the nearest kernel tick. * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an * __u64. * @version: Allows expanding the execbuf ioctl parameters without breaking * backwards compatibility, since user-space will always tell the kernel * which version it uses. * @flags: Execbuf flags. * @imported_fence_fd: FD for a fence imported from another device * * Argument to the DRM_VMW_EXECBUF Ioctl. */ #define DRM_VMW_EXECBUF_VERSION 2 #define DRM_VMW_EXECBUF_FLAG_IMPORT_FENCE_FD (1 << 0) #define DRM_VMW_EXECBUF_FLAG_EXPORT_FENCE_FD (1 << 1) struct drm_vmw_execbuf_arg { __u64 commands; __u32 command_size; __u32 throttle_us; __u64 fence_rep; __u32 version; __u32 flags; __u32 context_handle; __s32 imported_fence_fd; }; /** * struct drm_vmw_fence_rep * * @handle: Fence object handle for fence associated with a command submission. * @mask: Fence flags relevant for this fence object. * @seqno: Fence sequence number in fifo. A fence object with a lower * seqno will signal the EXEC flag before a fence object with a higher * seqno. This can be used by user-space to avoid kernel calls to determine * whether a fence has signaled the EXEC flag. Note that @seqno will * wrap at 32-bit. * @passed_seqno: The highest seqno number processed by the hardware * so far. This can be used to mark user-space fence objects as signaled, and * to determine whether a fence seqno might be stale. * @fd: FD associated with the fence, -1 if not exported * @error: This member should've been set to -EFAULT on submission. * The following actions should be take on completion: * error == -EFAULT: Fence communication failed. The host is synchronized. * Use the last fence id read from the FIFO fence register. * error != 0 && error != -EFAULT: * Fence submission failed. The host is synchronized. Use the fence_seq member. * error == 0: All is OK, The host may not be synchronized. * Use the fence_seq member. * * Input / Output data to the DRM_VMW_EXECBUF Ioctl. */ struct drm_vmw_fence_rep { __u32 handle; __u32 mask; __u32 seqno; __u32 passed_seqno; __s32 fd; __s32 error; }; /*************************************************************************/ /** * DRM_VMW_ALLOC_BO * * Allocate a buffer object that is visible also to the host. * NOTE: The buffer is * identified by a handle and an offset, which are private to the guest, but * useable in the command stream. The guest kernel may translate these * and patch up the command stream accordingly. In the future, the offset may * be zero at all times, or it may disappear from the interface before it is * fixed. * * The buffer object may stay user-space mapped in the guest at all times, * and is thus suitable for sub-allocation. * * Buffer objects are mapped using the mmap() syscall on the drm device. */ /** * struct drm_vmw_alloc_bo_req * * @size: Required minimum size of the buffer. * * Input data to the DRM_VMW_ALLOC_BO Ioctl. */ struct drm_vmw_alloc_bo_req { __u32 size; __u32 pad64; }; #define drm_vmw_alloc_dmabuf_req drm_vmw_alloc_bo_req /** * struct drm_vmw_bo_rep * * @map_handle: Offset to use in the mmap() call used to map the buffer. * @handle: Handle unique to this buffer. Used for unreferencing. * @cur_gmr_id: GMR id to use in the command stream when this buffer is * referenced. See not above. * @cur_gmr_offset: Offset to use in the command stream when this buffer is * referenced. See note above. * * Output data from the DRM_VMW_ALLOC_BO Ioctl. */ struct drm_vmw_bo_rep { __u64 map_handle; __u32 handle; __u32 cur_gmr_id; __u32 cur_gmr_offset; __u32 pad64; }; #define drm_vmw_dmabuf_rep drm_vmw_bo_rep /** * union drm_vmw_alloc_bo_arg * * @req: Input data as described above. * @rep: Output data as described above. * * Argument to the DRM_VMW_ALLOC_BO Ioctl. */ union drm_vmw_alloc_bo_arg { struct drm_vmw_alloc_bo_req req; struct drm_vmw_bo_rep rep; }; #define drm_vmw_alloc_dmabuf_arg drm_vmw_alloc_bo_arg /*************************************************************************/ /** * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. * * This IOCTL controls the overlay units of the svga device. * The SVGA overlay units does not work like regular hardware units in * that they do not automaticaly read back the contents of the given dma * buffer. But instead only read back for each call to this ioctl, and * at any point between this call being made and a following call that * either changes the buffer or disables the stream. */ /** * struct drm_vmw_rect * * Defines a rectangle. Used in the overlay ioctl to define * source and destination rectangle. */ struct drm_vmw_rect { __s32 x; __s32 y; __u32 w; __u32 h; }; /** * struct drm_vmw_control_stream_arg * * @stream_id: Stearm to control * @enabled: If false all following arguments are ignored. * @handle: Handle to buffer for getting data from. * @format: Format of the overlay as understood by the host. * @width: Width of the overlay. * @height: Height of the overlay. * @size: Size of the overlay in bytes. * @pitch: Array of pitches, the two last are only used for YUV12 formats. * @offset: Offset from start of dma buffer to overlay. * @src: Source rect, must be within the defined area above. * @dst: Destination rect, x and y may be negative. * * Argument to the DRM_VMW_CONTROL_STREAM Ioctl. */ struct drm_vmw_control_stream_arg { __u32 stream_id; __u32 enabled; __u32 flags; __u32 color_key; __u32 handle; __u32 offset; __s32 format; __u32 size; __u32 width; __u32 height; __u32 pitch[3]; __u32 pad64; struct drm_vmw_rect src; struct drm_vmw_rect dst; }; /*************************************************************************/ /** * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass. * */ #define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0) #define DRM_VMW_CURSOR_BYPASS_FLAGS (1) /** * struct drm_vmw_cursor_bypass_arg * * @flags: Flags. * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed. * @xpos: X position of cursor. * @ypos: Y position of cursor. * @xhot: X hotspot. * @yhot: Y hotspot. * * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl. */ struct drm_vmw_cursor_bypass_arg { __u32 flags; __u32 crtc_id; __s32 xpos; __s32 ypos; __s32 xhot; __s32 yhot; }; /*************************************************************************/ /** * DRM_VMW_CLAIM_STREAM - Claim a single stream. */ /** * struct drm_vmw_context_arg * * @stream_id: Device unique context ID. * * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. */ struct drm_vmw_stream_arg { __u32 stream_id; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_UNREF_STREAM - Unclaim a stream. * * Return a single stream that was claimed by this process. Also makes * sure that the stream has been stopped. */ /*************************************************************************/ /** * DRM_VMW_GET_3D_CAP * * Read 3D capabilities from the FIFO * */ /** * struct drm_vmw_get_3d_cap_arg * * @buffer: Pointer to a buffer for capability data, cast to an __u64 * @size: Max size to copy * * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL * ioctls. */ struct drm_vmw_get_3d_cap_arg { __u64 buffer; __u32 max_size; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_WAIT * * Waits for a fence object to signal. The wait is interruptible, so that * signals may be delivered during the interrupt. The wait may timeout, * in which case the calls returns -EBUSY. If the wait is restarted, * that is restarting without resetting @cookie_valid to zero, * the timeout is computed from the first call. * * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait * on: * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command * stream * have executed. * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish * commands * in the buffer given to the EXECBUF ioctl returning the fence object handle * are available to user-space. * * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the * fenc wait ioctl returns 0, the fence object has been unreferenced after * the wait. */ #define DRM_VMW_FENCE_FLAG_EXEC (1 << 0) #define DRM_VMW_FENCE_FLAG_QUERY (1 << 1) #define DRM_VMW_WAIT_OPTION_UNREF (1 << 0) /** * struct drm_vmw_fence_wait_arg * * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. * @cookie_valid: Must be reset to 0 on first call. Left alone on restart. * @kernel_cookie: Set to 0 on first call. Left alone on restart. * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout. * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick * before returning. * @flags: Fence flags to wait on. * @wait_options: Options that control the behaviour of the wait ioctl. * * Input argument to the DRM_VMW_FENCE_WAIT ioctl. */ struct drm_vmw_fence_wait_arg { __u32 handle; __s32 cookie_valid; __u64 kernel_cookie; __u64 timeout_us; __s32 lazy; __s32 flags; __s32 wait_options; __s32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_SIGNALED * * Checks if a fence object is signaled.. */ /** * struct drm_vmw_fence_signaled_arg * * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl * @signaled: Out: Flags signaled. * @sequence: Out: Highest sequence passed so far. Can be used to signal the * EXEC flag of user-space fence objects. * * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF * ioctls. */ struct drm_vmw_fence_signaled_arg { __u32 handle; __u32 flags; __s32 signaled; __u32 passed_seqno; __u32 signaled_flags; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_UNREF * * Unreferences a fence object, and causes it to be destroyed if there are no * other references to it. * */ /** * struct drm_vmw_fence_arg * * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. * * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl.. */ struct drm_vmw_fence_arg { __u32 handle; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_FENCE_EVENT * * Queues an event on a fence to be delivered on the drm character device * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag. * Optionally the approximate time when the fence signaled is * given by the event. */ /* * The event type */ #define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000 struct drm_vmw_event_fence { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; }; /* * Flags that may be given to the command. */ /* Request fence signaled time on the event. */ #define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0) /** * struct drm_vmw_fence_event_arg * * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if * the fence is not supposed to be referenced by user-space. * @user_info: Info to be delivered with the event. * @handle: Attach the event to this fence only. * @flags: A set of flags as defined above. */ struct drm_vmw_fence_event_arg { __u64 fence_rep; __u64 user_data; __u32 handle; __u32 flags; }; /*************************************************************************/ /** * DRM_VMW_PRESENT * * Executes an SVGA present on a given fb for a given surface. The surface * is placed on the framebuffer. Cliprects are given relative to the given * point (the point disignated by dest_{x|y}). * */ /** * struct drm_vmw_present_arg * @fb_id: framebuffer id to present / read back from. * @sid: Surface id to present from. * @dest_x: X placement coordinate for surface. * @dest_y: Y placement coordinate for surface. * @clips_ptr: Pointer to an array of clip rects cast to an __u64. * @num_clips: Number of cliprects given relative to the framebuffer origin, * in the same coordinate space as the frame buffer. * @pad64: Unused 64-bit padding. * * Input argument to the DRM_VMW_PRESENT ioctl. */ struct drm_vmw_present_arg { __u32 fb_id; __u32 sid; __s32 dest_x; __s32 dest_y; __u64 clips_ptr; __u32 num_clips; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_PRESENT_READBACK * * Executes an SVGA present readback from a given fb to the dma buffer * currently bound as the fb. If there is no dma buffer bound to the fb, * an error will be returned. * */ /** * struct drm_vmw_present_arg * @fb_id: fb_id to present / read back from. * @num_clips: Number of cliprects. * @clips_ptr: Pointer to an array of clip rects cast to an __u64. * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64. * If this member is NULL, then the ioctl should not return a fence. */ struct drm_vmw_present_readback_arg { __u32 fb_id; __u32 num_clips; __u64 clips_ptr; __u64 fence_rep; }; /*************************************************************************/ /** * DRM_VMW_UPDATE_LAYOUT - Update layout * * Updates the preferred modes and connection status for connectors. The * command consists of one drm_vmw_update_layout_arg pointing to an array * of num_outputs drm_vmw_rect's. */ /** * struct drm_vmw_update_layout_arg * * @num_outputs: number of active connectors * @rects: pointer to array of drm_vmw_rect cast to an __u64 * * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl. */ struct drm_vmw_update_layout_arg { __u32 num_outputs; __u32 pad64; __u64 rects; }; /*************************************************************************/ /** * DRM_VMW_CREATE_SHADER - Create shader * * Creates a shader and optionally binds it to a dma buffer containing * the shader byte-code. */ /** * enum drm_vmw_shader_type - Shader types */ enum drm_vmw_shader_type { drm_vmw_shader_type_vs = 0, drm_vmw_shader_type_ps, }; /** * struct drm_vmw_shader_create_arg * * @shader_type: Shader type of the shader to create. * @size: Size of the byte-code in bytes. * where the shader byte-code starts * @buffer_handle: Buffer handle identifying the buffer containing the * shader byte-code * @shader_handle: On successful completion contains a handle that * can be used to subsequently identify the shader. * @offset: Offset in bytes into the buffer given by @buffer_handle, * * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl. */ struct drm_vmw_shader_create_arg { enum drm_vmw_shader_type shader_type; __u32 size; __u32 buffer_handle; __u32 shader_handle; __u64 offset; }; /*************************************************************************/ /** * DRM_VMW_UNREF_SHADER - Unreferences a shader * * Destroys a user-space reference to a shader, optionally destroying * it. */ /** * struct drm_vmw_shader_arg * * @handle: Handle identifying the shader to destroy. * * Input argument to the DRM_VMW_UNREF_SHADER ioctl. */ struct drm_vmw_shader_arg { __u32 handle; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface. * * Allocates a surface handle and queues a create surface command * for the host on the first use of the surface. The surface ID can * be used as the surface ID in commands referencing the surface. */ /** * enum drm_vmw_surface_flags * * @drm_vmw_surface_flag_shareable: Whether the surface is shareable * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout * surface. * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is * given. * @drm_vmw_surface_flag_coherent: Back surface with coherent memory. */ enum drm_vmw_surface_flags { drm_vmw_surface_flag_shareable = (1 << 0), drm_vmw_surface_flag_scanout = (1 << 1), drm_vmw_surface_flag_create_buffer = (1 << 2), drm_vmw_surface_flag_coherent = (1 << 3), }; /** * struct drm_vmw_gb_surface_create_req * * @svga3d_flags: SVGA3d surface flags for the device. * @format: SVGA3d format. * @mip_level: Number of mip levels for all faces. * @drm_surface_flags Flags as described above. * @multisample_count Future use. Set to 0. * @autogen_filter Future use. Set to 0. * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID * if none. * @base_size Size of the base mip level for all faces. * @array_size Must be zero for non-DX hardware, and if non-zero * svga3d_flags must have proper bind flags setup. * * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl. * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl. */ struct drm_vmw_gb_surface_create_req { __u32 svga3d_flags; __u32 format; __u32 mip_levels; enum drm_vmw_surface_flags drm_surface_flags; __u32 multisample_count; __u32 autogen_filter; __u32 buffer_handle; __u32 array_size; struct drm_vmw_size base_size; }; /** * struct drm_vmw_gb_surface_create_rep * * @handle: Surface handle. * @backup_size: Size of backup buffers for this surface. * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none. * @buffer_size: Actual size of the buffer identified by * @buffer_handle * @buffer_map_handle: Offset into device address space for the buffer * identified by @buffer_handle. * * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl. * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl. */ struct drm_vmw_gb_surface_create_rep { __u32 handle; __u32 backup_size; __u32 buffer_handle; __u32 buffer_size; __u64 buffer_map_handle; }; /** * union drm_vmw_gb_surface_create_arg * * @req: Input argument as described above. * @rep: Output argument as described above. * * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl. */ union drm_vmw_gb_surface_create_arg { struct drm_vmw_gb_surface_create_rep rep; struct drm_vmw_gb_surface_create_req req; }; /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_REF - Reference a host surface. * * Puts a reference on a host surface with a given handle, as previously * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl. * A reference will make sure the surface isn't destroyed while we hold * it and will allow the calling client to use the surface handle in * the command stream. * * On successful return, the Ioctl returns the surface information given * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl. */ /** * struct drm_vmw_gb_surface_reference_arg * * @creq: The data used as input when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_req" * @crep: Additional data output when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_rep" * * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl. */ struct drm_vmw_gb_surface_ref_rep { struct drm_vmw_gb_surface_create_req creq; struct drm_vmw_gb_surface_create_rep crep; }; /** * union drm_vmw_gb_surface_reference_arg * * @req: Input data as described above at "struct drm_vmw_surface_arg" * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep" * * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl. */ union drm_vmw_gb_surface_reference_arg { struct drm_vmw_gb_surface_ref_rep rep; struct drm_vmw_surface_arg req; }; /*************************************************************************/ /** * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access. * * Idles any previously submitted GPU operations on the buffer and * by default blocks command submissions that reference the buffer. * If the file descriptor used to grab a blocking CPU sync is closed, the * cpu sync is released. * The flags argument indicates how the grab / release operation should be * performed: */ /** * enum drm_vmw_synccpu_flags - Synccpu flags: * * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a * hint to the kernel to allow command submissions that references the buffer * for read-only. * @drm_vmw_synccpu_write: Sync for write. Block all command submissions * referencing this buffer. * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return * -EBUSY should the buffer be busy. * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer * while the buffer is synced for CPU. This is similar to the GEM bo idle * behavior. */ enum drm_vmw_synccpu_flags { drm_vmw_synccpu_read = (1 << 0), drm_vmw_synccpu_write = (1 << 1), drm_vmw_synccpu_dontblock = (1 << 2), drm_vmw_synccpu_allow_cs = (1 << 3) }; /** * enum drm_vmw_synccpu_op - Synccpu operations: * * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations * @drm_vmw_synccpu_release: Release a previous grab. */ enum drm_vmw_synccpu_op { drm_vmw_synccpu_grab, drm_vmw_synccpu_release }; /** * struct drm_vmw_synccpu_arg * * @op: The synccpu operation as described above. * @handle: Handle identifying the buffer object. * @flags: Flags as described above. */ struct drm_vmw_synccpu_arg { enum drm_vmw_synccpu_op op; enum drm_vmw_synccpu_flags flags; __u32 handle; __u32 pad64; }; /*************************************************************************/ /** * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context. * * Allocates a device unique context id, and queues a create context command * for the host. Does not wait for host completion. */ enum drm_vmw_extended_context { drm_vmw_context_legacy, drm_vmw_context_dx }; /** * union drm_vmw_extended_context_arg * * @req: Context type. * @rep: Context identifier. * * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl. */ union drm_vmw_extended_context_arg { enum drm_vmw_extended_context req; struct drm_vmw_context_arg rep; }; /*************************************************************************/ /* * DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its * underlying resource. * * Note that this ioctl is overlaid on the deprecated DRM_VMW_UNREF_DMABUF * Ioctl. */ /** * struct drm_vmw_handle_close_arg * * @handle: Handle to close. * * Argument to the DRM_VMW_HANDLE_CLOSE Ioctl. */ struct drm_vmw_handle_close_arg { __u32 handle; __u32 pad64; }; #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_CREATE_EXT - Create a host guest-backed surface. * * Allocates a surface handle and queues a create surface command * for the host on the first use of the surface. The surface ID can * be used as the surface ID in commands referencing the surface. * * This new command extends DRM_VMW_GB_SURFACE_CREATE by adding version * parameter and 64 bit svga flag. */ /** * enum drm_vmw_surface_version * * @drm_vmw_surface_gb_v1: Corresponds to current gb surface format with * svga3d surface flags split into 2, upper half and lower half. */ enum drm_vmw_surface_version { drm_vmw_gb_surface_v1, }; /** * struct drm_vmw_gb_surface_create_ext_req * * @base: Surface create parameters. * @version: Version of surface create ioctl. * @svga3d_flags_upper_32_bits: Upper 32 bits of svga3d flags. * @multisample_pattern: Multisampling pattern when msaa is supported. * @quality_level: Precision settings for each sample. * @buffer_byte_stride: Buffer byte stride. * @must_be_zero: Reserved for future usage. * * Input argument to the DRM_VMW_GB_SURFACE_CREATE_EXT Ioctl. * Part of output argument for the DRM_VMW_GB_SURFACE_REF_EXT Ioctl. */ struct drm_vmw_gb_surface_create_ext_req { struct drm_vmw_gb_surface_create_req base; enum drm_vmw_surface_version version; __u32 svga3d_flags_upper_32_bits; __u32 multisample_pattern; __u32 quality_level; __u32 buffer_byte_stride; __u32 must_be_zero; }; /** * union drm_vmw_gb_surface_create_ext_arg * * @req: Input argument as described above. * @rep: Output argument as described above. * * Argument to the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. */ union drm_vmw_gb_surface_create_ext_arg { struct drm_vmw_gb_surface_create_rep rep; struct drm_vmw_gb_surface_create_ext_req req; }; /*************************************************************************/ /** * DRM_VMW_GB_SURFACE_REF_EXT - Reference a host surface. * * Puts a reference on a host surface with a given handle, as previously * returned by the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. * A reference will make sure the surface isn't destroyed while we hold * it and will allow the calling client to use the surface handle in * the command stream. * * On successful return, the Ioctl returns the surface information given * to and returned from the DRM_VMW_GB_SURFACE_CREATE_EXT ioctl. */ /** * struct drm_vmw_gb_surface_ref_ext_rep * * @creq: The data used as input when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_ext_req" * @crep: Additional data output when the surface was created, as described * above at "struct drm_vmw_gb_surface_create_rep" * * Output Argument to the DRM_VMW_GB_SURFACE_REF_EXT ioctl. */ struct drm_vmw_gb_surface_ref_ext_rep { struct drm_vmw_gb_surface_create_ext_req creq; struct drm_vmw_gb_surface_create_rep crep; }; /** * union drm_vmw_gb_surface_reference_ext_arg * * @req: Input data as described above at "struct drm_vmw_surface_arg" * @rep: Output data as described above at * "struct drm_vmw_gb_surface_ref_ext_rep" * * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl. */ union drm_vmw_gb_surface_reference_ext_arg { struct drm_vmw_gb_surface_ref_ext_rep rep; struct drm_vmw_surface_arg req; }; /** * struct drm_vmw_msg_arg * * @send: Pointer to user-space msg string (null terminated). * @receive: Pointer to user-space receive buffer. * @send_only: Boolean whether this is only sending or receiving too. * * Argument to the DRM_VMW_MSG ioctl. */ struct drm_vmw_msg_arg { __u64 send; __u64 receive; __s32 send_only; __u32 receive_len; }; /** * struct drm_vmw_mksstat_add_arg * * @stat: Pointer to user-space stat-counters array, page-aligned. * @info: Pointer to user-space counter-infos array, page-aligned. * @strs: Pointer to user-space stat strings, page-aligned. * @stat_len: Length in bytes of stat-counters array. * @info_len: Length in bytes of counter-infos array. * @strs_len: Length in bytes of the stat strings, terminators included. * @description: Pointer to instance descriptor string; will be truncated * to MKS_GUEST_STAT_INSTANCE_DESC_LENGTH chars. * @id: Output identifier of the produced record; -1 if error. * * Argument to the DRM_VMW_MKSSTAT_ADD ioctl. */ struct drm_vmw_mksstat_add_arg { __u64 stat; __u64 info; __u64 strs; __u64 stat_len; __u64 info_len; __u64 strs_len; __u64 description; __u64 id; }; /** * struct drm_vmw_mksstat_remove_arg * * @id: Identifier of the record being disposed, originally obtained through * DRM_VMW_MKSSTAT_ADD ioctl. * * Argument to the DRM_VMW_MKSSTAT_REMOVE ioctl. */ struct drm_vmw_mksstat_remove_arg { __u64 id; }; #if defined(__cplusplus) } #endif #endif linux/android/binder.h 0000644 00000032567 15063602046 0010756 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2008 Google, Inc. * * Based on, but no longer compatible with, the original * OpenBinder.org binder driver interface, which is: * * Copyright (c) 2005 Palmsource, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef _LINUX_BINDER_H #define _LINUX_BINDER_H #include <linux/types.h> #include <linux/ioctl.h> #define B_PACK_CHARS(c1, c2, c3, c4) \ ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) #define B_TYPE_LARGE 0x85 enum { BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), BINDER_TYPE_FDA = B_PACK_CHARS('f', 'd', 'a', B_TYPE_LARGE), BINDER_TYPE_PTR = B_PACK_CHARS('p', 't', '*', B_TYPE_LARGE), }; enum { FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, }; #ifdef BINDER_IPC_32BIT typedef __u32 binder_size_t; typedef __u32 binder_uintptr_t; #else typedef __u64 binder_size_t; typedef __u64 binder_uintptr_t; #endif /** * struct binder_object_header - header shared by all binder metadata objects. * @type: type of the object */ struct binder_object_header { __u32 type; }; /* * This is the flattened representation of a Binder object for transfer * between processes. The 'offsets' supplied as part of a binder transaction * contains offsets into the data where these structures occur. The Binder * driver takes care of re-writing the structure type and data as it moves * between processes. */ struct flat_binder_object { struct binder_object_header hdr; __u32 flags; /* 8 bytes of data. */ union { binder_uintptr_t binder; /* local object */ __u32 handle; /* remote object */ }; /* extra data associated with local object */ binder_uintptr_t cookie; }; /** * struct binder_fd_object - describes a filedescriptor to be fixed up. * @hdr: common header structure * @pad_flags: padding to remain compatible with old userspace code * @pad_binder: padding to remain compatible with old userspace code * @fd: file descriptor * @cookie: opaque data, used by user-space */ struct binder_fd_object { struct binder_object_header hdr; __u32 pad_flags; union { binder_uintptr_t pad_binder; __u32 fd; }; binder_uintptr_t cookie; }; /* struct binder_buffer_object - object describing a userspace buffer * @hdr: common header structure * @flags: one or more BINDER_BUFFER_* flags * @buffer: address of the buffer * @length: length of the buffer * @parent: index in offset array pointing to parent buffer * @parent_offset: offset in @parent pointing to this buffer * * A binder_buffer object represents an object that the * binder kernel driver can copy verbatim to the target * address space. A buffer itself may be pointed to from * within another buffer, meaning that the pointer inside * that other buffer needs to be fixed up as well. This * can be done by setting the BINDER_BUFFER_FLAG_HAS_PARENT * flag in @flags, by setting @parent buffer to the index * in the offset array pointing to the parent binder_buffer_object, * and by setting @parent_offset to the offset in the parent buffer * at which the pointer to this buffer is located. */ struct binder_buffer_object { struct binder_object_header hdr; __u32 flags; binder_uintptr_t buffer; binder_size_t length; binder_size_t parent; binder_size_t parent_offset; }; enum { BINDER_BUFFER_FLAG_HAS_PARENT = 0x01, }; /* struct binder_fd_array_object - object describing an array of fds in a buffer * @hdr: common header structure * @pad: padding to ensure correct alignment * @num_fds: number of file descriptors in the buffer * @parent: index in offset array to buffer holding the fd array * @parent_offset: start offset of fd array in the buffer * * A binder_fd_array object represents an array of file * descriptors embedded in a binder_buffer_object. It is * different from a regular binder_buffer_object because it * describes a list of file descriptors to fix up, not an opaque * blob of memory, and hence the kernel needs to treat it differently. * * An example of how this would be used is with Android's * native_handle_t object, which is a struct with a list of integers * and a list of file descriptors. The native_handle_t struct itself * will be represented by a struct binder_buffer_objct, whereas the * embedded list of file descriptors is represented by a * struct binder_fd_array_object with that binder_buffer_object as * a parent. */ struct binder_fd_array_object { struct binder_object_header hdr; __u32 pad; binder_size_t num_fds; binder_size_t parent; binder_size_t parent_offset; }; /* * On 64-bit platforms where user code may run in 32-bits the driver must * translate the buffer (and local binder) addresses appropriately. */ struct binder_write_read { binder_size_t write_size; /* bytes to write */ binder_size_t write_consumed; /* bytes consumed by driver */ binder_uintptr_t write_buffer; binder_size_t read_size; /* bytes to read */ binder_size_t read_consumed; /* bytes consumed by driver */ binder_uintptr_t read_buffer; }; /* Use with BINDER_VERSION, driver fills in fields. */ struct binder_version { /* driver protocol version -- increment with incompatible change */ __s32 protocol_version; }; /* This is the current protocol version. */ #ifdef BINDER_IPC_32BIT #define BINDER_CURRENT_PROTOCOL_VERSION 7 #else #define BINDER_CURRENT_PROTOCOL_VERSION 8 #endif /* * Use with BINDER_GET_NODE_DEBUG_INFO, driver reads ptr, writes to all fields. * Set ptr to NULL for the first call to get the info for the first node, and * then repeat the call passing the previously returned value to get the next * nodes. ptr will be 0 when there are no more nodes. */ struct binder_node_debug_info { binder_uintptr_t ptr; binder_uintptr_t cookie; __u32 has_strong_ref; __u32 has_weak_ref; }; #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32) #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32) #define BINDER_THREAD_EXIT _IOW('b', 8, __s32) #define BINDER_VERSION _IOWR('b', 9, struct binder_version) #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) /* * NOTE: Two special error codes you should check for when calling * in to the driver are: * * EINTR -- The operation has been interupted. This should be * handled by retrying the ioctl() until a different error code * is returned. * * ECONNREFUSED -- The driver is no longer accepting operations * from your process. That is, the process is being destroyed. * You should handle this by exiting from your process. Note * that once this error code is returned, all further calls to * the driver from any thread will return this same code. */ enum transaction_flags { TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */ TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ }; struct binder_transaction_data { /* The first two are only used for bcTRANSACTION and brTRANSACTION, * identifying the target and contents of the transaction. */ union { /* target descriptor of command transaction */ __u32 handle; /* target descriptor of return transaction */ binder_uintptr_t ptr; } target; binder_uintptr_t cookie; /* target object cookie */ __u32 code; /* transaction command */ /* General information about the transaction. */ __u32 flags; pid_t sender_pid; uid_t sender_euid; binder_size_t data_size; /* number of bytes of data */ binder_size_t offsets_size; /* number of bytes of offsets */ /* If this transaction is inline, the data immediately * follows here; otherwise, it ends with a pointer to * the data buffer. */ union { struct { /* transaction data */ binder_uintptr_t buffer; /* offsets from buffer to flat_binder_object structs */ binder_uintptr_t offsets; } ptr; __u8 buf[8]; } data; }; struct binder_transaction_data_sg { struct binder_transaction_data transaction_data; binder_size_t buffers_size; }; struct binder_ptr_cookie { binder_uintptr_t ptr; binder_uintptr_t cookie; }; struct binder_handle_cookie { __u32 handle; binder_uintptr_t cookie; } __attribute__((packed)); struct binder_pri_desc { __s32 priority; __u32 desc; }; struct binder_pri_ptr_cookie { __s32 priority; binder_uintptr_t ptr; binder_uintptr_t cookie; }; enum binder_driver_return_protocol { BR_ERROR = _IOR('r', 0, __s32), /* * int: error code */ BR_OK = _IO('r', 1), /* No parameters! */ BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), BR_REPLY = _IOR('r', 3, struct binder_transaction_data), /* * binder_transaction_data: the received command. */ BR_ACQUIRE_RESULT = _IOR('r', 4, __s32), /* * not currently supported * int: 0 if the last bcATTEMPT_ACQUIRE was not successful. * Else the remote object has acquired a primary reference. */ BR_DEAD_REPLY = _IO('r', 5), /* * The target of the last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters. */ BR_TRANSACTION_COMPLETE = _IO('r', 6), /* * No parameters... always refers to the last transaction requested * (including replies). Note that this will be sent even for * asynchronous transactions. */ BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie for binder */ BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), /* * not currently supported * int: priority * void *: ptr to binder * void *: cookie for binder */ BR_NOOP = _IO('r', 12), /* * No parameters. Do nothing and examine the next command. It exists * primarily so that we can replace it with a BR_SPAWN_LOOPER command. */ BR_SPAWN_LOOPER = _IO('r', 13), /* * No parameters. The driver has determined that a process has no * threads waiting to service incoming transactions. When a process * receives this command, it must spawn a new service thread and * register it via bcENTER_LOOPER. */ BR_FINISHED = _IO('r', 14), /* * not currently supported * stop threadpool thread */ BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t), /* * void *: cookie */ BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t), /* * void *: cookie */ BR_FAILED_REPLY = _IO('r', 17), /* * The the last transaction (either a bcTRANSACTION or * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. */ }; enum binder_driver_command_protocol { BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), BC_REPLY = _IOW('c', 1, struct binder_transaction_data), /* * binder_transaction_data: the sent command. */ BC_ACQUIRE_RESULT = _IOW('c', 2, __s32), /* * not currently supported * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful. * Else you have acquired a primary reference on the object. */ BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t), /* * void *: ptr to transaction data received on a read */ BC_INCREFS = _IOW('c', 4, __u32), BC_ACQUIRE = _IOW('c', 5, __u32), BC_RELEASE = _IOW('c', 6, __u32), BC_DECREFS = _IOW('c', 7, __u32), /* * int: descriptor */ BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), /* * void *: ptr to binder * void *: cookie for binder */ BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), /* * not currently supported * int: priority * int: descriptor */ BC_REGISTER_LOOPER = _IO('c', 11), /* * No parameters. * Register a spawned looper thread with the device. */ BC_ENTER_LOOPER = _IO('c', 12), BC_EXIT_LOOPER = _IO('c', 13), /* * No parameters. * These two commands are sent as an application-level thread * enters and exits the binder loop, respectively. They are * used so the binder can have an accurate count of the number * of looping threads it has available. */ BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie), /* * int: handle * void *: cookie */ BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie), /* * int: handle * void *: cookie */ BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t), /* * void *: cookie */ BC_TRANSACTION_SG = _IOW('c', 17, struct binder_transaction_data_sg), BC_REPLY_SG = _IOW('c', 18, struct binder_transaction_data_sg), /* * binder_transaction_data_sg: the sent command. */ }; #endif /* _LINUX_BINDER_H */ linux/cfm_bridge.h 0000644 00000002660 15063602046 0010143 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _LINUX_CFM_BRIDGE_H_ #define _LINUX_CFM_BRIDGE_H_ #include <linux/types.h> #include <linux/if_ether.h> #define ETHER_HEADER_LENGTH (6+6+4+2) #define CFM_MAID_LENGTH 48 #define CFM_CCM_PDU_LENGTH 75 #define CFM_PORT_STATUS_TLV_LENGTH 4 #define CFM_IF_STATUS_TLV_LENGTH 4 #define CFM_IF_STATUS_TLV_TYPE 4 #define CFM_PORT_STATUS_TLV_TYPE 2 #define CFM_ENDE_TLV_TYPE 0 #define CFM_CCM_MAX_FRAME_LENGTH (ETHER_HEADER_LENGTH+\ CFM_CCM_PDU_LENGTH+\ CFM_PORT_STATUS_TLV_LENGTH+\ CFM_IF_STATUS_TLV_LENGTH) #define CFM_FRAME_PRIO 7 #define CFM_CCM_TLV_OFFSET 70 #define CFM_CCM_PDU_MAID_OFFSET 10 #define CFM_CCM_PDU_MEPID_OFFSET 8 #define CFM_CCM_PDU_SEQNR_OFFSET 4 #define CFM_CCM_PDU_TLV_OFFSET 74 #define CFM_CCM_ITU_RESERVED_SIZE 16 struct br_cfm_common_hdr { __u8 mdlevel_version; __u8 opcode; __u8 flags; __u8 tlv_offset; }; enum br_cfm_opcodes { BR_CFM_OPCODE_CCM = 0x1, }; /* MEP domain */ enum br_cfm_domain { BR_CFM_PORT, BR_CFM_VLAN, }; /* MEP direction */ enum br_cfm_mep_direction { BR_CFM_MEP_DIRECTION_DOWN, BR_CFM_MEP_DIRECTION_UP, }; /* CCM interval supported. */ enum br_cfm_ccm_interval { BR_CFM_CCM_INTERVAL_NONE, BR_CFM_CCM_INTERVAL_3_3_MS, BR_CFM_CCM_INTERVAL_10_MS, BR_CFM_CCM_INTERVAL_100_MS, BR_CFM_CCM_INTERVAL_1_SEC, BR_CFM_CCM_INTERVAL_10_SEC, BR_CFM_CCM_INTERVAL_1_MIN, BR_CFM_CCM_INTERVAL_10_MIN, }; #endif linux/cgroupstats.h 0000644 00000004253 15063602046 0010440 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ /* cgroupstats.h - exporting per-cgroup statistics * * Copyright IBM Corporation, 2007 * Author Balbir Singh <balbir@linux.vnet.ibm.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef _LINUX_CGROUPSTATS_H #define _LINUX_CGROUPSTATS_H #include <linux/types.h> #include <linux/taskstats.h> /* * Data shared between user space and kernel space on a per cgroup * basis. This data is shared using taskstats. * * Most of these states are derived by looking at the task->state value * For the nr_io_wait state, a flag in the delay accounting structure * indicates that the task is waiting on IO * * Each member is aligned to a 8 byte boundary. */ struct cgroupstats { __u64 nr_sleeping; /* Number of tasks sleeping */ __u64 nr_running; /* Number of tasks running */ __u64 nr_stopped; /* Number of tasks in stopped state */ __u64 nr_uninterruptible; /* Number of tasks in uninterruptible */ /* state */ __u64 nr_io_wait; /* Number of tasks waiting on IO */ }; /* * Commands sent from userspace * Not versioned. New commands should only be inserted at the enum's end * prior to __CGROUPSTATS_CMD_MAX */ enum { CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, /* Reserved */ CGROUPSTATS_CMD_GET, /* user->kernel request/get-response */ CGROUPSTATS_CMD_NEW, /* kernel->user event */ __CGROUPSTATS_CMD_MAX, }; #define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1) enum { CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */ CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */ __CGROUPSTATS_TYPE_MAX, }; #define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1) enum { CGROUPSTATS_CMD_ATTR_UNSPEC = 0, CGROUPSTATS_CMD_ATTR_FD, __CGROUPSTATS_CMD_ATTR_MAX, }; #define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1) #endif /* _LINUX_CGROUPSTATS_H */ linux/chio.h 0000644 00000012340 15063602046 0007000 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ioctl interface for the scsi media changer driver */ /* changer element types */ #define CHET_MT 0 /* media transport element (robot) */ #define CHET_ST 1 /* storage element (media slots) */ #define CHET_IE 2 /* import/export element */ #define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */ #define CHET_V1 4 /* vendor specific #1 */ #define CHET_V2 5 /* vendor specific #2 */ #define CHET_V3 6 /* vendor specific #3 */ #define CHET_V4 7 /* vendor specific #4 */ /* * CHIOGPARAMS * query changer properties * * CHIOVGPARAMS * query vendor-specific element types * * accessing elements works by specifing type and unit of the element. * for example, storage elements are addressed with type = CHET_ST and * unit = 0 .. cp_nslots-1 * */ struct changer_params { int cp_curpicker; /* current transport element */ int cp_npickers; /* number of transport elements (CHET_MT) */ int cp_nslots; /* number of storage elements (CHET_ST) */ int cp_nportals; /* number of import/export elements (CHET_IE) */ int cp_ndrives; /* number of data transfer elements (CHET_DT) */ }; struct changer_vendor_params { int cvp_n1; /* number of vendor specific elems (CHET_V1) */ char cvp_label1[16]; int cvp_n2; /* number of vendor specific elems (CHET_V2) */ char cvp_label2[16]; int cvp_n3; /* number of vendor specific elems (CHET_V3) */ char cvp_label3[16]; int cvp_n4; /* number of vendor specific elems (CHET_V4) */ char cvp_label4[16]; int reserved[8]; }; /* * CHIOMOVE * move a medium from one element to another */ struct changer_move { int cm_fromtype; /* type/unit of source element */ int cm_fromunit; int cm_totype; /* type/unit of destination element */ int cm_tounit; int cm_flags; }; #define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */ /* * CHIOEXCHANGE * move one medium from element #1 to element #2, * and another one from element #2 to element #3. * element #1 and #3 are allowed to be identical. */ struct changer_exchange { int ce_srctype; /* type/unit of element #1 */ int ce_srcunit; int ce_fdsttype; /* type/unit of element #2 */ int ce_fdstunit; int ce_sdsttype; /* type/unit of element #3 */ int ce_sdstunit; int ce_flags; }; #define CE_INVERT1 1 #define CE_INVERT2 2 /* * CHIOPOSITION * move the transport element (robot arm) to a specific element. */ struct changer_position { int cp_type; int cp_unit; int cp_flags; }; #define CP_INVERT 1 /* * CHIOGSTATUS * get element status for all elements of a specific type */ struct changer_element_status { int ces_type; unsigned char *ces_data; }; #define CESTATUS_FULL 0x01 /* full */ #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ #define CESTATUS_EXCEPT 0x04 /* error condition */ #define CESTATUS_ACCESS 0x08 /* access allowed */ #define CESTATUS_EXENAB 0x10 /* element can export media */ #define CESTATUS_INENAB 0x20 /* element can import media */ /* * CHIOGELEM * get more detailed status information for a single element */ struct changer_get_element { int cge_type; /* type/unit */ int cge_unit; int cge_status; /* status */ int cge_errno; /* errno */ int cge_srctype; /* source element of the last move/exchange */ int cge_srcunit; int cge_id; /* scsi id (for data transfer elements) */ int cge_lun; /* scsi lun (for data transfer elements) */ char cge_pvoltag[36]; /* primary volume tag */ char cge_avoltag[36]; /* alternate volume tag */ int cge_flags; }; /* flags */ #define CGE_ERRNO 0x01 /* errno available */ #define CGE_INVERT 0x02 /* media inverted */ #define CGE_SRC 0x04 /* media src available */ #define CGE_IDLUN 0x08 /* ID+LUN available */ #define CGE_PVOLTAG 0x10 /* primary volume tag available */ #define CGE_AVOLTAG 0x20 /* alternate volume tag available */ /* * CHIOSVOLTAG * set volume tag */ struct changer_set_voltag { int csv_type; /* type/unit */ int csv_unit; char csv_voltag[36]; /* volume tag */ int csv_flags; }; #define CSV_PVOLTAG 0x01 /* primary volume tag */ #define CSV_AVOLTAG 0x02 /* alternate volume tag */ #define CSV_CLEARTAG 0x04 /* clear volume tag */ /* ioctls */ #define CHIOMOVE _IOW('c', 1,struct changer_move) #define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange) #define CHIOPOSITION _IOW('c', 3,struct changer_position) #define CHIOGPICKER _IOR('c', 4,int) /* not impl. */ #define CHIOSPICKER _IOW('c', 5,int) /* not impl. */ #define CHIOGPARAMS _IOR('c', 6,struct changer_params) #define CHIOGSTATUS _IOW('c', 8,struct changer_element_status) #define CHIOGELEM _IOW('c',16,struct changer_get_element) #define CHIOINITELEM _IO('c',17) #define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag) #define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params) /* ---------------------------------------------------------------------- */ /* * Local variables: * c-basic-offset: 8 * End: */ linux/close_range.h 0000644 00000000571 15063602046 0010342 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_CLOSE_RANGE_H #define _LINUX_CLOSE_RANGE_H /* Unshare the file descriptor table before closing file descriptors. */ #define CLOSE_RANGE_UNSHARE (1U << 1) /* Set the FD_CLOEXEC bit instead of closing the file descriptor. */ #define CLOSE_RANGE_CLOEXEC (1U << 2) #endif /* _LINUX_CLOSE_RANGE_H */ linux/cm4000_cs.h 0000644 00000003416 15063602046 0007452 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _CM4000_H_ #define _CM4000_H_ #include <linux/types.h> #include <linux/ioctl.h> #define MAX_ATR 33 #define CM4000_MAX_DEV 4 /* those two structures are passed via ioctl() from/to userspace. They are * used by existing userspace programs, so I kepth the awkward "bIFSD" naming * not to break compilation of userspace apps. -HW */ typedef struct atreq { __s32 atr_len; unsigned char atr[64]; __s32 power_act; unsigned char bIFSD; unsigned char bIFSC; } atreq_t; /* what is particularly stupid in the original driver is the arch-dependent * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace * will lay out the structure members differently than the 64bit kernel. * * I've changed "ptsreq.protocol" from "unsigned long" to "__u32". * On 32bit this will make no difference. With 64bit kernels, it will make * 32bit apps work, too. */ typedef struct ptsreq { __u32 protocol; /*T=0: 2^0, T=1: 2^1*/ unsigned char flags; unsigned char pts1; unsigned char pts2; unsigned char pts3; } ptsreq_t; #define CM_IOC_MAGIC 'c' #define CM_IOC_MAXNR 255 #define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *) #define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *) #define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *) #define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3) #define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4) #define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*) /* card and device states */ #define CM_CARD_INSERTED 0x01 #define CM_CARD_POWERED 0x02 #define CM_ATR_PRESENT 0x04 #define CM_ATR_VALID 0x08 #define CM_STATE_VALID 0x0f /* extra info only from CM4000 */ #define CM_NO_READER 0x10 #define CM_BAD_CARD 0x20 #endif /* _CM4000_H_ */ linux/cn_proc.h 0000644 00000006600 15063602046 0007503 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ /* * cn_proc.h - process events connector * * Copyright (C) Matt Helsley, IBM Corp. 2005 * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com> * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef CN_PROC_H #define CN_PROC_H #include <linux/types.h> /* * Userspace sends this enum to register with the kernel that it is listening * for events on the connector. */ enum proc_cn_mcast_op { PROC_CN_MCAST_LISTEN = 1, PROC_CN_MCAST_IGNORE = 2 }; /* * From the user's point of view, the process * ID is the thread group ID and thread ID is the internal * kernel "pid". So, fields are assigned as follow: * * In user space - In kernel space * * parent process ID = parent->tgid * parent thread ID = parent->pid * child process ID = child->tgid * child thread ID = child->pid */ struct proc_event { enum what { /* Use successive bits so the enums can be used to record * sets of events as well */ PROC_EVENT_NONE = 0x00000000, PROC_EVENT_FORK = 0x00000001, PROC_EVENT_EXEC = 0x00000002, PROC_EVENT_UID = 0x00000004, PROC_EVENT_GID = 0x00000040, PROC_EVENT_SID = 0x00000080, PROC_EVENT_PTRACE = 0x00000100, PROC_EVENT_COMM = 0x00000200, /* "next" should be 0x00000400 */ /* "last" is the last process event: exit, * while "next to last" is coredumping event */ PROC_EVENT_COREDUMP = 0x40000000, PROC_EVENT_EXIT = 0x80000000 } what; __u32 cpu; __u64 __attribute__((aligned(8))) timestamp_ns; /* Number of nano seconds since system boot */ union { /* must be last field of proc_event struct */ struct { __u32 err; } ack; struct fork_proc_event { __kernel_pid_t parent_pid; __kernel_pid_t parent_tgid; __kernel_pid_t child_pid; __kernel_pid_t child_tgid; } fork; struct exec_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; } exec; struct id_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; union { __u32 ruid; /* task uid */ __u32 rgid; /* task gid */ } r; union { __u32 euid; __u32 egid; } e; } id; struct sid_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; } sid; struct ptrace_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; __kernel_pid_t tracer_pid; __kernel_pid_t tracer_tgid; } ptrace; struct comm_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; char comm[16]; } comm; struct coredump_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; __kernel_pid_t parent_pid; __kernel_pid_t parent_tgid; } coredump; struct exit_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; __u32 exit_code, exit_signal; __kernel_pid_t parent_pid; __kernel_pid_t parent_tgid; } exit; } event_data; }; #endif /* CN_PROC_H */ linux/coda.h 0000644 00000042141 15063602046 0006766 0 ustar 00 /* You may distribute this file under either of the two licenses that follow at your discretion. */ /* BLURB lgpl Coda File System Release 5 Copyright (c) 1987-1999 Carnegie Mellon University Additional copyrights listed below This code is distributed "AS IS" without warranty of any kind under the terms of the GNU Library General Public Licence Version 2, as shown in the file LICENSE, or under the license shown below. The technical and financial contributors to Coda are listed in the file CREDITS. Additional copyrights */ /* Coda: an Experimental Distributed File System Release 4.0 Copyright (c) 1987-1999 Carnegie Mellon University All Rights Reserved Permission to use, copy, modify and distribute this software and its documentation is hereby granted, provided that both the copyright notice and this permission notice appear in all copies of the software, derivative works or modified versions, and any portions thereof, and that both notices appear in supporting documentation, and that credit is given to Carnegie Mellon University in all documents and publicity pertaining to direct or indirect use of this code or its derivatives. CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF ANY DERIVATIVE WORK. Carnegie Mellon encourages users of this software to return any improvements or extensions that they make, and to grant Carnegie Mellon the rights to redistribute these changes without encumbrance. */ /* * * Based on cfs.h from Mach, but revamped for increased simplicity. * Linux modifications by * Peter Braam, Aug 1996 */ #ifndef _CODA_HEADER_ #define _CODA_HEADER_ /* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */ #if defined(__NetBSD__) || \ ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL)) #include <sys/types.h> #endif #ifndef CODA_MAXSYMLINKS #define CODA_MAXSYMLINKS 10 #endif #if defined(DJGPP) || defined(__CYGWIN32__) #ifdef KERNEL typedef unsigned long u_long; typedef unsigned int u_int; typedef unsigned short u_short; typedef u_long ino_t; typedef u_long dev_t; typedef void * caddr_t; #ifdef DOS typedef unsigned __int64 u_quad_t; #else typedef unsigned long long u_quad_t; #endif #define __inline__ struct timespec { long ts_sec; long ts_nsec; }; #else /* DJGPP but not KERNEL */ #include <sys/time.h> typedef unsigned long long u_quad_t; #endif /* !KERNEL */ #endif /* !DJGPP */ #if defined(__linux__) #include <linux/time.h> #define cdev_t u_quad_t #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) #define _UQUAD_T_ 1 typedef unsigned long long u_quad_t; #endif #else #define cdev_t dev_t #endif #ifdef __CYGWIN32__ struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; #endif #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ typedef signed char int8_t; typedef unsigned char u_int8_t; typedef short int16_t; typedef unsigned short u_int16_t; typedef int int32_t; typedef unsigned int u_int32_t; #endif /* * Cfs constants */ #define CODA_MAXNAMLEN 255 #define CODA_MAXPATHLEN 1024 #define CODA_MAXSYMLINK 10 /* these are Coda's version of O_RDONLY etc combinations * to deal with VFS open modes */ #define C_O_READ 0x001 #define C_O_WRITE 0x002 #define C_O_TRUNC 0x010 #define C_O_EXCL 0x100 #define C_O_CREAT 0x200 /* these are to find mode bits in Venus */ #define C_M_READ 00400 #define C_M_WRITE 00200 /* for access Venus will use */ #define C_A_C_OK 8 /* Test for writing upon create. */ #define C_A_R_OK 4 /* Test for read permission. */ #define C_A_W_OK 2 /* Test for write permission. */ #define C_A_X_OK 1 /* Test for execute permission. */ #define C_A_F_OK 0 /* Test for existence. */ #ifndef _VENUS_DIRENT_T_ #define _VENUS_DIRENT_T_ 1 struct venus_dirent { u_int32_t d_fileno; /* file number of entry */ u_int16_t d_reclen; /* length of this record */ u_int8_t d_type; /* file type, see below */ u_int8_t d_namlen; /* length of string in d_name */ char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ }; #undef DIRSIZ #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ (((dp)->d_namlen+1 + 3) &~ 3)) /* * File types */ #define CDT_UNKNOWN 0 #define CDT_FIFO 1 #define CDT_CHR 2 #define CDT_DIR 4 #define CDT_BLK 6 #define CDT_REG 8 #define CDT_LNK 10 #define CDT_SOCK 12 #define CDT_WHT 14 /* * Convert between stat structure types and directory types. */ #define IFTOCDT(mode) (((mode) & 0170000) >> 12) #define CDTTOIF(dirtype) ((dirtype) << 12) #endif #ifndef _VUID_T_ #define _VUID_T_ typedef u_int32_t vuid_t; typedef u_int32_t vgid_t; #endif /*_VUID_T_ */ struct CodaFid { u_int32_t opaque[4]; }; #define coda_f2i(fid)\ (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) #ifndef _VENUS_VATTR_T_ #define _VENUS_VATTR_T_ /* * Vnode types. VNON means no type. */ enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; struct coda_vattr { long va_type; /* vnode type (for create) */ u_short va_mode; /* files access mode and type */ short va_nlink; /* number of references to file */ vuid_t va_uid; /* owner user id */ vgid_t va_gid; /* owner group id */ long va_fileid; /* file id */ u_quad_t va_size; /* file size in bytes */ long va_blocksize; /* blocksize preferred for i/o */ struct timespec va_atime; /* time of last access */ struct timespec va_mtime; /* time of last modification */ struct timespec va_ctime; /* time file changed */ u_long va_gen; /* generation number of file */ u_long va_flags; /* flags defined for file */ cdev_t va_rdev; /* device special file represents */ u_quad_t va_bytes; /* bytes of disk space held by file */ u_quad_t va_filerev; /* file modification number */ }; #endif /* structure used by CODA_STATFS for getting cache information from venus */ struct coda_statfs { int32_t f_blocks; int32_t f_bfree; int32_t f_bavail; int32_t f_files; int32_t f_ffree; }; /* * Kernel <--> Venus communications. */ #define CODA_ROOT 2 #define CODA_OPEN_BY_FD 3 #define CODA_OPEN 4 #define CODA_CLOSE 5 #define CODA_IOCTL 6 #define CODA_GETATTR 7 #define CODA_SETATTR 8 #define CODA_ACCESS 9 #define CODA_LOOKUP 10 #define CODA_CREATE 11 #define CODA_REMOVE 12 #define CODA_LINK 13 #define CODA_RENAME 14 #define CODA_MKDIR 15 #define CODA_RMDIR 16 #define CODA_SYMLINK 18 #define CODA_READLINK 19 #define CODA_FSYNC 20 #define CODA_VGET 22 #define CODA_SIGNAL 23 #define CODA_REPLACE 24 /* DOWNCALL */ #define CODA_FLUSH 25 /* DOWNCALL */ #define CODA_PURGEUSER 26 /* DOWNCALL */ #define CODA_ZAPFILE 27 /* DOWNCALL */ #define CODA_ZAPDIR 28 /* DOWNCALL */ #define CODA_PURGEFID 30 /* DOWNCALL */ #define CODA_OPEN_BY_PATH 31 #define CODA_RESOLVE 32 #define CODA_REINTEGRATE 33 #define CODA_STATFS 34 #define CODA_STORE 35 #define CODA_RELEASE 36 #define CODA_NCALLS 37 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ VC_MAXDATASIZE #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) #define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ /* * Venus <-> Coda RPC arguments */ struct coda_in_hdr { u_int32_t opcode; u_int32_t unique; /* Keep multiple outstanding msgs distinct */ pid_t pid; pid_t pgid; vuid_t uid; }; /* Really important that opcode and unique are 1st two fields! */ struct coda_out_hdr { u_int32_t opcode; u_int32_t unique; u_int32_t result; }; /* coda_root: NO_IN */ struct coda_root_out { struct coda_out_hdr oh; struct CodaFid VFid; }; struct coda_root_in { struct coda_in_hdr in; }; /* coda_open: */ struct coda_open_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_out { struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; /* coda_store: */ struct coda_store_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_store_out { struct coda_out_hdr out; }; /* coda_release: */ struct coda_release_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_release_out { struct coda_out_hdr out; }; /* coda_close: */ struct coda_close_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_close_out { struct coda_out_hdr out; }; /* coda_ioctl: */ struct coda_ioctl_in { struct coda_in_hdr ih; struct CodaFid VFid; int cmd; int len; int rwflag; char *data; /* Place holder for data. */ }; struct coda_ioctl_out { struct coda_out_hdr oh; int len; caddr_t data; /* Place holder for data. */ }; /* coda_getattr: */ struct coda_getattr_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_getattr_out { struct coda_out_hdr oh; struct coda_vattr attr; }; /* coda_setattr: NO_OUT */ struct coda_setattr_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; }; struct coda_setattr_out { struct coda_out_hdr out; }; /* coda_access: NO_OUT */ struct coda_access_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_access_out { struct coda_out_hdr out; }; /* lookup flags */ #define CLU_CASE_SENSITIVE 0x01 #define CLU_CASE_INSENSITIVE 0x02 /* coda_lookup: */ struct coda_lookup_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ int flags; }; struct coda_lookup_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; /* coda_create: */ struct coda_create_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int excl; int mode; int name; /* Place holder for data. */ }; struct coda_create_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; /* coda_remove: NO_OUT */ struct coda_remove_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ }; struct coda_remove_out { struct coda_out_hdr out; }; /* coda_link: NO_OUT */ struct coda_link_in { struct coda_in_hdr ih; struct CodaFid sourceFid; /* cnode to link *to* */ struct CodaFid destFid; /* Directory in which to place link */ int tname; /* Place holder for data. */ }; struct coda_link_out { struct coda_out_hdr out; }; /* coda_rename: NO_OUT */ struct coda_rename_in { struct coda_in_hdr ih; struct CodaFid sourceFid; int srcname; struct CodaFid destFid; int destname; }; struct coda_rename_out { struct coda_out_hdr out; }; /* coda_mkdir: */ struct coda_mkdir_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int name; /* Place holder for data. */ }; struct coda_mkdir_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; /* coda_rmdir: NO_OUT */ struct coda_rmdir_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ }; struct coda_rmdir_out { struct coda_out_hdr out; }; /* coda_symlink: NO_OUT */ struct coda_symlink_in { struct coda_in_hdr ih; struct CodaFid VFid; /* Directory to put symlink in */ int srcname; struct coda_vattr attr; int tname; }; struct coda_symlink_out { struct coda_out_hdr out; }; /* coda_readlink: */ struct coda_readlink_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_readlink_out { struct coda_out_hdr oh; int count; caddr_t data; /* Place holder for data. */ }; /* coda_fsync: NO_OUT */ struct coda_fsync_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_fsync_out { struct coda_out_hdr out; }; /* coda_vget: */ struct coda_vget_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_vget_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; /* CODA_SIGNAL is out-of-band, doesn't need data. */ /* CODA_INVALIDATE is a venus->kernel call */ /* CODA_FLUSH is a venus->kernel call */ /* coda_purgeuser: */ /* CODA_PURGEUSER is a venus->kernel call */ struct coda_purgeuser_out { struct coda_out_hdr oh; vuid_t uid; }; /* coda_zapfile: */ /* CODA_ZAPFILE is a venus->kernel call */ struct coda_zapfile_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_zapdir: */ /* CODA_ZAPDIR is a venus->kernel call */ struct coda_zapdir_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_purgefid: */ /* CODA_PURGEFID is a venus->kernel call */ struct coda_purgefid_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_replace: */ /* CODA_REPLACE is a venus->kernel call */ struct coda_replace_out { /* coda_replace is a venus->kernel call */ struct coda_out_hdr oh; struct CodaFid NewFid; struct CodaFid OldFid; }; /* coda_open_by_fd: */ struct coda_open_by_fd_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_fd_out { struct coda_out_hdr oh; int fd; }; /* coda_open_by_path: */ struct coda_open_by_path_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_path_out { struct coda_out_hdr oh; int path; }; /* coda_statfs: NO_IN */ struct coda_statfs_in { struct coda_in_hdr in; }; struct coda_statfs_out { struct coda_out_hdr oh; struct coda_statfs stat; }; /* * Occasionally, we don't cache the fid returned by CODA_LOOKUP. * For instance, if the fid is inconsistent. * This case is handled by setting the top bit of the type result parameter. */ #define CODA_NOCACHE 0x80000000 union inputArgs { struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ struct coda_open_in coda_open; struct coda_store_in coda_store; struct coda_release_in coda_release; struct coda_close_in coda_close; struct coda_ioctl_in coda_ioctl; struct coda_getattr_in coda_getattr; struct coda_setattr_in coda_setattr; struct coda_access_in coda_access; struct coda_lookup_in coda_lookup; struct coda_create_in coda_create; struct coda_remove_in coda_remove; struct coda_link_in coda_link; struct coda_rename_in coda_rename; struct coda_mkdir_in coda_mkdir; struct coda_rmdir_in coda_rmdir; struct coda_symlink_in coda_symlink; struct coda_readlink_in coda_readlink; struct coda_fsync_in coda_fsync; struct coda_vget_in coda_vget; struct coda_open_by_fd_in coda_open_by_fd; struct coda_open_by_path_in coda_open_by_path; struct coda_statfs_in coda_statfs; }; union outputArgs { struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ struct coda_root_out coda_root; struct coda_open_out coda_open; struct coda_ioctl_out coda_ioctl; struct coda_getattr_out coda_getattr; struct coda_lookup_out coda_lookup; struct coda_create_out coda_create; struct coda_mkdir_out coda_mkdir; struct coda_readlink_out coda_readlink; struct coda_vget_out coda_vget; struct coda_purgeuser_out coda_purgeuser; struct coda_zapfile_out coda_zapfile; struct coda_zapdir_out coda_zapdir; struct coda_purgefid_out coda_purgefid; struct coda_replace_out coda_replace; struct coda_open_by_fd_out coda_open_by_fd; struct coda_open_by_path_out coda_open_by_path; struct coda_statfs_out coda_statfs; }; union coda_downcalls { /* CODA_INVALIDATE is a venus->kernel call */ /* CODA_FLUSH is a venus->kernel call */ struct coda_purgeuser_out purgeuser; struct coda_zapfile_out zapfile; struct coda_zapdir_out zapdir; struct coda_purgefid_out purgefid; struct coda_replace_out replace; }; /* * Used for identifying usage of "Control" and pioctls */ #define PIOCPARM_MASK 0x0000ffff struct ViceIoctl { void *in; /* Data to be transferred in */ void *out; /* Data to be transferred out */ u_short in_size; /* Size of input buffer <= 2K */ u_short out_size; /* Maximum size of output buffer, <= 2K */ }; struct PioctlData { const char *path; int follow; struct ViceIoctl vi; }; #define CODA_CONTROL ".CONTROL" #define CODA_CONTROLLEN 8 #define CTL_INO -1 /* Data passed to mount */ #define CODA_MOUNT_VERSION 1 struct coda_mount_data { int version; int fd; /* Opened device */ }; #endif /* _CODA_HEADER_ */ linux/coda_psdev.h 0000644 00000001417 15063602046 0010170 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __CODA_PSDEV_H #define __CODA_PSDEV_H #include <linux/magic.h> #define CODA_PSDEV_MAJOR 67 #define MAX_CODADEVS 5 /* how many do we allow */ /* messages between coda filesystem in kernel and Venus */ struct upc_req { struct list_head uc_chain; caddr_t uc_data; u_short uc_flags; u_short uc_inSize; /* Size is at most 5000 bytes */ u_short uc_outSize; u_short uc_opcode; /* copied from data to save lookup */ int uc_unique; wait_queue_head_t uc_sleep; /* process' wait queue */ }; #define CODA_REQ_ASYNC 0x1 #define CODA_REQ_READ 0x2 #define CODA_REQ_WRITE 0x4 #define CODA_REQ_ABORT 0x8 #endif /* __CODA_PSDEV_H */ linux/coff.h 0000644 00000030274 15063602046 0007001 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* This file is derived from the GAS 2.1.4 assembler control file. The GAS product is under the GNU General Public License, version 2 or later. As such, this file is also under that license. If the file format changes in the COFF object, this file should be subsequently updated to reflect the changes. The actual loader module only uses a few of these structures. The full set is documented here because I received the full set. If you wish more information about COFF, then O'Reilly has a very excellent book. */ #define E_SYMNMLEN 8 /* Number of characters in a symbol name */ #define E_FILNMLEN 14 /* Number of characters in a file name */ #define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */ /* * These defines are byte order independent. There is no alignment of fields * permitted in the structures. Therefore they are declared as characters * and the values loaded from the character positions. It also makes it * nice to have it "endian" independent. */ /* Load a short int from the following tables with little-endian formats */ #define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\ ((unsigned short)((unsigned char)ps[0])))) /* Load a long int from the following tables with little-endian formats */ #define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\ ((unsigned long)((unsigned char)ps[2])<<16) |\ ((unsigned long)((unsigned char)ps[1])<<8) |\ ((unsigned long)((unsigned char)ps[0]))))) /* Load a short int from the following tables with big-endian formats */ #define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\ ((unsigned short)((unsigned char)ps[1])))) /* Load a long int from the following tables with big-endian formats */ #define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\ ((unsigned long)((unsigned char)ps[1])<<16) |\ ((unsigned long)((unsigned char)ps[2])<<8) |\ ((unsigned long)((unsigned char)ps[3]))))) /* These may be overridden later by brain dead implementations which generate a big-endian header with little-endian data. In that case, generate a replacement macro which tests a flag and uses either of the two above as appropriate. */ #define COFF_LONG(v) COFF_LONG_L(v) #define COFF_SHORT(v) COFF_SHORT_L(v) /*** coff information for Intel 386/486. */ /********************** FILE HEADER **********************/ struct COFF_filehdr { char f_magic[2]; /* magic number */ char f_nscns[2]; /* number of sections */ char f_timdat[4]; /* time & date stamp */ char f_symptr[4]; /* file pointer to symtab */ char f_nsyms[4]; /* number of symtab entries */ char f_opthdr[2]; /* sizeof(optional hdr) */ char f_flags[2]; /* flags */ }; /* * Bits for f_flags: * * F_RELFLG relocation info stripped from file * F_EXEC file is executable (i.e. no unresolved external * references) * F_LNNO line numbers stripped from file * F_LSYMS local symbols stripped from file * F_MINMAL this is a minimal object file (".m") output of fextract * F_UPDATE this is a fully bound update file, output of ogen * F_SWABD this file has had its bytes swabbed (in names) * F_AR16WR this file has the byte ordering of an AR16WR * (e.g. 11/70) machine * F_AR32WR this file has the byte ordering of an AR32WR machine * (e.g. vax and iNTEL 386) * F_AR32W this file has the byte ordering of an AR32W machine * (e.g. 3b,maxi) * F_PATCH file contains "patch" list in optional header * F_NODF (minimal file only) no decision functions for * replaced functions */ #define COFF_F_RELFLG 0000001 #define COFF_F_EXEC 0000002 #define COFF_F_LNNO 0000004 #define COFF_F_LSYMS 0000010 #define COFF_F_MINMAL 0000020 #define COFF_F_UPDATE 0000040 #define COFF_F_SWABD 0000100 #define COFF_F_AR16WR 0000200 #define COFF_F_AR32WR 0000400 #define COFF_F_AR32W 0001000 #define COFF_F_PATCH 0002000 #define COFF_F_NODF 0002000 #define COFF_I386MAGIC 0x14c /* Linux's system */ #if 0 /* Perhaps, someday, these formats may be used. */ #define COFF_I386PTXMAGIC 0x154 #define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */ #define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \ && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \ && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC) #else #define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) #endif #define COFF_FILHDR struct COFF_filehdr #define COFF_FILHSZ sizeof(COFF_FILHDR) /********************** AOUT "OPTIONAL HEADER" **********************/ /* Linux COFF must have this "optional" header. Standard COFF has no entry location for the "entry" point. They normally would start with the first location of the .text section. This is not a good idea for linux. So, the use of this "optional" header is not optional. It is required. Do not be tempted to assume that the size of the optional header is a constant and simply index the next byte by the size of this structure. Use the 'f_opthdr' field in the main coff header for the size of the structure actually written to the file!! */ typedef struct { char magic[2]; /* type of file */ char vstamp[2]; /* version stamp */ char tsize[4]; /* text size in bytes, padded to FW bdry */ char dsize[4]; /* initialized data " " */ char bsize[4]; /* uninitialized data " " */ char entry[4]; /* entry pt. */ char text_start[4]; /* base of text used for this file */ char data_start[4]; /* base of data used for this file */ } COFF_AOUTHDR; #define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) #define COFF_STMAGIC 0401 #define COFF_OMAGIC 0404 #define COFF_JMAGIC 0407 /* dirty text and data image, can't share */ #define COFF_DMAGIC 0410 /* dirty text segment, data aligned */ #define COFF_ZMAGIC 0413 /* The proper magic number for executables */ #define COFF_SHMAGIC 0443 /* shared library header */ /********************** SECTION HEADER **********************/ struct COFF_scnhdr { char s_name[8]; /* section name */ char s_paddr[4]; /* physical address, aliased s_nlib */ char s_vaddr[4]; /* virtual address */ char s_size[4]; /* section size */ char s_scnptr[4]; /* file ptr to raw data for section */ char s_relptr[4]; /* file ptr to relocation */ char s_lnnoptr[4]; /* file ptr to line numbers */ char s_nreloc[2]; /* number of relocation entries */ char s_nlnno[2]; /* number of line number entries */ char s_flags[4]; /* flags */ }; #define COFF_SCNHDR struct COFF_scnhdr #define COFF_SCNHSZ sizeof(COFF_SCNHDR) /* * names of "special" sections */ #define COFF_TEXT ".text" #define COFF_DATA ".data" #define COFF_BSS ".bss" #define COFF_COMMENT ".comment" #define COFF_LIB ".lib" #define COFF_SECT_TEXT 0 /* Section for instruction code */ #define COFF_SECT_DATA 1 /* Section for initialized globals */ #define COFF_SECT_BSS 2 /* Section for un-initialized globals */ #define COFF_SECT_REQD 3 /* Minimum number of sections for good file */ #define COFF_STYP_REG 0x00 /* regular segment */ #define COFF_STYP_DSECT 0x01 /* dummy segment */ #define COFF_STYP_NOLOAD 0x02 /* no-load segment */ #define COFF_STYP_GROUP 0x04 /* group segment */ #define COFF_STYP_PAD 0x08 /* .pad segment */ #define COFF_STYP_COPY 0x10 /* copy section */ #define COFF_STYP_TEXT 0x20 /* .text segment */ #define COFF_STYP_DATA 0x40 /* .data segment */ #define COFF_STYP_BSS 0x80 /* .bss segment */ #define COFF_STYP_INFO 0x200 /* .comment section */ #define COFF_STYP_OVER 0x400 /* overlay section */ #define COFF_STYP_LIB 0x800 /* library section */ /* * Shared libraries have the following section header in the data field for * each library. */ struct COFF_slib { char sl_entsz[4]; /* Size of this entry */ char sl_pathndx[4]; /* size of the header field */ }; #define COFF_SLIBHD struct COFF_slib #define COFF_SLIBSZ sizeof(COFF_SLIBHD) /********************** LINE NUMBERS **********************/ /* 1 line number entry for every "breakpointable" source line in a section. * Line numbers are grouped on a per function basis; first entry in a function * grouping will have l_lnno = 0 and in place of physical address will be the * symbol table index of the function name. */ struct COFF_lineno { union { char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ char l_paddr[4]; /* (physical) address of line number */ } l_addr; char l_lnno[2]; /* line number */ }; #define COFF_LINENO struct COFF_lineno #define COFF_LINESZ 6 /********************** SYMBOLS **********************/ #define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */ #define COFF_E_FILNMLEN 14 /* # characters in a file name */ #define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */ /* * All symbols and sections have the following definition */ struct COFF_syment { union { char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */ struct { char e_zeroes[4]; /* Leading zeros */ char e_offset[4]; /* Offset if this is a header section */ } e; } e; char e_value[4]; /* Value (address) of the segment */ char e_scnum[2]; /* Section number */ char e_type[2]; /* Type of section */ char e_sclass[1]; /* Loader class */ char e_numaux[1]; /* Number of auxiliary entries which follow */ }; #define COFF_N_BTMASK (0xf) /* Mask for important class bits */ #define COFF_N_TMASK (0x30) /* Mask for important type bits */ #define COFF_N_BTSHFT (4) /* # bits to shift class field */ #define COFF_N_TSHIFT (2) /* # bits to shift type field */ /* * Auxiliary entries because the main table is too limiting. */ union COFF_auxent { /* * Debugger information */ struct { char x_tagndx[4]; /* str, un, or enum tag indx */ union { struct { char x_lnno[2]; /* declaration line number */ char x_size[2]; /* str/union/array size */ } x_lnsz; char x_fsize[4]; /* size of function */ } x_misc; union { struct { /* if ISFCN, tag, or .bb */ char x_lnnoptr[4]; /* ptr to fcn line # */ char x_endndx[4]; /* entry ndx past block end */ } x_fcn; struct { /* if ISARY, up to 4 dimen. */ char x_dimen[E_DIMNUM][2]; } x_ary; } x_fcnary; char x_tvndx[2]; /* tv index */ } x_sym; /* * Source file names (debugger information) */ union { char x_fname[E_FILNMLEN]; struct { char x_zeroes[4]; char x_offset[4]; } x_n; } x_file; /* * Section information */ struct { char x_scnlen[4]; /* section length */ char x_nreloc[2]; /* # relocation entries */ char x_nlinno[2]; /* # line numbers */ } x_scn; /* * Transfer vector (branch table) */ struct { char x_tvfill[4]; /* tv fill value */ char x_tvlen[2]; /* length of .tv */ char x_tvran[2][2]; /* tv range */ } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ }; #define COFF_SYMENT struct COFF_syment #define COFF_SYMESZ 18 #define COFF_AUXENT union COFF_auxent #define COFF_AUXESZ 18 #define COFF_ETEXT "etext" /********************** RELOCATION DIRECTIVES **********************/ struct COFF_reloc { char r_vaddr[4]; /* Virtual address of item */ char r_symndx[4]; /* Symbol index in the symtab */ char r_type[2]; /* Relocation type */ }; #define COFF_RELOC struct COFF_reloc #define COFF_RELSZ 10 #define COFF_DEF_DATA_SECTION_ALIGNMENT 4 #define COFF_DEF_BSS_SECTION_ALIGNMENT 4 #define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 /* For new sections we haven't heard of before */ #define COFF_DEF_SECTION_ALIGNMENT 4 linux/connector.h 0000644 00000004315 15063602046 0010053 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * connector.h * * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __CONNECTOR_H #define __CONNECTOR_H #include <linux/types.h> /* * Process Events connector unique ids -- used for message routing */ #define CN_IDX_PROC 0x1 #define CN_VAL_PROC 0x1 #define CN_IDX_CIFS 0x2 #define CN_VAL_CIFS 0x1 #define CN_W1_IDX 0x3 /* w1 communication */ #define CN_W1_VAL 0x1 #define CN_IDX_V86D 0x4 #define CN_VAL_V86D_UVESAFB 0x1 #define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ #define CN_DST_IDX 0x6 #define CN_DST_VAL 0x1 #define CN_IDX_DM 0x7 /* Device Mapper */ #define CN_VAL_DM_USERSPACE_LOG 0x1 #define CN_IDX_DRBD 0x8 #define CN_VAL_DRBD 0x1 #define CN_KVP_IDX 0x9 /* HyperV KVP */ #define CN_KVP_VAL 0x1 /* queries from the kernel */ #define CN_VSS_IDX 0xA /* HyperV VSS */ #define CN_VSS_VAL 0x1 /* queries from the kernel */ #define CN_NETLINK_USERS 11 /* Highest index + 1 */ /* * Maximum connector's message size. */ #define CONNECTOR_MAX_MSG_SIZE 16384 /* * idx and val are unique identifiers which * are used for message routing and * must be registered in connector.h for in-kernel usage. */ struct cb_id { __u32 idx; __u32 val; }; struct cn_msg { struct cb_id id; __u32 seq; __u32 ack; __u16 len; /* Length of the following data */ __u16 flags; __u8 data[0]; }; #endif /* __CONNECTOR_H */ linux/const.h 0000644 00000001424 15063602046 0007205 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* const.h: Macros for dealing with constants. */ #ifndef _LINUX_CONST_H #define _LINUX_CONST_H /* Some constant macros are used in both assembler and * C code. Therefore we cannot annotate them always with * 'UL' and other type specifiers unilaterally. We * use the following macros to deal with this. * * Similarly, _AT() will cast an expression with a type in C, but * leave it unchanged in asm. */ #ifdef __ASSEMBLY__ #define _AC(X,Y) X #define _AT(T,X) X #else #define __AC(X,Y) (X##Y) #define _AC(X,Y) __AC(X,Y) #define _AT(T,X) ((T)(X)) #endif #define _UL(x) (_AC(x, UL)) #define _ULL(x) (_AC(x, ULL)) #define _BITUL(x) (_UL(1) << (x)) #define _BITULL(x) (_ULL(1) << (x)) #endif /* _LINUX_CONST_H */ linux/coresight-stm.h 0000644 00000001242 15063602046 0010645 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_CORESIGHT_STM_H_ #define __UAPI_CORESIGHT_STM_H_ #define STM_FLAG_TIMESTAMPED BIT(3) #define STM_FLAG_GUARANTEED BIT(7) /* * The CoreSight STM supports guaranteed and invariant timing * transactions. Guaranteed transactions are guaranteed to be * traced, this might involve stalling the bus or system to * ensure the transaction is accepted by the STM. While invariant * timing transactions are not guaranteed to be traced, they * will take an invariant amount of time regardless of the * state of the STM. */ enum { STM_OPTION_GUARANTEED = 0, STM_OPTION_INVARIANT, }; #endif linux/cramfs_fs.h 0000644 00000006743 15063602046 0010033 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __CRAMFS_H #define __CRAMFS_H #include <linux/types.h> #include <linux/magic.h> #define CRAMFS_SIGNATURE "Compressed ROMFS" /* * Width of various bitfields in struct cramfs_inode. * Primarily used to generate warnings in mkcramfs. */ #define CRAMFS_MODE_WIDTH 16 #define CRAMFS_UID_WIDTH 16 #define CRAMFS_SIZE_WIDTH 24 #define CRAMFS_GID_WIDTH 8 #define CRAMFS_NAMELEN_WIDTH 6 #define CRAMFS_OFFSET_WIDTH 26 /* * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs * path length is 63 << 2 = 252. */ #define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2) /* * Reasonably terse representation of the inode data. */ struct cramfs_inode { __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH; /* SIZE for device files is i_rdev */ __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH; /* NAMELEN is the length of the file name, divided by 4 and rounded up. (cramfs doesn't support hard links.) */ /* OFFSET: For symlinks and non-empty regular files, this contains the offset (divided by 4) of the file data in compressed form (starting with an array of block pointers; see README). For non-empty directories it is the offset (divided by 4) of the inode of the first file in that directory. For anything else, offset is zero. */ __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH; }; struct cramfs_info { __u32 crc; __u32 edition; __u32 blocks; __u32 files; }; /* * Superblock information at the beginning of the FS. */ struct cramfs_super { __u32 magic; /* 0x28cd3d45 - random number */ __u32 size; /* length in bytes */ __u32 flags; /* feature flags */ __u32 future; /* reserved for future use */ __u8 signature[16]; /* "Compressed ROMFS" */ struct cramfs_info fsid; /* unique filesystem info */ __u8 name[16]; /* user-defined name */ struct cramfs_inode root; /* root inode data */ }; /* * Feature flags * * 0x00000000 - 0x000000ff: features that work for all past kernels * 0x00000100 - 0xffffffff: features that don't work for past kernels */ #define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */ #define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */ #define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */ #define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */ #define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */ #define CRAMFS_FLAG_EXT_BLOCK_POINTERS 0x00000800 /* block pointer extensions */ /* * Valid values in super.flags. Currently we refuse to mount * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be * changed to test super.future instead. */ #define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \ | CRAMFS_FLAG_HOLES \ | CRAMFS_FLAG_WRONG_SIGNATURE \ | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET \ | CRAMFS_FLAG_EXT_BLOCK_POINTERS ) /* * Block pointer flags * * The maximum block offset that needs to be represented is roughly: * * (1 << CRAMFS_OFFSET_WIDTH) * 4 + * (1 << CRAMFS_SIZE_WIDTH) / PAGE_SIZE * (4 + PAGE_SIZE) * = 0x11004000 * * That leaves room for 3 flag bits in the block pointer table. */ #define CRAMFS_BLK_FLAG_UNCOMPRESSED (1 << 31) #define CRAMFS_BLK_FLAG_DIRECT_PTR (1 << 30) #define CRAMFS_BLK_FLAGS ( CRAMFS_BLK_FLAG_UNCOMPRESSED \ | CRAMFS_BLK_FLAG_DIRECT_PTR ) /* * Direct blocks are at least 4-byte aligned. * Pointers to direct blocks are shifted down by 2 bits. */ #define CRAMFS_BLK_DIRECT_PTR_SHIFT 2 #endif /* __CRAMFS_H */ linux/cryptouser.h 0000644 00000006500 15063602046 0010276 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Crypto user configuration API. * * Copyright (C) 2011 secunet Security Networks AG * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ #include <linux/types.h> /* Netlink configuration messages. */ enum { CRYPTO_MSG_BASE = 0x10, CRYPTO_MSG_NEWALG = 0x10, CRYPTO_MSG_DELALG, CRYPTO_MSG_UPDATEALG, CRYPTO_MSG_GETALG, CRYPTO_MSG_DELRNG, __CRYPTO_MSG_MAX }; #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1) #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE) #define CRYPTO_MAX_NAME 64 /* Netlink message attributes. */ enum crypto_attr_type_t { CRYPTOCFGA_UNSPEC, CRYPTOCFGA_PRIORITY_VAL, /* __u32 */ CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */ CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */ CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */ CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */ CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */ CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */ CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */ CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */ CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */ CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */ __CRYPTOCFGA_MAX #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) }; struct crypto_user_alg { char cru_name[CRYPTO_MAX_NAME]; char cru_driver_name[CRYPTO_MAX_NAME]; char cru_module_name[CRYPTO_MAX_NAME]; __u32 cru_type; __u32 cru_mask; __u32 cru_refcnt; __u32 cru_flags; }; struct crypto_report_larval { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_hash { char type[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int digestsize; }; struct crypto_report_cipher { char type[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int min_keysize; unsigned int max_keysize; }; struct crypto_report_blkcipher { char type[CRYPTO_MAX_NAME]; char geniv[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int min_keysize; unsigned int max_keysize; unsigned int ivsize; }; struct crypto_report_aead { char type[CRYPTO_MAX_NAME]; char geniv[CRYPTO_MAX_NAME]; unsigned int blocksize; unsigned int maxauthsize; unsigned int ivsize; }; struct crypto_report_comp { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_rng { char type[CRYPTO_MAX_NAME]; unsigned int seedsize; }; struct crypto_report_akcipher { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_kpp { char type[CRYPTO_MAX_NAME]; }; struct crypto_report_acomp { char type[CRYPTO_MAX_NAME]; }; #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ sizeof(struct crypto_report_blkcipher)) linux/cuda.h 0000644 00000001611 15063602046 0006771 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for talking to the CUDA. The CUDA is a microcontroller * which controls the ADB, system power, RTC, and various other things. * * Copyright (C) 1996 Paul Mackerras. */ #ifndef _LINUX_CUDA_H #define _LINUX_CUDA_H /* CUDA commands (2nd byte) */ #define CUDA_WARM_START 0 #define CUDA_AUTOPOLL 1 #define CUDA_GET_6805_ADDR 2 #define CUDA_GET_TIME 3 #define CUDA_GET_PRAM 7 #define CUDA_SET_6805_ADDR 8 #define CUDA_SET_TIME 9 #define CUDA_POWERDOWN 0xa #define CUDA_POWERUP_TIME 0xb #define CUDA_SET_PRAM 0xc #define CUDA_MS_RESET 0xd #define CUDA_SEND_DFAC 0xe #define CUDA_RESET_SYSTEM 0x11 #define CUDA_SET_IPL 0x12 #define CUDA_SET_AUTO_RATE 0x14 #define CUDA_GET_AUTO_RATE 0x16 #define CUDA_SET_DEVICE_LIST 0x19 #define CUDA_GET_DEVICE_LIST 0x1a #define CUDA_GET_SET_IIC 0x22 #endif /* _LINUX_CUDA_H */ linux/cyclades.h 0000644 00000041324 15063602046 0007651 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $ * linux/include/linux/cyclades.h * * This file was initially written by * Randolph Bentson <bentson@grieg.seaslug.org> and is maintained by * Ivan Passos <ivan@cyclades.com>. * * This file contains the general definitions for the cyclades.c driver *$Log: cyclades.h,v $ *Revision 3.1 2002/01/29 11:36:16 henrique *added throttle field on struct cyclades_port to indicate whether the *port is throttled or not * *Revision 3.1 2000/04/19 18:52:52 ivan *converted address fields to unsigned long and added fields for physical *addresses on cyclades_card structure; * *Revision 3.0 1998/11/02 14:20:59 ivan *added nports field on cyclades_card structure; * *Revision 2.5 1998/08/03 16:57:01 ivan *added cyclades_idle_stats structure; * *Revision 2.4 1998/06/01 12:09:53 ivan *removed closing_wait2 from cyclades_port structure; * *Revision 2.3 1998/03/16 18:01:12 ivan *changes in the cyclades_port structure to get it closer to the *standard serial port structure; *added constants for new ioctls; * *Revision 2.2 1998/02/17 16:50:00 ivan *changes in the cyclades_port structure (addition of shutdown_wait and *chip_rev variables); *added constants for new ioctls and for CD1400 rev. numbers. * *Revision 2.1 1997/10/24 16:03:00 ivan *added rflow (which allows enabling the CD1400 special flow control *feature) and rtsdtr_inv (which allows DTR/RTS pin inversion) to *cyclades_port structure; *added Alpha support * *Revision 2.0 1997/06/30 10:30:00 ivan *added some new doorbell command constants related to IOCTLW and *UART error signaling * *Revision 1.8 1997/06/03 15:30:00 ivan *added constant ZFIRM_HLT *added constant CyPCI_Ze_win ( = 2 * Cy_PCI_Zwin) * *Revision 1.7 1997/03/26 10:30:00 daniel *new entries at the end of cyclades_port struct to reallocate *variables illegally allocated within card memory. * *Revision 1.6 1996/09/09 18:35:30 bentson *fold in changes for Cyclom-Z -- including structures for *communicating with board as well modest changes to original *structures to support new features. * *Revision 1.5 1995/11/13 21:13:31 bentson *changes suggested by Michael Chastain <mec@duracef.shout.net> *to support use of this file in non-kernel applications * * */ #ifndef _LINUX_CYCLADES_H #define _LINUX_CYCLADES_H #include <linux/types.h> struct cyclades_monitor { unsigned long int_count; unsigned long char_count; unsigned long char_max; unsigned long char_last; }; /* * These stats all reflect activity since the device was last initialized. * (i.e., since the port was opened with no other processes already having it * open) */ struct cyclades_idle_stats { __kernel_time_t in_use; /* Time device has been in use (secs) */ __kernel_time_t recv_idle; /* Time since last char received (secs) */ __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */ unsigned long recv_bytes; /* Bytes received */ unsigned long xmit_bytes; /* Bytes transmitted */ unsigned long overruns; /* Input overruns */ unsigned long frame_errs; /* Input framing errors */ unsigned long parity_errs; /* Input parity errors */ }; #define CYCLADES_MAGIC 0x4359 #define CYGETMON 0x435901 #define CYGETTHRESH 0x435902 #define CYSETTHRESH 0x435903 #define CYGETDEFTHRESH 0x435904 #define CYSETDEFTHRESH 0x435905 #define CYGETTIMEOUT 0x435906 #define CYSETTIMEOUT 0x435907 #define CYGETDEFTIMEOUT 0x435908 #define CYSETDEFTIMEOUT 0x435909 #define CYSETRFLOW 0x43590a #define CYGETRFLOW 0x43590b #define CYSETRTSDTR_INV 0x43590c #define CYGETRTSDTR_INV 0x43590d #define CYZSETPOLLCYCLE 0x43590e #define CYZGETPOLLCYCLE 0x43590f #define CYGETCD1400VER 0x435910 #define CYSETWAIT 0x435912 #define CYGETWAIT 0x435913 /*************** CYCLOM-Z ADDITIONS ***************/ #define CZIOC ('M' << 8) #define CZ_NBOARDS (CZIOC|0xfa) #define CZ_BOOT_START (CZIOC|0xfb) #define CZ_BOOT_DATA (CZIOC|0xfc) #define CZ_BOOT_END (CZIOC|0xfd) #define CZ_TEST (CZIOC|0xfe) #define CZ_DEF_POLL (HZ/25) #define MAX_BOARD 4 /* Max number of boards */ #define MAX_DEV 256 /* Max number of ports total */ #define CYZ_MAX_SPEED 921600 #define CYZ_FIFO_SIZE 16 #define CYZ_BOOT_NWORDS 0x100 struct CYZ_BOOT_CTRL { unsigned short nboard; int status[MAX_BOARD]; int nchannel[MAX_BOARD]; int fw_rev[MAX_BOARD]; unsigned long offset; unsigned long data[CYZ_BOOT_NWORDS]; }; #ifndef DP_WINDOW_SIZE /* * Memory Window Sizes */ #define DP_WINDOW_SIZE (0x00080000) /* window size 512 Kb */ #define ZE_DP_WINDOW_SIZE (0x00100000) /* window size 1 Mb (Ze and 8Zo V.2 */ #define CTRL_WINDOW_SIZE (0x00000080) /* runtime regs 128 bytes */ /* * CUSTOM_REG - Cyclom-Z/PCI Custom Registers Set. The driver * normally will access only interested on the fpga_id, fpga_version, * start_cpu and stop_cpu. */ struct CUSTOM_REG { __u32 fpga_id; /* FPGA Identification Register */ __u32 fpga_version; /* FPGA Version Number Register */ __u32 cpu_start; /* CPU start Register (write) */ __u32 cpu_stop; /* CPU stop Register (write) */ __u32 misc_reg; /* Miscellaneous Register */ __u32 idt_mode; /* IDT mode Register */ __u32 uart_irq_status; /* UART IRQ status Register */ __u32 clear_timer0_irq; /* Clear timer interrupt Register */ __u32 clear_timer1_irq; /* Clear timer interrupt Register */ __u32 clear_timer2_irq; /* Clear timer interrupt Register */ __u32 test_register; /* Test Register */ __u32 test_count; /* Test Count Register */ __u32 timer_select; /* Timer select register */ __u32 pr_uart_irq_status; /* Prioritized UART IRQ stat Reg */ __u32 ram_wait_state; /* RAM wait-state Register */ __u32 uart_wait_state; /* UART wait-state Register */ __u32 timer_wait_state; /* timer wait-state Register */ __u32 ack_wait_state; /* ACK wait State Register */ }; /* * RUNTIME_9060 - PLX PCI9060ES local configuration and shared runtime * registers. This structure can be used to access the 9060 registers * (memory mapped). */ struct RUNTIME_9060 { __u32 loc_addr_range; /* 00h - Local Address Range */ __u32 loc_addr_base; /* 04h - Local Address Base */ __u32 loc_arbitr; /* 08h - Local Arbitration */ __u32 endian_descr; /* 0Ch - Big/Little Endian Descriptor */ __u32 loc_rom_range; /* 10h - Local ROM Range */ __u32 loc_rom_base; /* 14h - Local ROM Base */ __u32 loc_bus_descr; /* 18h - Local Bus descriptor */ __u32 loc_range_mst; /* 1Ch - Local Range for Master to PCI */ __u32 loc_base_mst; /* 20h - Local Base for Master PCI */ __u32 loc_range_io; /* 24h - Local Range for Master IO */ __u32 pci_base_mst; /* 28h - PCI Base for Master PCI */ __u32 pci_conf_io; /* 2Ch - PCI configuration for Master IO */ __u32 filler1; /* 30h */ __u32 filler2; /* 34h */ __u32 filler3; /* 38h */ __u32 filler4; /* 3Ch */ __u32 mail_box_0; /* 40h - Mail Box 0 */ __u32 mail_box_1; /* 44h - Mail Box 1 */ __u32 mail_box_2; /* 48h - Mail Box 2 */ __u32 mail_box_3; /* 4Ch - Mail Box 3 */ __u32 filler5; /* 50h */ __u32 filler6; /* 54h */ __u32 filler7; /* 58h */ __u32 filler8; /* 5Ch */ __u32 pci_doorbell; /* 60h - PCI to Local Doorbell */ __u32 loc_doorbell; /* 64h - Local to PCI Doorbell */ __u32 intr_ctrl_stat; /* 68h - Interrupt Control/Status */ __u32 init_ctrl; /* 6Ch - EEPROM control, Init Control, etc */ }; /* Values for the Local Base Address re-map register */ #define WIN_RAM 0x00000001L /* set the sliding window to RAM */ #define WIN_CREG 0x14000001L /* set the window to custom Registers */ /* Values timer select registers */ #define TIMER_BY_1M 0x00 /* clock divided by 1M */ #define TIMER_BY_256K 0x01 /* clock divided by 256k */ #define TIMER_BY_128K 0x02 /* clock divided by 128k */ #define TIMER_BY_32K 0x03 /* clock divided by 32k */ /****************** ****************** *******************/ #endif #ifndef ZFIRM_ID /* #include "zfwint.h" */ /****************** ****************** *******************/ /* * This file contains the definitions for interfacing with the * Cyclom-Z ZFIRM Firmware. */ /* General Constant definitions */ #define MAX_CHAN 64 /* max number of channels per board */ /* firmware id structure (set after boot) */ #define ID_ADDRESS 0x00000180L /* signature/pointer address */ #define ZFIRM_ID 0x5557465AL /* ZFIRM/U signature */ #define ZFIRM_HLT 0x59505B5CL /* ZFIRM needs external power supply */ #define ZFIRM_RST 0x56040674L /* RST signal (due to FW reset) */ #define ZF_TINACT_DEF 1000 /* default inactivity timeout (1000 ms) */ #define ZF_TINACT ZF_TINACT_DEF struct FIRM_ID { __u32 signature; /* ZFIRM/U signature */ __u32 zfwctrl_addr; /* pointer to ZFW_CTRL structure */ }; /* Op. System id */ #define C_OS_LINUX 0x00000030 /* generic Linux system */ /* channel op_mode */ #define C_CH_DISABLE 0x00000000 /* channel is disabled */ #define C_CH_TXENABLE 0x00000001 /* channel Tx enabled */ #define C_CH_RXENABLE 0x00000002 /* channel Rx enabled */ #define C_CH_ENABLE 0x00000003 /* channel Tx/Rx enabled */ #define C_CH_LOOPBACK 0x00000004 /* Loopback mode */ /* comm_parity - parity */ #define C_PR_NONE 0x00000000 /* None */ #define C_PR_ODD 0x00000001 /* Odd */ #define C_PR_EVEN 0x00000002 /* Even */ #define C_PR_MARK 0x00000004 /* Mark */ #define C_PR_SPACE 0x00000008 /* Space */ #define C_PR_PARITY 0x000000ff #define C_PR_DISCARD 0x00000100 /* discard char with frame/par error */ #define C_PR_IGNORE 0x00000200 /* ignore frame/par error */ /* comm_data_l - data length and stop bits */ #define C_DL_CS5 0x00000001 #define C_DL_CS6 0x00000002 #define C_DL_CS7 0x00000004 #define C_DL_CS8 0x00000008 #define C_DL_CS 0x0000000f #define C_DL_1STOP 0x00000010 #define C_DL_15STOP 0x00000020 #define C_DL_2STOP 0x00000040 #define C_DL_STOP 0x000000f0 /* interrupt enabling/status */ #define C_IN_DISABLE 0x00000000 /* zero, disable interrupts */ #define C_IN_TXBEMPTY 0x00000001 /* tx buffer empty */ #define C_IN_TXLOWWM 0x00000002 /* tx buffer below LWM */ #define C_IN_RXHIWM 0x00000010 /* rx buffer above HWM */ #define C_IN_RXNNDT 0x00000020 /* rx no new data timeout */ #define C_IN_MDCD 0x00000100 /* modem DCD change */ #define C_IN_MDSR 0x00000200 /* modem DSR change */ #define C_IN_MRI 0x00000400 /* modem RI change */ #define C_IN_MCTS 0x00000800 /* modem CTS change */ #define C_IN_RXBRK 0x00001000 /* Break received */ #define C_IN_PR_ERROR 0x00002000 /* parity error */ #define C_IN_FR_ERROR 0x00004000 /* frame error */ #define C_IN_OVR_ERROR 0x00008000 /* overrun error */ #define C_IN_RXOFL 0x00010000 /* RX buffer overflow */ #define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */ #define C_IN_MRTS 0x00040000 /* modem RTS drop */ #define C_IN_ICHAR 0x00080000 /* flow control */ #define C_FL_OXX 0x00000001 /* output Xon/Xoff flow control */ #define C_FL_IXX 0x00000002 /* output Xon/Xoff flow control */ #define C_FL_OIXANY 0x00000004 /* output Xon/Xoff (any xon) */ #define C_FL_SWFLOW 0x0000000f /* flow status */ #define C_FS_TXIDLE 0x00000000 /* no Tx data in the buffer or UART */ #define C_FS_SENDING 0x00000001 /* UART is sending data */ #define C_FS_SWFLOW 0x00000002 /* Tx is stopped by received Xoff */ /* rs_control/rs_status RS-232 signals */ #define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in IOCTLM command */ #define C_RS_RTS 0x00000001 /* RTS */ #define C_RS_DTR 0x00000004 /* DTR */ #define C_RS_DCD 0x00000100 /* CD */ #define C_RS_DSR 0x00000200 /* DSR */ #define C_RS_RI 0x00000400 /* RI */ #define C_RS_CTS 0x00000800 /* CTS */ /* commands Host <-> Board */ #define C_CM_RESET 0x01 /* reset/flush buffers */ #define C_CM_IOCTL 0x02 /* re-read CH_CTRL */ #define C_CM_IOCTLW 0x03 /* re-read CH_CTRL, intr when done */ #define C_CM_IOCTLM 0x04 /* RS-232 outputs change */ #define C_CM_SENDXOFF 0x10 /* send Xoff */ #define C_CM_SENDXON 0x11 /* send Xon */ #define C_CM_CLFLOW 0x12 /* Clear flow control (resume) */ #define C_CM_SENDBRK 0x41 /* send break */ #define C_CM_INTBACK 0x42 /* Interrupt back */ #define C_CM_SET_BREAK 0x43 /* Tx break on */ #define C_CM_CLR_BREAK 0x44 /* Tx break off */ #define C_CM_CMD_DONE 0x45 /* Previous command done */ #define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */ #define C_CM_TINACT 0x51 /* set inactivity detection */ #define C_CM_IRQ_ENBL 0x52 /* enable generation of interrupts */ #define C_CM_IRQ_DSBL 0x53 /* disable generation of interrupts */ #define C_CM_ACK_ENBL 0x54 /* enable acknowledged interrupt mode */ #define C_CM_ACK_DSBL 0x55 /* disable acknowledged intr mode */ #define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */ #define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */ #define C_CM_Q_ENABLE 0x58 /* enables queue access from the driver */ #define C_CM_Q_DISABLE 0x59 /* disables queue access from the driver */ #define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */ #define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */ #define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */ #define C_CM_RXNNDT 0x63 /* rx no new data timeout */ #define C_CM_TXFEMPTY 0x64 #define C_CM_ICHAR 0x65 #define C_CM_MDCD 0x70 /* modem DCD change */ #define C_CM_MDSR 0x71 /* modem DSR change */ #define C_CM_MRI 0x72 /* modem RI change */ #define C_CM_MCTS 0x73 /* modem CTS change */ #define C_CM_MRTS 0x74 /* modem RTS drop */ #define C_CM_RXBRK 0x84 /* Break received */ #define C_CM_PR_ERROR 0x85 /* Parity error */ #define C_CM_FR_ERROR 0x86 /* Frame error */ #define C_CM_OVR_ERROR 0x87 /* Overrun error */ #define C_CM_RXOFL 0x88 /* RX buffer overflow */ #define C_CM_CMDERROR 0x90 /* command error */ #define C_CM_FATAL 0x91 /* fatal error */ #define C_CM_HW_RESET 0x92 /* reset board */ /* * CH_CTRL - This per port structure contains all parameters * that control an specific port. It can be seen as the * configuration registers of a "super-serial-controller". */ struct CH_CTRL { __u32 op_mode; /* operation mode */ __u32 intr_enable; /* interrupt masking */ __u32 sw_flow; /* SW flow control */ __u32 flow_status; /* output flow status */ __u32 comm_baud; /* baud rate - numerically specified */ __u32 comm_parity; /* parity */ __u32 comm_data_l; /* data length/stop */ __u32 comm_flags; /* other flags */ __u32 hw_flow; /* HW flow control */ __u32 rs_control; /* RS-232 outputs */ __u32 rs_status; /* RS-232 inputs */ __u32 flow_xon; /* xon char */ __u32 flow_xoff; /* xoff char */ __u32 hw_overflow; /* hw overflow counter */ __u32 sw_overflow; /* sw overflow counter */ __u32 comm_error; /* frame/parity error counter */ __u32 ichar; __u32 filler[7]; }; /* * BUF_CTRL - This per channel structure contains * all Tx and Rx buffer control for a given channel. */ struct BUF_CTRL { __u32 flag_dma; /* buffers are in Host memory */ __u32 tx_bufaddr; /* address of the tx buffer */ __u32 tx_bufsize; /* tx buffer size */ __u32 tx_threshold; /* tx low water mark */ __u32 tx_get; /* tail index tx buf */ __u32 tx_put; /* head index tx buf */ __u32 rx_bufaddr; /* address of the rx buffer */ __u32 rx_bufsize; /* rx buffer size */ __u32 rx_threshold; /* rx high water mark */ __u32 rx_get; /* tail index rx buf */ __u32 rx_put; /* head index rx buf */ __u32 filler[5]; /* filler to align structures */ }; /* * BOARD_CTRL - This per board structure contains all global * control fields related to the board. */ struct BOARD_CTRL { /* static info provided by the on-board CPU */ __u32 n_channel; /* number of channels */ __u32 fw_version; /* firmware version */ /* static info provided by the driver */ __u32 op_system; /* op_system id */ __u32 dr_version; /* driver version */ /* board control area */ __u32 inactivity; /* inactivity control */ /* host to FW commands */ __u32 hcmd_channel; /* channel number */ __u32 hcmd_param; /* pointer to parameters */ /* FW to Host commands */ __u32 fwcmd_channel; /* channel number */ __u32 fwcmd_param; /* pointer to parameters */ __u32 zf_int_queue_addr; /* offset for INT_QUEUE structure */ /* filler so the structures are aligned */ __u32 filler[6]; }; /* Host Interrupt Queue */ #define QUEUE_SIZE (10*MAX_CHAN) struct INT_QUEUE { unsigned char intr_code[QUEUE_SIZE]; unsigned long channel[QUEUE_SIZE]; unsigned long param[QUEUE_SIZE]; unsigned long put; unsigned long get; }; /* * ZFW_CTRL - This is the data structure that includes all other * data structures used by the Firmware. */ struct ZFW_CTRL { struct BOARD_CTRL board_ctrl; struct CH_CTRL ch_ctrl[MAX_CHAN]; struct BUF_CTRL buf_ctrl[MAX_CHAN]; }; /****************** ****************** *******************/ #endif #endif /* _LINUX_CYCLADES_H */ linux/cycx_cfm.h 0000644 00000005656 15063602046 0007665 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * cycx_cfm.h Cyclom 2X WAN Link Driver. * Definitions for the Cyclom 2X Firmware Module (CFM). * * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> * * Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo * * Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ * 1998/08/08 acme Initial version. */ #ifndef _CYCX_CFM_H #define _CYCX_CFM_H /* Defines */ #define CFM_VERSION 2 #define CFM_SIGNATURE "CFM - Cyclades CYCX Firmware Module" /* min/max */ #define CFM_IMAGE_SIZE 0x20000 /* max size of CYCX code image file */ #define CFM_DESCR_LEN 256 /* max length of description string */ #define CFM_MAX_CYCX 1 /* max number of compatible adapters */ #define CFM_LOAD_BUFSZ 0x400 /* buffer size for reset code (buffer_load) */ /* Firmware Commands */ #define GEN_POWER_ON 0x1280 #define GEN_SET_SEG 0x1401 /* boot segment setting. */ #define GEN_BOOT_DAT 0x1402 /* boot data. */ #define GEN_START 0x1403 /* board start. */ #define GEN_DEFPAR 0x1404 /* buffer length for boot. */ /* Adapter Types */ #define CYCX_2X 2 /* for now only the 2X is supported, no plans to support 8X or 16X */ #define CYCX_8X 8 #define CYCX_16X 16 #define CFID_X25_2X 5200 /** * struct cycx_fw_info - firmware module information. * @codeid - firmware ID * @version - firmware version number * @adapter - compatible adapter types * @memsize - minimum memory size * @reserved - reserved * @startoffs - entry point offset * @winoffs - dual-port memory window offset * @codeoffs - code load offset * @codesize - code size * @dataoffs - configuration data load offset * @datasize - configuration data size */ struct cycx_fw_info { unsigned short codeid; unsigned short version; unsigned short adapter[CFM_MAX_CYCX]; unsigned long memsize; unsigned short reserved[2]; unsigned short startoffs; unsigned short winoffs; unsigned short codeoffs; unsigned long codesize; unsigned short dataoffs; unsigned long datasize; }; /** * struct cycx_firmware - CYCX firmware file structure * @signature - CFM file signature * @version - file format version * @checksum - info + image * @reserved - reserved * @descr - description string * @info - firmware module info * @image - code image (variable size) */ struct cycx_firmware { char signature[80]; unsigned short version; unsigned short checksum; unsigned short reserved[6]; char descr[CFM_DESCR_LEN]; struct cycx_fw_info info; unsigned char image[0]; }; struct cycx_fw_header { unsigned long reset_size; unsigned long data_size; unsigned long code_size; }; #endif /* _CYCX_CFM_H */ linux/dcbnl.h 0000644 00000061226 15063602046 0007147 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2008-2011, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Author: Lucy Liu <lucy.liu@intel.com> */ #ifndef __LINUX_DCBNL_H__ #define __LINUX_DCBNL_H__ #include <linux/types.h> /* IEEE 802.1Qaz std supported values */ #define IEEE_8021QAZ_MAX_TCS 8 #define IEEE_8021QAZ_TSA_STRICT 0 #define IEEE_8021QAZ_TSA_CB_SHAPER 1 #define IEEE_8021QAZ_TSA_ETS 2 #define IEEE_8021QAZ_TSA_VENDOR 255 /* This structure contains the IEEE 802.1Qaz ETS managed object * * @willing: willing bit in ETS configuration TLV * @ets_cap: indicates supported capacity of ets feature * @cbs: credit based shaper ets algorithm supported * @tc_tx_bw: tc tx bandwidth indexed by traffic class * @tc_rx_bw: tc rx bandwidth indexed by traffic class * @tc_tsa: TSA Assignment table, indexed by traffic class * @prio_tc: priority assignment table mapping 8021Qp to traffic class * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV * * Recommended values are used to set fields in the ETS recommendation TLV * with hardware offloaded LLDP. * * ---- * TSA Assignment 8 bit identifiers * 0 strict priority * 1 credit-based shaper * 2 enhanced transmission selection * 3-254 reserved * 255 vendor specific */ struct ieee_ets { __u8 willing; __u8 ets_cap; __u8 cbs; __u8 tc_tx_bw[IEEE_8021QAZ_MAX_TCS]; __u8 tc_rx_bw[IEEE_8021QAZ_MAX_TCS]; __u8 tc_tsa[IEEE_8021QAZ_MAX_TCS]; __u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; __u8 tc_reco_bw[IEEE_8021QAZ_MAX_TCS]; __u8 tc_reco_tsa[IEEE_8021QAZ_MAX_TCS]; __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS]; }; /* This structure contains rate limit extension to the IEEE 802.1Qaz ETS * managed object. * Values are 64 bits long and specified in Kbps to enable usage over both * slow and very fast networks. * * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class */ struct ieee_maxrate { __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; }; enum dcbnl_cndd_states { DCB_CNDD_RESET = 0, DCB_CNDD_EDGE, DCB_CNDD_INTERIOR, DCB_CNDD_INTERIOR_READY, }; /* This structure contains the IEEE 802.1Qau QCN managed object. * *@rpg_enable: enable QCN RP *@rppp_max_rps: maximum number of RPs allowed for this CNPV on this port *@rpg_time_reset: time between rate increases if no CNMs received. * given in u-seconds *@rpg_byte_reset: transmitted data between rate increases if no CNMs received. * given in Bytes *@rpg_threshold: The number of times rpByteStage or rpTimeStage can count * before RP rate control state machine advances states *@rpg_max_rate: the maxinun rate, in Mbits per second, * at which an RP can transmit *@rpg_ai_rate: The rate, in Mbits per second, * used to increase rpTargetRate in the RPR_ACTIVE_INCREASE *@rpg_hai_rate: The rate, in Mbits per second, * used to increase rpTargetRate in the RPR_HYPER_INCREASE state *@rpg_gd: Upon CNM receive, flow rate is limited to (Fb/Gd)*CurrentRate. * rpgGd is given as log2(Gd), where Gd may only be powers of 2 *@rpg_min_dec_fac: The minimum factor by which the current transmit rate * can be changed by reception of a CNM. * value is given as percentage (1-100) *@rpg_min_rate: The minimum value, in bits per second, for rate to limit *@cndd_state_machine: The state of the congestion notification domain * defense state machine, as defined by IEEE 802.3Qau * section 32.1.1. In the interior ready state, * the QCN capable hardware may add CN-TAG TLV to the * outgoing traffic, to specifically identify outgoing * flows. */ struct ieee_qcn { __u8 rpg_enable[IEEE_8021QAZ_MAX_TCS]; __u32 rppp_max_rps[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_time_reset[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_byte_reset[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_threshold[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_max_rate[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_ai_rate[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_hai_rate[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_gd[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_min_dec_fac[IEEE_8021QAZ_MAX_TCS]; __u32 rpg_min_rate[IEEE_8021QAZ_MAX_TCS]; __u32 cndd_state_machine[IEEE_8021QAZ_MAX_TCS]; }; /* This structure contains the IEEE 802.1Qau QCN statistics. * *@rppp_rp_centiseconds: the number of RP-centiseconds accumulated * by RPs at this priority level on this Port *@rppp_created_rps: number of active RPs(flows) that react to CNMs */ struct ieee_qcn_stats { __u64 rppp_rp_centiseconds[IEEE_8021QAZ_MAX_TCS]; __u32 rppp_created_rps[IEEE_8021QAZ_MAX_TCS]; }; /* This structure contains the IEEE 802.1Qaz PFC managed object * * @pfc_cap: Indicates the number of traffic classes on the local device * that may simultaneously have PFC enabled. * @pfc_en: bitmap indicating pfc enabled traffic classes * @mbc: enable macsec bypass capability * @delay: the allowance made for a round-trip propagation delay of the * link in bits. * @requests: count of the sent pfc frames * @indications: count of the received pfc frames */ struct ieee_pfc { __u8 pfc_cap; __u8 pfc_en; __u8 mbc; __u16 delay; __u64 requests[IEEE_8021QAZ_MAX_TCS]; __u64 indications[IEEE_8021QAZ_MAX_TCS]; }; #define IEEE_8021Q_MAX_PRIORITIES 8 #define DCBX_MAX_BUFFERS 8 struct dcbnl_buffer { /* priority to buffer mapping */ __u8 prio2buffer[IEEE_8021Q_MAX_PRIORITIES]; /* buffer size in Bytes */ __u32 buffer_size[DCBX_MAX_BUFFERS]; __u32 total_size; }; /* CEE DCBX std supported values */ #define CEE_DCBX_MAX_PGS 8 #define CEE_DCBX_MAX_PRIO 8 /** * struct cee_pg - CEE Priority-Group managed object * * @willing: willing bit in the PG tlv * @error: error bit in the PG tlv * @pg_en: enable bit of the PG feature * @tcs_supported: number of traffic classes supported * @pg_bw: bandwidth percentage for each priority group * @prio_pg: priority to PG mapping indexed by priority */ struct cee_pg { __u8 willing; __u8 error; __u8 pg_en; __u8 tcs_supported; __u8 pg_bw[CEE_DCBX_MAX_PGS]; __u8 prio_pg[CEE_DCBX_MAX_PGS]; }; /** * struct cee_pfc - CEE PFC managed object * * @willing: willing bit in the PFC tlv * @error: error bit in the PFC tlv * @pfc_en: bitmap indicating pfc enabled traffic classes * @tcs_supported: number of traffic classes supported */ struct cee_pfc { __u8 willing; __u8 error; __u8 pfc_en; __u8 tcs_supported; }; /* IEEE 802.1Qaz std supported values */ #define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1 #define IEEE_8021QAZ_APP_SEL_STREAM 2 #define IEEE_8021QAZ_APP_SEL_DGRAM 3 #define IEEE_8021QAZ_APP_SEL_ANY 4 #define IEEE_8021QAZ_APP_SEL_DSCP 5 /* This structure contains the IEEE 802.1Qaz APP managed object. This * object is also used for the CEE std as well. * * @selector: protocol identifier type * @protocol: protocol of type indicated * @priority: 3-bit unsigned integer indicating priority for IEEE * 8-bit 802.1p user priority bitmap for CEE * * ---- * Selector field values for IEEE 802.1Qaz * 0 Reserved * 1 Ethertype * 2 Well known port number over TCP or SCTP * 3 Well known port number over UDP or DCCP * 4 Well known port number over TCP, SCTP, UDP, or DCCP * 5-7 Reserved * * Selector field values for CEE * 0 Ethertype * 1 Well known port number over TCP or UDP * 2-3 Reserved */ struct dcb_app { __u8 selector; __u8 priority; __u16 protocol; }; /** * struct dcb_peer_app_info - APP feature information sent by the peer * * @willing: willing bit in the peer APP tlv * @error: error bit in the peer APP tlv * * In addition to this information the full peer APP tlv also contains * a table of 'app_count' APP objects defined above. */ struct dcb_peer_app_info { __u8 willing; __u8 error; }; struct dcbmsg { __u8 dcb_family; __u8 cmd; __u16 dcb_pad; }; /** * enum dcbnl_commands - supported DCB commands * * @DCB_CMD_UNDEFINED: unspecified command to catch errors * @DCB_CMD_GSTATE: request the state of DCB in the device * @DCB_CMD_SSTATE: set the state of DCB in the device * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx * @DCB_CMD_PFC_GCFG: request the priority flow control configuration * @DCB_CMD_PFC_SCFG: set the priority flow control configuration * @DCB_CMD_SET_ALL: apply all changes to the underlying device * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying * device. Only useful when using bonding. * @DCB_CMD_GCAP: request the DCB capabilities of the device * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported * @DCB_CMD_SNUMTCS: set the number of traffic classes * @DCB_CMD_GBCN: set backward congestion notification configuration * @DCB_CMD_SBCN: get backward congestion notification configration. * @DCB_CMD_GAPP: get application protocol configuration * @DCB_CMD_SAPP: set application protocol configuration * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration * @DCB_CMD_GDCBX: get DCBX engine configuration * @DCB_CMD_SDCBX: set DCBX engine configuration * @DCB_CMD_GFEATCFG: get DCBX features flags * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags * @DCB_CMD_CEE_GET: get CEE aggregated configuration * @DCB_CMD_IEEE_DEL: delete IEEE 802.1Qaz configuration */ enum dcbnl_commands { DCB_CMD_UNDEFINED, DCB_CMD_GSTATE, DCB_CMD_SSTATE, DCB_CMD_PGTX_GCFG, DCB_CMD_PGTX_SCFG, DCB_CMD_PGRX_GCFG, DCB_CMD_PGRX_SCFG, DCB_CMD_PFC_GCFG, DCB_CMD_PFC_SCFG, DCB_CMD_SET_ALL, DCB_CMD_GPERM_HWADDR, DCB_CMD_GCAP, DCB_CMD_GNUMTCS, DCB_CMD_SNUMTCS, DCB_CMD_PFC_GSTATE, DCB_CMD_PFC_SSTATE, DCB_CMD_BCN_GCFG, DCB_CMD_BCN_SCFG, DCB_CMD_GAPP, DCB_CMD_SAPP, DCB_CMD_IEEE_SET, DCB_CMD_IEEE_GET, DCB_CMD_GDCBX, DCB_CMD_SDCBX, DCB_CMD_GFEATCFG, DCB_CMD_SFEATCFG, DCB_CMD_CEE_GET, DCB_CMD_IEEE_DEL, __DCB_CMD_ENUM_MAX, DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, }; /** * enum dcbnl_attrs - DCB top-level netlink attributes * * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING) * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8) * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8) * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED) * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8) * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED) * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8) * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED) * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED) * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED) * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED) * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED) */ enum dcbnl_attrs { DCB_ATTR_UNDEFINED, DCB_ATTR_IFNAME, DCB_ATTR_STATE, DCB_ATTR_PFC_STATE, DCB_ATTR_PFC_CFG, DCB_ATTR_NUM_TC, DCB_ATTR_PG_CFG, DCB_ATTR_SET_ALL, DCB_ATTR_PERM_HWADDR, DCB_ATTR_CAP, DCB_ATTR_NUMTCS, DCB_ATTR_BCN, DCB_ATTR_APP, /* IEEE std attributes */ DCB_ATTR_IEEE, DCB_ATTR_DCBX, DCB_ATTR_FEATCFG, /* CEE nested attributes */ DCB_ATTR_CEE, __DCB_ATTR_ENUM_MAX, DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, }; /** * enum ieee_attrs - IEEE 802.1Qaz get/set attributes * * @DCB_ATTR_IEEE_UNSPEC: unspecified * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only */ enum ieee_attrs { DCB_ATTR_IEEE_UNSPEC, DCB_ATTR_IEEE_ETS, DCB_ATTR_IEEE_PFC, DCB_ATTR_IEEE_APP_TABLE, DCB_ATTR_IEEE_PEER_ETS, DCB_ATTR_IEEE_PEER_PFC, DCB_ATTR_IEEE_PEER_APP, DCB_ATTR_IEEE_MAXRATE, DCB_ATTR_IEEE_QCN, DCB_ATTR_IEEE_QCN_STATS, DCB_ATTR_DCB_BUFFER, __DCB_ATTR_IEEE_MAX }; #define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) enum ieee_attrs_app { DCB_ATTR_IEEE_APP_UNSPEC, DCB_ATTR_IEEE_APP, __DCB_ATTR_IEEE_APP_MAX }; #define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) /** * enum cee_attrs - CEE DCBX get attributes. * * @DCB_ATTR_CEE_UNSPEC: unspecified * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only * @DCB_ATTR_CEE_PEER_APP_TABLE: peer APP tlv - get only * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG) * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG) * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG) * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP) * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG) * * An aggregated collection of the cee std negotiated parameters. */ enum cee_attrs { DCB_ATTR_CEE_UNSPEC, DCB_ATTR_CEE_PEER_PG, DCB_ATTR_CEE_PEER_PFC, DCB_ATTR_CEE_PEER_APP_TABLE, DCB_ATTR_CEE_TX_PG, DCB_ATTR_CEE_RX_PG, DCB_ATTR_CEE_PFC, DCB_ATTR_CEE_APP_TABLE, DCB_ATTR_CEE_FEAT, __DCB_ATTR_CEE_MAX }; #define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1) enum peer_app_attr { DCB_ATTR_CEE_PEER_APP_UNSPEC, DCB_ATTR_CEE_PEER_APP_INFO, DCB_ATTR_CEE_PEER_APP, __DCB_ATTR_CEE_PEER_APP_MAX }; #define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1) enum cee_attrs_app { DCB_ATTR_CEE_APP_UNSPEC, DCB_ATTR_CEE_APP, __DCB_ATTR_CEE_APP_MAX }; #define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1) /** * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs * * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8) * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8) * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8) * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8) * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8) * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8) * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8) * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8) * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG) * */ enum dcbnl_pfc_up_attrs { DCB_PFC_UP_ATTR_UNDEFINED, DCB_PFC_UP_ATTR_0, DCB_PFC_UP_ATTR_1, DCB_PFC_UP_ATTR_2, DCB_PFC_UP_ATTR_3, DCB_PFC_UP_ATTR_4, DCB_PFC_UP_ATTR_5, DCB_PFC_UP_ATTR_6, DCB_PFC_UP_ATTR_7, DCB_PFC_UP_ATTR_ALL, __DCB_PFC_UP_ATTR_ENUM_MAX, DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1, }; /** * enum dcbnl_pg_attrs - DCB Priority Group attributes * * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED) * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED) * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8) * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8) * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8) * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8) * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8) * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8) * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8) * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8) * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG) * */ enum dcbnl_pg_attrs { DCB_PG_ATTR_UNDEFINED, DCB_PG_ATTR_TC_0, DCB_PG_ATTR_TC_1, DCB_PG_ATTR_TC_2, DCB_PG_ATTR_TC_3, DCB_PG_ATTR_TC_4, DCB_PG_ATTR_TC_5, DCB_PG_ATTR_TC_6, DCB_PG_ATTR_TC_7, DCB_PG_ATTR_TC_MAX, DCB_PG_ATTR_TC_ALL, DCB_PG_ATTR_BW_ID_0, DCB_PG_ATTR_BW_ID_1, DCB_PG_ATTR_BW_ID_2, DCB_PG_ATTR_BW_ID_3, DCB_PG_ATTR_BW_ID_4, DCB_PG_ATTR_BW_ID_5, DCB_PG_ATTR_BW_ID_6, DCB_PG_ATTR_BW_ID_7, DCB_PG_ATTR_BW_ID_MAX, DCB_PG_ATTR_BW_ID_ALL, __DCB_PG_ATTR_ENUM_MAX, DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1, }; /** * enum dcbnl_tc_attrs - DCB Traffic Class attributes * * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to * Valid values are: 0-7 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map * Some devices may not support changing the * user priority map of a TC. * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting * 0 - none * 1 - group strict * 2 - link strict * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and * not configured to use link strict priority, * this is the percentage of bandwidth of the * priority group this traffic class belongs to * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters * */ enum dcbnl_tc_attrs { DCB_TC_ATTR_PARAM_UNDEFINED, DCB_TC_ATTR_PARAM_PGID, DCB_TC_ATTR_PARAM_UP_MAPPING, DCB_TC_ATTR_PARAM_STRICT_PRIO, DCB_TC_ATTR_PARAM_BW_PCT, DCB_TC_ATTR_PARAM_ALL, __DCB_TC_ATTR_PARAM_ENUM_MAX, DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1, }; /** * enum dcbnl_cap_attrs - DCB Capability attributes * * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to * traffic class mapping * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a * number of traffic classes the device * can be configured to use for Priority Groups * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a * number of traffic classes the device can be * configured to use for Priority Flow Control * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion * Notification * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine * */ enum dcbnl_cap_attrs { DCB_CAP_ATTR_UNDEFINED, DCB_CAP_ATTR_ALL, DCB_CAP_ATTR_PG, DCB_CAP_ATTR_PFC, DCB_CAP_ATTR_UP2TC, DCB_CAP_ATTR_PG_TCS, DCB_CAP_ATTR_PFC_TCS, DCB_CAP_ATTR_GSP, DCB_CAP_ATTR_BCN, DCB_CAP_ATTR_DCBX, __DCB_CAP_ATTR_ENUM_MAX, DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1, }; /** * DCBX capability flags * * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent. * 'set' routines are used to configure the device with * the negotiated parameters * * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but * by another entity * 'get' routines are used to retrieve the * negotiated parameters * 'set' routines can be used to set the initial * negotiation configuration * * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine * supports the CEE protocol flavor * * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine * supports the IEEE protocol flavor * * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine * supports static configuration (i.e no actual * negotiation is performed negotiated parameters equal * the initial configuration) * */ #define DCB_CAP_DCBX_HOST 0x01 #define DCB_CAP_DCBX_LLD_MANAGED 0x02 #define DCB_CAP_DCBX_VER_CEE 0x04 #define DCB_CAP_DCBX_VER_IEEE 0x08 #define DCB_CAP_DCBX_STATIC 0x10 /** * enum dcbnl_numtcs_attrs - number of traffic classes * * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for * priority groups * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can * support priority flow control */ enum dcbnl_numtcs_attrs { DCB_NUMTCS_ATTR_UNDEFINED, DCB_NUMTCS_ATTR_ALL, DCB_NUMTCS_ATTR_PG, DCB_NUMTCS_ATTR_PFC, __DCB_NUMTCS_ATTR_ENUM_MAX, DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1, }; enum dcbnl_bcn_attrs{ DCB_BCN_ATTR_UNDEFINED = 0, DCB_BCN_ATTR_RP_0, DCB_BCN_ATTR_RP_1, DCB_BCN_ATTR_RP_2, DCB_BCN_ATTR_RP_3, DCB_BCN_ATTR_RP_4, DCB_BCN_ATTR_RP_5, DCB_BCN_ATTR_RP_6, DCB_BCN_ATTR_RP_7, DCB_BCN_ATTR_RP_ALL, DCB_BCN_ATTR_BCNA_0, DCB_BCN_ATTR_BCNA_1, DCB_BCN_ATTR_ALPHA, DCB_BCN_ATTR_BETA, DCB_BCN_ATTR_GD, DCB_BCN_ATTR_GI, DCB_BCN_ATTR_TMAX, DCB_BCN_ATTR_TD, DCB_BCN_ATTR_RMIN, DCB_BCN_ATTR_W, DCB_BCN_ATTR_RD, DCB_BCN_ATTR_RU, DCB_BCN_ATTR_WRTT, DCB_BCN_ATTR_RI, DCB_BCN_ATTR_C, DCB_BCN_ATTR_ALL, __DCB_BCN_ATTR_ENUM_MAX, DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1, }; /** * enum dcb_general_attr_values - general DCB attribute values * * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported * */ enum dcb_general_attr_values { DCB_ATTR_VALUE_UNDEFINED = 0xff }; #define DCB_APP_IDTYPE_ETHTYPE 0x00 #define DCB_APP_IDTYPE_PORTNUM 0x01 enum dcbnl_app_attrs { DCB_APP_ATTR_UNDEFINED, DCB_APP_ATTR_IDTYPE, DCB_APP_ATTR_ID, DCB_APP_ATTR_PRIORITY, __DCB_APP_ATTR_ENUM_MAX, DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1, }; /** * enum dcbnl_featcfg_attrs - features conifiguration flags * * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority * flow control * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV * */ #define DCB_FEATCFG_ERROR 0x01 /* error in feature resolution */ #define DCB_FEATCFG_ENABLE 0x02 /* enable feature */ #define DCB_FEATCFG_WILLING 0x04 /* feature is willing */ #define DCB_FEATCFG_ADVERTISE 0x08 /* advertise feature */ enum dcbnl_featcfg_attrs { DCB_FEATCFG_ATTR_UNDEFINED, DCB_FEATCFG_ATTR_ALL, DCB_FEATCFG_ATTR_PG, DCB_FEATCFG_ATTR_PFC, DCB_FEATCFG_ATTR_APP, __DCB_FEATCFG_ATTR_ENUM_MAX, DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1, }; #endif /* __LINUX_DCBNL_H__ */ linux/dccp.h 0000644 00000014444 15063602046 0006776 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_DCCP_H #define _LINUX_DCCP_H #include <linux/types.h> #include <asm/byteorder.h> /** * struct dccp_hdr - generic part of DCCP packet header * * @dccph_sport - Relevant port on the endpoint that sent this packet * @dccph_dport - Relevant port on the other endpoint * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words * @dccph_ccval - Used by the HC-Sender CCID * @dccph_cscov - Parts of the packet that are covered by the Checksum field * @dccph_checksum - Internet checksum, depends on dccph_cscov * @dccph_x - 0 = 24 bit sequence number, 1 = 48 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x */ struct dccp_hdr { __be16 dccph_sport, dccph_dport; __u8 dccph_doff; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 dccph_cscov:4, dccph_ccval:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 dccph_ccval:4, dccph_cscov:4; #else #error "Adjust your <asm/byteorder.h> defines" #endif __sum16 dccph_checksum; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 dccph_x:1, dccph_type:4, dccph_reserved:3; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 dccph_reserved:3, dccph_type:4, dccph_x:1; #else #error "Adjust your <asm/byteorder.h> defines" #endif __u8 dccph_seq2; __be16 dccph_seq; }; /** * struct dccp_hdr_ext - the low bits of a 48 bit seq packet * * @dccph_seq_low - low 24 bits of a 48 bit seq packet */ struct dccp_hdr_ext { __be32 dccph_seq_low; }; /** * struct dccp_hdr_request - Connection initiation request header * * @dccph_req_service - Service to which the client app wants to connect */ struct dccp_hdr_request { __be32 dccph_req_service; }; /** * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets * * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR */ struct dccp_hdr_ack_bits { __be16 dccph_reserved1; __be16 dccph_ack_nr_high; __be32 dccph_ack_nr_low; }; /** * struct dccp_hdr_response - Connection initiation response header * * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3) * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request */ struct dccp_hdr_response { struct dccp_hdr_ack_bits dccph_resp_ack; __be32 dccph_resp_service; }; /** * struct dccp_hdr_reset - Unconditionally shut down a connection * * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6) * @dccph_reset_code - one of %dccp_reset_codes * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6 */ struct dccp_hdr_reset { struct dccp_hdr_ack_bits dccph_reset_ack; __u8 dccph_reset_code, dccph_reset_data[3]; }; enum dccp_pkt_type { DCCP_PKT_REQUEST = 0, DCCP_PKT_RESPONSE, DCCP_PKT_DATA, DCCP_PKT_ACK, DCCP_PKT_DATAACK, DCCP_PKT_CLOSEREQ, DCCP_PKT_CLOSE, DCCP_PKT_RESET, DCCP_PKT_SYNC, DCCP_PKT_SYNCACK, DCCP_PKT_INVALID, }; #define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID static __inline__ unsigned int dccp_packet_hdr_len(const __u8 type) { if (type == DCCP_PKT_DATA) return 0; if (type == DCCP_PKT_DATAACK || type == DCCP_PKT_ACK || type == DCCP_PKT_SYNC || type == DCCP_PKT_SYNCACK || type == DCCP_PKT_CLOSE || type == DCCP_PKT_CLOSEREQ) return sizeof(struct dccp_hdr_ack_bits); if (type == DCCP_PKT_REQUEST) return sizeof(struct dccp_hdr_request); if (type == DCCP_PKT_RESPONSE) return sizeof(struct dccp_hdr_response); return sizeof(struct dccp_hdr_reset); } enum dccp_reset_codes { DCCP_RESET_CODE_UNSPECIFIED = 0, DCCP_RESET_CODE_CLOSED, DCCP_RESET_CODE_ABORTED, DCCP_RESET_CODE_NO_CONNECTION, DCCP_RESET_CODE_PACKET_ERROR, DCCP_RESET_CODE_OPTION_ERROR, DCCP_RESET_CODE_MANDATORY_ERROR, DCCP_RESET_CODE_CONNECTION_REFUSED, DCCP_RESET_CODE_BAD_SERVICE_CODE, DCCP_RESET_CODE_TOO_BUSY, DCCP_RESET_CODE_BAD_INIT_COOKIE, DCCP_RESET_CODE_AGGRESSION_PENALTY, DCCP_MAX_RESET_CODES /* Leave at the end! */ }; /* DCCP options */ enum { DCCPO_PADDING = 0, DCCPO_MANDATORY = 1, DCCPO_MIN_RESERVED = 3, DCCPO_MAX_RESERVED = 31, DCCPO_CHANGE_L = 32, DCCPO_CONFIRM_L = 33, DCCPO_CHANGE_R = 34, DCCPO_CONFIRM_R = 35, DCCPO_NDP_COUNT = 37, DCCPO_ACK_VECTOR_0 = 38, DCCPO_ACK_VECTOR_1 = 39, DCCPO_TIMESTAMP = 41, DCCPO_TIMESTAMP_ECHO = 42, DCCPO_ELAPSED_TIME = 43, DCCPO_MAX = 45, DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */ DCCPO_MAX_RX_CCID_SPECIFIC = 191, DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */ DCCPO_MAX_TX_CCID_SPECIFIC = 255, }; /* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */ #define DCCP_SINGLE_OPT_MAXLEN 253 /* DCCP CCIDS */ enum { DCCPC_CCID2 = 2, DCCPC_CCID3 = 3, }; /* DCCP features (RFC 4340 section 6.4) */ enum dccp_feature_numbers { DCCPF_RESERVED = 0, DCCPF_CCID = 1, DCCPF_SHORT_SEQNOS = 2, DCCPF_SEQUENCE_WINDOW = 3, DCCPF_ECN_INCAPABLE = 4, DCCPF_ACK_RATIO = 5, DCCPF_SEND_ACK_VECTOR = 6, DCCPF_SEND_NDP_COUNT = 7, DCCPF_MIN_CSUM_COVER = 8, DCCPF_DATA_CHECKSUM = 9, /* 10-127 reserved */ DCCPF_MIN_CCID_SPECIFIC = 128, DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */ DCCPF_MAX_CCID_SPECIFIC = 255, }; /* DCCP socket control message types for cmsg */ enum dccp_cmsg_type { DCCP_SCM_PRIORITY = 1, DCCP_SCM_QPOLICY_MAX = 0xFFFF, /* ^-- Up to here reserved exclusively for qpolicy parameters */ DCCP_SCM_MAX }; /* DCCP priorities for outgoing/queued packets */ enum dccp_packet_dequeueing_policy { DCCPQ_POLICY_SIMPLE, DCCPQ_POLICY_PRIO, DCCPQ_POLICY_MAX }; /* DCCP socket options */ #define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ #define DCCP_SOCKOPT_SERVICE 2 #define DCCP_SOCKOPT_CHANGE_L 3 #define DCCP_SOCKOPT_CHANGE_R 4 #define DCCP_SOCKOPT_GET_CUR_MPS 5 #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 #define DCCP_SOCKOPT_SEND_CSCOV 10 #define DCCP_SOCKOPT_RECV_CSCOV 11 #define DCCP_SOCKOPT_AVAILABLE_CCIDS 12 #define DCCP_SOCKOPT_CCID 13 #define DCCP_SOCKOPT_TX_CCID 14 #define DCCP_SOCKOPT_RX_CCID 15 #define DCCP_SOCKOPT_QPOLICY_ID 16 #define DCCP_SOCKOPT_QPOLICY_TXQLEN 17 #define DCCP_SOCKOPT_CCID_RX_INFO 128 #define DCCP_SOCKOPT_CCID_TX_INFO 192 /* maximum number of services provided on the same listening port */ #define DCCP_SERVICE_LIST_MAX_LEN 32 #endif /* _LINUX_DCCP_H */ linux/devlink.h 0000644 00000052064 15063602046 0007521 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/uapi/linux/devlink.h - Network physical device Netlink interface * Copyright (c) 2016 Mellanox Technologies. All rights reserved. * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef _LINUX_DEVLINK_H_ #define _LINUX_DEVLINK_H_ #include <linux/const.h> #define DEVLINK_GENL_NAME "devlink" #define DEVLINK_GENL_VERSION 0x1 #define DEVLINK_GENL_MCGRP_CONFIG_NAME "config" enum devlink_command { /* don't change the order or add anything between, this is ABI! */ DEVLINK_CMD_UNSPEC, DEVLINK_CMD_GET, /* can dump */ DEVLINK_CMD_SET, DEVLINK_CMD_NEW, DEVLINK_CMD_DEL, DEVLINK_CMD_PORT_GET, /* can dump */ DEVLINK_CMD_PORT_SET, DEVLINK_CMD_PORT_NEW, DEVLINK_CMD_PORT_DEL, DEVLINK_CMD_PORT_SPLIT, DEVLINK_CMD_PORT_UNSPLIT, DEVLINK_CMD_SB_GET, /* can dump */ DEVLINK_CMD_SB_SET, DEVLINK_CMD_SB_NEW, DEVLINK_CMD_SB_DEL, DEVLINK_CMD_SB_POOL_GET, /* can dump */ DEVLINK_CMD_SB_POOL_SET, DEVLINK_CMD_SB_POOL_NEW, DEVLINK_CMD_SB_POOL_DEL, DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */ DEVLINK_CMD_SB_PORT_POOL_SET, DEVLINK_CMD_SB_PORT_POOL_NEW, DEVLINK_CMD_SB_PORT_POOL_DEL, DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */ DEVLINK_CMD_SB_TC_POOL_BIND_SET, DEVLINK_CMD_SB_TC_POOL_BIND_NEW, DEVLINK_CMD_SB_TC_POOL_BIND_DEL, /* Shared buffer occupancy monitoring commands */ DEVLINK_CMD_SB_OCC_SNAPSHOT, DEVLINK_CMD_SB_OCC_MAX_CLEAR, DEVLINK_CMD_ESWITCH_GET, #define DEVLINK_CMD_ESWITCH_MODE_GET /* obsolete, never use this! */ \ DEVLINK_CMD_ESWITCH_GET DEVLINK_CMD_ESWITCH_SET, #define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \ DEVLINK_CMD_ESWITCH_SET DEVLINK_CMD_DPIPE_TABLE_GET, DEVLINK_CMD_DPIPE_ENTRIES_GET, DEVLINK_CMD_DPIPE_HEADERS_GET, DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, DEVLINK_CMD_RESOURCE_SET, DEVLINK_CMD_RESOURCE_DUMP, /* Hot driver reload, makes configuration changes take place. The * devlink instance is not released during the process. */ DEVLINK_CMD_RELOAD, DEVLINK_CMD_PARAM_GET, /* can dump */ DEVLINK_CMD_PARAM_SET, DEVLINK_CMD_PARAM_NEW, DEVLINK_CMD_PARAM_DEL, DEVLINK_CMD_REGION_GET, DEVLINK_CMD_REGION_SET, DEVLINK_CMD_REGION_NEW, DEVLINK_CMD_REGION_DEL, DEVLINK_CMD_REGION_READ, DEVLINK_CMD_PORT_PARAM_GET, /* can dump */ DEVLINK_CMD_PORT_PARAM_SET, DEVLINK_CMD_PORT_PARAM_NEW, DEVLINK_CMD_PORT_PARAM_DEL, DEVLINK_CMD_INFO_GET, /* can dump */ DEVLINK_CMD_HEALTH_REPORTER_GET, DEVLINK_CMD_HEALTH_REPORTER_SET, DEVLINK_CMD_HEALTH_REPORTER_RECOVER, DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE, DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET, DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR, DEVLINK_CMD_FLASH_UPDATE, DEVLINK_CMD_FLASH_UPDATE_END, /* notification only */ DEVLINK_CMD_FLASH_UPDATE_STATUS, /* notification only */ DEVLINK_CMD_TRAP_GET, /* can dump */ DEVLINK_CMD_TRAP_SET, DEVLINK_CMD_TRAP_NEW, DEVLINK_CMD_TRAP_DEL, DEVLINK_CMD_TRAP_GROUP_GET, /* can dump */ DEVLINK_CMD_TRAP_GROUP_SET, DEVLINK_CMD_TRAP_GROUP_NEW, DEVLINK_CMD_TRAP_GROUP_DEL, DEVLINK_CMD_TRAP_POLICER_GET, /* can dump */ DEVLINK_CMD_TRAP_POLICER_SET, DEVLINK_CMD_TRAP_POLICER_NEW, DEVLINK_CMD_TRAP_POLICER_DEL, DEVLINK_CMD_HEALTH_REPORTER_TEST, DEVLINK_CMD_RATE_GET, /* can dump */ DEVLINK_CMD_RATE_SET, DEVLINK_CMD_RATE_NEW, DEVLINK_CMD_RATE_DEL, __RH_RESERVED_DEVLINK_CMD_LINECARD_GET, /* can dump */ __RH_RESERVED_DEVLINK_CMD_LINECARD_SET, __RH_RESERVED_DEVLINK_CMD_LINECARD_NEW, __RH_RESERVED_DEVLINK_CMD_LINECARD_DEL, DEVLINK_CMD_SELFTESTS_GET, /* can dump */ DEVLINK_CMD_SELFTESTS_RUN, /* add new commands above here */ __DEVLINK_CMD_MAX, DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1 }; enum devlink_port_type { DEVLINK_PORT_TYPE_NOTSET, DEVLINK_PORT_TYPE_AUTO, DEVLINK_PORT_TYPE_ETH, DEVLINK_PORT_TYPE_IB, }; enum devlink_sb_pool_type { DEVLINK_SB_POOL_TYPE_INGRESS, DEVLINK_SB_POOL_TYPE_EGRESS, }; /* static threshold - limiting the maximum number of bytes. * dynamic threshold - limiting the maximum number of bytes * based on the currently available free space in the shared buffer pool. * In this mode, the maximum quota is calculated based * on the following formula: * max_quota = alpha / (1 + alpha) * Free_Buffer * While Free_Buffer is the amount of none-occupied buffer associated to * the relevant pool. * The value range which can be passed is 0-20 and serves * for computation of alpha by following formula: * alpha = 2 ^ (passed_value - 10) */ enum devlink_sb_threshold_type { DEVLINK_SB_THRESHOLD_TYPE_STATIC, DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC, }; #define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20 enum devlink_eswitch_mode { DEVLINK_ESWITCH_MODE_LEGACY, DEVLINK_ESWITCH_MODE_SWITCHDEV, }; enum devlink_eswitch_inline_mode { DEVLINK_ESWITCH_INLINE_MODE_NONE, DEVLINK_ESWITCH_INLINE_MODE_LINK, DEVLINK_ESWITCH_INLINE_MODE_NETWORK, DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT, }; enum devlink_eswitch_encap_mode { DEVLINK_ESWITCH_ENCAP_MODE_NONE, DEVLINK_ESWITCH_ENCAP_MODE_BASIC, }; enum devlink_port_flavour { DEVLINK_PORT_FLAVOUR_PHYSICAL, /* Any kind of a port physically * facing the user. */ DEVLINK_PORT_FLAVOUR_CPU, /* CPU port */ DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture * interconnect port. */ DEVLINK_PORT_FLAVOUR_PCI_PF, /* Represents eswitch port for * the PCI PF. It is an internal * port that faces the PCI PF. */ DEVLINK_PORT_FLAVOUR_PCI_VF, /* Represents eswitch port * for the PCI VF. It is an internal * port that faces the PCI VF. */ DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */ DEVLINK_PORT_FLAVOUR_UNUSED, /* Port which exists in the switch, but * is not used in any way. */ DEVLINK_PORT_FLAVOUR_PCI_SF, /* Represents eswitch port * for the PCI SF. It is an internal * port that faces the PCI SF. */ }; enum devlink_rate_type { DEVLINK_RATE_TYPE_LEAF, DEVLINK_RATE_TYPE_NODE, }; enum devlink_param_cmode { DEVLINK_PARAM_CMODE_RUNTIME, DEVLINK_PARAM_CMODE_DRIVERINIT, DEVLINK_PARAM_CMODE_PERMANENT, /* Add new configuration modes above */ __DEVLINK_PARAM_CMODE_MAX, DEVLINK_PARAM_CMODE_MAX = __DEVLINK_PARAM_CMODE_MAX - 1 }; enum devlink_param_fw_load_policy_value { DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER, DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH, DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK, DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_UNKNOWN, }; enum devlink_param_reset_dev_on_drv_probe_value { DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_UNKNOWN, DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS, DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER, DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK, }; enum { DEVLINK_ATTR_STATS_RX_PACKETS, /* u64 */ DEVLINK_ATTR_STATS_RX_BYTES, /* u64 */ DEVLINK_ATTR_STATS_RX_DROPPED, /* u64 */ __DEVLINK_ATTR_STATS_MAX, DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1 }; /* Specify what sections of a flash component can be overwritten when * performing an update. Overwriting of firmware binary sections is always * implicitly assumed to be allowed. * * Each section must be documented in * Documentation/networking/devlink/devlink-flash.rst * */ enum { DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT, DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT, __DEVLINK_FLASH_OVERWRITE_MAX_BIT, DEVLINK_FLASH_OVERWRITE_MAX_BIT = __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1 }; #define DEVLINK_FLASH_OVERWRITE_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT) #define DEVLINK_FLASH_OVERWRITE_IDENTIFIERS _BITUL(DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT) #define DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS \ (_BITUL(__DEVLINK_FLASH_OVERWRITE_MAX_BIT) - 1) enum devlink_attr_selftest_id { DEVLINK_ATTR_SELFTEST_ID_UNSPEC, DEVLINK_ATTR_SELFTEST_ID_FLASH, /* flag */ __DEVLINK_ATTR_SELFTEST_ID_MAX, DEVLINK_ATTR_SELFTEST_ID_MAX = __DEVLINK_ATTR_SELFTEST_ID_MAX - 1 }; enum devlink_selftest_status { DEVLINK_SELFTEST_STATUS_SKIP, DEVLINK_SELFTEST_STATUS_PASS, DEVLINK_SELFTEST_STATUS_FAIL }; enum devlink_attr_selftest_result { DEVLINK_ATTR_SELFTEST_RESULT_UNSPEC, DEVLINK_ATTR_SELFTEST_RESULT, /* nested */ DEVLINK_ATTR_SELFTEST_RESULT_ID, /* u32, enum devlink_attr_selftest_id */ DEVLINK_ATTR_SELFTEST_RESULT_STATUS, /* u8, enum devlink_selftest_status */ __DEVLINK_ATTR_SELFTEST_RESULT_MAX, DEVLINK_ATTR_SELFTEST_RESULT_MAX = __DEVLINK_ATTR_SELFTEST_RESULT_MAX - 1 }; /** * enum devlink_trap_action - Packet trap action. * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not * sent to the CPU. * @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU. * @DEVLINK_TRAP_ACTION_MIRROR: Packet is forwarded by the device and a copy is * sent to the CPU. */ enum devlink_trap_action { DEVLINK_TRAP_ACTION_DROP, DEVLINK_TRAP_ACTION_TRAP, DEVLINK_TRAP_ACTION_MIRROR, }; /** * enum devlink_trap_type - Packet trap type. * @DEVLINK_TRAP_TYPE_DROP: Trap reason is a drop. Trapped packets are only * processed by devlink and not injected to the * kernel's Rx path. * @DEVLINK_TRAP_TYPE_EXCEPTION: Trap reason is an exception. Packet was not * forwarded as intended due to an exception * (e.g., missing neighbour entry) and trapped to * control plane for resolution. Trapped packets * are processed by devlink and injected to * the kernel's Rx path. * @DEVLINK_TRAP_TYPE_CONTROL: Packet was trapped because it is required for * the correct functioning of the control plane. * For example, an ARP request packet. Trapped * packets are injected to the kernel's Rx path, * but not reported to drop monitor. */ enum devlink_trap_type { DEVLINK_TRAP_TYPE_DROP, DEVLINK_TRAP_TYPE_EXCEPTION, DEVLINK_TRAP_TYPE_CONTROL, }; enum { /* Trap can report input port as metadata */ DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT, /* Trap can report flow action cookie as metadata */ DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE, }; enum devlink_reload_action { DEVLINK_RELOAD_ACTION_UNSPEC, DEVLINK_RELOAD_ACTION_DRIVER_REINIT, /* Driver entities re-instantiation */ DEVLINK_RELOAD_ACTION_FW_ACTIVATE, /* FW activate */ /* Add new reload actions above */ __DEVLINK_RELOAD_ACTION_MAX, DEVLINK_RELOAD_ACTION_MAX = __DEVLINK_RELOAD_ACTION_MAX - 1 }; enum devlink_reload_limit { DEVLINK_RELOAD_LIMIT_UNSPEC, /* unspecified, no constraints */ DEVLINK_RELOAD_LIMIT_NO_RESET, /* No reset allowed, no down time allowed, * no link flap and no configuration is lost. */ /* Add new reload limit above */ __DEVLINK_RELOAD_LIMIT_MAX, DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1 }; #define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1) enum devlink_attr { /* don't change the order or add anything between, this is ABI! */ DEVLINK_ATTR_UNSPEC, /* bus name + dev name together are a handle for devlink entity */ DEVLINK_ATTR_BUS_NAME, /* string */ DEVLINK_ATTR_DEV_NAME, /* string */ DEVLINK_ATTR_PORT_INDEX, /* u32 */ DEVLINK_ATTR_PORT_TYPE, /* u16 */ DEVLINK_ATTR_PORT_DESIRED_TYPE, /* u16 */ DEVLINK_ATTR_PORT_NETDEV_IFINDEX, /* u32 */ DEVLINK_ATTR_PORT_NETDEV_NAME, /* string */ DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */ DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */ DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */ DEVLINK_ATTR_SB_INDEX, /* u32 */ DEVLINK_ATTR_SB_SIZE, /* u32 */ DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */ DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */ DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */ DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */ DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */ DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */ DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */ DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */ DEVLINK_ATTR_SB_THRESHOLD, /* u32 */ DEVLINK_ATTR_SB_TC_INDEX, /* u16 */ DEVLINK_ATTR_SB_OCC_CUR, /* u32 */ DEVLINK_ATTR_SB_OCC_MAX, /* u32 */ DEVLINK_ATTR_ESWITCH_MODE, /* u16 */ DEVLINK_ATTR_ESWITCH_INLINE_MODE, /* u8 */ DEVLINK_ATTR_DPIPE_TABLES, /* nested */ DEVLINK_ATTR_DPIPE_TABLE, /* nested */ DEVLINK_ATTR_DPIPE_TABLE_NAME, /* string */ DEVLINK_ATTR_DPIPE_TABLE_SIZE, /* u64 */ DEVLINK_ATTR_DPIPE_TABLE_MATCHES, /* nested */ DEVLINK_ATTR_DPIPE_TABLE_ACTIONS, /* nested */ DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, /* u8 */ DEVLINK_ATTR_DPIPE_ENTRIES, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY_INDEX, /* u64 */ DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES, /* nested */ DEVLINK_ATTR_DPIPE_ENTRY_COUNTER, /* u64 */ DEVLINK_ATTR_DPIPE_MATCH, /* nested */ DEVLINK_ATTR_DPIPE_MATCH_VALUE, /* nested */ DEVLINK_ATTR_DPIPE_MATCH_TYPE, /* u32 */ DEVLINK_ATTR_DPIPE_ACTION, /* nested */ DEVLINK_ATTR_DPIPE_ACTION_VALUE, /* nested */ DEVLINK_ATTR_DPIPE_ACTION_TYPE, /* u32 */ DEVLINK_ATTR_DPIPE_VALUE, DEVLINK_ATTR_DPIPE_VALUE_MASK, DEVLINK_ATTR_DPIPE_VALUE_MAPPING, /* u32 */ DEVLINK_ATTR_DPIPE_HEADERS, /* nested */ DEVLINK_ATTR_DPIPE_HEADER, /* nested */ DEVLINK_ATTR_DPIPE_HEADER_NAME, /* string */ DEVLINK_ATTR_DPIPE_HEADER_ID, /* u32 */ DEVLINK_ATTR_DPIPE_HEADER_FIELDS, /* nested */ DEVLINK_ATTR_DPIPE_HEADER_GLOBAL, /* u8 */ DEVLINK_ATTR_DPIPE_HEADER_INDEX, /* u32 */ DEVLINK_ATTR_DPIPE_FIELD, /* nested */ DEVLINK_ATTR_DPIPE_FIELD_NAME, /* string */ DEVLINK_ATTR_DPIPE_FIELD_ID, /* u32 */ DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH, /* u32 */ DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE, /* u32 */ DEVLINK_ATTR_PAD, DEVLINK_ATTR_ESWITCH_ENCAP_MODE, /* u8 */ DEVLINK_ATTR_RESOURCE_LIST, /* nested */ DEVLINK_ATTR_RESOURCE, /* nested */ DEVLINK_ATTR_RESOURCE_NAME, /* string */ DEVLINK_ATTR_RESOURCE_ID, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_NEW, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_VALID, /* u8 */ DEVLINK_ATTR_RESOURCE_SIZE_MIN, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_MAX, /* u64 */ DEVLINK_ATTR_RESOURCE_SIZE_GRAN, /* u64 */ DEVLINK_ATTR_RESOURCE_UNIT, /* u8 */ DEVLINK_ATTR_RESOURCE_OCC, /* u64 */ DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID, /* u64 */ DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */ DEVLINK_ATTR_PORT_FLAVOUR, /* u16 */ DEVLINK_ATTR_PORT_NUMBER, /* u32 */ DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER, /* u32 */ DEVLINK_ATTR_PARAM, /* nested */ DEVLINK_ATTR_PARAM_NAME, /* string */ DEVLINK_ATTR_PARAM_GENERIC, /* flag */ DEVLINK_ATTR_PARAM_TYPE, /* u8 */ DEVLINK_ATTR_PARAM_VALUES_LIST, /* nested */ DEVLINK_ATTR_PARAM_VALUE, /* nested */ DEVLINK_ATTR_PARAM_VALUE_DATA, /* dynamic */ DEVLINK_ATTR_PARAM_VALUE_CMODE, /* u8 */ DEVLINK_ATTR_REGION_NAME, /* string */ DEVLINK_ATTR_REGION_SIZE, /* u64 */ DEVLINK_ATTR_REGION_SNAPSHOTS, /* nested */ DEVLINK_ATTR_REGION_SNAPSHOT, /* nested */ DEVLINK_ATTR_REGION_SNAPSHOT_ID, /* u32 */ DEVLINK_ATTR_REGION_CHUNKS, /* nested */ DEVLINK_ATTR_REGION_CHUNK, /* nested */ DEVLINK_ATTR_REGION_CHUNK_DATA, /* binary */ DEVLINK_ATTR_REGION_CHUNK_ADDR, /* u64 */ DEVLINK_ATTR_REGION_CHUNK_LEN, /* u64 */ DEVLINK_ATTR_INFO_DRIVER_NAME, /* string */ DEVLINK_ATTR_INFO_SERIAL_NUMBER, /* string */ DEVLINK_ATTR_INFO_VERSION_FIXED, /* nested */ DEVLINK_ATTR_INFO_VERSION_RUNNING, /* nested */ DEVLINK_ATTR_INFO_VERSION_STORED, /* nested */ DEVLINK_ATTR_INFO_VERSION_NAME, /* string */ DEVLINK_ATTR_INFO_VERSION_VALUE, /* string */ DEVLINK_ATTR_SB_POOL_CELL_SIZE, /* u32 */ DEVLINK_ATTR_FMSG, /* nested */ DEVLINK_ATTR_FMSG_OBJ_NEST_START, /* flag */ DEVLINK_ATTR_FMSG_PAIR_NEST_START, /* flag */ DEVLINK_ATTR_FMSG_ARR_NEST_START, /* flag */ DEVLINK_ATTR_FMSG_NEST_END, /* flag */ DEVLINK_ATTR_FMSG_OBJ_NAME, /* string */ DEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE, /* u8 */ DEVLINK_ATTR_FMSG_OBJ_VALUE_DATA, /* dynamic */ DEVLINK_ATTR_HEALTH_REPORTER, /* nested */ DEVLINK_ATTR_HEALTH_REPORTER_NAME, /* string */ DEVLINK_ATTR_HEALTH_REPORTER_STATE, /* u8 */ DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT, /* u64 */ DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT, /* u64 */ DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS, /* u64 */ DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD, /* u64 */ DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER, /* u8 */ DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME, /* string */ DEVLINK_ATTR_FLASH_UPDATE_COMPONENT, /* string */ DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG, /* string */ DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE, /* u64 */ DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL, /* u64 */ DEVLINK_ATTR_PORT_PCI_PF_NUMBER, /* u16 */ DEVLINK_ATTR_PORT_PCI_VF_NUMBER, /* u16 */ DEVLINK_ATTR_STATS, /* nested */ DEVLINK_ATTR_TRAP_NAME, /* string */ /* enum devlink_trap_action */ DEVLINK_ATTR_TRAP_ACTION, /* u8 */ /* enum devlink_trap_type */ DEVLINK_ATTR_TRAP_TYPE, /* u8 */ DEVLINK_ATTR_TRAP_GENERIC, /* flag */ DEVLINK_ATTR_TRAP_METADATA, /* nested */ DEVLINK_ATTR_TRAP_GROUP_NAME, /* string */ DEVLINK_ATTR_RELOAD_FAILED, /* u8 0 or 1 */ DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS, /* u64 */ DEVLINK_ATTR_NETNS_FD, /* u32 */ DEVLINK_ATTR_NETNS_PID, /* u32 */ DEVLINK_ATTR_NETNS_ID, /* u32 */ DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP, /* u8 */ DEVLINK_ATTR_TRAP_POLICER_ID, /* u32 */ DEVLINK_ATTR_TRAP_POLICER_RATE, /* u64 */ DEVLINK_ATTR_TRAP_POLICER_BURST, /* u64 */ DEVLINK_ATTR_PORT_FUNCTION, /* nested */ DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER, /* string */ DEVLINK_ATTR_PORT_LANES, /* u32 */ DEVLINK_ATTR_PORT_SPLITTABLE, /* u8 */ DEVLINK_ATTR_PORT_EXTERNAL, /* u8 */ DEVLINK_ATTR_PORT_CONTROLLER_NUMBER, /* u32 */ DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT, /* u64 */ DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK, /* bitfield32 */ DEVLINK_ATTR_RELOAD_ACTION, /* u8 */ DEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED, /* bitfield32 */ DEVLINK_ATTR_RELOAD_LIMITS, /* bitfield32 */ DEVLINK_ATTR_DEV_STATS, /* nested */ DEVLINK_ATTR_RELOAD_STATS, /* nested */ DEVLINK_ATTR_RELOAD_STATS_ENTRY, /* nested */ DEVLINK_ATTR_RELOAD_STATS_LIMIT, /* u8 */ DEVLINK_ATTR_RELOAD_STATS_VALUE, /* u32 */ DEVLINK_ATTR_REMOTE_RELOAD_STATS, /* nested */ DEVLINK_ATTR_RELOAD_ACTION_INFO, /* nested */ DEVLINK_ATTR_RELOAD_ACTION_STATS, /* nested */ DEVLINK_ATTR_PORT_PCI_SF_NUMBER, /* u32 */ DEVLINK_ATTR_RATE_TYPE, /* u16 */ DEVLINK_ATTR_RATE_TX_SHARE, /* u64 */ DEVLINK_ATTR_RATE_TX_MAX, /* u64 */ DEVLINK_ATTR_RATE_NODE_NAME, /* string */ DEVLINK_ATTR_RATE_PARENT_NODE_NAME, /* string */ DEVLINK_ATTR_REGION_MAX_SNAPSHOTS, /* u32 */ __RH_RESERVED_DEVLINK_ATTR_LINECARD_INDEX, /* u32 */ __RH_RESERVED_DEVLINK_ATTR_LINECARD_STATE, /* u8 */ __RH_RESERVED_DEVLINK_ATTR_LINECARD_TYPE, /* string */ __RH_RESERVED_DEVLINK_ATTR_LINECARD_SUPPORTED_TYPES, /* nested */ __RH_RESERVED_DEVLINK_ATTR_NESTED_DEVLINK, /* nested */ DEVLINK_ATTR_SELFTESTS, /* nested */ /* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX, DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1 }; /* Mapping between internal resource described by the field and system * structure */ enum devlink_dpipe_field_mapping_type { DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE, DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX, }; /* Match type - specify the type of the match */ enum devlink_dpipe_match_type { DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT, }; /* Action type - specify the action type */ enum devlink_dpipe_action_type { DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY, }; enum devlink_dpipe_field_ethernet_id { DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC, }; enum devlink_dpipe_field_ipv4_id { DEVLINK_DPIPE_FIELD_IPV4_DST_IP, }; enum devlink_dpipe_field_ipv6_id { DEVLINK_DPIPE_FIELD_IPV6_DST_IP, }; enum devlink_dpipe_header_id { DEVLINK_DPIPE_HEADER_ETHERNET, DEVLINK_DPIPE_HEADER_IPV4, DEVLINK_DPIPE_HEADER_IPV6, }; enum devlink_resource_unit { DEVLINK_RESOURCE_UNIT_ENTRY, }; enum devlink_port_function_attr { DEVLINK_PORT_FUNCTION_ATTR_UNSPEC, DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR, /* binary */ DEVLINK_PORT_FN_ATTR_STATE, /* u8 */ DEVLINK_PORT_FN_ATTR_OPSTATE, /* u8 */ __DEVLINK_PORT_FUNCTION_ATTR_MAX, DEVLINK_PORT_FUNCTION_ATTR_MAX = __DEVLINK_PORT_FUNCTION_ATTR_MAX - 1 }; enum devlink_port_fn_state { DEVLINK_PORT_FN_STATE_INACTIVE, DEVLINK_PORT_FN_STATE_ACTIVE, }; /** * enum devlink_port_fn_opstate - indicates operational state of the function * @DEVLINK_PORT_FN_OPSTATE_ATTACHED: Driver is attached to the function. * For graceful tear down of the function, after inactivation of the * function, user should wait for operational state to turn DETACHED. * @DEVLINK_PORT_FN_OPSTATE_DETACHED: Driver is detached from the function. * It is safe to delete the port. */ enum devlink_port_fn_opstate { DEVLINK_PORT_FN_OPSTATE_DETACHED, DEVLINK_PORT_FN_OPSTATE_ATTACHED, }; #endif /* _LINUX_DEVLINK_H_ */ linux/dlm.h 0000644 00000004771 15063602046 0006643 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. ** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #ifndef __DLM_DOT_H__ #define __DLM_DOT_H__ /* * Interface to Distributed Lock Manager (DLM) * routines and structures to use DLM lockspaces */ /* Lock levels and flags are here */ #include <linux/dlmconstants.h> #include <linux/types.h> typedef void dlm_lockspace_t; /* * Lock status block * * Use this structure to specify the contents of the lock value block. For a * conversion request, this structure is used to specify the lock ID of the * lock. DLM writes the status of the lock request and the lock ID assigned * to the request in the lock status block. * * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests. * It is available when dlm_lock returns. * * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules * shown for the DLM_LKF_VALBLK flag. * * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock, * it was first demoted to NL to avoid conversion deadlock. * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid. * * sb_status: the returned status of the lock request set prior to AST * execution. Possible return values: * * 0 if lock request was successful * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE * -DLM_EUNLOCK if unlock request was successful * -DLM_ECANCEL if a cancel completed successfully * -EDEADLK if a deadlock was detected * -ETIMEDOUT if the lock request was canceled due to a timeout */ #define DLM_SBF_DEMOTED 0x01 #define DLM_SBF_VALNOTVALID 0x02 #define DLM_SBF_ALTMODE 0x04 struct dlm_lksb { int sb_status; __u32 sb_lkid; char sb_flags; char * sb_lvbptr; }; /* dlm_new_lockspace() flags */ #define DLM_LSFL_TIMEWARN 0x00000002 #define DLM_LSFL_FS 0x00000004 #define DLM_LSFL_NEWEXCL 0x00000008 #endif /* __DLM_DOT_H__ */ linux/dlm_device.h 0000644 00000004757 15063602046 0010166 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #ifndef _LINUX_DLM_DEVICE_H #define _LINUX_DLM_DEVICE_H /* This is the device interface for dlm, most users will use a library * interface. */ #include <linux/dlm.h> #include <linux/types.h> #define DLM_USER_LVB_LEN 32 /* Version of the device interface */ #define DLM_DEVICE_VERSION_MAJOR 6 #define DLM_DEVICE_VERSION_MINOR 0 #define DLM_DEVICE_VERSION_PATCH 2 /* struct passed to the lock write */ struct dlm_lock_params { __u8 mode; __u8 namelen; __u16 unused; __u32 flags; __u32 lkid; __u32 parent; __u64 xid; __u64 timeout; void *castparam; void *castaddr; void *bastparam; void *bastaddr; struct dlm_lksb *lksb; char lvb[DLM_USER_LVB_LEN]; char name[0]; }; struct dlm_lspace_params { __u32 flags; __u32 minor; char name[0]; }; struct dlm_purge_params { __u32 nodeid; __u32 pid; }; struct dlm_write_request { __u32 version[3]; __u8 cmd; __u8 is64bit; __u8 unused[2]; union { struct dlm_lock_params lock; struct dlm_lspace_params lspace; struct dlm_purge_params purge; } i; }; struct dlm_device_version { __u32 version[3]; }; /* struct read from the "device" fd, consists mainly of userspace pointers for the library to use */ struct dlm_lock_result { __u32 version[3]; __u32 length; void * user_astaddr; void * user_astparam; struct dlm_lksb * user_lksb; struct dlm_lksb lksb; __u8 bast_mode; __u8 unused[3]; /* Offsets may be zero if no data is present */ __u32 lvb_offset; }; /* Commands passed to the device */ #define DLM_USER_LOCK 1 #define DLM_USER_UNLOCK 2 #define DLM_USER_QUERY 3 #define DLM_USER_CREATE_LOCKSPACE 4 #define DLM_USER_REMOVE_LOCKSPACE 5 #define DLM_USER_PURGE 6 #define DLM_USER_DEADLOCK 7 /* Lockspace flags */ #define DLM_USER_LSFLG_AUTOFREE 1 #define DLM_USER_LSFLG_FORCEFREE 2 #endif linux/dlm_netlink.h 0000644 00000002207 15063602046 0010357 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2007 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef _DLM_NETLINK_H #define _DLM_NETLINK_H #include <linux/types.h> #include <linux/dlmconstants.h> enum { DLM_STATUS_WAITING = 1, DLM_STATUS_GRANTED = 2, DLM_STATUS_CONVERT = 3, }; #define DLM_LOCK_DATA_VERSION 1 struct dlm_lock_data { __u16 version; __u32 lockspace_id; int nodeid; int ownpid; __u32 id; __u32 remid; __u64 xid; __s8 status; __s8 grmode; __s8 rqmode; unsigned long timestamp; int resource_namelen; char resource_name[DLM_RESNAME_MAXLEN]; }; enum { DLM_CMD_UNSPEC = 0, DLM_CMD_HELLO, /* user->kernel */ DLM_CMD_TIMEOUT, /* kernel->user */ __DLM_CMD_MAX, }; #define DLM_CMD_MAX (__DLM_CMD_MAX - 1) enum { DLM_TYPE_UNSPEC = 0, DLM_TYPE_LOCK, __DLM_TYPE_MAX, }; #define DLM_TYPE_MAX (__DLM_TYPE_MAX - 1) #define DLM_GENL_VERSION 0x1 #define DLM_GENL_NAME "DLM" #endif /* _DLM_NETLINK_H */ linux/dlm_plock.h 0000644 00000001576 15063602046 0010033 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef __DLM_PLOCK_DOT_H__ #define __DLM_PLOCK_DOT_H__ #include <linux/types.h> #define DLM_PLOCK_MISC_NAME "dlm_plock" #define DLM_PLOCK_VERSION_MAJOR 1 #define DLM_PLOCK_VERSION_MINOR 2 #define DLM_PLOCK_VERSION_PATCH 0 enum { DLM_PLOCK_OP_LOCK = 1, DLM_PLOCK_OP_UNLOCK, DLM_PLOCK_OP_GET, }; #define DLM_PLOCK_FL_CLOSE 1 struct dlm_plock_info { __u32 version[3]; __u8 optype; __u8 ex; __u8 wait; __u8 flags; __u32 pid; __s32 nodeid; __s32 rv; __u32 fsid; __u64 number; __u64 start; __u64 end; __u64 owner; }; #endif /* __DLM_PLOCK_DOT_H__ */ linux/dlmconstants.h 0000644 00000011730 15063602046 0010571 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #ifndef __DLMCONSTANTS_DOT_H__ #define __DLMCONSTANTS_DOT_H__ /* * Constants used by DLM interface. */ #define DLM_LOCKSPACE_LEN 64 #define DLM_RESNAME_MAXLEN 64 /* * Lock Modes */ #define DLM_LOCK_IV (-1) /* invalid */ #define DLM_LOCK_NL 0 /* null */ #define DLM_LOCK_CR 1 /* concurrent read */ #define DLM_LOCK_CW 2 /* concurrent write */ #define DLM_LOCK_PR 3 /* protected read */ #define DLM_LOCK_PW 4 /* protected write */ #define DLM_LOCK_EX 5 /* exclusive */ /* * Flags to dlm_lock * * DLM_LKF_NOQUEUE * * Do not queue the lock request on the wait queue if it cannot be granted * immediately. If the lock cannot be granted because of this flag, DLM will * either return -EAGAIN from the dlm_lock call or will return 0 from * dlm_lock and -EAGAIN in the lock status block when the AST is executed. * * DLM_LKF_CANCEL * * Used to cancel a pending lock request or conversion. A converting lock is * returned to its previously granted mode. * * DLM_LKF_CONVERT * * Indicates a lock conversion request. For conversions the name and namelen * are ignored and the lock ID in the LKSB is used to identify the lock. * * DLM_LKF_VALBLK * * Requests DLM to return the current contents of the lock value block in the * lock status block. When this flag is set in a lock conversion from PW or EX * modes, DLM assigns the value specified in the lock status block to the lock * value block of the lock resource. The LVB is a DLM_LVB_LEN size array * containing application-specific information. * * DLM_LKF_QUECVT * * Force a conversion request to be queued, even if it is compatible with * the granted modes of other locks on the same resource. * * DLM_LKF_IVVALBLK * * Invalidate the lock value block. * * DLM_LKF_CONVDEADLK * * Allows the dlm to resolve conversion deadlocks internally by demoting the * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is * returned for a conversion that's been effected by this. * * DLM_LKF_PERSISTENT * * Only relevant to locks originating in userspace. A persistent lock will not * be removed if the process holding the lock exits. * * DLM_LKF_NODLCKWT * * Do not cancel the lock if it gets into conversion deadlock. * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN. * * DLM_LKF_NODLCKBLK * * net yet implemented * * DLM_LKF_EXPEDITE * * Used only with new requests for NL mode locks. Tells the lock manager * to grant the lock, ignoring other locks in convert and wait queues. * * DLM_LKF_NOQUEUEBAST * * Send blocking AST's before returning -EAGAIN to the caller. It is only * used along with the NOQUEUE flag. Blocking AST's are not sent for failed * NOQUEUE requests otherwise. * * DLM_LKF_HEADQUE * * Add a lock to the head of the convert or wait queue rather than the tail. * * DLM_LKF_NOORDER * * Disregard the standard grant order rules and grant a lock as soon as it * is compatible with other granted locks. * * DLM_LKF_ORPHAN * * Acquire an orphan lock. * * DLM_LKF_ALTPR * * If the requested mode cannot be granted immediately, try to grant the lock * in PR mode instead. If this alternate mode is granted instead of the * requested mode, DLM_SBF_ALTMODE is returned in the lksb. * * DLM_LKF_ALTCW * * The same as ALTPR, but the alternate mode is CW. * * DLM_LKF_FORCEUNLOCK * * Unlock the lock even if it is converting or waiting or has sublocks. * Only really for use by the userland device.c code. * */ #define DLM_LKF_NOQUEUE 0x00000001 #define DLM_LKF_CANCEL 0x00000002 #define DLM_LKF_CONVERT 0x00000004 #define DLM_LKF_VALBLK 0x00000008 #define DLM_LKF_QUECVT 0x00000010 #define DLM_LKF_IVVALBLK 0x00000020 #define DLM_LKF_CONVDEADLK 0x00000040 #define DLM_LKF_PERSISTENT 0x00000080 #define DLM_LKF_NODLCKWT 0x00000100 #define DLM_LKF_NODLCKBLK 0x00000200 #define DLM_LKF_EXPEDITE 0x00000400 #define DLM_LKF_NOQUEUEBAST 0x00000800 #define DLM_LKF_HEADQUE 0x00001000 #define DLM_LKF_NOORDER 0x00002000 #define DLM_LKF_ORPHAN 0x00004000 #define DLM_LKF_ALTPR 0x00008000 #define DLM_LKF_ALTCW 0x00010000 #define DLM_LKF_FORCEUNLOCK 0x00020000 #define DLM_LKF_TIMEOUT 0x00040000 /* * Some return codes that are not in errno.h */ #define DLM_ECANCEL 0x10001 #define DLM_EUNLOCK 0x10002 #endif /* __DLMCONSTANTS_DOT_H__ */ linux/dm-ioctl.h 0000644 00000026210 15063602046 0007567 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. * * This file is released under the LGPL. */ #ifndef _LINUX_DM_IOCTL_V4_H #define _LINUX_DM_IOCTL_V4_H #include <linux/types.h> #define DM_DIR "mapper" /* Slashes not supported */ #define DM_CONTROL_NODE "control" #define DM_MAX_TYPE_NAME 16 #define DM_NAME_LEN 128 #define DM_UUID_LEN 129 /* * A traditional ioctl interface for the device mapper. * * Each device can have two tables associated with it, an * 'active' table which is the one currently used by io passing * through the device, and an 'inactive' one which is a table * that is being prepared as a replacement for the 'active' one. * * DM_VERSION: * Just get the version information for the ioctl interface. * * DM_REMOVE_ALL: * Remove all dm devices, destroy all tables. Only really used * for debug. * * DM_LIST_DEVICES: * Get a list of all the dm device names. * * DM_DEV_CREATE: * Create a new device, neither the 'active' or 'inactive' table * slots will be filled. The device will be in suspended state * after creation, however any io to the device will get errored * since it will be out-of-bounds. * * DM_DEV_REMOVE: * Remove a device, destroy any tables. * * DM_DEV_RENAME: * Rename a device or set its uuid if none was previously supplied. * * DM_SUSPEND: * This performs both suspend and resume, depending which flag is * passed in. * Suspend: This command will not return until all pending io to * the device has completed. Further io will be deferred until * the device is resumed. * Resume: It is no longer an error to issue this command on an * unsuspended device. If a table is present in the 'inactive' * slot, it will be moved to the active slot, then the old table * from the active slot will be _destroyed_. Finally the device * is resumed. * * DM_DEV_STATUS: * Retrieves the status for the table in the 'active' slot. * * DM_DEV_WAIT: * Wait for a significant event to occur to the device. This * could either be caused by an event triggered by one of the * targets of the table in the 'active' slot, or a table change. * * DM_TABLE_LOAD: * Load a table into the 'inactive' slot for the device. The * device does _not_ need to be suspended prior to this command. * * DM_TABLE_CLEAR: * Destroy any table in the 'inactive' slot (ie. abort). * * DM_TABLE_DEPS: * Return a set of device dependencies for the 'active' table. * * DM_TABLE_STATUS: * Return the targets status for the 'active' table. * * DM_TARGET_MSG: * Pass a message string to the target at a specific offset of a device. * * DM_DEV_SET_GEOMETRY: * Set the geometry of a device by passing in a string in this format: * * "cylinders heads sectors_per_track start_sector" * * Beware that CHS geometry is nearly obsolete and only provided * for compatibility with dm devices that can be booted by a PC * BIOS. See struct hd_geometry for range limits. Also note that * the geometry is erased if the device size changes. */ /* * All ioctl arguments consist of a single chunk of memory, with * this structure at the start. If a uuid is specified any * lookup (eg. for a DM_INFO) will be done on that, *not* the * name. */ struct dm_ioctl { /* * The version number is made up of three parts: * major - no backward or forward compatibility, * minor - only backwards compatible, * patch - both backwards and forwards compatible. * * All clients of the ioctl interface should fill in the * version number of the interface that they were * compiled with. * * All recognised ioctl commands (ie. those that don't * return -ENOTTY) fill out this field, even if the * command failed. */ __u32 version[3]; /* in/out */ __u32 data_size; /* total size of data passed in * including this struct */ __u32 data_start; /* offset to start of data * relative to start of this struct */ __u32 target_count; /* in/out */ __s32 open_count; /* out */ __u32 flags; /* in/out */ /* * event_nr holds either the event number (input and output) or the * udev cookie value (input only). * The DM_DEV_WAIT ioctl takes an event number as input. * The DM_SUSPEND, DM_DEV_REMOVE and DM_DEV_RENAME ioctls * use the field as a cookie to return in the DM_COOKIE * variable with the uevents they issue. * For output, the ioctls return the event number, not the cookie. */ __u32 event_nr; /* in/out */ __u32 padding; __u64 dev; /* in/out */ char name[DM_NAME_LEN]; /* device name */ char uuid[DM_UUID_LEN]; /* unique identifier for * the block device */ char data[7]; /* padding or data */ }; /* * Used to specify tables. These structures appear after the * dm_ioctl. */ struct dm_target_spec { __u64 sector_start; __u64 length; __s32 status; /* used when reading from kernel only */ /* * Location of the next dm_target_spec. * - When specifying targets on a DM_TABLE_LOAD command, this value is * the number of bytes from the start of the "current" dm_target_spec * to the start of the "next" dm_target_spec. * - When retrieving targets on a DM_TABLE_STATUS command, this value * is the number of bytes from the start of the first dm_target_spec * (that follows the dm_ioctl struct) to the start of the "next" * dm_target_spec. */ __u32 next; char target_type[DM_MAX_TYPE_NAME]; /* * Parameter string starts immediately after this object. * Be careful to add padding after string to ensure correct * alignment of subsequent dm_target_spec. */ }; /* * Used to retrieve the target dependencies. */ struct dm_target_deps { __u32 count; /* Array size */ __u32 padding; /* unused */ __u64 dev[0]; /* out */ }; /* * Used to get a list of all dm devices. */ struct dm_name_list { __u64 dev; __u32 next; /* offset to the next record from the _start_ of this */ char name[0]; /* * The following members can be accessed by taking a pointer that * points immediately after the terminating zero character in "name" * and aligning this pointer to next 8-byte boundary. * Uuid is present if the flag DM_NAME_LIST_FLAG_HAS_UUID is set. * * __u32 event_nr; * __u32 flags; * char uuid[0]; */ }; #define DM_NAME_LIST_FLAG_HAS_UUID 1 #define DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID 2 /* * Used to retrieve the target versions */ struct dm_target_versions { __u32 next; __u32 version[3]; char name[0]; }; /* * Used to pass message to a target */ struct dm_target_msg { __u64 sector; /* Device sector */ char message[0]; }; /* * If you change this make sure you make the corresponding change * to dm-ioctl.c:lookup_ioctl() */ enum { /* Top level cmds */ DM_VERSION_CMD = 0, DM_REMOVE_ALL_CMD, DM_LIST_DEVICES_CMD, /* device level cmds */ DM_DEV_CREATE_CMD, DM_DEV_REMOVE_CMD, DM_DEV_RENAME_CMD, DM_DEV_SUSPEND_CMD, DM_DEV_STATUS_CMD, DM_DEV_WAIT_CMD, /* Table level cmds */ DM_TABLE_LOAD_CMD, DM_TABLE_CLEAR_CMD, DM_TABLE_DEPS_CMD, DM_TABLE_STATUS_CMD, /* Added later */ DM_LIST_VERSIONS_CMD, DM_TARGET_MSG_CMD, DM_DEV_SET_GEOMETRY_CMD, DM_DEV_ARM_POLL_CMD, DM_GET_TARGET_VERSION_CMD, }; #define DM_IOCTL 0xfd #define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) #define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) #define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl) #define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) #define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) #define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) #define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) #define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) #define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl) #define DM_DEV_ARM_POLL _IOWR(DM_IOCTL, DM_DEV_ARM_POLL_CMD, struct dm_ioctl) #define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl) #define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl) #define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl) #define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl) #define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) #define DM_GET_TARGET_VERSION _IOWR(DM_IOCTL, DM_GET_TARGET_VERSION_CMD, struct dm_ioctl) #define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) #define DM_VERSION_MAJOR 4 #define DM_VERSION_MINOR 46 #define DM_VERSION_PATCHLEVEL 0 #define DM_VERSION_EXTRA "-ioctl (2022-02-22)" /* Status bits */ #define DM_READONLY_FLAG (1 << 0) /* In/Out */ #define DM_SUSPEND_FLAG (1 << 1) /* In/Out */ #define DM_PERSISTENT_DEV_FLAG (1 << 3) /* In */ /* * Flag passed into ioctl STATUS command to get table information * rather than current status. */ #define DM_STATUS_TABLE_FLAG (1 << 4) /* In */ /* * Flags that indicate whether a table is present in either of * the two table slots that a device has. */ #define DM_ACTIVE_PRESENT_FLAG (1 << 5) /* Out */ #define DM_INACTIVE_PRESENT_FLAG (1 << 6) /* Out */ /* * Indicates that the buffer passed in wasn't big enough for the * results. */ #define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ /* * This flag is now ignored. */ #define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ /* * Set this to avoid attempting to freeze any filesystem when suspending. */ #define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */ /* * Set this to suspend without flushing queued ios. * Also disables flushing uncommitted changes in the thin target before * generating statistics for DM_TABLE_STATUS and DM_DEV_WAIT. */ #define DM_NOFLUSH_FLAG (1 << 11) /* In */ /* * If set, any table information returned will relate to the inactive * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG * is set before using the data returned. */ #define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ /* * If set, a uevent was generated for which the caller may need to wait. */ #define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */ /* * If set, rename changes the uuid not the name. Only permitted * if no uuid was previously supplied: an existing uuid cannot be changed. */ #define DM_UUID_FLAG (1 << 14) /* In */ /* * If set, all buffers are wiped after use. Use when sending * or requesting sensitive data such as an encryption key. */ #define DM_SECURE_DATA_FLAG (1 << 15) /* In */ /* * If set, a message generated output data. */ #define DM_DATA_OUT_FLAG (1 << 16) /* Out */ /* * If set with DM_DEV_REMOVE or DM_REMOVE_ALL this indicates that if * the device cannot be removed immediately because it is still in use * it should instead be scheduled for removal when it gets closed. * * On return from DM_DEV_REMOVE, DM_DEV_STATUS or other ioctls, this * flag indicates that the device is scheduled to be removed when it * gets closed. */ #define DM_DEFERRED_REMOVE (1 << 17) /* In/Out */ /* * If set, the device is suspended internally. */ #define DM_INTERNAL_SUSPEND_FLAG (1 << 18) /* Out */ #endif /* _LINUX_DM_IOCTL_H */ linux/dm-log-userspace.h 0000644 00000035527 15063602046 0011241 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2006-2009 Red Hat, Inc. * * This file is released under the LGPL. */ #ifndef __DM_LOG_USERSPACE_H__ #define __DM_LOG_USERSPACE_H__ #include <linux/types.h> #include <linux/dm-ioctl.h> /* For DM_UUID_LEN */ /* * The device-mapper userspace log module consists of a kernel component and * a user-space component. The kernel component implements the API defined * in dm-dirty-log.h. Its purpose is simply to pass the parameters and * return values of those API functions between kernel and user-space. * * Below are defined the 'request_types' - DM_ULOG_CTR, DM_ULOG_DTR, etc. * These request types represent the different functions in the device-mapper * dirty log API. Each of these is described in more detail below. * * The user-space program must listen for requests from the kernel (representing * the various API functions) and process them. * * User-space begins by setting up the communication link (error checking * removed for clarity): * fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); * addr.nl_family = AF_NETLINK; * addr.nl_groups = CN_IDX_DM; * addr.nl_pid = 0; * r = bind(fd, (struct sockaddr *) &addr, sizeof(addr)); * opt = addr.nl_groups; * setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt)); * * User-space will then wait to receive requests form the kernel, which it * will process as described below. The requests are received in the form, * ((struct dm_ulog_request) + (additional data)). Depending on the request * type, there may or may not be 'additional data'. In the descriptions below, * you will see 'Payload-to-userspace' and 'Payload-to-kernel'. The * 'Payload-to-userspace' is what the kernel sends in 'additional data' as * necessary parameters to complete the request. The 'Payload-to-kernel' is * the 'additional data' returned to the kernel that contains the necessary * results of the request. The 'data_size' field in the dm_ulog_request * structure denotes the availability and amount of payload data. */ /* * DM_ULOG_CTR corresponds to (found in dm-dirty-log.h): * int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, * unsigned argc, char **argv); * * Payload-to-userspace: * A single string containing all the argv arguments separated by ' 's * Payload-to-kernel: * A NUL-terminated string that is the name of the device that is used * as the backing store for the log data. 'dm_get_device' will be called * on this device. ('dm_put_device' will be called on this device * automatically after calling DM_ULOG_DTR.) If there is no device needed * for log data, 'data_size' in the dm_ulog_request struct should be 0. * * The UUID contained in the dm_ulog_request structure is the reference that * will be used by all request types to a specific log. The constructor must * record this association with the instance created. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field, filling the * data field with the log device if necessary, and setting 'data_size' * appropriately. */ #define DM_ULOG_CTR 1 /* * DM_ULOG_DTR corresponds to (found in dm-dirty-log.h): * void (*dtr)(struct dm_dirty_log *log); * * Payload-to-userspace: * A single string containing all the argv arguments separated by ' 's * Payload-to-kernel: * None. ('data_size' in the dm_ulog_request struct should be 0.) * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being destroyed. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_DTR 2 /* * DM_ULOG_PRESUSPEND corresponds to (found in dm-dirty-log.h): * int (*presuspend)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * None. * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being presuspended. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_PRESUSPEND 3 /* * DM_ULOG_POSTSUSPEND corresponds to (found in dm-dirty-log.h): * int (*postsuspend)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * None. * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being postsuspended. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_POSTSUSPEND 4 /* * DM_ULOG_RESUME corresponds to (found in dm-dirty-log.h): * int (*resume)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * None. * * The UUID contained in the dm_ulog_request structure is all that is * necessary to identify the log instance being resumed. There is no * payload data. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_RESUME 5 /* * DM_ULOG_GET_REGION_SIZE corresponds to (found in dm-dirty-log.h): * __u32 (*get_region_size)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * __u64 - contains the region size * * The region size is something that was determined at constructor time. * It is returned in the payload area and 'data_size' is set to * reflect this. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field appropriately. */ #define DM_ULOG_GET_REGION_SIZE 6 /* * DM_ULOG_IS_CLEAN corresponds to (found in dm-dirty-log.h): * int (*is_clean)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 - the region to get clean status on * Payload-to-kernel: * __s64 - 1 if clean, 0 otherwise * * Payload is sizeof(__u64) and contains the region for which the clean * status is being made. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - filling the payload with 0 (not clean) or * 1 (clean), setting 'data_size' and 'error' appropriately. */ #define DM_ULOG_IS_CLEAN 7 /* * DM_ULOG_IN_SYNC corresponds to (found in dm-dirty-log.h): * int (*in_sync)(struct dm_dirty_log *log, region_t region, * int can_block); * * Payload-to-userspace: * __u64 - the region to get sync status on * Payload-to-kernel: * __s64 - 1 if in-sync, 0 otherwise * * Exactly the same as 'is_clean' above, except this time asking "has the * region been recovered?" vs. "is the region not being modified?" */ #define DM_ULOG_IN_SYNC 8 /* * DM_ULOG_FLUSH corresponds to (found in dm-dirty-log.h): * int (*flush)(struct dm_dirty_log *log); * * Payload-to-userspace: * If the 'integrated_flush' directive is present in the constructor * table, the payload is as same as DM_ULOG_MARK_REGION: * __u64 [] - region(s) to mark * else * None * Payload-to-kernel: * None. * * If the 'integrated_flush' option was used during the creation of the * log, mark region requests are carried as payload in the flush request. * Piggybacking the mark requests in this way allows for fewer communications * between kernel and userspace. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_FLUSH 9 /* * DM_ULOG_MARK_REGION corresponds to (found in dm-dirty-log.h): * void (*mark_region)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 [] - region(s) to mark * Payload-to-kernel: * None. * * Incoming payload contains the one or more regions to mark dirty. * The number of regions contained in the payload can be determined from * 'data_size/sizeof(__u64)'. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_MARK_REGION 10 /* * DM_ULOG_CLEAR_REGION corresponds to (found in dm-dirty-log.h): * void (*clear_region)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 [] - region(s) to clear * Payload-to-kernel: * None. * * Incoming payload contains the one or more regions to mark clean. * The number of regions contained in the payload can be determined from * 'data_size/sizeof(__u64)'. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_CLEAR_REGION 11 /* * DM_ULOG_GET_RESYNC_WORK corresponds to (found in dm-dirty-log.h): * int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); * * Payload-to-userspace: * None. * Payload-to-kernel: * { * __s64 i; -- 1 if recovery necessary, 0 otherwise * __u64 r; -- The region to recover if i=1 * } * 'data_size' should be set appropriately. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field appropriately. */ #define DM_ULOG_GET_RESYNC_WORK 12 /* * DM_ULOG_SET_REGION_SYNC corresponds to (found in dm-dirty-log.h): * void (*set_region_sync)(struct dm_dirty_log *log, * region_t region, int in_sync); * * Payload-to-userspace: * { * __u64 - region to set sync state on * __s64 - 0 if not-in-sync, 1 if in-sync * } * Payload-to-kernel: * None. * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and clearing * 'data_size' appropriately. */ #define DM_ULOG_SET_REGION_SYNC 13 /* * DM_ULOG_GET_SYNC_COUNT corresponds to (found in dm-dirty-log.h): * region_t (*get_sync_count)(struct dm_dirty_log *log); * * Payload-to-userspace: * None. * Payload-to-kernel: * __u64 - the number of in-sync regions * * No incoming payload. Kernel-bound payload contains the number of * regions that are in-sync (in a size_t). * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_GET_SYNC_COUNT 14 /* * DM_ULOG_STATUS_INFO corresponds to (found in dm-dirty-log.h): * int (*status)(struct dm_dirty_log *log, STATUSTYPE_INFO, * char *result, unsigned maxlen); * * Payload-to-userspace: * None. * Payload-to-kernel: * Character string containing STATUSTYPE_INFO * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_STATUS_INFO 15 /* * DM_ULOG_STATUS_TABLE corresponds to (found in dm-dirty-log.h): * int (*status)(struct dm_dirty_log *log, STATUSTYPE_TABLE, * char *result, unsigned maxlen); * * Payload-to-userspace: * None. * Payload-to-kernel: * Character string containing STATUSTYPE_TABLE * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_STATUS_TABLE 16 /* * DM_ULOG_IS_REMOTE_RECOVERING corresponds to (found in dm-dirty-log.h): * int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region); * * Payload-to-userspace: * __u64 - region to determine recovery status on * Payload-to-kernel: * { * __s64 is_recovering; -- 0 if no, 1 if yes * __u64 in_sync_hint; -- lowest region still needing resync * } * * When the request has been processed, user-space must return the * dm_ulog_request to the kernel - setting the 'error' field and * 'data_size' appropriately. */ #define DM_ULOG_IS_REMOTE_RECOVERING 17 /* * (DM_ULOG_REQUEST_MASK & request_type) to get the request type * * Payload-to-userspace: * A single string containing all the argv arguments separated by ' 's * Payload-to-kernel: * None. ('data_size' in the dm_ulog_request struct should be 0.) * * We are reserving 8 bits of the 32-bit 'request_type' field for the * various request types above. The remaining 24-bits are currently * set to zero and are reserved for future use and compatibility concerns. * * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the * request type from the 'request_type' field to maintain forward compatibility. */ #define DM_ULOG_REQUEST_MASK 0xFF #define DM_ULOG_REQUEST_TYPE(request_type) \ (DM_ULOG_REQUEST_MASK & (request_type)) /* * DM_ULOG_REQUEST_VERSION is incremented when there is a * change to the way information is passed between kernel * and userspace. This could be a structure change of * dm_ulog_request or a change in the way requests are * issued/handled. Changes are outlined here: * version 1: Initial implementation * version 2: DM_ULOG_CTR allowed to return a string containing a * device name that is to be registered with DM via * 'dm_get_device'. * version 3: DM_ULOG_FLUSH is capable of carrying payload for marking * regions. This "integrated flush" reduces the number of * requests between the kernel and userspace by effectively * merging 'mark' and 'flush' requests. A constructor table * argument ('integrated_flush') is required to turn this * feature on, so it is backwards compatible with older * userspace versions. */ #define DM_ULOG_REQUEST_VERSION 3 struct dm_ulog_request { /* * The local unique identifier (luid) and the universally unique * identifier (uuid) are used to tie a request to a specific * mirror log. A single machine log could probably make due with * just the 'luid', but a cluster-aware log must use the 'uuid' and * the 'luid'. The uuid is what is required for node to node * communication concerning a particular log, but the 'luid' helps * differentiate between logs that are being swapped and have the * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) */ __u64 luid; char uuid[DM_UUID_LEN]; char padding[3]; /* Padding because DM_UUID_LEN = 129 */ __u32 version; /* See DM_ULOG_REQUEST_VERSION */ __s32 error; /* Used to report back processing errors */ __u32 seq; /* Sequence number for request */ __u32 request_type; /* DM_ULOG_* defined above */ __u32 data_size; /* How much data (not including this struct) */ char data[0]; }; #endif /* __DM_LOG_USERSPACE_H__ */ linux/dma-buf.h 0000644 00000012177 15063602047 0007402 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Framework for buffer objects that can be shared across devices/subsystems. * * Copyright(C) 2015 Intel Ltd * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _DMA_BUF_UAPI_H_ #define _DMA_BUF_UAPI_H_ #include <linux/types.h> /* begin/end dma-buf functions used for userspace mmap. */ struct dma_buf_sync { __u64 flags; }; #define DMA_BUF_SYNC_READ (1 << 0) #define DMA_BUF_SYNC_WRITE (2 << 0) #define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE) #define DMA_BUF_SYNC_START (0 << 2) #define DMA_BUF_SYNC_END (1 << 2) #define DMA_BUF_SYNC_VALID_FLAGS_MASK \ (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END) #define DMA_BUF_NAME_LEN 32 /** * struct dma_buf_export_sync_file - Get a sync_file from a dma-buf * * Userspace can perform a DMA_BUF_IOCTL_EXPORT_SYNC_FILE to retrieve the * current set of fences on a dma-buf file descriptor as a sync_file. CPU * waits via poll() or other driver-specific mechanisms typically wait on * whatever fences are on the dma-buf at the time the wait begins. This * is similar except that it takes a snapshot of the current fences on the * dma-buf for waiting later instead of waiting immediately. This is * useful for modern graphics APIs such as Vulkan which assume an explicit * synchronization model but still need to inter-operate with dma-buf. * * The intended usage pattern is the following: * * 1. Export a sync_file with flags corresponding to the expected GPU usage * via DMA_BUF_IOCTL_EXPORT_SYNC_FILE. * * 2. Submit rendering work which uses the dma-buf. The work should wait on * the exported sync file before rendering and produce another sync_file * when complete. * * 3. Import the rendering-complete sync_file into the dma-buf with flags * corresponding to the GPU usage via DMA_BUF_IOCTL_IMPORT_SYNC_FILE. * * Unlike doing implicit synchronization via a GPU kernel driver's exec ioctl, * the above is not a single atomic operation. If userspace wants to ensure * ordering via these fences, it is the respnosibility of userspace to use * locks or other mechanisms to ensure that no other context adds fences or * submits work between steps 1 and 3 above. */ struct dma_buf_export_sync_file { /** * @flags: Read/write flags * * Must be DMA_BUF_SYNC_READ, DMA_BUF_SYNC_WRITE, or both. * * If DMA_BUF_SYNC_READ is set and DMA_BUF_SYNC_WRITE is not set, * the returned sync file waits on any writers of the dma-buf to * complete. Waiting on the returned sync file is equivalent to * poll() with POLLIN. * * If DMA_BUF_SYNC_WRITE is set, the returned sync file waits on * any users of the dma-buf (read or write) to complete. Waiting * on the returned sync file is equivalent to poll() with POLLOUT. * If both DMA_BUF_SYNC_WRITE and DMA_BUF_SYNC_READ are set, this * is equivalent to just DMA_BUF_SYNC_WRITE. */ __u32 flags; /** @fd: Returned sync file descriptor */ __s32 fd; }; /** * struct dma_buf_import_sync_file - Insert a sync_file into a dma-buf * * Userspace can perform a DMA_BUF_IOCTL_IMPORT_SYNC_FILE to insert a * sync_file into a dma-buf for the purposes of implicit synchronization * with other dma-buf consumers. This allows clients using explicitly * synchronized APIs such as Vulkan to inter-op with dma-buf consumers * which expect implicit synchronization such as OpenGL or most media * drivers/video. */ struct dma_buf_import_sync_file { /** * @flags: Read/write flags * * Must be DMA_BUF_SYNC_READ, DMA_BUF_SYNC_WRITE, or both. * * If DMA_BUF_SYNC_READ is set and DMA_BUF_SYNC_WRITE is not set, * this inserts the sync_file as a read-only fence. Any subsequent * implicitly synchronized writes to this dma-buf will wait on this * fence but reads will not. * * If DMA_BUF_SYNC_WRITE is set, this inserts the sync_file as a * write fence. All subsequent implicitly synchronized access to * this dma-buf will wait on this fence. */ __u32 flags; /** @fd: Sync file descriptor */ __s32 fd; }; #define DMA_BUF_BASE 'b' #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) /* 32/64bitness of this uapi was botched in android, there's no difference * between them in actual uapi, they're just different numbers. */ #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *) #define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, __u32) #define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, __u64) #define DMA_BUF_IOCTL_EXPORT_SYNC_FILE _IOWR(DMA_BUF_BASE, 2, struct dma_buf_export_sync_file) #define DMA_BUF_IOCTL_IMPORT_SYNC_FILE _IOW(DMA_BUF_BASE, 3, struct dma_buf_import_sync_file) #endif linux/dn.h 0000644 00000011042 15063602047 0006456 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_DN_H #define _LINUX_DN_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/if_ether.h> /* DECnet Data Structures and Constants */ /* * DNPROTO_NSP can't be the same as SOL_SOCKET, * so increment each by one (compared to ULTRIX) */ #define DNPROTO_NSP 2 /* NSP protocol number */ #define DNPROTO_ROU 3 /* Routing protocol number */ #define DNPROTO_NML 4 /* Net mgt protocol number */ #define DNPROTO_EVL 5 /* Evl protocol number (usr) */ #define DNPROTO_EVR 6 /* Evl protocol number (evl) */ #define DNPROTO_NSPT 7 /* NSP trace protocol number */ #define DN_ADDL 2 #define DN_MAXADDL 2 /* ULTRIX headers have 20 here, but pathworks has 2 */ #define DN_MAXOPTL 16 #define DN_MAXOBJL 16 #define DN_MAXACCL 40 #define DN_MAXALIASL 128 #define DN_MAXNODEL 256 #define DNBUFSIZE 65023 /* * SET/GET Socket options - must match the DSO_ numbers below */ #define SO_CONDATA 1 #define SO_CONACCESS 2 #define SO_PROXYUSR 3 #define SO_LINKINFO 7 #define DSO_CONDATA 1 /* Set/Get connect data */ #define DSO_DISDATA 10 /* Set/Get disconnect data */ #define DSO_CONACCESS 2 /* Set/Get connect access data */ #define DSO_ACCEPTMODE 4 /* Set/Get accept mode */ #define DSO_CONACCEPT 5 /* Accept deferred connection */ #define DSO_CONREJECT 6 /* Reject deferred connection */ #define DSO_LINKINFO 7 /* Set/Get link information */ #define DSO_STREAM 8 /* Set socket type to stream */ #define DSO_SEQPACKET 9 /* Set socket type to sequenced packet */ #define DSO_MAXWINDOW 11 /* Maximum window size allowed */ #define DSO_NODELAY 12 /* Turn off nagle */ #define DSO_CORK 13 /* Wait for more data! */ #define DSO_SERVICES 14 /* NSP Services field */ #define DSO_INFO 15 /* NSP Info field */ #define DSO_MAX 15 /* Maximum option number */ /* LINK States */ #define LL_INACTIVE 0 #define LL_CONNECTING 1 #define LL_RUNNING 2 #define LL_DISCONNECTING 3 #define ACC_IMMED 0 #define ACC_DEFER 1 #define SDF_WILD 1 /* Wild card object */ #define SDF_PROXY 2 /* Addr eligible for proxy */ #define SDF_UICPROXY 4 /* Use uic-based proxy */ /* Structures */ struct dn_naddr { __le16 a_len; __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ }; struct sockaddr_dn { __u16 sdn_family; __u8 sdn_flags; __u8 sdn_objnum; __le16 sdn_objnamel; __u8 sdn_objname[DN_MAXOBJL]; struct dn_naddr sdn_add; }; #define sdn_nodeaddrl sdn_add.a_len /* Node address length */ #define sdn_nodeaddr sdn_add.a_addr /* Node address */ /* * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure */ struct optdata_dn { __le16 opt_status; /* Extended status return */ #define opt_sts opt_status __le16 opt_optl; /* Length of user data */ __u8 opt_data[16]; /* User data */ }; struct accessdata_dn { __u8 acc_accl; __u8 acc_acc[DN_MAXACCL]; __u8 acc_passl; __u8 acc_pass[DN_MAXACCL]; __u8 acc_userl; __u8 acc_user[DN_MAXACCL]; }; /* * DECnet logical link information structure */ struct linkinfo_dn { __u16 idn_segsize; /* Segment size for link */ __u8 idn_linkstate; /* Logical link state */ }; /* * Ethernet address format (for DECnet) */ union etheraddress { __u8 dne_addr[ETH_ALEN]; /* Full ethernet address */ struct { __u8 dne_hiord[4]; /* DECnet HIORD prefix */ __u8 dne_nodeaddr[2]; /* DECnet node address */ } dne_remote; }; /* * DECnet physical socket address format */ struct dn_addr { __le16 dna_family; /* AF_DECnet */ union etheraddress dna_netaddr; /* DECnet ethernet address */ }; #define DECNET_IOCTL_BASE 0x89 /* PROTOPRIVATE range */ #define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr) #define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr) #define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int) #define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int) #endif /* _LINUX_DN_H */ linux/dqblk_xfs.h 0000644 00000022035 15063602047 0010036 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesset General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _LINUX_DQBLK_XFS_H #define _LINUX_DQBLK_XFS_H #include <linux/types.h> /* * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM). */ #define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */ #define XQM_COMMAND(x) (((x) & (0xff<<8)) == ('X'<<8)) /* test if for XFS */ #define XQM_USRQUOTA 0 /* system call user quota type */ #define XQM_GRPQUOTA 1 /* system call group quota type */ #define XQM_PRJQUOTA 2 /* system call project quota type */ #define XQM_MAXQUOTAS 3 #define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ #define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ #define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */ #define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ #define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ #define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ #define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ #define Q_XGETQSTATV XQM_CMD(8) /* newer version of get quota */ #define Q_XGETNEXTQUOTA XQM_CMD(9) /* get disk limits and usage >= ID */ /* * fs_disk_quota structure: * * This contains the current quota information regarding a user/proj/group. * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of * 512 bytes. */ #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ typedef struct fs_disk_quota { __s8 d_version; /* version of this structure */ __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */ __u16 d_fieldmask; /* field specifier */ __u32 d_id; /* user, project, or group ID */ __u64 d_blk_hardlimit;/* absolute limit on disk blks */ __u64 d_blk_softlimit;/* preferred limit on disk blks */ __u64 d_ino_hardlimit;/* maximum # allocated inodes */ __u64 d_ino_softlimit;/* preferred inode limit */ __u64 d_bcount; /* # disk blocks owned by the user */ __u64 d_icount; /* # inodes owned by the user */ __s32 d_itimer; /* zero if within inode limits */ /* if not, we refuse service */ __s32 d_btimer; /* similar to above; for disk blocks */ __u16 d_iwarns; /* # warnings issued wrt num inodes */ __u16 d_bwarns; /* # warnings issued wrt disk blocks */ __s8 d_itimer_hi; /* upper 8 bits of timer values */ __s8 d_btimer_hi; __s8 d_rtbtimer_hi; __s8 d_padding2; /* padding2 - for future use */ __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ __u64 d_rtbcount; /* # realtime blocks owned */ __s32 d_rtbtimer; /* similar to above; for RT disk blks */ __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ __s16 d_padding3; /* padding3 - for future use */ char d_padding4[8]; /* yet more padding */ } fs_disk_quota_t; /* * These fields are sent to Q_XSETQLIM to specify fields that need to change. */ #define FS_DQ_ISOFT (1<<0) #define FS_DQ_IHARD (1<<1) #define FS_DQ_BSOFT (1<<2) #define FS_DQ_BHARD (1<<3) #define FS_DQ_RTBSOFT (1<<4) #define FS_DQ_RTBHARD (1<<5) #define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) /* * These timers can only be set in super user's dquot. For others, timers are * automatically started and stopped. Superusers timer values set the limits * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values * defined below are used. * These values also apply only to the d_fieldmask field for Q_XSETQLIM. */ #define FS_DQ_BTIMER (1<<6) #define FS_DQ_ITIMER (1<<7) #define FS_DQ_RTBTIMER (1<<8) #define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) /* * Warning counts are set in both super user's dquot and others. For others, * warnings are set/cleared by the administrators (or automatically by going * below the soft limit). Superusers warning values set the warning limits * for the rest. In case these values are zero, the DQ_{F,B}WARNLIMIT values * defined below are used. * These values also apply only to the d_fieldmask field for Q_XSETQLIM. */ #define FS_DQ_BWARNS (1<<9) #define FS_DQ_IWARNS (1<<10) #define FS_DQ_RTBWARNS (1<<11) #define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) /* * Accounting values. These can only be set for filesystem with * non-transactional quotas that require quotacheck(8) in userspace. */ #define FS_DQ_BCOUNT (1<<12) #define FS_DQ_ICOUNT (1<<13) #define FS_DQ_RTBCOUNT (1<<14) #define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT) /* * Quota expiration timestamps are 40-bit signed integers, with the upper 8 * bits encoded in the _hi fields. */ #define FS_DQ_BIGTIME (1<<15) /* * Various flags related to quotactl(2). */ #define FS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ #define FS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ #define FS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ #define FS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ #define FS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */ #define FS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */ #define FS_USER_QUOTA (1<<0) /* user quota type */ #define FS_PROJ_QUOTA (1<<1) /* project quota type */ #define FS_GROUP_QUOTA (1<<2) /* group quota type */ /* * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. * Provides a centralized way to get meta information about the quota subsystem. * eg. space taken up for user and group quotas, number of dquots currently * incore. */ #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ /* * Some basic information about 'quota files'. */ typedef struct fs_qfilestat { __u64 qfs_ino; /* inode number */ __u64 qfs_nblks; /* number of BBs 512-byte-blks */ __u32 qfs_nextents; /* number of extents */ } fs_qfilestat_t; typedef struct fs_quota_stat { __s8 qs_version; /* version number for future changes */ __u16 qs_flags; /* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ __s8 qs_pad; /* unused */ fs_qfilestat_t qs_uquota; /* user quota storage information */ fs_qfilestat_t qs_gquota; /* group quota storage information */ __u32 qs_incoredqs; /* number of dquots incore */ __s32 qs_btimelimit; /* limit for blks timer */ __s32 qs_itimelimit; /* limit for inodes timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit; /* limit for num warnings */ __u16 qs_iwarnlimit; /* limit for num warnings */ } fs_quota_stat_t; /* * fs_quota_statv is used by Q_XGETQSTATV for a given file system. It provides * a centralized way to get meta information about the quota subsystem. eg. * space taken up for user, group, and project quotas, number of dquots * currently incore. * * This version has proper versioning support with appropriate padding for * future expansions, and ability to expand for future without creating any * backward compatibility issues. * * Q_XGETQSTATV uses the passed in value of the requested version via * fs_quota_statv.qs_version to determine the return data layout of * fs_quota_statv. The kernel will fill the data fields relevant to that * version. * * If kernel does not support user space caller specified version, EINVAL will * be returned. User space caller can then reduce the version number and retry * the same command. */ #define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */ /* * Some basic information about 'quota files' for Q_XGETQSTATV command */ struct fs_qfilestatv { __u64 qfs_ino; /* inode number */ __u64 qfs_nblks; /* number of BBs 512-byte-blks */ __u32 qfs_nextents; /* number of extents */ __u32 qfs_pad; /* pad for 8-byte alignment */ }; struct fs_quota_statv { __s8 qs_version; /* version for future changes */ __u8 qs_pad1; /* pad for 16bit alignment */ __u16 qs_flags; /* FS_QUOTA_.* flags */ __u32 qs_incoredqs; /* number of dquots incore */ struct fs_qfilestatv qs_uquota; /* user quota information */ struct fs_qfilestatv qs_gquota; /* group quota information */ struct fs_qfilestatv qs_pquota; /* project quota information */ __s32 qs_btimelimit; /* limit for blks timer */ __s32 qs_itimelimit; /* limit for inodes timer */ __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit; /* limit for num warnings */ __u16 qs_iwarnlimit; /* limit for num warnings */ __u64 qs_pad2[8]; /* for future proofing */ }; #endif /* _LINUX_DQBLK_XFS_H */ linux/edd.h 0000644 00000012744 15063602047 0006623 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/edd.h * Copyright (C) 2002, 2003, 2004 Dell Inc. * by Matt Domsch <Matt_Domsch@dell.com> * * structures and definitions for the int 13h, ax={41,48}h * BIOS Enhanced Disk Drive Services * This is based on the T13 group document D1572 Revision 0 (August 14 2002) * available at http://www.t13.org/docs2002/d1572r0.pdf. It is * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf * * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch * table in the boot_params that contains a list of BIOS-enumerated * boot devices. * In arch/{i386,x86_64}/kernel/setup.c, this information is * transferred into the edd structure, and in drivers/firmware/edd.c, that * information is used to identify BIOS boot disk. The code in setup.S * is very sensitive to the size of these structures. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License v2.0 as published by * the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef _LINUX_EDD_H #define _LINUX_EDD_H #include <linux/types.h> #define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF in boot_params - treat this as 1 byte */ #define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ #define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ #define EDDEXTSIZE 8 /* change these if you muck with the structures */ #define EDDPARMSIZE 74 #define CHECKEXTENSIONSPRESENT 0x41 #define GETDEVICEPARAMETERS 0x48 #define LEGACYGETDEVICEPARAMETERS 0x08 #define EDDMAGIC1 0x55AA #define EDDMAGIC2 0xAA55 #define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ #define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ #define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ #define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ #define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF in boot_params - treat this as 1 byte */ #ifndef __ASSEMBLY__ #define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) #define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) #define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) #define EDD_EXT_64BIT_EXTENSIONS (1 << 3) #define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) #define EDD_INFO_GEOMETRY_VALID (1 << 1) #define EDD_INFO_REMOVABLE (1 << 2) #define EDD_INFO_WRITE_VERIFY (1 << 3) #define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) #define EDD_INFO_LOCKABLE (1 << 5) #define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) #define EDD_INFO_USE_INT13_FN50 (1 << 7) struct edd_device_params { __u16 length; __u16 info_flags; __u32 num_default_cylinders; __u32 num_default_heads; __u32 sectors_per_track; __u64 number_of_sectors; __u16 bytes_per_sector; __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ __u16 key; /* = 0xBEDD */ __u8 device_path_info_length; /* = 44 */ __u8 reserved2; __u16 reserved3; __u8 host_bus_type[4]; __u8 interface_type[8]; union { struct { __u16 base_address; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) isa; struct { __u8 bus; __u8 slot; __u8 function; __u8 channel; __u32 reserved; } __attribute__ ((packed)) pci; /* pcix is same as pci */ struct { __u64 reserved; } __attribute__ ((packed)) ibnd; struct { __u64 reserved; } __attribute__ ((packed)) xprs; struct { __u64 reserved; } __attribute__ ((packed)) htpt; struct { __u64 reserved; } __attribute__ ((packed)) unknown; } interface_path; union { struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) ata; struct { __u8 device; __u8 lun; __u8 reserved1; __u8 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) atapi; struct { __u16 id; __u64 lun; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) scsi; struct { __u64 serial_number; __u64 reserved; } __attribute__ ((packed)) usb; struct { __u64 eui; __u64 reserved; } __attribute__ ((packed)) i1394; struct { __u64 wwid; __u64 lun; } __attribute__ ((packed)) fibre; struct { __u64 identity_tag; __u64 reserved; } __attribute__ ((packed)) i2o; struct { __u32 array_number; __u32 reserved1; __u64 reserved2; } __attribute__ ((packed)) raid; struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) sata; struct { __u64 reserved1; __u64 reserved2; } __attribute__ ((packed)) unknown; } device_path; __u8 reserved4; __u8 checksum; } __attribute__ ((packed)); struct edd_info { __u8 device; __u8 version; __u16 interface_support; __u16 legacy_max_cylinder; __u8 legacy_max_head; __u8 legacy_sectors_per_track; struct edd_device_params params; } __attribute__ ((packed)); struct edd { unsigned int mbr_signature[EDD_MBR_SIG_MAX]; struct edd_info edd_info[EDDMAXNR]; unsigned char mbr_signature_nr; unsigned char edd_info_nr; }; #endif /*!__ASSEMBLY__ */ #endif /* _LINUX_EDD_H */ linux/elf-em.h 0000644 00000004213 15063602047 0007224 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ELF_EM_H #define _LINUX_ELF_EM_H /* These constants define the various ELF target machines */ #define EM_NONE 0 #define EM_M32 1 #define EM_SPARC 2 #define EM_386 3 #define EM_68K 4 #define EM_88K 5 #define EM_486 6 /* Perhaps disused */ #define EM_860 7 #define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ /* Next two are historical and binaries and modules of these types will be rejected by Linux. */ #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ #define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ #define EM_PARISC 15 /* HPPA */ #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ #define EM_PPC 20 /* PowerPC */ #define EM_PPC64 21 /* PowerPC64 */ #define EM_SPU 23 /* Cell BE SPU */ #define EM_ARM 40 /* ARM 32 bit */ #define EM_SH 42 /* SuperH */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_H8_300 46 /* Renesas H8/300 */ #define EM_IA_64 50 /* HP/Intel IA-64 */ #define EM_X86_64 62 /* AMD x86-64 */ #define EM_S390 22 /* IBM S/390 */ #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ #define EM_M32R 88 /* Renesas M32R */ #define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ #define EM_BLACKFIN 106 /* ADI Blackfin Processor */ #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ #define EM_TI_C6000 140 /* TI C6X DSPs */ #define EM_AARCH64 183 /* ARM 64 bit */ #define EM_TILEPRO 188 /* Tilera TILEPro */ #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ #define EM_TILEGX 191 /* Tilera TILE-Gx */ #define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ #define EM_FRV 0x5441 /* Fujitsu FR-V */ /* * This is an interim value that we will use until the committee comes * up with a final number. */ #define EM_ALPHA 0x9026 /* Bogus old m32r magic number, used by old tools. */ #define EM_CYGNUS_M32R 0x9041 /* This is the old interim value for S/390 architecture */ #define EM_S390_OLD 0xA390 /* Also Panasonic/MEI MN10300, AM33 */ #define EM_CYGNUS_MN10300 0xbeef #endif /* _LINUX_ELF_EM_H */ linux/elf.h 0000644 00000032237 15063602047 0006634 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ELF_H #define _LINUX_ELF_H #include <linux/types.h> #include <linux/elf-em.h> /* 32-bit ELF base types. */ typedef __u32 Elf32_Addr; typedef __u16 Elf32_Half; typedef __u32 Elf32_Off; typedef __s32 Elf32_Sword; typedef __u32 Elf32_Word; /* 64-bit ELF base types. */ typedef __u64 Elf64_Addr; typedef __u16 Elf64_Half; typedef __s16 Elf64_SHalf; typedef __u64 Elf64_Off; typedef __s32 Elf64_Sword; typedef __u32 Elf64_Word; typedef __u64 Elf64_Xword; typedef __s64 Elf64_Sxword; /* These constants are for the segment types stored in the image headers */ #define PT_NULL 0 #define PT_LOAD 1 #define PT_DYNAMIC 2 #define PT_INTERP 3 #define PT_NOTE 4 #define PT_SHLIB 5 #define PT_PHDR 6 #define PT_TLS 7 /* Thread local storage segment */ #define PT_LOOS 0x60000000 /* OS-specific */ #define PT_HIOS 0x6fffffff /* OS-specific */ #define PT_LOPROC 0x70000000 #define PT_HIPROC 0x7fffffff #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* * Extended Numbering * * If the real number of program header table entries is larger than * or equal to PN_XNUM(0xffff), it is set to sh_info field of the * section header at index 0, and PN_XNUM is set to e_phnum * field. Otherwise, the section header at index 0 is zero * initialized, if it exists. * * Specifications are available in: * * - Oracle: Linker and Libraries. * Part No: 817–1984–19, August 2011. * http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf * * - System V ABI AMD64 Architecture Processor Supplement * Draft Version 0.99.4, * January 13, 2010. * http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf */ #define PN_XNUM 0xffff /* These constants define the different elf file types */ #define ET_NONE 0 #define ET_REL 1 #define ET_EXEC 2 #define ET_DYN 3 #define ET_CORE 4 #define ET_LOPROC 0xff00 #define ET_HIPROC 0xffff /* This is the info that is needed to parse the dynamic section of the file */ #define DT_NULL 0 #define DT_NEEDED 1 #define DT_PLTRELSZ 2 #define DT_PLTGOT 3 #define DT_HASH 4 #define DT_STRTAB 5 #define DT_SYMTAB 6 #define DT_RELA 7 #define DT_RELASZ 8 #define DT_RELAENT 9 #define DT_STRSZ 10 #define DT_SYMENT 11 #define DT_INIT 12 #define DT_FINI 13 #define DT_SONAME 14 #define DT_RPATH 15 #define DT_SYMBOLIC 16 #define DT_REL 17 #define DT_RELSZ 18 #define DT_RELENT 19 #define DT_PLTREL 20 #define DT_DEBUG 21 #define DT_TEXTREL 22 #define DT_JMPREL 23 #define DT_ENCODING 32 #define OLD_DT_LOOS 0x60000000 #define DT_LOOS 0x6000000d #define DT_HIOS 0x6ffff000 #define DT_VALRNGLO 0x6ffffd00 #define DT_VALRNGHI 0x6ffffdff #define DT_ADDRRNGLO 0x6ffffe00 #define DT_ADDRRNGHI 0x6ffffeff #define DT_VERSYM 0x6ffffff0 #define DT_RELACOUNT 0x6ffffff9 #define DT_RELCOUNT 0x6ffffffa #define DT_FLAGS_1 0x6ffffffb #define DT_VERDEF 0x6ffffffc #define DT_VERDEFNUM 0x6ffffffd #define DT_VERNEED 0x6ffffffe #define DT_VERNEEDNUM 0x6fffffff #define OLD_DT_HIOS 0x6fffffff #define DT_LOPROC 0x70000000 #define DT_HIPROC 0x7fffffff /* This info is needed when parsing the symbol table */ #define STB_LOCAL 0 #define STB_GLOBAL 1 #define STB_WEAK 2 #define STT_NOTYPE 0 #define STT_OBJECT 1 #define STT_FUNC 2 #define STT_SECTION 3 #define STT_FILE 4 #define STT_COMMON 5 #define STT_TLS 6 #define ELF_ST_BIND(x) ((x) >> 4) #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) #define ELF32_ST_BIND(x) ELF_ST_BIND(x) #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) #define ELF64_ST_BIND(x) ELF_ST_BIND(x) #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) typedef struct dynamic{ Elf32_Sword d_tag; union{ Elf32_Sword d_val; Elf32_Addr d_ptr; } d_un; } Elf32_Dyn; typedef struct { Elf64_Sxword d_tag; /* entry tag value */ union { Elf64_Xword d_val; Elf64_Addr d_ptr; } d_un; } Elf64_Dyn; /* The following are used with relocations */ #define ELF32_R_SYM(x) ((x) >> 8) #define ELF32_R_TYPE(x) ((x) & 0xff) #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; } Elf32_Rel; typedef struct elf64_rel { Elf64_Addr r_offset; /* Location at which to apply the action */ Elf64_Xword r_info; /* index and type of relocation */ } Elf64_Rel; typedef struct elf32_rela{ Elf32_Addr r_offset; Elf32_Word r_info; Elf32_Sword r_addend; } Elf32_Rela; typedef struct elf64_rela { Elf64_Addr r_offset; /* Location at which to apply the action */ Elf64_Xword r_info; /* index and type of relocation */ Elf64_Sxword r_addend; /* Constant addend used to compute value */ } Elf64_Rela; typedef struct elf32_sym{ Elf32_Word st_name; Elf32_Addr st_value; Elf32_Word st_size; unsigned char st_info; unsigned char st_other; Elf32_Half st_shndx; } Elf32_Sym; typedef struct elf64_sym { Elf64_Word st_name; /* Symbol name, index in string tbl */ unsigned char st_info; /* Type and binding attributes */ unsigned char st_other; /* No defined meaning, 0 */ Elf64_Half st_shndx; /* Associated section index */ Elf64_Addr st_value; /* Value of the symbol */ Elf64_Xword st_size; /* Associated symbol size */ } Elf64_Sym; #define EI_NIDENT 16 typedef struct elf32_hdr{ unsigned char e_ident[EI_NIDENT]; Elf32_Half e_type; Elf32_Half e_machine; Elf32_Word e_version; Elf32_Addr e_entry; /* Entry point */ Elf32_Off e_phoff; Elf32_Off e_shoff; Elf32_Word e_flags; Elf32_Half e_ehsize; Elf32_Half e_phentsize; Elf32_Half e_phnum; Elf32_Half e_shentsize; Elf32_Half e_shnum; Elf32_Half e_shstrndx; } Elf32_Ehdr; typedef struct elf64_hdr { unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; /* Entry point virtual address */ Elf64_Off e_phoff; /* Program header table file offset */ Elf64_Off e_shoff; /* Section header table file offset */ Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } Elf64_Ehdr; /* These constants define the permissions on sections in the program header, p_flags. */ #define PF_R 0x4 #define PF_W 0x2 #define PF_X 0x1 typedef struct elf32_phdr{ Elf32_Word p_type; Elf32_Off p_offset; Elf32_Addr p_vaddr; Elf32_Addr p_paddr; Elf32_Word p_filesz; Elf32_Word p_memsz; Elf32_Word p_flags; Elf32_Word p_align; } Elf32_Phdr; typedef struct elf64_phdr { Elf64_Word p_type; Elf64_Word p_flags; Elf64_Off p_offset; /* Segment file offset */ Elf64_Addr p_vaddr; /* Segment virtual address */ Elf64_Addr p_paddr; /* Segment physical address */ Elf64_Xword p_filesz; /* Segment size in file */ Elf64_Xword p_memsz; /* Segment size in memory */ Elf64_Xword p_align; /* Segment alignment, file & memory */ } Elf64_Phdr; /* sh_type */ #define SHT_NULL 0 #define SHT_PROGBITS 1 #define SHT_SYMTAB 2 #define SHT_STRTAB 3 #define SHT_RELA 4 #define SHT_HASH 5 #define SHT_DYNAMIC 6 #define SHT_NOTE 7 #define SHT_NOBITS 8 #define SHT_REL 9 #define SHT_SHLIB 10 #define SHT_DYNSYM 11 #define SHT_NUM 12 #define SHT_LOPROC 0x70000000 #define SHT_HIPROC 0x7fffffff #define SHT_LOUSER 0x80000000 #define SHT_HIUSER 0xffffffff /* sh_flags */ #define SHF_WRITE 0x1 #define SHF_ALLOC 0x2 #define SHF_EXECINSTR 0x4 #define SHF_RELA_LIVEPATCH 0x00100000 #define SHF_RO_AFTER_INIT 0x00200000 #define SHF_MASKPROC 0xf0000000 /* special section indexes */ #define SHN_UNDEF 0 #define SHN_LORESERVE 0xff00 #define SHN_LOPROC 0xff00 #define SHN_HIPROC 0xff1f #define SHN_LIVEPATCH 0xff20 #define SHN_ABS 0xfff1 #define SHN_COMMON 0xfff2 #define SHN_HIRESERVE 0xffff typedef struct elf32_shdr { Elf32_Word sh_name; Elf32_Word sh_type; Elf32_Word sh_flags; Elf32_Addr sh_addr; Elf32_Off sh_offset; Elf32_Word sh_size; Elf32_Word sh_link; Elf32_Word sh_info; Elf32_Word sh_addralign; Elf32_Word sh_entsize; } Elf32_Shdr; typedef struct elf64_shdr { Elf64_Word sh_name; /* Section name, index in string tbl */ Elf64_Word sh_type; /* Type of section */ Elf64_Xword sh_flags; /* Miscellaneous section attributes */ Elf64_Addr sh_addr; /* Section virtual addr at execution */ Elf64_Off sh_offset; /* Section file offset */ Elf64_Xword sh_size; /* Size of section in bytes */ Elf64_Word sh_link; /* Index of another section */ Elf64_Word sh_info; /* Additional section information */ Elf64_Xword sh_addralign; /* Section alignment */ Elf64_Xword sh_entsize; /* Entry size if section holds table */ } Elf64_Shdr; #define EI_MAG0 0 /* e_ident[] indexes */ #define EI_MAG1 1 #define EI_MAG2 2 #define EI_MAG3 3 #define EI_CLASS 4 #define EI_DATA 5 #define EI_VERSION 6 #define EI_OSABI 7 #define EI_PAD 8 #define ELFMAG0 0x7f /* EI_MAG */ #define ELFMAG1 'E' #define ELFMAG2 'L' #define ELFMAG3 'F' #define ELFMAG "\177ELF" #define SELFMAG 4 #define ELFCLASSNONE 0 /* EI_CLASS */ #define ELFCLASS32 1 #define ELFCLASS64 2 #define ELFCLASSNUM 3 #define ELFDATANONE 0 /* e_ident[EI_DATA] */ #define ELFDATA2LSB 1 #define ELFDATA2MSB 2 #define EV_NONE 0 /* e_version, EI_VERSION */ #define EV_CURRENT 1 #define EV_NUM 2 #define ELFOSABI_NONE 0 #define ELFOSABI_LINUX 3 #ifndef ELF_OSABI #define ELF_OSABI ELFOSABI_NONE #endif /* * Notes used in ET_CORE. Architectures export some of the arch register sets * using the corresponding note types via the PTRACE_GETREGSET and * PTRACE_SETREGSET requests. */ #define NT_PRSTATUS 1 #define NT_PRFPREG 2 #define NT_PRPSINFO 3 #define NT_TASKSTRUCT 4 #define NT_AUXV 6 /* * Note to userspace developers: size of NT_SIGINFO note may increase * in the future to accomodate more fields, don't assume it is fixed! */ #define NT_SIGINFO 0x53494749 #define NT_FILE 0x46494c45 #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ #define NT_PPC_TAR 0x103 /* Target Address Register */ #define NT_PPC_PPR 0x104 /* Program Priority Register */ #define NT_PPC_DSCR 0x105 /* Data Stream Control Register */ #define NT_PPC_EBB 0x106 /* Event Based Branch Registers */ #define NT_PPC_PMU 0x107 /* Performance Monitor Registers */ #define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */ #define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */ #define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */ #define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */ #define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */ #define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */ #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ #define NT_S390_TIMER 0x301 /* s390 timer register */ #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ #define NT_S390_CTRS 0x304 /* s390 control registers */ #define NT_S390_PREFIX 0x305 /* s390 prefix register */ #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */ #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */ #define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */ #define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */ #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */ #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ #define NT_ARM_TLS 0x401 /* ARM TLS register */ #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ #define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */ #define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */ #define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */ #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ #define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */ /* Note header in a PT_NOTE section */ typedef struct elf32_note { Elf32_Word n_namesz; /* Name size */ Elf32_Word n_descsz; /* Content size */ Elf32_Word n_type; /* Content type */ } Elf32_Nhdr; /* Note header in a PT_NOTE section */ typedef struct elf64_note { Elf64_Word n_namesz; /* Name size */ Elf64_Word n_descsz; /* Content size */ Elf64_Word n_type; /* Content type */ } Elf64_Nhdr; #endif /* _LINUX_ELF_H */ linux/errno.h 0000644 00000000027 15063602047 0007203 0 ustar 00 #include <asm/errno.h> linux/erspan.h 0000644 00000002043 15063602047 0007346 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ERSPAN Tunnel Metadata * * Copyright (c) 2018 VMware * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * Userspace API for metadata mode ERSPAN tunnel */ #ifndef _ERSPAN_H #define _ERSPAN_H #include <linux/types.h> /* For __beXX in userspace */ #include <asm/byteorder.h> /* ERSPAN version 2 metadata header */ struct erspan_md2 { __be32 timestamp; __be16 sgt; /* security group tag */ #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 hwid_upper:2, ft:5, p:1; __u8 o:1, gra:2, dir:1, hwid:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 p:1, ft:5, hwid_upper:2; __u8 hwid:4, dir:1, gra:2, o:1; #else #error "Please fix <asm/byteorder.h>" #endif }; struct erspan_metadata { int version; union { __be32 index; /* Version 1 (type II)*/ struct erspan_md2 md2; /* Version 2 (type III) */ } u; }; #endif /* _ERSPAN_H */ linux/ethtool_netlink.h 0000644 00000054452 15063602047 0011273 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* * include/uapi/linux/ethtool_netlink.h - netlink interface for ethtool * * See Documentation/networking/ethtool-netlink.txt in kernel source tree for * doucumentation of the interface. */ #ifndef _LINUX_ETHTOOL_NETLINK_H_ #define _LINUX_ETHTOOL_NETLINK_H_ #include <linux/ethtool.h> /* message types - userspace to kernel */ enum { ETHTOOL_MSG_USER_NONE, ETHTOOL_MSG_STRSET_GET, ETHTOOL_MSG_LINKINFO_GET, ETHTOOL_MSG_LINKINFO_SET, ETHTOOL_MSG_LINKMODES_GET, ETHTOOL_MSG_LINKMODES_SET, ETHTOOL_MSG_LINKSTATE_GET, ETHTOOL_MSG_DEBUG_GET, ETHTOOL_MSG_DEBUG_SET, ETHTOOL_MSG_WOL_GET, ETHTOOL_MSG_WOL_SET, ETHTOOL_MSG_FEATURES_GET, ETHTOOL_MSG_FEATURES_SET, ETHTOOL_MSG_PRIVFLAGS_GET, ETHTOOL_MSG_PRIVFLAGS_SET, ETHTOOL_MSG_RINGS_GET, ETHTOOL_MSG_RINGS_SET, ETHTOOL_MSG_CHANNELS_GET, ETHTOOL_MSG_CHANNELS_SET, ETHTOOL_MSG_COALESCE_GET, ETHTOOL_MSG_COALESCE_SET, ETHTOOL_MSG_PAUSE_GET, ETHTOOL_MSG_PAUSE_SET, ETHTOOL_MSG_EEE_GET, ETHTOOL_MSG_EEE_SET, ETHTOOL_MSG_TSINFO_GET, ETHTOOL_MSG_CABLE_TEST_ACT, ETHTOOL_MSG_CABLE_TEST_TDR_ACT, ETHTOOL_MSG_TUNNEL_INFO_GET, ETHTOOL_MSG_FEC_GET, ETHTOOL_MSG_FEC_SET, ETHTOOL_MSG_MODULE_EEPROM_GET, ETHTOOL_MSG_STATS_GET, /* add new constants above here */ __ETHTOOL_MSG_USER_CNT, ETHTOOL_MSG_USER_MAX = __ETHTOOL_MSG_USER_CNT - 1 }; /* message types - kernel to userspace */ enum { ETHTOOL_MSG_KERNEL_NONE, ETHTOOL_MSG_STRSET_GET_REPLY, ETHTOOL_MSG_LINKINFO_GET_REPLY, ETHTOOL_MSG_LINKINFO_NTF, ETHTOOL_MSG_LINKMODES_GET_REPLY, ETHTOOL_MSG_LINKMODES_NTF, ETHTOOL_MSG_LINKSTATE_GET_REPLY, ETHTOOL_MSG_DEBUG_GET_REPLY, ETHTOOL_MSG_DEBUG_NTF, ETHTOOL_MSG_WOL_GET_REPLY, ETHTOOL_MSG_WOL_NTF, ETHTOOL_MSG_FEATURES_GET_REPLY, ETHTOOL_MSG_FEATURES_SET_REPLY, ETHTOOL_MSG_FEATURES_NTF, ETHTOOL_MSG_PRIVFLAGS_GET_REPLY, ETHTOOL_MSG_PRIVFLAGS_NTF, ETHTOOL_MSG_RINGS_GET_REPLY, ETHTOOL_MSG_RINGS_NTF, ETHTOOL_MSG_CHANNELS_GET_REPLY, ETHTOOL_MSG_CHANNELS_NTF, ETHTOOL_MSG_COALESCE_GET_REPLY, ETHTOOL_MSG_COALESCE_NTF, ETHTOOL_MSG_PAUSE_GET_REPLY, ETHTOOL_MSG_PAUSE_NTF, ETHTOOL_MSG_EEE_GET_REPLY, ETHTOOL_MSG_EEE_NTF, ETHTOOL_MSG_TSINFO_GET_REPLY, ETHTOOL_MSG_CABLE_TEST_NTF, ETHTOOL_MSG_CABLE_TEST_TDR_NTF, ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY, ETHTOOL_MSG_FEC_GET_REPLY, ETHTOOL_MSG_FEC_NTF, ETHTOOL_MSG_MODULE_EEPROM_GET_REPLY, ETHTOOL_MSG_STATS_GET_REPLY, /* add new constants above here */ __ETHTOOL_MSG_KERNEL_CNT, ETHTOOL_MSG_KERNEL_MAX = __ETHTOOL_MSG_KERNEL_CNT - 1 }; /* request header */ /* use compact bitsets in reply */ #define ETHTOOL_FLAG_COMPACT_BITSETS (1 << 0) /* provide optional reply for SET or ACT requests */ #define ETHTOOL_FLAG_OMIT_REPLY (1 << 1) /* request statistics, if supported by the driver */ #define ETHTOOL_FLAG_STATS (1 << 2) #define ETHTOOL_FLAG_ALL (ETHTOOL_FLAG_COMPACT_BITSETS | \ ETHTOOL_FLAG_OMIT_REPLY | \ ETHTOOL_FLAG_STATS) enum { ETHTOOL_A_HEADER_UNSPEC, ETHTOOL_A_HEADER_DEV_INDEX, /* u32 */ ETHTOOL_A_HEADER_DEV_NAME, /* string */ ETHTOOL_A_HEADER_FLAGS, /* u32 - ETHTOOL_FLAG_* */ /* add new constants above here */ __ETHTOOL_A_HEADER_CNT, ETHTOOL_A_HEADER_MAX = __ETHTOOL_A_HEADER_CNT - 1 }; /* bit sets */ enum { ETHTOOL_A_BITSET_BIT_UNSPEC, ETHTOOL_A_BITSET_BIT_INDEX, /* u32 */ ETHTOOL_A_BITSET_BIT_NAME, /* string */ ETHTOOL_A_BITSET_BIT_VALUE, /* flag */ /* add new constants above here */ __ETHTOOL_A_BITSET_BIT_CNT, ETHTOOL_A_BITSET_BIT_MAX = __ETHTOOL_A_BITSET_BIT_CNT - 1 }; enum { ETHTOOL_A_BITSET_BITS_UNSPEC, ETHTOOL_A_BITSET_BITS_BIT, /* nest - _A_BITSET_BIT_* */ /* add new constants above here */ __ETHTOOL_A_BITSET_BITS_CNT, ETHTOOL_A_BITSET_BITS_MAX = __ETHTOOL_A_BITSET_BITS_CNT - 1 }; enum { ETHTOOL_A_BITSET_UNSPEC, ETHTOOL_A_BITSET_NOMASK, /* flag */ ETHTOOL_A_BITSET_SIZE, /* u32 */ ETHTOOL_A_BITSET_BITS, /* nest - _A_BITSET_BITS_* */ ETHTOOL_A_BITSET_VALUE, /* binary */ ETHTOOL_A_BITSET_MASK, /* binary */ /* add new constants above here */ __ETHTOOL_A_BITSET_CNT, ETHTOOL_A_BITSET_MAX = __ETHTOOL_A_BITSET_CNT - 1 }; /* string sets */ enum { ETHTOOL_A_STRING_UNSPEC, ETHTOOL_A_STRING_INDEX, /* u32 */ ETHTOOL_A_STRING_VALUE, /* string */ /* add new constants above here */ __ETHTOOL_A_STRING_CNT, ETHTOOL_A_STRING_MAX = __ETHTOOL_A_STRING_CNT - 1 }; enum { ETHTOOL_A_STRINGS_UNSPEC, ETHTOOL_A_STRINGS_STRING, /* nest - _A_STRINGS_* */ /* add new constants above here */ __ETHTOOL_A_STRINGS_CNT, ETHTOOL_A_STRINGS_MAX = __ETHTOOL_A_STRINGS_CNT - 1 }; enum { ETHTOOL_A_STRINGSET_UNSPEC, ETHTOOL_A_STRINGSET_ID, /* u32 */ ETHTOOL_A_STRINGSET_COUNT, /* u32 */ ETHTOOL_A_STRINGSET_STRINGS, /* nest - _A_STRINGS_* */ /* add new constants above here */ __ETHTOOL_A_STRINGSET_CNT, ETHTOOL_A_STRINGSET_MAX = __ETHTOOL_A_STRINGSET_CNT - 1 }; enum { ETHTOOL_A_STRINGSETS_UNSPEC, ETHTOOL_A_STRINGSETS_STRINGSET, /* nest - _A_STRINGSET_* */ /* add new constants above here */ __ETHTOOL_A_STRINGSETS_CNT, ETHTOOL_A_STRINGSETS_MAX = __ETHTOOL_A_STRINGSETS_CNT - 1 }; /* STRSET */ enum { ETHTOOL_A_STRSET_UNSPEC, ETHTOOL_A_STRSET_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_STRSET_STRINGSETS, /* nest - _A_STRINGSETS_* */ ETHTOOL_A_STRSET_COUNTS_ONLY, /* flag */ /* add new constants above here */ __ETHTOOL_A_STRSET_CNT, ETHTOOL_A_STRSET_MAX = __ETHTOOL_A_STRSET_CNT - 1 }; /* LINKINFO */ enum { ETHTOOL_A_LINKINFO_UNSPEC, ETHTOOL_A_LINKINFO_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_LINKINFO_PORT, /* u8 */ ETHTOOL_A_LINKINFO_PHYADDR, /* u8 */ ETHTOOL_A_LINKINFO_TP_MDIX, /* u8 */ ETHTOOL_A_LINKINFO_TP_MDIX_CTRL, /* u8 */ ETHTOOL_A_LINKINFO_TRANSCEIVER, /* u8 */ /* add new constants above here */ __ETHTOOL_A_LINKINFO_CNT, ETHTOOL_A_LINKINFO_MAX = __ETHTOOL_A_LINKINFO_CNT - 1 }; /* LINKMODES */ enum { ETHTOOL_A_LINKMODES_UNSPEC, ETHTOOL_A_LINKMODES_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_LINKMODES_AUTONEG, /* u8 */ ETHTOOL_A_LINKMODES_OURS, /* bitset */ ETHTOOL_A_LINKMODES_PEER, /* bitset */ ETHTOOL_A_LINKMODES_SPEED, /* u32 */ ETHTOOL_A_LINKMODES_DUPLEX, /* u8 */ ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG, /* u8 */ ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE, /* u8 */ ETHTOOL_A_LINKMODES_LANES, /* u32 */ /* add new constants above here */ __ETHTOOL_A_LINKMODES_CNT, ETHTOOL_A_LINKMODES_MAX = __ETHTOOL_A_LINKMODES_CNT - 1 }; /* LINKSTATE */ enum { ETHTOOL_A_LINKSTATE_UNSPEC, ETHTOOL_A_LINKSTATE_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_LINKSTATE_LINK, /* u8 */ ETHTOOL_A_LINKSTATE_SQI, /* u32 */ ETHTOOL_A_LINKSTATE_SQI_MAX, /* u32 */ ETHTOOL_A_LINKSTATE_EXT_STATE, /* u8 */ ETHTOOL_A_LINKSTATE_EXT_SUBSTATE, /* u8 */ /* add new constants above here */ __ETHTOOL_A_LINKSTATE_CNT, ETHTOOL_A_LINKSTATE_MAX = __ETHTOOL_A_LINKSTATE_CNT - 1 }; /* DEBUG */ enum { ETHTOOL_A_DEBUG_UNSPEC, ETHTOOL_A_DEBUG_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_DEBUG_MSGMASK, /* bitset */ /* add new constants above here */ __ETHTOOL_A_DEBUG_CNT, ETHTOOL_A_DEBUG_MAX = __ETHTOOL_A_DEBUG_CNT - 1 }; /* WOL */ enum { ETHTOOL_A_WOL_UNSPEC, ETHTOOL_A_WOL_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_WOL_MODES, /* bitset */ ETHTOOL_A_WOL_SOPASS, /* binary */ /* add new constants above here */ __ETHTOOL_A_WOL_CNT, ETHTOOL_A_WOL_MAX = __ETHTOOL_A_WOL_CNT - 1 }; /* FEATURES */ enum { ETHTOOL_A_FEATURES_UNSPEC, ETHTOOL_A_FEATURES_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_FEATURES_HW, /* bitset */ ETHTOOL_A_FEATURES_WANTED, /* bitset */ ETHTOOL_A_FEATURES_ACTIVE, /* bitset */ ETHTOOL_A_FEATURES_NOCHANGE, /* bitset */ /* add new constants above here */ __ETHTOOL_A_FEATURES_CNT, ETHTOOL_A_FEATURES_MAX = __ETHTOOL_A_FEATURES_CNT - 1 }; /* PRIVFLAGS */ enum { ETHTOOL_A_PRIVFLAGS_UNSPEC, ETHTOOL_A_PRIVFLAGS_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_PRIVFLAGS_FLAGS, /* bitset */ /* add new constants above here */ __ETHTOOL_A_PRIVFLAGS_CNT, ETHTOOL_A_PRIVFLAGS_MAX = __ETHTOOL_A_PRIVFLAGS_CNT - 1 }; /* RINGS */ enum { ETHTOOL_TCP_DATA_SPLIT_UNKNOWN = 0, ETHTOOL_TCP_DATA_SPLIT_DISABLED, ETHTOOL_TCP_DATA_SPLIT_ENABLED, }; enum { ETHTOOL_A_RINGS_UNSPEC, ETHTOOL_A_RINGS_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_RINGS_RX_MAX, /* u32 */ ETHTOOL_A_RINGS_RX_MINI_MAX, /* u32 */ ETHTOOL_A_RINGS_RX_JUMBO_MAX, /* u32 */ ETHTOOL_A_RINGS_TX_MAX, /* u32 */ ETHTOOL_A_RINGS_RX, /* u32 */ ETHTOOL_A_RINGS_RX_MINI, /* u32 */ ETHTOOL_A_RINGS_RX_JUMBO, /* u32 */ ETHTOOL_A_RINGS_TX, /* u32 */ ETHTOOL_A_RINGS_RX_BUF_LEN, /* u32 */ ETHTOOL_A_RINGS_TCP_DATA_SPLIT, /* u8 */ /* add new constants above here */ __ETHTOOL_A_RINGS_CNT, ETHTOOL_A_RINGS_MAX = (__ETHTOOL_A_RINGS_CNT - 1) }; /* CHANNELS */ enum { ETHTOOL_A_CHANNELS_UNSPEC, ETHTOOL_A_CHANNELS_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_CHANNELS_RX_MAX, /* u32 */ ETHTOOL_A_CHANNELS_TX_MAX, /* u32 */ ETHTOOL_A_CHANNELS_OTHER_MAX, /* u32 */ ETHTOOL_A_CHANNELS_COMBINED_MAX, /* u32 */ ETHTOOL_A_CHANNELS_RX_COUNT, /* u32 */ ETHTOOL_A_CHANNELS_TX_COUNT, /* u32 */ ETHTOOL_A_CHANNELS_OTHER_COUNT, /* u32 */ ETHTOOL_A_CHANNELS_COMBINED_COUNT, /* u32 */ /* add new constants above here */ __ETHTOOL_A_CHANNELS_CNT, ETHTOOL_A_CHANNELS_MAX = (__ETHTOOL_A_CHANNELS_CNT - 1) }; /* COALESCE */ enum { ETHTOOL_A_COALESCE_UNSPEC, ETHTOOL_A_COALESCE_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_COALESCE_RX_USECS, /* u32 */ ETHTOOL_A_COALESCE_RX_MAX_FRAMES, /* u32 */ ETHTOOL_A_COALESCE_RX_USECS_IRQ, /* u32 */ ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ, /* u32 */ ETHTOOL_A_COALESCE_TX_USECS, /* u32 */ ETHTOOL_A_COALESCE_TX_MAX_FRAMES, /* u32 */ ETHTOOL_A_COALESCE_TX_USECS_IRQ, /* u32 */ ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ, /* u32 */ ETHTOOL_A_COALESCE_STATS_BLOCK_USECS, /* u32 */ ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX, /* u8 */ ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX, /* u8 */ ETHTOOL_A_COALESCE_PKT_RATE_LOW, /* u32 */ ETHTOOL_A_COALESCE_RX_USECS_LOW, /* u32 */ ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW, /* u32 */ ETHTOOL_A_COALESCE_TX_USECS_LOW, /* u32 */ ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW, /* u32 */ ETHTOOL_A_COALESCE_PKT_RATE_HIGH, /* u32 */ ETHTOOL_A_COALESCE_RX_USECS_HIGH, /* u32 */ ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH, /* u32 */ ETHTOOL_A_COALESCE_TX_USECS_HIGH, /* u32 */ ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH, /* u32 */ ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL, /* u32 */ ETHTOOL_A_COALESCE_USE_CQE_MODE_TX, /* u8 */ ETHTOOL_A_COALESCE_USE_CQE_MODE_RX, /* u8 */ /* add new constants above here */ __ETHTOOL_A_COALESCE_CNT, ETHTOOL_A_COALESCE_MAX = (__ETHTOOL_A_COALESCE_CNT - 1) }; /* PAUSE */ enum { ETHTOOL_A_PAUSE_UNSPEC, ETHTOOL_A_PAUSE_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_PAUSE_AUTONEG, /* u8 */ ETHTOOL_A_PAUSE_RX, /* u8 */ ETHTOOL_A_PAUSE_TX, /* u8 */ ETHTOOL_A_PAUSE_STATS, /* nest - _PAUSE_STAT_* */ /* add new constants above here */ __ETHTOOL_A_PAUSE_CNT, ETHTOOL_A_PAUSE_MAX = (__ETHTOOL_A_PAUSE_CNT - 1) }; enum { ETHTOOL_A_PAUSE_STAT_UNSPEC, ETHTOOL_A_PAUSE_STAT_PAD, ETHTOOL_A_PAUSE_STAT_TX_FRAMES, ETHTOOL_A_PAUSE_STAT_RX_FRAMES, /* add new constants above here */ __ETHTOOL_A_PAUSE_STAT_CNT, ETHTOOL_A_PAUSE_STAT_MAX = (__ETHTOOL_A_PAUSE_STAT_CNT - 1) }; /* EEE */ enum { ETHTOOL_A_EEE_UNSPEC, ETHTOOL_A_EEE_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_EEE_MODES_OURS, /* bitset */ ETHTOOL_A_EEE_MODES_PEER, /* bitset */ ETHTOOL_A_EEE_ACTIVE, /* u8 */ ETHTOOL_A_EEE_ENABLED, /* u8 */ ETHTOOL_A_EEE_TX_LPI_ENABLED, /* u8 */ ETHTOOL_A_EEE_TX_LPI_TIMER, /* u32 */ /* add new constants above here */ __ETHTOOL_A_EEE_CNT, ETHTOOL_A_EEE_MAX = (__ETHTOOL_A_EEE_CNT - 1) }; /* TSINFO */ enum { ETHTOOL_A_TSINFO_UNSPEC, ETHTOOL_A_TSINFO_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_TSINFO_TIMESTAMPING, /* bitset */ ETHTOOL_A_TSINFO_TX_TYPES, /* bitset */ ETHTOOL_A_TSINFO_RX_FILTERS, /* bitset */ ETHTOOL_A_TSINFO_PHC_INDEX, /* u32 */ /* add new constants above here */ __ETHTOOL_A_TSINFO_CNT, ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1) }; /* CABLE TEST */ enum { ETHTOOL_A_CABLE_TEST_UNSPEC, ETHTOOL_A_CABLE_TEST_HEADER, /* nest - _A_HEADER_* */ /* add new constants above here */ __ETHTOOL_A_CABLE_TEST_CNT, ETHTOOL_A_CABLE_TEST_MAX = __ETHTOOL_A_CABLE_TEST_CNT - 1 }; /* CABLE TEST NOTIFY */ enum { ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC, ETHTOOL_A_CABLE_RESULT_CODE_OK, ETHTOOL_A_CABLE_RESULT_CODE_OPEN, ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT, ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT, }; enum { ETHTOOL_A_CABLE_PAIR_A, ETHTOOL_A_CABLE_PAIR_B, ETHTOOL_A_CABLE_PAIR_C, ETHTOOL_A_CABLE_PAIR_D, }; enum { ETHTOOL_A_CABLE_RESULT_UNSPEC, ETHTOOL_A_CABLE_RESULT_PAIR, /* u8 ETHTOOL_A_CABLE_PAIR_ */ ETHTOOL_A_CABLE_RESULT_CODE, /* u8 ETHTOOL_A_CABLE_RESULT_CODE_ */ __ETHTOOL_A_CABLE_RESULT_CNT, ETHTOOL_A_CABLE_RESULT_MAX = (__ETHTOOL_A_CABLE_RESULT_CNT - 1) }; enum { ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC, ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR, /* u8 ETHTOOL_A_CABLE_PAIR_ */ ETHTOOL_A_CABLE_FAULT_LENGTH_CM, /* u32 */ __ETHTOOL_A_CABLE_FAULT_LENGTH_CNT, ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = (__ETHTOOL_A_CABLE_FAULT_LENGTH_CNT - 1) }; enum { ETHTOOL_A_CABLE_TEST_NTF_STATUS_UNSPEC, ETHTOOL_A_CABLE_TEST_NTF_STATUS_STARTED, ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED }; enum { ETHTOOL_A_CABLE_NEST_UNSPEC, ETHTOOL_A_CABLE_NEST_RESULT, /* nest - ETHTOOL_A_CABLE_RESULT_ */ ETHTOOL_A_CABLE_NEST_FAULT_LENGTH, /* nest - ETHTOOL_A_CABLE_FAULT_LENGTH_ */ __ETHTOOL_A_CABLE_NEST_CNT, ETHTOOL_A_CABLE_NEST_MAX = (__ETHTOOL_A_CABLE_NEST_CNT - 1) }; enum { ETHTOOL_A_CABLE_TEST_NTF_UNSPEC, ETHTOOL_A_CABLE_TEST_NTF_HEADER, /* nest - ETHTOOL_A_HEADER_* */ ETHTOOL_A_CABLE_TEST_NTF_STATUS, /* u8 - _STARTED/_COMPLETE */ ETHTOOL_A_CABLE_TEST_NTF_NEST, /* nest - of results: */ __ETHTOOL_A_CABLE_TEST_NTF_CNT, ETHTOOL_A_CABLE_TEST_NTF_MAX = (__ETHTOOL_A_CABLE_TEST_NTF_CNT - 1) }; /* CABLE TEST TDR */ enum { ETHTOOL_A_CABLE_TEST_TDR_CFG_UNSPEC, ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST, /* u32 */ ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST, /* u32 */ ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP, /* u32 */ ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR, /* u8 */ /* add new constants above here */ __ETHTOOL_A_CABLE_TEST_TDR_CFG_CNT, ETHTOOL_A_CABLE_TEST_TDR_CFG_MAX = __ETHTOOL_A_CABLE_TEST_TDR_CFG_CNT - 1 }; enum { ETHTOOL_A_CABLE_TEST_TDR_UNSPEC, ETHTOOL_A_CABLE_TEST_TDR_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_CABLE_TEST_TDR_CFG, /* nest - *_TDR_CFG_* */ /* add new constants above here */ __ETHTOOL_A_CABLE_TEST_TDR_CNT, ETHTOOL_A_CABLE_TEST_TDR_MAX = __ETHTOOL_A_CABLE_TEST_TDR_CNT - 1 }; /* CABLE TEST TDR NOTIFY */ enum { ETHTOOL_A_CABLE_AMPLITUDE_UNSPEC, ETHTOOL_A_CABLE_AMPLITUDE_PAIR, /* u8 */ ETHTOOL_A_CABLE_AMPLITUDE_mV, /* s16 */ __ETHTOOL_A_CABLE_AMPLITUDE_CNT, ETHTOOL_A_CABLE_AMPLITUDE_MAX = (__ETHTOOL_A_CABLE_AMPLITUDE_CNT - 1) }; enum { ETHTOOL_A_CABLE_PULSE_UNSPEC, ETHTOOL_A_CABLE_PULSE_mV, /* s16 */ __ETHTOOL_A_CABLE_PULSE_CNT, ETHTOOL_A_CABLE_PULSE_MAX = (__ETHTOOL_A_CABLE_PULSE_CNT - 1) }; enum { ETHTOOL_A_CABLE_STEP_UNSPEC, ETHTOOL_A_CABLE_STEP_FIRST_DISTANCE, /* u32 */ ETHTOOL_A_CABLE_STEP_LAST_DISTANCE, /* u32 */ ETHTOOL_A_CABLE_STEP_STEP_DISTANCE, /* u32 */ __ETHTOOL_A_CABLE_STEP_CNT, ETHTOOL_A_CABLE_STEP_MAX = (__ETHTOOL_A_CABLE_STEP_CNT - 1) }; enum { ETHTOOL_A_CABLE_TDR_NEST_UNSPEC, ETHTOOL_A_CABLE_TDR_NEST_STEP, /* nest - ETHTTOOL_A_CABLE_STEP */ ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE, /* nest - ETHTOOL_A_CABLE_AMPLITUDE */ ETHTOOL_A_CABLE_TDR_NEST_PULSE, /* nest - ETHTOOL_A_CABLE_PULSE */ __ETHTOOL_A_CABLE_TDR_NEST_CNT, ETHTOOL_A_CABLE_TDR_NEST_MAX = (__ETHTOOL_A_CABLE_TDR_NEST_CNT - 1) }; enum { ETHTOOL_A_CABLE_TEST_TDR_NTF_UNSPEC, ETHTOOL_A_CABLE_TEST_TDR_NTF_HEADER, /* nest - ETHTOOL_A_HEADER_* */ ETHTOOL_A_CABLE_TEST_TDR_NTF_STATUS, /* u8 - _STARTED/_COMPLETE */ ETHTOOL_A_CABLE_TEST_TDR_NTF_NEST, /* nest - of results: */ /* add new constants above here */ __ETHTOOL_A_CABLE_TEST_TDR_NTF_CNT, ETHTOOL_A_CABLE_TEST_TDR_NTF_MAX = __ETHTOOL_A_CABLE_TEST_TDR_NTF_CNT - 1 }; /* TUNNEL INFO */ enum { ETHTOOL_UDP_TUNNEL_TYPE_VXLAN, ETHTOOL_UDP_TUNNEL_TYPE_GENEVE, ETHTOOL_UDP_TUNNEL_TYPE_VXLAN_GPE, __ETHTOOL_UDP_TUNNEL_TYPE_CNT }; enum { ETHTOOL_A_TUNNEL_UDP_ENTRY_UNSPEC, ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT, /* be16 */ ETHTOOL_A_TUNNEL_UDP_ENTRY_TYPE, /* u32 */ /* add new constants above here */ __ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT, ETHTOOL_A_TUNNEL_UDP_ENTRY_MAX = (__ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT - 1) }; enum { ETHTOOL_A_TUNNEL_UDP_TABLE_UNSPEC, ETHTOOL_A_TUNNEL_UDP_TABLE_SIZE, /* u32 */ ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES, /* bitset */ ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY, /* nest - _UDP_ENTRY_* */ /* add new constants above here */ __ETHTOOL_A_TUNNEL_UDP_TABLE_CNT, ETHTOOL_A_TUNNEL_UDP_TABLE_MAX = (__ETHTOOL_A_TUNNEL_UDP_TABLE_CNT - 1) }; enum { ETHTOOL_A_TUNNEL_UDP_UNSPEC, ETHTOOL_A_TUNNEL_UDP_TABLE, /* nest - _UDP_TABLE_* */ /* add new constants above here */ __ETHTOOL_A_TUNNEL_UDP_CNT, ETHTOOL_A_TUNNEL_UDP_MAX = (__ETHTOOL_A_TUNNEL_UDP_CNT - 1) }; enum { ETHTOOL_A_TUNNEL_INFO_UNSPEC, ETHTOOL_A_TUNNEL_INFO_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_TUNNEL_INFO_UDP_PORTS, /* nest - _UDP_TABLE */ /* add new constants above here */ __ETHTOOL_A_TUNNEL_INFO_CNT, ETHTOOL_A_TUNNEL_INFO_MAX = (__ETHTOOL_A_TUNNEL_INFO_CNT - 1) }; /* FEC */ enum { ETHTOOL_A_FEC_UNSPEC, ETHTOOL_A_FEC_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_FEC_MODES, /* bitset */ ETHTOOL_A_FEC_AUTO, /* u8 */ ETHTOOL_A_FEC_ACTIVE, /* u32 */ ETHTOOL_A_FEC_STATS, /* nest - _A_FEC_STAT */ __ETHTOOL_A_FEC_CNT, ETHTOOL_A_FEC_MAX = (__ETHTOOL_A_FEC_CNT - 1) }; enum { ETHTOOL_A_FEC_STAT_UNSPEC, ETHTOOL_A_FEC_STAT_PAD, ETHTOOL_A_FEC_STAT_CORRECTED, /* array, u64 */ ETHTOOL_A_FEC_STAT_UNCORR, /* array, u64 */ ETHTOOL_A_FEC_STAT_CORR_BITS, /* array, u64 */ /* add new constants above here */ __ETHTOOL_A_FEC_STAT_CNT, ETHTOOL_A_FEC_STAT_MAX = (__ETHTOOL_A_FEC_STAT_CNT - 1) }; /* MODULE EEPROM */ enum { ETHTOOL_A_MODULE_EEPROM_UNSPEC, ETHTOOL_A_MODULE_EEPROM_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_MODULE_EEPROM_OFFSET, /* u32 */ ETHTOOL_A_MODULE_EEPROM_LENGTH, /* u32 */ ETHTOOL_A_MODULE_EEPROM_PAGE, /* u8 */ ETHTOOL_A_MODULE_EEPROM_BANK, /* u8 */ ETHTOOL_A_MODULE_EEPROM_I2C_ADDRESS, /* u8 */ ETHTOOL_A_MODULE_EEPROM_DATA, /* binary */ __ETHTOOL_A_MODULE_EEPROM_CNT, ETHTOOL_A_MODULE_EEPROM_MAX = (__ETHTOOL_A_MODULE_EEPROM_CNT - 1) }; /* STATS */ enum { ETHTOOL_A_STATS_UNSPEC, ETHTOOL_A_STATS_PAD, ETHTOOL_A_STATS_HEADER, /* nest - _A_HEADER_* */ ETHTOOL_A_STATS_GROUPS, /* bitset */ ETHTOOL_A_STATS_GRP, /* nest - _A_STATS_GRP_* */ /* add new constants above here */ __ETHTOOL_A_STATS_CNT, ETHTOOL_A_STATS_MAX = (__ETHTOOL_A_STATS_CNT - 1) }; enum { ETHTOOL_STATS_ETH_PHY, ETHTOOL_STATS_ETH_MAC, ETHTOOL_STATS_ETH_CTRL, ETHTOOL_STATS_RMON, /* add new constants above here */ __ETHTOOL_STATS_CNT }; enum { ETHTOOL_A_STATS_GRP_UNSPEC, ETHTOOL_A_STATS_GRP_PAD, ETHTOOL_A_STATS_GRP_ID, /* u32 */ ETHTOOL_A_STATS_GRP_SS_ID, /* u32 */ ETHTOOL_A_STATS_GRP_STAT, /* nest */ ETHTOOL_A_STATS_GRP_HIST_RX, /* nest */ ETHTOOL_A_STATS_GRP_HIST_TX, /* nest */ ETHTOOL_A_STATS_GRP_HIST_BKT_LOW, /* u32 */ ETHTOOL_A_STATS_GRP_HIST_BKT_HI, /* u32 */ ETHTOOL_A_STATS_GRP_HIST_VAL, /* u64 */ /* add new constants above here */ __ETHTOOL_A_STATS_GRP_CNT, ETHTOOL_A_STATS_GRP_MAX = (__ETHTOOL_A_STATS_CNT - 1) }; enum { /* 30.3.2.1.5 aSymbolErrorDuringCarrier */ ETHTOOL_A_STATS_ETH_PHY_5_SYM_ERR, /* add new constants above here */ __ETHTOOL_A_STATS_ETH_PHY_CNT, ETHTOOL_A_STATS_ETH_PHY_MAX = (__ETHTOOL_A_STATS_ETH_PHY_CNT - 1) }; enum { /* 30.3.1.1.2 aFramesTransmittedOK */ ETHTOOL_A_STATS_ETH_MAC_2_TX_PKT, /* 30.3.1.1.3 aSingleCollisionFrames */ ETHTOOL_A_STATS_ETH_MAC_3_SINGLE_COL, /* 30.3.1.1.4 aMultipleCollisionFrames */ ETHTOOL_A_STATS_ETH_MAC_4_MULTI_COL, /* 30.3.1.1.5 aFramesReceivedOK */ ETHTOOL_A_STATS_ETH_MAC_5_RX_PKT, /* 30.3.1.1.6 aFrameCheckSequenceErrors */ ETHTOOL_A_STATS_ETH_MAC_6_FCS_ERR, /* 30.3.1.1.7 aAlignmentErrors */ ETHTOOL_A_STATS_ETH_MAC_7_ALIGN_ERR, /* 30.3.1.1.8 aOctetsTransmittedOK */ ETHTOOL_A_STATS_ETH_MAC_8_TX_BYTES, /* 30.3.1.1.9 aFramesWithDeferredXmissions */ ETHTOOL_A_STATS_ETH_MAC_9_TX_DEFER, /* 30.3.1.1.10 aLateCollisions */ ETHTOOL_A_STATS_ETH_MAC_10_LATE_COL, /* 30.3.1.1.11 aFramesAbortedDueToXSColls */ ETHTOOL_A_STATS_ETH_MAC_11_XS_COL, /* 30.3.1.1.12 aFramesLostDueToIntMACXmitError */ ETHTOOL_A_STATS_ETH_MAC_12_TX_INT_ERR, /* 30.3.1.1.13 aCarrierSenseErrors */ ETHTOOL_A_STATS_ETH_MAC_13_CS_ERR, /* 30.3.1.1.14 aOctetsReceivedOK */ ETHTOOL_A_STATS_ETH_MAC_14_RX_BYTES, /* 30.3.1.1.15 aFramesLostDueToIntMACRcvError */ ETHTOOL_A_STATS_ETH_MAC_15_RX_INT_ERR, /* 30.3.1.1.18 aMulticastFramesXmittedOK */ ETHTOOL_A_STATS_ETH_MAC_18_TX_MCAST, /* 30.3.1.1.19 aBroadcastFramesXmittedOK */ ETHTOOL_A_STATS_ETH_MAC_19_TX_BCAST, /* 30.3.1.1.20 aFramesWithExcessiveDeferral */ ETHTOOL_A_STATS_ETH_MAC_20_XS_DEFER, /* 30.3.1.1.21 aMulticastFramesReceivedOK */ ETHTOOL_A_STATS_ETH_MAC_21_RX_MCAST, /* 30.3.1.1.22 aBroadcastFramesReceivedOK */ ETHTOOL_A_STATS_ETH_MAC_22_RX_BCAST, /* 30.3.1.1.23 aInRangeLengthErrors */ ETHTOOL_A_STATS_ETH_MAC_23_IR_LEN_ERR, /* 30.3.1.1.24 aOutOfRangeLengthField */ ETHTOOL_A_STATS_ETH_MAC_24_OOR_LEN, /* 30.3.1.1.25 aFrameTooLongErrors */ ETHTOOL_A_STATS_ETH_MAC_25_TOO_LONG_ERR, /* add new constants above here */ __ETHTOOL_A_STATS_ETH_MAC_CNT, ETHTOOL_A_STATS_ETH_MAC_MAX = (__ETHTOOL_A_STATS_ETH_MAC_CNT - 1) }; enum { /* 30.3.3.3 aMACControlFramesTransmitted */ ETHTOOL_A_STATS_ETH_CTRL_3_TX, /* 30.3.3.4 aMACControlFramesReceived */ ETHTOOL_A_STATS_ETH_CTRL_4_RX, /* 30.3.3.5 aUnsupportedOpcodesReceived */ ETHTOOL_A_STATS_ETH_CTRL_5_RX_UNSUP, /* add new constants above here */ __ETHTOOL_A_STATS_ETH_CTRL_CNT, ETHTOOL_A_STATS_ETH_CTRL_MAX = (__ETHTOOL_A_STATS_ETH_CTRL_CNT - 1) }; enum { /* etherStatsUndersizePkts */ ETHTOOL_A_STATS_RMON_UNDERSIZE, /* etherStatsOversizePkts */ ETHTOOL_A_STATS_RMON_OVERSIZE, /* etherStatsFragments */ ETHTOOL_A_STATS_RMON_FRAG, /* etherStatsJabbers */ ETHTOOL_A_STATS_RMON_JABBER, /* add new constants above here */ __ETHTOOL_A_STATS_RMON_CNT, ETHTOOL_A_STATS_RMON_MAX = (__ETHTOOL_A_STATS_RMON_CNT - 1) }; /* generic netlink info */ #define ETHTOOL_GENL_NAME "ethtool" #define ETHTOOL_GENL_VERSION 1 #define ETHTOOL_MCGRP_MONITOR_NAME "monitor" #endif /* _LINUX_ETHTOOL_NETLINK_H_ */ linux/falloc.h 0000644 00000007000 15063602047 0007314 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _FALLOC_H_ #define _FALLOC_H_ #define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ #define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ #define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */ /* * FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file * without leaving a hole in the file. The contents of the file beyond * the range being removed is appended to the start offset of the range * being removed (i.e. the hole that was punched is "collapsed"), * resulting in a file layout that looks like the range that was * removed never existed. As such collapsing a range of a file changes * the size of the file, reducing it by the same length of the range * that has been removed by the operation. * * Different filesystems may implement different limitations on the * granularity of the operation. Most will limit operations to * filesystem block size boundaries, but this boundary may be larger or * smaller depending on the filesystem and/or the configuration of the * filesystem or file. * * Attempting to collapse a range that crosses the end of the file is * considered an illegal operation - just use ftruncate(2) if you need * to collapse a range that crosses EOF. */ #define FALLOC_FL_COLLAPSE_RANGE 0x08 /* * FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably * without issuing data IO. Blocks should be preallocated for the regions that * span holes in the file, and the entire range is preferable converted to * unwritten extents - even though file system may choose to zero out the * extent or do whatever which will result in reading zeros from the range * while the range remains allocated for the file. * * This can be also used to preallocate blocks past EOF in the same way as * with fallocate. Flag FALLOC_FL_KEEP_SIZE should cause the inode * size to remain the same. */ #define FALLOC_FL_ZERO_RANGE 0x10 /* * FALLOC_FL_INSERT_RANGE is use to insert space within the file size without * overwriting any existing data. The contents of the file beyond offset are * shifted towards right by len bytes to create a hole. As such, this * operation will increase the size of the file by len bytes. * * Different filesystems may implement different limitations on the granularity * of the operation. Most will limit operations to filesystem block size * boundaries, but this boundary may be larger or smaller depending on * the filesystem and/or the configuration of the filesystem or file. * * Attempting to insert space using this flag at OR beyond the end of * the file is considered an illegal operation - just use ftruncate(2) or * fallocate(2) with mode 0 for such type of operations. */ #define FALLOC_FL_INSERT_RANGE 0x20 /* * FALLOC_FL_UNSHARE_RANGE is used to unshare shared blocks within the * file size without overwriting any existing data. The purpose of this * call is to preemptively reallocate any blocks that are subject to * copy-on-write. * * Different filesystems may implement different limitations on the * granularity of the operation. Most will limit operations to filesystem * block size boundaries, but this boundary may be larger or smaller * depending on the filesystem and/or the configuration of the filesystem * or file. * * This flag can only be used with allocate-mode fallocate, which is * to say that it cannot be used with the punch, zero, collapse, or * insert range modes. */ #define FALLOC_FL_UNSHARE_RANGE 0x40 #endif /* _FALLOC_H_ */ linux/fb.h 0000644 00000040135 15063602047 0006451 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FB_H #define _LINUX_FB_H #include <linux/types.h> #include <linux/i2c.h> /* Definitions of frame buffers */ #define FB_MAX 32 /* sufficient for now */ /* ioctls 0x46 is 'F' */ #define FBIOGET_VSCREENINFO 0x4600 #define FBIOPUT_VSCREENINFO 0x4601 #define FBIOGET_FSCREENINFO 0x4602 #define FBIOGETCMAP 0x4604 #define FBIOPUTCMAP 0x4605 #define FBIOPAN_DISPLAY 0x4606 #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor) /* 0x4607-0x460B are defined below */ /* #define FBIOGET_MONITORSPEC 0x460C */ /* #define FBIOPUT_MONITORSPEC 0x460D */ /* #define FBIOSWITCH_MONIBIT 0x460E */ #define FBIOGET_CON2FBMAP 0x460F #define FBIOPUT_CON2FBMAP 0x4610 #define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */ #define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank) #define FBIO_ALLOC 0x4613 #define FBIO_FREE 0x4614 #define FBIOGET_GLYPH 0x4615 #define FBIOGET_HWCINFO 0x4616 #define FBIOPUT_MODEINFO 0x4617 #define FBIOGET_DISPINFO 0x4618 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ #define FB_TYPE_TEXT 3 /* Text/attributes */ #define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ #define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */ #define FB_AUX_TEXT_MDA 0 /* Monochrome text */ #define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ #define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */ #define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */ #define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */ #define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */ #define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */ #define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */ #define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */ #define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */ #define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */ #define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */ #define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */ #define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */ #define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */ #define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ #define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ #define FB_VISUAL_TRUECOLOR 2 /* True color */ #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ #define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */ #define FB_ACCEL_NONE 0 /* no hardware accelerator */ #define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ #define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */ #define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */ #define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */ #define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */ #define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */ #define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */ #define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */ #define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */ #define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */ #define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */ #define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */ #define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */ #define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */ #define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */ #define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */ #define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */ #define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */ #define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */ #define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */ #define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */ #define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */ #define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */ #define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */ #define FB_ACCEL_SUN_TCX 25 /* Sun tcx */ #define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ #define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */ #define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */ #define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */ #define FB_ACCEL_CT_6555x 30 /* C&T 6555x */ #define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */ #define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */ #define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */ #define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */ #define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */ #define FB_ACCEL_SIS_GLAMOUR 36 /* SiS 300/630/540 */ #define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */ #define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */ #define FB_ACCEL_I810 39 /* Intel 810/815 */ #define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */ #define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */ #define FB_ACCEL_I830 42 /* Intel 830M/845G/85x/865G */ #define FB_ACCEL_NV_10 43 /* nVidia Arch 10 */ #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ #define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */ #define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */ #define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */ #define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ #define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ #define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */ #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ #define FB_ACCEL_NEOMAGIC_NM2097 93 /* NeoMagic NM2097 */ #define FB_ACCEL_NEOMAGIC_NM2160 94 /* NeoMagic NM2160 */ #define FB_ACCEL_NEOMAGIC_NM2200 95 /* NeoMagic NM2200 */ #define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */ #define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */ #define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */ #define FB_ACCEL_PXA3XX 99 /* PXA3xx */ #define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */ #define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */ #define FB_ACCEL_SAVAGE3D_MV 0x82 /* S3 Savage3D-MV */ #define FB_ACCEL_SAVAGE2000 0x83 /* S3 Savage2000 */ #define FB_ACCEL_SAVAGE_MX_MV 0x84 /* S3 Savage/MX-MV */ #define FB_ACCEL_SAVAGE_MX 0x85 /* S3 Savage/MX */ #define FB_ACCEL_SAVAGE_IX_MV 0x86 /* S3 Savage/IX-MV */ #define FB_ACCEL_SAVAGE_IX 0x87 /* S3 Savage/IX */ #define FB_ACCEL_PROSAVAGE_PM 0x88 /* S3 ProSavage PM133 */ #define FB_ACCEL_PROSAVAGE_KM 0x89 /* S3 ProSavage KM133 */ #define FB_ACCEL_S3TWISTER_P 0x8a /* S3 Twister */ #define FB_ACCEL_S3TWISTER_K 0x8b /* S3 TwisterK */ #define FB_ACCEL_SUPERSAVAGE 0x8c /* S3 Supersavage */ #define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */ #define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */ #define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */ #define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */ struct fb_fix_screeninfo { char id[16]; /* identification string eg "TT Builtin" */ unsigned long smem_start; /* Start of frame buffer mem */ /* (physical address) */ __u32 smem_len; /* Length of frame buffer mem */ __u32 type; /* see FB_TYPE_* */ __u32 type_aux; /* Interleave for interleaved Planes */ __u32 visual; /* see FB_VISUAL_* */ __u16 xpanstep; /* zero if no hardware panning */ __u16 ypanstep; /* zero if no hardware panning */ __u16 ywrapstep; /* zero if no hardware ywrap */ __u32 line_length; /* length of a line in bytes */ unsigned long mmio_start; /* Start of Memory Mapped I/O */ /* (physical address) */ __u32 mmio_len; /* Length of Memory Mapped I/O */ __u32 accel; /* Indicate to driver which */ /* specific chip/card we have */ __u16 capabilities; /* see FB_CAP_* */ __u16 reserved[2]; /* Reserved for future compatibility */ }; /* Interpretation of offset for color fields: All offsets are from the right, * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you * can use the offset as right argument to <<). A pixel afterwards is a bit * stream and is written to video memory as that unmodified. * * For pseudocolor: offset and length should be the same for all color * components. Offset specifies the position of the least significant bit * of the pallette index in a pixel value. Length indicates the number * of available palette entries (i.e. # of entries = 1 << length). */ struct fb_bitfield { __u32 offset; /* beginning of bitfield */ __u32 length; /* length of bitfield */ __u32 msb_right; /* != 0 : Most significant bit is */ /* right */ }; #define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ #define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */ #define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/ #define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ #define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */ #define FB_ACTIVATE_MASK 15 /* values */ #define FB_ACTIVATE_VBL 16 /* activate values on next vbl */ #define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */ #define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ #define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/ #define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */ #define FB_ACTIVATE_KD_TEXT 512 /* for KDSET vt ioctl */ #define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */ #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ #define FB_SYNC_EXT 4 /* external sync */ #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ #define FB_SYNC_BROADCAST 16 /* broadcast video timings */ /* vtotal = 144d/288n/576i => PAL */ /* vtotal = 121d/242n/484i => NTSC */ #define FB_SYNC_ON_GREEN 32 /* sync on green */ #define FB_VMODE_NONINTERLACED 0 /* non interlaced */ #define FB_VMODE_INTERLACED 1 /* interlaced */ #define FB_VMODE_DOUBLE 2 /* double scan */ #define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */ #define FB_VMODE_MASK 255 #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ /* * Display rotation support */ #define FB_ROTATE_UR 0 #define FB_ROTATE_CW 1 #define FB_ROTATE_UD 2 #define FB_ROTATE_CCW 3 #define PICOS2KHZ(a) (1000000000UL/(a)) #define KHZ2PICOS(a) (1000000000UL/(a)) struct fb_var_screeninfo { __u32 xres; /* visible resolution */ __u32 yres; __u32 xres_virtual; /* virtual resolution */ __u32 yres_virtual; __u32 xoffset; /* offset from virtual to visible */ __u32 yoffset; /* resolution */ __u32 bits_per_pixel; /* guess what */ __u32 grayscale; /* 0 = color, 1 = grayscale, */ /* >1 = FOURCC */ struct fb_bitfield red; /* bitfield in fb mem if true color, */ struct fb_bitfield green; /* else only length is significant */ struct fb_bitfield blue; struct fb_bitfield transp; /* transparency */ __u32 nonstd; /* != 0 Non standard pixel format */ __u32 activate; /* see FB_ACTIVATE_* */ __u32 height; /* height of picture in mm */ __u32 width; /* width of picture in mm */ __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */ /* Timing: All values in pixclocks, except pixclock (of course) */ __u32 pixclock; /* pixel clock in ps (pico seconds) */ __u32 left_margin; /* time from sync to picture */ __u32 right_margin; /* time from picture to sync */ __u32 upper_margin; /* time from sync to picture */ __u32 lower_margin; __u32 hsync_len; /* length of horizontal sync */ __u32 vsync_len; /* length of vertical sync */ __u32 sync; /* see FB_SYNC_* */ __u32 vmode; /* see FB_VMODE_* */ __u32 rotate; /* angle we rotate counter clockwise */ __u32 colorspace; /* colorspace for FOURCC-based modes */ __u32 reserved[4]; /* Reserved for future compatibility */ }; struct fb_cmap { __u32 start; /* First entry */ __u32 len; /* Number of entries */ __u16 *red; /* Red values */ __u16 *green; __u16 *blue; __u16 *transp; /* transparency, can be NULL */ }; struct fb_con2fbmap { __u32 console; __u32 framebuffer; }; /* VESA Blanking Levels */ #define VESA_NO_BLANKING 0 #define VESA_VSYNC_SUSPEND 1 #define VESA_HSYNC_SUSPEND 2 #define VESA_POWERDOWN 3 enum { /* screen: unblanked, hsync: on, vsync: on */ FB_BLANK_UNBLANK = VESA_NO_BLANKING, /* screen: blanked, hsync: on, vsync: on */ FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, /* screen: blanked, hsync: on, vsync: off */ FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, /* screen: blanked, hsync: off, vsync: on */ FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, /* screen: blanked, hsync: off, vsync: off */ FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1 }; #define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */ #define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */ #define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */ #define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */ #define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */ #define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */ #define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */ #define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */ #define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */ struct fb_vblank { __u32 flags; /* FB_VBLANK flags */ __u32 count; /* counter of retraces since boot */ __u32 vcount; /* current scanline position */ __u32 hcount; /* current scandot position */ __u32 reserved[4]; /* reserved for future compatibility */ }; /* Internal HW accel */ #define ROP_COPY 0 #define ROP_XOR 1 struct fb_copyarea { __u32 dx; __u32 dy; __u32 width; __u32 height; __u32 sx; __u32 sy; }; struct fb_fillrect { __u32 dx; /* screen-relative */ __u32 dy; __u32 width; __u32 height; __u32 color; __u32 rop; }; struct fb_image { __u32 dx; /* Where to place image */ __u32 dy; __u32 width; /* Size of image */ __u32 height; __u32 fg_color; /* Only used when a mono bitmap */ __u32 bg_color; __u8 depth; /* Depth of the image */ const char *data; /* Pointer to image data */ struct fb_cmap cmap; /* color map info */ }; /* * hardware cursor control */ #define FB_CUR_SETIMAGE 0x01 #define FB_CUR_SETPOS 0x02 #define FB_CUR_SETHOT 0x04 #define FB_CUR_SETCMAP 0x08 #define FB_CUR_SETSHAPE 0x10 #define FB_CUR_SETSIZE 0x20 #define FB_CUR_SETALL 0xFF struct fbcurpos { __u16 x, y; }; struct fb_cursor { __u16 set; /* what to set */ __u16 enable; /* cursor on/off */ __u16 rop; /* bitop operation */ const char *mask; /* cursor mask bits */ struct fbcurpos hot; /* cursor hot spot */ struct fb_image image; /* Cursor image */ }; /* Settings for the generic backlight code */ #define FB_BACKLIGHT_LEVELS 128 #define FB_BACKLIGHT_MAX 0xFF #endif /* _LINUX_FB_H */ linux/fd.h 0000644 00000026630 15063602047 0006457 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FD_H #define _LINUX_FD_H #include <linux/ioctl.h> /* New file layout: Now the ioctl definitions immediately follow the * definitions of the structures that they use */ /* * Geometry */ struct floppy_struct { unsigned int size, /* nr of sectors total */ sect, /* sectors per track */ head, /* nr of heads */ track, /* nr of tracks */ stretch; /* bit 0 !=0 means double track steps */ /* bit 1 != 0 means swap sides */ /* bits 2..9 give the first sector */ /* number (the LSB is flipped) */ #define FD_STRETCH 1 #define FD_SWAPSIDES 2 #define FD_ZEROBASED 4 #define FD_SECTBASEMASK 0x3FC #define FD_MKSECTBASE(s) (((s) ^ 1) << 2) #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) unsigned char gap, /* gap1 size */ rate, /* data rate. |= 0x40 for perpendicular */ #define FD_2M 0x4 #define FD_SIZECODEMASK 0x38 #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \ 512 : 128 << FD_SIZECODE(floppy) ) #define FD_PERP 0x40 spec1, /* stepping rate, head unload time */ fmt_gap; /* gap2 size */ const char * name; /* used only for predefined formats */ }; /* commands needing write access have 0x40 set */ /* commands needing super user access have 0x80 set */ #define FDCLRPRM _IO(2, 0x41) /* clear user-defined parameters */ #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) #define FDSETMEDIAPRM FDSETPRM /* set user-defined parameters for current media */ #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) #define FDDEFMEDIAPRM FDDEFPRM #define FDGETMEDIAPRM FDGETPRM /* set/get disk parameters */ #define FDMSGON _IO(2,0x45) #define FDMSGOFF _IO(2,0x46) /* issue/don't issue kernel messages on media type change */ /* * Formatting (obsolete) */ #define FD_FILL_BYTE 0xF6 /* format fill byte. */ struct format_descr { unsigned int device,head,track; }; #define FDFMTBEG _IO(2,0x47) /* begin formatting a disk */ #define FDFMTTRK _IOW(2,0x48, struct format_descr) /* format the specified track */ #define FDFMTEND _IO(2,0x49) /* end formatting a disk */ /* * Error thresholds */ struct floppy_max_errors { unsigned int abort, /* number of errors to be reached before aborting */ read_track, /* maximal number of errors permitted to read an * entire track at once */ reset, /* maximal number of errors before a reset is tried */ recal, /* maximal number of errors before a recalibrate is * tried */ /* * Threshold for reporting FDC errors to the console. * Setting this to zero may flood your screen when using * ultra cheap floppies ;-) */ reporting; }; #define FDSETEMSGTRESH _IO(2,0x4a) /* set fdc error reporting threshold */ #define FDFLUSH _IO(2,0x4b) /* flush buffers for media; either for verifying media, or for * handling a media change without closing the file descriptor */ #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) /* set/get abortion and read_track threshold. See also floppy_drive_params * structure */ typedef char floppy_drive_name[16]; #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) /* get drive type: 5 1/4 or 3 1/2 */ /* * Drive parameters (user modifiable) */ struct floppy_drive_params { signed char cmos; /* CMOS type */ /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). */ unsigned long max_dtr; /* Step rate, usec */ unsigned long hlt; /* Head load/settle time, msec */ unsigned long hut; /* Head unload time (remnant of * 8" drives) */ unsigned long srt; /* Step rate, usec */ unsigned long spinup; /* time needed for spinup (expressed * in jiffies) */ unsigned long spindown; /* timeout needed for spindown */ unsigned char spindown_offset; /* decides in which position the disk * will stop */ unsigned char select_delay; /* delay to wait after select */ unsigned char rps; /* rotations per second */ unsigned char tracks; /* maximum number of tracks */ unsigned long timeout; /* timeout for interrupt requests */ unsigned char interleave_sect; /* if there are more sectors, use * interleave */ struct floppy_max_errors max_errors; char flags; /* various flags, including ftd_msg */ /* * Announce successful media type detection and media information loss after * disk changes. * Also used to enable/disable printing of overrun warnings. */ #define FTD_MSG 0x10 #define FD_BROKEN_DCL 0x20 #define FD_DEBUG 0x02 #define FD_SILENT_DCL_CLEAR 0x4 #define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware considerations */ char read_track; /* use readtrack during probing? */ /* * Auto-detection. Each drive type has eight formats which are * used in succession to try to read the disk. If the FDC cannot lock onto * the disk, the next format is tried. This uses the variable 'probing'. */ short autodetect[8]; /* autodetected formats */ int checkfreq; /* how often should the drive be checked for disk * changes */ int native_format; /* native format of this drive */ }; enum { FD_NEED_TWADDLE_BIT, /* more magic */ FD_VERIFY_BIT, /* inquire for write protection */ FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet * to clear media change status */ FD_UNUSED_BIT, FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */ FD_DISK_WRITABLE_BIT, /* disk is writable */ FD_OPEN_SHOULD_FAIL_BIT }; #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) /* set/get drive parameters */ /* * Current drive state (not directly modifiable by user, readonly) */ struct floppy_drive_struct { unsigned long flags; /* values for these flags */ #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) #define FD_VERIFY (1 << FD_VERIFY_BIT) #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) unsigned long spinup_date; unsigned long select_date; unsigned long first_read_date; short probed_format; short track; /* current track */ short maxblock; /* id of highest block read */ short maxtrack; /* id of highest half track read */ int generation; /* how many diskchanges? */ /* * (User-provided) media information is _not_ discarded after a media change * if the corresponding keep_data flag is non-zero. Positive values are * decremented after each probe. */ int keep_data; /* Prevent "aliased" accesses. */ int fd_ref; int fd_device; unsigned long last_checked; /* when was the drive last checked for a disk * change? */ char *dmabuf; int bufblocks; }; #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) /* get drive state: GET returns the cached state, POLL polls for new state */ /* * reset FDC */ enum reset_mode { FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */ FD_RESET_IF_RAWCMD, /* obsolete */ FD_RESET_ALWAYS /* reset always */ }; #define FDRESET _IO(2, 0x54) /* * FDC state */ struct floppy_fdc_state { int spec1; /* spec1 value last used */ int spec2; /* spec2 value last used */ int dtr; unsigned char version; /* FDC version code */ unsigned char dor; unsigned long address; /* io address */ unsigned int rawcmd:2; unsigned int reset:1; unsigned int need_configure:1; unsigned int perp_mode:2; unsigned int has_fifo:1; unsigned int driver_version; /* version code for floppy driver */ #define FD_DRIVER_VERSION 0x100 /* user programs using the floppy API should use floppy_fdc_state to * get the version number of the floppy driver that they are running * on. If this version number is bigger than the one compiled into the * user program (the FD_DRIVER_VERSION define), it should be prepared * to bigger structures */ unsigned char track[4]; /* Position of the heads of the 4 units attached to this FDC, * as stored on the FDC. In the future, the position as stored * on the FDC might not agree with the actual physical * position of these drive heads. By allowing such * disagreement, it will be possible to reset the FDC without * incurring the expensive cost of repositioning all heads. * Right now, these positions are hard wired to 0. */ }; #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) /* * Asynchronous Write error tracking */ struct floppy_write_errors { /* Write error logging. * * These fields can be cleared with the FDWERRORCLR ioctl. * Only writes that were attempted but failed due to a physical media * error are logged. write(2) calls that fail and return an error code * to the user process are not counted. */ unsigned int write_errors; /* number of physical write errors * encountered */ /* position of first and last write errors */ unsigned long first_error_sector; int first_error_generation; unsigned long last_error_sector; int last_error_generation; unsigned int badness; /* highest retry count for a read or write * operation */ }; #define FDWERRORCLR _IO(2, 0x56) /* clear write error and badness information */ #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) /* get write error and badness information */ /* * Raw commands */ /* new interface flag: now we can do them in batches */ #define FDHAVEBATCHEDRAWCMD struct floppy_raw_cmd { unsigned int flags; #define FD_RAW_READ 1 #define FD_RAW_WRITE 2 #define FD_RAW_NO_MOTOR 4 #define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */ #define FD_RAW_INTR 8 /* wait for an interrupt */ #define FD_RAW_SPIN 0x10 /* spin up the disk for this command */ #define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command * completion */ #define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */ #define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */ /* more "in" flags */ #define FD_RAW_MORE 0x100 /* more records follow */ #define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */ #define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */ #define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure * detection too */ /* more "out" flags */ #define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */ #define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */ void *data; char *kernel_data; /* location of data buffer in the kernel */ struct floppy_raw_cmd *next; /* used for chaining of raw cmd's * within the kernel */ long length; /* in: length of dma transfer. out: remaining bytes */ long phys_length; /* physical length, if different from dma length */ int buffer_length; /* length of allocated buffer */ unsigned char rate; unsigned char cmd_count; unsigned char cmd[16]; unsigned char reply_count; unsigned char reply[16]; int track; int resultcode; int reserved1; int reserved2; }; #define FDRAWCMD _IO(2, 0x58) /* send a raw command to the fdc. Structure size not included, because of * batches */ #define FDTWADDLE _IO(2, 0x59) /* flicker motor-on bit before reading a sector. Experimental */ #define FDEJECT _IO(2, 0x5a) /* eject the disk */ #endif /* _LINUX_FD_H */ linux/fdreg.h 0000644 00000012454 15063602047 0007154 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FDREG_H #define _LINUX_FDREG_H /* * This file contains some defines for the floppy disk controller. * Various sources. Mostly "IBM Microcomputers: A Programmers * Handbook", Sanches and Canton. */ #ifdef FDPATCHES #define FD_IOPORT fdc_state[fdc].address #else /* It would be a lot saner just to force fdc_state[fdc].address to always be set ! FIXME */ #define FD_IOPORT 0x3f0 #endif /* Fd controller regs. S&C, about page 340 */ #define FD_STATUS (4 + FD_IOPORT ) #define FD_DATA (5 + FD_IOPORT ) /* Digital Output Register */ #define FD_DOR (2 + FD_IOPORT ) /* Digital Input Register (read) */ #define FD_DIR (7 + FD_IOPORT ) /* Diskette Control Register (write)*/ #define FD_DCR (7 + FD_IOPORT ) /* Bits of main status register */ #define STATUS_BUSYMASK 0x0F /* drive busy mask */ #define STATUS_BUSY 0x10 /* FDC busy */ #define STATUS_DMA 0x20 /* 0- DMA mode */ #define STATUS_DIR 0x40 /* 0- cpu->fdc */ #define STATUS_READY 0x80 /* Data reg ready */ /* Bits of FD_ST0 */ #define ST0_DS 0x03 /* drive select mask */ #define ST0_HA 0x04 /* Head (Address) */ #define ST0_NR 0x08 /* Not Ready */ #define ST0_ECE 0x10 /* Equipment check error */ #define ST0_SE 0x20 /* Seek end */ #define ST0_INTR 0xC0 /* Interrupt code mask */ /* Bits of FD_ST1 */ #define ST1_MAM 0x01 /* Missing Address Mark */ #define ST1_WP 0x02 /* Write Protect */ #define ST1_ND 0x04 /* No Data - unreadable */ #define ST1_OR 0x10 /* OverRun */ #define ST1_CRC 0x20 /* CRC error in data or addr */ #define ST1_EOC 0x80 /* End Of Cylinder */ /* Bits of FD_ST2 */ #define ST2_MAM 0x01 /* Missing Address Mark (again) */ #define ST2_BC 0x02 /* Bad Cylinder */ #define ST2_SNS 0x04 /* Scan Not Satisfied */ #define ST2_SEH 0x08 /* Scan Equal Hit */ #define ST2_WC 0x10 /* Wrong Cylinder */ #define ST2_CRC 0x20 /* CRC error in data field */ #define ST2_CM 0x40 /* Control Mark = deleted */ /* Bits of FD_ST3 */ #define ST3_HA 0x04 /* Head (Address) */ #define ST3_DS 0x08 /* drive is double-sided */ #define ST3_TZ 0x10 /* Track Zero signal (1=track 0) */ #define ST3_RY 0x20 /* drive is ready */ #define ST3_WP 0x40 /* Write Protect */ #define ST3_FT 0x80 /* Drive Fault */ /* Values for FD_COMMAND */ #define FD_RECALIBRATE 0x07 /* move to track 0 */ #define FD_SEEK 0x0F /* seek track */ #define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */ #define FD_WRITE 0xC5 /* write with MT, MFM */ #define FD_SENSEI 0x08 /* Sense Interrupt Status */ #define FD_SPECIFY 0x03 /* specify HUT etc */ #define FD_FORMAT 0x4D /* format one track */ #define FD_VERSION 0x10 /* get version code */ #define FD_CONFIGURE 0x13 /* configure FIFO operation */ #define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */ #define FD_GETSTATUS 0x04 /* read ST3 */ #define FD_DUMPREGS 0x0E /* dump the contents of the fdc regs */ #define FD_READID 0xEA /* prints the header of a sector */ #define FD_UNLOCK 0x14 /* Fifo config unlock */ #define FD_LOCK 0x94 /* Fifo config lock */ #define FD_RSEEK_OUT 0x8f /* seek out (i.e. to lower tracks) */ #define FD_RSEEK_IN 0xcf /* seek in (i.e. to higher tracks) */ /* the following commands are new in the 82078. They are not used in the * floppy driver, except the first three. These commands may be useful for apps * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at * http://www.intel.com/design/archives/periphrl/docs/29046803.htm */ #define FD_PARTID 0x18 /* part id ("extended" version cmd) */ #define FD_SAVE 0x2e /* save fdc regs for later restore */ #define FD_DRIVESPEC 0x8e /* drive specification: Access to the * 2 Mbps data transfer rate for tape * drives */ #define FD_RESTORE 0x4e /* later restore */ #define FD_POWERDOWN 0x27 /* configure FDC's powersave features */ #define FD_FORMAT_N_WRITE 0xef /* format and write in one go. */ #define FD_OPTION 0x33 /* ISO format (which is a clean way to * pack more sectors on a track) */ /* DMA commands */ #define DMA_READ 0x46 #define DMA_WRITE 0x4A /* FDC version return types */ #define FDC_NONE 0x00 #define FDC_UNKNOWN 0x10 /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION FAILS EARLY */ #define FDC_8272A 0x20 /* Intel 8272a, NEC 765 */ #define FDC_765ED 0x30 /* Non-Intel 1MB-compatible FDC, can't detect */ #define FDC_82072 0x40 /* Intel 82072; 8272a + FIFO + DUMPREGS */ #define FDC_82072A 0x45 /* 82072A (on Sparcs) */ #define FDC_82077_ORIG 0x51 /* Original version of 82077AA, sans LOCK */ #define FDC_82077 0x52 /* 82077AA-1 */ #define FDC_82078_UNKN 0x5f /* Unknown 82078 variant */ #define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */ #define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */ #define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB * SCSI/EIDE/Floppy controller) */ #define FDC_87306 0x63 /* National Semiconductor PC 87306 */ /* * Beware: the fdc type list is roughly sorted by increasing features. * Presence of features is tested by comparing the FDC version id with the * "oldest" version that has the needed feature. * If during FDC detection, an obscure test fails late in the sequence, don't * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse. * This is especially true if the tests are unneeded. */ #define FD_RESET_DELAY 20 #endif linux/byteorder/big_endian.h 0000644 00000006726 15063602047 0012150 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H #define _LINUX_BYTEORDER_BIG_ENDIAN_H #ifndef __BIG_ENDIAN #define __BIG_ENDIAN 4321 #endif #ifndef __BIG_ENDIAN_BITFIELD #define __BIG_ENDIAN_BITFIELD #endif #include <linux/types.h> #include <linux/swab.h> #define __constant_htonl(x) ((__be32)(__u32)(x)) #define __constant_ntohl(x) ((__u32)(__be32)(x)) #define __constant_htons(x) ((__be16)(__u16)(x)) #define __constant_ntohs(x) ((__u16)(__be16)(x)) #define __constant_cpu_to_le64(x) ((__le64)___constant_swab64((x))) #define __constant_le64_to_cpu(x) ___constant_swab64((__u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__le32)___constant_swab32((x))) #define __constant_le32_to_cpu(x) ___constant_swab32((__u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__le16)___constant_swab16((x))) #define __constant_le16_to_cpu(x) ___constant_swab16((__u16)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__be64)(__u64)(x)) #define __constant_be64_to_cpu(x) ((__u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__be32)(__u32)(x)) #define __constant_be32_to_cpu(x) ((__u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__be16)(__u16)(x)) #define __constant_be16_to_cpu(x) ((__u16)(__be16)(x)) #define __cpu_to_le64(x) ((__le64)__swab64((x))) #define __le64_to_cpu(x) __swab64((__u64)(__le64)(x)) #define __cpu_to_le32(x) ((__le32)__swab32((x))) #define __le32_to_cpu(x) __swab32((__u32)(__le32)(x)) #define __cpu_to_le16(x) ((__le16)__swab16((x))) #define __le16_to_cpu(x) __swab16((__u16)(__le16)(x)) #define __cpu_to_be64(x) ((__be64)(__u64)(x)) #define __be64_to_cpu(x) ((__u64)(__be64)(x)) #define __cpu_to_be32(x) ((__be32)(__u32)(x)) #define __be32_to_cpu(x) ((__u32)(__be32)(x)) #define __cpu_to_be16(x) ((__be16)(__u16)(x)) #define __be16_to_cpu(x) ((__u16)(__be16)(x)) static __always_inline __le64 __cpu_to_le64p(const __u64 *p) { return (__le64)__swab64p(p); } static __always_inline __u64 __le64_to_cpup(const __le64 *p) { return __swab64p((__u64 *)p); } static __always_inline __le32 __cpu_to_le32p(const __u32 *p) { return (__le32)__swab32p(p); } static __always_inline __u32 __le32_to_cpup(const __le32 *p) { return __swab32p((__u32 *)p); } static __always_inline __le16 __cpu_to_le16p(const __u16 *p) { return (__le16)__swab16p(p); } static __always_inline __u16 __le16_to_cpup(const __le16 *p) { return __swab16p((__u16 *)p); } static __always_inline __be64 __cpu_to_be64p(const __u64 *p) { return (__be64)*p; } static __always_inline __u64 __be64_to_cpup(const __be64 *p) { return (__u64)*p; } static __always_inline __be32 __cpu_to_be32p(const __u32 *p) { return (__be32)*p; } static __always_inline __u32 __be32_to_cpup(const __be32 *p) { return (__u32)*p; } static __always_inline __be16 __cpu_to_be16p(const __u16 *p) { return (__be16)*p; } static __always_inline __u16 __be16_to_cpup(const __be16 *p) { return (__u16)*p; } #define __cpu_to_le64s(x) __swab64s((x)) #define __le64_to_cpus(x) __swab64s((x)) #define __cpu_to_le32s(x) __swab32s((x)) #define __le32_to_cpus(x) __swab32s((x)) #define __cpu_to_le16s(x) __swab16s((x)) #define __le16_to_cpus(x) __swab16s((x)) #define __cpu_to_be64s(x) do { (void)(x); } while (0) #define __be64_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_be32s(x) do { (void)(x); } while (0) #define __be32_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_be16s(x) do { (void)(x); } while (0) #define __be16_to_cpus(x) do { (void)(x); } while (0) #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ linux/byteorder/little_endian.h 0000644 00000007033 15063602047 0012674 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H #ifndef __LITTLE_ENDIAN #define __LITTLE_ENDIAN 1234 #endif #ifndef __LITTLE_ENDIAN_BITFIELD #define __LITTLE_ENDIAN_BITFIELD #endif #include <linux/types.h> #include <linux/swab.h> #define __constant_htonl(x) ((__be32)___constant_swab32((x))) #define __constant_ntohl(x) ___constant_swab32((__be32)(x)) #define __constant_htons(x) ((__be16)___constant_swab16((x))) #define __constant_ntohs(x) ___constant_swab16((__be16)(x)) #define __constant_cpu_to_le64(x) ((__le64)(__u64)(x)) #define __constant_le64_to_cpu(x) ((__u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__le32)(__u32)(x)) #define __constant_le32_to_cpu(x) ((__u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__le16)(__u16)(x)) #define __constant_le16_to_cpu(x) ((__u16)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__be64)___constant_swab64((x))) #define __constant_be64_to_cpu(x) ___constant_swab64((__u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__be32)___constant_swab32((x))) #define __constant_be32_to_cpu(x) ___constant_swab32((__u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__be16)___constant_swab16((x))) #define __constant_be16_to_cpu(x) ___constant_swab16((__u16)(__be16)(x)) #define __cpu_to_le64(x) ((__le64)(__u64)(x)) #define __le64_to_cpu(x) ((__u64)(__le64)(x)) #define __cpu_to_le32(x) ((__le32)(__u32)(x)) #define __le32_to_cpu(x) ((__u32)(__le32)(x)) #define __cpu_to_le16(x) ((__le16)(__u16)(x)) #define __le16_to_cpu(x) ((__u16)(__le16)(x)) #define __cpu_to_be64(x) ((__be64)__swab64((x))) #define __be64_to_cpu(x) __swab64((__u64)(__be64)(x)) #define __cpu_to_be32(x) ((__be32)__swab32((x))) #define __be32_to_cpu(x) __swab32((__u32)(__be32)(x)) #define __cpu_to_be16(x) ((__be16)__swab16((x))) #define __be16_to_cpu(x) __swab16((__u16)(__be16)(x)) static __always_inline __le64 __cpu_to_le64p(const __u64 *p) { return (__le64)*p; } static __always_inline __u64 __le64_to_cpup(const __le64 *p) { return (__u64)*p; } static __always_inline __le32 __cpu_to_le32p(const __u32 *p) { return (__le32)*p; } static __always_inline __u32 __le32_to_cpup(const __le32 *p) { return (__u32)*p; } static __always_inline __le16 __cpu_to_le16p(const __u16 *p) { return (__le16)*p; } static __always_inline __u16 __le16_to_cpup(const __le16 *p) { return (__u16)*p; } static __always_inline __be64 __cpu_to_be64p(const __u64 *p) { return (__be64)__swab64p(p); } static __always_inline __u64 __be64_to_cpup(const __be64 *p) { return __swab64p((__u64 *)p); } static __always_inline __be32 __cpu_to_be32p(const __u32 *p) { return (__be32)__swab32p(p); } static __always_inline __u32 __be32_to_cpup(const __be32 *p) { return __swab32p((__u32 *)p); } static __always_inline __be16 __cpu_to_be16p(const __u16 *p) { return (__be16)__swab16p(p); } static __always_inline __u16 __be16_to_cpup(const __be16 *p) { return __swab16p((__u16 *)p); } #define __cpu_to_le64s(x) do { (void)(x); } while (0) #define __le64_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_le32s(x) do { (void)(x); } while (0) #define __le32_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_le16s(x) do { (void)(x); } while (0) #define __le16_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_be64s(x) __swab64s((x)) #define __be64_to_cpus(x) __swab64s((x)) #define __cpu_to_be32s(x) __swab32s((x)) #define __be32_to_cpus(x) __swab32s((x)) #define __cpu_to_be16s(x) __swab16s((x)) #define __be16_to_cpus(x) __swab16s((x)) #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ linux/caif/caif_socket.h 0000644 00000013310 15063602047 0011231 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* linux/caif_socket.h * CAIF Definitions for CAIF socket and network layer * Copyright (C) ST-Ericsson AB 2010 * Author: Sjur Brendeland * License terms: GNU General Public License (GPL) version 2 */ #ifndef _LINUX_CAIF_SOCKET_H #define _LINUX_CAIF_SOCKET_H #include <linux/types.h> #include <linux/socket.h> /** * enum caif_link_selector - Physical Link Selection. * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth * traffic. * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency * traffic. * * CAIF Link Layers can register their link properties. * This enum is used for choosing between CAIF Link Layers when * setting up CAIF Channels when multiple CAIF Link Layers exists. */ enum caif_link_selector { CAIF_LINK_HIGH_BANDW, CAIF_LINK_LOW_LATENCY }; /** * enum caif_channel_priority - CAIF channel priorities. * * @CAIF_PRIO_MIN: Min priority for a channel. * @CAIF_PRIO_LOW: Low-priority channel. * @CAIF_PRIO_NORMAL: Normal/default priority level. * @CAIF_PRIO_HIGH: High priority level * @CAIF_PRIO_MAX: Max priority for channel * * Priority can be set on CAIF Channels in order to * prioritize between traffic on different CAIF Channels. * These priority levels are recommended, but the priority value * is not restricted to the values defined in this enum, any value * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used. */ enum caif_channel_priority { CAIF_PRIO_MIN = 0x01, CAIF_PRIO_LOW = 0x04, CAIF_PRIO_NORMAL = 0x0f, CAIF_PRIO_HIGH = 0x14, CAIF_PRIO_MAX = 0x1F }; /** * enum caif_protocol_type - CAIF Channel type. * @CAIFPROTO_AT: Classic AT channel. * @CAIFPROTO_DATAGRAM: Datagram channel. * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing. * @CAIFPROTO_UTIL: Utility (Psock) channel. * @CAIFPROTO_RFM: Remote File Manager * @CAIFPROTO_DEBUG: Debug link * * This enum defines the CAIF Channel type to be used. This defines * the service to connect to on the modem. */ enum caif_protocol_type { CAIFPROTO_AT, CAIFPROTO_DATAGRAM, CAIFPROTO_DATAGRAM_LOOP, CAIFPROTO_UTIL, CAIFPROTO_RFM, CAIFPROTO_DEBUG, _CAIFPROTO_MAX }; #define CAIFPROTO_MAX _CAIFPROTO_MAX /** * enum caif_at_type - AT Service Endpoint * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel. */ enum caif_at_type { CAIF_ATTYPE_PLAIN = 2 }; /** * enum caif_debug_type - Content selection for debug connection * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain * both trace and interactive debug. * @CAIF_DEBUG_TRACE: Connection contains trace only. * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug. */ enum caif_debug_type { CAIF_DEBUG_TRACE_INTERACTIVE = 0, CAIF_DEBUG_TRACE, CAIF_DEBUG_INTERACTIVE, }; /** * enum caif_debug_service - Debug Service Endpoint * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system */ enum caif_debug_service { CAIF_RADIO_DEBUG_SERVICE = 1, CAIF_APP_DEBUG_SERVICE }; /** * struct sockaddr_caif - the sockaddr structure for CAIF sockets. * @family: Address family number, must be AF_CAIF. * @u: Union of address data 'switched' by family. * : * @u.at: Applies when family = CAIFPROTO_AT. * * @u.at.type: Type of AT link to set up (enum caif_at_type). * * @u.util: Applies when family = CAIFPROTO_UTIL * * @u.util.service: Utility service name. * * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM * * @u.dgm.connection_id: Datagram connection id. * * @u.dgm.nsapi: NSAPI of the PDP-Context. * * @u.rfm: Applies when family = CAIFPROTO_RFM * * @u.rfm.connection_id: Connection ID for RFM. * * @u.rfm.volume: Volume to mount. * * @u.dbg: Applies when family = CAIFPROTO_DEBUG. * * @u.dbg.type: Type of debug connection to set up * (caif_debug_type). * * @u.dbg.service: Service sub-system to connect (caif_debug_service * Description: * This structure holds the connect parameters used for setting up a * CAIF Channel. It defines the service to connect to on the modem. */ struct sockaddr_caif { __kernel_sa_family_t family; union { struct { __u8 type; /* type: enum caif_at_type */ } at; /* CAIFPROTO_AT */ struct { char service[16]; } util; /* CAIFPROTO_UTIL */ union { __u32 connection_id; __u8 nsapi; } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/ struct { __u32 connection_id; char volume[16]; } rfm; /* CAIFPROTO_RFM */ struct { __u8 type; /* type:enum caif_debug_type */ __u8 service; /* service:caif_debug_service */ } dbg; /* CAIFPROTO_DEBUG */ } u; }; /** * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt. * * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are * available. Either a high bandwidth * link can be selected (CAIF_LINK_HIGH_BANDW) or * or a low latency link (CAIF_LINK_LOW_LATENCY). * This option is of type __u32. * Alternatively SO_BINDTODEVICE can be used. * * @CAIFSO_REQ_PARAM: Used to set the request parameters for a * utility channel. (maximum 256 bytes). This * option must be set before connecting. * * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility * channel. (maximum 256 bytes). This option * is valid after a successful connect. * * * This enum defines the CAIF Socket options to be used on a socket * of type PF_CAIF. * */ enum caif_socket_opts { CAIFSO_LINK_SELECT = 127, CAIFSO_REQ_PARAM = 128, CAIFSO_RSP_PARAM = 129, }; #endif /* _LINUX_CAIF_SOCKET_H */ linux/caif/if_caif.h 0000644 00000002021 15063602047 0010334 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) ST-Ericsson AB 2010 * Author: Sjur Brendeland * License terms: GNU General Public License (GPL) version 2 */ #ifndef IF_CAIF_H_ #define IF_CAIF_H_ #include <linux/sockios.h> #include <linux/types.h> #include <linux/socket.h> /** * enum ifla_caif - CAIF NetlinkRT parameters. * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context. * The type of attribute is NLA_U32. * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context. * The type of attribute is NLA_U32. * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback * The type of attribute is NLA_U8. * * When using RT Netlink to create, destroy or configure a CAIF IP interface, * enum ifla_caif is used to specify the configuration attributes. */ enum ifla_caif { __IFLA_CAIF_UNSPEC, IFLA_CAIF_IPV4_CONNID, IFLA_CAIF_IPV6_CONNID, IFLA_CAIF_LOOPBACK, __IFLA_CAIF_MAX }; #define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1) #endif /*IF_CAIF_H_*/ linux/can/bcm.h 0000644 00000010017 15063602047 0007360 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/bcm.h * * Definitions for CAN Broadcast Manager (BCM) * * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_BCM_H #define _CAN_BCM_H #include <linux/types.h> #include <linux/can.h> struct bcm_timeval { long tv_sec; long tv_usec; }; /** * struct bcm_msg_head - head of messages to/from the broadcast manager * @opcode: opcode, see enum below. * @flags: special flags, see below. * @count: number of frames to send before changing interval. * @ival1: interval for the first @count frames. * @ival2: interval for the following frames. * @can_id: CAN ID of frames to be sent or received. * @nframes: number of frames appended to the message head. * @frames: array of CAN frames. */ struct bcm_msg_head { __u32 opcode; __u32 flags; __u32 count; struct bcm_timeval ival1, ival2; canid_t can_id; __u32 nframes; struct can_frame frames[0]; }; enum { TX_SETUP = 1, /* create (cyclic) transmission task */ TX_DELETE, /* remove (cyclic) transmission task */ TX_READ, /* read properties of (cyclic) transmission task */ TX_SEND, /* send one CAN frame */ RX_SETUP, /* create RX content filter subscription */ RX_DELETE, /* remove RX content filter subscription */ RX_READ, /* read properties of RX content filter subscription */ TX_STATUS, /* reply to TX_READ request */ TX_EXPIRED, /* notification on performed transmissions (count=0) */ RX_STATUS, /* reply to RX_READ request */ RX_TIMEOUT, /* cyclic message is absent */ RX_CHANGED /* updated CAN frame (detected content change) */ }; #define SETTIMER 0x0001 #define STARTTIMER 0x0002 #define TX_COUNTEVT 0x0004 #define TX_ANNOUNCE 0x0008 #define TX_CP_CAN_ID 0x0010 #define RX_FILTER_ID 0x0020 #define RX_CHECK_DLC 0x0040 #define RX_NO_AUTOTIMER 0x0080 #define RX_ANNOUNCE_RESUME 0x0100 #define TX_RESET_MULTI_IDX 0x0200 #define RX_RTR_FRAME 0x0400 #define CAN_FD_FRAME 0x0800 #endif /* !_UAPI_CAN_BCM_H */ linux/can/error.h 0000644 00000014715 15063602047 0007761 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/error.h * * Definitions of the CAN error messages to be filtered and passed to the user. * * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_ERROR_H #define _CAN_ERROR_H #define CAN_ERR_DLC 8 /* dlc for error message frames */ /* error class (mask) in can_id */ #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ #define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ #define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ #define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ #define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ #define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ #define CAN_ERR_BUSOFF 0x00000040U /* bus off */ #define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ #define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ /* arbitration lost in bit ... / data[0] */ #define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ /* else bit number in bitstream */ /* error status of CAN-controller / data[1] */ #define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ #define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ #define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ #define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ #define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ #define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ #define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ /* (at least one error counter exceeds */ /* the protocol-defined level of 127) */ #define CAN_ERR_CRTL_ACTIVE 0x40 /* recovered to error active state */ /* error in CAN protocol (type) / data[2] */ #define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ #define CAN_ERR_PROT_BIT 0x01 /* single bit error */ #define CAN_ERR_PROT_FORM 0x02 /* frame format error */ #define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ #define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ #define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ #define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ #define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ #define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */ /* error in CAN protocol (location) / data[3] */ #define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ #define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ #define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ #define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ #define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ #define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ #define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ #define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ #define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ #define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ #define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ #define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ #define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ #define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ #define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ #define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ #define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ #define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ #define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ #define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ /* error status of CAN-transceiver / data[4] */ /* CANH CANL */ #define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ #define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ #define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ #define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ #define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ #define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ /* controller specific additional information / data[5..7] */ #endif /* _CAN_ERROR_H */ linux/can/gw.h 0000644 00000016416 15063602047 0007245 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/gw.h * * Definitions for CAN frame Gateway/Router/Bridge * * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Copyright (c) 2011 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_GW_H #define _CAN_GW_H #include <linux/types.h> #include <linux/can.h> struct rtcanmsg { __u8 can_family; __u8 gwtype; __u16 flags; }; /* CAN gateway types */ enum { CGW_TYPE_UNSPEC, CGW_TYPE_CAN_CAN, /* CAN->CAN routing */ __CGW_TYPE_MAX }; #define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1) /* CAN rtnetlink attribute definitions */ enum { CGW_UNSPEC, CGW_MOD_AND, /* CAN frame modification binary AND */ CGW_MOD_OR, /* CAN frame modification binary OR */ CGW_MOD_XOR, /* CAN frame modification binary XOR */ CGW_MOD_SET, /* CAN frame modification set alternate values */ CGW_CS_XOR, /* set data[] XOR checksum into data[index] */ CGW_CS_CRC8, /* set data[] CRC8 checksum into data[index] */ CGW_HANDLED, /* number of handled CAN frames */ CGW_DROPPED, /* number of dropped CAN frames */ CGW_SRC_IF, /* ifindex of source network interface */ CGW_DST_IF, /* ifindex of destination network interface */ CGW_FILTER, /* specify struct can_filter on source CAN device */ CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */ CGW_LIM_HOPS, /* limit the number of hops of this specific rule */ CGW_MOD_UID, /* user defined identifier for modification updates */ __CGW_MAX }; #define CGW_MAX (__CGW_MAX - 1) #define CGW_FLAGS_CAN_ECHO 0x01 #define CGW_FLAGS_CAN_SRC_TSTAMP 0x02 #define CGW_FLAGS_CAN_IIF_TX_OK 0x04 #define CGW_MOD_FUNCS 4 /* AND OR XOR SET */ /* CAN frame elements that are affected by curr. 3 CAN frame modifications */ #define CGW_MOD_ID 0x01 #define CGW_MOD_DLC 0x02 #define CGW_MOD_DATA 0x04 #define CGW_FRAME_MODS 3 /* ID DLC DATA */ #define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS) struct cgw_frame_mod { struct can_frame cf; __u8 modtype; } __attribute__((packed)); #define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod) struct cgw_csum_xor { __s8 from_idx; __s8 to_idx; __s8 result_idx; __u8 init_xor_val; } __attribute__((packed)); struct cgw_csum_crc8 { __s8 from_idx; __s8 to_idx; __s8 result_idx; __u8 init_crc_val; __u8 final_xor_val; __u8 crctab[256]; __u8 profile; __u8 profile_data[20]; } __attribute__((packed)); /* length of checksum operation parameters. idx = index in CAN frame data[] */ #define CGW_CS_XOR_LEN sizeof(struct cgw_csum_xor) #define CGW_CS_CRC8_LEN sizeof(struct cgw_csum_crc8) /* CRC8 profiles (compute CRC for additional data elements - see below) */ enum { CGW_CRC8PRF_UNSPEC, CGW_CRC8PRF_1U8, /* compute one additional u8 value */ CGW_CRC8PRF_16U8, /* u8 value table indexed by data[1] & 0xF */ CGW_CRC8PRF_SFFID_XOR, /* (can_id & 0xFF) ^ (can_id >> 8 & 0xFF) */ __CGW_CRC8PRF_MAX }; #define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1) /* * CAN rtnetlink attribute contents in detail * * CGW_XXX_IF (length 4 bytes): * Sets an interface index for source/destination network interfaces. * For the CAN->CAN gwtype the indices of _two_ CAN interfaces are mandatory. * * CGW_FILTER (length 8 bytes): * Sets a CAN receive filter for the gateway job specified by the * struct can_filter described in include/linux/can.h * * CGW_MOD_(AND|OR|XOR|SET) (length 17 bytes): * Specifies a modification that's done to a received CAN frame before it is * send out to the destination interface. * * <struct can_frame> data used as operator * <u8> affected CAN frame elements * * CGW_LIM_HOPS (length 1 byte): * Limit the number of hops of this specific rule. Usually the received CAN * frame can be processed as much as 'max_hops' times (which is given at module * load time of the can-gw module). This value is used to reduce the number of * possible hops for this gateway rule to a value smaller then max_hops. * * CGW_MOD_UID (length 4 bytes): * Optional non-zero user defined routing job identifier to alter existing * modification settings at runtime. * * CGW_CS_XOR (length 4 bytes): * Set a simple XOR checksum starting with an initial value into * data[result-idx] using data[start-idx] .. data[end-idx] * * The XOR checksum is calculated like this: * * xor = init_xor_val * * for (i = from_idx .. to_idx) * xor ^= can_frame.data[i] * * can_frame.data[ result_idx ] = xor * * CGW_CS_CRC8 (length 282 bytes): * Set a CRC8 value into data[result-idx] using a given 256 byte CRC8 table, * a given initial value and a defined input data[start-idx] .. data[end-idx]. * Finally the result value is XOR'ed with the final_xor_val. * * The CRC8 checksum is calculated like this: * * crc = init_crc_val * * for (i = from_idx .. to_idx) * crc = crctab[ crc ^ can_frame.data[i] ] * * can_frame.data[ result_idx ] = crc ^ final_xor_val * * The calculated CRC may contain additional source data elements that can be * defined in the handling of 'checksum profiles' e.g. shown in AUTOSAR specs * like http://www.autosar.org/download/R4.0/AUTOSAR_SWS_E2ELibrary.pdf * E.g. the profile_data[] may contain additional u8 values (called DATA_IDs) * that are used depending on counter values inside the CAN frame data[]. * So far only three profiles have been implemented for illustration. * * Remark: In general the attribute data is a linear buffer. * Beware of sending unpacked or aligned structs! */ #endif /* !_UAPI_CAN_GW_H */ linux/can/netlink.h 0000644 00000007625 15063602047 0010276 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/can/netlink.h * * Definitions for the CAN netlink interface * * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the version 2 of the GNU General Public License * as published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _CAN_NETLINK_H #define _CAN_NETLINK_H #include <linux/types.h> /* * CAN bit-timing parameters * * For further information, please read chapter "8 BIT TIMING * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. */ struct can_bittiming { __u32 bitrate; /* Bit-rate in bits/second */ __u32 sample_point; /* Sample point in one-tenth of a percent */ __u32 tq; /* Time quanta (TQ) in nanoseconds */ __u32 prop_seg; /* Propagation segment in TQs */ __u32 phase_seg1; /* Phase buffer segment 1 in TQs */ __u32 phase_seg2; /* Phase buffer segment 2 in TQs */ __u32 sjw; /* Synchronisation jump width in TQs */ __u32 brp; /* Bit-rate prescaler */ }; /* * CAN harware-dependent bit-timing constant * * Used for calculating and checking bit-timing parameters */ struct can_bittiming_const { char name[16]; /* Name of the CAN controller hardware */ __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */ __u32 tseg1_max; __u32 tseg2_min; /* Time segement 2 = phase_seg2 */ __u32 tseg2_max; __u32 sjw_max; /* Synchronisation jump width */ __u32 brp_min; /* Bit-rate prescaler */ __u32 brp_max; __u32 brp_inc; }; /* * CAN clock parameters */ struct can_clock { __u32 freq; /* CAN system clock frequency in Hz */ }; /* * CAN operational and error states */ enum can_state { CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */ CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */ CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */ CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */ CAN_STATE_STOPPED, /* Device is stopped */ CAN_STATE_SLEEPING, /* Device is sleeping */ CAN_STATE_MAX }; /* * CAN bus error counters */ struct can_berr_counter { __u16 txerr; __u16 rxerr; }; /* * CAN controller mode */ struct can_ctrlmode { __u32 mask; __u32 flags; }; #define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ #define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ #define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ #define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ #define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ #define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */ #define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */ #define CAN_CTRLMODE_FD_NON_ISO 0x80 /* CAN FD in non-ISO mode */ /* * CAN device statistics */ struct can_device_stats { __u32 bus_error; /* Bus errors */ __u32 error_warning; /* Changes to error warning state */ __u32 error_passive; /* Changes to error passive state */ __u32 bus_off; /* Changes to bus off state */ __u32 arbitration_lost; /* Arbitration lost errors */ __u32 restarts; /* CAN controller re-starts */ }; /* * CAN netlink interface */ enum { IFLA_CAN_UNSPEC, IFLA_CAN_BITTIMING, IFLA_CAN_BITTIMING_CONST, IFLA_CAN_CLOCK, IFLA_CAN_STATE, IFLA_CAN_CTRLMODE, IFLA_CAN_RESTART_MS, IFLA_CAN_RESTART, IFLA_CAN_BERR_COUNTER, IFLA_CAN_DATA_BITTIMING, IFLA_CAN_DATA_BITTIMING_CONST, IFLA_CAN_TERMINATION, IFLA_CAN_TERMINATION_CONST, IFLA_CAN_BITRATE_CONST, IFLA_CAN_DATA_BITRATE_CONST, IFLA_CAN_BITRATE_MAX, __IFLA_CAN_MAX }; #define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) /* u16 termination range: 1..65535 Ohms */ #define CAN_TERMINATION_DISABLED 0 #endif /* !_UAPI_CAN_NETLINK_H */ linux/can/raw.h 0000644 00000005445 15063602047 0007421 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can/raw.h * * Definitions for raw CAN sockets * * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Urs Thuermann <urs.thuermann@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_RAW_H #define _CAN_RAW_H #include <linux/can.h> #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW) /* for socket options affecting the socket (not the global system) */ enum { CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ CAN_RAW_ERR_FILTER, /* set filter for error frames */ CAN_RAW_LOOPBACK, /* local loopback (default:on) */ CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */ CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ CAN_RAW_JOIN_FILTERS, /* all filters must match to trigger */ }; #endif /* !_UAPI_CAN_RAW_H */ linux/can/vxcan.h 0000644 00000000343 15063602047 0007737 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _CAN_VXCAN_H #define _CAN_VXCAN_H enum { VXCAN_INFO_UNSPEC, VXCAN_INFO_PEER, __VXCAN_INFO_MAX #define VXCAN_INFO_MAX (__VXCAN_INFO_MAX - 1) }; #endif linux/cifs/cifs_mount.h 0000644 00000002237 15063602047 0011155 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * * Author(s): Scott Lovenberg (scott.lovenberg@gmail.com) * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU Lesser General Public License for more details. */ #ifndef _CIFS_MOUNT_H #define _CIFS_MOUNT_H /* Max string lengths for cifs mounting options. */ #define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */ #define CIFS_MAX_USERNAME_LEN 256 /* reasonable max for current servers */ #define CIFS_MAX_PASSWORD_LEN 512 /* Windows max seems to be 256 wide chars */ #define CIFS_MAX_SHARE_LEN 256 /* reasonable max share name length */ #define CIFS_NI_MAXHOST 1024 /* max host name length (256 * 4 bytes) */ #endif /* _CIFS_MOUNT_H */ linux/cifs/cifs_netlink.h 0000644 00000003127 15063602047 0011456 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * Netlink routines for CIFS * * Copyright (c) 2020 Samuel Cabrero <scabrero@suse.de> */ #ifndef LINUX_CIFS_NETLINK_H #define LINUX_CIFS_NETLINK_H #define CIFS_GENL_NAME "cifs" #define CIFS_GENL_VERSION 0x1 #define CIFS_GENL_MCGRP_SWN_NAME "cifs_mcgrp_swn" enum cifs_genl_multicast_groups { CIFS_GENL_MCGRP_SWN, }; enum cifs_genl_attributes { CIFS_GENL_ATTR_UNSPEC, CIFS_GENL_ATTR_SWN_REGISTRATION_ID, CIFS_GENL_ATTR_SWN_NET_NAME, CIFS_GENL_ATTR_SWN_SHARE_NAME, CIFS_GENL_ATTR_SWN_IP, CIFS_GENL_ATTR_SWN_NET_NAME_NOTIFY, CIFS_GENL_ATTR_SWN_SHARE_NAME_NOTIFY, CIFS_GENL_ATTR_SWN_IP_NOTIFY, CIFS_GENL_ATTR_SWN_KRB_AUTH, CIFS_GENL_ATTR_SWN_USER_NAME, CIFS_GENL_ATTR_SWN_PASSWORD, CIFS_GENL_ATTR_SWN_DOMAIN_NAME, CIFS_GENL_ATTR_SWN_NOTIFICATION_TYPE, CIFS_GENL_ATTR_SWN_RESOURCE_STATE, CIFS_GENL_ATTR_SWN_RESOURCE_NAME, __CIFS_GENL_ATTR_MAX, }; #define CIFS_GENL_ATTR_MAX (__CIFS_GENL_ATTR_MAX - 1) enum cifs_genl_commands { CIFS_GENL_CMD_UNSPEC, CIFS_GENL_CMD_SWN_REGISTER, CIFS_GENL_CMD_SWN_UNREGISTER, CIFS_GENL_CMD_SWN_NOTIFY, __CIFS_GENL_CMD_MAX }; #define CIFS_GENL_CMD_MAX (__CIFS_GENL_CMD_MAX - 1) enum cifs_swn_notification_type { CIFS_SWN_NOTIFICATION_RESOURCE_CHANGE = 0x01, CIFS_SWN_NOTIFICATION_CLIENT_MOVE = 0x02, CIFS_SWN_NOTIFICATION_SHARE_MOVE = 0x03, CIFS_SWN_NOTIFICATION_IP_CHANGE = 0x04, }; enum cifs_swn_resource_state { CIFS_SWN_RESOURCE_STATE_UNKNOWN = 0x00, CIFS_SWN_RESOURCE_STATE_AVAILABLE = 0x01, CIFS_SWN_RESOURCE_STATE_UNAVAILABLE = 0xFF }; #endif /* LINUX_CIFS_NETLINK_H */ linux/efs_fs_sb.h 0000644 00000004263 15063602047 0010015 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * efs_fs_sb.h * * Copyright (c) 1999 Al Smith * * Portions derived from IRIX header files (c) 1988 Silicon Graphics */ #ifndef __EFS_FS_SB_H__ #define __EFS_FS_SB_H__ #include <linux/types.h> #include <linux/magic.h> /* EFS superblock magic numbers */ #define EFS_MAGIC 0x072959 #define EFS_NEWMAGIC 0x07295a #define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC)) #define EFS_SUPER 1 #define EFS_ROOTINODE 2 /* efs superblock on disk */ struct efs_super { __be32 fs_size; /* size of filesystem, in sectors */ __be32 fs_firstcg; /* bb offset to first cg */ __be32 fs_cgfsize; /* size of cylinder group in bb's */ __be16 fs_cgisize; /* bb's of inodes per cylinder group */ __be16 fs_sectors; /* sectors per track */ __be16 fs_heads; /* heads per cylinder */ __be16 fs_ncg; /* # of cylinder groups in filesystem */ __be16 fs_dirty; /* fs needs to be fsck'd */ __be32 fs_time; /* last super-block update */ __be32 fs_magic; /* magic number */ char fs_fname[6]; /* file system name */ char fs_fpack[6]; /* file system pack name */ __be32 fs_bmsize; /* size of bitmap in bytes */ __be32 fs_tfree; /* total free data blocks */ __be32 fs_tinode; /* total free inodes */ __be32 fs_bmblock; /* bitmap location. */ __be32 fs_replsb; /* Location of replicated superblock. */ __be32 fs_lastialloc; /* last allocated inode */ char fs_spare[20]; /* space for expansion - MUST BE ZERO */ __be32 fs_checksum; /* checksum of volume portion of fs */ }; /* efs superblock information in memory */ struct efs_sb_info { __u32 fs_magic; /* superblock magic number */ __u32 fs_start; /* first block of filesystem */ __u32 first_block; /* first data block in filesystem */ __u32 total_blocks; /* total number of blocks in filesystem */ __u32 group_size; /* # of blocks a group consists of */ __u32 data_free; /* # of free data blocks */ __u32 inode_free; /* # of free inodes */ __u16 inode_blocks; /* # of blocks used for inodes in every grp */ __u16 total_groups; /* # of groups */ }; #endif /* __EFS_FS_SB_H__ */ linux/elf-fdpic.h 0000644 00000002144 15063602047 0007711 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* elf-fdpic.h: FDPIC ELF load map * * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_ELF_FDPIC_H #define _LINUX_ELF_FDPIC_H #include <linux/elf.h> #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* segment mappings for ELF FDPIC libraries/executables/interpreters */ struct elf32_fdpic_loadseg { Elf32_Addr addr; /* core address to which mapped */ Elf32_Addr p_vaddr; /* VMA recorded in file */ Elf32_Word p_memsz; /* allocation size recorded in file */ }; struct elf32_fdpic_loadmap { Elf32_Half version; /* version of these structures, just in case... */ Elf32_Half nsegs; /* number of segments */ struct elf32_fdpic_loadseg segs[]; }; #define ELF32_FDPIC_LOADMAP_VERSION 0x0000 #endif /* _LINUX_ELF_FDPIC_H */ linux/elfcore.h 0000644 00000005663 15063602047 0007510 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ELFCORE_H #define _LINUX_ELFCORE_H #include <linux/types.h> #include <linux/signal.h> #include <linux/time.h> #include <linux/ptrace.h> #include <linux/elf.h> #include <linux/fs.h> struct elf_siginfo { int si_signo; /* signal number */ int si_code; /* extra code */ int si_errno; /* errno */ }; typedef elf_greg_t greg_t; typedef elf_gregset_t gregset_t; typedef elf_fpregset_t fpregset_t; typedef elf_fpxregset_t fpxregset_t; #define NGREG ELF_NGREG /* * Definitions to generate Intel SVR4-like core files. * These mostly have the same names as the SVR4 types with "elf_" * tacked on the front to prevent clashes with linux definitions, * and the typedef forms have been avoided. This is mostly like * the SVR4 structure, but more Linuxy, with things that Linux does * not support and which gdb doesn't really use excluded. * Fields present but not used are marked with "XXX". */ struct elf_prstatus { #if 0 long pr_flags; /* XXX Process flags */ short pr_why; /* XXX Reason for process halt */ short pr_what; /* XXX More detailed reason */ #endif struct elf_siginfo pr_info; /* Info associated with signal */ short pr_cursig; /* Current signal */ unsigned long pr_sigpend; /* Set of pending signals */ unsigned long pr_sighold; /* Set of held signals */ #if 0 struct sigaltstack pr_altstack; /* Alternate stack info */ struct sigaction pr_action; /* Signal action for current sig */ #endif pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; struct timeval pr_utime; /* User time */ struct timeval pr_stime; /* System time */ struct timeval pr_cutime; /* Cumulative user time */ struct timeval pr_cstime; /* Cumulative system time */ #if 0 long pr_instr; /* Current instruction */ #endif elf_gregset_t pr_reg; /* GP registers */ #ifdef CONFIG_BINFMT_ELF_FDPIC /* When using FDPIC, the loadmap addresses need to be communicated * to GDB in order for GDB to do the necessary relocations. The * fields (below) used to communicate this information are placed * immediately after ``pr_reg'', so that the loadmap addresses may * be viewed as part of the register set if so desired. */ unsigned long pr_exec_fdpic_loadmap; unsigned long pr_interp_fdpic_loadmap; #endif int pr_fpvalid; /* True if math co-processor being used. */ }; #define ELF_PRARGSZ (80) /* Number of chars for args */ struct elf_prpsinfo { char pr_state; /* numeric process state */ char pr_sname; /* char for pr_state */ char pr_zomb; /* zombie */ char pr_nice; /* nice val */ unsigned long pr_flag; /* flags */ __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ char pr_fname[16]; /* filename of executable */ char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; typedef struct elf_prstatus prstatus_t; typedef struct elf_prpsinfo prpsinfo_t; #define PRARGSZ ELF_PRARGSZ #endif /* _LINUX_ELFCORE_H */ linux/errqueue.h 0000644 00000002705 15063602047 0007720 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ERRQUEUE_H #define _LINUX_ERRQUEUE_H #include <linux/types.h> struct sock_extended_err { __u32 ee_errno; __u8 ee_origin; __u8 ee_type; __u8 ee_code; __u8 ee_pad; __u32 ee_info; __u32 ee_data; }; #define SO_EE_ORIGIN_NONE 0 #define SO_EE_ORIGIN_LOCAL 1 #define SO_EE_ORIGIN_ICMP 2 #define SO_EE_ORIGIN_ICMP6 3 #define SO_EE_ORIGIN_TXSTATUS 4 #define SO_EE_ORIGIN_ZEROCOPY 5 #define SO_EE_ORIGIN_TXTIME 6 #define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS #define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) #define SO_EE_CODE_ZEROCOPY_COPIED 1 #define SO_EE_CODE_TXTIME_INVALID_PARAM 1 #define SO_EE_CODE_TXTIME_MISSED 2 /** * struct scm_timestamping - timestamps exposed through cmsg * * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_* * communicate network timestamps by passing this struct in a cmsg with * recvmsg(). See Documentation/networking/timestamping.txt for details. */ struct scm_timestamping { struct timespec ts[3]; }; /* The type of scm_timestamping, passed in sock_extended_err ee_info. * This defines the type of ts[0]. For SCM_TSTAMP_SND only, if ts[0] * is zero, then this is a hardware timestamp and recorded in ts[2]. */ enum { SCM_TSTAMP_SND, /* driver passed skb to NIC, or HW */ SCM_TSTAMP_SCHED, /* data entered the packet scheduler */ SCM_TSTAMP_ACK, /* data acknowledged by peer */ }; #endif /* _LINUX_ERRQUEUE_H */ linux/ethtool.h 0000644 00000243617 15063602047 0007552 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ethtool.h: Defines for Linux ethtool. * * Copyright (C) 1998 David S. Miller (davem@redhat.com) * Copyright 2001 Jeff Garzik <jgarzik@pobox.com> * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) * Portions Copyright 2002 Intel (eli.kupermann@intel.com, * christopher.leech@intel.com, * scott.feldman@intel.com) * Portions Copyright (C) Sun Microsystems 2008 */ #ifndef _LINUX_ETHTOOL_H #define _LINUX_ETHTOOL_H #include <linux/kernel.h> #include <linux/types.h> #include <linux/if_ether.h> #include <limits.h> /* for INT_MAX */ /* All structures exposed to userland should be defined such that they * have the same layout for 32-bit and 64-bit userland. */ /* Note on reserved space. * Reserved fields must not be accessed directly by user space because * they may be replaced by a different field in the future. They must * be initialized to zero before making the request, e.g. via memset * of the entire structure or implicitly by not being set in a structure * initializer. */ /** * struct ethtool_cmd - DEPRECATED, link control and status * This structure is DEPRECATED, please use struct ethtool_link_settings. * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET * @supported: Bitmask of %SUPPORTED_* flags for the link modes, * physical connectors and other link features for which the * interface supports autonegotiation or auto-detection. * Read-only. * @advertising: Bitmask of %ADVERTISED_* flags for the link modes, * physical connectors and other link features that are * advertised through autonegotiation or enabled for * auto-detection. * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN * @duplex: Duplex mode; one of %DUPLEX_* * @port: Physical connector type; one of %PORT_* * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not * applicable. For clause 45 PHYs this is the PRTAD. * @transceiver: Historically used to distinguish different possible * PHY types, but not in a consistent way. Deprecated. * @autoneg: Enable/disable autonegotiation and auto-detection; * either %AUTONEG_DISABLE or %AUTONEG_ENABLE * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO * protocols supported by the interface; 0 if unknown. * Read-only. * @maxtxpkt: Historically used to report TX IRQ coalescing; now * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. * @maxrxpkt: Historically used to report RX IRQ coalescing; now * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of * %ETH_TP_MDI_*. If the status is unknown or not applicable, the * value will be %ETH_TP_MDI_INVALID. Read-only. * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. * When written successfully, the link should be renegotiated if * necessary. * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes * and other link features that the link partner advertised * through autonegotiation; 0 if unknown or not applicable. * Read-only. * @reserved: Reserved for future use; see the note on reserved space. * * The link speed in Mbps is split between @speed and @speed_hi. Use * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to * access it. * * If autonegotiation is disabled, the speed and @duplex represent the * fixed link mode and are writable if the driver supports multiple * link modes. If it is enabled then they are read-only; if the link * is up they represent the negotiated link mode; if the link is down, * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. * * Some hardware interfaces may have multiple PHYs and/or physical * connectors fitted or do not allow the driver to detect which are * fitted. For these interfaces @port and/or @phy_address may be * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. * Otherwise, attempts to write different values may be ignored or * rejected. * * Users should assume that all fields not marked read-only are * writable and subject to validation by the driver. They should use * %ETHTOOL_GSET to get the current values before making specific * changes and then applying them with %ETHTOOL_SSET. * * Drivers that implement set_settings() should validate all fields * other than @cmd that are not described as read-only or deprecated, * and must ignore all fields described as read-only. * * Deprecated fields should be ignored by both users and drivers. */ struct ethtool_cmd { __u32 cmd; __u32 supported; __u32 advertising; __u16 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 transceiver; __u8 autoneg; __u8 mdio_support; __u32 maxtxpkt; __u32 maxrxpkt; __u16 speed_hi; __u8 eth_tp_mdix; __u8 eth_tp_mdix_ctrl; __u32 lp_advertising; __u32 reserved[2]; }; static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep, __u32 speed) { ep->speed = (__u16)(speed & 0xFFFF); ep->speed_hi = (__u16)(speed >> 16); } static __inline__ __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) { return (ep->speed_hi << 16) | ep->speed; } /* Device supports clause 22 register access to PHY or peripherals * using the interface defined in <linux/mii.h>. This should not be * set if there are known to be no such peripherals present or if * the driver only emulates clause 22 registers for compatibility. */ #define ETH_MDIO_SUPPORTS_C22 1 /* Device supports clause 45 register access to PHY or peripherals * using the interface defined in <linux/mii.h> and <linux/mdio.h>. * This should not be set if there are known to be no such peripherals * present. */ #define ETH_MDIO_SUPPORTS_C45 2 #define ETHTOOL_FWVERS_LEN 32 #define ETHTOOL_BUSINFO_LEN 32 #define ETHTOOL_EROMVERS_LEN 32 /** * struct ethtool_drvinfo - general driver and device information * @cmd: Command number = %ETHTOOL_GDRVINFO * @driver: Driver short name. This should normally match the name * in its bus driver structure (e.g. pci_driver::name). Must * not be an empty string. * @version: Driver version string; may be an empty string * @fw_version: Firmware version string; may be an empty string * @erom_version: Expansion ROM version string; may be an empty string * @bus_info: Device bus address. This should match the dev_name() * string for the underlying bus device, if there is one. May be * an empty string. * @reserved2: Reserved for future use; see the note on reserved space. * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and * %ETHTOOL_SPFLAGS commands; also the number of strings in the * %ETH_SS_PRIV_FLAGS set * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS * command; also the number of strings in the %ETH_SS_STATS set * @testinfo_len: Number of results returned by the %ETHTOOL_TEST * command; also the number of strings in the %ETH_SS_TEST set * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM * and %ETHTOOL_SEEPROM commands, in bytes * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS * command, in bytes * * Users can use the %ETHTOOL_GSSET_INFO command to get the number of * strings in any string set (from Linux 2.6.34). * * Drivers should set at most @driver, @version, @fw_version and * @bus_info in their get_drvinfo() implementation. The ethtool * core fills in the other fields using other driver operations. */ struct ethtool_drvinfo { __u32 cmd; char driver[32]; char version[32]; char fw_version[ETHTOOL_FWVERS_LEN]; char bus_info[ETHTOOL_BUSINFO_LEN]; char erom_version[ETHTOOL_EROMVERS_LEN]; char reserved2[12]; __u32 n_priv_flags; __u32 n_stats; __u32 testinfo_len; __u32 eedump_len; __u32 regdump_len; }; #define SOPASS_MAX 6 /** * struct ethtool_wolinfo - Wake-On-Lan configuration * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes. * Read-only. * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes. * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE * is set in @wolopts. */ struct ethtool_wolinfo { __u32 cmd; __u32 supported; __u32 wolopts; __u8 sopass[SOPASS_MAX]; }; /* for passing single values */ struct ethtool_value { __u32 cmd; __u32 data; }; #define PFC_STORM_PREVENTION_AUTO 0xffff #define PFC_STORM_PREVENTION_DISABLE 0 enum tunable_id { ETHTOOL_ID_UNSPEC, ETHTOOL_RX_COPYBREAK, ETHTOOL_TX_COPYBREAK, ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */ ETHTOOL_TX_COPYBREAK_BUF_SIZE, /* * Add your fresh new tunable attribute above and remember to update * tunable_strings[] in net/ethtool/common.c */ __ETHTOOL_TUNABLE_COUNT, }; enum tunable_type_id { ETHTOOL_TUNABLE_UNSPEC, ETHTOOL_TUNABLE_U8, ETHTOOL_TUNABLE_U16, ETHTOOL_TUNABLE_U32, ETHTOOL_TUNABLE_U64, ETHTOOL_TUNABLE_STRING, ETHTOOL_TUNABLE_S8, ETHTOOL_TUNABLE_S16, ETHTOOL_TUNABLE_S32, ETHTOOL_TUNABLE_S64, }; struct ethtool_tunable { __u32 cmd; __u32 id; __u32 type_id; __u32 len; void *data[0]; }; #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff #define DOWNSHIFT_DEV_DISABLE 0 /* Time in msecs after which link is reported as down * 0 = lowest time supported by the PHY * 0xff = off, link down detection according to standard */ #define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0 #define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff /* Energy Detect Power Down (EDPD) is a feature supported by some PHYs, where * the PHY's RX & TX blocks are put into a low-power mode when there is no * link detected (typically cable is un-plugged). For RX, only a minimal * link-detection is available, and for TX the PHY wakes up to send link pulses * to avoid any lock-ups in case the peer PHY may also be running in EDPD mode. * * Some PHYs may support configuration of the wake-up interval for TX pulses, * and some PHYs may support only disabling TX pulses entirely. For the latter * a special value is required (ETHTOOL_PHY_EDPD_NO_TX) so that this can be * configured from userspace (should the user want it). * * The interval units for TX wake-up are in milliseconds, since this should * cover a reasonable range of intervals: * - from 1 millisecond, which does not sound like much of a power-saver * - to ~65 seconds which is quite a lot to wait for a link to come up when * plugging a cable */ #define ETHTOOL_PHY_EDPD_DFLT_TX_MSECS 0xffff #define ETHTOOL_PHY_EDPD_NO_TX 0xfffe #define ETHTOOL_PHY_EDPD_DISABLE 0 enum phy_tunable_id { ETHTOOL_PHY_ID_UNSPEC, ETHTOOL_PHY_DOWNSHIFT, ETHTOOL_PHY_FAST_LINK_DOWN, ETHTOOL_PHY_EDPD, /* * Add your fresh new phy tunable attribute above and remember to update * phy_tunable_strings[] in net/ethtool/common.c */ __ETHTOOL_PHY_TUNABLE_COUNT, }; /** * struct ethtool_regs - hardware register dump * @cmd: Command number = %ETHTOOL_GREGS * @version: Dump format version. This is driver-specific and may * distinguish different chips/revisions. Drivers must use new * version numbers whenever the dump format changes in an * incompatible way. * @len: On entry, the real length of @data. On return, the number of * bytes used. * @data: Buffer for the register dump * * Users should use %ETHTOOL_GDRVINFO to find the maximum length of * a register dump for the interface. They must allocate the buffer * immediately following this structure. */ struct ethtool_regs { __u32 cmd; __u32 version; __u32 len; __u8 data[0]; }; /** * struct ethtool_eeprom - EEPROM dump * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or * %ETHTOOL_SEEPROM * @magic: A 'magic cookie' value to guard against accidental changes. * The value passed in to %ETHTOOL_SEEPROM must match the value * returned by %ETHTOOL_GEEPROM for the same device. This is * unused when @cmd is %ETHTOOL_GMODULEEEPROM. * @offset: Offset within the EEPROM to begin reading/writing, in bytes * @len: On entry, number of bytes to read/write. On successful * return, number of bytes actually read/written. In case of * error, this may indicate at what point the error occurred. * @data: Buffer to read/write from * * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find * the length of an on-board or module EEPROM, respectively. They * must allocate the buffer immediately following this structure. */ struct ethtool_eeprom { __u32 cmd; __u32 magic; __u32 offset; __u32 len; __u8 data[0]; }; /** * struct ethtool_eee - Energy Efficient Ethernet information * @cmd: ETHTOOL_{G,S}EEE * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations * for which there is EEE support. * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations * advertised as eee capable. * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex * combinations advertised by the link partner as eee capable. * @eee_active: Result of the eee auto negotiation. * @eee_enabled: EEE configured mode (enabled/disabled). * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given * that eee was negotiated. * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting * its tx lpi (after reaching 'idle' state). Effective only when eee * was negotiated and tx_lpi_enabled was set. * @reserved: Reserved for future use; see the note on reserved space. */ struct ethtool_eee { __u32 cmd; __u32 supported; __u32 advertised; __u32 lp_advertised; __u32 eee_active; __u32 eee_enabled; __u32 tx_lpi_enabled; __u32 tx_lpi_timer; __u32 reserved[2]; }; /** * struct ethtool_modinfo - plugin module eeprom information * @cmd: %ETHTOOL_GMODULEINFO * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx * @eeprom_len: Length of the eeprom * @reserved: Reserved for future use; see the note on reserved space. * * This structure is used to return the information to * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. * The type code indicates the eeprom data format */ struct ethtool_modinfo { __u32 cmd; __u32 type; __u32 eeprom_len; __u32 reserved[8]; }; /** * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates * @cmd: ETHTOOL_{G,S}COALESCE * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after * a packet arrives. * @rx_max_coalesced_frames: Maximum number of packets to receive * before an RX interrupt. * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that * this value applies while an IRQ is being serviced by the host. * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames, * except that this value applies while an IRQ is being serviced * by the host. * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after * a packet is sent. * @tx_max_coalesced_frames: Maximum number of packets to be sent * before a TX interrupt. * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that * this value applies while an IRQ is being serviced by the host. * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames, * except that this value applies while an IRQ is being serviced * by the host. * @stats_block_coalesce_usecs: How many usecs to delay in-memory * statistics block updates. Some drivers do not have an * in-memory statistic block, and in such cases this value is * ignored. This value must not be zero. * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing. * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing. * @pkt_rate_low: Threshold for low packet rate (packets per second). * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after * a packet arrives, when the packet rate is below @pkt_rate_low. * @rx_max_coalesced_frames_low: Maximum number of packets to be received * before an RX interrupt, when the packet rate is below @pkt_rate_low. * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after * a packet is sent, when the packet rate is below @pkt_rate_low. * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before * a TX interrupt, when the packet rate is below @pkt_rate_low. * @pkt_rate_high: Threshold for high packet rate (packets per second). * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after * a packet arrives, when the packet rate is above @pkt_rate_high. * @rx_max_coalesced_frames_high: Maximum number of packets to be received * before an RX interrupt, when the packet rate is above @pkt_rate_high. * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after * a packet is sent, when the packet rate is above @pkt_rate_high. * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before * a TX interrupt, when the packet rate is above @pkt_rate_high. * @rate_sample_interval: How often to do adaptive coalescing packet rate * sampling, measured in seconds. Must not be zero. * * Each pair of (usecs, max_frames) fields specifies that interrupts * should be coalesced until * (usecs > 0 && time_since_first_completion >= usecs) || * (max_frames > 0 && completed_frames >= max_frames) * * It is illegal to set both usecs and max_frames to zero as this * would cause interrupts to never be generated. To disable * coalescing, set usecs = 0 and max_frames = 1. * * Some implementations ignore the value of max_frames and use the * condition time_since_first_completion >= usecs * * This is deprecated. Drivers for hardware that does not support * counting completions should validate that max_frames == !rx_usecs. * * Adaptive RX/TX coalescing is an algorithm implemented by some * drivers to improve latency under low packet rates and improve * throughput under high packet rates. Some drivers only implement * one of RX or TX adaptive coalescing. Anything not implemented by * the driver causes these values to be silently ignored. * * When the packet rate is below @pkt_rate_high but above * @pkt_rate_low (both measured in packets per second) the * normal {rx,tx}_* coalescing parameters are used. */ struct ethtool_coalesce { __u32 cmd; __u32 rx_coalesce_usecs; __u32 rx_max_coalesced_frames; __u32 rx_coalesce_usecs_irq; __u32 rx_max_coalesced_frames_irq; __u32 tx_coalesce_usecs; __u32 tx_max_coalesced_frames; __u32 tx_coalesce_usecs_irq; __u32 tx_max_coalesced_frames_irq; __u32 stats_block_coalesce_usecs; __u32 use_adaptive_rx_coalesce; __u32 use_adaptive_tx_coalesce; __u32 pkt_rate_low; __u32 rx_coalesce_usecs_low; __u32 rx_max_coalesced_frames_low; __u32 tx_coalesce_usecs_low; __u32 tx_max_coalesced_frames_low; __u32 pkt_rate_high; __u32 rx_coalesce_usecs_high; __u32 rx_max_coalesced_frames_high; __u32 tx_coalesce_usecs_high; __u32 tx_max_coalesced_frames_high; __u32 rate_sample_interval; }; /** * struct ethtool_ringparam - RX/TX ring parameters * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM * @rx_max_pending: Maximum supported number of pending entries per * RX ring. Read-only. * @rx_mini_max_pending: Maximum supported number of pending entries * per RX mini ring. Read-only. * @rx_jumbo_max_pending: Maximum supported number of pending entries * per RX jumbo ring. Read-only. * @tx_max_pending: Maximum supported number of pending entries per * TX ring. Read-only. * @rx_pending: Current maximum number of pending entries per RX ring * @rx_mini_pending: Current maximum number of pending entries per RX * mini ring * @rx_jumbo_pending: Current maximum number of pending entries per RX * jumbo ring * @tx_pending: Current maximum supported number of pending entries * per TX ring * * If the interface does not have separate RX mini and/or jumbo rings, * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0. * * There may also be driver-dependent minimum values for the number * of entries per ring. */ struct ethtool_ringparam { __u32 cmd; __u32 rx_max_pending; __u32 rx_mini_max_pending; __u32 rx_jumbo_max_pending; __u32 tx_max_pending; __u32 rx_pending; __u32 rx_mini_pending; __u32 rx_jumbo_pending; __u32 tx_pending; }; /** * struct ethtool_channels - configuring number of network channel * @cmd: ETHTOOL_{G,S}CHANNELS * @max_rx: Read only. Maximum number of receive channel the driver support. * @max_tx: Read only. Maximum number of transmit channel the driver support. * @max_other: Read only. Maximum number of other channel the driver support. * @max_combined: Read only. Maximum number of combined channel the driver * support. Set of queues RX, TX or other. * @rx_count: Valid values are in the range 1 to the max_rx. * @tx_count: Valid values are in the range 1 to the max_tx. * @other_count: Valid values are in the range 1 to the max_other. * @combined_count: Valid values are in the range 1 to the max_combined. * * This can be used to configure RX, TX and other channels. */ struct ethtool_channels { __u32 cmd; __u32 max_rx; __u32 max_tx; __u32 max_other; __u32 max_combined; __u32 rx_count; __u32 tx_count; __u32 other_count; __u32 combined_count; }; /** * struct ethtool_pauseparam - Ethernet pause (flow control) parameters * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM * @autoneg: Flag to enable autonegotiation of pause frame use * @rx_pause: Flag to enable reception of pause frames * @tx_pause: Flag to enable transmission of pause frames * * Drivers should reject a non-zero setting of @autoneg when * autoneogotiation is disabled (or not supported) for the link. * * If the link is autonegotiated, drivers should use * mii_advertise_flowctrl() or similar code to set the advertised * pause frame capabilities based on the @rx_pause and @tx_pause flags, * even if @autoneg is zero. They should also allow the advertised * pause frame capabilities to be controlled directly through the * advertising field of &struct ethtool_cmd. * * If @autoneg is non-zero, the MAC is configured to send and/or * receive pause frames according to the result of autonegotiation. * Otherwise, it is configured directly based on the @rx_pause and * @tx_pause flags. */ struct ethtool_pauseparam { __u32 cmd; __u32 autoneg; __u32 rx_pause; __u32 tx_pause; }; /* Link extended state */ enum ethtool_link_ext_state { ETHTOOL_LINK_EXT_STATE_AUTONEG, ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE, ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH, ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY, ETHTOOL_LINK_EXT_STATE_NO_CABLE, ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE, ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE, ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE, ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED, ETHTOOL_LINK_EXT_STATE_OVERHEAT, ETHTOOL_LINK_EXT_STATE_MODULE, }; /* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */ enum ethtool_link_ext_substate_autoneg { ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1, ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED, ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED, ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE, ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE, ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD, }; /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE. */ enum ethtool_link_ext_substate_link_training { ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1, ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT, ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY, ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT, }; /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH. */ enum ethtool_link_ext_substate_link_logical_mismatch { ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1, ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK, ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS, ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED, ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED, }; /* More information in addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY. */ enum ethtool_link_ext_substate_bad_signal_integrity { ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1, ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE, }; /* More information in addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. */ enum ethtool_link_ext_substate_cable_issue { ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1, ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE, }; /* More information in addition to ETHTOOL_LINK_EXT_STATE_MODULE. */ enum ethtool_link_ext_substate_module { ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY = 1, }; #define ETH_GSTRING_LEN 32 /** * enum ethtool_stringset - string set ID * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE; * now deprecated * @ETH_SS_FEATURES: Device feature names * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names * @ETH_SS_TUNABLES: tunable names * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS * @ETH_SS_PHY_TUNABLES: PHY tunable names * @ETH_SS_LINK_MODES: link mode names * @ETH_SS_MSG_CLASSES: debug message class names * @ETH_SS_WOL_MODES: wake-on-lan modes * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags * @ETH_SS_TS_TX_TYPES: timestamping Tx types * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types * @ETH_SS_STATS_STD: standardized stats * @ETH_SS_STATS_ETH_PHY: names of IEEE 802.3 PHY statistics * @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics * @ETH_SS_STATS_RMON: names of RMON statistics * * @ETH_SS_COUNT: number of defined string sets */ enum ethtool_stringset { ETH_SS_TEST = 0, ETH_SS_STATS, ETH_SS_PRIV_FLAGS, ETH_SS_NTUPLE_FILTERS, ETH_SS_FEATURES, ETH_SS_RSS_HASH_FUNCS, ETH_SS_TUNABLES, ETH_SS_PHY_STATS, ETH_SS_PHY_TUNABLES, ETH_SS_LINK_MODES, ETH_SS_MSG_CLASSES, ETH_SS_WOL_MODES, ETH_SS_SOF_TIMESTAMPING, ETH_SS_TS_TX_TYPES, ETH_SS_TS_RX_FILTERS, ETH_SS_UDP_TUNNEL_TYPES, ETH_SS_STATS_STD, ETH_SS_STATS_ETH_PHY, ETH_SS_STATS_ETH_MAC, ETH_SS_STATS_ETH_CTRL, ETH_SS_STATS_RMON, /* add new constants above here */ ETH_SS_COUNT }; /** * struct ethtool_gstrings - string set for data tagging * @cmd: Command number = %ETHTOOL_GSTRINGS * @string_set: String set ID; one of &enum ethtool_stringset * @len: On return, the number of strings in the string set * @data: Buffer for strings. Each string is null-padded to a size of * %ETH_GSTRING_LEN. * * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in * the string set. They must allocate a buffer of the appropriate * size immediately following this structure. */ struct ethtool_gstrings { __u32 cmd; __u32 string_set; __u32 len; __u8 data[0]; }; /** * struct ethtool_sset_info - string set information * @cmd: Command number = %ETHTOOL_GSSET_INFO * @reserved: Reserved for future use; see the note on reserved space. * @sset_mask: On entry, a bitmask of string sets to query, with bits * numbered according to &enum ethtool_stringset. On return, a * bitmask of those string sets queried that are supported. * @data: Buffer for string set sizes. On return, this contains the * size of each string set that was queried and supported, in * order of ID. * * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the * size of set 1 and @data[1] contains the size of set 2. * * Users must allocate a buffer of the appropriate size (4 * number of * sets queried) immediately following this structure. */ struct ethtool_sset_info { __u32 cmd; __u32 reserved; __u64 sset_mask; __u32 data[0]; }; /** * enum ethtool_test_flags - flags definition of ethtool_test * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise * only online tests. * @ETH_TEST_FL_FAILED: Driver set this flag if test fails. * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback * test. * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test */ enum ethtool_test_flags { ETH_TEST_FL_OFFLINE = (1 << 0), ETH_TEST_FL_FAILED = (1 << 1), ETH_TEST_FL_EXTERNAL_LB = (1 << 2), ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), }; /** * struct ethtool_test - device self-test invocation * @cmd: Command number = %ETHTOOL_TEST * @flags: A bitmask of flags from &enum ethtool_test_flags. Some * flags may be set by the user on entry; others may be set by * the driver on return. * @reserved: Reserved for future use; see the note on reserved space. * @len: On return, the number of test results * @data: Array of test results * * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the * number of test results that will be returned. They must allocate a * buffer of the appropriate size (8 * number of results) immediately * following this structure. */ struct ethtool_test { __u32 cmd; __u32 flags; __u32 reserved; __u32 len; __u64 data[0]; }; /** * struct ethtool_stats - device-specific statistics * @cmd: Command number = %ETHTOOL_GSTATS * @n_stats: On return, the number of statistics * @data: Array of statistics * * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the * number of statistics that will be returned. They must allocate a * buffer of the appropriate size (8 * number of statistics) * immediately following this structure. */ struct ethtool_stats { __u32 cmd; __u32 n_stats; __u64 data[0]; }; /** * struct ethtool_perm_addr - permanent hardware address * @cmd: Command number = %ETHTOOL_GPERMADDR * @size: On entry, the size of the buffer. On return, the size of the * address. The command fails if the buffer is too small. * @data: Buffer for the address * * Users must allocate the buffer immediately following this structure. * A buffer size of %MAX_ADDR_LEN should be sufficient for any address * type. */ struct ethtool_perm_addr { __u32 cmd; __u32 size; __u8 data[0]; }; /* boolean flags controlling per-interface behavior characteristics. * When reading, the flag indicates whether or not a certain behavior * is enabled/present. When writing, the flag indicates whether * or not the driver should turn on (set) or off (clear) a behavior. * * Some behaviors may read-only (unconditionally absent or present). * If such is the case, return EINVAL in the set-flags operation if the * flag differs from the read-only value. */ enum ethtool_flags { ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */ ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */ ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ ETH_FLAG_RXHASH = (1 << 28), }; /* The following structures are for supporting RX network flow * classification and RX n-tuple configuration. Note, all multibyte * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to * be in network byte order. */ /** * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. * @ip4src: Source host * @ip4dst: Destination host * @psrc: Source port * @pdst: Destination port * @tos: Type-of-service * * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. */ struct ethtool_tcpip4_spec { __be32 ip4src; __be32 ip4dst; __be16 psrc; __be16 pdst; __u8 tos; }; /** * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 * @ip4src: Source host * @ip4dst: Destination host * @spi: Security parameters index * @tos: Type-of-service * * This can be used to specify an IPsec transport or tunnel over IPv4. */ struct ethtool_ah_espip4_spec { __be32 ip4src; __be32 ip4dst; __be32 spi; __u8 tos; }; #define ETH_RX_NFC_IP4 1 /** * struct ethtool_usrip4_spec - general flow specification for IPv4 * @ip4src: Source host * @ip4dst: Destination host * @l4_4_bytes: First 4 bytes of transport (layer 4) header * @tos: Type-of-service * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 * @proto: Transport protocol number; mask must be 0 */ struct ethtool_usrip4_spec { __be32 ip4src; __be32 ip4dst; __be32 l4_4_bytes; __u8 tos; __u8 ip_ver; __u8 proto; }; /** * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc. * @ip6src: Source host * @ip6dst: Destination host * @psrc: Source port * @pdst: Destination port * @tclass: Traffic Class * * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow. */ struct ethtool_tcpip6_spec { __be32 ip6src[4]; __be32 ip6dst[4]; __be16 psrc; __be16 pdst; __u8 tclass; }; /** * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6 * @ip6src: Source host * @ip6dst: Destination host * @spi: Security parameters index * @tclass: Traffic Class * * This can be used to specify an IPsec transport or tunnel over IPv6. */ struct ethtool_ah_espip6_spec { __be32 ip6src[4]; __be32 ip6dst[4]; __be32 spi; __u8 tclass; }; /** * struct ethtool_usrip6_spec - general flow specification for IPv6 * @ip6src: Source host * @ip6dst: Destination host * @l4_4_bytes: First 4 bytes of transport (layer 4) header * @tclass: Traffic Class * @l4_proto: Transport protocol number (nexthdr after any Extension Headers) */ struct ethtool_usrip6_spec { __be32 ip6src[4]; __be32 ip6dst[4]; __be32 l4_4_bytes; __u8 tclass; __u8 l4_proto; }; union ethtool_flow_union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethtool_tcpip6_spec tcp_ip6_spec; struct ethtool_tcpip6_spec udp_ip6_spec; struct ethtool_tcpip6_spec sctp_ip6_spec; struct ethtool_ah_espip6_spec ah_ip6_spec; struct ethtool_ah_espip6_spec esp_ip6_spec; struct ethtool_usrip6_spec usr_ip6_spec; struct ethhdr ether_spec; __u8 hdata[52]; }; /** * struct ethtool_flow_ext - additional RX flow fields * @h_dest: destination MAC address * @vlan_etype: VLAN EtherType * @vlan_tci: VLAN tag control information * @data: user defined data * @padding: Reserved for future use; see the note on reserved space. * * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT * is set in &struct ethtool_rx_flow_spec @flow_type. * @h_dest is valid if %FLOW_MAC_EXT is set. */ struct ethtool_flow_ext { __u8 padding[2]; unsigned char h_dest[ETH_ALEN]; __be16 vlan_etype; __be16 vlan_tci; __be32 data[2]; }; /** * struct ethtool_rx_flow_spec - classification rule for RX flows * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW * @h_u: Flow fields to match (dependent on @flow_type) * @h_ext: Additional fields to match * @m_u: Masks for flow field bits to be matched * @m_ext: Masks for additional field bits to be matched * Note, all additional fields must be ignored unless @flow_type * includes the %FLOW_EXT or %FLOW_MAC_EXT flag * (see &struct ethtool_flow_ext description). * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the * packets should be used for Wake-on-LAN with %WAKE_FILTER * @location: Location of rule in the table. Locations must be * numbered such that a flow matching multiple rules will be * classified according to the first (lowest numbered) rule. */ struct ethtool_rx_flow_spec { __u32 flow_type; union ethtool_flow_union h_u; struct ethtool_flow_ext h_ext; union ethtool_flow_union m_u; struct ethtool_flow_ext m_ext; __u64 ring_cookie; __u32 location; }; /* How rings are laid out when accessing virtual functions or * offloaded queues is device specific. To allow users to do flow * steering and specify these queues the ring cookie is partitioned * into a 32bit queue index with an 8 bit virtual function id. * This also leaves the 3bytes for further specifiers. It is possible * future devices may support more than 256 virtual functions if * devices start supporting PCIe w/ARI. However at the moment I * do not know of any devices that support this so I do not reserve * space for this at this time. If a future patch consumes the next * byte it should be aware of this possibility. */ #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32 static __inline__ __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) { return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie; } static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) { return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; } /** * struct ethtool_rxnfc - command to get or set RX flow classification rules * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH, * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE, * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW * @data: Command-dependent value * @fs: Flow classification rule * @rss_context: RSS context to be affected * @rule_cnt: Number of rules to be affected * @rule_locs: Array of used rule locations * * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following * structure fields must not be used, except that if @flow_type includes * the %FLOW_RSS flag, then @rss_context determines which RSS context to * act on. * * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues * on return. * * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined * rules on return. If @data is non-zero on return then it is the * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the * driver supports any special location values. If that flag is not * set in @data then special location values should not be used. * * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an * existing rule on entry and @fs contains the rule on return; if * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is * filled with the RSS context ID associated with the rule. * * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the * user buffer for @rule_locs on entry. On return, @data is the size * of the rule table, @rule_cnt is the number of defined rules, and * @rule_locs contains the locations of the defined rules. Drivers * must use the second parameter to get_rxnfc() instead of @rule_locs. * * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. * @fs.@location either specifies the location to use or is a special * location value with %RX_CLS_LOC_SPECIAL flag set. On return, * @fs.@location is the actual rule location. If @fs.@flow_type * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to * use for flow spreading traffic which matches this rule. The value * from the rxfh indirection table will be added to @fs.@ring_cookie * to choose which ring to deliver to. * * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an * existing rule on entry. * * A driver supporting the special location values for * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused * location, and may remove a rule at a later location (lower * priority) that matches exactly the same set of flows. The special * values are %RX_CLS_LOC_ANY, selecting any location; * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum * priority); and %RX_CLS_LOC_LAST, selecting the last suitable * location (minimum priority). Additional special values may be * defined in future and drivers must return -%EINVAL for any * unrecognised value. */ struct ethtool_rxnfc { __u32 cmd; __u32 flow_type; __u64 data; struct ethtool_rx_flow_spec fs; union { __u32 rule_cnt; __u32 rss_context; }; __u32 rule_locs[0]; }; /** * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR * @size: On entry, the array size of the user buffer, which may be zero. * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware * indirection table. * @ring_index: RX ring/queue index for each hash value * * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means * the table should be reset to default values. This last feature * is not supported by the original implementations. */ struct ethtool_rxfh_indir { __u32 cmd; __u32 size; __u32 ring_index[0]; }; /** * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key. * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH * @rss_context: RSS context identifier. Context 0 is the default for normal * traffic; other contexts can be referenced as the destination for RX flow * classification rules. %ETH_RXFH_CONTEXT_ALLOC is used with command * %ETHTOOL_SRSSH to allocate a new RSS context; on return this field will * contain the ID of the newly allocated context. * @indir_size: On entry, the array size of the user buffer for the * indirection table, which may be zero, or (for %ETHTOOL_SRSSH), * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH, * the array size of the hardware indirection table. * @key_size: On entry, the array size of the user buffer for the hash key, * which may be zero. On return from %ETHTOOL_GRSSH, the size of the * hardware hash key. * @hfunc: Defines the current RSS hash function used by HW (or to be set to). * Valid values are one of the %ETH_RSS_HASH_*. * @rsvd8: Reserved for future use; see the note on reserved space. * @rsvd32: Reserved for future use; see the note on reserved space. * @rss_config: RX ring/queue index for each hash value i.e., indirection table * of @indir_size __u32 elements, followed by hash key of @key_size * bytes. * * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested * and a @indir_size of zero means the indir table should be reset to default * values (if @rss_context == 0) or that the RSS context should be deleted. * An hfunc of zero means that hash function setting is not requested. */ struct ethtool_rxfh { __u32 cmd; __u32 rss_context; __u32 indir_size; __u32 key_size; __u8 hfunc; __u8 rsvd8[3]; __u32 rsvd32; __u32 rss_config[0]; }; #define ETH_RXFH_CONTEXT_ALLOC 0xffffffff #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff /** * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW * @h_u: Flow field values to match (dependent on @flow_type) * @m_u: Masks for flow field value bits to be ignored * @vlan_tag: VLAN tag to match * @vlan_tag_mask: Mask for VLAN tag bits to be ignored * @data: Driver-dependent data to match * @data_mask: Mask for driver-dependent data bits to be ignored * @action: RX ring/queue index to deliver to (non-negative) or other action * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP) * * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where * a field value and mask are both zero this is treated as if all mask * bits are set i.e. the field is ignored. */ struct ethtool_rx_ntuple_flow_spec { __u32 flow_type; union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethhdr ether_spec; __u8 hdata[72]; } h_u, m_u; __u16 vlan_tag; __u16 vlan_tag_mask; __u64 data; __u64 data_mask; __s32 action; #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */ #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */ }; /** * struct ethtool_rx_ntuple - command to set or clear RX flow filter * @cmd: Command number - %ETHTOOL_SRXNTUPLE * @fs: Flow filter specification */ struct ethtool_rx_ntuple { __u32 cmd; struct ethtool_rx_ntuple_flow_spec fs; }; #define ETHTOOL_FLASH_MAX_FILENAME 128 enum ethtool_flash_op_type { ETHTOOL_FLASH_ALL_REGIONS = 0, }; /* for passing firmware flashing related parameters */ struct ethtool_flash { __u32 cmd; __u32 region; char data[ETHTOOL_FLASH_MAX_FILENAME]; }; /** * struct ethtool_dump - used for retrieving, setting device dump * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or * %ETHTOOL_SET_DUMP * @version: FW version of the dump, filled in by driver * @flag: driver dependent flag for dump setting, filled in by driver during * get and filled in by ethtool for set operation. * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when * firmware dump is disabled. * @len: length of dump data, used as the length of the user buffer on entry to * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver * for %ETHTOOL_GET_DUMP_FLAG command * @data: data collected for get dump data operation */ struct ethtool_dump { __u32 cmd; __u32 version; __u32 flag; __u32 len; __u8 data[0]; }; #define ETH_FW_DUMP_DISABLE 0 /* for returning and changing feature sets */ /** * struct ethtool_get_features_block - block with state of 32 features * @available: mask of changeable features * @requested: mask of features requested to be enabled if possible * @active: mask of currently enabled features * @never_changed: mask of features not changeable for any device */ struct ethtool_get_features_block { __u32 available; __u32 requested; __u32 active; __u32 never_changed; }; /** * struct ethtool_gfeatures - command to get state of device's features * @cmd: command number = %ETHTOOL_GFEATURES * @size: On entry, the number of elements in the features[] array; * on return, the number of elements in features[] needed to hold * all features * @features: state of features */ struct ethtool_gfeatures { __u32 cmd; __u32 size; struct ethtool_get_features_block features[0]; }; /** * struct ethtool_set_features_block - block with request for 32 features * @valid: mask of features to be changed * @requested: values of features to be changed */ struct ethtool_set_features_block { __u32 valid; __u32 requested; }; /** * struct ethtool_sfeatures - command to request change in device's features * @cmd: command number = %ETHTOOL_SFEATURES * @size: array size of the features[] array * @features: feature change masks */ struct ethtool_sfeatures { __u32 cmd; __u32 size; struct ethtool_set_features_block features[0]; }; /** * struct ethtool_ts_info - holds a device's timestamping and PHC association * @cmd: command number = %ETHTOOL_GET_TS_INFO * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags * @phc_index: device index of the associated PHC, or -1 if there is none * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values * @tx_reserved: Reserved for future use; see the note on reserved space. * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values * @rx_reserved: Reserved for future use; see the note on reserved space. * * The bits in the 'tx_types' and 'rx_filters' fields correspond to * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values, * respectively. For example, if the device supports HWTSTAMP_TX_ON, * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set. * * Drivers should only report the filters they actually support without * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op. */ struct ethtool_ts_info { __u32 cmd; __u32 so_timestamping; __s32 phc_index; __u32 tx_types; __u32 tx_reserved[3]; __u32 rx_filters; __u32 rx_reserved[3]; }; /* * %ETHTOOL_SFEATURES changes features present in features[].valid to the * values of corresponding bits in features[].requested. Bits in .requested * not set in .valid or not changeable are ignored. * * Returns %EINVAL when .valid contains undefined or never-changeable bits * or size is not equal to required number of features words (32-bit blocks). * Returns >= 0 if request was completed; bits set in the value mean: * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not * changeable (not present in %ETHTOOL_GFEATURES' features[].available) * those bits were ignored. * %ETHTOOL_F_WISH - some or all changes requested were recorded but the * resulting state of bits masked by .valid is not equal to .requested. * Probably there are other device-specific constraints on some features * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered * here as though ignored bits were cleared. * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling * compatibility functions. Requested offload state cannot be properly * managed by kernel. * * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands * for ETH_SS_FEATURES string set. First entry in the table corresponds to least * significant bit in features[0] fields. Empty strings mark undefined features. */ enum ethtool_sfeatures_retval_bits { ETHTOOL_F_UNSUPPORTED__BIT, ETHTOOL_F_WISH__BIT, ETHTOOL_F_COMPAT__BIT, }; #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) #define MAX_NUM_QUEUE 4096 /** * struct ethtool_per_queue_op - apply sub command to the queues in mask. * @cmd: ETHTOOL_PERQUEUE * @sub_command: the sub command which apply to each queues * @queue_mask: Bitmap of the queues which sub command apply to * @data: A complete command structure following for each of the queues addressed */ struct ethtool_per_queue_op { __u32 cmd; __u32 sub_command; __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)]; char data[]; }; /** * struct ethtool_fecparam - Ethernet Forward Error Correction parameters * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM * @active_fec: FEC mode which is active on the port, single bit set, GET only. * @fec: Bitmask of configured FEC modes. * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET. * * Note that @reserved was never validated on input and ethtool user space * left it uninitialized when calling SET. Hence going forward it can only be * used to return a value to userspace with GET. * * FEC modes supported by the device can be read via %ETHTOOL_GLINKSETTINGS. * FEC settings are configured by link autonegotiation whenever it's enabled. * With autoneg on %ETHTOOL_GFECPARAM can be used to read the current mode. * * When autoneg is disabled %ETHTOOL_SFECPARAM controls the FEC settings. * It is recommended that drivers only accept a single bit set in @fec. * When multiple bits are set in @fec drivers may pick mode in an implementation * dependent way. Drivers should reject mixing %ETHTOOL_FEC_AUTO_BIT with other * FEC modes, because it's unclear whether in this case other modes constrain * AUTO or are independent choices. * Drivers must reject SET requests if they support none of the requested modes. * * If device does not support FEC drivers may use %ETHTOOL_FEC_NONE instead * of returning %EOPNOTSUPP from %ETHTOOL_GFECPARAM. * * See enum ethtool_fec_config_bits for definition of valid bits for both * @fec and @active_fec. */ struct ethtool_fecparam { __u32 cmd; /* bitmask of FEC modes */ __u32 active_fec; __u32 fec; __u32 reserved; }; /** * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration * @ETHTOOL_FEC_NONE_BIT: FEC mode configuration is not supported. Should not * be used together with other bits. GET only. * @ETHTOOL_FEC_AUTO_BIT: Select default/best FEC mode automatically, usually * based link mode and SFP parameters read from module's * EEPROM. This bit does _not_ mean autonegotiation. * @ETHTOOL_FEC_OFF_BIT: No FEC Mode * @ETHTOOL_FEC_RS_BIT: Reed-Solomon FEC Mode * @ETHTOOL_FEC_BASER_BIT: Base-R/Reed-Solomon FEC Mode * @ETHTOOL_FEC_LLRS_BIT: Low Latency Reed Solomon FEC Mode (25G/50G Ethernet * Consortium) */ enum ethtool_fec_config_bits { ETHTOOL_FEC_NONE_BIT, ETHTOOL_FEC_AUTO_BIT, ETHTOOL_FEC_OFF_BIT, ETHTOOL_FEC_RS_BIT, ETHTOOL_FEC_BASER_BIT, ETHTOOL_FEC_LLRS_BIT, }; #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT) #define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT) #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT) #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT) #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT) #define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT) /* CMDs currently supported */ #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings. * Please use ETHTOOL_GLINKSETTINGS */ #define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings. * Please use ETHTOOL_SLINKSETTINGS */ #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ /* Get link status for host, i.e. whether the interface *and* the * physical port (if there is one) are up (ethtool_value). */ #define ETHTOOL_GLINK 0x0000000a #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable * (ethtool_value) */ #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable * (ethtool_value). */ #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */ #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */ #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */ #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */ #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */ #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */ #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */ #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */ #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */ #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ #define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */ #define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */ #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ #define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */ #define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */ #define ETHTOOL_GFECPARAM 0x00000050 /* Get FEC settings */ #define ETHTOOL_SFECPARAM 0x00000051 /* Set FEC settings */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET #define SPARC_ETH_SSET ETHTOOL_SSET /* Link mode bit indices */ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0, ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1, ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2, ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3, ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4, ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5, ETHTOOL_LINK_MODE_Autoneg_BIT = 6, ETHTOOL_LINK_MODE_TP_BIT = 7, ETHTOOL_LINK_MODE_AUI_BIT = 8, ETHTOOL_LINK_MODE_MII_BIT = 9, ETHTOOL_LINK_MODE_FIBRE_BIT = 10, ETHTOOL_LINK_MODE_BNC_BIT = 11, ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12, ETHTOOL_LINK_MODE_Pause_BIT = 13, ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14, ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15, ETHTOOL_LINK_MODE_Backplane_BIT = 16, ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17, ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18, ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19, ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20, ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21, ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22, ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23, ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24, ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25, ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26, ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27, ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28, ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29, ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30, ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31, /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* * macro for bits > 31. The only way to use indices > 31 is to * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. */ ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32, ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33, ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34, ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35, ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36, ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37, ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38, ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39, ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40, ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41, ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42, ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43, ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49, ETHTOOL_LINK_MODE_FEC_RS_BIT = 50, ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51, ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 52, ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 53, ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 54, ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 55, ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 56, ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 57, ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 58, ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 59, ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 60, ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 61, ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 62, ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 63, ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64, ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65, ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66, ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67, ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68, ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 69, ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 70, ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71, ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72, ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73, ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74, ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75, ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76, ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77, ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78, ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79, ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80, ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81, ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82, ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83, ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84, ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85, ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86, ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87, ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88, ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89, ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90, ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91, /* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS, /* RHEL: Last known value for RHEL 8.0 needed for emulation layer * for old binary drivers compiled against RHEL 8.0 */ __ETHTOOL_LINK_MODE_LAST_RH80 = ETHTOOL_LINK_MODE_FEC_BASER_BIT, #ifdef __GENKSYMS__ /* RHEL: Enum __ETHTOOL_LINK_MODE_LAST and its value is protected by * KABI checker. * We also need to define __ETHTOOL_LINK_MODE_MASK_NBITS as macro * for KABI checker to preserve existing checksums of several * ethtool symbols. */ __ETHTOOL_LINK_MODE_LAST = __ETHTOOL_LINK_MODE_LAST_RH80, #define __ETHTOOL_LINK_MODE_MASK_NBITS (__ETHTOOL_LINK_MODE_LAST + 1) #endif }; #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \ (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT)) /* DEPRECATED macros. Please migrate to * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT * define any new SUPPORTED_* macro for bits > 31. */ #define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) #define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) #define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) #define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) #define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) #define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) #define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) #define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) #define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) #define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) #define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) #define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) #define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) #define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) #define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) #define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) #define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) #define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) #define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) #define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) #define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) #define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) #define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) #define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) #define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) #define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) #define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) #define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) #define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) #define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) #define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) /* Please do not define any new SUPPORTED_* macro for bits > 31, see * notice above. */ /* * DEPRECATED macros. Please migrate to * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT * define any new ADERTISE_* macro for bits > 31. */ #define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) #define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) #define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) #define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) #define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) #define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) #define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) #define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) #define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) #define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) #define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) #define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) #define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) #define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) #define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) #define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) #define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) #define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) #define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) #define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) #define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) #define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) #define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) #define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) #define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) #define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) #define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) #define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) #define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) #define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) #define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) /* Please do not define any new ADVERTISED_* macro for bits > 31, see * notice above. */ /* The following are all involved in forcing a particular link * mode for the device for setting things. When getting the * devices settings, these indicate the current mode and whether * it was forced up into this mode or autonegotiated. */ /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. * Update drivers/net/phy/phy.c:phy_speed_to_str() and * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. */ #define SPEED_10 10 #define SPEED_100 100 #define SPEED_1000 1000 #define SPEED_2500 2500 #define SPEED_5000 5000 #define SPEED_10000 10000 #define SPEED_14000 14000 #define SPEED_20000 20000 #define SPEED_25000 25000 #define SPEED_40000 40000 #define SPEED_50000 50000 #define SPEED_56000 56000 #define SPEED_100000 100000 #define SPEED_200000 200000 #define SPEED_400000 400000 #define SPEED_UNKNOWN -1 static __inline__ int ethtool_validate_speed(__u32 speed) { return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN; } /* Duplex, half or full. */ #define DUPLEX_HALF 0x00 #define DUPLEX_FULL 0x01 #define DUPLEX_UNKNOWN 0xff static __inline__ int ethtool_validate_duplex(__u8 duplex) { switch (duplex) { case DUPLEX_HALF: case DUPLEX_FULL: case DUPLEX_UNKNOWN: return 1; } return 0; } #define MASTER_SLAVE_CFG_UNSUPPORTED 0 #define MASTER_SLAVE_CFG_UNKNOWN 1 #define MASTER_SLAVE_CFG_MASTER_PREFERRED 2 #define MASTER_SLAVE_CFG_SLAVE_PREFERRED 3 #define MASTER_SLAVE_CFG_MASTER_FORCE 4 #define MASTER_SLAVE_CFG_SLAVE_FORCE 5 #define MASTER_SLAVE_STATE_UNSUPPORTED 0 #define MASTER_SLAVE_STATE_UNKNOWN 1 #define MASTER_SLAVE_STATE_MASTER 2 #define MASTER_SLAVE_STATE_SLAVE 3 #define MASTER_SLAVE_STATE_ERR 4 /* Which connector port. */ #define PORT_TP 0x00 #define PORT_AUI 0x01 #define PORT_MII 0x02 #define PORT_FIBRE 0x03 #define PORT_BNC 0x04 #define PORT_DA 0x05 #define PORT_NONE 0xef #define PORT_OTHER 0xff /* Which transceiver to use. */ #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */ #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */ #define XCVR_DUMMY1 0x02 #define XCVR_DUMMY2 0x03 #define XCVR_DUMMY3 0x04 /* Enable or disable autonegotiation. */ #define AUTONEG_DISABLE 0x00 #define AUTONEG_ENABLE 0x01 /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then * the driver is required to renegotiate link */ #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */ #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */ #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */ #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */ /* Wake-On-Lan options. */ #define WAKE_PHY (1 << 0) #define WAKE_UCAST (1 << 1) #define WAKE_MCAST (1 << 2) #define WAKE_BCAST (1 << 3) #define WAKE_ARP (1 << 4) #define WAKE_MAGIC (1 << 5) #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ #define WAKE_FILTER (1 << 7) #define WOL_MODE_COUNT 8 /* L2-L4 network traffic flow types */ #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ #define AH_ESP_V4_FLOW 0x04 /* hash only */ #define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */ #define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */ #define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */ #define AH_ESP_V6_FLOW 0x08 /* hash only */ #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ #define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */ #define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */ #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ #define IP_USER_FLOW IPV4_USER_FLOW #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */ #define IPV4_FLOW 0x10 /* hash only */ #define IPV6_FLOW 0x11 /* hash only */ #define ETHER_FLOW 0x12 /* spec only (ether_spec) */ /* Flag to enable additional fields in struct ethtool_rx_flow_spec */ #define FLOW_EXT 0x80000000 #define FLOW_MAC_EXT 0x40000000 /* Flag to enable RSS spreading of traffic matching rule (nfc only) */ #define FLOW_RSS 0x20000000 /* L3-L4 network traffic flow hash options */ #define RXH_L2DA (1 << 1) #define RXH_VLAN (1 << 2) #define RXH_L3_PROTO (1 << 3) #define RXH_IP_SRC (1 << 4) #define RXH_IP_DST (1 << 5) #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ #define RXH_DISCARD (1 << 31) #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL #define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL /* Special RX classification rule insert location values */ #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */ #define RX_CLS_LOC_ANY 0xffffffff #define RX_CLS_LOC_FIRST 0xfffffffe #define RX_CLS_LOC_LAST 0xfffffffd /* EEPROM Standards for plug in modules */ #define ETH_MODULE_SFF_8079 0x1 #define ETH_MODULE_SFF_8079_LEN 256 #define ETH_MODULE_SFF_8472 0x2 #define ETH_MODULE_SFF_8472_LEN 512 #define ETH_MODULE_SFF_8636 0x3 #define ETH_MODULE_SFF_8636_LEN 256 #define ETH_MODULE_SFF_8436 0x4 #define ETH_MODULE_SFF_8436_LEN 256 #define ETH_MODULE_SFF_8636_MAX_LEN 640 #define ETH_MODULE_SFF_8436_MAX_LEN 640 /* Reset flags */ /* The reset() operation must clear the flags for the components which * were actually reset. On successful return, the flags indicate the * components which were not reset, either because they do not exist * in the hardware or because they cannot be reset independently. The * driver must never reset any components that were not requested. */ enum ethtool_reset_flags { /* These flags represent components dedicated to the interface * the command is addressed to. Shift any flag left by * ETH_RESET_SHARED_SHIFT to reset a shared component of the * same type. */ ETH_RESET_MGMT = 1 << 0, /* Management processor */ ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */ ETH_RESET_DMA = 1 << 2, /* DMA engine */ ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */ ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */ ETH_RESET_MAC = 1 << 5, /* Media access controller */ ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ ETH_RESET_RAM = 1 << 7, /* RAM shared between * multiple components */ ETH_RESET_AP = 1 << 8, /* Application processor */ ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to * this interface */ ETH_RESET_ALL = 0xffffffff, /* All components used by this * interface, even if shared */ }; #define ETH_RESET_SHARED_SHIFT 16 /** * struct ethtool_link_settings - link control and status * * IMPORTANT, Backward compatibility notice: When implementing new * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link * settings; do not use %ETHTOOL_SLINKSETTINGS if * %ETHTOOL_GLINKSETTINGS failed: stick to * %ETHTOOL_GSET/%ETHTOOL_SSET in that case. * * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS * @speed: Link speed (Mbps) * @duplex: Duplex mode; one of %DUPLEX_* * @port: Physical connector type; one of %PORT_* * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not * applicable. For clause 45 PHYs this is the PRTAD. * @autoneg: Enable/disable autonegotiation and auto-detection; * either %AUTONEG_DISABLE or %AUTONEG_ENABLE * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO * protocols supported by the interface; 0 if unknown. * Read-only. * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of * %ETH_TP_MDI_*. If the status is unknown or not applicable, the * value will be %ETH_TP_MDI_INVALID. Read-only. * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. * When written successfully, the link should be renegotiated if * necessary. * @link_mode_masks_nwords: Number of 32-bit words for each of the * supported, advertising, lp_advertising link mode bitmaps. For * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user * (>= 0); on return, if handshake in progress, negative if * request size unsupported by kernel: absolute value indicates * kernel expected size and all the other fields but cmd * are 0; otherwise (handshake completed), strictly positive * to indicate size used by kernel and cmd field stays * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise * refused. For drivers: ignore this field (use kernel's * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will * be overwritten by kernel. * @supported: Bitmap with each bit meaning given by * %ethtool_link_mode_bit_indices for the link modes, physical * connectors and other link features for which the interface * supports autonegotiation or auto-detection. Read-only. * @advertising: Bitmap with each bit meaning given by * %ethtool_link_mode_bit_indices for the link modes, physical * connectors and other link features that are advertised through * autonegotiation or enabled for auto-detection. * @lp_advertising: Bitmap with each bit meaning given by * %ethtool_link_mode_bit_indices for the link modes, and other * link features that the link partner advertised through * autonegotiation; 0 if unknown or not applicable. Read-only. * @transceiver: Used to distinguish different possible PHY types, * reported consistently by PHYLIB. Read-only. * @master_slave_cfg: Master/slave port mode. * @master_slave_state: Master/slave port state. * @reserved: Reserved for future use; see the note on reserved space. * @reserved1: Reserved for future use; see the note on reserved space. * @link_mode_masks: Variable length bitmaps. * * If autonegotiation is disabled, the speed and @duplex represent the * fixed link mode and are writable if the driver supports multiple * link modes. If it is enabled then they are read-only; if the link * is up they represent the negotiated link mode; if the link is down, * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. * * Some hardware interfaces may have multiple PHYs and/or physical * connectors fitted or do not allow the driver to detect which are * fitted. For these interfaces @port and/or @phy_address may be * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. * Otherwise, attempts to write different values may be ignored or * rejected. * * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt * are not available in %ethtool_link_settings. Until all drivers are * converted to ignore them or to the new %ethtool_link_settings API, * for both queries and changes, users should always try * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing * either %ethtool_cmd or %ethtool_link_settings). * * Users should assume that all fields not marked read-only are * writable and subject to validation by the driver. They should use * %ETHTOOL_GLINKSETTINGS to get the current values before making specific * changes and then applying them with %ETHTOOL_SLINKSETTINGS. * * Drivers that implement %get_link_ksettings and/or * %set_link_ksettings should ignore the @cmd * and @link_mode_masks_nwords fields (any change to them overwritten * by kernel), and rely only on kernel's internal * %__ETHTOOL_LINK_MODE_MASK_NBITS and * %ethtool_link_mode_mask_t. Drivers that implement * %set_link_ksettings() should validate all fields other than @cmd * and @link_mode_masks_nwords that are not described as read-only or * deprecated, and must ignore all fields described as read-only. */ struct ethtool_link_settings { __u32 cmd; __u32 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 autoneg; __u8 mdio_support; __u8 eth_tp_mdix; __u8 eth_tp_mdix_ctrl; __s8 link_mode_masks_nwords; __u8 transceiver; #ifndef __GENKSYMS__ __u8 master_slave_cfg; __u8 master_slave_state; __u8 reserved1[1]; #else __u8 reserved1[3]; #endif __u32 reserved[7]; __u32 link_mode_masks[0]; /* layout of link_mode_masks fields: * __u32 map_supported[link_mode_masks_nwords]; * __u32 map_advertising[link_mode_masks_nwords]; * __u32 map_lp_advertising[link_mode_masks_nwords]; */ }; #endif /* _LINUX_ETHTOOL_H */ linux/eventpoll.h 0000644 00000005256 15063602047 0010077 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/linux/eventpoll.h ( Efficient event polling implementation ) * Copyright (C) 2001,...,2006 Davide Libenzi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Davide Libenzi <davidel@xmailserver.org> * */ #ifndef _LINUX_EVENTPOLL_H #define _LINUX_EVENTPOLL_H /* For O_CLOEXEC */ #include <linux/fcntl.h> #include <linux/types.h> /* Flags for epoll_create1. */ #define EPOLL_CLOEXEC O_CLOEXEC /* Valid opcodes to issue to sys_epoll_ctl() */ #define EPOLL_CTL_ADD 1 #define EPOLL_CTL_DEL 2 #define EPOLL_CTL_MOD 3 /* Epoll event masks */ #define EPOLLIN (__poll_t)0x00000001 #define EPOLLPRI (__poll_t)0x00000002 #define EPOLLOUT (__poll_t)0x00000004 #define EPOLLERR (__poll_t)0x00000008 #define EPOLLHUP (__poll_t)0x00000010 #define EPOLLNVAL (__poll_t)0x00000020 #define EPOLLRDNORM (__poll_t)0x00000040 #define EPOLLRDBAND (__poll_t)0x00000080 #define EPOLLWRNORM (__poll_t)0x00000100 #define EPOLLWRBAND (__poll_t)0x00000200 #define EPOLLMSG (__poll_t)0x00000400 #define EPOLLRDHUP (__poll_t)0x00002000 /* Set exclusive wakeup mode for the target file descriptor */ #define EPOLLEXCLUSIVE (__poll_t)(1U << 28) /* * Request the handling of system wakeup events so as to prevent system suspends * from happening while those events are being processed. * * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be * re-allowed until epoll_wait is called again after consuming the wakeup * event(s). * * Requires CAP_BLOCK_SUSPEND */ #define EPOLLWAKEUP (__poll_t)(1U << 29) /* Set the One Shot behaviour for the target file descriptor */ #define EPOLLONESHOT (__poll_t)(1U << 30) /* Set the Edge Triggered behaviour for the target file descriptor */ #define EPOLLET (__poll_t)(1U << 31) /* * On x86-64 make the 64bit structure have the same alignment as the * 32bit structure. This makes 32bit emulation easier. * * UML/x86_64 needs the same packing as x86_64 */ #ifdef __x86_64__ #define EPOLL_PACKED __attribute__((packed)) #else #define EPOLL_PACKED #endif struct epoll_event { __poll_t events; __u64 data; } EPOLL_PACKED; #ifdef CONFIG_PM_SLEEP static __inline__ void ep_take_care_of_epollwakeup(struct epoll_event *epev) { if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) epev->events &= ~EPOLLWAKEUP; } #else static __inline__ void ep_take_care_of_epollwakeup(struct epoll_event *epev) { epev->events &= ~EPOLLWAKEUP; } #endif #endif /* _LINUX_EVENTPOLL_H */ linux/fadvise.h 0000644 00000001512 15063602047 0007477 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef FADVISE_H_INCLUDED #define FADVISE_H_INCLUDED #define POSIX_FADV_NORMAL 0 /* No further special treatment. */ #define POSIX_FADV_RANDOM 1 /* Expect random page references. */ #define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ #define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ /* * The advise values for POSIX_FADV_DONTNEED and POSIX_ADV_NOREUSE * for s390-64 differ from the values for the rest of the world. */ #if defined(__s390x__) #define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ #define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ #else #define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ #define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif #endif /* FADVISE_H_INCLUDED */ linux/fanotify.h 0000644 00000012335 15063602047 0007702 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FANOTIFY_H #define _LINUX_FANOTIFY_H #include <linux/types.h> /* the following events that user-space can register for */ #define FAN_ACCESS 0x00000001 /* File was accessed */ #define FAN_MODIFY 0x00000002 /* File was modified */ #define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */ #define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ #define FAN_OPEN 0x00000020 /* File was opened */ #define FAN_OPEN_EXEC 0x00001000 /* File was opened for exec */ #define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ #define FAN_OPEN_PERM 0x00010000 /* File open in perm check */ #define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */ #define FAN_OPEN_EXEC_PERM 0x00040000 /* File open/exec in perm check */ #define FAN_ONDIR 0x40000000 /* event occurred against dir */ #define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */ /* helper events */ #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */ /* flags used for fanotify_init() */ #define FAN_CLOEXEC 0x00000001 #define FAN_NONBLOCK 0x00000002 /* These are NOT bitwise flags. Both bits are used together. */ #define FAN_CLASS_NOTIF 0x00000000 #define FAN_CLASS_CONTENT 0x00000004 #define FAN_CLASS_PRE_CONTENT 0x00000008 /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \ FAN_CLASS_PRE_CONTENT) #define FAN_UNLIMITED_QUEUE 0x00000010 #define FAN_UNLIMITED_MARKS 0x00000020 #define FAN_ENABLE_AUDIT 0x00000040 /* Flags to determine fanotify event format */ #define FAN_REPORT_TID 0x00000100 /* event->pid is thread id */ /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\ FAN_UNLIMITED_MARKS) /* flags used for fanotify_modify_mark() */ #define FAN_MARK_ADD 0x00000001 #define FAN_MARK_REMOVE 0x00000002 #define FAN_MARK_DONT_FOLLOW 0x00000004 #define FAN_MARK_ONLYDIR 0x00000008 /* FAN_MARK_MOUNT is 0x00000010 */ #define FAN_MARK_IGNORED_MASK 0x00000020 #define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040 #define FAN_MARK_FLUSH 0x00000080 /* FAN_MARK_FILESYSTEM is 0x00000100 */ /* These are NOT bitwise flags. Both bits can be used togther. */ #define FAN_MARK_INODE 0x00000000 #define FAN_MARK_MOUNT 0x00000010 #define FAN_MARK_FILESYSTEM 0x00000100 /* These are NOT bitwise flags. Both bits can be used togther. */ #define FAN_MARK_INODE 0x00000000 #define FAN_MARK_MOUNT 0x00000010 /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\ FAN_MARK_REMOVE |\ FAN_MARK_DONT_FOLLOW |\ FAN_MARK_ONLYDIR |\ FAN_MARK_IGNORED_MASK |\ FAN_MARK_IGNORED_SURV_MODIFY |\ FAN_MARK_FLUSH|\ FAN_MARK_TYPE_MASK) /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_EVENTS (FAN_ACCESS |\ FAN_MODIFY |\ FAN_CLOSE |\ FAN_OPEN) /* * All events which require a permission response from userspace */ /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\ FAN_ACCESS_PERM) /* Deprecated - do not use this in programs and do not add new flags here! */ #define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\ FAN_ALL_PERM_EVENTS |\ FAN_Q_OVERFLOW) #define FANOTIFY_METADATA_VERSION 3 struct fanotify_event_metadata { __u32 event_len; __u8 vers; __u8 reserved; __u16 metadata_len; __aligned_u64 mask; __s32 fd; __s32 pid; }; /* * User space may need to record additional information about its decision. * The extra information type records what kind of information is included. * The default is none. We also define an extra information buffer whose * size is determined by the extra information type. * * If the information type is Audit Rule, then the information following * is the rule number that triggered the user space decision that * requires auditing. */ #define FAN_RESPONSE_INFO_NONE 0 #define FAN_RESPONSE_INFO_AUDIT_RULE 1 struct fanotify_response { __s32 fd; __u32 response; }; struct fanotify_response_info_header { __u8 type; __u8 pad; __u16 len; }; struct fanotify_response_info_audit_rule { struct fanotify_response_info_header hdr; __u32 rule_number; __u32 subj_trust; __u32 obj_trust; }; /* Legit userspace responses to a _PERM event */ #define FAN_ALLOW 0x01 #define FAN_DENY 0x02 #define FAN_AUDIT 0x10 /* Bitmask to create audit record for result */ #define FAN_INFO 0x20 /* Bitmask to indicate additional information */ /* No fd set in event */ #define FAN_NOFD -1 /* Helper functions to deal with fanotify_event_metadata buffers */ #define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata)) #define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \ (struct fanotify_event_metadata*)(((char *)(meta)) + \ (meta)->event_len)) #define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \ (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \ (long)(meta)->event_len <= (long)(len)) #endif /* _LINUX_FANOTIFY_H */ linux/fcntl.h 0000644 00000010116 15063602047 0007164 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FCNTL_H #define _LINUX_FCNTL_H #include <asm/fcntl.h> #include <linux/openat2.h> #define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0) #define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1) /* * Cancel a blocking posix lock; internal use only until we expose an * asynchronous lock api to userspace: */ #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5) /* Create a file descriptor with FD_CLOEXEC set. */ #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) /* * Request nofications on a directory. * See below for events that may be notified. */ #define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) /* * Set and get of pipe page size array */ #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) /* * Set/Get seals */ #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) /* * Types of seals */ #define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ #define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ #define F_SEAL_GROW 0x0004 /* prevent file from growing */ #define F_SEAL_WRITE 0x0008 /* prevent writes */ /* (1U << 31) is reserved for signed error codes */ /* * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on * the specific file. */ #define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11) #define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) /* * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be * used to clear any hints previously set. */ #define RWH_WRITE_LIFE_NOT_SET 0 #define RWH_WRITE_LIFE_NONE 1 #define RWH_WRITE_LIFE_SHORT 2 #define RWH_WRITE_LIFE_MEDIUM 3 #define RWH_WRITE_LIFE_LONG 4 #define RWH_WRITE_LIFE_EXTREME 5 /* * The originally introduced spelling is remained from the first * versions of the patch set that introduced the feature, see commit * v4.13-rc1~212^2~51. */ #define RWF_WRITE_LIFE_NOT_SET RWH_WRITE_LIFE_NOT_SET /* * Types of directory notifications that may be requested. */ #define DN_ACCESS 0x00000001 /* File accessed */ #define DN_MODIFY 0x00000002 /* File modified */ #define DN_CREATE 0x00000004 /* File created */ #define DN_DELETE 0x00000008 /* File removed */ #define DN_RENAME 0x00000010 /* File renamed */ #define DN_ATTRIB 0x00000020 /* File changed attibutes */ #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ /* * The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is * meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to * unlinkat. The two functions do completely different things and therefore, * the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to * faccessat would be undefined behavior and thus treating it equivalent to * AT_EACCESS is valid undefined behavior. */ #define AT_FDCWD -100 /* Special value used to indicate openat should use the current working directory. */ #define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ #define AT_EACCESS 0x200 /* Test access permitted for effective IDs, not real IDs. */ #define AT_REMOVEDIR 0x200 /* Remove directory instead of unlinking file. */ #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ #define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ #define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */ #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ #define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ #define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ #define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ #endif /* _LINUX_FCNTL_H */ linux/dvb/audio.h 0000644 00000011537 15063602047 0007742 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * audio.h * * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> * & Marcus Metzler <marcus@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Lesser Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBAUDIO_H_ #define _DVBAUDIO_H_ #include <linux/types.h> typedef enum { AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */ AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */ } audio_stream_source_t; typedef enum { AUDIO_STOPPED, /* Device is stopped */ AUDIO_PLAYING, /* Device is currently playing */ AUDIO_PAUSED /* Device is paused */ } audio_play_state_t; typedef enum { AUDIO_STEREO, AUDIO_MONO_LEFT, AUDIO_MONO_RIGHT, AUDIO_MONO, AUDIO_STEREO_SWAPPED } audio_channel_select_t; typedef struct audio_mixer { unsigned int volume_left; unsigned int volume_right; // what else do we need? bass, pass-through, ... } audio_mixer_t; typedef struct audio_status { int AV_sync_state; /* sync audio and video? */ int mute_state; /* audio is muted */ audio_play_state_t play_state; /* current playback state */ audio_stream_source_t stream_source; /* current stream source */ audio_channel_select_t channel_select; /* currently selected channel */ int bypass_mode; /* pass on audio data to */ audio_mixer_t mixer_state; /* current mixer state */ } audio_status_t; /* separate decoder hardware */ typedef struct audio_karaoke { /* if Vocal1 or Vocal2 are non-zero, they get mixed */ int vocal1; /* into left and right t at 70% each */ int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/ int melody; /* mixed into the left channel and */ /* Vocal2 into the right channel at 100% each. */ /* if Melody is non-zero, the melody channel gets mixed*/ } audio_karaoke_t; /* into left and right */ typedef __u16 audio_attributes_t; /* bits: descr. */ /* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ /* 12 multichannel extension */ /* 11-10 audio type (0=not spec, 1=language included) */ /* 9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */ /* 7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit, */ /* 5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */ /* 2- 0 number of audio channels (n+1 channels) */ /* for GET_CAPABILITIES and SET_FORMAT, the latter should only set one bit */ #define AUDIO_CAP_DTS 1 #define AUDIO_CAP_LPCM 2 #define AUDIO_CAP_MP1 4 #define AUDIO_CAP_MP2 8 #define AUDIO_CAP_MP3 16 #define AUDIO_CAP_AAC 32 #define AUDIO_CAP_OGG 64 #define AUDIO_CAP_SDDS 128 #define AUDIO_CAP_AC3 256 #define AUDIO_STOP _IO('o', 1) #define AUDIO_PLAY _IO('o', 2) #define AUDIO_PAUSE _IO('o', 3) #define AUDIO_CONTINUE _IO('o', 4) #define AUDIO_SELECT_SOURCE _IO('o', 5) #define AUDIO_SET_MUTE _IO('o', 6) #define AUDIO_SET_AV_SYNC _IO('o', 7) #define AUDIO_SET_BYPASS_MODE _IO('o', 8) #define AUDIO_CHANNEL_SELECT _IO('o', 9) #define AUDIO_GET_STATUS _IOR('o', 10, audio_status_t) #define AUDIO_GET_CAPABILITIES _IOR('o', 11, unsigned int) #define AUDIO_CLEAR_BUFFER _IO('o', 12) #define AUDIO_SET_ID _IO('o', 13) #define AUDIO_SET_MIXER _IOW('o', 14, audio_mixer_t) #define AUDIO_SET_STREAMTYPE _IO('o', 15) #define AUDIO_SET_EXT_ID _IO('o', 16) #define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) #define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) /** * AUDIO_GET_PTS * * Read the 33 bit presentation time stamp as defined * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. * * The PTS should belong to the currently played * frame if possible, but may also be a value close to it * like the PTS of the last decoded frame or the last PTS * extracted by the PES parser. */ #define AUDIO_GET_PTS _IOR('o', 19, __u64) #define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20) #endif /* _DVBAUDIO_H_ */ linux/dvb/ca.h 0000644 00000010227 15063602047 0007217 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * ca.h * * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> * & Marcus Metzler <marcus@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Lesser Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBCA_H_ #define _DVBCA_H_ /** * struct ca_slot_info - CA slot interface types and info. * * @num: slot number. * @type: slot type. * @flags: flags applicable to the slot. * * This struct stores the CA slot information. * * @type can be: * * - %CA_CI - CI high level interface; * - %CA_CI_LINK - CI link layer level interface; * - %CA_CI_PHYS - CI physical layer level interface; * - %CA_DESCR - built-in descrambler; * - %CA_SC -simple smart card interface. * * @flags can be: * * - %CA_CI_MODULE_PRESENT - module (or card) inserted; * - %CA_CI_MODULE_READY - module is ready for usage. */ struct ca_slot_info { int num; int type; #define CA_CI 1 #define CA_CI_LINK 2 #define CA_CI_PHYS 4 #define CA_DESCR 8 #define CA_SC 128 unsigned int flags; #define CA_CI_MODULE_PRESENT 1 #define CA_CI_MODULE_READY 2 }; /** * struct ca_descr_info - descrambler types and info. * * @num: number of available descramblers (keys). * @type: type of supported scrambling system. * * Identifies the number of descramblers and their type. * * @type can be: * * - %CA_ECD - European Common Descrambler (ECD) hardware; * - %CA_NDS - Videoguard (NDS) hardware; * - %CA_DSS - Distributed Sample Scrambling (DSS) hardware. */ struct ca_descr_info { unsigned int num; unsigned int type; #define CA_ECD 1 #define CA_NDS 2 #define CA_DSS 4 }; /** * struct ca_caps - CA slot interface capabilities. * * @slot_num: total number of CA card and module slots. * @slot_type: bitmap with all supported types as defined at * &struct ca_slot_info (e. g. %CA_CI, %CA_CI_LINK, etc). * @descr_num: total number of descrambler slots (keys) * @descr_type: bitmap with all supported types as defined at * &struct ca_descr_info (e. g. %CA_ECD, %CA_NDS, etc). */ struct ca_caps { unsigned int slot_num; unsigned int slot_type; unsigned int descr_num; unsigned int descr_type; }; /** * struct ca_msg - a message to/from a CI-CAM * * @index: unused * @type: unused * @length: length of the message * @msg: message * * This struct carries a message to be send/received from a CI CA module. */ struct ca_msg { unsigned int index; unsigned int type; unsigned int length; unsigned char msg[256]; }; /** * struct ca_descr - CA descrambler control words info * * @index: CA Descrambler slot * @parity: control words parity, where 0 means even and 1 means odd * @cw: CA Descrambler control words */ struct ca_descr { unsigned int index; unsigned int parity; unsigned char cw[8]; }; #define CA_RESET _IO('o', 128) #define CA_GET_CAP _IOR('o', 129, struct ca_caps) #define CA_GET_SLOT_INFO _IOR('o', 130, struct ca_slot_info) #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info) #define CA_GET_MSG _IOR('o', 132, struct ca_msg) #define CA_SEND_MSG _IOW('o', 133, struct ca_msg) #define CA_SET_DESCR _IOW('o', 134, struct ca_descr) /* This is needed for legacy userspace support */ typedef struct ca_slot_info ca_slot_info_t; typedef struct ca_descr_info ca_descr_info_t; typedef struct ca_caps ca_caps_t; typedef struct ca_msg ca_msg_t; typedef struct ca_descr ca_descr_t; #endif linux/dvb/dmx.h 0000644 00000023701 15063602047 0007425 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * dmx.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * & Ralph Metzler <ralph@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBDMX_H_ #define _DVBDMX_H_ #include <linux/types.h> #include <time.h> #define DMX_FILTER_SIZE 16 /** * enum dmx_output - Output for the demux. * * @DMX_OUT_DECODER: * Streaming directly to decoder. * @DMX_OUT_TAP: * Output going to a memory buffer (to be retrieved via the read command). * Delivers the stream output to the demux device on which the ioctl * is called. * @DMX_OUT_TS_TAP: * Output multiplexed into a new TS (to be retrieved by reading from the * logical DVR device). Routes output to the logical DVR device * ``/dev/dvb/adapter?/dvr?``, which delivers a TS multiplexed from all * filters for which @DMX_OUT_TS_TAP was specified. * @DMX_OUT_TSDEMUX_TAP: * Like @DMX_OUT_TS_TAP but retrieved from the DMX device. */ enum dmx_output { DMX_OUT_DECODER, DMX_OUT_TAP, DMX_OUT_TS_TAP, DMX_OUT_TSDEMUX_TAP }; /** * enum dmx_input - Input from the demux. * * @DMX_IN_FRONTEND: Input from a front-end device. * @DMX_IN_DVR: Input from the logical DVR device. */ enum dmx_input { DMX_IN_FRONTEND, DMX_IN_DVR }; /** * enum dmx_ts_pes - type of the PES filter. * * @DMX_PES_AUDIO0: first audio PID. Also referred as @DMX_PES_AUDIO. * @DMX_PES_VIDEO0: first video PID. Also referred as @DMX_PES_VIDEO. * @DMX_PES_TELETEXT0: first teletext PID. Also referred as @DMX_PES_TELETEXT. * @DMX_PES_SUBTITLE0: first subtitle PID. Also referred as @DMX_PES_SUBTITLE. * @DMX_PES_PCR0: first Program Clock Reference PID. * Also referred as @DMX_PES_PCR. * * @DMX_PES_AUDIO1: second audio PID. * @DMX_PES_VIDEO1: second video PID. * @DMX_PES_TELETEXT1: second teletext PID. * @DMX_PES_SUBTITLE1: second subtitle PID. * @DMX_PES_PCR1: second Program Clock Reference PID. * * @DMX_PES_AUDIO2: third audio PID. * @DMX_PES_VIDEO2: third video PID. * @DMX_PES_TELETEXT2: third teletext PID. * @DMX_PES_SUBTITLE2: third subtitle PID. * @DMX_PES_PCR2: third Program Clock Reference PID. * * @DMX_PES_AUDIO3: fourth audio PID. * @DMX_PES_VIDEO3: fourth video PID. * @DMX_PES_TELETEXT3: fourth teletext PID. * @DMX_PES_SUBTITLE3: fourth subtitle PID. * @DMX_PES_PCR3: fourth Program Clock Reference PID. * * @DMX_PES_OTHER: any other PID. */ enum dmx_ts_pes { DMX_PES_AUDIO0, DMX_PES_VIDEO0, DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0, DMX_PES_PCR0, DMX_PES_AUDIO1, DMX_PES_VIDEO1, DMX_PES_TELETEXT1, DMX_PES_SUBTITLE1, DMX_PES_PCR1, DMX_PES_AUDIO2, DMX_PES_VIDEO2, DMX_PES_TELETEXT2, DMX_PES_SUBTITLE2, DMX_PES_PCR2, DMX_PES_AUDIO3, DMX_PES_VIDEO3, DMX_PES_TELETEXT3, DMX_PES_SUBTITLE3, DMX_PES_PCR3, DMX_PES_OTHER }; #define DMX_PES_AUDIO DMX_PES_AUDIO0 #define DMX_PES_VIDEO DMX_PES_VIDEO0 #define DMX_PES_TELETEXT DMX_PES_TELETEXT0 #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 #define DMX_PES_PCR DMX_PES_PCR0 /** * struct dmx_filter - Specifies a section header filter. * * @filter: bit array with bits to be matched at the section header. * @mask: bits that are valid at the filter bit array. * @mode: mode of match: if bit is zero, it will match if equal (positive * match); if bit is one, it will match if the bit is negated. * * Note: All arrays in this struct have a size of DMX_FILTER_SIZE (16 bytes). */ struct dmx_filter { __u8 filter[DMX_FILTER_SIZE]; __u8 mask[DMX_FILTER_SIZE]; __u8 mode[DMX_FILTER_SIZE]; }; /** * struct dmx_sct_filter_params - Specifies a section filter. * * @pid: PID to be filtered. * @filter: section header filter, as defined by &struct dmx_filter. * @timeout: maximum time to filter, in milliseconds. * @flags: extra flags for the section filter. * * Carries the configuration for a MPEG-TS section filter. * * The @flags can be: * * - %DMX_CHECK_CRC - only deliver sections where the CRC check succeeded; * - %DMX_ONESHOT - disable the section filter after one section * has been delivered; * - %DMX_IMMEDIATE_START - Start filter immediately without requiring a * :ref:`DMX_START`. */ struct dmx_sct_filter_params { __u16 pid; struct dmx_filter filter; __u32 timeout; __u32 flags; #define DMX_CHECK_CRC 1 #define DMX_ONESHOT 2 #define DMX_IMMEDIATE_START 4 }; /** * struct dmx_pes_filter_params - Specifies Packetized Elementary Stream (PES) * filter parameters. * * @pid: PID to be filtered. * @input: Demux input, as specified by &enum dmx_input. * @output: Demux output, as specified by &enum dmx_output. * @pes_type: Type of the pes filter, as specified by &enum dmx_pes_type. * @flags: Demux PES flags. */ struct dmx_pes_filter_params { __u16 pid; enum dmx_input input; enum dmx_output output; enum dmx_ts_pes pes_type; __u32 flags; }; /** * struct dmx_stc - Stores System Time Counter (STC) information. * * @num: input data: number of the STC, from 0 to N. * @base: output: divisor for STC to get 90 kHz clock. * @stc: output: stc in @base * 90 kHz units. */ struct dmx_stc { unsigned int num; unsigned int base; __u64 stc; }; /** * enum dmx_buffer_flags - DMX memory-mapped buffer flags * * @DMX_BUFFER_FLAG_HAD_CRC32_DISCARD: * Indicates that the Kernel discarded one or more frames due to wrong * CRC32 checksum. * @DMX_BUFFER_FLAG_TEI: * Indicates that the Kernel has detected a Transport Error indicator * (TEI) on a filtered pid. * @DMX_BUFFER_PKT_COUNTER_MISMATCH: * Indicates that the Kernel has detected a packet counter mismatch * on a filtered pid. * @DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED: * Indicates that the Kernel has detected one or more frame discontinuity. * @DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR: * Received at least one packet with a frame discontinuity indicator. */ enum dmx_buffer_flags { DMX_BUFFER_FLAG_HAD_CRC32_DISCARD = 1 << 0, DMX_BUFFER_FLAG_TEI = 1 << 1, DMX_BUFFER_PKT_COUNTER_MISMATCH = 1 << 2, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED = 1 << 3, DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR = 1 << 4, }; /** * struct dmx_buffer - dmx buffer info * * @index: id number of the buffer * @bytesused: number of bytes occupied by data in the buffer (payload); * @offset: for buffers with memory == DMX_MEMORY_MMAP; * offset from the start of the device memory for this plane, * (or a "cookie" that should be passed to mmap() as offset) * @length: size in bytes of the buffer * @flags: bit array of buffer flags as defined by &enum dmx_buffer_flags. * Filled only at &DMX_DQBUF. * @count: monotonic counter for filled buffers. Helps to identify * data stream loses. Filled only at &DMX_DQBUF. * * Contains data exchanged by application and driver using one of the streaming * I/O methods. * * Please notice that, for &DMX_QBUF, only @index should be filled. * On &DMX_DQBUF calls, all fields will be filled by the Kernel. */ struct dmx_buffer { __u32 index; __u32 bytesused; __u32 offset; __u32 length; __u32 flags; __u32 count; }; /** * struct dmx_requestbuffers - request dmx buffer information * * @count: number of requested buffers, * @size: size in bytes of the requested buffer * * Contains data used for requesting a dmx buffer. * All reserved fields must be set to zero. */ struct dmx_requestbuffers { __u32 count; __u32 size; }; /** * struct dmx_exportbuffer - export of dmx buffer as DMABUF file descriptor * * @index: id number of the buffer * @flags: flags for newly created file, currently only O_CLOEXEC is * supported, refer to manual of open syscall for more details * @fd: file descriptor associated with DMABUF (set by driver) * * Contains data used for exporting a dmx buffer as DMABUF file descriptor. * The buffer is identified by a 'cookie' returned by DMX_QUERYBUF * (identical to the cookie used to mmap() the buffer to userspace). All * reserved fields must be set to zero. The field reserved0 is expected to * become a structure 'type' allowing an alternative layout of the structure * content. Therefore this field should not be used for any other extensions. */ struct dmx_exportbuffer { __u32 index; __u32 flags; __s32 fd; }; #define DMX_START _IO('o', 41) #define DMX_STOP _IO('o', 42) #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) #define DMX_SET_BUFFER_SIZE _IO('o', 45) #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) #define DMX_ADD_PID _IOW('o', 51, __u16) #define DMX_REMOVE_PID _IOW('o', 52, __u16) /* This is needed for legacy userspace support */ typedef enum dmx_output dmx_output_t; typedef enum dmx_input dmx_input_t; typedef enum dmx_ts_pes dmx_pes_type_t; typedef struct dmx_filter dmx_filter_t; #define DMX_REQBUFS _IOWR('o', 60, struct dmx_requestbuffers) #define DMX_QUERYBUF _IOWR('o', 61, struct dmx_buffer) #define DMX_EXPBUF _IOWR('o', 62, struct dmx_exportbuffer) #define DMX_QBUF _IOWR('o', 63, struct dmx_buffer) #define DMX_DQBUF _IOWR('o', 64, struct dmx_buffer) #endif /* _DVBDMX_H_ */ linux/dvb/frontend.h 0000644 00000071074 15063602047 0010462 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * frontend.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * Ralph Metzler <ralph@convergence.de> * Holger Waechtler <holger@convergence.de> * Andre Draszik <ad@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBFRONTEND_H_ #define _DVBFRONTEND_H_ #include <linux/types.h> /** * enum fe_caps - Frontend capabilities * * @FE_IS_STUPID: There's something wrong at the * frontend, and it can't report its * capabilities. * @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral * band inversion * @FE_CAN_FEC_1_2: Supports FEC 1/2 * @FE_CAN_FEC_2_3: Supports FEC 2/3 * @FE_CAN_FEC_3_4: Supports FEC 3/4 * @FE_CAN_FEC_4_5: Supports FEC 4/5 * @FE_CAN_FEC_5_6: Supports FEC 5/6 * @FE_CAN_FEC_6_7: Supports FEC 6/7 * @FE_CAN_FEC_7_8: Supports FEC 7/8 * @FE_CAN_FEC_8_9: Supports FEC 8/9 * @FE_CAN_FEC_AUTO: Can auto-detect FEC * @FE_CAN_QPSK: Supports QPSK modulation * @FE_CAN_QAM_16: Supports 16-QAM modulation * @FE_CAN_QAM_32: Supports 32-QAM modulation * @FE_CAN_QAM_64: Supports 64-QAM modulation * @FE_CAN_QAM_128: Supports 128-QAM modulation * @FE_CAN_QAM_256: Supports 256-QAM modulation * @FE_CAN_QAM_AUTO: Can auto-detect QAM modulation * @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode * @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth * @FE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard interval * @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy * @FE_CAN_8VSB: Supports 8-VSB modulation * @FE_CAN_16VSB: Supporta 16-VSB modulation * @FE_HAS_EXTENDED_CAPS: Unused * @FE_CAN_MULTISTREAM: Supports multistream filtering * @FE_CAN_TURBO_FEC: Supports "turbo FEC" modulation * @FE_CAN_2G_MODULATION: Supports "2nd generation" modulation, * e. g. DVB-S2, DVB-T2, DVB-C2 * @FE_NEEDS_BENDING: Unused * @FE_CAN_RECOVER: Can recover from a cable unplug * automatically * @FE_CAN_MUTE_TS: Can stop spurious TS data output */ enum fe_caps { FE_IS_STUPID = 0, FE_CAN_INVERSION_AUTO = 0x1, FE_CAN_FEC_1_2 = 0x2, FE_CAN_FEC_2_3 = 0x4, FE_CAN_FEC_3_4 = 0x8, FE_CAN_FEC_4_5 = 0x10, FE_CAN_FEC_5_6 = 0x20, FE_CAN_FEC_6_7 = 0x40, FE_CAN_FEC_7_8 = 0x80, FE_CAN_FEC_8_9 = 0x100, FE_CAN_FEC_AUTO = 0x200, FE_CAN_QPSK = 0x400, FE_CAN_QAM_16 = 0x800, FE_CAN_QAM_32 = 0x1000, FE_CAN_QAM_64 = 0x2000, FE_CAN_QAM_128 = 0x4000, FE_CAN_QAM_256 = 0x8000, FE_CAN_QAM_AUTO = 0x10000, FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, FE_CAN_BANDWIDTH_AUTO = 0x40000, FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, FE_CAN_HIERARCHY_AUTO = 0x100000, FE_CAN_8VSB = 0x200000, FE_CAN_16VSB = 0x400000, FE_HAS_EXTENDED_CAPS = 0x800000, FE_CAN_MULTISTREAM = 0x4000000, FE_CAN_TURBO_FEC = 0x8000000, FE_CAN_2G_MODULATION = 0x10000000, FE_NEEDS_BENDING = 0x20000000, FE_CAN_RECOVER = 0x40000000, FE_CAN_MUTE_TS = 0x80000000 }; /* * DEPRECATED: Should be kept just due to backward compatibility. */ enum fe_type { FE_QPSK, FE_QAM, FE_OFDM, FE_ATSC }; /** * struct dvb_frontend_info - Frontend properties and capabilities * * @name: Name of the frontend * @type: **DEPRECATED**. * Should not be used on modern programs, * as a frontend may have more than one type. * In order to get the support types of a given * frontend, use :c:type:`DTV_ENUM_DELSYS` * instead. * @frequency_min: Minimal frequency supported by the frontend. * @frequency_max: Minimal frequency supported by the frontend. * @frequency_stepsize: All frequencies are multiple of this value. * @frequency_tolerance: Frequency tolerance. * @symbol_rate_min: Minimal symbol rate, in bauds * (for Cable/Satellite systems). * @symbol_rate_max: Maximal symbol rate, in bauds * (for Cable/Satellite systems). * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm * (for Cable/Satellite systems). * @notifier_delay: **DEPRECATED**. Not used by any driver. * @caps: Capabilities supported by the frontend, * as specified in &enum fe_caps. * * .. note: * * #. The frequencies are specified in Hz for Terrestrial and Cable * systems. * #. The frequencies are specified in kHz for Satellite systems. */ struct dvb_frontend_info { char name[128]; enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ __u32 frequency_min; __u32 frequency_max; __u32 frequency_stepsize; __u32 frequency_tolerance; __u32 symbol_rate_min; __u32 symbol_rate_max; __u32 symbol_rate_tolerance; __u32 notifier_delay; /* DEPRECATED */ enum fe_caps caps; }; /** * struct dvb_diseqc_master_cmd - DiSEqC master command * * @msg: * DiSEqC message to be sent. It contains a 3 bytes header with: * framing + address + command, and an optional argument * of up to 3 bytes of data. * @msg_len: * Length of the DiSEqC message. Valid values are 3 to 6. * * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for * the possible messages that can be used. */ struct dvb_diseqc_master_cmd { __u8 msg[6]; __u8 msg_len; }; /** * struct dvb_diseqc_slave_reply - DiSEqC received data * * @msg: * DiSEqC message buffer to store a message received via DiSEqC. * It contains one byte header with: framing and * an optional argument of up to 3 bytes of data. * @msg_len: * Length of the DiSEqC message. Valid values are 0 to 4, * where 0 means no message. * @timeout: * Return from ioctl after timeout ms with errorcode when * no message was received. * * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for * the possible messages that can be used. */ struct dvb_diseqc_slave_reply { __u8 msg[4]; __u8 msg_len; int timeout; }; /** * enum fe_sec_voltage - DC Voltage used to feed the LNBf * * @SEC_VOLTAGE_13: Output 13V to the LNBf * @SEC_VOLTAGE_18: Output 18V to the LNBf * @SEC_VOLTAGE_OFF: Don't feed the LNBf with a DC voltage */ enum fe_sec_voltage { SEC_VOLTAGE_13, SEC_VOLTAGE_18, SEC_VOLTAGE_OFF }; /** * enum fe_sec_tone_mode - Type of tone to be send to the LNBf. * @SEC_TONE_ON: Sends a 22kHz tone burst to the antenna. * @SEC_TONE_OFF: Don't send a 22kHz tone to the antenna (except * if the ``FE_DISEQC_*`` ioctls are called). */ enum fe_sec_tone_mode { SEC_TONE_ON, SEC_TONE_OFF }; /** * enum fe_sec_mini_cmd - Type of mini burst to be sent * * @SEC_MINI_A: Sends a mini-DiSEqC 22kHz '0' Tone Burst to select * satellite-A * @SEC_MINI_B: Sends a mini-DiSEqC 22kHz '1' Data Burst to select * satellite-B */ enum fe_sec_mini_cmd { SEC_MINI_A, SEC_MINI_B }; /** * enum fe_status - Enumerates the possible frontend status. * @FE_NONE: The frontend doesn't have any kind of lock. * That's the initial frontend status * @FE_HAS_SIGNAL: Has found something above the noise level. * @FE_HAS_CARRIER: Has found a signal. * @FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code). * is stable. * @FE_HAS_SYNC: Synchronization bytes was found. * @FE_HAS_LOCK: Digital TV were locked and everything is working. * @FE_TIMEDOUT: Fo lock within the last about 2 seconds. * @FE_REINIT: Frontend was reinitialized, application is recommended * to reset DiSEqC, tone and parameters. */ enum fe_status { FE_NONE = 0x00, FE_HAS_SIGNAL = 0x01, FE_HAS_CARRIER = 0x02, FE_HAS_VITERBI = 0x04, FE_HAS_SYNC = 0x08, FE_HAS_LOCK = 0x10, FE_TIMEDOUT = 0x20, FE_REINIT = 0x40, }; /** * enum fe_spectral_inversion - Type of inversion band * * @INVERSION_OFF: Don't do spectral band inversion. * @INVERSION_ON: Do spectral band inversion. * @INVERSION_AUTO: Autodetect spectral band inversion. * * This parameter indicates if spectral inversion should be presumed or * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try * to figure out the correct setting by itself. If the hardware doesn't * support, the %dvb_frontend will try to lock at the carrier first with * inversion off. If it fails, it will try to enable inversion. */ enum fe_spectral_inversion { INVERSION_OFF, INVERSION_ON, INVERSION_AUTO }; /** * enum fe_code_rate - Type of Forward Error Correction (FEC) * * * @FEC_NONE: No Forward Error Correction Code * @FEC_1_2: Forward Error Correction Code 1/2 * @FEC_2_3: Forward Error Correction Code 2/3 * @FEC_3_4: Forward Error Correction Code 3/4 * @FEC_4_5: Forward Error Correction Code 4/5 * @FEC_5_6: Forward Error Correction Code 5/6 * @FEC_6_7: Forward Error Correction Code 6/7 * @FEC_7_8: Forward Error Correction Code 7/8 * @FEC_8_9: Forward Error Correction Code 8/9 * @FEC_AUTO: Autodetect Error Correction Code * @FEC_3_5: Forward Error Correction Code 3/5 * @FEC_9_10: Forward Error Correction Code 9/10 * @FEC_2_5: Forward Error Correction Code 2/5 * * Please note that not all FEC types are supported by a given standard. */ enum fe_code_rate { FEC_NONE = 0, FEC_1_2, FEC_2_3, FEC_3_4, FEC_4_5, FEC_5_6, FEC_6_7, FEC_7_8, FEC_8_9, FEC_AUTO, FEC_3_5, FEC_9_10, FEC_2_5, }; /** * enum fe_modulation - Type of modulation/constellation * @QPSK: QPSK modulation * @QAM_16: 16-QAM modulation * @QAM_32: 32-QAM modulation * @QAM_64: 64-QAM modulation * @QAM_128: 128-QAM modulation * @QAM_256: 256-QAM modulation * @QAM_AUTO: Autodetect QAM modulation * @VSB_8: 8-VSB modulation * @VSB_16: 16-VSB modulation * @PSK_8: 8-PSK modulation * @APSK_16: 16-APSK modulation * @APSK_32: 32-APSK modulation * @DQPSK: DQPSK modulation * @QAM_4_NR: 4-QAM-NR modulation * * Please note that not all modulations are supported by a given standard. * */ enum fe_modulation { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO, VSB_8, VSB_16, PSK_8, APSK_16, APSK_32, DQPSK, QAM_4_NR, }; /** * enum fe_transmit_mode - Transmission mode * * @TRANSMISSION_MODE_AUTO: * Autodetect transmission mode. The hardware will try to find the * correct FFT-size (if capable) to fill in the missing parameters. * @TRANSMISSION_MODE_1K: * Transmission mode 1K * @TRANSMISSION_MODE_2K: * Transmission mode 2K * @TRANSMISSION_MODE_8K: * Transmission mode 8K * @TRANSMISSION_MODE_4K: * Transmission mode 4K * @TRANSMISSION_MODE_16K: * Transmission mode 16K * @TRANSMISSION_MODE_32K: * Transmission mode 32K * @TRANSMISSION_MODE_C1: * Single Carrier (C=1) transmission mode (DTMB only) * @TRANSMISSION_MODE_C3780: * Multi Carrier (C=3780) transmission mode (DTMB only) * * Please note that not all transmission modes are supported by a given * standard. */ enum fe_transmit_mode { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_AUTO, TRANSMISSION_MODE_4K, TRANSMISSION_MODE_1K, TRANSMISSION_MODE_16K, TRANSMISSION_MODE_32K, TRANSMISSION_MODE_C1, TRANSMISSION_MODE_C3780, }; /** * enum fe_guard_interval - Guard interval * * @GUARD_INTERVAL_AUTO: Autodetect the guard interval * @GUARD_INTERVAL_1_128: Guard interval 1/128 * @GUARD_INTERVAL_1_32: Guard interval 1/32 * @GUARD_INTERVAL_1_16: Guard interval 1/16 * @GUARD_INTERVAL_1_8: Guard interval 1/8 * @GUARD_INTERVAL_1_4: Guard interval 1/4 * @GUARD_INTERVAL_19_128: Guard interval 19/128 * @GUARD_INTERVAL_19_256: Guard interval 19/256 * @GUARD_INTERVAL_PN420: PN length 420 (1/4) * @GUARD_INTERVAL_PN595: PN length 595 (1/6) * @GUARD_INTERVAL_PN945: PN length 945 (1/9) * * Please note that not all guard intervals are supported by a given standard. */ enum fe_guard_interval { GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4, GUARD_INTERVAL_AUTO, GUARD_INTERVAL_1_128, GUARD_INTERVAL_19_128, GUARD_INTERVAL_19_256, GUARD_INTERVAL_PN420, GUARD_INTERVAL_PN595, GUARD_INTERVAL_PN945, }; /** * enum fe_hierarchy - Hierarchy * @HIERARCHY_NONE: No hierarchy * @HIERARCHY_AUTO: Autodetect hierarchy (if supported) * @HIERARCHY_1: Hierarchy 1 * @HIERARCHY_2: Hierarchy 2 * @HIERARCHY_4: Hierarchy 4 * * Please note that not all hierarchy types are supported by a given standard. */ enum fe_hierarchy { HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4, HIERARCHY_AUTO }; /** * enum fe_interleaving - Interleaving * @INTERLEAVING_NONE: No interleaving. * @INTERLEAVING_AUTO: Auto-detect interleaving. * @INTERLEAVING_240: Interleaving of 240 symbols. * @INTERLEAVING_720: Interleaving of 720 symbols. * * Please note that, currently, only DTMB uses it. */ enum fe_interleaving { INTERLEAVING_NONE, INTERLEAVING_AUTO, INTERLEAVING_240, INTERLEAVING_720, }; /* DVBv5 property Commands */ #define DTV_UNDEFINED 0 #define DTV_TUNE 1 #define DTV_CLEAR 2 #define DTV_FREQUENCY 3 #define DTV_MODULATION 4 #define DTV_BANDWIDTH_HZ 5 #define DTV_INVERSION 6 #define DTV_DISEQC_MASTER 7 #define DTV_SYMBOL_RATE 8 #define DTV_INNER_FEC 9 #define DTV_VOLTAGE 10 #define DTV_TONE 11 #define DTV_PILOT 12 #define DTV_ROLLOFF 13 #define DTV_DISEQC_SLAVE_REPLY 14 /* Basic enumeration set for querying unlimited capabilities */ #define DTV_FE_CAPABILITY_COUNT 15 #define DTV_FE_CAPABILITY 16 #define DTV_DELIVERY_SYSTEM 17 /* ISDB-T and ISDB-Tsb */ #define DTV_ISDBT_PARTIAL_RECEPTION 18 #define DTV_ISDBT_SOUND_BROADCASTING 19 #define DTV_ISDBT_SB_SUBCHANNEL_ID 20 #define DTV_ISDBT_SB_SEGMENT_IDX 21 #define DTV_ISDBT_SB_SEGMENT_COUNT 22 #define DTV_ISDBT_LAYERA_FEC 23 #define DTV_ISDBT_LAYERA_MODULATION 24 #define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 #define DTV_ISDBT_LAYERB_FEC 27 #define DTV_ISDBT_LAYERB_MODULATION 28 #define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 #define DTV_ISDBT_LAYERC_FEC 31 #define DTV_ISDBT_LAYERC_MODULATION 32 #define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 #define DTV_API_VERSION 35 #define DTV_CODE_RATE_HP 36 #define DTV_CODE_RATE_LP 37 #define DTV_GUARD_INTERVAL 38 #define DTV_TRANSMISSION_MODE 39 #define DTV_HIERARCHY 40 #define DTV_ISDBT_LAYER_ENABLED 41 #define DTV_STREAM_ID 42 #define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID #define DTV_DVBT2_PLP_ID_LEGACY 43 #define DTV_ENUM_DELSYS 44 /* ATSC-MH */ #define DTV_ATSCMH_FIC_VER 45 #define DTV_ATSCMH_PARADE_ID 46 #define DTV_ATSCMH_NOG 47 #define DTV_ATSCMH_TNOG 48 #define DTV_ATSCMH_SGN 49 #define DTV_ATSCMH_PRC 50 #define DTV_ATSCMH_RS_FRAME_MODE 51 #define DTV_ATSCMH_RS_FRAME_ENSEMBLE 52 #define DTV_ATSCMH_RS_CODE_MODE_PRI 53 #define DTV_ATSCMH_RS_CODE_MODE_SEC 54 #define DTV_ATSCMH_SCCC_BLOCK_MODE 55 #define DTV_ATSCMH_SCCC_CODE_MODE_A 56 #define DTV_ATSCMH_SCCC_CODE_MODE_B 57 #define DTV_ATSCMH_SCCC_CODE_MODE_C 58 #define DTV_ATSCMH_SCCC_CODE_MODE_D 59 #define DTV_INTERLEAVING 60 #define DTV_LNA 61 /* Quality parameters */ #define DTV_STAT_SIGNAL_STRENGTH 62 #define DTV_STAT_CNR 63 #define DTV_STAT_PRE_ERROR_BIT_COUNT 64 #define DTV_STAT_PRE_TOTAL_BIT_COUNT 65 #define DTV_STAT_POST_ERROR_BIT_COUNT 66 #define DTV_STAT_POST_TOTAL_BIT_COUNT 67 #define DTV_STAT_ERROR_BLOCK_COUNT 68 #define DTV_STAT_TOTAL_BLOCK_COUNT 69 /* Physical layer scrambling */ #define DTV_SCRAMBLING_SEQUENCE_INDEX 70 #define DTV_MAX_COMMAND DTV_SCRAMBLING_SEQUENCE_INDEX /** * enum fe_pilot - Type of pilot tone * * @PILOT_ON: Pilot tones enabled * @PILOT_OFF: Pilot tones disabled * @PILOT_AUTO: Autodetect pilot tones */ enum fe_pilot { PILOT_ON, PILOT_OFF, PILOT_AUTO, }; /** * enum fe_rolloff - Rolloff factor * @ROLLOFF_35: Roloff factor: α=35% * @ROLLOFF_20: Roloff factor: α=20% * @ROLLOFF_25: Roloff factor: α=25% * @ROLLOFF_AUTO: Auto-detect the roloff factor. * * .. note: * * Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default. */ enum fe_rolloff { ROLLOFF_35, ROLLOFF_20, ROLLOFF_25, ROLLOFF_AUTO, }; /** * enum fe_delivery_system - Type of the delivery system * * @SYS_UNDEFINED: * Undefined standard. Generally, indicates an error * @SYS_DVBC_ANNEX_A: * Cable TV: DVB-C following ITU-T J.83 Annex A spec * @SYS_DVBC_ANNEX_B: * Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM) * @SYS_DVBC_ANNEX_C: * Cable TV: DVB-C following ITU-T J.83 Annex C spec * @SYS_ISDBC: * Cable TV: ISDB-C (no drivers yet) * @SYS_DVBT: * Terrestrial TV: DVB-T * @SYS_DVBT2: * Terrestrial TV: DVB-T2 * @SYS_ISDBT: * Terrestrial TV: ISDB-T * @SYS_ATSC: * Terrestrial TV: ATSC * @SYS_ATSCMH: * Terrestrial TV (mobile): ATSC-M/H * @SYS_DTMB: * Terrestrial TV: DTMB * @SYS_DVBS: * Satellite TV: DVB-S * @SYS_DVBS2: * Satellite TV: DVB-S2 * @SYS_TURBO: * Satellite TV: DVB-S Turbo * @SYS_ISDBS: * Satellite TV: ISDB-S * @SYS_DAB: * Digital audio: DAB (not fully supported) * @SYS_DSS: * Satellite TV: DSS (not fully supported) * @SYS_CMMB: * Terrestrial TV (mobile): CMMB (not fully supported) * @SYS_DVBH: * Terrestrial TV (mobile): DVB-H (standard deprecated) */ enum fe_delivery_system { SYS_UNDEFINED, SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_B, SYS_DVBT, SYS_DSS, SYS_DVBS, SYS_DVBS2, SYS_DVBH, SYS_ISDBT, SYS_ISDBS, SYS_ISDBC, SYS_ATSC, SYS_ATSCMH, SYS_DTMB, SYS_CMMB, SYS_DAB, SYS_DVBT2, SYS_TURBO, SYS_DVBC_ANNEX_C, }; /* backward compatibility definitions for delivery systems */ #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A #define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB */ /* ATSC-MH specific parameters */ /** * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional * Code Block Mode. * * @ATSCMH_SCCC_BLK_SEP: * Separate SCCC: the SCCC outer code mode shall be set independently * for each Group Region (A, B, C, D) * @ATSCMH_SCCC_BLK_COMB: * Combined SCCC: all four Regions shall have the same SCCC outer * code mode. * @ATSCMH_SCCC_BLK_RES: * Reserved. Shouldn't be used. */ enum atscmh_sccc_block_mode { ATSCMH_SCCC_BLK_SEP = 0, ATSCMH_SCCC_BLK_COMB = 1, ATSCMH_SCCC_BLK_RES = 2, }; /** * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional * Code Rate. * * @ATSCMH_SCCC_CODE_HLF: * The outer code rate of a SCCC Block is 1/2 rate. * @ATSCMH_SCCC_CODE_QTR: * The outer code rate of a SCCC Block is 1/4 rate. * @ATSCMH_SCCC_CODE_RES: * Reserved. Should not be used. */ enum atscmh_sccc_code_mode { ATSCMH_SCCC_CODE_HLF = 0, ATSCMH_SCCC_CODE_QTR = 1, ATSCMH_SCCC_CODE_RES = 2, }; /** * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble. * * @ATSCMH_RSFRAME_ENS_PRI: Primary Ensemble. * @ATSCMH_RSFRAME_ENS_SEC: Secondary Ensemble. */ enum atscmh_rs_frame_ensemble { ATSCMH_RSFRAME_ENS_PRI = 0, ATSCMH_RSFRAME_ENS_SEC = 1, }; /** * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode. * * @ATSCMH_RSFRAME_PRI_ONLY: * Single Frame: There is only a primary RS Frame for all Group * Regions. * @ATSCMH_RSFRAME_PRI_SEC: * Dual Frame: There are two separate RS Frames: Primary RS Frame for * Group Region A and B and Secondary RS Frame for Group Region C and * D. * @ATSCMH_RSFRAME_RES: * Reserved. Shouldn't be used. */ enum atscmh_rs_frame_mode { ATSCMH_RSFRAME_PRI_ONLY = 0, ATSCMH_RSFRAME_PRI_SEC = 1, ATSCMH_RSFRAME_RES = 2, }; /** * enum atscmh_rs_code_mode * @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187). * @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187). * @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187). * @ATSCMH_RSCODE_RES: Reserved. Shouldn't be used. */ enum atscmh_rs_code_mode { ATSCMH_RSCODE_211_187 = 0, ATSCMH_RSCODE_223_187 = 1, ATSCMH_RSCODE_235_187 = 2, ATSCMH_RSCODE_RES = 3, }; #define NO_STREAM_ID_FILTER (~0U) #define LNA_AUTO (~0U) /** * enum fecap_scale_params - scale types for the quality parameters. * * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That * could indicate a temporary or a permanent * condition. * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically * used on signal measures. * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, * ranging from 0 (0%) to 0xffff (100%). * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like * bit error, block error, lapsed time. */ enum fecap_scale_params { FE_SCALE_NOT_AVAILABLE = 0, FE_SCALE_DECIBEL, FE_SCALE_RELATIVE, FE_SCALE_COUNTER }; /** * struct dtv_stats - Used for reading a DTV status property * * @scale: * Filled with enum fecap_scale_params - the scale in usage * for that parameter * * @svalue: * integer value of the measure, for %FE_SCALE_DECIBEL, * used for dB measures. The unit is 0.001 dB. * * @uvalue: * unsigned integer value of the measure, used when @scale is * either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER. * * For most delivery systems, this will return a single value for each * parameter. * * It should be noticed, however, that new OFDM delivery systems like * ISDB can use different modulation types for each group of carriers. * On such standards, up to 8 groups of statistics can be provided, one * for each carrier group (called "layer" on ISDB). * * In order to be consistent with other delivery systems, the first * value refers to the entire set of carriers ("global"). * * @scale should use the value %FE_SCALE_NOT_AVAILABLE when * the value for the entire group of carriers or from one specific layer * is not provided by the hardware. * * @len should be filled with the latest filled status + 1. * * In other words, for ISDB, those values should be filled like:: * * u.st.stat.svalue[0] = global statistics; * u.st.stat.scale[0] = FE_SCALE_DECIBEL; * u.st.stat.value[1] = layer A statistics; * u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available); * u.st.stat.svalue[2] = layer B statistics; * u.st.stat.scale[2] = FE_SCALE_DECIBEL; * u.st.stat.svalue[3] = layer C statistics; * u.st.stat.scale[3] = FE_SCALE_DECIBEL; * u.st.len = 4; */ struct dtv_stats { __u8 scale; /* enum fecap_scale_params type */ union { __u64 uvalue; /* for counters and relative scales */ __s64 svalue; /* for 0.001 dB measures */ }; } __attribute__ ((packed)); #define MAX_DTV_STATS 4 /** * struct dtv_fe_stats - store Digital TV frontend statistics * * @len: length of the statistics - if zero, stats is disabled. * @stat: array with digital TV statistics. * * On most standards, @len can either be 0 or 1. However, for ISDB, each * layer is modulated in separate. So, each layer may have its own set * of statistics. If so, stat[0] carries on a global value for the property. * Indexes 1 to 3 means layer A to B. */ struct dtv_fe_stats { __u8 len; struct dtv_stats stat[MAX_DTV_STATS]; } __attribute__ ((packed)); /** * struct dtv_property - store one of frontend command and its value * * @cmd: Digital TV command. * @reserved: Not used. * @u: Union with the values for the command. * @u.data: A unsigned 32 bits integer with command value. * @u.buffer: Struct to store bigger properties. * Currently unused. * @u.buffer.data: an unsigned 32-bits array. * @u.buffer.len: number of elements of the buffer. * @u.buffer.reserved1: Reserved. * @u.buffer.reserved2: Reserved. * @u.st: a &struct dtv_fe_stats array of statistics. * @result: Currently unused. * */ struct dtv_property { __u32 cmd; __u32 reserved[3]; union { __u32 data; struct dtv_fe_stats st; struct { __u8 data[32]; __u32 len; __u32 reserved1[3]; void *reserved2; } buffer; } u; int result; } __attribute__ ((packed)); /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ #define DTV_IOCTL_MAX_MSGS 64 /** * struct dtv_properties - a set of command/value pairs. * * @num: amount of commands stored at the struct. * @props: a pointer to &struct dtv_property. */ struct dtv_properties { __u32 num; struct dtv_property *props; }; /* * When set, this flag will disable any zigzagging or other "normal" tuning * behavior. Additionally, there will be no automatic monitoring of the lock * status, and hence no frontend events will be generated. If a frontend device * is closed, this flag will be automatically turned off when the device is * reopened read-write. */ #define FE_TUNE_MODE_ONESHOT 0x01 /* Digital TV Frontend API calls */ #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ #define FE_READ_STATUS _IOR('o', 69, fe_status_t) #define FE_READ_BER _IOR('o', 70, __u32) #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) #define FE_READ_SNR _IOR('o', 72, __u16) #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) /* * DEPRECATED: Everything below is deprecated in favor of DVBv5 API * * The DVBv3 only ioctls, structs and enums should not be used on * newer programs, as it doesn't support the second generation of * digital TV standards, nor supports newer delivery systems. * They also don't support modern frontends with usually support multiple * delivery systems. * * Drivers shouldn't use them. * * New applications should use DVBv5 delivery system instead */ /* */ enum fe_bandwidth { BANDWIDTH_8_MHZ, BANDWIDTH_7_MHZ, BANDWIDTH_6_MHZ, BANDWIDTH_AUTO, BANDWIDTH_5_MHZ, BANDWIDTH_10_MHZ, BANDWIDTH_1_712_MHZ, }; /* This is kept for legacy userspace support */ typedef enum fe_sec_voltage fe_sec_voltage_t; typedef enum fe_caps fe_caps_t; typedef enum fe_type fe_type_t; typedef enum fe_sec_tone_mode fe_sec_tone_mode_t; typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t; typedef enum fe_status fe_status_t; typedef enum fe_spectral_inversion fe_spectral_inversion_t; typedef enum fe_code_rate fe_code_rate_t; typedef enum fe_modulation fe_modulation_t; typedef enum fe_transmit_mode fe_transmit_mode_t; typedef enum fe_bandwidth fe_bandwidth_t; typedef enum fe_guard_interval fe_guard_interval_t; typedef enum fe_hierarchy fe_hierarchy_t; typedef enum fe_pilot fe_pilot_t; typedef enum fe_rolloff fe_rolloff_t; typedef enum fe_delivery_system fe_delivery_system_t; /* DVBv3 structs */ struct dvb_qpsk_parameters { __u32 symbol_rate; /* symbol rate in Symbols per second */ fe_code_rate_t fec_inner; /* forward error correction (see above) */ }; struct dvb_qam_parameters { __u32 symbol_rate; /* symbol rate in Symbols per second */ fe_code_rate_t fec_inner; /* forward error correction (see above) */ fe_modulation_t modulation; /* modulation type (see above) */ }; struct dvb_vsb_parameters { fe_modulation_t modulation; /* modulation type (see above) */ }; struct dvb_ofdm_parameters { fe_bandwidth_t bandwidth; fe_code_rate_t code_rate_HP; /* high priority stream code rate */ fe_code_rate_t code_rate_LP; /* low priority stream code rate */ fe_modulation_t constellation; /* modulation type (see above) */ fe_transmit_mode_t transmission_mode; fe_guard_interval_t guard_interval; fe_hierarchy_t hierarchy_information; }; struct dvb_frontend_parameters { __u32 frequency; /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */ /* intermediate frequency in kHz for DVB-S */ fe_spectral_inversion_t inversion; union { struct dvb_qpsk_parameters qpsk; /* DVB-S */ struct dvb_qam_parameters qam; /* DVB-C */ struct dvb_ofdm_parameters ofdm; /* DVB-T */ struct dvb_vsb_parameters vsb; /* ATSC */ } u; }; struct dvb_frontend_event { fe_status_t status; struct dvb_frontend_parameters parameters; }; /* DVBv3 API calls */ #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) #endif /*_DVBFRONTEND_H_*/ linux/dvb/net.h 0000644 00000004117 15063602047 0007423 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * net.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * & Ralph Metzler <ralph@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBNET_H_ #define _DVBNET_H_ #include <linux/types.h> /** * struct dvb_net_if - describes a DVB network interface * * @pid: Packet ID (PID) of the MPEG-TS that contains data * @if_num: number of the Digital TV interface. * @feedtype: Encapsulation type of the feed. * * A MPEG-TS stream may contain packet IDs with IP packages on it. * This struct describes it, and the type of encoding. * * @feedtype can be: * * - %DVB_NET_FEEDTYPE_MPE for MPE encoding * - %DVB_NET_FEEDTYPE_ULE for ULE encoding. */ struct dvb_net_if { __u16 pid; __u16 if_num; __u8 feedtype; #define DVB_NET_FEEDTYPE_MPE 0 /* multi protocol encapsulation */ #define DVB_NET_FEEDTYPE_ULE 1 /* ultra lightweight encapsulation */ }; #define NET_ADD_IF _IOWR('o', 52, struct dvb_net_if) #define NET_REMOVE_IF _IO('o', 53) #define NET_GET_IF _IOWR('o', 54, struct dvb_net_if) /* binary compatibility cruft: */ struct __dvb_net_if_old { __u16 pid; __u16 if_num; }; #define __NET_ADD_IF_OLD _IOWR('o', 52, struct __dvb_net_if_old) #define __NET_GET_IF_OLD _IOWR('o', 54, struct __dvb_net_if_old) #endif /*_DVBNET_H_*/ linux/dvb/osd.h 0000644 00000013201 15063602047 0007414 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * osd.h * * Copyright (C) 2001 Ralph Metzler <ralph@convergence.de> * & Marcus Metzler <marcus@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Lesser Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBOSD_H_ #define _DVBOSD_H_ typedef enum { // All functions return -2 on "not open" OSD_Close=1, // () // Disables OSD and releases the buffers // returns 0 on success OSD_Open, // (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) // Opens OSD with this size and bit depth // returns 0 on success, -1 on DRAM allocation error, -2 on "already open" OSD_Show, // () // enables OSD mode // returns 0 on success OSD_Hide, // () // disables OSD mode // returns 0 on success OSD_Clear, // () // Sets all pixel to color 0 // returns 0 on success OSD_Fill, // (color) // Sets all pixel to color <col> // returns 0 on success OSD_SetColor, // (color,R{x0},G{y0},B{x1},opacity{y1}) // set palette entry <num> to <r,g,b>, <mix> and <trans> apply // R,G,B: 0..255 // R=Red, G=Green, B=Blue // opacity=0: pixel opacity 0% (only video pixel shows) // opacity=1..254: pixel opacity as specified in header // opacity=255: pixel opacity 100% (only OSD pixel shows) // returns 0 on success, -1 on error OSD_SetPalette, // (firstcolor{color},lastcolor{x0},data) // Set a number of entries in the palette // sets the entries "firstcolor" through "lastcolor" from the array "data" // data has 4 byte for each color: // R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel OSD_SetTrans, // (transparency{color}) // Sets transparency of mixed pixel (0..15) // returns 0 on success OSD_SetPixel, // (x0,y0,color) // sets pixel <x>,<y> to color number <col> // returns 0 on success, -1 on error OSD_GetPixel, // (x0,y0) // returns color number of pixel <x>,<y>, or -1 OSD_SetRow, // (x0,y0,x1,data) // fills pixels x0,y through x1,y with the content of data[] // returns 0 on success, -1 on clipping all pixel (no pixel drawn) OSD_SetBlock, // (x0,y0,x1,y1,increment{color},data) // fills pixels x0,y0 through x1,y1 with the content of data[] // inc contains the width of one line in the data block, // inc<=0 uses blockwidth as linewidth // returns 0 on success, -1 on clipping all pixel OSD_FillRow, // (x0,y0,x1,color) // fills pixels x0,y through x1,y with the color <col> // returns 0 on success, -1 on clipping all pixel OSD_FillBlock, // (x0,y0,x1,y1,color) // fills pixels x0,y0 through x1,y1 with the color <col> // returns 0 on success, -1 on clipping all pixel OSD_Line, // (x0,y0,x1,y1,color) // draw a line from x0,y0 to x1,y1 with the color <col> // returns 0 on success OSD_Query, // (x0,y0,x1,y1,xasp{color}}), yasp=11 // fills parameters with the picture dimensions and the pixel aspect ratio // returns 0 on success OSD_Test, // () // draws a test picture. for debugging purposes only // returns 0 on success // TODO: remove "test" in final version OSD_Text, // (x0,y0,size,color,text) OSD_SetWindow, // (x0) set window with number 0<x0<8 as current OSD_MoveWindow, // move current window to (x0, y0) OSD_OpenRaw, // Open other types of OSD windows } OSD_Command; typedef struct osd_cmd_s { OSD_Command cmd; int x0; int y0; int x1; int y1; int color; void *data; } osd_cmd_t; /* OSD_OpenRaw: set 'color' to desired window type */ typedef enum { OSD_BITMAP1, /* 1 bit bitmap */ OSD_BITMAP2, /* 2 bit bitmap */ OSD_BITMAP4, /* 4 bit bitmap */ OSD_BITMAP8, /* 8 bit bitmap */ OSD_BITMAP1HR, /* 1 Bit bitmap half resolution */ OSD_BITMAP2HR, /* 2 bit bitmap half resolution */ OSD_BITMAP4HR, /* 4 bit bitmap half resolution */ OSD_BITMAP8HR, /* 8 bit bitmap half resolution */ OSD_YCRCB422, /* 4:2:2 YCRCB Graphic Display */ OSD_YCRCB444, /* 4:4:4 YCRCB Graphic Display */ OSD_YCRCB444HR, /* 4:4:4 YCRCB graphic half resolution */ OSD_VIDEOTSIZE, /* True Size Normal MPEG Video Display */ OSD_VIDEOHSIZE, /* MPEG Video Display Half Resolution */ OSD_VIDEOQSIZE, /* MPEG Video Display Quarter Resolution */ OSD_VIDEODSIZE, /* MPEG Video Display Double Resolution */ OSD_VIDEOTHSIZE, /* True Size MPEG Video Display Half Resolution */ OSD_VIDEOTQSIZE, /* True Size MPEG Video Display Quarter Resolution*/ OSD_VIDEOTDSIZE, /* True Size MPEG Video Display Double Resolution */ OSD_VIDEONSIZE, /* Full Size MPEG Video Display */ OSD_CURSOR /* Cursor */ } osd_raw_window_t; typedef struct osd_cap_s { int cmd; #define OSD_CAP_MEMSIZE 1 /* memory size */ long val; } osd_cap_t; #define OSD_SEND_CMD _IOW('o', 160, osd_cmd_t) #define OSD_GET_CAPABILITY _IOR('o', 161, osd_cap_t) #endif linux/dvb/version.h 0000644 00000002072 15063602047 0010320 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * version.h * * Copyright (C) 2000 Holger Waechtler <holger@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBVERSION_H_ #define _DVBVERSION_H_ #define DVB_API_VERSION 5 #define DVB_API_VERSION_MINOR 11 #endif /*_DVBVERSION_H_*/ linux/dvb/video.h 0000644 00000021131 15063602047 0007736 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * video.h * * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * & Ralph Metzler <ralph@convergence.de> * for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef _DVBVIDEO_H_ #define _DVBVIDEO_H_ #include <linux/types.h> #include <time.h> typedef enum { VIDEO_FORMAT_4_3, /* Select 4:3 format */ VIDEO_FORMAT_16_9, /* Select 16:9 format. */ VIDEO_FORMAT_221_1 /* 2.21:1 */ } video_format_t; typedef enum { VIDEO_SYSTEM_PAL, VIDEO_SYSTEM_NTSC, VIDEO_SYSTEM_PALN, VIDEO_SYSTEM_PALNc, VIDEO_SYSTEM_PALM, VIDEO_SYSTEM_NTSC60, VIDEO_SYSTEM_PAL60, VIDEO_SYSTEM_PALM60 } video_system_t; typedef enum { VIDEO_PAN_SCAN, /* use pan and scan format */ VIDEO_LETTER_BOX, /* use letterbox format */ VIDEO_CENTER_CUT_OUT /* use center cut out format */ } video_displayformat_t; typedef struct { int w; int h; video_format_t aspect_ratio; } video_size_t; typedef enum { VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ VIDEO_SOURCE_MEMORY /* If this source is selected, the stream comes from the user through the write system call */ } video_stream_source_t; typedef enum { VIDEO_STOPPED, /* Video is stopped */ VIDEO_PLAYING, /* Video is currently playing */ VIDEO_FREEZED /* Video is freezed */ } video_play_state_t; /* Decoder commands */ #define VIDEO_CMD_PLAY (0) #define VIDEO_CMD_STOP (1) #define VIDEO_CMD_FREEZE (2) #define VIDEO_CMD_CONTINUE (3) /* Flags for VIDEO_CMD_FREEZE */ #define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0) /* Flags for VIDEO_CMD_STOP */ #define VIDEO_CMD_STOP_TO_BLACK (1 << 0) #define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1) /* Play input formats: */ /* The decoder has no special format requirements */ #define VIDEO_PLAY_FMT_NONE (0) /* The decoder requires full GOPs */ #define VIDEO_PLAY_FMT_GOP (1) /* The structure must be zeroed before use by the application This ensures it can be extended safely in the future. */ struct video_command { __u32 cmd; __u32 flags; union { struct { __u64 pts; } stop; struct { /* 0 or 1000 specifies normal speed, 1 specifies forward single stepping, -1 specifies backward single stepping, >1: playback at speed/1000 of the normal speed, <-1: reverse playback at (-speed/1000) of the normal speed. */ __s32 speed; __u32 format; } play; struct { __u32 data[16]; } raw; }; }; /* FIELD_UNKNOWN can be used if the hardware does not know whether the Vsync is for an odd, even or progressive (i.e. non-interlaced) field. */ #define VIDEO_VSYNC_FIELD_UNKNOWN (0) #define VIDEO_VSYNC_FIELD_ODD (1) #define VIDEO_VSYNC_FIELD_EVEN (2) #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) struct video_event { __s32 type; #define VIDEO_EVENT_SIZE_CHANGED 1 #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 #define VIDEO_EVENT_DECODER_STOPPED 3 #define VIDEO_EVENT_VSYNC 4 /* unused, make sure to use atomic time for y2038 if it ever gets used */ long timestamp; union { video_size_t size; unsigned int frame_rate; /* in frames per 1000sec */ unsigned char vsync_field; /* unknown/odd/even/progressive */ } u; }; struct video_status { int video_blank; /* blank video on freeze? */ video_play_state_t play_state; /* current state of playback */ video_stream_source_t stream_source; /* current source (demux/memory) */ video_format_t video_format; /* current aspect ratio of stream*/ video_displayformat_t display_format;/* selected cropping mode */ }; struct video_still_picture { char *iFrame; /* pointer to a single iframe in memory */ __s32 size; }; typedef struct video_highlight { int active; /* 1=show highlight, 0=hide highlight */ __u8 contrast1; /* 7- 4 Pattern pixel contrast */ /* 3- 0 Background pixel contrast */ __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */ /* 3- 0 Emphasis pixel-1 contrast */ __u8 color1; /* 7- 4 Pattern pixel color */ /* 3- 0 Background pixel color */ __u8 color2; /* 7- 4 Emphasis pixel-2 color */ /* 3- 0 Emphasis pixel-1 color */ __u32 ypos; /* 23-22 auto action mode */ /* 21-12 start y */ /* 9- 0 end y */ __u32 xpos; /* 23-22 button color number */ /* 21-12 start x */ /* 9- 0 end x */ } video_highlight_t; typedef struct video_spu { int active; int stream_id; } video_spu_t; typedef struct video_spu_palette { /* SPU Palette information */ int length; __u8 *palette; } video_spu_palette_t; typedef struct video_navi_pack { int length; /* 0 ... 1024 */ __u8 data[1024]; } video_navi_pack_t; typedef __u16 video_attributes_t; /* bits: descr. */ /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ /* 13-12 TV system (0=525/60, 1=625/50) */ /* 11-10 Aspect ratio (0=4:3, 3=16:9) */ /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */ /* 7 line 21-1 data present in GOP (1=yes, 0=no) */ /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ /* 2 source letterboxed (1=yes, 0=no) */ /* 0 film/camera mode (0= *camera, 1=film (625/50 only)) */ /* bit definitions for capabilities: */ /* can the hardware decode MPEG1 and/or MPEG2? */ #define VIDEO_CAP_MPEG1 1 #define VIDEO_CAP_MPEG2 2 /* can you send a system and/or program stream to video device? (you still have to open the video and the audio device but only send the stream to the video device) */ #define VIDEO_CAP_SYS 4 #define VIDEO_CAP_PROG 8 /* can the driver also handle SPU, NAVI and CSS encoded data? (CSS API is not present yet) */ #define VIDEO_CAP_SPU 16 #define VIDEO_CAP_NAVI 32 #define VIDEO_CAP_CSS 64 #define VIDEO_STOP _IO('o', 21) #define VIDEO_PLAY _IO('o', 22) #define VIDEO_FREEZE _IO('o', 23) #define VIDEO_CONTINUE _IO('o', 24) #define VIDEO_SELECT_SOURCE _IO('o', 25) #define VIDEO_SET_BLANK _IO('o', 26) #define VIDEO_GET_STATUS _IOR('o', 27, struct video_status) #define VIDEO_GET_EVENT _IOR('o', 28, struct video_event) #define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29) #define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture) #define VIDEO_FAST_FORWARD _IO('o', 31) #define VIDEO_SLOWMOTION _IO('o', 32) #define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int) #define VIDEO_CLEAR_BUFFER _IO('o', 34) #define VIDEO_SET_ID _IO('o', 35) #define VIDEO_SET_STREAMTYPE _IO('o', 36) #define VIDEO_SET_FORMAT _IO('o', 37) #define VIDEO_SET_SYSTEM _IO('o', 38) #define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t) #define VIDEO_SET_SPU _IOW('o', 50, video_spu_t) #define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t) #define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t) #define VIDEO_SET_ATTRIBUTES _IO('o', 53) #define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) #define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int) /** * VIDEO_GET_PTS * * Read the 33 bit presentation time stamp as defined * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. * * The PTS should belong to the currently played * frame if possible, but may also be a value close to it * like the PTS of the last decoded frame or the last PTS * extracted by the PES parser. */ #define VIDEO_GET_PTS _IOR('o', 57, __u64) /* Read the number of displayed frames since the decoder was started */ #define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64) #define VIDEO_COMMAND _IOWR('o', 59, struct video_command) #define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command) #endif /* _DVBVIDEO_H_ */ linux/genwqe/genwqe_card.h 0000644 00000042612 15063602047 0011631 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __GENWQE_CARD_H__ #define __GENWQE_CARD_H__ /** * IBM Accelerator Family 'GenWQE' * * (C) Copyright IBM Corp. 2013 * * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> * Author: Michael Jung <mijung@gmx.net> * Author: Michael Ruettger <michael@ibmra.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2 only) * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ /* * User-space API for the GenWQE card. For debugging and test purposes * the register addresses are included here too. */ #include <linux/types.h> #include <linux/ioctl.h> /* Basename of sysfs, debugfs and /dev interfaces */ #define GENWQE_DEVNAME "genwqe" #define GENWQE_TYPE_ALTERA_230 0x00 /* GenWQE4 Stratix-IV-230 */ #define GENWQE_TYPE_ALTERA_530 0x01 /* GenWQE4 Stratix-IV-530 */ #define GENWQE_TYPE_ALTERA_A4 0x02 /* GenWQE5 A4 Stratix-V-A4 */ #define GENWQE_TYPE_ALTERA_A7 0x03 /* GenWQE5 A7 Stratix-V-A7 */ /* MMIO Unit offsets: Each UnitID occupies a defined address range */ #define GENWQE_UID_OFFS(uid) ((uid) << 24) #define GENWQE_SLU_OFFS GENWQE_UID_OFFS(0) #define GENWQE_HSU_OFFS GENWQE_UID_OFFS(1) #define GENWQE_APP_OFFS GENWQE_UID_OFFS(2) #define GENWQE_MAX_UNITS 3 /* Common offsets per UnitID */ #define IO_EXTENDED_ERROR_POINTER 0x00000048 #define IO_ERROR_INJECT_SELECTOR 0x00000060 #define IO_EXTENDED_DIAG_SELECTOR 0x00000070 #define IO_EXTENDED_DIAG_READ_MBX 0x00000078 #define IO_EXTENDED_DIAG_MAP(ring) (0x00000500 | ((ring) << 3)) #define GENWQE_EXTENDED_DIAG_SELECTOR(ring, trace) (((ring) << 8) | (trace)) /* UnitID 0: Service Layer Unit (SLU) */ /* SLU: Unit Configuration Register */ #define IO_SLU_UNITCFG 0x00000000 #define IO_SLU_UNITCFG_TYPE_MASK 0x000000000ff00000 /* 27:20 */ /* SLU: Fault Isolation Register (FIR) (ac_slu_fir) */ #define IO_SLU_FIR 0x00000008 /* read only, wr direct */ #define IO_SLU_FIR_CLR 0x00000010 /* read and clear */ /* SLU: First Error Capture Register (FEC/WOF) */ #define IO_SLU_FEC 0x00000018 #define IO_SLU_ERR_ACT_MASK 0x00000020 #define IO_SLU_ERR_ATTN_MASK 0x00000028 #define IO_SLU_FIRX1_ACT_MASK 0x00000030 #define IO_SLU_FIRX0_ACT_MASK 0x00000038 #define IO_SLU_SEC_LEM_DEBUG_OVR 0x00000040 #define IO_SLU_EXTENDED_ERR_PTR 0x00000048 #define IO_SLU_COMMON_CONFIG 0x00000060 #define IO_SLU_FLASH_FIR 0x00000108 #define IO_SLU_SLC_FIR 0x00000110 #define IO_SLU_RIU_TRAP 0x00000280 #define IO_SLU_FLASH_FEC 0x00000308 #define IO_SLU_SLC_FEC 0x00000310 /* * The Virtual Function's Access is from offset 0x00010000 * The Physical Function's Access is from offset 0x00050000 * Single Shared Registers exists only at offset 0x00060000 * * SLC: Queue Virtual Window Window for accessing into a specific VF * queue. When accessing the 0x10000 space using the 0x50000 address * segment, the value indicated here is used to specify which VF * register is decoded. This register, and the 0x50000 register space * can only be accessed by the PF. Example, if this register is set to * 0x2, then a read from 0x50000 is the same as a read from 0x10000 * from VF=2. */ /* SLC: Queue Segment */ #define IO_SLC_QUEUE_SEGMENT 0x00010000 #define IO_SLC_VF_QUEUE_SEGMENT 0x00050000 /* SLC: Queue Offset */ #define IO_SLC_QUEUE_OFFSET 0x00010008 #define IO_SLC_VF_QUEUE_OFFSET 0x00050008 /* SLC: Queue Configuration */ #define IO_SLC_QUEUE_CONFIG 0x00010010 #define IO_SLC_VF_QUEUE_CONFIG 0x00050010 /* SLC: Job Timout/Only accessible for the PF */ #define IO_SLC_APPJOB_TIMEOUT 0x00010018 #define IO_SLC_VF_APPJOB_TIMEOUT 0x00050018 #define TIMEOUT_250MS 0x0000000f #define HEARTBEAT_DISABLE 0x0000ff00 /* SLC: Queue InitSequence Register */ #define IO_SLC_QUEUE_INITSQN 0x00010020 #define IO_SLC_VF_QUEUE_INITSQN 0x00050020 /* SLC: Queue Wrap */ #define IO_SLC_QUEUE_WRAP 0x00010028 #define IO_SLC_VF_QUEUE_WRAP 0x00050028 /* SLC: Queue Status */ #define IO_SLC_QUEUE_STATUS 0x00010100 #define IO_SLC_VF_QUEUE_STATUS 0x00050100 /* SLC: Queue Working Time */ #define IO_SLC_QUEUE_WTIME 0x00010030 #define IO_SLC_VF_QUEUE_WTIME 0x00050030 /* SLC: Queue Error Counts */ #define IO_SLC_QUEUE_ERRCNTS 0x00010038 #define IO_SLC_VF_QUEUE_ERRCNTS 0x00050038 /* SLC: Queue Loast Response Word */ #define IO_SLC_QUEUE_LRW 0x00010040 #define IO_SLC_VF_QUEUE_LRW 0x00050040 /* SLC: Freerunning Timer */ #define IO_SLC_FREE_RUNNING_TIMER 0x00010108 #define IO_SLC_VF_FREE_RUNNING_TIMER 0x00050108 /* SLC: Queue Virtual Access Region */ #define IO_PF_SLC_VIRTUAL_REGION 0x00050000 /* SLC: Queue Virtual Window */ #define IO_PF_SLC_VIRTUAL_WINDOW 0x00060000 /* SLC: DDCB Application Job Pending [n] (n=0:63) */ #define IO_PF_SLC_JOBPEND(n) (0x00061000 + 8*(n)) #define IO_SLC_JOBPEND(n) IO_PF_SLC_JOBPEND(n) /* SLC: Parser Trap RAM [n] (n=0:31) */ #define IO_SLU_SLC_PARSE_TRAP(n) (0x00011000 + 8*(n)) /* SLC: Dispatcher Trap RAM [n] (n=0:31) */ #define IO_SLU_SLC_DISP_TRAP(n) (0x00011200 + 8*(n)) /* Global Fault Isolation Register (GFIR) */ #define IO_SLC_CFGREG_GFIR 0x00020000 #define GFIR_ERR_TRIGGER 0x0000ffff /* SLU: Soft Reset Register */ #define IO_SLC_CFGREG_SOFTRESET 0x00020018 /* SLU: Misc Debug Register */ #define IO_SLC_MISC_DEBUG 0x00020060 #define IO_SLC_MISC_DEBUG_CLR 0x00020068 #define IO_SLC_MISC_DEBUG_SET 0x00020070 /* Temperature Sensor Reading */ #define IO_SLU_TEMPERATURE_SENSOR 0x00030000 #define IO_SLU_TEMPERATURE_CONFIG 0x00030008 /* Voltage Margining Control */ #define IO_SLU_VOLTAGE_CONTROL 0x00030080 #define IO_SLU_VOLTAGE_NOMINAL 0x00000000 #define IO_SLU_VOLTAGE_DOWN5 0x00000006 #define IO_SLU_VOLTAGE_UP5 0x00000007 /* Direct LED Control Register */ #define IO_SLU_LEDCONTROL 0x00030100 /* SLU: Flashbus Direct Access -A5 */ #define IO_SLU_FLASH_DIRECTACCESS 0x00040010 /* SLU: Flashbus Direct Access2 -A5 */ #define IO_SLU_FLASH_DIRECTACCESS2 0x00040020 /* SLU: Flashbus Command Interface -A5 */ #define IO_SLU_FLASH_CMDINTF 0x00040030 /* SLU: BitStream Loaded */ #define IO_SLU_BITSTREAM 0x00040040 /* This Register has a switch which will change the CAs to UR */ #define IO_HSU_ERR_BEHAVIOR 0x01001010 #define IO_SLC2_SQB_TRAP 0x00062000 #define IO_SLC2_QUEUE_MANAGER_TRAP 0x00062008 #define IO_SLC2_FLS_MASTER_TRAP 0x00062010 /* UnitID 1: HSU Registers */ #define IO_HSU_UNITCFG 0x01000000 #define IO_HSU_FIR 0x01000008 #define IO_HSU_FIR_CLR 0x01000010 #define IO_HSU_FEC 0x01000018 #define IO_HSU_ERR_ACT_MASK 0x01000020 #define IO_HSU_ERR_ATTN_MASK 0x01000028 #define IO_HSU_FIRX1_ACT_MASK 0x01000030 #define IO_HSU_FIRX0_ACT_MASK 0x01000038 #define IO_HSU_SEC_LEM_DEBUG_OVR 0x01000040 #define IO_HSU_EXTENDED_ERR_PTR 0x01000048 #define IO_HSU_COMMON_CONFIG 0x01000060 /* UnitID 2: Application Unit (APP) */ #define IO_APP_UNITCFG 0x02000000 #define IO_APP_FIR 0x02000008 #define IO_APP_FIR_CLR 0x02000010 #define IO_APP_FEC 0x02000018 #define IO_APP_ERR_ACT_MASK 0x02000020 #define IO_APP_ERR_ATTN_MASK 0x02000028 #define IO_APP_FIRX1_ACT_MASK 0x02000030 #define IO_APP_FIRX0_ACT_MASK 0x02000038 #define IO_APP_SEC_LEM_DEBUG_OVR 0x02000040 #define IO_APP_EXTENDED_ERR_PTR 0x02000048 #define IO_APP_COMMON_CONFIG 0x02000060 #define IO_APP_DEBUG_REG_01 0x02010000 #define IO_APP_DEBUG_REG_02 0x02010008 #define IO_APP_DEBUG_REG_03 0x02010010 #define IO_APP_DEBUG_REG_04 0x02010018 #define IO_APP_DEBUG_REG_05 0x02010020 #define IO_APP_DEBUG_REG_06 0x02010028 #define IO_APP_DEBUG_REG_07 0x02010030 #define IO_APP_DEBUG_REG_08 0x02010038 #define IO_APP_DEBUG_REG_09 0x02010040 #define IO_APP_DEBUG_REG_10 0x02010048 #define IO_APP_DEBUG_REG_11 0x02010050 #define IO_APP_DEBUG_REG_12 0x02010058 #define IO_APP_DEBUG_REG_13 0x02010060 #define IO_APP_DEBUG_REG_14 0x02010068 #define IO_APP_DEBUG_REG_15 0x02010070 #define IO_APP_DEBUG_REG_16 0x02010078 #define IO_APP_DEBUG_REG_17 0x02010080 #define IO_APP_DEBUG_REG_18 0x02010088 /* Read/write from/to registers */ struct genwqe_reg_io { __u64 num; /* register offset/address */ __u64 val64; }; /* * All registers of our card will return values not equal this values. * If we see IO_ILLEGAL_VALUE on any of our MMIO register reads, the * card can be considered as unusable. It will need recovery. */ #define IO_ILLEGAL_VALUE 0xffffffffffffffffull /* * Generic DDCB execution interface. * * This interface is a first prototype resulting from discussions we * had with other teams which wanted to use the Genwqe card. It allows * to issue a DDCB request in a generic way. The request will block * until it finishes or time out with error. * * Some DDCBs require DMA addresses to be specified in the ASIV * block. The interface provies the capability to let the kernel * driver know where those addresses are by specifying the ATS field, * such that it can replace the user-space addresses with appropriate * DMA addresses or DMA addresses of a scatter gather list which is * dynamically created. * * Our hardware will refuse DDCB execution if the ATS field is not as * expected. That means the DDCB execution engine in the chip knows * where it expects DMA addresses within the ASIV part of the DDCB and * will check that against the ATS field definition. Any invalid or * unknown ATS content will lead to DDCB refusal. */ /* Genwqe chip Units */ #define DDCB_ACFUNC_SLU 0x00 /* chip service layer unit */ #define DDCB_ACFUNC_APP 0x01 /* chip application */ /* DDCB return codes (RETC) */ #define DDCB_RETC_IDLE 0x0000 /* Unexecuted/DDCB created */ #define DDCB_RETC_PENDING 0x0101 /* Pending Execution */ #define DDCB_RETC_COMPLETE 0x0102 /* Cmd complete. No error */ #define DDCB_RETC_FAULT 0x0104 /* App Err, recoverable */ #define DDCB_RETC_ERROR 0x0108 /* App Err, non-recoverable */ #define DDCB_RETC_FORCED_ERROR 0x01ff /* overwritten by driver */ #define DDCB_RETC_UNEXEC 0x0110 /* Unexe/Removed from queue */ #define DDCB_RETC_TERM 0x0120 /* Terminated */ #define DDCB_RETC_RES0 0x0140 /* Reserved */ #define DDCB_RETC_RES1 0x0180 /* Reserved */ /* DDCB Command Options (CMDOPT) */ #define DDCB_OPT_ECHO_FORCE_NO 0x0000 /* ECHO DDCB */ #define DDCB_OPT_ECHO_FORCE_102 0x0001 /* force return code */ #define DDCB_OPT_ECHO_FORCE_104 0x0002 #define DDCB_OPT_ECHO_FORCE_108 0x0003 #define DDCB_OPT_ECHO_FORCE_110 0x0004 /* only on PF ! */ #define DDCB_OPT_ECHO_FORCE_120 0x0005 #define DDCB_OPT_ECHO_FORCE_140 0x0006 #define DDCB_OPT_ECHO_FORCE_180 0x0007 #define DDCB_OPT_ECHO_COPY_NONE (0 << 5) #define DDCB_OPT_ECHO_COPY_ALL (1 << 5) /* Definitions of Service Layer Commands */ #define SLCMD_ECHO_SYNC 0x00 /* PF/VF */ #define SLCMD_MOVE_FLASH 0x06 /* PF only */ #define SLCMD_MOVE_FLASH_FLAGS_MODE 0x03 /* bit 0 and 1 used for mode */ #define SLCMD_MOVE_FLASH_FLAGS_DLOAD 0 /* mode: download */ #define SLCMD_MOVE_FLASH_FLAGS_EMUL 1 /* mode: emulation */ #define SLCMD_MOVE_FLASH_FLAGS_UPLOAD 2 /* mode: upload */ #define SLCMD_MOVE_FLASH_FLAGS_VERIFY 3 /* mode: verify */ #define SLCMD_MOVE_FLASH_FLAG_NOTAP (1 << 2)/* just dump DDCB and exit */ #define SLCMD_MOVE_FLASH_FLAG_POLL (1 << 3)/* wait for RETC >= 0102 */ #define SLCMD_MOVE_FLASH_FLAG_PARTITION (1 << 4) #define SLCMD_MOVE_FLASH_FLAG_ERASE (1 << 5) enum genwqe_card_state { GENWQE_CARD_UNUSED = 0, GENWQE_CARD_USED = 1, GENWQE_CARD_FATAL_ERROR = 2, GENWQE_CARD_RELOAD_BITSTREAM = 3, GENWQE_CARD_STATE_MAX, }; /* common struct for chip image exchange */ struct genwqe_bitstream { __u64 data_addr; /* pointer to image data */ __u32 size; /* size of image file */ __u32 crc; /* crc of this image */ __u64 target_addr; /* starting address in Flash */ __u32 partition; /* '0', '1', or 'v' */ __u32 uid; /* 1=host/x=dram */ __u64 slu_id; /* informational/sim: SluID */ __u64 app_id; /* informational/sim: AppID */ __u16 retc; /* returned from processing */ __u16 attn; /* attention code from processing */ __u32 progress; /* progress code from processing */ }; /* Issuing a specific DDCB command */ #define DDCB_LENGTH 256 /* for debug data */ #define DDCB_ASIV_LENGTH 104 /* len of the DDCB ASIV array */ #define DDCB_ASIV_LENGTH_ATS 96 /* ASIV in ATS architecture */ #define DDCB_ASV_LENGTH 64 /* len of the DDCB ASV array */ #define DDCB_FIXUPS 12 /* maximum number of fixups */ struct genwqe_debug_data { char driver_version[64]; __u64 slu_unitcfg; __u64 app_unitcfg; __u8 ddcb_before[DDCB_LENGTH]; __u8 ddcb_prev[DDCB_LENGTH]; __u8 ddcb_finished[DDCB_LENGTH]; }; /* * Address Translation Specification (ATS) definitions * * Each 4 bit within the ATS 64-bit word specify the required address * translation at the defined offset. * * 63 LSB * 6666.5555.5555.5544.4444.4443.3333.3333 ... 11 * 3210.9876.5432.1098.7654.3210.9876.5432 ... 1098.7654.3210 * * offset: 0x00 0x08 0x10 0x18 0x20 0x28 0x30 0x38 ... 0x68 0x70 0x78 * res res res res ASIV ... * The first 4 entries in the ATS word are reserved. The following nibbles * each describe at an 8 byte offset the format of the required data. */ #define ATS_TYPE_DATA 0x0ull /* data */ #define ATS_TYPE_FLAT_RD 0x4ull /* flat buffer read only */ #define ATS_TYPE_FLAT_RDWR 0x5ull /* flat buffer read/write */ #define ATS_TYPE_SGL_RD 0x6ull /* sgl read only */ #define ATS_TYPE_SGL_RDWR 0x7ull /* sgl read/write */ #define ATS_SET_FLAGS(_struct, _field, _flags) \ (((_flags) & 0xf) << (44 - (4 * (offsetof(_struct, _field) / 8)))) #define ATS_GET_FLAGS(_ats, _byte_offs) \ (((_ats) >> (44 - (4 * ((_byte_offs) / 8)))) & 0xf) /** * struct genwqe_ddcb_cmd - User parameter for generic DDCB commands * * On the way into the kernel the driver will read the whole data * structure. On the way out the driver will not copy the ASIV data * back to user-space. */ struct genwqe_ddcb_cmd { /* START of data copied to/from driver */ __u64 next_addr; /* chaining genwqe_ddcb_cmd */ __u64 flags; /* reserved */ __u8 acfunc; /* accelerators functional unit */ __u8 cmd; /* command to execute */ __u8 asiv_length; /* used parameter length */ __u8 asv_length; /* length of valid return values */ __u16 cmdopts; /* command options */ __u16 retc; /* return code from processing */ __u16 attn; /* attention code from processing */ __u16 vcrc; /* variant crc16 */ __u32 progress; /* progress code from processing */ __u64 deque_ts; /* dequeue time stamp */ __u64 cmplt_ts; /* completion time stamp */ __u64 disp_ts; /* SW processing start */ /* move to end and avoid copy-back */ __u64 ddata_addr; /* collect debug data */ /* command specific values */ __u8 asv[DDCB_ASV_LENGTH]; /* END of data copied from driver */ union { struct { __u64 ats; __u8 asiv[DDCB_ASIV_LENGTH_ATS]; }; /* used for flash update to keep it backward compatible */ __u8 __asiv[DDCB_ASIV_LENGTH]; }; /* END of data copied to driver */ }; #define GENWQE_IOC_CODE 0xa5 /* Access functions */ #define GENWQE_READ_REG64 _IOR(GENWQE_IOC_CODE, 30, struct genwqe_reg_io) #define GENWQE_WRITE_REG64 _IOW(GENWQE_IOC_CODE, 31, struct genwqe_reg_io) #define GENWQE_READ_REG32 _IOR(GENWQE_IOC_CODE, 32, struct genwqe_reg_io) #define GENWQE_WRITE_REG32 _IOW(GENWQE_IOC_CODE, 33, struct genwqe_reg_io) #define GENWQE_READ_REG16 _IOR(GENWQE_IOC_CODE, 34, struct genwqe_reg_io) #define GENWQE_WRITE_REG16 _IOW(GENWQE_IOC_CODE, 35, struct genwqe_reg_io) #define GENWQE_GET_CARD_STATE _IOR(GENWQE_IOC_CODE, 36, enum genwqe_card_state) /** * struct genwqe_mem - Memory pinning/unpinning information * @addr: virtual user space address * @size: size of the area pin/dma-map/unmap * direction: 0: read/1: read and write * * Avoid pinning and unpinning of memory pages dynamically. Instead * the idea is to pin the whole buffer space required for DDCB * opertionas in advance. The driver will reuse this pinning and the * memory associated with it to setup the sglists for the DDCB * requests without the need to allocate and free memory or map and * unmap to get the DMA addresses. * * The inverse operation needs to be called after the pinning is not * needed anymore. The pinnings else the pinnings will get removed * after the device is closed. Note that pinnings will required * memory. */ struct genwqe_mem { __u64 addr; __u64 size; __u64 direction; __u64 flags; }; #define GENWQE_PIN_MEM _IOWR(GENWQE_IOC_CODE, 40, struct genwqe_mem) #define GENWQE_UNPIN_MEM _IOWR(GENWQE_IOC_CODE, 41, struct genwqe_mem) /* * Generic synchronous DDCB execution interface. * Synchronously execute a DDCB. * * Return: 0 on success or negative error code. * -EINVAL: Invalid parameters (ASIV_LEN, ASV_LEN, illegal fixups * no mappings found/could not create mappings * -EFAULT: illegal addresses in fixups, purging failed * -EBADMSG: enqueing failed, retc != DDCB_RETC_COMPLETE */ #define GENWQE_EXECUTE_DDCB \ _IOWR(GENWQE_IOC_CODE, 50, struct genwqe_ddcb_cmd) #define GENWQE_EXECUTE_RAW_DDCB \ _IOWR(GENWQE_IOC_CODE, 51, struct genwqe_ddcb_cmd) /* Service Layer functions (PF only) */ #define GENWQE_SLU_UPDATE _IOWR(GENWQE_IOC_CODE, 80, struct genwqe_bitstream) #define GENWQE_SLU_READ _IOWR(GENWQE_IOC_CODE, 81, struct genwqe_bitstream) #endif /* __GENWQE_CARD_H__ */ linux/fib_rules.h 0000644 00000003764 15063602047 0010043 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_FIB_RULES_H #define __LINUX_FIB_RULES_H #include <linux/types.h> #include <linux/rtnetlink.h> /* rule is permanent, and cannot be deleted */ #define FIB_RULE_PERMANENT 0x00000001 #define FIB_RULE_INVERT 0x00000002 #define FIB_RULE_UNRESOLVED 0x00000004 #define FIB_RULE_IIF_DETACHED 0x00000008 #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED #define FIB_RULE_OIF_DETACHED 0x00000010 /* try to find source address in routing lookups */ #define FIB_RULE_FIND_SADDR 0x00010000 struct fib_rule_hdr { __u8 family; __u8 dst_len; __u8 src_len; __u8 tos; __u8 table; __u8 res1; /* reserved */ __u8 res2; /* reserved */ __u8 action; __u32 flags; }; struct fib_rule_uid_range { __u32 start; __u32 end; }; struct fib_rule_port_range { __u16 start; __u16 end; }; enum { FRA_UNSPEC, FRA_DST, /* destination address */ FRA_SRC, /* source address */ FRA_IIFNAME, /* interface name */ #define FRA_IFNAME FRA_IIFNAME FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ FRA_UNUSED2, FRA_PRIORITY, /* priority/preference */ FRA_UNUSED3, FRA_UNUSED4, FRA_UNUSED5, FRA_FWMARK, /* mark */ FRA_FLOW, /* flow/class id */ FRA_TUN_ID, FRA_SUPPRESS_IFGROUP, FRA_SUPPRESS_PREFIXLEN, FRA_TABLE, /* Extended table id */ FRA_FWMASK, /* mask for netfilter mark */ FRA_OIFNAME, FRA_PAD, FRA_L3MDEV, /* iif or oif is l3mdev goto its table */ FRA_UID_RANGE, /* UID range */ FRA_PROTOCOL, /* Originator of the rule */ FRA_IP_PROTO, /* ip proto */ FRA_SPORT_RANGE, /* sport */ FRA_DPORT_RANGE, /* dport */ __FRA_MAX }; #define FRA_MAX (__FRA_MAX - 1) enum { FR_ACT_UNSPEC, FR_ACT_TO_TBL, /* Pass to fixed table */ FR_ACT_GOTO, /* Jump to another rule */ FR_ACT_NOP, /* No operation */ FR_ACT_RES3, FR_ACT_RES4, FR_ACT_BLACKHOLE, /* Drop without notification */ FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ FR_ACT_PROHIBIT, /* Drop with EACCES */ __FR_ACT_MAX, }; #define FR_ACT_MAX (__FR_ACT_MAX - 1) #endif linux/fiemap.h 0000644 00000005327 15063602047 0007327 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * FS_IOC_FIEMAP ioctl infrastructure. * * Some portions copyright (C) 2007 Cluster File Systems, Inc * * Authors: Mark Fasheh <mfasheh@suse.com> * Kalpak Shah <kalpak.shah@sun.com> * Andreas Dilger <adilger@sun.com> */ #ifndef _LINUX_FIEMAP_H #define _LINUX_FIEMAP_H #include <linux/types.h> struct fiemap_extent { __u64 fe_logical; /* logical offset in bytes for the start of * the extent from the beginning of the file */ __u64 fe_physical; /* physical offset in bytes for the start * of the extent from the beginning of the disk */ __u64 fe_length; /* length in bytes for this extent */ __u64 fe_reserved64[2]; __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ __u32 fe_reserved[3]; }; struct fiemap { __u64 fm_start; /* logical offset (inclusive) at * which to start mapping (in) */ __u64 fm_length; /* logical length of mapping which * userspace wants (in) */ __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ __u32 fm_extent_count; /* size of fm_extents array (in) */ __u32 fm_reserved; struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ }; #define FIEMAP_MAX_OFFSET (~0ULL) #define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ #define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ #define FIEMAP_FLAG_CACHE 0x00000004 /* request caching of the extents */ #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) #define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ #define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ #define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. * Sets EXTENT_UNKNOWN. */ #define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read * while fs is unmounted */ #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. * Sets EXTENT_NO_BYPASS. */ #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be * block aligned. */ #define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. * Sets EXTENT_NOT_ALIGNED.*/ #define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. * Sets EXTENT_NOT_ALIGNED.*/ #define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but * no data (i.e. zero). */ #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively * support extents. Result * merged for efficiency. */ #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other * files. */ #endif /* _LINUX_FIEMAP_H */ linux/filter.h 0000644 00000004250 15063602047 0007345 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Linux Socket Filter Data Structures */ #ifndef __LINUX_FILTER_H__ #define __LINUX_FILTER_H__ #include <linux/types.h> #include <linux/bpf_common.h> /* * Current version of the filter code architecture. */ #define BPF_MAJOR_VERSION 1 #define BPF_MINOR_VERSION 1 /* * Try and keep these values and structures similar to BSD, especially * the BPF code definitions which need to match so you can share filters */ struct sock_filter { /* Filter block */ __u16 code; /* Actual filter code */ __u8 jt; /* Jump true */ __u8 jf; /* Jump false */ __u32 k; /* Generic multiuse field */ }; struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ unsigned short len; /* Number of filter blocks */ struct sock_filter *filter; }; /* ret - BPF_K and BPF_X also apply */ #define BPF_RVAL(code) ((code) & 0x18) #define BPF_A 0x10 /* misc */ #define BPF_MISCOP(code) ((code) & 0xf8) #define BPF_TAX 0x00 #define BPF_TXA 0x80 /* * Macros for filter block array initializers. */ #ifndef BPF_STMT #define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } #endif #ifndef BPF_JUMP #define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } #endif /* * Number of scratch memory words for: BPF_ST and BPF_STX */ #define BPF_MEMWORDS 16 /* RATIONALE. Negative offsets are invalid in BPF. We use them to reference ancillary data. Unlike introduction new instructions, it does not break existing compilers/optimizers. */ #define SKF_AD_OFF (-0x1000) #define SKF_AD_PROTOCOL 0 #define SKF_AD_PKTTYPE 4 #define SKF_AD_IFINDEX 8 #define SKF_AD_NLATTR 12 #define SKF_AD_NLATTR_NEST 16 #define SKF_AD_MARK 20 #define SKF_AD_QUEUE 24 #define SKF_AD_HATYPE 28 #define SKF_AD_RXHASH 32 #define SKF_AD_CPU 36 #define SKF_AD_ALU_XOR_X 40 #define SKF_AD_VLAN_TAG 44 #define SKF_AD_VLAN_TAG_PRESENT 48 #define SKF_AD_PAY_OFFSET 52 #define SKF_AD_RANDOM 56 #define SKF_AD_VLAN_TPID 60 #define SKF_AD_MAX 64 #define SKF_NET_OFF (-0x100000) #define SKF_LL_OFF (-0x200000) #define BPF_NET_OFF SKF_NET_OFF #define BPF_LL_OFF SKF_LL_OFF #endif /* __LINUX_FILTER_H__ */ linux/firewire-cdev.h 0000644 00000125556 15063602047 0010630 0 ustar 00 /* * Char device interface. * * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _LINUX_FIREWIRE_CDEV_H #define _LINUX_FIREWIRE_CDEV_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/firewire-constants.h> /* available since kernel version 2.6.22 */ #define FW_CDEV_EVENT_BUS_RESET 0x00 #define FW_CDEV_EVENT_RESPONSE 0x01 #define FW_CDEV_EVENT_REQUEST 0x02 #define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 /* available since kernel version 2.6.30 */ #define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 #define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 /* available since kernel version 2.6.36 */ #define FW_CDEV_EVENT_REQUEST2 0x06 #define FW_CDEV_EVENT_PHY_PACKET_SENT 0x07 #define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08 #define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09 /** * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types * @closure: For arbitrary use by userspace * @type: Discriminates the fw_cdev_event_ types * * This struct may be used to access generic members of all fw_cdev_event_ * types regardless of the specific type. * * Data passed in the @closure field for a request will be returned in the * corresponding event. It is big enough to hold a pointer on all platforms. * The ioctl used to set @closure depends on the @type of event. */ struct fw_cdev_event_common { __u64 closure; __u32 type; }; /** * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET * @node_id: New node ID of this node * @local_node_id: Node ID of the local node, i.e. of the controller * @bm_node_id: Node ID of the bus manager * @irm_node_id: Node ID of the iso resource manager * @root_node_id: Node ID of the root node * @generation: New bus generation * * This event is sent when the bus the device belongs to goes through a bus * reset. It provides information about the new bus configuration, such as * new node ID for this device, new root ID, and others. * * If @bm_node_id is 0xffff right after bus reset it can be reread by an * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished. * Kernels with ABI version < 4 do not set @bm_node_id. */ struct fw_cdev_event_bus_reset { __u64 closure; __u32 type; __u32 node_id; __u32 local_node_id; __u32 bm_node_id; __u32 irm_node_id; __u32 root_node_id; __u32 generation; }; /** * struct fw_cdev_event_response - Sent when a response packet was received * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE * @rcode: Response code returned by the remote node * @length: Data length, i.e. the response's payload size in bytes * @data: Payload data, if any * * This event is sent when the stack receives a response to an outgoing request * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses * carrying data (read and lock responses) follows immediately and can be * accessed through the @data field. * * The event is also generated after conclusions of transactions that do not * involve response packets. This includes unified write transactions, * broadcast write transactions, and transmission of asynchronous stream * packets. @rcode indicates success or failure of such transmissions. */ struct fw_cdev_event_response { __u64 closure; __u32 type; __u32 rcode; __u32 length; __u32 data[0]; }; /** * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST * * This event is sent instead of &fw_cdev_event_request2 if the kernel or * the client implements ABI version <= 3. &fw_cdev_event_request lacks * essential information; use &fw_cdev_event_request2 instead. */ struct fw_cdev_event_request { __u64 closure; __u32 type; __u32 tcode; __u64 offset; __u32 handle; __u32 length; __u32 data[0]; }; /** * struct fw_cdev_event_request2 - Sent on incoming request to an address region * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2 * @tcode: Transaction code of the incoming request * @offset: The offset into the 48-bit per-node address space * @source_node_id: Sender node ID * @destination_node_id: Destination node ID * @card: The index of the card from which the request came * @generation: Bus generation in which the request is valid * @handle: Reference to the kernel-side pending request * @length: Data length, i.e. the request's payload size in bytes * @data: Incoming data, if any * * This event is sent when the stack receives an incoming request to an address * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is * guaranteed to be completely contained in the specified region. Userspace is * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl, * using the same @handle. * * The payload data for requests carrying data (write and lock requests) * follows immediately and can be accessed through the @data field. * * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT, * i.e. encodes the extended transaction code. * * @card may differ from &fw_cdev_get_info.card because requests are received * from all cards of the Linux host. @source_node_id, @destination_node_id, and * @generation pertain to that card. Destination node ID and bus generation may * therefore differ from the corresponding fields of the last * &fw_cdev_event_bus_reset. * * @destination_node_id may also differ from the current node ID because of a * non-local bus ID part or in case of a broadcast write request. Note, a * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a * broadcast write request; the kernel will then release the kernel-side pending * request but will not actually send a response packet. * * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already * sent a write response immediately after the request was received; in this * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to * release the kernel-side pending request, though another response won't be * sent. * * If the client subsequently needs to initiate requests to the sender node of * an &fw_cdev_event_request2, it needs to use a device file with matching * card index, node ID, and generation for outbound requests. */ struct fw_cdev_event_request2 { __u64 closure; __u32 type; __u32 tcode; __u64 offset; __u32 source_node_id; __u32 destination_node_id; __u32 card; __u32 generation; __u32 handle; __u32 length; __u32 data[0]; }; /** * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed * @closure: See &fw_cdev_event_common; * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT * @cycle: Cycle counter of the last completed packet * @header_length: Total length of following headers, in bytes * @header: Stripped headers, if any * * This event is sent when the controller has completed an &fw_cdev_iso_packet * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets * without the interrupt bit set that the kernel's internal buffer for @header * is about to overflow. (In the last case, ABI versions < 5 drop header data * up to the next interrupt packet.) * * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): * * In version 3 and some implementations of version 2 of the ABI, &header_length * is a multiple of 4 and &header contains timestamps of all packets up until * the interrupt packet. The format of the timestamps is as described below for * isochronous reception. In version 1 of the ABI, &header_length was 0. * * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE): * * The headers stripped of all packets up until and including the interrupt * packet are returned in the @header field. The amount of header data per * packet is as specified at iso context creation by * &fw_cdev_create_iso_context.header_size. * * Hence, _interrupt.header_length / _context.header_size is the number of * packets received in this interrupt event. The client can now iterate * through the mmap()'ed DMA buffer according to this number of packets and * to the buffer sizes as the client specified in &fw_cdev_queue_iso. * * Since version 2 of this ABI, the portion for each packet in _interrupt.header * consists of the 1394 isochronous packet header, followed by a timestamp * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets * from the packet payload if &fw_cdev_create_iso_context.header_size > 8. * * Format of 1394 iso packet header: 16 bits data_length, 2 bits tag, 6 bits * channel, 4 bits tcode, 4 bits sy, in big endian byte order. * data_length is the actual received size of the packet without the four * 1394 iso packet header bytes. * * Format of timestamp: 16 bits invalid, 3 bits cycleSeconds, 13 bits * cycleCount, in big endian byte order. * * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload * data followed directly after the 1394 is header if header_size > 4. * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. */ struct fw_cdev_event_iso_interrupt { __u64 closure; __u32 type; __u32 cycle; __u32 header_length; __u32 header[0]; }; /** * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed * @closure: See &fw_cdev_event_common; * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL * @completed: Offset into the receive buffer; data before this offset is valid * * This event is sent in multichannel contexts (context type * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer * chunks that have been completely filled and that have the * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with * %FW_CDEV_IOC_FLUSH_ISO. * * The buffer is continuously filled with the following data, per packet: * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, * but in little endian byte order, * - packet payload (as many bytes as specified in the data_length field of * the 1394 iso packet header) in big endian byte order, * - 0...3 padding bytes as needed to align the following trailer quadlet, * - trailer quadlet, containing the reception timestamp as described at * &fw_cdev_event_iso_interrupt, but in little endian byte order. * * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8. * When processing the data, stop before a packet that would cross the * @completed offset. * * A packet near the end of a buffer chunk will typically spill over into the * next queued buffer chunk. It is the responsibility of the client to check * for this condition, assemble a broken-up packet from its parts, and not to * re-queue any buffer chunks in which as yet unread packet parts reside. */ struct fw_cdev_event_iso_interrupt_mc { __u64 closure; __u32 type; __u32 completed; }; /** * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed * @closure: See &fw_cdev_event_common; * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED * @handle: Reference by which an allocated resource can be deallocated * @channel: Isochronous channel which was (de)allocated, if any * @bandwidth: Bandwidth allocation units which were (de)allocated, if any * * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous * resource was allocated at the IRM. The client has to check @channel and * @bandwidth for whether the allocation actually succeeded. * * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous * resource was deallocated at the IRM. It is also sent when automatic * reallocation after a bus reset failed. * * @channel is <0 if no channel was (de)allocated or if reallocation failed. * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed. */ struct fw_cdev_event_iso_resource { __u64 closure; __u32 type; __u32 handle; __s32 channel; __s32 bandwidth; }; /** * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED * @rcode: %RCODE_..., indicates success or failure of transmission * @length: Data length in bytes * @data: Incoming data * * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty, * except in case of a ping packet: Then, @length is 4, and @data[0] is the * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE. * * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data * consists of the two PHY packet quadlets, in host byte order. */ struct fw_cdev_event_phy_packet { __u64 closure; __u32 type; __u32 rcode; __u32 length; __u32 data[0]; }; /** * union fw_cdev_event - Convenience union of fw_cdev_event_ types * @common: Valid for all types * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT * @iso_interrupt_mc: Valid if @common.type == * %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL * @iso_resource: Valid if @common.type == * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED * @phy_packet: Valid if @common.type == * %FW_CDEV_EVENT_PHY_PACKET_SENT or * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED * * Convenience union for userspace use. Events could be read(2) into an * appropriately aligned char buffer and then cast to this union for further * processing. Note that for a request, response or iso_interrupt event, * the data[] or header[] may make the size of the full event larger than * sizeof(union fw_cdev_event). Also note that if you attempt to read(2) * an event into a buffer that is not large enough for it, the data that does * not fit will be discarded so that the next read(2) will return a new event. */ union fw_cdev_event { struct fw_cdev_event_common common; struct fw_cdev_event_bus_reset bus_reset; struct fw_cdev_event_response response; struct fw_cdev_event_request request; struct fw_cdev_event_request2 request2; /* added in 2.6.36 */ struct fw_cdev_event_iso_interrupt iso_interrupt; struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */ struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */ struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */ }; /* available since kernel version 2.6.22 */ #define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) #define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) #define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) #define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) #define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) #define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) #define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) /* available since kernel version 2.6.24 */ #define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer) /* available since kernel version 2.6.30 */ #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource) #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate) #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource) #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource) #define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */ #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) /* available since kernel version 2.6.34 */ #define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) /* available since kernel version 2.6.36 */ #define FW_CDEV_IOC_SEND_PHY_PACKET _IOWR('#', 0x15, struct fw_cdev_send_phy_packet) #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) #define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) /* available since kernel version 3.4 */ #define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso) /* * ABI version history * 1 (2.6.22) - initial version * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if * &fw_cdev_create_iso_context.header_size is 8 or more * - added %FW_CDEV_IOC_*_ISO_RESOURCE*, * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST, * %FW_CDEV_IOC_SEND_STREAM_PACKET * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt * (2.6.33) - IR has always packet-per-buffer semantics now, not one of * dual-buffer or packet-per-buffer depending on hardware * - shared use and auto-response for FCP registers * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2 * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*, * and &fw_cdev_allocate.region_end * - implemented &fw_cdev_event_bus_reset.bm_node_id * - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and * %FW_CDEV_IOC_SET_ISO_CHANNELS * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to * avoid dropping data * - added %FW_CDEV_IOC_FLUSH_ISO */ /** * struct fw_cdev_get_info - General purpose information ioctl * @version: The version field is just a running serial number. Both an * input parameter (ABI version implemented by the client) and * output parameter (ABI version implemented by the kernel). * A client shall fill in the ABI @version for which the client * was implemented. This is necessary for forward compatibility. * @rom_length: If @rom is non-zero, up to @rom_length bytes of Configuration * ROM will be copied into that user space address. In either * case, @rom_length is updated with the actual length of the * Configuration ROM. * @rom: If non-zero, address of a buffer to be filled by a copy of the * device's Configuration ROM * @bus_reset: If non-zero, address of a buffer to be filled by a * &struct fw_cdev_event_bus_reset with the current state * of the bus. This does not cause a bus reset to happen. * @bus_reset_closure: Value of &closure in this and subsequent bus reset events * @card: The index of the card this device belongs to * * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client * performs right after it opened a /dev/fw* file. * * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2) * is started by this ioctl. */ struct fw_cdev_get_info { __u32 version; __u32 rom_length; __u64 rom; __u64 bus_reset; __u64 bus_reset_closure; __u32 card; }; /** * struct fw_cdev_send_request - Send an asynchronous request packet * @tcode: Transaction code of the request * @length: Length of outgoing payload, in bytes * @offset: 48-bit offset at destination node * @closure: Passed back to userspace in the response event * @data: Userspace pointer to payload * @generation: The bus generation where packet is valid * * Send a request to the device. This ioctl implements all outgoing requests. * Both quadlet and block request specify the payload as a pointer to the data * in the @data field. Once the transaction completes, the kernel writes an * &fw_cdev_event_response event back. The @closure field is passed back to * user space in the response event. */ struct fw_cdev_send_request { __u32 tcode; __u32 length; __u64 offset; __u64 closure; __u64 data; __u32 generation; }; /** * struct fw_cdev_send_response - Send an asynchronous response packet * @rcode: Response code as determined by the userspace handler * @length: Length of outgoing payload, in bytes * @data: Userspace pointer to payload * @handle: The handle from the &fw_cdev_event_request * * Send a response to an incoming request. By setting up an address range using * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must * send a reply using this ioctl. The event has a handle to the kernel-side * pending transaction, which should be used with this ioctl. */ struct fw_cdev_send_response { __u32 rcode; __u32 length; __u64 data; __u32 handle; }; /** * struct fw_cdev_allocate - Allocate a CSR in an address range * @offset: Start offset of the address range * @closure: To be passed back to userspace in request events * @length: Length of the CSR, in bytes * @handle: Handle to the allocation, written by the kernel * @region_end: First address above the address range (added in ABI v4, 2.6.36) * * Allocate an address range in the 48-bit address space on the local node * (the controller). This allows userspace to listen for requests with an * offset within that address range. Every time when the kernel receives a * request within the range, an &fw_cdev_event_request2 event will be emitted. * (If the kernel or the client implements ABI version <= 3, an * &fw_cdev_event_request will be generated instead.) * * The @closure field is passed back to userspace in these request events. * The @handle field is an out parameter, returning a handle to the allocated * range to be used for later deallocation of the range. * * The address range is allocated on all local nodes. The address allocation * is exclusive except for the FCP command and response registers. If an * exclusive address region is already in use, the ioctl fails with errno set * to %EBUSY. * * If kernel and client implement ABI version >= 4, the kernel looks up a free * spot of size @length inside [@offset..@region_end) and, if found, writes * the start address of the new CSR back in @offset. I.e. @offset is an * in and out parameter. If this automatic placement of a CSR in a bigger * address range is not desired, the client simply needs to set @region_end * = @offset + @length. * * If the kernel or the client implements ABI version <= 3, @region_end is * ignored and effectively assumed to be @offset + @length. * * @region_end is only present in a kernel header >= 2.6.36. If necessary, * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2. */ struct fw_cdev_allocate { __u64 offset; __u64 closure; __u32 length; __u32 handle; __u64 region_end; /* available since kernel version 2.6.36 */ }; /** * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource * @handle: Handle to the address range or iso resource, as returned by the * kernel when the range or resource was allocated */ struct fw_cdev_deallocate { __u32 handle; }; #define FW_CDEV_LONG_RESET 0 #define FW_CDEV_SHORT_RESET 1 /** * struct fw_cdev_initiate_bus_reset - Initiate a bus reset * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET * * Initiate a bus reset for the bus this device is on. The bus reset can be * either the original (long) bus reset or the arbitrated (short) bus reset * introduced in 1394a-2000. * * The ioctl returns immediately. A subsequent &fw_cdev_event_bus_reset * indicates when the reset actually happened. Since ABI v4, this may be * considerably later than the ioctl because the kernel ensures a grace period * between subsequent bus resets as per IEEE 1394 bus management specification. */ struct fw_cdev_initiate_bus_reset { __u32 type; }; /** * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM * @immediate: If non-zero, immediate key to insert before pointer * @key: Upper 8 bits of root directory pointer * @data: Userspace pointer to contents of descriptor block * @length: Length of descriptor block data, in quadlets * @handle: Handle to the descriptor, written by the kernel * * Add a descriptor block and optionally a preceding immediate key to the local * node's Configuration ROM. * * The @key field specifies the upper 8 bits of the descriptor root directory * pointer and the @data and @length fields specify the contents. The @key * should be of the form 0xXX000000. The offset part of the root directory entry * will be filled in by the kernel. * * If not 0, the @immediate field specifies an immediate key which will be * inserted before the root directory pointer. * * @immediate, @key, and @data array elements are CPU-endian quadlets. * * If successful, the kernel adds the descriptor and writes back a @handle to * the kernel-side object to be used for later removal of the descriptor block * and immediate key. The kernel will also generate a bus reset to signal the * change of the Configuration ROM to other nodes. * * This ioctl affects the Configuration ROMs of all local nodes. * The ioctl only succeeds on device files which represent a local node. */ struct fw_cdev_add_descriptor { __u32 immediate; __u32 key; __u64 data; __u32 length; __u32 handle; }; /** * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM * @handle: Handle to the descriptor, as returned by the kernel when the * descriptor was added * * Remove a descriptor block and accompanying immediate key from the local * nodes' Configuration ROMs. The kernel will also generate a bus reset to * signal the change of the Configuration ROM to other nodes. */ struct fw_cdev_remove_descriptor { __u32 handle; }; #define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 #define FW_CDEV_ISO_CONTEXT_RECEIVE 1 #define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 /* added in 2.6.36 */ /** * struct fw_cdev_create_iso_context - Create a context for isochronous I/O * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL * @header_size: Header size to strip in single-channel reception * @channel: Channel to bind to in single-channel reception or transmission * @speed: Transmission speed * @closure: To be returned in &fw_cdev_event_iso_interrupt or * &fw_cdev_event_iso_interrupt_multichannel * @handle: Handle to context, written back by kernel * * Prior to sending or receiving isochronous I/O, a context must be created. * The context records information about the transmit or receive configuration * and typically maps to an underlying hardware resource. A context is set up * for either sending or receiving. It is bound to a specific isochronous * @channel. * * In case of multichannel reception, @header_size and @channel are ignored * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS. * * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4 * and must be a multiple of 4. It is ignored in other context types. * * @speed is ignored in receive context types. * * If a context was successfully created, the kernel writes back a handle to the * context, which must be passed in for subsequent operations on that context. * * Limitations: * No more than one iso context can be created per fd. * The total number of contexts that all userspace and kernelspace drivers can * create on a card at a time is a hardware limit, typically 4 or 8 contexts per * direction, and of them at most one multichannel receive context. */ struct fw_cdev_create_iso_context { __u32 type; __u32 header_size; __u32 channel; __u32 speed; __u64 closure; __u32 handle; }; /** * struct fw_cdev_set_iso_channels - Select channels in multichannel reception * @channels: Bitmask of channels to listen to * @handle: Handle of the mutichannel receive context * * @channels is the bitwise or of 1ULL << n for each channel n to listen to. * * The ioctl fails with errno %EBUSY if there is already another receive context * on a channel in @channels. In that case, the bitmask of all unoccupied * channels is returned in @channels. */ struct fw_cdev_set_iso_channels { __u64 channels; __u32 handle; }; #define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) #define FW_CDEV_ISO_INTERRUPT (1 << 16) #define FW_CDEV_ISO_SKIP (1 << 17) #define FW_CDEV_ISO_SYNC (1 << 17) #define FW_CDEV_ISO_TAG(v) ((v) << 18) #define FW_CDEV_ISO_SY(v) ((v) << 20) #define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24) /** * struct fw_cdev_iso_packet - Isochronous packet * @control: Contains the header length (8 uppermost bits), * the sy field (4 bits), the tag field (2 bits), a sync flag * or a skip flag (1 bit), an interrupt flag (1 bit), and the * payload length (16 lowermost bits) * @header: Header and payload in case of a transmit context. * * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. * Use the FW_CDEV_ISO_ macros to fill in @control. * The @header array is empty in case of receive contexts. * * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT: * * @control.HEADER_LENGTH must be a multiple of 4. It specifies the numbers of * bytes in @header that will be prepended to the packet's payload. These bytes * are copied into the kernel and will not be accessed after the ioctl has * returned. * * The @control.SY and TAG fields are copied to the iso packet header. These * fields are specified by IEEE 1394a and IEC 61883-1. * * The @control.SKIP flag specifies that no packet is to be sent in a frame. * When using this, all other fields except @control.INTERRUPT must be zero. * * When a packet with the @control.INTERRUPT flag set has been completed, an * &fw_cdev_event_iso_interrupt event will be sent. * * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE: * * @control.HEADER_LENGTH must be a multiple of the context's header_size. * If the HEADER_LENGTH is larger than the context's header_size, multiple * packets are queued for this entry. * * The @control.SY and TAG fields are ignored. * * If the @control.SYNC flag is set, the context drops all packets until a * packet with a sy field is received which matches &fw_cdev_start_iso.sync. * * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for * one packet (in addition to payload quadlets that have been defined as headers * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure). * If more bytes are received, the additional bytes are dropped. If less bytes * are received, the remaining bytes in this part of the payload buffer will not * be written to, not even by the next packet. I.e., packets received in * consecutive frames will not necessarily be consecutive in memory. If an * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally * among them. * * When a packet with the @control.INTERRUPT flag set has been completed, an * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued * multiple receive packets is completed when its last packet is completed. * * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL: * * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since * it specifies a chunk of the mmap()'ed buffer, while the number and alignment * of packets to be placed into the buffer chunk is not known beforehand. * * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room * for header, payload, padding, and trailer bytes of one or more packets. * It must be a multiple of 4. * * @control.HEADER_LENGTH, TAG and SY are ignored. SYNC is treated as described * for single-channel reception. * * When a buffer chunk with the @control.INTERRUPT flag set has been filled * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent. */ struct fw_cdev_iso_packet { __u32 control; __u32 header[0]; }; /** * struct fw_cdev_queue_iso - Queue isochronous packets for I/O * @packets: Userspace pointer to an array of &fw_cdev_iso_packet * @data: Pointer into mmap()'ed payload buffer * @size: Size of the @packets array, in bytes * @handle: Isochronous context handle * * Queue a number of isochronous packets for reception or transmission. * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, * which describe how to transmit from or receive into a contiguous region * of a mmap()'ed payload buffer. As part of transmit packet descriptors, * a series of headers can be supplied, which will be prepended to the * payload during DMA. * * The kernel may or may not queue all packets, but will write back updated * values of the @packets, @data and @size fields, so the ioctl can be * resubmitted easily. * * In case of a multichannel receive context, @data must be quadlet-aligned * relative to the buffer start. */ struct fw_cdev_queue_iso { __u64 packets; __u64 data; __u32 size; __u32 handle; }; #define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8 #define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15 /** * struct fw_cdev_start_iso - Start an isochronous transmission or reception * @cycle: Cycle in which to start I/O. If @cycle is greater than or * equal to 0, the I/O will start on that cycle. * @sync: Determines the value to wait for for receive packets that have * the %FW_CDEV_ISO_SYNC bit set * @tags: Tag filter bit mask. Only valid for isochronous reception. * Determines the tag values for which packets will be accepted. * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags. * @handle: Isochronous context handle within which to transmit or receive */ struct fw_cdev_start_iso { __s32 cycle; __u32 sync; __u32 tags; __u32 handle; }; /** * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception * @handle: Handle of isochronous context to stop */ struct fw_cdev_stop_iso { __u32 handle; }; /** * struct fw_cdev_flush_iso - flush completed iso packets * @handle: handle of isochronous context to flush * * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, * report any completed packets. * * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current * offset in the receive buffer, if it has changed; this is typically in the * middle of some buffer chunk. * * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL * events generated by this ioctl are sent synchronously, i.e., are available * for reading from the file descriptor when this ioctl returns. */ struct fw_cdev_flush_iso { __u32 handle; }; /** * struct fw_cdev_get_cycle_timer - read cycle timer register * @local_time: system time, in microseconds since the Epoch * @cycle_timer: Cycle Time register contents * * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME * and only with microseconds resolution. * * In version 1 and 2 of the ABI, this ioctl returned unreliable (non- * monotonic) @cycle_timer values on certain controllers. */ struct fw_cdev_get_cycle_timer { __u64 local_time; __u32 cycle_timer; }; /** * struct fw_cdev_get_cycle_timer2 - read cycle timer register * @tv_sec: system time, seconds * @tv_nsec: system time, sub-seconds part in nanoseconds * @clk_id: input parameter, clock from which to get the system time * @cycle_timer: Cycle Time register contents * * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer * and also the system clock. This allows to correlate reception time of * isochronous packets with system time. * * @clk_id lets you choose a clock like with POSIX' clock_gettime function. * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC * and Linux' %CLOCK_MONOTONIC_RAW. * * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394. */ struct fw_cdev_get_cycle_timer2 { __s64 tv_sec; __s32 tv_nsec; __s32 clk_id; __u32 cycle_timer; }; /** * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth * @closure: Passed back to userspace in corresponding iso resource events * @channels: Isochronous channels of which one is to be (de)allocated * @bandwidth: Isochronous bandwidth units to be (de)allocated * @handle: Handle to the allocation, written by the kernel (only valid in * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls) * * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an * isochronous channel and/or of isochronous bandwidth at the isochronous * resource manager (IRM). Only one of the channels specified in @channels is * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after * communication with the IRM, indicating success or failure in the event data. * The kernel will automatically reallocate the resources after bus resets. * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event * will be sent. The kernel will also automatically deallocate the resources * when the file descriptor is closed. * * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate * deallocation of resources which were allocated as described above. * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. * * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation * without automatic re- or deallocation. * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation, * indicating success or failure in its data. * * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed * instead of allocated. * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. * * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources * for the lifetime of the fd or @handle. * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources * for the duration of a bus generation. * * @channels is a host-endian bitfield with the least significant bit * representing channel 0 and the most significant bit representing channel 63: * 1ULL << c for each channel c that is a candidate for (de)allocation. * * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send * one quadlet of data (payload or header data) at speed S1600. */ struct fw_cdev_allocate_iso_resource { __u64 closure; __u64 channels; __u32 bandwidth; __u32 handle; }; /** * struct fw_cdev_send_stream_packet - send an asynchronous stream packet * @length: Length of outgoing payload, in bytes * @tag: Data format tag * @channel: Isochronous channel to transmit to * @sy: Synchronization code * @closure: Passed back to userspace in the response event * @data: Userspace pointer to payload * @generation: The bus generation where packet is valid * @speed: Speed to transmit at * * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet * to every device which is listening to the specified channel. The kernel * writes an &fw_cdev_event_response event which indicates success or failure of * the transmission. */ struct fw_cdev_send_stream_packet { __u32 length; __u32 tag; __u32 channel; __u32 sy; __u64 closure; __u64 data; __u32 generation; __u32 speed; }; /** * struct fw_cdev_send_phy_packet - send a PHY packet * @closure: Passed back to userspace in the PHY-packet-sent event * @data: First and second quadlet of the PHY packet * @generation: The bus generation where packet is valid * * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes * on the same card as this device. After transmission, an * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated. * * The payload @data[] shall be specified in host byte order. Usually, * @data[1] needs to be the bitwise inverse of @data[0]. VersaPHY packets * are an exception to this rule. * * The ioctl is only permitted on device files which represent a local node. */ struct fw_cdev_send_phy_packet { __u64 closure; __u32 data[2]; __u32 generation; }; /** * struct fw_cdev_receive_phy_packets - start reception of PHY packets * @closure: Passed back to userspace in phy packet events * * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to * incoming PHY packets from any node on the same bus as the device. * * The ioctl is only permitted on device files which represent a local node. */ struct fw_cdev_receive_phy_packets { __u64 closure; }; #define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */ #endif /* _LINUX_FIREWIRE_CDEV_H */ linux/firewire-constants.h 0000644 00000006237 15063602047 0011715 0 ustar 00 /* * IEEE 1394 constants. * * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _LINUX_FIREWIRE_CONSTANTS_H #define _LINUX_FIREWIRE_CONSTANTS_H #define TCODE_WRITE_QUADLET_REQUEST 0x0 #define TCODE_WRITE_BLOCK_REQUEST 0x1 #define TCODE_WRITE_RESPONSE 0x2 #define TCODE_READ_QUADLET_REQUEST 0x4 #define TCODE_READ_BLOCK_REQUEST 0x5 #define TCODE_READ_QUADLET_RESPONSE 0x6 #define TCODE_READ_BLOCK_RESPONSE 0x7 #define TCODE_CYCLE_START 0x8 #define TCODE_LOCK_REQUEST 0x9 #define TCODE_STREAM_DATA 0xa #define TCODE_LOCK_RESPONSE 0xb #define EXTCODE_MASK_SWAP 0x1 #define EXTCODE_COMPARE_SWAP 0x2 #define EXTCODE_FETCH_ADD 0x3 #define EXTCODE_LITTLE_ADD 0x4 #define EXTCODE_BOUNDED_ADD 0x5 #define EXTCODE_WRAP_ADD 0x6 #define EXTCODE_VENDOR_DEPENDENT 0x7 /* Linux firewire-core (Juju) specific tcodes */ #define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) #define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) #define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) #define TCODE_LOCK_LITTLE_ADD (0x10 | EXTCODE_LITTLE_ADD) #define TCODE_LOCK_BOUNDED_ADD (0x10 | EXTCODE_BOUNDED_ADD) #define TCODE_LOCK_WRAP_ADD (0x10 | EXTCODE_WRAP_ADD) #define TCODE_LOCK_VENDOR_DEPENDENT (0x10 | EXTCODE_VENDOR_DEPENDENT) #define RCODE_COMPLETE 0x0 #define RCODE_CONFLICT_ERROR 0x4 #define RCODE_DATA_ERROR 0x5 #define RCODE_TYPE_ERROR 0x6 #define RCODE_ADDRESS_ERROR 0x7 /* Linux firewire-core (Juju) specific rcodes */ #define RCODE_SEND_ERROR 0x10 #define RCODE_CANCELLED 0x11 #define RCODE_BUSY 0x12 #define RCODE_GENERATION 0x13 #define RCODE_NO_ACK 0x14 #define SCODE_100 0x0 #define SCODE_200 0x1 #define SCODE_400 0x2 #define SCODE_800 0x3 #define SCODE_1600 0x4 #define SCODE_3200 0x5 #define SCODE_BETA 0x3 #define ACK_COMPLETE 0x1 #define ACK_PENDING 0x2 #define ACK_BUSY_X 0x4 #define ACK_BUSY_A 0x5 #define ACK_BUSY_B 0x6 #define ACK_DATA_ERROR 0xd #define ACK_TYPE_ERROR 0xe #define RETRY_1 0x00 #define RETRY_X 0x01 #define RETRY_A 0x02 #define RETRY_B 0x03 #endif /* _LINUX_FIREWIRE_CONSTANTS_H */ linux/flat.h 0000644 00000004144 15063602047 0007010 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com> * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com> * The Silver Hammer Group, Ltd. * * This file provides the definitions and structures needed to * support uClinux flat-format executables. */ #ifndef _LINUX_FLAT_H #define _LINUX_FLAT_H #define FLAT_VERSION 0x00000004L #ifdef CONFIG_BINFMT_SHARED_FLAT #define MAX_SHARED_LIBS (4) #else #define MAX_SHARED_LIBS (1) #endif /* * To make everything easier to port and manage cross platform * development, all fields are in network byte order. */ struct flat_hdr { char magic[4]; unsigned long rev; /* version (as above) */ unsigned long entry; /* Offset of first executable instruction with text segment from beginning of file */ unsigned long data_start; /* Offset of data segment from beginning of file */ unsigned long data_end; /* Offset of end of data segment from beginning of file */ unsigned long bss_end; /* Offset of end of bss segment from beginning of file */ /* (It is assumed that data_end through bss_end forms the bss segment.) */ unsigned long stack_size; /* Size of stack, in bytes */ unsigned long reloc_start; /* Offset of relocation records from beginning of file */ unsigned long reloc_count; /* Number of relocation records */ unsigned long flags; unsigned long build_date; /* When the program/library was built */ unsigned long filler[5]; /* Reservered, set to zero */ }; #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ #endif /* _LINUX_FLAT_H */ linux/fou.h 0000644 00000001266 15063602047 0006655 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* fou.h - FOU Interface */ #ifndef _LINUX_FOU_H #define _LINUX_FOU_H /* NETLINK_GENERIC related info */ #define FOU_GENL_NAME "fou" #define FOU_GENL_VERSION 0x1 enum { FOU_ATTR_UNSPEC, FOU_ATTR_PORT, /* u16 */ FOU_ATTR_AF, /* u8 */ FOU_ATTR_IPPROTO, /* u8 */ FOU_ATTR_TYPE, /* u8 */ FOU_ATTR_REMCSUM_NOPARTIAL, /* flag */ __FOU_ATTR_MAX, }; #define FOU_ATTR_MAX (__FOU_ATTR_MAX - 1) enum { FOU_CMD_UNSPEC, FOU_CMD_ADD, FOU_CMD_DEL, FOU_CMD_GET, __FOU_CMD_MAX, }; enum { FOU_ENCAP_UNSPEC, FOU_ENCAP_DIRECT, FOU_ENCAP_GUE, }; #define FOU_CMD_MAX (__FOU_CMD_MAX - 1) #endif /* _LINUX_FOU_H */ linux/fpga-dfl.h 0000644 00000021030 15063602047 0007533 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Header File for FPGA DFL User API * * Copyright (C) 2017-2018 Intel Corporation, Inc. * * Authors: * Kang Luwei <luwei.kang@intel.com> * Zhang Yi <yi.z.zhang@intel.com> * Wu Hao <hao.wu@intel.com> * Xiao Guangrong <guangrong.xiao@linux.intel.com> */ #ifndef _LINUX_FPGA_DFL_H #define _LINUX_FPGA_DFL_H #include <linux/types.h> #include <linux/ioctl.h> #define DFL_FPGA_API_VERSION 0 /* * The IOCTL interface for DFL based FPGA is designed for extensibility by * embedding the structure length (argsz) and flags into structures passed * between kernel and userspace. This design referenced the VFIO IOCTL * interface (include/uapi/linux/vfio.h). */ #define DFL_FPGA_MAGIC 0xB6 #define DFL_FPGA_BASE 0 #define DFL_PORT_BASE 0x40 #define DFL_FME_BASE 0x80 /* Common IOCTLs for both FME and AFU file descriptor */ /** * DFL_FPGA_GET_API_VERSION - _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 0) * * Report the version of the driver API. * Return: Driver API Version. */ #define DFL_FPGA_GET_API_VERSION _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 0) /** * DFL_FPGA_CHECK_EXTENSION - _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 1) * * Check whether an extension is supported. * Return: 0 if not supported, otherwise the extension is supported. */ #define DFL_FPGA_CHECK_EXTENSION _IO(DFL_FPGA_MAGIC, DFL_FPGA_BASE + 1) /* IOCTLs for AFU file descriptor */ /** * DFL_FPGA_PORT_RESET - _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 0) * * Reset the FPGA Port and its AFU. No parameters are supported. * Userspace can do Port reset at any time, e.g. during DMA or PR. But * it should never cause any system level issue, only functional failure * (e.g. DMA or PR operation failure) and be recoverable from the failure. * Return: 0 on success, -errno of failure */ #define DFL_FPGA_PORT_RESET _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 0) /** * DFL_FPGA_PORT_GET_INFO - _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 1, * struct dfl_fpga_port_info) * * Retrieve information about the fpga port. * Driver fills the info in provided struct dfl_fpga_port_info. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_info { /* Input */ __u32 argsz; /* Structure length */ /* Output */ __u32 flags; /* Zero for now */ __u32 num_regions; /* The number of supported regions */ __u32 num_umsgs; /* The number of allocated umsgs */ }; #define DFL_FPGA_PORT_GET_INFO _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 1) /** * FPGA_PORT_GET_REGION_INFO - _IOWR(FPGA_MAGIC, PORT_BASE + 2, * struct dfl_fpga_port_region_info) * * Retrieve information about a device memory region. * Caller provides struct dfl_fpga_port_region_info with index value set. * Driver returns the region info in other fields. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_region_info { /* input */ __u32 argsz; /* Structure length */ /* Output */ __u32 flags; /* Access permission */ #define DFL_PORT_REGION_READ (1 << 0) /* Region is readable */ #define DFL_PORT_REGION_WRITE (1 << 1) /* Region is writable */ #define DFL_PORT_REGION_MMAP (1 << 2) /* Can be mmaped to userspace */ /* Input */ __u32 index; /* Region index */ #define DFL_PORT_REGION_INDEX_AFU 0 /* AFU */ #define DFL_PORT_REGION_INDEX_STP 1 /* Signal Tap */ __u32 padding; /* Output */ __u64 size; /* Region size (bytes) */ __u64 offset; /* Region offset from start of device fd */ }; #define DFL_FPGA_PORT_GET_REGION_INFO _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 2) /** * DFL_FPGA_PORT_DMA_MAP - _IOWR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 3, * struct dfl_fpga_port_dma_map) * * Map the dma memory per user_addr and length which are provided by caller. * Driver fills the iova in provided struct afu_port_dma_map. * This interface only accepts page-size aligned user memory for dma mapping. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_dma_map { /* Input */ __u32 argsz; /* Structure length */ __u32 flags; /* Zero for now */ __u64 user_addr; /* Process virtual address */ __u64 length; /* Length of mapping (bytes)*/ /* Output */ __u64 iova; /* IO virtual address */ }; #define DFL_FPGA_PORT_DMA_MAP _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 3) /** * DFL_FPGA_PORT_DMA_UNMAP - _IOW(FPGA_MAGIC, PORT_BASE + 4, * struct dfl_fpga_port_dma_unmap) * * Unmap the dma memory per iova provided by caller. * Return: 0 on success, -errno on failure. */ struct dfl_fpga_port_dma_unmap { /* Input */ __u32 argsz; /* Structure length */ __u32 flags; /* Zero for now */ __u64 iova; /* IO virtual address */ }; #define DFL_FPGA_PORT_DMA_UNMAP _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 4) /** * struct dfl_fpga_irq_set - the argument for DFL_FPGA_XXX_SET_IRQ ioctl. * * @start: Index of the first irq. * @count: The number of eventfd handler. * @evtfds: Eventfd handlers. */ struct dfl_fpga_irq_set { __u32 start; __u32 count; __s32 evtfds[]; }; /** * DFL_FPGA_PORT_ERR_GET_IRQ_NUM - _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 5, * __u32 num_irqs) * * Get the number of irqs supported by the fpga port error reporting private * feature. Currently hardware supports up to 1 irq. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_PORT_ERR_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC, \ DFL_PORT_BASE + 5, __u32) /** * DFL_FPGA_PORT_ERR_SET_IRQ - _IOW(DFL_FPGA_MAGIC, DFL_PORT_BASE + 6, * struct dfl_fpga_irq_set) * * Set fpga port error reporting interrupt trigger if evtfds[n] is valid. * Unset related interrupt trigger if evtfds[n] is a negative value. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_PORT_ERR_SET_IRQ _IOW(DFL_FPGA_MAGIC, \ DFL_PORT_BASE + 6, \ struct dfl_fpga_irq_set) /** * DFL_FPGA_PORT_UINT_GET_IRQ_NUM - _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 7, * __u32 num_irqs) * * Get the number of irqs supported by the fpga AFU interrupt private * feature. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_PORT_UINT_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC, \ DFL_PORT_BASE + 7, __u32) /** * DFL_FPGA_PORT_UINT_SET_IRQ - _IOW(DFL_FPGA_MAGIC, DFL_PORT_BASE + 8, * struct dfl_fpga_irq_set) * * Set fpga AFU interrupt trigger if evtfds[n] is valid. * Unset related interrupt trigger if evtfds[n] is a negative value. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_PORT_UINT_SET_IRQ _IOW(DFL_FPGA_MAGIC, \ DFL_PORT_BASE + 8, \ struct dfl_fpga_irq_set) /* IOCTLs for FME file descriptor */ /** * DFL_FPGA_FME_PORT_PR - _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 0, * struct dfl_fpga_fme_port_pr) * * Driver does Partial Reconfiguration based on Port ID and Buffer (Image) * provided by caller. * Return: 0 on success, -errno on failure. * If DFL_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected * some errors during PR, under this case, the user can fetch HW error info * from the status of FME's fpga manager. */ struct dfl_fpga_fme_port_pr { /* Input */ __u32 argsz; /* Structure length */ __u32 flags; /* Zero for now */ __u32 port_id; __u32 buffer_size; __u64 buffer_address; /* Userspace address to the buffer for PR */ }; #define DFL_FPGA_FME_PORT_PR _IO(DFL_FPGA_MAGIC, DFL_FME_BASE + 0) /** * DFL_FPGA_FME_PORT_RELEASE - _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 1, * int port_id) * * Driver releases the port per Port ID provided by caller. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_FME_PORT_RELEASE _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 1, int) /** * DFL_FPGA_FME_PORT_ASSIGN - _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 2, * int port_id) * * Driver assigns the port back per Port ID provided by caller. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_FME_PORT_ASSIGN _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 2, int) /** * DFL_FPGA_FME_ERR_GET_IRQ_NUM - _IOR(DFL_FPGA_MAGIC, DFL_FME_BASE + 3, * __u32 num_irqs) * * Get the number of irqs supported by the fpga fme error reporting private * feature. Currently hardware supports up to 1 irq. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_FME_ERR_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC, \ DFL_FME_BASE + 3, __u32) /** * DFL_FPGA_FME_ERR_SET_IRQ - _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 4, * struct dfl_fpga_irq_set) * * Set fpga fme error reporting interrupt trigger if evtfds[n] is valid. * Unset related interrupt trigger if evtfds[n] is a negative value. * Return: 0 on success, -errno on failure. */ #define DFL_FPGA_FME_ERR_SET_IRQ _IOW(DFL_FPGA_MAGIC, \ DFL_FME_BASE + 4, \ struct dfl_fpga_irq_set) #endif /* _LINUX_FPGA_DFL_H */ linux/fs.h 0000644 00000032160 15063602047 0006471 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FS_H #define _LINUX_FS_H /* * This file has definitions for some important file table structures * and constants and structures used by various generic file system * ioctl's. Please do not make any changes in this file before * sending patches for review to linux-fsdevel@vger.kernel.org and * linux-api@vger.kernel.org. */ #include <linux/limits.h> #include <linux/ioctl.h> #include <linux/types.h> /* Use of MS_* flags within the kernel is restricted to core mount(2) code. */ #include <linux/mount.h> /* * It's silly to have NR_OPEN bigger than NR_FILE, but you can change * the file limit at runtime and only root can increase the per-process * nr_file rlimit, so it's safe to set up a ridiculously high absolute * upper limit on files-per-process. * * Some programs (notably those using select()) may have to be * recompiled to take full advantage of the new limits.. */ /* Fixed constants first: */ #undef NR_OPEN #define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */ #define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */ #define BLOCK_SIZE_BITS 10 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) #define SEEK_SET 0 /* seek relative to beginning of file */ #define SEEK_CUR 1 /* seek relative to current file position */ #define SEEK_END 2 /* seek relative to end of file */ #define SEEK_DATA 3 /* seek to the next data */ #define SEEK_HOLE 4 /* seek to the next hole */ #define SEEK_MAX SEEK_HOLE #define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ #define RENAME_WHITEOUT (1 << 2) /* Whiteout source */ struct file_clone_range { __s64 src_fd; __u64 src_offset; __u64 src_length; __u64 dest_offset; }; struct fstrim_range { __u64 start; __u64 len; __u64 minlen; }; /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ #define FILE_DEDUPE_RANGE_SAME 0 #define FILE_DEDUPE_RANGE_DIFFERS 1 /* from struct btrfs_ioctl_file_extent_same_info */ struct file_dedupe_range_info { __s64 dest_fd; /* in - destination file */ __u64 dest_offset; /* in - start of extent in destination */ __u64 bytes_deduped; /* out - total # of bytes we were able * to dedupe from this file. */ /* status of this dedupe operation: * < 0 for error * == FILE_DEDUPE_RANGE_SAME if dedupe succeeds * == FILE_DEDUPE_RANGE_DIFFERS if data differs */ __s32 status; /* out - see above description */ __u32 reserved; /* must be zero */ }; /* from struct btrfs_ioctl_file_extent_same_args */ struct file_dedupe_range { __u64 src_offset; /* in - start of extent in source */ __u64 src_length; /* in - length of extent */ __u16 dest_count; /* in - total elements in info array */ __u16 reserved1; /* must be zero */ __u32 reserved2; /* must be zero */ struct file_dedupe_range_info info[0]; }; /* And dynamically-tunable limits and defaults: */ struct files_stat_struct { unsigned long nr_files; /* read only */ unsigned long nr_free_files; /* read only */ unsigned long max_files; /* tunable */ }; struct inodes_stat_t { long nr_inodes; long nr_unused; long dummy[5]; /* padding for sysctl ABI compatibility */ }; #define NR_FILE 8192 /* this can well be larger on a larger system */ /* * Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR. */ struct fsxattr { __u32 fsx_xflags; /* xflags field value (get/set) */ __u32 fsx_extsize; /* extsize field value (get/set)*/ __u32 fsx_nextents; /* nextents field value (get) */ __u32 fsx_projid; /* project identifier (get/set) */ __u32 fsx_cowextsize; /* CoW extsize field value (get/set)*/ unsigned char fsx_pad[8]; }; /* * Flags for the fsx_xflags field */ #define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ #define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ #define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ #define FS_XFLAG_APPEND 0x00000010 /* all writes append */ #define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ #define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */ #define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ #define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ #define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ #define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ #define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ #define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ #define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ /* the read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ #define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ #define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ #define BLKRRPART _IO(0x12,95) /* re-read partition table */ #define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ #define BLKRASET _IO(0x12,98) /* set read ahead for block device */ #define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ #define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ #define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ #define BLKSSZGET _IO(0x12,104)/* get block device sector size */ #if 0 #define BLKPG _IO(0x12,105)/* See blkpg.h */ /* Some people are morons. Do not use sizeof! */ #define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */ #define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */ /* This was here just to show that the number is taken - probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */ #endif /* A jump here: 108-111 have been used for various private purposes. */ #define BLKBSZGET _IOR(0x12,112,size_t) #define BLKBSZSET _IOW(0x12,113,size_t) #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) #define BLKTRACESTART _IO(0x12,116) #define BLKTRACESTOP _IO(0x12,117) #define BLKTRACETEARDOWN _IO(0x12,118) #define BLKDISCARD _IO(0x12,119) #define BLKIOMIN _IO(0x12,120) #define BLKIOOPT _IO(0x12,121) #define BLKALIGNOFF _IO(0x12,122) #define BLKPBSZGET _IO(0x12,123) #define BLKDISCARDZEROES _IO(0x12,124) #define BLKSECDISCARD _IO(0x12,125) #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) /* * A jump here: 130-136 are reserved for zoned block devices * (see uapi/linux/blkzoned.h) */ #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ #define FITHAW _IOWR('X', 120, int) /* Thaw */ #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ #define FICLONE _IOW(0x94, 9, int) #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) #define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) #define FSLABEL_MAX 256 /* Max chars for the interface; each fs may differ */ #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) #define FS_IOC_GETVERSION _IOR('v', 1, long) #define FS_IOC_SETVERSION _IOW('v', 2, long) #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) #define FS_IOC32_GETVERSION _IOR('v', 1, int) #define FS_IOC32_SETVERSION _IOW('v', 2, int) #define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) #define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) #define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX]) #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) /* * File system encryption support */ /* Policy provided via an ioctl on the topmost directory */ #define FS_KEY_DESCRIPTOR_SIZE 8 #define FS_POLICY_FLAGS_PAD_4 0x00 #define FS_POLICY_FLAGS_PAD_8 0x01 #define FS_POLICY_FLAGS_PAD_16 0x02 #define FS_POLICY_FLAGS_PAD_32 0x03 #define FS_POLICY_FLAGS_PAD_MASK 0x03 #define FS_POLICY_FLAGS_VALID 0x03 /* Encryption algorithms */ #define FS_ENCRYPTION_MODE_INVALID 0 #define FS_ENCRYPTION_MODE_AES_256_XTS 1 #define FS_ENCRYPTION_MODE_AES_256_GCM 2 #define FS_ENCRYPTION_MODE_AES_256_CBC 3 #define FS_ENCRYPTION_MODE_AES_256_CTS 4 #define FS_ENCRYPTION_MODE_AES_128_CBC 5 #define FS_ENCRYPTION_MODE_AES_128_CTS 6 #define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7 #define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8 struct fscrypt_policy { __u8 version; __u8 contents_encryption_mode; __u8 filenames_encryption_mode; __u8 flags; __u8 master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE]; }; #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) /* Parameters for passing an encryption key into the kernel keyring */ #define FS_KEY_DESC_PREFIX "fscrypt:" #define FS_KEY_DESC_PREFIX_SIZE 8 /* Structure that userspace passes to the kernel keyring */ #define FS_MAX_KEY_SIZE 64 struct fscrypt_key { __u32 mode; __u8 raw[FS_MAX_KEY_SIZE]; __u32 size; }; /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) * * Note: for historical reasons, these flags were originally used and * defined for use by ext2/ext3, and then other file systems started * using these flags so they wouldn't need to write their own version * of chattr/lsattr (which was shipped as part of e2fsprogs). You * should think twice before trying to use these flags in new * contexts, or trying to assign these flags, since they are used both * as the UAPI and the on-disk encoding for ext2/3/4. Also, we are * almost out of 32-bit flags. :-) * * We have recently hoisted FS_IOC_FSGETXATTR / FS_IOC_FSSETXATTR from * XFS to the generic FS level interface. This uses a structure that * has padding and hence has more room to grow, so it may be more * appropriate for many new use cases. * * Please do not change these flags or interfaces before checking with * linux-fsdevel@vger.kernel.org and linux-api@vger.kernel.org. */ #define FS_SECRM_FL 0x00000001 /* Secure deletion */ #define FS_UNRM_FL 0x00000002 /* Undelete */ #define FS_COMPR_FL 0x00000004 /* Compress file */ #define FS_SYNC_FL 0x00000008 /* Synchronous updates */ #define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ #define FS_APPEND_FL 0x00000020 /* writes to file may only append */ #define FS_NODUMP_FL 0x00000040 /* do not dump file */ #define FS_NOATIME_FL 0x00000080 /* do not update atime */ /* Reserved for compression usage... */ #define FS_DIRTY_FL 0x00000100 #define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ #define FS_NOCOMP_FL 0x00000400 /* Don't compress */ /* End compression flags --- maybe not all used */ #define FS_ENCRYPT_FL 0x00000800 /* Encrypted file */ #define FS_BTREE_FL 0x00001000 /* btree format dir */ #define FS_INDEX_FL 0x00001000 /* hash-indexed directory */ #define FS_IMAGIC_FL 0x00002000 /* AFS directory */ #define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ #define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ #define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ #define FS_HUGE_FILE_FL 0x00040000 /* Reserved for ext4 */ #define FS_EXTENT_FL 0x00080000 /* Extents */ #define FS_EA_INODE_FL 0x00200000 /* Inode used for large EA */ #define FS_EOFBLOCKS_FL 0x00400000 /* Reserved for ext4 */ #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ #define FS_DAX_FL 0x02000000 /* Inode is DAX */ #define FS_INLINE_DATA_FL 0x10000000 /* Reserved for ext4 */ #define FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ #define SYNC_FILE_RANGE_WAIT_BEFORE 1 #define SYNC_FILE_RANGE_WRITE 2 #define SYNC_FILE_RANGE_WAIT_AFTER 4 /* * Flags for preadv2/pwritev2: */ typedef int __bitwise __kernel_rwf_t; /* high priority request, poll if possible */ #define RWF_HIPRI ((__kernel_rwf_t)0x00000001) /* per-IO O_DSYNC */ #define RWF_DSYNC ((__kernel_rwf_t)0x00000002) /* per-IO O_SYNC */ #define RWF_SYNC ((__kernel_rwf_t)0x00000004) /* per-IO, return -EAGAIN if operation would block */ #define RWF_NOWAIT ((__kernel_rwf_t)0x00000008) /* per-IO O_APPEND */ #define RWF_APPEND ((__kernel_rwf_t)0x00000010) /* mask of flags supported by the kernel */ #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ RWF_APPEND) #endif /* _LINUX_FS_H */ linux/fsl_hypervisor.h 0000644 00000016205 15063602047 0011141 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Freescale hypervisor ioctl and kernel interface * * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. * Author: Timur Tabi <timur@freescale.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Freescale Semiconductor nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * * ALTERNATIVELY, this software may be distributed under the terms of the * GNU General Public License ("GPL") as published by the Free Software * Foundation, either version 2 of that License or (at your option) any * later version. * * This software is provided by Freescale Semiconductor "as is" and any * express or implied warranties, including, but not limited to, the implied * warranties of merchantability and fitness for a particular purpose are * disclaimed. In no event shall Freescale Semiconductor be liable for any * direct, indirect, incidental, special, exemplary, or consequential damages * (including, but not limited to, procurement of substitute goods or services; * loss of use, data, or profits; or business interruption) however caused and * on any theory of liability, whether in contract, strict liability, or tort * (including negligence or otherwise) arising in any way out of the use of this * software, even if advised of the possibility of such damage. * * This file is used by the Freescale hypervisor management driver. It can * also be included by applications that need to communicate with the driver * via the ioctl interface. */ #ifndef FSL_HYPERVISOR_H #define FSL_HYPERVISOR_H #include <linux/types.h> /** * struct fsl_hv_ioctl_restart - restart a partition * @ret: return error code from the hypervisor * @partition: the ID of the partition to restart, or -1 for the * calling partition * * Used by FSL_HV_IOCTL_PARTITION_RESTART */ struct fsl_hv_ioctl_restart { __u32 ret; __u32 partition; }; /** * struct fsl_hv_ioctl_status - get a partition's status * @ret: return error code from the hypervisor * @partition: the ID of the partition to query, or -1 for the * calling partition * @status: The returned status of the partition * * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS * * Values of 'status': * 0 = Stopped * 1 = Running * 2 = Starting * 3 = Stopping */ struct fsl_hv_ioctl_status { __u32 ret; __u32 partition; __u32 status; }; /** * struct fsl_hv_ioctl_start - start a partition * @ret: return error code from the hypervisor * @partition: the ID of the partition to control * @entry_point: The offset within the guest IMA to start execution * @load: If non-zero, reload the partition's images before starting * * Used by FSL_HV_IOCTL_PARTITION_START */ struct fsl_hv_ioctl_start { __u32 ret; __u32 partition; __u32 entry_point; __u32 load; }; /** * struct fsl_hv_ioctl_stop - stop a partition * @ret: return error code from the hypervisor * @partition: the ID of the partition to stop, or -1 for the calling * partition * * Used by FSL_HV_IOCTL_PARTITION_STOP */ struct fsl_hv_ioctl_stop { __u32 ret; __u32 partition; }; /** * struct fsl_hv_ioctl_memcpy - copy memory between partitions * @ret: return error code from the hypervisor * @source: the partition ID of the source partition, or -1 for this * partition * @target: the partition ID of the target partition, or -1 for this * partition * @reserved: reserved, must be set to 0 * @local_addr: user-space virtual address of a buffer in the local * partition * @remote_addr: guest physical address of a buffer in the * remote partition * @count: the number of bytes to copy. Both the local and remote * buffers must be at least 'count' bytes long * * Used by FSL_HV_IOCTL_MEMCPY * * The 'local' partition is the partition that calls this ioctl. The * 'remote' partition is a different partition. The data is copied from * the 'source' paritition' to the 'target' partition. * * The buffer in the remote partition must be guest physically * contiguous. * * This ioctl does not support copying memory between two remote * partitions or within the same partition, so either 'source' or * 'target' (but not both) must be -1. In other words, either * * source == local and target == remote * or * source == remote and target == local */ struct fsl_hv_ioctl_memcpy { __u32 ret; __u32 source; __u32 target; __u32 reserved; /* padding to ensure local_vaddr is aligned */ __u64 local_vaddr; __u64 remote_paddr; __u64 count; }; /** * struct fsl_hv_ioctl_doorbell - ring a doorbell * @ret: return error code from the hypervisor * @doorbell: the handle of the doorbell to ring doorbell * * Used by FSL_HV_IOCTL_DOORBELL */ struct fsl_hv_ioctl_doorbell { __u32 ret; __u32 doorbell; }; /** * struct fsl_hv_ioctl_prop - get/set a device tree property * @ret: return error code from the hypervisor * @handle: handle of partition whose tree to access * @path: virtual address of path name of node to access * @propname: virtual address of name of property to access * @propval: virtual address of property data buffer * @proplen: Size of property data buffer * @reserved: reserved, must be set to 0 * * Used by FSL_HV_IOCTL_DOORBELL */ struct fsl_hv_ioctl_prop { __u32 ret; __u32 handle; __u64 path; __u64 propname; __u64 propval; __u32 proplen; __u32 reserved; /* padding to ensure structure is aligned */ }; /* The ioctl type, documented in ioctl-number.txt */ #define FSL_HV_IOCTL_TYPE 0xAF /* Restart another partition */ #define FSL_HV_IOCTL_PARTITION_RESTART \ _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart) /* Get a partition's status */ #define FSL_HV_IOCTL_PARTITION_GET_STATUS \ _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status) /* Boot another partition */ #define FSL_HV_IOCTL_PARTITION_START \ _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start) /* Stop this or another partition */ #define FSL_HV_IOCTL_PARTITION_STOP \ _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop) /* Copy data from one partition to another */ #define FSL_HV_IOCTL_MEMCPY \ _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy) /* Ring a doorbell */ #define FSL_HV_IOCTL_DOORBELL \ _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell) /* Get a property from another guest's device tree */ #define FSL_HV_IOCTL_GETPROP \ _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop) /* Set a property in another guest's device tree */ #define FSL_HV_IOCTL_SETPROP \ _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop) #endif /* FSL_HYPERVISOR_H */ linux/fsmap.h 0000644 00000010451 15063602047 0007166 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * FS_IOC_GETFSMAP ioctl infrastructure. * * Copyright (C) 2017 Oracle. All Rights Reserved. * * Author: Darrick J. Wong <darrick.wong@oracle.com> */ #ifndef _LINUX_FSMAP_H #define _LINUX_FSMAP_H #include <linux/types.h> /* * Structure for FS_IOC_GETFSMAP. * * The memory layout for this call are the scalar values defined in * struct fsmap_head, followed by two struct fsmap that describe * the lower and upper bound of mappings to return, followed by an * array of struct fsmap mappings. * * fmh_iflags control the output of the call, whereas fmh_oflags report * on the overall record output. fmh_count should be set to the * length of the fmh_recs array, and fmh_entries will be set to the * number of entries filled out during each call. If fmh_count is * zero, the number of reverse mappings will be returned in * fmh_entries, though no mappings will be returned. fmh_reserved * must be set to zero. * * The two elements in the fmh_keys array are used to constrain the * output. The first element in the array should represent the * lowest disk mapping ("low key") that the user wants to learn * about. If this value is all zeroes, the filesystem will return * the first entry it knows about. For a subsequent call, the * contents of fsmap_head.fmh_recs[fsmap_head.fmh_count - 1] should be * copied into fmh_keys[0] to have the kernel start where it left off. * * The second element in the fmh_keys array should represent the * highest disk mapping ("high key") that the user wants to learn * about. If this value is all ones, the filesystem will not stop * until it runs out of mapping to return or runs out of space in * fmh_recs. * * fmr_device can be either a 32-bit cookie representing a device, or * a 32-bit dev_t if the FMH_OF_DEV_T flag is set. fmr_physical, * fmr_offset, and fmr_length are expressed in units of bytes. * fmr_owner is either an inode number, or a special value if * FMR_OF_SPECIAL_OWNER is set in fmr_flags. */ struct fsmap { __u32 fmr_device; /* device id */ __u32 fmr_flags; /* mapping flags */ __u64 fmr_physical; /* device offset of segment */ __u64 fmr_owner; /* owner id */ __u64 fmr_offset; /* file offset of segment */ __u64 fmr_length; /* length of segment */ __u64 fmr_reserved[3]; /* must be zero */ }; struct fsmap_head { __u32 fmh_iflags; /* control flags */ __u32 fmh_oflags; /* output flags */ __u32 fmh_count; /* # of entries in array incl. input */ __u32 fmh_entries; /* # of entries filled in (output). */ __u64 fmh_reserved[6]; /* must be zero */ struct fsmap fmh_keys[2]; /* low and high keys for the mapping search */ struct fsmap fmh_recs[]; /* returned records */ }; /* Size of an fsmap_head with room for nr records. */ static __inline__ size_t fsmap_sizeof( unsigned int nr) { return sizeof(struct fsmap_head) + nr * sizeof(struct fsmap); } /* Start the next fsmap query at the end of the current query results. */ static __inline__ void fsmap_advance( struct fsmap_head *head) { head->fmh_keys[0] = head->fmh_recs[head->fmh_entries - 1]; } /* fmh_iflags values - set by FS_IOC_GETFSMAP caller in the header. */ /* no flags defined yet */ #define FMH_IF_VALID 0 /* fmh_oflags values - returned in the header segment only. */ #define FMH_OF_DEV_T 0x1 /* fmr_device values will be dev_t */ /* fmr_flags values - returned for each non-header segment */ #define FMR_OF_PREALLOC 0x1 /* segment = unwritten pre-allocation */ #define FMR_OF_ATTR_FORK 0x2 /* segment = attribute fork */ #define FMR_OF_EXTENT_MAP 0x4 /* segment = extent map */ #define FMR_OF_SHARED 0x8 /* segment = shared with another file */ #define FMR_OF_SPECIAL_OWNER 0x10 /* owner is a special value */ #define FMR_OF_LAST 0x20 /* segment is the last in the dataset */ /* Each FS gets to define its own special owner codes. */ #define FMR_OWNER(type, code) (((__u64)type << 32) | \ ((__u64)code & 0xFFFFFFFFULL)) #define FMR_OWNER_TYPE(owner) ((__u32)((__u64)owner >> 32)) #define FMR_OWNER_CODE(owner) ((__u32)(((__u64)owner & 0xFFFFFFFFULL))) #define FMR_OWN_FREE FMR_OWNER(0, 1) /* free space */ #define FMR_OWN_UNKNOWN FMR_OWNER(0, 2) /* unknown owner */ #define FMR_OWN_METADATA FMR_OWNER(0, 3) /* metadata */ #define FS_IOC_GETFSMAP _IOWR('X', 59, struct fsmap_head) #endif /* _LINUX_FSMAP_H */ linux/fuse.h 0000644 00000055661 15063602050 0007030 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* This file defines the kernel interface of FUSE Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> This program can be distributed under the terms of the GNU GPL. See the file COPYING. This -- and only this -- header file may also be distributed under the terms of the BSD Licence as follows: Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * This file defines the kernel interface of FUSE * * Protocol changelog: * * 7.1: * - add the following messages: * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK, * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE, * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR, * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR, * FUSE_RELEASEDIR * - add padding to messages to accommodate 32-bit servers on 64-bit kernels * * 7.2: * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags * - add FUSE_FSYNCDIR message * * 7.3: * - add FUSE_ACCESS message * - add FUSE_CREATE message * - add filehandle to fuse_setattr_in * * 7.4: * - add frsize to fuse_kstatfs * - clean up request size limit checking * * 7.5: * - add flags and max_write to fuse_init_out * * 7.6: * - add max_readahead to fuse_init_in and fuse_init_out * * 7.7: * - add FUSE_INTERRUPT message * - add POSIX file lock support * * 7.8: * - add lock_owner and flags fields to fuse_release_in * - add FUSE_BMAP message * - add FUSE_DESTROY message * * 7.9: * - new fuse_getattr_in input argument of GETATTR * - add lk_flags in fuse_lk_in * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in * - add blksize field to fuse_attr * - add file flags field to fuse_read_in and fuse_write_in * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in * * 7.10 * - add nonseekable open flag * * 7.11 * - add IOCTL message * - add unsolicited notification support * - add POLL message and NOTIFY_POLL notification * * 7.12 * - add umask flag to input argument of create, mknod and mkdir * - add notification messages for invalidation of inodes and * directory entries * * 7.13 * - make max number of background requests and congestion threshold * tunables * * 7.14 * - add splice support to fuse device * * 7.15 * - add store notify * - add retrieve notify * * 7.16 * - add BATCH_FORGET request * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' * - add FUSE_IOCTL_32BIT flag * * 7.17 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK * * 7.18 * - add FUSE_IOCTL_DIR flag * - add FUSE_NOTIFY_DELETE * * 7.19 * - add FUSE_FALLOCATE * * 7.20 * - add FUSE_AUTO_INVAL_DATA * * 7.21 * - add FUSE_READDIRPLUS * - send the requested events in POLL request * * 7.22 * - add FUSE_ASYNC_DIO * * 7.23 * - add FUSE_WRITEBACK_CACHE * - add time_gran to fuse_init_out * - add reserved space to fuse_init_out * - add FATTR_CTIME * - add ctime and ctimensec to fuse_setattr_in * - add FUSE_RENAME2 request * - add FUSE_NO_OPEN_SUPPORT flag * * 7.24 * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support * * 7.25 * - add FUSE_PARALLEL_DIROPS * * 7.26 * - add FUSE_HANDLE_KILLPRIV * - add FUSE_POSIX_ACL * * 7.27 * - add FUSE_ABORT_ERROR * * 7.28 * - add FUSE_COPY_FILE_RANGE * - add FOPEN_CACHE_DIR * - add FUSE_MAX_PAGES, add max_pages to init_out * - add FUSE_CACHE_SYMLINKS * * 7.29 * - add FUSE_NO_OPENDIR_SUPPORT flag * * 7.30 * - add FUSE_EXPLICIT_INVAL_DATA * - add FUSE_IOCTL_COMPAT_X32 * * 7.31 * - add FUSE_WRITE_KILL_PRIV flag * - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING * - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag * * 7.32 * - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS * * 7.33 * - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID * - add FUSE_OPEN_KILL_SUIDGID * - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT * - add FUSE_SETXATTR_ACL_KILL_SGID * - add FUSE_EXPIRE_ONLY flag to fuse_notify_inval_entry * - add FUSE_HAS_EXPIRE_ONLY * * 7.34 * - add FUSE_SYNCFS */ #ifndef _LINUX_FUSE_H #define _LINUX_FUSE_H #include <stdint.h> /* * Version negotiation: * * Both the kernel and userspace send the version they support in the * INIT request and reply respectively. * * If the major versions match then both shall use the smallest * of the two minor versions for communication. * * If the kernel supports a larger major version, then userspace shall * reply with the major version it supports, ignore the rest of the * INIT message and expect a new INIT message from the kernel with a * matching major version. * * If the library supports a larger major version, then it shall fall * back to the major protocol version sent by the kernel for * communication and reply with that major version (and an arbitrary * supported minor version). */ /** Version number of this interface */ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ #define FUSE_KERNEL_MINOR_VERSION 34 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 /* Make sure all structures are padded to 64bit boundary, so 32bit userspace works under 64bit kernels */ struct fuse_attr { uint64_t ino; uint64_t size; uint64_t blocks; uint64_t atime; uint64_t mtime; uint64_t ctime; uint32_t atimensec; uint32_t mtimensec; uint32_t ctimensec; uint32_t mode; uint32_t nlink; uint32_t uid; uint32_t gid; uint32_t rdev; uint32_t blksize; uint32_t flags; }; struct fuse_kstatfs { uint64_t blocks; uint64_t bfree; uint64_t bavail; uint64_t files; uint64_t ffree; uint32_t bsize; uint32_t namelen; uint32_t frsize; uint32_t padding; uint32_t spare[6]; }; struct fuse_file_lock { uint64_t start; uint64_t end; uint32_t type; uint32_t pid; /* tgid */ }; /** * Bitmasks for fuse_setattr_in.valid */ #define FATTR_MODE (1 << 0) #define FATTR_UID (1 << 1) #define FATTR_GID (1 << 2) #define FATTR_SIZE (1 << 3) #define FATTR_ATIME (1 << 4) #define FATTR_MTIME (1 << 5) #define FATTR_FH (1 << 6) #define FATTR_ATIME_NOW (1 << 7) #define FATTR_MTIME_NOW (1 << 8) #define FATTR_LOCKOWNER (1 << 9) #define FATTR_CTIME (1 << 10) #define FATTR_KILL_SUIDGID (1 << 11) /** * Flags returned by the OPEN request * * FOPEN_DIRECT_IO: bypass page cache for this open file * FOPEN_KEEP_CACHE: don't invalidate the data cache on open * FOPEN_NONSEEKABLE: the file is not seekable * FOPEN_CACHE_DIR: allow caching this directory */ #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) #define FOPEN_NONSEEKABLE (1 << 2) #define FOPEN_CACHE_DIR (1 << 3) /** * INIT request/reply flags * * FUSE_ASYNC_READ: asynchronous read requests * FUSE_POSIX_LOCKS: remote locking for POSIX file locks * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB * FUSE_DONT_MASK: don't apply umask to file mode on create operations * FUSE_SPLICE_WRITE: kernel supports splice write on the device * FUSE_SPLICE_MOVE: kernel supports splice move on the device * FUSE_SPLICE_READ: kernel supports splice read on the device * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) * FUSE_READDIRPLUS_AUTO: adaptive readdirplus * FUSE_ASYNC_DIO: asynchronous direct I/O submission * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc * FUSE_POSIX_ACL: filesystem supports posix acls * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages * FUSE_CACHE_SYMLINKS: cache READLINK responses * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request * FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for * foffset and moffset fields in struct * fuse_setupmapping_out and fuse_removemapping_one. * FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts * FUSE_HANDLE_KILLPRIV_V2: fs kills suid/sgid/cap on write/chown/trunc. * Upon write/truncate suid/sgid is only killed if caller * does not have CAP_FSETID. Additionally upon * write/truncate sgid is killed only if file has group * execute permission. (Same as Linux VFS behavior). * FUSE_SETXATTR_EXT: Server supports extended struct fuse_setxattr_in * FUSE_INIT_EXT: extended fuse_init_in request * FUSE_INIT_RESERVED: reserved, do not use * FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) #define FUSE_FILE_OPS (1 << 2) #define FUSE_ATOMIC_O_TRUNC (1 << 3) #define FUSE_EXPORT_SUPPORT (1 << 4) #define FUSE_BIG_WRITES (1 << 5) #define FUSE_DONT_MASK (1 << 6) #define FUSE_SPLICE_WRITE (1 << 7) #define FUSE_SPLICE_MOVE (1 << 8) #define FUSE_SPLICE_READ (1 << 9) #define FUSE_FLOCK_LOCKS (1 << 10) #define FUSE_HAS_IOCTL_DIR (1 << 11) #define FUSE_AUTO_INVAL_DATA (1 << 12) #define FUSE_DO_READDIRPLUS (1 << 13) #define FUSE_READDIRPLUS_AUTO (1 << 14) #define FUSE_ASYNC_DIO (1 << 15) #define FUSE_WRITEBACK_CACHE (1 << 16) #define FUSE_NO_OPEN_SUPPORT (1 << 17) #define FUSE_PARALLEL_DIROPS (1 << 18) #define FUSE_HANDLE_KILLPRIV (1 << 19) #define FUSE_POSIX_ACL (1 << 20) #define FUSE_ABORT_ERROR (1 << 21) #define FUSE_MAX_PAGES (1 << 22) #define FUSE_CACHE_SYMLINKS (1 << 23) #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) #define FUSE_MAP_ALIGNMENT (1 << 26) #define FUSE_SUBMOUNTS (1 << 27) #define FUSE_HANDLE_KILLPRIV_V2 (1 << 28) #define FUSE_SETXATTR_EXT (1 << 29) #define FUSE_INIT_EXT (1 << 30) #define FUSE_INIT_RESERVED (1 << 31) /* bits 32..63 get shifted down 32 bits into the flags2 field */ #define FUSE_HAS_EXPIRE_ONLY (1ULL << 35) /** * CUSE INIT request/reply flags * * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl */ #define CUSE_UNRESTRICTED_IOCTL (1 << 0) /** * Release flags */ #define FUSE_RELEASE_FLUSH (1 << 0) #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) /** * Getattr flags */ #define FUSE_GETATTR_FH (1 << 0) /** * Lock flags */ #define FUSE_LK_FLOCK (1 << 0) /** * WRITE flags * * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed * FUSE_WRITE_LOCKOWNER: lock_owner field is valid * FUSE_WRITE_KILL_SUIDGID: kill suid and sgid bits */ #define FUSE_WRITE_CACHE (1 << 0) #define FUSE_WRITE_LOCKOWNER (1 << 1) #define FUSE_WRITE_KILL_SUIDGID (1 << 2) /* Obsolete alias; this flag implies killing suid/sgid only. */ #define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID /** * Read flags */ #define FUSE_READ_LOCKOWNER (1 << 1) /** * Ioctl flags * * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed * FUSE_IOCTL_RETRY: retry with new iovecs * FUSE_IOCTL_32BIT: 32bit ioctl * FUSE_IOCTL_DIR: is a directory * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t) * * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs */ #define FUSE_IOCTL_COMPAT (1 << 0) #define FUSE_IOCTL_UNRESTRICTED (1 << 1) #define FUSE_IOCTL_RETRY (1 << 2) #define FUSE_IOCTL_32BIT (1 << 3) #define FUSE_IOCTL_DIR (1 << 4) #define FUSE_IOCTL_COMPAT_X32 (1 << 5) #define FUSE_IOCTL_MAX_IOV 256 /** * Poll flags * * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify */ #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) /** * Fsync flags * * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata */ #define FUSE_FSYNC_FDATASYNC (1 << 0) /** * fuse_attr flags * * FUSE_ATTR_SUBMOUNT: Object is a submount root */ #define FUSE_ATTR_SUBMOUNT (1 << 0) /** * Open flags * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable */ #define FUSE_OPEN_KILL_SUIDGID (1 << 0) /** * setxattr flags * FUSE_SETXATTR_ACL_KILL_SGID: Clear SGID when system.posix_acl_access is set */ #define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0) /** * notify_inval_entry flags * FUSE_EXPIRE_ONLY */ #define FUSE_EXPIRE_ONLY (1 << 0) enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, /* no reply */ FUSE_GETATTR = 3, FUSE_SETATTR = 4, FUSE_READLINK = 5, FUSE_SYMLINK = 6, FUSE_MKNOD = 8, FUSE_MKDIR = 9, FUSE_UNLINK = 10, FUSE_RMDIR = 11, FUSE_RENAME = 12, FUSE_LINK = 13, FUSE_OPEN = 14, FUSE_READ = 15, FUSE_WRITE = 16, FUSE_STATFS = 17, FUSE_RELEASE = 18, FUSE_FSYNC = 20, FUSE_SETXATTR = 21, FUSE_GETXATTR = 22, FUSE_LISTXATTR = 23, FUSE_REMOVEXATTR = 24, FUSE_FLUSH = 25, FUSE_INIT = 26, FUSE_OPENDIR = 27, FUSE_READDIR = 28, FUSE_RELEASEDIR = 29, FUSE_FSYNCDIR = 30, FUSE_GETLK = 31, FUSE_SETLK = 32, FUSE_SETLKW = 33, FUSE_ACCESS = 34, FUSE_CREATE = 35, FUSE_INTERRUPT = 36, FUSE_BMAP = 37, FUSE_DESTROY = 38, FUSE_IOCTL = 39, FUSE_POLL = 40, FUSE_NOTIFY_REPLY = 41, FUSE_BATCH_FORGET = 42, FUSE_FALLOCATE = 43, FUSE_READDIRPLUS = 44, FUSE_RENAME2 = 45, FUSE_LSEEK = 46, FUSE_COPY_FILE_RANGE = 47, FUSE_SETUPMAPPING = 48, FUSE_REMOVEMAPPING = 49, FUSE_SYNCFS = 50, /* CUSE specific operations */ CUSE_INIT = 4096, /* Reserved opcodes: helpful to detect structure endian-ness */ CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */ FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */ }; enum fuse_notify_code { FUSE_NOTIFY_POLL = 1, FUSE_NOTIFY_INVAL_INODE = 2, FUSE_NOTIFY_INVAL_ENTRY = 3, FUSE_NOTIFY_STORE = 4, FUSE_NOTIFY_RETRIEVE = 5, FUSE_NOTIFY_DELETE = 6, FUSE_NOTIFY_CODE_MAX, }; /* The read buffer is required to be at least 8k, but may be much larger */ #define FUSE_MIN_READ_BUFFER 8192 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 struct fuse_entry_out { uint64_t nodeid; /* Inode ID */ uint64_t generation; /* Inode generation: nodeid:gen must be unique for the fs's lifetime */ uint64_t entry_valid; /* Cache timeout for the name */ uint64_t attr_valid; /* Cache timeout for the attributes */ uint32_t entry_valid_nsec; uint32_t attr_valid_nsec; struct fuse_attr attr; }; struct fuse_forget_in { uint64_t nlookup; }; struct fuse_forget_one { uint64_t nodeid; uint64_t nlookup; }; struct fuse_batch_forget_in { uint32_t count; uint32_t dummy; }; struct fuse_getattr_in { uint32_t getattr_flags; uint32_t dummy; uint64_t fh; }; #define FUSE_COMPAT_ATTR_OUT_SIZE 96 struct fuse_attr_out { uint64_t attr_valid; /* Cache timeout for the attributes */ uint32_t attr_valid_nsec; uint32_t dummy; struct fuse_attr attr; }; #define FUSE_COMPAT_MKNOD_IN_SIZE 8 struct fuse_mknod_in { uint32_t mode; uint32_t rdev; uint32_t umask; uint32_t padding; }; struct fuse_mkdir_in { uint32_t mode; uint32_t umask; }; struct fuse_rename_in { uint64_t newdir; }; struct fuse_rename2_in { uint64_t newdir; uint32_t flags; uint32_t padding; }; struct fuse_link_in { uint64_t oldnodeid; }; struct fuse_setattr_in { uint32_t valid; uint32_t padding; uint64_t fh; uint64_t size; uint64_t lock_owner; uint64_t atime; uint64_t mtime; uint64_t ctime; uint32_t atimensec; uint32_t mtimensec; uint32_t ctimensec; uint32_t mode; uint32_t unused4; uint32_t uid; uint32_t gid; uint32_t unused5; }; struct fuse_open_in { uint32_t flags; uint32_t open_flags; /* FUSE_OPEN_... */ }; struct fuse_create_in { uint32_t flags; uint32_t mode; uint32_t umask; uint32_t open_flags; /* FUSE_OPEN_... */ }; struct fuse_open_out { uint64_t fh; uint32_t open_flags; uint32_t padding; }; struct fuse_release_in { uint64_t fh; uint32_t flags; uint32_t release_flags; uint64_t lock_owner; }; struct fuse_flush_in { uint64_t fh; uint32_t unused; uint32_t padding; uint64_t lock_owner; }; struct fuse_read_in { uint64_t fh; uint64_t offset; uint32_t size; uint32_t read_flags; uint64_t lock_owner; uint32_t flags; uint32_t padding; }; #define FUSE_COMPAT_WRITE_IN_SIZE 24 struct fuse_write_in { uint64_t fh; uint64_t offset; uint32_t size; uint32_t write_flags; uint64_t lock_owner; uint32_t flags; uint32_t padding; }; struct fuse_write_out { uint32_t size; uint32_t padding; }; #define FUSE_COMPAT_STATFS_SIZE 48 struct fuse_statfs_out { struct fuse_kstatfs st; }; struct fuse_fsync_in { uint64_t fh; uint32_t fsync_flags; uint32_t padding; }; #define FUSE_COMPAT_SETXATTR_IN_SIZE 8 struct fuse_setxattr_in { uint32_t size; uint32_t flags; uint32_t setxattr_flags; uint32_t padding; }; struct fuse_getxattr_in { uint32_t size; uint32_t padding; }; struct fuse_getxattr_out { uint32_t size; uint32_t padding; }; struct fuse_lk_in { uint64_t fh; uint64_t owner; struct fuse_file_lock lk; uint32_t lk_flags; uint32_t padding; }; struct fuse_lk_out { struct fuse_file_lock lk; }; struct fuse_access_in { uint32_t mask; uint32_t padding; }; struct fuse_init_in { uint32_t major; uint32_t minor; uint32_t max_readahead; uint32_t flags; uint32_t flags2; uint32_t unused[11]; }; #define FUSE_COMPAT_INIT_OUT_SIZE 8 #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 struct fuse_init_out { uint32_t major; uint32_t minor; uint32_t max_readahead; uint32_t flags; uint16_t max_background; uint16_t congestion_threshold; uint32_t max_write; uint32_t time_gran; uint16_t max_pages; uint16_t map_alignment; uint32_t flags2; uint32_t unused[7]; }; #define CUSE_INIT_INFO_MAX 4096 struct cuse_init_in { uint32_t major; uint32_t minor; uint32_t unused; uint32_t flags; }; struct cuse_init_out { uint32_t major; uint32_t minor; uint32_t unused; uint32_t flags; uint32_t max_read; uint32_t max_write; uint32_t dev_major; /* chardev major */ uint32_t dev_minor; /* chardev minor */ uint32_t spare[10]; }; struct fuse_interrupt_in { uint64_t unique; }; struct fuse_bmap_in { uint64_t block; uint32_t blocksize; uint32_t padding; }; struct fuse_bmap_out { uint64_t block; }; struct fuse_ioctl_in { uint64_t fh; uint32_t flags; uint32_t cmd; uint64_t arg; uint32_t in_size; uint32_t out_size; }; struct fuse_ioctl_iovec { uint64_t base; uint64_t len; }; struct fuse_ioctl_out { int32_t result; uint32_t flags; uint32_t in_iovs; uint32_t out_iovs; }; struct fuse_poll_in { uint64_t fh; uint64_t kh; uint32_t flags; uint32_t events; }; struct fuse_poll_out { uint32_t revents; uint32_t padding; }; struct fuse_notify_poll_wakeup_out { uint64_t kh; }; struct fuse_fallocate_in { uint64_t fh; uint64_t offset; uint64_t length; uint32_t mode; uint32_t padding; }; struct fuse_in_header { uint32_t len; uint32_t opcode; uint64_t unique; uint64_t nodeid; uint32_t uid; uint32_t gid; uint32_t pid; uint32_t padding; }; struct fuse_out_header { uint32_t len; int32_t error; uint64_t unique; }; struct fuse_dirent { uint64_t ino; uint64_t off; uint32_t namelen; uint32_t type; char name[]; }; #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) #define FUSE_DIRENT_ALIGN(x) \ (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) #define FUSE_DIRENT_SIZE(d) \ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) struct fuse_direntplus { struct fuse_entry_out entry_out; struct fuse_dirent dirent; }; #define FUSE_NAME_OFFSET_DIRENTPLUS \ offsetof(struct fuse_direntplus, dirent.name) #define FUSE_DIRENTPLUS_SIZE(d) \ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) struct fuse_notify_inval_inode_out { uint64_t ino; int64_t off; int64_t len; }; struct fuse_notify_inval_entry_out { uint64_t parent; uint32_t namelen; uint32_t flags; }; struct fuse_notify_delete_out { uint64_t parent; uint64_t child; uint32_t namelen; uint32_t padding; }; struct fuse_notify_store_out { uint64_t nodeid; uint64_t offset; uint32_t size; uint32_t padding; }; struct fuse_notify_retrieve_out { uint64_t notify_unique; uint64_t nodeid; uint64_t offset; uint32_t size; uint32_t padding; }; /* Matches the size of fuse_write_in */ struct fuse_notify_retrieve_in { uint64_t dummy1; uint64_t offset; uint32_t size; uint32_t dummy2; uint64_t dummy3; uint64_t dummy4; }; /* Device ioctls: */ #define FUSE_DEV_IOC_MAGIC 229 #define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t) struct fuse_lseek_in { uint64_t fh; uint64_t offset; uint32_t whence; uint32_t padding; }; struct fuse_lseek_out { uint64_t offset; }; struct fuse_copy_file_range_in { uint64_t fh_in; uint64_t off_in; uint64_t nodeid_out; uint64_t fh_out; uint64_t off_out; uint64_t len; uint64_t flags; }; #define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0) #define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1) struct fuse_setupmapping_in { /* An already open handle */ uint64_t fh; /* Offset into the file to start the mapping */ uint64_t foffset; /* Length of mapping required */ uint64_t len; /* Flags, FUSE_SETUPMAPPING_FLAG_* */ uint64_t flags; /* Offset in Memory Window */ uint64_t moffset; }; struct fuse_removemapping_in { /* number of fuse_removemapping_one follows */ uint32_t count; }; struct fuse_removemapping_one { /* Offset into the dax window start the unmapping */ uint64_t moffset; /* Length of mapping required */ uint64_t len; }; #define FUSE_REMOVEMAPPING_MAX_ENTRY \ (PAGE_SIZE / sizeof(struct fuse_removemapping_one)) struct fuse_syncfs_in { uint64_t padding; }; #endif /* _LINUX_FUSE_H */ linux/futex.h 0000644 00000011601 15063602050 0007203 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H #include <linux/types.h> /* Second argument to futex syscall */ #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 #define FUTEX_FD 2 #define FUTEX_REQUEUE 3 #define FUTEX_CMP_REQUEUE 4 #define FUTEX_WAKE_OP 5 #define FUTEX_LOCK_PI 6 #define FUTEX_UNLOCK_PI 7 #define FUTEX_TRYLOCK_PI 8 #define FUTEX_WAIT_BITSET 9 #define FUTEX_WAKE_BITSET 10 #define FUTEX_WAIT_REQUEUE_PI 11 #define FUTEX_CMP_REQUEUE_PI 12 #define FUTEX_PRIVATE_FLAG 128 #define FUTEX_CLOCK_REALTIME 256 #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) #define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG) #define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG) #define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG) #define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG) #define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG) #define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) #define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) #define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) #define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG) #define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG) #define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \ FUTEX_PRIVATE_FLAG) #define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \ FUTEX_PRIVATE_FLAG) /* * Support for robust futexes: the kernel cleans up held futexes at * thread exit time. */ /* * Per-lock list entry - embedded in user-space locks, somewhere close * to the futex field. (Note: user-space uses a double-linked list to * achieve O(1) list add and remove, but the kernel only needs to know * about the forward link) * * NOTE: this structure is part of the syscall ABI, and must not be * changed. */ struct robust_list { struct robust_list *next; }; /* * Per-thread list head: * * NOTE: this structure is part of the syscall ABI, and must only be * changed if the change is first communicated with the glibc folks. * (When an incompatible change is done, we'll increase the structure * size, which glibc will detect) */ struct robust_list_head { /* * The head of the list. Points back to itself if empty: */ struct robust_list list; /* * This relative offset is set by user-space, it gives the kernel * the relative position of the futex field to examine. This way * we keep userspace flexible, to freely shape its data-structure, * without hardcoding any particular offset into the kernel: */ long futex_offset; /* * The death of the thread may race with userspace setting * up a lock's links. So to handle this race, userspace first * sets this field to the address of the to-be-taken lock, * then does the lock acquire, and then adds itself to the * list, and then clears this field. Hence the kernel will * always have full knowledge of all locks that the thread * _might_ have taken. We check the owner TID in any case, * so only truly owned locks will be handled. */ struct robust_list *list_op_pending; }; /* * Are there any waiters for this robust futex: */ #define FUTEX_WAITERS 0x80000000 /* * The kernel signals via this bit that a thread holding a futex * has exited without unlocking the futex. The kernel also does * a FUTEX_WAKE on such futexes, after setting the bit, to wake * up any possible waiters: */ #define FUTEX_OWNER_DIED 0x40000000 /* * The rest of the robust-futex field is for the TID: */ #define FUTEX_TID_MASK 0x3fffffff /* * This limit protects against a deliberately circular list. * (Not worth introducing an rlimit for it) */ #define ROBUST_LIST_LIMIT 2048 /* * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a * match of any bit. */ #define FUTEX_BITSET_MATCH_ANY 0xffffffff #define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ #define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */ #define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */ #define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */ #define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */ #define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */ #define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */ #define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */ #define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */ #define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */ #define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */ #define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */ /* FUTEX_WAKE_OP will perform atomically int oldval = *(int *)UADDR2; *(int *)UADDR2 = oldval OP OPARG; if (oldval CMP CMPARG) wake UADDR2; */ #define FUTEX_OP(op, oparg, cmp, cmparg) \ (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \ | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)) #endif /* _LINUX_FUTEX_H */ linux/gameport.h 0000644 00000001601 15063602050 0007665 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 1999-2002 Vojtech Pavlik * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _GAMEPORT_H #define _GAMEPORT_H #define GAMEPORT_MODE_DISABLED 0 #define GAMEPORT_MODE_RAW 1 #define GAMEPORT_MODE_COOKED 2 #define GAMEPORT_ID_VENDOR_ANALOG 0x0001 #define GAMEPORT_ID_VENDOR_MADCATZ 0x0002 #define GAMEPORT_ID_VENDOR_LOGITECH 0x0003 #define GAMEPORT_ID_VENDOR_CREATIVE 0x0004 #define GAMEPORT_ID_VENDOR_GENIUS 0x0005 #define GAMEPORT_ID_VENDOR_INTERACT 0x0006 #define GAMEPORT_ID_VENDOR_MICROSOFT 0x0007 #define GAMEPORT_ID_VENDOR_THRUSTMASTER 0x0008 #define GAMEPORT_ID_VENDOR_GRAVIS 0x0009 #define GAMEPORT_ID_VENDOR_GUILLEMOT 0x000a #endif /* _GAMEPORT_H */ linux/gen_stats.h 0000644 00000002766 15063602050 0010053 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_GEN_STATS_H #define __LINUX_GEN_STATS_H #include <linux/types.h> enum { TCA_STATS_UNSPEC, TCA_STATS_BASIC, TCA_STATS_RATE_EST, TCA_STATS_QUEUE, TCA_STATS_APP, TCA_STATS_RATE_EST64, TCA_STATS_PAD, TCA_STATS_BASIC_HW, TCA_STATS_PKT64, __TCA_STATS_MAX, }; #define TCA_STATS_MAX (__TCA_STATS_MAX - 1) /** * struct gnet_stats_basic - byte/packet throughput statistics * @bytes: number of seen bytes * @packets: number of seen packets */ struct gnet_stats_basic { __u64 bytes; __u32 packets; }; /** * struct gnet_stats_rate_est - rate estimator * @bps: current byte rate * @pps: current packet rate */ struct gnet_stats_rate_est { __u32 bps; __u32 pps; }; /** * struct gnet_stats_rate_est64 - rate estimator * @bps: current byte rate * @pps: current packet rate */ struct gnet_stats_rate_est64 { __u64 bps; __u64 pps; }; /** * struct gnet_stats_queue - queuing statistics * @qlen: queue length * @backlog: backlog size of queue * @drops: number of dropped packets * @requeues: number of requeues * @overlimits: number of enqueues over the limit */ struct gnet_stats_queue { __u32 qlen; __u32 backlog; __u32 drops; __u32 requeues; __u32 overlimits; }; /** * struct gnet_estimator - rate estimator configuration * @interval: sampling period * @ewma_log: the log of measurement window weight */ struct gnet_estimator { signed char interval; unsigned char ewma_log; }; #endif /* __LINUX_GEN_STATS_H */ linux/genetlink.h 0000644 00000004177 15063602050 0010042 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_GENERIC_NETLINK_H #define __LINUX_GENERIC_NETLINK_H #include <linux/types.h> #include <linux/netlink.h> #define GENL_NAMSIZ 16 /* length of family name */ #define GENL_MIN_ID NLMSG_MIN_TYPE #define GENL_MAX_ID 1023 struct genlmsghdr { __u8 cmd; __u8 version; __u16 reserved; }; #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) #define GENL_ADMIN_PERM 0x01 #define GENL_CMD_CAP_DO 0x02 #define GENL_CMD_CAP_DUMP 0x04 #define GENL_CMD_CAP_HASPOL 0x08 #define GENL_UNS_ADMIN_PERM 0x10 /* * List of reserved static generic netlink identifiers: */ #define GENL_ID_CTRL NLMSG_MIN_TYPE #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2) /* must be last reserved + 1 */ #define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3) /************************************************************************** * Controller **************************************************************************/ enum { CTRL_CMD_UNSPEC, CTRL_CMD_NEWFAMILY, CTRL_CMD_DELFAMILY, CTRL_CMD_GETFAMILY, CTRL_CMD_NEWOPS, CTRL_CMD_DELOPS, CTRL_CMD_GETOPS, CTRL_CMD_NEWMCAST_GRP, CTRL_CMD_DELMCAST_GRP, CTRL_CMD_GETMCAST_GRP, /* unused */ CTRL_CMD_GETPOLICY, __CTRL_CMD_MAX, }; #define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) enum { CTRL_ATTR_UNSPEC, CTRL_ATTR_FAMILY_ID, CTRL_ATTR_FAMILY_NAME, CTRL_ATTR_VERSION, CTRL_ATTR_HDRSIZE, CTRL_ATTR_MAXATTR, CTRL_ATTR_OPS, CTRL_ATTR_MCAST_GROUPS, CTRL_ATTR_POLICY, CTRL_ATTR_OP_POLICY, CTRL_ATTR_OP, __CTRL_ATTR_MAX, }; #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) enum { CTRL_ATTR_OP_UNSPEC, CTRL_ATTR_OP_ID, CTRL_ATTR_OP_FLAGS, __CTRL_ATTR_OP_MAX, }; #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) enum { CTRL_ATTR_MCAST_GRP_UNSPEC, CTRL_ATTR_MCAST_GRP_NAME, CTRL_ATTR_MCAST_GRP_ID, __CTRL_ATTR_MCAST_GRP_MAX, }; enum { CTRL_ATTR_POLICY_UNSPEC, CTRL_ATTR_POLICY_DO, CTRL_ATTR_POLICY_DUMP, __CTRL_ATTR_POLICY_DUMP_MAX, CTRL_ATTR_POLICY_DUMP_MAX = __CTRL_ATTR_POLICY_DUMP_MAX - 1 }; #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) #endif /* __LINUX_GENERIC_NETLINK_H */ linux/gfs2_ondisk.h 0000644 00000034627 15063602050 0010275 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License v.2. */ #ifndef __GFS2_ONDISK_DOT_H__ #define __GFS2_ONDISK_DOT_H__ #include <linux/types.h> #define GFS2_MAGIC 0x01161970 #define GFS2_BASIC_BLOCK 512 #define GFS2_BASIC_BLOCK_SHIFT 9 /* Lock numbers of the LM_TYPE_NONDISK type */ #define GFS2_MOUNT_LOCK 0 #define GFS2_LIVE_LOCK 1 #define GFS2_FREEZE_LOCK 2 #define GFS2_RENAME_LOCK 3 #define GFS2_CONTROL_LOCK 4 #define GFS2_MOUNTED_LOCK 5 /* Format numbers for various metadata types */ #define GFS2_FORMAT_NONE 0 #define GFS2_FORMAT_SB 100 #define GFS2_FORMAT_RG 200 #define GFS2_FORMAT_RB 300 #define GFS2_FORMAT_DI 400 #define GFS2_FORMAT_IN 500 #define GFS2_FORMAT_LF 600 #define GFS2_FORMAT_JD 700 #define GFS2_FORMAT_LH 800 #define GFS2_FORMAT_LD 900 #define GFS2_FORMAT_LB 1000 #define GFS2_FORMAT_EA 1600 #define GFS2_FORMAT_ED 1700 #define GFS2_FORMAT_QC 1400 /* These are format numbers for entities contained in files */ #define GFS2_FORMAT_RI 1100 #define GFS2_FORMAT_DE 1200 #define GFS2_FORMAT_QU 1500 /* These are part of the superblock */ #define GFS2_FORMAT_FS 1801 #define GFS2_FORMAT_MULTI 1900 /* * An on-disk inode number */ struct gfs2_inum { __be64 no_formal_ino; __be64 no_addr; }; /* * Generic metadata head structure * Every inplace buffer logged in the journal must start with this. */ #define GFS2_METATYPE_NONE 0 #define GFS2_METATYPE_SB 1 #define GFS2_METATYPE_RG 2 #define GFS2_METATYPE_RB 3 #define GFS2_METATYPE_DI 4 #define GFS2_METATYPE_IN 5 #define GFS2_METATYPE_LF 6 #define GFS2_METATYPE_JD 7 #define GFS2_METATYPE_LH 8 #define GFS2_METATYPE_LD 9 #define GFS2_METATYPE_LB 12 #define GFS2_METATYPE_EA 10 #define GFS2_METATYPE_ED 11 #define GFS2_METATYPE_QC 14 struct gfs2_meta_header { __be32 mh_magic; __be32 mh_type; __be64 __pad0; /* Was generation number in gfs1 */ __be32 mh_format; /* This union is to keep userspace happy */ union { __be32 mh_jid; /* Was incarnation number in gfs1 */ __be32 __pad1; }; }; /* * super-block structure * * It's probably good if SIZEOF_SB <= GFS2_BASIC_BLOCK (512 bytes) * * Order is important, need to be able to read old superblocks to do on-disk * version upgrades. */ /* Address of superblock in GFS2 basic blocks */ #define GFS2_SB_ADDR 128 /* The lock number for the superblock (must be zero) */ #define GFS2_SB_LOCK 0 /* Requirement: GFS2_LOCKNAME_LEN % 8 == 0 Includes: the fencing zero at the end */ #define GFS2_LOCKNAME_LEN 64 struct gfs2_sb { struct gfs2_meta_header sb_header; __be32 sb_fs_format; __be32 sb_multihost_format; __u32 __pad0; /* Was superblock flags in gfs1 */ __be32 sb_bsize; __be32 sb_bsize_shift; __u32 __pad1; /* Was journal segment size in gfs1 */ struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ struct gfs2_inum sb_root_dir; char sb_lockproto[GFS2_LOCKNAME_LEN]; char sb_locktable[GFS2_LOCKNAME_LEN]; struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ #define GFS2_HAS_UUID 1 __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */ }; /* * resource index structure */ struct gfs2_rindex { __be64 ri_addr; /* grp block disk address */ __be32 ri_length; /* length of rgrp header in fs blocks */ __u32 __pad; __be64 ri_data0; /* first data location */ __be32 ri_data; /* num of data blocks in rgrp */ __be32 ri_bitbytes; /* number of bytes in data bitmaps */ __u8 ri_reserved[64]; }; /* * resource group header structure */ /* Number of blocks per byte in rgrp */ #define GFS2_NBBY 4 #define GFS2_BIT_SIZE 2 #define GFS2_BIT_MASK 0x00000003 #define GFS2_BLKST_FREE 0 #define GFS2_BLKST_USED 1 #define GFS2_BLKST_UNLINKED 2 #define GFS2_BLKST_DINODE 3 #define GFS2_RGF_JOURNAL 0x00000001 #define GFS2_RGF_METAONLY 0x00000002 #define GFS2_RGF_DATAONLY 0x00000004 #define GFS2_RGF_NOALLOC 0x00000008 #define GFS2_RGF_TRIMMED 0x00000010 struct gfs2_inode_lvb { __be32 ri_magic; __be32 __pad; __be64 ri_generation_deleted; }; struct gfs2_rgrp_lvb { __be32 rl_magic; __be32 rl_flags; __be32 rl_free; __be32 rl_dinodes; __be64 rl_igeneration; __be32 rl_unlinked; __be32 __pad; }; struct gfs2_rgrp { struct gfs2_meta_header rg_header; __be32 rg_flags; __be32 rg_free; __be32 rg_dinodes; union { __be32 __pad; __be32 rg_skip; /* Distance to the next rgrp in fs blocks */ }; __be64 rg_igeneration; /* The following 3 fields are duplicated from gfs2_rindex to reduce reliance on the rindex */ __be64 rg_data0; /* First data location */ __be32 rg_data; /* Number of data blocks in rgrp */ __be32 rg_bitbytes; /* Number of bytes in data bitmaps */ __be32 rg_crc; /* crc32 of the structure with this field 0 */ __u8 rg_reserved[60]; /* Several fields from gfs1 now reserved */ }; /* * quota structure */ struct gfs2_quota { __be64 qu_limit; __be64 qu_warn; __be64 qu_value; __u8 qu_reserved[64]; }; /* * dinode structure */ #define GFS2_MAX_META_HEIGHT 10 #define GFS2_DIR_MAX_DEPTH 17 #define DT2IF(dt) (((dt) << 12) & S_IFMT) #define IF2DT(sif) (((sif) & S_IFMT) >> 12) enum { gfs2fl_Jdata = 0, gfs2fl_ExHash = 1, gfs2fl_Unused = 2, gfs2fl_EaIndirect = 3, gfs2fl_Directio = 4, gfs2fl_Immutable = 5, gfs2fl_AppendOnly = 6, gfs2fl_NoAtime = 7, gfs2fl_Sync = 8, gfs2fl_System = 9, gfs2fl_TopLevel = 10, gfs2fl_TruncInProg = 29, gfs2fl_InheritDirectio = 30, gfs2fl_InheritJdata = 31, }; /* Dinode flags */ #define GFS2_DIF_JDATA 0x00000001 #define GFS2_DIF_EXHASH 0x00000002 #define GFS2_DIF_UNUSED 0x00000004 /* only in gfs1 */ #define GFS2_DIF_EA_INDIRECT 0x00000008 #define GFS2_DIF_DIRECTIO 0x00000010 #define GFS2_DIF_IMMUTABLE 0x00000020 #define GFS2_DIF_APPENDONLY 0x00000040 #define GFS2_DIF_NOATIME 0x00000080 #define GFS2_DIF_SYNC 0x00000100 #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ #define GFS2_DIF_TOPDIR 0x00000400 /* New in gfs2 */ #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 /* only in gfs1 */ #define GFS2_DIF_INHERIT_JDATA 0x80000000 struct gfs2_dinode { struct gfs2_meta_header di_header; struct gfs2_inum di_num; __be32 di_mode; /* mode of file */ __be32 di_uid; /* owner's user id */ __be32 di_gid; /* owner's group id */ __be32 di_nlink; /* number of links to this file */ __be64 di_size; /* number of bytes in file */ __be64 di_blocks; /* number of blocks in file */ __be64 di_atime; /* time last accessed */ __be64 di_mtime; /* time last modified */ __be64 di_ctime; /* time last changed */ __be32 di_major; /* device major number */ __be32 di_minor; /* device minor number */ /* This section varies from gfs1. Padding added to align with * remainder of dinode */ __be64 di_goal_meta; /* rgrp to alloc from next */ __be64 di_goal_data; /* data block goal */ __be64 di_generation; /* generation number for NFS */ __be32 di_flags; /* GFS2_DIF_... */ __be32 di_payload_format; /* GFS2_FORMAT_... */ __u16 __pad1; /* Was ditype in gfs1 */ __be16 di_height; /* height of metadata */ __u32 __pad2; /* Unused incarnation number from gfs1 */ /* These only apply to directories */ __u16 __pad3; /* Padding */ __be16 di_depth; /* Number of bits in the table */ __be32 di_entries; /* The number of entries in the directory */ struct gfs2_inum __pad4; /* Unused even in current gfs1 */ __be64 di_eattr; /* extended attribute block number */ __be32 di_atime_nsec; /* nsec portion of atime */ __be32 di_mtime_nsec; /* nsec portion of mtime */ __be32 di_ctime_nsec; /* nsec portion of ctime */ __u8 di_reserved[44]; }; /* * directory structure - many of these per directory file */ #define GFS2_FNAMESIZE 255 #define GFS2_DIRENT_SIZE(name_len) ((sizeof(struct gfs2_dirent) + (name_len) + 7) & ~7) #define GFS2_MIN_DIRENT_SIZE (GFS2_DIRENT_SIZE(1)) struct gfs2_dirent { struct gfs2_inum de_inum; __be32 de_hash; __be16 de_rec_len; __be16 de_name_len; __be16 de_type; __be16 de_rahead; union { __u8 __pad[12]; struct { __u32 de_cookie; /* ondisk value not used */ __u8 pad3[8]; }; }; }; /* * Header of leaf directory nodes */ struct gfs2_leaf { struct gfs2_meta_header lf_header; __be16 lf_depth; /* Depth of leaf */ __be16 lf_entries; /* Number of dirents in leaf */ __be32 lf_dirent_format; /* Format of the dirents */ __be64 lf_next; /* Next leaf, if overflow */ union { __u8 lf_reserved[64]; struct { __be64 lf_inode; /* Dir inode number */ __be32 lf_dist; /* Dist from inode on chain */ __be32 lf_nsec; /* Last ins/del usecs */ __be64 lf_sec; /* Last ins/del in secs */ __u8 lf_reserved2[40]; }; }; }; /* * Extended attribute header format * * This works in a similar way to dirents. There is a fixed size header * followed by a variable length section made up of the name and the * associated data. In the case of a "stuffed" entry, the value is * __inline__ directly after the name, the ea_num_ptrs entry will be * zero in that case. For non-"stuffed" entries, there will be * a set of pointers (aligned to 8 byte boundary) to the block(s) * containing the value. * * The blocks containing the values and the blocks containing the * extended attribute headers themselves all start with the common * metadata header. Each inode, if it has extended attributes, will * have either a single block containing the extended attribute headers * or a single indirect block pointing to blocks containing the * extended attribute headers. * * The maximum size of the data part of an extended attribute is 64k * so the number of blocks required depends upon block size. Since the * block size also determines the number of pointers in an indirect * block, its a fairly complicated calculation to work out the maximum * number of blocks that an inode may have relating to extended attributes. * */ #define GFS2_EA_MAX_NAME_LEN 255 #define GFS2_EA_MAX_DATA_LEN 65536 #define GFS2_EATYPE_UNUSED 0 #define GFS2_EATYPE_USR 1 #define GFS2_EATYPE_SYS 2 #define GFS2_EATYPE_SECURITY 3 #define GFS2_EATYPE_LAST 3 #define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST) #define GFS2_EAFLAG_LAST 0x01 /* last ea in block */ struct gfs2_ea_header { __be32 ea_rec_len; __be32 ea_data_len; __u8 ea_name_len; /* no NULL pointer after the string */ __u8 ea_type; /* GFS2_EATYPE_... */ __u8 ea_flags; /* GFS2_EAFLAG_... */ __u8 ea_num_ptrs; __u32 __pad; }; /* * Log header structure */ #define GFS2_LOG_HEAD_UNMOUNT 0x00000001 /* log is clean */ #define GFS2_LOG_HEAD_FLUSH_NORMAL 0x00000002 /* normal log flush */ #define GFS2_LOG_HEAD_FLUSH_SYNC 0x00000004 /* Sync log flush */ #define GFS2_LOG_HEAD_FLUSH_SHUTDOWN 0x00000008 /* Shutdown log flush */ #define GFS2_LOG_HEAD_FLUSH_FREEZE 0x00000010 /* Freeze flush */ #define GFS2_LOG_HEAD_RECOVERY 0x00000020 /* Journal recovery */ #define GFS2_LOG_HEAD_USERSPACE 0x80000000 /* Written by gfs2-utils */ /* Log flush callers */ #define GFS2_LFC_SHUTDOWN 0x00000100 #define GFS2_LFC_JDATA_WPAGES 0x00000200 #define GFS2_LFC_SET_FLAGS 0x00000400 #define GFS2_LFC_AIL_EMPTY_GL 0x00000800 #define GFS2_LFC_AIL_FLUSH 0x00001000 #define GFS2_LFC_RGRP_GO_SYNC 0x00002000 #define GFS2_LFC_INODE_GO_SYNC 0x00004000 #define GFS2_LFC_INODE_GO_INVAL 0x00008000 #define GFS2_LFC_FREEZE_GO_SYNC 0x00010000 #define GFS2_LFC_KILL_SB 0x00020000 #define GFS2_LFC_DO_SYNC 0x00040000 #define GFS2_LFC_INPLACE_RESERVE 0x00080000 #define GFS2_LFC_WRITE_INODE 0x00100000 #define GFS2_LFC_MAKE_FS_RO 0x00200000 #define GFS2_LFC_SYNC_FS 0x00400000 #define GFS2_LFC_EVICT_INODE 0x00800000 #define GFS2_LFC_TRANS_END 0x01000000 #define GFS2_LFC_LOGD_JFLUSH_REQD 0x02000000 #define GFS2_LFC_LOGD_AIL_FLUSH_REQD 0x04000000 #define LH_V1_SIZE (offsetofend(struct gfs2_log_header, lh_hash)) struct gfs2_log_header { struct gfs2_meta_header lh_header; __be64 lh_sequence; /* Sequence number of this transaction */ __be32 lh_flags; /* GFS2_LOG_HEAD_... */ __be32 lh_tail; /* Block number of log tail */ __be32 lh_blkno; __be32 lh_hash; /* crc up to here with this field 0 */ /* Version 2 additional fields start here */ __be32 lh_crc; /* crc32c from lh_nsec to end of block */ __be32 lh_nsec; /* Nanoseconds of timestamp */ __be64 lh_sec; /* Seconds of timestamp */ __be64 lh_addr; /* Block addr of this log header (absolute) */ __be64 lh_jinode; /* Journal inode number */ __be64 lh_statfs_addr; /* Local statfs inode number */ __be64 lh_quota_addr; /* Local quota change inode number */ /* Statfs local changes (i.e. diff from global statfs) */ __be64 lh_local_total; __be64 lh_local_free; __be64 lh_local_dinodes; }; /* * Log type descriptor */ #define GFS2_LOG_DESC_METADATA 300 /* ld_data1 is the number of metadata blocks in the descriptor. ld_data2 is unused. */ #define GFS2_LOG_DESC_REVOKE 301 /* ld_data1 is the number of revoke blocks in the descriptor. ld_data2 is unused. */ #define GFS2_LOG_DESC_JDATA 302 /* ld_data1 is the number of data blocks in the descriptor. ld_data2 is unused. */ struct gfs2_log_descriptor { struct gfs2_meta_header ld_header; __be32 ld_type; /* GFS2_LOG_DESC_... */ __be32 ld_length; /* Number of buffers in this chunk */ __be32 ld_data1; /* descriptor-specific field */ __be32 ld_data2; /* descriptor-specific field */ __u8 ld_reserved[32]; }; /* * Inum Range * Describe a range of formal inode numbers allocated to * one machine to assign to inodes. */ #define GFS2_INUM_QUANTUM 1048576 struct gfs2_inum_range { __be64 ir_start; __be64 ir_length; }; /* * Statfs change * Describes an change to the pool of free and allocated * blocks. */ struct gfs2_statfs_change { __be64 sc_total; __be64 sc_free; __be64 sc_dinodes; }; /* * Quota change * Describes an allocation change for a particular * user or group. */ #define GFS2_QCF_USER 0x00000001 struct gfs2_quota_change { __be64 qc_change; __be32 qc_flags; /* GFS2_QCF_... */ __be32 qc_id; }; struct gfs2_quota_lvb { __be32 qb_magic; __u32 __pad; __be64 qb_limit; /* Hard limit of # blocks to alloc */ __be64 qb_warn; /* Warn user when alloc is above this # */ __be64 qb_value; /* Current # blocks allocated */ }; #endif /* __GFS2_ONDISK_DOT_H__ */ linux/gigaset_dev.h 0000644 00000002642 15063602050 0010336 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * interface to user space for the gigaset driver * * Copyright (c) 2004 by Hansjoerg Lipp <hjlipp@web.de> * * ===================================================================== * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * ===================================================================== */ #ifndef GIGASET_INTERFACE_H #define GIGASET_INTERFACE_H #include <linux/ioctl.h> /* The magic IOCTL value for this interface. */ #define GIGASET_IOCTL 0x47 /* enable/disable device control via character device (lock out ISDN subsys) */ #define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int) /* enable adapter configuration mode (M10x only) */ #define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int) /* set break characters (M105 only) */ #define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6]) /* get version information selected by arg[0] */ #define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4]) /* values for GIGASET_VERSION arg[0] */ #define GIGVER_DRIVER 0 /* get driver version */ #define GIGVER_COMPAT 1 /* get interface compatibility version */ #define GIGVER_FWBASE 2 /* get base station firmware version */ #endif linux/gpio.h 0000644 00000015137 15063602050 0007016 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/gpio.h> - userspace ABI for the GPIO character devices * * Copyright (C) 2016 Linus Walleij * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _GPIO_H_ #define _GPIO_H_ #include <linux/ioctl.h> #include <linux/types.h> /** * struct gpiochip_info - Information about a certain GPIO chip * @name: the Linux kernel name of this GPIO chip * @label: a functional name for this GPIO chip, such as a product * number, may be NULL * @lines: number of GPIO lines on this chip */ struct gpiochip_info { char name[32]; char label[32]; __u32 lines; }; /* Informational flags */ #define GPIOLINE_FLAG_KERNEL (1UL << 0) /* Line used by the kernel */ #define GPIOLINE_FLAG_IS_OUT (1UL << 1) #define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2) #define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3) #define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4) #define GPIOLINE_FLAG_BIAS_PULL_UP (1UL << 5) #define GPIOLINE_FLAG_BIAS_PULL_DOWN (1UL << 6) #define GPIOLINE_FLAG_BIAS_DISABLE (1UL << 7) /** * struct gpioline_info - Information about a certain GPIO line * @line_offset: the local offset on this GPIO device, fill this in when * requesting the line information from the kernel * @flags: various flags for this line * @name: the name of this GPIO line, such as the output pin of the line on the * chip, a rail or a pin header name on a board, as specified by the gpio * chip, may be NULL * @consumer: a functional name for the consumer of this GPIO line as set by * whatever is using it, will be NULL if there is no current user but may * also be NULL if the consumer doesn't set this up */ struct gpioline_info { __u32 line_offset; __u32 flags; char name[32]; char consumer[32]; }; /* Maximum number of requested handles */ #define GPIOHANDLES_MAX 64 /* Linerequest flags */ #define GPIOHANDLE_REQUEST_INPUT (1UL << 0) #define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1) #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2) #define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3) #define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4) #define GPIOHANDLE_REQUEST_BIAS_PULL_UP (1UL << 5) #define GPIOHANDLE_REQUEST_BIAS_PULL_DOWN (1UL << 6) #define GPIOHANDLE_REQUEST_BIAS_DISABLE (1UL << 7) /** * struct gpiohandle_request - Information about a GPIO handle request * @lineoffsets: an array desired lines, specified by offset index for the * associated GPIO device * @flags: desired flags for the desired GPIO lines, such as * GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed * together. Note that even if multiple lines are requested, the same flags * must be applicable to all of them, if you want lines with individual * flags set, request them one by one. It is possible to select * a batch of input or output lines, but they must all have the same * characteristics, i.e. all inputs or all outputs, all active low etc * @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set for a requested * line, this specifies the default output value, should be 0 (low) or * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) * @consumer_label: a desired consumer label for the selected GPIO line(s) * such as "my-bitbanged-relay" * @lines: number of lines requested in this request, i.e. the number of * valid fields in the above arrays, set to 1 to request a single line * @fd: if successful this field will contain a valid anonymous file handle * after a GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value * means error */ struct gpiohandle_request { __u32 lineoffsets[GPIOHANDLES_MAX]; __u32 flags; __u8 default_values[GPIOHANDLES_MAX]; char consumer_label[32]; __u32 lines; int fd; }; /** * struct gpiohandle_config - Configuration for a GPIO handle request * @flags: updated flags for the requested GPIO lines, such as * GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed * together * @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set in flags, * this specifies the default output value, should be 0 (low) or * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) * @padding: reserved for future use and should be zero filled */ struct gpiohandle_config { __u32 flags; __u8 default_values[GPIOHANDLES_MAX]; __u32 padding[4]; /* padding for future use */ }; #define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0a, struct gpiohandle_config) /** * struct gpiohandle_data - Information of values on a GPIO handle * @values: when getting the state of lines this contains the current * state of a line, when setting the state of lines these should contain * the desired target state */ struct gpiohandle_data { __u8 values[GPIOHANDLES_MAX]; }; #define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data) #define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data) /* Eventrequest flags */ #define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0) #define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1) #define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1)) /** * struct gpioevent_request - Information about a GPIO event request * @lineoffset: the desired line to subscribe to events from, specified by * offset index for the associated GPIO device * @handleflags: desired handle flags for the desired GPIO line, such as * GPIOHANDLE_REQUEST_ACTIVE_LOW or GPIOHANDLE_REQUEST_OPEN_DRAIN * @eventflags: desired flags for the desired GPIO event line, such as * GPIOEVENT_REQUEST_RISING_EDGE or GPIOEVENT_REQUEST_FALLING_EDGE * @consumer_label: a desired consumer label for the selected GPIO line(s) * such as "my-listener" * @fd: if successful this field will contain a valid anonymous file handle * after a GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value * means error */ struct gpioevent_request { __u32 lineoffset; __u32 handleflags; __u32 eventflags; char consumer_label[32]; int fd; }; /** * GPIO event types */ #define GPIOEVENT_EVENT_RISING_EDGE 0x01 #define GPIOEVENT_EVENT_FALLING_EDGE 0x02 /** * struct gpioevent_data - The actual event being pushed to userspace * @timestamp: best estimate of time of event occurrence, in nanoseconds * @id: event identifier */ struct gpioevent_data { __u64 timestamp; __u32 id; }; #define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info) #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info) #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request) #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request) #endif /* _GPIO_H_ */ linux/gsmmux.h 0000644 00000002021 15063602050 0007364 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_GSMMUX_H #define _LINUX_GSMMUX_H #include <linux/if.h> #include <linux/ioctl.h> #include <linux/types.h> struct gsm_config { unsigned int adaption; unsigned int encapsulation; unsigned int initiator; unsigned int t1; unsigned int t2; unsigned int t3; unsigned int n2; unsigned int mru; unsigned int mtu; unsigned int k; unsigned int i; unsigned int unused[8]; /* Padding for expansion without breaking stuff */ }; #define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config) #define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config) struct gsm_netconfig { unsigned int adaption; /* Adaption to use in network mode */ unsigned short protocol;/* Protocol to use - only ETH_P_IP supported */ unsigned short unused2; char if_name[IFNAMSIZ]; /* interface name format string */ __u8 unused[28]; /* For future use */ }; #define GSMIOC_ENABLE_NET _IOW('G', 2, struct gsm_netconfig) #define GSMIOC_DISABLE_NET _IO('G', 3) #endif linux/gtp.h 0000644 00000001251 15063602050 0006642 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_GTP_H_ #define _LINUX_GTP_H_ enum gtp_genl_cmds { GTP_CMD_NEWPDP, GTP_CMD_DELPDP, GTP_CMD_GETPDP, GTP_CMD_MAX, }; enum gtp_version { GTP_V0 = 0, GTP_V1, }; enum gtp_attrs { GTPA_UNSPEC = 0, GTPA_LINK, GTPA_VERSION, GTPA_TID, /* for GTPv0 only */ GTPA_PEER_ADDRESS, /* Remote GSN peer, either SGSN or GGSN */ #define GTPA_SGSN_ADDRESS GTPA_PEER_ADDRESS /* maintain legacy attr name */ GTPA_MS_ADDRESS, GTPA_FLOW, GTPA_NET_NS_FD, GTPA_I_TEI, /* for GTPv1 only */ GTPA_O_TEI, /* for GTPv1 only */ GTPA_PAD, __GTPA_MAX, }; #define GTPA_MAX (__GTPA_MAX + 1) #endif /* _LINUX_GTP_H_ */ linux/hash_info.h 0000644 00000001631 15063602050 0010010 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Hash Info: Hash algorithms information * * Copyright (c) 2013 Dmitry Kasatkin <d.kasatkin@samsung.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * */ #ifndef _LINUX_HASH_INFO_H #define _LINUX_HASH_INFO_H enum hash_algo { HASH_ALGO_MD4, HASH_ALGO_MD5, HASH_ALGO_SHA1, HASH_ALGO_RIPE_MD_160, HASH_ALGO_SHA256, HASH_ALGO_SHA384, HASH_ALGO_SHA512, HASH_ALGO_SHA224, HASH_ALGO_RIPE_MD_128, HASH_ALGO_RIPE_MD_256, HASH_ALGO_RIPE_MD_320, HASH_ALGO_WP_256, HASH_ALGO_WP_384, HASH_ALGO_WP_512, HASH_ALGO_TGR_128, HASH_ALGO_TGR_160, HASH_ALGO_TGR_192, HASH_ALGO_SM3_256, HASH_ALGO__LAST }; #endif /* _LINUX_HASH_INFO_H */ linux/hdlc.h 0000644 00000001175 15063602050 0006767 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Generic HDLC support routines for Linux * * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. */ #ifndef __HDLC_H #define __HDLC_H #define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ #if 0 #define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ #else #define HDLC_MAX_MRU 1600 /* as required for FR network */ #endif #endif /* __HDLC_H */ linux/hdlcdrv.h 0000644 00000005534 15063602050 0007506 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * hdlcdrv.h -- HDLC packet radio network driver. * The Linux soundcard driver for 1200 baud and 9600 baud packet radio * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA */ #ifndef _HDLCDRV_H #define _HDLCDRV_H /* -------------------------------------------------------------------- */ /* * structs for the IOCTL commands */ struct hdlcdrv_params { int iobase; int irq; int dma; int dma2; int seriobase; int pariobase; int midiiobase; }; struct hdlcdrv_channel_params { int tx_delay; /* the transmitter keyup delay in 10ms units */ int tx_tail; /* the transmitter keyoff delay in 10ms units */ int slottime; /* the slottime in 10ms; usually 10 = 100ms */ int ppersist; /* the p-persistence 0..255 */ int fulldup; /* some driver do not support full duplex, setting */ /* this just makes them send even if DCD is on */ }; struct hdlcdrv_old_channel_state { int ptt; int dcd; int ptt_keyed; }; struct hdlcdrv_channel_state { int ptt; int dcd; int ptt_keyed; unsigned long tx_packets; unsigned long tx_errors; unsigned long rx_packets; unsigned long rx_errors; }; struct hdlcdrv_ioctl { int cmd; union { struct hdlcdrv_params mp; struct hdlcdrv_channel_params cp; struct hdlcdrv_channel_state cs; struct hdlcdrv_old_channel_state ocs; unsigned int calibrate; unsigned char bits; char modename[128]; char drivername[32]; } data; }; /* -------------------------------------------------------------------- */ /* * ioctl values */ #define HDLCDRVCTL_GETMODEMPAR 0 #define HDLCDRVCTL_SETMODEMPAR 1 #define HDLCDRVCTL_MODEMPARMASK 2 /* not handled by hdlcdrv */ #define HDLCDRVCTL_GETCHANNELPAR 10 #define HDLCDRVCTL_SETCHANNELPAR 11 #define HDLCDRVCTL_OLDGETSTAT 20 #define HDLCDRVCTL_CALIBRATE 21 #define HDLCDRVCTL_GETSTAT 22 /* * these are mainly for debugging purposes */ #define HDLCDRVCTL_GETSAMPLES 30 #define HDLCDRVCTL_GETBITS 31 /* * not handled by hdlcdrv, but by its depending drivers */ #define HDLCDRVCTL_GETMODE 40 #define HDLCDRVCTL_SETMODE 41 #define HDLCDRVCTL_MODELIST 42 #define HDLCDRVCTL_DRIVERNAME 43 /* * mask of needed modem parameters, returned by HDLCDRVCTL_MODEMPARMASK */ #define HDLCDRV_PARMASK_IOBASE (1<<0) #define HDLCDRV_PARMASK_IRQ (1<<1) #define HDLCDRV_PARMASK_DMA (1<<2) #define HDLCDRV_PARMASK_DMA2 (1<<3) #define HDLCDRV_PARMASK_SERIOBASE (1<<4) #define HDLCDRV_PARMASK_PARIOBASE (1<<5) #define HDLCDRV_PARMASK_MIDIIOBASE (1<<6) /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ #endif /* _HDLCDRV_H */ /* -------------------------------------------------------------------- */ linux/hdreg.h 0000644 00000054257 15063602050 0007157 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_HDREG_H #define _LINUX_HDREG_H #include <linux/types.h> /* * Command Header sizes for IOCTL commands */ #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8)) #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) #define IDE_DRIVE_TASK_NO_DATA 0 #define IDE_DRIVE_TASK_INVALID -1 #define IDE_DRIVE_TASK_SET_XFER 1 #define IDE_DRIVE_TASK_IN 2 #define IDE_DRIVE_TASK_OUT 3 #define IDE_DRIVE_TASK_RAW_WRITE 4 /* * Define standard taskfile in/out register */ #define IDE_TASKFILE_STD_IN_FLAGS 0xFE #define IDE_HOB_STD_IN_FLAGS 0x3C #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE #define IDE_HOB_STD_OUT_FLAGS 0x3C typedef unsigned char task_ioreg_t; typedef unsigned long sata_ioreg_t; typedef union ide_reg_valid_s { unsigned all : 16; struct { unsigned data : 1; unsigned error_feature : 1; unsigned sector : 1; unsigned nsector : 1; unsigned lcyl : 1; unsigned hcyl : 1; unsigned select : 1; unsigned status_command : 1; unsigned data_hob : 1; unsigned error_feature_hob : 1; unsigned sector_hob : 1; unsigned nsector_hob : 1; unsigned lcyl_hob : 1; unsigned hcyl_hob : 1; unsigned select_hob : 1; unsigned control_hob : 1; } b; } ide_reg_valid_t; typedef struct ide_task_request_s { __u8 io_ports[8]; __u8 hob_ports[8]; /* bytes 6 and 7 are unused */ ide_reg_valid_t out_flags; ide_reg_valid_t in_flags; int data_phase; int req_cmd; unsigned long out_size; unsigned long in_size; } ide_task_request_t; typedef struct ide_ioctl_request_s { ide_task_request_t *task_request; unsigned char *out_buffer; unsigned char *in_buffer; } ide_ioctl_request_t; struct hd_drive_cmd_hdr { __u8 command; __u8 sector_number; __u8 feature; __u8 sector_count; }; typedef struct hd_drive_task_hdr { __u8 data; __u8 feature; __u8 sector_count; __u8 sector_number; __u8 low_cylinder; __u8 high_cylinder; __u8 device_head; __u8 command; } task_struct_t; typedef struct hd_drive_hob_hdr { __u8 data; __u8 feature; __u8 sector_count; __u8 sector_number; __u8 low_cylinder; __u8 high_cylinder; __u8 device_head; __u8 control; } hob_struct_t; #define TASKFILE_NO_DATA 0x0000 #define TASKFILE_IN 0x0001 #define TASKFILE_MULTI_IN 0x0002 #define TASKFILE_OUT 0x0004 #define TASKFILE_MULTI_OUT 0x0008 #define TASKFILE_IN_OUT 0x0010 #define TASKFILE_IN_DMA 0x0020 #define TASKFILE_OUT_DMA 0x0040 #define TASKFILE_IN_DMAQ 0x0080 #define TASKFILE_OUT_DMAQ 0x0100 #define TASKFILE_P_IN 0x0200 #define TASKFILE_P_OUT 0x0400 #define TASKFILE_P_IN_DMA 0x0800 #define TASKFILE_P_OUT_DMA 0x1000 #define TASKFILE_P_IN_DMAQ 0x2000 #define TASKFILE_P_OUT_DMAQ 0x4000 #define TASKFILE_48 0x8000 #define TASKFILE_INVALID 0x7fff /* ATA/ATAPI Commands pre T13 Spec */ #define WIN_NOP 0x00 /* * 0x01->0x02 Reserved */ #define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */ /* * 0x04->0x07 Reserved */ #define WIN_SRST 0x08 /* ATAPI soft reset command */ #define WIN_DEVICE_RESET 0x08 /* * 0x09->0x0F Reserved */ #define WIN_RECAL 0x10 #define WIN_RESTORE WIN_RECAL /* * 0x10->0x1F Reserved */ #define WIN_READ 0x20 /* 28-Bit */ #define WIN_READ_ONCE 0x21 /* 28-Bit without retries */ #define WIN_READ_LONG 0x22 /* 28-Bit */ #define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */ #define WIN_READ_EXT 0x24 /* 48-Bit */ #define WIN_READDMA_EXT 0x25 /* 48-Bit */ #define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */ #define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */ /* * 0x28 */ #define WIN_MULTREAD_EXT 0x29 /* 48-Bit */ /* * 0x2A->0x2F Reserved */ #define WIN_WRITE 0x30 /* 28-Bit */ #define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */ #define WIN_WRITE_LONG 0x32 /* 28-Bit */ #define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */ #define WIN_WRITE_EXT 0x34 /* 48-Bit */ #define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */ #define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */ #define WIN_SET_MAX_EXT 0x37 /* 48-Bit */ #define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */ #define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */ /* * 0x3A->0x3B Reserved */ #define WIN_WRITE_VERIFY 0x3C /* 28-Bit */ /* * 0x3D->0x3F Reserved */ #define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */ #define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */ #define WIN_VERIFY_EXT 0x42 /* 48-Bit */ /* * 0x43->0x4F Reserved */ #define WIN_FORMAT 0x50 /* * 0x51->0x5F Reserved */ #define WIN_INIT 0x60 /* * 0x61->0x5F Reserved */ #define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */ #define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */ #define WIN_DIAGNOSE 0x90 #define WIN_SPECIFY 0x91 /* set drive geometry translation */ #define WIN_DOWNLOAD_MICROCODE 0x92 #define WIN_STANDBYNOW2 0x94 #define WIN_STANDBY2 0x96 #define WIN_SETIDLE2 0x97 #define WIN_CHECKPOWERMODE2 0x98 #define WIN_SLEEPNOW2 0x99 /* * 0x9A VENDOR */ #define WIN_PACKETCMD 0xA0 /* Send a packet command. */ #define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ #define WIN_QUEUED_SERVICE 0xA2 #define WIN_SMART 0xB0 /* self-monitoring and reporting */ #define CFA_ERASE_SECTORS 0xC0 #define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/ #define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ #define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ #define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */ #define WIN_READDMA 0xC8 /* read sectors using DMA transfers */ #define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */ #define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */ #define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */ #define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */ #define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */ #define WIN_GETMEDIASTATUS 0xDA #define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */ #define WIN_POSTBOOT 0xDC #define WIN_PREBOOT 0xDD #define WIN_DOORLOCK 0xDE /* lock door on removable drives */ #define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */ #define WIN_STANDBYNOW1 0xE0 #define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */ #define WIN_STANDBY 0xE2 /* Set device in Standby Mode */ #define WIN_SETIDLE1 0xE3 #define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */ #define WIN_CHECKPOWERMODE1 0xE5 #define WIN_SLEEPNOW1 0xE6 #define WIN_FLUSH_CACHE 0xE7 #define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */ #define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */ /* SET_FEATURES 0x22 or 0xDD */ #define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */ #define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ #define WIN_MEDIAEJECT 0xED #define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */ #define WIN_SETFEATURES 0xEF /* set special drive features */ #define EXABYTE_ENABLE_NEST 0xF0 #define WIN_SECURITY_SET_PASS 0xF1 #define WIN_SECURITY_UNLOCK 0xF2 #define WIN_SECURITY_ERASE_PREPARE 0xF3 #define WIN_SECURITY_ERASE_UNIT 0xF4 #define WIN_SECURITY_FREEZE_LOCK 0xF5 #define WIN_SECURITY_DISABLE 0xF6 #define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */ #define WIN_SET_MAX 0xF9 #define DISABLE_SEAGATE 0xFB /* WIN_SMART sub-commands */ #define SMART_READ_VALUES 0xD0 #define SMART_READ_THRESHOLDS 0xD1 #define SMART_AUTOSAVE 0xD2 #define SMART_SAVE 0xD3 #define SMART_IMMEDIATE_OFFLINE 0xD4 #define SMART_READ_LOG_SECTOR 0xD5 #define SMART_WRITE_LOG_SECTOR 0xD6 #define SMART_WRITE_THRESHOLDS 0xD7 #define SMART_ENABLE 0xD8 #define SMART_DISABLE 0xD9 #define SMART_STATUS 0xDA #define SMART_AUTO_OFFLINE 0xDB /* Password used in TF4 & TF5 executing SMART commands */ #define SMART_LCYL_PASS 0x4F #define SMART_HCYL_PASS 0xC2 /* WIN_SETFEATURES sub-commands */ #define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */ #define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */ #define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */ #define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */ #define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */ #define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */ #define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */ #define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */ #define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */ #define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */ #define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */ #define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */ #define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */ #define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */ #define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */ #define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */ #define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */ #define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */ #define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */ #define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */ #define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */ #define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */ #define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ #define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ #define SETFEATURES_EN_REST 0xAC /* ATA-1 */ #define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */ #define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ #define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ #define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ #define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */ #define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */ /* WIN_SECURITY sub-commands */ #define SECURITY_SET_PASSWORD 0xBA #define SECURITY_UNLOCK 0xBB #define SECURITY_ERASE_PREPARE 0xBC #define SECURITY_ERASE_UNIT 0xBD #define SECURITY_FREEZE_LOCK 0xBE #define SECURITY_DISABLE_PASSWORD 0xBF struct hd_geometry { unsigned char heads; unsigned char sectors; unsigned short cylinders; unsigned long start; }; /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ #define HDIO_GETGEO 0x0301 /* get device geometry */ #define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ #define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ #define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */ #define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */ #define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */ #define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ #define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ #define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ #define HDIO_GET_DMA 0x030b /* get use-dma flag */ #define HDIO_GET_NICE 0x030c /* get nice flags */ #define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ #define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */ #define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */ #define HDIO_GET_ADDRESS 0x0310 /* */ #define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */ #define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */ #define HDIO_DRIVE_RESET 0x031c /* execute a device reset */ #define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */ #define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */ #define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ #define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ #define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ #define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ #define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ #define HDIO_SET_NICE 0x0329 /* set nice flags */ #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ #define HDIO_SET_QDMA 0x032e /* change use-qdma flag */ #define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */ /* bus states */ enum { BUSSTATE_OFF = 0, BUSSTATE_ON, BUSSTATE_TRISTATE }; /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */ /* 0x330 is reserved - used to be HDIO_GETGEO_BIG */ /* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */ /* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */ /* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */ #define __NEW_HD_DRIVE_ID /* * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. * * If you change something here, please remember to update fix_driveid() in * ide/probe.c. */ struct hd_driveid { unsigned short config; /* lots of obsolete bit flags */ unsigned short cyls; /* Obsolete, "physical" cyls */ unsigned short reserved2; /* reserved (word 2) */ unsigned short heads; /* Obsolete, "physical" heads */ unsigned short track_bytes; /* unformatted bytes per track */ unsigned short sector_bytes; /* unformatted bytes per sector */ unsigned short sectors; /* Obsolete, "physical" sectors per track */ unsigned short vendor0; /* vendor unique */ unsigned short vendor1; /* vendor unique */ unsigned short vendor2; /* Retired vendor unique */ unsigned char serial_no[20]; /* 0 = not_specified */ unsigned short buf_type; /* Retired */ unsigned short buf_size; /* Retired, 512 byte increments * 0 = not_specified */ unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */ unsigned char fw_rev[8]; /* 0 = not_specified */ unsigned char model[40]; /* 0 = not_specified */ unsigned char max_multsect; /* 0=not_implemented */ unsigned char vendor3; /* vendor unique */ unsigned short dword_io; /* 0=not_implemented; 1=implemented */ unsigned char vendor4; /* vendor unique */ unsigned char capability; /* (upper byte of word 49) * 3: IORDYsup * 2: IORDYsw * 1: LBA * 0: DMA */ unsigned short reserved50; /* reserved (word 50) */ unsigned char vendor5; /* Obsolete, vendor unique */ unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */ unsigned char vendor6; /* Obsolete, vendor unique */ unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */ unsigned short field_valid; /* (word 53) * 2: ultra_ok word 88 * 1: eide_ok words 64-70 * 0: cur_ok words 54-58 */ unsigned short cur_cyls; /* Obsolete, logical cylinders */ unsigned short cur_heads; /* Obsolete, l heads */ unsigned short cur_sectors; /* Obsolete, l sectors per track */ unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */ unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */ unsigned char multsect; /* current multiple sector count */ unsigned char multsect_valid; /* when (bit0==1) multsect is ok */ unsigned int lba_capacity; /* Obsolete, total number of sectors */ unsigned short dma_1word; /* Obsolete, single-word dma info */ unsigned short dma_mword; /* multiple-word dma info */ unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */ unsigned short eide_dma_min; /* min mword dma cycle time (ns) */ unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */ unsigned short eide_pio; /* min cycle time (ns), no IORDY */ unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */ unsigned short words69_70[2]; /* reserved words 69-70 * future command overlap and queuing */ unsigned short words71_74[4]; /* reserved words 71-74 * for IDENTIFY PACKET DEVICE command */ unsigned short queue_depth; /* (word 75) * 15:5 reserved * 4:0 Maximum queue depth -1 */ unsigned short words76_79[4]; /* reserved words 76-79 */ unsigned short major_rev_num; /* (word 80) */ unsigned short minor_rev_num; /* (word 81) */ unsigned short command_set_1; /* (word 82) supported * 15: Obsolete * 14: NOP command * 13: READ_BUFFER * 12: WRITE_BUFFER * 11: Obsolete * 10: Host Protected Area * 9: DEVICE Reset * 8: SERVICE Interrupt * 7: Release Interrupt * 6: look-ahead * 5: write cache * 4: PACKET Command * 3: Power Management Feature Set * 2: Removable Feature Set * 1: Security Feature Set * 0: SMART Feature Set */ unsigned short command_set_2; /* (word 83) * 15: Shall be ZERO * 14: Shall be ONE * 13: FLUSH CACHE EXT * 12: FLUSH CACHE * 11: Device Configuration Overlay * 10: 48-bit Address Feature Set * 9: Automatic Acoustic Management * 8: SET MAX security * 7: reserved 1407DT PARTIES * 6: SetF sub-command Power-Up * 5: Power-Up in Standby Feature Set * 4: Removable Media Notification * 3: APM Feature Set * 2: CFA Feature Set * 1: READ/WRITE DMA QUEUED * 0: Download MicroCode */ unsigned short cfsse; /* (word 84) * cmd set-feature supported extensions * 15: Shall be ZERO * 14: Shall be ONE * 13:6 reserved * 5: General Purpose Logging * 4: Streaming Feature Set * 3: Media Card Pass Through * 2: Media Serial Number Valid * 1: SMART selt-test supported * 0: SMART error logging */ unsigned short cfs_enable_1; /* (word 85) * command set-feature enabled * 15: Obsolete * 14: NOP command * 13: READ_BUFFER * 12: WRITE_BUFFER * 11: Obsolete * 10: Host Protected Area * 9: DEVICE Reset * 8: SERVICE Interrupt * 7: Release Interrupt * 6: look-ahead * 5: write cache * 4: PACKET Command * 3: Power Management Feature Set * 2: Removable Feature Set * 1: Security Feature Set * 0: SMART Feature Set */ unsigned short cfs_enable_2; /* (word 86) * command set-feature enabled * 15: Shall be ZERO * 14: Shall be ONE * 13: FLUSH CACHE EXT * 12: FLUSH CACHE * 11: Device Configuration Overlay * 10: 48-bit Address Feature Set * 9: Automatic Acoustic Management * 8: SET MAX security * 7: reserved 1407DT PARTIES * 6: SetF sub-command Power-Up * 5: Power-Up in Standby Feature Set * 4: Removable Media Notification * 3: APM Feature Set * 2: CFA Feature Set * 1: READ/WRITE DMA QUEUED * 0: Download MicroCode */ unsigned short csf_default; /* (word 87) * command set-feature default * 15: Shall be ZERO * 14: Shall be ONE * 13:6 reserved * 5: General Purpose Logging enabled * 4: Valid CONFIGURE STREAM executed * 3: Media Card Pass Through enabled * 2: Media Serial Number Valid * 1: SMART selt-test supported * 0: SMART error logging */ unsigned short dma_ultra; /* (word 88) */ unsigned short trseuc; /* time required for security erase */ unsigned short trsEuc; /* time required for enhanced erase */ unsigned short CurAPMvalues; /* current APM values */ unsigned short mprc; /* master password revision code */ unsigned short hw_config; /* hardware config (word 93) * 15: Shall be ZERO * 14: Shall be ONE * 13: * 12: * 11: * 10: * 9: * 8: * 7: * 6: * 5: * 4: * 3: * 2: * 1: * 0: Shall be ONE */ unsigned short acoustic; /* (word 94) * 15:8 Vendor's recommended value * 7:0 current value */ unsigned short msrqs; /* min stream request size */ unsigned short sxfert; /* stream transfer time */ unsigned short sal; /* stream access latency */ unsigned int spg; /* stream performance granularity */ unsigned long long lba_capacity_2;/* 48-bit total number of sectors */ unsigned short words104_125[22];/* reserved words 104-125 */ unsigned short last_lun; /* (word 126) */ unsigned short word127; /* (word 127) Feature Set * Removable Media Notification * 15:2 reserved * 1:0 00 = not supported * 01 = supported * 10 = reserved * 11 = reserved */ unsigned short dlf; /* (word 128) * device lock function * 15:9 reserved * 8 security level 1:max 0:high * 7:6 reserved * 5 enhanced erase * 4 expire * 3 frozen * 2 locked * 1 en/disabled * 0 capability */ unsigned short csfo; /* (word 129) * current set features options * 15:4 reserved * 3: auto reassign * 2: reverting * 1: read-look-ahead * 0: write cache */ unsigned short words130_155[26];/* reserved vendor words 130-155 */ unsigned short word156; /* reserved vendor word 156 */ unsigned short words157_159[3];/* reserved vendor words 157-159 */ unsigned short cfa_power; /* (word 160) CFA Power Mode * 15 word 160 supported * 14 reserved * 13 * 12 * 11:0 */ unsigned short words161_175[15];/* Reserved for CFA */ unsigned short words176_205[30];/* Current Media Serial Number */ unsigned short words206_254[49];/* reserved words 206-254 */ unsigned short integrity_word; /* (word 255) * 15:8 Checksum * 7:0 Signature */ }; /* * IDE "nice" flags. These are used on a per drive basis to determine * when to be nice and give more bandwidth to the other devices which * share the same IDE bus. */ #define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ #define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ #define IDE_NICE_1 (3) /* when probably won't affect us much */ #define IDE_NICE_0 (2) /* when sure that it won't affect us */ #define IDE_NICE_2 (4) /* when we know it's on our expense */ #endif /* _LINUX_HDREG_H */ linux/hid.h 0000644 00000003555 15063602050 0006625 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 1999 Andreas Gal * Copyright (c) 2000-2001 Vojtech Pavlik * Copyright (c) 2006-2007 Jiri Kosina */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ #ifndef __HID_H #define __HID_H /* * USB HID (Human Interface Device) interface class code */ #define USB_INTERFACE_CLASS_HID 3 /* * USB HID interface subclass and protocol codes */ #define USB_INTERFACE_SUBCLASS_BOOT 1 #define USB_INTERFACE_PROTOCOL_KEYBOARD 1 #define USB_INTERFACE_PROTOCOL_MOUSE 2 /* * HID class requests */ #define HID_REQ_GET_REPORT 0x01 #define HID_REQ_GET_IDLE 0x02 #define HID_REQ_GET_PROTOCOL 0x03 #define HID_REQ_SET_REPORT 0x09 #define HID_REQ_SET_IDLE 0x0A #define HID_REQ_SET_PROTOCOL 0x0B /* * HID class descriptor types */ #define HID_DT_HID (USB_TYPE_CLASS | 0x01) #define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) #define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03) #define HID_MAX_DESCRIPTOR_SIZE 4096 #endif /* __HID_H */ linux/hiddev.h 0000644 00000014311 15063602050 0007314 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 1999-2000 Vojtech Pavlik * * Sponsored by SuSE */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ #ifndef _HIDDEV_H #define _HIDDEV_H #include <linux/types.h> /* * The event structure itself */ struct hiddev_event { unsigned hid; signed int value; }; struct hiddev_devinfo { __u32 bustype; __u32 busnum; __u32 devnum; __u32 ifnum; __s16 vendor; __s16 product; __s16 version; __u32 num_applications; }; struct hiddev_collection_info { __u32 index; __u32 type; __u32 usage; __u32 level; }; #define HID_STRING_SIZE 256 struct hiddev_string_descriptor { __s32 index; char value[HID_STRING_SIZE]; }; struct hiddev_report_info { __u32 report_type; __u32 report_id; __u32 num_fields; }; /* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields * are unknown. Otherwise use a usage_ref struct filled in from a previous * successful GUSAGE call to save time. To actually send a value to the * device, perform a SUSAGE first, followed by a SREPORT. An INITREPORT or a * GREPORT isn't necessary for a GUSAGE to return valid data. */ #define HID_REPORT_ID_UNKNOWN 0xffffffff #define HID_REPORT_ID_FIRST 0x00000100 #define HID_REPORT_ID_NEXT 0x00000200 #define HID_REPORT_ID_MASK 0x000000ff #define HID_REPORT_ID_MAX 0x000000ff #define HID_REPORT_TYPE_INPUT 1 #define HID_REPORT_TYPE_OUTPUT 2 #define HID_REPORT_TYPE_FEATURE 3 #define HID_REPORT_TYPE_MIN 1 #define HID_REPORT_TYPE_MAX 3 struct hiddev_field_info { __u32 report_type; __u32 report_id; __u32 field_index; __u32 maxusage; __u32 flags; __u32 physical; /* physical usage for this field */ __u32 logical; /* logical usage for this field */ __u32 application; /* application usage for this field */ __s32 logical_minimum; __s32 logical_maximum; __s32 physical_minimum; __s32 physical_maximum; __u32 unit_exponent; __u32 unit; }; /* Fill in report_type, report_id and field_index to get the information on a * field. */ #define HID_FIELD_CONSTANT 0x001 #define HID_FIELD_VARIABLE 0x002 #define HID_FIELD_RELATIVE 0x004 #define HID_FIELD_WRAP 0x008 #define HID_FIELD_NONLINEAR 0x010 #define HID_FIELD_NO_PREFERRED 0x020 #define HID_FIELD_NULL_STATE 0x040 #define HID_FIELD_VOLATILE 0x080 #define HID_FIELD_BUFFERED_BYTE 0x100 struct hiddev_usage_ref { __u32 report_type; __u32 report_id; __u32 field_index; __u32 usage_index; __u32 usage_code; __s32 value; }; /* hiddev_usage_ref_multi is used for sending multiple bytes to a control. * It really manifests itself as setting the value of consecutive usages */ #define HID_MAX_MULTI_USAGES 1024 struct hiddev_usage_ref_multi { struct hiddev_usage_ref uref; __u32 num_values; __s32 values[HID_MAX_MULTI_USAGES]; }; /* FIELD_INDEX_NONE is returned in read() data from the kernel when flags * is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has * been sent by the device */ #define HID_FIELD_INDEX_NONE 0xffffffff /* * Protocol version. */ #define HID_VERSION 0x010004 /* * IOCTLs (0x00 - 0x7f) */ #define HIDIOCGVERSION _IOR('H', 0x01, int) #define HIDIOCAPPLICATION _IO('H', 0x02) #define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo) #define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor) #define HIDIOCINITREPORT _IO('H', 0x05) #define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len) #define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info) #define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) #define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info) #define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info) #define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref) #define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) #define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref) #define HIDIOCGFLAG _IOR('H', 0x0E, int) #define HIDIOCSFLAG _IOW('H', 0x0F, int) #define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref) #define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info) #define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len) /* For writing/reading to multiple/consecutive usages */ #define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi) #define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi) /* * Flags to be used in HIDIOCSFLAG */ #define HIDDEV_FLAG_UREF 0x1 #define HIDDEV_FLAG_REPORT 0x2 #define HIDDEV_FLAGS 0x3 /* To traverse the input report descriptor info for a HID device, perform the * following: * * rinfo.report_type = HID_REPORT_TYPE_INPUT; * rinfo.report_id = HID_REPORT_ID_FIRST; * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); * * while (ret >= 0) { * for (i = 0; i < rinfo.num_fields; i++) { * finfo.report_type = rinfo.report_type; * finfo.report_id = rinfo.report_id; * finfo.field_index = i; * ioctl(fd, HIDIOCGFIELDINFO, &finfo); * for (j = 0; j < finfo.maxusage; j++) { * uref.report_type = rinfo.report_type; * uref.report_id = rinfo.report_id; * uref.field_index = i; * uref.usage_index = j; * ioctl(fd, HIDIOCGUCODE, &uref); * ioctl(fd, HIDIOCGUSAGE, &uref); * } * } * rinfo.report_id |= HID_REPORT_ID_NEXT; * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); * } */ #endif /* _HIDDEV_H */ linux/hdlc/ioctl.h 0000644 00000005141 15063602050 0010076 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __HDLC_IOCTL_H__ #define __HDLC_IOCTL_H__ #define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ #define CLOCK_DEFAULT 0 /* Default setting */ #define CLOCK_EXT 1 /* External TX and RX clock - DTE */ #define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ #define CLOCK_TXINT 3 /* Internal TX and external RX clock */ #define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ #define ENCODING_DEFAULT 0 /* Default setting */ #define ENCODING_NRZ 1 #define ENCODING_NRZI 2 #define ENCODING_FM_MARK 3 #define ENCODING_FM_SPACE 4 #define ENCODING_MANCHESTER 5 #define PARITY_DEFAULT 0 /* Default setting */ #define PARITY_NONE 1 /* No parity */ #define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ #define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ #define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ #define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ #define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ #define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ #define LMI_DEFAULT 0 /* Default setting */ #define LMI_NONE 1 /* No LMI, all PVCs are static */ #define LMI_ANSI 2 /* ANSI Annex D */ #define LMI_CCITT 3 /* ITU-T Annex A */ #define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ #ifndef __ASSEMBLY__ typedef struct { unsigned int clock_rate; /* bits per second */ unsigned int clock_type; /* internal, external, TX-internal etc. */ unsigned short loopback; } sync_serial_settings; /* V.35, V.24, X.21 */ typedef struct { unsigned int clock_rate; /* bits per second */ unsigned int clock_type; /* internal, external, TX-internal etc. */ unsigned short loopback; unsigned int slot_map; } te1_settings; /* T1, E1 */ typedef struct { unsigned short encoding; unsigned short parity; } raw_hdlc_proto; typedef struct { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; /* 1 for DCE (network side) operation */ } fr_proto; typedef struct { unsigned int dlci; } fr_proto_pvc; /* for creating/deleting FR PVCs */ typedef struct { unsigned int dlci; char master[IFNAMSIZ]; /* Name of master FRAD device */ }fr_proto_pvc_info; /* for returning PVC information only */ typedef struct { unsigned int interval; unsigned int timeout; } cisco_proto; /* PPP doesn't need any info now - supply length = 0 to ioctl */ #endif /* __ASSEMBLY__ */ #endif /* __HDLC_IOCTL_H__ */ linux/hidraw.h 0000644 00000003711 15063602050 0007331 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2007 Jiri Kosina */ /* * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _HIDRAW_H #define _HIDRAW_H #include <linux/hid.h> #include <linux/types.h> struct hidraw_report_descriptor { __u32 size; __u8 value[HID_MAX_DESCRIPTOR_SIZE]; }; struct hidraw_devinfo { __u32 bustype; __s16 vendor; __s16 product; }; /* ioctl interface */ #define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) #define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) #define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) #define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) #define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) /* The first byte of SFEATURE and GFEATURE is the report number */ #define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) #define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) #define HIDIOCGRAWUNIQ(len) _IOC(_IOC_READ, 'H', 0x08, len) /* The first byte of SINPUT and GINPUT is the report number */ #define HIDIOCSINPUT(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x09, len) #define HIDIOCGINPUT(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0A, len) /* The first byte of SOUTPUT and GOUTPUT is the report number */ #define HIDIOCSOUTPUT(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0B, len) #define HIDIOCGOUTPUT(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0C, len) #define HIDRAW_FIRST_MINOR 0 #define HIDRAW_MAX_DEVICES 64 /* number of reports to buffer */ #define HIDRAW_BUFFER_SIZE 64 /* kernel-only API declarations */ #endif /* _HIDRAW_H */ linux/hpet.h 0000644 00000001347 15063602050 0007016 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __HPET__ #define __HPET__ struct hpet_info { unsigned long hi_ireqfreq; /* Hz */ unsigned long hi_flags; /* information */ unsigned short hi_hpet; unsigned short hi_timer; }; #define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */ #define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ #define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ #define HPET_INFO _IOR('h', 0x03, struct hpet_info) #define HPET_EPI _IO('h', 0x04) /* enable periodic */ #define HPET_DPI _IO('h', 0x05) /* disable periodic */ #define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ #define MAX_HPET_TBS 8 /* maximum hpet timer blocks */ #endif /* __HPET__ */ linux/hsr_netlink.h 0000644 00000002071 15063602050 0010371 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2011-2013 Autronica Fire and Security AS * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * Author(s): * 2011-2013 Arvid Brodin, arvid.brodin@xdin.com */ #ifndef __UAPI_HSR_NETLINK_H #define __UAPI_HSR_NETLINK_H /* Generic Netlink HSR family definition */ /* attributes */ enum { HSR_A_UNSPEC, HSR_A_NODE_ADDR, HSR_A_IFINDEX, HSR_A_IF1_AGE, HSR_A_IF2_AGE, HSR_A_NODE_ADDR_B, HSR_A_IF1_SEQ, HSR_A_IF2_SEQ, HSR_A_IF1_IFINDEX, HSR_A_IF2_IFINDEX, HSR_A_ADDR_B_IFINDEX, __HSR_A_MAX, }; #define HSR_A_MAX (__HSR_A_MAX - 1) /* commands */ enum { HSR_C_UNSPEC, HSR_C_RING_ERROR, HSR_C_NODE_DOWN, HSR_C_GET_NODE_STATUS, HSR_C_SET_NODE_STATUS, HSR_C_GET_NODE_LIST, HSR_C_SET_NODE_LIST, __HSR_C_MAX, }; #define HSR_C_MAX (__HSR_C_MAX - 1) #endif /* __UAPI_HSR_NETLINK_H */ linux/hw_breakpoint.h 0000644 00000001346 15063602050 0010711 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_HW_BREAKPOINT_H #define _LINUX_HW_BREAKPOINT_H enum { HW_BREAKPOINT_LEN_1 = 1, HW_BREAKPOINT_LEN_2 = 2, HW_BREAKPOINT_LEN_3 = 3, HW_BREAKPOINT_LEN_4 = 4, HW_BREAKPOINT_LEN_5 = 5, HW_BREAKPOINT_LEN_6 = 6, HW_BREAKPOINT_LEN_7 = 7, HW_BREAKPOINT_LEN_8 = 8, }; enum { HW_BREAKPOINT_EMPTY = 0, HW_BREAKPOINT_R = 1, HW_BREAKPOINT_W = 2, HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W, HW_BREAKPOINT_X = 4, HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X, }; enum bp_type_idx { TYPE_INST = 0, #ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS TYPE_DATA = 0, #else TYPE_DATA = 1, #endif TYPE_MAX }; #endif /* _LINUX_HW_BREAKPOINT_H */ linux/hyperv.h 0000644 00000025620 15063602050 0007373 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * * Copyright (c) 2011, Microsoft Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Authors: * Haiyang Zhang <haiyangz@microsoft.com> * Hank Janssen <hjanssen@microsoft.com> * K. Y. Srinivasan <kys@microsoft.com> * */ #ifndef _HYPERV_H #define _HYPERV_H #include <linux/types.h> /* * Framework version for util services. */ #define UTIL_FW_MINOR 0 #define UTIL_WS2K8_FW_MAJOR 1 #define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR) #define UTIL_FW_MAJOR 3 #define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR) /* * Implementation of host controlled snapshot of the guest. */ #define VSS_OP_REGISTER 128 /* Daemon code with full handshake support. */ #define VSS_OP_REGISTER1 129 enum hv_vss_op { VSS_OP_CREATE = 0, VSS_OP_DELETE, VSS_OP_HOT_BACKUP, VSS_OP_GET_DM_INFO, VSS_OP_BU_COMPLETE, /* * Following operations are only supported with IC version >= 5.0 */ VSS_OP_FREEZE, /* Freeze the file systems in the VM */ VSS_OP_THAW, /* Unfreeze the file systems */ VSS_OP_AUTO_RECOVER, VSS_OP_COUNT /* Number of operations, must be last */ }; /* * Header for all VSS messages. */ struct hv_vss_hdr { __u8 operation; __u8 reserved[7]; } __attribute__((packed)); /* * Flag values for the hv_vss_check_feature. Linux supports only * one value. */ #define VSS_HBU_NO_AUTO_RECOVERY 0x00000005 struct hv_vss_check_feature { __u32 flags; } __attribute__((packed)); struct hv_vss_check_dm_info { __u32 flags; } __attribute__((packed)); /* * struct hv_vss_msg encodes the fields that the Linux VSS * driver accesses. However, FREEZE messages from Hyper-V contain * additional LUN information that Linux doesn't use and are not * represented in struct hv_vss_msg. A received FREEZE message may * be as large as 6,260 bytes, so the driver must allocate at least * that much space, not sizeof(struct hv_vss_msg). Other messages * such as AUTO_RECOVER may be as large as 12,500 bytes. However, * because the Linux VSS driver responds that it doesn't support * auto-recovery, it should not receive such messages. */ struct hv_vss_msg { union { struct hv_vss_hdr vss_hdr; int error; }; union { struct hv_vss_check_feature vss_cf; struct hv_vss_check_dm_info dm_info; }; } __attribute__((packed)); /* * Implementation of a host to guest copy facility. */ #define FCOPY_VERSION_0 0 #define FCOPY_VERSION_1 1 #define FCOPY_CURRENT_VERSION FCOPY_VERSION_1 #define W_MAX_PATH 260 enum hv_fcopy_op { START_FILE_COPY = 0, WRITE_TO_FILE, COMPLETE_FCOPY, CANCEL_FCOPY, }; struct hv_fcopy_hdr { __u32 operation; __u8 service_id0[16]; /* currently unused */ __u8 service_id1[16]; /* currently unused */ } __attribute__((packed)); #define OVER_WRITE 0x1 #define CREATE_PATH 0x2 struct hv_start_fcopy { struct hv_fcopy_hdr hdr; __u16 file_name[W_MAX_PATH]; __u16 path_name[W_MAX_PATH]; __u32 copy_flags; __u64 file_size; } __attribute__((packed)); /* * The file is chunked into fragments. */ #define DATA_FRAGMENT (6 * 1024) struct hv_do_fcopy { struct hv_fcopy_hdr hdr; __u32 pad; __u64 offset; __u32 size; __u8 data[DATA_FRAGMENT]; } __attribute__((packed)); /* * An implementation of HyperV key value pair (KVP) functionality for Linux. * * * Copyright (C) 2010, Novell, Inc. * Author : K. Y. Srinivasan <ksrinivasan@novell.com> * */ /* * Maximum value size - used for both key names and value data, and includes * any applicable NULL terminators. * * Note: This limit is somewhat arbitrary, but falls easily within what is * supported for all native guests (back to Win 2000) and what is reasonable * for the IC KVP exchange functionality. Note that Windows Me/98/95 are * limited to 255 character key names. * * MSDN recommends not storing data values larger than 2048 bytes in the * registry. * * Note: This value is used in defining the KVP exchange message - this value * cannot be modified without affecting the message size and compatibility. */ /* * bytes, including any null terminators */ #define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048) /* * Maximum key size - the registry limit for the length of an entry name * is 256 characters, including the null terminator */ #define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512) /* * In Linux, we implement the KVP functionality in two components: * 1) The kernel component which is packaged as part of the hv_utils driver * is responsible for communicating with the host and responsible for * implementing the host/guest protocol. 2) A user level daemon that is * responsible for data gathering. * * Host/Guest Protocol: The host iterates over an index and expects the guest * to assign a key name to the index and also return the value corresponding to * the key. The host will have atmost one KVP transaction outstanding at any * given point in time. The host side iteration stops when the guest returns * an error. Microsoft has specified the following mapping of key names to * host specified index: * * Index Key Name * 0 FullyQualifiedDomainName * 1 IntegrationServicesVersion * 2 NetworkAddressIPv4 * 3 NetworkAddressIPv6 * 4 OSBuildNumber * 5 OSName * 6 OSMajorVersion * 7 OSMinorVersion * 8 OSVersion * 9 ProcessorArchitecture * * The Windows host expects the Key Name and Key Value to be encoded in utf16. * * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the * data gathering functionality in a user mode daemon. The user level daemon * is also responsible for binding the key name to the index as well. The * kernel and user-level daemon communicate using a connector channel. * * The user mode component first registers with the * kernel component. Subsequently, the kernel component requests, data * for the specified keys. In response to this message the user mode component * fills in the value corresponding to the specified key. We overload the * sequence field in the cn_msg header to define our KVP message types. * * * The kernel component simply acts as a conduit for communication between the * Windows host and the user-level daemon. The kernel component passes up the * index received from the Host to the user-level daemon. If the index is * valid (supported), the corresponding key as well as its * value (both are strings) is returned. If the index is invalid * (not supported), a NULL key string is returned. */ /* * Registry value types. */ #define REG_SZ 1 #define REG_U32 4 #define REG_U64 8 /* * As we look at expanding the KVP functionality to include * IP injection functionality, we need to maintain binary * compatibility with older daemons. * * The KVP opcodes are defined by the host and it was unfortunate * that I chose to treat the registration operation as part of the * KVP operations defined by the host. * Here is the level of compatibility * (between the user level daemon and the kernel KVP driver) that we * will implement: * * An older daemon will always be supported on a newer driver. * A given user level daemon will require a minimal version of the * kernel driver. * If we cannot handle the version differences, we will fail gracefully * (this can happen when we have a user level daemon that is more * advanced than the KVP driver. * * We will use values used in this handshake for determining if we have * workable user level daemon and the kernel driver. We begin by taking the * registration opcode out of the KVP opcode namespace. We will however, * maintain compatibility with the existing user-level daemon code. */ /* * Daemon code not supporting IP injection (legacy daemon). */ #define KVP_OP_REGISTER 4 /* * Daemon code supporting IP injection. * The KVP opcode field is used to communicate the * registration information; so define a namespace that * will be distinct from the host defined KVP opcode. */ #define KVP_OP_REGISTER1 100 enum hv_kvp_exchg_op { KVP_OP_GET = 0, KVP_OP_SET, KVP_OP_DELETE, KVP_OP_ENUMERATE, KVP_OP_GET_IP_INFO, KVP_OP_SET_IP_INFO, KVP_OP_COUNT /* Number of operations, must be last. */ }; enum hv_kvp_exchg_pool { KVP_POOL_EXTERNAL = 0, KVP_POOL_GUEST, KVP_POOL_AUTO, KVP_POOL_AUTO_EXTERNAL, KVP_POOL_AUTO_INTERNAL, KVP_POOL_COUNT /* Number of pools, must be last. */ }; /* * Some Hyper-V status codes. */ #define HV_S_OK 0x00000000 #define HV_E_FAIL 0x80004005 #define HV_S_CONT 0x80070103 #define HV_ERROR_NOT_SUPPORTED 0x80070032 #define HV_ERROR_MACHINE_LOCKED 0x800704F7 #define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F #define HV_INVALIDARG 0x80070057 #define HV_GUID_NOTFOUND 0x80041002 #define HV_ERROR_ALREADY_EXISTS 0x80070050 #define HV_ERROR_DISK_FULL 0x80070070 #define ADDR_FAMILY_NONE 0x00 #define ADDR_FAMILY_IPV4 0x01 #define ADDR_FAMILY_IPV6 0x02 #define MAX_ADAPTER_ID_SIZE 128 #define MAX_IP_ADDR_SIZE 1024 #define MAX_GATEWAY_SIZE 512 struct hv_kvp_ipaddr_value { __u16 adapter_id[MAX_ADAPTER_ID_SIZE]; __u8 addr_family; __u8 dhcp_enabled; __u16 ip_addr[MAX_IP_ADDR_SIZE]; __u16 sub_net[MAX_IP_ADDR_SIZE]; __u16 gate_way[MAX_GATEWAY_SIZE]; __u16 dns_addr[MAX_IP_ADDR_SIZE]; } __attribute__((packed)); struct hv_kvp_hdr { __u8 operation; __u8 pool; __u16 pad; } __attribute__((packed)); struct hv_kvp_exchg_msg_value { __u32 value_type; __u32 key_size; __u32 value_size; __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; union { __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; __u32 value_u32; __u64 value_u64; }; } __attribute__((packed)); struct hv_kvp_msg_enumerate { __u32 index; struct hv_kvp_exchg_msg_value data; } __attribute__((packed)); struct hv_kvp_msg_get { struct hv_kvp_exchg_msg_value data; }; struct hv_kvp_msg_set { struct hv_kvp_exchg_msg_value data; }; struct hv_kvp_msg_delete { __u32 key_size; __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; }; struct hv_kvp_register { __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; }; struct hv_kvp_msg { union { struct hv_kvp_hdr kvp_hdr; int error; }; union { struct hv_kvp_msg_get kvp_get; struct hv_kvp_msg_set kvp_set; struct hv_kvp_msg_delete kvp_delete; struct hv_kvp_msg_enumerate kvp_enum_data; struct hv_kvp_ipaddr_value kvp_ip_val; struct hv_kvp_register kvp_register; } body; } __attribute__((packed)); struct hv_kvp_ip_msg { __u8 operation; __u8 pool; struct hv_kvp_ipaddr_value kvp_ip_val; } __attribute__((packed)); #endif /* _HYPERV_H */ linux/hsi/cs-protocol.h 0000644 00000007110 15063602050 0011077 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * cmt-speech interface definitions * * Copyright (C) 2008,2009,2010 Nokia Corporation. All rights reserved. * * Contact: Kai Vehmanen <kai.vehmanen@nokia.com> * Original author: Peter Ujfalusi <peter.ujfalusi@nokia.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef _CS_PROTOCOL_H #define _CS_PROTOCOL_H #include <linux/types.h> #include <linux/ioctl.h> /* chardev parameters */ #define CS_DEV_FILE_NAME "/dev/cmt_speech" /* user-space API versioning */ #define CS_IF_VERSION 2 /* APE kernel <-> user space messages */ #define CS_CMD_SHIFT 28 #define CS_DOMAIN_SHIFT 24 #define CS_CMD_MASK 0xff000000 #define CS_PARAM_MASK 0xffffff #define CS_CMD(id, dom) \ (((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT)) #define CS_ERROR CS_CMD(1, 0) #define CS_RX_DATA_RECEIVED CS_CMD(2, 0) #define CS_TX_DATA_READY CS_CMD(3, 0) #define CS_TX_DATA_SENT CS_CMD(4, 0) /* params to CS_ERROR indication */ #define CS_ERR_PEER_RESET 0 /* ioctl interface */ /* parameters to CS_CONFIG_BUFS ioctl */ #define CS_FEAT_TSTAMP_RX_CTRL (1 << 0) #define CS_FEAT_ROLLING_RX_COUNTER (2 << 0) /* parameters to CS_GET_STATE ioctl */ #define CS_STATE_CLOSED 0 #define CS_STATE_OPENED 1 /* resource allocated */ #define CS_STATE_CONFIGURED 2 /* data path active */ /* maximum number of TX/RX buffers */ #define CS_MAX_BUFFERS_SHIFT 4 #define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT) /* Parameters for setting up the data buffers */ struct cs_buffer_config { __u32 rx_bufs; /* number of RX buffer slots */ __u32 tx_bufs; /* number of TX buffer slots */ __u32 buf_size; /* bytes */ __u32 flags; /* see CS_FEAT_* */ __u32 reserved[4]; }; /* * struct for monotonic timestamp taken when the * last control command was received */ struct cs_timestamp { __u32 tv_sec; /* seconds */ __u32 tv_nsec; /* nanoseconds */ }; /* * Struct describing the layout and contents of the driver mmap area. * This information is meant as read-only information for the application. */ struct cs_mmap_config_block { __u32 reserved1; __u32 buf_size; /* 0=disabled, otherwise the transfer size */ __u32 rx_bufs; /* # of RX buffers */ __u32 tx_bufs; /* # of TX buffers */ __u32 reserved2; /* array of offsets within the mmap area for each RX and TX buffer */ __u32 rx_offsets[CS_MAX_BUFFERS]; __u32 tx_offsets[CS_MAX_BUFFERS]; __u32 rx_ptr; __u32 rx_ptr_boundary; __u32 reserved3[2]; /* enabled with CS_FEAT_TSTAMP_RX_CTRL */ struct cs_timestamp tstamp_rx_ctrl; }; #define CS_IO_MAGIC 'C' #define CS_IOW(num, dtype) _IOW(CS_IO_MAGIC, num, dtype) #define CS_IOR(num, dtype) _IOR(CS_IO_MAGIC, num, dtype) #define CS_IOWR(num, dtype) _IOWR(CS_IO_MAGIC, num, dtype) #define CS_IO(num) _IO(CS_IO_MAGIC, num) #define CS_GET_STATE CS_IOR(21, unsigned int) #define CS_SET_WAKELINE CS_IOW(23, unsigned int) #define CS_GET_IF_VERSION CS_IOR(30, unsigned int) #define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config) #endif /* _CS_PROTOCOL_H */ linux/hsi/hsi_char.h 0000644 00000003547 15063602050 0010425 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Part of the HSI character device driver. * * Copyright (C) 2010 Nokia Corporation. All rights reserved. * * Contact: Andras Domokos <andras.domokos at nokia.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef __HSI_CHAR_H #define __HSI_CHAR_H #include <linux/types.h> #define HSI_CHAR_MAGIC 'k' #define HSC_IOW(num, dtype) _IOW(HSI_CHAR_MAGIC, num, dtype) #define HSC_IOR(num, dtype) _IOR(HSI_CHAR_MAGIC, num, dtype) #define HSC_IOWR(num, dtype) _IOWR(HSI_CHAR_MAGIC, num, dtype) #define HSC_IO(num) _IO(HSI_CHAR_MAGIC, num) #define HSC_RESET HSC_IO(16) #define HSC_SET_PM HSC_IO(17) #define HSC_SEND_BREAK HSC_IO(18) #define HSC_SET_RX HSC_IOW(19, struct hsc_rx_config) #define HSC_GET_RX HSC_IOW(20, struct hsc_rx_config) #define HSC_SET_TX HSC_IOW(21, struct hsc_tx_config) #define HSC_GET_TX HSC_IOW(22, struct hsc_tx_config) #define HSC_PM_DISABLE 0 #define HSC_PM_ENABLE 1 #define HSC_MODE_STREAM 1 #define HSC_MODE_FRAME 2 #define HSC_FLOW_SYNC 0 #define HSC_ARB_RR 0 #define HSC_ARB_PRIO 1 struct hsc_rx_config { __u32 mode; __u32 flow; __u32 channels; }; struct hsc_tx_config { __u32 mode; __u32 channels; __u32 speed; __u32 arb_mode; }; #endif /* __HSI_CHAR_H */ linux/hysdn_if.h 0000644 00000002546 15063602050 0007663 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $ * * Linux driver for HYSDN cards * ioctl definitions shared by hynetmgr and driver. * * Author Werner Cornelius (werner@titro.de) for Hypercope GmbH * Copyright 1999 by Werner Cornelius (werner@titro.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ /****************/ /* error values */ /****************/ #define ERR_NONE 0 /* no error occurred */ #define ERR_ALREADY_BOOT 1000 /* we are already booting */ #define EPOF_BAD_MAGIC 1001 /* bad magic in POF header */ #define ERR_BOARD_DPRAM 1002 /* board DPRAM failed */ #define EPOF_INTERNAL 1003 /* internal POF handler error */ #define EPOF_BAD_IMG_SIZE 1004 /* POF boot image size invalid */ #define ERR_BOOTIMG_FAIL 1005 /* 1. stage boot image did not start */ #define ERR_BOOTSEQ_FAIL 1006 /* 2. stage boot seq handshake timeout */ #define ERR_POF_TIMEOUT 1007 /* timeout waiting for card pof ready */ #define ERR_NOT_BOOTED 1008 /* operation only allowed when booted */ #define ERR_CONF_LONG 1009 /* conf line is too long */ #define ERR_INV_CHAN 1010 /* invalid channel number */ #define ERR_ASYNC_TIME 1011 /* timeout sending async data */ linux/i2c-dev.h 0000644 00000005064 15063602050 0007307 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* i2c-dev.h - i2c-bus driver, char device interface Copyright (C) 1995-97 Simon G. Vogl Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _LINUX_I2C_DEV_H #define _LINUX_I2C_DEV_H #include <linux/types.h> /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an * unsigned long, except for: * - I2C_FUNCS, takes pointer to an unsigned long * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data */ #define I2C_RETRIES 0x0701 /* number of times a device address should be polled when not acknowledging */ #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses * are NOT supported! (due to code brokenness) */ #define I2C_SLAVE 0x0703 /* Use this slave address */ #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it is already in use by a driver! */ #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ #define I2C_SMBUS 0x0720 /* SMBus transfer */ /* This is the structure as used in the I2C_SMBUS ioctl call */ struct i2c_smbus_ioctl_data { __u8 read_write; __u8 command; __u32 size; union i2c_smbus_data *data; }; /* This is the structure as used in the I2C_RDWR ioctl call */ struct i2c_rdwr_ioctl_data { struct i2c_msg *msgs; /* pointers to i2c_msgs */ __u32 nmsgs; /* number of i2c_msgs */ }; #define I2C_RDWR_IOCTL_MAX_MSGS 42 /* Originally defined with a typo, keep it for compatibility */ #define I2C_RDRW_IOCTL_MAX_MSGS I2C_RDWR_IOCTL_MAX_MSGS #endif /* _LINUX_I2C_DEV_H */ linux/i2c.h 0000644 00000015734 15063602050 0006540 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* ------------------------------------------------------------------------- */ /* */ /* i2c.h - definitions for the i2c-bus interface */ /* */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-2000 Simon G. Vogl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and Frodo Looijaard <frodol@dds.nl> */ #ifndef _LINUX_I2C_H #define _LINUX_I2C_H #include <linux/types.h> /** * struct i2c_msg - an I2C transaction segment beginning with START * @addr: Slave address, either seven or ten bits. When this is a ten * bit address, I2C_M_TEN must be set in @flags and the adapter * must support I2C_FUNC_10BIT_ADDR. * @flags: I2C_M_RD is handled by all adapters. No other flags may be * provided unless the adapter exported the relevant I2C_FUNC_* * flags through i2c_check_functionality(). * @len: Number of data bytes in @buf being read from or written to the * I2C slave address. For read transactions where I2C_M_RECV_LEN * is set, the caller guarantees that this buffer can hold up to * 32 bytes in addition to the initial length byte sent by the * slave (plus, if used, the SMBus PEC); and this value will be * incremented by the number of block data bytes received. * @buf: The buffer into which data is read, or from which it's written. * * An i2c_msg is the low level representation of one segment of an I2C * transaction. It is visible to drivers in the @i2c_transfer() procedure, * to userspace from i2c-dev, and to I2C adapter drivers through the * @i2c_adapter.@master_xfer() method. * * Except when I2C "protocol mangling" is used, all I2C adapters implement * the standard rules for I2C transactions. Each transaction begins with a * START. That is followed by the slave address, and a bit encoding read * versus write. Then follow all the data bytes, possibly including a byte * with SMBus PEC. The transfer terminates with a NAK, or when all those * bytes have been transferred and ACKed. If this is the last message in a * group, it is followed by a STOP. Otherwise it is followed by the next * @i2c_msg transaction segment, beginning with a (repeated) START. * * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then * passing certain @flags may have changed those standard protocol behaviors. * Those flags are only for use with broken/nonconforming slaves, and with * adapters which are known to support the specific mangling options they * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR). */ struct i2c_msg { __u16 addr; /* slave address */ __u16 flags; #define I2C_M_RD 0x0001 /* read data, from slave to master */ /* I2C_M_RD is guaranteed to be 0x0001! */ #define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ #define I2C_M_DMA_SAFE 0x0200 /* the buffer of this message is DMA safe */ /* makes only sense in kernelspace */ /* userspace buffers are copied anyway */ #define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ #define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */ #define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */ __u16 len; /* msg length */ __u8 *buf; /* pointer to msg data */ }; /* To determine what functionality is present */ #define I2C_FUNC_I2C 0x00000001 #define I2C_FUNC_10BIT_ADDR 0x00000002 #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */ #define I2C_FUNC_SMBUS_PEC 0x00000008 #define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */ #define I2C_FUNC_SLAVE 0x00000020 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_QUICK 0x00010000 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ #define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000 #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ I2C_FUNC_SMBUS_WRITE_BYTE) #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ I2C_FUNC_SMBUS_WRITE_BYTE_DATA) #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ I2C_FUNC_SMBUS_WRITE_WORD_DATA) #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ I2C_FUNC_SMBUS_BYTE | \ I2C_FUNC_SMBUS_BYTE_DATA | \ I2C_FUNC_SMBUS_WORD_DATA | \ I2C_FUNC_SMBUS_PROC_CALL | \ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ I2C_FUNC_SMBUS_I2C_BLOCK | \ I2C_FUNC_SMBUS_PEC) /* * Data for SMBus Messages */ #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ union i2c_smbus_data { __u8 byte; __u16 word; __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ /* and one more for user-space compatibility */ }; /* i2c_smbus_xfer read or write markers */ #define I2C_SMBUS_READ 1 #define I2C_SMBUS_WRITE 0 /* SMBus transaction types (size parameter in the above functions) Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ #define I2C_SMBUS_QUICK 0 #define I2C_SMBUS_BYTE 1 #define I2C_SMBUS_BYTE_DATA 2 #define I2C_SMBUS_WORD_DATA 3 #define I2C_SMBUS_PROC_CALL 4 #define I2C_SMBUS_BLOCK_DATA 5 #define I2C_SMBUS_I2C_BLOCK_BROKEN 6 #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ #define I2C_SMBUS_I2C_BLOCK_DATA 8 #endif /* _LINUX_I2C_H */ linux/i2o-dev.h 0000644 00000026443 15063602050 0007327 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * I2O user space accessible structures/APIs * * (c) Copyright 1999, 2000 Red Hat Software * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ************************************************************************* * * This header file defines the I2O APIs that are available to both * the kernel and user level applications. Kernel specific structures * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which * automatically includes this file. * */ #ifndef _I2O_DEV_H #define _I2O_DEV_H /* How many controllers are we allowing */ #define MAX_I2O_CONTROLLERS 32 #include <linux/ioctl.h> #include <linux/types.h> /* * I2O Control IOCTLs and structures */ #define I2O_MAGIC_NUMBER 'i' #define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS]) #define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) #define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) #define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) #define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget) #define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) #define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) #define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) #define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,__u32) #define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) #define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) #define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) #define I2OPASSTHRU _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru) #define I2OPASSTHRU32 _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32) struct i2o_cmd_passthru32 { unsigned int iop; /* IOP unit number */ __u32 msg; /* message */ }; struct i2o_cmd_passthru { unsigned int iop; /* IOP unit number */ void *msg; /* message */ }; struct i2o_cmd_hrtlct { unsigned int iop; /* IOP unit number */ void *resbuf; /* Buffer for result */ unsigned int *reslen; /* Buffer length in bytes */ }; struct i2o_cmd_psetget { unsigned int iop; /* IOP unit number */ unsigned int tid; /* Target device TID */ void *opbuf; /* Operation List buffer */ unsigned int oplen; /* Operation List buffer length in bytes */ void *resbuf; /* Result List buffer */ unsigned int *reslen; /* Result List buffer length in bytes */ }; struct i2o_sw_xfer { unsigned int iop; /* IOP unit number */ unsigned char flags; /* Flags field */ unsigned char sw_type; /* Software type */ unsigned int sw_id; /* Software ID */ void *buf; /* Pointer to software buffer */ unsigned int *swlen; /* Length of software data */ unsigned int *maxfrag; /* Maximum fragment count */ unsigned int *curfrag; /* Current fragment count */ }; struct i2o_html { unsigned int iop; /* IOP unit number */ unsigned int tid; /* Target device ID */ unsigned int page; /* HTML page */ void *resbuf; /* Buffer for reply HTML page */ unsigned int *reslen; /* Length in bytes of reply buffer */ void *qbuf; /* Pointer to HTTP query string */ unsigned int qlen; /* Length in bytes of query string buffer */ }; #define I2O_EVT_Q_LEN 32 struct i2o_evt_id { unsigned int iop; unsigned int tid; unsigned int evt_mask; }; /* Event data size = frame size - message header + evt indicator */ #define I2O_EVT_DATA_SIZE 88 struct i2o_evt_info { struct i2o_evt_id id; unsigned char evt_data[I2O_EVT_DATA_SIZE]; unsigned int data_size; }; struct i2o_evt_get { struct i2o_evt_info info; int pending; int lost; }; typedef struct i2o_sg_io_hdr { unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */ } i2o_sg_io_hdr_t; /************************************************************************** * HRT related constants and structures **************************************************************************/ #define I2O_BUS_LOCAL 0 #define I2O_BUS_ISA 1 #define I2O_BUS_EISA 2 /* was I2O_BUS_MCA 3 */ #define I2O_BUS_PCI 4 #define I2O_BUS_PCMCIA 5 #define I2O_BUS_NUBUS 6 #define I2O_BUS_CARDBUS 7 #define I2O_BUS_UNKNOWN 0x80 typedef struct _i2o_pci_bus { __u8 PciFunctionNumber; __u8 PciDeviceNumber; __u8 PciBusNumber; __u8 reserved; __u16 PciVendorID; __u16 PciDeviceID; } i2o_pci_bus; typedef struct _i2o_local_bus { __u16 LbBaseIOPort; __u16 reserved; __u32 LbBaseMemoryAddress; } i2o_local_bus; typedef struct _i2o_isa_bus { __u16 IsaBaseIOPort; __u8 CSN; __u8 reserved; __u32 IsaBaseMemoryAddress; } i2o_isa_bus; typedef struct _i2o_eisa_bus_info { __u16 EisaBaseIOPort; __u8 reserved; __u8 EisaSlotNumber; __u32 EisaBaseMemoryAddress; } i2o_eisa_bus; typedef struct _i2o_mca_bus { __u16 McaBaseIOPort; __u8 reserved; __u8 McaSlotNumber; __u32 McaBaseMemoryAddress; } i2o_mca_bus; typedef struct _i2o_other_bus { __u16 BaseIOPort; __u16 reserved; __u32 BaseMemoryAddress; } i2o_other_bus; typedef struct _i2o_hrt_entry { __u32 adapter_id; __u32 parent_tid:12; __u32 state:4; __u32 bus_num:8; __u32 bus_type:8; union { i2o_pci_bus pci_bus; i2o_local_bus local_bus; i2o_isa_bus isa_bus; i2o_eisa_bus eisa_bus; i2o_mca_bus mca_bus; i2o_other_bus other_bus; } bus; } i2o_hrt_entry; typedef struct _i2o_hrt { __u16 num_entries; __u8 entry_len; __u8 hrt_version; __u32 change_ind; i2o_hrt_entry hrt_entry[1]; } i2o_hrt; typedef struct _i2o_lct_entry { __u32 entry_size:16; __u32 tid:12; __u32 reserved:4; __u32 change_ind; __u32 device_flags; __u32 class_id:12; __u32 version:4; __u32 vendor_id:16; __u32 sub_class; __u32 user_tid:12; __u32 parent_tid:12; __u32 bios_info:8; __u8 identity_tag[8]; __u32 event_capabilities; } i2o_lct_entry; typedef struct _i2o_lct { __u32 table_size:16; __u32 boot_tid:12; __u32 lct_ver:4; __u32 iop_flags; __u32 change_ind; i2o_lct_entry lct_entry[1]; } i2o_lct; typedef struct _i2o_status_block { __u16 org_id; __u16 reserved; __u16 iop_id:12; __u16 reserved1:4; __u16 host_unit_id; __u16 segment_number:12; __u16 i2o_version:4; __u8 iop_state; __u8 msg_type; __u16 inbound_frame_size; __u8 init_code; __u8 reserved2; __u32 max_inbound_frames; __u32 cur_inbound_frames; __u32 max_outbound_frames; char product_id[24]; __u32 expected_lct_size; __u32 iop_capabilities; __u32 desired_mem_size; __u32 current_mem_size; __u32 current_mem_base; __u32 desired_io_size; __u32 current_io_size; __u32 current_io_base; __u32 reserved3:24; __u32 cmd_status:8; } i2o_status_block; /* Event indicator mask flags */ #define I2O_EVT_IND_STATE_CHANGE 0x80000000 #define I2O_EVT_IND_GENERAL_WARNING 0x40000000 #define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000 #define I2O_EVT_IND_LOCK_RELEASE 0x10000000 #define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000 #define I2O_EVT_IND_DEVICE_RESET 0x04000000 #define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000 #define I2O_EVT_IND_FIELD_MODIFIED 0x01000000 #define I2O_EVT_IND_VENDOR_EVT 0x00800000 #define I2O_EVT_IND_DEVICE_STATE 0x00400000 /* Executive event indicitors */ #define I2O_EVT_IND_EXEC_RESOURCE_LIMITS 0x00000001 #define I2O_EVT_IND_EXEC_CONNECTION_FAIL 0x00000002 #define I2O_EVT_IND_EXEC_ADAPTER_FAULT 0x00000004 #define I2O_EVT_IND_EXEC_POWER_FAIL 0x00000008 #define I2O_EVT_IND_EXEC_RESET_PENDING 0x00000010 #define I2O_EVT_IND_EXEC_RESET_IMMINENT 0x00000020 #define I2O_EVT_IND_EXEC_HW_FAIL 0x00000040 #define I2O_EVT_IND_EXEC_XCT_CHANGE 0x00000080 #define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY 0x00000100 #define I2O_EVT_IND_EXEC_MODIFIED_LCT 0x00000200 #define I2O_EVT_IND_EXEC_DDM_AVAILABILITY 0x00000400 /* Random Block Storage Event Indicators */ #define I2O_EVT_IND_BSA_VOLUME_LOAD 0x00000001 #define I2O_EVT_IND_BSA_VOLUME_UNLOAD 0x00000002 #define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ 0x00000004 #define I2O_EVT_IND_BSA_CAPACITY_CHANGE 0x00000008 #define I2O_EVT_IND_BSA_SCSI_SMART 0x00000010 /* Event data for generic events */ #define I2O_EVT_STATE_CHANGE_NORMAL 0x00 #define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01 #define I2O_EVT_STATE_CHANGE_RESTART 0x02 #define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03 #define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04 #define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05 #define I2O_EVT_STATE_CHANGE_FAILED 0x10 #define I2O_EVT_STATE_CHANGE_FAULTED 0x11 #define I2O_EVT_GEN_WARNING_NORMAL 0x00 #define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01 #define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02 #define I2O_EVT_CAPABILITY_OTHER 0x01 #define I2O_EVT_CAPABILITY_CHANGED 0x02 #define I2O_EVT_SENSOR_STATE_CHANGED 0x01 /* * I2O classes / subclasses */ /* Class ID and Code Assignments * (LCT.ClassID.Version field) */ #define I2O_CLASS_VERSION_10 0x00 #define I2O_CLASS_VERSION_11 0x01 /* Class code names * (from v1.5 Table 6-1 Class Code Assignments.) */ #define I2O_CLASS_EXECUTIVE 0x000 #define I2O_CLASS_DDM 0x001 #define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 #define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 #define I2O_CLASS_LAN 0x020 #define I2O_CLASS_WAN 0x030 #define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 #define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 #define I2O_CLASS_SCSI_PERIPHERAL 0x051 #define I2O_CLASS_ATE_PORT 0x060 #define I2O_CLASS_ATE_PERIPHERAL 0x061 #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 #define I2O_CLASS_FLOPPY_DEVICE 0x071 #define I2O_CLASS_BUS_ADAPTER 0x080 #define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 #define I2O_CLASS_PEER_TRANSPORT 0x091 #define I2O_CLASS_END 0xfff /* * Rest of 0x092 - 0x09f reserved for peer-to-peer classes */ #define I2O_CLASS_MATCH_ANYCLASS 0xffffffff /* * Subclasses */ #define I2O_SUBCLASS_i960 0x001 #define I2O_SUBCLASS_HDM 0x020 #define I2O_SUBCLASS_ISM 0x021 /* Operation functions */ #define I2O_PARAMS_FIELD_GET 0x0001 #define I2O_PARAMS_LIST_GET 0x0002 #define I2O_PARAMS_MORE_GET 0x0003 #define I2O_PARAMS_SIZE_GET 0x0004 #define I2O_PARAMS_TABLE_GET 0x0005 #define I2O_PARAMS_FIELD_SET 0x0006 #define I2O_PARAMS_LIST_SET 0x0007 #define I2O_PARAMS_ROW_ADD 0x0008 #define I2O_PARAMS_ROW_DELETE 0x0009 #define I2O_PARAMS_TABLE_CLEAR 0x000A /* * I2O serial number conventions / formats * (circa v1.5) */ #define I2O_SNFORMAT_UNKNOWN 0 #define I2O_SNFORMAT_BINARY 1 #define I2O_SNFORMAT_ASCII 2 #define I2O_SNFORMAT_UNICODE 3 #define I2O_SNFORMAT_LAN48_MAC 4 #define I2O_SNFORMAT_WAN 5 /* * Plus new in v2.0 (Yellowstone pdf doc) */ #define I2O_SNFORMAT_LAN64_MAC 6 #define I2O_SNFORMAT_DDM 7 #define I2O_SNFORMAT_IEEE_REG64 8 #define I2O_SNFORMAT_IEEE_REG128 9 #define I2O_SNFORMAT_UNKNOWN2 0xff /* * I2O Get Status State values */ #define ADAPTER_STATE_INITIALIZING 0x01 #define ADAPTER_STATE_RESET 0x02 #define ADAPTER_STATE_HOLD 0x04 #define ADAPTER_STATE_READY 0x05 #define ADAPTER_STATE_OPERATIONAL 0x08 #define ADAPTER_STATE_FAILED 0x10 #define ADAPTER_STATE_FAULTED 0x11 /* * Software module types */ #define I2O_SOFTWARE_MODULE_IRTOS 0x11 #define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22 #define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23 /* * Vendors */ #define I2O_VENDOR_DPT 0x001b /* * DPT / Adaptec specific values for i2o_sg_io_hdr flags. */ #define I2O_DPT_SG_FLAG_INTERPRET 0x00010000 #define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000 #define I2O_DPT_FLASH_FRAG_SIZE 0x10000 #define I2O_DPT_FLASH_READ 0x0101 #define I2O_DPT_FLASH_WRITE 0x0102 #endif /* _I2O_DEV_H */ linux/i8k.h 0000644 00000002770 15063602050 0006552 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops * * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _LINUX_I8K_H #define _LINUX_I8K_H #define I8K_PROC "/proc/i8k" #define I8K_PROC_FMT "1.0" #define I8K_BIOS_VERSION _IOR ('i', 0x80, int) /* broken: meant 4 bytes */ #define I8K_MACHINE_ID _IOR ('i', 0x81, int) /* broken: meant 16 bytes */ #define I8K_POWER_STATUS _IOR ('i', 0x82, size_t) #define I8K_FN_STATUS _IOR ('i', 0x83, size_t) #define I8K_GET_TEMP _IOR ('i', 0x84, size_t) #define I8K_GET_SPEED _IOWR('i', 0x85, size_t) #define I8K_GET_FAN _IOWR('i', 0x86, size_t) #define I8K_SET_FAN _IOWR('i', 0x87, size_t) #define I8K_FAN_LEFT 1 #define I8K_FAN_RIGHT 0 #define I8K_FAN_OFF 0 #define I8K_FAN_LOW 1 #define I8K_FAN_HIGH 2 #define I8K_FAN_TURBO 3 #define I8K_FAN_MAX I8K_FAN_TURBO #define I8K_VOL_UP 1 #define I8K_VOL_DOWN 2 #define I8K_VOL_MUTE 4 #define I8K_AC 1 #define I8K_BATTERY 0 #endif linux/icmp.h 0000644 00000005637 15063602050 0007014 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the ICMP protocol. * * Version: @(#)icmp.h 1.0.3 04/28/93 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_ICMP_H #define _LINUX_ICMP_H #include <linux/types.h> #define ICMP_ECHOREPLY 0 /* Echo Reply */ #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ #define ICMP_SOURCE_QUENCH 4 /* Source Quench */ #define ICMP_REDIRECT 5 /* Redirect (change route) */ #define ICMP_ECHO 8 /* Echo Request */ #define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ #define ICMP_PARAMETERPROB 12 /* Parameter Problem */ #define ICMP_TIMESTAMP 13 /* Timestamp Request */ #define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ #define ICMP_INFO_REQUEST 15 /* Information Request */ #define ICMP_INFO_REPLY 16 /* Information Reply */ #define ICMP_ADDRESS 17 /* Address Mask Request */ #define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ #define NR_ICMP_TYPES 18 /* Codes for UNREACH. */ #define ICMP_NET_UNREACH 0 /* Network Unreachable */ #define ICMP_HOST_UNREACH 1 /* Host Unreachable */ #define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ #define ICMP_PORT_UNREACH 3 /* Port Unreachable */ #define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ #define ICMP_SR_FAILED 5 /* Source Route failed */ #define ICMP_NET_UNKNOWN 6 #define ICMP_HOST_UNKNOWN 7 #define ICMP_HOST_ISOLATED 8 #define ICMP_NET_ANO 9 #define ICMP_HOST_ANO 10 #define ICMP_NET_UNR_TOS 11 #define ICMP_HOST_UNR_TOS 12 #define ICMP_PKT_FILTERED 13 /* Packet filtered */ #define ICMP_PREC_VIOLATION 14 /* Precedence violation */ #define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ #define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ /* Codes for REDIRECT. */ #define ICMP_REDIR_NET 0 /* Redirect Net */ #define ICMP_REDIR_HOST 1 /* Redirect Host */ #define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ #define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ /* Codes for TIME_EXCEEDED. */ #define ICMP_EXC_TTL 0 /* TTL count exceeded */ #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ struct icmphdr { __u8 type; __u8 code; __sum16 checksum; union { struct { __be16 id; __be16 sequence; } echo; __be32 gateway; struct { __be16 __unused; __be16 mtu; } frag; __u8 reserved[4]; } un; }; /* * constants for (set|get)sockopt */ #define ICMP_FILTER 1 struct icmp_filter { __u32 data; }; #endif /* _LINUX_ICMP_H */ linux/icmpv6.h 0000644 00000007706 15063602050 0007267 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ICMPV6_H #define _LINUX_ICMPV6_H #include <linux/types.h> #include <asm/byteorder.h> struct icmp6hdr { __u8 icmp6_type; __u8 icmp6_code; __sum16 icmp6_cksum; union { __be32 un_data32[1]; __be16 un_data16[2]; __u8 un_data8[4]; struct icmpv6_echo { __be16 identifier; __be16 sequence; } u_echo; struct icmpv6_nd_advt { #if defined(__LITTLE_ENDIAN_BITFIELD) __u32 reserved:5, override:1, solicited:1, router:1, reserved2:24; #elif defined(__BIG_ENDIAN_BITFIELD) __u32 router:1, solicited:1, override:1, reserved:29; #else #error "Please fix <asm/byteorder.h>" #endif } u_nd_advt; struct icmpv6_nd_ra { __u8 hop_limit; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved:3, router_pref:2, home_agent:1, other:1, managed:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 managed:1, other:1, home_agent:1, router_pref:2, reserved:3; #else #error "Please fix <asm/byteorder.h>" #endif __be16 rt_lifetime; } u_nd_ra; } icmp6_dataun; #define icmp6_identifier icmp6_dataun.u_echo.identifier #define icmp6_sequence icmp6_dataun.u_echo.sequence #define icmp6_pointer icmp6_dataun.un_data32[0] #define icmp6_mtu icmp6_dataun.un_data32[0] #define icmp6_unused icmp6_dataun.un_data32[0] #define icmp6_maxdelay icmp6_dataun.un_data16[0] #define icmp6_router icmp6_dataun.u_nd_advt.router #define icmp6_solicited icmp6_dataun.u_nd_advt.solicited #define icmp6_override icmp6_dataun.u_nd_advt.override #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved #define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit #define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref }; #define ICMPV6_ROUTER_PREF_LOW 0x3 #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 #define ICMPV6_ROUTER_PREF_HIGH 0x1 #define ICMPV6_ROUTER_PREF_INVALID 0x2 #define ICMPV6_DEST_UNREACH 1 #define ICMPV6_PKT_TOOBIG 2 #define ICMPV6_TIME_EXCEED 3 #define ICMPV6_PARAMPROB 4 #define ICMPV6_INFOMSG_MASK 0x80 #define ICMPV6_ECHO_REQUEST 128 #define ICMPV6_ECHO_REPLY 129 #define ICMPV6_MGM_QUERY 130 #define ICMPV6_MGM_REPORT 131 #define ICMPV6_MGM_REDUCTION 132 #define ICMPV6_NI_QUERY 139 #define ICMPV6_NI_REPLY 140 #define ICMPV6_MLD2_REPORT 143 #define ICMPV6_DHAAD_REQUEST 144 #define ICMPV6_DHAAD_REPLY 145 #define ICMPV6_MOBILE_PREFIX_SOL 146 #define ICMPV6_MOBILE_PREFIX_ADV 147 #define ICMPV6_MRDISC_ADV 151 /* * Codes for Destination Unreachable */ #define ICMPV6_NOROUTE 0 #define ICMPV6_ADM_PROHIBITED 1 #define ICMPV6_NOT_NEIGHBOUR 2 #define ICMPV6_ADDR_UNREACH 3 #define ICMPV6_PORT_UNREACH 4 #define ICMPV6_POLICY_FAIL 5 #define ICMPV6_REJECT_ROUTE 6 /* * Codes for Time Exceeded */ #define ICMPV6_EXC_HOPLIMIT 0 #define ICMPV6_EXC_FRAGTIME 1 /* * Codes for Parameter Problem */ #define ICMPV6_HDR_FIELD 0 #define ICMPV6_UNK_NEXTHDR 1 #define ICMPV6_UNK_OPTION 2 #define ICMPV6_HDR_INCOMP 3 /* * constants for (set|get)sockopt */ #define ICMPV6_FILTER 1 /* * ICMPV6 filter */ #define ICMPV6_FILTER_BLOCK 1 #define ICMPV6_FILTER_PASS 2 #define ICMPV6_FILTER_BLOCKOTHERS 3 #define ICMPV6_FILTER_PASSONLY 4 struct icmp6_filter { __u32 data[8]; }; /* * Definitions for MLDv2 */ #define MLD2_MODE_IS_INCLUDE 1 #define MLD2_MODE_IS_EXCLUDE 2 #define MLD2_CHANGE_TO_INCLUDE 3 #define MLD2_CHANGE_TO_EXCLUDE 4 #define MLD2_ALLOW_NEW_SOURCES 5 #define MLD2_BLOCK_OLD_SOURCES 6 #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } #endif /* _LINUX_ICMPV6_H */ linux/idxd.h 0000644 00000020341 15063602050 0007001 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ /* Copyright(c) 2019 Intel Corporation. All rights rsvd. */ #ifndef _USR_IDXD_H_ #define _USR_IDXD_H_ #include <stdint.h> /* Driver command error status */ enum idxd_scmd_stat { IDXD_SCMD_DEV_ENABLED = 0x80000010, IDXD_SCMD_DEV_NOT_ENABLED = 0x80000020, IDXD_SCMD_WQ_ENABLED = 0x80000021, IDXD_SCMD_DEV_DMA_ERR = 0x80020000, IDXD_SCMD_WQ_NO_GRP = 0x80030000, IDXD_SCMD_WQ_NO_NAME = 0x80040000, IDXD_SCMD_WQ_NO_SVM = 0x80050000, IDXD_SCMD_WQ_NO_THRESH = 0x80060000, IDXD_SCMD_WQ_PORTAL_ERR = 0x80070000, IDXD_SCMD_WQ_RES_ALLOC_ERR = 0x80080000, IDXD_SCMD_PERCPU_ERR = 0x80090000, IDXD_SCMD_DMA_CHAN_ERR = 0x800a0000, IDXD_SCMD_CDEV_ERR = 0x800b0000, IDXD_SCMD_WQ_NO_SWQ_SUPPORT = 0x800c0000, IDXD_SCMD_WQ_NONE_CONFIGURED = 0x800d0000, IDXD_SCMD_WQ_NO_SIZE = 0x800e0000, IDXD_SCMD_WQ_NO_PRIV = 0x800f0000, IDXD_SCMD_WQ_IRQ_ERR = 0x80100000, IDXD_SCMD_WQ_USER_NO_IOMMU = 0x80110000, }; #define IDXD_SCMD_SOFTERR_MASK 0x80000000 #define IDXD_SCMD_SOFTERR_SHIFT 16 /* Descriptor flags */ #define IDXD_OP_FLAG_FENCE 0x0001 #define IDXD_OP_FLAG_BOF 0x0002 #define IDXD_OP_FLAG_CRAV 0x0004 #define IDXD_OP_FLAG_RCR 0x0008 #define IDXD_OP_FLAG_RCI 0x0010 #define IDXD_OP_FLAG_CRSTS 0x0020 #define IDXD_OP_FLAG_CR 0x0080 #define IDXD_OP_FLAG_CC 0x0100 #define IDXD_OP_FLAG_ADDR1_TCS 0x0200 #define IDXD_OP_FLAG_ADDR2_TCS 0x0400 #define IDXD_OP_FLAG_ADDR3_TCS 0x0800 #define IDXD_OP_FLAG_CR_TCS 0x1000 #define IDXD_OP_FLAG_STORD 0x2000 #define IDXD_OP_FLAG_DRDBK 0x4000 #define IDXD_OP_FLAG_DSTS 0x8000 /* IAX */ #define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000 #define IDXD_OP_FLAG_RD_SRC2_2ND 0x020000 #define IDXD_OP_FLAG_WR_SRC2_AECS_COMP 0x040000 #define IDXD_OP_FLAG_WR_SRC2_AECS_OVFL 0x080000 #define IDXD_OP_FLAG_SRC2_STS 0x100000 #define IDXD_OP_FLAG_CRC_RFC3720 0x200000 /* Opcode */ enum dsa_opcode { DSA_OPCODE_NOOP = 0, DSA_OPCODE_BATCH, DSA_OPCODE_DRAIN, DSA_OPCODE_MEMMOVE, DSA_OPCODE_MEMFILL, DSA_OPCODE_COMPARE, DSA_OPCODE_COMPVAL, DSA_OPCODE_CR_DELTA, DSA_OPCODE_AP_DELTA, DSA_OPCODE_DUALCAST, DSA_OPCODE_CRCGEN = 0x10, DSA_OPCODE_COPY_CRC, DSA_OPCODE_DIF_CHECK, DSA_OPCODE_DIF_INS, DSA_OPCODE_DIF_STRP, DSA_OPCODE_DIF_UPDT, DSA_OPCODE_CFLUSH = 0x20, }; enum iax_opcode { IAX_OPCODE_NOOP = 0, IAX_OPCODE_DRAIN = 2, IAX_OPCODE_MEMMOVE, IAX_OPCODE_DECOMPRESS = 0x42, IAX_OPCODE_COMPRESS, IAX_OPCODE_CRC64, IAX_OPCODE_ZERO_DECOMP_32 = 0x48, IAX_OPCODE_ZERO_DECOMP_16, IAX_OPCODE_ZERO_COMP_32 = 0x4c, IAX_OPCODE_ZERO_COMP_16, IAX_OPCODE_SCAN = 0x50, IAX_OPCODE_SET_MEMBER, IAX_OPCODE_EXTRACT, IAX_OPCODE_SELECT, IAX_OPCODE_RLE_BURST, IAX_OPCODE_FIND_UNIQUE, IAX_OPCODE_EXPAND, }; /* Completion record status */ enum dsa_completion_status { DSA_COMP_NONE = 0, DSA_COMP_SUCCESS, DSA_COMP_SUCCESS_PRED, DSA_COMP_PAGE_FAULT_NOBOF, DSA_COMP_PAGE_FAULT_IR, DSA_COMP_BATCH_FAIL, DSA_COMP_BATCH_PAGE_FAULT, DSA_COMP_DR_OFFSET_NOINC, DSA_COMP_DR_OFFSET_ERANGE, DSA_COMP_DIF_ERR, DSA_COMP_BAD_OPCODE = 0x10, DSA_COMP_INVALID_FLAGS, DSA_COMP_NOZERO_RESERVE, DSA_COMP_XFER_ERANGE, DSA_COMP_DESC_CNT_ERANGE, DSA_COMP_DR_ERANGE, DSA_COMP_OVERLAP_BUFFERS, DSA_COMP_DCAST_ERR, DSA_COMP_DESCLIST_ALIGN, DSA_COMP_INT_HANDLE_INVAL, DSA_COMP_CRA_XLAT, DSA_COMP_CRA_ALIGN, DSA_COMP_ADDR_ALIGN, DSA_COMP_PRIV_BAD, DSA_COMP_TRAFFIC_CLASS_CONF, DSA_COMP_PFAULT_RDBA, DSA_COMP_HW_ERR1, DSA_COMP_HW_ERR_DRB, DSA_COMP_TRANSLATION_FAIL, }; enum iax_completion_status { IAX_COMP_NONE = 0, IAX_COMP_SUCCESS, IAX_COMP_PAGE_FAULT_IR = 0x04, IAX_COMP_ANALYTICS_ERROR = 0x0a, IAX_COMP_OUTBUF_OVERFLOW, IAX_COMP_BAD_OPCODE = 0x10, IAX_COMP_INVALID_FLAGS, IAX_COMP_NOZERO_RESERVE, IAX_COMP_INVALID_SIZE, IAX_COMP_OVERLAP_BUFFERS = 0x16, IAX_COMP_INT_HANDLE_INVAL = 0x19, IAX_COMP_CRA_XLAT, IAX_COMP_CRA_ALIGN, IAX_COMP_ADDR_ALIGN, IAX_COMP_PRIV_BAD, IAX_COMP_TRAFFIC_CLASS_CONF, IAX_COMP_PFAULT_RDBA, IAX_COMP_HW_ERR1, IAX_COMP_HW_ERR_DRB, IAX_COMP_TRANSLATION_FAIL, IAX_COMP_PRS_TIMEOUT, IAX_COMP_WATCHDOG, IAX_COMP_INVALID_COMP_FLAG = 0x30, IAX_COMP_INVALID_FILTER_FLAG, IAX_COMP_INVALID_INPUT_SIZE, IAX_COMP_INVALID_NUM_ELEMS, IAX_COMP_INVALID_SRC1_WIDTH, IAX_COMP_INVALID_INVERT_OUT, }; #define DSA_COMP_STATUS_MASK 0x7f #define DSA_COMP_STATUS_WRITE 0x80 struct dsa_hw_desc { uint32_t pasid:20; uint32_t rsvd:11; uint32_t priv:1; uint32_t flags:24; uint32_t opcode:8; uint64_t completion_addr; union { uint64_t src_addr; uint64_t rdback_addr; uint64_t pattern; uint64_t desc_list_addr; }; union { uint64_t dst_addr; uint64_t rdback_addr2; uint64_t src2_addr; uint64_t comp_pattern; }; union { uint32_t xfer_size; uint32_t desc_count; }; uint16_t int_handle; uint16_t rsvd1; union { uint8_t expected_res; /* create delta record */ struct { uint64_t delta_addr; uint32_t max_delta_size; uint32_t delt_rsvd; uint8_t expected_res_mask; }; uint32_t delta_rec_size; uint64_t dest2; /* CRC */ struct { uint32_t crc_seed; uint32_t crc_rsvd; uint64_t seed_addr; }; /* DIF check or strip */ struct { uint8_t src_dif_flags; uint8_t dif_chk_res; uint8_t dif_chk_flags; uint8_t dif_chk_res2[5]; uint32_t chk_ref_tag_seed; uint16_t chk_app_tag_mask; uint16_t chk_app_tag_seed; }; /* DIF insert */ struct { uint8_t dif_ins_res; uint8_t dest_dif_flag; uint8_t dif_ins_flags; uint8_t dif_ins_res2[13]; uint32_t ins_ref_tag_seed; uint16_t ins_app_tag_mask; uint16_t ins_app_tag_seed; }; /* DIF update */ struct { uint8_t src_upd_flags; uint8_t upd_dest_flags; uint8_t dif_upd_flags; uint8_t dif_upd_res[5]; uint32_t src_ref_tag_seed; uint16_t src_app_tag_mask; uint16_t src_app_tag_seed; uint32_t dest_ref_tag_seed; uint16_t dest_app_tag_mask; uint16_t dest_app_tag_seed; }; uint8_t op_specific[24]; }; } __attribute__((packed)); struct iax_hw_desc { uint32_t pasid:20; uint32_t rsvd:11; uint32_t priv:1; uint32_t flags:24; uint32_t opcode:8; uint64_t completion_addr; uint64_t src1_addr; uint64_t dst_addr; uint32_t src1_size; uint16_t int_handle; union { uint16_t compr_flags; uint16_t decompr_flags; }; uint64_t src2_addr; uint32_t max_dst_size; uint32_t src2_size; uint32_t filter_flags; uint32_t num_inputs; } __attribute__((packed)); struct dsa_raw_desc { uint64_t field[8]; } __attribute__((packed)); /* * The status field will be modified by hardware, therefore it should be * __volatile__ and prevent the compiler from optimize the read. */ struct dsa_completion_record { __volatile__ uint8_t status; union { uint8_t result; uint8_t dif_status; }; uint16_t rsvd; uint32_t bytes_completed; uint64_t fault_addr; union { /* common record */ struct { uint32_t invalid_flags:24; uint32_t rsvd2:8; }; uint32_t delta_rec_size; uint64_t crc_val; /* DIF check & strip */ struct { uint32_t dif_chk_ref_tag; uint16_t dif_chk_app_tag_mask; uint16_t dif_chk_app_tag; }; /* DIF insert */ struct { uint64_t dif_ins_res; uint32_t dif_ins_ref_tag; uint16_t dif_ins_app_tag_mask; uint16_t dif_ins_app_tag; }; /* DIF update */ struct { uint32_t dif_upd_src_ref_tag; uint16_t dif_upd_src_app_tag_mask; uint16_t dif_upd_src_app_tag; uint32_t dif_upd_dest_ref_tag; uint16_t dif_upd_dest_app_tag_mask; uint16_t dif_upd_dest_app_tag; }; uint8_t op_specific[16]; }; } __attribute__((packed)); struct dsa_raw_completion_record { uint64_t field[4]; } __attribute__((packed)); struct iax_completion_record { __volatile__ uint8_t status; uint8_t error_code; uint16_t rsvd; uint32_t bytes_completed; uint64_t fault_addr; uint32_t invalid_flags; uint32_t rsvd2; uint32_t output_size; uint8_t output_bits; uint8_t rsvd3; uint16_t xor_csum; uint32_t crc; uint32_t min; uint32_t max; uint32_t sum; uint64_t rsvd4[2]; } __attribute__((packed)); struct iax_raw_completion_record { uint64_t field[8]; } __attribute__((packed)); #endif linux/if.h 0000644 00000025225 15063602050 0006455 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the INET interface module. * * Version: @(#)if.h 1.0.2 04/18/93 * * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 * Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_H #define _LINUX_IF_H #include <linux/libc-compat.h> /* for compatibility with glibc */ #include <linux/types.h> /* for "__kernel_caddr_t" et al */ #include <linux/socket.h> /* for "struct sockaddr" et al */ /* for "__user" et al */ #include <sys/socket.h> /* for struct sockaddr. */ #if __UAPI_DEF_IF_IFNAMSIZ #define IFNAMSIZ 16 #endif /* __UAPI_DEF_IF_IFNAMSIZ */ #define IFALIASZ 256 #define ALTIFNAMSIZ 128 #include <linux/hdlc/ioctl.h> /* For glibc compatibility. An empty enum does not compile. */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \ __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 /** * enum net_device_flags - &struct net_device flags * * These are the &struct net_device flags, they can be set by drivers, the * kernel and some can be triggered by userspace. Userspace can query and * set these flags using userspace utilities but there is also a sysfs * entry available for all dev flags which can be queried and set. These flags * are shared for all types of net_devices. The sysfs entries are available * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs * are annotated below, note that only a few flags can be toggled and some * other flags are always preserved from the original net_device flags * even if you try to set them via sysfs. Flags which are always preserved * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__ * are annotated below as such. * * You should have a pretty good reason to be extending these flags. * * @IFF_UP: interface is up. Can be toggled through sysfs. * @IFF_BROADCAST: broadcast address valid. Volatile. * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. * @IFF_LOOPBACK: is a loopback net. Volatile. * @IFF_POINTOPOINT: interface is has p-p link. Volatile. * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs. * Volatile. * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile. * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. * @IFF_PROMISC: receive all packets. Can be toggled through sysfs. * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through * sysfs. * @IFF_MASTER: master of a load balancer. Volatile. * @IFF_SLAVE: slave of a load balancer. Volatile. * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs. * @IFF_PORTSEL: can set media type. Can be toggled through sysfs. * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs. * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled * through sysfs. * @IFF_LOWER_UP: driver signals L1 up. Volatile. * @IFF_DORMANT: driver signals dormant. Volatile. * @IFF_ECHO: echo sent packets. Volatile. */ enum net_device_flags { /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS IFF_UP = 1<<0, /* sysfs */ IFF_BROADCAST = 1<<1, /* __volatile__ */ IFF_DEBUG = 1<<2, /* sysfs */ IFF_LOOPBACK = 1<<3, /* __volatile__ */ IFF_POINTOPOINT = 1<<4, /* __volatile__ */ IFF_NOTRAILERS = 1<<5, /* sysfs */ IFF_RUNNING = 1<<6, /* __volatile__ */ IFF_NOARP = 1<<7, /* sysfs */ IFF_PROMISC = 1<<8, /* sysfs */ IFF_ALLMULTI = 1<<9, /* sysfs */ IFF_MASTER = 1<<10, /* __volatile__ */ IFF_SLAVE = 1<<11, /* __volatile__ */ IFF_MULTICAST = 1<<12, /* sysfs */ IFF_PORTSEL = 1<<13, /* sysfs */ IFF_AUTOMEDIA = 1<<14, /* sysfs */ IFF_DYNAMIC = 1<<15, /* sysfs */ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO IFF_LOWER_UP = 1<<16, /* __volatile__ */ IFF_DORMANT = 1<<17, /* __volatile__ */ IFF_ECHO = 1<<18, /* __volatile__ */ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ }; #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS #define IFF_UP IFF_UP #define IFF_BROADCAST IFF_BROADCAST #define IFF_DEBUG IFF_DEBUG #define IFF_LOOPBACK IFF_LOOPBACK #define IFF_POINTOPOINT IFF_POINTOPOINT #define IFF_NOTRAILERS IFF_NOTRAILERS #define IFF_RUNNING IFF_RUNNING #define IFF_NOARP IFF_NOARP #define IFF_PROMISC IFF_PROMISC #define IFF_ALLMULTI IFF_ALLMULTI #define IFF_MASTER IFF_MASTER #define IFF_SLAVE IFF_SLAVE #define IFF_MULTICAST IFF_MULTICAST #define IFF_PORTSEL IFF_PORTSEL #define IFF_AUTOMEDIA IFF_AUTOMEDIA #define IFF_DYNAMIC IFF_DYNAMIC #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO #define IFF_LOWER_UP IFF_LOWER_UP #define IFF_DORMANT IFF_DORMANT #define IFF_ECHO IFF_ECHO #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) #define IF_GET_IFACE 0x0001 /* for querying only */ #define IF_GET_PROTO 0x0002 /* For definitions see hdlc.h */ #define IF_IFACE_V35 0x1000 /* V.35 serial interface */ #define IF_IFACE_V24 0x1001 /* V.24 serial interface */ #define IF_IFACE_X21 0x1002 /* X.21 serial interface */ #define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ #define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ #define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ #define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ /* For definitions see hdlc.h */ #define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ #define IF_PROTO_PPP 0x2001 /* PPP protocol */ #define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ #define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ #define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ #define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ #define IF_PROTO_X25 0x2006 /* X.25 */ #define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ #define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ #define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ #define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ #define IF_PROTO_FR_ETH_PVC 0x200B #define IF_PROTO_RAW 0x200C /* RAW Socket */ /* RFC 2863 operational status */ enum { IF_OPER_UNKNOWN, IF_OPER_NOTPRESENT, IF_OPER_DOWN, IF_OPER_LOWERLAYERDOWN, IF_OPER_TESTING, IF_OPER_DORMANT, IF_OPER_UP, }; /* link modes */ enum { IF_LINK_MODE_DEFAULT, IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ IF_LINK_MODE_TESTING, /* limit upward transition to testing */ }; /* * Device mapping structure. I'd just gone off and designed a * beautiful scheme using only loadable modules with arguments * for driver options and along come the PCMCIA people 8) * * Ah well. The get() side of this is good for WDSETUP, and it'll * be handy for debugging things. The set side is fine for now and * being very small might be worth keeping for clean configuration. */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_IFMAP struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; /* 3 bytes spare */ }; #endif /* __UAPI_DEF_IF_IFMAP */ struct if_settings { unsigned int type; /* Type of physical device or protocol */ unsigned int size; /* Size of the data allocated by the caller */ union { /* {atm/eth/dsl}_settings anyone ? */ raw_hdlc_proto *raw_hdlc; cisco_proto *cisco; fr_proto *fr; fr_proto_pvc *fr_pvc; fr_proto_pvc_info *fr_pvc_info; /* interface settings */ sync_serial_settings *sync; te1_settings *te1; } ifs_ifsu; }; /* * Interface request structure used for socket * ioctl's. All interface ioctl's must have parameter * definitions which begin with ifr_name. The * remainder may be interface specific. */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_IFREQ struct ifreq { #define IFHWADDRLEN 6 union { char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; void * ifru_data; struct if_settings ifru_settings; } ifr_ifru; }; #endif /* __UAPI_DEF_IF_IFREQ */ #define ifr_name ifr_ifrn.ifrn_name /* interface name */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ #define ifr_flags ifr_ifru.ifru_flags /* flags */ #define ifr_metric ifr_ifru.ifru_ivalue /* metric */ #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ #define ifr_map ifr_ifru.ifru_map /* device map */ #define ifr_slave ifr_ifru.ifru_slave /* slave device */ #define ifr_data ifr_ifru.ifru_data /* for use by interface */ #define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ #define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ #define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ #define ifr_newname ifr_ifru.ifru_newname /* New name */ #define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ /* * Structure used in SIOCGIFCONF request. * Used to retrieve interface configuration * for machine (useful for programs which * must know all networks accessible). */ /* for compatibility with glibc net/if.h */ #if __UAPI_DEF_IF_IFCONF struct ifconf { int ifc_len; /* size of buffer */ union { char *ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu; }; #endif /* __UAPI_DEF_IF_IFCONF */ #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ #endif /* _LINUX_IF_H */ linux/if_addr.h 0000644 00000003536 15063602050 0007450 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_IF_ADDR_H #define __LINUX_IF_ADDR_H #include <linux/types.h> #include <linux/netlink.h> struct ifaddrmsg { __u8 ifa_family; __u8 ifa_prefixlen; /* The prefix length */ __u8 ifa_flags; /* Flags */ __u8 ifa_scope; /* Address scope */ __u32 ifa_index; /* Link index */ }; /* * Important comment: * IFA_ADDRESS is prefix address, rather than local interface address. * It makes no difference for normally configured broadcast interfaces, * but for point-to-point IFA_ADDRESS is DESTINATION address, * local address is supplied in IFA_LOCAL attribute. * * IFA_FLAGS is a u32 attribute that extends the u8 field ifa_flags. * If present, the value from struct ifaddrmsg will be ignored. */ enum { IFA_UNSPEC, IFA_ADDRESS, IFA_LOCAL, IFA_LABEL, IFA_BROADCAST, IFA_ANYCAST, IFA_CACHEINFO, IFA_MULTICAST, IFA_FLAGS, IFA_RT_PRIORITY, /* u32, priority/metric for prefix route */ IFA_TARGET_NETNSID, __IFA_MAX, }; #define IFA_MAX (__IFA_MAX - 1) /* ifa_flags */ #define IFA_F_SECONDARY 0x01 #define IFA_F_TEMPORARY IFA_F_SECONDARY #define IFA_F_NODAD 0x02 #define IFA_F_OPTIMISTIC 0x04 #define IFA_F_DADFAILED 0x08 #define IFA_F_HOMEADDRESS 0x10 #define IFA_F_DEPRECATED 0x20 #define IFA_F_TENTATIVE 0x40 #define IFA_F_PERMANENT 0x80 #define IFA_F_MANAGETEMPADDR 0x100 #define IFA_F_NOPREFIXROUTE 0x200 #define IFA_F_MCAUTOJOIN 0x400 #define IFA_F_STABLE_PRIVACY 0x800 struct ifa_cacheinfo { __u32 ifa_prefered; __u32 ifa_valid; __u32 cstamp; /* created timestamp, hundredths of seconds */ __u32 tstamp; /* updated timestamp, hundredths of seconds */ }; /* backwards compatibility for userspace */ #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) #endif linux/if_addrlabel.h 0000644 00000001321 15063602050 0010436 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * if_addrlabel.h - netlink interface for address labels * * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. * * Authors: * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org> */ #ifndef __LINUX_IF_ADDRLABEL_H #define __LINUX_IF_ADDRLABEL_H #include <linux/types.h> struct ifaddrlblmsg { __u8 ifal_family; /* Address family */ __u8 __ifal_reserved; /* Reserved */ __u8 ifal_prefixlen; /* Prefix length */ __u8 ifal_flags; /* Flags */ __u32 ifal_index; /* Link index */ __u32 ifal_seq; /* sequence number */ }; enum { IFAL_ADDRESS = 1, IFAL_LABEL = 2, __IFAL_MAX }; #define IFAL_MAX (__IFAL_MAX - 1) #endif linux/if_alg.h 0000644 00000001662 15063602050 0007277 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * if_alg: User-space algorithm interface * * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * */ #ifndef _LINUX_IF_ALG_H #define _LINUX_IF_ALG_H #include <linux/types.h> struct sockaddr_alg { __u16 salg_family; __u8 salg_type[14]; __u32 salg_feat; __u32 salg_mask; __u8 salg_name[64]; }; struct af_alg_iv { __u32 ivlen; __u8 iv[0]; }; /* Socket options */ #define ALG_SET_KEY 1 #define ALG_SET_IV 2 #define ALG_SET_OP 3 #define ALG_SET_AEAD_ASSOCLEN 4 #define ALG_SET_AEAD_AUTHSIZE 5 /* Operations */ #define ALG_OP_DECRYPT 0 #define ALG_OP_ENCRYPT 1 #endif /* _LINUX_IF_ALG_H */ linux/if_arcnet.h 0000644 00000007205 15063602050 0010007 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the ARCnet interface. * * Authors: David Woodhouse and Avery Pennarun * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_ARCNET_H #define _LINUX_IF_ARCNET_H #include <linux/types.h> #include <linux/if_ether.h> /* * These are the defined ARCnet Protocol ID's. */ /* CAP mode */ /* No macro but uses 1-8 */ /* RFC1201 Protocol ID's */ #define ARC_P_IP 212 /* 0xD4 */ #define ARC_P_IPV6 196 /* 0xC4: RFC2497 */ #define ARC_P_ARP 213 /* 0xD5 */ #define ARC_P_RARP 214 /* 0xD6 */ #define ARC_P_IPX 250 /* 0xFA */ #define ARC_P_NOVELL_EC 236 /* 0xEC */ /* Old RFC1051 Protocol ID's */ #define ARC_P_IP_RFC1051 240 /* 0xF0 */ #define ARC_P_ARP_RFC1051 241 /* 0xF1 */ /* MS LanMan/WfWg "NDIS" encapsulation */ #define ARC_P_ETHER 232 /* 0xE8 */ /* Unsupported/indirectly supported protocols */ #define ARC_P_DATAPOINT_BOOT 0 /* very old Datapoint equipment */ #define ARC_P_DATAPOINT_MOUNT 1 #define ARC_P_POWERLAN_BEACON 8 /* Probably ATA-Netbios related */ #define ARC_P_POWERLAN_BEACON2 243 /* 0xF3 */ #define ARC_P_LANSOFT 251 /* 0xFB - what is this? */ #define ARC_P_ATALK 0xDD /* Hardware address length */ #define ARCNET_ALEN 1 /* * The RFC1201-specific components of an arcnet packet header. */ struct arc_rfc1201 { __u8 proto; /* protocol ID field - varies */ __u8 split_flag; /* for use with split packets */ __be16 sequence; /* sequence number */ __u8 payload[0]; /* space remaining in packet (504 bytes)*/ }; #define RFC1201_HDR_SIZE 4 /* * The RFC1051-specific components. */ struct arc_rfc1051 { __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ __u8 payload[0]; /* 507 bytes */ }; #define RFC1051_HDR_SIZE 1 /* * The ethernet-encap-specific components. We have a real ethernet header * and some data. */ struct arc_eth_encap { __u8 proto; /* Always ARC_P_ETHER */ struct ethhdr eth; /* standard ethernet header (yuck!) */ __u8 payload[0]; /* 493 bytes */ }; #define ETH_ENCAP_HDR_SIZE 14 struct arc_cap { __u8 proto; __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */ union { __u8 ack; __u8 raw[0]; /* 507 bytes */ } mes; }; /* * The data needed by the actual arcnet hardware. * * Now, in the real arcnet hardware, the third and fourth bytes are the * 'offset' specification instead of the length, and the soft data is at * the _end_ of the 512-byte buffer. We hide this complexity inside the * driver. */ struct arc_hardware { __u8 source; /* source ARCnet - filled in automagically */ __u8 dest; /* destination ARCnet - 0 for broadcast */ __u8 offset[2]; /* offset bytes (some weird semantics) */ }; #define ARC_HDR_SIZE 4 /* * This is an ARCnet frame header, as seen by the kernel (and userspace, * when you do a raw packet capture). */ struct archdr { /* hardware requirements */ struct arc_hardware hard; /* arcnet encapsulation-specific bits */ union { struct arc_rfc1201 rfc1201; struct arc_rfc1051 rfc1051; struct arc_eth_encap eth_encap; struct arc_cap cap; __u8 raw[0]; /* 508 bytes */ } soft; }; #endif /* _LINUX_IF_ARCNET_H */ linux/if_arp.h 0000644 00000014661 15063602050 0007321 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the ARP (RFC 826) protocol. * * Version: @(#)if_arp.h 1.0.1 04/16/93 * * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. * Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Florian La Roche, * Jonathan Layes <layes@loran.com> * Arnaldo Carvalho de Melo <acme@conectiva.com.br> ARPHRD_HWX25 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_ARP_H #define _LINUX_IF_ARP_H #include <linux/netdevice.h> /* ARP protocol HARDWARE identifiers. */ #define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ #define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ #define ARPHRD_EETHER 2 /* Experimental Ethernet */ #define ARPHRD_AX25 3 /* AX.25 Level 2 */ #define ARPHRD_PRONET 4 /* PROnet token ring */ #define ARPHRD_CHAOS 5 /* Chaosnet */ #define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ #define ARPHRD_ARCNET 7 /* ARCnet */ #define ARPHRD_APPLETLK 8 /* APPLEtalk */ #define ARPHRD_DLCI 15 /* Frame Relay DLCI */ #define ARPHRD_ATM 19 /* ATM */ #define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ #define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */ #define ARPHRD_EUI64 27 /* EUI-64 */ #define ARPHRD_INFINIBAND 32 /* InfiniBand */ /* Dummy types for non ARP hardware */ #define ARPHRD_SLIP 256 #define ARPHRD_CSLIP 257 #define ARPHRD_SLIP6 258 #define ARPHRD_CSLIP6 259 #define ARPHRD_RSRVD 260 /* Notional KISS type */ #define ARPHRD_ADAPT 264 #define ARPHRD_ROSE 270 #define ARPHRD_X25 271 /* CCITT X.25 */ #define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ #define ARPHRD_CAN 280 /* Controller Area Network */ #define ARPHRD_PPP 512 #define ARPHRD_CISCO 513 /* Cisco HDLC */ #define ARPHRD_HDLC ARPHRD_CISCO #define ARPHRD_LAPB 516 /* LAPB */ #define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */ #define ARPHRD_RAWHDLC 518 /* Raw HDLC */ #define ARPHRD_RAWIP 519 /* Raw IP */ #define ARPHRD_TUNNEL 768 /* IPIP tunnel */ #define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */ #define ARPHRD_FRAD 770 /* Frame Relay Access Device */ #define ARPHRD_SKIP 771 /* SKIP vif */ #define ARPHRD_LOOPBACK 772 /* Loopback device */ #define ARPHRD_LOCALTLK 773 /* Localtalk device */ #define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */ #define ARPHRD_BIF 775 /* AP1000 BIF */ #define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ #define ARPHRD_IPDDP 777 /* IP over DDP tunneller */ #define ARPHRD_IPGRE 778 /* GRE over IP */ #define ARPHRD_PIMREG 779 /* PIMSM register interface */ #define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */ #define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ #define ARPHRD_ECONET 782 /* Acorn Econet */ #define ARPHRD_IRDA 783 /* Linux-IrDA */ /* ARP works differently on different FC media .. so */ #define ARPHRD_FCPP 784 /* Point to point fibrechannel */ #define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */ #define ARPHRD_FCPL 786 /* Fibrechannel public loop */ #define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ /* 787->799 reserved for fibrechannel media types */ #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ #define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ #define ARPHRD_IEEE802154 804 #define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */ #define ARPHRD_PHONET 820 /* PhoNet media type */ #define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ #define ARPHRD_CAIF 822 /* CAIF media type */ #define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ #define ARPHRD_NETLINK 824 /* Netlink header */ #define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ #define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ #define ARPHRD_NONE 0xFFFE /* zero header length */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ #define ARPOP_REPLY 2 /* ARP reply */ #define ARPOP_RREQUEST 3 /* RARP request */ #define ARPOP_RREPLY 4 /* RARP reply */ #define ARPOP_InREQUEST 8 /* InARP request */ #define ARPOP_InREPLY 9 /* InARP reply */ #define ARPOP_NAK 10 /* (ATM)ARP NAK */ /* ARP ioctl request. */ struct arpreq { struct sockaddr arp_pa; /* protocol address */ struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ char arp_dev[16]; }; struct arpreq_old { struct sockaddr arp_pa; /* protocol address */ struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ }; /* ARP Flag values. */ #define ATF_COM 0x02 /* completed entry (ha valid) */ #define ATF_PERM 0x04 /* permanent entry */ #define ATF_PUBL 0x08 /* publish entry */ #define ATF_USETRAILERS 0x10 /* has requested trailers */ #define ATF_NETMASK 0x20 /* want to use a netmask (only for proxy entries) */ #define ATF_DONTPUB 0x40 /* don't answer this addresses */ /* * This structure defines an ethernet arp header. */ struct arphdr { __be16 ar_hrd; /* format of hardware address */ __be16 ar_pro; /* format of protocol address */ unsigned char ar_hln; /* length of hardware address */ unsigned char ar_pln; /* length of protocol address */ __be16 ar_op; /* ARP opcode (command) */ #if 0 /* * Ethernet looks like this : This bit is variable sized however... */ unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ unsigned char ar_sip[4]; /* sender IP address */ unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ unsigned char ar_tip[4]; /* target IP address */ #endif }; #endif /* _LINUX_IF_ARP_H */ linux/if_bonding.h 0000644 00000012253 15063602050 0010152 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. * * * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes * NCM: Network and Communications Management, Inc. * * BUT, I'm the one who modified it for ethernet, so: * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov * * This software may be used and distributed according to the terms * of the GNU Public License, incorporated herein by reference. * * 2003/03/18 - Amir Noam <amir.noam at intel dot com> * - Added support for getting slave's speed and duplex via ethtool. * Needed for 802.3ad and other future modes. * * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and * Shmulik Hen <shmulik.hen at intel dot com> * - Enable support of modes that need to use the unique mac address of * each slave. * * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and * Amir Noam <amir.noam at intel dot com> * - Moved driver's private data types to bonding.h * * 2003/03/18 - Amir Noam <amir.noam at intel dot com>, * Tsippy Mendelson <tsippy.mendelson at intel dot com> and * Shmulik Hen <shmulik.hen at intel dot com> * - Added support for IEEE 802.3ad Dynamic link aggregation mode. * * 2003/05/01 - Amir Noam <amir.noam at intel dot com> * - Added ABI version control to restore compatibility between * new/old ifenslave and new/old bonding. * * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com> * - Code cleanup and style changes * * 2005/05/05 - Jason Gabler <jygabler at lbl dot gov> * - added definitions for various XOR hashing policies */ #ifndef _LINUX_IF_BONDING_H #define _LINUX_IF_BONDING_H #include <linux/if.h> #include <linux/types.h> #include <linux/if_ether.h> /* userland - kernel ABI version (2003/05/08) */ #define BOND_ABI_VERSION 2 /* * We can remove these ioctl definitions in 2.5. People should use the * SIOC*** versions of them instead */ #define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE) #define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1) #define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2) #define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11) #define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12) #define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13) #define BOND_CHECK_MII_STATUS (SIOCGMIIPHY) #define BOND_MODE_ROUNDROBIN 0 #define BOND_MODE_ACTIVEBACKUP 1 #define BOND_MODE_XOR 2 #define BOND_MODE_BROADCAST 3 #define BOND_MODE_8023AD 4 #define BOND_MODE_TLB 5 #define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ /* each slave's link has 4 states */ #define BOND_LINK_UP 0 /* link is up and running */ #define BOND_LINK_FAIL 1 /* link has just gone down */ #define BOND_LINK_DOWN 2 /* link has been down for too long time */ #define BOND_LINK_BACK 3 /* link is going back */ /* each slave has several states */ #define BOND_STATE_ACTIVE 0 /* link is active */ #define BOND_STATE_BACKUP 1 /* link is backup */ #define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ #define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ #define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */ /* hashing types */ #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ #define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ #define BOND_XMIT_POLICY_ENCAP23 3 /* encapsulated layer 2+3 */ #define BOND_XMIT_POLICY_ENCAP34 4 /* encapsulated layer 3+4 */ #define BOND_XMIT_POLICY_VLAN_SRCMAC 5 /* vlan + source MAC */ /* 802.3ad port state definitions (43.4.2.2 in the 802.3ad standard) */ #define LACP_STATE_LACP_ACTIVITY 0x1 #define LACP_STATE_LACP_TIMEOUT 0x2 #define LACP_STATE_AGGREGATION 0x4 #define LACP_STATE_SYNCHRONIZATION 0x8 #define LACP_STATE_COLLECTING 0x10 #define LACP_STATE_DISTRIBUTING 0x20 #define LACP_STATE_DEFAULTED 0x40 #define LACP_STATE_EXPIRED 0x80 typedef struct ifbond { __s32 bond_mode; __s32 num_slaves; __s32 miimon; } ifbond; typedef struct ifslave { __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ char slave_name[IFNAMSIZ]; __s8 link; __s8 state; __u32 link_failure_count; } ifslave; struct ad_info { __u16 aggregator_id; __u16 ports; __u16 actor_key; __u16 partner_key; __u8 partner_system[ETH_ALEN]; }; /* Embedded inside LINK_XSTATS_TYPE_BOND */ enum { BOND_XSTATS_UNSPEC, BOND_XSTATS_3AD, __BOND_XSTATS_MAX }; #define BOND_XSTATS_MAX (__BOND_XSTATS_MAX - 1) /* Embedded inside BOND_XSTATS_3AD */ enum { BOND_3AD_STAT_LACPDU_RX, BOND_3AD_STAT_LACPDU_TX, BOND_3AD_STAT_LACPDU_UNKNOWN_RX, BOND_3AD_STAT_LACPDU_ILLEGAL_RX, BOND_3AD_STAT_MARKER_RX, BOND_3AD_STAT_MARKER_TX, BOND_3AD_STAT_MARKER_RESP_RX, BOND_3AD_STAT_MARKER_RESP_TX, BOND_3AD_STAT_MARKER_UNKNOWN_RX, BOND_3AD_STAT_PAD, __BOND_3AD_STAT_MAX }; #define BOND_3AD_STAT_MAX (__BOND_3AD_STAT_MAX - 1) #endif /* _LINUX_IF_BONDING_H */ /* * Local variables: * version-control: t * kept-new-versions: 5 * c-indent-level: 8 * c-basic-offset: 8 * tab-width: 8 * End: */ linux/if_bridge.h 0000644 00000046072 15063602050 0007774 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux ethernet bridge * * Authors: * Lennert Buytenhek <buytenh@gnu.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_BRIDGE_H #define _LINUX_IF_BRIDGE_H #include <linux/types.h> #include <linux/if_ether.h> #include <linux/in6.h> #define SYSFS_BRIDGE_ATTR "bridge" #define SYSFS_BRIDGE_FDB "brforward" #define SYSFS_BRIDGE_PORT_SUBDIR "brif" #define SYSFS_BRIDGE_PORT_ATTR "brport" #define SYSFS_BRIDGE_PORT_LINK "bridge" #define BRCTL_VERSION 1 #define BRCTL_GET_VERSION 0 #define BRCTL_GET_BRIDGES 1 #define BRCTL_ADD_BRIDGE 2 #define BRCTL_DEL_BRIDGE 3 #define BRCTL_ADD_IF 4 #define BRCTL_DEL_IF 5 #define BRCTL_GET_BRIDGE_INFO 6 #define BRCTL_GET_PORT_LIST 7 #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8 #define BRCTL_SET_BRIDGE_HELLO_TIME 9 #define BRCTL_SET_BRIDGE_MAX_AGE 10 #define BRCTL_SET_AGEING_TIME 11 #define BRCTL_SET_GC_INTERVAL 12 #define BRCTL_GET_PORT_INFO 13 #define BRCTL_SET_BRIDGE_STP_STATE 14 #define BRCTL_SET_BRIDGE_PRIORITY 15 #define BRCTL_SET_PORT_PRIORITY 16 #define BRCTL_SET_PATH_COST 17 #define BRCTL_GET_FDB_ENTRIES 18 #define BR_STATE_DISABLED 0 #define BR_STATE_LISTENING 1 #define BR_STATE_LEARNING 2 #define BR_STATE_FORWARDING 3 #define BR_STATE_BLOCKING 4 struct __bridge_info { __u64 designated_root; __u64 bridge_id; __u32 root_path_cost; __u32 max_age; __u32 hello_time; __u32 forward_delay; __u32 bridge_max_age; __u32 bridge_hello_time; __u32 bridge_forward_delay; __u8 topology_change; __u8 topology_change_detected; __u8 root_port; __u8 stp_enabled; __u32 ageing_time; __u32 gc_interval; __u32 hello_timer_value; __u32 tcn_timer_value; __u32 topology_change_timer_value; __u32 gc_timer_value; }; struct __port_info { __u64 designated_root; __u64 designated_bridge; __u16 port_id; __u16 designated_port; __u32 path_cost; __u32 designated_cost; __u8 state; __u8 top_change_ack; __u8 config_pending; __u8 unused0; __u32 message_age_timer_value; __u32 forward_delay_timer_value; __u32 hold_timer_value; }; struct __fdb_entry { __u8 mac_addr[ETH_ALEN]; __u8 port_no; __u8 is_local; __u32 ageing_timer_value; __u8 port_hi; __u8 pad0; __u16 unused; }; /* Bridge Flags */ #define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */ #define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */ #define BRIDGE_MODE_VEB 0 /* Default loopback mode */ #define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ #define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */ /* Bridge management nested attributes * [IFLA_AF_SPEC] = { * [IFLA_BRIDGE_FLAGS] * [IFLA_BRIDGE_MODE] * [IFLA_BRIDGE_VLAN_INFO] * } */ enum { IFLA_BRIDGE_FLAGS, IFLA_BRIDGE_MODE, IFLA_BRIDGE_VLAN_INFO, IFLA_BRIDGE_VLAN_TUNNEL_INFO, IFLA_BRIDGE_MRP, IFLA_BRIDGE_CFM, IFLA_BRIDGE_MST, __IFLA_BRIDGE_MAX, }; #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) #define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */ #define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */ #define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */ #define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */ #define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */ #define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */ #define BRIDGE_VLAN_INFO_ONLY_OPTS (1<<6) /* Skip create/delete/flags */ struct bridge_vlan_info { __u16 flags; __u16 vid; }; enum { IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC, IFLA_BRIDGE_VLAN_TUNNEL_ID, IFLA_BRIDGE_VLAN_TUNNEL_VID, IFLA_BRIDGE_VLAN_TUNNEL_FLAGS, __IFLA_BRIDGE_VLAN_TUNNEL_MAX, }; #define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1) struct bridge_vlan_xstats { __u64 rx_bytes; __u64 rx_packets; __u64 tx_bytes; __u64 tx_packets; __u16 vid; __u16 flags; __u32 pad2; }; enum { IFLA_BRIDGE_MRP_UNSPEC, IFLA_BRIDGE_MRP_INSTANCE, IFLA_BRIDGE_MRP_PORT_STATE, IFLA_BRIDGE_MRP_PORT_ROLE, IFLA_BRIDGE_MRP_RING_STATE, IFLA_BRIDGE_MRP_RING_ROLE, IFLA_BRIDGE_MRP_START_TEST, IFLA_BRIDGE_MRP_INFO, IFLA_BRIDGE_MRP_IN_ROLE, IFLA_BRIDGE_MRP_IN_STATE, IFLA_BRIDGE_MRP_START_IN_TEST, __IFLA_BRIDGE_MRP_MAX, }; #define IFLA_BRIDGE_MRP_MAX (__IFLA_BRIDGE_MRP_MAX - 1) enum { IFLA_BRIDGE_MRP_INSTANCE_UNSPEC, IFLA_BRIDGE_MRP_INSTANCE_RING_ID, IFLA_BRIDGE_MRP_INSTANCE_P_IFINDEX, IFLA_BRIDGE_MRP_INSTANCE_S_IFINDEX, IFLA_BRIDGE_MRP_INSTANCE_PRIO, __IFLA_BRIDGE_MRP_INSTANCE_MAX, }; #define IFLA_BRIDGE_MRP_INSTANCE_MAX (__IFLA_BRIDGE_MRP_INSTANCE_MAX - 1) enum { IFLA_BRIDGE_MRP_PORT_STATE_UNSPEC, IFLA_BRIDGE_MRP_PORT_STATE_STATE, __IFLA_BRIDGE_MRP_PORT_STATE_MAX, }; #define IFLA_BRIDGE_MRP_PORT_STATE_MAX (__IFLA_BRIDGE_MRP_PORT_STATE_MAX - 1) enum { IFLA_BRIDGE_MRP_PORT_ROLE_UNSPEC, IFLA_BRIDGE_MRP_PORT_ROLE_ROLE, __IFLA_BRIDGE_MRP_PORT_ROLE_MAX, }; #define IFLA_BRIDGE_MRP_PORT_ROLE_MAX (__IFLA_BRIDGE_MRP_PORT_ROLE_MAX - 1) enum { IFLA_BRIDGE_MRP_RING_STATE_UNSPEC, IFLA_BRIDGE_MRP_RING_STATE_RING_ID, IFLA_BRIDGE_MRP_RING_STATE_STATE, __IFLA_BRIDGE_MRP_RING_STATE_MAX, }; #define IFLA_BRIDGE_MRP_RING_STATE_MAX (__IFLA_BRIDGE_MRP_RING_STATE_MAX - 1) enum { IFLA_BRIDGE_MRP_RING_ROLE_UNSPEC, IFLA_BRIDGE_MRP_RING_ROLE_RING_ID, IFLA_BRIDGE_MRP_RING_ROLE_ROLE, __IFLA_BRIDGE_MRP_RING_ROLE_MAX, }; #define IFLA_BRIDGE_MRP_RING_ROLE_MAX (__IFLA_BRIDGE_MRP_RING_ROLE_MAX - 1) enum { IFLA_BRIDGE_MRP_START_TEST_UNSPEC, IFLA_BRIDGE_MRP_START_TEST_RING_ID, IFLA_BRIDGE_MRP_START_TEST_INTERVAL, IFLA_BRIDGE_MRP_START_TEST_MAX_MISS, IFLA_BRIDGE_MRP_START_TEST_PERIOD, IFLA_BRIDGE_MRP_START_TEST_MONITOR, __IFLA_BRIDGE_MRP_START_TEST_MAX, }; #define IFLA_BRIDGE_MRP_START_TEST_MAX (__IFLA_BRIDGE_MRP_START_TEST_MAX - 1) enum { IFLA_BRIDGE_MRP_INFO_UNSPEC, IFLA_BRIDGE_MRP_INFO_RING_ID, IFLA_BRIDGE_MRP_INFO_P_IFINDEX, IFLA_BRIDGE_MRP_INFO_S_IFINDEX, IFLA_BRIDGE_MRP_INFO_PRIO, IFLA_BRIDGE_MRP_INFO_RING_STATE, IFLA_BRIDGE_MRP_INFO_RING_ROLE, IFLA_BRIDGE_MRP_INFO_TEST_INTERVAL, IFLA_BRIDGE_MRP_INFO_TEST_MAX_MISS, IFLA_BRIDGE_MRP_INFO_TEST_MONITOR, IFLA_BRIDGE_MRP_INFO_I_IFINDEX, IFLA_BRIDGE_MRP_INFO_IN_STATE, IFLA_BRIDGE_MRP_INFO_IN_ROLE, IFLA_BRIDGE_MRP_INFO_IN_TEST_INTERVAL, IFLA_BRIDGE_MRP_INFO_IN_TEST_MAX_MISS, __IFLA_BRIDGE_MRP_INFO_MAX, }; #define IFLA_BRIDGE_MRP_INFO_MAX (__IFLA_BRIDGE_MRP_INFO_MAX - 1) enum { IFLA_BRIDGE_MRP_IN_STATE_UNSPEC, IFLA_BRIDGE_MRP_IN_STATE_IN_ID, IFLA_BRIDGE_MRP_IN_STATE_STATE, __IFLA_BRIDGE_MRP_IN_STATE_MAX, }; #define IFLA_BRIDGE_MRP_IN_STATE_MAX (__IFLA_BRIDGE_MRP_IN_STATE_MAX - 1) enum { IFLA_BRIDGE_MRP_IN_ROLE_UNSPEC, IFLA_BRIDGE_MRP_IN_ROLE_RING_ID, IFLA_BRIDGE_MRP_IN_ROLE_IN_ID, IFLA_BRIDGE_MRP_IN_ROLE_ROLE, IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX, __IFLA_BRIDGE_MRP_IN_ROLE_MAX, }; #define IFLA_BRIDGE_MRP_IN_ROLE_MAX (__IFLA_BRIDGE_MRP_IN_ROLE_MAX - 1) enum { IFLA_BRIDGE_MRP_START_IN_TEST_UNSPEC, IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID, IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL, IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS, IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD, __IFLA_BRIDGE_MRP_START_IN_TEST_MAX, }; #define IFLA_BRIDGE_MRP_START_IN_TEST_MAX (__IFLA_BRIDGE_MRP_START_IN_TEST_MAX - 1) struct br_mrp_instance { __u32 ring_id; __u32 p_ifindex; __u32 s_ifindex; __u16 prio; }; struct br_mrp_ring_state { __u32 ring_id; __u32 ring_state; }; struct br_mrp_ring_role { __u32 ring_id; __u32 ring_role; }; struct br_mrp_start_test { __u32 ring_id; __u32 interval; __u32 max_miss; __u32 period; __u32 monitor; }; struct br_mrp_in_state { __u32 in_state; __u16 in_id; }; struct br_mrp_in_role { __u32 ring_id; __u32 in_role; __u32 i_ifindex; __u16 in_id; }; struct br_mrp_start_in_test { __u32 interval; __u32 max_miss; __u32 period; __u16 in_id; }; enum { IFLA_BRIDGE_CFM_UNSPEC, IFLA_BRIDGE_CFM_MEP_CREATE, IFLA_BRIDGE_CFM_MEP_DELETE, IFLA_BRIDGE_CFM_MEP_CONFIG, IFLA_BRIDGE_CFM_CC_CONFIG, IFLA_BRIDGE_CFM_CC_PEER_MEP_ADD, IFLA_BRIDGE_CFM_CC_PEER_MEP_REMOVE, IFLA_BRIDGE_CFM_CC_RDI, IFLA_BRIDGE_CFM_CC_CCM_TX, IFLA_BRIDGE_CFM_MEP_CREATE_INFO, IFLA_BRIDGE_CFM_MEP_CONFIG_INFO, IFLA_BRIDGE_CFM_CC_CONFIG_INFO, IFLA_BRIDGE_CFM_CC_RDI_INFO, IFLA_BRIDGE_CFM_CC_CCM_TX_INFO, IFLA_BRIDGE_CFM_CC_PEER_MEP_INFO, IFLA_BRIDGE_CFM_MEP_STATUS_INFO, IFLA_BRIDGE_CFM_CC_PEER_STATUS_INFO, __IFLA_BRIDGE_CFM_MAX, }; #define IFLA_BRIDGE_CFM_MAX (__IFLA_BRIDGE_CFM_MAX - 1) enum { IFLA_BRIDGE_CFM_MEP_CREATE_UNSPEC, IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE, IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN, IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION, IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX, __IFLA_BRIDGE_CFM_MEP_CREATE_MAX, }; #define IFLA_BRIDGE_CFM_MEP_CREATE_MAX (__IFLA_BRIDGE_CFM_MEP_CREATE_MAX - 1) enum { IFLA_BRIDGE_CFM_MEP_DELETE_UNSPEC, IFLA_BRIDGE_CFM_MEP_DELETE_INSTANCE, __IFLA_BRIDGE_CFM_MEP_DELETE_MAX, }; #define IFLA_BRIDGE_CFM_MEP_DELETE_MAX (__IFLA_BRIDGE_CFM_MEP_DELETE_MAX - 1) enum { IFLA_BRIDGE_CFM_MEP_CONFIG_UNSPEC, IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE, IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC, IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL, IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID, __IFLA_BRIDGE_CFM_MEP_CONFIG_MAX, }; #define IFLA_BRIDGE_CFM_MEP_CONFIG_MAX (__IFLA_BRIDGE_CFM_MEP_CONFIG_MAX - 1) enum { IFLA_BRIDGE_CFM_CC_CONFIG_UNSPEC, IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE, IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE, IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL, IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID, __IFLA_BRIDGE_CFM_CC_CONFIG_MAX, }; #define IFLA_BRIDGE_CFM_CC_CONFIG_MAX (__IFLA_BRIDGE_CFM_CC_CONFIG_MAX - 1) enum { IFLA_BRIDGE_CFM_CC_PEER_MEP_UNSPEC, IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE, IFLA_BRIDGE_CFM_CC_PEER_MEPID, __IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX, }; #define IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX (__IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX - 1) enum { IFLA_BRIDGE_CFM_CC_RDI_UNSPEC, IFLA_BRIDGE_CFM_CC_RDI_INSTANCE, IFLA_BRIDGE_CFM_CC_RDI_RDI, __IFLA_BRIDGE_CFM_CC_RDI_MAX, }; #define IFLA_BRIDGE_CFM_CC_RDI_MAX (__IFLA_BRIDGE_CFM_CC_RDI_MAX - 1) enum { IFLA_BRIDGE_CFM_CC_CCM_TX_UNSPEC, IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE, IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC, IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE, IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD, IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV, IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE, IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV, IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE, __IFLA_BRIDGE_CFM_CC_CCM_TX_MAX, }; #define IFLA_BRIDGE_CFM_CC_CCM_TX_MAX (__IFLA_BRIDGE_CFM_CC_CCM_TX_MAX - 1) enum { IFLA_BRIDGE_CFM_MEP_STATUS_UNSPEC, IFLA_BRIDGE_CFM_MEP_STATUS_INSTANCE, IFLA_BRIDGE_CFM_MEP_STATUS_OPCODE_UNEXP_SEEN, IFLA_BRIDGE_CFM_MEP_STATUS_VERSION_UNEXP_SEEN, IFLA_BRIDGE_CFM_MEP_STATUS_RX_LEVEL_LOW_SEEN, __IFLA_BRIDGE_CFM_MEP_STATUS_MAX, }; #define IFLA_BRIDGE_CFM_MEP_STATUS_MAX (__IFLA_BRIDGE_CFM_MEP_STATUS_MAX - 1) enum { IFLA_BRIDGE_CFM_CC_PEER_STATUS_UNSPEC, IFLA_BRIDGE_CFM_CC_PEER_STATUS_INSTANCE, IFLA_BRIDGE_CFM_CC_PEER_STATUS_PEER_MEPID, IFLA_BRIDGE_CFM_CC_PEER_STATUS_CCM_DEFECT, IFLA_BRIDGE_CFM_CC_PEER_STATUS_RDI, IFLA_BRIDGE_CFM_CC_PEER_STATUS_PORT_TLV_VALUE, IFLA_BRIDGE_CFM_CC_PEER_STATUS_IF_TLV_VALUE, IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEEN, IFLA_BRIDGE_CFM_CC_PEER_STATUS_TLV_SEEN, IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEQ_UNEXP_SEEN, __IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX, }; #define IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX (__IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX - 1) enum { IFLA_BRIDGE_MST_UNSPEC, IFLA_BRIDGE_MST_ENTRY, __IFLA_BRIDGE_MST_MAX, }; #define IFLA_BRIDGE_MST_MAX (__IFLA_BRIDGE_MST_MAX - 1) enum { IFLA_BRIDGE_MST_ENTRY_UNSPEC, IFLA_BRIDGE_MST_ENTRY_MSTI, IFLA_BRIDGE_MST_ENTRY_STATE, __IFLA_BRIDGE_MST_ENTRY_MAX, }; #define IFLA_BRIDGE_MST_ENTRY_MAX (__IFLA_BRIDGE_MST_ENTRY_MAX - 1) struct bridge_stp_xstats { __u64 transition_blk; __u64 transition_fwd; __u64 rx_bpdu; __u64 tx_bpdu; __u64 rx_tcn; __u64 tx_tcn; }; /* Bridge vlan RTM header */ struct br_vlan_msg { __u8 family; __u8 reserved1; __u16 reserved2; __u32 ifindex; }; enum { BRIDGE_VLANDB_DUMP_UNSPEC, BRIDGE_VLANDB_DUMP_FLAGS, __BRIDGE_VLANDB_DUMP_MAX, }; #define BRIDGE_VLANDB_DUMP_MAX (__BRIDGE_VLANDB_DUMP_MAX - 1) /* flags used in BRIDGE_VLANDB_DUMP_FLAGS attribute to affect dumps */ #define BRIDGE_VLANDB_DUMPF_STATS (1 << 0) /* Include stats in the dump */ #define BRIDGE_VLANDB_DUMPF_GLOBAL (1 << 1) /* Dump global vlan options only */ /* Bridge vlan RTM attributes * [BRIDGE_VLANDB_ENTRY] = { * [BRIDGE_VLANDB_ENTRY_INFO] * ... * } * [BRIDGE_VLANDB_GLOBAL_OPTIONS] = { * [BRIDGE_VLANDB_GOPTS_ID] * ... * } */ enum { BRIDGE_VLANDB_UNSPEC, BRIDGE_VLANDB_ENTRY, BRIDGE_VLANDB_GLOBAL_OPTIONS, __BRIDGE_VLANDB_MAX, }; #define BRIDGE_VLANDB_MAX (__BRIDGE_VLANDB_MAX - 1) enum { BRIDGE_VLANDB_ENTRY_UNSPEC, BRIDGE_VLANDB_ENTRY_INFO, BRIDGE_VLANDB_ENTRY_RANGE, BRIDGE_VLANDB_ENTRY_STATE, BRIDGE_VLANDB_ENTRY_TUNNEL_INFO, BRIDGE_VLANDB_ENTRY_STATS, BRIDGE_VLANDB_ENTRY_MCAST_ROUTER, __BRIDGE_VLANDB_ENTRY_MAX, }; #define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1) /* [BRIDGE_VLANDB_ENTRY] = { * [BRIDGE_VLANDB_ENTRY_TUNNEL_INFO] = { * [BRIDGE_VLANDB_TINFO_ID] * ... * } * } */ enum { BRIDGE_VLANDB_TINFO_UNSPEC, BRIDGE_VLANDB_TINFO_ID, BRIDGE_VLANDB_TINFO_CMD, __BRIDGE_VLANDB_TINFO_MAX, }; #define BRIDGE_VLANDB_TINFO_MAX (__BRIDGE_VLANDB_TINFO_MAX - 1) /* [BRIDGE_VLANDB_ENTRY] = { * [BRIDGE_VLANDB_ENTRY_STATS] = { * [BRIDGE_VLANDB_STATS_RX_BYTES] * ... * } * ... * } */ enum { BRIDGE_VLANDB_STATS_UNSPEC, BRIDGE_VLANDB_STATS_RX_BYTES, BRIDGE_VLANDB_STATS_RX_PACKETS, BRIDGE_VLANDB_STATS_TX_BYTES, BRIDGE_VLANDB_STATS_TX_PACKETS, BRIDGE_VLANDB_STATS_PAD, __BRIDGE_VLANDB_STATS_MAX, }; #define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1) enum { BRIDGE_VLANDB_GOPTS_UNSPEC, BRIDGE_VLANDB_GOPTS_ID, BRIDGE_VLANDB_GOPTS_RANGE, BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING, BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION, BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION, BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_CNT, BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT, BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL, BRIDGE_VLANDB_GOPTS_PAD, BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL, BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL, BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL, BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL, BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL, BRIDGE_VLANDB_GOPTS_MCAST_QUERIER, BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS, BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE, BRIDGE_VLANDB_GOPTS_MSTI, __BRIDGE_VLANDB_GOPTS_MAX }; #define BRIDGE_VLANDB_GOPTS_MAX (__BRIDGE_VLANDB_GOPTS_MAX - 1) /* Bridge multicast database attributes * [MDBA_MDB] = { * [MDBA_MDB_ENTRY] = { * [MDBA_MDB_ENTRY_INFO] { * struct br_mdb_entry * [MDBA_MDB_EATTR attributes] * } * } * } * [MDBA_ROUTER] = { * [MDBA_ROUTER_PORT] = { * u32 ifindex * [MDBA_ROUTER_PATTR attributes] * } * } */ enum { MDBA_UNSPEC, MDBA_MDB, MDBA_ROUTER, __MDBA_MAX, }; #define MDBA_MAX (__MDBA_MAX - 1) enum { MDBA_MDB_UNSPEC, MDBA_MDB_ENTRY, __MDBA_MDB_MAX, }; #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1) enum { MDBA_MDB_ENTRY_UNSPEC, MDBA_MDB_ENTRY_INFO, __MDBA_MDB_ENTRY_MAX, }; #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1) /* per mdb entry additional attributes */ enum { MDBA_MDB_EATTR_UNSPEC, MDBA_MDB_EATTR_TIMER, MDBA_MDB_EATTR_SRC_LIST, MDBA_MDB_EATTR_GROUP_MODE, MDBA_MDB_EATTR_SOURCE, MDBA_MDB_EATTR_RTPROT, __MDBA_MDB_EATTR_MAX }; #define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1) /* per mdb entry source */ enum { MDBA_MDB_SRCLIST_UNSPEC, MDBA_MDB_SRCLIST_ENTRY, __MDBA_MDB_SRCLIST_MAX }; #define MDBA_MDB_SRCLIST_MAX (__MDBA_MDB_SRCLIST_MAX - 1) /* per mdb entry per source attributes * these are embedded in MDBA_MDB_SRCLIST_ENTRY */ enum { MDBA_MDB_SRCATTR_UNSPEC, MDBA_MDB_SRCATTR_ADDRESS, MDBA_MDB_SRCATTR_TIMER, __MDBA_MDB_SRCATTR_MAX }; #define MDBA_MDB_SRCATTR_MAX (__MDBA_MDB_SRCATTR_MAX - 1) /* multicast router types */ enum { MDB_RTR_TYPE_DISABLED, MDB_RTR_TYPE_TEMP_QUERY, MDB_RTR_TYPE_PERM, MDB_RTR_TYPE_TEMP }; enum { MDBA_ROUTER_UNSPEC, MDBA_ROUTER_PORT, __MDBA_ROUTER_MAX, }; #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1) /* router port attributes */ enum { MDBA_ROUTER_PATTR_UNSPEC, MDBA_ROUTER_PATTR_TIMER, MDBA_ROUTER_PATTR_TYPE, MDBA_ROUTER_PATTR_INET_TIMER, MDBA_ROUTER_PATTR_INET6_TIMER, MDBA_ROUTER_PATTR_VID, __MDBA_ROUTER_PATTR_MAX }; #define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1) struct br_port_msg { __u8 family; __u32 ifindex; }; struct br_mdb_entry { __u32 ifindex; #define MDB_TEMPORARY 0 #define MDB_PERMANENT 1 __u8 state; #define MDB_FLAGS_OFFLOAD (1 << 0) #define MDB_FLAGS_FAST_LEAVE (1 << 1) #define MDB_FLAGS_STAR_EXCL (1 << 2) #define MDB_FLAGS_BLOCKED (1 << 3) __u8 flags; __u16 vid; struct { union { __be32 ip4; struct in6_addr ip6; unsigned char mac_addr[ETH_ALEN]; } u; __be16 proto; } addr; }; enum { MDBA_SET_ENTRY_UNSPEC, MDBA_SET_ENTRY, MDBA_SET_ENTRY_ATTRS, __MDBA_SET_ENTRY_MAX, }; #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1) /* [MDBA_SET_ENTRY_ATTRS] = { * [MDBE_ATTR_xxx] * ... * } */ enum { MDBE_ATTR_UNSPEC, MDBE_ATTR_SOURCE, __MDBE_ATTR_MAX, }; #define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1) /* Embedded inside LINK_XSTATS_TYPE_BRIDGE */ enum { BRIDGE_XSTATS_UNSPEC, BRIDGE_XSTATS_VLAN, BRIDGE_XSTATS_MCAST, BRIDGE_XSTATS_PAD, BRIDGE_XSTATS_STP, __BRIDGE_XSTATS_MAX }; #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) enum { BR_MCAST_DIR_RX, BR_MCAST_DIR_TX, BR_MCAST_DIR_SIZE }; /* IGMP/MLD statistics */ struct br_mcast_stats { __u64 igmp_v1queries[BR_MCAST_DIR_SIZE]; __u64 igmp_v2queries[BR_MCAST_DIR_SIZE]; __u64 igmp_v3queries[BR_MCAST_DIR_SIZE]; __u64 igmp_leaves[BR_MCAST_DIR_SIZE]; __u64 igmp_v1reports[BR_MCAST_DIR_SIZE]; __u64 igmp_v2reports[BR_MCAST_DIR_SIZE]; __u64 igmp_v3reports[BR_MCAST_DIR_SIZE]; __u64 igmp_parse_errors; __u64 mld_v1queries[BR_MCAST_DIR_SIZE]; __u64 mld_v2queries[BR_MCAST_DIR_SIZE]; __u64 mld_leaves[BR_MCAST_DIR_SIZE]; __u64 mld_v1reports[BR_MCAST_DIR_SIZE]; __u64 mld_v2reports[BR_MCAST_DIR_SIZE]; __u64 mld_parse_errors; __u64 mcast_bytes[BR_MCAST_DIR_SIZE]; __u64 mcast_packets[BR_MCAST_DIR_SIZE]; }; /* bridge boolean options * BR_BOOLOPT_NO_LL_LEARN - disable learning from link-local packets * BR_BOOLOPT_MCAST_VLAN_SNOOPING - control vlan multicast snooping * * IMPORTANT: if adding a new option do not forget to handle * it in br_boolopt_toggle/get and bridge sysfs */ enum br_boolopt_id { BR_BOOLOPT_NO_LL_LEARN, BR_BOOLOPT_MCAST_VLAN_SNOOPING, BR_BOOLOPT_MST_ENABLE, BR_BOOLOPT_MAX }; /* struct br_boolopt_multi - change multiple bridge boolean options * * @optval: new option values (bit per option) * @optmask: options to change (bit per option) */ struct br_boolopt_multi { __u32 optval; __u32 optmask; }; enum { BRIDGE_QUERIER_UNSPEC, BRIDGE_QUERIER_IP_ADDRESS, BRIDGE_QUERIER_IP_PORT, BRIDGE_QUERIER_IP_OTHER_TIMER, BRIDGE_QUERIER_PAD, BRIDGE_QUERIER_IPV6_ADDRESS, BRIDGE_QUERIER_IPV6_PORT, BRIDGE_QUERIER_IPV6_OTHER_TIMER, __BRIDGE_QUERIER_MAX }; #define BRIDGE_QUERIER_MAX (__BRIDGE_QUERIER_MAX - 1) #endif /* _LINUX_IF_BRIDGE_H */ linux/if_cablemodem.h 0000644 00000001732 15063602050 0010622 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _LINUX_CABLEMODEM_H_ #define _LINUX_CABLEMODEM_H_ /* * Author: Franco Venturi <fventuri@mediaone.net> * Copyright 1998 Franco Venturi * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software * Foundation; either version 2 of the License, or (at * your option) any later version. */ /* some useful defines for sb1000.c e cmconfig.c - fv */ #define SIOCGCMSTATS (SIOCDEVPRIVATE+0) /* get cable modem stats */ #define SIOCGCMFIRMWARE (SIOCDEVPRIVATE+1) /* get cm firmware version */ #define SIOCGCMFREQUENCY (SIOCDEVPRIVATE+2) /* get cable modem frequency */ #define SIOCSCMFREQUENCY (SIOCDEVPRIVATE+3) /* set cable modem frequency */ #define SIOCGCMPIDS (SIOCDEVPRIVATE+4) /* get cable modem PIDs */ #define SIOCSCMPIDS (SIOCDEVPRIVATE+5) /* set cable modem PIDs */ #endif linux/if_eql.h 0000644 00000002505 15063602050 0007312 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Equalizer Load-balancer for serial network interfaces. * * (c) Copyright 1995 Simon "Guru Aleph-Null" Janes * NCM: Network and Communications Management, Inc. * * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * * The author may be reached as simon@ncm.com, or C/O * NCM * Attn: Simon Janes * 6803 Whittier Ave * McLean VA 22101 * Phone: 1-703-847-0040 ext 103 */ #ifndef _LINUX_IF_EQL_H #define _LINUX_IF_EQL_H #define EQL_DEFAULT_SLAVE_PRIORITY 28800 #define EQL_DEFAULT_MAX_SLAVES 4 #define EQL_DEFAULT_MTU 576 #define EQL_DEFAULT_RESCHED_IVAL HZ #define EQL_ENSLAVE (SIOCDEVPRIVATE) #define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) #define EQL_GETSLAVECFG (SIOCDEVPRIVATE + 2) #define EQL_SETSLAVECFG (SIOCDEVPRIVATE + 3) #define EQL_GETMASTRCFG (SIOCDEVPRIVATE + 4) #define EQL_SETMASTRCFG (SIOCDEVPRIVATE + 5) typedef struct master_config { char master_name[16]; int max_slaves; int min_slaves; } master_config_t; typedef struct slave_config { char slave_name[16]; long priority; } slave_config_t; typedef struct slaving_request { char slave_name[16]; long priority; } slaving_request_t; #endif /* _LINUX_IF_EQL_H */ linux/if_ether.h 0000644 00000020070 15063602050 0007635 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the Ethernet IEEE 802.3 interface. * * Version: @(#)if_ether.h 1.0.1a 02/08/94 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_ETHER_H #define _LINUX_IF_ETHER_H #include <linux/types.h> /* * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble * and FCS/CRC (frame check sequence). */ #define ETH_ALEN 6 /* Octets in one ethernet addr */ #define ETH_TLEN 2 /* Octets in ethernet type field */ #define ETH_HLEN 14 /* Total octets in header. */ #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ #define ETH_DATA_LEN 1500 /* Max. octets in payload */ #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ #define ETH_FCS_LEN 4 /* Octets in the FCS */ #define ETH_MIN_MTU 68 /* Min IPv4 MTU per RFC791 */ #define ETH_MAX_MTU 0xFFFFU /* 65535, same as IP_MAX_MTU */ /* * These are the defined Ethernet Protocol ID's. */ #define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ #define ETH_P_PUP 0x0200 /* Xerox PUP packet */ #define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ #define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */ #define ETH_P_ERSPAN2 0x22EB /* ERSPAN version 2 (type III) */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ #define ETH_P_X25 0x0805 /* CCITT X.25 */ #define ETH_P_ARP 0x0806 /* Address Resolution packet */ #define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ #define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ #define ETH_P_BATMAN 0x4305 /* B.A.T.M.A.N.-Advanced packet [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_DEC 0x6000 /* DEC Assigned proto */ #define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ #define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ #define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */ #define ETH_P_LAT 0x6004 /* DEC LAT */ #define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ #define ETH_P_CUST 0x6006 /* DEC Customer use */ #define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ #define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ #define ETH_P_ATALK 0x809B /* Appletalk DDP */ #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ #define ETH_P_ERSPAN 0x88BE /* ERSPAN type II */ #define ETH_P_IPX 0x8137 /* IPX over DIX */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ #define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ #define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ #define ETH_P_WCCP 0x883E /* Web-cache coordination protocol * defined in draft-wilson-wrec-wccp-v2-00.txt */ #define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ #define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ #define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ #define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ #define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ #define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport * over Ethernet */ #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ #define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ #define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ #define ETH_P_PREAUTH 0x88C7 /* 802.11 Preauthentication */ #define ETH_P_TIPC 0x88CA /* TIPC */ #define ETH_P_LLDP 0x88CC /* Link Layer Discovery Protocol */ #define ETH_P_MRP 0x88E3 /* Media Redundancy Protocol */ #define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */ #define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ #define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ #define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ #define ETH_P_NCSI 0x88F8 /* NCSI protocol */ #define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */ #define ETH_P_CFM 0x8902 /* Connectivity Fault Management */ #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ #define ETH_P_IBOE 0x8915 /* Infiniband over Ethernet */ #define ETH_P_TDLS 0x890D /* TDLS */ #define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ #define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */ #define ETH_P_HSR 0x892F /* IEC 62439-3 HSRv1 */ #define ETH_P_NSH 0x894F /* Network Service Header */ #define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */ #define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ #define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value * then the frame is Ethernet II. Else it is 802.3 */ /* * Non DIX types. Won't clash for 1500 types. */ #define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ #define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ #define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ #define ETH_P_802_2 0x0004 /* 802.2 frames */ #define ETH_P_SNAP 0x0005 /* Internal only */ #define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ #define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ #define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ #define ETH_P_CAN 0x000C /* CAN: Controller Area Network */ #define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/ #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ #define ETH_P_CONTROL 0x0016 /* Card specific control frames */ #define ETH_P_IRDA 0x0017 /* Linux-IrDA */ #define ETH_P_ECONET 0x0018 /* Acorn Econet */ #define ETH_P_HDLC 0x0019 /* HDLC frames */ #define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ #define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ #define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ #define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ #define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ #define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ #define ETH_P_XDSA 0x00F8 /* Multiplexed DSA protocol */ #define ETH_P_MAP 0x00F9 /* Qualcomm multiplexing and * aggregation protocol */ /* * This is an Ethernet frame header. */ /* allow libcs like musl to deactivate this, glibc does not implement this. */ #ifndef __UAPI_DEF_ETHHDR #define __UAPI_DEF_ETHHDR 1 #endif #if __UAPI_DEF_ETHHDR struct ethhdr { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */ __be16 h_proto; /* packet type ID field */ } __attribute__((packed)); #endif #endif /* _LINUX_IF_ETHER_H */ linux/if_fc.h 0000644 00000003312 15063602050 0007116 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for Fibre Channel. * * Version: @(#)if_fc.h 0.0 11/20/98 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> * Vineet Abraham, <vma@iol.unh.edu> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_FC_H #define _LINUX_IF_FC_H #include <linux/types.h> #define FC_ALEN 6 /* Octets in one ethernet addr */ #define FC_HLEN (sizeof(struct fch_hdr)+sizeof(struct fcllc)) #define FC_ID_LEN 3 /* Octets in a Fibre Channel Address */ /* LLC and SNAP constants */ #define EXTENDED_SAP 0xAA #define UI_CMD 0x03 /* This is NOT the Fibre Channel frame header. The FC frame header is * constructed in the driver as the Tachyon needs certain fields in * certains positions. So, it can't be generalized here.*/ struct fch_hdr { __u8 daddr[FC_ALEN]; /* destination address */ __u8 saddr[FC_ALEN]; /* source address */ }; /* This is a Fibre Channel LLC structure */ struct fcllc { __u8 dsap; /* destination SAP */ __u8 ssap; /* source SAP */ __u8 llc; /* LLC control field */ __u8 protid[3]; /* protocol id */ __be16 ethertype; /* ether type field */ }; #endif /* _LINUX_IF_FC_H */ linux/if_fddi.h 0000644 00000007244 15063602050 0007444 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the ANSI FDDI interface. * * Version: @(#)if_fddi.h 1.0.2 Sep 29 2004 * * Author: Lawrence V. Stefani, <stefani@lkg.dec.com> * * if_fddi.h is based on previous if_ether.h and if_tr.h work by * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_FDDI_H #define _LINUX_IF_FDDI_H #include <linux/types.h> /* * Define max and min legal sizes. The frame sizes do not include * 4 byte FCS/CRC (frame check sequence). */ #define FDDI_K_ALEN 6 /* Octets in one FDDI address */ #define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */ #define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */ #define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */ #define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */ #define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */ #define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */ #define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */ #define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */ #define FDDI_K_OUI_LEN 3 /* Octets in OUI in 802.2 SNAP header */ /* Define FDDI Frame Control (FC) Byte values */ #define FDDI_FC_K_VOID 0x00 #define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80 #define FDDI_FC_K_RESTRICTED_TOKEN 0xC0 #define FDDI_FC_K_SMT_MIN 0x41 #define FDDI_FC_K_SMT_MAX 0x4F #define FDDI_FC_K_MAC_MIN 0xC1 #define FDDI_FC_K_MAC_MAX 0xCF #define FDDI_FC_K_ASYNC_LLC_MIN 0x50 #define FDDI_FC_K_ASYNC_LLC_DEF 0x54 #define FDDI_FC_K_ASYNC_LLC_MAX 0x5F #define FDDI_FC_K_SYNC_LLC_MIN 0xD0 #define FDDI_FC_K_SYNC_LLC_MAX 0xD7 #define FDDI_FC_K_IMPLEMENTOR_MIN 0x60 #define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F #define FDDI_FC_K_RESERVED_MIN 0x70 #define FDDI_FC_K_RESERVED_MAX 0x7F /* Define LLC and SNAP constants */ #define FDDI_EXTENDED_SAP 0xAA #define FDDI_UI_CMD 0x03 /* Define 802.2 Type 1 header */ struct fddi_8022_1_hdr { __u8 dsap; /* destination service access point */ __u8 ssap; /* source service access point */ __u8 ctrl; /* control byte #1 */ } __attribute__((packed)); /* Define 802.2 Type 2 header */ struct fddi_8022_2_hdr { __u8 dsap; /* destination service access point */ __u8 ssap; /* source service access point */ __u8 ctrl_1; /* control byte #1 */ __u8 ctrl_2; /* control byte #2 */ } __attribute__((packed)); /* Define 802.2 SNAP header */ struct fddi_snap_hdr { __u8 dsap; /* always 0xAA */ __u8 ssap; /* always 0xAA */ __u8 ctrl; /* always 0x03 */ __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ __be16 ethertype; /* packet type ID field */ } __attribute__((packed)); /* Define FDDI LLC frame header */ struct fddihdr { __u8 fc; /* frame control */ __u8 daddr[FDDI_K_ALEN]; /* destination address */ __u8 saddr[FDDI_K_ALEN]; /* source address */ union { struct fddi_8022_1_hdr llc_8022_1; struct fddi_8022_2_hdr llc_8022_2; struct fddi_snap_hdr llc_snap; } hdr; } __attribute__((packed)); #endif /* _LINUX_IF_FDDI_H */ linux/if_frad.h 0000644 00000005713 15063602050 0007451 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are * created for each DLCI associated with a FRAD. The FRAD driver * is not truly a network device, but the lower level device * handler. This allows other FRAD manufacturers to use the DLCI * code, including its RFC1490 encapsulation alongside the current * implementation for the Sangoma cards. * * Version: @(#)if_ifrad.h 0.15 31 Mar 96 * * Author: Mike McLagan <mike.mclagan@linux.org> * * Changes: * 0.15 Mike McLagan changed structure defs (packed) * re-arranged flags * added DLCI_RET vars * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _FRAD_H_ #define _FRAD_H_ #include <linux/if.h> /* Structures and constants associated with the DLCI device driver */ struct dlci_add { char devname[IFNAMSIZ]; short dlci; }; #define DLCI_GET_CONF (SIOCDEVPRIVATE + 2) #define DLCI_SET_CONF (SIOCDEVPRIVATE + 3) /* * These are related to the Sangoma SDLA and should remain in order. * Code within the SDLA module is based on the specifics of this * structure. Change at your own peril. */ struct dlci_conf { short flags; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; /* these are part of the status read */ short Tc_fwd; short Tc_bwd; short Tf_max; short Tb_max; /* add any new fields here above is a mirror of sdla_dlci_conf */ }; #define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4) /* configuration flags for DLCI */ #define DLCI_IGNORE_CIR_OUT 0x0001 #define DLCI_ACCOUNT_CIR_IN 0x0002 #define DLCI_BUFFER_IF 0x0008 #define DLCI_VALID_FLAGS 0x000B /* defines for the actual Frame Relay hardware */ #define FRAD_GET_CONF (SIOCDEVPRIVATE) #define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) #define FRAD_LAST_IOCTL FRAD_SET_CONF /* * Based on the setup for the Sangoma SDLA. If changes are * necessary to this structure, a routine will need to be * added to that module to copy fields. */ struct frad_conf { short station; short flags; short kbaud; short clocking; short mtu; short T391; short T392; short N391; short N392; short N393; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; /* Add new fields here, above is a mirror of the sdla_conf */ }; #define FRAD_STATION_CPE 0x0000 #define FRAD_STATION_NODE 0x0001 #define FRAD_TX_IGNORE_CIR 0x0001 #define FRAD_RX_ACCOUNT_CIR 0x0002 #define FRAD_DROP_ABORTED 0x0004 #define FRAD_BUFFERIF 0x0008 #define FRAD_STATS 0x0010 #define FRAD_MCI 0x0100 #define FRAD_AUTODLCI 0x8000 #define FRAD_VALID_FLAGS 0x811F #define FRAD_CLOCK_INT 0x0001 #define FRAD_CLOCK_EXT 0x0000 #endif /* _FRAD_H_ */ linux/if_hippi.h 0000644 00000010213 15063602050 0007635 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the HIPPI interface. * * Version: @(#)if_hippi.h 1.0.0 05/26/97 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * Jes Sorensen, <Jes.Sorensen@cern.ch> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IF_HIPPI_H #define _LINUX_IF_HIPPI_H #include <linux/types.h> #include <asm/byteorder.h> /* * HIPPI magic constants. */ #define HIPPI_ALEN 6 /* Bytes in one HIPPI hw-addr */ #define HIPPI_HLEN sizeof(struct hippi_hdr) #define HIPPI_ZLEN 0 /* Min. bytes in frame without FCS */ #define HIPPI_DATA_LEN 65280 /* Max. bytes in payload */ #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) /* Max. bytes in frame without FCS */ /* * Define LLC and SNAP constants. */ #define HIPPI_EXTENDED_SAP 0xAA #define HIPPI_UI_CMD 0x03 /* * Do we need to list some sort of ID's here? */ /* * HIPPI statistics collection data. */ struct hipnet_statistics { int rx_packets; /* total packets received */ int tx_packets; /* total packets transmitted */ int rx_errors; /* bad packets received */ int tx_errors; /* packet transmit problems */ int rx_dropped; /* no space in linux buffers */ int tx_dropped; /* no space available in linux */ /* detailed rx_errors: */ int rx_length_errors; int rx_over_errors; /* receiver ring buff overflow */ int rx_crc_errors; /* recved pkt with crc error */ int rx_frame_errors; /* recv'd frame alignment error */ int rx_fifo_errors; /* recv'r fifo overrun */ int rx_missed_errors; /* receiver missed packet */ /* detailed tx_errors */ int tx_aborted_errors; int tx_carrier_errors; int tx_fifo_errors; int tx_heartbeat_errors; int tx_window_errors; }; struct hippi_fp_hdr { #if 0 __u8 ulp; /* must contain 4 */ #if defined (__BIG_ENDIAN_BITFIELD) __u8 d1_data_present:1; /* must be 1 */ __u8 start_d2_burst_boundary:1; /* must be zero */ __u8 reserved:6; /* must be zero */ #if 0 __u16 reserved1:5; __u16 d1_area_size:8; /* must be 3 */ __u16 d2_offset:3; /* must be zero */ #endif #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved:6; /* must be zero */ __u8 start_d2_burst_boundary:1; /* must be zero */ __u8 d1_data_present:1; /* must be 1 */ #if 0 __u16 d2_offset:3; /* must be zero */ __u16 d1_area_size:8; /* must be 3 */ __u16 reserved1:5; /* must be zero */ #endif #else #error "Please fix <asm/byteorder.h>" #endif #else __be32 fixed; #endif __be32 d2_size; } __attribute__((packed)); struct hippi_le_hdr { #if defined (__BIG_ENDIAN_BITFIELD) __u8 fc:3; __u8 double_wide:1; __u8 message_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 message_type:4; __u8 double_wide:1; __u8 fc:3; #endif __u8 dest_switch_addr[3]; #if defined (__BIG_ENDIAN_BITFIELD) __u8 dest_addr_type:4, src_addr_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 src_addr_type:4, dest_addr_type:4; #endif __u8 src_switch_addr[3]; __u16 reserved; __u8 daddr[HIPPI_ALEN]; __u16 locally_administered; __u8 saddr[HIPPI_ALEN]; } __attribute__((packed)); #define HIPPI_OUI_LEN 3 /* * Looks like the dsap and ssap fields have been swapped by mistake in * RFC 2067 "IP over HIPPI". */ struct hippi_snap_hdr { __u8 dsap; /* always 0xAA */ __u8 ssap; /* always 0xAA */ __u8 ctrl; /* always 0x03 */ __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ __be16 ethertype; /* packet type ID field */ } __attribute__((packed)); struct hippi_hdr { struct hippi_fp_hdr fp; struct hippi_le_hdr le; struct hippi_snap_hdr snap; } __attribute__((packed)); #endif /* _LINUX_IF_HIPPI_H */ linux/if_infiniband.h 0000644 00000002335 15063602050 0010633 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available at * <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD * license, available in the LICENSE.TXT file accompanying this * software. These details are also available at * <http://www.openfabrics.org/software_license.htm>. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Copyright (c) 2004 Topspin Communications. All rights reserved. * * $Id$ */ #ifndef _LINUX_IF_INFINIBAND_H #define _LINUX_IF_INFINIBAND_H #define INFINIBAND_ALEN 20 /* Octets in IPoIB HW addr */ #endif /* _LINUX_IF_INFINIBAND_H */ linux/if_link.h 0000644 00000074435 15063602050 0007501 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IF_LINK_H #define _LINUX_IF_LINK_H #include <linux/types.h> #include <linux/netlink.h> /* This struct should be in sync with struct rtnl_link_stats64 */ struct rtnl_link_stats { __u32 rx_packets; /* total packets received */ __u32 tx_packets; /* total packets transmitted */ __u32 rx_bytes; /* total bytes received */ __u32 tx_bytes; /* total bytes transmitted */ __u32 rx_errors; /* bad packets received */ __u32 tx_errors; /* packet transmit problems */ __u32 rx_dropped; /* no space in linux buffers */ __u32 tx_dropped; /* no space available in linux */ __u32 multicast; /* multicast packets received */ __u32 collisions; /* detailed rx_errors: */ __u32 rx_length_errors; __u32 rx_over_errors; /* receiver ring buff overflow */ __u32 rx_crc_errors; /* recved pkt with crc error */ __u32 rx_frame_errors; /* recv'd frame alignment error */ __u32 rx_fifo_errors; /* recv'r fifo overrun */ __u32 rx_missed_errors; /* receiver missed packet */ /* detailed tx_errors */ __u32 tx_aborted_errors; __u32 tx_carrier_errors; __u32 tx_fifo_errors; __u32 tx_heartbeat_errors; __u32 tx_window_errors; /* for cslip etc */ __u32 rx_compressed; __u32 tx_compressed; __u32 rx_nohandler; /* dropped, no handler found */ }; /** * struct rtnl_link_stats64 - The main device statistics structure. * * @rx_packets: Number of good packets received by the interface. * For hardware interfaces counts all good packets received from the device * by the host, including packets which host had to drop at various stages * of processing (even in the driver). * * @tx_packets: Number of packets successfully transmitted. * For hardware interfaces counts packets which host was able to successfully * hand over to the device, which does not necessarily mean that packets * had been successfully transmitted out of the device, only that device * acknowledged it copied them out of host memory. * * @rx_bytes: Number of good received bytes, corresponding to @rx_packets. * * For IEEE 802.3 devices should count the length of Ethernet Frames * excluding the FCS. * * @tx_bytes: Number of good transmitted bytes, corresponding to @tx_packets. * * For IEEE 802.3 devices should count the length of Ethernet Frames * excluding the FCS. * * @rx_errors: Total number of bad packets received on this network device. * This counter must include events counted by @rx_length_errors, * @rx_crc_errors, @rx_frame_errors and other errors not otherwise * counted. * * @tx_errors: Total number of transmit problems. * This counter must include events counter by @tx_aborted_errors, * @tx_carrier_errors, @tx_fifo_errors, @tx_heartbeat_errors, * @tx_window_errors and other errors not otherwise counted. * * @rx_dropped: Number of packets received but not processed, * e.g. due to lack of resources or unsupported protocol. * For hardware interfaces this counter should not include packets * dropped by the device which are counted separately in * @rx_missed_errors (since procfs folds those two counters together). * * @tx_dropped: Number of packets dropped on their way to transmission, * e.g. due to lack of resources. * * @multicast: Multicast packets received. * For hardware interfaces this statistic is commonly calculated * at the device level (unlike @rx_packets) and therefore may include * packets which did not reach the host. * * For IEEE 802.3 devices this counter may be equivalent to: * * - 30.3.1.1.21 aMulticastFramesReceivedOK * * @collisions: Number of collisions during packet transmissions. * * @rx_length_errors: Number of packets dropped due to invalid length. * Part of aggregate "frame" errors in `/proc/net/dev`. * * For IEEE 802.3 devices this counter should be equivalent to a sum * of the following attributes: * * - 30.3.1.1.23 aInRangeLengthErrors * - 30.3.1.1.24 aOutOfRangeLengthField * - 30.3.1.1.25 aFrameTooLongErrors * * @rx_over_errors: Receiver FIFO overflow event counter. * * Historically the count of overflow events. Such events may be * reported in the receive descriptors or via interrupts, and may * not correspond one-to-one with dropped packets. * * The recommended interpretation for high speed interfaces is - * number of packets dropped because they did not fit into buffers * provided by the host, e.g. packets larger than MTU or next buffer * in the ring was not available for a scatter transfer. * * Part of aggregate "frame" errors in `/proc/net/dev`. * * This statistics was historically used interchangeably with * @rx_fifo_errors. * * This statistic corresponds to hardware events and is not commonly used * on software devices. * * @rx_crc_errors: Number of packets received with a CRC error. * Part of aggregate "frame" errors in `/proc/net/dev`. * * For IEEE 802.3 devices this counter must be equivalent to: * * - 30.3.1.1.6 aFrameCheckSequenceErrors * * @rx_frame_errors: Receiver frame alignment errors. * Part of aggregate "frame" errors in `/proc/net/dev`. * * For IEEE 802.3 devices this counter should be equivalent to: * * - 30.3.1.1.7 aAlignmentErrors * * @rx_fifo_errors: Receiver FIFO error counter. * * Historically the count of overflow events. Those events may be * reported in the receive descriptors or via interrupts, and may * not correspond one-to-one with dropped packets. * * This statistics was used interchangeably with @rx_over_errors. * Not recommended for use in drivers for high speed interfaces. * * This statistic is used on software devices, e.g. to count software * packet queue overflow (can) or sequencing errors (GRE). * * @rx_missed_errors: Count of packets missed by the host. * Folded into the "drop" counter in `/proc/net/dev`. * * Counts number of packets dropped by the device due to lack * of buffer space. This usually indicates that the host interface * is slower than the network interface, or host is not keeping up * with the receive packet rate. * * This statistic corresponds to hardware events and is not used * on software devices. * * @tx_aborted_errors: * Part of aggregate "carrier" errors in `/proc/net/dev`. * For IEEE 802.3 devices capable of half-duplex operation this counter * must be equivalent to: * * - 30.3.1.1.11 aFramesAbortedDueToXSColls * * High speed interfaces may use this counter as a general device * discard counter. * * @tx_carrier_errors: Number of frame transmission errors due to loss * of carrier during transmission. * Part of aggregate "carrier" errors in `/proc/net/dev`. * * For IEEE 802.3 devices this counter must be equivalent to: * * - 30.3.1.1.13 aCarrierSenseErrors * * @tx_fifo_errors: Number of frame transmission errors due to device * FIFO underrun / underflow. This condition occurs when the device * begins transmission of a frame but is unable to deliver the * entire frame to the transmitter in time for transmission. * Part of aggregate "carrier" errors in `/proc/net/dev`. * * @tx_heartbeat_errors: Number of Heartbeat / SQE Test errors for * old half-duplex Ethernet. * Part of aggregate "carrier" errors in `/proc/net/dev`. * * For IEEE 802.3 devices possibly equivalent to: * * - 30.3.2.1.4 aSQETestErrors * * @tx_window_errors: Number of frame transmission errors due * to late collisions (for Ethernet - after the first 64B of transmission). * Part of aggregate "carrier" errors in `/proc/net/dev`. * * For IEEE 802.3 devices this counter must be equivalent to: * * - 30.3.1.1.10 aLateCollisions * * @rx_compressed: Number of correctly received compressed packets. * This counters is only meaningful for interfaces which support * packet compression (e.g. CSLIP, PPP). * * @tx_compressed: Number of transmitted compressed packets. * This counters is only meaningful for interfaces which support * packet compression (e.g. CSLIP, PPP). * * @rx_nohandler: Number of packets received on the interface * but dropped by the networking stack because the device is * not designated to receive packets (e.g. backup link in a bond). */ struct rtnl_link_stats64 { __u64 rx_packets; __u64 tx_packets; __u64 rx_bytes; __u64 tx_bytes; __u64 rx_errors; __u64 tx_errors; __u64 rx_dropped; __u64 tx_dropped; __u64 multicast; __u64 collisions; /* detailed rx_errors: */ __u64 rx_length_errors; __u64 rx_over_errors; __u64 rx_crc_errors; __u64 rx_frame_errors; __u64 rx_fifo_errors; __u64 rx_missed_errors; /* detailed tx_errors */ __u64 tx_aborted_errors; __u64 tx_carrier_errors; __u64 tx_fifo_errors; __u64 tx_heartbeat_errors; __u64 tx_window_errors; /* for cslip etc */ __u64 rx_compressed; __u64 tx_compressed; __u64 rx_nohandler; }; /* The struct should be in sync with struct ifmap */ struct rtnl_link_ifmap { __u64 mem_start; __u64 mem_end; __u64 base_addr; __u16 irq; __u8 dma; __u8 port; }; /* * IFLA_AF_SPEC * Contains nested attributes for address family specific attributes. * Each address family may create a attribute with the address family * number as type and create its own attribute structure in it. * * Example: * [IFLA_AF_SPEC] = { * [AF_INET] = { * [IFLA_INET_CONF] = ..., * }, * [AF_INET6] = { * [IFLA_INET6_FLAGS] = ..., * [IFLA_INET6_CONF] = ..., * } * } */ enum { IFLA_UNSPEC, IFLA_ADDRESS, IFLA_BROADCAST, IFLA_IFNAME, IFLA_MTU, IFLA_LINK, IFLA_QDISC, IFLA_STATS, IFLA_COST, #define IFLA_COST IFLA_COST IFLA_PRIORITY, #define IFLA_PRIORITY IFLA_PRIORITY IFLA_MASTER, #define IFLA_MASTER IFLA_MASTER IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ #define IFLA_WIRELESS IFLA_WIRELESS IFLA_PROTINFO, /* Protocol specific information for a link */ #define IFLA_PROTINFO IFLA_PROTINFO IFLA_TXQLEN, #define IFLA_TXQLEN IFLA_TXQLEN IFLA_MAP, #define IFLA_MAP IFLA_MAP IFLA_WEIGHT, #define IFLA_WEIGHT IFLA_WEIGHT IFLA_OPERSTATE, IFLA_LINKMODE, IFLA_LINKINFO, #define IFLA_LINKINFO IFLA_LINKINFO IFLA_NET_NS_PID, IFLA_IFALIAS, IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ IFLA_VFINFO_LIST, IFLA_STATS64, IFLA_VF_PORTS, IFLA_PORT_SELF, IFLA_AF_SPEC, IFLA_GROUP, /* Group the device belongs to */ IFLA_NET_NS_FD, IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */ #define IFLA_PROMISCUITY IFLA_PROMISCUITY IFLA_NUM_TX_QUEUES, IFLA_NUM_RX_QUEUES, IFLA_CARRIER, IFLA_PHYS_PORT_ID, IFLA_CARRIER_CHANGES, IFLA_PHYS_SWITCH_ID, IFLA_LINK_NETNSID, IFLA_PHYS_PORT_NAME, IFLA_PROTO_DOWN, IFLA_GSO_MAX_SEGS, IFLA_GSO_MAX_SIZE, IFLA_PAD, IFLA_XDP, IFLA_EVENT, IFLA_NEW_NETNSID, IFLA_IF_NETNSID, IFLA_TARGET_NETNSID = IFLA_IF_NETNSID, /* new alias */ IFLA_CARRIER_UP_COUNT, IFLA_CARRIER_DOWN_COUNT, IFLA_NEW_IFINDEX, IFLA_MIN_MTU, IFLA_MAX_MTU, IFLA_PROP_LIST, IFLA_ALT_IFNAME, /* Alternative ifname */ IFLA_PERM_ADDRESS, __RH_RESERVED_IFLA_PROTO_DOWN_REASON, /* device (sysfs) name as parent, used instead * of IFLA_LINK where there's no parent netdev */ IFLA_PARENT_DEV_NAME, IFLA_PARENT_DEV_BUS_NAME, __IFLA_MAX }; #define IFLA_MAX (__IFLA_MAX - 1) /* backwards compatibility for userspace */ #define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) enum { IFLA_INET_UNSPEC, IFLA_INET_CONF, __IFLA_INET_MAX, }; #define IFLA_INET_MAX (__IFLA_INET_MAX - 1) /* ifi_flags. IFF_* flags. The only change is: IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are more not changeable by user. They describe link media characteristics and set by device driver. Comments: - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid - If neither of these three flags are set; the interface is NBMA. - IFF_MULTICAST does not mean anything special: multicasts can be used on all not-NBMA links. IFF_MULTICAST means that this media uses special encapsulation for multicast frames. Apparently, all IFF_POINTOPOINT and IFF_BROADCAST devices are able to use multicasts too. */ /* IFLA_LINK. For usual devices it is equal ifi_index. If it is a "virtual interface" (f.e. tunnel), ifi_link can point to real physical interface (f.e. for bandwidth calculations), or maybe 0, what means, that real media is unknown (usual for IPIP tunnels, when route to endpoint is allowed to change) */ /* Subtype attributes for IFLA_PROTINFO */ enum { IFLA_INET6_UNSPEC, IFLA_INET6_FLAGS, /* link flags */ IFLA_INET6_CONF, /* sysctl parameters */ IFLA_INET6_STATS, /* statistics */ IFLA_INET6_MCAST, /* MC things. What of them? */ IFLA_INET6_CACHEINFO, /* time values and max reasm size */ IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ IFLA_INET6_TOKEN, /* device token */ IFLA_INET6_ADDR_GEN_MODE, /* implicit address generator mode */ __IFLA_INET6_MAX }; #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) enum in6_addr_gen_mode { IN6_ADDR_GEN_MODE_EUI64, IN6_ADDR_GEN_MODE_NONE, IN6_ADDR_GEN_MODE_STABLE_PRIVACY, IN6_ADDR_GEN_MODE_RANDOM, }; /* Bridge section */ enum { IFLA_BR_UNSPEC, IFLA_BR_FORWARD_DELAY, IFLA_BR_HELLO_TIME, IFLA_BR_MAX_AGE, IFLA_BR_AGEING_TIME, IFLA_BR_STP_STATE, IFLA_BR_PRIORITY, IFLA_BR_VLAN_FILTERING, IFLA_BR_VLAN_PROTOCOL, IFLA_BR_GROUP_FWD_MASK, IFLA_BR_ROOT_ID, IFLA_BR_BRIDGE_ID, IFLA_BR_ROOT_PORT, IFLA_BR_ROOT_PATH_COST, IFLA_BR_TOPOLOGY_CHANGE, IFLA_BR_TOPOLOGY_CHANGE_DETECTED, IFLA_BR_HELLO_TIMER, IFLA_BR_TCN_TIMER, IFLA_BR_TOPOLOGY_CHANGE_TIMER, IFLA_BR_GC_TIMER, IFLA_BR_GROUP_ADDR, IFLA_BR_FDB_FLUSH, IFLA_BR_MCAST_ROUTER, IFLA_BR_MCAST_SNOOPING, IFLA_BR_MCAST_QUERY_USE_IFADDR, IFLA_BR_MCAST_QUERIER, IFLA_BR_MCAST_HASH_ELASTICITY, IFLA_BR_MCAST_HASH_MAX, IFLA_BR_MCAST_LAST_MEMBER_CNT, IFLA_BR_MCAST_STARTUP_QUERY_CNT, IFLA_BR_MCAST_LAST_MEMBER_INTVL, IFLA_BR_MCAST_MEMBERSHIP_INTVL, IFLA_BR_MCAST_QUERIER_INTVL, IFLA_BR_MCAST_QUERY_INTVL, IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, IFLA_BR_MCAST_STARTUP_QUERY_INTVL, IFLA_BR_NF_CALL_IPTABLES, IFLA_BR_NF_CALL_IP6TABLES, IFLA_BR_NF_CALL_ARPTABLES, IFLA_BR_VLAN_DEFAULT_PVID, IFLA_BR_PAD, IFLA_BR_VLAN_STATS_ENABLED, IFLA_BR_MCAST_STATS_ENABLED, IFLA_BR_MCAST_IGMP_VERSION, IFLA_BR_MCAST_MLD_VERSION, IFLA_BR_VLAN_STATS_PER_PORT, IFLA_BR_MULTI_BOOLOPT, IFLA_BR_MCAST_QUERIER_STATE, __IFLA_BR_MAX, }; #define IFLA_BR_MAX (__IFLA_BR_MAX - 1) struct ifla_bridge_id { __u8 prio[2]; __u8 addr[6]; /* ETH_ALEN */ }; enum { BRIDGE_MODE_UNSPEC, BRIDGE_MODE_HAIRPIN, }; enum { IFLA_BRPORT_UNSPEC, IFLA_BRPORT_STATE, /* Spanning tree state */ IFLA_BRPORT_PRIORITY, /* " priority */ IFLA_BRPORT_COST, /* " cost */ IFLA_BRPORT_MODE, /* mode (hairpin) */ IFLA_BRPORT_GUARD, /* bpdu guard */ IFLA_BRPORT_PROTECT, /* root port protection */ IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ IFLA_BRPORT_LEARNING, /* mac learning */ IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ IFLA_BRPORT_PROXYARP, /* proxy ARP */ IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */ IFLA_BRPORT_PROXYARP_WIFI, /* proxy ARP for Wi-Fi */ IFLA_BRPORT_ROOT_ID, /* designated root */ IFLA_BRPORT_BRIDGE_ID, /* designated bridge */ IFLA_BRPORT_DESIGNATED_PORT, IFLA_BRPORT_DESIGNATED_COST, IFLA_BRPORT_ID, IFLA_BRPORT_NO, IFLA_BRPORT_TOPOLOGY_CHANGE_ACK, IFLA_BRPORT_CONFIG_PENDING, IFLA_BRPORT_MESSAGE_AGE_TIMER, IFLA_BRPORT_FORWARD_DELAY_TIMER, IFLA_BRPORT_HOLD_TIMER, IFLA_BRPORT_FLUSH, IFLA_BRPORT_MULTICAST_ROUTER, IFLA_BRPORT_PAD, IFLA_BRPORT_MCAST_FLOOD, IFLA_BRPORT_MCAST_TO_UCAST, IFLA_BRPORT_VLAN_TUNNEL, IFLA_BRPORT_BCAST_FLOOD, IFLA_BRPORT_GROUP_FWD_MASK, IFLA_BRPORT_NEIGH_SUPPRESS, IFLA_BRPORT_ISOLATED, IFLA_BRPORT_BACKUP_PORT, IFLA_BRPORT_MRP_RING_OPEN, IFLA_BRPORT_MRP_IN_OPEN, IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT, IFLA_BRPORT_MCAST_EHT_HOSTS_CNT, IFLA_BRPORT_LOCKED, __IFLA_BRPORT_MAX }; #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) struct ifla_cacheinfo { __u32 max_reasm_len; __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ __u32 reachable_time; __u32 retrans_time; }; enum { IFLA_INFO_UNSPEC, IFLA_INFO_KIND, IFLA_INFO_DATA, IFLA_INFO_XSTATS, IFLA_INFO_SLAVE_KIND, IFLA_INFO_SLAVE_DATA, __IFLA_INFO_MAX, }; #define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) /* VLAN section */ enum { IFLA_VLAN_UNSPEC, IFLA_VLAN_ID, IFLA_VLAN_FLAGS, IFLA_VLAN_EGRESS_QOS, IFLA_VLAN_INGRESS_QOS, IFLA_VLAN_PROTOCOL, __IFLA_VLAN_MAX, }; #define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) struct ifla_vlan_flags { __u32 flags; __u32 mask; }; enum { IFLA_VLAN_QOS_UNSPEC, IFLA_VLAN_QOS_MAPPING, __IFLA_VLAN_QOS_MAX }; #define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) struct ifla_vlan_qos_mapping { __u32 from; __u32 to; }; /* MACVLAN section */ enum { IFLA_MACVLAN_UNSPEC, IFLA_MACVLAN_MODE, IFLA_MACVLAN_FLAGS, IFLA_MACVLAN_MACADDR_MODE, IFLA_MACVLAN_MACADDR, IFLA_MACVLAN_MACADDR_DATA, IFLA_MACVLAN_MACADDR_COUNT, IFLA_MACVLAN_BC_QUEUE_LEN, IFLA_MACVLAN_BC_QUEUE_LEN_USED, IFLA_MACVLAN_BC_CUTOFF, __IFLA_MACVLAN_MAX, }; #define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1) enum macvlan_mode { MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */ MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ MACVLAN_MODE_SOURCE = 16,/* use source MAC address list to assign */ }; enum macvlan_macaddr_mode { MACVLAN_MACADDR_ADD, MACVLAN_MACADDR_DEL, MACVLAN_MACADDR_FLUSH, MACVLAN_MACADDR_SET, }; #define MACVLAN_FLAG_NOPROMISC 1 /* VRF section */ enum { IFLA_VRF_UNSPEC, IFLA_VRF_TABLE, __IFLA_VRF_MAX }; #define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1) enum { IFLA_VRF_PORT_UNSPEC, IFLA_VRF_PORT_TABLE, __IFLA_VRF_PORT_MAX }; #define IFLA_VRF_PORT_MAX (__IFLA_VRF_PORT_MAX - 1) /* MACSEC section */ enum { IFLA_MACSEC_UNSPEC, IFLA_MACSEC_SCI, IFLA_MACSEC_PORT, IFLA_MACSEC_ICV_LEN, IFLA_MACSEC_CIPHER_SUITE, IFLA_MACSEC_WINDOW, IFLA_MACSEC_ENCODING_SA, IFLA_MACSEC_ENCRYPT, IFLA_MACSEC_PROTECT, IFLA_MACSEC_INC_SCI, IFLA_MACSEC_ES, IFLA_MACSEC_SCB, IFLA_MACSEC_REPLAY_PROTECT, IFLA_MACSEC_VALIDATION, IFLA_MACSEC_PAD, __IFLA_MACSEC_MAX, }; #define IFLA_MACSEC_MAX (__IFLA_MACSEC_MAX - 1) /* XFRM section */ enum { IFLA_XFRM_UNSPEC, IFLA_XFRM_LINK, IFLA_XFRM_IF_ID, __IFLA_XFRM_MAX }; #define IFLA_XFRM_MAX (__IFLA_XFRM_MAX - 1) enum macsec_validation_type { MACSEC_VALIDATE_DISABLED = 0, MACSEC_VALIDATE_CHECK = 1, MACSEC_VALIDATE_STRICT = 2, __MACSEC_VALIDATE_END, MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1, }; /* IPVLAN section */ enum { IFLA_IPVLAN_UNSPEC, IFLA_IPVLAN_MODE, IFLA_IPVLAN_FLAGS, __IFLA_IPVLAN_MAX }; #define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1) enum ipvlan_mode { IPVLAN_MODE_L2 = 0, IPVLAN_MODE_L3, IPVLAN_MODE_L3S, IPVLAN_MODE_MAX }; #define IPVLAN_F_PRIVATE 0x01 #define IPVLAN_F_VEPA 0x02 /* VXLAN section */ enum { IFLA_VXLAN_UNSPEC, IFLA_VXLAN_ID, IFLA_VXLAN_GROUP, /* group or remote address */ IFLA_VXLAN_LINK, IFLA_VXLAN_LOCAL, IFLA_VXLAN_TTL, IFLA_VXLAN_TOS, IFLA_VXLAN_LEARNING, IFLA_VXLAN_AGEING, IFLA_VXLAN_LIMIT, IFLA_VXLAN_PORT_RANGE, /* source port */ IFLA_VXLAN_PROXY, IFLA_VXLAN_RSC, IFLA_VXLAN_L2MISS, IFLA_VXLAN_L3MISS, IFLA_VXLAN_PORT, /* destination port */ IFLA_VXLAN_GROUP6, IFLA_VXLAN_LOCAL6, IFLA_VXLAN_UDP_CSUM, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, IFLA_VXLAN_REMCSUM_TX, IFLA_VXLAN_REMCSUM_RX, IFLA_VXLAN_GBP, IFLA_VXLAN_REMCSUM_NOPARTIAL, IFLA_VXLAN_COLLECT_METADATA, IFLA_VXLAN_LABEL, IFLA_VXLAN_GPE, IFLA_VXLAN_TTL_INHERIT, IFLA_VXLAN_DF, __IFLA_VXLAN_MAX }; #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) struct ifla_vxlan_port_range { __be16 low; __be16 high; }; enum ifla_vxlan_df { VXLAN_DF_UNSET = 0, VXLAN_DF_SET, VXLAN_DF_INHERIT, __VXLAN_DF_END, VXLAN_DF_MAX = __VXLAN_DF_END - 1, }; /* GENEVE section */ enum { IFLA_GENEVE_UNSPEC, IFLA_GENEVE_ID, IFLA_GENEVE_REMOTE, IFLA_GENEVE_TTL, IFLA_GENEVE_TOS, IFLA_GENEVE_PORT, /* destination port */ IFLA_GENEVE_COLLECT_METADATA, IFLA_GENEVE_REMOTE6, IFLA_GENEVE_UDP_CSUM, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, IFLA_GENEVE_LABEL, IFLA_GENEVE_TTL_INHERIT, IFLA_GENEVE_DF, __IFLA_GENEVE_MAX }; #define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) enum ifla_geneve_df { GENEVE_DF_UNSET = 0, GENEVE_DF_SET, GENEVE_DF_INHERIT, __GENEVE_DF_END, GENEVE_DF_MAX = __GENEVE_DF_END - 1, }; /* Bareudp section */ enum { IFLA_BAREUDP_UNSPEC, IFLA_BAREUDP_PORT, IFLA_BAREUDP_ETHERTYPE, IFLA_BAREUDP_SRCPORT_MIN, IFLA_BAREUDP_MULTIPROTO_MODE, __IFLA_BAREUDP_MAX }; #define IFLA_BAREUDP_MAX (__IFLA_BAREUDP_MAX - 1) /* PPP section */ enum { IFLA_PPP_UNSPEC, IFLA_PPP_DEV_FD, __IFLA_PPP_MAX }; #define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1) /* GTP section */ enum ifla_gtp_role { GTP_ROLE_GGSN = 0, GTP_ROLE_SGSN, }; enum { IFLA_GTP_UNSPEC, IFLA_GTP_FD0, IFLA_GTP_FD1, IFLA_GTP_PDP_HASHSIZE, IFLA_GTP_ROLE, __IFLA_GTP_MAX, }; #define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1) /* Bonding section */ enum { IFLA_BOND_UNSPEC, IFLA_BOND_MODE, IFLA_BOND_ACTIVE_SLAVE, IFLA_BOND_MIIMON, IFLA_BOND_UPDELAY, IFLA_BOND_DOWNDELAY, IFLA_BOND_USE_CARRIER, IFLA_BOND_ARP_INTERVAL, IFLA_BOND_ARP_IP_TARGET, IFLA_BOND_ARP_VALIDATE, IFLA_BOND_ARP_ALL_TARGETS, IFLA_BOND_PRIMARY, IFLA_BOND_PRIMARY_RESELECT, IFLA_BOND_FAIL_OVER_MAC, IFLA_BOND_XMIT_HASH_POLICY, IFLA_BOND_RESEND_IGMP, IFLA_BOND_NUM_PEER_NOTIF, IFLA_BOND_ALL_SLAVES_ACTIVE, IFLA_BOND_MIN_LINKS, IFLA_BOND_LP_INTERVAL, IFLA_BOND_PACKETS_PER_SLAVE, IFLA_BOND_AD_LACP_RATE, IFLA_BOND_AD_SELECT, IFLA_BOND_AD_INFO, IFLA_BOND_AD_ACTOR_SYS_PRIO, IFLA_BOND_AD_USER_PORT_KEY, IFLA_BOND_AD_ACTOR_SYSTEM, IFLA_BOND_TLB_DYNAMIC_LB, IFLA_BOND_PEER_NOTIF_DELAY, IFLA_BOND_AD_LACP_ACTIVE, __IFLA_BOND_MAX, }; #define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1) enum { IFLA_BOND_AD_INFO_UNSPEC, IFLA_BOND_AD_INFO_AGGREGATOR, IFLA_BOND_AD_INFO_NUM_PORTS, IFLA_BOND_AD_INFO_ACTOR_KEY, IFLA_BOND_AD_INFO_PARTNER_KEY, IFLA_BOND_AD_INFO_PARTNER_MAC, __IFLA_BOND_AD_INFO_MAX, }; #define IFLA_BOND_AD_INFO_MAX (__IFLA_BOND_AD_INFO_MAX - 1) enum { IFLA_BOND_SLAVE_UNSPEC, IFLA_BOND_SLAVE_STATE, IFLA_BOND_SLAVE_MII_STATUS, IFLA_BOND_SLAVE_LINK_FAILURE_COUNT, IFLA_BOND_SLAVE_PERM_HWADDR, IFLA_BOND_SLAVE_QUEUE_ID, IFLA_BOND_SLAVE_AD_AGGREGATOR_ID, IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE, __IFLA_BOND_SLAVE_MAX, }; #define IFLA_BOND_SLAVE_MAX (__IFLA_BOND_SLAVE_MAX - 1) /* SR-IOV virtual function management section */ enum { IFLA_VF_INFO_UNSPEC, IFLA_VF_INFO, __IFLA_VF_INFO_MAX, }; #define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1) enum { IFLA_VF_UNSPEC, IFLA_VF_MAC, /* Hardware queue specific attributes */ IFLA_VF_VLAN, /* VLAN ID and QoS */ IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */ IFLA_VF_RSS_QUERY_EN, /* RSS Redirection Table and Hash Key query * on/off switch */ IFLA_VF_STATS, /* network device statistics */ IFLA_VF_TRUST, /* Trust VF */ IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ IFLA_VF_BROADCAST, /* VF broadcast */ __IFLA_VF_MAX, }; #define IFLA_VF_MAX (__IFLA_VF_MAX - 1) struct ifla_vf_mac { __u32 vf; __u8 mac[32]; /* MAX_ADDR_LEN */ }; struct ifla_vf_broadcast { __u8 broadcast[32]; }; struct ifla_vf_vlan { __u32 vf; __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ __u32 qos; }; enum { IFLA_VF_VLAN_INFO_UNSPEC, IFLA_VF_VLAN_INFO, /* VLAN ID, QoS and VLAN protocol */ __IFLA_VF_VLAN_INFO_MAX, }; #define IFLA_VF_VLAN_INFO_MAX (__IFLA_VF_VLAN_INFO_MAX - 1) #define MAX_VLAN_LIST_LEN 1 struct ifla_vf_vlan_info { __u32 vf; __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ __u32 qos; __be16 vlan_proto; /* VLAN protocol either 802.1Q or 802.1ad */ }; struct ifla_vf_tx_rate { __u32 vf; __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ }; struct ifla_vf_rate { __u32 vf; __u32 min_tx_rate; /* Min Bandwidth in Mbps */ __u32 max_tx_rate; /* Max Bandwidth in Mbps */ }; struct ifla_vf_spoofchk { __u32 vf; __u32 setting; }; struct ifla_vf_guid { __u32 vf; __u64 guid; }; enum { IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */ IFLA_VF_LINK_STATE_ENABLE, /* link always up */ IFLA_VF_LINK_STATE_DISABLE, /* link always down */ __IFLA_VF_LINK_STATE_MAX, }; struct ifla_vf_link_state { __u32 vf; __u32 link_state; }; struct ifla_vf_rss_query_en { __u32 vf; __u32 setting; }; enum { IFLA_VF_STATS_RX_PACKETS, IFLA_VF_STATS_TX_PACKETS, IFLA_VF_STATS_RX_BYTES, IFLA_VF_STATS_TX_BYTES, IFLA_VF_STATS_BROADCAST, IFLA_VF_STATS_MULTICAST, IFLA_VF_STATS_PAD, IFLA_VF_STATS_RX_DROPPED, IFLA_VF_STATS_TX_DROPPED, __IFLA_VF_STATS_MAX, }; #define IFLA_VF_STATS_MAX (__IFLA_VF_STATS_MAX - 1) struct ifla_vf_trust { __u32 vf; __u32 setting; }; /* VF ports management section * * Nested layout of set/get msg is: * * [IFLA_NUM_VF] * [IFLA_VF_PORTS] * [IFLA_VF_PORT] * [IFLA_PORT_*], ... * [IFLA_VF_PORT] * [IFLA_PORT_*], ... * ... * [IFLA_PORT_SELF] * [IFLA_PORT_*], ... */ enum { IFLA_VF_PORT_UNSPEC, IFLA_VF_PORT, /* nest */ __IFLA_VF_PORT_MAX, }; #define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1) enum { IFLA_PORT_UNSPEC, IFLA_PORT_VF, /* __u32 */ IFLA_PORT_PROFILE, /* string */ IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */ IFLA_PORT_INSTANCE_UUID, /* binary UUID */ IFLA_PORT_HOST_UUID, /* binary UUID */ IFLA_PORT_REQUEST, /* __u8 */ IFLA_PORT_RESPONSE, /* __u16, output only */ __IFLA_PORT_MAX, }; #define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1) #define PORT_PROFILE_MAX 40 #define PORT_UUID_MAX 16 #define PORT_SELF_VF -1 enum { PORT_REQUEST_PREASSOCIATE = 0, PORT_REQUEST_PREASSOCIATE_RR, PORT_REQUEST_ASSOCIATE, PORT_REQUEST_DISASSOCIATE, }; enum { PORT_VDP_RESPONSE_SUCCESS = 0, PORT_VDP_RESPONSE_INVALID_FORMAT, PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES, PORT_VDP_RESPONSE_UNUSED_VTID, PORT_VDP_RESPONSE_VTID_VIOLATION, PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION, PORT_VDP_RESPONSE_OUT_OF_SYNC, /* 0x08-0xFF reserved for future VDP use */ PORT_PROFILE_RESPONSE_SUCCESS = 0x100, PORT_PROFILE_RESPONSE_INPROGRESS, PORT_PROFILE_RESPONSE_INVALID, PORT_PROFILE_RESPONSE_BADSTATE, PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES, PORT_PROFILE_RESPONSE_ERROR, }; struct ifla_port_vsi { __u8 vsi_mgr_id; __u8 vsi_type_id[3]; __u8 vsi_type_version; __u8 pad[3]; }; /* IPoIB section */ enum { IFLA_IPOIB_UNSPEC, IFLA_IPOIB_PKEY, IFLA_IPOIB_MODE, IFLA_IPOIB_UMCAST, __IFLA_IPOIB_MAX }; enum { IPOIB_MODE_DATAGRAM = 0, /* using unreliable datagram QPs */ IPOIB_MODE_CONNECTED = 1, /* using connected QPs */ }; #define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1) /* HSR section */ enum { IFLA_HSR_UNSPEC, IFLA_HSR_SLAVE1, IFLA_HSR_SLAVE2, IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */ IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */ IFLA_HSR_SEQ_NR, IFLA_HSR_VERSION, /* HSR version */ __IFLA_HSR_MAX, }; #define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1) /* STATS section */ struct if_stats_msg { __u8 family; __u8 pad1; __u16 pad2; __u32 ifindex; __u32 filter_mask; }; /* A stats attribute can be netdev specific or a global stat. * For netdev stats, lets use the prefix IFLA_STATS_LINK_* */ enum { IFLA_STATS_UNSPEC, /* also used as 64bit pad attribute */ IFLA_STATS_LINK_64, IFLA_STATS_LINK_XSTATS, IFLA_STATS_LINK_XSTATS_SLAVE, IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_STATS_AF_SPEC, __IFLA_STATS_MAX, }; #define IFLA_STATS_MAX (__IFLA_STATS_MAX - 1) #define IFLA_STATS_FILTER_BIT(ATTR) (1 << (ATTR - 1)) /* These are embedded into IFLA_STATS_LINK_XSTATS: * [IFLA_STATS_LINK_XSTATS] * -> [LINK_XSTATS_TYPE_xxx] * -> [rtnl link type specific attributes] */ enum { LINK_XSTATS_TYPE_UNSPEC, LINK_XSTATS_TYPE_BRIDGE, LINK_XSTATS_TYPE_BOND, __LINK_XSTATS_TYPE_MAX }; #define LINK_XSTATS_TYPE_MAX (__LINK_XSTATS_TYPE_MAX - 1) /* These are stats embedded into IFLA_STATS_LINK_OFFLOAD_XSTATS */ enum { IFLA_OFFLOAD_XSTATS_UNSPEC, IFLA_OFFLOAD_XSTATS_CPU_HIT, /* struct rtnl_link_stats64 */ __IFLA_OFFLOAD_XSTATS_MAX }; #define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1) /* XDP section */ #define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) #define XDP_FLAGS_SKB_MODE (1U << 1) #define XDP_FLAGS_DRV_MODE (1U << 2) #define XDP_FLAGS_HW_MODE (1U << 3) #define XDP_FLAGS_REPLACE (1U << 4) #define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \ XDP_FLAGS_DRV_MODE | \ XDP_FLAGS_HW_MODE) #define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ XDP_FLAGS_MODES | XDP_FLAGS_REPLACE) /* These are stored into IFLA_XDP_ATTACHED on dump. */ enum { XDP_ATTACHED_NONE = 0, XDP_ATTACHED_DRV, XDP_ATTACHED_SKB, XDP_ATTACHED_HW, XDP_ATTACHED_MULTI, }; enum { IFLA_XDP_UNSPEC, IFLA_XDP_FD, IFLA_XDP_ATTACHED, IFLA_XDP_FLAGS, IFLA_XDP_PROG_ID, IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID, IFLA_XDP_EXPECTED_FD, __IFLA_XDP_MAX, }; #define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1) enum { IFLA_EVENT_NONE, IFLA_EVENT_REBOOT, /* internal reset / reboot */ IFLA_EVENT_FEATURES, /* change in offload features */ IFLA_EVENT_BONDING_FAILOVER, /* change in active slave */ IFLA_EVENT_NOTIFY_PEERS, /* re-sent grat. arp/ndisc */ IFLA_EVENT_IGMP_RESEND, /* re-sent IGMP JOIN */ IFLA_EVENT_BONDING_OPTIONS, /* change in bonding options */ }; /* tun section */ enum { IFLA_TUN_UNSPEC, IFLA_TUN_OWNER, IFLA_TUN_GROUP, IFLA_TUN_TYPE, IFLA_TUN_PI, IFLA_TUN_VNET_HDR, IFLA_TUN_PERSIST, IFLA_TUN_MULTI_QUEUE, IFLA_TUN_NUM_QUEUES, IFLA_TUN_NUM_DISABLED_QUEUES, __IFLA_TUN_MAX, }; #define IFLA_TUN_MAX (__IFLA_TUN_MAX - 1) /* rmnet section */ #define RMNET_FLAGS_INGRESS_DEAGGREGATION (1U << 0) #define RMNET_FLAGS_INGRESS_MAP_COMMANDS (1U << 1) #define RMNET_FLAGS_INGRESS_MAP_CKSUMV4 (1U << 2) #define RMNET_FLAGS_EGRESS_MAP_CKSUMV4 (1U << 3) enum { IFLA_RMNET_UNSPEC, IFLA_RMNET_MUX_ID, IFLA_RMNET_FLAGS, __IFLA_RMNET_MAX, }; #define IFLA_RMNET_MAX (__IFLA_RMNET_MAX - 1) struct ifla_rmnet_flags { __u32 flags; __u32 mask; }; #endif /* _LINUX_IF_LINK_H */ linux/if_ltalk.h 0000644 00000000322 15063602050 0007633 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_LTALK_H #define __LINUX_LTALK_H #define LTALK_HLEN 1 #define LTALK_MTU 600 #define LTALK_ALEN 1 #endif /* __LINUX_LTALK_H */ linux/if_macsec.h 0000644 00000013310 15063602050 0007760 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/uapi/linux/if_macsec.h - MACsec device * * Copyright (c) 2015 Sabrina Dubroca <sd@queasysnail.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef _MACSEC_H #define _MACSEC_H #include <linux/types.h> #define MACSEC_GENL_NAME "macsec" #define MACSEC_GENL_VERSION 1 #define MACSEC_MAX_KEY_LEN 128 #define MACSEC_KEYID_LEN 16 /* cipher IDs as per IEEE802.1AEbn-2011 */ #define MACSEC_CIPHER_ID_GCM_AES_128 0x0080C20001000001ULL #define MACSEC_CIPHER_ID_GCM_AES_256 0x0080C20001000002ULL /* deprecated cipher ID for GCM-AES-128 */ #define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL #define MACSEC_DEFAULT_CIPHER_ALT MACSEC_CIPHER_ID_GCM_AES_128 #define MACSEC_MIN_ICV_LEN 8 #define MACSEC_MAX_ICV_LEN 32 /* upper limit for ICV length as recommended by IEEE802.1AE-2006 */ #define MACSEC_STD_ICV_LEN 16 enum macsec_attrs { MACSEC_ATTR_UNSPEC, MACSEC_ATTR_IFINDEX, /* u32, ifindex of the MACsec netdevice */ MACSEC_ATTR_RXSC_CONFIG, /* config, nested macsec_rxsc_attrs */ MACSEC_ATTR_SA_CONFIG, /* config, nested macsec_sa_attrs */ MACSEC_ATTR_SECY, /* dump, nested macsec_secy_attrs */ MACSEC_ATTR_TXSA_LIST, /* dump, nested, macsec_sa_attrs for each TXSA */ MACSEC_ATTR_RXSC_LIST, /* dump, nested, macsec_rxsc_attrs for each RXSC */ MACSEC_ATTR_TXSC_STATS, /* dump, nested, macsec_txsc_stats_attr */ MACSEC_ATTR_SECY_STATS, /* dump, nested, macsec_secy_stats_attr */ __MACSEC_ATTR_END, NUM_MACSEC_ATTR = __MACSEC_ATTR_END, MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1, }; enum macsec_secy_attrs { MACSEC_SECY_ATTR_UNSPEC, MACSEC_SECY_ATTR_SCI, MACSEC_SECY_ATTR_ENCODING_SA, MACSEC_SECY_ATTR_WINDOW, MACSEC_SECY_ATTR_CIPHER_SUITE, MACSEC_SECY_ATTR_ICV_LEN, MACSEC_SECY_ATTR_PROTECT, MACSEC_SECY_ATTR_REPLAY, MACSEC_SECY_ATTR_OPER, MACSEC_SECY_ATTR_VALIDATE, MACSEC_SECY_ATTR_ENCRYPT, MACSEC_SECY_ATTR_INC_SCI, MACSEC_SECY_ATTR_ES, MACSEC_SECY_ATTR_SCB, MACSEC_SECY_ATTR_PAD, __MACSEC_SECY_ATTR_END, NUM_MACSEC_SECY_ATTR = __MACSEC_SECY_ATTR_END, MACSEC_SECY_ATTR_MAX = __MACSEC_SECY_ATTR_END - 1, }; enum macsec_rxsc_attrs { MACSEC_RXSC_ATTR_UNSPEC, MACSEC_RXSC_ATTR_SCI, /* config/dump, u64 */ MACSEC_RXSC_ATTR_ACTIVE, /* config/dump, u8 0..1 */ MACSEC_RXSC_ATTR_SA_LIST, /* dump, nested */ MACSEC_RXSC_ATTR_STATS, /* dump, nested, macsec_rxsc_stats_attr */ MACSEC_RXSC_ATTR_PAD, __MACSEC_RXSC_ATTR_END, NUM_MACSEC_RXSC_ATTR = __MACSEC_RXSC_ATTR_END, MACSEC_RXSC_ATTR_MAX = __MACSEC_RXSC_ATTR_END - 1, }; enum macsec_sa_attrs { MACSEC_SA_ATTR_UNSPEC, MACSEC_SA_ATTR_AN, /* config/dump, u8 0..3 */ MACSEC_SA_ATTR_ACTIVE, /* config/dump, u8 0..1 */ MACSEC_SA_ATTR_PN, /* config/dump, u32 */ MACSEC_SA_ATTR_KEY, /* config, data */ MACSEC_SA_ATTR_KEYID, /* config/dump, 128-bit */ MACSEC_SA_ATTR_STATS, /* dump, nested, macsec_sa_stats_attr */ MACSEC_SA_ATTR_PAD, __MACSEC_SA_ATTR_END, NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END, MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1, }; enum macsec_nl_commands { MACSEC_CMD_GET_TXSC, MACSEC_CMD_ADD_RXSC, MACSEC_CMD_DEL_RXSC, MACSEC_CMD_UPD_RXSC, MACSEC_CMD_ADD_TXSA, MACSEC_CMD_DEL_TXSA, MACSEC_CMD_UPD_TXSA, MACSEC_CMD_ADD_RXSA, MACSEC_CMD_DEL_RXSA, MACSEC_CMD_UPD_RXSA, }; /* u64 per-RXSC stats */ enum macsec_rxsc_stats_attr { MACSEC_RXSC_STATS_ATTR_UNSPEC, MACSEC_RXSC_STATS_ATTR_IN_OCTETS_VALIDATED, MACSEC_RXSC_STATS_ATTR_IN_OCTETS_DECRYPTED, MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNCHECKED, MACSEC_RXSC_STATS_ATTR_IN_PKTS_DELAYED, MACSEC_RXSC_STATS_ATTR_IN_PKTS_OK, MACSEC_RXSC_STATS_ATTR_IN_PKTS_INVALID, MACSEC_RXSC_STATS_ATTR_IN_PKTS_LATE, MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_VALID, MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_USING_SA, MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNUSED_SA, MACSEC_RXSC_STATS_ATTR_PAD, __MACSEC_RXSC_STATS_ATTR_END, NUM_MACSEC_RXSC_STATS_ATTR = __MACSEC_RXSC_STATS_ATTR_END, MACSEC_RXSC_STATS_ATTR_MAX = __MACSEC_RXSC_STATS_ATTR_END - 1, }; /* u32 per-{RX,TX}SA stats */ enum macsec_sa_stats_attr { MACSEC_SA_STATS_ATTR_UNSPEC, MACSEC_SA_STATS_ATTR_IN_PKTS_OK, MACSEC_SA_STATS_ATTR_IN_PKTS_INVALID, MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_VALID, MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_USING_SA, MACSEC_SA_STATS_ATTR_IN_PKTS_UNUSED_SA, MACSEC_SA_STATS_ATTR_OUT_PKTS_PROTECTED, MACSEC_SA_STATS_ATTR_OUT_PKTS_ENCRYPTED, __MACSEC_SA_STATS_ATTR_END, NUM_MACSEC_SA_STATS_ATTR = __MACSEC_SA_STATS_ATTR_END, MACSEC_SA_STATS_ATTR_MAX = __MACSEC_SA_STATS_ATTR_END - 1, }; /* u64 per-TXSC stats */ enum macsec_txsc_stats_attr { MACSEC_TXSC_STATS_ATTR_UNSPEC, MACSEC_TXSC_STATS_ATTR_OUT_PKTS_PROTECTED, MACSEC_TXSC_STATS_ATTR_OUT_PKTS_ENCRYPTED, MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_PROTECTED, MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_ENCRYPTED, MACSEC_TXSC_STATS_ATTR_PAD, __MACSEC_TXSC_STATS_ATTR_END, NUM_MACSEC_TXSC_STATS_ATTR = __MACSEC_TXSC_STATS_ATTR_END, MACSEC_TXSC_STATS_ATTR_MAX = __MACSEC_TXSC_STATS_ATTR_END - 1, }; /* u64 per-SecY stats */ enum macsec_secy_stats_attr { MACSEC_SECY_STATS_ATTR_UNSPEC, MACSEC_SECY_STATS_ATTR_OUT_PKTS_UNTAGGED, MACSEC_SECY_STATS_ATTR_IN_PKTS_UNTAGGED, MACSEC_SECY_STATS_ATTR_OUT_PKTS_TOO_LONG, MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_TAG, MACSEC_SECY_STATS_ATTR_IN_PKTS_BAD_TAG, MACSEC_SECY_STATS_ATTR_IN_PKTS_UNKNOWN_SCI, MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_SCI, MACSEC_SECY_STATS_ATTR_IN_PKTS_OVERRUN, MACSEC_SECY_STATS_ATTR_PAD, __MACSEC_SECY_STATS_ATTR_END, NUM_MACSEC_SECY_STATS_ATTR = __MACSEC_SECY_STATS_ATTR_END, MACSEC_SECY_STATS_ATTR_MAX = __MACSEC_SECY_STATS_ATTR_END - 1, }; #endif /* _MACSEC_H */ linux/if_packet.h 0000644 00000017357 15063602050 0010013 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_IF_PACKET_H #define __LINUX_IF_PACKET_H #include <linux/types.h> struct sockaddr_pkt { unsigned short spkt_family; unsigned char spkt_device[14]; __be16 spkt_protocol; }; struct sockaddr_ll { unsigned short sll_family; __be16 sll_protocol; int sll_ifindex; unsigned short sll_hatype; unsigned char sll_pkttype; unsigned char sll_halen; unsigned char sll_addr[8]; }; /* Packet types */ #define PACKET_HOST 0 /* To us */ #define PACKET_BROADCAST 1 /* To all */ #define PACKET_MULTICAST 2 /* To group */ #define PACKET_OTHERHOST 3 /* To someone else */ #define PACKET_OUTGOING 4 /* Outgoing of any type */ #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ #define PACKET_USER 6 /* To user space */ #define PACKET_KERNEL 7 /* To kernel space */ /* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ #define PACKET_FASTROUTE 6 /* Fastrouted frame */ /* Packet socket options */ #define PACKET_ADD_MEMBERSHIP 1 #define PACKET_DROP_MEMBERSHIP 2 #define PACKET_RECV_OUTPUT 3 /* Value 4 is still used by obsolete turbo-packet. */ #define PACKET_RX_RING 5 #define PACKET_STATISTICS 6 #define PACKET_COPY_THRESH 7 #define PACKET_AUXDATA 8 #define PACKET_ORIGDEV 9 #define PACKET_VERSION 10 #define PACKET_HDRLEN 11 #define PACKET_RESERVE 12 #define PACKET_TX_RING 13 #define PACKET_LOSS 14 #define PACKET_VNET_HDR 15 #define PACKET_TX_TIMESTAMP 16 #define PACKET_TIMESTAMP 17 #define PACKET_FANOUT 18 #define PACKET_TX_HAS_OFF 19 #define PACKET_QDISC_BYPASS 20 #define PACKET_ROLLOVER_STATS 21 #define PACKET_FANOUT_DATA 22 #define PACKET_FANOUT_HASH 0 #define PACKET_FANOUT_LB 1 #define PACKET_FANOUT_CPU 2 #define PACKET_FANOUT_ROLLOVER 3 #define PACKET_FANOUT_RND 4 #define PACKET_FANOUT_QM 5 #define PACKET_FANOUT_CBPF 6 #define PACKET_FANOUT_EBPF 7 #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 #define PACKET_FANOUT_FLAG_UNIQUEID 0x2000 #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 struct tpacket_stats { unsigned int tp_packets; unsigned int tp_drops; }; struct tpacket_stats_v3 { unsigned int tp_packets; unsigned int tp_drops; unsigned int tp_freeze_q_cnt; }; struct tpacket_rollover_stats { __aligned_u64 tp_all; __aligned_u64 tp_huge; __aligned_u64 tp_failed; }; union tpacket_stats_u { struct tpacket_stats stats1; struct tpacket_stats_v3 stats3; }; struct tpacket_auxdata { __u32 tp_status; __u32 tp_len; __u32 tp_snaplen; __u16 tp_mac; __u16 tp_net; __u16 tp_vlan_tci; __u16 tp_vlan_tpid; }; /* Rx ring - header status */ #define TP_STATUS_KERNEL 0 #define TP_STATUS_USER (1 << 0) #define TP_STATUS_COPY (1 << 1) #define TP_STATUS_LOSING (1 << 2) #define TP_STATUS_CSUMNOTREADY (1 << 3) #define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */ #define TP_STATUS_BLK_TMO (1 << 5) #define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */ #define TP_STATUS_CSUM_VALID (1 << 7) /* Tx ring - header status */ #define TP_STATUS_AVAILABLE 0 #define TP_STATUS_SEND_REQUEST (1 << 0) #define TP_STATUS_SENDING (1 << 1) #define TP_STATUS_WRONG_FORMAT (1 << 2) /* Rx and Tx ring - header status */ #define TP_STATUS_TS_SOFTWARE (1 << 29) #define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */ #define TP_STATUS_TS_RAW_HARDWARE (1 << 31) /* Rx ring - feature request bits */ #define TP_FT_REQ_FILL_RXHASH 0x1 struct tpacket_hdr { unsigned long tp_status; unsigned int tp_len; unsigned int tp_snaplen; unsigned short tp_mac; unsigned short tp_net; unsigned int tp_sec; unsigned int tp_usec; }; #define TPACKET_ALIGNMENT 16 #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) struct tpacket2_hdr { __u32 tp_status; __u32 tp_len; __u32 tp_snaplen; __u16 tp_mac; __u16 tp_net; __u32 tp_sec; __u32 tp_nsec; __u16 tp_vlan_tci; __u16 tp_vlan_tpid; __u8 tp_padding[4]; }; struct tpacket_hdr_variant1 { __u32 tp_rxhash; __u32 tp_vlan_tci; __u16 tp_vlan_tpid; __u16 tp_padding; }; struct tpacket3_hdr { __u32 tp_next_offset; __u32 tp_sec; __u32 tp_nsec; __u32 tp_snaplen; __u32 tp_len; __u32 tp_status; __u16 tp_mac; __u16 tp_net; /* pkt_hdr variants */ union { struct tpacket_hdr_variant1 hv1; }; __u8 tp_padding[8]; }; struct tpacket_bd_ts { unsigned int ts_sec; union { unsigned int ts_usec; unsigned int ts_nsec; }; }; struct tpacket_hdr_v1 { __u32 block_status; __u32 num_pkts; __u32 offset_to_first_pkt; /* Number of valid bytes (including padding) * blk_len <= tp_block_size */ __u32 blk_len; /* * Quite a few uses of sequence number: * 1. Make sure cache flush etc worked. * Well, one can argue - why not use the increasing ts below? * But look at 2. below first. * 2. When you pass around blocks to other user space decoders, * you can see which blk[s] is[are] outstanding etc. * 3. Validate kernel code. */ __aligned_u64 seq_num; /* * ts_last_pkt: * * Case 1. Block has 'N'(N >=1) packets and TMO'd(timed out) * ts_last_pkt == 'time-stamp of last packet' and NOT the * time when the timer fired and the block was closed. * By providing the ts of the last packet we can absolutely * guarantee that time-stamp wise, the first packet in the * next block will never precede the last packet of the * previous block. * Case 2. Block has zero packets and TMO'd * ts_last_pkt = time when the timer fired and the block * was closed. * Case 3. Block has 'N' packets and NO TMO. * ts_last_pkt = time-stamp of the last pkt in the block. * * ts_first_pkt: * Is always the time-stamp when the block was opened. * Case a) ZERO packets * No packets to deal with but atleast you know the * time-interval of this block. * Case b) Non-zero packets * Use the ts of the first packet in the block. * */ struct tpacket_bd_ts ts_first_pkt, ts_last_pkt; }; union tpacket_bd_header_u { struct tpacket_hdr_v1 bh1; }; struct tpacket_block_desc { __u32 version; __u32 offset_to_priv; union tpacket_bd_header_u hdr; }; #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) #define TPACKET3_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll)) enum tpacket_versions { TPACKET_V1, TPACKET_V2, TPACKET_V3 }; /* Frame structure: - Start. Frame must be aligned to TPACKET_ALIGNMENT=16 - struct tpacket_hdr - pad to TPACKET_ALIGNMENT=16 - struct sockaddr_ll - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 - Start+tp_mac: [ Optional MAC header ] - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. - Pad to align to TPACKET_ALIGNMENT=16 */ struct tpacket_req { unsigned int tp_block_size; /* Minimal size of contiguous block */ unsigned int tp_block_nr; /* Number of blocks */ unsigned int tp_frame_size; /* Size of frame */ unsigned int tp_frame_nr; /* Total number of frames */ }; struct tpacket_req3 { unsigned int tp_block_size; /* Minimal size of contiguous block */ unsigned int tp_block_nr; /* Number of blocks */ unsigned int tp_frame_size; /* Size of frame */ unsigned int tp_frame_nr; /* Total number of frames */ unsigned int tp_retire_blk_tov; /* timeout in msecs */ unsigned int tp_sizeof_priv; /* offset to private data area */ unsigned int tp_feature_req_word; }; union tpacket_req_u { struct tpacket_req req; struct tpacket_req3 req3; }; struct packet_mreq { int mr_ifindex; unsigned short mr_type; unsigned short mr_alen; unsigned char mr_address[8]; }; #define PACKET_MR_MULTICAST 0 #define PACKET_MR_PROMISC 1 #define PACKET_MR_ALLMULTI 2 #define PACKET_MR_UNICAST 3 #endif linux/if_phonet.h 0000644 00000000650 15063602050 0010025 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * File: if_phonet.h * * Phonet interface kernel definitions * * Copyright (C) 2008 Nokia Corporation. All rights reserved. */ #ifndef LINUX_IF_PHONET_H #define LINUX_IF_PHONET_H #define PHONET_MIN_MTU 6 /* pn_length = 0 */ #define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */ #define PHONET_DEV_MTU PHONET_MAX_MTU #endif /* LINUX_IF_PHONET_H */ linux/if_plip.h 0000644 00000001224 15063602050 0007472 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * NET3 PLIP tuning facilities for the new Niibe PLIP. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #ifndef _LINUX_IF_PLIP_H #define _LINUX_IF_PLIP_H #include <linux/sockios.h> #define SIOCDEVPLIP SIOCDEVPRIVATE struct plipconf { unsigned short pcmd; unsigned long nibble; unsigned long trigger; }; #define PLIP_GET_TIMEOUT 0x1 #define PLIP_SET_TIMEOUT 0x2 #endif linux/if_ppp.h 0000644 00000000035 15063602050 0007324 0 ustar 00 #include <linux/ppp-ioctl.h> linux/if_pppol2tp.h 0000644 00000006334 15063602050 0010315 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /*************************************************************************** * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661) * * This file supplies definitions required by the PPP over L2TP driver * (l2tp_ppp.c). All version information wrt this file is located in l2tp_ppp.c * * License: * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #ifndef __LINUX_IF_PPPOL2TP_H #define __LINUX_IF_PPPOL2TP_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> #include <linux/l2tp.h> /* Structure used to connect() the socket to a particular tunnel UDP * socket over IPv4. */ struct pppol2tp_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP socket to use */ struct sockaddr_in addr; /* IP address and port to send to */ __u16 s_tunnel, s_session; /* For matching incoming packets */ __u16 d_tunnel, d_session; /* For sending outgoing packets */ }; /* Structure used to connect() the socket to a particular tunnel UDP * socket over IPv6. */ struct pppol2tpin6_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP socket to use */ __u16 s_tunnel, s_session; /* For matching incoming packets */ __u16 d_tunnel, d_session; /* For sending outgoing packets */ struct sockaddr_in6 addr; /* IP address and port to send to */ }; /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 * bits. So we need a different sockaddr structure. */ struct pppol2tpv3_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP or IP socket to use */ struct sockaddr_in addr; /* IP address and port to send to */ __u32 s_tunnel, s_session; /* For matching incoming packets */ __u32 d_tunnel, d_session; /* For sending outgoing packets */ }; struct pppol2tpv3in6_addr { __kernel_pid_t pid; /* pid that owns the fd. * 0 => current */ int fd; /* FD of UDP or IP socket to use */ __u32 s_tunnel, s_session; /* For matching incoming packets */ __u32 d_tunnel, d_session; /* For sending outgoing packets */ struct sockaddr_in6 addr; /* IP address and port to send to */ }; /* Socket options: * DEBUG - bitmask of debug message categories * SENDSEQ - 0 => don't send packets with sequence numbers * 1 => send packets with sequence numbers * RECVSEQ - 0 => receive packet sequence numbers are optional * 1 => drop receive packets without sequence numbers * LNSMODE - 0 => act as LAC. * 1 => act as LNS. * REORDERTO - reorder timeout (in millisecs). If 0, don't try to reorder. */ enum { PPPOL2TP_SO_DEBUG = 1, PPPOL2TP_SO_RECVSEQ = 2, PPPOL2TP_SO_SENDSEQ = 3, PPPOL2TP_SO_LNSMODE = 4, PPPOL2TP_SO_REORDERTO = 5, }; /* Debug message categories for the DEBUG socket option (deprecated) */ enum { PPPOL2TP_MSG_DEBUG = L2TP_MSG_DEBUG, PPPOL2TP_MSG_CONTROL = L2TP_MSG_CONTROL, PPPOL2TP_MSG_SEQ = L2TP_MSG_SEQ, PPPOL2TP_MSG_DATA = L2TP_MSG_DATA, }; #endif /* __LINUX_IF_PPPOL2TP_H */ linux/if_pppox.h 0000644 00000011417 15063602050 0007701 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /*************************************************************************** * Linux PPP over X - Generic PPP transport layer sockets * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) * * This file supplies definitions required by the PPP over Ethernet driver * (pppox.c). All version information wrt this file is located in pppox.c * * License: * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #ifndef __LINUX_IF_PPPOX_H #define __LINUX_IF_PPPOX_H #include <linux/types.h> #include <asm/byteorder.h> #include <linux/socket.h> #include <linux/if.h> #include <linux/if_ether.h> #include <linux/if_pppol2tp.h> #include <linux/in.h> #include <linux/in6.h> /* For user-space programs to pick up these definitions * which they wouldn't get otherwise without defining __KERNEL__ */ #ifndef AF_PPPOX #define AF_PPPOX 24 #define PF_PPPOX AF_PPPOX #endif /* !(AF_PPPOX) */ /************************************************************************ * PPPoE addressing definition */ typedef __be16 sid_t; struct pppoe_addr { sid_t sid; /* Session identifier */ unsigned char remote[ETH_ALEN]; /* Remote address */ char dev[IFNAMSIZ]; /* Local device to use */ }; /************************************************************************ * PPTP addressing definition */ struct pptp_addr { __u16 call_id; struct in_addr sin_addr; }; /************************************************************************ * Protocols supported by AF_PPPOX */ #define PX_PROTO_OE 0 /* Currently just PPPoE */ #define PX_PROTO_OL2TP 1 /* Now L2TP also */ #define PX_PROTO_PPTP 2 #define PX_MAX_PROTO 3 struct sockaddr_pppox { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ union { struct pppoe_addr pppoe; struct pptp_addr pptp; } sa_addr; } __attribute__((packed)); /* The use of the above union isn't viable because the size of this * struct must stay fixed over time -- applications use sizeof(struct * sockaddr_pppox) to fill it. We use a protocol specific sockaddr * type instead. */ struct sockaddr_pppol2tp { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tp_addr pppol2tp; } __attribute__((packed)); struct sockaddr_pppol2tpin6 { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tpin6_addr pppol2tp; } __attribute__((packed)); /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 * bits. So we need a different sockaddr structure. */ struct sockaddr_pppol2tpv3 { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tpv3_addr pppol2tp; } __attribute__((packed)); struct sockaddr_pppol2tpv3in6 { __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ unsigned int sa_protocol; /* protocol identifier */ struct pppol2tpv3in6_addr pppol2tp; } __attribute__((packed)); /********************************************************************* * * ioctl interface for defining forwarding of connections * ********************************************************************/ #define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) #define PPPOEIOCDFWD _IO(0xB1 ,1) /*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ /* Codes to identify message types */ #define PADI_CODE 0x09 #define PADO_CODE 0x07 #define PADR_CODE 0x19 #define PADS_CODE 0x65 #define PADT_CODE 0xa7 struct pppoe_tag { __be16 tag_type; __be16 tag_len; char tag_data[0]; } __attribute__ ((packed)); /* Tag identifiers */ #define PTT_EOL __cpu_to_be16(0x0000) #define PTT_SRV_NAME __cpu_to_be16(0x0101) #define PTT_AC_NAME __cpu_to_be16(0x0102) #define PTT_HOST_UNIQ __cpu_to_be16(0x0103) #define PTT_AC_COOKIE __cpu_to_be16(0x0104) #define PTT_VENDOR __cpu_to_be16(0x0105) #define PTT_RELAY_SID __cpu_to_be16(0x0110) #define PTT_SRV_ERR __cpu_to_be16(0x0201) #define PTT_SYS_ERR __cpu_to_be16(0x0202) #define PTT_GEN_ERR __cpu_to_be16(0x0203) struct pppoe_hdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 type : 4; __u8 ver : 4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 ver : 4; __u8 type : 4; #else #error "Please fix <asm/byteorder.h>" #endif __u8 code; __be16 sid; __be16 length; struct pppoe_tag tag[0]; } __attribute__((packed)); /* Length of entire PPPoE + PPP header */ #define PPPOE_SES_HLEN 8 #endif /* __LINUX_IF_PPPOX_H */ linux/if_slip.h 0000644 00000001550 15063602050 0007477 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Swansea University Computer Society NET3 * * This file declares the constants of special use with the SLIP/CSLIP/ * KISS TNC driver. */ #ifndef __LINUX_SLIP_H #define __LINUX_SLIP_H #define SL_MODE_SLIP 0 #define SL_MODE_CSLIP 1 #define SL_MODE_KISS 4 #define SL_OPT_SIXBIT 2 #define SL_OPT_ADAPTIVE 8 /* * VSV = ioctl for keepalive & outfill in SLIP driver */ #define SIOCSKEEPALIVE (SIOCDEVPRIVATE) /* Set keepalive timeout in sec */ #define SIOCGKEEPALIVE (SIOCDEVPRIVATE+1) /* Get keepalive timeout */ #define SIOCSOUTFILL (SIOCDEVPRIVATE+2) /* Set outfill timeout */ #define SIOCGOUTFILL (SIOCDEVPRIVATE+3) /* Get outfill timeout */ #define SIOCSLEASE (SIOCDEVPRIVATE+4) /* Set "leased" line type */ #define SIOCGLEASE (SIOCDEVPRIVATE+5) /* Get line type */ #endif linux/if_team.h 0000644 00000005050 15063602050 0007455 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/linux/if_team.h - Network team device driver header * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef _LINUX_IF_TEAM_H_ #define _LINUX_IF_TEAM_H_ #define TEAM_STRING_MAX_LEN 32 /********************************** * NETLINK_GENERIC netlink family. **********************************/ enum { TEAM_CMD_NOOP, TEAM_CMD_OPTIONS_SET, TEAM_CMD_OPTIONS_GET, TEAM_CMD_PORT_LIST_GET, __TEAM_CMD_MAX, TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1), }; enum { TEAM_ATTR_UNSPEC, TEAM_ATTR_TEAM_IFINDEX, /* u32 */ TEAM_ATTR_LIST_OPTION, /* nest */ TEAM_ATTR_LIST_PORT, /* nest */ __TEAM_ATTR_MAX, TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1, }; /* Nested layout of get/set msg: * * [TEAM_ATTR_LIST_OPTION] * [TEAM_ATTR_ITEM_OPTION] * [TEAM_ATTR_OPTION_*], ... * [TEAM_ATTR_ITEM_OPTION] * [TEAM_ATTR_OPTION_*], ... * ... * [TEAM_ATTR_LIST_PORT] * [TEAM_ATTR_ITEM_PORT] * [TEAM_ATTR_PORT_*], ... * [TEAM_ATTR_ITEM_PORT] * [TEAM_ATTR_PORT_*], ... * ... */ enum { TEAM_ATTR_ITEM_OPTION_UNSPEC, TEAM_ATTR_ITEM_OPTION, /* nest */ __TEAM_ATTR_ITEM_OPTION_MAX, TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1, }; enum { TEAM_ATTR_OPTION_UNSPEC, TEAM_ATTR_OPTION_NAME, /* string */ TEAM_ATTR_OPTION_CHANGED, /* flag */ TEAM_ATTR_OPTION_TYPE, /* u8 */ TEAM_ATTR_OPTION_DATA, /* dynamic */ TEAM_ATTR_OPTION_REMOVED, /* flag */ TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */ TEAM_ATTR_OPTION_ARRAY_INDEX, /* u32 */ /* for array options */ __TEAM_ATTR_OPTION_MAX, TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, }; enum { TEAM_ATTR_ITEM_PORT_UNSPEC, TEAM_ATTR_ITEM_PORT, /* nest */ __TEAM_ATTR_ITEM_PORT_MAX, TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1, }; enum { TEAM_ATTR_PORT_UNSPEC, TEAM_ATTR_PORT_IFINDEX, /* u32 */ TEAM_ATTR_PORT_CHANGED, /* flag */ TEAM_ATTR_PORT_LINKUP, /* flag */ TEAM_ATTR_PORT_SPEED, /* u32 */ TEAM_ATTR_PORT_DUPLEX, /* u8 */ TEAM_ATTR_PORT_REMOVED, /* flag */ __TEAM_ATTR_PORT_MAX, TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1, }; /* * NETLINK_GENERIC related info */ #define TEAM_GENL_NAME "team" #define TEAM_GENL_VERSION 0x1 #define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event" #endif /* _LINUX_IF_TEAM_H_ */ linux/if_tun.h 0000644 00000010002 15063602050 0007326 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Universal TUN/TAP device driver. * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __IF_TUN_H #define __IF_TUN_H #include <linux/types.h> #include <linux/if_ether.h> #include <linux/filter.h> /* Read queue size */ #define TUN_READQ_SIZE 500 /* TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. */ #define TUN_TUN_DEV IFF_TUN #define TUN_TAP_DEV IFF_TAP #define TUN_TYPE_MASK 0x000f /* Ioctl defines */ #define TUNSETNOCSUM _IOW('T', 200, int) #define TUNSETDEBUG _IOW('T', 201, int) #define TUNSETIFF _IOW('T', 202, int) #define TUNSETPERSIST _IOW('T', 203, int) #define TUNSETOWNER _IOW('T', 204, int) #define TUNSETLINK _IOW('T', 205, int) #define TUNSETGROUP _IOW('T', 206, int) #define TUNGETFEATURES _IOR('T', 207, unsigned int) #define TUNSETOFFLOAD _IOW('T', 208, unsigned int) #define TUNSETTXFILTER _IOW('T', 209, unsigned int) #define TUNGETIFF _IOR('T', 210, unsigned int) #define TUNGETSNDBUF _IOR('T', 211, int) #define TUNSETSNDBUF _IOW('T', 212, int) #define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) #define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) #define TUNGETVNETHDRSZ _IOR('T', 215, int) #define TUNSETVNETHDRSZ _IOW('T', 216, int) #define TUNSETQUEUE _IOW('T', 217, int) #define TUNSETIFINDEX _IOW('T', 218, unsigned int) #define TUNGETFILTER _IOR('T', 219, struct sock_fprog) #define TUNSETVNETLE _IOW('T', 220, int) #define TUNGETVNETLE _IOR('T', 221, int) /* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on * little-endian hosts. Not all kernel configurations support them, but all * configurations that support SET also support GET. */ #define TUNSETVNETBE _IOW('T', 222, int) #define TUNGETVNETBE _IOR('T', 223, int) #define TUNSETSTEERINGEBPF _IOR('T', 224, int) #define TUNSETFILTEREBPF _IOR('T', 225, int) #define TUNSETCARRIER _IOW('T', 226, int) #define TUNGETDEVNETNS _IO('T', 227) /* TUNSETIFF ifr flags */ #define IFF_TUN 0x0001 #define IFF_TAP 0x0002 #define IFF_NAPI 0x0010 #define IFF_NAPI_FRAGS 0x0020 #define IFF_NO_PI 0x1000 /* This flag has no real effect */ #define IFF_ONE_QUEUE 0x2000 #define IFF_VNET_HDR 0x4000 #define IFF_TUN_EXCL 0x8000 #define IFF_MULTI_QUEUE 0x0100 #define IFF_ATTACH_QUEUE 0x0200 #define IFF_DETACH_QUEUE 0x0400 /* read-only flag */ #define IFF_PERSIST 0x0800 #define IFF_NOFILTER 0x1000 /* Socket options */ #define TUN_TX_TIMESTAMP 1 /* Features for GSO (TUNSETOFFLOAD). */ #define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ #define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ #define TUN_F_UFO 0x10 /* I can handle UFO packets */ /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ #define TUN_PKT_STRIP 0x0001 struct tun_pi { __u16 flags; __be16 proto; }; /* * Filter spec (used for SETXXFILTER ioctls) * This stuff is applicable only to the TAP (Ethernet) devices. * If the count is zero the filter is disabled and the driver accepts * all packets (promisc mode). * If the filter is enabled in order to accept broadcast packets * broadcast addr must be explicitly included in the addr list. */ #define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */ struct tun_filter { __u16 flags; /* TUN_FLT_ flags see above */ __u16 count; /* Number of addresses */ __u8 addr[0][ETH_ALEN]; }; #endif /* __IF_TUN_H */ linux/if_tunnel.h 0000644 00000010640 15063602050 0010035 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IF_TUNNEL_H_ #define _IF_TUNNEL_H_ #include <linux/types.h> #include <linux/if.h> #include <linux/ip.h> #include <linux/in6.h> #include <asm/byteorder.h> #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) #define SIOCGETPRL (SIOCDEVPRIVATE + 4) #define SIOCADDPRL (SIOCDEVPRIVATE + 5) #define SIOCDELPRL (SIOCDEVPRIVATE + 6) #define SIOCCHGPRL (SIOCDEVPRIVATE + 7) #define SIOCGET6RD (SIOCDEVPRIVATE + 8) #define SIOCADD6RD (SIOCDEVPRIVATE + 9) #define SIOCDEL6RD (SIOCDEVPRIVATE + 10) #define SIOCCHG6RD (SIOCDEVPRIVATE + 11) #define GRE_CSUM __cpu_to_be16(0x8000) #define GRE_ROUTING __cpu_to_be16(0x4000) #define GRE_KEY __cpu_to_be16(0x2000) #define GRE_SEQ __cpu_to_be16(0x1000) #define GRE_STRICT __cpu_to_be16(0x0800) #define GRE_REC __cpu_to_be16(0x0700) #define GRE_ACK __cpu_to_be16(0x0080) #define GRE_FLAGS __cpu_to_be16(0x0078) #define GRE_VERSION __cpu_to_be16(0x0007) #define GRE_IS_CSUM(f) ((f) & GRE_CSUM) #define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING) #define GRE_IS_KEY(f) ((f) & GRE_KEY) #define GRE_IS_SEQ(f) ((f) & GRE_SEQ) #define GRE_IS_STRICT(f) ((f) & GRE_STRICT) #define GRE_IS_REC(f) ((f) & GRE_REC) #define GRE_IS_ACK(f) ((f) & GRE_ACK) #define GRE_VERSION_0 __cpu_to_be16(0x0000) #define GRE_VERSION_1 __cpu_to_be16(0x0001) #define GRE_PROTO_PPP __cpu_to_be16(0x880b) #define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff) struct ip_tunnel_parm { char name[IFNAMSIZ]; int link; __be16 i_flags; __be16 o_flags; __be32 i_key; __be32 o_key; struct iphdr iph; }; enum { IFLA_IPTUN_UNSPEC, IFLA_IPTUN_LINK, IFLA_IPTUN_LOCAL, IFLA_IPTUN_REMOTE, IFLA_IPTUN_TTL, IFLA_IPTUN_TOS, IFLA_IPTUN_ENCAP_LIMIT, IFLA_IPTUN_FLOWINFO, IFLA_IPTUN_FLAGS, IFLA_IPTUN_PROTO, IFLA_IPTUN_PMTUDISC, IFLA_IPTUN_6RD_PREFIX, IFLA_IPTUN_6RD_RELAY_PREFIX, IFLA_IPTUN_6RD_PREFIXLEN, IFLA_IPTUN_6RD_RELAY_PREFIXLEN, IFLA_IPTUN_ENCAP_TYPE, IFLA_IPTUN_ENCAP_FLAGS, IFLA_IPTUN_ENCAP_SPORT, IFLA_IPTUN_ENCAP_DPORT, IFLA_IPTUN_COLLECT_METADATA, IFLA_IPTUN_FWMARK, __IFLA_IPTUN_MAX, }; #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) enum tunnel_encap_types { TUNNEL_ENCAP_NONE, TUNNEL_ENCAP_FOU, TUNNEL_ENCAP_GUE, TUNNEL_ENCAP_MPLS, }; #define TUNNEL_ENCAP_FLAG_CSUM (1<<0) #define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) #define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2) /* SIT-mode i_flags */ #define SIT_ISATAP 0x0001 struct ip_tunnel_prl { __be32 addr; __u16 flags; __u16 __reserved; __u32 datalen; __u32 __reserved2; /* data follows */ }; /* PRL flags */ #define PRL_DEFAULT 0x0001 struct ip_tunnel_6rd { struct in6_addr prefix; __be32 relay_prefix; __u16 prefixlen; __u16 relay_prefixlen; }; enum { IFLA_GRE_UNSPEC, IFLA_GRE_LINK, IFLA_GRE_IFLAGS, IFLA_GRE_OFLAGS, IFLA_GRE_IKEY, IFLA_GRE_OKEY, IFLA_GRE_LOCAL, IFLA_GRE_REMOTE, IFLA_GRE_TTL, IFLA_GRE_TOS, IFLA_GRE_PMTUDISC, IFLA_GRE_ENCAP_LIMIT, IFLA_GRE_FLOWINFO, IFLA_GRE_FLAGS, IFLA_GRE_ENCAP_TYPE, IFLA_GRE_ENCAP_FLAGS, IFLA_GRE_ENCAP_SPORT, IFLA_GRE_ENCAP_DPORT, IFLA_GRE_COLLECT_METADATA, IFLA_GRE_IGNORE_DF, IFLA_GRE_FWMARK, IFLA_GRE_ERSPAN_INDEX, IFLA_GRE_ERSPAN_VER, IFLA_GRE_ERSPAN_DIR, IFLA_GRE_ERSPAN_HWID, __IFLA_GRE_MAX, }; #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) /* VTI-mode i_flags */ #define VTI_ISVTI ((__be16)0x0001) enum { IFLA_VTI_UNSPEC, IFLA_VTI_LINK, IFLA_VTI_IKEY, IFLA_VTI_OKEY, IFLA_VTI_LOCAL, IFLA_VTI_REMOTE, IFLA_VTI_FWMARK, __IFLA_VTI_MAX, }; #define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1) #define TUNNEL_CSUM __cpu_to_be16(0x01) #define TUNNEL_ROUTING __cpu_to_be16(0x02) #define TUNNEL_KEY __cpu_to_be16(0x04) #define TUNNEL_SEQ __cpu_to_be16(0x08) #define TUNNEL_STRICT __cpu_to_be16(0x10) #define TUNNEL_REC __cpu_to_be16(0x20) #define TUNNEL_VERSION __cpu_to_be16(0x40) #define TUNNEL_NO_KEY __cpu_to_be16(0x80) #define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100) #define TUNNEL_OAM __cpu_to_be16(0x0200) #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400) #define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800) #define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000) #define TUNNEL_NOCACHE __cpu_to_be16(0x2000) #define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000) #define TUNNEL_OPTIONS_PRESENT \ (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT) #endif /* _IF_TUNNEL_H_ */ linux/if_vlan.h 0000644 00000003447 15063602050 0007477 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * VLAN An implementation of 802.1Q VLAN tagging. * * Authors: Ben Greear <greearb@candelatech.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #ifndef _LINUX_IF_VLAN_H_ #define _LINUX_IF_VLAN_H_ /* VLAN IOCTLs are found in sockios.h */ /* Passed in vlan_ioctl_args structure to determine behaviour. */ enum vlan_ioctl_cmds { ADD_VLAN_CMD, DEL_VLAN_CMD, SET_VLAN_INGRESS_PRIORITY_CMD, SET_VLAN_EGRESS_PRIORITY_CMD, GET_VLAN_INGRESS_PRIORITY_CMD, GET_VLAN_EGRESS_PRIORITY_CMD, SET_VLAN_NAME_TYPE_CMD, SET_VLAN_FLAG_CMD, GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */ GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ }; enum vlan_flags { VLAN_FLAG_REORDER_HDR = 0x1, VLAN_FLAG_GVRP = 0x2, VLAN_FLAG_LOOSE_BINDING = 0x4, VLAN_FLAG_MVRP = 0x8, VLAN_FLAG_BRIDGE_BINDING = 0x10, }; enum vlan_name_types { VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */ VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */ VLAN_NAME_TYPE_HIGHEST }; struct vlan_ioctl_args { int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ char device1[24]; union { char device2[24]; int VID; unsigned int skb_priority; unsigned int name_type; unsigned int bind_type; unsigned int flag; /* Matches vlan_dev_priv flags */ } u; short vlan_qos; }; #endif /* _LINUX_IF_VLAN_H_ */ linux/if_x25.h 0000644 00000001561 15063602050 0007150 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux X.25 packet to device interface * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _IF_X25_H #define _IF_X25_H #include <linux/types.h> /* Documentation/networking/x25-iface.txt */ #define X25_IFACE_DATA 0x00 #define X25_IFACE_CONNECT 0x01 #define X25_IFACE_DISCONNECT 0x02 #define X25_IFACE_PARAMS 0x03 #endif /* _IF_X25_H */ linux/if_xdp.h 0000644 00000005703 15063602050 0007327 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * if_xdp: XDP socket user-space interface * Copyright(c) 2018 Intel Corporation. * * Author(s): Björn Töpel <bjorn.topel@intel.com> * Magnus Karlsson <magnus.karlsson@intel.com> */ #ifndef _LINUX_IF_XDP_H #define _LINUX_IF_XDP_H #include <linux/types.h> /* Options for the sxdp_flags field */ #define XDP_SHARED_UMEM (1 << 0) #define XDP_COPY (1 << 1) /* Force copy-mode */ #define XDP_ZEROCOPY (1 << 2) /* Force zero-copy mode */ /* If this option is set, the driver might go sleep and in that case * the XDP_RING_NEED_WAKEUP flag in the fill and/or Tx rings will be * set. If it is set, the application need to explicitly wake up the * driver with a poll() (Rx and Tx) or sendto() (Tx only). If you are * running the driver and the application on the same core, you should * use this option so that the kernel will yield to the user space * application. */ #define XDP_USE_NEED_WAKEUP (1 << 3) /* Flags for xsk_umem_config flags */ #define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0) struct sockaddr_xdp { __u16 sxdp_family; __u16 sxdp_flags; __u32 sxdp_ifindex; __u32 sxdp_queue_id; __u32 sxdp_shared_umem_fd; }; /* XDP_RING flags */ #define XDP_RING_NEED_WAKEUP (1 << 0) struct xdp_ring_offset { __u64 producer; __u64 consumer; __u64 desc; __u64 flags; }; struct xdp_mmap_offsets { struct xdp_ring_offset rx; struct xdp_ring_offset tx; struct xdp_ring_offset fr; /* Fill */ struct xdp_ring_offset cr; /* Completion */ }; /* XDP socket options */ #define XDP_MMAP_OFFSETS 1 #define XDP_RX_RING 2 #define XDP_TX_RING 3 #define XDP_UMEM_REG 4 #define XDP_UMEM_FILL_RING 5 #define XDP_UMEM_COMPLETION_RING 6 #define XDP_STATISTICS 7 #define XDP_OPTIONS 8 struct xdp_umem_reg { __u64 addr; /* Start of packet data area */ __u64 len; /* Length of packet data area */ __u32 chunk_size; __u32 headroom; __u32 flags; }; struct xdp_statistics { __u64 rx_dropped; /* Dropped for other reasons */ __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */ __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */ __u64 rx_ring_full; /* Dropped due to rx ring being full */ __u64 rx_fill_ring_empty_descs; /* Failed to retrieve item from fill ring */ __u64 tx_ring_empty_descs; /* Failed to retrieve item from tx ring */ }; struct xdp_options { __u32 flags; }; /* Flags for the flags field of struct xdp_options */ #define XDP_OPTIONS_ZEROCOPY (1 << 0) /* Pgoff for mmaping the rings */ #define XDP_PGOFF_RX_RING 0 #define XDP_PGOFF_TX_RING 0x80000000 #define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL #define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL /* Masks for unaligned chunks mode */ #define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48 #define XSK_UNALIGNED_BUF_ADDR_MASK \ ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1) /* Rx/Tx descriptor */ struct xdp_desc { __u64 addr; __u32 len; __u32 options; }; /* UMEM descriptor is __u64 */ #endif /* _LINUX_IF_XDP_H */ linux/ife.h 0000644 00000000537 15063602050 0006621 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_IFE_H #define __UAPI_IFE_H #define IFE_METAHDRLEN 2 enum { IFE_META_SKBMARK = 1, IFE_META_HASHID, IFE_META_PRIO, IFE_META_QMAP, IFE_META_TCINDEX, __IFE_META_MAX }; /*Can be overridden at runtime by module option*/ #define IFE_META_MAX (__IFE_META_MAX - 1) #endif linux/igmp.h 0000644 00000005770 15063602050 0007016 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux NET3: Internet Group Management Protocol [IGMP] * * Authors: * Alan Cox <alan@lxorguk.ukuu.org.uk> * * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IGMP_H #define _LINUX_IGMP_H #include <linux/types.h> #include <asm/byteorder.h> /* * IGMP protocol structures */ /* * Header in on cable format */ struct igmphdr { __u8 type; __u8 code; /* For newer IGMP */ __sum16 csum; __be32 group; }; /* V3 group record types [grec_type] */ #define IGMPV3_MODE_IS_INCLUDE 1 #define IGMPV3_MODE_IS_EXCLUDE 2 #define IGMPV3_CHANGE_TO_INCLUDE 3 #define IGMPV3_CHANGE_TO_EXCLUDE 4 #define IGMPV3_ALLOW_NEW_SOURCES 5 #define IGMPV3_BLOCK_OLD_SOURCES 6 struct igmpv3_grec { __u8 grec_type; __u8 grec_auxwords; __be16 grec_nsrcs; __be32 grec_mca; __be32 grec_src[0]; }; struct igmpv3_report { __u8 type; __u8 resv1; __sum16 csum; __be16 resv2; __be16 ngrec; struct igmpv3_grec grec[0]; }; struct igmpv3_query { __u8 type; __u8 code; __sum16 csum; __be32 group; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 qrv:3, suppress:1, resv:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 resv:4, suppress:1, qrv:3; #else #error "Please fix <asm/byteorder.h>" #endif __u8 qqic; __be16 nsrcs; __be32 srcs[0]; }; #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ #define IGMP_DVMRP 0x13 /* DVMRP routing */ #define IGMP_PIM 0x14 /* PIM routing */ #define IGMP_TRACE 0x15 #define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x12 */ #define IGMP_HOST_LEAVE_MESSAGE 0x17 #define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x12 */ #define IGMP_MTRACE_RESP 0x1e #define IGMP_MTRACE 0x1f #define IGMP_MRDISC_ADV 0x30 /* From RFC4286 */ /* * Use the BSD names for these for compatibility */ #define IGMP_DELAYING_MEMBER 0x01 #define IGMP_IDLE_MEMBER 0x02 #define IGMP_LAZY_MEMBER 0x03 #define IGMP_SLEEPING_MEMBER 0x04 #define IGMP_AWAKENING_MEMBER 0x05 #define IGMP_MINLEN 8 #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ /* query (in seconds) */ #define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */ /* specifies time in 10th of seconds */ #define IGMP_AGE_THRESHOLD 400 /* If this host don't hear any IGMP V1 */ /* message in this period of time, */ /* revert to IGMP v2 router. */ #define IGMP_ALL_HOSTS htonl(0xE0000001L) #define IGMP_ALL_ROUTER htonl(0xE0000002L) #define IGMPV3_ALL_MCR htonl(0xE0000016L) #define IGMP_LOCAL_GROUP htonl(0xE0000000L) #define IGMP_LOCAL_GROUP_MASK htonl(0xFFFFFF00L) /* * struct for keeping the multicast list in */ #endif /* _LINUX_IGMP_H */ linux/ila.h 0000644 00000002336 15063602050 0006622 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* ila.h - ILA Interface */ #ifndef _LINUX_ILA_H #define _LINUX_ILA_H /* NETLINK_GENERIC related info */ #define ILA_GENL_NAME "ila" #define ILA_GENL_VERSION 0x1 enum { ILA_ATTR_UNSPEC, ILA_ATTR_LOCATOR, /* u64 */ ILA_ATTR_IDENTIFIER, /* u64 */ ILA_ATTR_LOCATOR_MATCH, /* u64 */ ILA_ATTR_IFINDEX, /* s32 */ ILA_ATTR_DIR, /* u32 */ ILA_ATTR_PAD, ILA_ATTR_CSUM_MODE, /* u8 */ ILA_ATTR_IDENT_TYPE, /* u8 */ ILA_ATTR_HOOK_TYPE, /* u8 */ __ILA_ATTR_MAX, }; #define ILA_ATTR_MAX (__ILA_ATTR_MAX - 1) enum { ILA_CMD_UNSPEC, ILA_CMD_ADD, ILA_CMD_DEL, ILA_CMD_GET, ILA_CMD_FLUSH, __ILA_CMD_MAX, }; #define ILA_CMD_MAX (__ILA_CMD_MAX - 1) #define ILA_DIR_IN (1 << 0) #define ILA_DIR_OUT (1 << 1) enum { ILA_CSUM_ADJUST_TRANSPORT, ILA_CSUM_NEUTRAL_MAP, ILA_CSUM_NO_ACTION, ILA_CSUM_NEUTRAL_MAP_AUTO, }; enum { ILA_ATYPE_IID = 0, ILA_ATYPE_LUID, ILA_ATYPE_VIRT_V4, ILA_ATYPE_VIRT_UNI_V6, ILA_ATYPE_VIRT_MULTI_V6, ILA_ATYPE_NONLOCAL_ADDR, ILA_ATYPE_RSVD_1, ILA_ATYPE_RSVD_2, ILA_ATYPE_USE_FORMAT = 32, /* Get type from type field in identifier */ }; enum { ILA_HOOK_ROUTE_OUTPUT, ILA_HOOK_ROUTE_INPUT, }; #endif /* _LINUX_ILA_H */ linux/in.h 0000644 00000023436 15063602050 0006467 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions of the Internet Protocol. * * Version: @(#)in.h 1.0.1 04/21/93 * * Authors: Original taken from the GNU Project <netinet/in.h> file. * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IN_H #define _LINUX_IN_H #include <linux/types.h> #include <linux/libc-compat.h> #include <linux/socket.h> #if __UAPI_DEF_IN_IPPROTO /* Standard well-defined IP protocols. */ enum { IPPROTO_IP = 0, /* Dummy protocol for TCP */ #define IPPROTO_IP IPPROTO_IP IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ #define IPPROTO_ICMP IPPROTO_ICMP IPPROTO_IGMP = 2, /* Internet Group Management Protocol */ #define IPPROTO_IGMP IPPROTO_IGMP IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ #define IPPROTO_IPIP IPPROTO_IPIP IPPROTO_TCP = 6, /* Transmission Control Protocol */ #define IPPROTO_TCP IPPROTO_TCP IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ #define IPPROTO_EGP IPPROTO_EGP IPPROTO_PUP = 12, /* PUP protocol */ #define IPPROTO_PUP IPPROTO_PUP IPPROTO_UDP = 17, /* User Datagram Protocol */ #define IPPROTO_UDP IPPROTO_UDP IPPROTO_IDP = 22, /* XNS IDP protocol */ #define IPPROTO_IDP IPPROTO_IDP IPPROTO_TP = 29, /* SO Transport Protocol Class 4 */ #define IPPROTO_TP IPPROTO_TP IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */ #define IPPROTO_DCCP IPPROTO_DCCP IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ #define IPPROTO_IPV6 IPPROTO_IPV6 IPPROTO_RSVP = 46, /* RSVP Protocol */ #define IPPROTO_RSVP IPPROTO_RSVP IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ #define IPPROTO_GRE IPPROTO_GRE IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */ #define IPPROTO_ESP IPPROTO_ESP IPPROTO_AH = 51, /* Authentication Header protocol */ #define IPPROTO_AH IPPROTO_AH IPPROTO_MTP = 92, /* Multicast Transport Protocol */ #define IPPROTO_MTP IPPROTO_MTP IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */ #define IPPROTO_BEETPH IPPROTO_BEETPH IPPROTO_ENCAP = 98, /* Encapsulation Header */ #define IPPROTO_ENCAP IPPROTO_ENCAP IPPROTO_PIM = 103, /* Protocol Independent Multicast */ #define IPPROTO_PIM IPPROTO_PIM IPPROTO_COMP = 108, /* Compression Header Protocol */ #define IPPROTO_COMP IPPROTO_COMP IPPROTO_L2TP = 115, /* Layer 2 Tunnelling Protocol */ #define IPPROTO_L2TP IPPROTO_L2TP IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ #define IPPROTO_SCTP IPPROTO_SCTP IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */ #define IPPROTO_UDPLITE IPPROTO_UDPLITE IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */ #define IPPROTO_MPLS IPPROTO_MPLS IPPROTO_RAW = 255, /* Raw IP packets */ #define IPPROTO_RAW IPPROTO_RAW IPPROTO_MAX #define IPPROTO_MPTCP 262 }; #endif #if __UAPI_DEF_IN_ADDR /* Internet address. */ struct in_addr { __be32 s_addr; }; #endif #define IP_TOS 1 #define IP_TTL 2 #define IP_HDRINCL 3 #define IP_OPTIONS 4 #define IP_ROUTER_ALERT 5 #define IP_RECVOPTS 6 #define IP_RETOPTS 7 #define IP_PKTINFO 8 #define IP_PKTOPTIONS 9 #define IP_MTU_DISCOVER 10 #define IP_RECVERR 11 #define IP_RECVTTL 12 #define IP_RECVTOS 13 #define IP_MTU 14 #define IP_FREEBIND 15 #define IP_IPSEC_POLICY 16 #define IP_XFRM_POLICY 17 #define IP_PASSSEC 18 #define IP_TRANSPARENT 19 /* BSD compatibility */ #define IP_RECVRETOPTS IP_RETOPTS /* TProxy original addresses */ #define IP_ORIGDSTADDR 20 #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR #define IP_MINTTL 21 #define IP_NODEFRAG 22 #define IP_CHECKSUM 23 #define IP_BIND_ADDRESS_NO_PORT 24 #define IP_RECVFRAGSIZE 25 /* IP_MTU_DISCOVER values */ #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ #define IP_PMTUDISC_WANT 1 /* Use per route hints */ #define IP_PMTUDISC_DO 2 /* Always DF */ #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ /* Always use interface mtu (ignores dst pmtu) but don't set DF flag. * Also incoming ICMP frag_needed notifications will be ignored on * this socket to prevent accepting spoofed ones. */ #define IP_PMTUDISC_INTERFACE 4 /* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get * fragmented if they exeed the interface mtu */ #define IP_PMTUDISC_OMIT 5 #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 #define IP_MULTICAST_LOOP 34 #define IP_ADD_MEMBERSHIP 35 #define IP_DROP_MEMBERSHIP 36 #define IP_UNBLOCK_SOURCE 37 #define IP_BLOCK_SOURCE 38 #define IP_ADD_SOURCE_MEMBERSHIP 39 #define IP_DROP_SOURCE_MEMBERSHIP 40 #define IP_MSFILTER 41 #define MCAST_JOIN_GROUP 42 #define MCAST_BLOCK_SOURCE 43 #define MCAST_UNBLOCK_SOURCE 44 #define MCAST_LEAVE_GROUP 45 #define MCAST_JOIN_SOURCE_GROUP 46 #define MCAST_LEAVE_SOURCE_GROUP 47 #define MCAST_MSFILTER 48 #define IP_MULTICAST_ALL 49 #define IP_UNICAST_IF 50 #define MCAST_EXCLUDE 0 #define MCAST_INCLUDE 1 /* These need to appear somewhere around here */ #define IP_DEFAULT_MULTICAST_TTL 1 #define IP_DEFAULT_MULTICAST_LOOP 1 /* Request struct for multicast socket ops */ #if __UAPI_DEF_IP_MREQ struct ip_mreq { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_interface; /* local IP address of interface */ }; struct ip_mreqn { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_address; /* local IP address of interface */ int imr_ifindex; /* Interface index */ }; struct ip_mreq_source { __be32 imr_multiaddr; __be32 imr_interface; __be32 imr_sourceaddr; }; struct ip_msfilter { __be32 imsf_multiaddr; __be32 imsf_interface; __u32 imsf_fmode; __u32 imsf_numsrc; __be32 imsf_slist[1]; }; #define IP_MSFILTER_SIZE(numsrc) \ (sizeof(struct ip_msfilter) - sizeof(__u32) \ + (numsrc) * sizeof(__u32)) struct group_req { __u32 gr_interface; /* interface index */ struct __kernel_sockaddr_storage gr_group; /* group address */ }; struct group_source_req { __u32 gsr_interface; /* interface index */ struct __kernel_sockaddr_storage gsr_group; /* group address */ struct __kernel_sockaddr_storage gsr_source; /* source address */ }; struct group_filter { __u32 gf_interface; /* interface index */ struct __kernel_sockaddr_storage gf_group; /* multicast address */ __u32 gf_fmode; /* filter mode */ __u32 gf_numsrc; /* number of sources */ struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */ }; #define GROUP_FILTER_SIZE(numsrc) \ (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) #endif #if __UAPI_DEF_IN_PKTINFO struct in_pktinfo { int ipi_ifindex; struct in_addr ipi_spec_dst; struct in_addr ipi_addr; }; #endif /* Structure describing an Internet (IP) socket address. */ #if __UAPI_DEF_SOCKADDR_IN #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ struct sockaddr_in { __kernel_sa_family_t sin_family; /* Address family */ __be16 sin_port; /* Port number */ struct in_addr sin_addr; /* Internet address */ /* Pad to size of `struct sockaddr'. */ unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)]; }; #define sin_zero __pad /* for BSD UNIX comp. -FvK */ #endif #if __UAPI_DEF_IN_CLASS /* * Definitions of the bits in an Internet address integer. * On subnets, host and network parts are found according * to the subnet mask, not these masks. */ #define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) #define IN_CLASSA_MAX 128 #define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) #define IN_CLASSB_MAX 65536 #define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) #define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) #define IN_MULTICAST(a) IN_CLASSD(a) #define IN_MULTICAST_NET 0xF0000000 #define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) #define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) /* Address to accept any incoming messages. */ #define INADDR_ANY ((unsigned long int) 0x00000000) /* Address to send to all hosts. */ #define INADDR_BROADCAST ((unsigned long int) 0xffffffff) /* Address indicating an error return. */ #define INADDR_NONE ((unsigned long int) 0xffffffff) /* Dummy address for src of ICMP replies if no real address is set (RFC7600). */ #define INADDR_DUMMY ((unsigned long int) 0xc0000008) /* Network number for local host loopback. */ #define IN_LOOPBACKNET 127 /* Address to loopback in software to local host. */ #define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ #define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) /* Defines for Multicast INADDR */ #define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */ #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ #define INADDR_ALLSNOOPERS_GROUP 0xe000006aU /* 224.0.0.106 */ #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ #endif /* <asm/byteorder.h> contains the htonl type stuff.. */ #include <asm/byteorder.h> #endif /* _LINUX_IN_H */ linux/in6.h 0000644 00000016416 15063602050 0006555 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Types and definitions for AF_INET6 * Linux INET6 implementation * * Authors: * Pedro Roque <roque@di.fc.ul.pt> * * Sources: * IPv6 Program Interfaces for BSD Systems * <draft-ietf-ipngwg-bsd-api-05.txt> * * Advanced Sockets API for IPv6 * <draft-stevens-advanced-api-00.txt> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IN6_H #define _LINUX_IN6_H #include <linux/types.h> #include <linux/libc-compat.h> /* * IPv6 address structure */ #if __UAPI_DEF_IN6_ADDR struct in6_addr { union { __u8 u6_addr8[16]; #if __UAPI_DEF_IN6_ADDR_ALT __be16 u6_addr16[8]; __be32 u6_addr32[4]; #endif } in6_u; #define s6_addr in6_u.u6_addr8 #if __UAPI_DEF_IN6_ADDR_ALT #define s6_addr16 in6_u.u6_addr16 #define s6_addr32 in6_u.u6_addr32 #endif }; #endif /* __UAPI_DEF_IN6_ADDR */ #if __UAPI_DEF_SOCKADDR_IN6 struct sockaddr_in6 { unsigned short int sin6_family; /* AF_INET6 */ __be16 sin6_port; /* Transport layer port # */ __be32 sin6_flowinfo; /* IPv6 flow information */ struct in6_addr sin6_addr; /* IPv6 address */ __u32 sin6_scope_id; /* scope id (new in RFC2553) */ }; #endif /* __UAPI_DEF_SOCKADDR_IN6 */ #if __UAPI_DEF_IPV6_MREQ struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local IPv6 address of interface */ int ipv6mr_ifindex; }; #endif /* __UAPI_DEF_IVP6_MREQ */ #define ipv6mr_acaddr ipv6mr_multiaddr struct in6_flowlabel_req { struct in6_addr flr_dst; __be32 flr_label; __u8 flr_action; __u8 flr_share; __u16 flr_flags; __u16 flr_expires; __u16 flr_linger; __u32 __flr_pad; /* Options in format of IPV6_PKTOPTIONS */ }; #define IPV6_FL_A_GET 0 #define IPV6_FL_A_PUT 1 #define IPV6_FL_A_RENEW 2 #define IPV6_FL_F_CREATE 1 #define IPV6_FL_F_EXCL 2 #define IPV6_FL_F_REFLECT 4 #define IPV6_FL_F_REMOTE 8 #define IPV6_FL_S_NONE 0 #define IPV6_FL_S_EXCL 1 #define IPV6_FL_S_PROCESS 2 #define IPV6_FL_S_USER 3 #define IPV6_FL_S_ANY 255 /* * Bitmask constant declarations to help applications select out the * flow label and priority fields. * * Note that this are in host byte order while the flowinfo field of * sockaddr_in6 is in network byte order. */ #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 /* These definitions are obsolete */ #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 #define IPV6_PRIORITY_FILLER 0x0100 #define IPV6_PRIORITY_UNATTENDED 0x0200 #define IPV6_PRIORITY_RESERVED1 0x0300 #define IPV6_PRIORITY_BULK 0x0400 #define IPV6_PRIORITY_RESERVED2 0x0500 #define IPV6_PRIORITY_INTERACTIVE 0x0600 #define IPV6_PRIORITY_CONTROL 0x0700 #define IPV6_PRIORITY_8 0x0800 #define IPV6_PRIORITY_9 0x0900 #define IPV6_PRIORITY_10 0x0a00 #define IPV6_PRIORITY_11 0x0b00 #define IPV6_PRIORITY_12 0x0c00 #define IPV6_PRIORITY_13 0x0d00 #define IPV6_PRIORITY_14 0x0e00 #define IPV6_PRIORITY_15 0x0f00 /* * IPV6 extension headers */ #if __UAPI_DEF_IPPROTO_V6 #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ #define IPPROTO_ROUTING 43 /* IPv6 routing header */ #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ #define IPPROTO_ICMPV6 58 /* ICMPv6 */ #define IPPROTO_NONE 59 /* IPv6 no next header */ #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ #define IPPROTO_MH 135 /* IPv6 mobility header */ #endif /* __UAPI_DEF_IPPROTO_V6 */ /* * IPv6 TLV options. */ #define IPV6_TLV_PAD1 0 #define IPV6_TLV_PADN 1 #define IPV6_TLV_ROUTERALERT 5 #define IPV6_TLV_CALIPSO 7 /* RFC 5570 */ #define IPV6_TLV_JUMBO 194 #define IPV6_TLV_HAO 201 /* home address option */ /* * IPV6 socket options */ #if __UAPI_DEF_IPV6_OPTIONS #define IPV6_ADDRFORM 1 #define IPV6_2292PKTINFO 2 #define IPV6_2292HOPOPTS 3 #define IPV6_2292DSTOPTS 4 #define IPV6_2292RTHDR 5 #define IPV6_2292PKTOPTIONS 6 #define IPV6_CHECKSUM 7 #define IPV6_2292HOPLIMIT 8 #define IPV6_NEXTHOP 9 #define IPV6_AUTHHDR 10 /* obsolete */ #define IPV6_FLOWINFO 11 #define IPV6_UNICAST_HOPS 16 #define IPV6_MULTICAST_IF 17 #define IPV6_MULTICAST_HOPS 18 #define IPV6_MULTICAST_LOOP 19 #define IPV6_ADD_MEMBERSHIP 20 #define IPV6_DROP_MEMBERSHIP 21 #define IPV6_ROUTER_ALERT 22 #define IPV6_MTU_DISCOVER 23 #define IPV6_MTU 24 #define IPV6_RECVERR 25 #define IPV6_V6ONLY 26 #define IPV6_JOIN_ANYCAST 27 #define IPV6_LEAVE_ANYCAST 28 /* IPV6_MTU_DISCOVER values */ #define IPV6_PMTUDISC_DONT 0 #define IPV6_PMTUDISC_WANT 1 #define IPV6_PMTUDISC_DO 2 #define IPV6_PMTUDISC_PROBE 3 /* same as IPV6_PMTUDISC_PROBE, provided for symetry with IPv4 * also see comments on IP_PMTUDISC_INTERFACE */ #define IPV6_PMTUDISC_INTERFACE 4 /* weaker version of IPV6_PMTUDISC_INTERFACE, which allows packets to * get fragmented if they exceed the interface mtu */ #define IPV6_PMTUDISC_OMIT 5 /* Flowlabel */ #define IPV6_FLOWLABEL_MGR 32 #define IPV6_FLOWINFO_SEND 33 #define IPV6_IPSEC_POLICY 34 #define IPV6_XFRM_POLICY 35 #define IPV6_HDRINCL 36 #endif /* * Multicast: * Following socket options are shared between IPv4 and IPv6. * * MCAST_JOIN_GROUP 42 * MCAST_BLOCK_SOURCE 43 * MCAST_UNBLOCK_SOURCE 44 * MCAST_LEAVE_GROUP 45 * MCAST_JOIN_SOURCE_GROUP 46 * MCAST_LEAVE_SOURCE_GROUP 47 * MCAST_MSFILTER 48 */ /* * Advanced API (RFC3542) (1) * * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c. */ #define IPV6_RECVPKTINFO 49 #define IPV6_PKTINFO 50 #define IPV6_RECVHOPLIMIT 51 #define IPV6_HOPLIMIT 52 #define IPV6_RECVHOPOPTS 53 #define IPV6_HOPOPTS 54 #define IPV6_RTHDRDSTOPTS 55 #define IPV6_RECVRTHDR 56 #define IPV6_RTHDR 57 #define IPV6_RECVDSTOPTS 58 #define IPV6_DSTOPTS 59 #define IPV6_RECVPATHMTU 60 #define IPV6_PATHMTU 61 #define IPV6_DONTFRAG 62 #if 0 /* not yet */ #define IPV6_USE_MIN_MTU 63 #endif /* * Netfilter (1) * * Following socket options are used in ip6_tables; * see include/linux/netfilter_ipv6/ip6_tables.h. * * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64 * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65 */ /* * Advanced API (RFC3542) (2) */ #define IPV6_RECVTCLASS 66 #define IPV6_TCLASS 67 /* * Netfilter (2) * * Following socket options are used in ip6_tables; * see include/linux/netfilter_ipv6/ip6_tables.h. * * IP6T_SO_GET_REVISION_MATCH 68 * IP6T_SO_GET_REVISION_TARGET 69 * IP6T_SO_ORIGINAL_DST 80 */ #define IPV6_AUTOFLOWLABEL 70 /* RFC5014: Source address selection */ #define IPV6_ADDR_PREFERENCES 72 #define IPV6_PREFER_SRC_TMP 0x0001 #define IPV6_PREFER_SRC_PUBLIC 0x0002 #define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 #define IPV6_PREFER_SRC_COA 0x0004 #define IPV6_PREFER_SRC_HOME 0x0400 #define IPV6_PREFER_SRC_CGA 0x0008 #define IPV6_PREFER_SRC_NONCGA 0x0800 /* RFC5082: Generalized Ttl Security Mechanism */ #define IPV6_MINHOPCOUNT 73 #define IPV6_ORIGDSTADDR 74 #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR #define IPV6_TRANSPARENT 75 #define IPV6_UNICAST_IF 76 #define IPV6_RECVFRAGSIZE 77 #define IPV6_FREEBIND 78 /* * Multicast Routing: * see include/uapi/linux/mroute6.h. * * MRT6_BASE 200 * ... * MRT6_MAX */ #endif /* _LINUX_IN6_H */ linux/in_route.h 0000644 00000001650 15063602050 0007677 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IN_ROUTE_H #define _LINUX_IN_ROUTE_H /* IPv4 routing cache flags */ #define RTCF_DEAD RTNH_F_DEAD #define RTCF_ONLINK RTNH_F_ONLINK /* Obsolete flag. About to be deleted */ #define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC #define RTCF_NOTIFY 0x00010000 #define RTCF_DIRECTDST 0x00020000 /* unused */ #define RTCF_REDIRECTED 0x00040000 #define RTCF_TPROXY 0x00080000 /* unused */ #define RTCF_FAST 0x00200000 /* unused */ #define RTCF_MASQ 0x00400000 /* unused */ #define RTCF_SNAT 0x00800000 /* unused */ #define RTCF_DOREDIRECT 0x01000000 #define RTCF_DIRECTSRC 0x04000000 #define RTCF_DNAT 0x08000000 #define RTCF_BROADCAST 0x10000000 #define RTCF_MULTICAST 0x20000000 #define RTCF_REJECT 0x40000000 /* unused */ #define RTCF_LOCAL 0x80000000 #define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) #define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) #endif /* _LINUX_IN_ROUTE_H */ linux/inet_diag.h 0000644 00000011100 15063602050 0007765 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _INET_DIAG_H_ #define _INET_DIAG_H_ #include <linux/types.h> /* Just some random number */ #define TCPDIAG_GETSOCK 18 #define DCCPDIAG_GETSOCK 19 #define INET_DIAG_GETSOCK_MAX 24 /* Socket identity */ struct inet_diag_sockid { __be16 idiag_sport; __be16 idiag_dport; __be32 idiag_src[4]; __be32 idiag_dst[4]; __u32 idiag_if; __u32 idiag_cookie[2]; #define INET_DIAG_NOCOOKIE (~0U) }; /* Request structure */ struct inet_diag_req { __u8 idiag_family; /* Family of addresses. */ __u8 idiag_src_len; __u8 idiag_dst_len; __u8 idiag_ext; /* Query extended information */ struct inet_diag_sockid id; __u32 idiag_states; /* States to dump */ __u32 idiag_dbs; /* Tables to dump (NI) */ }; struct inet_diag_req_v2 { __u8 sdiag_family; __u8 sdiag_protocol; __u8 idiag_ext; __u8 pad; __u32 idiag_states; struct inet_diag_sockid id; }; /* * SOCK_RAW sockets require the underlied protocol to be * additionally specified so we can use @pad member for * this, but we can't rename it because userspace programs * still may depend on this name. Instead lets use another * structure definition as an alias for struct * @inet_diag_req_v2. */ struct inet_diag_req_raw { __u8 sdiag_family; __u8 sdiag_protocol; __u8 idiag_ext; __u8 sdiag_raw_protocol; __u32 idiag_states; struct inet_diag_sockid id; }; enum { INET_DIAG_REQ_NONE, INET_DIAG_REQ_BYTECODE, INET_DIAG_REQ_SK_BPF_STORAGES, INET_DIAG_REQ_PROTOCOL, __INET_DIAG_REQ_MAX, }; #define INET_DIAG_REQ_MAX (__INET_DIAG_REQ_MAX - 1) /* Bytecode is sequence of 4 byte commands followed by variable arguments. * All the commands identified by "code" are conditional jumps forward: * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be * length of the command and its arguments. */ struct inet_diag_bc_op { unsigned char code; unsigned char yes; unsigned short no; }; enum { INET_DIAG_BC_NOP, INET_DIAG_BC_JMP, INET_DIAG_BC_S_GE, INET_DIAG_BC_S_LE, INET_DIAG_BC_D_GE, INET_DIAG_BC_D_LE, INET_DIAG_BC_AUTO, INET_DIAG_BC_S_COND, INET_DIAG_BC_D_COND, INET_DIAG_BC_DEV_COND, /* u32 ifindex */ INET_DIAG_BC_MARK_COND, INET_DIAG_BC_S_EQ, INET_DIAG_BC_D_EQ, }; struct inet_diag_hostcond { __u8 family; __u8 prefix_len; int port; __be32 addr[0]; }; struct inet_diag_markcond { __u32 mark; __u32 mask; }; /* Base info structure. It contains socket identity (addrs/ports/cookie) * and, alas, the information shown by netstat. */ struct inet_diag_msg { __u8 idiag_family; __u8 idiag_state; __u8 idiag_timer; __u8 idiag_retrans; struct inet_diag_sockid id; __u32 idiag_expires; __u32 idiag_rqueue; __u32 idiag_wqueue; __u32 idiag_uid; __u32 idiag_inode; }; /* Extensions */ enum { INET_DIAG_NONE, INET_DIAG_MEMINFO, INET_DIAG_INFO, INET_DIAG_VEGASINFO, INET_DIAG_CONG, INET_DIAG_TOS, INET_DIAG_TCLASS, INET_DIAG_SKMEMINFO, INET_DIAG_SHUTDOWN, /* * Next extenstions cannot be requested in struct inet_diag_req_v2: * its field idiag_ext has only 8 bits. */ INET_DIAG_DCTCPINFO, /* request as INET_DIAG_VEGASINFO */ INET_DIAG_PROTOCOL, /* response attribute only */ INET_DIAG_SKV6ONLY, INET_DIAG_LOCALS, INET_DIAG_PEERS, INET_DIAG_PAD, INET_DIAG_MARK, /* only with CAP_NET_ADMIN */ INET_DIAG_BBRINFO, /* request as INET_DIAG_VEGASINFO */ INET_DIAG_CLASS_ID, /* request as INET_DIAG_TCLASS */ INET_DIAG_MD5SIG, INET_DIAG_ULP_INFO, INET_DIAG_SK_BPF_STORAGES, __INET_DIAG_MAX, }; #define INET_DIAG_MAX (__INET_DIAG_MAX - 1) enum { INET_ULP_INFO_UNSPEC, INET_ULP_INFO_NAME, INET_ULP_INFO_TLS, INET_ULP_INFO_MPTCP, __INET_ULP_INFO_MAX, }; #define INET_ULP_INFO_MAX (__INET_ULP_INFO_MAX - 1) /* INET_DIAG_MEM */ struct inet_diag_meminfo { __u32 idiag_rmem; __u32 idiag_wmem; __u32 idiag_fmem; __u32 idiag_tmem; }; /* INET_DIAG_VEGASINFO */ struct tcpvegas_info { __u32 tcpv_enabled; __u32 tcpv_rttcnt; __u32 tcpv_rtt; __u32 tcpv_minrtt; }; /* INET_DIAG_DCTCPINFO */ struct tcp_dctcp_info { __u16 dctcp_enabled; __u16 dctcp_ce_state; __u32 dctcp_alpha; __u32 dctcp_ab_ecn; __u32 dctcp_ab_tot; }; /* INET_DIAG_BBRINFO */ struct tcp_bbr_info { /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */ __u32 bbr_bw_lo; /* lower 32 bits of bw */ __u32 bbr_bw_hi; /* upper 32 bits of bw */ __u32 bbr_min_rtt; /* min-filtered RTT in uSec */ __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */ __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */ }; union tcp_cc_info { struct tcpvegas_info vegas; struct tcp_dctcp_info dctcp; struct tcp_bbr_info bbr; }; #endif /* _INET_DIAG_H_ */ linux/inotify.h 0000644 00000006334 15063602050 0007540 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Inode based directory notification for Linux * * Copyright (C) 2005 John McCutchan */ #ifndef _LINUX_INOTIFY_H #define _LINUX_INOTIFY_H /* For O_CLOEXEC and O_NONBLOCK */ #include <linux/fcntl.h> #include <linux/types.h> /* * struct inotify_event - structure read from the inotify device for each event * * When you are watching a directory, you will receive the filename for events * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd. */ struct inotify_event { __s32 wd; /* watch descriptor */ __u32 mask; /* watch mask */ __u32 cookie; /* cookie to synchronize two events */ __u32 len; /* length (including nulls) of name */ char name[0]; /* stub for possible name */ }; /* the following are legal, implemented events that user-space can watch for */ #define IN_ACCESS 0x00000001 /* File was accessed */ #define IN_MODIFY 0x00000002 /* File was modified */ #define IN_ATTRIB 0x00000004 /* Metadata changed */ #define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ #define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ #define IN_OPEN 0x00000020 /* File was opened */ #define IN_MOVED_FROM 0x00000040 /* File was moved from X */ #define IN_MOVED_TO 0x00000080 /* File was moved to Y */ #define IN_CREATE 0x00000100 /* Subfile was created */ #define IN_DELETE 0x00000200 /* Subfile was deleted */ #define IN_DELETE_SELF 0x00000400 /* Self was deleted */ #define IN_MOVE_SELF 0x00000800 /* Self was moved */ /* the following are legal events. they are sent as needed to any watch */ #define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ #define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ #define IN_IGNORED 0x00008000 /* File was ignored */ /* helper events */ #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */ #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ /* special flags */ #define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ #define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ #define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */ #define IN_MASK_CREATE 0x10000000 /* only create watches */ #define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ #define IN_ISDIR 0x40000000 /* event occurred against dir */ #define IN_ONESHOT 0x80000000 /* only send event once */ /* * All of the events - we build the list by hand so that we can add flags in * the future and not break backward compatibility. Apps will get only the * events that they originally wanted. Be sure to add new events here! */ #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ IN_MOVE_SELF) /* Flags for sys_inotify_init1. */ #define IN_CLOEXEC O_CLOEXEC #define IN_NONBLOCK O_NONBLOCK /* * ioctl numbers: inotify uses 'I' prefix for all ioctls, * except historical FIONREAD, which is based on 'T'. * * INOTIFY_IOC_SETNEXTWD: set desired number of next created * watch descriptor. */ #define INOTIFY_IOC_SETNEXTWD _IOW('I', 0, __s32) #endif /* _LINUX_INOTIFY_H */ linux/input-event-codes.h 0000644 00000067676 15063602050 0011450 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* * Input event codes * * *** IMPORTANT *** * This file is not only included from C-code but also from devicetree source * files. As such this file MUST only contain comments and defines. * * Copyright (c) 1999-2002 Vojtech Pavlik * Copyright (c) 2015 Hans de Goede <hdegoede@redhat.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _INPUT_EVENT_CODES_H #define _INPUT_EVENT_CODES_H /* * Device properties and quirks */ #define INPUT_PROP_POINTER 0x00 /* needs a pointer */ #define INPUT_PROP_DIRECT 0x01 /* direct input devices */ #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ #define INPUT_PROP_MAX 0x1f #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) /* * Event types */ #define EV_SYN 0x00 #define EV_KEY 0x01 #define EV_REL 0x02 #define EV_ABS 0x03 #define EV_MSC 0x04 #define EV_SW 0x05 #define EV_LED 0x11 #define EV_SND 0x12 #define EV_REP 0x14 #define EV_FF 0x15 #define EV_PWR 0x16 #define EV_FF_STATUS 0x17 #define EV_MAX 0x1f #define EV_CNT (EV_MAX+1) /* * Synchronization events. */ #define SYN_REPORT 0 #define SYN_CONFIG 1 #define SYN_MT_REPORT 2 #define SYN_DROPPED 3 #define SYN_MAX 0xf #define SYN_CNT (SYN_MAX+1) /* * Keys and buttons * * Most of the keys/buttons are modeled after USB HUT 1.12 * (see http://www.usb.org/developers/hidpage). * Abbreviations in the comments: * AC - Application Control * AL - Application Launch Button * SC - System Control */ #define KEY_RESERVED 0 #define KEY_ESC 1 #define KEY_1 2 #define KEY_2 3 #define KEY_3 4 #define KEY_4 5 #define KEY_5 6 #define KEY_6 7 #define KEY_7 8 #define KEY_8 9 #define KEY_9 10 #define KEY_0 11 #define KEY_MINUS 12 #define KEY_EQUAL 13 #define KEY_BACKSPACE 14 #define KEY_TAB 15 #define KEY_Q 16 #define KEY_W 17 #define KEY_E 18 #define KEY_R 19 #define KEY_T 20 #define KEY_Y 21 #define KEY_U 22 #define KEY_I 23 #define KEY_O 24 #define KEY_P 25 #define KEY_LEFTBRACE 26 #define KEY_RIGHTBRACE 27 #define KEY_ENTER 28 #define KEY_LEFTCTRL 29 #define KEY_A 30 #define KEY_S 31 #define KEY_D 32 #define KEY_F 33 #define KEY_G 34 #define KEY_H 35 #define KEY_J 36 #define KEY_K 37 #define KEY_L 38 #define KEY_SEMICOLON 39 #define KEY_APOSTROPHE 40 #define KEY_GRAVE 41 #define KEY_LEFTSHIFT 42 #define KEY_BACKSLASH 43 #define KEY_Z 44 #define KEY_X 45 #define KEY_C 46 #define KEY_V 47 #define KEY_B 48 #define KEY_N 49 #define KEY_M 50 #define KEY_COMMA 51 #define KEY_DOT 52 #define KEY_SLASH 53 #define KEY_RIGHTSHIFT 54 #define KEY_KPASTERISK 55 #define KEY_LEFTALT 56 #define KEY_SPACE 57 #define KEY_CAPSLOCK 58 #define KEY_F1 59 #define KEY_F2 60 #define KEY_F3 61 #define KEY_F4 62 #define KEY_F5 63 #define KEY_F6 64 #define KEY_F7 65 #define KEY_F8 66 #define KEY_F9 67 #define KEY_F10 68 #define KEY_NUMLOCK 69 #define KEY_SCROLLLOCK 70 #define KEY_KP7 71 #define KEY_KP8 72 #define KEY_KP9 73 #define KEY_KPMINUS 74 #define KEY_KP4 75 #define KEY_KP5 76 #define KEY_KP6 77 #define KEY_KPPLUS 78 #define KEY_KP1 79 #define KEY_KP2 80 #define KEY_KP3 81 #define KEY_KP0 82 #define KEY_KPDOT 83 #define KEY_ZENKAKUHANKAKU 85 #define KEY_102ND 86 #define KEY_F11 87 #define KEY_F12 88 #define KEY_RO 89 #define KEY_KATAKANA 90 #define KEY_HIRAGANA 91 #define KEY_HENKAN 92 #define KEY_KATAKANAHIRAGANA 93 #define KEY_MUHENKAN 94 #define KEY_KPJPCOMMA 95 #define KEY_KPENTER 96 #define KEY_RIGHTCTRL 97 #define KEY_KPSLASH 98 #define KEY_SYSRQ 99 #define KEY_RIGHTALT 100 #define KEY_LINEFEED 101 #define KEY_HOME 102 #define KEY_UP 103 #define KEY_PAGEUP 104 #define KEY_LEFT 105 #define KEY_RIGHT 106 #define KEY_END 107 #define KEY_DOWN 108 #define KEY_PAGEDOWN 109 #define KEY_INSERT 110 #define KEY_DELETE 111 #define KEY_MACRO 112 #define KEY_MUTE 113 #define KEY_VOLUMEDOWN 114 #define KEY_VOLUMEUP 115 #define KEY_POWER 116 /* SC System Power Down */ #define KEY_KPEQUAL 117 #define KEY_KPPLUSMINUS 118 #define KEY_PAUSE 119 #define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ #define KEY_KPCOMMA 121 #define KEY_HANGEUL 122 #define KEY_HANGUEL KEY_HANGEUL #define KEY_HANJA 123 #define KEY_YEN 124 #define KEY_LEFTMETA 125 #define KEY_RIGHTMETA 126 #define KEY_COMPOSE 127 #define KEY_STOP 128 /* AC Stop */ #define KEY_AGAIN 129 #define KEY_PROPS 130 /* AC Properties */ #define KEY_UNDO 131 /* AC Undo */ #define KEY_FRONT 132 #define KEY_COPY 133 /* AC Copy */ #define KEY_OPEN 134 /* AC Open */ #define KEY_PASTE 135 /* AC Paste */ #define KEY_FIND 136 /* AC Search */ #define KEY_CUT 137 /* AC Cut */ #define KEY_HELP 138 /* AL Integrated Help Center */ #define KEY_MENU 139 /* Menu (show menu) */ #define KEY_CALC 140 /* AL Calculator */ #define KEY_SETUP 141 #define KEY_SLEEP 142 /* SC System Sleep */ #define KEY_WAKEUP 143 /* System Wake Up */ #define KEY_FILE 144 /* AL Local Machine Browser */ #define KEY_SENDFILE 145 #define KEY_DELETEFILE 146 #define KEY_XFER 147 #define KEY_PROG1 148 #define KEY_PROG2 149 #define KEY_WWW 150 /* AL Internet Browser */ #define KEY_MSDOS 151 #define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ #define KEY_SCREENLOCK KEY_COFFEE #define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */ #define KEY_DIRECTION KEY_ROTATE_DISPLAY #define KEY_CYCLEWINDOWS 154 #define KEY_MAIL 155 #define KEY_BOOKMARKS 156 /* AC Bookmarks */ #define KEY_COMPUTER 157 #define KEY_BACK 158 /* AC Back */ #define KEY_FORWARD 159 /* AC Forward */ #define KEY_CLOSECD 160 #define KEY_EJECTCD 161 #define KEY_EJECTCLOSECD 162 #define KEY_NEXTSONG 163 #define KEY_PLAYPAUSE 164 #define KEY_PREVIOUSSONG 165 #define KEY_STOPCD 166 #define KEY_RECORD 167 #define KEY_REWIND 168 #define KEY_PHONE 169 /* Media Select Telephone */ #define KEY_ISO 170 #define KEY_CONFIG 171 /* AL Consumer Control Configuration */ #define KEY_HOMEPAGE 172 /* AC Home */ #define KEY_REFRESH 173 /* AC Refresh */ #define KEY_EXIT 174 /* AC Exit */ #define KEY_MOVE 175 #define KEY_EDIT 176 #define KEY_SCROLLUP 177 #define KEY_SCROLLDOWN 178 #define KEY_KPLEFTPAREN 179 #define KEY_KPRIGHTPAREN 180 #define KEY_NEW 181 /* AC New */ #define KEY_REDO 182 /* AC Redo/Repeat */ #define KEY_F13 183 #define KEY_F14 184 #define KEY_F15 185 #define KEY_F16 186 #define KEY_F17 187 #define KEY_F18 188 #define KEY_F19 189 #define KEY_F20 190 #define KEY_F21 191 #define KEY_F22 192 #define KEY_F23 193 #define KEY_F24 194 #define KEY_PLAYCD 200 #define KEY_PAUSECD 201 #define KEY_PROG3 202 #define KEY_PROG4 203 #define KEY_DASHBOARD 204 /* AL Dashboard */ #define KEY_SUSPEND 205 #define KEY_CLOSE 206 /* AC Close */ #define KEY_PLAY 207 #define KEY_FASTFORWARD 208 #define KEY_BASSBOOST 209 #define KEY_PRINT 210 /* AC Print */ #define KEY_HP 211 #define KEY_CAMERA 212 #define KEY_SOUND 213 #define KEY_QUESTION 214 #define KEY_EMAIL 215 #define KEY_CHAT 216 #define KEY_SEARCH 217 #define KEY_CONNECT 218 #define KEY_FINANCE 219 /* AL Checkbook/Finance */ #define KEY_SPORT 220 #define KEY_SHOP 221 #define KEY_ALTERASE 222 #define KEY_CANCEL 223 /* AC Cancel */ #define KEY_BRIGHTNESSDOWN 224 #define KEY_BRIGHTNESSUP 225 #define KEY_MEDIA 226 #define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video outputs (Monitor/LCD/TV-out/etc) */ #define KEY_KBDILLUMTOGGLE 228 #define KEY_KBDILLUMDOWN 229 #define KEY_KBDILLUMUP 230 #define KEY_SEND 231 /* AC Send */ #define KEY_REPLY 232 /* AC Reply */ #define KEY_FORWARDMAIL 233 /* AC Forward Msg */ #define KEY_SAVE 234 /* AC Save */ #define KEY_DOCUMENTS 235 #define KEY_BATTERY 236 #define KEY_BLUETOOTH 237 #define KEY_WLAN 238 #define KEY_UWB 239 #define KEY_UNKNOWN 240 #define KEY_VIDEO_NEXT 241 /* drive next video source */ #define KEY_VIDEO_PREV 242 /* drive previous video source */ #define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ #define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual brightness control is off, rely on ambient */ #define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO #define KEY_DISPLAY_OFF 245 /* display device to off state */ #define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */ #define KEY_WIMAX KEY_WWAN #define KEY_RFKILL 247 /* Key that controls all radios */ #define KEY_MICMUTE 248 /* Mute / unmute the microphone */ /* Code 255 is reserved for special needs of AT keyboard driver */ #define BTN_MISC 0x100 #define BTN_0 0x100 #define BTN_1 0x101 #define BTN_2 0x102 #define BTN_3 0x103 #define BTN_4 0x104 #define BTN_5 0x105 #define BTN_6 0x106 #define BTN_7 0x107 #define BTN_8 0x108 #define BTN_9 0x109 #define BTN_MOUSE 0x110 #define BTN_LEFT 0x110 #define BTN_RIGHT 0x111 #define BTN_MIDDLE 0x112 #define BTN_SIDE 0x113 #define BTN_EXTRA 0x114 #define BTN_FORWARD 0x115 #define BTN_BACK 0x116 #define BTN_TASK 0x117 #define BTN_JOYSTICK 0x120 #define BTN_TRIGGER 0x120 #define BTN_THUMB 0x121 #define BTN_THUMB2 0x122 #define BTN_TOP 0x123 #define BTN_TOP2 0x124 #define BTN_PINKIE 0x125 #define BTN_BASE 0x126 #define BTN_BASE2 0x127 #define BTN_BASE3 0x128 #define BTN_BASE4 0x129 #define BTN_BASE5 0x12a #define BTN_BASE6 0x12b #define BTN_DEAD 0x12f #define BTN_GAMEPAD 0x130 #define BTN_SOUTH 0x130 #define BTN_A BTN_SOUTH #define BTN_EAST 0x131 #define BTN_B BTN_EAST #define BTN_C 0x132 #define BTN_NORTH 0x133 #define BTN_X BTN_NORTH #define BTN_WEST 0x134 #define BTN_Y BTN_WEST #define BTN_Z 0x135 #define BTN_TL 0x136 #define BTN_TR 0x137 #define BTN_TL2 0x138 #define BTN_TR2 0x139 #define BTN_SELECT 0x13a #define BTN_START 0x13b #define BTN_MODE 0x13c #define BTN_THUMBL 0x13d #define BTN_THUMBR 0x13e #define BTN_DIGI 0x140 #define BTN_TOOL_PEN 0x140 #define BTN_TOOL_RUBBER 0x141 #define BTN_TOOL_BRUSH 0x142 #define BTN_TOOL_PENCIL 0x143 #define BTN_TOOL_AIRBRUSH 0x144 #define BTN_TOOL_FINGER 0x145 #define BTN_TOOL_MOUSE 0x146 #define BTN_TOOL_LENS 0x147 #define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ #define BTN_STYLUS3 0x149 #define BTN_TOUCH 0x14a #define BTN_STYLUS 0x14b #define BTN_STYLUS2 0x14c #define BTN_TOOL_DOUBLETAP 0x14d #define BTN_TOOL_TRIPLETAP 0x14e #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ #define BTN_WHEEL 0x150 #define BTN_GEAR_DOWN 0x150 #define BTN_GEAR_UP 0x151 #define KEY_OK 0x160 #define KEY_SELECT 0x161 #define KEY_GOTO 0x162 #define KEY_CLEAR 0x163 #define KEY_POWER2 0x164 #define KEY_OPTION 0x165 #define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ #define KEY_TIME 0x167 #define KEY_VENDOR 0x168 #define KEY_ARCHIVE 0x169 #define KEY_PROGRAM 0x16a /* Media Select Program Guide */ #define KEY_CHANNEL 0x16b #define KEY_FAVORITES 0x16c #define KEY_EPG 0x16d #define KEY_PVR 0x16e /* Media Select Home */ #define KEY_MHP 0x16f #define KEY_LANGUAGE 0x170 #define KEY_TITLE 0x171 #define KEY_SUBTITLE 0x172 #define KEY_ANGLE 0x173 #define KEY_FULL_SCREEN 0x174 /* AC View Toggle */ #define KEY_ZOOM KEY_FULL_SCREEN #define KEY_MODE 0x175 #define KEY_KEYBOARD 0x176 #define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */ #define KEY_SCREEN KEY_ASPECT_RATIO #define KEY_PC 0x178 /* Media Select Computer */ #define KEY_TV 0x179 /* Media Select TV */ #define KEY_TV2 0x17a /* Media Select Cable */ #define KEY_VCR 0x17b /* Media Select VCR */ #define KEY_VCR2 0x17c /* VCR Plus */ #define KEY_SAT 0x17d /* Media Select Satellite */ #define KEY_SAT2 0x17e #define KEY_CD 0x17f /* Media Select CD */ #define KEY_TAPE 0x180 /* Media Select Tape */ #define KEY_RADIO 0x181 #define KEY_TUNER 0x182 /* Media Select Tuner */ #define KEY_PLAYER 0x183 #define KEY_TEXT 0x184 #define KEY_DVD 0x185 /* Media Select DVD */ #define KEY_AUX 0x186 #define KEY_MP3 0x187 #define KEY_AUDIO 0x188 /* AL Audio Browser */ #define KEY_VIDEO 0x189 /* AL Movie Browser */ #define KEY_DIRECTORY 0x18a #define KEY_LIST 0x18b #define KEY_MEMO 0x18c /* Media Select Messages */ #define KEY_CALENDAR 0x18d #define KEY_RED 0x18e #define KEY_GREEN 0x18f #define KEY_YELLOW 0x190 #define KEY_BLUE 0x191 #define KEY_CHANNELUP 0x192 /* Channel Increment */ #define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ #define KEY_FIRST 0x194 #define KEY_LAST 0x195 /* Recall Last */ #define KEY_AB 0x196 #define KEY_NEXT 0x197 #define KEY_RESTART 0x198 #define KEY_SLOW 0x199 #define KEY_SHUFFLE 0x19a #define KEY_BREAK 0x19b #define KEY_PREVIOUS 0x19c #define KEY_DIGITS 0x19d #define KEY_TEEN 0x19e #define KEY_TWEN 0x19f #define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ #define KEY_GAMES 0x1a1 /* Media Select Games */ #define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ #define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ #define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ #define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ #define KEY_EDITOR 0x1a6 /* AL Text Editor */ #define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ #define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ #define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ #define KEY_DATABASE 0x1aa /* AL Database App */ #define KEY_NEWS 0x1ab /* AL Newsreader */ #define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ #define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ #define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ #define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ #define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE #define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ #define KEY_LOGOFF 0x1b1 /* AL Logoff */ #define KEY_DOLLAR 0x1b2 #define KEY_EURO 0x1b3 #define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ #define KEY_FRAMEFORWARD 0x1b5 #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ #define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ #define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ #define KEY_IMAGES 0x1ba /* AL Image Browser */ #define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */ #define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */ #define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */ #define KEY_DEL_EOL 0x1c0 #define KEY_DEL_EOS 0x1c1 #define KEY_INS_LINE 0x1c2 #define KEY_DEL_LINE 0x1c3 #define KEY_FN 0x1d0 #define KEY_FN_ESC 0x1d1 #define KEY_FN_F1 0x1d2 #define KEY_FN_F2 0x1d3 #define KEY_FN_F3 0x1d4 #define KEY_FN_F4 0x1d5 #define KEY_FN_F5 0x1d6 #define KEY_FN_F6 0x1d7 #define KEY_FN_F7 0x1d8 #define KEY_FN_F8 0x1d9 #define KEY_FN_F9 0x1da #define KEY_FN_F10 0x1db #define KEY_FN_F11 0x1dc #define KEY_FN_F12 0x1dd #define KEY_FN_1 0x1de #define KEY_FN_2 0x1df #define KEY_FN_D 0x1e0 #define KEY_FN_E 0x1e1 #define KEY_FN_F 0x1e2 #define KEY_FN_S 0x1e3 #define KEY_FN_B 0x1e4 #define KEY_FN_RIGHT_SHIFT 0x1e5 #define KEY_BRL_DOT1 0x1f1 #define KEY_BRL_DOT2 0x1f2 #define KEY_BRL_DOT3 0x1f3 #define KEY_BRL_DOT4 0x1f4 #define KEY_BRL_DOT5 0x1f5 #define KEY_BRL_DOT6 0x1f6 #define KEY_BRL_DOT7 0x1f7 #define KEY_BRL_DOT8 0x1f8 #define KEY_BRL_DOT9 0x1f9 #define KEY_BRL_DOT10 0x1fa #define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ #define KEY_NUMERIC_1 0x201 /* and other keypads */ #define KEY_NUMERIC_2 0x202 #define KEY_NUMERIC_3 0x203 #define KEY_NUMERIC_4 0x204 #define KEY_NUMERIC_5 0x205 #define KEY_NUMERIC_6 0x206 #define KEY_NUMERIC_7 0x207 #define KEY_NUMERIC_8 0x208 #define KEY_NUMERIC_9 0x209 #define KEY_NUMERIC_STAR 0x20a #define KEY_NUMERIC_POUND 0x20b #define KEY_NUMERIC_A 0x20c /* Phone key A - HUT Telephony 0xb9 */ #define KEY_NUMERIC_B 0x20d #define KEY_NUMERIC_C 0x20e #define KEY_NUMERIC_D 0x20f #define KEY_CAMERA_FOCUS 0x210 #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ #define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */ #define KEY_TOUCHPAD_ON 0x213 #define KEY_TOUCHPAD_OFF 0x214 #define KEY_CAMERA_ZOOMIN 0x215 #define KEY_CAMERA_ZOOMOUT 0x216 #define KEY_CAMERA_UP 0x217 #define KEY_CAMERA_DOWN 0x218 #define KEY_CAMERA_LEFT 0x219 #define KEY_CAMERA_RIGHT 0x21a #define KEY_ATTENDANT_ON 0x21b #define KEY_ATTENDANT_OFF 0x21c #define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */ #define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */ #define BTN_DPAD_UP 0x220 #define BTN_DPAD_DOWN 0x221 #define BTN_DPAD_LEFT 0x222 #define BTN_DPAD_RIGHT 0x223 #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ #define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */ #define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ #define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ #define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */ #define KEY_CONTROLPANEL 0x243 /* AL Control Panel */ #define KEY_APPSELECT 0x244 /* AL Select Task/Application */ #define KEY_SCREENSAVER 0x245 /* AL Screen Saver */ #define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ #define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */ #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */ #define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ #define KEY_KBDINPUTASSIST_PREV 0x260 #define KEY_KBDINPUTASSIST_NEXT 0x261 #define KEY_KBDINPUTASSIST_PREVGROUP 0x262 #define KEY_KBDINPUTASSIST_NEXTGROUP 0x263 #define KEY_KBDINPUTASSIST_ACCEPT 0x264 #define KEY_KBDINPUTASSIST_CANCEL 0x265 /* Diagonal movement keys */ #define KEY_RIGHT_UP 0x266 #define KEY_RIGHT_DOWN 0x267 #define KEY_LEFT_UP 0x268 #define KEY_LEFT_DOWN 0x269 #define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */ /* Show Top Menu of the Media (e.g. DVD) */ #define KEY_MEDIA_TOP_MENU 0x26b #define KEY_NUMERIC_11 0x26c #define KEY_NUMERIC_12 0x26d /* * Toggle Audio Description: refers to an audio service that helps blind and * visually impaired consumers understand the action in a program. Note: in * some countries this is referred to as "Video Description". */ #define KEY_AUDIO_DESC 0x26e #define KEY_3D_MODE 0x26f #define KEY_NEXT_FAVORITE 0x270 #define KEY_STOP_RECORD 0x271 #define KEY_PAUSE_RECORD 0x272 #define KEY_VOD 0x273 /* Video on Demand */ #define KEY_UNMUTE 0x274 #define KEY_FASTREVERSE 0x275 #define KEY_SLOWREVERSE 0x276 /* * Control a data application associated with the currently viewed channel, * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) */ #define KEY_DATA 0x277 #define KEY_ONSCREEN_KEYBOARD 0x278 /* Electronic privacy screen control */ #define KEY_PRIVACY_SCREEN_TOGGLE 0x279 /* Select an area of screen to be copied */ #define KEY_SELECTIVE_SCREENSHOT 0x27a /* * Some keyboards have keys which do not have a defined meaning, these keys * are intended to be programmed / bound to macros by the user. For most * keyboards with these macro-keys the key-sequence to inject, or action to * take, is all handled by software on the host side. So from the kernel's * point of view these are just normal keys. * * The KEY_MACRO# codes below are intended for such keys, which may be labeled * e.g. G1-G18, or S1 - S30. The KEY_MACRO# codes MUST NOT be used for keys * where the marking on the key does indicate a defined meaning / purpose. * * The KEY_MACRO# codes MUST also NOT be used as fallback for when no existing * KEY_FOO define matches the marking / purpose. In this case a new KEY_FOO * define MUST be added. */ #define KEY_MACRO1 0x290 #define KEY_MACRO2 0x291 #define KEY_MACRO3 0x292 #define KEY_MACRO4 0x293 #define KEY_MACRO5 0x294 #define KEY_MACRO6 0x295 #define KEY_MACRO7 0x296 #define KEY_MACRO8 0x297 #define KEY_MACRO9 0x298 #define KEY_MACRO10 0x299 #define KEY_MACRO11 0x29a #define KEY_MACRO12 0x29b #define KEY_MACRO13 0x29c #define KEY_MACRO14 0x29d #define KEY_MACRO15 0x29e #define KEY_MACRO16 0x29f #define KEY_MACRO17 0x2a0 #define KEY_MACRO18 0x2a1 #define KEY_MACRO19 0x2a2 #define KEY_MACRO20 0x2a3 #define KEY_MACRO21 0x2a4 #define KEY_MACRO22 0x2a5 #define KEY_MACRO23 0x2a6 #define KEY_MACRO24 0x2a7 #define KEY_MACRO25 0x2a8 #define KEY_MACRO26 0x2a9 #define KEY_MACRO27 0x2aa #define KEY_MACRO28 0x2ab #define KEY_MACRO29 0x2ac #define KEY_MACRO30 0x2ad /* * Some keyboards with the macro-keys described above have some extra keys * for controlling the host-side software responsible for the macro handling: * -A macro recording start/stop key. Note that not all keyboards which emit * KEY_MACRO_RECORD_START will also emit KEY_MACRO_RECORD_STOP if * KEY_MACRO_RECORD_STOP is not advertised, then KEY_MACRO_RECORD_START * should be interpreted as a recording start/stop toggle; * -Keys for switching between different macro (pre)sets, either a key for * cycling through the configured presets or keys to directly select a preset. */ #define KEY_MACRO_RECORD_START 0x2b0 #define KEY_MACRO_RECORD_STOP 0x2b1 #define KEY_MACRO_PRESET_CYCLE 0x2b2 #define KEY_MACRO_PRESET1 0x2b3 #define KEY_MACRO_PRESET2 0x2b4 #define KEY_MACRO_PRESET3 0x2b5 /* * Some keyboards have a buildin LCD panel where the contents are controlled * by the host. Often these have a number of keys directly below the LCD * intended for controlling a menu shown on the LCD. These keys often don't * have any labeling so we just name them KEY_KBD_LCD_MENU# */ #define KEY_KBD_LCD_MENU1 0x2b8 #define KEY_KBD_LCD_MENU2 0x2b9 #define KEY_KBD_LCD_MENU3 0x2ba #define KEY_KBD_LCD_MENU4 0x2bb #define KEY_KBD_LCD_MENU5 0x2bc #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY2 0x2c1 #define BTN_TRIGGER_HAPPY3 0x2c2 #define BTN_TRIGGER_HAPPY4 0x2c3 #define BTN_TRIGGER_HAPPY5 0x2c4 #define BTN_TRIGGER_HAPPY6 0x2c5 #define BTN_TRIGGER_HAPPY7 0x2c6 #define BTN_TRIGGER_HAPPY8 0x2c7 #define BTN_TRIGGER_HAPPY9 0x2c8 #define BTN_TRIGGER_HAPPY10 0x2c9 #define BTN_TRIGGER_HAPPY11 0x2ca #define BTN_TRIGGER_HAPPY12 0x2cb #define BTN_TRIGGER_HAPPY13 0x2cc #define BTN_TRIGGER_HAPPY14 0x2cd #define BTN_TRIGGER_HAPPY15 0x2ce #define BTN_TRIGGER_HAPPY16 0x2cf #define BTN_TRIGGER_HAPPY17 0x2d0 #define BTN_TRIGGER_HAPPY18 0x2d1 #define BTN_TRIGGER_HAPPY19 0x2d2 #define BTN_TRIGGER_HAPPY20 0x2d3 #define BTN_TRIGGER_HAPPY21 0x2d4 #define BTN_TRIGGER_HAPPY22 0x2d5 #define BTN_TRIGGER_HAPPY23 0x2d6 #define BTN_TRIGGER_HAPPY24 0x2d7 #define BTN_TRIGGER_HAPPY25 0x2d8 #define BTN_TRIGGER_HAPPY26 0x2d9 #define BTN_TRIGGER_HAPPY27 0x2da #define BTN_TRIGGER_HAPPY28 0x2db #define BTN_TRIGGER_HAPPY29 0x2dc #define BTN_TRIGGER_HAPPY30 0x2dd #define BTN_TRIGGER_HAPPY31 0x2de #define BTN_TRIGGER_HAPPY32 0x2df #define BTN_TRIGGER_HAPPY33 0x2e0 #define BTN_TRIGGER_HAPPY34 0x2e1 #define BTN_TRIGGER_HAPPY35 0x2e2 #define BTN_TRIGGER_HAPPY36 0x2e3 #define BTN_TRIGGER_HAPPY37 0x2e4 #define BTN_TRIGGER_HAPPY38 0x2e5 #define BTN_TRIGGER_HAPPY39 0x2e6 #define BTN_TRIGGER_HAPPY40 0x2e7 /* We avoid low common keys in module aliases so they don't get huge. */ #define KEY_MIN_INTERESTING KEY_MUTE #define KEY_MAX 0x2ff #define KEY_CNT (KEY_MAX+1) /* * Relative axes */ #define REL_X 0x00 #define REL_Y 0x01 #define REL_Z 0x02 #define REL_RX 0x03 #define REL_RY 0x04 #define REL_RZ 0x05 #define REL_HWHEEL 0x06 #define REL_DIAL 0x07 #define REL_WHEEL 0x08 #define REL_MISC 0x09 /* * 0x0a is reserved and should not be used in input drivers. * It was used by HID as REL_MISC+1 and userspace needs to detect if * the next REL_* event is correct or is just REL_MISC + n. * We define here REL_RESERVED so userspace can rely on it and detect * the situation described above. */ #define REL_RESERVED 0x0a #define REL_WHEEL_HI_RES 0x0b #define REL_HWHEEL_HI_RES 0x0c #define REL_MAX 0x0f #define REL_CNT (REL_MAX+1) /* * Absolute axes */ #define ABS_X 0x00 #define ABS_Y 0x01 #define ABS_Z 0x02 #define ABS_RX 0x03 #define ABS_RY 0x04 #define ABS_RZ 0x05 #define ABS_THROTTLE 0x06 #define ABS_RUDDER 0x07 #define ABS_WHEEL 0x08 #define ABS_GAS 0x09 #define ABS_BRAKE 0x0a #define ABS_HAT0X 0x10 #define ABS_HAT0Y 0x11 #define ABS_HAT1X 0x12 #define ABS_HAT1Y 0x13 #define ABS_HAT2X 0x14 #define ABS_HAT2Y 0x15 #define ABS_HAT3X 0x16 #define ABS_HAT3Y 0x17 #define ABS_PRESSURE 0x18 #define ABS_DISTANCE 0x19 #define ABS_TILT_X 0x1a #define ABS_TILT_Y 0x1b #define ABS_TOOL_WIDTH 0x1c #define ABS_VOLUME 0x20 #define ABS_MISC 0x28 /* * 0x2e is reserved and should not be used in input drivers. * It was used by HID as ABS_MISC+6 and userspace needs to detect if * the next ABS_* event is correct or is just ABS_MISC + n. * We define here ABS_RESERVED so userspace can rely on it and detect * the situation described above. */ #define ABS_RESERVED 0x2e #define ABS_MT_SLOT 0x2f /* MT slot being modified */ #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ #define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ #define ABS_MT_POSITION_X 0x35 /* Center X touch position */ #define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */ #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ #define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ #define ABS_MT_TOOL_X 0x3c /* Center X tool position */ #define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */ #define ABS_MAX 0x3f #define ABS_CNT (ABS_MAX+1) /* * Switch events */ #define SW_LID 0x00 /* set = lid shut */ #define SW_TABLET_MODE 0x01 /* set = tablet mode */ #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ #define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" set = radio enabled */ #define SW_RADIO SW_RFKILL_ALL /* deprecated */ #define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ #define SW_DOCK 0x05 /* set = plugged into dock */ #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ #define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ #define SW_MACHINE_COVER 0x10 /* set = cover closed */ #define SW_MAX 0x10 #define SW_CNT (SW_MAX+1) /* * Misc events */ #define MSC_SERIAL 0x00 #define MSC_PULSELED 0x01 #define MSC_GESTURE 0x02 #define MSC_RAW 0x03 #define MSC_SCAN 0x04 #define MSC_TIMESTAMP 0x05 #define MSC_MAX 0x07 #define MSC_CNT (MSC_MAX+1) /* * LEDs */ #define LED_NUML 0x00 #define LED_CAPSL 0x01 #define LED_SCROLLL 0x02 #define LED_COMPOSE 0x03 #define LED_KANA 0x04 #define LED_SLEEP 0x05 #define LED_SUSPEND 0x06 #define LED_MUTE 0x07 #define LED_MISC 0x08 #define LED_MAIL 0x09 #define LED_CHARGING 0x0a #define LED_MAX 0x0f #define LED_CNT (LED_MAX+1) /* * Autorepeat values */ #define REP_DELAY 0x00 #define REP_PERIOD 0x01 #define REP_MAX 0x01 #define REP_CNT (REP_MAX+1) /* * Sounds */ #define SND_CLICK 0x00 #define SND_BELL 0x01 #define SND_TONE 0x02 #define SND_MAX 0x07 #define SND_CNT (SND_MAX+1) #endif linux/input.h 0000644 00000037161 15063602050 0007220 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 1999-2002 Vojtech Pavlik * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _INPUT_H #define _INPUT_H #include <sys/time.h> #include <sys/ioctl.h> #include <sys/types.h> #include <linux/types.h> #include "input-event-codes.h" /* * The event structure itself * Note that __USE_TIME_BITS64 is defined by libc based on * application's request to use 64 bit time_t. */ struct input_event { #if (__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64)) && !defined(__KERNEL__) struct timeval time; #define input_event_sec time.tv_sec #define input_event_usec time.tv_usec #else __kernel_ulong_t __sec; #if defined(__sparc__) && defined(__arch64__) unsigned int __usec; unsigned int __pad; #else __kernel_ulong_t __usec; #endif #define input_event_sec __sec #define input_event_usec __usec #endif __u16 type; __u16 code; __s32 value; }; /* * Protocol version. */ #define EV_VERSION 0x010001 /* * IOCTLs (0x00 - 0x7f) */ struct input_id { __u16 bustype; __u16 vendor; __u16 product; __u16 version; }; /** * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls * @value: latest reported value for the axis. * @minimum: specifies minimum value for the axis. * @maximum: specifies maximum value for the axis. * @fuzz: specifies fuzz value that is used to filter noise from * the event stream. * @flat: values that are within this value will be discarded by * joydev interface and reported as 0 instead. * @resolution: specifies resolution for the values reported for * the axis. * * Note that input core does not clamp reported values to the * [minimum, maximum] limits, such task is left to userspace. * * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z) * is reported in units per millimeter (units/mm), resolution * for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported * in units per radian. * When INPUT_PROP_ACCELEROMETER is set the resolution changes. * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in * in units per g (units/g) and in units per degree per second * (units/deg/s) for rotational axes (ABS_RX, ABS_RY, ABS_RZ). */ struct input_absinfo { __s32 value; __s32 minimum; __s32 maximum; __s32 fuzz; __s32 flat; __s32 resolution; }; /** * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls * @scancode: scancode represented in machine-endian form. * @len: length of the scancode that resides in @scancode buffer. * @index: index in the keymap, may be used instead of scancode * @flags: allows to specify how kernel should handle the request. For * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel * should perform lookup in keymap by @index instead of @scancode * @keycode: key code assigned to this scancode * * The structure is used to retrieve and modify keymap data. Users have * option of performing lookup either by @scancode itself or by @index * in keymap entry. EVIOCGKEYCODE will also return scancode or index * (depending on which element was used to perform lookup). */ struct input_keymap_entry { #define INPUT_KEYMAP_BY_INDEX (1 << 0) __u8 flags; __u8 len; __u16 index; __u32 keycode; __u8 scancode[32]; }; struct input_mask { __u32 type; __u32 codes_size; __u64 codes_ptr; }; #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */ #define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry) #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */ #define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry) #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ /** * EVIOCGMTSLOTS(len) - get MT slot values * @len: size of the data buffer in bytes * * The ioctl buffer argument should be binary equivalent to * * struct input_mt_request_layout { * __u32 code; * __s32 values[num_slots]; * }; * * where num_slots is the (arbitrary) number of MT slots to extract. * * The ioctl size argument (len) is the size of the buffer, which * should satisfy len = (num_slots + 1) * sizeof(__s32). If len is * too small to fit all available slots, the first num_slots are * returned. * * Before the call, code is set to the wanted ABS_MT event type. On * return, values[] is filled with the slot values for the specified * ABS_MT code. * * If the request code is not an ABS_MT value, -EINVAL is returned. */ #define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len) #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */ #define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */ #define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */ #define EVIOCSFF _IOW('E', 0x80, struct ff_effect) /* send a force effect to a force feedback device */ #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ #define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */ /** * EVIOCGMASK - Retrieve current event mask * * This ioctl allows user to retrieve the current event mask for specific * event type. The argument must be of type "struct input_mask" and * specifies the event type to query, the address of the receive buffer and * the size of the receive buffer. * * The event mask is a per-client mask that specifies which events are * forwarded to the client. Each event code is represented by a single bit * in the event mask. If the bit is set, the event is passed to the client * normally. Otherwise, the event is filtered and will never be queued on * the client's receive buffer. * * Event masks do not affect global state of the input device. They only * affect the file descriptor they are applied to. * * The default event mask for a client has all bits set, i.e. all events * are forwarded to the client. If the kernel is queried for an unknown * event type or if the receive buffer is larger than the number of * event codes known to the kernel, the kernel returns all zeroes for those * codes. * * At maximum, codes_size bytes are copied. * * This ioctl may fail with ENODEV in case the file is revoked, EFAULT * if the receive-buffer points to invalid memory, or EINVAL if the kernel * does not implement the ioctl. */ #define EVIOCGMASK _IOR('E', 0x92, struct input_mask) /* Get event-masks */ /** * EVIOCSMASK - Set event mask * * This ioctl is the counterpart to EVIOCGMASK. Instead of receiving the * current event mask, this changes the client's event mask for a specific * type. See EVIOCGMASK for a description of event-masks and the * argument-type. * * This ioctl provides full forward compatibility. If the passed event type * is unknown to the kernel, or if the number of event codes specified in * the mask is bigger than what is known to the kernel, the ioctl is still * accepted and applied. However, any unknown codes are left untouched and * stay cleared. That means, the kernel always filters unknown codes * regardless of what the client requests. If the new mask doesn't cover * all known event-codes, all remaining codes are automatically cleared and * thus filtered. * * This ioctl may fail with ENODEV in case the file is revoked. EFAULT is * returned if the receive-buffer points to invalid memory. EINVAL is returned * if the kernel does not implement the ioctl. */ #define EVIOCSMASK _IOW('E', 0x93, struct input_mask) /* Set event-masks */ #define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ /* * IDs. */ #define ID_BUS 0 #define ID_VENDOR 1 #define ID_PRODUCT 2 #define ID_VERSION 3 #define BUS_PCI 0x01 #define BUS_ISAPNP 0x02 #define BUS_USB 0x03 #define BUS_HIL 0x04 #define BUS_BLUETOOTH 0x05 #define BUS_VIRTUAL 0x06 #define BUS_ISA 0x10 #define BUS_I8042 0x11 #define BUS_XTKBD 0x12 #define BUS_RS232 0x13 #define BUS_GAMEPORT 0x14 #define BUS_PARPORT 0x15 #define BUS_AMIGA 0x16 #define BUS_ADB 0x17 #define BUS_I2C 0x18 #define BUS_HOST 0x19 #define BUS_GSC 0x1A #define BUS_ATARI 0x1B #define BUS_SPI 0x1C #define BUS_RMI 0x1D #define BUS_CEC 0x1E #define BUS_INTEL_ISHTP 0x1F /* * MT_TOOL types */ #define MT_TOOL_FINGER 0x00 #define MT_TOOL_PEN 0x01 #define MT_TOOL_PALM 0x02 #define MT_TOOL_DIAL 0x0a #define MT_TOOL_MAX 0x0f /* * Values describing the status of a force-feedback effect */ #define FF_STATUS_STOPPED 0x00 #define FF_STATUS_PLAYING 0x01 #define FF_STATUS_MAX 0x01 /* * Structures used in ioctls to upload effects to a device * They are pieces of a bigger structure (called ff_effect) */ /* * All duration values are expressed in ms. Values above 32767 ms (0x7fff) * should not be used and have unspecified results. */ /** * struct ff_replay - defines scheduling of the force-feedback effect * @length: duration of the effect * @delay: delay before effect should start playing */ struct ff_replay { __u16 length; __u16 delay; }; /** * struct ff_trigger - defines what triggers the force-feedback effect * @button: number of the button triggering the effect * @interval: controls how soon the effect can be re-triggered */ struct ff_trigger { __u16 button; __u16 interval; }; /** * struct ff_envelope - generic force-feedback effect envelope * @attack_length: duration of the attack (ms) * @attack_level: level at the beginning of the attack * @fade_length: duration of fade (ms) * @fade_level: level at the end of fade * * The @attack_level and @fade_level are absolute values; when applying * envelope force-feedback core will convert to positive/negative * value based on polarity of the default level of the effect. * Valid range for the attack and fade levels is 0x0000 - 0x7fff */ struct ff_envelope { __u16 attack_length; __u16 attack_level; __u16 fade_length; __u16 fade_level; }; /** * struct ff_constant_effect - defines parameters of a constant force-feedback effect * @level: strength of the effect; may be negative * @envelope: envelope data */ struct ff_constant_effect { __s16 level; struct ff_envelope envelope; }; /** * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect * @start_level: beginning strength of the effect; may be negative * @end_level: final strength of the effect; may be negative * @envelope: envelope data */ struct ff_ramp_effect { __s16 start_level; __s16 end_level; struct ff_envelope envelope; }; /** * struct ff_condition_effect - defines a spring or friction force-feedback effect * @right_saturation: maximum level when joystick moved all way to the right * @left_saturation: same for the left side * @right_coeff: controls how fast the force grows when the joystick moves * to the right * @left_coeff: same for the left side * @deadband: size of the dead zone, where no force is produced * @center: position of the dead zone */ struct ff_condition_effect { __u16 right_saturation; __u16 left_saturation; __s16 right_coeff; __s16 left_coeff; __u16 deadband; __s16 center; }; /** * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect * @waveform: kind of the effect (wave) * @period: period of the wave (ms) * @magnitude: peak value * @offset: mean value of the wave (roughly) * @phase: 'horizontal' shift * @envelope: envelope data * @custom_len: number of samples (FF_CUSTOM only) * @custom_data: buffer of samples (FF_CUSTOM only) * * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP, * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined * for the time being as no driver supports it yet. * * Note: the data pointed by custom_data is copied by the driver. * You can therefore dispose of the memory after the upload/update. */ struct ff_periodic_effect { __u16 waveform; __u16 period; __s16 magnitude; __s16 offset; __u16 phase; struct ff_envelope envelope; __u32 custom_len; __s16 *custom_data; }; /** * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect * @strong_magnitude: magnitude of the heavy motor * @weak_magnitude: magnitude of the light one * * Some rumble pads have two motors of different weight. Strong_magnitude * represents the magnitude of the vibration generated by the heavy one. */ struct ff_rumble_effect { __u16 strong_magnitude; __u16 weak_magnitude; }; /** * struct ff_effect - defines force feedback effect * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM) * @id: an unique id assigned to an effect * @direction: direction of the effect * @trigger: trigger conditions (struct ff_trigger) * @replay: scheduling of the effect (struct ff_replay) * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect, * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further * defining effect parameters * * This structure is sent through ioctl from the application to the driver. * To create a new effect application should set its @id to -1; the kernel * will return assigned @id which can later be used to update or delete * this effect. * * Direction of the effect is encoded as follows: * 0 deg -> 0x0000 (down) * 90 deg -> 0x4000 (left) * 180 deg -> 0x8000 (up) * 270 deg -> 0xC000 (right) */ struct ff_effect { __u16 type; __s16 id; __u16 direction; struct ff_trigger trigger; struct ff_replay replay; union { struct ff_constant_effect constant; struct ff_ramp_effect ramp; struct ff_periodic_effect periodic; struct ff_condition_effect condition[2]; /* One for each axis */ struct ff_rumble_effect rumble; } u; }; /* * Force feedback effect types */ #define FF_RUMBLE 0x50 #define FF_PERIODIC 0x51 #define FF_CONSTANT 0x52 #define FF_SPRING 0x53 #define FF_FRICTION 0x54 #define FF_DAMPER 0x55 #define FF_INERTIA 0x56 #define FF_RAMP 0x57 #define FF_EFFECT_MIN FF_RUMBLE #define FF_EFFECT_MAX FF_RAMP /* * Force feedback periodic effect types */ #define FF_SQUARE 0x58 #define FF_TRIANGLE 0x59 #define FF_SINE 0x5a #define FF_SAW_UP 0x5b #define FF_SAW_DOWN 0x5c #define FF_CUSTOM 0x5d #define FF_WAVEFORM_MIN FF_SQUARE #define FF_WAVEFORM_MAX FF_CUSTOM /* * Set ff device properties */ #define FF_GAIN 0x60 #define FF_AUTOCENTER 0x61 /* * ff->playback(effect_id = FF_GAIN) is the first effect_id to * cause a collision with another ff method, in this case ff->set_gain(). * Therefore the greatest safe value for effect_id is FF_GAIN - 1, * and thus the total number of effects should never exceed FF_GAIN. */ #define FF_MAX_EFFECTS FF_GAIN #define FF_MAX 0x7f #define FF_CNT (FF_MAX+1) #endif /* _INPUT_H */ linux/io_uring.h 0000644 00000014077 15063602050 0007675 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */ /* * Header file for the io_uring interface. * * Copyright (C) 2019 Jens Axboe * Copyright (C) 2019 Christoph Hellwig */ #ifndef LINUX_IO_URING_H #define LINUX_IO_URING_H #include <linux/fs.h> #include <linux/types.h> /* * IO submission data structure (Submission Queue Entry) */ struct io_uring_sqe { __u8 opcode; /* type of operation for this sqe */ __u8 flags; /* IOSQE_ flags */ __u16 ioprio; /* ioprio for the request */ __s32 fd; /* file descriptor to do IO on */ union { __u64 off; /* offset into file */ __u64 addr2; }; union { __u64 addr; /* pointer to buffer or iovecs */ __u64 splice_off_in; }; __u32 len; /* buffer size or number of iovecs */ union { __kernel_rwf_t rw_flags; __u32 fsync_flags; __u16 poll_events; __u32 sync_range_flags; __u32 msg_flags; __u32 timeout_flags; __u32 accept_flags; __u32 cancel_flags; __u32 open_flags; __u32 statx_flags; __u32 fadvise_advice; __u32 splice_flags; }; __u64 user_data; /* data to be passed back at completion time */ union { struct { /* pack this to avoid bogus arm OABI complaints */ union { /* index into fixed buffers, if used */ __u16 buf_index; /* for grouped buffer selection */ __u16 buf_group; } __attribute__((packed)); /* personality to use, if used */ __u16 personality; __s32 splice_fd_in; }; __u64 __pad2[3]; }; }; enum { IOSQE_FIXED_FILE_BIT, IOSQE_IO_DRAIN_BIT, IOSQE_IO_LINK_BIT, IOSQE_IO_HARDLINK_BIT, IOSQE_ASYNC_BIT, IOSQE_BUFFER_SELECT_BIT, }; /* * sqe->flags */ /* use fixed fileset */ #define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT) /* issue after inflight IO */ #define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT) /* links next sqe */ #define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT) /* like LINK, but stronger */ #define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT) /* always go async */ #define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT) /* select buffer from sqe->buf_group */ #define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT) /* * io_uring_setup() flags */ #define IORING_SETUP_IOPOLL (1U << 0) /* io_context is polled */ #define IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */ #define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */ #define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */ #define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */ #define IORING_SETUP_ATTACH_WQ (1U << 5) /* attach to existing wq */ enum { IORING_OP_NOP, IORING_OP_READV, IORING_OP_WRITEV, IORING_OP_FSYNC, IORING_OP_READ_FIXED, IORING_OP_WRITE_FIXED, IORING_OP_POLL_ADD, IORING_OP_POLL_REMOVE, IORING_OP_SYNC_FILE_RANGE, IORING_OP_SENDMSG, IORING_OP_RECVMSG, IORING_OP_TIMEOUT, IORING_OP_TIMEOUT_REMOVE, IORING_OP_ACCEPT, IORING_OP_ASYNC_CANCEL, IORING_OP_LINK_TIMEOUT, IORING_OP_CONNECT, IORING_OP_FALLOCATE, IORING_OP_OPENAT, IORING_OP_CLOSE, IORING_OP_FILES_UPDATE, IORING_OP_STATX, IORING_OP_READ, IORING_OP_WRITE, IORING_OP_FADVISE, IORING_OP_MADVISE, IORING_OP_SEND, IORING_OP_RECV, IORING_OP_OPENAT2, IORING_OP_EPOLL_CTL, IORING_OP_SPLICE, IORING_OP_PROVIDE_BUFFERS, IORING_OP_REMOVE_BUFFERS, /* this goes last, obviously */ IORING_OP_LAST, }; /* * sqe->fsync_flags */ #define IORING_FSYNC_DATASYNC (1U << 0) /* * sqe->timeout_flags */ #define IORING_TIMEOUT_ABS (1U << 0) /* * sqe->splice_flags * extends splice(2) flags */ #define SPLICE_F_FD_IN_FIXED (1U << 31) /* the last bit of __u32 */ /* * IO completion data structure (Completion Queue Entry) */ struct io_uring_cqe { __u64 user_data; /* sqe->data submission passed back */ __s32 res; /* result code for this event */ __u32 flags; }; /* * cqe->flags * * IORING_CQE_F_BUFFER If set, the upper 16 bits are the buffer ID */ #define IORING_CQE_F_BUFFER (1U << 0) enum { IORING_CQE_BUFFER_SHIFT = 16, }; /* * Magic offsets for the application to mmap the data it needs */ #define IORING_OFF_SQ_RING 0ULL #define IORING_OFF_CQ_RING 0x8000000ULL #define IORING_OFF_SQES 0x10000000ULL /* * Filled with the offset for mmap(2) */ struct io_sqring_offsets { __u32 head; __u32 tail; __u32 ring_mask; __u32 ring_entries; __u32 flags; __u32 dropped; __u32 array; __u32 resv1; __u64 resv2; }; /* * sq_ring->flags */ #define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */ struct io_cqring_offsets { __u32 head; __u32 tail; __u32 ring_mask; __u32 ring_entries; __u32 overflow; __u32 cqes; __u64 resv[2]; }; /* * io_uring_enter(2) flags */ #define IORING_ENTER_GETEVENTS (1U << 0) #define IORING_ENTER_SQ_WAKEUP (1U << 1) /* * Passed in for io_uring_setup(2). Copied back with updated info on success */ struct io_uring_params { __u32 sq_entries; __u32 cq_entries; __u32 flags; __u32 sq_thread_cpu; __u32 sq_thread_idle; __u32 features; __u32 wq_fd; __u32 resv[3]; struct io_sqring_offsets sq_off; struct io_cqring_offsets cq_off; }; /* * io_uring_params->features flags */ #define IORING_FEAT_SINGLE_MMAP (1U << 0) #define IORING_FEAT_NODROP (1U << 1) #define IORING_FEAT_SUBMIT_STABLE (1U << 2) #define IORING_FEAT_RW_CUR_POS (1U << 3) #define IORING_FEAT_CUR_PERSONALITY (1U << 4) #define IORING_FEAT_FAST_POLL (1U << 5) /* * io_uring_register(2) opcodes and arguments */ #define IORING_REGISTER_BUFFERS 0 #define IORING_UNREGISTER_BUFFERS 1 #define IORING_REGISTER_FILES 2 #define IORING_UNREGISTER_FILES 3 #define IORING_REGISTER_EVENTFD 4 #define IORING_UNREGISTER_EVENTFD 5 #define IORING_REGISTER_FILES_UPDATE 6 #define IORING_REGISTER_EVENTFD_ASYNC 7 #define IORING_REGISTER_PROBE 8 #define IORING_REGISTER_PERSONALITY 9 #define IORING_UNREGISTER_PERSONALITY 10 struct io_uring_files_update { __u32 offset; __u32 resv; __aligned_u64 /* __s32 * */ fds; }; #define IO_URING_OP_SUPPORTED (1U << 0) struct io_uring_probe_op { __u8 op; __u8 resv; __u16 flags; /* IO_URING_OP_* flags */ __u32 resv2; }; struct io_uring_probe { __u8 last_op; /* last opcode supported */ __u8 ops_len; /* length of ops[] array below */ __u16 resv; __u32 resv2[3]; struct io_uring_probe_op ops[0]; }; #endif linux/iio/events.h 0000644 00000002556 15063602050 0010145 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* The industrial I/O - event passing to userspace * * Copyright (c) 2008-2011 Jonathan Cameron * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _IIO_EVENTS_H_ #define _IIO_EVENTS_H_ #include <linux/ioctl.h> #include <linux/types.h> /** * struct iio_event_data - The actual event being pushed to userspace * @id: event identifier * @timestamp: best estimate of time of event occurrence (often from * the interrupt handler) */ struct iio_event_data { __u64 id; __s64 timestamp; }; #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F) #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) /* Event code number extraction depends on which type of event we have. * Perhaps review this function in the future*/ #define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF)) #define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF)) #define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF) #define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1) #endif /* _IIO_EVENTS_H_ */ linux/iio/types.h 0000644 00000003631 15063602050 0010000 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* industrial I/O data types needed both in and out of kernel * * Copyright (c) 2008 Jonathan Cameron * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _IIO_TYPES_H_ #define _IIO_TYPES_H_ enum iio_chan_type { IIO_VOLTAGE, IIO_CURRENT, IIO_POWER, IIO_ACCEL, IIO_ANGL_VEL, IIO_MAGN, IIO_LIGHT, IIO_INTENSITY, IIO_PROXIMITY, IIO_TEMP, IIO_INCLI, IIO_ROT, IIO_ANGL, IIO_TIMESTAMP, IIO_CAPACITANCE, IIO_ALTVOLTAGE, IIO_CCT, IIO_PRESSURE, IIO_HUMIDITYRELATIVE, IIO_ACTIVITY, IIO_STEPS, IIO_ENERGY, IIO_DISTANCE, IIO_VELOCITY, IIO_CONCENTRATION, IIO_RESISTANCE, IIO_PH, IIO_UVINDEX, IIO_ELECTRICALCONDUCTIVITY, IIO_COUNT, IIO_INDEX, IIO_GRAVITY, }; enum iio_modifier { IIO_NO_MOD, IIO_MOD_X, IIO_MOD_Y, IIO_MOD_Z, IIO_MOD_X_AND_Y, IIO_MOD_X_AND_Z, IIO_MOD_Y_AND_Z, IIO_MOD_X_AND_Y_AND_Z, IIO_MOD_X_OR_Y, IIO_MOD_X_OR_Z, IIO_MOD_Y_OR_Z, IIO_MOD_X_OR_Y_OR_Z, IIO_MOD_LIGHT_BOTH, IIO_MOD_LIGHT_IR, IIO_MOD_ROOT_SUM_SQUARED_X_Y, IIO_MOD_SUM_SQUARED_X_Y_Z, IIO_MOD_LIGHT_CLEAR, IIO_MOD_LIGHT_RED, IIO_MOD_LIGHT_GREEN, IIO_MOD_LIGHT_BLUE, IIO_MOD_QUATERNION, IIO_MOD_TEMP_AMBIENT, IIO_MOD_TEMP_OBJECT, IIO_MOD_NORTH_MAGN, IIO_MOD_NORTH_TRUE, IIO_MOD_NORTH_MAGN_TILT_COMP, IIO_MOD_NORTH_TRUE_TILT_COMP, IIO_MOD_RUNNING, IIO_MOD_JOGGING, IIO_MOD_WALKING, IIO_MOD_STILL, IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z, IIO_MOD_I, IIO_MOD_Q, IIO_MOD_CO2, IIO_MOD_VOC, IIO_MOD_LIGHT_UV, }; enum iio_event_type { IIO_EV_TYPE_THRESH, IIO_EV_TYPE_MAG, IIO_EV_TYPE_ROC, IIO_EV_TYPE_THRESH_ADAPTIVE, IIO_EV_TYPE_MAG_ADAPTIVE, IIO_EV_TYPE_CHANGE, }; enum iio_event_direction { IIO_EV_DIR_EITHER, IIO_EV_DIR_RISING, IIO_EV_DIR_FALLING, IIO_EV_DIR_NONE, }; #endif /* _IIO_TYPES_H_ */ linux/ioctl.h 0000644 00000000243 15063602050 0007162 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IOCTL_H #define _LINUX_IOCTL_H #include <asm/ioctl.h> #endif /* _LINUX_IOCTL_H */ linux/iommu.h 0000644 00000011450 15063602050 0007200 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * IOMMU user API definitions */ #ifndef _IOMMU_H #define _IOMMU_H #include <linux/types.h> #define IOMMU_FAULT_PERM_READ (1 << 0) /* read */ #define IOMMU_FAULT_PERM_WRITE (1 << 1) /* write */ #define IOMMU_FAULT_PERM_EXEC (1 << 2) /* exec */ #define IOMMU_FAULT_PERM_PRIV (1 << 3) /* privileged */ /* Generic fault types, can be expanded IRQ remapping fault */ enum iommu_fault_type { IOMMU_FAULT_DMA_UNRECOV = 1, /* unrecoverable fault */ IOMMU_FAULT_PAGE_REQ, /* page request fault */ }; enum iommu_fault_reason { IOMMU_FAULT_REASON_UNKNOWN = 0, /* Could not access the PASID table (fetch caused external abort) */ IOMMU_FAULT_REASON_PASID_FETCH, /* PASID entry is invalid or has configuration errors */ IOMMU_FAULT_REASON_BAD_PASID_ENTRY, /* * PASID is out of range (e.g. exceeds the maximum PASID * supported by the IOMMU) or disabled. */ IOMMU_FAULT_REASON_PASID_INVALID, /* * An external abort occurred fetching (or updating) a translation * table descriptor */ IOMMU_FAULT_REASON_WALK_EABT, /* * Could not access the page table entry (Bad address), * actual translation fault */ IOMMU_FAULT_REASON_PTE_FETCH, /* Protection flag check failed */ IOMMU_FAULT_REASON_PERMISSION, /* access flag check failed */ IOMMU_FAULT_REASON_ACCESS, /* Output address of a translation stage caused Address Size fault */ IOMMU_FAULT_REASON_OOR_ADDRESS, }; /** * struct iommu_fault_unrecoverable - Unrecoverable fault data * @reason: reason of the fault, from &enum iommu_fault_reason * @flags: parameters of this fault (IOMMU_FAULT_UNRECOV_* values) * @pasid: Process Address Space ID * @perm: requested permission access using by the incoming transaction * (IOMMU_FAULT_PERM_* values) * @addr: offending page address * @fetch_addr: address that caused a fetch abort, if any */ struct iommu_fault_unrecoverable { __u32 reason; #define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0) #define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1) #define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2) __u32 flags; __u32 pasid; __u32 perm; __u64 addr; __u64 fetch_addr; }; /** * struct iommu_fault_page_request - Page Request data * @flags: encodes whether the corresponding fields are valid and whether this * is the last page in group (IOMMU_FAULT_PAGE_REQUEST_* values). * When IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID is set, the page response * must have the same PASID value as the page request. When it is clear, * the page response should not have a PASID. * @pasid: Process Address Space ID * @grpid: Page Request Group Index * @perm: requested page permissions (IOMMU_FAULT_PERM_* values) * @addr: page address * @private_data: device-specific private information */ struct iommu_fault_page_request { #define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0) #define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1) #define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2) #define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3) __u32 flags; __u32 pasid; __u32 grpid; __u32 perm; __u64 addr; __u64 private_data[2]; }; /** * struct iommu_fault - Generic fault data * @type: fault type from &enum iommu_fault_type * @padding: reserved for future use (should be zero) * @event: fault event, when @type is %IOMMU_FAULT_DMA_UNRECOV * @prm: Page Request message, when @type is %IOMMU_FAULT_PAGE_REQ * @padding2: sets the fault size to allow for future extensions */ struct iommu_fault { __u32 type; __u32 padding; union { struct iommu_fault_unrecoverable event; struct iommu_fault_page_request prm; __u8 padding2[56]; }; }; /** * enum iommu_page_response_code - Return status of fault handlers * @IOMMU_PAGE_RESP_SUCCESS: Fault has been handled and the page tables * populated, retry the access. This is "Success" in PCI PRI. * @IOMMU_PAGE_RESP_FAILURE: General error. Drop all subsequent faults from * this device if possible. This is "Response Failure" in PCI PRI. * @IOMMU_PAGE_RESP_INVALID: Could not handle this fault, don't retry the * access. This is "Invalid Request" in PCI PRI. */ enum iommu_page_response_code { IOMMU_PAGE_RESP_SUCCESS = 0, IOMMU_PAGE_RESP_INVALID, IOMMU_PAGE_RESP_FAILURE, }; /** * struct iommu_page_response - Generic page response information * @argsz: User filled size of this data * @version: API version of this structure * @flags: encodes whether the corresponding fields are valid * (IOMMU_FAULT_PAGE_RESPONSE_* values) * @pasid: Process Address Space ID * @grpid: Page Request Group Index * @code: response code from &enum iommu_page_response_code */ struct iommu_page_response { __u32 argsz; #define IOMMU_PAGE_RESP_VERSION_1 1 __u32 version; #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) __u32 flags; __u32 pasid; __u32 grpid; __u32 code; }; #endif /* _IOMMU_H */ linux/ip.h 0000644 00000011170 15063602050 0006461 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the IP protocol. * * Version: @(#)ip.h 1.0.2 04/28/93 * * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IP_H #define _LINUX_IP_H #include <linux/types.h> #include <asm/byteorder.h> #define IPTOS_TOS_MASK 0x1E #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) #define IPTOS_LOWDELAY 0x10 #define IPTOS_THROUGHPUT 0x08 #define IPTOS_RELIABILITY 0x04 #define IPTOS_MINCOST 0x02 #define IPTOS_PREC_MASK 0xE0 #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) #define IPTOS_PREC_NETCONTROL 0xe0 #define IPTOS_PREC_INTERNETCONTROL 0xc0 #define IPTOS_PREC_CRITIC_ECP 0xa0 #define IPTOS_PREC_FLASHOVERRIDE 0x80 #define IPTOS_PREC_FLASH 0x60 #define IPTOS_PREC_IMMEDIATE 0x40 #define IPTOS_PREC_PRIORITY 0x20 #define IPTOS_PREC_ROUTINE 0x00 /* IP options */ #define IPOPT_COPY 0x80 #define IPOPT_CLASS_MASK 0x60 #define IPOPT_NUMBER_MASK 0x1f #define IPOPT_COPIED(o) ((o)&IPOPT_COPY) #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) #define IPOPT_CONTROL 0x00 #define IPOPT_RESERVED1 0x20 #define IPOPT_MEASUREMENT 0x40 #define IPOPT_RESERVED2 0x60 #define IPOPT_END (0 |IPOPT_CONTROL) #define IPOPT_NOOP (1 |IPOPT_CONTROL) #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) #define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_RR (7 |IPOPT_CONTROL) #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) #define IPVERSION 4 #define MAXTTL 255 #define IPDEFTTL 64 #define IPOPT_OPTVAL 0 #define IPOPT_OLEN 1 #define IPOPT_OFFSET 2 #define IPOPT_MINOFF 4 #define MAX_IPOPTLEN 40 #define IPOPT_NOP IPOPT_NOOP #define IPOPT_EOL IPOPT_END #define IPOPT_TS IPOPT_TIMESTAMP #define IPOPT_TS_TSONLY 0 /* timestamps only */ #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ #define IPOPT_TS_PRESPEC 3 /* specified modules only */ #define IPV4_BEET_PHMAXLEN 8 struct iphdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 ihl:4, version:4; #elif defined (__BIG_ENDIAN_BITFIELD) __u8 version:4, ihl:4; #else #error "Please fix <asm/byteorder.h>" #endif __u8 tos; __be16 tot_len; __be16 id; __be16 frag_off; __u8 ttl; __u8 protocol; __sum16 check; __be32 saddr; __be32 daddr; /*The options start here. */ }; struct ip_auth_hdr { __u8 nexthdr; __u8 hdrlen; /* This one is measured in 32 bit units! */ __be16 reserved; __be32 spi; __be32 seq_no; /* Sequence number */ __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ }; struct ip_esp_hdr { __be32 spi; __be32 seq_no; /* Sequence number */ __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ }; struct ip_comp_hdr { __u8 nexthdr; __u8 flags; __be16 cpi; }; struct ip_beet_phdr { __u8 nexthdr; __u8 hdrlen; __u8 padlen; __u8 reserved; }; /* index values for the variables in ipv4_devconf */ enum { IPV4_DEVCONF_FORWARDING=1, IPV4_DEVCONF_MC_FORWARDING, IPV4_DEVCONF_PROXY_ARP, IPV4_DEVCONF_ACCEPT_REDIRECTS, IPV4_DEVCONF_SECURE_REDIRECTS, IPV4_DEVCONF_SEND_REDIRECTS, IPV4_DEVCONF_SHARED_MEDIA, IPV4_DEVCONF_RP_FILTER, IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, IPV4_DEVCONF_BOOTP_RELAY, IPV4_DEVCONF_LOG_MARTIANS, IPV4_DEVCONF_TAG, IPV4_DEVCONF_ARPFILTER, IPV4_DEVCONF_MEDIUM_ID, IPV4_DEVCONF_NOXFRM, IPV4_DEVCONF_NOPOLICY, IPV4_DEVCONF_FORCE_IGMP_VERSION, IPV4_DEVCONF_ARP_ANNOUNCE, IPV4_DEVCONF_ARP_IGNORE, IPV4_DEVCONF_PROMOTE_SECONDARIES, IPV4_DEVCONF_ARP_ACCEPT, IPV4_DEVCONF_ARP_NOTIFY, IPV4_DEVCONF_ACCEPT_LOCAL, IPV4_DEVCONF_SRC_VMARK, IPV4_DEVCONF_PROXY_ARP_PVLAN, IPV4_DEVCONF_ROUTE_LOCALNET, IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL, IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL, IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, IPV4_DEVCONF_DROP_GRATUITOUS_ARP, IPV4_DEVCONF_BC_FORWARDING, __IPV4_DEVCONF_MAX }; #define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1) #endif /* _LINUX_IP_H */ linux/ip6_tunnel.h 0000644 00000003641 15063602050 0010140 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6_TUNNEL_H #define _IP6_TUNNEL_H #include <linux/types.h> #include <linux/if.h> /* For IFNAMSIZ. */ #include <linux/in6.h> /* For struct in6_addr. */ #define IPV6_TLV_TNL_ENCAP_LIMIT 4 #define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4 /* don't add encapsulation limit if one isn't present in inner packet */ #define IP6_TNL_F_IGN_ENCAP_LIMIT 0x1 /* copy the traffic class field from the inner packet */ #define IP6_TNL_F_USE_ORIG_TCLASS 0x2 /* copy the flowlabel from the inner packet */ #define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 /* being used for Mobile IPv6 */ #define IP6_TNL_F_MIP6_DEV 0x8 /* copy DSCP from the outer packet */ #define IP6_TNL_F_RCV_DSCP_COPY 0x10 /* copy fwmark from inner packet */ #define IP6_TNL_F_USE_ORIG_FWMARK 0x20 /* allow remote endpoint on the local node */ #define IP6_TNL_F_ALLOW_LOCAL_REMOTE 0x40 struct ip6_tnl_parm { char name[IFNAMSIZ]; /* name of tunnel device */ int link; /* ifindex of underlying L2 interface */ __u8 proto; /* tunnel protocol */ __u8 encap_limit; /* encapsulation limit for tunnel */ __u8 hop_limit; /* hop limit for tunnel */ __be32 flowinfo; /* traffic class and flowlabel for tunnel */ __u32 flags; /* tunnel flags */ struct in6_addr laddr; /* local tunnel end-point address */ struct in6_addr raddr; /* remote tunnel end-point address */ }; struct ip6_tnl_parm2 { char name[IFNAMSIZ]; /* name of tunnel device */ int link; /* ifindex of underlying L2 interface */ __u8 proto; /* tunnel protocol */ __u8 encap_limit; /* encapsulation limit for tunnel */ __u8 hop_limit; /* hop limit for tunnel */ __be32 flowinfo; /* traffic class and flowlabel for tunnel */ __u32 flags; /* tunnel flags */ struct in6_addr laddr; /* local tunnel end-point address */ struct in6_addr raddr; /* remote tunnel end-point address */ __be16 i_flags; __be16 o_flags; __be32 i_key; __be32 o_key; }; #endif linux/ip_vs.h 0000644 00000032477 15063602050 0007206 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * IP Virtual Server * data structure and functionality definitions */ #ifndef _IP_VS_H #define _IP_VS_H #include <linux/types.h> /* For __beXX types in userland */ #define IP_VS_VERSION_CODE 0x010201 #define NVERSION(version) \ (version >> 16) & 0xFF, \ (version >> 8) & 0xFF, \ version & 0xFF /* * Virtual Service Flags */ #define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ #define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ #define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */ #define IP_VS_SVC_F_SCHED1 0x0008 /* scheduler flag 1 */ #define IP_VS_SVC_F_SCHED2 0x0010 /* scheduler flag 2 */ #define IP_VS_SVC_F_SCHED3 0x0020 /* scheduler flag 3 */ #define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */ #define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */ /* * Destination Server Flags */ #define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */ #define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */ /* * IPVS sync daemon states */ #define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */ #define IP_VS_STATE_MASTER 0x0001 /* started as master */ #define IP_VS_STATE_BACKUP 0x0002 /* started as backup */ /* * IPVS socket options */ #define IP_VS_BASE_CTL (64+1024+64) /* base */ #define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */ #define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1) #define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2) #define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3) #define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4) #define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5) #define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6) #define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7) #define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8) #define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9) #define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10) #define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11) #define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12) #define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13) #define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14) #define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15) #define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO #define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL #define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1) #define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2) #define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3) #define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4) #define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */ #define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6) #define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7) #define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON /* * IPVS Connection Flags * Only flags 0..15 are sent to backup server */ #define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */ #define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */ #define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */ #define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */ #define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */ #define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */ #define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */ #define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */ #define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */ #define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */ #define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */ #define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */ #define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */ #define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */ #define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ #define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ /* Initial bits allowed in backup server */ #define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \ IP_VS_CONN_F_NOOUTPUT | \ IP_VS_CONN_F_INACTIVE | \ IP_VS_CONN_F_SEQ_MASK | \ IP_VS_CONN_F_NO_CPORT | \ IP_VS_CONN_F_TEMPLATE \ ) /* Bits allowed to update in backup server */ #define IP_VS_CONN_F_BACKUP_UPD_MASK (IP_VS_CONN_F_INACTIVE | \ IP_VS_CONN_F_SEQ_MASK) /* Flags that are not sent to backup server start from bit 16 */ #define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ /* Connection flags from destination that can be changed by user space */ #define IP_VS_CONN_F_DEST_MASK (IP_VS_CONN_F_FWD_MASK | \ IP_VS_CONN_F_ONE_PACKET | \ IP_VS_CONN_F_NFCT | \ 0) #define IP_VS_SCHEDNAME_MAXLEN 16 #define IP_VS_PENAME_MAXLEN 16 #define IP_VS_IFNAME_MAXLEN 16 #define IP_VS_PEDATA_MAXLEN 255 /* * The struct ip_vs_service_user and struct ip_vs_dest_user are * used to set IPVS rules through setsockopt. */ struct ip_vs_service_user { /* virtual service addresses */ __u16 protocol; __be32 addr; /* virtual ip address */ __be16 port; __u32 fwmark; /* firwall mark of service */ /* virtual service options */ char sched_name[IP_VS_SCHEDNAME_MAXLEN]; unsigned int flags; /* virtual service flags */ unsigned int timeout; /* persistent timeout in sec */ __be32 netmask; /* persistent netmask */ }; struct ip_vs_dest_user { /* destination server address */ __be32 addr; __be16 port; /* real server options */ unsigned int conn_flags; /* connection flags */ int weight; /* destination weight */ /* thresholds for active connections */ __u32 u_threshold; /* upper threshold */ __u32 l_threshold; /* lower threshold */ }; /* * IPVS statistics object (for user space) */ struct ip_vs_stats_user { __u32 conns; /* connections scheduled */ __u32 inpkts; /* incoming packets */ __u32 outpkts; /* outgoing packets */ __u64 inbytes; /* incoming bytes */ __u64 outbytes; /* outgoing bytes */ __u32 cps; /* current connection rate */ __u32 inpps; /* current in packet rate */ __u32 outpps; /* current out packet rate */ __u32 inbps; /* current in byte rate */ __u32 outbps; /* current out byte rate */ }; /* The argument to IP_VS_SO_GET_INFO */ struct ip_vs_getinfo { /* version number */ unsigned int version; /* size of connection hash table */ unsigned int size; /* number of virtual services */ unsigned int num_services; }; /* The argument to IP_VS_SO_GET_SERVICE */ struct ip_vs_service_entry { /* which service: user fills in these */ __u16 protocol; __be32 addr; /* virtual address */ __be16 port; __u32 fwmark; /* firwall mark of service */ /* service options */ char sched_name[IP_VS_SCHEDNAME_MAXLEN]; unsigned int flags; /* virtual service flags */ unsigned int timeout; /* persistent timeout */ __be32 netmask; /* persistent netmask */ /* number of real servers */ unsigned int num_dests; /* statistics */ struct ip_vs_stats_user stats; }; struct ip_vs_dest_entry { __be32 addr; /* destination address */ __be16 port; unsigned int conn_flags; /* connection flags */ int weight; /* destination weight */ __u32 u_threshold; /* upper threshold */ __u32 l_threshold; /* lower threshold */ __u32 activeconns; /* active connections */ __u32 inactconns; /* inactive connections */ __u32 persistconns; /* persistent connections */ /* statistics */ struct ip_vs_stats_user stats; }; /* The argument to IP_VS_SO_GET_DESTS */ struct ip_vs_get_dests { /* which service: user fills in these */ __u16 protocol; __be32 addr; /* virtual address */ __be16 port; __u32 fwmark; /* firwall mark of service */ /* number of real servers */ unsigned int num_dests; /* the real servers */ struct ip_vs_dest_entry entrytable[0]; }; /* The argument to IP_VS_SO_GET_SERVICES */ struct ip_vs_get_services { /* number of virtual services */ unsigned int num_services; /* service table */ struct ip_vs_service_entry entrytable[0]; }; /* The argument to IP_VS_SO_GET_TIMEOUT */ struct ip_vs_timeout_user { int tcp_timeout; int tcp_fin_timeout; int udp_timeout; }; /* The argument to IP_VS_SO_GET_DAEMON */ struct ip_vs_daemon_user { /* sync daemon state (master/backup) */ int state; /* multicast interface name */ char mcast_ifn[IP_VS_IFNAME_MAXLEN]; /* SyncID we belong to */ int syncid; }; /* * * IPVS Generic Netlink interface definitions * */ /* Generic Netlink family info */ #define IPVS_GENL_NAME "IPVS" #define IPVS_GENL_VERSION 0x1 struct ip_vs_flags { __u32 flags; __u32 mask; }; /* Generic Netlink command attributes */ enum { IPVS_CMD_UNSPEC = 0, IPVS_CMD_NEW_SERVICE, /* add service */ IPVS_CMD_SET_SERVICE, /* modify service */ IPVS_CMD_DEL_SERVICE, /* delete service */ IPVS_CMD_GET_SERVICE, /* get service info */ IPVS_CMD_NEW_DEST, /* add destination */ IPVS_CMD_SET_DEST, /* modify destination */ IPVS_CMD_DEL_DEST, /* delete destination */ IPVS_CMD_GET_DEST, /* get destination info */ IPVS_CMD_NEW_DAEMON, /* start sync daemon */ IPVS_CMD_DEL_DAEMON, /* stop sync daemon */ IPVS_CMD_GET_DAEMON, /* get sync daemon status */ IPVS_CMD_SET_CONFIG, /* set config settings */ IPVS_CMD_GET_CONFIG, /* get config settings */ IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */ IPVS_CMD_GET_INFO, /* get general IPVS info */ IPVS_CMD_ZERO, /* zero all counters and stats */ IPVS_CMD_FLUSH, /* flush services and dests */ __IPVS_CMD_MAX, }; #define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1) /* Attributes used in the first level of commands */ enum { IPVS_CMD_ATTR_UNSPEC = 0, IPVS_CMD_ATTR_SERVICE, /* nested service attribute */ IPVS_CMD_ATTR_DEST, /* nested destination attribute */ IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */ IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */ IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */ IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */ __IPVS_CMD_ATTR_MAX, }; #define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1) /* * Attributes used to describe a service * * Used inside nested attribute IPVS_CMD_ATTR_SERVICE */ enum { IPVS_SVC_ATTR_UNSPEC = 0, IPVS_SVC_ATTR_AF, /* address family */ IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */ IPVS_SVC_ATTR_ADDR, /* virtual service address */ IPVS_SVC_ATTR_PORT, /* virtual service port */ IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */ IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */ IPVS_SVC_ATTR_FLAGS, /* virtual service flags */ IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */ IPVS_SVC_ATTR_NETMASK, /* persistent netmask */ IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */ IPVS_SVC_ATTR_PE_NAME, /* name of ct retriever */ IPVS_SVC_ATTR_STATS64, /* nested attribute for service stats */ __IPVS_SVC_ATTR_MAX, }; #define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) /* * Attributes used to describe a destination (real server) * * Used inside nested attribute IPVS_CMD_ATTR_DEST */ enum { IPVS_DEST_ATTR_UNSPEC = 0, IPVS_DEST_ATTR_ADDR, /* real server address */ IPVS_DEST_ATTR_PORT, /* real server port */ IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */ IPVS_DEST_ATTR_WEIGHT, /* destination weight */ IPVS_DEST_ATTR_U_THRESH, /* upper threshold */ IPVS_DEST_ATTR_L_THRESH, /* lower threshold */ IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */ IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */ IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */ IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */ IPVS_DEST_ATTR_ADDR_FAMILY, /* Address family of address */ IPVS_DEST_ATTR_STATS64, /* nested attribute for dest stats */ __IPVS_DEST_ATTR_MAX, }; #define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1) /* * Attributes describing a sync daemon * * Used inside nested attribute IPVS_CMD_ATTR_DAEMON */ enum { IPVS_DAEMON_ATTR_UNSPEC = 0, IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */ IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */ IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */ IPVS_DAEMON_ATTR_SYNC_MAXLEN, /* UDP Payload Size */ IPVS_DAEMON_ATTR_MCAST_GROUP, /* IPv4 Multicast Address */ IPVS_DAEMON_ATTR_MCAST_GROUP6, /* IPv6 Multicast Address */ IPVS_DAEMON_ATTR_MCAST_PORT, /* Multicast Port (base) */ IPVS_DAEMON_ATTR_MCAST_TTL, /* Multicast TTL */ __IPVS_DAEMON_ATTR_MAX, }; #define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1) /* * Attributes used to describe service or destination entry statistics * * Used inside nested attributes IPVS_SVC_ATTR_STATS, IPVS_DEST_ATTR_STATS, * IPVS_SVC_ATTR_STATS64 and IPVS_DEST_ATTR_STATS64. */ enum { IPVS_STATS_ATTR_UNSPEC = 0, IPVS_STATS_ATTR_CONNS, /* connections scheduled */ IPVS_STATS_ATTR_INPKTS, /* incoming packets */ IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */ IPVS_STATS_ATTR_INBYTES, /* incoming bytes */ IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */ IPVS_STATS_ATTR_CPS, /* current connection rate */ IPVS_STATS_ATTR_INPPS, /* current in packet rate */ IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */ IPVS_STATS_ATTR_INBPS, /* current in byte rate */ IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */ IPVS_STATS_ATTR_PAD, __IPVS_STATS_ATTR_MAX, }; #define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1) /* Attributes used in response to IPVS_CMD_GET_INFO command */ enum { IPVS_INFO_ATTR_UNSPEC = 0, IPVS_INFO_ATTR_VERSION, /* IPVS version number */ IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */ __IPVS_INFO_ATTR_MAX, }; #define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1) #endif /* _IP_VS_H */ linux/ipc.h 0000644 00000004065 15063602050 0006631 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IPC_H #define _LINUX_IPC_H #include <linux/types.h> #define IPC_PRIVATE ((__kernel_key_t) 0) /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct ipc_perm { __kernel_key_t key; __kernel_uid_t uid; __kernel_gid_t gid; __kernel_uid_t cuid; __kernel_gid_t cgid; __kernel_mode_t mode; unsigned short seq; }; /* Include the definition of ipc64_perm */ #include <asm/ipcbuf.h> /* resource get request flags */ #define IPC_CREAT 00001000 /* create if key is nonexistent */ #define IPC_EXCL 00002000 /* fail if key exists */ #define IPC_NOWAIT 00004000 /* return error on wait */ /* these fields are used by the DIPC package so the kernel as standard should avoid using them if possible */ #define IPC_DIPC 00010000 /* make it distributed */ #define IPC_OWN 00020000 /* this machine is the DIPC owner */ /* * Control commands used with semctl, msgctl and shmctl * see also specific commands in sem.h, msg.h and shm.h */ #define IPC_RMID 0 /* remove resource */ #define IPC_SET 1 /* set ipc_perm options */ #define IPC_STAT 2 /* get ipc_perm options */ #define IPC_INFO 3 /* see ipcs */ /* * Version flags for semctl, msgctl, and shmctl commands * These are passed as bitflags or-ed with the actual command */ #define IPC_OLD 0 /* Old version (no 32-bit UID support on many architectures) */ #define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger message sizes, etc. */ /* * These are used to wrap system calls. * * See architecture code for ugly details.. */ struct ipc_kludge { struct msgbuf *msgp; long msgtyp; }; #define SEMOP 1 #define SEMGET 2 #define SEMCTL 3 #define SEMTIMEDOP 4 #define MSGSND 11 #define MSGRCV 12 #define MSGGET 13 #define MSGCTL 14 #define SHMAT 21 #define SHMDT 22 #define SHMGET 23 #define SHMCTL 24 /* Used by the DIPC package, try and avoid reusing it */ #define DIPC 25 #define IPCCALL(version,op) ((version)<<16 | (op)) #endif /* _LINUX_IPC_H */ linux/ipmi.h 0000644 00000036122 15063602051 0007014 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * ipmi.h * * MontaVista IPMI interface * * Author: MontaVista Software, Inc. * Corey Minyard <minyard@mvista.com> * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * */ #ifndef __LINUX_IPMI_H #define __LINUX_IPMI_H #include <linux/ipmi_msgdefs.h> /* * This file describes an interface to an IPMI driver. You have to * have a fairly good understanding of IPMI to use this, so go read * the specs first before actually trying to do anything. * * With that said, this driver provides a multi-user interface to the * IPMI driver, and it allows multiple IPMI physical interfaces below * the driver. The physical interfaces bind as a lower layer on the * driver. They appear as interfaces to the application using this * interface. * * Multi-user means that multiple applications may use the driver, * send commands, receive responses, etc. The driver keeps track of * commands the user sends and tracks the responses. The responses * will go back to the application that send the command. If the * response doesn't come back in time, the driver will return a * timeout error response to the application. Asynchronous events * from the BMC event queue will go to all users bound to the driver. * The incoming event queue in the BMC will automatically be flushed * if it becomes full and it is queried once a second to see if * anything is in it. Incoming commands to the driver will get * delivered as commands. */ /* * This is an overlay for all the address types, so it's easy to * determine the actual address type. This is kind of like addresses * work for sockets. */ #define IPMI_MAX_ADDR_SIZE 32 struct ipmi_addr { /* Try to take these from the "Channel Medium Type" table in section 6.5 of the IPMI 1.5 manual. */ int addr_type; short channel; char data[IPMI_MAX_ADDR_SIZE]; }; /* * When the address is not used, the type will be set to this value. * The channel is the BMC's channel number for the channel (usually * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC. */ #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c struct ipmi_system_interface_addr { int addr_type; short channel; unsigned char lun; }; /* An IPMB Address. */ #define IPMI_IPMB_ADDR_TYPE 0x01 /* Used for broadcast get device id as described in section 17.9 of the IPMI 1.5 manual. */ #define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 struct ipmi_ipmb_addr { int addr_type; short channel; unsigned char slave_addr; unsigned char lun; }; /* * Used for messages received directly from an IPMB that have not gone * through a MC. This is for systems that sit right on an IPMB so * they can receive commands and respond to them. */ #define IPMI_IPMB_DIRECT_ADDR_TYPE 0x81 struct ipmi_ipmb_direct_addr { int addr_type; short channel; unsigned char slave_addr; unsigned char rs_lun; unsigned char rq_lun; }; /* * A LAN Address. This is an address to/from a LAN interface bridged * by the BMC, not an address actually out on the LAN. * * A conscious decision was made here to deviate slightly from the IPMI * spec. We do not use rqSWID and rsSWID like it shows in the * message. Instead, we use remote_SWID and local_SWID. This means * that any message (a request or response) from another device will * always have exactly the same address. If you didn't do this, * requests and responses from the same device would have different * addresses, and that's not too cool. * * In this address, the remote_SWID is always the SWID the remote * message came from, or the SWID we are sending the message to. * local_SWID is always our SWID. Note that having our SWID in the * message is a little weird, but this is required. */ #define IPMI_LAN_ADDR_TYPE 0x04 struct ipmi_lan_addr { int addr_type; short channel; unsigned char privilege; unsigned char session_handle; unsigned char remote_SWID; unsigned char local_SWID; unsigned char lun; }; /* * Channel for talking directly with the BMC. When using this * channel, This is for the system interface address type only. FIXME * - is this right, or should we use -1? */ #define IPMI_BMC_CHANNEL 0xf #define IPMI_NUM_CHANNELS 0x10 /* * Used to signify an "all channel" bitmask. This is more than the * actual number of channels because this is used in userland and * will cover us if the number of channels is extended. */ #define IPMI_CHAN_ALL (~0) /* * A raw IPMI message without any addressing. This covers both * commands and responses. The completion code is always the first * byte of data in the response (as the spec shows the messages laid * out). */ struct ipmi_msg { unsigned char netfn; unsigned char cmd; unsigned short data_len; unsigned char *data; }; struct kernel_ipmi_msg { unsigned char netfn; unsigned char cmd; unsigned short data_len; unsigned char *data; }; /* * Various defines that are useful for IPMI applications. */ #define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1 #define IPMI_TIMEOUT_COMPLETION_CODE 0xC3 #define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff /* * Receive types for messages coming from the receive interface. This * is used for the receive in-kernel interface and in the receive * IOCTL. * * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but * it allows you to get the message results when you send a response * message. */ #define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */ #define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */ #define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */ #define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for a sent response, giving any error status for sending the response. When you send a response message, this will be returned. */ #define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */ /* Note that async events and received commands do not have a completion code as the first byte of the incoming data, unlike a response. */ /* * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO * setting is the default and means it will be set on certain * commands. Hard setting it on and off will override automatic * operation. */ #define IPMI_MAINTENANCE_MODE_AUTO 0 #define IPMI_MAINTENANCE_MODE_OFF 1 #define IPMI_MAINTENANCE_MODE_ON 2 /* * The userland interface */ /* * The userland interface for the IPMI driver is a standard character * device, with each instance of an interface registered as a minor * number under the major character device. * * The read and write calls do not work, to get messages in and out * requires ioctl calls because of the complexity of the data. select * and poll do work, so you can wait for input using the file * descriptor, you just can use read to get it. * * In general, you send a command down to the interface and receive * responses back. You can use the msgid value to correlate commands * and responses, the driver will take care of figuring out which * incoming messages are for which command and find the proper msgid * value to report. You will only receive reponses for commands you * send. Asynchronous events, however, go to all open users, so you * must be ready to handle these (or ignore them if you don't care). * * The address type depends upon the channel type. When talking * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored * (IPMI_UNUSED_ADDR_TYPE). When talking to an IPMB channel, you must * supply a valid IPMB address with the addr_type set properly. * * When talking to normal channels, the driver takes care of the * details of formatting and sending messages on that channel. You do * not, for instance, have to format a send command, you just send * whatever command you want to the channel, the driver will create * the send command, automatically issue receive command and get even * commands, and pass those up to the proper user. */ /* The magic IOCTL value for this interface. */ #define IPMI_IOC_MAGIC 'i' /* Messages sent to the interface are this format. */ struct ipmi_req { unsigned char *addr; /* Address to send the message to. */ unsigned int addr_len; long msgid; /* The sequence number for the message. This exact value will be reported back in the response to this request if it is a command. If it is a response, this will be used as the sequence value for the response. */ struct ipmi_msg msg; }; /* * Send a message to the interfaces. error values are: * - EFAULT - an address supplied was invalid. * - EINVAL - The address supplied was not valid, or the command * was not allowed. * - EMSGSIZE - The message to was too large. * - ENOMEM - Buffers could not be allocated for the command. */ #define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \ struct ipmi_req) /* Messages sent to the interface with timing parameters are this format. */ struct ipmi_req_settime { struct ipmi_req req; /* See ipmi_request_settime() above for details on these values. */ int retries; unsigned int retry_time_ms; }; /* * Send a message to the interfaces with timing parameters. error values * are: * - EFAULT - an address supplied was invalid. * - EINVAL - The address supplied was not valid, or the command * was not allowed. * - EMSGSIZE - The message to was too large. * - ENOMEM - Buffers could not be allocated for the command. */ #define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \ struct ipmi_req_settime) /* Messages received from the interface are this format. */ struct ipmi_recv { int recv_type; /* Is this a command, response or an asyncronous event. */ unsigned char *addr; /* Address the message was from is put here. The caller must supply the memory. */ unsigned int addr_len; /* The size of the address buffer. The caller supplies the full buffer length, this value is updated to the actual message length when the message is received. */ long msgid; /* The sequence number specified in the request if this is a response. If this is a command, this will be the sequence number from the command. */ struct ipmi_msg msg; /* The data field must point to a buffer. The data_size field must be set to the size of the message buffer. The caller supplies the full buffer length, this value is updated to the actual message length when the message is received. */ }; /* * Receive a message. error values: * - EAGAIN - no messages in the queue. * - EFAULT - an address supplied was invalid. * - EINVAL - The address supplied was not valid. * - EMSGSIZE - The message to was too large to fit into the message buffer, * the message will be left in the buffer. */ #define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, \ struct ipmi_recv) /* * Like RECEIVE_MSG, but if the message won't fit in the buffer, it * will truncate the contents instead of leaving the data in the * buffer. */ #define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, \ struct ipmi_recv) /* Register to get commands from other entities on this interface. */ struct ipmi_cmdspec { unsigned char netfn; unsigned char cmd; }; /* * Register to receive a specific command. error values: * - EFAULT - an address supplied was invalid. * - EBUSY - The netfn/cmd supplied was already in use. * - ENOMEM - could not allocate memory for the entry. */ #define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, \ struct ipmi_cmdspec) /* * Unregister a registered command. error values: * - EFAULT - an address supplied was invalid. * - ENOENT - The netfn/cmd was not found registered for this user. */ #define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \ struct ipmi_cmdspec) /* * Register to get commands from other entities on specific channels. * This way, you can only listen on specific channels, or have messages * from some channels go to one place and other channels to someplace * else. The chans field is a bitmask, (1 << channel) for each channel. * It may be IPMI_CHAN_ALL for all channels. */ struct ipmi_cmdspec_chans { unsigned int netfn; unsigned int cmd; unsigned int chans; }; /* * Register to receive a specific command on specific channels. error values: * - EFAULT - an address supplied was invalid. * - EBUSY - One of the netfn/cmd/chans supplied was already in use. * - ENOMEM - could not allocate memory for the entry. */ #define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, \ struct ipmi_cmdspec_chans) /* * Unregister some netfn/cmd/chans. error values: * - EFAULT - an address supplied was invalid. * - ENOENT - None of the netfn/cmd/chans were found registered for this user. */ #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \ struct ipmi_cmdspec_chans) /* * Set whether this interface receives events. Note that the first * user registered for events will get all pending events for the * interface. error values: * - EFAULT - an address supplied was invalid. */ #define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int) /* * Set and get the slave address and LUN that we will use for our * source messages. Note that this affects the interface, not just * this user, so it will affect all users of this interface. This is * so some initialization code can come in and do the OEM-specific * things it takes to determine your address (if not the BMC) and set * it for everyone else. You should probably leave the LUN alone. */ struct ipmi_channel_lun_address_set { unsigned short channel; unsigned char value; }; #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \ _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set) #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \ _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set) #define IPMICTL_SET_MY_CHANNEL_LUN_CMD \ _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set) #define IPMICTL_GET_MY_CHANNEL_LUN_CMD \ _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set) /* Legacy interfaces, these only set IPMB 0. */ #define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int) #define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) #define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int) #define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int) /* * Get/set the default timing values for an interface. You shouldn't * generally mess with these. */ struct ipmi_timing_parms { int retries; unsigned int retry_time_ms; }; #define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \ struct ipmi_timing_parms) #define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ struct ipmi_timing_parms) /* * Set the maintenance mode. See ipmi_set_maintenance_mode() above * for a description of what this does. */ #define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int) #define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int) #endif /* __LINUX_IPMI_H */ linux/ipmi_bmc.h 0000644 00000000720 15063602051 0007630 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015-2018, Intel Corporation. */ #ifndef _LINUX_IPMI_BMC_H #define _LINUX_IPMI_BMC_H #include <linux/ioctl.h> #define __IPMI_BMC_IOCTL_MAGIC 0xB1 #define IPMI_BMC_IOCTL_SET_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x00) #define IPMI_BMC_IOCTL_CLEAR_SMS_ATN _IO(__IPMI_BMC_IOCTL_MAGIC, 0x01) #define IPMI_BMC_IOCTL_FORCE_ABORT _IO(__IPMI_BMC_IOCTL_MAGIC, 0x02) #endif /* _LINUX_IPMI_BMC_H */ linux/ipmi_msgdefs.h 0000644 00000006546 15063602051 0010533 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * ipmi_smi.h * * MontaVista IPMI system management interface * * Author: MontaVista Software, Inc. * Corey Minyard <minyard@mvista.com> * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * */ #ifndef __LINUX_IPMI_MSGDEFS_H #define __LINUX_IPMI_MSGDEFS_H /* Various definitions for IPMI messages used by almost everything in the IPMI stack. */ /* NetFNs and commands used inside the IPMI stack. */ #define IPMI_NETFN_SENSOR_EVENT_REQUEST 0x04 #define IPMI_NETFN_SENSOR_EVENT_RESPONSE 0x05 #define IPMI_GET_EVENT_RECEIVER_CMD 0x01 #define IPMI_NETFN_APP_REQUEST 0x06 #define IPMI_NETFN_APP_RESPONSE 0x07 #define IPMI_GET_DEVICE_ID_CMD 0x01 #define IPMI_COLD_RESET_CMD 0x02 #define IPMI_WARM_RESET_CMD 0x03 #define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 #define IPMI_GET_DEVICE_GUID_CMD 0x08 #define IPMI_GET_MSG_FLAGS_CMD 0x31 #define IPMI_SEND_MSG_CMD 0x34 #define IPMI_GET_MSG_CMD 0x33 #define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 #define IPMI_GET_CHANNEL_INFO_CMD 0x42 /* Bit for BMC global enables. */ #define IPMI_BMC_RCV_MSG_INTR 0x01 #define IPMI_BMC_EVT_MSG_INTR 0x02 #define IPMI_BMC_EVT_MSG_BUFF 0x04 #define IPMI_BMC_SYS_LOG 0x08 #define IPMI_NETFN_STORAGE_REQUEST 0x0a #define IPMI_NETFN_STORAGE_RESPONSE 0x0b #define IPMI_ADD_SEL_ENTRY_CMD 0x44 #define IPMI_NETFN_FIRMWARE_REQUEST 0x08 #define IPMI_NETFN_FIRMWARE_RESPONSE 0x09 /* The default slave address */ #define IPMI_BMC_SLAVE_ADDR 0x20 /* The BT interface on high-end HP systems supports up to 255 bytes in * one transfer. Its "virtual" BMC supports some commands that are longer * than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus * some overhead; it's not worth the effort to dynamically size this based * on the results of the "Get BT Capabilities" command. */ #define IPMI_MAX_MSG_LENGTH 272 /* multiple of 16 */ #define IPMI_CC_NO_ERROR 0x00 #define IPMI_NODE_BUSY_ERR 0xc0 #define IPMI_INVALID_COMMAND_ERR 0xc1 #define IPMI_TIMEOUT_ERR 0xc3 #define IPMI_ERR_MSG_TRUNCATED 0xc6 #define IPMI_REQ_LEN_INVALID_ERR 0xc7 #define IPMI_REQ_LEN_EXCEEDED_ERR 0xc8 #define IPMI_DEVICE_IN_FW_UPDATE_ERR 0xd1 #define IPMI_DEVICE_IN_INIT_ERR 0xd2 #define IPMI_NOT_IN_MY_STATE_ERR 0xd5 /* IPMI 2.0 */ #define IPMI_LOST_ARBITRATION_ERR 0x81 #define IPMI_BUS_ERR 0x82 #define IPMI_NAK_ON_WRITE_ERR 0x83 #define IPMI_ERR_UNSPECIFIED 0xff #define IPMI_CHANNEL_PROTOCOL_IPMB 1 #define IPMI_CHANNEL_PROTOCOL_ICMB 2 #define IPMI_CHANNEL_PROTOCOL_SMBUS 4 #define IPMI_CHANNEL_PROTOCOL_KCS 5 #define IPMI_CHANNEL_PROTOCOL_SMIC 6 #define IPMI_CHANNEL_PROTOCOL_BT10 7 #define IPMI_CHANNEL_PROTOCOL_BT15 8 #define IPMI_CHANNEL_PROTOCOL_TMODE 9 #define IPMI_CHANNEL_MEDIUM_IPMB 1 #define IPMI_CHANNEL_MEDIUM_ICMB10 2 #define IPMI_CHANNEL_MEDIUM_ICMB09 3 #define IPMI_CHANNEL_MEDIUM_8023LAN 4 #define IPMI_CHANNEL_MEDIUM_ASYNC 5 #define IPMI_CHANNEL_MEDIUM_OTHER_LAN 6 #define IPMI_CHANNEL_MEDIUM_PCI_SMBUS 7 #define IPMI_CHANNEL_MEDIUM_SMBUS1 8 #define IPMI_CHANNEL_MEDIUM_SMBUS2 9 #define IPMI_CHANNEL_MEDIUM_USB1 10 #define IPMI_CHANNEL_MEDIUM_USB2 11 #define IPMI_CHANNEL_MEDIUM_SYSINTF 12 #define IPMI_CHANNEL_MEDIUM_OEM_MIN 0x60 #define IPMI_CHANNEL_MEDIUM_OEM_MAX 0x7f #endif /* __LINUX_IPMI_MSGDEFS_H */ linux/ipmi_ssif_bmc.h 0000644 00000000671 15063602051 0010661 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note*/ /* * Copyright (c) 2022, Ampere Computing LLC. */ #ifndef _LINUX_IPMI_SSIF_BMC_H #define _LINUX_IPMI_SSIF_BMC_H #include <linux/types.h> /* Max length of ipmi ssif message included netfn and cmd field */ #define IPMI_SSIF_PAYLOAD_MAX 254 struct ipmi_ssif_msg { unsigned int len; __u8 payload[IPMI_SSIF_PAYLOAD_MAX]; }; #endif /* _LINUX_IPMI_SSIF_BMC_H */ linux/ipsec.h 0000644 00000001663 15063602051 0007163 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IPSEC_H #define _LINUX_IPSEC_H /* The definitions, required to talk to KAME racoon IKE. */ #include <linux/pfkeyv2.h> #define IPSEC_PORT_ANY 0 #define IPSEC_ULPROTO_ANY 255 #define IPSEC_PROTO_ANY 255 enum { IPSEC_MODE_ANY = 0, /* We do not support this for SA */ IPSEC_MODE_TRANSPORT = 1, IPSEC_MODE_TUNNEL = 2, IPSEC_MODE_BEET = 3 }; enum { IPSEC_DIR_ANY = 0, IPSEC_DIR_INBOUND = 1, IPSEC_DIR_OUTBOUND = 2, IPSEC_DIR_FWD = 3, /* It is our own */ IPSEC_DIR_MAX = 4, IPSEC_DIR_INVALID = 5 }; enum { IPSEC_POLICY_DISCARD = 0, IPSEC_POLICY_NONE = 1, IPSEC_POLICY_IPSEC = 2, IPSEC_POLICY_ENTRUST = 3, IPSEC_POLICY_BYPASS = 4 }; enum { IPSEC_LEVEL_DEFAULT = 0, IPSEC_LEVEL_USE = 1, IPSEC_LEVEL_REQUIRE = 2, IPSEC_LEVEL_UNIQUE = 3 }; #define IPSEC_MANUAL_REQID_MAX 0x3fff #define IPSEC_REPLAYWSIZE 32 #endif /* _LINUX_IPSEC_H */ linux/ipv6.h 0000644 00000007577 15063602051 0006756 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPV6_H #define _IPV6_H #include <linux/libc-compat.h> #include <linux/types.h> #include <linux/in6.h> #include <asm/byteorder.h> /* The latest drafts declared increase in minimal mtu up to 1280. */ #define IPV6_MIN_MTU 1280 /* * Advanced API * source interface/address selection, source routing, etc... * *under construction* */ #if __UAPI_DEF_IN6_PKTINFO struct in6_pktinfo { struct in6_addr ipi6_addr; int ipi6_ifindex; }; #endif #if __UAPI_DEF_IP6_MTUINFO struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; __u32 ip6m_mtu; }; #endif struct in6_ifreq { struct in6_addr ifr6_addr; __u32 ifr6_prefixlen; int ifr6_ifindex; }; #define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */ #define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */ #define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */ #define IPV6_SRCRT_TYPE_4 4 /* Segment Routing with IPv6 */ /* * routing header */ struct ipv6_rt_hdr { __u8 nexthdr; __u8 hdrlen; __u8 type; __u8 segments_left; /* * type specific data * variable length field */ }; struct ipv6_opt_hdr { __u8 nexthdr; __u8 hdrlen; /* * TLV encoded option data follows. */ } __attribute__((packed)); /* required for some archs */ #define ipv6_destopt_hdr ipv6_opt_hdr #define ipv6_hopopt_hdr ipv6_opt_hdr /* Router Alert option values (RFC2711) */ #define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */ /* * routing header type 0 (used in cmsghdr struct) */ struct rt0_hdr { struct ipv6_rt_hdr rt_hdr; __u32 reserved; struct in6_addr addr[0]; #define rt0_type rt_hdr.type }; /* * routing header type 2 */ struct rt2_hdr { struct ipv6_rt_hdr rt_hdr; __u32 reserved; struct in6_addr addr; #define rt2_type rt_hdr.type }; /* * home address option in destination options header */ struct ipv6_destopt_hao { __u8 type; __u8 length; struct in6_addr addr; } __attribute__((packed)); /* * IPv6 fixed header * * BEWARE, it is incorrect. The first 4 bits of flow_lbl * are glued to priority now, forming "class". */ struct ipv6hdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 priority:4, version:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 version:4, priority:4; #else #error "Please fix <asm/byteorder.h>" #endif __u8 flow_lbl[3]; __be16 payload_len; __u8 nexthdr; __u8 hop_limit; struct in6_addr saddr; struct in6_addr daddr; }; /* index values for the variables in ipv6_devconf */ enum { DEVCONF_FORWARDING = 0, DEVCONF_HOPLIMIT, DEVCONF_MTU6, DEVCONF_ACCEPT_RA, DEVCONF_ACCEPT_REDIRECTS, DEVCONF_AUTOCONF, DEVCONF_DAD_TRANSMITS, DEVCONF_RTR_SOLICITS, DEVCONF_RTR_SOLICIT_INTERVAL, DEVCONF_RTR_SOLICIT_DELAY, DEVCONF_USE_TEMPADDR, DEVCONF_TEMP_VALID_LFT, DEVCONF_TEMP_PREFERED_LFT, DEVCONF_REGEN_MAX_RETRY, DEVCONF_MAX_DESYNC_FACTOR, DEVCONF_MAX_ADDRESSES, DEVCONF_FORCE_MLD_VERSION, DEVCONF_ACCEPT_RA_DEFRTR, DEVCONF_ACCEPT_RA_PINFO, DEVCONF_ACCEPT_RA_RTR_PREF, DEVCONF_RTR_PROBE_INTERVAL, DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, DEVCONF_PROXY_NDP, DEVCONF_OPTIMISTIC_DAD, DEVCONF_ACCEPT_SOURCE_ROUTE, DEVCONF_MC_FORWARDING, DEVCONF_DISABLE_IPV6, DEVCONF_ACCEPT_DAD, DEVCONF_FORCE_TLLAO, DEVCONF_NDISC_NOTIFY, DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL, DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, DEVCONF_SUPPRESS_FRAG_NDISC, DEVCONF_ACCEPT_RA_FROM_LOCAL, DEVCONF_USE_OPTIMISTIC, DEVCONF_ACCEPT_RA_MTU, DEVCONF_STABLE_SECRET, DEVCONF_USE_OIF_ADDRS_ONLY, DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT, DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, DEVCONF_DROP_UNSOLICITED_NA, DEVCONF_KEEP_ADDR_ON_DOWN, DEVCONF_RTR_SOLICIT_MAX_INTERVAL, DEVCONF_SEG6_ENABLED, DEVCONF_SEG6_REQUIRE_HMAC, DEVCONF_ENHANCED_DAD, DEVCONF_ADDR_GEN_MODE, DEVCONF_DISABLE_POLICY, DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN, DEVCONF_NDISC_TCLASS, DEVCONF_MAX }; #endif /* _IPV6_H */ linux/ipv6_route.h 0000644 00000003564 15063602051 0010164 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Linux INET6 implementation * * Authors: * Pedro Roque <roque@di.fc.ul.pt> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_IPV6_ROUTE_H #define _LINUX_IPV6_ROUTE_H #include <linux/types.h> #include <linux/in6.h> /* For struct in6_addr. */ #define RTF_DEFAULT 0x00010000 /* default - learned via ND */ #define RTF_ALLONLINK 0x00020000 /* (deprecated and will be removed) fallback, no routers on link */ #define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ #define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */ #define RTF_ANYCAST 0x00100000 /* Anycast */ #define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ #define RTF_EXPIRES 0x00400000 #define RTF_ROUTEINFO 0x00800000 /* route information - RA */ #define RTF_CACHE 0x01000000 /* read-only: can not be set by user */ #define RTF_FLOW 0x02000000 /* flow significant route */ #define RTF_POLICY 0x04000000 /* policy route */ #define RTF_PREF(pref) ((pref) << 27) #define RTF_PREF_MASK 0x18000000 #define RTF_PCPU 0x40000000 /* read-only: can not be set by user */ #define RTF_LOCAL 0x80000000 struct in6_rtmsg { struct in6_addr rtmsg_dst; struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; __u32 rtmsg_type; __u16 rtmsg_dst_len; __u16 rtmsg_src_len; __u32 rtmsg_metric; unsigned long rtmsg_info; __u32 rtmsg_flags; int rtmsg_ifindex; }; #define RTMSG_NEWDEVICE 0x11 #define RTMSG_DELDEVICE 0x12 #define RTMSG_NEWROUTE 0x21 #define RTMSG_DELROUTE 0x22 #define IP6_RT_PRIO_USER 1024 #define IP6_RT_PRIO_ADDRCONF 256 #endif /* _LINUX_IPV6_ROUTE_H */ linux/ipx.h 0000644 00000004453 15063602051 0006660 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPX_H_ #define _IPX_H_ #include <linux/libc-compat.h> /* for compatibility with glibc netipx/ipx.h */ #include <linux/types.h> #include <linux/sockios.h> #include <linux/socket.h> #define IPX_NODE_LEN 6 #define IPX_MTU 576 #if __UAPI_DEF_SOCKADDR_IPX struct sockaddr_ipx { __kernel_sa_family_t sipx_family; __be16 sipx_port; __be32 sipx_network; unsigned char sipx_node[IPX_NODE_LEN]; __u8 sipx_type; unsigned char sipx_zero; /* 16 byte fill */ }; #endif /* __UAPI_DEF_SOCKADDR_IPX */ /* * So we can fit the extra info for SIOCSIFADDR into the address nicely */ #define sipx_special sipx_port #define sipx_action sipx_zero #define IPX_DLTITF 0 #define IPX_CRTITF 1 #if __UAPI_DEF_IPX_ROUTE_DEFINITION struct ipx_route_definition { __be32 ipx_network; __be32 ipx_router_network; unsigned char ipx_router_node[IPX_NODE_LEN]; }; #endif /* __UAPI_DEF_IPX_ROUTE_DEFINITION */ #if __UAPI_DEF_IPX_INTERFACE_DEFINITION struct ipx_interface_definition { __be32 ipx_network; unsigned char ipx_device[16]; unsigned char ipx_dlink_type; #define IPX_FRAME_NONE 0 #define IPX_FRAME_SNAP 1 #define IPX_FRAME_8022 2 #define IPX_FRAME_ETHERII 3 #define IPX_FRAME_8023 4 #define IPX_FRAME_TR_8022 5 /* obsolete */ unsigned char ipx_special; #define IPX_SPECIAL_NONE 0 #define IPX_PRIMARY 1 #define IPX_INTERNAL 2 unsigned char ipx_node[IPX_NODE_LEN]; }; #endif /* __UAPI_DEF_IPX_INTERFACE_DEFINITION */ #if __UAPI_DEF_IPX_CONFIG_DATA struct ipx_config_data { unsigned char ipxcfg_auto_select_primary; unsigned char ipxcfg_auto_create_interfaces; }; #endif /* __UAPI_DEF_IPX_CONFIG_DATA */ /* * OLD Route Definition for backward compatibility. */ #if __UAPI_DEF_IPX_ROUTE_DEF struct ipx_route_def { __be32 ipx_network; __be32 ipx_router_network; #define IPX_ROUTE_NO_ROUTER 0 unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_device[16]; unsigned short ipx_flags; #define IPX_RT_SNAP 8 #define IPX_RT_8022 4 #define IPX_RT_BLUEBOOK 2 #define IPX_RT_ROUTED 1 }; #endif /* __UAPI_DEF_IPX_ROUTE_DEF */ #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1) #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2) #define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3) #endif /* _IPX_H_ */ linux/irqnr.h 0000644 00000000150 15063602051 0007201 0 ustar 00 /* * There isn't anything here anymore, but the file must not be empty or patch * will delete it. */ linux/isdn.h 0000644 00000013216 15063602051 0007012 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $ * * Main header for the Linux ISDN subsystem (linklevel). * * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __ISDN_H__ #define __ISDN_H__ #include <linux/ioctl.h> #include <linux/tty.h> #define ISDN_MAX_DRIVERS 32 #define ISDN_MAX_CHANNELS 64 /* New ioctl-codes */ #define IIOCNETAIF _IO('I',1) #define IIOCNETDIF _IO('I',2) #define IIOCNETSCF _IO('I',3) #define IIOCNETGCF _IO('I',4) #define IIOCNETANM _IO('I',5) #define IIOCNETDNM _IO('I',6) #define IIOCNETGNM _IO('I',7) #define IIOCGETSET _IO('I',8) /* no longer supported */ #define IIOCSETSET _IO('I',9) /* no longer supported */ #define IIOCSETVER _IO('I',10) #define IIOCNETHUP _IO('I',11) #define IIOCSETGST _IO('I',12) #define IIOCSETBRJ _IO('I',13) #define IIOCSIGPRF _IO('I',14) #define IIOCGETPRF _IO('I',15) #define IIOCSETPRF _IO('I',16) #define IIOCGETMAP _IO('I',17) #define IIOCSETMAP _IO('I',18) #define IIOCNETASL _IO('I',19) #define IIOCNETDIL _IO('I',20) #define IIOCGETCPS _IO('I',21) #define IIOCGETDVR _IO('I',22) #define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */ #define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */ #define IIOCNETALN _IO('I',32) #define IIOCNETDLN _IO('I',33) #define IIOCNETGPN _IO('I',34) #define IIOCDBGVAR _IO('I',127) #define IIOCDRVCTL _IO('I',128) /* cisco hdlck device private ioctls */ #define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0) #define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1) #define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2) #define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3) /* Packet encapsulations for net-interfaces */ #define ISDN_NET_ENCAP_ETHER 0 #define ISDN_NET_ENCAP_RAWIP 1 #define ISDN_NET_ENCAP_IPTYP 2 #define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */ #define ISDN_NET_ENCAP_SYNCPPP 4 #define ISDN_NET_ENCAP_UIHDLC 5 #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */ #define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt */ #define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE /* Facility which currently uses an ISDN-channel */ #define ISDN_USAGE_NONE 0 #define ISDN_USAGE_RAW 1 #define ISDN_USAGE_MODEM 2 #define ISDN_USAGE_NET 3 #define ISDN_USAGE_VOICE 4 #define ISDN_USAGE_FAX 5 #define ISDN_USAGE_MASK 7 /* Mask to get plain usage */ #define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */ #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */ #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */ #define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */ #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */ #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */ #define ISDN_MSNLEN 32 #define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */ #define TTY_DV 0x06 /* Data version for iprofd etc. */ #define INF_DV 0x01 /* Data version for /dev/isdninfo */ typedef struct { char drvid[25]; unsigned long arg; } isdn_ioctl_struct; typedef struct { char name[10]; char phone[ISDN_MSNLEN]; int outgoing; } isdn_net_ioctl_phone; typedef struct { char name[10]; /* Name of interface */ char master[10]; /* Name of Master for Bundling */ char slave[10]; /* Name of Slave for Bundling */ char eaz[256]; /* EAZ/MSN */ char drvid[25]; /* DriverId for Bindings */ int onhtime; /* Hangup-Timeout */ int charge; /* Charge-Units */ int l2_proto; /* Layer-2 protocol */ int l3_proto; /* Layer-3 protocol */ int p_encap; /* Encapsulation */ int exclusive; /* Channel, if bound exclusive */ int dialmax; /* Dial Retry-Counter */ int slavedelay; /* Delay until slave starts up */ int cbdelay; /* Delay before Callback */ int chargehup; /* Flag: Charge-Hangup */ int ihup; /* Flag: Hangup-Timeout on incoming line */ int secure; /* Flag: Secure */ int callback; /* Flag: Callback */ int cbhup; /* Flag: Reject Call before Callback */ int pppbind; /* ippp device for bindings */ int chargeint; /* Use fixed charge interval length */ int triggercps; /* BogoCPS needed for triggering slave */ int dialtimeout; /* Dial-Timeout */ int dialwait; /* Time to wait after failed dial */ int dialmode; /* Flag: off / on / auto */ } isdn_net_ioctl_cfg; #define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */ #define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */ #define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */ #define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */ #define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK) #endif /* __ISDN_H__ */ linux/isdn_divertif.h 0000644 00000002260 15063602051 0010703 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ * * Header for the diversion supplementary interface for i4l. * * Author Werner Cornelius (werner@titro.de) * Copyright by Werner Cornelius (werner@titro.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef _LINUX_ISDN_DIVERTIF_H #define _LINUX_ISDN_DIVERTIF_H /***********************************************************/ /* magic value is also used to control version information */ /***********************************************************/ #define DIVERT_IF_MAGIC 0x25873401 #define DIVERT_CMD_REG 0x00 /* register command */ #define DIVERT_CMD_REL 0x01 /* release command */ #define DIVERT_NO_ERR 0x00 /* return value no error */ #define DIVERT_CMD_ERR 0x01 /* invalid cmd */ #define DIVERT_VER_ERR 0x02 /* magic/version invalid */ #define DIVERT_REG_ERR 0x03 /* module already registered */ #define DIVERT_REL_ERR 0x04 /* module not registered */ #define DIVERT_REG_NAME isdn_register_divert #endif /* _LINUX_ISDN_DIVERTIF_H */ linux/isdn_ppp.h 0000644 00000003603 15063602051 0007670 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* Linux ISDN subsystem, sync PPP, interface to ipppd * * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de) * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef _LINUX_ISDN_PPP_H #define _LINUX_ISDN_PPP_H #define CALLTYPE_INCOMING 0x1 #define CALLTYPE_OUTGOING 0x2 #define CALLTYPE_CALLBACK 0x4 #define IPPP_VERSION "2.2.0" struct pppcallinfo { int calltype; unsigned char local_num[64]; unsigned char remote_num[64]; int charge_units; }; #define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo) #define PPPIOCBUNDLE _IOW('t',129,int) #define PPPIOCGMPFLAGS _IOR('t',130,int) #define PPPIOCSMPFLAGS _IOW('t',131,int) #define PPPIOCSMPMTU _IOW('t',132,int) #define PPPIOCSMPMRU _IOW('t',133,int) #define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8]) #define PPPIOCSCOMPRESSOR _IOW('t',135,int) #define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] ) #define SC_MP_PROT 0x00000200 #define SC_REJ_MP_PROT 0x00000400 #define SC_OUT_SHORT_SEQ 0x00000800 #define SC_IN_SHORT_SEQ 0x00004000 #define SC_DECOMP_ON 0x01 #define SC_COMP_ON 0x02 #define SC_DECOMP_DISCARD 0x04 #define SC_COMP_DISCARD 0x08 #define SC_LINK_DECOMP_ON 0x10 #define SC_LINK_COMP_ON 0x20 #define SC_LINK_DECOMP_DISCARD 0x40 #define SC_LINK_COMP_DISCARD 0x80 #define ISDN_PPP_COMP_MAX_OPTIONS 16 #define IPPP_COMP_FLAG_XMIT 0x1 #define IPPP_COMP_FLAG_LINK 0x2 struct isdn_ppp_comp_data { int num; unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS]; int optlen; int flags; }; #endif /* _LINUX_ISDN_PPP_H */ linux/isdnif.h 0000644 00000004502 15063602051 0007327 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $ * * Linux ISDN subsystem * Definition of the interface between the subsystem and its low-level drivers. * * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __ISDNIF_H__ #define __ISDNIF_H__ /* * Values for general protocol-selection */ #define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */ #define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */ #define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */ #define ISDN_PTYPE_LEASED 3 /* for leased lines */ #define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */ #define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */ /* * Values for Layer-2-protocol-selection */ #define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */ #define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */ #define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */ #define ISDN_PROTO_L2_HDLC 3 /* HDLC */ #define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */ #define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */ #define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */ #define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */ #define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */ #define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */ #define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */ #define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */ #define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */ #define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */ /* * Values for Layer-3-protocol-selection */ #define ISDN_PROTO_L3_TRANS 0 /* Transparent */ #define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */ #define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */ #define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */ #define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */ #endif /* __ISDNIF_H__ */ linux/iso_fs.h 0000644 00000014525 15063602051 0007343 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ISOFS_FS_H #define _ISOFS_FS_H #include <linux/types.h> #include <linux/magic.h> /* * The isofs filesystem constants/structures */ /* This part borrowed from the bsd386 isofs */ #define ISODCL(from, to) (to - from + 1) struct iso_volume_descriptor { __u8 type[ISODCL(1,1)]; /* 711 */ char id[ISODCL(2,6)]; __u8 version[ISODCL(7,7)]; __u8 data[ISODCL(8,2048)]; }; /* volume descriptor types */ #define ISO_VD_PRIMARY 1 #define ISO_VD_SUPPLEMENTARY 2 #define ISO_VD_END 255 #define ISO_STANDARD_ID "CD001" struct iso_primary_descriptor { __u8 type [ISODCL ( 1, 1)]; /* 711 */ char id [ISODCL ( 2, 6)]; __u8 version [ISODCL ( 7, 7)]; /* 711 */ __u8 unused1 [ISODCL ( 8, 8)]; char system_id [ISODCL ( 9, 40)]; /* achars */ char volume_id [ISODCL ( 41, 72)]; /* dchars */ __u8 unused2 [ISODCL ( 73, 80)]; __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */ __u8 unused3 [ISODCL ( 89, 120)]; __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */ __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */ __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */ __u8 path_table_size [ISODCL (133, 140)]; /* 733 */ __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */ __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */ __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */ char volume_set_id [ISODCL (191, 318)]; /* dchars */ char publisher_id [ISODCL (319, 446)]; /* achars */ char preparer_id [ISODCL (447, 574)]; /* achars */ char application_id [ISODCL (575, 702)]; /* achars */ char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */ __u8 unused4 [ISODCL (883, 883)]; __u8 application_data [ISODCL (884, 1395)]; __u8 unused5 [ISODCL (1396, 2048)]; }; /* Almost the same as the primary descriptor but two fields are specified */ struct iso_supplementary_descriptor { __u8 type [ISODCL ( 1, 1)]; /* 711 */ char id [ISODCL ( 2, 6)]; __u8 version [ISODCL ( 7, 7)]; /* 711 */ __u8 flags [ISODCL ( 8, 8)]; /* 853 */ char system_id [ISODCL ( 9, 40)]; /* achars */ char volume_id [ISODCL ( 41, 72)]; /* dchars */ __u8 unused2 [ISODCL ( 73, 80)]; __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */ __u8 escape [ISODCL ( 89, 120)]; /* 856 */ __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */ __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */ __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */ __u8 path_table_size [ISODCL (133, 140)]; /* 733 */ __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */ __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */ __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */ char volume_set_id [ISODCL (191, 318)]; /* dchars */ char publisher_id [ISODCL (319, 446)]; /* achars */ char preparer_id [ISODCL (447, 574)]; /* achars */ char application_id [ISODCL (575, 702)]; /* achars */ char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */ __u8 unused4 [ISODCL (883, 883)]; __u8 application_data [ISODCL (884, 1395)]; __u8 unused5 [ISODCL (1396, 2048)]; }; #define HS_STANDARD_ID "CDROM" struct hs_volume_descriptor { __u8 foo [ISODCL ( 1, 8)]; /* 733 */ __u8 type [ISODCL ( 9, 9)]; /* 711 */ char id [ISODCL ( 10, 14)]; __u8 version [ISODCL ( 15, 15)]; /* 711 */ __u8 data[ISODCL(16,2048)]; }; struct hs_primary_descriptor { __u8 foo [ISODCL ( 1, 8)]; /* 733 */ __u8 type [ISODCL ( 9, 9)]; /* 711 */ __u8 id [ISODCL ( 10, 14)]; __u8 version [ISODCL ( 15, 15)]; /* 711 */ __u8 unused1 [ISODCL ( 16, 16)]; /* 711 */ char system_id [ISODCL ( 17, 48)]; /* achars */ char volume_id [ISODCL ( 49, 80)]; /* dchars */ __u8 unused2 [ISODCL ( 81, 88)]; /* 733 */ __u8 volume_space_size [ISODCL ( 89, 96)]; /* 733 */ __u8 unused3 [ISODCL ( 97, 128)]; /* 733 */ __u8 volume_set_size [ISODCL (129, 132)]; /* 723 */ __u8 volume_sequence_number [ISODCL (133, 136)]; /* 723 */ __u8 logical_block_size [ISODCL (137, 140)]; /* 723 */ __u8 path_table_size [ISODCL (141, 148)]; /* 733 */ __u8 type_l_path_table [ISODCL (149, 152)]; /* 731 */ __u8 unused4 [ISODCL (153, 180)]; /* 733 */ __u8 root_directory_record [ISODCL (181, 214)]; /* 9.1 */ }; /* We use this to help us look up the parent inode numbers. */ struct iso_path_table{ __u8 name_len[2]; /* 721 */ __u8 extent[4]; /* 731 */ __u8 parent[2]; /* 721 */ char name[0]; } __attribute__((packed)); /* high sierra is identical to iso, except that the date is only 6 bytes, and there is an extra reserved byte after the flags */ struct iso_directory_record { __u8 length [ISODCL (1, 1)]; /* 711 */ __u8 ext_attr_length [ISODCL (2, 2)]; /* 711 */ __u8 extent [ISODCL (3, 10)]; /* 733 */ __u8 size [ISODCL (11, 18)]; /* 733 */ __u8 date [ISODCL (19, 25)]; /* 7 by 711 */ __u8 flags [ISODCL (26, 26)]; __u8 file_unit_size [ISODCL (27, 27)]; /* 711 */ __u8 interleave [ISODCL (28, 28)]; /* 711 */ __u8 volume_sequence_number [ISODCL (29, 32)]; /* 723 */ __u8 name_len [ISODCL (33, 33)]; /* 711 */ char name [0]; } __attribute__((packed)); #define ISOFS_BLOCK_BITS 11 #define ISOFS_BLOCK_SIZE 2048 #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) #endif /* _ISOFS_FS_H */ linux/isst_if.h 0000644 00000012410 15063602051 0007510 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ /* * Intel Speed Select Interface: OS to hardware Interface * Copyright (c) 2019, Intel Corporation. * All rights reserved. * * Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> */ #ifndef __ISST_IF_H #define __ISST_IF_H #include <linux/types.h> /** * struct isst_if_platform_info - Define platform information * @api_version: Version of the firmware document, which this driver * can communicate * @driver_version: Driver version, which will help user to send right * commands. Even if the firmware is capable, driver may * not be ready * @max_cmds_per_ioctl: Returns the maximum number of commands driver will * accept in a single ioctl * @mbox_supported: Support of mail box interface * @mmio_supported: Support of mmio interface for core-power feature * * Used to return output of IOCTL ISST_IF_GET_PLATFORM_INFO. This * information can be used by the user space, to get the driver, firmware * support and also number of commands to send in a single IOCTL request. */ struct isst_if_platform_info { __u16 api_version; __u16 driver_version; __u16 max_cmds_per_ioctl; __u8 mbox_supported; __u8 mmio_supported; }; /** * struct isst_if_cpu_map - CPU mapping between logical and physical CPU * @logical_cpu: Linux logical CPU number * @physical_cpu: PUNIT CPU number * * Used to convert from Linux logical CPU to PUNIT CPU numbering scheme. * The PUNIT CPU number is different than APIC ID based CPU numbering. */ struct isst_if_cpu_map { __u32 logical_cpu; __u32 physical_cpu; }; /** * struct isst_if_cpu_maps - structure for CPU map IOCTL * @cmd_count: Number of CPU mapping command in cpu_map[] * @cpu_map[]: Holds one or more CPU map data structure * * This structure used with ioctl ISST_IF_GET_PHY_ID to send * one or more CPU mapping commands. Here IOCTL return value indicates * number of commands sent or error number if no commands have been sent. */ struct isst_if_cpu_maps { __u32 cmd_count; struct isst_if_cpu_map cpu_map[1]; }; /** * struct isst_if_io_reg - Read write PUNIT IO register * @read_write: Value 0: Read, 1: Write * @logical_cpu: Logical CPU number to get target PCI device. * @reg: PUNIT register offset * @value: For write operation value to write and for * for read placeholder read value * * Structure to specify read/write data to PUNIT registers. */ struct isst_if_io_reg { __u32 read_write; /* Read:0, Write:1 */ __u32 logical_cpu; __u32 reg; __u32 value; }; /** * struct isst_if_io_regs - structure for IO register commands * @cmd_count: Number of io reg commands in io_reg[] * @io_reg[]: Holds one or more io_reg command structure * * This structure used with ioctl ISST_IF_IO_CMD to send * one or more read/write commands to PUNIT. Here IOCTL return value * indicates number of requests sent or error number if no requests have * been sent. */ struct isst_if_io_regs { __u32 req_count; struct isst_if_io_reg io_reg[1]; }; /** * struct isst_if_mbox_cmd - Structure to define mail box command * @logical_cpu: Logical CPU number to get target PCI device * @parameter: Mailbox parameter value * @req_data: Request data for the mailbox * @resp_data: Response data for mailbox command response * @command: Mailbox command value * @sub_command: Mailbox sub command value * @reserved: Unused, set to 0 * * Structure to specify mailbox command to be sent to PUNIT. */ struct isst_if_mbox_cmd { __u32 logical_cpu; __u32 parameter; __u32 req_data; __u32 resp_data; __u16 command; __u16 sub_command; __u32 reserved; }; /** * struct isst_if_mbox_cmds - structure for mailbox commands * @cmd_count: Number of mailbox commands in mbox_cmd[] * @mbox_cmd[]: Holds one or more mbox commands * * This structure used with ioctl ISST_IF_MBOX_COMMAND to send * one or more mailbox commands to PUNIT. Here IOCTL return value * indicates number of commands sent or error number if no commands have * been sent. */ struct isst_if_mbox_cmds { __u32 cmd_count; struct isst_if_mbox_cmd mbox_cmd[1]; }; /** * struct isst_if_msr_cmd - Structure to define msr command * @read_write: Value 0: Read, 1: Write * @logical_cpu: Logical CPU number * @msr: MSR number * @data: For write operation, data to write, for read * place holder * * Structure to specify MSR command related to PUNIT. */ struct isst_if_msr_cmd { __u32 read_write; /* Read:0, Write:1 */ __u32 logical_cpu; __u64 msr; __u64 data; }; /** * struct isst_if_msr_cmds - structure for msr commands * @cmd_count: Number of mailbox commands in msr_cmd[] * @msr_cmd[]: Holds one or more msr commands * * This structure used with ioctl ISST_IF_MSR_COMMAND to send * one or more MSR commands. IOCTL return value indicates number of * commands sent or error number if no commands have been sent. */ struct isst_if_msr_cmds { __u32 cmd_count; struct isst_if_msr_cmd msr_cmd[1]; }; #define ISST_IF_MAGIC 0xFE #define ISST_IF_GET_PLATFORM_INFO _IOR(ISST_IF_MAGIC, 0, struct isst_if_platform_info *) #define ISST_IF_GET_PHY_ID _IOWR(ISST_IF_MAGIC, 1, struct isst_if_cpu_map *) #define ISST_IF_IO_CMD _IOW(ISST_IF_MAGIC, 2, struct isst_if_io_regs *) #define ISST_IF_MBOX_COMMAND _IOWR(ISST_IF_MAGIC, 3, struct isst_if_mbox_cmds *) #define ISST_IF_MSR_COMMAND _IOWR(ISST_IF_MAGIC, 4, struct isst_if_msr_cmds *) #endif linux/ivtv.h 0000644 00000005716 15063602051 0007053 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* Public ivtv API header Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_IVTV_H__ #define __LINUX_IVTV_H__ #include <linux/types.h> #include <linux/videodev2.h> /* ivtv knows several distinct output modes: MPEG streaming, YUV streaming, YUV updates through user DMA and the passthrough mode. In order to clearly tell the driver that we are in user DMA YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL first (althrough if you don't then the first time DMA_FRAME is called the mode switch is done automatically). When you close the file handle the user DMA mode is exited again. While in one mode, you cannot use another mode (EBUSY is returned). All this means that if you want to change the YUV interlacing for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME with y_source == NULL before you can set the correct format using VIDIOC_S_FMT. Eventually all this should be replaced with a proper V4L2 API, but for now we have to do it this way. */ struct ivtv_dma_frame { enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */ __u32 pixelformat; /* 0 == same as destination */ void *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT, then just switch to user DMA YUV output mode */ void *uv_source; /* Unused for RGB pixelformats */ struct v4l2_rect src; struct v4l2_rect dst; __u32 src_width; __u32 src_height; }; #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) /* Select the passthrough mode (if the argument is non-zero). In the passthrough mode the output of the encoder is passed immediately into the decoder. */ #define IVTV_IOC_PASSTHROUGH_MODE _IOW ('V', BASE_VIDIOC_PRIVATE+1, int) /* Deprecated defines: applications should use the defines from videodev2.h */ #define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B #define IVTV_SLICED_TYPE_CAPTION_525 V4L2_MPEG_VBI_IVTV_CAPTION_525 #define IVTV_SLICED_TYPE_WSS_625 V4L2_MPEG_VBI_IVTV_WSS_625 #define IVTV_SLICED_TYPE_VPS V4L2_MPEG_VBI_IVTV_VPS #endif /* _LINUX_IVTV_H */ linux/ivtvfb.h 0000644 00000002267 15063602051 0007361 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* On Screen Display cx23415 Framebuffer driver Copyright (C) 2006, 2007 Ian Armstrong <ian@iarmst.demon.co.uk> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_IVTVFB_H__ #define __LINUX_IVTVFB_H__ #include <linux/types.h> /* Framebuffer external API */ struct ivtvfb_dma_frame { void *source; unsigned long dest_offset; int count; }; #define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) #endif linux/isdn/capicmd.h 0000644 00000011166 15063602051 0010414 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: capicmd.h,v 1.2.6.2 2001/09/23 22:24:33 kai Exp $ * * CAPI 2.0 Interface for Linux * * Copyright 1997 by Carsten Paeth <calle@calle.de> * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __CAPICMD_H__ #define __CAPICMD_H__ #define CAPI_MSG_BASELEN 8 #define CAPI_DATA_B3_REQ_LEN (CAPI_MSG_BASELEN+4+4+2+2+2) #define CAPI_DATA_B3_RESP_LEN (CAPI_MSG_BASELEN+4+2) /*----- CAPI commands -----*/ #define CAPI_ALERT 0x01 #define CAPI_CONNECT 0x02 #define CAPI_CONNECT_ACTIVE 0x03 #define CAPI_CONNECT_B3_ACTIVE 0x83 #define CAPI_CONNECT_B3 0x82 #define CAPI_CONNECT_B3_T90_ACTIVE 0x88 #define CAPI_DATA_B3 0x86 #define CAPI_DISCONNECT_B3 0x84 #define CAPI_DISCONNECT 0x04 #define CAPI_FACILITY 0x80 #define CAPI_INFO 0x08 #define CAPI_LISTEN 0x05 #define CAPI_MANUFACTURER 0xff #define CAPI_RESET_B3 0x87 #define CAPI_SELECT_B_PROTOCOL 0x41 /*----- CAPI subcommands -----*/ #define CAPI_REQ 0x80 #define CAPI_CONF 0x81 #define CAPI_IND 0x82 #define CAPI_RESP 0x83 /*----- CAPI combined commands -----*/ #define CAPICMD(cmd,subcmd) (((cmd)<<8)|(subcmd)) #define CAPI_DISCONNECT_REQ CAPICMD(CAPI_DISCONNECT,CAPI_REQ) #define CAPI_DISCONNECT_CONF CAPICMD(CAPI_DISCONNECT,CAPI_CONF) #define CAPI_DISCONNECT_IND CAPICMD(CAPI_DISCONNECT,CAPI_IND) #define CAPI_DISCONNECT_RESP CAPICMD(CAPI_DISCONNECT,CAPI_RESP) #define CAPI_ALERT_REQ CAPICMD(CAPI_ALERT,CAPI_REQ) #define CAPI_ALERT_CONF CAPICMD(CAPI_ALERT,CAPI_CONF) #define CAPI_CONNECT_REQ CAPICMD(CAPI_CONNECT,CAPI_REQ) #define CAPI_CONNECT_CONF CAPICMD(CAPI_CONNECT,CAPI_CONF) #define CAPI_CONNECT_IND CAPICMD(CAPI_CONNECT,CAPI_IND) #define CAPI_CONNECT_RESP CAPICMD(CAPI_CONNECT,CAPI_RESP) #define CAPI_CONNECT_ACTIVE_REQ CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_REQ) #define CAPI_CONNECT_ACTIVE_CONF CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_CONF) #define CAPI_CONNECT_ACTIVE_IND CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_IND) #define CAPI_CONNECT_ACTIVE_RESP CAPICMD(CAPI_CONNECT_ACTIVE,CAPI_RESP) #define CAPI_SELECT_B_PROTOCOL_REQ CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_REQ) #define CAPI_SELECT_B_PROTOCOL_CONF CAPICMD(CAPI_SELECT_B_PROTOCOL,CAPI_CONF) #define CAPI_CONNECT_B3_ACTIVE_REQ CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_REQ) #define CAPI_CONNECT_B3_ACTIVE_CONF CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_CONF) #define CAPI_CONNECT_B3_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_IND) #define CAPI_CONNECT_B3_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_ACTIVE,CAPI_RESP) #define CAPI_CONNECT_B3_REQ CAPICMD(CAPI_CONNECT_B3,CAPI_REQ) #define CAPI_CONNECT_B3_CONF CAPICMD(CAPI_CONNECT_B3,CAPI_CONF) #define CAPI_CONNECT_B3_IND CAPICMD(CAPI_CONNECT_B3,CAPI_IND) #define CAPI_CONNECT_B3_RESP CAPICMD(CAPI_CONNECT_B3,CAPI_RESP) #define CAPI_CONNECT_B3_T90_ACTIVE_IND CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_IND) #define CAPI_CONNECT_B3_T90_ACTIVE_RESP CAPICMD(CAPI_CONNECT_B3_T90_ACTIVE,CAPI_RESP) #define CAPI_DATA_B3_REQ CAPICMD(CAPI_DATA_B3,CAPI_REQ) #define CAPI_DATA_B3_CONF CAPICMD(CAPI_DATA_B3,CAPI_CONF) #define CAPI_DATA_B3_IND CAPICMD(CAPI_DATA_B3,CAPI_IND) #define CAPI_DATA_B3_RESP CAPICMD(CAPI_DATA_B3,CAPI_RESP) #define CAPI_DISCONNECT_B3_REQ CAPICMD(CAPI_DISCONNECT_B3,CAPI_REQ) #define CAPI_DISCONNECT_B3_CONF CAPICMD(CAPI_DISCONNECT_B3,CAPI_CONF) #define CAPI_DISCONNECT_B3_IND CAPICMD(CAPI_DISCONNECT_B3,CAPI_IND) #define CAPI_DISCONNECT_B3_RESP CAPICMD(CAPI_DISCONNECT_B3,CAPI_RESP) #define CAPI_RESET_B3_REQ CAPICMD(CAPI_RESET_B3,CAPI_REQ) #define CAPI_RESET_B3_CONF CAPICMD(CAPI_RESET_B3,CAPI_CONF) #define CAPI_RESET_B3_IND CAPICMD(CAPI_RESET_B3,CAPI_IND) #define CAPI_RESET_B3_RESP CAPICMD(CAPI_RESET_B3,CAPI_RESP) #define CAPI_LISTEN_REQ CAPICMD(CAPI_LISTEN,CAPI_REQ) #define CAPI_LISTEN_CONF CAPICMD(CAPI_LISTEN,CAPI_CONF) #define CAPI_MANUFACTURER_REQ CAPICMD(CAPI_MANUFACTURER,CAPI_REQ) #define CAPI_MANUFACTURER_CONF CAPICMD(CAPI_MANUFACTURER,CAPI_CONF) #define CAPI_MANUFACTURER_IND CAPICMD(CAPI_MANUFACTURER,CAPI_IND) #define CAPI_MANUFACTURER_RESP CAPICMD(CAPI_MANUFACTURER,CAPI_RESP) #define CAPI_FACILITY_REQ CAPICMD(CAPI_FACILITY,CAPI_REQ) #define CAPI_FACILITY_CONF CAPICMD(CAPI_FACILITY,CAPI_CONF) #define CAPI_FACILITY_IND CAPICMD(CAPI_FACILITY,CAPI_IND) #define CAPI_FACILITY_RESP CAPICMD(CAPI_FACILITY,CAPI_RESP) #define CAPI_INFO_REQ CAPICMD(CAPI_INFO,CAPI_REQ) #define CAPI_INFO_CONF CAPICMD(CAPI_INFO,CAPI_CONF) #define CAPI_INFO_IND CAPICMD(CAPI_INFO,CAPI_IND) #define CAPI_INFO_RESP CAPICMD(CAPI_INFO,CAPI_RESP) #endif /* __CAPICMD_H__ */ linux/jffs2.h 0000644 00000015552 15063602051 0007074 0 ustar 00 /* * JFFS2 -- Journalling Flash File System, Version 2. * * Copyright © 2001-2007 Red Hat, Inc. * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org> * * Created by David Woodhouse <dwmw2@infradead.org> * * For licensing information, see the file 'LICENCE' in the * jffs2 directory. */ #ifndef __LINUX_JFFS2_H__ #define __LINUX_JFFS2_H__ #include <linux/types.h> #include <linux/magic.h> /* You must include something which defines the C99 uintXX_t types. We don't do it from here because this file is used in too many different environments. */ /* Values we may expect to find in the 'magic' field */ #define JFFS2_OLD_MAGIC_BITMASK 0x1984 #define JFFS2_MAGIC_BITMASK 0x1985 #define KSAMTIB_CIGAM_2SFFJ 0x8519 /* For detecting wrong-endian fs */ #define JFFS2_EMPTY_BITMASK 0xffff #define JFFS2_DIRTY_BITMASK 0x0000 /* Summary node MAGIC marker */ #define JFFS2_SUM_MAGIC 0x02851885 /* We only allow a single char for length, and 0xFF is empty flash so we don't want it confused with a real length. Hence max 254. */ #define JFFS2_MAX_NAME_LEN 254 /* How small can we sensibly write nodes? */ #define JFFS2_MIN_DATA_LEN 128 #define JFFS2_COMPR_NONE 0x00 #define JFFS2_COMPR_ZERO 0x01 #define JFFS2_COMPR_RTIME 0x02 #define JFFS2_COMPR_RUBINMIPS 0x03 #define JFFS2_COMPR_COPY 0x04 #define JFFS2_COMPR_DYNRUBIN 0x05 #define JFFS2_COMPR_ZLIB 0x06 #define JFFS2_COMPR_LZO 0x07 /* Compatibility flags. */ #define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ #define JFFS2_NODE_ACCURATE 0x2000 /* INCOMPAT: Fail to mount the filesystem */ #define JFFS2_FEATURE_INCOMPAT 0xc000 /* ROCOMPAT: Mount read-only */ #define JFFS2_FEATURE_ROCOMPAT 0x8000 /* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */ #define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000 /* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */ #define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 #define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1) #define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2) #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) #define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) #define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6) #define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8) #define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9) /* XATTR Related */ #define JFFS2_XPREFIX_USER 1 /* for "user." */ #define JFFS2_XPREFIX_SECURITY 2 /* for "security." */ #define JFFS2_XPREFIX_ACL_ACCESS 3 /* for "system.posix_acl_access" */ #define JFFS2_XPREFIX_ACL_DEFAULT 4 /* for "system.posix_acl_default" */ #define JFFS2_XPREFIX_TRUSTED 5 /* for "trusted.*" */ #define JFFS2_ACL_VERSION 0x0001 // Maybe later... //#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) //#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) #define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at mount time, don't wait for it to happen later */ #define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific compression type */ /* These can go once we've made sure we've caught all uses without byteswapping */ typedef struct { __u32 v32; } __attribute__((packed)) jint32_t; typedef struct { __u32 m; } __attribute__((packed)) jmode_t; typedef struct { __u16 v16; } __attribute__((packed)) jint16_t; struct jffs2_unknown_node { /* All start like this */ jint16_t magic; jint16_t nodetype; jint32_t totlen; /* So we can skip over nodes we don't grok */ jint32_t hdr_crc; }; struct jffs2_raw_dirent { jint16_t magic; jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ jint32_t totlen; jint32_t hdr_crc; jint32_t pino; jint32_t version; jint32_t ino; /* == zero for unlink */ jint32_t mctime; __u8 nsize; __u8 type; __u8 unused[2]; jint32_t node_crc; jint32_t name_crc; __u8 name[0]; }; /* The JFFS2 raw inode structure: Used for storage on physical media. */ /* The uid, gid, atime, mtime and ctime members could be longer, but are left like this for space efficiency. If and when people decide they really need them extended, it's simple enough to add support for a new type of raw node. */ struct jffs2_raw_inode { jint16_t magic; /* A constant magic number. */ jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ jint32_t totlen; /* Total length of this node (inc data, etc.) */ jint32_t hdr_crc; jint32_t ino; /* Inode number. */ jint32_t version; /* Version number. */ jmode_t mode; /* The file's type or mode. */ jint16_t uid; /* The file's owner. */ jint16_t gid; /* The file's group. */ jint32_t isize; /* Total resultant size of this inode (used for truncations) */ jint32_t atime; /* Last access time. */ jint32_t mtime; /* Last modification time. */ jint32_t ctime; /* Change time. */ jint32_t offset; /* Where to begin to write. */ jint32_t csize; /* (Compressed) data size */ jint32_t dsize; /* Size of the node's data. (after decompression) */ __u8 compr; /* Compression algorithm used */ __u8 usercompr; /* Compression algorithm requested by the user */ jint16_t flags; /* See JFFS2_INO_FLAG_* */ jint32_t data_crc; /* CRC for the (compressed) data. */ jint32_t node_crc; /* CRC for the raw inode (excluding data) */ __u8 data[0]; }; struct jffs2_raw_xattr { jint16_t magic; jint16_t nodetype; /* = JFFS2_NODETYPE_XATTR */ jint32_t totlen; jint32_t hdr_crc; jint32_t xid; /* XATTR identifier number */ jint32_t version; __u8 xprefix; __u8 name_len; jint16_t value_len; jint32_t data_crc; jint32_t node_crc; __u8 data[0]; } __attribute__((packed)); struct jffs2_raw_xref { jint16_t magic; jint16_t nodetype; /* = JFFS2_NODETYPE_XREF */ jint32_t totlen; jint32_t hdr_crc; jint32_t ino; /* inode number */ jint32_t xid; /* XATTR identifier number */ jint32_t xseqno; /* xref sequential number */ jint32_t node_crc; } __attribute__((packed)); struct jffs2_raw_summary { jint16_t magic; jint16_t nodetype; /* = JFFS2_NODETYPE_SUMMARY */ jint32_t totlen; jint32_t hdr_crc; jint32_t sum_num; /* number of sum entries*/ jint32_t cln_mkr; /* clean marker size, 0 = no cleanmarker */ jint32_t padded; /* sum of the size of padding nodes */ jint32_t sum_crc; /* summary information crc */ jint32_t node_crc; /* node crc */ jint32_t sum[0]; /* inode summary info */ }; union jffs2_node_union { struct jffs2_raw_inode i; struct jffs2_raw_dirent d; struct jffs2_raw_xattr x; struct jffs2_raw_xref r; struct jffs2_raw_summary s; struct jffs2_unknown_node u; }; /* Data payload for device nodes. */ union jffs2_device_node { jint16_t old_id; jint32_t new_id; }; #endif /* __LINUX_JFFS2_H__ */ linux/joystick.h 0000644 00000006552 15063602051 0007721 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 1996-2000 Vojtech Pavlik * * Sponsored by SuSE */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LINUX_JOYSTICK_H #define _LINUX_JOYSTICK_H #include <linux/types.h> #include <linux/input.h> /* * Version */ #define JS_VERSION 0x020100 /* * Types and constants for reading from /dev/js */ #define JS_EVENT_BUTTON 0x01 /* button pressed/released */ #define JS_EVENT_AXIS 0x02 /* joystick moved */ #define JS_EVENT_INIT 0x80 /* initial state of device */ struct js_event { __u32 time; /* event timestamp in milliseconds */ __s16 value; /* value */ __u8 type; /* event type */ __u8 number; /* axis/button number */ }; /* * IOCTL commands for joystick driver */ #define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */ #define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */ #define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */ #define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ #define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ #define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ #define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */ #define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */ #define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ #define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ /* * Types and constants for get/set correction */ #define JS_CORR_NONE 0x00 /* returns raw values */ #define JS_CORR_BROKEN 0x01 /* broken line */ struct js_corr { __s32 coef[8]; __s16 prec; __u16 type; }; /* * v0.x compatibility definitions */ #define JS_RETURN sizeof(struct JS_DATA_TYPE) #define JS_TRUE 1 #define JS_FALSE 0 #define JS_X_0 0x01 #define JS_Y_0 0x02 #define JS_X_1 0x04 #define JS_Y_1 0x08 #define JS_MAX 2 #define JS_DEF_TIMEOUT 0x1300 #define JS_DEF_CORR 0 #define JS_DEF_TIMELIMIT 10L #define JS_SET_CAL 1 #define JS_GET_CAL 2 #define JS_SET_TIMEOUT 3 #define JS_GET_TIMEOUT 4 #define JS_SET_TIMELIMIT 5 #define JS_GET_TIMELIMIT 6 #define JS_GET_ALL 7 #define JS_SET_ALL 8 struct JS_DATA_TYPE { __s32 buttons; __s32 x; __s32 y; }; struct JS_DATA_SAVE_TYPE_32 { __s32 JS_TIMEOUT; __s32 BUSY; __s32 JS_EXPIRETIME; __s32 JS_TIMELIMIT; struct JS_DATA_TYPE JS_SAVE; struct JS_DATA_TYPE JS_CORR; }; struct JS_DATA_SAVE_TYPE_64 { __s32 JS_TIMEOUT; __s32 BUSY; __s64 JS_EXPIRETIME; __s64 JS_TIMELIMIT; struct JS_DATA_TYPE JS_SAVE; struct JS_DATA_TYPE JS_CORR; }; #endif /* _LINUX_JOYSTICK_H */ linux/kcm.h 0000644 00000001466 15063602051 0006633 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Kernel Connection Multiplexor * * Copyright (c) 2016 Tom Herbert <tom@herbertland.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * User API to clone KCM sockets and attach transport socket to a KCM * multiplexor. */ #ifndef KCM_KERNEL_H #define KCM_KERNEL_H struct kcm_attach { int fd; int bpf_fd; }; struct kcm_unattach { int fd; }; struct kcm_clone { int fd; }; #define SIOCKCMATTACH (SIOCPROTOPRIVATE + 0) #define SIOCKCMUNATTACH (SIOCPROTOPRIVATE + 1) #define SIOCKCMCLONE (SIOCPROTOPRIVATE + 2) #define KCMPROTO_CONNECTED 0 /* Socket options */ #define KCM_RECV_DISABLE 1 #endif linux/kcmp.h 0000644 00000001012 15063602051 0006776 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KCMP_H #define _LINUX_KCMP_H #include <linux/types.h> /* Comparison type */ enum kcmp_type { KCMP_FILE, KCMP_VM, KCMP_FILES, KCMP_FS, KCMP_SIGHAND, KCMP_IO, KCMP_SYSVSEM, KCMP_EPOLL_TFD, KCMP_TYPES, }; /* Slot for KCMP_EPOLL_TFD */ struct kcmp_epoll_slot { __u32 efd; /* epoll file descriptor */ __u32 tfd; /* target file number */ __u32 toff; /* target offset within same numbered sequence */ }; #endif /* _LINUX_KCMP_H */ linux/kcov.h 0000644 00000002113 15063602051 0007011 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KCOV_IOCTLS_H #define _LINUX_KCOV_IOCTLS_H #include <linux/types.h> #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) #define KCOV_ENABLE _IO('c', 100) #define KCOV_DISABLE _IO('c', 101) enum { /* * Tracing coverage collection mode. * Covered PCs are collected in a per-task buffer. * In new KCOV version the mode is chosen by calling * ioctl(fd, KCOV_ENABLE, mode). In older versions the mode argument * was supposed to be 0 in such a call. So, for reasons of backward * compatibility, we have chosen the value KCOV_TRACE_PC to be 0. */ KCOV_TRACE_PC = 0, /* Collecting comparison operands mode. */ KCOV_TRACE_CMP = 1, }; /* * The format for the types of collected comparisons. * * Bit 0 shows whether one of the arguments is a compile-time constant. * Bits 1 & 2 contain log2 of the argument size, up to 8 bytes. */ #define KCOV_CMP_CONST (1 << 0) #define KCOV_CMP_SIZE(n) ((n) << 1) #define KCOV_CMP_MASK KCOV_CMP_SIZE(3) #endif /* _LINUX_KCOV_IOCTLS_H */ linux/kd.h 0000644 00000014155 15063602051 0006456 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KD_H #define _LINUX_KD_H #include <linux/types.h> /* 0x4B is 'K', to avoid collision with termios and vt */ #define GIO_FONT 0x4B60 /* gets font in expanded form */ #define PIO_FONT 0x4B61 /* use font in expanded form */ #define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */ #define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */ struct consolefontdesc { unsigned short charcount; /* characters in font (256 or 512) */ unsigned short charheight; /* scan lines per character (1-32) */ char *chardata; /* font data in expanded form */ }; #define PIO_FONTRESET 0x4B6D /* reset to default font */ #define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */ #define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */ #define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ #define KDMKTONE 0x4B30 /* generate tone */ #define KDGETLED 0x4B31 /* return current led state */ #define KDSETLED 0x4B32 /* set led state [lights, not flags] */ #define LED_SCR 0x01 /* scroll lock led */ #define LED_NUM 0x02 /* num lock led */ #define LED_CAP 0x04 /* caps lock led */ #define KDGKBTYPE 0x4B33 /* get keyboard type */ #define KB_84 0x01 #define KB_101 0x02 /* this is what we always answer */ #define KB_OTHER 0x03 #define KDADDIO 0x4B34 /* add i/o port as valid */ #define KDDELIO 0x4B35 /* del i/o port as valid */ #define KDENABIO 0x4B36 /* enable i/o to video board */ #define KDDISABIO 0x4B37 /* disable i/o to video board */ #define KDSETMODE 0x4B3A /* set text/graphics mode */ #define KD_TEXT 0x00 #define KD_GRAPHICS 0x01 #define KD_TEXT0 0x02 /* obsolete */ #define KD_TEXT1 0x03 /* obsolete */ #define KDGETMODE 0x4B3B /* get current mode */ #define KDMAPDISP 0x4B3C /* map display into address space */ #define KDUNMAPDISP 0x4B3D /* unmap display from address space */ typedef char scrnmap_t; #define E_TABSZ 256 #define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */ #define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */ #define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */ #define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */ #define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */ struct unipair { unsigned short unicode; unsigned short fontpos; }; struct unimapdesc { unsigned short entry_ct; struct unipair *entries; }; #define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ #define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ struct unimapinit { unsigned short advised_hashsize; /* 0 if no opinion */ unsigned short advised_hashstep; /* 0 if no opinion */ unsigned short advised_hashlevel; /* 0 if no opinion */ }; #define UNI_DIRECT_BASE 0xF000 /* start of Direct Font Region */ #define UNI_DIRECT_MASK 0x01FF /* Direct Font Region bitmask */ #define K_RAW 0x00 #define K_XLATE 0x01 #define K_MEDIUMRAW 0x02 #define K_UNICODE 0x03 #define K_OFF 0x04 #define KDGKBMODE 0x4B44 /* gets current keyboard mode */ #define KDSKBMODE 0x4B45 /* sets current keyboard mode */ #define K_METABIT 0x03 #define K_ESCPREFIX 0x04 #define KDGKBMETA 0x4B62 /* gets meta key handling mode */ #define KDSKBMETA 0x4B63 /* sets meta key handling mode */ #define K_SCROLLLOCK 0x01 #define K_NUMLOCK 0x02 #define K_CAPSLOCK 0x04 #define KDGKBLED 0x4B64 /* get led flags (not lights) */ #define KDSKBLED 0x4B65 /* set led flags (not lights) */ struct kbentry { unsigned char kb_table; unsigned char kb_index; unsigned short kb_value; }; #define K_NORMTAB 0x00 #define K_SHIFTTAB 0x01 #define K_ALTTAB 0x02 #define K_ALTSHIFTTAB 0x03 #define KDGKBENT 0x4B46 /* gets one entry in translation table */ #define KDSKBENT 0x4B47 /* sets one entry in translation table */ struct kbsentry { unsigned char kb_func; unsigned char kb_string[512]; }; #define KDGKBSENT 0x4B48 /* gets one function key string entry */ #define KDSKBSENT 0x4B49 /* sets one function key string entry */ struct kbdiacr { unsigned char diacr, base, result; }; struct kbdiacrs { unsigned int kb_cnt; /* number of entries in following array */ struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */ }; #define KDGKBDIACR 0x4B4A /* read kernel accent table */ #define KDSKBDIACR 0x4B4B /* write kernel accent table */ struct kbdiacruc { unsigned int diacr, base, result; }; struct kbdiacrsuc { unsigned int kb_cnt; /* number of entries in following array */ struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */ }; #define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */ #define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */ struct kbkeycode { unsigned int scancode, keycode; }; #define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */ #define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ #define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */ struct kbd_repeat { int delay; /* in msec; <= 0: don't change */ int period; /* in msec; <= 0: don't change */ /* earlier this field was misnamed "rate" */ }; #define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate; * actually used values are returned */ #define KDFONTOP 0x4B72 /* font operations */ struct console_font_op { unsigned int op; /* operation code KD_FONT_OP_* */ unsigned int flags; /* KD_FONT_FLAG_* */ unsigned int width, height; /* font size */ unsigned int charcount; unsigned char *data; /* font data with height fixed to 32 */ }; struct console_font { unsigned int width, height; /* font size */ unsigned int charcount; unsigned char *data; /* font data with height fixed to 32 */ }; #define KD_FONT_OP_SET 0 /* Set font */ #define KD_FONT_OP_GET 1 /* Get font */ #define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */ #define KD_FONT_OP_COPY 3 /* Copy from another console */ #define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size [compat] */ /* note: 0x4B00-0x4B4E all have had a value at some time; don't reuse for the time being */ /* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */ #endif /* _LINUX_KD_H */ linux/kdev_t.h 0000644 00000000577 15063602051 0007337 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KDEV_T_H #define _LINUX_KDEV_T_H /* Some programs want their definitions of MAJOR and MINOR and MKDEV from the kernel sources. These must be the externally visible ones. */ #define MAJOR(dev) ((dev)>>8) #define MINOR(dev) ((dev) & 0xff) #define MKDEV(ma,mi) ((ma)<<8 | (mi)) #endif /* _LINUX_KDEV_T_H */ linux/kernel-page-flags.h 0000644 00000001604 15063602051 0011337 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef LINUX_KERNEL_PAGE_FLAGS_H #define LINUX_KERNEL_PAGE_FLAGS_H /* * Stable page flag bits exported to user space */ #define KPF_LOCKED 0 #define KPF_ERROR 1 #define KPF_REFERENCED 2 #define KPF_UPTODATE 3 #define KPF_DIRTY 4 #define KPF_LRU 5 #define KPF_ACTIVE 6 #define KPF_SLAB 7 #define KPF_WRITEBACK 8 #define KPF_RECLAIM 9 #define KPF_BUDDY 10 /* 11-20: new additions in 2.6.31 */ #define KPF_MMAP 11 #define KPF_ANON 12 #define KPF_SWAPCACHE 13 #define KPF_SWAPBACKED 14 #define KPF_COMPOUND_HEAD 15 #define KPF_COMPOUND_TAIL 16 #define KPF_HUGE 17 #define KPF_UNEVICTABLE 18 #define KPF_HWPOISON 19 #define KPF_NOPAGE 20 #define KPF_KSM 21 #define KPF_THP 22 #define KPF_OFFLINE 23 #define KPF_ZERO_PAGE 24 #define KPF_IDLE 25 #define KPF_PGTABLE 26 #endif /* LINUX_KERNEL_PAGE_FLAGS_H */ linux/kernel.h 0000644 00000000666 15063602051 0007342 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_KERNEL_H #define _LINUX_KERNEL_H #include <linux/sysinfo.h> /* * 'kernel.h' contains some often-used function prototypes etc */ #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #endif /* _LINUX_KERNEL_H */ linux/kernelcapi.h 0000644 00000001773 15063602051 0010177 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $ * * Kernel CAPI 2.0 Interface for Linux * * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) * */ #ifndef __KERNELCAPI_H__ #define __KERNELCAPI_H__ #define CAPI_MAXAPPL 240 /* maximum number of applications */ #define CAPI_MAXCONTR 32 /* maximum number of controller */ #define CAPI_MAXDATAWINDOW 8 typedef struct kcapi_flagdef { int contr; int flag; } kcapi_flagdef; typedef struct kcapi_carddef { char driver[32]; unsigned int port; unsigned irq; unsigned int membase; int cardnr; } kcapi_carddef; /* new ioctls >= 10 */ #define KCAPI_CMD_TRACE 10 #define KCAPI_CMD_ADDCARD 11 /* OBSOLETE */ /* * flag > 2 => trace also data * flag & 1 => show trace */ #define KCAPI_TRACE_OFF 0 #define KCAPI_TRACE_SHORT_NO_DATA 1 #define KCAPI_TRACE_FULL_NO_DATA 2 #define KCAPI_TRACE_SHORT 3 #define KCAPI_TRACE_FULL 4 #endif /* __KERNELCAPI_H__ */ linux/kexec.h 0000644 00000003453 15063602051 0007156 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef LINUX_KEXEC_H #define LINUX_KEXEC_H /* kexec system call - It loads the new kernel to boot into. * kexec does not sync, or unmount filesystems so if you need * that to happen you need to do that yourself. */ #include <linux/types.h> /* kexec flags for different usage scenarios */ #define KEXEC_ON_CRASH 0x00000001 #define KEXEC_PRESERVE_CONTEXT 0x00000002 #define KEXEC_ARCH_MASK 0xffff0000 /* * Kexec file load interface flags. * KEXEC_FILE_UNLOAD : Unload already loaded kexec/kdump image. * KEXEC_FILE_ON_CRASH : Load/unload operation belongs to kdump image. * KEXEC_FILE_NO_INITRAMFS : No initramfs is being loaded. Ignore the initrd * fd field. */ #define KEXEC_FILE_UNLOAD 0x00000001 #define KEXEC_FILE_ON_CRASH 0x00000002 #define KEXEC_FILE_NO_INITRAMFS 0x00000004 /* These values match the ELF architecture values. * Unless there is a good reason that should continue to be the case. */ #define KEXEC_ARCH_DEFAULT ( 0 << 16) #define KEXEC_ARCH_386 ( 3 << 16) #define KEXEC_ARCH_68K ( 4 << 16) #define KEXEC_ARCH_X86_64 (62 << 16) #define KEXEC_ARCH_PPC (20 << 16) #define KEXEC_ARCH_PPC64 (21 << 16) #define KEXEC_ARCH_IA_64 (50 << 16) #define KEXEC_ARCH_ARM (40 << 16) #define KEXEC_ARCH_S390 (22 << 16) #define KEXEC_ARCH_SH (42 << 16) #define KEXEC_ARCH_MIPS_LE (10 << 16) #define KEXEC_ARCH_MIPS ( 8 << 16) #define KEXEC_ARCH_AARCH64 (183 << 16) /* The artificial cap on the number of segments passed to kexec_load. */ #define KEXEC_SEGMENT_MAX 16 /* * This structure is used to hold the arguments that are used when * loading kernel binaries. */ struct kexec_segment { const void *buf; size_t bufsz; const void *mem; size_t memsz; }; #endif /* LINUX_KEXEC_H */ linux/keyboard.h 0000644 00000030757 15063602051 0007666 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KEYBOARD_H #define __LINUX_KEYBOARD_H #include <linux/wait.h> #define KG_SHIFT 0 #define KG_CTRL 2 #define KG_ALT 3 #define KG_ALTGR 1 #define KG_SHIFTL 4 #define KG_KANASHIFT 4 #define KG_SHIFTR 5 #define KG_CTRLL 6 #define KG_CTRLR 7 #define KG_CAPSSHIFT 8 #define NR_SHIFT 9 #define NR_KEYS 256 #define MAX_NR_KEYMAPS 256 /* This means 128Kb if all keymaps are allocated. Only the superuser may increase the number of keymaps beyond MAX_NR_OF_USER_KEYMAPS. */ #define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */ #define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */ #define KT_LATIN 0 /* we depend on this being zero */ #define KT_LETTER 11 /* symbol that can be acted upon by CapsLock */ #define KT_FN 1 #define KT_SPEC 2 #define KT_PAD 3 #define KT_DEAD 4 #define KT_CONS 5 #define KT_CUR 6 #define KT_SHIFT 7 #define KT_META 8 #define KT_ASCII 9 #define KT_LOCK 10 #define KT_SLOCK 12 #define KT_DEAD2 13 #define KT_BRL 14 #define K(t,v) (((t)<<8)|(v)) #define KTYP(x) ((x) >> 8) #define KVAL(x) ((x) & 0xff) #define K_F1 K(KT_FN,0) #define K_F2 K(KT_FN,1) #define K_F3 K(KT_FN,2) #define K_F4 K(KT_FN,3) #define K_F5 K(KT_FN,4) #define K_F6 K(KT_FN,5) #define K_F7 K(KT_FN,6) #define K_F8 K(KT_FN,7) #define K_F9 K(KT_FN,8) #define K_F10 K(KT_FN,9) #define K_F11 K(KT_FN,10) #define K_F12 K(KT_FN,11) #define K_F13 K(KT_FN,12) #define K_F14 K(KT_FN,13) #define K_F15 K(KT_FN,14) #define K_F16 K(KT_FN,15) #define K_F17 K(KT_FN,16) #define K_F18 K(KT_FN,17) #define K_F19 K(KT_FN,18) #define K_F20 K(KT_FN,19) #define K_FIND K(KT_FN,20) #define K_INSERT K(KT_FN,21) #define K_REMOVE K(KT_FN,22) #define K_SELECT K(KT_FN,23) #define K_PGUP K(KT_FN,24) /* PGUP is a synonym for PRIOR */ #define K_PGDN K(KT_FN,25) /* PGDN is a synonym for NEXT */ #define K_MACRO K(KT_FN,26) #define K_HELP K(KT_FN,27) #define K_DO K(KT_FN,28) #define K_PAUSE K(KT_FN,29) #define K_F21 K(KT_FN,30) #define K_F22 K(KT_FN,31) #define K_F23 K(KT_FN,32) #define K_F24 K(KT_FN,33) #define K_F25 K(KT_FN,34) #define K_F26 K(KT_FN,35) #define K_F27 K(KT_FN,36) #define K_F28 K(KT_FN,37) #define K_F29 K(KT_FN,38) #define K_F30 K(KT_FN,39) #define K_F31 K(KT_FN,40) #define K_F32 K(KT_FN,41) #define K_F33 K(KT_FN,42) #define K_F34 K(KT_FN,43) #define K_F35 K(KT_FN,44) #define K_F36 K(KT_FN,45) #define K_F37 K(KT_FN,46) #define K_F38 K(KT_FN,47) #define K_F39 K(KT_FN,48) #define K_F40 K(KT_FN,49) #define K_F41 K(KT_FN,50) #define K_F42 K(KT_FN,51) #define K_F43 K(KT_FN,52) #define K_F44 K(KT_FN,53) #define K_F45 K(KT_FN,54) #define K_F46 K(KT_FN,55) #define K_F47 K(KT_FN,56) #define K_F48 K(KT_FN,57) #define K_F49 K(KT_FN,58) #define K_F50 K(KT_FN,59) #define K_F51 K(KT_FN,60) #define K_F52 K(KT_FN,61) #define K_F53 K(KT_FN,62) #define K_F54 K(KT_FN,63) #define K_F55 K(KT_FN,64) #define K_F56 K(KT_FN,65) #define K_F57 K(KT_FN,66) #define K_F58 K(KT_FN,67) #define K_F59 K(KT_FN,68) #define K_F60 K(KT_FN,69) #define K_F61 K(KT_FN,70) #define K_F62 K(KT_FN,71) #define K_F63 K(KT_FN,72) #define K_F64 K(KT_FN,73) #define K_F65 K(KT_FN,74) #define K_F66 K(KT_FN,75) #define K_F67 K(KT_FN,76) #define K_F68 K(KT_FN,77) #define K_F69 K(KT_FN,78) #define K_F70 K(KT_FN,79) #define K_F71 K(KT_FN,80) #define K_F72 K(KT_FN,81) #define K_F73 K(KT_FN,82) #define K_F74 K(KT_FN,83) #define K_F75 K(KT_FN,84) #define K_F76 K(KT_FN,85) #define K_F77 K(KT_FN,86) #define K_F78 K(KT_FN,87) #define K_F79 K(KT_FN,88) #define K_F80 K(KT_FN,89) #define K_F81 K(KT_FN,90) #define K_F82 K(KT_FN,91) #define K_F83 K(KT_FN,92) #define K_F84 K(KT_FN,93) #define K_F85 K(KT_FN,94) #define K_F86 K(KT_FN,95) #define K_F87 K(KT_FN,96) #define K_F88 K(KT_FN,97) #define K_F89 K(KT_FN,98) #define K_F90 K(KT_FN,99) #define K_F91 K(KT_FN,100) #define K_F92 K(KT_FN,101) #define K_F93 K(KT_FN,102) #define K_F94 K(KT_FN,103) #define K_F95 K(KT_FN,104) #define K_F96 K(KT_FN,105) #define K_F97 K(KT_FN,106) #define K_F98 K(KT_FN,107) #define K_F99 K(KT_FN,108) #define K_F100 K(KT_FN,109) #define K_F101 K(KT_FN,110) #define K_F102 K(KT_FN,111) #define K_F103 K(KT_FN,112) #define K_F104 K(KT_FN,113) #define K_F105 K(KT_FN,114) #define K_F106 K(KT_FN,115) #define K_F107 K(KT_FN,116) #define K_F108 K(KT_FN,117) #define K_F109 K(KT_FN,118) #define K_F110 K(KT_FN,119) #define K_F111 K(KT_FN,120) #define K_F112 K(KT_FN,121) #define K_F113 K(KT_FN,122) #define K_F114 K(KT_FN,123) #define K_F115 K(KT_FN,124) #define K_F116 K(KT_FN,125) #define K_F117 K(KT_FN,126) #define K_F118 K(KT_FN,127) #define K_F119 K(KT_FN,128) #define K_F120 K(KT_FN,129) #define K_F121 K(KT_FN,130) #define K_F122 K(KT_FN,131) #define K_F123 K(KT_FN,132) #define K_F124 K(KT_FN,133) #define K_F125 K(KT_FN,134) #define K_F126 K(KT_FN,135) #define K_F127 K(KT_FN,136) #define K_F128 K(KT_FN,137) #define K_F129 K(KT_FN,138) #define K_F130 K(KT_FN,139) #define K_F131 K(KT_FN,140) #define K_F132 K(KT_FN,141) #define K_F133 K(KT_FN,142) #define K_F134 K(KT_FN,143) #define K_F135 K(KT_FN,144) #define K_F136 K(KT_FN,145) #define K_F137 K(KT_FN,146) #define K_F138 K(KT_FN,147) #define K_F139 K(KT_FN,148) #define K_F140 K(KT_FN,149) #define K_F141 K(KT_FN,150) #define K_F142 K(KT_FN,151) #define K_F143 K(KT_FN,152) #define K_F144 K(KT_FN,153) #define K_F145 K(KT_FN,154) #define K_F146 K(KT_FN,155) #define K_F147 K(KT_FN,156) #define K_F148 K(KT_FN,157) #define K_F149 K(KT_FN,158) #define K_F150 K(KT_FN,159) #define K_F151 K(KT_FN,160) #define K_F152 K(KT_FN,161) #define K_F153 K(KT_FN,162) #define K_F154 K(KT_FN,163) #define K_F155 K(KT_FN,164) #define K_F156 K(KT_FN,165) #define K_F157 K(KT_FN,166) #define K_F158 K(KT_FN,167) #define K_F159 K(KT_FN,168) #define K_F160 K(KT_FN,169) #define K_F161 K(KT_FN,170) #define K_F162 K(KT_FN,171) #define K_F163 K(KT_FN,172) #define K_F164 K(KT_FN,173) #define K_F165 K(KT_FN,174) #define K_F166 K(KT_FN,175) #define K_F167 K(KT_FN,176) #define K_F168 K(KT_FN,177) #define K_F169 K(KT_FN,178) #define K_F170 K(KT_FN,179) #define K_F171 K(KT_FN,180) #define K_F172 K(KT_FN,181) #define K_F173 K(KT_FN,182) #define K_F174 K(KT_FN,183) #define K_F175 K(KT_FN,184) #define K_F176 K(KT_FN,185) #define K_F177 K(KT_FN,186) #define K_F178 K(KT_FN,187) #define K_F179 K(KT_FN,188) #define K_F180 K(KT_FN,189) #define K_F181 K(KT_FN,190) #define K_F182 K(KT_FN,191) #define K_F183 K(KT_FN,192) #define K_F184 K(KT_FN,193) #define K_F185 K(KT_FN,194) #define K_F186 K(KT_FN,195) #define K_F187 K(KT_FN,196) #define K_F188 K(KT_FN,197) #define K_F189 K(KT_FN,198) #define K_F190 K(KT_FN,199) #define K_F191 K(KT_FN,200) #define K_F192 K(KT_FN,201) #define K_F193 K(KT_FN,202) #define K_F194 K(KT_FN,203) #define K_F195 K(KT_FN,204) #define K_F196 K(KT_FN,205) #define K_F197 K(KT_FN,206) #define K_F198 K(KT_FN,207) #define K_F199 K(KT_FN,208) #define K_F200 K(KT_FN,209) #define K_F201 K(KT_FN,210) #define K_F202 K(KT_FN,211) #define K_F203 K(KT_FN,212) #define K_F204 K(KT_FN,213) #define K_F205 K(KT_FN,214) #define K_F206 K(KT_FN,215) #define K_F207 K(KT_FN,216) #define K_F208 K(KT_FN,217) #define K_F209 K(KT_FN,218) #define K_F210 K(KT_FN,219) #define K_F211 K(KT_FN,220) #define K_F212 K(KT_FN,221) #define K_F213 K(KT_FN,222) #define K_F214 K(KT_FN,223) #define K_F215 K(KT_FN,224) #define K_F216 K(KT_FN,225) #define K_F217 K(KT_FN,226) #define K_F218 K(KT_FN,227) #define K_F219 K(KT_FN,228) #define K_F220 K(KT_FN,229) #define K_F221 K(KT_FN,230) #define K_F222 K(KT_FN,231) #define K_F223 K(KT_FN,232) #define K_F224 K(KT_FN,233) #define K_F225 K(KT_FN,234) #define K_F226 K(KT_FN,235) #define K_F227 K(KT_FN,236) #define K_F228 K(KT_FN,237) #define K_F229 K(KT_FN,238) #define K_F230 K(KT_FN,239) #define K_F231 K(KT_FN,240) #define K_F232 K(KT_FN,241) #define K_F233 K(KT_FN,242) #define K_F234 K(KT_FN,243) #define K_F235 K(KT_FN,244) #define K_F236 K(KT_FN,245) #define K_F237 K(KT_FN,246) #define K_F238 K(KT_FN,247) #define K_F239 K(KT_FN,248) #define K_F240 K(KT_FN,249) #define K_F241 K(KT_FN,250) #define K_F242 K(KT_FN,251) #define K_F243 K(KT_FN,252) #define K_F244 K(KT_FN,253) #define K_F245 K(KT_FN,254) #define K_UNDO K(KT_FN,255) #define K_HOLE K(KT_SPEC,0) #define K_ENTER K(KT_SPEC,1) #define K_SH_REGS K(KT_SPEC,2) #define K_SH_MEM K(KT_SPEC,3) #define K_SH_STAT K(KT_SPEC,4) #define K_BREAK K(KT_SPEC,5) #define K_CONS K(KT_SPEC,6) #define K_CAPS K(KT_SPEC,7) #define K_NUM K(KT_SPEC,8) #define K_HOLD K(KT_SPEC,9) #define K_SCROLLFORW K(KT_SPEC,10) #define K_SCROLLBACK K(KT_SPEC,11) #define K_BOOT K(KT_SPEC,12) #define K_CAPSON K(KT_SPEC,13) #define K_COMPOSE K(KT_SPEC,14) #define K_SAK K(KT_SPEC,15) #define K_DECRCONSOLE K(KT_SPEC,16) #define K_INCRCONSOLE K(KT_SPEC,17) #define K_SPAWNCONSOLE K(KT_SPEC,18) #define K_BARENUMLOCK K(KT_SPEC,19) #define K_ALLOCATED K(KT_SPEC,126) /* dynamically allocated keymap */ #define K_NOSUCHMAP K(KT_SPEC,127) /* returned by KDGKBENT */ #define K_P0 K(KT_PAD,0) #define K_P1 K(KT_PAD,1) #define K_P2 K(KT_PAD,2) #define K_P3 K(KT_PAD,3) #define K_P4 K(KT_PAD,4) #define K_P5 K(KT_PAD,5) #define K_P6 K(KT_PAD,6) #define K_P7 K(KT_PAD,7) #define K_P8 K(KT_PAD,8) #define K_P9 K(KT_PAD,9) #define K_PPLUS K(KT_PAD,10) /* key-pad plus */ #define K_PMINUS K(KT_PAD,11) /* key-pad minus */ #define K_PSTAR K(KT_PAD,12) /* key-pad asterisk (star) */ #define K_PSLASH K(KT_PAD,13) /* key-pad slash */ #define K_PENTER K(KT_PAD,14) /* key-pad enter */ #define K_PCOMMA K(KT_PAD,15) /* key-pad comma: kludge... */ #define K_PDOT K(KT_PAD,16) /* key-pad dot (period): kludge... */ #define K_PPLUSMINUS K(KT_PAD,17) /* key-pad plus/minus */ #define K_PPARENL K(KT_PAD,18) /* key-pad left parenthesis */ #define K_PPARENR K(KT_PAD,19) /* key-pad right parenthesis */ #define NR_PAD 20 #define K_DGRAVE K(KT_DEAD,0) #define K_DACUTE K(KT_DEAD,1) #define K_DCIRCM K(KT_DEAD,2) #define K_DTILDE K(KT_DEAD,3) #define K_DDIERE K(KT_DEAD,4) #define K_DCEDIL K(KT_DEAD,5) #define NR_DEAD 6 #define K_DOWN K(KT_CUR,0) #define K_LEFT K(KT_CUR,1) #define K_RIGHT K(KT_CUR,2) #define K_UP K(KT_CUR,3) #define K_SHIFT K(KT_SHIFT,KG_SHIFT) #define K_CTRL K(KT_SHIFT,KG_CTRL) #define K_ALT K(KT_SHIFT,KG_ALT) #define K_ALTGR K(KT_SHIFT,KG_ALTGR) #define K_SHIFTL K(KT_SHIFT,KG_SHIFTL) #define K_SHIFTR K(KT_SHIFT,KG_SHIFTR) #define K_CTRLL K(KT_SHIFT,KG_CTRLL) #define K_CTRLR K(KT_SHIFT,KG_CTRLR) #define K_CAPSSHIFT K(KT_SHIFT,KG_CAPSSHIFT) #define K_ASC0 K(KT_ASCII,0) #define K_ASC1 K(KT_ASCII,1) #define K_ASC2 K(KT_ASCII,2) #define K_ASC3 K(KT_ASCII,3) #define K_ASC4 K(KT_ASCII,4) #define K_ASC5 K(KT_ASCII,5) #define K_ASC6 K(KT_ASCII,6) #define K_ASC7 K(KT_ASCII,7) #define K_ASC8 K(KT_ASCII,8) #define K_ASC9 K(KT_ASCII,9) #define K_HEX0 K(KT_ASCII,10) #define K_HEX1 K(KT_ASCII,11) #define K_HEX2 K(KT_ASCII,12) #define K_HEX3 K(KT_ASCII,13) #define K_HEX4 K(KT_ASCII,14) #define K_HEX5 K(KT_ASCII,15) #define K_HEX6 K(KT_ASCII,16) #define K_HEX7 K(KT_ASCII,17) #define K_HEX8 K(KT_ASCII,18) #define K_HEX9 K(KT_ASCII,19) #define K_HEXa K(KT_ASCII,20) #define K_HEXb K(KT_ASCII,21) #define K_HEXc K(KT_ASCII,22) #define K_HEXd K(KT_ASCII,23) #define K_HEXe K(KT_ASCII,24) #define K_HEXf K(KT_ASCII,25) #define NR_ASCII 26 #define K_SHIFTLOCK K(KT_LOCK,KG_SHIFT) #define K_CTRLLOCK K(KT_LOCK,KG_CTRL) #define K_ALTLOCK K(KT_LOCK,KG_ALT) #define K_ALTGRLOCK K(KT_LOCK,KG_ALTGR) #define K_SHIFTLLOCK K(KT_LOCK,KG_SHIFTL) #define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR) #define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL) #define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR) #define K_CAPSSHIFTLOCK K(KT_LOCK,KG_CAPSSHIFT) #define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT) #define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL) #define K_ALT_SLOCK K(KT_SLOCK,KG_ALT) #define K_ALTGR_SLOCK K(KT_SLOCK,KG_ALTGR) #define K_SHIFTL_SLOCK K(KT_SLOCK,KG_SHIFTL) #define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR) #define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL) #define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR) #define K_CAPSSHIFT_SLOCK K(KT_SLOCK,KG_CAPSSHIFT) #define NR_LOCK 9 #define K_BRL_BLANK K(KT_BRL, 0) #define K_BRL_DOT1 K(KT_BRL, 1) #define K_BRL_DOT2 K(KT_BRL, 2) #define K_BRL_DOT3 K(KT_BRL, 3) #define K_BRL_DOT4 K(KT_BRL, 4) #define K_BRL_DOT5 K(KT_BRL, 5) #define K_BRL_DOT6 K(KT_BRL, 6) #define K_BRL_DOT7 K(KT_BRL, 7) #define K_BRL_DOT8 K(KT_BRL, 8) #define K_BRL_DOT9 K(KT_BRL, 9) #define K_BRL_DOT10 K(KT_BRL, 10) #define NR_BRL 11 #define MAX_DIACR 256 #endif /* __LINUX_KEYBOARD_H */ linux/mmc/ioctl.h 0000644 00000004355 15063602051 0007747 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef LINUX_MMC_IOCTL_H #define LINUX_MMC_IOCTL_H #include <linux/types.h> struct mmc_ioc_cmd { /* Implies direction of data. true = write, false = read */ int write_flag; /* Application-specific command. true = precede with CMD55 */ int is_acmd; __u32 opcode; __u32 arg; __u32 response[4]; /* CMD response */ unsigned int flags; unsigned int blksz; unsigned int blocks; /* * Sleep at least postsleep_min_us useconds, and at most * postsleep_max_us useconds *after* issuing command. Needed for * some read commands for which cards have no other way of indicating * they're ready for the next command (i.e. there is no equivalent of * a "busy" indicator for read operations). */ unsigned int postsleep_min_us; unsigned int postsleep_max_us; /* * Override driver-computed timeouts. Note the difference in units! */ unsigned int data_timeout_ns; unsigned int cmd_timeout_ms; /* * For 64-bit machines, the next member, ``__u64 data_ptr``, wants to * be 8-byte aligned. Make sure this struct is the same size when * built for 32-bit. */ __u32 __pad; /* DAT buffer */ __u64 data_ptr; }; #define mmc_ioc_cmd_set_data(ic, ptr) ic.data_ptr = (__u64)(unsigned long) ptr /** * struct mmc_ioc_multi_cmd - multi command information * @num_of_cmds: Number of commands to send. Must be equal to or less than * MMC_IOC_MAX_CMDS. * @cmds: Array of commands with length equal to 'num_of_cmds' */ struct mmc_ioc_multi_cmd { __u64 num_of_cmds; struct mmc_ioc_cmd cmds[0]; }; #define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd) /* * MMC_IOC_MULTI_CMD: Used to send an array of MMC commands described by * the structure mmc_ioc_multi_cmd. The MMC driver will issue all * commands in array in sequence to card. */ #define MMC_IOC_MULTI_CMD _IOWR(MMC_BLOCK_MAJOR, 1, struct mmc_ioc_multi_cmd) /* * Since this ioctl is only meant to enhance (and not replace) normal access * to the mmc bus device, an upper data transfer limit of MMC_IOC_MAX_BYTES * is enforced per ioctl call. For larger data transfers, use the normal * block device operations. */ #define MMC_IOC_MAX_BYTES (512L * 1024) #define MMC_IOC_MAX_CMDS 255 #endif /* LINUX_MMC_IOCTL_H */ linux/keyctl.h 0000644 00000006654 15063602051 0007360 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* keyctl.h: keyctl command IDs * * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_KEYCTL_H #define _LINUX_KEYCTL_H #include <linux/types.h> /* special process keyring shortcut IDs */ #define KEY_SPEC_THREAD_KEYRING -1 /* - key ID for thread-specific keyring */ #define KEY_SPEC_PROCESS_KEYRING -2 /* - key ID for process-specific keyring */ #define KEY_SPEC_SESSION_KEYRING -3 /* - key ID for session-specific keyring */ #define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ #define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ #define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ #define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ #define KEY_SPEC_REQUESTOR_KEYRING -8 /* - key ID for request_key() dest keyring */ /* request-key default keyrings */ #define KEY_REQKEY_DEFL_NO_CHANGE -1 #define KEY_REQKEY_DEFL_DEFAULT 0 #define KEY_REQKEY_DEFL_THREAD_KEYRING 1 #define KEY_REQKEY_DEFL_PROCESS_KEYRING 2 #define KEY_REQKEY_DEFL_SESSION_KEYRING 3 #define KEY_REQKEY_DEFL_USER_KEYRING 4 #define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 #define KEY_REQKEY_DEFL_GROUP_KEYRING 6 #define KEY_REQKEY_DEFL_REQUESTOR_KEYRING 7 /* keyctl commands */ #define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ #define KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ #define KEYCTL_UPDATE 2 /* update a key */ #define KEYCTL_REVOKE 3 /* revoke a key */ #define KEYCTL_CHOWN 4 /* set ownership of a key */ #define KEYCTL_SETPERM 5 /* set perms on a key */ #define KEYCTL_DESCRIBE 6 /* describe a key */ #define KEYCTL_CLEAR 7 /* clear contents of a keyring */ #define KEYCTL_LINK 8 /* link a key into a keyring */ #define KEYCTL_UNLINK 9 /* unlink a key from a keyring */ #define KEYCTL_SEARCH 10 /* search for a key in a keyring */ #define KEYCTL_READ 11 /* read a key or keyring's contents */ #define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ #define KEYCTL_NEGATE 13 /* negate a partially constructed key */ #define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ #define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ #define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ #define KEYCTL_GET_SECURITY 17 /* get key security label */ #define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ #define KEYCTL_REJECT 19 /* reject a partially constructed key */ #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ #define KEYCTL_INVALIDATE 21 /* invalidate a key */ #define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */ #define KEYCTL_DH_COMPUTE 23 /* Compute Diffie-Hellman values */ #define KEYCTL_RESTRICT_KEYRING 29 /* Restrict keys allowed to link to a keyring */ /* keyctl structures */ struct keyctl_dh_params { __s32 private; __s32 prime; __s32 base; }; struct keyctl_kdf_params { char *hashname; char *otherinfo; __u32 otherinfolen; __u32 __spare[8]; }; #endif /* _LINUX_KEYCTL_H */ linux/kfd_ioctl.h 0000644 00000070216 15063602051 0010016 0 ustar 00 /* * Copyright 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef KFD_IOCTL_H_INCLUDED #define KFD_IOCTL_H_INCLUDED #include <drm/drm.h> #include <linux/ioctl.h> /* * - 1.1 - initial version * - 1.3 - Add SMI events support * - 1.4 - Indicate new SRAM EDC bit in device properties * - 1.5 - Add SVM API * - 1.6 - Query clear flags in SVM get_attr API * - 1.7 - Checkpoint Restore (CRIU) API * - 1.8 - CRIU - Support for SDMA transfers with GTT BOs * - 1.9 - Add available memory ioctl * - 1.10 - Add SMI profiler event log * - 1.11 - Add unified memory for ctx save/restore area */ #define KFD_IOCTL_MAJOR_VERSION 1 #define KFD_IOCTL_MINOR_VERSION 11 struct kfd_ioctl_get_version_args { __u32 major_version; /* from KFD */ __u32 minor_version; /* from KFD */ }; /* For kfd_ioctl_create_queue_args.queue_type. */ #define KFD_IOC_QUEUE_TYPE_COMPUTE 0x0 #define KFD_IOC_QUEUE_TYPE_SDMA 0x1 #define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 0x2 #define KFD_IOC_QUEUE_TYPE_SDMA_XGMI 0x3 #define KFD_MAX_QUEUE_PERCENTAGE 100 #define KFD_MAX_QUEUE_PRIORITY 15 struct kfd_ioctl_create_queue_args { __u64 ring_base_address; /* to KFD */ __u64 write_pointer_address; /* from KFD */ __u64 read_pointer_address; /* from KFD */ __u64 doorbell_offset; /* from KFD */ __u32 ring_size; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 queue_type; /* to KFD */ __u32 queue_percentage; /* to KFD */ __u32 queue_priority; /* to KFD */ __u32 queue_id; /* from KFD */ __u64 eop_buffer_address; /* to KFD */ __u64 eop_buffer_size; /* to KFD */ __u64 ctx_save_restore_address; /* to KFD */ __u32 ctx_save_restore_size; /* to KFD */ __u32 ctl_stack_size; /* to KFD */ }; struct kfd_ioctl_destroy_queue_args { __u32 queue_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_update_queue_args { __u64 ring_base_address; /* to KFD */ __u32 queue_id; /* to KFD */ __u32 ring_size; /* to KFD */ __u32 queue_percentage; /* to KFD */ __u32 queue_priority; /* to KFD */ }; struct kfd_ioctl_set_cu_mask_args { __u32 queue_id; /* to KFD */ __u32 num_cu_mask; /* to KFD */ __u64 cu_mask_ptr; /* to KFD */ }; struct kfd_ioctl_get_queue_wave_state_args { __u64 ctl_stack_address; /* to KFD */ __u32 ctl_stack_used_size; /* from KFD */ __u32 save_area_used_size; /* from KFD */ __u32 queue_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_get_available_memory_args { __u64 available; /* from KFD */ __u32 gpu_id; /* to KFD */ __u32 pad; }; /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */ #define KFD_IOC_CACHE_POLICY_COHERENT 0 #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1 struct kfd_ioctl_set_memory_policy_args { __u64 alternate_aperture_base; /* to KFD */ __u64 alternate_aperture_size; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 default_policy; /* to KFD */ __u32 alternate_policy; /* to KFD */ __u32 pad; }; /* * All counters are monotonic. They are used for profiling of compute jobs. * The profiling is done by userspace. * * In case of GPU reset, the counter should not be affected. */ struct kfd_ioctl_get_clock_counters_args { __u64 gpu_clock_counter; /* from KFD */ __u64 cpu_clock_counter; /* from KFD */ __u64 system_clock_counter; /* from KFD */ __u64 system_clock_freq; /* from KFD */ __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_process_device_apertures { __u64 lds_base; /* from KFD */ __u64 lds_limit; /* from KFD */ __u64 scratch_base; /* from KFD */ __u64 scratch_limit; /* from KFD */ __u64 gpuvm_base; /* from KFD */ __u64 gpuvm_limit; /* from KFD */ __u32 gpu_id; /* from KFD */ __u32 pad; }; /* * AMDKFD_IOC_GET_PROCESS_APERTURES is deprecated. Use * AMDKFD_IOC_GET_PROCESS_APERTURES_NEW instead, which supports an * unlimited number of GPUs. */ #define NUM_OF_SUPPORTED_GPUS 7 struct kfd_ioctl_get_process_apertures_args { struct kfd_process_device_apertures process_apertures[NUM_OF_SUPPORTED_GPUS];/* from KFD */ /* from KFD, should be in the range [1 - NUM_OF_SUPPORTED_GPUS] */ __u32 num_of_nodes; __u32 pad; }; struct kfd_ioctl_get_process_apertures_new_args { /* User allocated. Pointer to struct kfd_process_device_apertures * filled in by Kernel */ __u64 kfd_process_device_apertures_ptr; /* to KFD - indicates amount of memory present in * kfd_process_device_apertures_ptr * from KFD - Number of entries filled by KFD. */ __u32 num_of_nodes; __u32 pad; }; #define MAX_ALLOWED_NUM_POINTS 100 #define MAX_ALLOWED_AW_BUFF_SIZE 4096 #define MAX_ALLOWED_WAC_BUFF_SIZE 128 struct kfd_ioctl_dbg_register_args { __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_dbg_unregister_args { __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_dbg_address_watch_args { __u64 content_ptr; /* a pointer to the actual content */ __u32 gpu_id; /* to KFD */ __u32 buf_size_in_bytes; /*including gpu_id and buf_size */ }; struct kfd_ioctl_dbg_wave_control_args { __u64 content_ptr; /* a pointer to the actual content */ __u32 gpu_id; /* to KFD */ __u32 buf_size_in_bytes; /*including gpu_id and buf_size */ }; #define KFD_INVALID_FD 0xffffffff /* Matching HSA_EVENTTYPE */ #define KFD_IOC_EVENT_SIGNAL 0 #define KFD_IOC_EVENT_NODECHANGE 1 #define KFD_IOC_EVENT_DEVICESTATECHANGE 2 #define KFD_IOC_EVENT_HW_EXCEPTION 3 #define KFD_IOC_EVENT_SYSTEM_EVENT 4 #define KFD_IOC_EVENT_DEBUG_EVENT 5 #define KFD_IOC_EVENT_PROFILE_EVENT 6 #define KFD_IOC_EVENT_QUEUE_EVENT 7 #define KFD_IOC_EVENT_MEMORY 8 #define KFD_IOC_WAIT_RESULT_COMPLETE 0 #define KFD_IOC_WAIT_RESULT_TIMEOUT 1 #define KFD_IOC_WAIT_RESULT_FAIL 2 #define KFD_SIGNAL_EVENT_LIMIT 4096 /* For kfd_event_data.hw_exception_data.reset_type. */ #define KFD_HW_EXCEPTION_WHOLE_GPU_RESET 0 #define KFD_HW_EXCEPTION_PER_ENGINE_RESET 1 /* For kfd_event_data.hw_exception_data.reset_cause. */ #define KFD_HW_EXCEPTION_GPU_HANG 0 #define KFD_HW_EXCEPTION_ECC 1 /* For kfd_hsa_memory_exception_data.ErrorType */ #define KFD_MEM_ERR_NO_RAS 0 #define KFD_MEM_ERR_SRAM_ECC 1 #define KFD_MEM_ERR_POISON_CONSUMED 2 #define KFD_MEM_ERR_GPU_HANG 3 struct kfd_ioctl_create_event_args { __u64 event_page_offset; /* from KFD */ __u32 event_trigger_data; /* from KFD - signal events only */ __u32 event_type; /* to KFD */ __u32 auto_reset; /* to KFD */ __u32 node_id; /* to KFD - only valid for certain event types */ __u32 event_id; /* from KFD */ __u32 event_slot_index; /* from KFD */ }; struct kfd_ioctl_destroy_event_args { __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_set_event_args { __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_reset_event_args { __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_memory_exception_failure { __u32 NotPresent; /* Page not present or supervisor privilege */ __u32 ReadOnly; /* Write access to a read-only page */ __u32 NoExecute; /* Execute access to a page marked NX */ __u32 imprecise; /* Can't determine the exact fault address */ }; /* memory exception data */ struct kfd_hsa_memory_exception_data { struct kfd_memory_exception_failure failure; __u64 va; __u32 gpu_id; __u32 ErrorType; /* 0 = no RAS error, * 1 = ECC_SRAM, * 2 = Link_SYNFLOOD (poison), * 3 = GPU hang (not attributable to a specific cause), * other values reserved */ }; /* hw exception data */ struct kfd_hsa_hw_exception_data { __u32 reset_type; __u32 reset_cause; __u32 memory_lost; __u32 gpu_id; }; /* Event data */ struct kfd_event_data { union { struct kfd_hsa_memory_exception_data memory_exception_data; struct kfd_hsa_hw_exception_data hw_exception_data; }; /* From KFD */ __u64 kfd_event_data_ext; /* pointer to an extension structure for future exception types */ __u32 event_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_wait_events_args { __u64 events_ptr; /* pointed to struct kfd_event_data array, to KFD */ __u32 num_events; /* to KFD */ __u32 wait_for_all; /* to KFD */ __u32 timeout; /* to KFD */ __u32 wait_result; /* from KFD */ }; struct kfd_ioctl_set_scratch_backing_va_args { __u64 va_addr; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_get_tile_config_args { /* to KFD: pointer to tile array */ __u64 tile_config_ptr; /* to KFD: pointer to macro tile array */ __u64 macro_tile_config_ptr; /* to KFD: array size allocated by user mode * from KFD: array size filled by kernel */ __u32 num_tile_configs; /* to KFD: array size allocated by user mode * from KFD: array size filled by kernel */ __u32 num_macro_tile_configs; __u32 gpu_id; /* to KFD */ __u32 gb_addr_config; /* from KFD */ __u32 num_banks; /* from KFD */ __u32 num_ranks; /* from KFD */ /* struct size can be extended later if needed * without breaking ABI compatibility */ }; struct kfd_ioctl_set_trap_handler_args { __u64 tba_addr; /* to KFD */ __u64 tma_addr; /* to KFD */ __u32 gpu_id; /* to KFD */ __u32 pad; }; struct kfd_ioctl_acquire_vm_args { __u32 drm_fd; /* to KFD */ __u32 gpu_id; /* to KFD */ }; /* Allocation flags: memory types */ #define KFD_IOC_ALLOC_MEM_FLAGS_VRAM (1 << 0) #define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1) #define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2) #define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3) #define KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP (1 << 4) /* Allocation flags: attributes/access options */ #define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31) #define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30) #define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29) #define KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE (1 << 28) #define KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM (1 << 27) #define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 26) #define KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED (1 << 25) /* Allocate memory for later SVM (shared virtual memory) mapping. * * @va_addr: virtual address of the memory to be allocated * all later mappings on all GPUs will use this address * @size: size in bytes * @handle: buffer handle returned to user mode, used to refer to * this allocation for mapping, unmapping and freeing * @mmap_offset: for CPU-mapping the allocation by mmapping a render node * for userptrs this is overloaded to specify the CPU address * @gpu_id: device identifier * @flags: memory type and attributes. See KFD_IOC_ALLOC_MEM_FLAGS above */ struct kfd_ioctl_alloc_memory_of_gpu_args { __u64 va_addr; /* to KFD */ __u64 size; /* to KFD */ __u64 handle; /* from KFD */ __u64 mmap_offset; /* to KFD (userptr), from KFD (mmap offset) */ __u32 gpu_id; /* to KFD */ __u32 flags; }; /* Free memory allocated with kfd_ioctl_alloc_memory_of_gpu * * @handle: memory handle returned by alloc */ struct kfd_ioctl_free_memory_of_gpu_args { __u64 handle; /* to KFD */ }; /* Map memory to one or more GPUs * * @handle: memory handle returned by alloc * @device_ids_array_ptr: array of gpu_ids (__u32 per device) * @n_devices: number of devices in the array * @n_success: number of devices mapped successfully * * @n_success returns information to the caller how many devices from * the start of the array have mapped the buffer successfully. It can * be passed into a subsequent retry call to skip those devices. For * the first call the caller should initialize it to 0. * * If the ioctl completes with return code 0 (success), n_success == * n_devices. */ struct kfd_ioctl_map_memory_to_gpu_args { __u64 handle; /* to KFD */ __u64 device_ids_array_ptr; /* to KFD */ __u32 n_devices; /* to KFD */ __u32 n_success; /* to/from KFD */ }; /* Unmap memory from one or more GPUs * * same arguments as for mapping */ struct kfd_ioctl_unmap_memory_from_gpu_args { __u64 handle; /* to KFD */ __u64 device_ids_array_ptr; /* to KFD */ __u32 n_devices; /* to KFD */ __u32 n_success; /* to/from KFD */ }; /* Allocate GWS for specific queue * * @queue_id: queue's id that GWS is allocated for * @num_gws: how many GWS to allocate * @first_gws: index of the first GWS allocated. * only support contiguous GWS allocation */ struct kfd_ioctl_alloc_queue_gws_args { __u32 queue_id; /* to KFD */ __u32 num_gws; /* to KFD */ __u32 first_gws; /* from KFD */ __u32 pad; }; struct kfd_ioctl_get_dmabuf_info_args { __u64 size; /* from KFD */ __u64 metadata_ptr; /* to KFD */ __u32 metadata_size; /* to KFD (space allocated by user) * from KFD (actual metadata size) */ __u32 gpu_id; /* from KFD */ __u32 flags; /* from KFD (KFD_IOC_ALLOC_MEM_FLAGS) */ __u32 dmabuf_fd; /* to KFD */ }; struct kfd_ioctl_import_dmabuf_args { __u64 va_addr; /* to KFD */ __u64 handle; /* from KFD */ __u32 gpu_id; /* to KFD */ __u32 dmabuf_fd; /* to KFD */ }; /* * KFD SMI(System Management Interface) events */ enum kfd_smi_event { KFD_SMI_EVENT_NONE = 0, /* not used */ KFD_SMI_EVENT_VMFAULT = 1, /* event start counting at 1 */ KFD_SMI_EVENT_THERMAL_THROTTLE = 2, KFD_SMI_EVENT_GPU_PRE_RESET = 3, KFD_SMI_EVENT_GPU_POST_RESET = 4, KFD_SMI_EVENT_MIGRATE_START = 5, KFD_SMI_EVENT_MIGRATE_END = 6, KFD_SMI_EVENT_PAGE_FAULT_START = 7, KFD_SMI_EVENT_PAGE_FAULT_END = 8, KFD_SMI_EVENT_QUEUE_EVICTION = 9, KFD_SMI_EVENT_QUEUE_RESTORE = 10, KFD_SMI_EVENT_UNMAP_FROM_GPU = 11, /* * max event number, as a flag bit to get events from all processes, * this requires super user permission, otherwise will not be able to * receive event from any process. Without this flag to receive events * from same process. */ KFD_SMI_EVENT_ALL_PROCESS = 64 }; enum KFD_MIGRATE_TRIGGERS { KFD_MIGRATE_TRIGGER_PREFETCH, KFD_MIGRATE_TRIGGER_PAGEFAULT_GPU, KFD_MIGRATE_TRIGGER_PAGEFAULT_CPU, KFD_MIGRATE_TRIGGER_TTM_EVICTION }; enum KFD_QUEUE_EVICTION_TRIGGERS { KFD_QUEUE_EVICTION_TRIGGER_SVM, KFD_QUEUE_EVICTION_TRIGGER_USERPTR, KFD_QUEUE_EVICTION_TRIGGER_TTM, KFD_QUEUE_EVICTION_TRIGGER_SUSPEND, KFD_QUEUE_EVICTION_CRIU_CHECKPOINT, KFD_QUEUE_EVICTION_CRIU_RESTORE }; enum KFD_SVM_UNMAP_TRIGGERS { KFD_SVM_UNMAP_TRIGGER_MMU_NOTIFY, KFD_SVM_UNMAP_TRIGGER_MMU_NOTIFY_MIGRATE, KFD_SVM_UNMAP_TRIGGER_UNMAP_FROM_CPU }; #define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1)) #define KFD_SMI_EVENT_MSG_SIZE 96 struct kfd_ioctl_smi_events_args { __u32 gpuid; /* to KFD */ __u32 anon_fd; /* from KFD */ }; /************************************************************************************************** * CRIU IOCTLs (Checkpoint Restore In Userspace) * * When checkpointing a process, the userspace application will perform: * 1. PROCESS_INFO op to determine current process information. This pauses execution and evicts * all the queues. * 2. CHECKPOINT op to checkpoint process contents (BOs, queues, events, svm-ranges) * 3. UNPAUSE op to un-evict all the queues * * When restoring a process, the CRIU userspace application will perform: * * 1. RESTORE op to restore process contents * 2. RESUME op to start the process * * Note: Queues are forced into an evicted state after a successful PROCESS_INFO. User * application needs to perform an UNPAUSE operation after calling PROCESS_INFO. */ enum kfd_criu_op { KFD_CRIU_OP_PROCESS_INFO, KFD_CRIU_OP_CHECKPOINT, KFD_CRIU_OP_UNPAUSE, KFD_CRIU_OP_RESTORE, KFD_CRIU_OP_RESUME, }; /** * kfd_ioctl_criu_args - Arguments perform CRIU operation * @devices: [in/out] User pointer to memory location for devices information. * This is an array of type kfd_criu_device_bucket. * @bos: [in/out] User pointer to memory location for BOs information * This is an array of type kfd_criu_bo_bucket. * @priv_data: [in/out] User pointer to memory location for private data * @priv_data_size: [in/out] Size of priv_data in bytes * @num_devices: [in/out] Number of GPUs used by process. Size of @devices array. * @num_bos [in/out] Number of BOs used by process. Size of @bos array. * @num_objects: [in/out] Number of objects used by process. Objects are opaque to * user application. * @pid: [in/out] PID of the process being checkpointed * @op [in] Type of operation (kfd_criu_op) * * Return: 0 on success, -errno on failure */ struct kfd_ioctl_criu_args { __u64 devices; /* Used during ops: CHECKPOINT, RESTORE */ __u64 bos; /* Used during ops: CHECKPOINT, RESTORE */ __u64 priv_data; /* Used during ops: CHECKPOINT, RESTORE */ __u64 priv_data_size; /* Used during ops: PROCESS_INFO, RESTORE */ __u32 num_devices; /* Used during ops: PROCESS_INFO, RESTORE */ __u32 num_bos; /* Used during ops: PROCESS_INFO, RESTORE */ __u32 num_objects; /* Used during ops: PROCESS_INFO, RESTORE */ __u32 pid; /* Used during ops: PROCESS_INFO, RESUME */ __u32 op; }; struct kfd_criu_device_bucket { __u32 user_gpu_id; __u32 actual_gpu_id; __u32 drm_fd; __u32 pad; }; struct kfd_criu_bo_bucket { __u64 addr; __u64 size; __u64 offset; __u64 restored_offset; /* During restore, updated offset for BO */ __u32 gpu_id; /* This is the user_gpu_id */ __u32 alloc_flags; __u32 dmabuf_fd; __u32 pad; }; /* CRIU IOCTLs - END */ /**************************************************************************************************/ /* Register offset inside the remapped mmio page */ enum kfd_mmio_remap { KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL = 0, KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL = 4, }; /* Guarantee host access to memory */ #define KFD_IOCTL_SVM_FLAG_HOST_ACCESS 0x00000001 /* Fine grained coherency between all devices with access */ #define KFD_IOCTL_SVM_FLAG_COHERENT 0x00000002 /* Use any GPU in same hive as preferred device */ #define KFD_IOCTL_SVM_FLAG_HIVE_LOCAL 0x00000004 /* GPUs only read, allows replication */ #define KFD_IOCTL_SVM_FLAG_GPU_RO 0x00000008 /* Allow execution on GPU */ #define KFD_IOCTL_SVM_FLAG_GPU_EXEC 0x00000010 /* GPUs mostly read, may allow similar optimizations as RO, but writes fault */ #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY 0x00000020 /* Keep GPU memory mapping always valid as if XNACK is disable */ #define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED 0x00000040 /** * kfd_ioctl_svm_op - SVM ioctl operations * * @KFD_IOCTL_SVM_OP_SET_ATTR: Modify one or more attributes * @KFD_IOCTL_SVM_OP_GET_ATTR: Query one or more attributes */ enum kfd_ioctl_svm_op { KFD_IOCTL_SVM_OP_SET_ATTR, KFD_IOCTL_SVM_OP_GET_ATTR }; /** kfd_ioctl_svm_location - Enum for preferred and prefetch locations * * GPU IDs are used to specify GPUs as preferred and prefetch locations. * Below definitions are used for system memory or for leaving the preferred * location unspecified. */ enum kfd_ioctl_svm_location { KFD_IOCTL_SVM_LOCATION_SYSMEM = 0, KFD_IOCTL_SVM_LOCATION_UNDEFINED = 0xffffffff }; /** * kfd_ioctl_svm_attr_type - SVM attribute types * * @KFD_IOCTL_SVM_ATTR_PREFERRED_LOC: gpuid of the preferred location, 0 for * system memory * @KFD_IOCTL_SVM_ATTR_PREFETCH_LOC: gpuid of the prefetch location, 0 for * system memory. Setting this triggers an * immediate prefetch (migration). * @KFD_IOCTL_SVM_ATTR_ACCESS: * @KFD_IOCTL_SVM_ATTR_ACCESS_IN_PLACE: * @KFD_IOCTL_SVM_ATTR_NO_ACCESS: specify memory access for the gpuid given * by the attribute value * @KFD_IOCTL_SVM_ATTR_SET_FLAGS: bitmask of flags to set (see * KFD_IOCTL_SVM_FLAG_...) * @KFD_IOCTL_SVM_ATTR_CLR_FLAGS: bitmask of flags to clear * @KFD_IOCTL_SVM_ATTR_GRANULARITY: migration granularity * (log2 num pages) */ enum kfd_ioctl_svm_attr_type { KFD_IOCTL_SVM_ATTR_PREFERRED_LOC, KFD_IOCTL_SVM_ATTR_PREFETCH_LOC, KFD_IOCTL_SVM_ATTR_ACCESS, KFD_IOCTL_SVM_ATTR_ACCESS_IN_PLACE, KFD_IOCTL_SVM_ATTR_NO_ACCESS, KFD_IOCTL_SVM_ATTR_SET_FLAGS, KFD_IOCTL_SVM_ATTR_CLR_FLAGS, KFD_IOCTL_SVM_ATTR_GRANULARITY }; /** * kfd_ioctl_svm_attribute - Attributes as pairs of type and value * * The meaning of the @value depends on the attribute type. * * @type: attribute type (see enum @kfd_ioctl_svm_attr_type) * @value: attribute value */ struct kfd_ioctl_svm_attribute { __u32 type; __u32 value; }; /** * kfd_ioctl_svm_args - Arguments for SVM ioctl * * @op specifies the operation to perform (see enum * @kfd_ioctl_svm_op). @start_addr and @size are common for all * operations. * * A variable number of attributes can be given in @attrs. * @nattr specifies the number of attributes. New attributes can be * added in the future without breaking the ABI. If unknown attributes * are given, the function returns -EINVAL. * * @KFD_IOCTL_SVM_OP_SET_ATTR sets attributes for a virtual address * range. It may overlap existing virtual address ranges. If it does, * the existing ranges will be split such that the attribute changes * only apply to the specified address range. * * @KFD_IOCTL_SVM_OP_GET_ATTR returns the intersection of attributes * over all memory in the given range and returns the result as the * attribute value. If different pages have different preferred or * prefetch locations, 0xffffffff will be returned for * @KFD_IOCTL_SVM_ATTR_PREFERRED_LOC or * @KFD_IOCTL_SVM_ATTR_PREFETCH_LOC resepctively. For * @KFD_IOCTL_SVM_ATTR_SET_FLAGS, flags of all pages will be * aggregated by bitwise AND. That means, a flag will be set in the * output, if that flag is set for all pages in the range. For * @KFD_IOCTL_SVM_ATTR_CLR_FLAGS, flags of all pages will be * aggregated by bitwise NOR. That means, a flag will be set in the * output, if that flag is clear for all pages in the range. * The minimum migration granularity throughout the range will be * returned for @KFD_IOCTL_SVM_ATTR_GRANULARITY. * * Querying of accessibility attributes works by initializing the * attribute type to @KFD_IOCTL_SVM_ATTR_ACCESS and the value to the * GPUID being queried. Multiple attributes can be given to allow * querying multiple GPUIDs. The ioctl function overwrites the * attribute type to indicate the access for the specified GPU. */ struct kfd_ioctl_svm_args { __u64 start_addr; __u64 size; __u32 op; __u32 nattr; /* Variable length array of attributes */ struct kfd_ioctl_svm_attribute attrs[]; }; /** * kfd_ioctl_set_xnack_mode_args - Arguments for set_xnack_mode * * @xnack_enabled: [in/out] Whether to enable XNACK mode for this process * * @xnack_enabled indicates whether recoverable page faults should be * enabled for the current process. 0 means disabled, positive means * enabled, negative means leave unchanged. If enabled, virtual address * translations on GFXv9 and later AMD GPUs can return XNACK and retry * the access until a valid PTE is available. This is used to implement * device page faults. * * On output, @xnack_enabled returns the (new) current mode (0 or * positive). Therefore, a negative input value can be used to query * the current mode without changing it. * * The XNACK mode fundamentally changes the way SVM managed memory works * in the driver, with subtle effects on application performance and * functionality. * * Enabling XNACK mode requires shader programs to be compiled * differently. Furthermore, not all GPUs support changing the mode * per-process. Therefore changing the mode is only allowed while no * user mode queues exist in the process. This ensure that no shader * code is running that may be compiled for the wrong mode. And GPUs * that cannot change to the requested mode will prevent the XNACK * mode from occurring. All GPUs used by the process must be in the * same XNACK mode. * * GFXv8 or older GPUs do not support 48 bit virtual addresses or SVM. * Therefore those GPUs are not considered for the XNACK mode switch. * * Return: 0 on success, -errno on failure */ struct kfd_ioctl_set_xnack_mode_args { __s32 xnack_enabled; }; #define AMDKFD_IOCTL_BASE 'K' #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr) #define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type) #define AMDKFD_IOW(nr, type) _IOW(AMDKFD_IOCTL_BASE, nr, type) #define AMDKFD_IOWR(nr, type) _IOWR(AMDKFD_IOCTL_BASE, nr, type) #define AMDKFD_IOC_GET_VERSION \ AMDKFD_IOR(0x01, struct kfd_ioctl_get_version_args) #define AMDKFD_IOC_CREATE_QUEUE \ AMDKFD_IOWR(0x02, struct kfd_ioctl_create_queue_args) #define AMDKFD_IOC_DESTROY_QUEUE \ AMDKFD_IOWR(0x03, struct kfd_ioctl_destroy_queue_args) #define AMDKFD_IOC_SET_MEMORY_POLICY \ AMDKFD_IOW(0x04, struct kfd_ioctl_set_memory_policy_args) #define AMDKFD_IOC_GET_CLOCK_COUNTERS \ AMDKFD_IOWR(0x05, struct kfd_ioctl_get_clock_counters_args) #define AMDKFD_IOC_GET_PROCESS_APERTURES \ AMDKFD_IOR(0x06, struct kfd_ioctl_get_process_apertures_args) #define AMDKFD_IOC_UPDATE_QUEUE \ AMDKFD_IOW(0x07, struct kfd_ioctl_update_queue_args) #define AMDKFD_IOC_CREATE_EVENT \ AMDKFD_IOWR(0x08, struct kfd_ioctl_create_event_args) #define AMDKFD_IOC_DESTROY_EVENT \ AMDKFD_IOW(0x09, struct kfd_ioctl_destroy_event_args) #define AMDKFD_IOC_SET_EVENT \ AMDKFD_IOW(0x0A, struct kfd_ioctl_set_event_args) #define AMDKFD_IOC_RESET_EVENT \ AMDKFD_IOW(0x0B, struct kfd_ioctl_reset_event_args) #define AMDKFD_IOC_WAIT_EVENTS \ AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args) #define AMDKFD_IOC_DBG_REGISTER_DEPRECATED \ AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args) #define AMDKFD_IOC_DBG_UNREGISTER_DEPRECATED \ AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args) #define AMDKFD_IOC_DBG_ADDRESS_WATCH_DEPRECATED \ AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args) #define AMDKFD_IOC_DBG_WAVE_CONTROL_DEPRECATED \ AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args) #define AMDKFD_IOC_SET_SCRATCH_BACKING_VA \ AMDKFD_IOWR(0x11, struct kfd_ioctl_set_scratch_backing_va_args) #define AMDKFD_IOC_GET_TILE_CONFIG \ AMDKFD_IOWR(0x12, struct kfd_ioctl_get_tile_config_args) #define AMDKFD_IOC_SET_TRAP_HANDLER \ AMDKFD_IOW(0x13, struct kfd_ioctl_set_trap_handler_args) #define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW \ AMDKFD_IOWR(0x14, \ struct kfd_ioctl_get_process_apertures_new_args) #define AMDKFD_IOC_ACQUIRE_VM \ AMDKFD_IOW(0x15, struct kfd_ioctl_acquire_vm_args) #define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU \ AMDKFD_IOWR(0x16, struct kfd_ioctl_alloc_memory_of_gpu_args) #define AMDKFD_IOC_FREE_MEMORY_OF_GPU \ AMDKFD_IOW(0x17, struct kfd_ioctl_free_memory_of_gpu_args) #define AMDKFD_IOC_MAP_MEMORY_TO_GPU \ AMDKFD_IOWR(0x18, struct kfd_ioctl_map_memory_to_gpu_args) #define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU \ AMDKFD_IOWR(0x19, struct kfd_ioctl_unmap_memory_from_gpu_args) #define AMDKFD_IOC_SET_CU_MASK \ AMDKFD_IOW(0x1A, struct kfd_ioctl_set_cu_mask_args) #define AMDKFD_IOC_GET_QUEUE_WAVE_STATE \ AMDKFD_IOWR(0x1B, struct kfd_ioctl_get_queue_wave_state_args) #define AMDKFD_IOC_GET_DMABUF_INFO \ AMDKFD_IOWR(0x1C, struct kfd_ioctl_get_dmabuf_info_args) #define AMDKFD_IOC_IMPORT_DMABUF \ AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args) #define AMDKFD_IOC_ALLOC_QUEUE_GWS \ AMDKFD_IOWR(0x1E, struct kfd_ioctl_alloc_queue_gws_args) #define AMDKFD_IOC_SMI_EVENTS \ AMDKFD_IOWR(0x1F, struct kfd_ioctl_smi_events_args) #define AMDKFD_IOC_SVM AMDKFD_IOWR(0x20, struct kfd_ioctl_svm_args) #define AMDKFD_IOC_SET_XNACK_MODE \ AMDKFD_IOWR(0x21, struct kfd_ioctl_set_xnack_mode_args) #define AMDKFD_IOC_CRIU_OP \ AMDKFD_IOWR(0x22, struct kfd_ioctl_criu_args) #define AMDKFD_IOC_AVAILABLE_MEMORY \ AMDKFD_IOWR(0x23, struct kfd_ioctl_get_available_memory_args) #define AMDKFD_COMMAND_START 0x01 #define AMDKFD_COMMAND_END 0x24 #endif linux/kfd_sysfs.h 0000644 00000010376 15063602051 0010054 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */ /* * Copyright 2021 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef KFD_SYSFS_H_INCLUDED #define KFD_SYSFS_H_INCLUDED /* Capability bits in node properties */ #define HSA_CAP_HOT_PLUGGABLE 0x00000001 #define HSA_CAP_ATS_PRESENT 0x00000002 #define HSA_CAP_SHARED_WITH_GRAPHICS 0x00000004 #define HSA_CAP_QUEUE_SIZE_POW2 0x00000008 #define HSA_CAP_QUEUE_SIZE_32BIT 0x00000010 #define HSA_CAP_QUEUE_IDLE_EVENT 0x00000020 #define HSA_CAP_VA_LIMIT 0x00000040 #define HSA_CAP_WATCH_POINTS_SUPPORTED 0x00000080 #define HSA_CAP_WATCH_POINTS_TOTALBITS_MASK 0x00000f00 #define HSA_CAP_WATCH_POINTS_TOTALBITS_SHIFT 8 #define HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK 0x00003000 #define HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT 12 #define HSA_CAP_DOORBELL_TYPE_PRE_1_0 0x0 #define HSA_CAP_DOORBELL_TYPE_1_0 0x1 #define HSA_CAP_DOORBELL_TYPE_2_0 0x2 #define HSA_CAP_AQL_QUEUE_DOUBLE_MAP 0x00004000 /* Old buggy user mode depends on this being 0 */ #define HSA_CAP_RESERVED_WAS_SRAM_EDCSUPPORTED 0x00080000 #define HSA_CAP_MEM_EDCSUPPORTED 0x00100000 #define HSA_CAP_RASEVENTNOTIFY 0x00200000 #define HSA_CAP_ASIC_REVISION_MASK 0x03c00000 #define HSA_CAP_ASIC_REVISION_SHIFT 22 #define HSA_CAP_SRAM_EDCSUPPORTED 0x04000000 #define HSA_CAP_SVMAPI_SUPPORTED 0x08000000 #define HSA_CAP_FLAGS_COHERENTHOSTACCESS 0x10000000 #define HSA_CAP_RESERVED 0xe00f8000 /* Heap types in memory properties */ #define HSA_MEM_HEAP_TYPE_SYSTEM 0 #define HSA_MEM_HEAP_TYPE_FB_PUBLIC 1 #define HSA_MEM_HEAP_TYPE_FB_PRIVATE 2 #define HSA_MEM_HEAP_TYPE_GPU_GDS 3 #define HSA_MEM_HEAP_TYPE_GPU_LDS 4 #define HSA_MEM_HEAP_TYPE_GPU_SCRATCH 5 /* Flag bits in memory properties */ #define HSA_MEM_FLAGS_HOT_PLUGGABLE 0x00000001 #define HSA_MEM_FLAGS_NON_VOLATILE 0x00000002 #define HSA_MEM_FLAGS_RESERVED 0xfffffffc /* Cache types in cache properties */ #define HSA_CACHE_TYPE_DATA 0x00000001 #define HSA_CACHE_TYPE_INSTRUCTION 0x00000002 #define HSA_CACHE_TYPE_CPU 0x00000004 #define HSA_CACHE_TYPE_HSACU 0x00000008 #define HSA_CACHE_TYPE_RESERVED 0xfffffff0 /* Link types in IO link properties (matches CRAT link types) */ #define HSA_IOLINK_TYPE_UNDEFINED 0 #define HSA_IOLINK_TYPE_HYPERTRANSPORT 1 #define HSA_IOLINK_TYPE_PCIEXPRESS 2 #define HSA_IOLINK_TYPE_AMBA 3 #define HSA_IOLINK_TYPE_MIPI 4 #define HSA_IOLINK_TYPE_QPI_1_1 5 #define HSA_IOLINK_TYPE_RESERVED1 6 #define HSA_IOLINK_TYPE_RESERVED2 7 #define HSA_IOLINK_TYPE_RAPID_IO 8 #define HSA_IOLINK_TYPE_INFINIBAND 9 #define HSA_IOLINK_TYPE_RESERVED3 10 #define HSA_IOLINK_TYPE_XGMI 11 #define HSA_IOLINK_TYPE_XGOP 12 #define HSA_IOLINK_TYPE_GZ 13 #define HSA_IOLINK_TYPE_ETHERNET_RDMA 14 #define HSA_IOLINK_TYPE_RDMA_OTHER 15 #define HSA_IOLINK_TYPE_OTHER 16 /* Flag bits in IO link properties (matches CRAT flags, excluding the * bi-directional flag, which is not offially part of the CRAT spec, and * only used internally in KFD) */ #define HSA_IOLINK_FLAGS_ENABLED (1 << 0) #define HSA_IOLINK_FLAGS_NON_COHERENT (1 << 1) #define HSA_IOLINK_FLAGS_NO_ATOMICS_32_BIT (1 << 2) #define HSA_IOLINK_FLAGS_NO_ATOMICS_64_BIT (1 << 3) #define HSA_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA (1 << 4) #define HSA_IOLINK_FLAGS_RESERVED 0xffffffe0 #endif linux/kvm.h 0000644 00000170171 15063602051 0006656 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KVM_H #define __LINUX_KVM_H /* * Userspace interface for /dev/kvm - kernel based virtual machine * * Note: you must update KVM_API_VERSION if you change this interface. */ #include <linux/const.h> #include <linux/types.h> #include <linux/ioctl.h> #include <asm/kvm.h> #define KVM_API_VERSION 12 /* *** Deprecated interfaces *** */ #define KVM_TRC_SHIFT 16 #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) #define KVM_TRC_HEAD_SIZE 12 #define KVM_TRC_CYCLE_SIZE 8 #define KVM_TRC_EXTRA_MAX 7 #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) struct kvm_user_trace_setup { __u32 buf_size; __u32 buf_nr; }; #define __KVM_DEPRECATED_MAIN_W_0x06 \ _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) #define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07) #define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08) #define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq) struct kvm_breakpoint { __u32 enabled; __u32 padding; __u64 address; }; struct kvm_debug_guest { __u32 enabled; __u32 pad; struct kvm_breakpoint breakpoints[4]; __u32 singlestep; }; #define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) /* *** End of deprecated interfaces *** */ /* for KVM_CREATE_MEMORY_REGION */ struct kvm_memory_region { __u32 slot; __u32 flags; __u64 guest_phys_addr; __u64 memory_size; /* bytes */ }; /* for KVM_SET_USER_MEMORY_REGION */ struct kvm_userspace_memory_region { __u32 slot; __u32 flags; __u64 guest_phys_addr; __u64 memory_size; /* bytes */ __u64 userspace_addr; /* start of the userspace allocated memory */ }; /* * The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace, * other bits are reserved for kvm internal use which are defined in * include/linux/kvm_host.h. */ #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) #define KVM_MEM_READONLY (1UL << 1) /* for KVM_IRQ_LINE */ struct kvm_irq_level { /* * ACPI gsi notion of irq. * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. * For ARM: See Documentation/virt/kvm/api.rst */ union { __u32 irq; __s32 status; }; __u32 level; }; struct kvm_irqchip { __u32 chip_id; __u32 pad; union { char dummy[512]; /* reserving space */ #ifdef __KVM_HAVE_PIT struct kvm_pic_state pic; #endif #ifdef __KVM_HAVE_IOAPIC struct kvm_ioapic_state ioapic; #endif } chip; }; /* for KVM_CREATE_PIT2 */ struct kvm_pit_config { __u32 flags; __u32 pad[15]; }; #define KVM_PIT_SPEAKER_DUMMY 1 struct kvm_s390_skeys { __u64 start_gfn; __u64 count; __u64 skeydata_addr; __u32 flags; __u32 reserved[9]; }; #define KVM_S390_CMMA_PEEK (1 << 0) /** * kvm_s390_cmma_log - Used for CMMA migration. * * Used both for input and output. * * @start_gfn: Guest page number to start from. * @count: Size of the result buffer. * @flags: Control operation mode via KVM_S390_CMMA_* flags * @remaining: Used with KVM_S390_GET_CMMA_BITS. Indicates how many dirty * pages are still remaining. * @mask: Used with KVM_S390_SET_CMMA_BITS. Bitmap of bits to actually set * in the PGSTE. * @values: Pointer to the values buffer. * * Used in KVM_S390_{G,S}ET_CMMA_BITS ioctls. */ struct kvm_s390_cmma_log { __u64 start_gfn; __u32 count; __u32 flags; union { __u64 remaining; __u64 mask; }; __u64 values; }; struct kvm_hyperv_exit { #define KVM_EXIT_HYPERV_SYNIC 1 #define KVM_EXIT_HYPERV_HCALL 2 #define KVM_EXIT_HYPERV_SYNDBG 3 __u32 type; __u32 pad1; union { struct { __u32 msr; __u32 pad2; __u64 control; __u64 evt_page; __u64 msg_page; } synic; struct { __u64 input; __u64 result; __u64 params[2]; } hcall; struct { __u32 msr; __u32 pad2; __u64 control; __u64 status; __u64 send_page; __u64 recv_page; __u64 pending_page; } syndbg; } u; }; struct kvm_xen_exit { #define KVM_EXIT_XEN_HCALL 1 __u32 type; union { struct { __u32 longmode; __u32 cpl; __u64 input; __u64 result; __u64 params[6]; } hcall; } u; }; #define KVM_S390_GET_SKEYS_NONE 1 #define KVM_S390_SKEYS_MAX 1048576 #define KVM_EXIT_UNKNOWN 0 #define KVM_EXIT_EXCEPTION 1 #define KVM_EXIT_IO 2 #define KVM_EXIT_HYPERCALL 3 #define KVM_EXIT_DEBUG 4 #define KVM_EXIT_HLT 5 #define KVM_EXIT_MMIO 6 #define KVM_EXIT_IRQ_WINDOW_OPEN 7 #define KVM_EXIT_SHUTDOWN 8 #define KVM_EXIT_FAIL_ENTRY 9 #define KVM_EXIT_INTR 10 #define KVM_EXIT_SET_TPR 11 #define KVM_EXIT_TPR_ACCESS 12 #define KVM_EXIT_S390_SIEIC 13 #define KVM_EXIT_S390_RESET 14 #define KVM_EXIT_DCR 15 /* deprecated */ #define KVM_EXIT_NMI 16 #define KVM_EXIT_INTERNAL_ERROR 17 #define KVM_EXIT_OSI 18 #define KVM_EXIT_PAPR_HCALL 19 #define KVM_EXIT_S390_UCONTROL 20 #define KVM_EXIT_WATCHDOG 21 #define KVM_EXIT_S390_TSCH 22 #define KVM_EXIT_EPR 23 #define KVM_EXIT_SYSTEM_EVENT 24 #define KVM_EXIT_S390_STSI 25 #define KVM_EXIT_IOAPIC_EOI 26 #define KVM_EXIT_HYPERV 27 #define KVM_EXIT_ARM_NISV 28 #define KVM_EXIT_X86_RDMSR 29 #define KVM_EXIT_X86_WRMSR 30 #define KVM_EXIT_DIRTY_RING_FULL 31 #define KVM_EXIT_AP_RESET_HOLD 32 #define KVM_EXIT_X86_BUS_LOCK 33 #define KVM_EXIT_XEN 34 /* For KVM_EXIT_INTERNAL_ERROR */ /* Emulate instruction failed. */ #define KVM_INTERNAL_ERROR_EMULATION 1 /* Encounter unexpected simultaneous exceptions. */ #define KVM_INTERNAL_ERROR_SIMUL_EX 2 /* Encounter unexpected vm-exit due to delivery event. */ #define KVM_INTERNAL_ERROR_DELIVERY_EV 3 /* Encounter unexpected vm-exit reason */ #define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4 /* Flags that describe what fields in emulation_failure hold valid data. */ #define KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES (1ULL << 0) /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ struct kvm_run { /* in */ __u8 request_interrupt_window; __u8 immediate_exit; __u8 padding1[6]; /* out */ __u32 exit_reason; __u8 ready_for_interrupt_injection; __u8 if_flag; __u16 flags; /* in (pre_kvm_run), out (post_kvm_run) */ __u64 cr8; __u64 apic_base; #ifdef __KVM_S390 /* the processor status word for s390 */ __u64 psw_mask; /* psw upper half */ __u64 psw_addr; /* psw lower half */ #endif union { /* KVM_EXIT_UNKNOWN */ struct { __u64 hardware_exit_reason; } hw; /* KVM_EXIT_FAIL_ENTRY */ struct { __u64 hardware_entry_failure_reason; __u32 cpu; } fail_entry; /* KVM_EXIT_EXCEPTION */ struct { __u32 exception; __u32 error_code; } ex; /* KVM_EXIT_IO */ struct { #define KVM_EXIT_IO_IN 0 #define KVM_EXIT_IO_OUT 1 __u8 direction; __u8 size; /* bytes */ __u16 port; __u32 count; __u64 data_offset; /* relative to kvm_run start */ } io; /* KVM_EXIT_DEBUG */ struct { struct kvm_debug_exit_arch arch; } debug; /* KVM_EXIT_MMIO */ struct { __u64 phys_addr; __u8 data[8]; __u32 len; __u8 is_write; } mmio; /* KVM_EXIT_HYPERCALL */ struct { __u64 nr; __u64 args[6]; __u64 ret; __u32 longmode; __u32 pad; } hypercall; /* KVM_EXIT_TPR_ACCESS */ struct { __u64 rip; __u32 is_write; __u32 pad; } tpr_access; /* KVM_EXIT_S390_SIEIC */ struct { __u8 icptcode; __u16 ipa; __u32 ipb; } s390_sieic; /* KVM_EXIT_S390_RESET */ #define KVM_S390_RESET_POR 1 #define KVM_S390_RESET_CLEAR 2 #define KVM_S390_RESET_SUBSYSTEM 4 #define KVM_S390_RESET_CPU_INIT 8 #define KVM_S390_RESET_IPL 16 __u64 s390_reset_flags; /* KVM_EXIT_S390_UCONTROL */ struct { __u64 trans_exc_code; __u32 pgm_code; } s390_ucontrol; /* KVM_EXIT_DCR (deprecated) */ struct { __u32 dcrn; __u32 data; __u8 is_write; } dcr; /* KVM_EXIT_INTERNAL_ERROR */ struct { __u32 suberror; /* Available with KVM_CAP_INTERNAL_ERROR_DATA: */ __u32 ndata; __u64 data[16]; } internal; /* * KVM_INTERNAL_ERROR_EMULATION * * "struct emulation_failure" is an overlay of "struct internal" * that is used for the KVM_INTERNAL_ERROR_EMULATION sub-type of * KVM_EXIT_INTERNAL_ERROR. Note, unlike other internal error * sub-types, this struct is ABI! It also needs to be backwards * compatible with "struct internal". Take special care that * "ndata" is correct, that new fields are enumerated in "flags", * and that each flag enumerates fields that are 64-bit aligned * and sized (so that ndata+internal.data[] is valid/accurate). * * Space beyond the defined fields may be used to store arbitrary * debug information relating to the emulation failure. It is * accounted for in "ndata" but the format is unspecified and is * not represented in "flags". Any such information is *not* ABI! */ struct { __u32 suberror; __u32 ndata; __u64 flags; union { struct { __u8 insn_size; __u8 insn_bytes[15]; }; }; /* Arbitrary debug data may follow. */ } emulation_failure; /* KVM_EXIT_OSI */ struct { __u64 gprs[32]; } osi; /* KVM_EXIT_PAPR_HCALL */ struct { __u64 nr; __u64 ret; __u64 args[9]; } papr_hcall; /* KVM_EXIT_S390_TSCH */ struct { __u16 subchannel_id; __u16 subchannel_nr; __u32 io_int_parm; __u32 io_int_word; __u32 ipb; __u8 dequeued; } s390_tsch; /* KVM_EXIT_EPR */ struct { __u32 epr; } epr; /* KVM_EXIT_SYSTEM_EVENT */ struct { #define KVM_SYSTEM_EVENT_SHUTDOWN 1 #define KVM_SYSTEM_EVENT_RESET 2 #define KVM_SYSTEM_EVENT_CRASH 3 __u32 type; __u64 flags; } system_event; /* KVM_EXIT_S390_STSI */ struct { __u64 addr; __u8 ar; __u8 reserved; __u8 fc; __u8 sel1; __u16 sel2; } s390_stsi; /* KVM_EXIT_IOAPIC_EOI */ struct { __u8 vector; } eoi; /* KVM_EXIT_HYPERV */ struct kvm_hyperv_exit hyperv; /* KVM_EXIT_ARM_NISV */ struct { __u64 esr_iss; __u64 fault_ipa; } arm_nisv; /* KVM_EXIT_X86_RDMSR / KVM_EXIT_X86_WRMSR */ struct { __u8 error; /* user -> kernel */ __u8 pad[7]; #define KVM_MSR_EXIT_REASON_INVAL (1 << 0) #define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1) #define KVM_MSR_EXIT_REASON_FILTER (1 << 2) __u32 reason; /* kernel -> user */ __u32 index; /* kernel -> user */ __u64 data; /* kernel <-> user */ } msr; /* KVM_EXIT_XEN */ struct kvm_xen_exit xen; /* Fix the size of the union. */ char padding[256]; }; /* 2048 is the size of the char array used to bound/pad the size * of the union that holds sync regs. */ #define SYNC_REGS_SIZE_BYTES 2048 /* * shared registers between kvm and userspace. * kvm_valid_regs specifies the register classes set by the host * kvm_dirty_regs specified the register classes dirtied by userspace * struct kvm_sync_regs is architecture specific, as well as the * bits for kvm_valid_regs and kvm_dirty_regs */ __u64 kvm_valid_regs; __u64 kvm_dirty_regs; union { struct kvm_sync_regs regs; char padding[SYNC_REGS_SIZE_BYTES]; } s; }; /* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ struct kvm_coalesced_mmio_zone { __u64 addr; __u32 size; union { __u32 pad; __u32 pio; }; }; struct kvm_coalesced_mmio { __u64 phys_addr; __u32 len; union { __u32 pad; __u32 pio; }; __u8 data[8]; }; struct kvm_coalesced_mmio_ring { __u32 first, last; struct kvm_coalesced_mmio coalesced_mmio[0]; }; #define KVM_COALESCED_MMIO_MAX \ ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / \ sizeof(struct kvm_coalesced_mmio)) /* for KVM_TRANSLATE */ struct kvm_translation { /* in */ __u64 linear_address; /* out */ __u64 physical_address; __u8 valid; __u8 writeable; __u8 usermode; __u8 pad[5]; }; /* for KVM_S390_MEM_OP */ struct kvm_s390_mem_op { /* in */ __u64 gaddr; /* the guest address */ __u64 flags; /* flags */ __u32 size; /* amount of bytes */ __u32 op; /* type of operation */ __u64 buf; /* buffer in userspace */ union { struct { __u8 ar; /* the access register number */ __u8 key; /* access key, ignored if flag unset */ }; __u32 sida_offset; /* offset into the sida */ __u8 reserved[32]; /* ignored */ }; }; /* types for kvm_s390_mem_op->op */ #define KVM_S390_MEMOP_LOGICAL_READ 0 #define KVM_S390_MEMOP_LOGICAL_WRITE 1 #define KVM_S390_MEMOP_SIDA_READ 2 #define KVM_S390_MEMOP_SIDA_WRITE 3 #define KVM_S390_MEMOP_ABSOLUTE_READ 4 #define KVM_S390_MEMOP_ABSOLUTE_WRITE 5 /* flags for kvm_s390_mem_op->flags */ #define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0) #define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1) #define KVM_S390_MEMOP_F_SKEY_PROTECTION (1ULL << 2) /* for KVM_INTERRUPT */ struct kvm_interrupt { /* in */ __u32 irq; }; /* for KVM_GET_DIRTY_LOG */ struct kvm_dirty_log { __u32 slot; __u32 padding1; union { void *dirty_bitmap; /* one bit per page */ __u64 padding2; }; }; /* for KVM_CLEAR_DIRTY_LOG */ struct kvm_clear_dirty_log { __u32 slot; __u32 num_pages; __u64 first_page; union { void *dirty_bitmap; /* one bit per page */ __u64 padding2; }; }; /* for KVM_SET_SIGNAL_MASK */ struct kvm_signal_mask { __u32 len; __u8 sigset[0]; }; /* for KVM_TPR_ACCESS_REPORTING */ struct kvm_tpr_access_ctl { __u32 enabled; __u32 flags; __u32 reserved[8]; }; /* for KVM_SET_VAPIC_ADDR */ struct kvm_vapic_addr { __u64 vapic_addr; }; /* for KVM_SET_MP_STATE */ /* not all states are valid on all architectures */ #define KVM_MP_STATE_RUNNABLE 0 #define KVM_MP_STATE_UNINITIALIZED 1 #define KVM_MP_STATE_INIT_RECEIVED 2 #define KVM_MP_STATE_HALTED 3 #define KVM_MP_STATE_SIPI_RECEIVED 4 #define KVM_MP_STATE_STOPPED 5 #define KVM_MP_STATE_CHECK_STOP 6 #define KVM_MP_STATE_OPERATING 7 #define KVM_MP_STATE_LOAD 8 #define KVM_MP_STATE_AP_RESET_HOLD 9 struct kvm_mp_state { __u32 mp_state; }; struct kvm_s390_psw { __u64 mask; __u64 addr; }; /* valid values for type in kvm_s390_interrupt */ #define KVM_S390_SIGP_STOP 0xfffe0000u #define KVM_S390_PROGRAM_INT 0xfffe0001u #define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u #define KVM_S390_RESTART 0xfffe0003u #define KVM_S390_INT_PFAULT_INIT 0xfffe0004u #define KVM_S390_INT_PFAULT_DONE 0xfffe0005u #define KVM_S390_MCHK 0xfffe1000u #define KVM_S390_INT_CLOCK_COMP 0xffff1004u #define KVM_S390_INT_CPU_TIMER 0xffff1005u #define KVM_S390_INT_VIRTIO 0xffff2603u #define KVM_S390_INT_SERVICE 0xffff2401u #define KVM_S390_INT_EMERGENCY 0xffff1201u #define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u /* Anything below 0xfffe0000u is taken by INT_IO */ #define KVM_S390_INT_IO(ai,cssid,ssid,schid) \ (((schid)) | \ ((ssid) << 16) | \ ((cssid) << 18) | \ ((ai) << 26)) #define KVM_S390_INT_IO_MIN 0x00000000u #define KVM_S390_INT_IO_MAX 0xfffdffffu #define KVM_S390_INT_IO_AI_MASK 0x04000000u struct kvm_s390_interrupt { __u32 type; __u32 parm; __u64 parm64; }; struct kvm_s390_io_info { __u16 subchannel_id; __u16 subchannel_nr; __u32 io_int_parm; __u32 io_int_word; }; struct kvm_s390_ext_info { __u32 ext_params; __u32 pad; __u64 ext_params2; }; struct kvm_s390_pgm_info { __u64 trans_exc_code; __u64 mon_code; __u64 per_address; __u32 data_exc_code; __u16 code; __u16 mon_class_nr; __u8 per_code; __u8 per_atmid; __u8 exc_access_id; __u8 per_access_id; __u8 op_access_id; #define KVM_S390_PGM_FLAGS_ILC_VALID 0x01 #define KVM_S390_PGM_FLAGS_ILC_0 0x02 #define KVM_S390_PGM_FLAGS_ILC_1 0x04 #define KVM_S390_PGM_FLAGS_ILC_MASK 0x06 #define KVM_S390_PGM_FLAGS_NO_REWIND 0x08 __u8 flags; __u8 pad[2]; }; struct kvm_s390_prefix_info { __u32 address; }; struct kvm_s390_extcall_info { __u16 code; }; struct kvm_s390_emerg_info { __u16 code; }; #define KVM_S390_STOP_FLAG_STORE_STATUS 0x01 struct kvm_s390_stop_info { __u32 flags; }; struct kvm_s390_mchk_info { __u64 cr14; __u64 mcic; __u64 failing_storage_address; __u32 ext_damage_code; __u32 pad; __u8 fixed_logout[16]; }; struct kvm_s390_irq { __u64 type; union { struct kvm_s390_io_info io; struct kvm_s390_ext_info ext; struct kvm_s390_pgm_info pgm; struct kvm_s390_emerg_info emerg; struct kvm_s390_extcall_info extcall; struct kvm_s390_prefix_info prefix; struct kvm_s390_stop_info stop; struct kvm_s390_mchk_info mchk; char reserved[64]; } u; }; struct kvm_s390_irq_state { __u64 buf; __u32 flags; /* will stay unused for compatibility reasons */ __u32 len; __u32 reserved[4]; /* will stay unused for compatibility reasons */ }; /* for KVM_SET_GUEST_DEBUG */ #define KVM_GUESTDBG_ENABLE 0x00000001 #define KVM_GUESTDBG_SINGLESTEP 0x00000002 struct kvm_guest_debug { __u32 control; __u32 pad; struct kvm_guest_debug_arch arch; }; enum { kvm_ioeventfd_flag_nr_datamatch, kvm_ioeventfd_flag_nr_pio, kvm_ioeventfd_flag_nr_deassign, kvm_ioeventfd_flag_nr_virtio_ccw_notify, kvm_ioeventfd_flag_nr_fast_mmio, kvm_ioeventfd_flag_nr_max, }; #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) #define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \ (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify) #define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1) struct kvm_ioeventfd { __u64 datamatch; __u64 addr; /* legal pio/mmio address */ __u32 len; /* 1, 2, 4, or 8 bytes; or 0 to ignore length */ __s32 fd; __u32 flags; __u8 pad[36]; }; #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) #define KVM_X86_DISABLE_EXITS_HLT (1 << 1) #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) #define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3) #define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ KVM_X86_DISABLE_EXITS_HLT | \ KVM_X86_DISABLE_EXITS_PAUSE | \ KVM_X86_DISABLE_EXITS_CSTATE) /* for KVM_ENABLE_CAP */ struct kvm_enable_cap { /* in */ __u32 cap; __u32 flags; __u64 args[4]; __u8 pad[64]; }; /* for KVM_PPC_GET_PVINFO */ #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) struct kvm_ppc_pvinfo { /* out */ __u32 flags; __u32 hcall[4]; __u8 pad[108]; }; /* for KVM_PPC_GET_SMMU_INFO */ #define KVM_PPC_PAGE_SIZES_MAX_SZ 8 struct kvm_ppc_one_page_size { __u32 page_shift; /* Page shift (or 0) */ __u32 pte_enc; /* Encoding in the HPTE (>>12) */ }; struct kvm_ppc_one_seg_page_size { __u32 page_shift; /* Base page shift of segment (or 0) */ __u32 slb_enc; /* SLB encoding for BookS */ struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ]; }; #define KVM_PPC_PAGE_SIZES_REAL 0x00000001 #define KVM_PPC_1T_SEGMENTS 0x00000002 #define KVM_PPC_NO_HASH 0x00000004 struct kvm_ppc_smmu_info { __u64 flags; __u32 slb_size; __u16 data_keys; /* # storage keys supported for data */ __u16 instr_keys; /* # storage keys supported for instructions */ struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; }; /* for KVM_PPC_RESIZE_HPT_{PREPARE,COMMIT} */ struct kvm_ppc_resize_hpt { __u64 flags; __u32 shift; __u32 pad; }; #define KVMIO 0xAE /* machine type bits, to be used as argument to KVM_CREATE_VM */ #define KVM_VM_S390_UCONTROL 1 /* on ppc, 0 indicate default, 1 should force HV and 2 PR */ #define KVM_VM_PPC_HV 1 #define KVM_VM_PPC_PR 2 /* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */ #define KVM_VM_MIPS_TE 0 #define KVM_VM_MIPS_VZ 1 #define KVM_S390_SIE_PAGE_OFFSET 1 /* * On arm64, machine type can be used to request the physical * address size for the VM. Bits[7-0] are reserved for the guest * PA size shift (i.e, log2(PA_Size)). For backward compatibility, * value 0 implies the default IPA size, 40bits. */ #define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL #define KVM_VM_TYPE_ARM_IPA_SIZE(x) \ ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK) /* * ioctls for /dev/kvm fds: */ #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) #define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) #define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06) /* * Check if a kvm extension is available. Argument is extension number, * return is 1 (yes) or 0 (no, sorry). */ #define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03) /* * Get size for mmap(vcpu_fd) */ #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) #define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 #define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 #define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 #define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2) #define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list) /* * Extension capability list. */ #define KVM_CAP_IRQCHIP 0 #define KVM_CAP_HLT 1 #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 #define KVM_CAP_USER_MEMORY 3 #define KVM_CAP_SET_TSS_ADDR 4 #define KVM_CAP_VAPIC 6 #define KVM_CAP_EXT_CPUID 7 #define KVM_CAP_CLOCKSOURCE 8 #define KVM_CAP_NR_VCPUS 9 /* returns recommended max vcpus per vm */ #define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */ #define KVM_CAP_PIT 11 #define KVM_CAP_NOP_IO_DELAY 12 #define KVM_CAP_PV_MMU 13 #define KVM_CAP_MP_STATE 14 #define KVM_CAP_COALESCED_MMIO 15 #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ #define KVM_CAP_IOMMU 18 /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 #define KVM_CAP_USER_NMI 22 #ifdef __KVM_HAVE_GUEST_DEBUG #define KVM_CAP_SET_GUEST_DEBUG 23 #endif #ifdef __KVM_HAVE_PIT #define KVM_CAP_REINJECT_CONTROL 24 #endif #define KVM_CAP_IRQ_ROUTING 25 #define KVM_CAP_IRQ_INJECT_STATUS 26 #define KVM_CAP_ASSIGN_DEV_IRQ 29 /* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ #define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 #ifdef __KVM_HAVE_MCE #define KVM_CAP_MCE 31 #endif #define KVM_CAP_IRQFD 32 #ifdef __KVM_HAVE_PIT #define KVM_CAP_PIT2 33 #endif #define KVM_CAP_SET_BOOT_CPU_ID 34 #ifdef __KVM_HAVE_PIT_STATE2 #define KVM_CAP_PIT_STATE2 35 #endif #define KVM_CAP_IOEVENTFD 36 #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37 #ifdef __KVM_HAVE_XEN_HVM #define KVM_CAP_XEN_HVM 38 #endif #define KVM_CAP_ADJUST_CLOCK 39 #define KVM_CAP_INTERNAL_ERROR_DATA 40 #ifdef __KVM_HAVE_VCPU_EVENTS #define KVM_CAP_VCPU_EVENTS 41 #endif #define KVM_CAP_S390_PSW 42 #define KVM_CAP_PPC_SEGSTATE 43 #define KVM_CAP_HYPERV 44 #define KVM_CAP_HYPERV_VAPIC 45 #define KVM_CAP_HYPERV_SPIN 46 #define KVM_CAP_PCI_SEGMENT 47 #define KVM_CAP_PPC_PAIRED_SINGLES 48 #define KVM_CAP_INTR_SHADOW 49 #ifdef __KVM_HAVE_DEBUGREGS #define KVM_CAP_DEBUGREGS 50 #endif #define KVM_CAP_X86_ROBUST_SINGLESTEP 51 #define KVM_CAP_PPC_OSI 52 #define KVM_CAP_PPC_UNSET_IRQ 53 #define KVM_CAP_ENABLE_CAP 54 #ifdef __KVM_HAVE_XSAVE #define KVM_CAP_XSAVE 55 #endif #ifdef __KVM_HAVE_XCRS #define KVM_CAP_XCRS 56 #endif #define KVM_CAP_PPC_GET_PVINFO 57 #define KVM_CAP_PPC_IRQ_LEVEL 58 #define KVM_CAP_ASYNC_PF 59 #define KVM_CAP_TSC_CONTROL 60 #define KVM_CAP_GET_TSC_KHZ 61 #define KVM_CAP_PPC_BOOKE_SREGS 62 #define KVM_CAP_SPAPR_TCE 63 #define KVM_CAP_PPC_SMT 64 #define KVM_CAP_PPC_RMA 65 #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ #define KVM_CAP_PPC_HIOR 67 #define KVM_CAP_PPC_PAPR 68 #define KVM_CAP_SW_TLB 69 #define KVM_CAP_ONE_REG 70 #define KVM_CAP_S390_GMAP 71 #define KVM_CAP_TSC_DEADLINE_TIMER 72 #define KVM_CAP_S390_UCONTROL 73 #define KVM_CAP_SYNC_REGS 74 #define KVM_CAP_PCI_2_3 75 #define KVM_CAP_KVMCLOCK_CTRL 76 #define KVM_CAP_SIGNAL_MSI 77 #define KVM_CAP_PPC_GET_SMMU_INFO 78 #define KVM_CAP_S390_COW 79 #define KVM_CAP_PPC_ALLOC_HTAB 80 #define KVM_CAP_READONLY_MEM 81 #define KVM_CAP_IRQFD_RESAMPLE 82 #define KVM_CAP_PPC_BOOKE_WATCHDOG 83 #define KVM_CAP_PPC_HTAB_FD 84 #define KVM_CAP_S390_CSS_SUPPORT 85 #define KVM_CAP_PPC_EPR 86 #define KVM_CAP_ARM_PSCI 87 #define KVM_CAP_ARM_SET_DEVICE_ADDR 88 #define KVM_CAP_DEVICE_CTRL 89 #define KVM_CAP_IRQ_MPIC 90 #define KVM_CAP_PPC_RTAS 91 #define KVM_CAP_IRQ_XICS 92 #define KVM_CAP_ARM_EL1_32BIT 93 #define KVM_CAP_SPAPR_MULTITCE 94 #define KVM_CAP_EXT_EMUL_CPUID 95 #define KVM_CAP_HYPERV_TIME 96 #define KVM_CAP_IOAPIC_POLARITY_IGNORED 97 #define KVM_CAP_ENABLE_CAP_VM 98 #define KVM_CAP_S390_IRQCHIP 99 #define KVM_CAP_IOEVENTFD_NO_LENGTH 100 #define KVM_CAP_VM_ATTRIBUTES 101 #define KVM_CAP_ARM_PSCI_0_2 102 #define KVM_CAP_PPC_FIXUP_HCALL 103 #define KVM_CAP_PPC_ENABLE_HCALL 104 #define KVM_CAP_CHECK_EXTENSION_VM 105 #define KVM_CAP_S390_USER_SIGP 106 #define KVM_CAP_S390_VECTOR_REGISTERS 107 #define KVM_CAP_S390_MEM_OP 108 #define KVM_CAP_S390_USER_STSI 109 #define KVM_CAP_S390_SKEYS 110 #define KVM_CAP_MIPS_FPU 111 #define KVM_CAP_MIPS_MSA 112 #define KVM_CAP_S390_INJECT_IRQ 113 #define KVM_CAP_S390_IRQ_STATE 114 #define KVM_CAP_PPC_HWRNG 115 #define KVM_CAP_DISABLE_QUIRKS 116 #define KVM_CAP_X86_SMM 117 #define KVM_CAP_MULTI_ADDRESS_SPACE 118 #define KVM_CAP_GUEST_DEBUG_HW_BPS 119 #define KVM_CAP_GUEST_DEBUG_HW_WPS 120 #define KVM_CAP_SPLIT_IRQCHIP 121 #define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 #define KVM_CAP_HYPERV_SYNIC 123 #define KVM_CAP_S390_RI 124 #define KVM_CAP_SPAPR_TCE_64 125 #define KVM_CAP_ARM_PMU_V3 126 #define KVM_CAP_VCPU_ATTRIBUTES 127 #define KVM_CAP_MAX_VCPU_ID 128 #define KVM_CAP_X2APIC_API 129 #define KVM_CAP_S390_USER_INSTR0 130 #define KVM_CAP_MSI_DEVID 131 #define KVM_CAP_PPC_HTM 132 #define KVM_CAP_SPAPR_RESIZE_HPT 133 #define KVM_CAP_PPC_MMU_RADIX 134 #define KVM_CAP_PPC_MMU_HASH_V3 135 #define KVM_CAP_IMMEDIATE_EXIT 136 #define KVM_CAP_MIPS_VZ 137 #define KVM_CAP_MIPS_TE 138 #define KVM_CAP_MIPS_64BIT 139 #define KVM_CAP_S390_GS 140 #define KVM_CAP_S390_AIS 141 #define KVM_CAP_SPAPR_TCE_VFIO 142 #define KVM_CAP_X86_DISABLE_EXITS 143 #define KVM_CAP_ARM_USER_IRQ 144 #define KVM_CAP_S390_CMMA_MIGRATION 145 #define KVM_CAP_PPC_FWNMI 146 #define KVM_CAP_PPC_SMT_POSSIBLE 147 #define KVM_CAP_HYPERV_SYNIC2 148 #define KVM_CAP_HYPERV_VP_INDEX 149 #define KVM_CAP_S390_AIS_MIGRATION 150 #define KVM_CAP_PPC_GET_CPU_CHAR 151 #define KVM_CAP_S390_BPB 152 #define KVM_CAP_GET_MSR_FEATURES 153 #define KVM_CAP_HYPERV_EVENTFD 154 #define KVM_CAP_HYPERV_TLBFLUSH 155 #define KVM_CAP_S390_HPAGE_1M 156 #define KVM_CAP_NESTED_STATE 157 #define KVM_CAP_ARM_INJECT_SERROR_ESR 158 #define KVM_CAP_MSR_PLATFORM_INFO 159 #define KVM_CAP_PPC_NESTED_HV 160 #define KVM_CAP_HYPERV_SEND_IPI 161 #define KVM_CAP_COALESCED_PIO 162 #define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163 #define KVM_CAP_EXCEPTION_PAYLOAD 164 #define KVM_CAP_ARM_VM_IPA_SIZE 165 #define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 /* Obsolete */ #define KVM_CAP_HYPERV_CPUID 167 #define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168 #define KVM_CAP_PPC_IRQ_XIVE 169 #define KVM_CAP_ARM_SVE 170 #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 #define KVM_CAP_PMU_EVENT_FILTER 173 #define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174 #define KVM_CAP_HYPERV_DIRECT_TLBFLUSH 175 #define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176 #define KVM_CAP_ARM_NISV_TO_USER 177 #define KVM_CAP_ARM_INJECT_EXT_DABT 178 #define KVM_CAP_S390_VCPU_RESETS 179 #define KVM_CAP_S390_PROTECTED 180 #define KVM_CAP_PPC_SECURE_GUEST 181 #define KVM_CAP_HALT_POLL 182 #define KVM_CAP_ASYNC_PF_INT 183 #define KVM_CAP_LAST_CPU 184 #define KVM_CAP_SMALLER_MAXPHYADDR 185 #define KVM_CAP_S390_DIAG318 186 #define KVM_CAP_STEAL_TIME 187 #define KVM_CAP_X86_USER_SPACE_MSR 188 #define KVM_CAP_X86_MSR_FILTER 189 #define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190 #define KVM_CAP_SYS_HYPERV_CPUID 191 #define KVM_CAP_DIRTY_LOG_RING 192 #define KVM_CAP_X86_BUS_LOCK_EXIT 193 #define KVM_CAP_SET_GUEST_DEBUG2 195 #define KVM_CAP_SGX_ATTRIBUTE 196 #define KVM_CAP_VM_COPY_ENC_CONTEXT_FROM 197 #define KVM_CAP_HYPERV_ENFORCE_CPUID 199 #define KVM_CAP_SREGS2 200 #define KVM_CAP_EXIT_HYPERCALL 201 #define KVM_CAP_BINARY_STATS_FD 203 #define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204 #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206 #define KVM_CAP_XSAVE2 208 #define KVM_CAP_SYS_ATTRIBUTES 209 #define KVM_CAP_S390_MEM_OP_EXTENSION 211 #define KVM_CAP_PMU_CAPABILITY 212 #define KVM_CAP_DISABLE_QUIRKS2 213 #define KVM_CAP_VM_TSC_CONTROL 214 #define KVM_CAP_SYSTEM_EVENT_DATA 215 #define KVM_CAP_ARM_SYSTEM_SUSPEND 216 #define KVM_CAP_S390_PROTECTED_DUMP 217 #define KVM_CAP_S390_ZPCI_OP 221 #define KVM_CAP_S390_CPU_TOPOLOGY 222 #ifdef KVM_CAP_IRQ_ROUTING struct kvm_irq_routing_irqchip { __u32 irqchip; __u32 pin; }; struct kvm_irq_routing_msi { __u32 address_lo; __u32 address_hi; __u32 data; union { __u32 pad; __u32 devid; }; }; struct kvm_irq_routing_s390_adapter { __u64 ind_addr; __u64 summary_addr; __u64 ind_offset; __u32 summary_offset; __u32 adapter_id; }; struct kvm_irq_routing_hv_sint { __u32 vcpu; __u32 sint; }; struct kvm_irq_routing_xen_evtchn { __u32 port; __u32 vcpu; __u32 priority; }; #define KVM_IRQ_ROUTING_XEN_EVTCHN_PRIO_2LEVEL ((__u32)(-1)) /* gsi routing entry types */ #define KVM_IRQ_ROUTING_IRQCHIP 1 #define KVM_IRQ_ROUTING_MSI 2 #define KVM_IRQ_ROUTING_S390_ADAPTER 3 #define KVM_IRQ_ROUTING_HV_SINT 4 #define KVM_IRQ_ROUTING_XEN_EVTCHN 5 struct kvm_irq_routing_entry { __u32 gsi; __u32 type; __u32 flags; __u32 pad; union { struct kvm_irq_routing_irqchip irqchip; struct kvm_irq_routing_msi msi; struct kvm_irq_routing_s390_adapter adapter; struct kvm_irq_routing_hv_sint hv_sint; struct kvm_irq_routing_xen_evtchn xen_evtchn; __u32 pad[8]; } u; }; struct kvm_irq_routing { __u32 nr; __u32 flags; struct kvm_irq_routing_entry entries[0]; }; #endif #ifdef KVM_CAP_MCE /* x86 MCE */ struct kvm_x86_mce { __u64 status; __u64 addr; __u64 misc; __u64 mcg_status; __u8 bank; __u8 pad1[7]; __u64 pad2[3]; }; #endif #ifdef KVM_CAP_XEN_HVM #define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR (1 << 0) #define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1) #define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2) #define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3) #define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4) struct kvm_xen_hvm_config { __u32 flags; __u32 msr; __u64 blob_addr_32; __u64 blob_addr_64; __u8 blob_size_32; __u8 blob_size_64; __u8 pad2[30]; }; #endif #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) /* * Available with KVM_CAP_IRQFD_RESAMPLE * * KVM_IRQFD_FLAG_RESAMPLE indicates resamplefd is valid and specifies * the irqfd to operate in resampling mode for level triggered interrupt * emulation. See Documentation/virt/kvm/api.rst. */ #define KVM_IRQFD_FLAG_RESAMPLE (1 << 1) struct kvm_irqfd { __u32 fd; __u32 gsi; __u32 flags; __u32 resamplefd; __u8 pad[16]; }; /* For KVM_CAP_ADJUST_CLOCK */ /* Do not use 1, KVM_CHECK_EXTENSION returned it before we had flags. */ #define KVM_CLOCK_TSC_STABLE 2 #define KVM_CLOCK_REALTIME (1 << 2) #define KVM_CLOCK_HOST_TSC (1 << 3) struct kvm_clock_data { __u64 clock; __u32 flags; __u32 pad0; __u64 realtime; __u64 host_tsc; __u32 pad[4]; }; /* For KVM_CAP_SW_TLB */ #define KVM_MMU_FSL_BOOKE_NOHV 0 #define KVM_MMU_FSL_BOOKE_HV 1 struct kvm_config_tlb { __u64 params; __u64 array; __u32 mmu_type; __u32 array_len; }; struct kvm_dirty_tlb { __u64 bitmap; __u32 num_dirty; }; /* Available with KVM_CAP_ONE_REG */ #define KVM_REG_ARCH_MASK 0xff00000000000000ULL #define KVM_REG_GENERIC 0x0000000000000000ULL /* * Architecture specific registers are to be defined in arch headers and * ORed with the arch identifier. */ #define KVM_REG_PPC 0x1000000000000000ULL #define KVM_REG_X86 0x2000000000000000ULL #define KVM_REG_IA64 0x3000000000000000ULL #define KVM_REG_ARM 0x4000000000000000ULL #define KVM_REG_S390 0x5000000000000000ULL #define KVM_REG_ARM64 0x6000000000000000ULL #define KVM_REG_MIPS 0x7000000000000000ULL #define KVM_REG_SIZE_SHIFT 52 #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL #define KVM_REG_SIZE_U8 0x0000000000000000ULL #define KVM_REG_SIZE_U16 0x0010000000000000ULL #define KVM_REG_SIZE_U32 0x0020000000000000ULL #define KVM_REG_SIZE_U64 0x0030000000000000ULL #define KVM_REG_SIZE_U128 0x0040000000000000ULL #define KVM_REG_SIZE_U256 0x0050000000000000ULL #define KVM_REG_SIZE_U512 0x0060000000000000ULL #define KVM_REG_SIZE_U1024 0x0070000000000000ULL #define KVM_REG_SIZE_U2048 0x0080000000000000ULL struct kvm_reg_list { __u64 n; /* number of regs */ __u64 reg[0]; }; struct kvm_one_reg { __u64 id; __u64 addr; }; #define KVM_MSI_VALID_DEVID (1U << 0) struct kvm_msi { __u32 address_lo; __u32 address_hi; __u32 data; __u32 flags; __u32 devid; __u8 pad[12]; }; struct kvm_arm_device_addr { __u64 id; __u64 addr; }; /* * Device control API, available with KVM_CAP_DEVICE_CTRL */ #define KVM_CREATE_DEVICE_TEST 1 struct kvm_create_device { __u32 type; /* in: KVM_DEV_TYPE_xxx */ __u32 fd; /* out: device handle */ __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */ }; struct kvm_device_attr { __u32 flags; /* no flags currently defined */ __u32 group; /* device-defined */ __u64 attr; /* group-defined */ __u64 addr; /* userspace address of attr data */ }; #define KVM_DEV_VFIO_GROUP 1 #define KVM_DEV_VFIO_GROUP_ADD 1 #define KVM_DEV_VFIO_GROUP_DEL 2 #define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3 enum kvm_device_type { KVM_DEV_TYPE_FSL_MPIC_20 = 1, #define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_42, #define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_XICS, #define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS KVM_DEV_TYPE_VFIO, #define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_ARM_VGIC_V2, #define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_FLIC, #define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_ARM_VGIC_V3, #define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_ITS, #define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_XIVE, #define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_ARM_PV_TIME, #define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_MAX, }; struct kvm_vfio_spapr_tce { __s32 groupfd; __s32 tablefd; }; /* * ioctls for VM fds */ #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) /* * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns * a vcpu fd. */ #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) /* KVM_SET_MEMORY_ALIAS is obsolete: */ #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ struct kvm_userspace_memory_region) #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) /* enable ucontrol for s390 */ struct kvm_s390_ucas_mapping { __u64 user_addr; __u64 vcpu_addr; __u64 length; }; #define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping) #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping) #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long) /* Device model IOC */ #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) #define KVM_CREATE_PIT _IO(KVMIO, 0x64) #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) #define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level) #define KVM_REGISTER_COALESCED_MMIO \ _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) #define KVM_UNREGISTER_COALESCED_MMIO \ _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ struct kvm_assigned_pci_dev) #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) /* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ #define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70 #define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ struct kvm_assigned_pci_dev) #define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \ struct kvm_assigned_msix_nr) #define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \ struct kvm_assigned_msix_entry) #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd) #define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config) #define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data) #define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data) /* Available with KVM_CAP_PIT_STATE2 */ #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) /* Available with KVM_CAP_PPC_GET_PVINFO */ #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo) /* Available with KVM_CAP_TSC_CONTROL */ #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) /* Available with KVM_CAP_PCI_2_3 */ #define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \ struct kvm_assigned_pci_dev) /* Available with KVM_CAP_SIGNAL_MSI */ #define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi) /* Available with KVM_CAP_PPC_GET_SMMU_INFO */ #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) /* Available with KVM_CAP_PPC_ALLOC_HTAB */ #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) #define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, \ struct kvm_create_spapr_tce_64) /* Available with KVM_CAP_RMA */ #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) /* Available with KVM_CAP_PPC_HTAB_FD */ #define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd) /* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */ #define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr) /* Available with KVM_CAP_PPC_RTAS */ #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args) /* Available with KVM_CAP_SPAPR_RESIZE_HPT */ #define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt) #define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt) /* Available with KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 */ #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg) /* Available with KVM_CAP_PPC_RADIX_MMU */ #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) /* Available with KVM_CAP_PPC_GET_CPU_CHAR */ #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) /* Available with KVM_CAP_PMU_EVENT_FILTER */ #define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter) #define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3) /* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) /* ioctls for fds returned by KVM_CREATE_DEVICE */ #define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr) #define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr) #define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr) /* * ioctls for vcpu fds */ #define KVM_RUN _IO(KVMIO, 0x80) #define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs) #define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs) #define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs) #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) /* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */ #define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87 #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) #define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask) #define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu) #define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) #define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) #define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) #define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2) #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2) /* Available with KVM_CAP_VAPIC */ #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) /* Available with KVM_CAP_VAPIC */ #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) /* valid for virtual machine (for floating interrupt)_and_ vcpu */ #define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt) /* store status for s390 */ #define KVM_S390_STORE_STATUS_NOADDR (-1ul) #define KVM_S390_STORE_STATUS_PREFIXED (-2ul) #define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long) /* initial ipl psw for s390 */ #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) /* initial reset for s390 */ #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) /* Available with KVM_CAP_USER_NMI */ #define KVM_NMI _IO(KVMIO, 0x9a) /* Available with KVM_CAP_SET_GUEST_DEBUG */ #define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) /* MCE for x86 */ #define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64) #define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64) #define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) /* Available with KVM_CAP_VCPU_EVENTS */ #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) #define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) /* Available with KVM_CAP_DEBUGREGS */ #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) /* * vcpu version available with KVM_ENABLE_CAP * vm version available with KVM_CAP_ENABLE_CAP_VM */ #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) /* Available with KVM_CAP_XSAVE */ #define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave) #define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave) /* Available with KVM_CAP_XCRS */ #define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) #define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) /* Available with KVM_CAP_SW_TLB */ #define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb) /* Available with KVM_CAP_ONE_REG */ #define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg) #define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) /* VM is being stopped by host */ #define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) #define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) #define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init) #define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) /* Available with KVM_CAP_S390_MEM_OP */ #define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op) /* Available with KVM_CAP_S390_SKEYS */ #define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys) #define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys) /* Available with KVM_CAP_S390_INJECT_IRQ */ #define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq) /* Available with KVM_CAP_S390_IRQ_STATE */ #define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state) #define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state) /* Available with KVM_CAP_X86_SMM */ #define KVM_SMI _IO(KVMIO, 0xb7) /* Available with KVM_CAP_S390_CMMA_MIGRATION */ #define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log) #define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log) /* Memory Encryption Commands */ #define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long) struct kvm_enc_region { __u64 addr; __u64 size; }; #define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region) #define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region) /* Available with KVM_CAP_HYPERV_EVENTFD */ #define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd) /* Available with KVM_CAP_NESTED_STATE */ #define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state) #define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state) /* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT_2 */ #define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log) /* Available with KVM_CAP_HYPERV_CPUID (vcpu) / KVM_CAP_SYS_HYPERV_CPUID (system) */ #define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2) /* Available with KVM_CAP_ARM_SVE */ #define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int) /* Available with KVM_CAP_S390_VCPU_RESETS */ #define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3) #define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4) struct kvm_s390_pv_sec_parm { __u64 origin; __u64 length; }; struct kvm_s390_pv_unp { __u64 addr; __u64 size; __u64 tweak; }; enum pv_cmd_dmp_id { KVM_PV_DUMP_INIT, KVM_PV_DUMP_CONFIG_STOR_STATE, KVM_PV_DUMP_COMPLETE, KVM_PV_DUMP_CPU, }; struct kvm_s390_pv_dmp { __u64 subcmd; __u64 buff_addr; __u64 buff_len; __u64 gaddr; /* For dump storage state */ __u64 reserved[4]; }; enum pv_cmd_info_id { KVM_PV_INFO_VM, KVM_PV_INFO_DUMP, }; struct kvm_s390_pv_info_dump { __u64 dump_cpu_buffer_len; __u64 dump_config_mem_buffer_per_1m; __u64 dump_config_finalize_len; }; struct kvm_s390_pv_info_vm { __u64 inst_calls_list[4]; __u64 max_cpus; __u64 max_guests; __u64 max_guest_addr; __u64 feature_indication; }; struct kvm_s390_pv_info_header { __u32 id; __u32 len_max; __u32 len_written; __u32 reserved; }; struct kvm_s390_pv_info { struct kvm_s390_pv_info_header header; union { struct kvm_s390_pv_info_dump dump; struct kvm_s390_pv_info_vm vm; }; }; enum pv_cmd_id { KVM_PV_ENABLE, KVM_PV_DISABLE, KVM_PV_SET_SEC_PARMS, KVM_PV_UNPACK, KVM_PV_VERIFY, KVM_PV_PREP_RESET, KVM_PV_UNSHARE_ALL, KVM_PV_INFO, KVM_PV_DUMP, }; struct kvm_pv_cmd { __u32 cmd; /* Command to be executed */ __u16 rc; /* Ultravisor return code */ __u16 rrc; /* Ultravisor return reason code */ __u64 data; /* Data or address */ __u32 flags; /* flags for future extensions. Must be 0 for now */ __u32 reserved[3]; }; /* Available with KVM_CAP_S390_PROTECTED */ #define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd) /* Available with KVM_CAP_X86_MSR_FILTER */ #define KVM_X86_SET_MSR_FILTER _IOW(KVMIO, 0xc6, struct kvm_msr_filter) /* Available with KVM_CAP_DIRTY_LOG_RING */ #define KVM_RESET_DIRTY_RINGS _IO(KVMIO, 0xc7) /* Per-VM Xen attributes */ #define KVM_XEN_HVM_GET_ATTR _IOWR(KVMIO, 0xc8, struct kvm_xen_hvm_attr) #define KVM_XEN_HVM_SET_ATTR _IOW(KVMIO, 0xc9, struct kvm_xen_hvm_attr) struct kvm_xen_hvm_attr { __u16 type; __u16 pad[3]; union { __u8 long_mode; __u8 vector; struct { __u64 gfn; } shared_info; __u64 pad[8]; } u; }; /* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO */ #define KVM_XEN_ATTR_TYPE_LONG_MODE 0x0 #define KVM_XEN_ATTR_TYPE_SHARED_INFO 0x1 #define KVM_XEN_ATTR_TYPE_UPCALL_VECTOR 0x2 /* Per-vCPU Xen attributes */ #define KVM_XEN_VCPU_GET_ATTR _IOWR(KVMIO, 0xca, struct kvm_xen_vcpu_attr) #define KVM_XEN_VCPU_SET_ATTR _IOW(KVMIO, 0xcb, struct kvm_xen_vcpu_attr) #define KVM_GET_SREGS2 _IOR(KVMIO, 0xcc, struct kvm_sregs2) #define KVM_SET_SREGS2 _IOW(KVMIO, 0xcd, struct kvm_sregs2) struct kvm_xen_vcpu_attr { __u16 type; __u16 pad[3]; union { __u64 gpa; __u64 pad[8]; struct { __u64 state; __u64 state_entry_time; __u64 time_running; __u64 time_runnable; __u64 time_blocked; __u64 time_offline; } runstate; } u; }; /* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO */ #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO 0x0 #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO 0x1 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR 0x2 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 0x3 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 0x4 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 0x5 /* Secure Encrypted Virtualization command */ enum sev_cmd_id { /* Guest initialization commands */ KVM_SEV_INIT = 0, KVM_SEV_ES_INIT, /* Guest launch commands */ KVM_SEV_LAUNCH_START, KVM_SEV_LAUNCH_UPDATE_DATA, KVM_SEV_LAUNCH_UPDATE_VMSA, KVM_SEV_LAUNCH_SECRET, KVM_SEV_LAUNCH_MEASURE, KVM_SEV_LAUNCH_FINISH, /* Guest migration commands (outgoing) */ KVM_SEV_SEND_START, KVM_SEV_SEND_UPDATE_DATA, KVM_SEV_SEND_UPDATE_VMSA, KVM_SEV_SEND_FINISH, /* Guest migration commands (incoming) */ KVM_SEV_RECEIVE_START, KVM_SEV_RECEIVE_UPDATE_DATA, KVM_SEV_RECEIVE_UPDATE_VMSA, KVM_SEV_RECEIVE_FINISH, /* Guest status and debug commands */ KVM_SEV_GUEST_STATUS, KVM_SEV_DBG_DECRYPT, KVM_SEV_DBG_ENCRYPT, /* Guest certificates commands */ KVM_SEV_CERT_EXPORT, /* Attestation report */ KVM_SEV_GET_ATTESTATION_REPORT, /* Guest Migration Extension */ KVM_SEV_SEND_CANCEL, KVM_SEV_NR_MAX, }; struct kvm_sev_cmd { __u32 id; __u64 data; __u32 error; __u32 sev_fd; }; struct kvm_sev_launch_start { __u32 handle; __u32 policy; __u64 dh_uaddr; __u32 dh_len; __u64 session_uaddr; __u32 session_len; }; struct kvm_sev_launch_update_data { __u64 uaddr; __u32 len; }; struct kvm_sev_launch_secret { __u64 hdr_uaddr; __u32 hdr_len; __u64 guest_uaddr; __u32 guest_len; __u64 trans_uaddr; __u32 trans_len; }; struct kvm_sev_launch_measure { __u64 uaddr; __u32 len; }; struct kvm_sev_guest_status { __u32 handle; __u32 policy; __u32 state; }; struct kvm_sev_dbg { __u64 src_uaddr; __u64 dst_uaddr; __u32 len; }; struct kvm_sev_attestation_report { __u8 mnonce[16]; __u64 uaddr; __u32 len; }; struct kvm_sev_send_start { __u32 policy; __u64 pdh_cert_uaddr; __u32 pdh_cert_len; __u64 plat_certs_uaddr; __u32 plat_certs_len; __u64 amd_certs_uaddr; __u32 amd_certs_len; __u64 session_uaddr; __u32 session_len; }; struct kvm_sev_send_update_data { __u64 hdr_uaddr; __u32 hdr_len; __u64 guest_uaddr; __u32 guest_len; __u64 trans_uaddr; __u32 trans_len; }; struct kvm_sev_receive_start { __u32 handle; __u32 policy; __u64 pdh_uaddr; __u32 pdh_len; __u64 session_uaddr; __u32 session_len; }; struct kvm_sev_receive_update_data { __u64 hdr_uaddr; __u32 hdr_len; __u64 guest_uaddr; __u32 guest_len; __u64 trans_uaddr; __u32 trans_len; }; #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) #define KVM_DEV_ASSIGN_MASK_INTX (1 << 2) struct kvm_assigned_pci_dev { __u32 assigned_dev_id; __u32 busnr; __u32 devfn; __u32 flags; __u32 segnr; union { __u32 reserved[11]; }; }; #define KVM_DEV_IRQ_HOST_INTX (1 << 0) #define KVM_DEV_IRQ_HOST_MSI (1 << 1) #define KVM_DEV_IRQ_HOST_MSIX (1 << 2) #define KVM_DEV_IRQ_GUEST_INTX (1 << 8) #define KVM_DEV_IRQ_GUEST_MSI (1 << 9) #define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) #define KVM_DEV_IRQ_HOST_MASK 0x00ff #define KVM_DEV_IRQ_GUEST_MASK 0xff00 struct kvm_assigned_irq { __u32 assigned_dev_id; __u32 host_irq; /* ignored (legacy field) */ __u32 guest_irq; __u32 flags; union { __u32 reserved[12]; }; }; struct kvm_assigned_msix_nr { __u32 assigned_dev_id; __u16 entry_nr; __u16 padding; }; #define KVM_MAX_MSIX_PER_DEV 256 struct kvm_assigned_msix_entry { __u32 assigned_dev_id; __u32 gsi; __u16 entry; /* The index of entry in the MSI-X table */ __u16 padding[3]; }; #define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0) #define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1) /* Available with KVM_CAP_ARM_USER_IRQ */ /* Bits for run->s.regs.device_irq_level */ #define KVM_ARM_DEV_EL1_VTIMER (1 << 0) #define KVM_ARM_DEV_EL1_PTIMER (1 << 1) #define KVM_ARM_DEV_PMU (1 << 2) struct kvm_hyperv_eventfd { __u32 conn_id; __s32 fd; __u32 flags; __u32 padding[3]; }; #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) #define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0) #define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1) /* * Arch needs to define the macro after implementing the dirty ring * feature. KVM_DIRTY_LOG_PAGE_OFFSET should be defined as the * starting page offset of the dirty ring structures. */ #ifndef KVM_DIRTY_LOG_PAGE_OFFSET #define KVM_DIRTY_LOG_PAGE_OFFSET 0 #endif /* * KVM dirty GFN flags, defined as: * * |---------------+---------------+--------------| * | bit 1 (reset) | bit 0 (dirty) | Status | * |---------------+---------------+--------------| * | 0 | 0 | Invalid GFN | * | 0 | 1 | Dirty GFN | * | 1 | X | GFN to reset | * |---------------+---------------+--------------| * * Lifecycle of a dirty GFN goes like: * * dirtied harvested reset * 00 -----------> 01 -------------> 1X -------+ * ^ | * | | * +------------------------------------------+ * * The userspace program is only responsible for the 01->1X state * conversion after harvesting an entry. Also, it must not skip any * dirty bits, so that dirty bits are always harvested in sequence. */ #define KVM_DIRTY_GFN_F_DIRTY _BITUL(0) #define KVM_DIRTY_GFN_F_RESET _BITUL(1) #define KVM_DIRTY_GFN_F_MASK 0x3 /* * KVM dirty rings should be mapped at KVM_DIRTY_LOG_PAGE_OFFSET of * per-vcpu mmaped regions as an array of struct kvm_dirty_gfn. The * size of the gfn buffer is decided by the first argument when * enabling KVM_CAP_DIRTY_LOG_RING. */ struct kvm_dirty_gfn { __u32 flags; __u32 slot; __u64 offset; }; #define KVM_BUS_LOCK_DETECTION_OFF (1 << 0) #define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1) #define KVM_PMU_CAP_DISABLE (1 << 0) /** * struct kvm_stats_header - Header of per vm/vcpu binary statistics data. * @flags: Some extra information for header, always 0 for now. * @name_size: The size in bytes of the memory which contains statistics * name string including trailing '\0'. The memory is allocated * at the send of statistics descriptor. * @num_desc: The number of statistics the vm or vcpu has. * @id_offset: The offset of the vm/vcpu stats' id string in the file pointed * by vm/vcpu stats fd. * @desc_offset: The offset of the vm/vcpu stats' descriptor block in the file * pointd by vm/vcpu stats fd. * @data_offset: The offset of the vm/vcpu stats' data block in the file * pointed by vm/vcpu stats fd. * * This is the header userspace needs to read from stats fd before any other * readings. It is used by userspace to discover all the information about the * vm/vcpu's binary statistics. * Userspace reads this header from the start of the vm/vcpu's stats fd. */ struct kvm_stats_header { __u32 flags; __u32 name_size; __u32 num_desc; __u32 id_offset; __u32 desc_offset; __u32 data_offset; }; #define KVM_STATS_TYPE_SHIFT 0 #define KVM_STATS_TYPE_MASK (0xF << KVM_STATS_TYPE_SHIFT) #define KVM_STATS_TYPE_CUMULATIVE (0x0 << KVM_STATS_TYPE_SHIFT) #define KVM_STATS_TYPE_INSTANT (0x1 << KVM_STATS_TYPE_SHIFT) #define KVM_STATS_TYPE_PEAK (0x2 << KVM_STATS_TYPE_SHIFT) #define KVM_STATS_TYPE_LINEAR_HIST (0x3 << KVM_STATS_TYPE_SHIFT) #define KVM_STATS_TYPE_LOG_HIST (0x4 << KVM_STATS_TYPE_SHIFT) #define KVM_STATS_TYPE_MAX KVM_STATS_TYPE_LOG_HIST #define KVM_STATS_UNIT_SHIFT 4 #define KVM_STATS_UNIT_MASK (0xF << KVM_STATS_UNIT_SHIFT) #define KVM_STATS_UNIT_NONE (0x0 << KVM_STATS_UNIT_SHIFT) #define KVM_STATS_UNIT_BYTES (0x1 << KVM_STATS_UNIT_SHIFT) #define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT) #define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT) #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES #define KVM_STATS_BASE_SHIFT 8 #define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT) #define KVM_STATS_BASE_POW10 (0x0 << KVM_STATS_BASE_SHIFT) #define KVM_STATS_BASE_POW2 (0x1 << KVM_STATS_BASE_SHIFT) #define KVM_STATS_BASE_MAX KVM_STATS_BASE_POW2 /** * struct kvm_stats_desc - Descriptor of a KVM statistics. * @flags: Annotations of the stats, like type, unit, etc. * @exponent: Used together with @flags to determine the unit. * @size: The number of data items for this stats. * Every data item is of type __u64. * @offset: The offset of the stats to the start of stat structure in * structure kvm or kvm_vcpu. * @bucket_size: A parameter value used for histogram stats. It is only used * for linear histogram stats, specifying the size of the bucket; * @name: The name string for the stats. Its size is indicated by the * &kvm_stats_header->name_size. */ struct kvm_stats_desc { __u32 flags; __s16 exponent; __u16 size; __u32 offset; __u32 bucket_size; char name[]; }; #define KVM_GET_STATS_FD _IO(KVMIO, 0xce) /* Available with KVM_CAP_XSAVE2 */ #define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave) /* Available with KVM_CAP_S390_PROTECTED_DUMP */ #define KVM_S390_PV_CPU_COMMAND _IOWR(KVMIO, 0xd0, struct kvm_pv_cmd) /* Available with KVM_CAP_S390_ZPCI_OP */ #define KVM_S390_ZPCI_OP _IOW(KVMIO, 0xd1, struct kvm_s390_zpci_op) struct kvm_s390_zpci_op { /* in */ __u32 fh; /* target device */ __u8 op; /* operation to perform */ __u8 pad[3]; union { /* for KVM_S390_ZPCIOP_REG_AEN */ struct { __u64 ibv; /* Guest addr of interrupt bit vector */ __u64 sb; /* Guest addr of summary bit */ __u32 flags; __u32 noi; /* Number of interrupts */ __u8 isc; /* Guest interrupt subclass */ __u8 sbo; /* Offset of guest summary bit vector */ __u16 pad; } reg_aen; __u64 reserved[8]; } u; }; /* types for kvm_s390_zpci_op->op */ #define KVM_S390_ZPCIOP_REG_AEN 0 #define KVM_S390_ZPCIOP_DEREG_AEN 1 /* flags for kvm_s390_zpci_op->u.reg_aen.flags */ #define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0) #endif /* __LINUX_KVM_H */ linux/kvm_para.h 0000644 00000001751 15063602051 0007656 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_KVM_PARA_H #define __LINUX_KVM_PARA_H /* * This header file provides a method for making a hypercall to the host * Architectures should define: * - kvm_hypercall0, kvm_hypercall1... * - kvm_arch_para_features * - kvm_para_available */ /* Return values for hypercalls */ #define KVM_ENOSYS 1000 #define KVM_EFAULT EFAULT #define KVM_EINVAL EINVAL #define KVM_E2BIG E2BIG #define KVM_EPERM EPERM #define KVM_EOPNOTSUPP 95 #define KVM_HC_VAPIC_POLL_IRQ 1 #define KVM_HC_MMU_OP 2 #define KVM_HC_FEATURES 3 #define KVM_HC_PPC_MAP_MAGIC_PAGE 4 #define KVM_HC_KICK_CPU 5 #define KVM_HC_MIPS_GET_CLOCK_FREQ 6 #define KVM_HC_MIPS_EXIT_VM 7 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8 #define KVM_HC_CLOCK_PAIRING 9 #define KVM_HC_SEND_IPI 10 #define KVM_HC_SCHED_YIELD 11 #define KVM_HC_MAP_GPA_RANGE 12 /* * hypercalls use architecture specific */ #include <asm/kvm_para.h> #endif /* __LINUX_KVM_PARA_H */ linux/l2tp.h 0000644 00000012727 15063602051 0006744 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * L2TP-over-IP socket for L2TPv3. * * Author: James Chapman <jchapman@katalix.com> */ #ifndef _LINUX_L2TP_H_ #define _LINUX_L2TP_H_ #include <linux/types.h> #include <linux/socket.h> #include <linux/in.h> #include <linux/in6.h> /** * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets * @l2tp_family: address family number AF_L2TPIP. * @l2tp_addr: protocol specific address information * @l2tp_conn_id: connection id of tunnel */ #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ struct sockaddr_l2tpip { /* The first fields must match struct sockaddr_in */ __kernel_sa_family_t l2tp_family; /* AF_INET */ __be16 l2tp_unused; /* INET port number (unused) */ struct in_addr l2tp_addr; /* Internet address */ __u32 l2tp_conn_id; /* Connection ID of tunnel */ /* Pad to size of `struct sockaddr'. */ unsigned char __pad[__SOCK_SIZE__ - sizeof(__kernel_sa_family_t) - sizeof(__be16) - sizeof(struct in_addr) - sizeof(__u32)]; }; /** * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets * @l2tp_family: address family number AF_L2TPIP. * @l2tp_addr: protocol specific address information * @l2tp_conn_id: connection id of tunnel */ struct sockaddr_l2tpip6 { /* The first fields must match struct sockaddr_in6 */ __kernel_sa_family_t l2tp_family; /* AF_INET6 */ __be16 l2tp_unused; /* INET port number (unused) */ __be32 l2tp_flowinfo; /* IPv6 flow information */ struct in6_addr l2tp_addr; /* IPv6 address */ __u32 l2tp_scope_id; /* scope id (new in RFC2553) */ __u32 l2tp_conn_id; /* Connection ID of tunnel */ }; /***************************************************************************** * NETLINK_GENERIC netlink family. *****************************************************************************/ /* * Commands. * Valid TLVs of each command are:- * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid * TUNNEL_DELETE - CONN_ID * TUNNEL_MODIFY - CONN_ID, udpcsum * TUNNEL_GETSTATS - CONN_ID, (stats) * TUNNEL_GET - CONN_ID, (...) * SESSION_CREATE - SESSION_ID, PW_TYPE, data_seq, cookie, peer_cookie, l2spec * SESSION_DELETE - SESSION_ID * SESSION_MODIFY - SESSION_ID, data_seq * SESSION_GET - SESSION_ID, (...) * SESSION_GETSTATS - SESSION_ID, (stats) * */ enum { L2TP_CMD_NOOP, L2TP_CMD_TUNNEL_CREATE, L2TP_CMD_TUNNEL_DELETE, L2TP_CMD_TUNNEL_MODIFY, L2TP_CMD_TUNNEL_GET, L2TP_CMD_SESSION_CREATE, L2TP_CMD_SESSION_DELETE, L2TP_CMD_SESSION_MODIFY, L2TP_CMD_SESSION_GET, __L2TP_CMD_MAX, }; #define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1) /* * ATTR types defined for L2TP */ enum { L2TP_ATTR_NONE, /* no data */ L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ L2TP_ATTR_OFFSET, /* u16 (not used) */ L2TP_ATTR_DATA_SEQ, /* u16 */ L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ L2TP_ATTR_L2SPEC_LEN, /* u8 (not used) */ L2TP_ATTR_PROTO_VERSION, /* u8 */ L2TP_ATTR_IFNAME, /* string */ L2TP_ATTR_CONN_ID, /* u32 */ L2TP_ATTR_PEER_CONN_ID, /* u32 */ L2TP_ATTR_SESSION_ID, /* u32 */ L2TP_ATTR_PEER_SESSION_ID, /* u32 */ L2TP_ATTR_UDP_CSUM, /* u8 */ L2TP_ATTR_VLAN_ID, /* u16 */ L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */ L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */ L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */ L2TP_ATTR_RECV_SEQ, /* u8 */ L2TP_ATTR_SEND_SEQ, /* u8 */ L2TP_ATTR_LNS_MODE, /* u8 */ L2TP_ATTR_USING_IPSEC, /* u8 */ L2TP_ATTR_RECV_TIMEOUT, /* msec */ L2TP_ATTR_FD, /* int */ L2TP_ATTR_IP_SADDR, /* u32 */ L2TP_ATTR_IP_DADDR, /* u32 */ L2TP_ATTR_UDP_SPORT, /* u16 */ L2TP_ATTR_UDP_DPORT, /* u16 */ L2TP_ATTR_MTU, /* u16 */ L2TP_ATTR_MRU, /* u16 */ L2TP_ATTR_STATS, /* nested */ L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* flag */ L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* flag */ L2TP_ATTR_PAD, __L2TP_ATTR_MAX, }; #define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1) /* Nested in L2TP_ATTR_STATS */ enum { L2TP_ATTR_STATS_NONE, /* no data */ L2TP_ATTR_TX_PACKETS, /* u64 */ L2TP_ATTR_TX_BYTES, /* u64 */ L2TP_ATTR_TX_ERRORS, /* u64 */ L2TP_ATTR_RX_PACKETS, /* u64 */ L2TP_ATTR_RX_BYTES, /* u64 */ L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */ L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ L2TP_ATTR_RX_ERRORS, /* u64 */ L2TP_ATTR_STATS_PAD, __L2TP_ATTR_STATS_MAX, }; #define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1) enum l2tp_pwtype { L2TP_PWTYPE_NONE = 0x0000, L2TP_PWTYPE_ETH_VLAN = 0x0004, L2TP_PWTYPE_ETH = 0x0005, L2TP_PWTYPE_PPP = 0x0007, L2TP_PWTYPE_PPP_AC = 0x0008, L2TP_PWTYPE_IP = 0x000b, __L2TP_PWTYPE_MAX }; enum l2tp_l2spec_type { L2TP_L2SPECTYPE_NONE, L2TP_L2SPECTYPE_DEFAULT, }; enum l2tp_encap_type { L2TP_ENCAPTYPE_UDP, L2TP_ENCAPTYPE_IP, }; enum l2tp_seqmode { L2TP_SEQ_NONE = 0, L2TP_SEQ_IP = 1, L2TP_SEQ_ALL = 2, }; /** * enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions * * @L2TP_MSG_DEBUG: verbose debug (if compiled in) * @L2TP_MSG_CONTROL: userspace - kernel interface * @L2TP_MSG_SEQ: sequence numbers * @L2TP_MSG_DATA: data packets */ enum l2tp_debug_flags { L2TP_MSG_DEBUG = (1 << 0), L2TP_MSG_CONTROL = (1 << 1), L2TP_MSG_SEQ = (1 << 2), L2TP_MSG_DATA = (1 << 3), }; /* * NETLINK_GENERIC related info */ #define L2TP_GENL_NAME "l2tp" #define L2TP_GENL_VERSION 0x1 #define L2TP_GENL_MCGROUP "l2tp" #endif /* _LINUX_L2TP_H_ */ linux/libc-compat.h 0000644 00000020141 15063602051 0010242 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Compatibility interface for userspace libc header coordination: * * Define compatibility macros that are used to control the inclusion or * exclusion of UAPI structures and definitions in coordination with another * userspace C library. * * This header is intended to solve the problem of UAPI definitions that * conflict with userspace definitions. If a UAPI header has such conflicting * definitions then the solution is as follows: * * * Synchronize the UAPI header and the libc headers so either one can be * used and such that the ABI is preserved. If this is not possible then * no simple compatibility interface exists (you need to write translating * wrappers and rename things) and you can't use this interface. * * Then follow this process: * * (a) Include libc-compat.h in the UAPI header. * e.g. #include <linux/libc-compat.h> * This include must be as early as possible. * * (b) In libc-compat.h add enough code to detect that the comflicting * userspace libc header has been included first. * * (c) If the userspace libc header has been included first define a set of * guard macros of the form __UAPI_DEF_FOO and set their values to 1, else * set their values to 0. * * (d) Back in the UAPI header with the conflicting definitions, guard the * definitions with: * #if __UAPI_DEF_FOO * ... * #endif * * This fixes the situation where the linux headers are included *after* the * libc headers. To fix the problem with the inclusion in the other order the * userspace libc headers must be fixed like this: * * * For all definitions that conflict with kernel definitions wrap those * defines in the following: * #if !__UAPI_DEF_FOO * ... * #endif * * This prevents the redefinition of a construct already defined by the kernel. */ #ifndef _LIBC_COMPAT_H #define _LIBC_COMPAT_H /* We have included glibc headers... */ #if defined(__GLIBC__) /* Coordinate with glibc net/if.h header. */ #if defined(_NET_IF_H) && defined(__USE_MISC) /* GLIBC headers included first so don't define anything * that would already be defined. */ #define __UAPI_DEF_IF_IFCONF 0 #define __UAPI_DEF_IF_IFMAP 0 #define __UAPI_DEF_IF_IFNAMSIZ 0 #define __UAPI_DEF_IF_IFREQ 0 /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0 /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ #else /* _NET_IF_H */ /* Linux headers included first, and we must define everything * we need. The expectation is that glibc will check the * __UAPI_DEF_* defines and adjust appropriately. */ #define __UAPI_DEF_IF_IFCONF 1 #define __UAPI_DEF_IF_IFMAP 1 #define __UAPI_DEF_IF_IFNAMSIZ 1 #define __UAPI_DEF_IF_IFREQ 1 /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 #endif /* _NET_IF_H */ /* Coordinate with glibc netinet/in.h header. */ #if defined(_NETINET_IN_H) /* GLIBC headers included first so don't define anything * that would already be defined. */ #define __UAPI_DEF_IN_ADDR 0 #define __UAPI_DEF_IN_IPPROTO 0 #define __UAPI_DEF_IN_PKTINFO 0 #define __UAPI_DEF_IP_MREQ 0 #define __UAPI_DEF_SOCKADDR_IN 0 #define __UAPI_DEF_IN_CLASS 0 #define __UAPI_DEF_IN6_ADDR 0 /* The exception is the in6_addr macros which must be defined * if the glibc code didn't define them. This guard matches * the guard in glibc/inet/netinet/in.h which defines the * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */ #if defined(__USE_MISC) || defined (__USE_GNU) #define __UAPI_DEF_IN6_ADDR_ALT 0 #else #define __UAPI_DEF_IN6_ADDR_ALT 1 #endif #define __UAPI_DEF_SOCKADDR_IN6 0 #define __UAPI_DEF_IPV6_MREQ 0 #define __UAPI_DEF_IPPROTO_V6 0 #define __UAPI_DEF_IPV6_OPTIONS 0 #define __UAPI_DEF_IN6_PKTINFO 0 #define __UAPI_DEF_IP6_MTUINFO 0 #else /* Linux headers included first, and we must define everything * we need. The expectation is that glibc will check the * __UAPI_DEF_* defines and adjust appropriately. */ #define __UAPI_DEF_IN_ADDR 1 #define __UAPI_DEF_IN_IPPROTO 1 #define __UAPI_DEF_IN_PKTINFO 1 #define __UAPI_DEF_IP_MREQ 1 #define __UAPI_DEF_SOCKADDR_IN 1 #define __UAPI_DEF_IN_CLASS 1 #define __UAPI_DEF_IN6_ADDR 1 /* We unconditionally define the in6_addr macros and glibc must * coordinate. */ #define __UAPI_DEF_IN6_ADDR_ALT 1 #define __UAPI_DEF_SOCKADDR_IN6 1 #define __UAPI_DEF_IPV6_MREQ 1 #define __UAPI_DEF_IPPROTO_V6 1 #define __UAPI_DEF_IPV6_OPTIONS 1 #define __UAPI_DEF_IN6_PKTINFO 1 #define __UAPI_DEF_IP6_MTUINFO 1 #endif /* _NETINET_IN_H */ /* Coordinate with glibc netipx/ipx.h header. */ #if defined(__NETIPX_IPX_H) #define __UAPI_DEF_SOCKADDR_IPX 0 #define __UAPI_DEF_IPX_ROUTE_DEFINITION 0 #define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0 #define __UAPI_DEF_IPX_CONFIG_DATA 0 #define __UAPI_DEF_IPX_ROUTE_DEF 0 #else /* defined(__NETIPX_IPX_H) */ #define __UAPI_DEF_SOCKADDR_IPX 1 #define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 #define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 #define __UAPI_DEF_IPX_CONFIG_DATA 1 #define __UAPI_DEF_IPX_ROUTE_DEF 1 #endif /* defined(__NETIPX_IPX_H) */ /* Definitions for xattr.h */ #if defined(_SYS_XATTR_H) #define __UAPI_DEF_XATTR 0 #else #define __UAPI_DEF_XATTR 1 #endif /* If we did not see any headers from any supported C libraries, * or we are being included in the kernel, then define everything * that we need. Check for previous __UAPI_* definitions to give * unsupported C libraries a way to opt out of any kernel definition. */ #else /* !defined(__GLIBC__) */ /* Definitions for if.h */ #ifndef __UAPI_DEF_IF_IFCONF #define __UAPI_DEF_IF_IFCONF 1 #endif #ifndef __UAPI_DEF_IF_IFMAP #define __UAPI_DEF_IF_IFMAP 1 #endif #ifndef __UAPI_DEF_IF_IFNAMSIZ #define __UAPI_DEF_IF_IFNAMSIZ 1 #endif #ifndef __UAPI_DEF_IF_IFREQ #define __UAPI_DEF_IF_IFREQ 1 #endif /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 #endif /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 #endif /* Definitions for in.h */ #ifndef __UAPI_DEF_IN_ADDR #define __UAPI_DEF_IN_ADDR 1 #endif #ifndef __UAPI_DEF_IN_IPPROTO #define __UAPI_DEF_IN_IPPROTO 1 #endif #ifndef __UAPI_DEF_IN_PKTINFO #define __UAPI_DEF_IN_PKTINFO 1 #endif #ifndef __UAPI_DEF_IP_MREQ #define __UAPI_DEF_IP_MREQ 1 #endif #ifndef __UAPI_DEF_SOCKADDR_IN #define __UAPI_DEF_SOCKADDR_IN 1 #endif #ifndef __UAPI_DEF_IN_CLASS #define __UAPI_DEF_IN_CLASS 1 #endif /* Definitions for in6.h */ #ifndef __UAPI_DEF_IN6_ADDR #define __UAPI_DEF_IN6_ADDR 1 #endif #ifndef __UAPI_DEF_IN6_ADDR_ALT #define __UAPI_DEF_IN6_ADDR_ALT 1 #endif #ifndef __UAPI_DEF_SOCKADDR_IN6 #define __UAPI_DEF_SOCKADDR_IN6 1 #endif #ifndef __UAPI_DEF_IPV6_MREQ #define __UAPI_DEF_IPV6_MREQ 1 #endif #ifndef __UAPI_DEF_IPPROTO_V6 #define __UAPI_DEF_IPPROTO_V6 1 #endif #ifndef __UAPI_DEF_IPV6_OPTIONS #define __UAPI_DEF_IPV6_OPTIONS 1 #endif #ifndef __UAPI_DEF_IN6_PKTINFO #define __UAPI_DEF_IN6_PKTINFO 1 #endif #ifndef __UAPI_DEF_IP6_MTUINFO #define __UAPI_DEF_IP6_MTUINFO 1 #endif /* Definitions for ipx.h */ #ifndef __UAPI_DEF_SOCKADDR_IPX #define __UAPI_DEF_SOCKADDR_IPX 1 #endif #ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION #define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 #endif #ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION #define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 #endif #ifndef __UAPI_DEF_IPX_CONFIG_DATA #define __UAPI_DEF_IPX_CONFIG_DATA 1 #endif #ifndef __UAPI_DEF_IPX_ROUTE_DEF #define __UAPI_DEF_IPX_ROUTE_DEF 1 #endif /* Definitions for xattr.h */ #ifndef __UAPI_DEF_XATTR #define __UAPI_DEF_XATTR 1 #endif #endif /* __GLIBC__ */ #endif /* _LIBC_COMPAT_H */ linux/lightnvm.h 0000644 00000011662 15063602051 0007710 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2015 CNEX Labs. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, * USA. */ #ifndef _LINUX_LIGHTNVM_H #define _LINUX_LIGHTNVM_H #include <stdio.h> #include <sys/ioctl.h> #define DISK_NAME_LEN 32 #include <linux/types.h> #include <linux/ioctl.h> #define NVM_TTYPE_NAME_MAX 48 #define NVM_TTYPE_MAX 63 #define NVM_MMTYPE_LEN 8 #define NVM_CTRL_FILE "/dev/lightnvm/control" struct nvm_ioctl_info_tgt { __u32 version[3]; __u32 reserved; char tgtname[NVM_TTYPE_NAME_MAX]; }; struct nvm_ioctl_info { __u32 version[3]; /* in/out - major, minor, patch */ __u16 tgtsize; /* number of targets */ __u16 reserved16; /* pad to 4K page */ __u32 reserved[12]; struct nvm_ioctl_info_tgt tgts[NVM_TTYPE_MAX]; }; enum { NVM_DEVICE_ACTIVE = 1 << 0, }; struct nvm_ioctl_device_info { char devname[DISK_NAME_LEN]; char bmname[NVM_TTYPE_NAME_MAX]; __u32 bmversion[3]; __u32 flags; __u32 reserved[8]; }; struct nvm_ioctl_get_devices { __u32 nr_devices; __u32 reserved[31]; struct nvm_ioctl_device_info info[31]; }; struct nvm_ioctl_create_simple { __u32 lun_begin; __u32 lun_end; }; struct nvm_ioctl_create_extended { __u16 lun_begin; __u16 lun_end; __u16 op; __u16 rsv; }; enum { NVM_CONFIG_TYPE_SIMPLE = 0, NVM_CONFIG_TYPE_EXTENDED = 1, }; struct nvm_ioctl_create_conf { __u32 type; union { struct nvm_ioctl_create_simple s; struct nvm_ioctl_create_extended e; }; }; enum { NVM_TARGET_FACTORY = 1 << 0, /* Init target in factory mode */ }; struct nvm_ioctl_create { char dev[DISK_NAME_LEN]; /* open-channel SSD device */ char tgttype[NVM_TTYPE_NAME_MAX]; /* target type name */ char tgtname[DISK_NAME_LEN]; /* dev to expose target as */ __u32 flags; struct nvm_ioctl_create_conf conf; }; struct nvm_ioctl_remove { char tgtname[DISK_NAME_LEN]; __u32 flags; }; struct nvm_ioctl_dev_init { char dev[DISK_NAME_LEN]; /* open-channel SSD device */ char mmtype[NVM_MMTYPE_LEN]; /* register to media manager */ __u32 flags; }; enum { NVM_FACTORY_ERASE_ONLY_USER = 1 << 0, /* erase only blocks used as * host blks or grown blks */ NVM_FACTORY_RESET_HOST_BLKS = 1 << 1, /* remove host blk marks */ NVM_FACTORY_RESET_GRWN_BBLKS = 1 << 2, /* remove grown blk marks */ NVM_FACTORY_NR_BITS = 1 << 3, /* stops here */ }; struct nvm_ioctl_dev_factory { char dev[DISK_NAME_LEN]; __u32 flags; }; struct nvm_user_vio { __u8 opcode; __u8 flags; __u16 control; __u16 nppas; __u16 rsvd; __u64 metadata; __u64 addr; __u64 ppa_list; __u32 metadata_len; __u32 data_len; __u64 status; __u32 result; __u32 rsvd3[3]; }; struct nvm_passthru_vio { __u8 opcode; __u8 flags; __u8 rsvd[2]; __u32 nsid; __u32 cdw2; __u32 cdw3; __u64 metadata; __u64 addr; __u32 metadata_len; __u32 data_len; __u64 ppa_list; __u16 nppas; __u16 control; __u32 cdw13; __u32 cdw14; __u32 cdw15; __u64 status; __u32 result; __u32 timeout_ms; }; /* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ enum { /* top level cmds */ NVM_INFO_CMD = 0x20, NVM_GET_DEVICES_CMD, /* device level cmds */ NVM_DEV_CREATE_CMD, NVM_DEV_REMOVE_CMD, /* Init a device to support LightNVM media managers */ NVM_DEV_INIT_CMD, /* Factory reset device */ NVM_DEV_FACTORY_CMD, /* Vector user I/O */ NVM_DEV_VIO_ADMIN_CMD = 0x41, NVM_DEV_VIO_CMD = 0x42, NVM_DEV_VIO_USER_CMD = 0x43, }; #define NVM_IOCTL 'L' /* 0x4c */ #define NVM_INFO _IOWR(NVM_IOCTL, NVM_INFO_CMD, \ struct nvm_ioctl_info) #define NVM_GET_DEVICES _IOR(NVM_IOCTL, NVM_GET_DEVICES_CMD, \ struct nvm_ioctl_get_devices) #define NVM_DEV_CREATE _IOW(NVM_IOCTL, NVM_DEV_CREATE_CMD, \ struct nvm_ioctl_create) #define NVM_DEV_REMOVE _IOW(NVM_IOCTL, NVM_DEV_REMOVE_CMD, \ struct nvm_ioctl_remove) #define NVM_DEV_INIT _IOW(NVM_IOCTL, NVM_DEV_INIT_CMD, \ struct nvm_ioctl_dev_init) #define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, \ struct nvm_ioctl_dev_factory) #define NVME_NVM_IOCTL_IO_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_USER_CMD, \ struct nvm_passthru_vio) #define NVME_NVM_IOCTL_ADMIN_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_ADMIN_CMD,\ struct nvm_passthru_vio) #define NVME_NVM_IOCTL_SUBMIT_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_CMD,\ struct nvm_user_vio) #define NVM_VERSION_MAJOR 1 #define NVM_VERSION_MINOR 0 #define NVM_VERSION_PATCHLEVEL 0 #endif linux/limits.h 0000644 00000001651 15063602051 0007356 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_LIMITS_H #define _LINUX_LIMITS_H #define NR_OPEN 1024 #define NGROUPS_MAX 65536 /* supplemental group IDs are available */ #define ARG_MAX 131072 /* # bytes of args + environ for exec() */ #define LINK_MAX 127 /* # links a file may have */ #define MAX_CANON 255 /* size of the canonical input queue */ #define MAX_INPUT 255 /* size of the type-ahead buffer */ #define NAME_MAX 255 /* # chars in a file name */ #define PATH_MAX 4096 /* # chars in a path name including nul */ #define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ #define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ #define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ #define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ #define RTSIG_MAX 32 #endif linux/lirc.h 0000644 00000017205 15063602051 0007010 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * lirc.h - linux infrared remote control header file * last modified 2010/07/13 by Jarod Wilson */ #ifndef _LINUX_LIRC_H #define _LINUX_LIRC_H #include <linux/types.h> #include <linux/ioctl.h> #define PULSE_BIT 0x01000000 #define PULSE_MASK 0x00FFFFFF #define LIRC_MODE2_SPACE 0x00000000 #define LIRC_MODE2_PULSE 0x01000000 #define LIRC_MODE2_FREQUENCY 0x02000000 #define LIRC_MODE2_TIMEOUT 0x03000000 #define LIRC_VALUE_MASK 0x00FFFFFF #define LIRC_MODE2_MASK 0xFF000000 #define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE) #define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE) #define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY) #define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT) #define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK) #define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK) #define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE) #define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE) #define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY) #define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT) /* used heavily by lirc userspace */ #define lirc_t int /*** lirc compatible hardware features ***/ #define LIRC_MODE2SEND(x) (x) #define LIRC_SEND2MODE(x) (x) #define LIRC_MODE2REC(x) ((x) << 16) #define LIRC_REC2MODE(x) ((x) >> 16) #define LIRC_MODE_RAW 0x00000001 #define LIRC_MODE_PULSE 0x00000002 #define LIRC_MODE_MODE2 0x00000004 #define LIRC_MODE_SCANCODE 0x00000008 #define LIRC_MODE_LIRCCODE 0x00000010 #define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW) #define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE) #define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2) #define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE) #define LIRC_CAN_SEND_MASK 0x0000003f #define LIRC_CAN_SET_SEND_CARRIER 0x00000100 #define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200 #define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400 #define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW) #define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE) #define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2) #define LIRC_CAN_REC_SCANCODE LIRC_MODE2REC(LIRC_MODE_SCANCODE) #define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE) #define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK) #define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16) #define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16) #define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000 #define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000 #define LIRC_CAN_GET_REC_RESOLUTION 0x20000000 #define LIRC_CAN_SET_REC_TIMEOUT 0x10000000 #define LIRC_CAN_SET_REC_FILTER 0x08000000 #define LIRC_CAN_MEASURE_CARRIER 0x02000000 #define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000 #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) #define LIRC_CAN_NOTIFY_DECODE 0x01000000 /*** IOCTL commands for lirc driver ***/ #define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32) #define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32) #define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32) #define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32) #define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32) #define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32) /* code length in bits, currently only for LIRC_MODE_LIRCCODE */ #define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32) #define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32) #define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32) /* Note: these can reset the according pulse_width */ #define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32) #define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32) #define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32) #define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32) /* * when a timeout != 0 is set the driver will send a * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is * never sent, timeout is disabled by default */ #define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32) /* 1 enables, 0 disables timeout reports in MODE2 */ #define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32) /* * if enabled from the next key press on the driver will send * LIRC_MODE2_FREQUENCY packets */ #define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) /* * to set a range use LIRC_SET_REC_CARRIER_RANGE with the * lower bound first and later LIRC_SET_REC_CARRIER with the upper bound */ #define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32) #define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32) /* * Return the recording timeout, which is either set by * the ioctl LIRC_SET_REC_TIMEOUT or by the kernel after setting the protocols. */ #define LIRC_GET_REC_TIMEOUT _IOR('i', 0x00000024, __u32) /* * struct lirc_scancode - decoded scancode with protocol for use with * LIRC_MODE_SCANCODE * * @timestamp: Timestamp in nanoseconds using CLOCK_MONOTONIC when IR * was decoded. * @flags: should be 0 for transmit. When receiving scancodes, * LIRC_SCANCODE_FLAG_TOGGLE or LIRC_SCANCODE_FLAG_REPEAT can be set * depending on the protocol * @rc_proto: see enum rc_proto * @keycode: the translated keycode. Set to 0 for transmit. * @scancode: the scancode received or to be sent */ struct lirc_scancode { __u64 timestamp; __u16 flags; __u16 rc_proto; __u32 keycode; __u64 scancode; }; /* Set if the toggle bit of rc-5 or rc-6 is enabled */ #define LIRC_SCANCODE_FLAG_TOGGLE 1 /* Set if this is a nec or sanyo repeat */ #define LIRC_SCANCODE_FLAG_REPEAT 2 /** * enum rc_proto - the Remote Controller protocol * * @RC_PROTO_UNKNOWN: Protocol not known * @RC_PROTO_OTHER: Protocol known but proprietary * @RC_PROTO_RC5: Philips RC5 protocol * @RC_PROTO_RC5X_20: Philips RC5x 20 bit protocol * @RC_PROTO_RC5_SZ: StreamZap variant of RC5 * @RC_PROTO_JVC: JVC protocol * @RC_PROTO_SONY12: Sony 12 bit protocol * @RC_PROTO_SONY15: Sony 15 bit protocol * @RC_PROTO_SONY20: Sony 20 bit protocol * @RC_PROTO_NEC: NEC protocol * @RC_PROTO_NECX: Extended NEC protocol * @RC_PROTO_NEC32: NEC 32 bit protocol * @RC_PROTO_SANYO: Sanyo protocol * @RC_PROTO_MCIR2_KBD: RC6-ish MCE keyboard * @RC_PROTO_MCIR2_MSE: RC6-ish MCE mouse * @RC_PROTO_RC6_0: Philips RC6-0-16 protocol * @RC_PROTO_RC6_6A_20: Philips RC6-6A-20 protocol * @RC_PROTO_RC6_6A_24: Philips RC6-6A-24 protocol * @RC_PROTO_RC6_6A_32: Philips RC6-6A-32 protocol * @RC_PROTO_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol * @RC_PROTO_SHARP: Sharp protocol * @RC_PROTO_XMP: XMP protocol * @RC_PROTO_CEC: CEC protocol * @RC_PROTO_IMON: iMon Pad protocol */ enum rc_proto { RC_PROTO_UNKNOWN = 0, RC_PROTO_OTHER = 1, RC_PROTO_RC5 = 2, RC_PROTO_RC5X_20 = 3, RC_PROTO_RC5_SZ = 4, RC_PROTO_JVC = 5, RC_PROTO_SONY12 = 6, RC_PROTO_SONY15 = 7, RC_PROTO_SONY20 = 8, RC_PROTO_NEC = 9, RC_PROTO_NECX = 10, RC_PROTO_NEC32 = 11, RC_PROTO_SANYO = 12, RC_PROTO_MCIR2_KBD = 13, RC_PROTO_MCIR2_MSE = 14, RC_PROTO_RC6_0 = 15, RC_PROTO_RC6_6A_20 = 16, RC_PROTO_RC6_6A_24 = 17, RC_PROTO_RC6_6A_32 = 18, RC_PROTO_RC6_MCE = 19, RC_PROTO_SHARP = 20, RC_PROTO_XMP = 21, RC_PROTO_CEC = 22, RC_PROTO_IMON = 23, }; #endif linux/llc.h 0000644 00000006134 15063602051 0006630 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators. * * Copyright (c) 2001 by Jay Schulist <jschlst@samba.org> * * This program can be redistributed or modified under the terms of the * GNU General Public License as published by the Free Software Foundation. * This program is distributed without any warranty or implied warranty * of merchantability or fitness for a particular purpose. * * See the GNU General Public License for more details. */ #ifndef __LINUX_LLC_H #define __LINUX_LLC_H #include <linux/socket.h> #include <linux/if.h> /* For IFHWADDRLEN. */ #define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */ struct sockaddr_llc { __kernel_sa_family_t sllc_family; /* AF_LLC */ __kernel_sa_family_t sllc_arphrd; /* ARPHRD_ETHER */ unsigned char sllc_test; unsigned char sllc_xid; unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */ unsigned char sllc_sap; unsigned char sllc_mac[IFHWADDRLEN]; unsigned char __pad[__LLC_SOCK_SIZE__ - sizeof(__kernel_sa_family_t) * 2 - sizeof(unsigned char) * 4 - IFHWADDRLEN]; }; /* sockopt definitions. */ enum llc_sockopts { LLC_OPT_UNKNOWN = 0, LLC_OPT_RETRY, /* max retrans attempts. */ LLC_OPT_SIZE, /* max PDU size (octets). */ LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */ LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */ LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */ LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ LLC_OPT_TX_WIN, /* tx window size. */ LLC_OPT_RX_WIN, /* rx window size. */ LLC_OPT_PKTINFO, /* ancillary packet information. */ LLC_OPT_MAX }; #define LLC_OPT_MAX_RETRY 100 #define LLC_OPT_MAX_SIZE 4196 #define LLC_OPT_MAX_WIN 127 #define LLC_OPT_MAX_ACK_TMR_EXP 60 #define LLC_OPT_MAX_P_TMR_EXP 60 #define LLC_OPT_MAX_REJ_TMR_EXP 60 #define LLC_OPT_MAX_BUSY_TMR_EXP 60 /* LLC SAP types. */ #define LLC_SAP_NULL 0x00 /* NULL SAP. */ #define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */ #define LLC_SAP_SNA 0x04 /* SNA Path Control. */ #define LLC_SAP_PNM 0x0E /* Proway Network Management. */ #define LLC_SAP_IP 0x06 /* TCP/IP. */ #define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ #define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ #define LLC_SAP_8208 0x7E /* ISO 8208 */ #define LLC_SAP_3COM 0x80 /* 3COM. */ #define LLC_SAP_PRO 0x8E /* Proway Active Station List */ #define LLC_SAP_SNAP 0xAA /* SNAP. */ #define LLC_SAP_BANYAN 0xBC /* Banyan. */ #define LLC_SAP_IPX 0xE0 /* IPX/SPX. */ #define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */ #define LLC_SAP_LANMGR 0xF4 /* LanManager. */ #define LLC_SAP_IMPL 0xF8 /* IMPL */ #define LLC_SAP_DISC 0xFC /* Discovery */ #define LLC_SAP_OSI 0xFE /* OSI Network Layers. */ #define LLC_SAP_LAR 0xDC /* LAN Address Resolution */ #define LLC_SAP_RM 0xD4 /* Resource Management */ #define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ struct llc_pktinfo { int lpi_ifindex; unsigned char lpi_sap; unsigned char lpi_mac[IFHWADDRLEN]; }; #endif /* __LINUX_LLC_H */ linux/loop.h 0000644 00000006651 15063602051 0007033 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * include/linux/loop.h * * Written by Theodore Ts'o, 3/29/93. * * Copyright 1993 by Theodore Ts'o. Redistribution of this file is * permitted under the GNU General Public License. */ #ifndef _LINUX_LOOP_H #define _LINUX_LOOP_H #define LO_NAME_SIZE 64 #define LO_KEY_SIZE 32 /* * Loop flags */ enum { LO_FLAGS_READ_ONLY = 1, LO_FLAGS_AUTOCLEAR = 4, LO_FLAGS_PARTSCAN = 8, LO_FLAGS_DIRECT_IO = 16, }; /* LO_FLAGS that can be set using LOOP_SET_STATUS(64) */ #define LOOP_SET_STATUS_SETTABLE_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN) /* LO_FLAGS that can be cleared using LOOP_SET_STATUS(64) */ #define LOOP_SET_STATUS_CLEARABLE_FLAGS (LO_FLAGS_AUTOCLEAR) /* LO_FLAGS that can be set using LOOP_CONFIGURE */ #define LOOP_CONFIGURE_SETTABLE_FLAGS (LO_FLAGS_READ_ONLY | LO_FLAGS_AUTOCLEAR \ | LO_FLAGS_PARTSCAN | LO_FLAGS_DIRECT_IO) #include <asm/posix_types.h> /* for __kernel_old_dev_t */ #include <linux/types.h> /* for __u64 */ /* Backwards compatibility version */ struct loop_info { int lo_number; /* ioctl r/o */ __kernel_old_dev_t lo_device; /* ioctl r/o */ unsigned long lo_inode; /* ioctl r/o */ __kernel_old_dev_t lo_rdevice; /* ioctl r/o */ int lo_offset; int lo_encrypt_type; int lo_encrypt_key_size; /* ioctl w/o */ int lo_flags; char lo_name[LO_NAME_SIZE]; unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ unsigned long lo_init[2]; char reserved[4]; }; struct loop_info64 { __u64 lo_device; /* ioctl r/o */ __u64 lo_inode; /* ioctl r/o */ __u64 lo_rdevice; /* ioctl r/o */ __u64 lo_offset; __u64 lo_sizelimit;/* bytes, 0 == max available */ __u32 lo_number; /* ioctl r/o */ __u32 lo_encrypt_type; __u32 lo_encrypt_key_size; /* ioctl w/o */ __u32 lo_flags; __u8 lo_file_name[LO_NAME_SIZE]; __u8 lo_crypt_name[LO_NAME_SIZE]; __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ __u64 lo_init[2]; }; /** * struct loop_config - Complete configuration for a loop device. * @fd: fd of the file to be used as a backing file for the loop device. * @block_size: block size to use; ignored if 0. * @info: struct loop_info64 to configure the loop device with. * * This structure is used with the LOOP_CONFIGURE ioctl, and can be used to * atomically setup and configure all loop device parameters at once. */ struct loop_config { __u32 fd; __u32 block_size; struct loop_info64 info; __u64 __reserved[8]; }; /* * Loop filter types */ #define LO_CRYPT_NONE 0 #define LO_CRYPT_XOR 1 #define LO_CRYPT_DES 2 #define LO_CRYPT_FISH2 3 /* Twofish encryption */ #define LO_CRYPT_BLOW 4 #define LO_CRYPT_CAST128 5 #define LO_CRYPT_IDEA 6 #define LO_CRYPT_DUMMY 9 #define LO_CRYPT_SKIPJACK 10 #define LO_CRYPT_CRYPTOAPI 18 #define MAX_LO_CRYPT 20 /* * IOCTL commands --- we will commandeer 0x4C ('L') */ #define LOOP_SET_FD 0x4C00 #define LOOP_CLR_FD 0x4C01 #define LOOP_SET_STATUS 0x4C02 #define LOOP_GET_STATUS 0x4C03 #define LOOP_SET_STATUS64 0x4C04 #define LOOP_GET_STATUS64 0x4C05 #define LOOP_CHANGE_FD 0x4C06 #define LOOP_SET_CAPACITY 0x4C07 #define LOOP_SET_DIRECT_IO 0x4C08 #define LOOP_SET_BLOCK_SIZE 0x4C09 #define LOOP_CONFIGURE 0x4C0A /* /dev/loop-control interface */ #define LOOP_CTL_ADD 0x4C80 #define LOOP_CTL_REMOVE 0x4C81 #define LOOP_CTL_GET_FREE 0x4C82 #endif /* _LINUX_LOOP_H */ linux/lp.h 0000644 00000010136 15063602051 0006466 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * usr/include/linux/lp.h c.1991-1992 James Wiegand * many modifications copyright (C) 1992 Michael K. Johnson * Interrupt support added 1993 Nigel Gamble * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti */ #ifndef _LINUX_LP_H #define _LINUX_LP_H #include <linux/types.h> #include <linux/ioctl.h> /* * Per POSIX guidelines, this module reserves the LP and lp prefixes * These are the lp_table[minor].flags flags... */ #define LP_EXIST 0x0001 #define LP_SELEC 0x0002 #define LP_BUSY 0x0004 #define LP_BUSY_BIT_POS 2 #define LP_OFFL 0x0008 #define LP_NOPA 0x0010 #define LP_ERR 0x0020 #define LP_ABORT 0x0040 #define LP_CAREFUL 0x0080 /* obsoleted -arca */ #define LP_ABORTOPEN 0x0100 #define LP_TRUST_IRQ_ 0x0200 /* obsolete */ #define LP_NO_REVERSE 0x0400 /* No reverse mode available. */ #define LP_DATA_AVAIL 0x0800 /* Data is available. */ /* * bit defines for 8255 status port * base + 1 * accessed with LP_S(minor), which gets the byte... */ #define LP_PBUSY 0x80 /* inverted input, active high */ #define LP_PACK 0x40 /* unchanged input, active low */ #define LP_POUTPA 0x20 /* unchanged input, active high */ #define LP_PSELECD 0x10 /* unchanged input, active high */ #define LP_PERRORP 0x08 /* unchanged input, active low */ /* timeout for each character. This is relative to bus cycles -- it * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you * have extremely slow printing, or if the machine seems to slow down * a lot when you print. If you have slow printing, increase this * number and recompile, and if your system gets bogged down, decrease * this number. This can be changed with the tunelp(8) command as well. */ #define LP_INIT_CHAR 1000 /* The parallel port specs apparently say that there needs to be * a .5usec wait before and after the strobe. */ #define LP_INIT_WAIT 1 /* This is the amount of time that the driver waits for the printer to * catch up when the printer's buffer appears to be filled. If you * want to tune this and have a fast printer (i.e. HPIIIP), decrease * this number, and if you have a slow printer, increase this number. * This is in hundredths of a second, the default 2 being .05 second. * Or use the tunelp(8) command, which is especially nice if you want * change back and forth between character and graphics printing, which * are wildly different... */ #define LP_INIT_TIME 2 /* IOCTL numbers */ #define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */ #define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */ #define LPABORT 0x0604 /* call with TRUE arg to abort on error, FALSE to retry. Default is retry. */ #define LPSETIRQ 0x0605 /* call with new IRQ number, or 0 for polling (no IRQ) */ #define LPGETIRQ 0x0606 /* get the current IRQ number */ #define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */ /* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */ #define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off- line, and error indicators good on all writes, FALSE to ignore them. Default is ignore. */ #define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error, FALSE to ignore error. Default is ignore. */ #define LPGETSTATUS 0x060b /* return LP_S(minor) */ #define LPRESET 0x060c /* reset printer */ #ifdef LP_STATS #define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */ #endif #define LPGETFLAGS 0x060e /* get status flags */ #define LPSETTIMEOUT_OLD 0x060f /* set parport timeout */ #define LPSETTIMEOUT_NEW \ _IOW(0x6, 0xf, __s64[2]) /* set parport timeout */ #if __BITS_PER_LONG == 64 #define LPSETTIMEOUT LPSETTIMEOUT_OLD #else #define LPSETTIMEOUT (sizeof(time_t) > sizeof(__kernel_long_t) ? \ LPSETTIMEOUT_NEW : LPSETTIMEOUT_OLD) #endif /* timeout for printk'ing a timeout, in jiffies (100ths of a second). This is also used for re-checking error conditions if LP_ABORT is not set. This is the default behavior. */ #define LP_TIMEOUT_INTERRUPT (60 * HZ) #define LP_TIMEOUT_POLLED (10 * HZ) #endif /* _LINUX_LP_H */ linux/lwtunnel.h 0000644 00000004203 15063602051 0007721 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LWTUNNEL_H_ #define _LWTUNNEL_H_ #include <linux/types.h> enum lwtunnel_encap_types { LWTUNNEL_ENCAP_NONE, LWTUNNEL_ENCAP_MPLS, LWTUNNEL_ENCAP_IP, LWTUNNEL_ENCAP_ILA, LWTUNNEL_ENCAP_IP6, LWTUNNEL_ENCAP_SEG6, LWTUNNEL_ENCAP_BPF, LWTUNNEL_ENCAP_SEG6_LOCAL, __LWTUNNEL_ENCAP_MAX, }; #define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1) enum lwtunnel_ip_t { LWTUNNEL_IP_UNSPEC, LWTUNNEL_IP_ID, LWTUNNEL_IP_DST, LWTUNNEL_IP_SRC, LWTUNNEL_IP_TTL, LWTUNNEL_IP_TOS, LWTUNNEL_IP_FLAGS, LWTUNNEL_IP_PAD, LWTUNNEL_IP_OPTS, __LWTUNNEL_IP_MAX, }; #define LWTUNNEL_IP_MAX (__LWTUNNEL_IP_MAX - 1) enum lwtunnel_ip6_t { LWTUNNEL_IP6_UNSPEC, LWTUNNEL_IP6_ID, LWTUNNEL_IP6_DST, LWTUNNEL_IP6_SRC, LWTUNNEL_IP6_HOPLIMIT, LWTUNNEL_IP6_TC, LWTUNNEL_IP6_FLAGS, LWTUNNEL_IP6_PAD, LWTUNNEL_IP6_OPTS, __LWTUNNEL_IP6_MAX, }; #define LWTUNNEL_IP6_MAX (__LWTUNNEL_IP6_MAX - 1) enum { LWTUNNEL_IP_OPTS_UNSPEC, LWTUNNEL_IP_OPTS_GENEVE, LWTUNNEL_IP_OPTS_VXLAN, LWTUNNEL_IP_OPTS_ERSPAN, __LWTUNNEL_IP_OPTS_MAX, }; #define LWTUNNEL_IP_OPTS_MAX (__LWTUNNEL_IP_OPTS_MAX - 1) enum { LWTUNNEL_IP_OPT_GENEVE_UNSPEC, LWTUNNEL_IP_OPT_GENEVE_CLASS, LWTUNNEL_IP_OPT_GENEVE_TYPE, LWTUNNEL_IP_OPT_GENEVE_DATA, __LWTUNNEL_IP_OPT_GENEVE_MAX, }; #define LWTUNNEL_IP_OPT_GENEVE_MAX (__LWTUNNEL_IP_OPT_GENEVE_MAX - 1) enum { LWTUNNEL_IP_OPT_VXLAN_UNSPEC, LWTUNNEL_IP_OPT_VXLAN_GBP, __LWTUNNEL_IP_OPT_VXLAN_MAX, }; #define LWTUNNEL_IP_OPT_VXLAN_MAX (__LWTUNNEL_IP_OPT_VXLAN_MAX - 1) enum { LWTUNNEL_IP_OPT_ERSPAN_UNSPEC, LWTUNNEL_IP_OPT_ERSPAN_VER, LWTUNNEL_IP_OPT_ERSPAN_INDEX, LWTUNNEL_IP_OPT_ERSPAN_DIR, LWTUNNEL_IP_OPT_ERSPAN_HWID, __LWTUNNEL_IP_OPT_ERSPAN_MAX, }; #define LWTUNNEL_IP_OPT_ERSPAN_MAX (__LWTUNNEL_IP_OPT_ERSPAN_MAX - 1) enum { LWT_BPF_PROG_UNSPEC, LWT_BPF_PROG_FD, LWT_BPF_PROG_NAME, __LWT_BPF_PROG_MAX, }; #define LWT_BPF_PROG_MAX (__LWT_BPF_PROG_MAX - 1) enum { LWT_BPF_UNSPEC, LWT_BPF_IN, LWT_BPF_OUT, LWT_BPF_XMIT, LWT_BPF_XMIT_HEADROOM, __LWT_BPF_MAX, }; #define LWT_BPF_MAX (__LWT_BPF_MAX - 1) #define LWT_BPF_MAX_HEADROOM 256 #endif /* _LWTUNNEL_H_ */ linux/magic.h 0000644 00000006713 15063602051 0007141 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MAGIC_H__ #define __LINUX_MAGIC_H__ #define ADFS_SUPER_MAGIC 0xadf5 #define AFFS_SUPER_MAGIC 0xadff #define AFS_SUPER_MAGIC 0x5346414F #define AUTOFS_SUPER_MAGIC 0x0187 #define CODA_SUPER_MAGIC 0x73757245 #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ #define DEBUGFS_MAGIC 0x64626720 #define SECURITYFS_MAGIC 0x73636673 #define SELINUX_MAGIC 0xf97cff8c #define SMACK_MAGIC 0x43415d53 /* "SMAC" */ #define RAMFS_MAGIC 0x858458f6 /* some random number */ #define TMPFS_MAGIC 0x01021994 #define HUGETLBFS_MAGIC 0x958458f6 /* some random number */ #define SQUASHFS_MAGIC 0x73717368 #define ECRYPTFS_SUPER_MAGIC 0xf15f #define EFS_SUPER_MAGIC 0x414A53 #define EXT2_SUPER_MAGIC 0xEF53 #define EXT3_SUPER_MAGIC 0xEF53 #define XENFS_SUPER_MAGIC 0xabba1974 #define EXT4_SUPER_MAGIC 0xEF53 #define BTRFS_SUPER_MAGIC 0x9123683E #define NILFS_SUPER_MAGIC 0x3434 #define F2FS_SUPER_MAGIC 0xF2F52010 #define HPFS_SUPER_MAGIC 0xf995e849 #define ISOFS_SUPER_MAGIC 0x9660 #define JFFS2_SUPER_MAGIC 0x72b6 #define XFS_SUPER_MAGIC 0x58465342 /* "XFSB" */ #define PSTOREFS_MAGIC 0x6165676C #define EFIVARFS_MAGIC 0xde5e81e4 #define HOSTFS_SUPER_MAGIC 0x00c0ffee #define OVERLAYFS_SUPER_MAGIC 0x794c7630 #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ #define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */ #define MINIX2_SUPER_MAGIC 0x2468 /* minix v2 fs, 14 char names */ #define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2 fs, 30 char names */ #define MINIX3_SUPER_MAGIC 0x4d5a /* minix v3 fs, 60 char names */ #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ #define NFS_SUPER_MAGIC 0x6969 #define OCFS2_SUPER_MAGIC 0x7461636f #define OPENPROM_SUPER_MAGIC 0x9fa1 #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ #define AFS_FS_MAGIC 0x6B414653 #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ /* used by file system utilities that look at the superblock, etc. */ #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" #define SMB_SUPER_MAGIC 0x517B #define CGROUP_SUPER_MAGIC 0x27e0eb #define CGROUP2_SUPER_MAGIC 0x63677270 #define RDTGROUP_SUPER_MAGIC 0x7655821 #define STACK_END_MAGIC 0x57AC6E9D #define TRACEFS_MAGIC 0x74726163 #define V9FS_MAGIC 0x01021997 #define BDEVFS_MAGIC 0x62646576 #define DAXFS_MAGIC 0x64646178 #define BINFMTFS_MAGIC 0x42494e4d #define DEVPTS_SUPER_MAGIC 0x1cd1 #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA #define PIPEFS_MAGIC 0x50495045 #define PROC_SUPER_MAGIC 0x9fa0 #define SOCKFS_MAGIC 0x534F434B #define SYSFS_MAGIC 0x62656572 #define USBDEVICE_SUPER_MAGIC 0x9fa2 #define MTD_INODE_FS_MAGIC 0x11307854 #define ANON_INODE_FS_MAGIC 0x09041934 #define BTRFS_TEST_MAGIC 0x73727279 #define NSFS_MAGIC 0x6e736673 #define BPF_FS_MAGIC 0xcafe4a11 #define AAFS_MAGIC 0x5a3c69f0 /* Since UDF 2.01 is ISO 13346 based... */ #define UDF_SUPER_MAGIC 0x15013346 #define BALLOON_KVM_MAGIC 0x13661366 #define ZSMALLOC_MAGIC 0x58295829 #define DMA_BUF_MAGIC 0x444d4142 /* "DMAB" */ #define PPC_CMM_MAGIC 0xc7571590 #endif /* __LINUX_MAGIC_H__ */ linux/major.h 0000644 00000011151 15063602051 0007161 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MAJOR_H #define _LINUX_MAJOR_H /* * This file has definitions for major device numbers. * For the device number assignments, see Documentation/admin-guide/devices.rst. */ #define UNNAMED_MAJOR 0 #define MEM_MAJOR 1 #define RAMDISK_MAJOR 1 #define FLOPPY_MAJOR 2 #define PTY_MASTER_MAJOR 2 #define IDE0_MAJOR 3 #define HD_MAJOR IDE0_MAJOR #define PTY_SLAVE_MAJOR 3 #define TTY_MAJOR 4 #define TTYAUX_MAJOR 5 #define LP_MAJOR 6 #define VCS_MAJOR 7 #define LOOP_MAJOR 7 #define SCSI_DISK0_MAJOR 8 #define SCSI_TAPE_MAJOR 9 #define MD_MAJOR 9 #define MISC_MAJOR 10 #define SCSI_CDROM_MAJOR 11 #define MUX_MAJOR 11 /* PA-RISC only */ #define XT_DISK_MAJOR 13 #define INPUT_MAJOR 13 #define SOUND_MAJOR 14 #define CDU31A_CDROM_MAJOR 15 #define JOYSTICK_MAJOR 15 #define GOLDSTAR_CDROM_MAJOR 16 #define OPTICS_CDROM_MAJOR 17 #define SANYO_CDROM_MAJOR 18 #define CYCLADES_MAJOR 19 #define CYCLADESAUX_MAJOR 20 #define MITSUMI_X_CDROM_MAJOR 20 #define MFM_ACORN_MAJOR 21 /* ARM Linux /dev/mfm */ #define SCSI_GENERIC_MAJOR 21 #define IDE1_MAJOR 22 #define DIGICU_MAJOR 22 #define DIGI_MAJOR 23 #define MITSUMI_CDROM_MAJOR 23 #define CDU535_CDROM_MAJOR 24 #define STL_SERIALMAJOR 24 #define MATSUSHITA_CDROM_MAJOR 25 #define STL_CALLOUTMAJOR 25 #define MATSUSHITA_CDROM2_MAJOR 26 #define QIC117_TAPE_MAJOR 27 #define MATSUSHITA_CDROM3_MAJOR 27 #define MATSUSHITA_CDROM4_MAJOR 28 #define STL_SIOMEMMAJOR 28 #define ACSI_MAJOR 28 #define AZTECH_CDROM_MAJOR 29 #define FB_MAJOR 29 /* /dev/fb* framebuffers */ #define MTD_BLOCK_MAJOR 31 #define CM206_CDROM_MAJOR 32 #define IDE2_MAJOR 33 #define IDE3_MAJOR 34 #define Z8530_MAJOR 34 #define XPRAM_MAJOR 35 /* Expanded storage on S/390: "slow ram"*/ #define NETLINK_MAJOR 36 #define PS2ESDI_MAJOR 36 #define IDETAPE_MAJOR 37 #define Z2RAM_MAJOR 37 #define APBLOCK_MAJOR 38 /* AP1000 Block device */ #define DDV_MAJOR 39 /* AP1000 DDV block device */ #define NBD_MAJOR 43 /* Network block device */ #define RISCOM8_NORMAL_MAJOR 48 #define DAC960_MAJOR 48 /* 48..55 */ #define RISCOM8_CALLOUT_MAJOR 49 #define MKISS_MAJOR 55 #define DSP56K_MAJOR 55 /* DSP56001 processor device */ #define IDE4_MAJOR 56 #define IDE5_MAJOR 57 #define SCSI_DISK1_MAJOR 65 #define SCSI_DISK2_MAJOR 66 #define SCSI_DISK3_MAJOR 67 #define SCSI_DISK4_MAJOR 68 #define SCSI_DISK5_MAJOR 69 #define SCSI_DISK6_MAJOR 70 #define SCSI_DISK7_MAJOR 71 #define COMPAQ_SMART2_MAJOR 72 #define COMPAQ_SMART2_MAJOR1 73 #define COMPAQ_SMART2_MAJOR2 74 #define COMPAQ_SMART2_MAJOR3 75 #define COMPAQ_SMART2_MAJOR4 76 #define COMPAQ_SMART2_MAJOR5 77 #define COMPAQ_SMART2_MAJOR6 78 #define COMPAQ_SMART2_MAJOR7 79 #define SPECIALIX_NORMAL_MAJOR 75 #define SPECIALIX_CALLOUT_MAJOR 76 #define AURORA_MAJOR 79 #define I2O_MAJOR 80 /* 80->87 */ #define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */ #define SCSI_CHANGER_MAJOR 86 #define IDE6_MAJOR 88 #define IDE7_MAJOR 89 #define IDE8_MAJOR 90 #define MTD_CHAR_MAJOR 90 #define IDE9_MAJOR 91 #define DASD_MAJOR 94 #define MDISK_MAJOR 95 #define UBD_MAJOR 98 #define PP_MAJOR 99 #define JSFD_MAJOR 99 #define PHONE_MAJOR 100 #define COMPAQ_CISS_MAJOR 104 #define COMPAQ_CISS_MAJOR1 105 #define COMPAQ_CISS_MAJOR2 106 #define COMPAQ_CISS_MAJOR3 107 #define COMPAQ_CISS_MAJOR4 108 #define COMPAQ_CISS_MAJOR5 109 #define COMPAQ_CISS_MAJOR6 110 #define COMPAQ_CISS_MAJOR7 111 #define VIODASD_MAJOR 112 #define VIOCD_MAJOR 113 #define ATARAID_MAJOR 114 #define SCSI_DISK8_MAJOR 128 #define SCSI_DISK9_MAJOR 129 #define SCSI_DISK10_MAJOR 130 #define SCSI_DISK11_MAJOR 131 #define SCSI_DISK12_MAJOR 132 #define SCSI_DISK13_MAJOR 133 #define SCSI_DISK14_MAJOR 134 #define SCSI_DISK15_MAJOR 135 #define UNIX98_PTY_MASTER_MAJOR 128 #define UNIX98_PTY_MAJOR_COUNT 8 #define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) #define DRBD_MAJOR 147 #define RTF_MAJOR 150 #define RAW_MAJOR 162 #define USB_ACM_MAJOR 166 #define USB_ACM_AUX_MAJOR 167 #define USB_CHAR_MAJOR 180 #define MMC_BLOCK_MAJOR 179 #define VXVM_MAJOR 199 /* VERITAS volume i/o driver */ #define VXSPEC_MAJOR 200 /* VERITAS volume config driver */ #define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */ #define XENVBD_MAJOR 202 /* Xen virtual block device */ #define MSR_MAJOR 202 #define CPUID_MAJOR 203 #define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */ #define IBM_TTY3270_MAJOR 227 #define IBM_FS3270_MAJOR 228 #define VIOTAPE_MAJOR 230 #define BLOCK_EXT_MAJOR 259 #define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */ #endif linux/map_to_7segment.h 0000644 00000016123 15063602051 0011145 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MAP_TO_7SEGMENT_H #define MAP_TO_7SEGMENT_H /* This file provides translation primitives and tables for the conversion * of (ASCII) characters to a 7-segments notation. * * The 7 segment's wikipedia notation below is used as standard. * See: http://en.wikipedia.org/wiki/Seven_segment_display * * Notation: +-a-+ * f b * +-g-+ * e c * +-d-+ * * Usage: * * Register a map variable, and fill it with a character set: * static SEG7_DEFAULT_MAP(map_seg7); * * * Then use for conversion: * seg7 = map_to_seg7(&map_seg7, some_char); * ... * * In device drivers it is recommended, if required, to make the char map * accessible via the sysfs interface using the following scheme: * * static ssize_t show_map(struct device *dev, char *buf) { * memcpy(buf, &map_seg7, sizeof(map_seg7)); * return sizeof(map_seg7); * } * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) { * if(cnt != sizeof(map_seg7)) * return -EINVAL; * memcpy(&map_seg7, buf, cnt); * return cnt; * } * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map); * * History: * 2005-05-31 RFC linux-kernel@vger.kernel.org */ #include <linux/errno.h> #define BIT_SEG7_A 0 #define BIT_SEG7_B 1 #define BIT_SEG7_C 2 #define BIT_SEG7_D 3 #define BIT_SEG7_E 4 #define BIT_SEG7_F 5 #define BIT_SEG7_G 6 #define BIT_SEG7_RESERVED 7 struct seg7_conversion_map { unsigned char table[128]; }; static __inline__ int map_to_seg7(struct seg7_conversion_map *map, int c) { return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; } #define SEG7_CONVERSION_MAP(_name, _map) \ struct seg7_conversion_map _name = { .table = { _map } } /* * It is recommended to use a facility that allows user space to redefine * custom character sets for LCD devices. Please use a sysfs interface * as described above. */ #define MAP_TO_SEG7_SYSFS_FILE "map_seg7" /******************************************************************************* * ASCII conversion table ******************************************************************************/ #define _SEG7(l,a,b,c,d,e,f,g) \ ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \ e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G ) #define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, #define _MAP_33_47_ASCII_SEG7_SYMBOL \ _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\ _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\ _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\ _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\ _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1), #define _MAP_48_57_ASCII_SEG7_NUMERIC \ _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\ _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\ _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\ _SEG7('9',1,1,1,1,0,1,1), #define _MAP_58_64_ASCII_SEG7_SYMBOL \ _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\ _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\ _SEG7('@',1,1,0,1,1,1,1), #define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\ _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\ _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\ _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\ _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\ _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), #define _MAP_91_96_ASCII_SEG7_SYMBOL \ _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\ _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0), #define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\ _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\ _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\ _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\ _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\ _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), #define _MAP_123_126_ASCII_SEG7_SYMBOL \ _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\ _SEG7('~',1,0,0,0,0,0,0), /* Maps */ /* This set tries to map as close as possible to the visible characteristics * of the ASCII symbol, lowercase and uppercase letters may differ in * presentation on the display. */ #define MAP_ASCII7SEG_ALPHANUM \ _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ _MAP_33_47_ASCII_SEG7_SYMBOL \ _MAP_48_57_ASCII_SEG7_NUMERIC \ _MAP_58_64_ASCII_SEG7_SYMBOL \ _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ _MAP_91_96_ASCII_SEG7_SYMBOL \ _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _MAP_123_126_ASCII_SEG7_SYMBOL /* This set tries to map as close as possible to the symbolic characteristics * of the ASCII character for maximum discrimination. * For now this means all alpha chars are in lower case representations. * (This for example facilitates the use of hex numbers with uppercase input.) */ #define MAP_ASCII7SEG_ALPHANUM_LC \ _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ _MAP_33_47_ASCII_SEG7_SYMBOL \ _MAP_48_57_ASCII_SEG7_NUMERIC \ _MAP_58_64_ASCII_SEG7_SYMBOL \ _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _MAP_91_96_ASCII_SEG7_SYMBOL \ _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ _MAP_123_126_ASCII_SEG7_SYMBOL #define SEG7_DEFAULT_MAP(_name) \ SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM) #endif /* MAP_TO_7SEGMENT_H */ linux/matroxfb.h 0000644 00000002670 15063602051 0007701 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MATROXFB_H__ #define __LINUX_MATROXFB_H__ #include <asm/ioctl.h> #include <linux/types.h> #include <linux/videodev2.h> #include <linux/fb.h> struct matroxioc_output_mode { __u32 output; /* which output */ #define MATROXFB_OUTPUT_PRIMARY 0x0000 #define MATROXFB_OUTPUT_SECONDARY 0x0001 #define MATROXFB_OUTPUT_DFP 0x0002 __u32 mode; /* which mode */ #define MATROXFB_OUTPUT_MODE_PAL 0x0001 #define MATROXFB_OUTPUT_MODE_NTSC 0x0002 #define MATROXFB_OUTPUT_MODE_MONITOR 0x0080 }; #define MATROXFB_SET_OUTPUT_MODE _IOW('n',0xFA,size_t) #define MATROXFB_GET_OUTPUT_MODE _IOWR('n',0xFA,size_t) /* bitfield */ #define MATROXFB_OUTPUT_CONN_PRIMARY (1 << MATROXFB_OUTPUT_PRIMARY) #define MATROXFB_OUTPUT_CONN_SECONDARY (1 << MATROXFB_OUTPUT_SECONDARY) #define MATROXFB_OUTPUT_CONN_DFP (1 << MATROXFB_OUTPUT_DFP) /* connect these outputs to this framebuffer */ #define MATROXFB_SET_OUTPUT_CONNECTION _IOW('n',0xF8,size_t) /* which outputs are connected to this framebuffer */ #define MATROXFB_GET_OUTPUT_CONNECTION _IOR('n',0xF8,size_t) /* which outputs are available for this framebuffer */ #define MATROXFB_GET_AVAILABLE_OUTPUTS _IOR('n',0xF9,size_t) /* which outputs exist on this framebuffer */ #define MATROXFB_GET_ALL_OUTPUTS _IOR('n',0xFB,size_t) enum matroxfb_ctrl_id { MATROXFB_CID_TESTOUT = V4L2_CID_PRIVATE_BASE, MATROXFB_CID_DEFLICKER, MATROXFB_CID_LAST }; #endif linux/max2175.h 0000644 00000002013 15063602051 0007152 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * max2175.h * * Maxim Integrated MAX2175 RF to Bits tuner driver - user space header file. * * Copyright (C) 2016 Maxim Integrated Products * Copyright (C) 2017 Renesas Electronics Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __UAPI_MAX2175_H_ #define __UAPI_MAX2175_H_ #include <linux/v4l2-controls.h> #define V4L2_CID_MAX2175_I2S_ENABLE (V4L2_CID_USER_MAX217X_BASE + 0x01) #define V4L2_CID_MAX2175_HSLS (V4L2_CID_USER_MAX217X_BASE + 0x02) #define V4L2_CID_MAX2175_RX_MODE (V4L2_CID_USER_MAX217X_BASE + 0x03) #endif /* __UAPI_MAX2175_H_ */ linux/mdio.h 0000644 00000041570 15063602051 0007011 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/mdio.h: definitions for MDIO (clause 45) transceivers * Copyright 2006-2009 Solarflare Communications Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation, incorporated herein by reference. */ #ifndef __LINUX_MDIO_H__ #define __LINUX_MDIO_H__ #include <linux/types.h> #include <linux/mii.h> /* MDIO Manageable Devices (MMDs). */ #define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/ * Physical Medium Dependent */ #define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */ #define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */ #define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */ #define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */ #define MDIO_MMD_TC 6 /* Transmission Convergence */ #define MDIO_MMD_AN 7 /* Auto-Negotiation */ #define MDIO_MMD_C22EXT 29 /* Clause 22 extension */ #define MDIO_MMD_VEND1 30 /* Vendor specific 1 */ #define MDIO_MMD_VEND2 31 /* Vendor specific 2 */ /* Generic MDIO registers. */ #define MDIO_CTRL1 MII_BMCR #define MDIO_STAT1 MII_BMSR #define MDIO_DEVID1 MII_PHYSID1 #define MDIO_DEVID2 MII_PHYSID2 #define MDIO_SPEED 4 /* Speed ability */ #define MDIO_DEVS1 5 /* Devices in package */ #define MDIO_DEVS2 6 #define MDIO_CTRL2 7 /* 10G control 2 */ #define MDIO_STAT2 8 /* 10G status 2 */ #define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */ #define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */ #define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */ #define MDIO_PKGID1 14 /* Package identifier */ #define MDIO_PKGID2 15 #define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */ #define MDIO_AN_LPA 19 /* AN LP abilities (base page) */ #define MDIO_PCS_EEE_ABLE 20 /* EEE Capability register */ #define MDIO_PCS_EEE_ABLE2 21 /* EEE Capability register 2 */ #define MDIO_PMA_NG_EXTABLE 21 /* 2.5G/5G PMA/PMD extended ability */ #define MDIO_PCS_EEE_WK_ERR 22 /* EEE wake error counter */ #define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */ #define MDIO_AN_EEE_ADV 60 /* EEE advertisement */ #define MDIO_AN_EEE_LPABLE 61 /* EEE link partner ability */ #define MDIO_AN_EEE_ADV2 62 /* EEE advertisement 2 */ #define MDIO_AN_EEE_LPABLE2 63 /* EEE link partner ability 2 */ /* Media-dependent registers. */ #define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */ #define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ #define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A. * Lanes B-D are numbered 134-136. */ #define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */ #define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */ #define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */ #define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */ #define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */ #define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */ /* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */ #define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */ #define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */ #define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */ #define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */ #define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */ #define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */ /* Control register 1. */ /* Enable extended speed selection */ #define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100) /* All speed selection bits */ #define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c) #define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX #define MDIO_CTRL1_LPOWER BMCR_PDOWN #define MDIO_CTRL1_RESET BMCR_RESET #define MDIO_PMA_CTRL1_LOOPBACK 0x0001 #define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000 #define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100 #define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK #define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK #define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART #define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE #define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */ #define MDIO_PCS_CTRL1_CLKSTOP_EN 0x400 /* Stop the clock during LPI */ /* 10 Gb/s */ #define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00) /* 10PASS-TS/2BASE-TL */ #define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04) /* 2.5 Gb/s */ #define MDIO_CTRL1_SPEED2_5G (MDIO_CTRL1_SPEEDSELEXT | 0x18) /* 5 Gb/s */ #define MDIO_CTRL1_SPEED5G (MDIO_CTRL1_SPEEDSELEXT | 0x1c) /* Status register 1. */ #define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */ #define MDIO_STAT1_LSTATUS BMSR_LSTATUS #define MDIO_STAT1_FAULT 0x0080 /* Fault */ #define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */ #define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE #define MDIO_AN_STAT1_RFAULT BMSR_RFAULT #define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE #define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */ #define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */ /* Speed register. */ #define MDIO_SPEED_10G 0x0001 /* 10G capable */ #define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */ #define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */ #define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */ #define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */ #define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */ #define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */ #define MDIO_PCS_SPEED_2_5G 0x0040 /* 2.5G capable */ #define MDIO_PCS_SPEED_5G 0x0080 /* 5G capable */ /* Device present registers. */ #define MDIO_DEVS_PRESENT(devad) (1 << (devad)) #define MDIO_DEVS_C22PRESENT MDIO_DEVS_PRESENT(0) #define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD) #define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS) #define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS) #define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS) #define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS) #define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC) #define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN) #define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT) #define MDIO_DEVS_VEND1 MDIO_DEVS_PRESENT(MDIO_MMD_VEND1) #define MDIO_DEVS_VEND2 MDIO_DEVS_PRESENT(MDIO_MMD_VEND2) /* Control register 2. */ #define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */ #define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */ #define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */ #define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */ #define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */ #define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */ #define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */ #define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */ #define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */ #define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */ #define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */ #define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */ #define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */ #define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */ #define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */ #define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */ #define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */ #define MDIO_PMA_CTRL2_2_5GBT 0x0030 /* 2.5GBaseT type */ #define MDIO_PMA_CTRL2_5GBT 0x0031 /* 5GBaseT type */ #define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */ #define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */ #define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */ #define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */ #define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */ /* Status register 2. */ #define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */ #define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */ #define MDIO_STAT2_DEVPRST 0xc000 /* Device present */ #define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */ #define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */ #define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */ #define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */ #define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */ #define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */ #define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */ #define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */ #define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */ #define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */ #define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */ #define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */ #define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */ #define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */ #define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */ #define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */ #define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */ #define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */ /* Transmit disable register. */ #define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */ #define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */ #define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */ #define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */ #define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */ /* Receive signal detect register. */ #define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */ #define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */ #define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */ #define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */ #define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */ /* Extended abilities register. */ #define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */ #define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */ #define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */ #define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */ #define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */ #define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */ #define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */ #define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */ #define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */ #define MDIO_PMA_EXTABLE_NBT 0x4000 /* 2.5/5GBASE-T ability */ /* PHY XGXS lane state register. */ #define MDIO_PHYXS_LNSTAT_SYNC0 0x0001 #define MDIO_PHYXS_LNSTAT_SYNC1 0x0002 #define MDIO_PHYXS_LNSTAT_SYNC2 0x0004 #define MDIO_PHYXS_LNSTAT_SYNC3 0x0008 #define MDIO_PHYXS_LNSTAT_ALIGN 0x1000 /* PMA 10GBASE-T pair swap & polarity */ #define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */ #define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */ #define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */ #define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */ #define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */ #define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */ /* PMA 10GBASE-T TX power register. */ #define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */ /* PMA 10GBASE-T SNR registers. */ /* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */ #define MDIO_PMA_10GBT_SNR_BIAS 0x8000 #define MDIO_PMA_10GBT_SNR_MAX 127 /* PMA 10GBASE-R FEC ability register. */ #define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */ #define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */ /* PCS 10GBASE-R/-T status register 1. */ #define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */ /* PCS 10GBASE-R/-T status register 2. */ #define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff #define MDIO_PCS_10GBRT_STAT2_BER 0x3f00 /* AN 10GBASE-T control register. */ #define MDIO_AN_10GBT_CTRL_ADV2_5G 0x0080 /* Advertise 2.5GBASE-T */ #define MDIO_AN_10GBT_CTRL_ADV5G 0x0100 /* Advertise 5GBASE-T */ #define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */ /* AN 10GBASE-T status register. */ #define MDIO_AN_10GBT_STAT_LP2_5G 0x0020 /* LP is 2.5GBT capable */ #define MDIO_AN_10GBT_STAT_LP5G 0x0040 /* LP is 5GBT capable */ #define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */ #define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */ #define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */ #define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */ #define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */ #define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */ #define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */ /* EEE Supported/Advertisement/LP Advertisement registers. * * EEE capability Register (3.20), Advertisement (7.60) and * Link partner ability (7.61) registers have and can use the same identical * bit masks. */ #define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */ #define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */ /* Note: the two defines above can be potentially used by the user-land * and cannot remove them now. * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros * using the previous ones (that can be considered obsolete). */ #define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */ #define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */ #define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */ #define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */ #define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */ #define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */ #define MDIO_EEE_40GR_FW 0x0100 /* 40G R fast wake */ #define MDIO_EEE_40GR_DS 0x0200 /* 40G R deep sleep */ #define MDIO_EEE_100GR_FW 0x1000 /* 100G R fast wake */ #define MDIO_EEE_100GR_DS 0x2000 /* 100G R deep sleep */ #define MDIO_EEE_2_5GT 0x0001 /* 2.5GT EEE cap */ #define MDIO_EEE_5GT 0x0002 /* 5GT EEE cap */ /* 2.5G/5G Extended abilities register. */ #define MDIO_PMA_NG_EXTABLE_2_5GBT 0x0001 /* 2.5GBASET ability */ #define MDIO_PMA_NG_EXTABLE_5GBT 0x0002 /* 5GBASET ability */ /* LASI RX_ALARM control/status registers. */ #define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */ #define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */ #define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */ #define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */ #define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */ /* LASI TX_ALARM control/status registers. */ #define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */ #define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */ #define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */ #define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */ #define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */ #define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */ /* LASI control/status registers. */ #define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */ #define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */ #define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */ /* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */ #define MDIO_PHY_ID_C45 0x8000 #define MDIO_PHY_ID_PRTAD 0x03e0 #define MDIO_PHY_ID_DEVAD 0x001f #define MDIO_PHY_ID_C45_MASK \ (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD) static __inline__ __u16 mdio_phy_id_c45(int prtad, int devad) { return MDIO_PHY_ID_C45 | (prtad << 5) | devad; } /* UsxgmiiChannelInfo[15:0] for USXGMII in-band auto-negotiation.*/ #define MDIO_USXGMII_EEE_CLK_STP 0x0080 /* EEE clock stop supported */ #define MDIO_USXGMII_EEE 0x0100 /* EEE supported */ #define MDIO_USXGMII_SPD_MASK 0x0e00 /* USXGMII speed mask */ #define MDIO_USXGMII_FULL_DUPLEX 0x1000 /* USXGMII full duplex */ #define MDIO_USXGMII_DPX_SPD_MASK 0x1e00 /* USXGMII duplex and speed bits */ #define MDIO_USXGMII_10 0x0000 /* 10Mbps */ #define MDIO_USXGMII_10HALF 0x0000 /* 10Mbps half-duplex */ #define MDIO_USXGMII_10FULL 0x1000 /* 10Mbps full-duplex */ #define MDIO_USXGMII_100 0x0200 /* 100Mbps */ #define MDIO_USXGMII_100HALF 0x0200 /* 100Mbps half-duplex */ #define MDIO_USXGMII_100FULL 0x1200 /* 100Mbps full-duplex */ #define MDIO_USXGMII_1000 0x0400 /* 1000Mbps */ #define MDIO_USXGMII_1000HALF 0x0400 /* 1000Mbps half-duplex */ #define MDIO_USXGMII_1000FULL 0x1400 /* 1000Mbps full-duplex */ #define MDIO_USXGMII_10G 0x0600 /* 10Gbps */ #define MDIO_USXGMII_10GHALF 0x0600 /* 10Gbps half-duplex */ #define MDIO_USXGMII_10GFULL 0x1600 /* 10Gbps full-duplex */ #define MDIO_USXGMII_2500 0x0800 /* 2500Mbps */ #define MDIO_USXGMII_2500HALF 0x0800 /* 2500Mbps half-duplex */ #define MDIO_USXGMII_2500FULL 0x1800 /* 2500Mbps full-duplex */ #define MDIO_USXGMII_5000 0x0a00 /* 5000Mbps */ #define MDIO_USXGMII_5000HALF 0x0a00 /* 5000Mbps half-duplex */ #define MDIO_USXGMII_5000FULL 0x1a00 /* 5000Mbps full-duplex */ #define MDIO_USXGMII_LINK 0x8000 /* PHY link with copper-side partner */ #endif /* __LINUX_MDIO_H__ */ linux/media-bus-format.h 0000644 00000014413 15063602051 0011211 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Media Bus API header * * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __LINUX_MEDIA_BUS_FORMAT_H #define __LINUX_MEDIA_BUS_FORMAT_H /* * These bus formats uniquely identify data formats on the data bus. Format 0 * is reserved, MEDIA_BUS_FMT_FIXED shall be used by host-client pairs, where * the data format is fixed. Additionally, "2X8" means that one pixel is * transferred in two 8-bit samples, "BE" or "LE" specify in which order those * samples are transferred over the bus: "LE" means that the least significant * bits are transferred first, "BE" means that the most significant bits are * transferred first, and "PADHI" and "PADLO" define which bits - low or high, * in the incomplete high byte, are filled with padding bits. * * The bus formats are grouped by type, bus_width, bits per component, samples * per pixel and order of subsamples. Numerical values are sorted using generic * numerical sort order (8 thus comes before 10). * * As their value can't change when a new bus format is inserted in the * enumeration, the bus formats are explicitly given a numerical value. The next * free values for each category are listed below, update them when inserting * new pixel codes. */ #define MEDIA_BUS_FMT_FIXED 0x0001 /* RGB - next is 0x101b */ #define MEDIA_BUS_FMT_RGB444_1X12 0x1016 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE 0x1003 #define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004 #define MEDIA_BUS_FMT_RGB565_1X16 0x1017 #define MEDIA_BUS_FMT_BGR565_2X8_BE 0x1005 #define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006 #define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007 #define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008 #define MEDIA_BUS_FMT_RGB666_1X18 0x1009 #define MEDIA_BUS_FMT_RBG888_1X24 0x100e #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015 #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG 0x1010 #define MEDIA_BUS_FMT_BGR888_1X24 0x1013 #define MEDIA_BUS_FMT_GBR888_1X24 0x1014 #define MEDIA_BUS_FMT_RGB888_1X24 0x100a #define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b #define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c #define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011 #define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012 #define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d #define MEDIA_BUS_FMT_RGB888_1X32_PADHI 0x100f #define MEDIA_BUS_FMT_RGB101010_1X30 0x1018 #define MEDIA_BUS_FMT_RGB121212_1X36 0x1019 #define MEDIA_BUS_FMT_RGB161616_1X48 0x101a /* YUV (including grey) - next is 0x202c */ #define MEDIA_BUS_FMT_Y8_1X8 0x2001 #define MEDIA_BUS_FMT_UV8_1X8 0x2015 #define MEDIA_BUS_FMT_UYVY8_1_5X8 0x2002 #define MEDIA_BUS_FMT_VYUY8_1_5X8 0x2003 #define MEDIA_BUS_FMT_YUYV8_1_5X8 0x2004 #define MEDIA_BUS_FMT_YVYU8_1_5X8 0x2005 #define MEDIA_BUS_FMT_UYVY8_2X8 0x2006 #define MEDIA_BUS_FMT_VYUY8_2X8 0x2007 #define MEDIA_BUS_FMT_YUYV8_2X8 0x2008 #define MEDIA_BUS_FMT_YVYU8_2X8 0x2009 #define MEDIA_BUS_FMT_Y10_1X10 0x200a #define MEDIA_BUS_FMT_UYVY10_2X10 0x2018 #define MEDIA_BUS_FMT_VYUY10_2X10 0x2019 #define MEDIA_BUS_FMT_YUYV10_2X10 0x200b #define MEDIA_BUS_FMT_YVYU10_2X10 0x200c #define MEDIA_BUS_FMT_Y12_1X12 0x2013 #define MEDIA_BUS_FMT_UYVY12_2X12 0x201c #define MEDIA_BUS_FMT_VYUY12_2X12 0x201d #define MEDIA_BUS_FMT_YUYV12_2X12 0x201e #define MEDIA_BUS_FMT_YVYU12_2X12 0x201f #define MEDIA_BUS_FMT_UYVY8_1X16 0x200f #define MEDIA_BUS_FMT_VYUY8_1X16 0x2010 #define MEDIA_BUS_FMT_YUYV8_1X16 0x2011 #define MEDIA_BUS_FMT_YVYU8_1X16 0x2012 #define MEDIA_BUS_FMT_YDYUYDYV8_1X16 0x2014 #define MEDIA_BUS_FMT_UYVY10_1X20 0x201a #define MEDIA_BUS_FMT_VYUY10_1X20 0x201b #define MEDIA_BUS_FMT_YUYV10_1X20 0x200d #define MEDIA_BUS_FMT_YVYU10_1X20 0x200e #define MEDIA_BUS_FMT_VUY8_1X24 0x2024 #define MEDIA_BUS_FMT_YUV8_1X24 0x2025 #define MEDIA_BUS_FMT_UYYVYY8_0_5X24 0x2026 #define MEDIA_BUS_FMT_UYVY12_1X24 0x2020 #define MEDIA_BUS_FMT_VYUY12_1X24 0x2021 #define MEDIA_BUS_FMT_YUYV12_1X24 0x2022 #define MEDIA_BUS_FMT_YVYU12_1X24 0x2023 #define MEDIA_BUS_FMT_YUV10_1X30 0x2016 #define MEDIA_BUS_FMT_UYYVYY10_0_5X30 0x2027 #define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 #define MEDIA_BUS_FMT_UYYVYY12_0_5X36 0x2028 #define MEDIA_BUS_FMT_YUV12_1X36 0x2029 #define MEDIA_BUS_FMT_YUV16_1X48 0x202a #define MEDIA_BUS_FMT_UYYVYY16_0_5X48 0x202b /* Bayer - next is 0x3021 */ #define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 #define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013 #define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002 #define MEDIA_BUS_FMT_SRGGB8_1X8 0x3014 #define MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8 0x3015 #define MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8 0x3016 #define MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8 0x3017 #define MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8 0x3018 #define MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 0x300b #define MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 0x300c #define MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 0x3009 #define MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 0x300d #define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE 0x3003 #define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE 0x3004 #define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE 0x3005 #define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE 0x3006 #define MEDIA_BUS_FMT_SBGGR10_1X10 0x3007 #define MEDIA_BUS_FMT_SGBRG10_1X10 0x300e #define MEDIA_BUS_FMT_SGRBG10_1X10 0x300a #define MEDIA_BUS_FMT_SRGGB10_1X10 0x300f #define MEDIA_BUS_FMT_SBGGR12_1X12 0x3008 #define MEDIA_BUS_FMT_SGBRG12_1X12 0x3010 #define MEDIA_BUS_FMT_SGRBG12_1X12 0x3011 #define MEDIA_BUS_FMT_SRGGB12_1X12 0x3012 #define MEDIA_BUS_FMT_SBGGR14_1X14 0x3019 #define MEDIA_BUS_FMT_SGBRG14_1X14 0x301a #define MEDIA_BUS_FMT_SGRBG14_1X14 0x301b #define MEDIA_BUS_FMT_SRGGB14_1X14 0x301c #define MEDIA_BUS_FMT_SBGGR16_1X16 0x301d #define MEDIA_BUS_FMT_SGBRG16_1X16 0x301e #define MEDIA_BUS_FMT_SGRBG16_1X16 0x301f #define MEDIA_BUS_FMT_SRGGB16_1X16 0x3020 /* JPEG compressed formats - next is 0x4002 */ #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 /* Vendor specific formats - next is 0x5002 */ /* S5C73M3 sensor specific interleaved UYVY and JPEG */ #define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 0x5001 /* HSV - next is 0x6002 */ #define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001 #endif /* __LINUX_MEDIA_BUS_FORMAT_H */ linux/media.h 0000644 00000026166 15063602051 0007144 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Multimedia device API * * Copyright (C) 2010 Nokia Corporation * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __LINUX_MEDIA_H #define __LINUX_MEDIA_H #include <stdint.h> #include <linux/ioctl.h> #include <linux/types.h> #include <linux/version.h> struct media_device_info { char driver[16]; char model[32]; char serial[40]; char bus_info[32]; __u32 media_version; __u32 hw_revision; __u32 driver_version; __u32 reserved[31]; }; /* * Base number ranges for entity functions * * NOTE: Userspace should not rely on these ranges to identify a group * of function types, as newer functions can be added with any name within * the full u32 range. * * Some older functions use the MEDIA_ENT_F_OLD_*_BASE range. Do not * change this, this is for backwards compatibility. When adding new * functions always use MEDIA_ENT_F_BASE. */ #define MEDIA_ENT_F_BASE 0x00000000 #define MEDIA_ENT_F_OLD_BASE 0x00010000 #define MEDIA_ENT_F_OLD_SUBDEV_BASE 0x00020000 /* * Initial value to be used when a new entity is created * Drivers should change it to something useful. */ #define MEDIA_ENT_F_UNKNOWN MEDIA_ENT_F_BASE /* * Subdevs are initialized with MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN in order * to preserve backward compatibility. Drivers must change to the proper * subdev type before registering the entity. */ #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE /* * DVB entity functions */ #define MEDIA_ENT_F_DTV_DEMOD (MEDIA_ENT_F_BASE + 0x00001) #define MEDIA_ENT_F_TS_DEMUX (MEDIA_ENT_F_BASE + 0x00002) #define MEDIA_ENT_F_DTV_CA (MEDIA_ENT_F_BASE + 0x00003) #define MEDIA_ENT_F_DTV_NET_DECAP (MEDIA_ENT_F_BASE + 0x00004) /* * I/O entity functions */ #define MEDIA_ENT_F_IO_V4L (MEDIA_ENT_F_OLD_BASE + 1) #define MEDIA_ENT_F_IO_DTV (MEDIA_ENT_F_BASE + 0x01001) #define MEDIA_ENT_F_IO_VBI (MEDIA_ENT_F_BASE + 0x01002) #define MEDIA_ENT_F_IO_SWRADIO (MEDIA_ENT_F_BASE + 0x01003) /* * Sensor functions */ #define MEDIA_ENT_F_CAM_SENSOR (MEDIA_ENT_F_OLD_SUBDEV_BASE + 1) #define MEDIA_ENT_F_FLASH (MEDIA_ENT_F_OLD_SUBDEV_BASE + 2) #define MEDIA_ENT_F_LENS (MEDIA_ENT_F_OLD_SUBDEV_BASE + 3) /* * Video decoder functions */ #define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4) #define MEDIA_ENT_F_DTV_DECODER (MEDIA_ENT_F_BASE + 0x6001) /* * Digital TV, analog TV, radio and/or software defined radio tuner functions. * * It is a responsibility of the master/bridge drivers to add connectors * and links for MEDIA_ENT_F_TUNER. Please notice that some old tuners * may require the usage of separate I2C chips to decode analog TV signals, * when the master/bridge chipset doesn't have its own TV standard decoder. * On such cases, the IF-PLL staging is mapped via one or two entities: * MEDIA_ENT_F_IF_VID_DECODER and/or MEDIA_ENT_F_IF_AUD_DECODER. */ #define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5) /* * Analog TV IF-PLL decoder functions * * It is a responsibility of the master/bridge drivers to create links * for MEDIA_ENT_F_IF_VID_DECODER and MEDIA_ENT_F_IF_AUD_DECODER. */ #define MEDIA_ENT_F_IF_VID_DECODER (MEDIA_ENT_F_BASE + 0x02001) #define MEDIA_ENT_F_IF_AUD_DECODER (MEDIA_ENT_F_BASE + 0x02002) /* * Audio entity functions */ #define MEDIA_ENT_F_AUDIO_CAPTURE (MEDIA_ENT_F_BASE + 0x03001) #define MEDIA_ENT_F_AUDIO_PLAYBACK (MEDIA_ENT_F_BASE + 0x03002) #define MEDIA_ENT_F_AUDIO_MIXER (MEDIA_ENT_F_BASE + 0x03003) /* * Processing entity functions */ #define MEDIA_ENT_F_PROC_VIDEO_COMPOSER (MEDIA_ENT_F_BASE + 0x4001) #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER (MEDIA_ENT_F_BASE + 0x4002) #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV (MEDIA_ENT_F_BASE + 0x4003) #define MEDIA_ENT_F_PROC_VIDEO_LUT (MEDIA_ENT_F_BASE + 0x4004) #define MEDIA_ENT_F_PROC_VIDEO_SCALER (MEDIA_ENT_F_BASE + 0x4005) #define MEDIA_ENT_F_PROC_VIDEO_STATISTICS (MEDIA_ENT_F_BASE + 0x4006) /* * Switch and bridge entity functions */ #define MEDIA_ENT_F_VID_MUX (MEDIA_ENT_F_BASE + 0x5001) #define MEDIA_ENT_F_VID_IF_BRIDGE (MEDIA_ENT_F_BASE + 0x5002) /* Entity flags */ #define MEDIA_ENT_FL_DEFAULT (1 << 0) #define MEDIA_ENT_FL_CONNECTOR (1 << 1) /* OR with the entity id value to find the next entity */ #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) struct media_entity_desc { __u32 id; char name[32]; __u32 type; __u32 revision; __u32 flags; __u32 group_id; __u16 pads; __u16 links; __u32 reserved[4]; union { /* Node specifications */ struct { __u32 major; __u32 minor; } dev; /* * TODO: this shouldn't have been added without * actual drivers that use this. When the first real driver * appears that sets this information, special attention * should be given whether this information is 1) enough, and * 2) can deal with udev rules that rename devices. The struct * dev would not be sufficient for this since that does not * contain the subdevice information. In addition, struct dev * can only refer to a single device, and not to multiple (e.g. * pcm and mixer devices). */ struct { __u32 card; __u32 device; __u32 subdevice; } alsa; /* * DEPRECATED: previous node specifications. Kept just to * avoid breaking compilation. Use media_entity_desc.dev * instead. */ struct { __u32 major; __u32 minor; } v4l; struct { __u32 major; __u32 minor; } fb; int dvb; /* Sub-device specifications */ /* Nothing needed yet */ __u8 raw[184]; }; }; #define MEDIA_PAD_FL_SINK (1 << 0) #define MEDIA_PAD_FL_SOURCE (1 << 1) #define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) struct media_pad_desc { __u32 entity; /* entity ID */ __u16 index; /* pad index */ __u32 flags; /* pad flags */ __u32 reserved[2]; }; #define MEDIA_LNK_FL_ENABLED (1 << 0) #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) #define MEDIA_LNK_FL_DYNAMIC (1 << 2) #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) # define MEDIA_LNK_FL_DATA_LINK (0 << 28) # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) struct media_link_desc { struct media_pad_desc source; struct media_pad_desc sink; __u32 flags; __u32 reserved[2]; }; struct media_links_enum { __u32 entity; /* Should have enough room for pads elements */ struct media_pad_desc *pads; /* Should have enough room for links elements */ struct media_link_desc *links; __u32 reserved[4]; }; /* Interface type ranges */ #define MEDIA_INTF_T_DVB_BASE 0x00000100 #define MEDIA_INTF_T_V4L_BASE 0x00000200 /* Interface types */ #define MEDIA_INTF_T_DVB_FE (MEDIA_INTF_T_DVB_BASE) #define MEDIA_INTF_T_DVB_DEMUX (MEDIA_INTF_T_DVB_BASE + 1) #define MEDIA_INTF_T_DVB_DVR (MEDIA_INTF_T_DVB_BASE + 2) #define MEDIA_INTF_T_DVB_CA (MEDIA_INTF_T_DVB_BASE + 3) #define MEDIA_INTF_T_DVB_NET (MEDIA_INTF_T_DVB_BASE + 4) #define MEDIA_INTF_T_V4L_VIDEO (MEDIA_INTF_T_V4L_BASE) #define MEDIA_INTF_T_V4L_VBI (MEDIA_INTF_T_V4L_BASE + 1) #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) #define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5) /* * MC next gen API definitions */ struct media_v2_entity { __u32 id; char name[64]; __u32 function; /* Main function of the entity */ __u32 reserved[6]; } __attribute__ ((packed)); /* Should match the specific fields at media_intf_devnode */ struct media_v2_intf_devnode { __u32 major; __u32 minor; } __attribute__ ((packed)); struct media_v2_interface { __u32 id; __u32 intf_type; __u32 flags; __u32 reserved[9]; union { struct media_v2_intf_devnode devnode; __u32 raw[16]; }; } __attribute__ ((packed)); struct media_v2_pad { __u32 id; __u32 entity_id; __u32 flags; __u32 reserved[5]; } __attribute__ ((packed)); struct media_v2_link { __u32 id; __u32 source_id; __u32 sink_id; __u32 flags; __u32 reserved[6]; } __attribute__ ((packed)); struct media_v2_topology { __u64 topology_version; __u32 num_entities; __u32 reserved1; __u64 ptr_entities; __u32 num_interfaces; __u32 reserved2; __u64 ptr_interfaces; __u32 num_pads; __u32 reserved3; __u64 ptr_pads; __u32 num_links; __u32 reserved4; __u64 ptr_links; } __attribute__ ((packed)); /* ioctls */ #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) #define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) /* * Legacy symbols used to avoid userspace compilation breakages. * Do not use any of this in new applications! * * Those symbols map the entity function into types and should be * used only on legacy programs for legacy hardware. Don't rely * on those for MEDIA_IOC_G_TOPOLOGY. */ #define MEDIA_ENT_TYPE_SHIFT 16 #define MEDIA_ENT_TYPE_MASK 0x00ff0000 #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff #define MEDIA_ENT_T_DEVNODE_UNKNOWN (MEDIA_ENT_F_OLD_BASE | \ MEDIA_ENT_SUBTYPE_MASK) #define MEDIA_ENT_T_DEVNODE MEDIA_ENT_F_OLD_BASE #define MEDIA_ENT_T_DEVNODE_V4L MEDIA_ENT_F_IO_V4L #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_F_OLD_BASE + 2) #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_F_OLD_BASE + 3) #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_F_OLD_BASE + 4) #define MEDIA_ENT_T_UNKNOWN MEDIA_ENT_F_UNKNOWN #define MEDIA_ENT_T_V4L2_VIDEO MEDIA_ENT_F_IO_V4L #define MEDIA_ENT_T_V4L2_SUBDEV MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR MEDIA_ENT_F_CAM_SENSOR #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH MEDIA_ENT_F_FLASH #define MEDIA_ENT_T_V4L2_SUBDEV_LENS MEDIA_ENT_F_LENS #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER MEDIA_ENT_F_ATV_DECODER #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER MEDIA_ENT_F_TUNER /* * There is still no ALSA support in the media controller. These * defines should not have been added and we leave them here only * in case some application tries to use these defines. */ #define MEDIA_INTF_T_ALSA_BASE 0x00000300 #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) #define MEDIA_INTF_T_ALSA_CONTROL (MEDIA_INTF_T_ALSA_BASE + 2) #define MEDIA_INTF_T_ALSA_COMPRESS (MEDIA_INTF_T_ALSA_BASE + 3) #define MEDIA_INTF_T_ALSA_RAWMIDI (MEDIA_INTF_T_ALSA_BASE + 4) #define MEDIA_INTF_T_ALSA_HWDEP (MEDIA_INTF_T_ALSA_BASE + 5) #define MEDIA_INTF_T_ALSA_SEQUENCER (MEDIA_INTF_T_ALSA_BASE + 6) #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) /* Obsolete symbol for media_version, no longer used in the kernel */ #define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0) #endif /* __LINUX_MEDIA_H */ linux/mei.h 0000644 00000006623 15063602051 0006633 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Copyright(c) 2003-2015 Intel Corporation. All rights reserved. * Intel Management Engine Interface (Intel MEI) Linux driver * Intel MEI Interface Header */ #ifndef _LINUX_MEI_H #define _LINUX_MEI_H #include <linux/uuid.h> /* * This IOCTL is used to associate the current file descriptor with a * FW Client (given by UUID). This opens a communication channel * between a host client and a FW client. From this point every read and write * will communicate with the associated FW client. * Only in close() (file_operation release()) the communication between * the clients is disconnected * * The IOCTL argument is a struct with a union that contains * the input parameter and the output parameter for this IOCTL. * * The input parameter is UUID of the FW Client. * The output parameter is the properties of the FW client * (FW protocol version and max message size). * */ #define IOCTL_MEI_CONNECT_CLIENT \ _IOWR('H' , 0x01, struct mei_connect_client_data) /* * Intel MEI client information struct */ struct mei_client { __u32 max_msg_length; __u8 protocol_version; __u8 reserved[3]; }; /* * IOCTL Connect Client Data structure */ struct mei_connect_client_data { union { uuid_le in_client_uuid; struct mei_client out_client_properties; }; }; /** * DOC: set and unset event notification for a connected client * * The IOCTL argument is 1 for enabling event notification and 0 for * disabling the service * Return: -EOPNOTSUPP if the devices doesn't support the feature */ #define IOCTL_MEI_NOTIFY_SET _IOW('H', 0x02, __u32) /** * DOC: retrieve notification * * The IOCTL output argument is 1 if an event was is pending and 0 otherwise * the ioctl has to be called in order to acknowledge pending event * * Return: -EOPNOTSUPP if the devices doesn't support the feature */ #define IOCTL_MEI_NOTIFY_GET _IOR('H', 0x03, __u32) /** * struct mei_connect_client_vtag - mei client information struct with vtag * * @in_client_uuid: UUID of client to connect * @vtag: virtual tag * @reserved: reserved for future use */ struct mei_connect_client_vtag { uuid_le in_client_uuid; __u8 vtag; __u8 reserved[3]; }; /** * struct mei_connect_client_data_vtag - IOCTL connect data union * * @connect: input connect data * @out_client_properties: output client data */ struct mei_connect_client_data_vtag { union { struct mei_connect_client_vtag connect; struct mei_client out_client_properties; }; }; /** * DOC: * This IOCTL is used to associate the current file descriptor with a * FW Client (given by UUID), and virtual tag (vtag). * The IOCTL opens a communication channel between a host client and * a FW client on a tagged channel. From this point on, every read * and write will communicate with the associated FW client with * on the tagged channel. * Upone close() the communication is terminated. * * The IOCTL argument is a struct with a union that contains * the input parameter and the output parameter for this IOCTL. * * The input parameter is UUID of the FW Client, a vtag [0,255] * The output parameter is the properties of the FW client * (FW protocool version and max message size). * * Clients that do not support tagged connection * will respond with -EOPNOTSUPP. */ #define IOCTL_MEI_CONNECT_CLIENT_VTAG \ _IOWR('H', 0x04, struct mei_connect_client_data_vtag) #endif /* _LINUX_MEI_H */ linux/membarrier.h 0000644 00000017333 15063602051 0010206 0 ustar 00 #ifndef _LINUX_MEMBARRIER_H #define _LINUX_MEMBARRIER_H /* * linux/membarrier.h * * membarrier system call API * * Copyright (c) 2010, 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * enum membarrier_cmd - membarrier system call command * @MEMBARRIER_CMD_QUERY: Query the set of supported commands. It returns * a bitmask of valid commands. * @MEMBARRIER_CMD_GLOBAL: Execute a memory barrier on all running threads. * Upon return from system call, the caller thread * is ensured that all running threads have passed * through a state where all memory accesses to * user-space addresses match program order between * entry to and return from the system call * (non-running threads are de facto in such a * state). This covers threads from all processes * running on the system. This command returns 0. * @MEMBARRIER_CMD_GLOBAL_EXPEDITED: * Execute a memory barrier on all running threads * of all processes which previously registered * with MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. * Upon return from system call, the caller thread * is ensured that all running threads have passed * through a state where all memory accesses to * user-space addresses match program order between * entry to and return from the system call * (non-running threads are de facto in such a * state). This only covers threads from processes * which registered with * MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED. * This command returns 0. Given that * registration is about the intent to receive * the barriers, it is valid to invoke * MEMBARRIER_CMD_GLOBAL_EXPEDITED from a * non-registered process. * @MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED: * Register the process intent to receive * MEMBARRIER_CMD_GLOBAL_EXPEDITED memory * barriers. Always returns 0. * @MEMBARRIER_CMD_PRIVATE_EXPEDITED: * Execute a memory barrier on each running * thread belonging to the same process as the current * thread. Upon return from system call, the * caller thread is ensured that all its running * threads siblings have passed through a state * where all memory accesses to user-space * addresses match program order between entry * to and return from the system call * (non-running threads are de facto in such a * state). This only covers threads from the * same process as the caller thread. This * command returns 0 on success. The * "expedited" commands complete faster than * the non-expedited ones, they never block, * but have the downside of causing extra * overhead. A process needs to register its * intent to use the private expedited command * prior to using it, otherwise this command * returns -EPERM. * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED: * Register the process intent to use * MEMBARRIER_CMD_PRIVATE_EXPEDITED. Always * returns 0. * @MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE: * In addition to provide memory ordering * guarantees described in * MEMBARRIER_CMD_PRIVATE_EXPEDITED, ensure * the caller thread, upon return from system * call, that all its running threads siblings * have executed a core serializing * instruction. (architectures are required to * guarantee that non-running threads issue * core serializing instructions before they * resume user-space execution). This only * covers threads from the same process as the * caller thread. This command returns 0 on * success. The "expedited" commands complete * faster than the non-expedited ones, they * never block, but have the downside of * causing extra overhead. If this command is * not implemented by an architecture, -EINVAL * is returned. A process needs to register its * intent to use the private expedited sync * core command prior to using it, otherwise * this command returns -EPERM. * @MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE: * Register the process intent to use * MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE. * If this command is not implemented by an * architecture, -EINVAL is returned. * Returns 0 on success. * @MEMBARRIER_CMD_SHARED: * Alias to MEMBARRIER_CMD_GLOBAL. Provided for * header backward compatibility. * * Command to be passed to the membarrier system call. The commands need to * be a single bit each, except for MEMBARRIER_CMD_QUERY which is assigned to * the value 0. */ enum membarrier_cmd { MEMBARRIER_CMD_QUERY = 0, MEMBARRIER_CMD_GLOBAL = (1 << 0), MEMBARRIER_CMD_GLOBAL_EXPEDITED = (1 << 1), MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = (1 << 2), MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5), MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6), /* Alias for header backward compatibility. */ MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL, }; #endif /* _LINUX_MEMBARRIER_H */ linux/memfd.h 0000644 00000002454 15063602051 0007147 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MEMFD_H #define _LINUX_MEMFD_H #include <asm-generic/hugetlb_encode.h> /* flags for memfd_create(2) (unsigned int) */ #define MFD_CLOEXEC 0x0001U #define MFD_ALLOW_SEALING 0x0002U #define MFD_HUGETLB 0x0004U /* * Huge page size encoding when MFD_HUGETLB is specified, and a huge page * size other than the default is desired. See hugetlb_encode.h. * All known huge page size encodings are provided here. It is the * responsibility of the application to know which sizes are supported on * the running system. See mmap(2) man page for details. */ #define MFD_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT #define MFD_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK #define MFD_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB #define MFD_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB #define MFD_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB #define MFD_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB #define MFD_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB #define MFD_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB #define MFD_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB #define MFD_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB #define MFD_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB #define MFD_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB #define MFD_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB #define MFD_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB #endif /* _LINUX_MEMFD_H */ linux/mempolicy.h 0000644 00000004267 15063602051 0010061 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NUMA memory policies for Linux. * Copyright 2003,2004 Andi Kleen SuSE Labs */ #ifndef _LINUX_MEMPOLICY_H #define _LINUX_MEMPOLICY_H #include <linux/errno.h> /* * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are * passed by the user to either set_mempolicy() or mbind() in an 'int' actual. * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags. */ /* Policies */ enum { MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, MPOL_INTERLEAVE, MPOL_LOCAL, MPOL_PREFERRED_MANY, MPOL_MAX, /* always last member of enum */ }; /* Flags for set_mempolicy */ #define MPOL_F_STATIC_NODES (1 << 15) #define MPOL_F_RELATIVE_NODES (1 << 14) #define MPOL_F_NUMA_BALANCING (1 << 13) /* Optimize with NUMA balancing if possible */ /* * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to * either set_mempolicy() or mbind(). */ #define MPOL_MODE_FLAGS \ (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES | MPOL_F_NUMA_BALANCING) /* Flags for get_mempolicy */ #define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ #define MPOL_F_ADDR (1<<1) /* look up vma using address */ #define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ /* Flags for mbind */ #define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ #define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to policy */ #define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to policy */ #define MPOL_MF_LAZY (1<<3) /* Modifies '_MOVE: lazy migrate on fault */ #define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */ #define MPOL_MF_VALID (MPOL_MF_STRICT | \ MPOL_MF_MOVE | \ MPOL_MF_MOVE_ALL) /* * Internal flags that share the struct mempolicy flags word with * "mode flags". These flags are allocated from bit 0 up, as they * are never OR'ed into the mode in mempolicy API arguments. */ #define MPOL_F_SHARED (1 << 0) /* identify shared policies */ #define MPOL_F_MOF (1 << 3) /* this policy wants migrate on fault */ #define MPOL_F_MORON (1 << 4) /* Migrate On protnone Reference On Node */ #endif /* _LINUX_MEMPOLICY_H */ linux/meye.h 0000644 00000004741 15063602051 0007017 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Motion Eye video4linux driver for Sony Vaio PictureBook * * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net> * * Copyright (C) 2001-2002 Alcôve <www.alcove.com> * * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com> * * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. * * Some parts borrowed from various video4linux drivers, especially * bttv-driver.c and zoran.c, see original files for credits. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MEYE_H_ #define _MEYE_H_ /****************************************************************************/ /* Private API for handling mjpeg capture / playback. */ /****************************************************************************/ struct meye_params { unsigned char subsample; unsigned char quality; unsigned char sharpness; unsigned char agc; unsigned char picture; unsigned char framerate; }; /* query the extended parameters */ #define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params) /* set the extended parameters */ #define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params) /* queue a buffer for mjpeg capture */ #define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int) /* sync a previously queued mjpeg buffer */ #define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int) /* get a still uncompressed snapshot */ #define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4) /* get a jpeg compressed snapshot */ #define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int) /* V4L2 private controls */ #define V4L2_CID_MEYE_AGC (V4L2_CID_USER_MEYE_BASE + 0) #define V4L2_CID_MEYE_PICTURE (V4L2_CID_USER_MEYE_BASE + 1) #define V4L2_CID_MEYE_FRAMERATE (V4L2_CID_USER_MEYE_BASE + 2) #endif linux/mic_common.h 0000644 00000014567 15063602051 0010207 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Intel MIC Platform Software Stack (MPSS) * * Copyright(c) 2013 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Intel MIC driver. * */ #ifndef __MIC_COMMON_H_ #define __MIC_COMMON_H_ #include <linux/virtio_ring.h> #define __mic_align(a, x) (((a) + (x) - 1) & ~((x) - 1)) /** * struct mic_device_desc: Virtio device information shared between the * virtio driver and userspace backend * * @type: Device type: console/network/disk etc. Type 0/-1 terminates. * @num_vq: Number of virtqueues. * @feature_len: Number of bytes of feature bits. Multiply by 2: one for host features and one for guest acknowledgements. * @config_len: Number of bytes of the config array after virtqueues. * @status: A status byte, written by the Guest. * @config: Start of the following variable length config. */ struct mic_device_desc { __s8 type; __u8 num_vq; __u8 feature_len; __u8 config_len; __u8 status; __le64 config[0]; } __attribute__ ((aligned(8))); /** * struct mic_device_ctrl: Per virtio device information in the device page * used internally by the host and card side drivers. * * @vdev: Used for storing MIC vdev information by the guest. * @config_change: Set to 1 by host when a config change is requested. * @vdev_reset: Set to 1 by guest to indicate virtio device has been reset. * @guest_ack: Set to 1 by guest to ack a command. * @host_ack: Set to 1 by host to ack a command. * @used_address_updated: Set to 1 by guest when the used address should be * updated. * @c2h_vdev_db: The doorbell number to be used by guest. Set by host. * @h2c_vdev_db: The doorbell number to be used by host. Set by guest. */ struct mic_device_ctrl { __le64 vdev; __u8 config_change; __u8 vdev_reset; __u8 guest_ack; __u8 host_ack; __u8 used_address_updated; __s8 c2h_vdev_db; __s8 h2c_vdev_db; } __attribute__ ((aligned(8))); /** * struct mic_bootparam: Virtio device independent information in device page * * @magic: A magic value used by the card to ensure it can see the host * @h2c_config_db: Host to Card Virtio config doorbell set by card * @node_id: Unique id of the node * @h2c_scif_db - Host to card SCIF doorbell set by card * @c2h_scif_db - Card to host SCIF doorbell set by host * @scif_host_dma_addr - SCIF host queue pair DMA address * @scif_card_dma_addr - SCIF card queue pair DMA address */ struct mic_bootparam { __le32 magic; __s8 h2c_config_db; __u8 node_id; __u8 h2c_scif_db; __u8 c2h_scif_db; __u64 scif_host_dma_addr; __u64 scif_card_dma_addr; } __attribute__ ((aligned(8))); /** * struct mic_device_page: High level representation of the device page * * @bootparam: The bootparam structure is used for sharing information and * status updates between MIC host and card drivers. * @desc: Array of MIC virtio device descriptors. */ struct mic_device_page { struct mic_bootparam bootparam; struct mic_device_desc desc[0]; }; /** * struct mic_vqconfig: This is how we expect the device configuration field * for a virtqueue to be laid out in config space. * * @address: Guest/MIC physical address of the virtio ring * (avail and desc rings) * @used_address: Guest/MIC physical address of the used ring * @num: The number of entries in the virtio_ring */ struct mic_vqconfig { __le64 address; __le64 used_address; __le16 num; } __attribute__ ((aligned(8))); /* * The alignment to use between consumer and producer parts of vring. * This is pagesize for historical reasons. */ #define MIC_VIRTIO_RING_ALIGN 4096 #define MIC_MAX_VRINGS 4 #define MIC_VRING_ENTRIES 128 /* * Max vring entries (power of 2) to ensure desc and avail rings * fit in a single page */ #define MIC_MAX_VRING_ENTRIES 128 /** * Max size of the desc block in bytes: includes: * - struct mic_device_desc * - struct mic_vqconfig (num_vq of these) * - host and guest features * - virtio device config space */ #define MIC_MAX_DESC_BLK_SIZE 256 /** * struct _mic_vring_info - Host vring info exposed to userspace backend * for the avail index and magic for the card. * * @avail_idx: host avail idx * @magic: A magic debug cookie. */ struct _mic_vring_info { __u16 avail_idx; __le32 magic; }; /** * struct mic_vring - Vring information. * * @vr: The virtio ring. * @info: Host vring information exposed to the userspace backend for the * avail index and magic for the card. * @va: The va for the buffer allocated for vr and info. * @len: The length of the buffer required for allocating vr and info. */ struct mic_vring { struct vring vr; struct _mic_vring_info *info; void *va; int len; }; #define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8) #ifndef INTEL_MIC_CARD static __inline__ unsigned mic_desc_size(const struct mic_device_desc *desc) { return sizeof(*desc) + desc->num_vq * sizeof(struct mic_vqconfig) + desc->feature_len * 2 + desc->config_len; } static __inline__ struct mic_vqconfig * mic_vq_config(const struct mic_device_desc *desc) { return (struct mic_vqconfig *)(desc + 1); } static __inline__ __u8 *mic_vq_features(const struct mic_device_desc *desc) { return (__u8 *)(mic_vq_config(desc) + desc->num_vq); } static __inline__ __u8 *mic_vq_configspace(const struct mic_device_desc *desc) { return mic_vq_features(desc) + desc->feature_len * 2; } static __inline__ unsigned mic_total_desc_size(struct mic_device_desc *desc) { return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl); } #endif /* Device page size */ #define MIC_DP_SIZE 4096 #define MIC_MAGIC 0xc0ffee00 /** * enum mic_states - MIC states. */ enum mic_states { MIC_READY = 0, MIC_BOOTING, MIC_ONLINE, MIC_SHUTTING_DOWN, MIC_RESETTING, MIC_RESET_FAILED, MIC_LAST }; /** * enum mic_status - MIC status reported by card after * a host or card initiated shutdown or a card crash. */ enum mic_status { MIC_NOP = 0, MIC_CRASHED, MIC_HALTED, MIC_POWER_OFF, MIC_RESTART, MIC_STATUS_LAST }; #endif linux/mic_ioctl.h 0000644 00000004314 15063602051 0010016 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Intel MIC Platform Software Stack (MPSS) * * Copyright(c) 2013 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * The full GNU General Public License is included in this distribution in * the file called "COPYING". * * Intel MIC Host driver. * */ #ifndef _MIC_IOCTL_H_ #define _MIC_IOCTL_H_ #include <linux/types.h> /* * mic_copy - MIC virtio descriptor copy. * * @iov: An array of IOVEC structures containing user space buffers. * @iovcnt: Number of IOVEC structures in iov. * @vr_idx: The vring index. * @update_used: A non zero value results in used index being updated. * @out_len: The aggregate of the total length written to or read from * the virtio device. */ struct mic_copy_desc { struct iovec *iov; __u32 iovcnt; __u8 vr_idx; __u8 update_used; __u32 out_len; }; /* * Add a new virtio device * The (struct mic_device_desc *) pointer points to a device page entry * for the virtio device consisting of: * - struct mic_device_desc * - struct mic_vqconfig (num_vq of these) * - host and guest features * - virtio device config space * The total size referenced by the pointer should equal the size returned * by desc_size() in mic_common.h */ #define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *) /* * Copy the number of entries in the iovec and update the used index * if requested by the user. */ #define MIC_VIRTIO_COPY_DESC _IOWR('s', 2, struct mic_copy_desc *) /* * Notify virtio device of a config change * The (__u8 *) pointer points to config space values for the device * as they should be written into the device page. The total size * referenced by the pointer should equal the config_len field of struct * mic_device_desc. */ #define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *) #endif linux/mii.h 0000644 00000022430 15063602051 0006631 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/mii.h: definitions for MII-compatible transceivers * Originally drivers/net/sunhme.h. * * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com) */ #ifndef __LINUX_MII_H__ #define __LINUX_MII_H__ #include <linux/types.h> #include <linux/ethtool.h> /* Generic MII registers. */ #define MII_BMCR 0x00 /* Basic mode control register */ #define MII_BMSR 0x01 /* Basic mode status register */ #define MII_PHYSID1 0x02 /* PHYS ID 1 */ #define MII_PHYSID2 0x03 /* PHYS ID 2 */ #define MII_ADVERTISE 0x04 /* Advertisement control reg */ #define MII_LPA 0x05 /* Link partner ability reg */ #define MII_EXPANSION 0x06 /* Expansion register */ #define MII_CTRL1000 0x09 /* 1000BASE-T control */ #define MII_STAT1000 0x0a /* 1000BASE-T status */ #define MII_MMD_CTRL 0x0d /* MMD Access Control Register */ #define MII_MMD_DATA 0x0e /* MMD Access Data Register */ #define MII_ESTATUS 0x0f /* Extended Status */ #define MII_DCOUNTER 0x12 /* Disconnect counter */ #define MII_FCSCOUNTER 0x13 /* False carrier counter */ #define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ #define MII_RERRCOUNTER 0x15 /* Receive error counter */ #define MII_SREVISION 0x16 /* Silicon revision */ #define MII_RESV1 0x17 /* Reserved... */ #define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */ #define MII_PHYADDR 0x19 /* PHY address */ #define MII_RESV2 0x1a /* Reserved... */ #define MII_TPISTATUS 0x1b /* TPI status for 10mbps */ #define MII_NCONFIG 0x1c /* Network interface config */ /* Basic mode control register. */ #define BMCR_RESV 0x003f /* Unused... */ #define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */ #define BMCR_CTST 0x0080 /* Collision test */ #define BMCR_FULLDPLX 0x0100 /* Full duplex */ #define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */ #define BMCR_ISOLATE 0x0400 /* Isolate data paths from MII */ #define BMCR_PDOWN 0x0800 /* Enable low power state */ #define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ #define BMCR_SPEED100 0x2000 /* Select 100Mbps */ #define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */ #define BMCR_RESET 0x8000 /* Reset to default state */ #define BMCR_SPEED10 0x0000 /* Select 10Mbps */ /* Basic mode status register. */ #define BMSR_ERCAP 0x0001 /* Ext-reg capability */ #define BMSR_JCD 0x0002 /* Jabber detected */ #define BMSR_LSTATUS 0x0004 /* Link status */ #define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */ #define BMSR_RFAULT 0x0010 /* Remote fault detected */ #define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ #define BMSR_RESV 0x00c0 /* Unused... */ #define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */ #define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */ #define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */ #define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ #define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ #define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ #define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */ #define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */ /* Advertisement control register. */ #define ADVERTISE_SLCT 0x001f /* Selector bits */ #define ADVERTISE_CSMA 0x0001 /* Only selector supported */ #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ #define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */ #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ #define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */ #define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ #define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */ #define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ #define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */ #define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ #define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ #define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */ #define ADVERTISE_RESV 0x1000 /* Unused... */ #define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */ #define ADVERTISE_LPACK 0x4000 /* Ack link partners response */ #define ADVERTISE_NPAGE 0x8000 /* Next page bit */ #define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ ADVERTISE_CSMA) #define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ ADVERTISE_100HALF | ADVERTISE_100FULL) /* Link partner ability register. */ #define LPA_SLCT 0x001f /* Same as advertise selector */ #define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ #define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */ #define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ #define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */ #define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ #define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */ #define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ #define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/ #define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */ #define LPA_PAUSE_CAP 0x0400 /* Can pause */ #define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */ #define LPA_RESV 0x1000 /* Unused... */ #define LPA_RFAULT 0x2000 /* Link partner faulted */ #define LPA_LPACK 0x4000 /* Link partner acked us */ #define LPA_NPAGE 0x8000 /* Next page bit */ #define LPA_DUPLEX (LPA_10FULL | LPA_100FULL) #define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4) /* Expansion register for auto-negotiation. */ #define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */ #define EXPANSION_LCWP 0x0002 /* Got new RX page code word */ #define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */ #define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */ #define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ #define EXPANSION_RESV 0xffe0 /* Unused... */ #define ESTATUS_1000_XFULL 0x8000 /* Can do 1000BaseX Full */ #define ESTATUS_1000_XHALF 0x4000 /* Can do 1000BaseX Half */ #define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */ #define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */ /* N-way test register. */ #define NWAYTEST_RESV1 0x00ff /* Unused... */ #define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */ #define NWAYTEST_RESV2 0xfe00 /* Unused... */ /* MAC and PHY tx_config_Reg[15:0] for SGMII in-band auto-negotiation.*/ #define ADVERTISE_SGMII 0x0001 /* MAC can do SGMII */ #define LPA_SGMII 0x0001 /* PHY can do SGMII */ #define LPA_SGMII_SPD_MASK 0x0c00 /* SGMII speed mask */ #define LPA_SGMII_FULL_DUPLEX 0x1000 /* SGMII full duplex */ #define LPA_SGMII_DPX_SPD_MASK 0x1C00 /* SGMII duplex and speed bits */ #define LPA_SGMII_10 0x0000 /* 10Mbps */ #define LPA_SGMII_10HALF 0x0000 /* Can do 10mbps half-duplex */ #define LPA_SGMII_10FULL 0x1000 /* Can do 10mbps full-duplex */ #define LPA_SGMII_100 0x0400 /* 100Mbps */ #define LPA_SGMII_100HALF 0x0400 /* Can do 100mbps half-duplex */ #define LPA_SGMII_100FULL 0x1400 /* Can do 100mbps full-duplex */ #define LPA_SGMII_1000 0x0800 /* 1000Mbps */ #define LPA_SGMII_1000HALF 0x0800 /* Can do 1000mbps half-duplex */ #define LPA_SGMII_1000FULL 0x1800 /* Can do 1000mbps full-duplex */ #define LPA_SGMII_LINK 0x8000 /* PHY link with copper-side partner */ /* 1000BASE-T Control register */ #define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */ #define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */ #define CTL1000_PREFER_MASTER 0x0400 /* prefer to operate as master */ #define CTL1000_AS_MASTER 0x0800 #define CTL1000_ENABLE_MASTER 0x1000 /* 1000BASE-T Status register */ #define LPA_1000MSFAIL 0x8000 /* Master/Slave resolution failure */ #define LPA_1000MSRES 0x4000 /* Master/Slave resolution status */ #define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */ #define LPA_1000REMRXOK 0x1000 /* Link partner remote receiver status */ #define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ #define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ /* Flow control flags */ #define FLOW_CTRL_TX 0x01 #define FLOW_CTRL_RX 0x02 /* MMD Access Control register fields */ #define MII_MMD_CTRL_DEVAD_MASK 0x1f /* Mask MMD DEVAD*/ #define MII_MMD_CTRL_ADDR 0x0000 /* Address */ #define MII_MMD_CTRL_NOINCR 0x4000 /* no post increment */ #define MII_MMD_CTRL_INCR_RDWT 0x8000 /* post increment on reads & writes */ #define MII_MMD_CTRL_INCR_ON_WT 0xC000 /* post increment on writes only */ /* This structure is used in all SIOCxMIIxxx ioctl calls */ struct mii_ioctl_data { __u16 phy_id; __u16 reg_num; __u16 val_in; __u16 val_out; }; #endif /* __LINUX_MII_H__ */ linux/minix_fs.h 0000644 00000004112 15063602051 0007664 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MINIX_FS_H #define _LINUX_MINIX_FS_H #include <linux/types.h> #include <linux/magic.h> /* * The minix filesystem constants/structures */ /* * Thanks to Kees J Bot for sending me the definitions of the new * minix filesystem (aka V2) with bigger inodes and 32-bit block * pointers. */ #define MINIX_ROOT_INO 1 /* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */ #define MINIX_LINK_MAX 250 #define MINIX2_LINK_MAX 65530 #define MINIX_I_MAP_SLOTS 8 #define MINIX_Z_MAP_SLOTS 64 #define MINIX_VALID_FS 0x0001 /* Clean fs. */ #define MINIX_ERROR_FS 0x0002 /* fs has errors. */ #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) /* * This is the original minix inode layout on disk. * Note the 8-bit gid and atime and ctime. */ struct minix_inode { __u16 i_mode; __u16 i_uid; __u32 i_size; __u32 i_time; __u8 i_gid; __u8 i_nlinks; __u16 i_zone[9]; }; /* * The new minix inode has all the time entries, as well as * long block numbers and a third indirect block (7+1+1+1 * instead of 7+1+1). Also, some previously 8-bit values are * now 16-bit. The inode is now 64 bytes instead of 32. */ struct minix2_inode { __u16 i_mode; __u16 i_nlinks; __u16 i_uid; __u16 i_gid; __u32 i_size; __u32 i_atime; __u32 i_mtime; __u32 i_ctime; __u32 i_zone[10]; }; /* * minix super-block data on disk */ struct minix_super_block { __u16 s_ninodes; __u16 s_nzones; __u16 s_imap_blocks; __u16 s_zmap_blocks; __u16 s_firstdatazone; __u16 s_log_zone_size; __u32 s_max_size; __u16 s_magic; __u16 s_state; __u32 s_zones; }; /* * V3 minix super-block data on disk */ struct minix3_super_block { __u32 s_ninodes; __u16 s_pad0; __u16 s_imap_blocks; __u16 s_zmap_blocks; __u16 s_firstdatazone; __u16 s_log_zone_size; __u16 s_pad1; __u32 s_max_size; __u32 s_zones; __u16 s_magic; __u16 s_pad2; __u16 s_blocksize; __u8 s_disk_version; }; struct minix_dir_entry { __u16 inode; char name[0]; }; struct minix3_dir_entry { __u32 inode; char name[0]; }; #endif linux/mman.h 0000644 00000002551 15063602051 0007005 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MMAN_H #define _LINUX_MMAN_H #include <asm/mman.h> #include <asm-generic/hugetlb_encode.h> #define MREMAP_MAYMOVE 1 #define MREMAP_FIXED 2 #define OVERCOMMIT_GUESS 0 #define OVERCOMMIT_ALWAYS 1 #define OVERCOMMIT_NEVER 2 /* * Huge page size encoding when MAP_HUGETLB is specified, and a huge page * size other than the default is desired. See hugetlb_encode.h. * All known huge page size encodings are provided here. It is the * responsibility of the application to know which sizes are supported on * the running system. See mmap(2) man page for details. */ #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT #define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK #define MAP_HUGE_16KB HUGETLB_FLAG_ENCODE_16KB #define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB #define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB #define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB #define MAP_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB #define MAP_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB #define MAP_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB #define MAP_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB #define MAP_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB #define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB #endif /* _LINUX_MMAN_H */ linux/mmtimer.h 0000644 00000004105 15063602051 0007524 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Intel Multimedia Timer device interface * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. * * This file should define an interface compatible with the IA-PC Multimedia * Timers Draft Specification (rev. 0.97) from Intel. Note that some * hardware may not be able to safely export its registers to userspace, * so the ioctl interface should support all necessary functionality. * * 11/01/01 - jbarnes - initial revision * 9/10/04 - Christoph Lameter - remove interrupt support * 9/17/04 - jbarnes - remove test program, move some #defines to the driver */ #ifndef _LINUX_MMTIMER_H #define _LINUX_MMTIMER_H /* * Breakdown of the ioctl's available. An 'optional' next to the command * indicates that supporting this command is optional, while 'required' * commands must be implemented if conformance is desired. * * MMTIMER_GETOFFSET - optional * Should return the offset (relative to the start of the page where the * registers are mapped) for the counter in question. * * MMTIMER_GETRES - required * The resolution of the clock in femto (10^-15) seconds * * MMTIMER_GETFREQ - required * Frequency of the clock in Hz * * MMTIMER_GETBITS - required * Number of bits in the clock's counter * * MMTIMER_MMAPAVAIL - required * Returns nonzero if the registers can be mmap'd into userspace, 0 otherwise * * MMTIMER_GETCOUNTER - required * Gets the current value in the counter */ #define MMTIMER_IOCTL_BASE 'm' #define MMTIMER_GETOFFSET _IO(MMTIMER_IOCTL_BASE, 0) #define MMTIMER_GETRES _IOR(MMTIMER_IOCTL_BASE, 1, unsigned long) #define MMTIMER_GETFREQ _IOR(MMTIMER_IOCTL_BASE, 2, unsigned long) #define MMTIMER_GETBITS _IO(MMTIMER_IOCTL_BASE, 4) #define MMTIMER_MMAPAVAIL _IO(MMTIMER_IOCTL_BASE, 6) #define MMTIMER_GETCOUNTER _IOR(MMTIMER_IOCTL_BASE, 9, unsigned long) #endif /* _LINUX_MMTIMER_H */ linux/module.h 0000644 00000000377 15063602051 0007346 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MODULE_H #define _LINUX_MODULE_H /* Flags for sys_finit_module: */ #define MODULE_INIT_IGNORE_MODVERSIONS 1 #define MODULE_INIT_IGNORE_VERMAGIC 2 #endif /* _LINUX_MODULE_H */ linux/mount.h 0000644 00000010702 15063602051 0007214 0 ustar 00 #ifndef _LINUX_MOUNT_H #define _LINUX_MOUNT_H /* * These are the fs-independent mount-flags: up to 32 flags are supported * * Usage of these is restricted within the kernel to core mount(2) code and * callers of sys_mount() only. Filesystems should be using the SB_* * equivalent instead. */ #define MS_RDONLY 1 /* Mount read-only */ #define MS_NOSUID 2 /* Ignore suid and sgid bits */ #define MS_NODEV 4 /* Disallow access to device special files */ #define MS_NOEXEC 8 /* Disallow program execution */ #define MS_SYNCHRONOUS 16 /* Writes are synced at once */ #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ #define MS_NOATIME 1024 /* Do not update access times. */ #define MS_NODIRATIME 2048 /* Do not update directory access times */ #define MS_BIND 4096 #define MS_MOVE 8192 #define MS_REC 16384 #define MS_VERBOSE 32768 /* War is peace. Verbosity is silence. MS_VERBOSE is deprecated. */ #define MS_SILENT 32768 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ #define MS_UNBINDABLE (1<<17) /* change to unbindable */ #define MS_PRIVATE (1<<18) /* change to private */ #define MS_SLAVE (1<<19) /* change to slave */ #define MS_SHARED (1<<20) /* change to shared */ #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ #define MS_I_VERSION (1<<23) /* Update inode I_version field */ #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ #define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ /* These sb flags are internal to the kernel */ #define MS_SUBMOUNT (1<<26) #define MS_NOREMOTELOCK (1<<27) #define MS_NOSEC (1<<28) #define MS_BORN (1<<29) #define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) /* * Superblock flags that can be altered by MS_REMOUNT */ #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\ MS_LAZYTIME) /* * Old magic mount flag and mask */ #define MS_MGC_VAL 0xC0ED0000 #define MS_MGC_MSK 0xffff0000 /* * open_tree() flags. */ #define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ #define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ /* * move_mount() flags. */ #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */ #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */ #define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */ #define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */ #define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */ #define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */ #define MOVE_MOUNT__MASK 0x00000077 /* * fsopen() flags. */ #define FSOPEN_CLOEXEC 0x00000001 /* * fspick() flags. */ #define FSPICK_CLOEXEC 0x00000001 #define FSPICK_SYMLINK_NOFOLLOW 0x00000002 #define FSPICK_NO_AUTOMOUNT 0x00000004 #define FSPICK_EMPTY_PATH 0x00000008 /* * The type of fsconfig() call made. */ enum fsconfig_command { FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ }; /* * fsmount() flags. */ #define FSMOUNT_CLOEXEC 0x00000001 /* * Mount attributes. */ #define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */ #define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */ #define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */ #define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */ #define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */ #define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */ #define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */ #define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */ #define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */ #endif /* _LINUX_MOUNT_H */ linux/mpls.h 0000644 00000004376 15063602051 0007037 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _MPLS_H #define _MPLS_H #include <linux/types.h> #include <asm/byteorder.h> /* Reference: RFC 5462, RFC 3032 * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Label | TC |S| TTL | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * Label: Label Value, 20 bits * TC: Traffic Class field, 3 bits * S: Bottom of Stack, 1 bit * TTL: Time to Live, 8 bits */ struct mpls_label { __be32 entry; }; #define MPLS_LS_LABEL_MASK 0xFFFFF000 #define MPLS_LS_LABEL_SHIFT 12 #define MPLS_LS_TC_MASK 0x00000E00 #define MPLS_LS_TC_SHIFT 9 #define MPLS_LS_S_MASK 0x00000100 #define MPLS_LS_S_SHIFT 8 #define MPLS_LS_TTL_MASK 0x000000FF #define MPLS_LS_TTL_SHIFT 0 /* Reserved labels */ #define MPLS_LABEL_IPV4NULL 0 /* RFC3032 */ #define MPLS_LABEL_RTALERT 1 /* RFC3032 */ #define MPLS_LABEL_IPV6NULL 2 /* RFC3032 */ #define MPLS_LABEL_IMPLNULL 3 /* RFC3032 */ #define MPLS_LABEL_ENTROPY 7 /* RFC6790 */ #define MPLS_LABEL_GAL 13 /* RFC5586 */ #define MPLS_LABEL_OAMALERT 14 /* RFC3429 */ #define MPLS_LABEL_EXTENSION 15 /* RFC7274 */ #define MPLS_LABEL_FIRST_UNRESERVED 16 /* RFC3032 */ /* These are embedded into IFLA_STATS_AF_SPEC: * [IFLA_STATS_AF_SPEC] * -> [AF_MPLS] * -> [MPLS_STATS_xxx] * * Attributes: * [MPLS_STATS_LINK] = { * struct mpls_link_stats * } */ enum { MPLS_STATS_UNSPEC, /* also used as 64bit pad attribute */ MPLS_STATS_LINK, __MPLS_STATS_MAX, }; #define MPLS_STATS_MAX (__MPLS_STATS_MAX - 1) struct mpls_link_stats { __u64 rx_packets; /* total packets received */ __u64 tx_packets; /* total packets transmitted */ __u64 rx_bytes; /* total bytes received */ __u64 tx_bytes; /* total bytes transmitted */ __u64 rx_errors; /* bad packets received */ __u64 tx_errors; /* packet transmit problems */ __u64 rx_dropped; /* packet dropped on receive */ __u64 tx_dropped; /* packet dropped on transmit */ __u64 rx_noroute; /* no route for packet dest */ }; #endif /* _MPLS_H */ linux/mpls_iptunnel.h 0000644 00000001371 15063602051 0010745 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * mpls tunnel api * * Authors: * Roopa Prabhu <roopa@cumulusnetworks.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_MPLS_IPTUNNEL_H #define _LINUX_MPLS_IPTUNNEL_H /* MPLS tunnel attributes * [RTA_ENCAP] = { * [MPLS_IPTUNNEL_DST] * [MPLS_IPTUNNEL_TTL] * } */ enum { MPLS_IPTUNNEL_UNSPEC, MPLS_IPTUNNEL_DST, MPLS_IPTUNNEL_TTL, __MPLS_IPTUNNEL_MAX, }; #define MPLS_IPTUNNEL_MAX (__MPLS_IPTUNNEL_MAX - 1) #endif /* _LINUX_MPLS_IPTUNNEL_H */ linux/mptcp.h 0000644 00000012750 15063602051 0007202 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _MPTCP_H #define _MPTCP_H #include <linux/const.h> #include <linux/types.h> #define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0) #define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1) #define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2) #define MPTCP_SUBFLOW_FLAG_JOIN_LOC _BITUL(3) #define MPTCP_SUBFLOW_FLAG_BKUP_REM _BITUL(4) #define MPTCP_SUBFLOW_FLAG_BKUP_LOC _BITUL(5) #define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED _BITUL(6) #define MPTCP_SUBFLOW_FLAG_CONNECTED _BITUL(7) #define MPTCP_SUBFLOW_FLAG_MAPVALID _BITUL(8) enum { MPTCP_SUBFLOW_ATTR_UNSPEC, MPTCP_SUBFLOW_ATTR_TOKEN_REM, MPTCP_SUBFLOW_ATTR_TOKEN_LOC, MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ, MPTCP_SUBFLOW_ATTR_MAP_SEQ, MPTCP_SUBFLOW_ATTR_MAP_SFSEQ, MPTCP_SUBFLOW_ATTR_SSN_OFFSET, MPTCP_SUBFLOW_ATTR_MAP_DATALEN, MPTCP_SUBFLOW_ATTR_FLAGS, MPTCP_SUBFLOW_ATTR_ID_REM, MPTCP_SUBFLOW_ATTR_ID_LOC, MPTCP_SUBFLOW_ATTR_PAD, __MPTCP_SUBFLOW_ATTR_MAX }; #define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1) /* netlink interface */ #define MPTCP_PM_NAME "mptcp_pm" #define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds" #define MPTCP_PM_EV_GRP_NAME "mptcp_pm_events" #define MPTCP_PM_VER 0x1 /* * ATTR types defined for MPTCP */ enum { MPTCP_PM_ATTR_UNSPEC, MPTCP_PM_ATTR_ADDR, /* nested address */ MPTCP_PM_ATTR_RCV_ADD_ADDRS, /* u32 */ MPTCP_PM_ATTR_SUBFLOWS, /* u32 */ __MPTCP_PM_ATTR_MAX }; #define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1) enum { MPTCP_PM_ADDR_ATTR_UNSPEC, MPTCP_PM_ADDR_ATTR_FAMILY, /* u16 */ MPTCP_PM_ADDR_ATTR_ID, /* u8 */ MPTCP_PM_ADDR_ATTR_ADDR4, /* struct in_addr */ MPTCP_PM_ADDR_ATTR_ADDR6, /* struct in6_addr */ MPTCP_PM_ADDR_ATTR_PORT, /* u16 */ MPTCP_PM_ADDR_ATTR_FLAGS, /* u32 */ MPTCP_PM_ADDR_ATTR_IF_IDX, /* s32 */ __MPTCP_PM_ADDR_ATTR_MAX }; #define MPTCP_PM_ADDR_ATTR_MAX (__MPTCP_PM_ADDR_ATTR_MAX - 1) #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0) #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1) #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2) #define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3) #define MPTCP_PM_ADDR_FLAG_IMPLICIT (1 << 4) enum { MPTCP_PM_CMD_UNSPEC, MPTCP_PM_CMD_ADD_ADDR, MPTCP_PM_CMD_DEL_ADDR, MPTCP_PM_CMD_GET_ADDR, MPTCP_PM_CMD_FLUSH_ADDRS, MPTCP_PM_CMD_SET_LIMITS, MPTCP_PM_CMD_GET_LIMITS, MPTCP_PM_CMD_SET_FLAGS, __MPTCP_PM_CMD_AFTER_LAST }; #define MPTCP_INFO_FLAG_FALLBACK _BITUL(0) #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1) struct mptcp_info { __u8 mptcpi_subflows; __u8 mptcpi_add_addr_signal; __u8 mptcpi_add_addr_accepted; __u8 mptcpi_subflows_max; __u8 mptcpi_add_addr_signal_max; __u8 mptcpi_add_addr_accepted_max; __u32 mptcpi_flags; __u32 mptcpi_token; __u64 mptcpi_write_seq; __u64 mptcpi_snd_una; __u64 mptcpi_rcv_nxt; __u8 mptcpi_local_addr_used; __u8 mptcpi_local_addr_max; }; /* * MPTCP_EVENT_CREATED: token, family, saddr4 | saddr6, daddr4 | daddr6, * sport, dport * A new MPTCP connection has been created. It is the good time to allocate * memory and send ADD_ADDR if needed. Depending on the traffic-patterns * it can take a long time until the MPTCP_EVENT_ESTABLISHED is sent. * * MPTCP_EVENT_ESTABLISHED: token, family, saddr4 | saddr6, daddr4 | daddr6, * sport, dport * A MPTCP connection is established (can start new subflows). * * MPTCP_EVENT_CLOSED: token * A MPTCP connection has stopped. * * MPTCP_EVENT_ANNOUNCED: token, rem_id, family, daddr4 | daddr6 [, dport] * A new address has been announced by the peer. * * MPTCP_EVENT_REMOVED: token, rem_id * An address has been lost by the peer. * * MPTCP_EVENT_SUB_ESTABLISHED: token, family, saddr4 | saddr6, * daddr4 | daddr6, sport, dport, backup, * if_idx [, error] * A new subflow has been established. 'error' should not be set. * * MPTCP_EVENT_SUB_CLOSED: token, family, saddr4 | saddr6, daddr4 | daddr6, * sport, dport, backup, if_idx [, error] * A subflow has been closed. An error (copy of sk_err) could be set if an * error has been detected for this subflow. * * MPTCP_EVENT_SUB_PRIORITY: token, family, saddr4 | saddr6, daddr4 | daddr6, * sport, dport, backup, if_idx [, error] * The priority of a subflow has changed. 'error' should not be set. */ enum mptcp_event_type { MPTCP_EVENT_UNSPEC = 0, MPTCP_EVENT_CREATED = 1, MPTCP_EVENT_ESTABLISHED = 2, MPTCP_EVENT_CLOSED = 3, MPTCP_EVENT_ANNOUNCED = 6, MPTCP_EVENT_REMOVED = 7, MPTCP_EVENT_SUB_ESTABLISHED = 10, MPTCP_EVENT_SUB_CLOSED = 11, MPTCP_EVENT_SUB_PRIORITY = 13, }; enum mptcp_event_attr { MPTCP_ATTR_UNSPEC = 0, MPTCP_ATTR_TOKEN, /* u32 */ MPTCP_ATTR_FAMILY, /* u16 */ MPTCP_ATTR_LOC_ID, /* u8 */ MPTCP_ATTR_REM_ID, /* u8 */ MPTCP_ATTR_SADDR4, /* be32 */ MPTCP_ATTR_SADDR6, /* struct in6_addr */ MPTCP_ATTR_DADDR4, /* be32 */ MPTCP_ATTR_DADDR6, /* struct in6_addr */ MPTCP_ATTR_SPORT, /* be16 */ MPTCP_ATTR_DPORT, /* be16 */ MPTCP_ATTR_BACKUP, /* u8 */ MPTCP_ATTR_ERROR, /* u8 */ MPTCP_ATTR_FLAGS, /* u16 */ MPTCP_ATTR_TIMEOUT, /* u32 */ MPTCP_ATTR_IF_IDX, /* s32 */ MPTCP_ATTR_RESET_REASON,/* u32 */ MPTCP_ATTR_RESET_FLAGS, /* u32 */ __MPTCP_ATTR_AFTER_LAST }; #define MPTCP_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1) /* MPTCP Reset reason codes, rfc8684 */ #define MPTCP_RST_EUNSPEC 0 #define MPTCP_RST_EMPTCP 1 #define MPTCP_RST_ERESOURCE 2 #define MPTCP_RST_EPROHIBIT 3 #define MPTCP_RST_EWQ2BIG 4 #define MPTCP_RST_EBADPERF 5 #define MPTCP_RST_EMIDDLEBOX 6 #endif /* _MPTCP_H */ linux/mqueue.h 0000644 00000004231 15063602051 0007353 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _LINUX_MQUEUE_H #define _LINUX_MQUEUE_H #include <linux/types.h> #define MQ_PRIO_MAX 32768 /* per-uid limit of kernel memory used by mqueue, in bytes */ #define MQ_BYTES_MAX 819200 struct mq_attr { __kernel_long_t mq_flags; /* message queue flags */ __kernel_long_t mq_maxmsg; /* maximum number of messages */ __kernel_long_t mq_msgsize; /* maximum message size */ __kernel_long_t mq_curmsgs; /* number of messages currently queued */ __kernel_long_t __reserved[4]; /* ignored for input, zeroed for output */ }; /* * SIGEV_THREAD implementation: * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed * to mq_notify, then * - sigev_signo must be the file descriptor of an AF_NETLINK socket. It's not * necessary that the socket is bound. * - sigev_value.sival_ptr must point to a cookie that is NOTIFY_COOKIE_LEN * bytes long. * If the notification is triggered, then the cookie is sent to the netlink * socket. The last byte of the cookie is replaced with the NOTIFY_?? codes: * NOTIFY_WOKENUP if the notification got triggered, NOTIFY_REMOVED if it was * removed, either due to a close() on the message queue fd or due to a * mq_notify() that removed the notification. */ #define NOTIFY_NONE 0 #define NOTIFY_WOKENUP 1 #define NOTIFY_REMOVED 2 #define NOTIFY_COOKIE_LEN 32 #endif linux/mroute.h 0000644 00000012463 15063602051 0007373 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MROUTE_H #define __LINUX_MROUTE_H #include <linux/sockios.h> #include <linux/types.h> #include <linux/in.h> /* For struct in_addr. */ /* Based on the MROUTING 3.5 defines primarily to keep * source compatibility with BSD. * * See the mrouted code for the original history. * * Protocol Independent Multicast (PIM) data structures included * Carlos Picoto (cap@di.fc.ul.pt) */ #define MRT_BASE 200 #define MRT_INIT (MRT_BASE) /* Activate the kernel mroute code */ #define MRT_DONE (MRT_BASE+1) /* Shutdown the kernel mroute */ #define MRT_ADD_VIF (MRT_BASE+2) /* Add a virtual interface */ #define MRT_DEL_VIF (MRT_BASE+3) /* Delete a virtual interface */ #define MRT_ADD_MFC (MRT_BASE+4) /* Add a multicast forwarding entry */ #define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ #define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ #define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ #define MRT_PIM (MRT_BASE+8) /* enable PIM code */ #define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */ #define MRT_ADD_MFC_PROXY (MRT_BASE+10) /* Add a (*,*|G) mfc entry */ #define MRT_DEL_MFC_PROXY (MRT_BASE+11) /* Del a (*,*|G) mfc entry */ #define MRT_MAX (MRT_BASE+11) #define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) #define SIOCGETRPF (SIOCPROTOPRIVATE+2) #define MAXVIFS 32 typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ typedef unsigned short vifi_t; #define ALL_VIFS ((vifi_t)(-1)) /* Same idea as select */ #define VIFM_SET(n,m) ((m)|=(1<<(n))) #define VIFM_CLR(n,m) ((m)&=~(1<<(n))) #define VIFM_ISSET(n,m) ((m)&(1<<(n))) #define VIFM_CLRALL(m) ((m)=0) #define VIFM_COPY(mfrom,mto) ((mto)=(mfrom)) #define VIFM_SAME(m1,m2) ((m1)==(m2)) /* Passed by mrouted for an MRT_ADD_VIF - again we use the * mrouted 3.6 structures for compatibility */ struct vifctl { vifi_t vifc_vifi; /* Index of VIF */ unsigned char vifc_flags; /* VIFF_ flags */ unsigned char vifc_threshold; /* ttl limit */ unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ union { struct in_addr vifc_lcl_addr; /* Local interface address */ int vifc_lcl_ifindex; /* Local interface index */ }; struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ }; #define VIFF_TUNNEL 0x1 /* IPIP tunnel */ #define VIFF_SRCRT 0x2 /* NI */ #define VIFF_REGISTER 0x4 /* register vif */ #define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of vifc_lcl_addr to find an interface */ /* Cache manipulation structures for mrouted and PIMd */ struct mfcctl { struct in_addr mfcc_origin; /* Origin of mcast */ struct in_addr mfcc_mcastgrp; /* Group in question */ vifi_t mfcc_parent; /* Where it arrived */ unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */ unsigned int mfcc_pkt_cnt; /* pkt count for src-grp */ unsigned int mfcc_byte_cnt; unsigned int mfcc_wrong_if; int mfcc_expire; }; /* Group count retrieval for mrouted */ struct sioc_sg_req { struct in_addr src; struct in_addr grp; unsigned long pktcnt; unsigned long bytecnt; unsigned long wrong_if; }; /* To get vif packet counts */ struct sioc_vif_req { vifi_t vifi; /* Which iface */ unsigned long icount; /* In packets */ unsigned long ocount; /* Out packets */ unsigned long ibytes; /* In bytes */ unsigned long obytes; /* Out bytes */ }; /* This is the format the mroute daemon expects to see IGMP control * data. Magically happens to be like an IP packet as per the original */ struct igmpmsg { __u32 unused1,unused2; unsigned char im_msgtype; /* What is this */ unsigned char im_mbz; /* Must be zero */ unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ unsigned char unused3; struct in_addr im_src,im_dst; }; /* ipmr netlink table attributes */ enum { IPMRA_TABLE_UNSPEC, IPMRA_TABLE_ID, IPMRA_TABLE_CACHE_RES_QUEUE_LEN, IPMRA_TABLE_MROUTE_REG_VIF_NUM, IPMRA_TABLE_MROUTE_DO_ASSERT, IPMRA_TABLE_MROUTE_DO_PIM, IPMRA_TABLE_VIFS, __IPMRA_TABLE_MAX }; #define IPMRA_TABLE_MAX (__IPMRA_TABLE_MAX - 1) /* ipmr netlink vif attribute format * [ IPMRA_TABLE_VIFS ] - nested attribute * [ IPMRA_VIF ] - nested attribute * [ IPMRA_VIFA_xxx ] */ enum { IPMRA_VIF_UNSPEC, IPMRA_VIF, __IPMRA_VIF_MAX }; #define IPMRA_VIF_MAX (__IPMRA_VIF_MAX - 1) /* vif-specific attributes */ enum { IPMRA_VIFA_UNSPEC, IPMRA_VIFA_IFINDEX, IPMRA_VIFA_VIF_ID, IPMRA_VIFA_FLAGS, IPMRA_VIFA_BYTES_IN, IPMRA_VIFA_BYTES_OUT, IPMRA_VIFA_PACKETS_IN, IPMRA_VIFA_PACKETS_OUT, IPMRA_VIFA_LOCAL_ADDR, IPMRA_VIFA_REMOTE_ADDR, IPMRA_VIFA_PAD, __IPMRA_VIFA_MAX }; #define IPMRA_VIFA_MAX (__IPMRA_VIFA_MAX - 1) /* ipmr netlink cache report attributes */ enum { IPMRA_CREPORT_UNSPEC, IPMRA_CREPORT_MSGTYPE, IPMRA_CREPORT_VIF_ID, IPMRA_CREPORT_SRC_ADDR, IPMRA_CREPORT_DST_ADDR, IPMRA_CREPORT_PKT, __IPMRA_CREPORT_MAX }; #define IPMRA_CREPORT_MAX (__IPMRA_CREPORT_MAX - 1) /* That's all usermode folks */ #define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ /* Pseudo messages used by mrouted */ #define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */ #define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ #define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ #endif /* __LINUX_MROUTE_H */ linux/mroute6.h 0000644 00000010741 15063602051 0007456 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_MROUTE6_H #define __LINUX_MROUTE6_H #include <linux/kernel.h> #include <linux/types.h> #include <linux/sockios.h> #include <linux/in6.h> /* For struct sockaddr_in6. */ /* * Based on the MROUTING 3.5 defines primarily to keep * source compatibility with BSD. * * See the pim6sd code for the original history. * * Protocol Independent Multicast (PIM) data structures included * Carlos Picoto (cap@di.fc.ul.pt) * */ #define MRT6_BASE 200 #define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */ #define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */ #define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */ #define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */ #define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */ #define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ #define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ #define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ #define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ #define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */ #define MRT6_ADD_MFC_PROXY (MRT6_BASE+10) /* Add a (*,*|G) mfc entry */ #define MRT6_DEL_MFC_PROXY (MRT6_BASE+11) /* Del a (*,*|G) mfc entry */ #define MRT6_MAX (MRT6_BASE+11) #define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) #define SIOCGETRPF (SIOCPROTOPRIVATE+2) #define MAXMIFS 32 typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */ typedef unsigned short mifi_t; #define ALL_MIFS ((mifi_t)(-1)) #ifndef IF_SETSIZE #define IF_SETSIZE 256 #endif typedef __u32 if_mask; #define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */ typedef struct if_set { if_mask ifs_bits[__KERNEL_DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; } if_set; #define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) #define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) #define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) #define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) #define IF_ZERO(p) bzero(p, sizeof(*(p))) /* * Passed by mrouted for an MRT_ADD_MIF - again we use the * mrouted 3.6 structures for compatibility */ struct mif6ctl { mifi_t mif6c_mifi; /* Index of MIF */ unsigned char mif6c_flags; /* MIFF_ flags */ unsigned char vifc_threshold; /* ttl limit */ __u16 mif6c_pifi; /* the index of the physical IF */ unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ }; #define MIFF_REGISTER 0x1 /* register vif */ /* * Cache manipulation structures for mrouted and PIMd */ struct mf6cctl { struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */ struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */ mifi_t mf6cc_parent; /* Where it arrived */ struct if_set mf6cc_ifset; /* Where it is going */ }; /* * Group count retrieval for pim6sd */ struct sioc_sg_req6 { struct sockaddr_in6 src; struct sockaddr_in6 grp; unsigned long pktcnt; unsigned long bytecnt; unsigned long wrong_if; }; /* * To get vif packet counts */ struct sioc_mif_req6 { mifi_t mifi; /* Which iface */ unsigned long icount; /* In packets */ unsigned long ocount; /* Out packets */ unsigned long ibytes; /* In bytes */ unsigned long obytes; /* Out bytes */ }; /* * That's all usermode folks */ /* * Structure used to communicate from kernel to multicast router. * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{} * used for IPv4 implementation). This is because this structure will be passed via an * IPv6 raw socket, on which an application will only receiver the payload i.e the data after * the IPv6 header and all the extension headers. (See section 3 of RFC 3542) */ struct mrt6msg { #define MRT6MSG_NOCACHE 1 #define MRT6MSG_WRONGMIF 2 #define MRT6MSG_WHOLEPKT 3 /* used for use level encap */ __u8 im6_mbz; /* must be zero */ __u8 im6_msgtype; /* what type of message */ __u16 im6_mif; /* mif rec'd on */ __u32 im6_pad; /* padding for 64 bit arch */ struct in6_addr im6_src, im6_dst; }; /* ip6mr netlink cache report attributes */ enum { IP6MRA_CREPORT_UNSPEC, IP6MRA_CREPORT_MSGTYPE, IP6MRA_CREPORT_MIF_ID, IP6MRA_CREPORT_SRC_ADDR, IP6MRA_CREPORT_DST_ADDR, IP6MRA_CREPORT_PKT, __IP6MRA_CREPORT_MAX }; #define IP6MRA_CREPORT_MAX (__IP6MRA_CREPORT_MAX - 1) #endif /* __LINUX_MROUTE6_H */ linux/mrp_bridge.h 0000644 00000003254 15063602051 0010170 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _LINUX_MRP_BRIDGE_H_ #define _LINUX_MRP_BRIDGE_H_ #include <linux/types.h> #include <linux/if_ether.h> #define MRP_MAX_FRAME_LENGTH 200 #define MRP_DEFAULT_PRIO 0x8000 #define MRP_DOMAIN_UUID_LENGTH 16 #define MRP_VERSION 1 #define MRP_FRAME_PRIO 7 #define MRP_OUI_LENGTH 3 #define MRP_MANUFACTURE_DATA_LENGTH 2 enum br_mrp_ring_role_type { BR_MRP_RING_ROLE_DISABLED, BR_MRP_RING_ROLE_MRC, BR_MRP_RING_ROLE_MRM, BR_MRP_RING_ROLE_MRA, }; enum br_mrp_in_role_type { BR_MRP_IN_ROLE_DISABLED, BR_MRP_IN_ROLE_MIC, BR_MRP_IN_ROLE_MIM, }; enum br_mrp_ring_state_type { BR_MRP_RING_STATE_OPEN, BR_MRP_RING_STATE_CLOSED, }; enum br_mrp_in_state_type { BR_MRP_IN_STATE_OPEN, BR_MRP_IN_STATE_CLOSED, }; enum br_mrp_port_state_type { BR_MRP_PORT_STATE_DISABLED, BR_MRP_PORT_STATE_BLOCKED, BR_MRP_PORT_STATE_FORWARDING, BR_MRP_PORT_STATE_NOT_CONNECTED, }; enum br_mrp_port_role_type { BR_MRP_PORT_ROLE_PRIMARY, BR_MRP_PORT_ROLE_SECONDARY, BR_MRP_PORT_ROLE_INTER, }; enum br_mrp_tlv_header_type { BR_MRP_TLV_HEADER_END = 0x0, BR_MRP_TLV_HEADER_COMMON = 0x1, BR_MRP_TLV_HEADER_RING_TEST = 0x2, BR_MRP_TLV_HEADER_RING_TOPO = 0x3, BR_MRP_TLV_HEADER_RING_LINK_DOWN = 0x4, BR_MRP_TLV_HEADER_RING_LINK_UP = 0x5, BR_MRP_TLV_HEADER_IN_TEST = 0x6, BR_MRP_TLV_HEADER_IN_TOPO = 0x7, BR_MRP_TLV_HEADER_IN_LINK_DOWN = 0x8, BR_MRP_TLV_HEADER_IN_LINK_UP = 0x9, BR_MRP_TLV_HEADER_IN_LINK_STATUS = 0xa, BR_MRP_TLV_HEADER_OPTION = 0x7f, }; enum br_mrp_sub_tlv_header_type { BR_MRP_SUB_TLV_HEADER_TEST_MGR_NACK = 0x1, BR_MRP_SUB_TLV_HEADER_TEST_PROPAGATE = 0x2, BR_MRP_SUB_TLV_HEADER_TEST_AUTO_MGR = 0x3, }; #endif linux/msdos_fs.h 0000644 00000015463 15063602051 0007700 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MSDOS_FS_H #define _LINUX_MSDOS_FS_H #include <linux/types.h> #include <linux/magic.h> #include <asm/byteorder.h> /* * The MS-DOS filesystem constants/structures */ #ifndef SECTOR_SIZE #define SECTOR_SIZE 512 /* sector size (bytes) */ #endif #define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ #define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */ #define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */ #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ #define MSDOS_LONGNAME 256 /* maximum name length */ #define CF_LE_W(v) le16_to_cpu(v) #define CF_LE_L(v) le32_to_cpu(v) #define CT_LE_W(v) cpu_to_le16(v) #define CT_LE_L(v) cpu_to_le32(v) #define MSDOS_ROOT_INO 1 /* The root inode number */ #define MSDOS_FSINFO_INO 2 /* Used for managing the FSINFO block */ #define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ /* directory limit */ #define FAT_MAX_DIR_ENTRIES (65536) #define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS) #define ATTR_NONE 0 /* no attribute bits */ #define ATTR_RO 1 /* read-only */ #define ATTR_HIDDEN 2 /* hidden */ #define ATTR_SYS 4 /* system */ #define ATTR_VOLUME 8 /* volume label */ #define ATTR_DIR 16 /* directory */ #define ATTR_ARCH 32 /* archived */ /* attribute bits that are copied "as is" */ #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) /* bits that are used by the Windows 95/Windows NT extended FAT */ #define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) #define CASE_LOWER_BASE 8 /* base is lower case */ #define CASE_LOWER_EXT 16 /* extension is lower case */ #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) #define FAT_LFN_LEN 255 /* maximum long name length */ #define MSDOS_NAME 11 /* maximum name length */ #define MSDOS_SLOTS 21 /* max # of slots for short and long names */ #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ #define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) /* start of data cluster's entry (number of reserved clusters) */ #define FAT_START_ENT 2 /* maximum number of clusters */ #define MAX_FAT12 0xFF4 #define MAX_FAT16 0xFFF4 #define MAX_FAT32 0x0FFFFFF6 #define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \ MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12) /* bad cluster mark */ #define BAD_FAT12 0xFF7 #define BAD_FAT16 0xFFF7 #define BAD_FAT32 0x0FFFFFF7 /* standard EOF */ #define EOF_FAT12 0xFFF #define EOF_FAT16 0xFFFF #define EOF_FAT32 0x0FFFFFFF #define FAT_ENT_FREE (0) #define FAT_ENT_BAD (BAD_FAT32) #define FAT_ENT_EOF (EOF_FAT32) #define FAT_FSINFO_SIG1 0x41615252 #define FAT_FSINFO_SIG2 0x61417272 #define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \ && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) #define FAT_STATE_DIRTY 0x01 struct __fat_dirent { long d_ino; __kernel_off_t d_off; unsigned short d_reclen; char d_name[256]; /* We must not include limits.h! */ }; /* * ioctl commands */ #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2]) #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2]) /* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) #define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) /*Android kernel has used 0x12, so we use 0x13*/ #define FAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x13, __u32) struct fat_boot_sector { __u8 ignored[3]; /* Boot strap short or near jump */ __u8 system_id[8]; /* Name - can be used to special case partition manager volumes */ __u8 sector_size[2]; /* bytes per logical sector */ __u8 sec_per_clus; /* sectors/cluster */ __le16 reserved; /* reserved sectors */ __u8 fats; /* number of FATs */ __u8 dir_entries[2]; /* root directory entries */ __u8 sectors[2]; /* number of sectors */ __u8 media; /* media code */ __le16 fat_length; /* sectors/FAT */ __le16 secs_track; /* sectors per track */ __le16 heads; /* number of heads */ __le32 hidden; /* hidden sectors (unused) */ __le32 total_sect; /* number of sectors (if sectors == 0) */ union { struct { /* Extended BPB Fields for FAT16 */ __u8 drive_number; /* Physical drive number */ __u8 state; /* undocumented, but used for mount state. */ __u8 signature; /* extended boot signature */ __u8 vol_id[4]; /* volume ID */ __u8 vol_label[11]; /* volume label */ __u8 fs_type[8]; /* file system type */ /* other fields are not added here */ } fat16; struct { /* only used by FAT32 */ __le32 length; /* sectors/FAT */ __le16 flags; /* bit 8: fat mirroring, low 4: active fat */ __u8 version[2]; /* major, minor filesystem version */ __le32 root_cluster; /* first cluster in root directory */ __le16 info_sector; /* filesystem info sector */ __le16 backup_boot; /* backup boot sector */ __le16 reserved2[6]; /* Unused */ /* Extended BPB Fields for FAT32 */ __u8 drive_number; /* Physical drive number */ __u8 state; /* undocumented, but used for mount state. */ __u8 signature; /* extended boot signature */ __u8 vol_id[4]; /* volume ID */ __u8 vol_label[11]; /* volume label */ __u8 fs_type[8]; /* file system type */ /* other fields are not added here */ } fat32; }; }; struct fat_boot_fsinfo { __le32 signature1; /* 0x41615252L */ __le32 reserved1[120]; /* Nothing as far as I can tell */ __le32 signature2; /* 0x61417272L */ __le32 free_clusters; /* Free cluster count. -1 if unknown */ __le32 next_cluster; /* Most recently allocated cluster */ __le32 reserved2[4]; }; struct msdos_dir_entry { __u8 name[MSDOS_NAME];/* name and extension */ __u8 attr; /* attribute bits */ __u8 lcase; /* Case for base and extension */ __u8 ctime_cs; /* Creation time, centiseconds (0-199) */ __le16 ctime; /* Creation time */ __le16 cdate; /* Creation date */ __le16 adate; /* Last access date */ __le16 starthi; /* High 16 bits of cluster in FAT32 */ __le16 time,date,start;/* time, date and first cluster */ __le32 size; /* file size (in bytes) */ }; /* Up to 13 characters of the name */ struct msdos_dir_slot { __u8 id; /* sequence number for slot */ __u8 name0_4[10]; /* first 5 characters in name */ __u8 attr; /* attribute byte */ __u8 reserved; /* always 0 */ __u8 alias_checksum; /* checksum for 8.3 alias */ __u8 name5_10[12]; /* 6 more characters in name */ __le16 start; /* starting cluster number, 0 in long slots */ __u8 name11_12[4]; /* last 2 characters in name */ }; #endif /* _LINUX_MSDOS_FS_H */ linux/msg.h 0000644 00000006456 15063602051 0006653 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_MSG_H #define _LINUX_MSG_H #include <linux/ipc.h> /* ipcs ctl commands */ #define MSG_STAT 11 #define MSG_INFO 12 #define MSG_STAT_ANY 13 /* msgrcv options */ #define MSG_NOERROR 010000 /* no error if message is too big */ #define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ #define MSG_COPY 040000 /* copy (not remove) all queue messages */ /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct msqid_ds { struct ipc_perm msg_perm; struct msg *msg_first; /* first message on queue,unused */ struct msg *msg_last; /* last message in queue,unused */ __kernel_time_t msg_stime; /* last msgsnd time */ __kernel_time_t msg_rtime; /* last msgrcv time */ __kernel_time_t msg_ctime; /* last change time */ unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */ unsigned long msg_lqbytes; /* ditto */ unsigned short msg_cbytes; /* current number of bytes on queue */ unsigned short msg_qnum; /* number of messages in queue */ unsigned short msg_qbytes; /* max number of bytes on queue */ __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */ __kernel_ipc_pid_t msg_lrpid; /* last receive pid */ }; /* Include the definition of msqid64_ds */ #include <asm/msgbuf.h> /* message buffer for msgsnd and msgrcv calls */ struct msgbuf { __kernel_long_t mtype; /* type of message */ char mtext[1]; /* message text */ }; /* buffer for msgctl calls IPC_INFO, MSG_INFO */ struct msginfo { int msgpool; int msgmap; int msgmax; int msgmnb; int msgmni; int msgssz; int msgtql; unsigned short msgseg; }; /* * MSGMNI, MSGMAX and MSGMNB are default values which can be * modified by sysctl. * * MSGMNI is the upper limit for the number of messages queues per * namespace. * It has been chosen to be as large possible without facilitating * scenarios where userspace causes overflows when adjusting the limits via * operations of the form retrieve current limit; add X; update limit". * * MSGMNB is the default size of a new message queue. Non-root tasks can * decrease the size with msgctl(IPC_SET), root tasks * (actually: CAP_SYS_RESOURCE) can both increase and decrease the queue * size. The optimal value is application dependent. * 16384 is used because it was always used (since 0.99.10) * * MAXMAX is the maximum size of an individual message, it's a global * (per-namespace) limit that applies for all message queues. * It's set to 1/2 of MSGMNB, to ensure that at least two messages fit into * the queue. This is also an arbitrary choice (since 2.6.0). */ #define MSGMNI 32000 /* <= IPCMNI */ /* max # of msg queue identifiers */ #define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ #define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ /* unused */ #define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */ #define MSGTQL MSGMNB /* number of system message headers */ #define MSGMAP MSGMNB /* number of entries in message map */ #define MSGSSZ 16 /* message segment size */ #define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */ #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) #endif /* _LINUX_MSG_H */ linux/mtio.h 0000644 00000017757 15063602051 0007043 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/mtio.h header file for Linux. Written by H. Bergman * * Modified for special ioctls provided by zftape in September 1997 * by C.-J. Heine. */ #ifndef _LINUX_MTIO_H #define _LINUX_MTIO_H #include <linux/types.h> #include <linux/ioctl.h> /* * Structures and definitions for mag tape io control commands */ /* structure for MTIOCTOP - mag tape op command */ struct mtop { short mt_op; /* operations defined below */ int mt_count; /* how many of them */ }; /* Magnetic Tape operations [Not all operations supported by all drivers]: */ #define MTRESET 0 /* +reset drive in case of problems */ #define MTFSF 1 /* forward space over FileMark, * position at first record of next file */ #define MTBSF 2 /* backward space FileMark (position before FM) */ #define MTFSR 3 /* forward space record */ #define MTBSR 4 /* backward space record */ #define MTWEOF 5 /* write an end-of-file record (mark) */ #define MTREW 6 /* rewind */ #define MTOFFL 7 /* rewind and put the drive offline (eject?) */ #define MTNOP 8 /* no op, set status only (read with MTIOCGET) */ #define MTRETEN 9 /* retension tape */ #define MTBSFM 10 /* +backward space FileMark, position at FM */ #define MTFSFM 11 /* +forward space FileMark, position at FM */ #define MTEOM 12 /* goto end of recorded media (for appending files). * MTEOM positions after the last FM, ready for * appending another file. */ #define MTERASE 13 /* erase tape -- be careful! */ #define MTRAS1 14 /* run self test 1 (nondestructive) */ #define MTRAS2 15 /* run self test 2 (destructive) */ #define MTRAS3 16 /* reserved for self test 3 */ #define MTSETBLK 20 /* set block length (SCSI) */ #define MTSETDENSITY 21 /* set tape density (SCSI) */ #define MTSEEK 22 /* seek to block (Tandberg, etc.) */ #define MTTELL 23 /* tell block (Tandberg, etc.) */ #define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */ /* ordinary buffered operation with code 1 */ #define MTFSS 25 /* space forward over setmarks */ #define MTBSS 26 /* space backward over setmarks */ #define MTWSM 27 /* write setmarks */ #define MTLOCK 28 /* lock the drive door */ #define MTUNLOCK 29 /* unlock the drive door */ #define MTLOAD 30 /* execute the SCSI load command */ #define MTUNLOAD 31 /* execute the SCSI unload command */ #define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */ #define MTSETPART 33 /* Change the active tape partition */ #define MTMKPART 34 /* Format the tape with one or two partitions */ #define MTWEOFI 35 /* write an end-of-file record (mark) in immediate mode */ /* structure for MTIOCGET - mag tape get status command */ struct mtget { long mt_type; /* type of magtape device */ long mt_resid; /* residual count: (not sure) * number of bytes ignored, or * number of files not skipped, or * number of records not skipped. */ /* the following registers are device dependent */ long mt_dsreg; /* status register */ long mt_gstat; /* generic (device independent) status */ long mt_erreg; /* error register */ /* The next two fields are not always used */ __kernel_daddr_t mt_fileno; /* number of current file on tape */ __kernel_daddr_t mt_blkno; /* current block number */ }; /* * Constants for mt_type. Not all of these are supported, * and these are not all of the ones that are supported. */ #define MT_ISUNKNOWN 0x01 #define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */ #define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */ #define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */ #define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */ #define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */ #define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */ #define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */ #define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */ #define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */ #define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */ #define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */ #define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */ #define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */ #define MT_ISDDS1 0x51 /* DDS device without partitions */ #define MT_ISDDS2 0x52 /* DDS device with partitions */ #define MT_ISONSTREAM_SC 0x61 /* OnStream SCSI tape drives (SC-x0) and SCSI emulated (DI, DP, USB) */ #define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */ #define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */ /* QIC-40/80/3010/3020 ftape supported drives. * 20bit vendor ID + 0x800000 (see ftape-vendors.h) */ #define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ #define MT_ISFTAPE_FLAG 0x800000 /* structure for MTIOCPOS - mag tape get position command */ struct mtpos { long mt_blkno; /* current block number */ }; /* mag tape io control commands */ #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ #define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ #define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */ /* Generic Mag Tape (device independent) status macros for examining * mt_gstat -- HP-UX compatible. * There is room for more generic status bits here, but I don't * know which of them are reserved. At least three or so should * be added to make this really useful. */ #define GMT_EOF(x) ((x) & 0x80000000) #define GMT_BOT(x) ((x) & 0x40000000) #define GMT_EOT(x) ((x) & 0x20000000) #define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ #define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ #define GMT_WR_PROT(x) ((x) & 0x04000000) /* #define GMT_ ? ((x) & 0x02000000) */ #define GMT_ONLINE(x) ((x) & 0x01000000) #define GMT_D_6250(x) ((x) & 0x00800000) #define GMT_D_1600(x) ((x) & 0x00400000) #define GMT_D_800(x) ((x) & 0x00200000) /* #define GMT_ ? ((x) & 0x00100000) */ /* #define GMT_ ? ((x) & 0x00080000) */ #define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */ /* #define GMT_ ? ((x) & 0x00020000) */ #define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */ #define GMT_CLN(x) ((x) & 0x00008000) /* cleaning requested */ /* 15 generic status bits unused */ /* SCSI-tape specific definitions */ /* Bitfield shifts in the status */ #define MT_ST_BLKSIZE_SHIFT 0 #define MT_ST_BLKSIZE_MASK 0xffffff #define MT_ST_DENSITY_SHIFT 24 #define MT_ST_DENSITY_MASK 0xff000000 #define MT_ST_SOFTERR_SHIFT 0 #define MT_ST_SOFTERR_MASK 0xffff /* Bitfields for the MTSETDRVBUFFER ioctl */ #define MT_ST_OPTIONS 0xf0000000 #define MT_ST_BOOLEANS 0x10000000 #define MT_ST_SETBOOLEANS 0x30000000 #define MT_ST_CLEARBOOLEANS 0x40000000 #define MT_ST_WRITE_THRESHOLD 0x20000000 #define MT_ST_DEF_BLKSIZE 0x50000000 #define MT_ST_DEF_OPTIONS 0x60000000 #define MT_ST_TIMEOUTS 0x70000000 #define MT_ST_SET_TIMEOUT (MT_ST_TIMEOUTS | 0x000000) #define MT_ST_SET_LONG_TIMEOUT (MT_ST_TIMEOUTS | 0x100000) #define MT_ST_SET_CLN 0x80000000 #define MT_ST_BUFFER_WRITES 0x1 #define MT_ST_ASYNC_WRITES 0x2 #define MT_ST_READ_AHEAD 0x4 #define MT_ST_DEBUGGING 0x8 #define MT_ST_TWO_FM 0x10 #define MT_ST_FAST_MTEOM 0x20 #define MT_ST_AUTO_LOCK 0x40 #define MT_ST_DEF_WRITES 0x80 #define MT_ST_CAN_BSR 0x100 #define MT_ST_NO_BLKLIMS 0x200 #define MT_ST_CAN_PARTITIONS 0x400 #define MT_ST_SCSI2LOGICAL 0x800 #define MT_ST_SYSV 0x1000 #define MT_ST_NOWAIT 0x2000 #define MT_ST_SILI 0x4000 #define MT_ST_NOWAIT_EOF 0x8000 /* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ #define MT_ST_CLEAR_DEFAULT 0xfffff #define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) /* The offset for the arguments for the special HP changer load command. */ #define MT_ST_HPLOADER_OFFSET 10000 #endif /* _LINUX_MTIO_H */ linux/n_r3964.h 0000644 00000004552 15063602051 0007164 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* r3964 linediscipline for linux * * ----------------------------------------------------------- * Copyright by * Philips Automation Projects * Kassel (Germany) * ----------------------------------------------------------- * This software may be used and distributed according to the terms of * the GNU General Public License, incorporated herein by reference. * * Author: * L. Haag * * $Log: r3964.h,v $ * Revision 1.4 2005/12/21 19:54:24 Kurt Huwig <kurt huwig de> * Fixed HZ usage on 2.6 kernels * Removed unnecessary include * * Revision 1.3 2001/03/18 13:02:24 dwmw2 * Fix timer usage, use spinlocks properly. * * Revision 1.2 2001/03/18 12:53:15 dwmw2 * Merge changes in 2.4.2 * * Revision 1.1.1.1 1998/10/13 16:43:14 dwmw2 * This'll screw the version control * * Revision 1.6 1998/09/30 00:40:38 dwmw2 * Updated to use kernel's N_R3964 if available * * Revision 1.4 1998/04/02 20:29:44 lhaag * select, blocking, ... * * Revision 1.3 1998/02/12 18:58:43 root * fixed some memory leaks * calculation of checksum characters * * Revision 1.2 1998/02/07 13:03:17 root * ioctl read_telegram * * Revision 1.1 1998/02/06 19:19:43 root * Initial revision * * */ #ifndef __LINUX_N_R3964_H__ #define __LINUX_N_R3964_H__ /* line disciplines for r3964 protocol */ /* * Ioctl-commands */ #define R3964_ENABLE_SIGNALS 0x5301 #define R3964_SETPRIORITY 0x5302 #define R3964_USE_BCC 0x5303 #define R3964_READ_TELEGRAM 0x5304 /* Options for R3964_SETPRIORITY */ #define R3964_MASTER 0 #define R3964_SLAVE 1 /* Options for R3964_ENABLE_SIGNALS */ #define R3964_SIG_ACK 0x0001 #define R3964_SIG_DATA 0x0002 #define R3964_SIG_ALL 0x000f #define R3964_SIG_NONE 0x0000 #define R3964_USE_SIGIO 0x1000 /* * r3964 operation states: */ /* types for msg_id: */ enum {R3964_MSG_ACK=1, R3964_MSG_DATA }; #define R3964_MAX_MSG_COUNT 32 /* error codes for client messages */ #define R3964_OK 0 /* no error. */ #define R3964_TX_FAIL -1 /* transmission error, block NOT sent */ #define R3964_OVERFLOW -2 /* msg queue overflow */ /* the client gets this struct when calling read(fd,...): */ struct r3964_client_message { int msg_id; int arg; int error_code; }; #define R3964_MTU 256 #endif /* __LINUX_N_R3964_H__ */ linux/nbd-netlink.h 0000644 00000004550 15063602051 0010263 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2017 Facebook. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #ifndef LINUX_NBD_NETLINK_H #define LINUX_NBD_NETLINK_H #define NBD_GENL_FAMILY_NAME "nbd" #define NBD_GENL_VERSION 0x1 #define NBD_GENL_MCAST_GROUP_NAME "nbd_mc_group" /* Configuration policy attributes, used for CONNECT */ enum { NBD_ATTR_UNSPEC, NBD_ATTR_INDEX, NBD_ATTR_SIZE_BYTES, NBD_ATTR_BLOCK_SIZE_BYTES, NBD_ATTR_TIMEOUT, NBD_ATTR_SERVER_FLAGS, NBD_ATTR_CLIENT_FLAGS, NBD_ATTR_SOCKETS, NBD_ATTR_DEAD_CONN_TIMEOUT, NBD_ATTR_DEVICE_LIST, NBD_ATTR_BACKEND_IDENTIFIER, __NBD_ATTR_MAX, }; #define NBD_ATTR_MAX (__NBD_ATTR_MAX - 1) /* * This is the format for multiple devices with NBD_ATTR_DEVICE_LIST * * [NBD_ATTR_DEVICE_LIST] * [NBD_DEVICE_ITEM] * [NBD_DEVICE_INDEX] * [NBD_DEVICE_CONNECTED] */ enum { NBD_DEVICE_ITEM_UNSPEC, NBD_DEVICE_ITEM, __NBD_DEVICE_ITEM_MAX, }; #define NBD_DEVICE_ITEM_MAX (__NBD_DEVICE_ITEM_MAX - 1) enum { NBD_DEVICE_UNSPEC, NBD_DEVICE_INDEX, NBD_DEVICE_CONNECTED, __NBD_DEVICE_MAX, }; #define NBD_DEVICE_ATTR_MAX (__NBD_DEVICE_MAX - 1) /* * This is the format for multiple sockets with NBD_ATTR_SOCKETS * * [NBD_ATTR_SOCKETS] * [NBD_SOCK_ITEM] * [NBD_SOCK_FD] * [NBD_SOCK_ITEM] * [NBD_SOCK_FD] */ enum { NBD_SOCK_ITEM_UNSPEC, NBD_SOCK_ITEM, __NBD_SOCK_ITEM_MAX, }; #define NBD_SOCK_ITEM_MAX (__NBD_SOCK_ITEM_MAX - 1) enum { NBD_SOCK_UNSPEC, NBD_SOCK_FD, __NBD_SOCK_MAX, }; #define NBD_SOCK_MAX (__NBD_SOCK_MAX - 1) enum { NBD_CMD_UNSPEC, NBD_CMD_CONNECT, NBD_CMD_DISCONNECT, NBD_CMD_RECONFIGURE, NBD_CMD_LINK_DEAD, NBD_CMD_STATUS, __NBD_CMD_MAX, }; #define NBD_CMD_MAX (__NBD_CMD_MAX - 1) #endif /* LINUX_NBD_NETLINK_H */ linux/nbd.h 0000644 00000005720 15063602051 0006621 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL. * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne) * Made nbd_end_request() use the io_request_lock * 2001 Copyright (C) Steven Whitehouse * New nbd_end_request() for compatibility with new linux block * layer code. * 2003/06/24 Louis D. Langholtz <ldl@aros.net> * Removed unneeded blksize_bits field from nbd_device struct. * Cleanup PARANOIA usage & code. * 2004/02/19 Paul Clements * Removed PARANOIA, plus various cleanup and comments */ #ifndef LINUX_NBD_H #define LINUX_NBD_H #include <linux/types.h> #define NBD_SET_SOCK _IO( 0xab, 0 ) #define NBD_SET_BLKSIZE _IO( 0xab, 1 ) #define NBD_SET_SIZE _IO( 0xab, 2 ) #define NBD_DO_IT _IO( 0xab, 3 ) #define NBD_CLEAR_SOCK _IO( 0xab, 4 ) #define NBD_CLEAR_QUE _IO( 0xab, 5 ) #define NBD_PRINT_DEBUG _IO( 0xab, 6 ) #define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) #define NBD_DISCONNECT _IO( 0xab, 8 ) #define NBD_SET_TIMEOUT _IO( 0xab, 9 ) #define NBD_SET_FLAGS _IO( 0xab, 10) enum { NBD_CMD_READ = 0, NBD_CMD_WRITE = 1, NBD_CMD_DISC = 2, NBD_CMD_FLUSH = 3, NBD_CMD_TRIM = 4 }; /* values for flags field, these are server interaction specific. */ #define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */ #define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */ #define NBD_FLAG_SEND_FLUSH (1 << 2) /* can flush writeback cache */ #define NBD_FLAG_SEND_FUA (1 << 3) /* send FUA (forced unit access) */ /* there is a gap here to match userspace */ #define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */ #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) /* Server supports multiple connections per export. */ /* values for cmd flags in the upper 16 bits of request type */ #define NBD_CMD_FLAG_FUA (1 << 16) /* FUA (forced unit access) op */ /* These are client behavior specific flags. */ #define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) /* delete the nbd device on disconnect. */ #define NBD_CFLAG_DISCONNECT_ON_CLOSE (1 << 1) /* disconnect the nbd device on * close by last opener. */ /* userspace doesn't need the nbd_device structure */ /* These are sent over the network in the request/reply magic fields */ #define NBD_REQUEST_MAGIC 0x25609513 #define NBD_REPLY_MAGIC 0x67446698 /* Do *not* use magics: 0x12560953 0x96744668. */ /* * This is the packet used for communication between client and * server. All data are in network byte order. */ struct nbd_request { __be32 magic; __be32 type; /* == READ || == WRITE */ char handle[8]; __be64 from; __be32 len; } __attribute__((packed)); /* * This is the reply packet that nbd-server sends back to the client after * it has completed an I/O request (or an error occurs). */ struct nbd_reply { __be32 magic; __be32 error; /* 0 = ok, else error */ char handle[8]; /* handle you got from request */ }; #endif /* LINUX_NBD_H */ linux/ncsi.h 0000644 00000007450 15063602051 0007014 0 ustar 00 /* * Copyright Samuel Mendoza-Jonas, IBM Corporation 2018. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef __UAPI_NCSI_NETLINK_H__ #define __UAPI_NCSI_NETLINK_H__ /** * enum ncsi_nl_commands - supported NCSI commands * * @NCSI_CMD_UNSPEC: unspecified command to catch errors * @NCSI_CMD_PKG_INFO: list package and channel attributes. Requires * NCSI_ATTR_IFINDEX. If NCSI_ATTR_PACKAGE_ID is specified returns the * specific package and its channels - otherwise a dump request returns * all packages and their associated channels. * @NCSI_CMD_SET_INTERFACE: set preferred package and channel combination. * Requires NCSI_ATTR_IFINDEX and the preferred NCSI_ATTR_PACKAGE_ID and * optionally the preferred NCSI_ATTR_CHANNEL_ID. * @NCSI_CMD_CLEAR_INTERFACE: clear any preferred package/channel combination. * Requires NCSI_ATTR_IFINDEX. * @NCSI_CMD_MAX: highest command number */ enum ncsi_nl_commands { NCSI_CMD_UNSPEC, NCSI_CMD_PKG_INFO, NCSI_CMD_SET_INTERFACE, NCSI_CMD_CLEAR_INTERFACE, __NCSI_CMD_AFTER_LAST, NCSI_CMD_MAX = __NCSI_CMD_AFTER_LAST - 1 }; /** * enum ncsi_nl_attrs - General NCSI netlink attributes * * @NCSI_ATTR_UNSPEC: unspecified attributes to catch errors * @NCSI_ATTR_IFINDEX: ifindex of network device using NCSI * @NCSI_ATTR_PACKAGE_LIST: nested array of NCSI_PKG_ATTR attributes * @NCSI_ATTR_PACKAGE_ID: package ID * @NCSI_ATTR_CHANNEL_ID: channel ID * @NCSI_ATTR_MAX: highest attribute number */ enum ncsi_nl_attrs { NCSI_ATTR_UNSPEC, NCSI_ATTR_IFINDEX, NCSI_ATTR_PACKAGE_LIST, NCSI_ATTR_PACKAGE_ID, NCSI_ATTR_CHANNEL_ID, __NCSI_ATTR_AFTER_LAST, NCSI_ATTR_MAX = __NCSI_ATTR_AFTER_LAST - 1 }; /** * enum ncsi_nl_pkg_attrs - NCSI netlink package-specific attributes * * @NCSI_PKG_ATTR_UNSPEC: unspecified attributes to catch errors * @NCSI_PKG_ATTR: nested array of package attributes * @NCSI_PKG_ATTR_ID: package ID * @NCSI_PKG_ATTR_FORCED: flag signifying a package has been set as preferred * @NCSI_PKG_ATTR_CHANNEL_LIST: nested array of NCSI_CHANNEL_ATTR attributes * @NCSI_PKG_ATTR_MAX: highest attribute number */ enum ncsi_nl_pkg_attrs { NCSI_PKG_ATTR_UNSPEC, NCSI_PKG_ATTR, NCSI_PKG_ATTR_ID, NCSI_PKG_ATTR_FORCED, NCSI_PKG_ATTR_CHANNEL_LIST, __NCSI_PKG_ATTR_AFTER_LAST, NCSI_PKG_ATTR_MAX = __NCSI_PKG_ATTR_AFTER_LAST - 1 }; /** * enum ncsi_nl_channel_attrs - NCSI netlink channel-specific attributes * * @NCSI_CHANNEL_ATTR_UNSPEC: unspecified attributes to catch errors * @NCSI_CHANNEL_ATTR: nested array of channel attributes * @NCSI_CHANNEL_ATTR_ID: channel ID * @NCSI_CHANNEL_ATTR_VERSION_MAJOR: channel major version number * @NCSI_CHANNEL_ATTR_VERSION_MINOR: channel minor version number * @NCSI_CHANNEL_ATTR_VERSION_STR: channel version string * @NCSI_CHANNEL_ATTR_LINK_STATE: channel link state flags * @NCSI_CHANNEL_ATTR_ACTIVE: channels with this flag are in * NCSI_CHANNEL_ACTIVE state * @NCSI_CHANNEL_ATTR_FORCED: flag signifying a channel has been set as * preferred * @NCSI_CHANNEL_ATTR_VLAN_LIST: nested array of NCSI_CHANNEL_ATTR_VLAN_IDs * @NCSI_CHANNEL_ATTR_VLAN_ID: VLAN ID being filtered on this channel * @NCSI_CHANNEL_ATTR_MAX: highest attribute number */ enum ncsi_nl_channel_attrs { NCSI_CHANNEL_ATTR_UNSPEC, NCSI_CHANNEL_ATTR, NCSI_CHANNEL_ATTR_ID, NCSI_CHANNEL_ATTR_VERSION_MAJOR, NCSI_CHANNEL_ATTR_VERSION_MINOR, NCSI_CHANNEL_ATTR_VERSION_STR, NCSI_CHANNEL_ATTR_LINK_STATE, NCSI_CHANNEL_ATTR_ACTIVE, NCSI_CHANNEL_ATTR_FORCED, NCSI_CHANNEL_ATTR_VLAN_LIST, NCSI_CHANNEL_ATTR_VLAN_ID, __NCSI_CHANNEL_ATTR_AFTER_LAST, NCSI_CHANNEL_ATTR_MAX = __NCSI_CHANNEL_ATTR_AFTER_LAST - 1 }; #endif /* __UAPI_NCSI_NETLINK_H__ */ linux/ndctl.h 0000644 00000015322 15063602051 0007161 0 ustar 00 /* * Copyright (c) 2014-2016, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. */ #ifndef __NDCTL_H__ #define __NDCTL_H__ #include <linux/types.h> struct nd_cmd_dimm_flags { __u32 status; __u32 flags; } __attribute__((packed)); struct nd_cmd_get_config_size { __u32 status; __u32 config_size; __u32 max_xfer; } __attribute__((packed)); struct nd_cmd_get_config_data_hdr { __u32 in_offset; __u32 in_length; __u32 status; __u8 out_buf[0]; } __attribute__((packed)); struct nd_cmd_set_config_hdr { __u32 in_offset; __u32 in_length; __u8 in_buf[0]; } __attribute__((packed)); struct nd_cmd_vendor_hdr { __u32 opcode; __u32 in_length; __u8 in_buf[0]; } __attribute__((packed)); struct nd_cmd_vendor_tail { __u32 status; __u32 out_length; __u8 out_buf[0]; } __attribute__((packed)); struct nd_cmd_ars_cap { __u64 address; __u64 length; __u32 status; __u32 max_ars_out; __u32 clear_err_unit; __u16 flags; __u16 reserved; } __attribute__((packed)); struct nd_cmd_ars_start { __u64 address; __u64 length; __u16 type; __u8 flags; __u8 reserved[5]; __u32 status; __u32 scrub_time; } __attribute__((packed)); struct nd_cmd_ars_status { __u32 status; __u32 out_length; __u64 address; __u64 length; __u64 restart_address; __u64 restart_length; __u16 type; __u16 flags; __u32 num_records; struct nd_ars_record { __u32 handle; __u32 reserved; __u64 err_address; __u64 length; } __attribute__((packed)) records[0]; } __attribute__((packed)); struct nd_cmd_clear_error { __u64 address; __u64 length; __u32 status; __u8 reserved[4]; __u64 cleared; } __attribute__((packed)); enum { ND_CMD_IMPLEMENTED = 0, /* bus commands */ ND_CMD_ARS_CAP = 1, ND_CMD_ARS_START = 2, ND_CMD_ARS_STATUS = 3, ND_CMD_CLEAR_ERROR = 4, /* per-dimm commands */ ND_CMD_SMART = 1, ND_CMD_SMART_THRESHOLD = 2, ND_CMD_DIMM_FLAGS = 3, ND_CMD_GET_CONFIG_SIZE = 4, ND_CMD_GET_CONFIG_DATA = 5, ND_CMD_SET_CONFIG_DATA = 6, ND_CMD_VENDOR_EFFECT_LOG_SIZE = 7, ND_CMD_VENDOR_EFFECT_LOG = 8, ND_CMD_VENDOR = 9, ND_CMD_CALL = 10, }; enum { ND_ARS_VOLATILE = 1, ND_ARS_PERSISTENT = 2, ND_ARS_RETURN_PREV_DATA = 1 << 1, ND_CONFIG_LOCKED = 1, }; static __inline__ const char *nvdimm_bus_cmd_name(unsigned cmd) { static const char * const names[] = { [ND_CMD_ARS_CAP] = "ars_cap", [ND_CMD_ARS_START] = "ars_start", [ND_CMD_ARS_STATUS] = "ars_status", [ND_CMD_CLEAR_ERROR] = "clear_error", [ND_CMD_CALL] = "cmd_call", }; if (cmd < ARRAY_SIZE(names) && names[cmd]) return names[cmd]; return "unknown"; } static __inline__ const char *nvdimm_cmd_name(unsigned cmd) { static const char * const names[] = { [ND_CMD_SMART] = "smart", [ND_CMD_SMART_THRESHOLD] = "smart_thresh", [ND_CMD_DIMM_FLAGS] = "flags", [ND_CMD_GET_CONFIG_SIZE] = "get_size", [ND_CMD_GET_CONFIG_DATA] = "get_data", [ND_CMD_SET_CONFIG_DATA] = "set_data", [ND_CMD_VENDOR_EFFECT_LOG_SIZE] = "effect_size", [ND_CMD_VENDOR_EFFECT_LOG] = "effect_log", [ND_CMD_VENDOR] = "vendor", [ND_CMD_CALL] = "cmd_call", }; if (cmd < ARRAY_SIZE(names) && names[cmd]) return names[cmd]; return "unknown"; } #define ND_IOCTL 'N' #define ND_IOCTL_DIMM_FLAGS _IOWR(ND_IOCTL, ND_CMD_DIMM_FLAGS,\ struct nd_cmd_dimm_flags) #define ND_IOCTL_GET_CONFIG_SIZE _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_SIZE,\ struct nd_cmd_get_config_size) #define ND_IOCTL_GET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_GET_CONFIG_DATA,\ struct nd_cmd_get_config_data_hdr) #define ND_IOCTL_SET_CONFIG_DATA _IOWR(ND_IOCTL, ND_CMD_SET_CONFIG_DATA,\ struct nd_cmd_set_config_hdr) #define ND_IOCTL_VENDOR _IOWR(ND_IOCTL, ND_CMD_VENDOR,\ struct nd_cmd_vendor_hdr) #define ND_IOCTL_ARS_CAP _IOWR(ND_IOCTL, ND_CMD_ARS_CAP,\ struct nd_cmd_ars_cap) #define ND_IOCTL_ARS_START _IOWR(ND_IOCTL, ND_CMD_ARS_START,\ struct nd_cmd_ars_start) #define ND_IOCTL_ARS_STATUS _IOWR(ND_IOCTL, ND_CMD_ARS_STATUS,\ struct nd_cmd_ars_status) #define ND_IOCTL_CLEAR_ERROR _IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR,\ struct nd_cmd_clear_error) #define ND_DEVICE_DIMM 1 /* nd_dimm: container for "config data" */ #define ND_DEVICE_REGION_PMEM 2 /* nd_region: (parent of PMEM namespaces) */ #define ND_DEVICE_REGION_BLK 3 /* nd_region: (parent of BLK namespaces) */ #define ND_DEVICE_NAMESPACE_IO 4 /* legacy persistent memory */ #define ND_DEVICE_NAMESPACE_PMEM 5 /* PMEM namespace (may alias with BLK) */ #define ND_DEVICE_NAMESPACE_BLK 6 /* BLK namespace (may alias with PMEM) */ #define ND_DEVICE_DAX_PMEM 7 /* Device DAX interface to pmem */ enum nd_driver_flags { ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM, ND_DRIVER_REGION_PMEM = 1 << ND_DEVICE_REGION_PMEM, ND_DRIVER_REGION_BLK = 1 << ND_DEVICE_REGION_BLK, ND_DRIVER_NAMESPACE_IO = 1 << ND_DEVICE_NAMESPACE_IO, ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM, ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK, ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM, }; enum { ND_MIN_NAMESPACE_SIZE = PAGE_SIZE, }; enum ars_masks { ARS_STATUS_MASK = 0x0000FFFF, ARS_EXT_STATUS_SHIFT = 16, }; /* * struct nd_cmd_pkg * * is a wrapper to a quasi pass thru interface for invoking firmware * associated with nvdimms. * * INPUT PARAMETERS * * nd_family corresponds to the firmware (e.g. DSM) interface. * * nd_command are the function index advertised by the firmware. * * nd_size_in is the size of the input parameters being passed to firmware * * OUTPUT PARAMETERS * * nd_fw_size is the size of the data firmware wants to return for * the call. If nd_fw_size is greater than size of nd_size_out, only * the first nd_size_out bytes are returned. */ struct nd_cmd_pkg { __u64 nd_family; /* family of commands */ __u64 nd_command; __u32 nd_size_in; /* INPUT: size of input args */ __u32 nd_size_out; /* INPUT: size of payload */ __u32 nd_reserved2[9]; /* reserved must be zero */ __u32 nd_fw_size; /* OUTPUT: size fw wants to return */ unsigned char nd_payload[]; /* Contents of call */ }; /* These NVDIMM families represent pre-standardization command sets */ #define NVDIMM_FAMILY_INTEL 0 #define NVDIMM_FAMILY_HPE1 1 #define NVDIMM_FAMILY_HPE2 2 #define NVDIMM_FAMILY_MSFT 3 #define NVDIMM_FAMILY_HYPERV 4 #define NVDIMM_FAMILY_PAPR 5 #define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL,\ struct nd_cmd_pkg) #endif /* __NDCTL_H__ */ linux/neighbour.h 0000644 00000012022 15063602051 0010031 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NEIGHBOUR_H #define __LINUX_NEIGHBOUR_H #include <linux/types.h> #include <linux/netlink.h> struct ndmsg { __u8 ndm_family; __u8 ndm_pad1; __u16 ndm_pad2; __s32 ndm_ifindex; __u16 ndm_state; __u8 ndm_flags; __u8 ndm_type; }; enum { NDA_UNSPEC, NDA_DST, NDA_LLADDR, NDA_CACHEINFO, NDA_PROBES, NDA_VLAN, NDA_PORT, NDA_VNI, NDA_IFINDEX, NDA_MASTER, NDA_LINK_NETNSID, NDA_SRC_VNI, NDA_PROTOCOL, /* Originator of entry */ __RH_RESERVED_NDA_NH_ID, NDA_FDB_EXT_ATTRS, __NDA_MAX }; #define NDA_MAX (__NDA_MAX - 1) /* * Neighbor Cache Entry Flags */ #define NTF_USE 0x01 #define NTF_SELF 0x02 #define NTF_MASTER 0x04 #define NTF_PROXY 0x08 /* == ATF_PUBL */ #define NTF_EXT_LEARNED 0x10 #define NTF_OFFLOADED 0x20 #define NTF_STICKY 0x40 #define NTF_ROUTER 0x80 /* * Neighbor Cache Entry States. */ #define NUD_INCOMPLETE 0x01 #define NUD_REACHABLE 0x02 #define NUD_STALE 0x04 #define NUD_DELAY 0x08 #define NUD_PROBE 0x10 #define NUD_FAILED 0x20 /* Dummy states */ #define NUD_NOARP 0x40 #define NUD_PERMANENT 0x80 #define NUD_NONE 0x00 /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change * and make no address resolution or NUD. * NUD_PERMANENT also cannot be deleted by garbage collectors. * When NTF_EXT_LEARNED is set for a bridge fdb entry the different cache entry * states don't make sense and thus are ignored. Such entries don't age and * can roam. */ struct nda_cacheinfo { __u32 ndm_confirmed; __u32 ndm_used; __u32 ndm_updated; __u32 ndm_refcnt; }; /***************************************************************** * Neighbour tables specific messages. * * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the * NLM_F_DUMP flag set. Every neighbour table configuration is * spread over multiple messages to avoid running into message * size limits on systems with many interfaces. The first message * in the sequence transports all not device specific data such as * statistics, configuration, and the default parameter set. * This message is followed by 0..n messages carrying device * specific parameter sets. * Although the ordering should be sufficient, NDTA_NAME can be * used to identify sequences. The initial message can be identified * by checking for NDTA_CONFIG. The device specific messages do * not contain this TLV but have NDTPA_IFINDEX set to the * corresponding interface index. * * To change neighbour table attributes, send RTM_SETNEIGHTBL * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked * otherwise. Device specific parameter sets can be changed by * setting NDTPA_IFINDEX to the interface index of the corresponding * device. ****/ struct ndt_stats { __u64 ndts_allocs; __u64 ndts_destroys; __u64 ndts_hash_grows; __u64 ndts_res_failed; __u64 ndts_lookups; __u64 ndts_hits; __u64 ndts_rcv_probes_mcast; __u64 ndts_rcv_probes_ucast; __u64 ndts_periodic_gc_runs; __u64 ndts_forced_gc_runs; __u64 ndts_table_fulls; }; enum { NDTPA_UNSPEC, NDTPA_IFINDEX, /* u32, unchangeable */ NDTPA_REFCNT, /* u32, read-only */ NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ NDTPA_RETRANS_TIME, /* u64, msecs */ NDTPA_GC_STALETIME, /* u64, msecs */ NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ NDTPA_QUEUE_LEN, /* u32 */ NDTPA_APP_PROBES, /* u32 */ NDTPA_UCAST_PROBES, /* u32 */ NDTPA_MCAST_PROBES, /* u32 */ NDTPA_ANYCAST_DELAY, /* u64, msecs */ NDTPA_PROXY_DELAY, /* u64, msecs */ NDTPA_PROXY_QLEN, /* u32 */ NDTPA_LOCKTIME, /* u64, msecs */ NDTPA_QUEUE_LENBYTES, /* u32 */ NDTPA_MCAST_REPROBES, /* u32 */ NDTPA_PAD, __NDTPA_MAX }; #define NDTPA_MAX (__NDTPA_MAX - 1) struct ndtmsg { __u8 ndtm_family; __u8 ndtm_pad1; __u16 ndtm_pad2; }; struct ndt_config { __u16 ndtc_key_len; __u16 ndtc_entry_size; __u32 ndtc_entries; __u32 ndtc_last_flush; /* delta to now in msecs */ __u32 ndtc_last_rand; /* delta to now in msecs */ __u32 ndtc_hash_rnd; __u32 ndtc_hash_mask; __u32 ndtc_hash_chain_gc; __u32 ndtc_proxy_qlen; }; enum { NDTA_UNSPEC, NDTA_NAME, /* char *, unchangeable */ NDTA_THRESH1, /* u32 */ NDTA_THRESH2, /* u32 */ NDTA_THRESH3, /* u32 */ NDTA_CONFIG, /* struct ndt_config, read-only */ NDTA_PARMS, /* nested TLV NDTPA_* */ NDTA_STATS, /* struct ndt_stats, read-only */ NDTA_GC_INTERVAL, /* u64, msecs */ NDTA_PAD, __NDTA_MAX }; #define NDTA_MAX (__NDTA_MAX - 1) /* FDB activity notification bits used in NFEA_ACTIVITY_NOTIFY: * - FDB_NOTIFY_BIT - notify on activity/expire for any entry * - FDB_NOTIFY_INACTIVE_BIT - mark as inactive to avoid multiple notifications */ enum { FDB_NOTIFY_BIT = (1 << 0), FDB_NOTIFY_INACTIVE_BIT = (1 << 1) }; /* embedded into NDA_FDB_EXT_ATTRS: * [NDA_FDB_EXT_ATTRS] = { * [NFEA_ACTIVITY_NOTIFY] * ... * } */ enum { NFEA_UNSPEC, NFEA_ACTIVITY_NOTIFY, NFEA_DONT_REFRESH, __NFEA_MAX }; #define NFEA_MAX (__NFEA_MAX - 1) #endif linux/net.h 0000644 00000004045 15063602051 0006643 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * NET An implementation of the SOCKET network access protocol. * This is the master header file for the Linux NET layer, * or, in plain English: the networking handling part of the * kernel. * * Version: @(#)net.h 1.0.3 05/25/93 * * Authors: Orest Zborowski, <obz@Kodak.COM> * Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_NET_H #define _LINUX_NET_H #include <linux/socket.h> #include <asm/socket.h> #define NPROTO AF_MAX #define SYS_SOCKET 1 /* sys_socket(2) */ #define SYS_BIND 2 /* sys_bind(2) */ #define SYS_CONNECT 3 /* sys_connect(2) */ #define SYS_LISTEN 4 /* sys_listen(2) */ #define SYS_ACCEPT 5 /* sys_accept(2) */ #define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ #define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ #define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ #define SYS_SEND 9 /* sys_send(2) */ #define SYS_RECV 10 /* sys_recv(2) */ #define SYS_SENDTO 11 /* sys_sendto(2) */ #define SYS_RECVFROM 12 /* sys_recvfrom(2) */ #define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ #define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ #define SYS_ACCEPT4 18 /* sys_accept4(2) */ #define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */ #define SYS_SENDMMSG 20 /* sys_sendmmsg(2) */ typedef enum { SS_FREE = 0, /* not allocated */ SS_UNCONNECTED, /* unconnected to any socket */ SS_CONNECTING, /* in process of connecting */ SS_CONNECTED, /* connected to socket */ SS_DISCONNECTING /* in process of disconnecting */ } socket_state; #define __SO_ACCEPTCON (1 << 16) /* performed a listen */ #endif /* _LINUX_NET_H */ linux/net_dropmon.h 0000644 00000005552 15063602051 0010405 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NET_DROPMON_H #define __NET_DROPMON_H #include <linux/types.h> #include <linux/netlink.h> struct net_dm_drop_point { __u8 pc[8]; __u32 count; }; #define is_drop_point_hw(x) do {\ int ____i, ____j;\ for (____i = 0; ____i < 8; i ____i++)\ ____j |= x[____i];\ ____j;\ } while (0) #define NET_DM_CFG_VERSION 0 #define NET_DM_CFG_ALERT_COUNT 1 #define NET_DM_CFG_ALERT_DELAY 2 #define NET_DM_CFG_MAX 3 struct net_dm_config_entry { __u32 type; __u64 data __attribute__((aligned(8))); }; struct net_dm_config_msg { __u32 entries; struct net_dm_config_entry options[0]; }; struct net_dm_alert_msg { __u32 entries; struct net_dm_drop_point points[0]; }; struct net_dm_user_msg { union { struct net_dm_config_msg user; struct net_dm_alert_msg alert; } u; }; /* These are the netlink message types for this protocol */ enum { NET_DM_CMD_UNSPEC = 0, NET_DM_CMD_ALERT, NET_DM_CMD_CONFIG, NET_DM_CMD_START, NET_DM_CMD_STOP, NET_DM_CMD_PACKET_ALERT, NET_DM_CMD_CONFIG_GET, NET_DM_CMD_CONFIG_NEW, NET_DM_CMD_STATS_GET, NET_DM_CMD_STATS_NEW, _NET_DM_CMD_MAX, }; #define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1) /* * Our group identifiers */ #define NET_DM_GRP_ALERT 1 enum net_dm_attr { NET_DM_ATTR_UNSPEC, NET_DM_ATTR_ALERT_MODE, /* u8 */ NET_DM_ATTR_PC, /* u64 */ NET_DM_ATTR_SYMBOL, /* string */ NET_DM_ATTR_IN_PORT, /* nested */ NET_DM_ATTR_TIMESTAMP, /* u64 */ NET_DM_ATTR_PROTO, /* u16 */ NET_DM_ATTR_PAYLOAD, /* binary */ NET_DM_ATTR_PAD, NET_DM_ATTR_TRUNC_LEN, /* u32 */ NET_DM_ATTR_ORIG_LEN, /* u32 */ NET_DM_ATTR_QUEUE_LEN, /* u32 */ NET_DM_ATTR_STATS, /* nested */ NET_DM_ATTR_HW_STATS, /* nested */ NET_DM_ATTR_ORIGIN, /* u16 */ NET_DM_ATTR_HW_TRAP_GROUP_NAME, /* string */ NET_DM_ATTR_HW_TRAP_NAME, /* string */ NET_DM_ATTR_HW_ENTRIES, /* nested */ NET_DM_ATTR_HW_ENTRY, /* nested */ NET_DM_ATTR_HW_TRAP_COUNT, /* u32 */ NET_DM_ATTR_SW_DROPS, /* flag */ NET_DM_ATTR_HW_DROPS, /* flag */ NET_DM_ATTR_FLOW_ACTION_COOKIE, /* binary */ NET_DM_ATTR_REASON, /* string */ __NET_DM_ATTR_MAX, NET_DM_ATTR_MAX = __NET_DM_ATTR_MAX - 1 }; /** * enum net_dm_alert_mode - Alert mode. * @NET_DM_ALERT_MODE_SUMMARY: A summary of recent drops is sent to user space. * @NET_DM_ALERT_MODE_PACKET: Each dropped packet is sent to user space along * with metadata. */ enum net_dm_alert_mode { NET_DM_ALERT_MODE_SUMMARY, NET_DM_ALERT_MODE_PACKET, }; enum { NET_DM_ATTR_PORT_NETDEV_IFINDEX, /* u32 */ NET_DM_ATTR_PORT_NETDEV_NAME, /* string */ __NET_DM_ATTR_PORT_MAX, NET_DM_ATTR_PORT_MAX = __NET_DM_ATTR_PORT_MAX - 1 }; enum { NET_DM_ATTR_STATS_DROPPED, /* u64 */ __NET_DM_ATTR_STATS_MAX, NET_DM_ATTR_STATS_MAX = __NET_DM_ATTR_STATS_MAX - 1 }; enum net_dm_origin { NET_DM_ORIGIN_SW, NET_DM_ORIGIN_HW, }; #endif linux/net_namespace.h 0000644 00000001313 15063602051 0010652 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2015 6WIND S.A. * Author: Nicolas Dichtel <nicolas.dichtel@6wind.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. */ #ifndef _LINUX_NET_NAMESPACE_H_ #define _LINUX_NET_NAMESPACE_H_ /* Attributes of RTM_NEWNSID/RTM_GETNSID messages */ enum { NETNSA_NONE, #define NETNSA_NSID_NOT_ASSIGNED -1 NETNSA_NSID, NETNSA_PID, NETNSA_FD, NETNSA_TARGET_NSID, NETNSA_CURRENT_NSID, __NETNSA_MAX, }; #define NETNSA_MAX (__NETNSA_MAX - 1) #endif /* _LINUX_NET_NAMESPACE_H_ */ linux/net_tstamp.h 0000644 00000013256 15063602051 0010237 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Userspace API for hardware time stamping of network packets * * Copyright (C) 2008,2009 Intel Corporation * Author: Patrick Ohly <patrick.ohly@intel.com> * */ #ifndef _NET_TIMESTAMPING_H #define _NET_TIMESTAMPING_H #include <linux/types.h> #include <linux/socket.h> /* for SO_TIMESTAMPING */ /* SO_TIMESTAMPING gets an integer bit field comprised of these values */ enum { SOF_TIMESTAMPING_TX_HARDWARE = (1<<0), SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1), SOF_TIMESTAMPING_RX_HARDWARE = (1<<2), SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3), SOF_TIMESTAMPING_SOFTWARE = (1<<4), SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5), SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6), SOF_TIMESTAMPING_OPT_ID = (1<<7), SOF_TIMESTAMPING_TX_SCHED = (1<<8), SOF_TIMESTAMPING_TX_ACK = (1<<9), SOF_TIMESTAMPING_OPT_CMSG = (1<<10), SOF_TIMESTAMPING_OPT_TSONLY = (1<<11), SOF_TIMESTAMPING_OPT_STATS = (1<<12), SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13), SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14), SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_TX_SWHW, SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | SOF_TIMESTAMPING_LAST }; /* * SO_TIMESTAMPING flags are either for recording a packet timestamp or for * reporting the timestamp to user space. * Recording flags can be set both via socket options and control messages. */ #define SOF_TIMESTAMPING_TX_RECORD_MASK (SOF_TIMESTAMPING_TX_HARDWARE | \ SOF_TIMESTAMPING_TX_SOFTWARE | \ SOF_TIMESTAMPING_TX_SCHED | \ SOF_TIMESTAMPING_TX_ACK) /** * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter * * @flags: one of HWTSTAMP_FLAG_* * @tx_type: one of HWTSTAMP_TX_* * @rx_filter: one of HWTSTAMP_FILTER_* * * %SIOCGHWTSTAMP and %SIOCSHWTSTAMP expect a &struct ifreq with a * ifr_data pointer to this structure. For %SIOCSHWTSTAMP, if the * driver or hardware does not support the requested @rx_filter value, * the driver may use a more general filter mode. In this case * @rx_filter will indicate the actual mode on return. */ struct hwtstamp_config { int flags; int tx_type; int rx_filter; }; /* possible values for hwtstamp_config->flags */ enum hwtstamp_flags { /* * With this flag, the user could get bond active interface's * PHC index. Note this PHC index is not stable as when there * is a failover, the bond active interface will be changed, so * will be the PHC index. */ HWTSTAMP_FLAG_BONDED_PHC_INDEX = (1<<0), #define HWTSTAMP_FLAG_BONDED_PHC_INDEX HWTSTAMP_FLAG_BONDED_PHC_INDEX HWTSTAMP_FLAG_LAST = HWTSTAMP_FLAG_BONDED_PHC_INDEX, HWTSTAMP_FLAG_MASK = (HWTSTAMP_FLAG_LAST - 1) | HWTSTAMP_FLAG_LAST }; /* possible values for hwtstamp_config->tx_type */ enum hwtstamp_tx_types { /* * No outgoing packet will need hardware time stamping; * should a packet arrive which asks for it, no hardware * time stamping will be done. */ HWTSTAMP_TX_OFF, /* * Enables hardware time stamping for outgoing packets; * the sender of the packet decides which are to be * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE * before sending the packet. */ HWTSTAMP_TX_ON, /* * Enables time stamping for outgoing packets just as * HWTSTAMP_TX_ON does, but also enables time stamp insertion * directly into Sync packets. In this case, transmitted Sync * packets will not received a time stamp via the socket error * queue. */ HWTSTAMP_TX_ONESTEP_SYNC, /* * Same as HWTSTAMP_TX_ONESTEP_SYNC, but also enables time * stamp insertion directly into PDelay_Resp packets. In this * case, neither transmitted Sync nor PDelay_Resp packets will * receive a time stamp via the socket error queue. */ HWTSTAMP_TX_ONESTEP_P2P, /* add new constants above here */ __HWTSTAMP_TX_CNT }; /* possible values for hwtstamp_config->rx_filter */ enum hwtstamp_rx_filters { /* time stamp no incoming packet at all */ HWTSTAMP_FILTER_NONE, /* time stamp any incoming packet */ HWTSTAMP_FILTER_ALL, /* return value: time stamp all packets requested plus some others */ HWTSTAMP_FILTER_SOME, /* PTP v1, UDP, any kind of event packet */ HWTSTAMP_FILTER_PTP_V1_L4_EVENT, /* PTP v1, UDP, Sync packet */ HWTSTAMP_FILTER_PTP_V1_L4_SYNC, /* PTP v1, UDP, Delay_req packet */ HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ, /* PTP v2, UDP, any kind of event packet */ HWTSTAMP_FILTER_PTP_V2_L4_EVENT, /* PTP v2, UDP, Sync packet */ HWTSTAMP_FILTER_PTP_V2_L4_SYNC, /* PTP v2, UDP, Delay_req packet */ HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ, /* 802.AS1, Ethernet, any kind of event packet */ HWTSTAMP_FILTER_PTP_V2_L2_EVENT, /* 802.AS1, Ethernet, Sync packet */ HWTSTAMP_FILTER_PTP_V2_L2_SYNC, /* 802.AS1, Ethernet, Delay_req packet */ HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ, /* PTP v2/802.AS1, any layer, any kind of event packet */ HWTSTAMP_FILTER_PTP_V2_EVENT, /* PTP v2/802.AS1, any layer, Sync packet */ HWTSTAMP_FILTER_PTP_V2_SYNC, /* PTP v2/802.AS1, any layer, Delay_req packet */ HWTSTAMP_FILTER_PTP_V2_DELAY_REQ, /* NTP, UDP, all versions and packet modes */ HWTSTAMP_FILTER_NTP_ALL, /* add new constants above here */ __HWTSTAMP_FILTER_CNT }; /* SCM_TIMESTAMPING_PKTINFO control message */ struct scm_ts_pktinfo { __u32 if_index; __u32 pkt_length; __u32 reserved[2]; }; /* * SO_TXTIME gets a struct sock_txtime with flags being an integer bit * field comprised of these values. */ enum txtime_flags { SOF_TXTIME_DEADLINE_MODE = (1 << 0), SOF_TXTIME_REPORT_ERRORS = (1 << 1), SOF_TXTIME_FLAGS_LAST = SOF_TXTIME_REPORT_ERRORS, SOF_TXTIME_FLAGS_MASK = (SOF_TXTIME_FLAGS_LAST - 1) | SOF_TXTIME_FLAGS_LAST }; struct sock_txtime { __kernel_clockid_t clockid;/* reference clockid */ __u32 flags; /* as defined by enum txtime_flags */ }; #endif /* _NET_TIMESTAMPING_H */ linux/netconf.h 0000644 00000001146 15063602051 0007510 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETCONF_H_ #define _LINUX_NETCONF_H_ #include <linux/types.h> #include <linux/netlink.h> struct netconfmsg { __u8 ncm_family; }; enum { NETCONFA_UNSPEC, NETCONFA_IFINDEX, NETCONFA_FORWARDING, NETCONFA_RP_FILTER, NETCONFA_MC_FORWARDING, NETCONFA_PROXY_NEIGH, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, NETCONFA_INPUT, NETCONFA_BC_FORWARDING, __NETCONFA_MAX }; #define NETCONFA_MAX (__NETCONFA_MAX - 1) #define NETCONFA_ALL -1 #define NETCONFA_IFINDEX_ALL -1 #define NETCONFA_IFINDEX_DEFAULT -2 #endif /* _LINUX_NETCONF_H_ */ linux/netdevice.h 0000644 00000004315 15063602051 0010023 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the Interfaces handler. * * Version: @(#)dev.h 1.0.10 08/12/93 * * Authors: Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Corey Minyard <wf-rch!minyard@relay.EU.net> * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> * Alan Cox, <alan@lxorguk.ukuu.org.uk> * Bjorn Ekwall. <bj0rn@blox.se> * Pekka Riikonen <priikone@poseidon.pspt.fi> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * Moved to /usr/include/linux for NET3 */ #ifndef _LINUX_NETDEVICE_H #define _LINUX_NETDEVICE_H #include <linux/if.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <linux/if_link.h> #define MAX_ADDR_LEN 32 /* Largest hardware address length */ /* Initial net device group. All devices belong to group 0 by default. */ #define INIT_NETDEV_GROUP 0 /* interface name assignment types (sysfs name_assign_type attribute) */ #define NET_NAME_UNKNOWN 0 /* unknown origin (not exposed to userspace) */ #define NET_NAME_ENUM 1 /* enumerated by kernel */ #define NET_NAME_PREDICTABLE 2 /* predictably named by the kernel */ #define NET_NAME_USER 3 /* provided by user-space */ #define NET_NAME_RENAMED 4 /* renamed by user-space */ /* Media selection options. */ enum { IF_PORT_UNKNOWN = 0, IF_PORT_10BASE2, IF_PORT_10BASET, IF_PORT_AUI, IF_PORT_100BASET, IF_PORT_100BASETX, IF_PORT_100BASEFX }; /* hardware address assignment types */ #define NET_ADDR_PERM 0 /* address is permanent (default) */ #define NET_ADDR_RANDOM 1 /* address is generated randomly */ #define NET_ADDR_STOLEN 2 /* address is stolen from other device */ #define NET_ADDR_SET 3 /* address is set using * dev_set_mac_address() */ #endif /* _LINUX_NETDEVICE_H */ linux/netfilter.h 0000644 00000003434 15063602051 0010052 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NETFILTER_H #define __LINUX_NETFILTER_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> /* Responses from hook functions. */ #define NF_DROP 0 #define NF_ACCEPT 1 #define NF_STOLEN 2 #define NF_QUEUE 3 #define NF_REPEAT 4 #define NF_STOP 5 /* Deprecated, for userspace nf_queue compatibility. */ #define NF_MAX_VERDICT NF_STOP /* we overload the higher bits for encoding auxiliary data such as the queue * number or errno values. Not nice, but better than additional function * arguments. */ #define NF_VERDICT_MASK 0x000000ff /* extra verdict flags have mask 0x0000ff00 */ #define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000 /* queue number (NF_QUEUE) or errno (NF_DROP) */ #define NF_VERDICT_QMASK 0xffff0000 #define NF_VERDICT_QBITS 16 #define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE) #define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP) /* only for userspace compatibility */ /* Generic cache responses from hook functions. <= 0x2000 is used for protocol-flags. */ #define NFC_UNKNOWN 0x4000 #define NFC_ALTERED 0x8000 /* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */ #define NF_VERDICT_BITS 16 enum nf_inet_hooks { NF_INET_PRE_ROUTING, NF_INET_LOCAL_IN, NF_INET_FORWARD, NF_INET_LOCAL_OUT, NF_INET_POST_ROUTING, NF_INET_NUMHOOKS }; enum nf_dev_hooks { NF_NETDEV_INGRESS, NF_NETDEV_NUMHOOKS }; enum { NFPROTO_UNSPEC = 0, NFPROTO_INET = 1, NFPROTO_IPV4 = 2, NFPROTO_ARP = 3, NFPROTO_NETDEV = 5, NFPROTO_BRIDGE = 7, NFPROTO_IPV6 = 10, NFPROTO_DECNET = 12, NFPROTO_NUMPROTO, }; union nf_inet_addr { __u32 all[4]; __be32 ip; __be32 ip6[4]; struct in_addr in; struct in6_addr in6; }; #endif /* __LINUX_NETFILTER_H */ linux/netfilter_arp.h 0000644 00000000675 15063602051 0010720 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ #ifndef __LINUX_ARP_NETFILTER_H #define __LINUX_ARP_NETFILTER_H /* ARP-specific defines for netfilter. * (C)2002 Rusty Russell IBM -- This code is GPL. */ #include <linux/netfilter.h> /* There is no PF_ARP. */ #define NF_ARP 0 /* ARP Hooks */ #define NF_ARP_IN 0 #define NF_ARP_OUT 1 #define NF_ARP_FORWARD 2 #define NF_ARP_NUMHOOKS 3 #endif /* __LINUX_ARP_NETFILTER_H */ linux/netfilter_bridge.h 0000644 00000002220 15063602051 0011356 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_NETFILTER_H #define __LINUX_BRIDGE_NETFILTER_H /* bridge-specific defines for netfilter. */ #include <linux/in.h> #include <linux/netfilter.h> #include <linux/if_ether.h> #include <linux/if_vlan.h> #include <linux/if_pppox.h> #include <limits.h> /* for INT_MIN, INT_MAX */ /* Bridge Hooks */ /* After promisc drops, checksum checks. */ #define NF_BR_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_BR_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_BR_FORWARD 2 /* Packets coming from a local process. */ #define NF_BR_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_BR_POST_ROUTING 4 /* Not really a hook, but used for the ebtables broute table */ #define NF_BR_BROUTING 5 #define NF_BR_NUMHOOKS 6 enum nf_br_hook_priorities { NF_BR_PRI_FIRST = INT_MIN, NF_BR_PRI_NAT_DST_BRIDGED = -300, NF_BR_PRI_FILTER_BRIDGED = -200, NF_BR_PRI_BRNF = 0, NF_BR_PRI_NAT_DST_OTHER = 100, NF_BR_PRI_FILTER_OTHER = 200, NF_BR_PRI_NAT_SRC = 300, NF_BR_PRI_LAST = INT_MAX, }; #endif /* __LINUX_BRIDGE_NETFILTER_H */ linux/netfilter_decnet.h 0000644 00000003673 15063602051 0011401 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_DECNET_NETFILTER_H #define __LINUX_DECNET_NETFILTER_H /* DECnet-specific defines for netfilter. * This file (C) Steve Whitehouse 1999 derived from the * ipv4 netfilter header file which is * (C)1998 Rusty Russell -- This code is GPL. */ #include <linux/netfilter.h> /* only for userspace compatibility */ #include <limits.h> /* for INT_MIN, INT_MAX */ /* IP Cache bits. */ /* Src IP address. */ #define NFC_DN_SRC 0x0001 /* Dest IP address. */ #define NFC_DN_DST 0x0002 /* Input device. */ #define NFC_DN_IF_IN 0x0004 /* Output device. */ #define NFC_DN_IF_OUT 0x0008 /* kernel define is in netfilter_defs.h */ #define NF_DN_NUMHOOKS 7 /* DECnet Hooks */ /* After promisc drops, checksum checks. */ #define NF_DN_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_DN_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_DN_FORWARD 2 /* Packets coming from a local process. */ #define NF_DN_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_DN_POST_ROUTING 4 /* Input Hello Packets */ #define NF_DN_HELLO 5 /* Input Routing Packets */ #define NF_DN_ROUTE 6 enum nf_dn_hook_priorities { NF_DN_PRI_FIRST = INT_MIN, NF_DN_PRI_CONNTRACK = -200, NF_DN_PRI_MANGLE = -150, NF_DN_PRI_NAT_DST = -100, NF_DN_PRI_FILTER = 0, NF_DN_PRI_NAT_SRC = 100, NF_DN_PRI_DNRTMSG = 200, NF_DN_PRI_LAST = INT_MAX, }; struct nf_dn_rtmsg { int nfdn_ifindex; }; #define NFDN_RTMSG(r) ((unsigned char *)(r) + NLMSG_ALIGN(sizeof(struct nf_dn_rtmsg))) /* backwards compatibility for userspace */ #define DNRMG_L1_GROUP 0x01 #define DNRMG_L2_GROUP 0x02 enum { DNRNG_NLGRP_NONE, #define DNRNG_NLGRP_NONE DNRNG_NLGRP_NONE DNRNG_NLGRP_L1, #define DNRNG_NLGRP_L1 DNRNG_NLGRP_L1 DNRNG_NLGRP_L2, #define DNRNG_NLGRP_L2 DNRNG_NLGRP_L2 __DNRNG_NLGRP_MAX }; #define DNRNG_NLGRP_MAX (__DNRNG_NLGRP_MAX - 1) #endif /*__LINUX_DECNET_NETFILTER_H*/ linux/netfilter_ipv4.h 0000644 00000004171 15063602052 0011014 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* IPv4-specific defines for netfilter. * (C)1998 Rusty Russell -- This code is GPL. */ #ifndef __LINUX_IP_NETFILTER_H #define __LINUX_IP_NETFILTER_H #include <linux/netfilter.h> /* only for userspace compatibility */ #include <limits.h> /* for INT_MIN, INT_MAX */ /* IP Cache bits. */ /* Src IP address. */ #define NFC_IP_SRC 0x0001 /* Dest IP address. */ #define NFC_IP_DST 0x0002 /* Input device. */ #define NFC_IP_IF_IN 0x0004 /* Output device. */ #define NFC_IP_IF_OUT 0x0008 /* TOS. */ #define NFC_IP_TOS 0x0010 /* Protocol. */ #define NFC_IP_PROTO 0x0020 /* IP options. */ #define NFC_IP_OPTIONS 0x0040 /* Frag & flags. */ #define NFC_IP_FRAG 0x0080 /* Per-protocol information: only matters if proto match. */ /* TCP flags. */ #define NFC_IP_TCPFLAGS 0x0100 /* Source port. */ #define NFC_IP_SRC_PT 0x0200 /* Dest port. */ #define NFC_IP_DST_PT 0x0400 /* Something else about the proto */ #define NFC_IP_PROTO_UNKNOWN 0x2000 /* IP Hooks */ /* After promisc drops, checksum checks. */ #define NF_IP_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_IP_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_IP_FORWARD 2 /* Packets coming from a local process. */ #define NF_IP_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_IP_POST_ROUTING 4 #define NF_IP_NUMHOOKS 5 enum nf_ip_hook_priorities { NF_IP_PRI_FIRST = INT_MIN, NF_IP_PRI_RAW_BEFORE_DEFRAG = -450, NF_IP_PRI_CONNTRACK_DEFRAG = -400, NF_IP_PRI_RAW = -300, NF_IP_PRI_SELINUX_FIRST = -225, NF_IP_PRI_CONNTRACK = -200, NF_IP_PRI_MANGLE = -150, NF_IP_PRI_NAT_DST = -100, NF_IP_PRI_FILTER = 0, NF_IP_PRI_SECURITY = 50, NF_IP_PRI_NAT_SRC = 100, NF_IP_PRI_SELINUX_LAST = 225, NF_IP_PRI_CONNTRACK_HELPER = 300, NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, NF_IP_PRI_LAST = INT_MAX, }; /* Arguments for setsockopt SOL_IP: */ /* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */ /* 2.2 firewalling (+ masq) went from 64 through 76 */ /* 2.4 firewalling went 64 through 67. */ #define SO_ORIGINAL_DST 80 #endif /* __LINUX_IP_NETFILTER_H */ linux/netfilter_ipv6.h 0000644 00000004215 15063602052 0011015 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* IPv6-specific defines for netfilter. * (C)1998 Rusty Russell -- This code is GPL. * (C)1999 David Jeffery * this header was blatantly ripped from netfilter_ipv4.h * it's amazing what adding a bunch of 6s can do =8^) */ #ifndef __LINUX_IP6_NETFILTER_H #define __LINUX_IP6_NETFILTER_H #include <linux/netfilter.h> /* only for userspace compatibility */ #include <limits.h> /* for INT_MIN, INT_MAX */ /* IP Cache bits. */ /* Src IP address. */ #define NFC_IP6_SRC 0x0001 /* Dest IP address. */ #define NFC_IP6_DST 0x0002 /* Input device. */ #define NFC_IP6_IF_IN 0x0004 /* Output device. */ #define NFC_IP6_IF_OUT 0x0008 /* TOS. */ #define NFC_IP6_TOS 0x0010 /* Protocol. */ #define NFC_IP6_PROTO 0x0020 /* IP options. */ #define NFC_IP6_OPTIONS 0x0040 /* Frag & flags. */ #define NFC_IP6_FRAG 0x0080 /* Per-protocol information: only matters if proto match. */ /* TCP flags. */ #define NFC_IP6_TCPFLAGS 0x0100 /* Source port. */ #define NFC_IP6_SRC_PT 0x0200 /* Dest port. */ #define NFC_IP6_DST_PT 0x0400 /* Something else about the proto */ #define NFC_IP6_PROTO_UNKNOWN 0x2000 /* IP6 Hooks */ /* After promisc drops, checksum checks. */ #define NF_IP6_PRE_ROUTING 0 /* If the packet is destined for this box. */ #define NF_IP6_LOCAL_IN 1 /* If the packet is destined for another interface. */ #define NF_IP6_FORWARD 2 /* Packets coming from a local process. */ #define NF_IP6_LOCAL_OUT 3 /* Packets about to hit the wire. */ #define NF_IP6_POST_ROUTING 4 #define NF_IP6_NUMHOOKS 5 enum nf_ip6_hook_priorities { NF_IP6_PRI_FIRST = INT_MIN, NF_IP6_PRI_RAW_BEFORE_DEFRAG = -450, NF_IP6_PRI_CONNTRACK_DEFRAG = -400, NF_IP6_PRI_RAW = -300, NF_IP6_PRI_SELINUX_FIRST = -225, NF_IP6_PRI_CONNTRACK = -200, NF_IP6_PRI_MANGLE = -150, NF_IP6_PRI_NAT_DST = -100, NF_IP6_PRI_FILTER = 0, NF_IP6_PRI_SECURITY = 50, NF_IP6_PRI_NAT_SRC = 100, NF_IP6_PRI_SELINUX_LAST = 225, NF_IP6_PRI_CONNTRACK_HELPER = 300, NF_IP6_PRI_LAST = INT_MAX, }; #endif /* __LINUX_IP6_NETFILTER_H */ linux/netlink.h 0000644 00000026347 15063602052 0007533 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NETLINK_H #define __LINUX_NETLINK_H #include <linux/kernel.h> #include <linux/socket.h> /* for __kernel_sa_family_t */ #include <linux/types.h> #define NETLINK_ROUTE 0 /* Routing/device hook */ #define NETLINK_UNUSED 1 /* Unused number */ #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ #define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */ #define NETLINK_SOCK_DIAG 4 /* socket monitoring */ #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ #define NETLINK_XFRM 6 /* ipsec */ #define NETLINK_SELINUX 7 /* SELinux event notifications */ #define NETLINK_ISCSI 8 /* Open-iSCSI */ #define NETLINK_AUDIT 9 /* auditing */ #define NETLINK_FIB_LOOKUP 10 #define NETLINK_CONNECTOR 11 #define NETLINK_NETFILTER 12 /* netfilter subsystem */ #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ #define NETLINK_GENERIC 16 /* leave room for NETLINK_DM (DM Events) */ #define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ #define NETLINK_ECRYPTFS 19 #define NETLINK_RDMA 20 #define NETLINK_CRYPTO 21 /* Crypto layer */ #define NETLINK_SMC 22 /* SMC monitoring */ #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG #define MAX_LINKS 32 struct sockaddr_nl { __kernel_sa_family_t nl_family; /* AF_NETLINK */ unsigned short nl_pad; /* zero */ __u32 nl_pid; /* port ID */ __u32 nl_groups; /* multicast groups mask */ }; struct nlmsghdr { __u32 nlmsg_len; /* Length of message including header */ __u16 nlmsg_type; /* Message content */ __u16 nlmsg_flags; /* Additional flags */ __u32 nlmsg_seq; /* Sequence number */ __u32 nlmsg_pid; /* Sending process port ID */ }; /* Flags values */ #define NLM_F_REQUEST 0x01 /* It is request message. */ #define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */ #define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */ #define NLM_F_ECHO 0x08 /* Echo this request */ #define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */ #define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */ /* Modifiers to GET request */ #define NLM_F_ROOT 0x100 /* specify tree root */ #define NLM_F_MATCH 0x200 /* return all matching */ #define NLM_F_ATOMIC 0x400 /* atomic GET */ #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) /* Modifiers to NEW request */ #define NLM_F_REPLACE 0x100 /* Override existing */ #define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ #define NLM_F_CREATE 0x400 /* Create, if it does not exist */ #define NLM_F_APPEND 0x800 /* Add to end of list */ /* Modifiers to DELETE request */ #define NLM_F_NONREC 0x100 /* Do not delete recursively */ /* Flags for ACK message */ #define NLM_F_CAPPED 0x100 /* request was capped */ #define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */ /* 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL 4.4BSD CHANGE NLM_F_REPLACE True CHANGE NLM_F_CREATE|NLM_F_REPLACE Append NLM_F_CREATE Check NLM_F_EXCL */ #define NLMSG_ALIGNTO 4U #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len <= (len)) #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) #define NLMSG_NOOP 0x1 /* Nothing. */ #define NLMSG_ERROR 0x2 /* Error */ #define NLMSG_DONE 0x3 /* End of a dump */ #define NLMSG_OVERRUN 0x4 /* Data lost */ #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ struct nlmsgerr { int error; struct nlmsghdr msg; /* * followed by the message contents unless NETLINK_CAP_ACK was set * or the ACK indicates success (error == 0) * message length is aligned with NLMSG_ALIGN() */ /* * followed by TLVs defined in enum nlmsgerr_attrs * if NETLINK_EXT_ACK was set */ }; /** * enum nlmsgerr_attrs - nlmsgerr attributes * @NLMSGERR_ATTR_UNUSED: unused * @NLMSGERR_ATTR_MSG: error message string (string) * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original * message, counting from the beginning of the header (u32) * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to * be used - in the success case - to identify a created * object or operation or similar (binary) * @__NLMSGERR_ATTR_MAX: number of attributes * @NLMSGERR_ATTR_MAX: highest attribute number */ enum nlmsgerr_attrs { NLMSGERR_ATTR_UNUSED, NLMSGERR_ATTR_MSG, NLMSGERR_ATTR_OFFS, NLMSGERR_ATTR_COOKIE, __NLMSGERR_ATTR_MAX, NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 }; #define NETLINK_ADD_MEMBERSHIP 1 #define NETLINK_DROP_MEMBERSHIP 2 #define NETLINK_PKTINFO 3 #define NETLINK_BROADCAST_ERROR 4 #define NETLINK_NO_ENOBUFS 5 #define NETLINK_RX_RING 6 #define NETLINK_TX_RING 7 #define NETLINK_LISTEN_ALL_NSID 8 #define NETLINK_LIST_MEMBERSHIPS 9 #define NETLINK_CAP_ACK 10 #define NETLINK_EXT_ACK 11 #define NETLINK_GET_STRICT_CHK 12 struct nl_pktinfo { __u32 group; }; struct nl_mmap_req { unsigned int nm_block_size; unsigned int nm_block_nr; unsigned int nm_frame_size; unsigned int nm_frame_nr; }; struct nl_mmap_hdr { unsigned int nm_status; unsigned int nm_len; __u32 nm_group; /* credentials */ __u32 nm_pid; __u32 nm_uid; __u32 nm_gid; }; enum nl_mmap_status { NL_MMAP_STATUS_UNUSED, NL_MMAP_STATUS_RESERVED, NL_MMAP_STATUS_VALID, NL_MMAP_STATUS_COPY, NL_MMAP_STATUS_SKIP, }; #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) #define NET_MAJOR 36 /* Major 36 is reserved for networking */ enum { NETLINK_UNCONNECTED = 0, NETLINK_CONNECTED, }; /* * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> * +---------------------+- - -+- - - - - - - - - -+- - -+ * | Header | Pad | Payload | Pad | * | (struct nlattr) | ing | | ing | * +---------------------+- - -+- - - - - - - - - -+- - -+ * <-------------- nlattr->nla_len --------------> */ struct nlattr { __u16 nla_len; __u16 nla_type; }; /* * nla_type (16 bits) * +---+---+-------------------------------+ * | N | O | Attribute Type | * +---+---+-------------------------------+ * N := Carries nested attributes * O := Payload stored in network byte order * * Note: The N and O flag are mutually exclusive. */ #define NLA_F_NESTED (1 << 15) #define NLA_F_NET_BYTEORDER (1 << 14) #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) #define NLA_ALIGNTO 4 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) /* Generic 32 bitflags attribute content sent to the kernel. * * The value is a bitmap that defines the values being set * The selector is a bitmask that defines which value is legit * * Examples: * value = 0x0, and selector = 0x1 * implies we are selecting bit 1 and we want to set its value to 0. * * value = 0x2, and selector = 0x2 * implies we are selecting bit 2 and we want to set its value to 1. * */ struct nla_bitfield32 { __u32 value; __u32 selector; }; /* * policy descriptions - it's specific to each family how this is used * Normally, it should be retrieved via a dump inside another attribute * specifying where it applies. */ /** * enum netlink_attribute_type - type of an attribute * @NL_ATTR_TYPE_INVALID: unused * @NL_ATTR_TYPE_FLAG: flag attribute (present/not present) * @NL_ATTR_TYPE_U8: 8-bit unsigned attribute * @NL_ATTR_TYPE_U16: 16-bit unsigned attribute * @NL_ATTR_TYPE_U32: 32-bit unsigned attribute * @NL_ATTR_TYPE_U64: 64-bit unsigned attribute * @NL_ATTR_TYPE_S8: 8-bit signed attribute * @NL_ATTR_TYPE_S16: 16-bit signed attribute * @NL_ATTR_TYPE_S32: 32-bit signed attribute * @NL_ATTR_TYPE_S64: 64-bit signed attribute * @NL_ATTR_TYPE_BINARY: binary data, min/max length may be specified * @NL_ATTR_TYPE_STRING: string, min/max length may be specified * @NL_ATTR_TYPE_NUL_STRING: NUL-terminated string, * min/max length may be specified * @NL_ATTR_TYPE_NESTED: nested, i.e. the content of this attribute * consists of sub-attributes. The nested policy and maxtype * inside may be specified. * @NL_ATTR_TYPE_NESTED_ARRAY: nested array, i.e. the content of this * attribute contains sub-attributes whose type is irrelevant * (just used to separate the array entries) and each such array * entry has attributes again, the policy for those inner ones * and the corresponding maxtype may be specified. * @NL_ATTR_TYPE_BITFIELD32: &struct nla_bitfield32 attribute */ enum netlink_attribute_type { NL_ATTR_TYPE_INVALID, NL_ATTR_TYPE_FLAG, NL_ATTR_TYPE_U8, NL_ATTR_TYPE_U16, NL_ATTR_TYPE_U32, NL_ATTR_TYPE_U64, NL_ATTR_TYPE_S8, NL_ATTR_TYPE_S16, NL_ATTR_TYPE_S32, NL_ATTR_TYPE_S64, NL_ATTR_TYPE_BINARY, NL_ATTR_TYPE_STRING, NL_ATTR_TYPE_NUL_STRING, NL_ATTR_TYPE_NESTED, NL_ATTR_TYPE_NESTED_ARRAY, NL_ATTR_TYPE_BITFIELD32, }; /** * enum netlink_policy_type_attr - policy type attributes * @NL_POLICY_TYPE_ATTR_UNSPEC: unused * @NL_POLICY_TYPE_ATTR_TYPE: type of the attribute, * &enum netlink_attribute_type (U32) * @NL_POLICY_TYPE_ATTR_MIN_VALUE_S: minimum value for signed * integers (S64) * @NL_POLICY_TYPE_ATTR_MAX_VALUE_S: maximum value for signed * integers (S64) * @NL_POLICY_TYPE_ATTR_MIN_VALUE_U: minimum value for unsigned * integers (U64) * @NL_POLICY_TYPE_ATTR_MAX_VALUE_U: maximum value for unsigned * integers (U64) * @NL_POLICY_TYPE_ATTR_MIN_LENGTH: minimum length for binary * attributes, no minimum if not given (U32) * @NL_POLICY_TYPE_ATTR_MAX_LENGTH: maximum length for binary * attributes, no maximum if not given (U32) * @NL_POLICY_TYPE_ATTR_POLICY_IDX: sub policy for nested and * nested array types (U32) * @NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE: maximum sub policy * attribute for nested and nested array types, this can * in theory be < the size of the policy pointed to by * the index, if limited inside the nesting (U32) * @NL_POLICY_TYPE_ATTR_BITFIELD32_MASK: valid mask for the * bitfield32 type (U32) * @NL_POLICY_TYPE_ATTR_MASK: mask of valid bits for unsigned integers (U64) * @NL_POLICY_TYPE_ATTR_PAD: pad attribute for 64-bit alignment */ enum netlink_policy_type_attr { NL_POLICY_TYPE_ATTR_UNSPEC, NL_POLICY_TYPE_ATTR_TYPE, NL_POLICY_TYPE_ATTR_MIN_VALUE_S, NL_POLICY_TYPE_ATTR_MAX_VALUE_S, NL_POLICY_TYPE_ATTR_MIN_VALUE_U, NL_POLICY_TYPE_ATTR_MAX_VALUE_U, NL_POLICY_TYPE_ATTR_MIN_LENGTH, NL_POLICY_TYPE_ATTR_MAX_LENGTH, NL_POLICY_TYPE_ATTR_POLICY_IDX, NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE, NL_POLICY_TYPE_ATTR_BITFIELD32_MASK, NL_POLICY_TYPE_ATTR_PAD, NL_POLICY_TYPE_ATTR_MASK, /* keep last */ __NL_POLICY_TYPE_ATTR_MAX, NL_POLICY_TYPE_ATTR_MAX = __NL_POLICY_TYPE_ATTR_MAX - 1 }; #endif /* __LINUX_NETLINK_H */ linux/netlink_diag.h 0000644 00000002764 15063602052 0010514 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NETLINK_DIAG_H__ #define __NETLINK_DIAG_H__ #include <linux/types.h> struct netlink_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; __u16 pad; __u32 ndiag_ino; __u32 ndiag_show; __u32 ndiag_cookie[2]; }; struct netlink_diag_msg { __u8 ndiag_family; __u8 ndiag_type; __u8 ndiag_protocol; __u8 ndiag_state; __u32 ndiag_portid; __u32 ndiag_dst_portid; __u32 ndiag_dst_group; __u32 ndiag_ino; __u32 ndiag_cookie[2]; }; struct netlink_diag_ring { __u32 ndr_block_size; __u32 ndr_block_nr; __u32 ndr_frame_size; __u32 ndr_frame_nr; }; enum { /* NETLINK_DIAG_NONE, standard nl API requires this attribute! */ NETLINK_DIAG_MEMINFO, NETLINK_DIAG_GROUPS, NETLINK_DIAG_RX_RING, NETLINK_DIAG_TX_RING, NETLINK_DIAG_FLAGS, __NETLINK_DIAG_MAX, }; #define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1) #define NDIAG_PROTO_ALL ((__u8) ~0) #define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ #define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ /* deprecated since 4.6 */ #define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ #define NDIAG_SHOW_FLAGS 0x00000008 /* show flags of a netlink socket */ /* flags */ #define NDIAG_FLAG_CB_RUNNING 0x00000001 #define NDIAG_FLAG_PKTINFO 0x00000002 #define NDIAG_FLAG_BROADCAST_ERROR 0x00000004 #define NDIAG_FLAG_NO_ENOBUFS 0x00000008 #define NDIAG_FLAG_LISTEN_ALL_NSID 0x00000010 #define NDIAG_FLAG_CAP_ACK 0x00000020 #endif linux/netrom.h 0000644 00000001447 15063602052 0007365 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel NET/ROM implementation. * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the * definition of the ax25_address structure. */ #ifndef NETROM_KERNEL_H #define NETROM_KERNEL_H #include <linux/ax25.h> #define NETROM_MTU 236 #define NETROM_T1 1 #define NETROM_T2 2 #define NETROM_N2 3 #define NETROM_T4 6 #define NETROM_IDLE 7 #define SIOCNRDECOBS (SIOCPROTOPRIVATE+2) struct nr_route_struct { #define NETROM_NEIGH 0 #define NETROM_NODE 1 int type; ax25_address callsign; char device[16]; unsigned int quality; char mnemonic[7]; ax25_address neighbour; unsigned int obs_count; unsigned int ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; #endif linux/nexthop.h 0000644 00000002776 15063602052 0007554 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NEXTHOP_H #define _LINUX_NEXTHOP_H #include <linux/types.h> struct nhmsg { unsigned char nh_family; unsigned char nh_scope; /* return only */ unsigned char nh_protocol; /* Routing protocol that installed nh */ unsigned char resvd; unsigned int nh_flags; /* RTNH_F flags */ }; /* entry in a nexthop group */ struct nexthop_grp { __u32 id; /* nexthop id - must exist */ __u8 weight; /* weight of this nexthop */ __u8 resvd1; __u16 resvd2; }; enum { NEXTHOP_GRP_TYPE_MPATH, /* default type if not specified */ __NEXTHOP_GRP_TYPE_MAX, }; #define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1) enum { NHA_UNSPEC, NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */ NHA_GROUP, /* array of nexthop_grp */ NHA_GROUP_TYPE, /* u16 one of NEXTHOP_GRP_TYPE */ /* if NHA_GROUP attribute is added, no other attributes can be set */ NHA_BLACKHOLE, /* flag; nexthop used to blackhole packets */ /* if NHA_BLACKHOLE is added, OIF, GATEWAY, ENCAP can not be set */ NHA_OIF, /* u32; nexthop device */ NHA_GATEWAY, /* be32 (IPv4) or in6_addr (IPv6) gw address */ NHA_ENCAP_TYPE, /* u16; lwt encap type */ NHA_ENCAP, /* lwt encap data */ /* NHA_OIF can be appended to dump request to return only * nexthops using given device */ NHA_GROUPS, /* flag; only return nexthop groups in dump */ NHA_MASTER, /* u32; only return nexthops with given master dev */ __NHA_MAX, }; #define NHA_MAX (__NHA_MAX - 1) #endif linux/nfc.h 0000644 00000025711 15063602052 0006627 0 ustar 00 /* * Copyright (C) 2011 Instituto Nokia de Tecnologia * * Authors: * Lauro Ramos Venancio <lauro.venancio@openbossa.org> * Aloisio Almeida Jr <aloisio.almeida@openbossa.org> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __LINUX_NFC_H #define __LINUX_NFC_H #include <linux/types.h> #include <linux/socket.h> #define NFC_GENL_NAME "nfc" #define NFC_GENL_VERSION 1 #define NFC_GENL_MCAST_EVENT_NAME "events" /** * enum nfc_commands - supported nfc commands * * @NFC_CMD_UNSPEC: unspecified command * * @NFC_CMD_GET_DEVICE: request information about a device (requires * %NFC_ATTR_DEVICE_INDEX) or dump request to get a list of all nfc devices * @NFC_CMD_DEV_UP: turn on the nfc device * (requires %NFC_ATTR_DEVICE_INDEX) * @NFC_CMD_DEV_DOWN: turn off the nfc device * (requires %NFC_ATTR_DEVICE_INDEX) * @NFC_CMD_START_POLL: start polling for targets using the given protocols * (requires %NFC_ATTR_DEVICE_INDEX and %NFC_ATTR_PROTOCOLS) * @NFC_CMD_STOP_POLL: stop polling for targets (requires * %NFC_ATTR_DEVICE_INDEX) * @NFC_CMD_GET_TARGET: dump all targets found by the previous poll (requires * %NFC_ATTR_DEVICE_INDEX) * @NFC_EVENT_TARGETS_FOUND: event emitted when a new target is found * (it sends %NFC_ATTR_DEVICE_INDEX) * @NFC_EVENT_DEVICE_ADDED: event emitted when a new device is registred * (it sends %NFC_ATTR_DEVICE_NAME, %NFC_ATTR_DEVICE_INDEX and * %NFC_ATTR_PROTOCOLS) * @NFC_EVENT_DEVICE_REMOVED: event emitted when a device is removed * (it sends %NFC_ATTR_DEVICE_INDEX) * @NFC_EVENT_TM_ACTIVATED: event emitted when the adapter is activated in * target mode. * @NFC_EVENT_DEVICE_DEACTIVATED: event emitted when the adapter is deactivated * from target mode. * @NFC_CMD_LLC_GET_PARAMS: request LTO, RW, and MIUX parameters for a device * @NFC_CMD_LLC_SET_PARAMS: set one or more of LTO, RW, and MIUX parameters for * a device. LTO must be set before the link is up otherwise -EINPROGRESS * is returned. RW and MIUX can be set at anytime and will be passed in * subsequent CONNECT and CC messages. * If one of the passed parameters is wrong none is set and -EINVAL is * returned. * @NFC_CMD_ENABLE_SE: Enable the physical link to a specific secure element. * Once enabled a secure element will handle card emulation mode, i.e. * starting a poll from a device which has a secure element enabled means * we want to do SE based card emulation. * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. * @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform * that some firmware was loaded * @NFC_EVENT_SE_ADDED: Event emitted when a new secure element is discovered. * This typically will be sent whenever a new NFC controller with either * an embedded SE or an UICC one connected to it through SWP. * @NFC_EVENT_SE_REMOVED: Event emitted when a secure element is removed from * the system, as a consequence of e.g. an NFC controller being unplugged. * @NFC_EVENT_SE_CONNECTIVITY: This event is emitted whenever a secure element * is requesting connectivity access. For example a UICC SE may need to * talk with a sleeping modem and will notify this need by sending this * event. It is then up to userspace to decide if it will wake the modem * up or not. * @NFC_EVENT_SE_TRANSACTION: This event is sent when an application running on * a specific SE notifies us about the end of a transaction. The parameter * for this event is the application ID (AID). * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller. * @NFC_CMD_SE_IO: Send/Receive APDUs to/from the selected secure element. * @NFC_CMD_ACTIVATE_TARGET: Request NFC controller to reactivate target. * @NFC_CMD_VENDOR: Vendor specific command, to be implemented directly * from the driver in order to support hardware specific operations. * @NFC_CMD_DEACTIVATE_TARGET: Request NFC controller to deactivate target. */ enum nfc_commands { NFC_CMD_UNSPEC, NFC_CMD_GET_DEVICE, NFC_CMD_DEV_UP, NFC_CMD_DEV_DOWN, NFC_CMD_DEP_LINK_UP, NFC_CMD_DEP_LINK_DOWN, NFC_CMD_START_POLL, NFC_CMD_STOP_POLL, NFC_CMD_GET_TARGET, NFC_EVENT_TARGETS_FOUND, NFC_EVENT_DEVICE_ADDED, NFC_EVENT_DEVICE_REMOVED, NFC_EVENT_TARGET_LOST, NFC_EVENT_TM_ACTIVATED, NFC_EVENT_TM_DEACTIVATED, NFC_CMD_LLC_GET_PARAMS, NFC_CMD_LLC_SET_PARAMS, NFC_CMD_ENABLE_SE, NFC_CMD_DISABLE_SE, NFC_CMD_LLC_SDREQ, NFC_EVENT_LLC_SDRES, NFC_CMD_FW_DOWNLOAD, NFC_EVENT_SE_ADDED, NFC_EVENT_SE_REMOVED, NFC_EVENT_SE_CONNECTIVITY, NFC_EVENT_SE_TRANSACTION, NFC_CMD_GET_SE, NFC_CMD_SE_IO, NFC_CMD_ACTIVATE_TARGET, NFC_CMD_VENDOR, NFC_CMD_DEACTIVATE_TARGET, /* private: internal use only */ __NFC_CMD_AFTER_LAST }; #define NFC_CMD_MAX (__NFC_CMD_AFTER_LAST - 1) /** * enum nfc_attrs - supported nfc attributes * * @NFC_ATTR_UNSPEC: unspecified attribute * * @NFC_ATTR_DEVICE_INDEX: index of nfc device * @NFC_ATTR_DEVICE_NAME: device name, max 8 chars * @NFC_ATTR_PROTOCOLS: nfc protocols - bitwise or-ed combination from * NFC_PROTO_*_MASK constants * @NFC_ATTR_TARGET_INDEX: index of the nfc target * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the * target is not NFC-Forum compliant) * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes * @NFC_ATTR_TARGET_SENSB_RES: NFC-B targets extra information, max 12 bytes * @NFC_ATTR_TARGET_SENSF_RES: NFC-F targets extra information, max 18 bytes * @NFC_ATTR_COMM_MODE: Passive or active mode * @NFC_ATTR_RF_MODE: Initiator or target * @NFC_ATTR_IM_PROTOCOLS: Initiator mode protocols to poll for * @NFC_ATTR_TM_PROTOCOLS: Target mode protocols to listen for * @NFC_ATTR_LLC_PARAM_LTO: Link TimeOut parameter * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter * @NFC_ATTR_SE: Available Secure Elements * @NFC_ATTR_FIRMWARE_NAME: Free format firmware version * @NFC_ATTR_SE_INDEX: Secure element index * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status * @NFC_ATTR_APDU: Secure element APDU * @NFC_ATTR_TARGET_ISO15693_DSFID: ISO 15693 Data Storage Format Identifier * @NFC_ATTR_TARGET_ISO15693_UID: ISO 15693 Unique Identifier * @NFC_ATTR_SE_PARAMS: Parameters data from an evt_transaction * @NFC_ATTR_VENDOR_ID: NFC manufacturer unique ID, typically an OUI * @NFC_ATTR_VENDOR_SUBCMD: Vendor specific sub command * @NFC_ATTR_VENDOR_DATA: Vendor specific data, to be optionally passed * to a vendor specific command implementation */ enum nfc_attrs { NFC_ATTR_UNSPEC, NFC_ATTR_DEVICE_INDEX, NFC_ATTR_DEVICE_NAME, NFC_ATTR_PROTOCOLS, NFC_ATTR_TARGET_INDEX, NFC_ATTR_TARGET_SENS_RES, NFC_ATTR_TARGET_SEL_RES, NFC_ATTR_TARGET_NFCID1, NFC_ATTR_TARGET_SENSB_RES, NFC_ATTR_TARGET_SENSF_RES, NFC_ATTR_COMM_MODE, NFC_ATTR_RF_MODE, NFC_ATTR_DEVICE_POWERED, NFC_ATTR_IM_PROTOCOLS, NFC_ATTR_TM_PROTOCOLS, NFC_ATTR_LLC_PARAM_LTO, NFC_ATTR_LLC_PARAM_RW, NFC_ATTR_LLC_PARAM_MIUX, NFC_ATTR_SE, NFC_ATTR_LLC_SDP, NFC_ATTR_FIRMWARE_NAME, NFC_ATTR_SE_INDEX, NFC_ATTR_SE_TYPE, NFC_ATTR_SE_AID, NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, NFC_ATTR_SE_APDU, NFC_ATTR_TARGET_ISO15693_DSFID, NFC_ATTR_TARGET_ISO15693_UID, NFC_ATTR_SE_PARAMS, NFC_ATTR_VENDOR_ID, NFC_ATTR_VENDOR_SUBCMD, NFC_ATTR_VENDOR_DATA, /* private: internal use only */ __NFC_ATTR_AFTER_LAST }; #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) enum nfc_sdp_attr { NFC_SDP_ATTR_UNSPEC, NFC_SDP_ATTR_URI, NFC_SDP_ATTR_SAP, /* private: internal use only */ __NFC_SDP_ATTR_AFTER_LAST }; #define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1) #define NFC_DEVICE_NAME_MAXSIZE 8 #define NFC_NFCID1_MAXSIZE 10 #define NFC_NFCID2_MAXSIZE 8 #define NFC_NFCID3_MAXSIZE 10 #define NFC_SENSB_RES_MAXSIZE 12 #define NFC_SENSF_RES_MAXSIZE 18 #define NFC_ATR_REQ_MAXSIZE 64 #define NFC_ATR_RES_MAXSIZE 64 #define NFC_ATR_REQ_GB_MAXSIZE 48 #define NFC_ATR_RES_GB_MAXSIZE 47 #define NFC_GB_MAXSIZE 48 #define NFC_FIRMWARE_NAME_MAXSIZE 32 #define NFC_ISO15693_UID_MAXSIZE 8 /* NFC protocols */ #define NFC_PROTO_JEWEL 1 #define NFC_PROTO_MIFARE 2 #define NFC_PROTO_FELICA 3 #define NFC_PROTO_ISO14443 4 #define NFC_PROTO_NFC_DEP 5 #define NFC_PROTO_ISO14443_B 6 #define NFC_PROTO_ISO15693 7 #define NFC_PROTO_MAX 8 /* NFC communication modes */ #define NFC_COMM_ACTIVE 0 #define NFC_COMM_PASSIVE 1 /* NFC RF modes */ #define NFC_RF_INITIATOR 0 #define NFC_RF_TARGET 1 #define NFC_RF_NONE 2 /* NFC protocols masks used in bitsets */ #define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) #define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) #define NFC_PROTO_FELICA_MASK (1 << NFC_PROTO_FELICA) #define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443) #define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) #define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) #define NFC_PROTO_ISO15693_MASK (1 << NFC_PROTO_ISO15693) /* NFC Secure Elements */ #define NFC_SE_UICC 0x1 #define NFC_SE_EMBEDDED 0x2 #define NFC_SE_DISABLED 0x0 #define NFC_SE_ENABLED 0x1 struct sockaddr_nfc { sa_family_t sa_family; __u32 dev_idx; __u32 target_idx; __u32 nfc_protocol; }; #define NFC_LLCP_MAX_SERVICE_NAME 63 struct sockaddr_nfc_llcp { sa_family_t sa_family; __u32 dev_idx; __u32 target_idx; __u32 nfc_protocol; __u8 dsap; /* Destination SAP, if known */ __u8 ssap; /* Source SAP to be bound to */ char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */; size_t service_name_len; }; /* NFC socket protocols */ #define NFC_SOCKPROTO_RAW 0 #define NFC_SOCKPROTO_LLCP 1 #define NFC_SOCKPROTO_MAX 2 #define NFC_HEADER_SIZE 1 /** * Pseudo-header info for raw socket packets * First byte is the adapter index * Second byte contains flags * - 0x01 - Direction (0=RX, 1=TX) * - 0x02-0x04 - Payload type (000=LLCP, 001=NCI, 010=HCI, 011=Digital, * 100=Proprietary) * - 0x05-0x80 - Reserved **/ #define NFC_RAW_HEADER_SIZE 2 #define NFC_DIRECTION_RX 0x00 #define NFC_DIRECTION_TX 0x01 #define RAW_PAYLOAD_LLCP 0 #define RAW_PAYLOAD_NCI 1 #define RAW_PAYLOAD_HCI 2 #define RAW_PAYLOAD_DIGITAL 3 #define RAW_PAYLOAD_PROPRIETARY 4 /* socket option names */ #define NFC_LLCP_RW 0 #define NFC_LLCP_MIUX 1 #define NFC_LLCP_REMOTE_MIU 2 #define NFC_LLCP_REMOTE_LTO 3 #define NFC_LLCP_REMOTE_RW 4 #endif /*__LINUX_NFC_H */ linux/nfs.h 0000644 00000010624 15063602052 0006644 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NFS protocol definitions * * This file contains constants mostly for Version 2 of the protocol, * but also has a couple of NFSv3 bits in (notably the error codes). */ #ifndef _LINUX_NFS_H #define _LINUX_NFS_H #include <linux/types.h> #define NFS_PROGRAM 100003 #define NFS_PORT 2049 #define NFS_RDMA_PORT 20049 #define NFS_MAXDATA 8192 #define NFS_MAXPATHLEN 1024 #define NFS_MAXNAMLEN 255 #define NFS_MAXGROUPS 16 #define NFS_FHSIZE 32 #define NFS_COOKIESIZE 4 #define NFS_FIFO_DEV (-1) #define NFSMODE_FMT 0170000 #define NFSMODE_DIR 0040000 #define NFSMODE_CHR 0020000 #define NFSMODE_BLK 0060000 #define NFSMODE_REG 0100000 #define NFSMODE_LNK 0120000 #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 #define NFS_MNT_PROGRAM 100005 #define NFS_MNT_VERSION 1 #define NFS_MNT3_VERSION 3 #define NFS_PIPE_DIRNAME "nfs" /* * NFS stats. The good thing with these values is that NFSv3 errors are * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which * no-one uses anyway), so we can happily mix code as long as we make sure * no NFSv3 errors are returned to NFSv2 clients. * Error codes that have a `--' in the v2 column are not part of the * standard, but seem to be widely used nevertheless. */ enum nfs_stat { NFS_OK = 0, /* v2 v3 v4 */ NFSERR_PERM = 1, /* v2 v3 v4 */ NFSERR_NOENT = 2, /* v2 v3 v4 */ NFSERR_IO = 5, /* v2 v3 v4 */ NFSERR_NXIO = 6, /* v2 v3 v4 */ NFSERR_EAGAIN = 11, /* v2 v3 */ NFSERR_ACCES = 13, /* v2 v3 v4 */ NFSERR_EXIST = 17, /* v2 v3 v4 */ NFSERR_XDEV = 18, /* v3 v4 */ NFSERR_NODEV = 19, /* v2 v3 v4 */ NFSERR_NOTDIR = 20, /* v2 v3 v4 */ NFSERR_ISDIR = 21, /* v2 v3 v4 */ NFSERR_INVAL = 22, /* v2 v3 v4 */ NFSERR_FBIG = 27, /* v2 v3 v4 */ NFSERR_NOSPC = 28, /* v2 v3 v4 */ NFSERR_ROFS = 30, /* v2 v3 v4 */ NFSERR_MLINK = 31, /* v3 v4 */ NFSERR_OPNOTSUPP = 45, /* v2 v3 */ NFSERR_NAMETOOLONG = 63, /* v2 v3 v4 */ NFSERR_NOTEMPTY = 66, /* v2 v3 v4 */ NFSERR_DQUOT = 69, /* v2 v3 v4 */ NFSERR_STALE = 70, /* v2 v3 v4 */ NFSERR_REMOTE = 71, /* v2 v3 */ NFSERR_WFLUSH = 99, /* v2 */ NFSERR_BADHANDLE = 10001, /* v3 v4 */ NFSERR_NOT_SYNC = 10002, /* v3 */ NFSERR_BAD_COOKIE = 10003, /* v3 v4 */ NFSERR_NOTSUPP = 10004, /* v3 v4 */ NFSERR_TOOSMALL = 10005, /* v3 v4 */ NFSERR_SERVERFAULT = 10006, /* v3 v4 */ NFSERR_BADTYPE = 10007, /* v3 v4 */ NFSERR_JUKEBOX = 10008, /* v3 v4 */ NFSERR_SAME = 10009, /* v4 */ NFSERR_DENIED = 10010, /* v4 */ NFSERR_EXPIRED = 10011, /* v4 */ NFSERR_LOCKED = 10012, /* v4 */ NFSERR_GRACE = 10013, /* v4 */ NFSERR_FHEXPIRED = 10014, /* v4 */ NFSERR_SHARE_DENIED = 10015, /* v4 */ NFSERR_WRONGSEC = 10016, /* v4 */ NFSERR_CLID_INUSE = 10017, /* v4 */ NFSERR_RESOURCE = 10018, /* v4 */ NFSERR_MOVED = 10019, /* v4 */ NFSERR_NOFILEHANDLE = 10020, /* v4 */ NFSERR_MINOR_VERS_MISMATCH = 10021, /* v4 */ NFSERR_STALE_CLIENTID = 10022, /* v4 */ NFSERR_STALE_STATEID = 10023, /* v4 */ NFSERR_OLD_STATEID = 10024, /* v4 */ NFSERR_BAD_STATEID = 10025, /* v4 */ NFSERR_BAD_SEQID = 10026, /* v4 */ NFSERR_NOT_SAME = 10027, /* v4 */ NFSERR_LOCK_RANGE = 10028, /* v4 */ NFSERR_SYMLINK = 10029, /* v4 */ NFSERR_RESTOREFH = 10030, /* v4 */ NFSERR_LEASE_MOVED = 10031, /* v4 */ NFSERR_ATTRNOTSUPP = 10032, /* v4 */ NFSERR_NO_GRACE = 10033, /* v4 */ NFSERR_RECLAIM_BAD = 10034, /* v4 */ NFSERR_RECLAIM_CONFLICT = 10035,/* v4 */ NFSERR_BAD_XDR = 10036, /* v4 */ NFSERR_LOCKS_HELD = 10037, /* v4 */ NFSERR_OPENMODE = 10038, /* v4 */ NFSERR_BADOWNER = 10039, /* v4 */ NFSERR_BADCHAR = 10040, /* v4 */ NFSERR_BADNAME = 10041, /* v4 */ NFSERR_BAD_RANGE = 10042, /* v4 */ NFSERR_LOCK_NOTSUPP = 10043, /* v4 */ NFSERR_OP_ILLEGAL = 10044, /* v4 */ NFSERR_DEADLOCK = 10045, /* v4 */ NFSERR_FILE_OPEN = 10046, /* v4 */ NFSERR_ADMIN_REVOKED = 10047, /* v4 */ NFSERR_CB_PATH_DOWN = 10048, /* v4 */ }; /* NFSv2 file types - beware, these are not the same in NFSv3 */ enum nfs_ftype { NFNON = 0, NFREG = 1, NFDIR = 2, NFBLK = 3, NFCHR = 4, NFLNK = 5, NFSOCK = 6, NFBAD = 7, NFFIFO = 8 }; #endif /* _LINUX_NFS_H */ linux/nubus.h 0000644 00000017777 15063602052 0007232 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* nubus.h: various definitions and prototypes for NuBus drivers to use. Originally written by Alan Cox. Hacked to death by C. Scott Ananian and David Huggins-Daines. Some of the constants in here are from the corresponding NetBSD/OpenBSD header file, by Allen Briggs. We figured out the rest of them on our own. */ #ifndef LINUX_NUBUS_H #define LINUX_NUBUS_H #include <linux/types.h> enum nubus_category { NUBUS_CAT_BOARD = 0x0001, NUBUS_CAT_DISPLAY = 0x0003, NUBUS_CAT_NETWORK = 0x0004, NUBUS_CAT_COMMUNICATIONS = 0x0006, NUBUS_CAT_FONT = 0x0009, NUBUS_CAT_CPU = 0x000A, /* For lack of a better name */ NUBUS_CAT_DUODOCK = 0x0020 }; enum nubus_type_network { NUBUS_TYPE_ETHERNET = 0x0001, NUBUS_TYPE_RS232 = 0x0002 }; enum nubus_type_display { NUBUS_TYPE_VIDEO = 0x0001 }; enum nubus_type_cpu { NUBUS_TYPE_68020 = 0x0003, NUBUS_TYPE_68030 = 0x0004, NUBUS_TYPE_68040 = 0x0005 }; /* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots) * 68030 motherboards: <10,4,0,24> * 68040 motherboards: <10,5,0,24> * DuoDock Plus: <32,1,1,2> * * Toby Frame Buffer card: <3,1,1,1> * RBV built-in video (IIci): <3,1,1,24> * Valkyrie built-in video (Q630): <3,1,1,46> * Macintosh Display Card: <3,1,1,25> * Sonora built-in video (P460): <3,1,1,34> * Jet framebuffer (DuoDock Plus): <3,1,1,41> * * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272> * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271> * Apple SONIC LC-PDS Ethernet ("Apple Ethernet LC Twisted-Pair Card"): <4,1,0,281> * Sonic Systems Ethernet A-Series Card: <4,1,268,256> * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision) * ROM on the above card: <2,1,0,0> * Cabletron ethernet card: <4,1,1,265> * Farallon ethernet card: <4,1,268,256> (identical to Sonic Systems card) * Kinetics EtherPort IIN: <4,1,259,262> * API Engineering EtherRun_LCa PDS enet card: <4,1,282,256> * * Add your devices to the list! You can obtain the "Slots" utility * from Apple's FTP site at: * ftp://dev.apple.com/devworld/Tool_Chest/Devices_-_Hardware/NuBus_Slot_Manager/ * * Alternately, TattleTech can be found at any Info-Mac mirror site. * or from its distribution site: ftp://ftp.decismkr.com/dms */ /* DrSW: Uniquely identifies the software interface to a board. This is usually the one you want to look at when writing a driver. It's not as useful as you think, though, because as we should know by now (duh), "Apple Compatible" can mean a lot of things... */ /* Add known DrSW values here */ enum nubus_drsw { /* NUBUS_CAT_DISPLAY */ NUBUS_DRSW_APPLE = 0x0001, NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */ /* NUBUS_CAT_NETWORK */ NUBUS_DRSW_3COM = 0x0000, NUBUS_DRSW_CABLETRON = 0x0001, NUBUS_DRSW_SONIC_LC = 0x0001, NUBUS_DRSW_KINETICS = 0x0103, NUBUS_DRSW_ASANTE = 0x0104, NUBUS_DRSW_TECHWORKS = 0x0109, NUBUS_DRSW_DAYNA = 0x010b, NUBUS_DRSW_FARALLON = 0x010c, NUBUS_DRSW_APPLE_SN = 0x010f, NUBUS_DRSW_DAYNA2 = 0x0115, NUBUS_DRSW_FOCUS = 0x011a, NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */ NUBUS_DRSW_DAYNA_LC = 0x011e, /* NUBUS_CAT_CPU */ NUBUS_DRSW_NONE = 0x0000, }; /* DrHW: Uniquely identifies the hardware interface to a board (or at least, it should... some video cards are known to incorrectly identify themselves as Toby cards) */ /* Add known DrHW values here */ enum nubus_drhw { /* NUBUS_CAT_DISPLAY */ NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */ NUBUS_DRHW_APPLE_WVC = 0x0006, /* Apple Workstation Video Card */ NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */ NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */ NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */ NUBUS_DRHW_APPLE_MVC = 0x0014, /* Mac II Monochrome Video Card */ NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */ NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */ NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */ NUBUS_DRHW_APPLE_VSC = 0x0020, /* Duo MiniDock ViSC framebuffer */ NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */ NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */ NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */ NUBUS_DRHW_APPLE_VALKYRIE = 0x002e, NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */ NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */ NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */ NUBUS_DRHW_RDIUS_GSC = 0x0153, /* Radius GS/C */ NUBUS_DRHW_SMAC_SPEC8 = 0x017B, /* SuperMac Spectrum/8 */ NUBUS_DRHW_SMAC_SPEC24 = 0x017C, /* SuperMac Spectrum/24 */ NUBUS_DRHW_RASTER_CB364 = 0x026F, /* RasterOps ColorBoard 364 */ NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */ NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */ NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */ NUBUS_DRHW_RASTER_24XLI = 0x02A0, /* RasterOps 8/24 XLi */ NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */ NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */ NUBUS_DRHW_RASTER_24XLTV = 0x02B7, /* RasterOps 24XLTV */ NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */ NUBUS_DRHW_SMAC_THUNDLGHT = 0x03D9, /* SuperMac ThunderLight */ NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */ NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */ NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */ /* NUBUS_CAT_NETWORK */ NUBUS_DRHW_INTERLAN = 0x0100, NUBUS_DRHW_SMC9194 = 0x0101, NUBUS_DRHW_KINETICS = 0x0106, NUBUS_DRHW_CABLETRON = 0x0109, NUBUS_DRHW_ASANTE_LC = 0x010f, NUBUS_DRHW_SONIC = 0x0110, NUBUS_DRHW_TECHWORKS = 0x0112, NUBUS_DRHW_APPLE_SONIC_NB = 0x0118, NUBUS_DRHW_APPLE_SONIC_LC = 0x0119, NUBUS_DRHW_FOCUS = 0x011c, NUBUS_DRHW_SONNET = 0x011d, }; /* Resource IDs: These are the identifiers for the various weird and wonderful tidbits of information that may or may not reside in the NuBus ROM directory. */ enum nubus_res_id { NUBUS_RESID_TYPE = 0x0001, NUBUS_RESID_NAME = 0x0002, NUBUS_RESID_ICON = 0x0003, NUBUS_RESID_DRVRDIR = 0x0004, NUBUS_RESID_LOADREC = 0x0005, NUBUS_RESID_BOOTREC = 0x0006, NUBUS_RESID_FLAGS = 0x0007, NUBUS_RESID_HWDEVID = 0x0008, NUBUS_RESID_MINOR_BASEOS = 0x000a, NUBUS_RESID_MINOR_LENGTH = 0x000b, NUBUS_RESID_MAJOR_BASEOS = 0x000c, NUBUS_RESID_MAJOR_LENGTH = 0x000d, NUBUS_RESID_CICN = 0x000f, NUBUS_RESID_ICL8 = 0x0010, NUBUS_RESID_ICL4 = 0x0011, }; /* Category-specific resources. */ enum nubus_board_res_id { NUBUS_RESID_BOARDID = 0x0020, NUBUS_RESID_PRAMINITDATA = 0x0021, NUBUS_RESID_PRIMARYINIT = 0x0022, NUBUS_RESID_TIMEOUTCONST = 0x0023, NUBUS_RESID_VENDORINFO = 0x0024, NUBUS_RESID_BOARDFLAGS = 0x0025, NUBUS_RESID_SECONDINIT = 0x0026, /* Not sure why Apple put these next two in here */ NUBUS_RESID_VIDNAMES = 0x0041, NUBUS_RESID_VIDMODES = 0x007e }; /* Fields within the vendor info directory */ enum nubus_vendor_res_id { NUBUS_RESID_VEND_ID = 0x0001, NUBUS_RESID_VEND_SERIAL = 0x0002, NUBUS_RESID_VEND_REV = 0x0003, NUBUS_RESID_VEND_PART = 0x0004, NUBUS_RESID_VEND_DATE = 0x0005 }; enum nubus_net_res_id { NUBUS_RESID_MAC_ADDRESS = 0x0080 }; enum nubus_cpu_res_id { NUBUS_RESID_MEMINFO = 0x0081, NUBUS_RESID_ROMINFO = 0x0082 }; enum nubus_display_res_id { NUBUS_RESID_GAMMADIR = 0x0040, NUBUS_RESID_FIRSTMODE = 0x0080, NUBUS_RESID_SECONDMODE = 0x0081, NUBUS_RESID_THIRDMODE = 0x0082, NUBUS_RESID_FOURTHMODE = 0x0083, NUBUS_RESID_FIFTHMODE = 0x0084, NUBUS_RESID_SIXTHMODE = 0x0085 }; #endif /* LINUX_NUBUS_H */ linux/netfilter/ipset/ip_set.h 0000644 00000021630 15063602052 0012460 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> * Patrick Schaaf <bof@bof.de> * Martin Josefsson <gandalf@wlug.westbo.se> * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _IP_SET_H #define _IP_SET_H #include <linux/types.h> /* The protocol versions */ #define IPSET_PROTOCOL 7 #define IPSET_PROTOCOL_MIN 6 /* The max length of strings including NUL: set and type identifiers */ #define IPSET_MAXNAMELEN 32 /* The maximum permissible comment length we will accept over netlink */ #define IPSET_MAX_COMMENT_SIZE 255 /* Message types and commands */ enum ipset_cmd { IPSET_CMD_NONE, IPSET_CMD_PROTOCOL, /* 1: Return protocol version */ IPSET_CMD_CREATE, /* 2: Create a new (empty) set */ IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */ IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */ IPSET_CMD_RENAME, /* 5: Rename a set */ IPSET_CMD_SWAP, /* 6: Swap two sets */ IPSET_CMD_LIST, /* 7: List sets */ IPSET_CMD_SAVE, /* 8: Save sets */ IPSET_CMD_ADD, /* 9: Add an element to a set */ IPSET_CMD_DEL, /* 10: Delete an element from a set */ IPSET_CMD_TEST, /* 11: Test an element in a set */ IPSET_CMD_HEADER, /* 12: Get set header data only */ IPSET_CMD_TYPE, /* 13: Get set type */ IPSET_CMD_GET_BYNAME, /* 14: Get set index by name */ IPSET_CMD_GET_BYINDEX, /* 15: Get set name by index */ IPSET_MSG_MAX, /* Netlink message commands */ /* Commands in userspace: */ IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 16: Enter restore mode */ IPSET_CMD_HELP, /* 17: Get help */ IPSET_CMD_VERSION, /* 18: Get program version */ IPSET_CMD_QUIT, /* 19: Quit from interactive mode */ IPSET_CMD_MAX, IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 20: Commit buffered commands */ }; /* Attributes at command level */ enum { IPSET_ATTR_UNSPEC, IPSET_ATTR_PROTOCOL, /* 1: Protocol version */ IPSET_ATTR_SETNAME, /* 2: Name of the set */ IPSET_ATTR_TYPENAME, /* 3: Typename */ IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */ IPSET_ATTR_REVISION, /* 4: Settype revision */ IPSET_ATTR_FAMILY, /* 5: Settype family */ IPSET_ATTR_FLAGS, /* 6: Flags at command level */ IPSET_ATTR_DATA, /* 7: Nested attributes */ IPSET_ATTR_ADT, /* 8: Multiple data containers */ IPSET_ATTR_LINENO, /* 9: Restore lineno */ IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */ IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */ IPSET_ATTR_INDEX, /* 11: Kernel index of set */ __IPSET_ATTR_CMD_MAX, }; #define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1) /* CADT specific attributes */ enum { IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1, IPSET_ATTR_IP_FROM = IPSET_ATTR_IP, IPSET_ATTR_IP_TO, /* 2 */ IPSET_ATTR_CIDR, /* 3 */ IPSET_ATTR_PORT, /* 4 */ IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT, IPSET_ATTR_PORT_TO, /* 5 */ IPSET_ATTR_TIMEOUT, /* 6 */ IPSET_ATTR_PROTO, /* 7 */ IPSET_ATTR_CADT_FLAGS, /* 8 */ IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */ IPSET_ATTR_MARK, /* 10 */ IPSET_ATTR_MARKMASK, /* 11 */ /* Reserve empty slots */ IPSET_ATTR_CADT_MAX = 16, /* Create-only specific attributes */ IPSET_ATTR_GC, IPSET_ATTR_HASHSIZE, IPSET_ATTR_MAXELEM, IPSET_ATTR_NETMASK, IPSET_ATTR_PROBES, IPSET_ATTR_RESIZE, IPSET_ATTR_SIZE, /* Kernel-only */ IPSET_ATTR_ELEMENTS, IPSET_ATTR_REFERENCES, IPSET_ATTR_MEMSIZE, __IPSET_ATTR_CREATE_MAX, }; #define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1) /* ADT specific attributes */ enum { IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1, IPSET_ATTR_NAME, IPSET_ATTR_NAMEREF, IPSET_ATTR_IP2, IPSET_ATTR_CIDR2, IPSET_ATTR_IP2_TO, IPSET_ATTR_IFACE, IPSET_ATTR_BYTES, IPSET_ATTR_PACKETS, IPSET_ATTR_COMMENT, IPSET_ATTR_SKBMARK, IPSET_ATTR_SKBPRIO, IPSET_ATTR_SKBQUEUE, IPSET_ATTR_PAD, __IPSET_ATTR_ADT_MAX, }; #define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) /* IP specific attributes */ enum { IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1, IPSET_ATTR_IPADDR_IPV6, __IPSET_ATTR_IPADDR_MAX, }; #define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1) /* Error codes */ enum ipset_errno { IPSET_ERR_PRIVATE = 4096, IPSET_ERR_PROTOCOL, IPSET_ERR_FIND_TYPE, IPSET_ERR_MAX_SETS, IPSET_ERR_BUSY, IPSET_ERR_EXIST_SETNAME2, IPSET_ERR_TYPE_MISMATCH, IPSET_ERR_EXIST, IPSET_ERR_INVALID_CIDR, IPSET_ERR_INVALID_NETMASK, IPSET_ERR_INVALID_FAMILY, IPSET_ERR_TIMEOUT, IPSET_ERR_REFERENCED, IPSET_ERR_IPADDR_IPV4, IPSET_ERR_IPADDR_IPV6, IPSET_ERR_COUNTER, IPSET_ERR_COMMENT, IPSET_ERR_INVALID_MARKMASK, IPSET_ERR_SKBINFO, /* Type specific error codes */ IPSET_ERR_TYPE_SPECIFIC = 4352, }; /* Flags at command level or match/target flags, lower half of cmdattrs*/ enum ipset_cmd_flags { IPSET_FLAG_BIT_EXIST = 0, IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), IPSET_FLAG_BIT_LIST_SETNAME = 1, IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), IPSET_FLAG_BIT_LIST_HEADER = 2, IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE = 3, IPSET_FLAG_SKIP_COUNTER_UPDATE = (1 << IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE), IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE = 4, IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE = (1 << IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE), IPSET_FLAG_BIT_MATCH_COUNTERS = 5, IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), IPSET_FLAG_BIT_RETURN_NOMATCH = 7, IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), IPSET_FLAG_BIT_MAP_SKBMARK = 8, IPSET_FLAG_MAP_SKBMARK = (1 << IPSET_FLAG_BIT_MAP_SKBMARK), IPSET_FLAG_BIT_MAP_SKBPRIO = 9, IPSET_FLAG_MAP_SKBPRIO = (1 << IPSET_FLAG_BIT_MAP_SKBPRIO), IPSET_FLAG_BIT_MAP_SKBQUEUE = 10, IPSET_FLAG_MAP_SKBQUEUE = (1 << IPSET_FLAG_BIT_MAP_SKBQUEUE), IPSET_FLAG_CMD_MAX = 15, }; /* Flags at CADT attribute level, upper half of cmdattrs */ enum ipset_cadt_flags { IPSET_FLAG_BIT_BEFORE = 0, IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), IPSET_FLAG_BIT_PHYSDEV = 1, IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), IPSET_FLAG_BIT_NOMATCH = 2, IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), IPSET_FLAG_BIT_WITH_COUNTERS = 3, IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), IPSET_FLAG_BIT_WITH_COMMENT = 4, IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), IPSET_FLAG_BIT_WITH_FORCEADD = 5, IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD), IPSET_FLAG_BIT_WITH_SKBINFO = 6, IPSET_FLAG_WITH_SKBINFO = (1 << IPSET_FLAG_BIT_WITH_SKBINFO), IPSET_FLAG_CADT_MAX = 15, }; /* The flag bits which correspond to the non-extension create flags */ enum ipset_create_flags { IPSET_CREATE_FLAG_BIT_FORCEADD = 0, IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD), IPSET_CREATE_FLAG_BIT_MAX = 7, }; /* Commands with settype-specific attributes */ enum ipset_adt { IPSET_ADD, IPSET_DEL, IPSET_TEST, IPSET_ADT_MAX, IPSET_CREATE = IPSET_ADT_MAX, IPSET_CADT_MAX, }; /* Sets are identified by an index in kernel space. Tweak with ip_set_id_t * and IPSET_INVALID_ID if you want to increase the max number of sets. * Also, IPSET_ATTR_INDEX must be changed. */ typedef __u16 ip_set_id_t; #define IPSET_INVALID_ID 65535 enum ip_set_dim { IPSET_DIM_ZERO = 0, IPSET_DIM_ONE, IPSET_DIM_TWO, IPSET_DIM_THREE, /* Max dimension in elements. * If changed, new revision of iptables match/target is required. */ IPSET_DIM_MAX = 6, /* Backward compatibility: set match revision 2 */ IPSET_BIT_RETURN_NOMATCH = 7, }; /* Option flags for kernel operations */ enum ip_set_kopt { IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO), IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE), IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO), IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH), }; enum { IPSET_COUNTER_NONE = 0, IPSET_COUNTER_EQ, IPSET_COUNTER_NE, IPSET_COUNTER_LT, IPSET_COUNTER_GT, }; /* Backward compatibility for set match v3 */ struct ip_set_counter_match0 { __u8 op; __u64 value; }; struct ip_set_counter_match { __aligned_u64 value; __u8 op; }; /* Interface to iptables/ip6tables */ #define SO_IP_SET 83 union ip_set_name_index { char name[IPSET_MAXNAMELEN]; ip_set_id_t index; }; #define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ struct ip_set_req_get_set { unsigned int op; unsigned int version; union ip_set_name_index set; }; #define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ /* Uses ip_set_req_get_set */ #define IP_SET_OP_GET_FNAME 0x00000008 /* Get set index and family */ struct ip_set_req_get_set_family { unsigned int op; unsigned int version; unsigned int family; union ip_set_name_index set; }; #define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ struct ip_set_req_version { unsigned int op; unsigned int version; }; #endif /* _IP_SET_H */ linux/netfilter/ipset/ip_set_bitmap.h 0000644 00000000654 15063602052 0014017 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __IP_SET_BITMAP_H #define __IP_SET_BITMAP_H #include <linux/netfilter/ipset/ip_set.h> /* Bitmap type specific error codes */ enum { /* The element is out of the range of the set */ IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC, /* The range exceeds the size limit of the set type */ IPSET_ERR_BITMAP_RANGE_SIZE, }; #endif /* __IP_SET_BITMAP_H */ linux/netfilter/ipset/ip_set_hash.h 0000644 00000001102 15063602052 0013453 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __IP_SET_HASH_H #define __IP_SET_HASH_H #include <linux/netfilter/ipset/ip_set.h> /* Hash type specific error codes */ enum { /* Hash is full */ IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC, /* Null-valued element */ IPSET_ERR_HASH_ELEM, /* Invalid protocol */ IPSET_ERR_INVALID_PROTO, /* Protocol missing but must be specified */ IPSET_ERR_MISSING_PROTO, /* Range not supported */ IPSET_ERR_HASH_RANGE_UNSUPPORTED, /* Invalid range */ IPSET_ERR_HASH_RANGE, }; #endif /* __IP_SET_HASH_H */ linux/netfilter/ipset/ip_set_list.h 0000644 00000001141 15063602052 0013506 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __IP_SET_LIST_H #define __IP_SET_LIST_H #include <linux/netfilter/ipset/ip_set.h> /* List type specific error codes */ enum { /* Set name to be added/deleted/tested does not exist. */ IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC, /* list:set type is not permitted to add */ IPSET_ERR_LOOP, /* Missing reference set */ IPSET_ERR_BEFORE, /* Reference set does not exist */ IPSET_ERR_NAMEREF, /* Set is full */ IPSET_ERR_LIST_FULL, /* Reference set is not added to the set */ IPSET_ERR_REF_EXIST, }; #endif /* __IP_SET_LIST_H */ linux/netfilter/nf_conntrack_ftp.h 0000644 00000000666 15063602052 0013375 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_FTP_H #define _NF_CONNTRACK_FTP_H /* FTP tracking. */ /* This enum is exposed to userspace */ enum nf_ct_ftp_type { /* PORT command from client */ NF_CT_FTP_PORT, /* PASV response from server */ NF_CT_FTP_PASV, /* EPRT command from client */ NF_CT_FTP_EPRT, /* EPSV response from server */ NF_CT_FTP_EPSV, }; #endif /* _NF_CONNTRACK_FTP_H */ linux/netfilter/nf_conntrack_sctp.h 0000644 00000001100 15063602052 0013535 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_SCTP_H #define _NF_CONNTRACK_SCTP_H /* SCTP tracking. */ #include <linux/netfilter/nf_conntrack_tuple_common.h> enum sctp_conntrack { SCTP_CONNTRACK_NONE, SCTP_CONNTRACK_CLOSED, SCTP_CONNTRACK_COOKIE_WAIT, SCTP_CONNTRACK_COOKIE_ECHOED, SCTP_CONNTRACK_ESTABLISHED, SCTP_CONNTRACK_SHUTDOWN_SENT, SCTP_CONNTRACK_SHUTDOWN_RECD, SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, SCTP_CONNTRACK_HEARTBEAT_SENT, SCTP_CONNTRACK_HEARTBEAT_ACKED, SCTP_CONNTRACK_MAX }; #endif /* _NF_CONNTRACK_SCTP_H */ linux/netfilter/nf_conntrack_tcp.h 0000644 00000002607 15063602052 0013367 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_TCP_H #define _NF_CONNTRACK_TCP_H /* TCP tracking. */ #include <linux/types.h> /* This is exposed to userspace (ctnetlink) */ enum tcp_conntrack { TCP_CONNTRACK_NONE, TCP_CONNTRACK_SYN_SENT, TCP_CONNTRACK_SYN_RECV, TCP_CONNTRACK_ESTABLISHED, TCP_CONNTRACK_FIN_WAIT, TCP_CONNTRACK_CLOSE_WAIT, TCP_CONNTRACK_LAST_ACK, TCP_CONNTRACK_TIME_WAIT, TCP_CONNTRACK_CLOSE, TCP_CONNTRACK_LISTEN, /* obsolete */ #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN TCP_CONNTRACK_MAX, TCP_CONNTRACK_IGNORE, TCP_CONNTRACK_RETRANS, TCP_CONNTRACK_UNACK, TCP_CONNTRACK_TIMEOUT_MAX }; /* Window scaling is advertised by the sender */ #define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01 /* SACK is permitted by the sender */ #define IP_CT_TCP_FLAG_SACK_PERM 0x02 /* This sender sent FIN first */ #define IP_CT_TCP_FLAG_CLOSE_INIT 0x04 /* Be liberal in window checking */ #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 /* Has unacknowledged data */ #define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 /* The field td_maxack has been set */ #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 /* Marks possibility for expected RFC5961 challenge ACK */ #define IP_CT_EXP_CHALLENGE_ACK 0x40 /* Simultaneous open initialized */ #define IP_CT_TCP_SIMULTANEOUS_OPEN 0x80 struct nf_ct_tcp_flags { __u8 flags; __u8 mask; }; #endif /* _NF_CONNTRACK_TCP_H */ linux/netfilter/nf_conntrack_tuple_common.h 0000644 00000001600 15063602052 0015272 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_TUPLE_COMMON_H #define _NF_CONNTRACK_TUPLE_COMMON_H #include <linux/types.h> #include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_common.h> /* IP_CT_IS_REPLY */ enum ip_conntrack_dir { IP_CT_DIR_ORIGINAL, IP_CT_DIR_REPLY, IP_CT_DIR_MAX }; /* The protocol-specific manipulable parts of the tuple: always in * network order */ union nf_conntrack_man_proto { /* Add other protocols here. */ __be16 all; struct { __be16 port; } tcp; struct { __be16 port; } udp; struct { __be16 id; } icmp; struct { __be16 port; } dccp; struct { __be16 port; } sctp; struct { __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */ } gre; }; #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) #endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ linux/netfilter/nf_log.h 0000644 00000001032 15063602052 0011307 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NETFILTER_NF_LOG_H #define _NETFILTER_NF_LOG_H #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ #define NF_LOG_IPOPT 0x04 /* Log IP options */ #define NF_LOG_UID 0x08 /* Log UID owning local socket */ #define NF_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ #define NF_LOG_MACDECODE 0x20 /* Decode MAC header */ #define NF_LOG_MASK 0x2f #define NF_LOG_PREFIXLEN 128 #endif /* _NETFILTER_NF_LOG_H */ linux/netfilter/nf_nat.h 0000644 00000002762 15063602052 0011323 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NETFILTER_NF_NAT_H #define _NETFILTER_NF_NAT_H #include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> #define NF_NAT_RANGE_MAP_IPS (1 << 0) #define NF_NAT_RANGE_PROTO_SPECIFIED (1 << 1) #define NF_NAT_RANGE_PROTO_RANDOM (1 << 2) #define NF_NAT_RANGE_PERSISTENT (1 << 3) #define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4) #define NF_NAT_RANGE_PROTO_OFFSET (1 << 5) #define NF_NAT_RANGE_PROTO_RANDOM_ALL \ (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY) #define NF_NAT_RANGE_MASK \ (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \ NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \ NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET) struct nf_nat_ipv4_range { unsigned int flags; __be32 min_ip; __be32 max_ip; union nf_conntrack_man_proto min; union nf_conntrack_man_proto max; }; struct nf_nat_ipv4_multi_range_compat { unsigned int rangesize; struct nf_nat_ipv4_range range[1]; }; struct nf_nat_range { unsigned int flags; union nf_inet_addr min_addr; union nf_inet_addr max_addr; union nf_conntrack_man_proto min_proto; union nf_conntrack_man_proto max_proto; }; struct nf_nat_range2 { unsigned int flags; union nf_inet_addr min_addr; union nf_inet_addr max_addr; union nf_conntrack_man_proto min_proto; union nf_conntrack_man_proto max_proto; union nf_conntrack_man_proto base_proto; }; #endif /* _NETFILTER_NF_NAT_H */ linux/netfilter/nf_osf.h 0000644 00000003634 15063602052 0011327 0 ustar 00 #ifndef _NF_OSF_H #define _NF_OSF_H #include <linux/types.h> #define MAXGENRELEN 32 #define NF_OSF_GENRE (1 << 0) #define NF_OSF_TTL (1 << 1) #define NF_OSF_LOG (1 << 2) #define NF_OSF_INVERT (1 << 3) #define NF_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */ #define NF_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */ #define NF_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */ #define NF_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */ /* Do not compare ip and fingerprint TTL at all */ #define NF_OSF_TTL_NOCHECK 2 /* Wildcard MSS (kind of). * It is used to implement a state machine for the different wildcard values * of the MSS and window sizes. */ struct nf_osf_wc { __u32 wc; __u32 val; }; /* This struct represents IANA options * http://www.iana.org/assignments/tcp-parameters */ struct nf_osf_opt { __u16 kind, length; struct nf_osf_wc wc; }; struct nf_osf_info { char genre[MAXGENRELEN]; __u32 len; __u32 flags; __u32 loglevel; __u32 ttl; }; struct nf_osf_user_finger { struct nf_osf_wc wss; __u8 ttl, df; __u16 ss, mss; __u16 opt_num; char genre[MAXGENRELEN]; char version[MAXGENRELEN]; char subtype[MAXGENRELEN]; /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */ struct nf_osf_opt opt[MAX_IPOPTLEN]; }; struct nf_osf_nlmsg { struct nf_osf_user_finger f; struct iphdr ip; struct tcphdr tcp; }; /* Defines for IANA option kinds */ enum iana_options { OSFOPT_EOL = 0, /* End of options */ OSFOPT_NOP, /* NOP */ OSFOPT_MSS, /* Maximum segment size */ OSFOPT_WSO, /* Window scale option */ OSFOPT_SACKP, /* SACK permitted */ OSFOPT_SACK, /* SACK */ OSFOPT_ECHO, OSFOPT_ECHOREPLY, OSFOPT_TS, /* Timestamp option */ OSFOPT_POCP, /* Partial Order Connection Permitted */ OSFOPT_POSP, /* Partial Order Service Profile */ /* Others are not used in the current OSF */ OSFOPT_EMPTY = 255, }; #endif /* _NF_OSF_H */ linux/netfilter/nf_tables.h 0000644 00000140371 15063602052 0012012 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NF_TABLES_H #define _LINUX_NF_TABLES_H #define NFT_NAME_MAXLEN 256 #define NFT_TABLE_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_CHAIN_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_SET_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_OBJ_MAXNAMELEN NFT_NAME_MAXLEN #define NFT_USERDATA_MAXLEN 256 /** * enum nft_registers - nf_tables registers * * nf_tables used to have five registers: a verdict register and four data * registers of size 16. The data registers have been changed to 16 registers * of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still * map to areas of size 16, the 4 byte registers are addressed using * NFT_REG32_00 - NFT_REG32_15. */ enum nft_registers { NFT_REG_VERDICT, NFT_REG_1, NFT_REG_2, NFT_REG_3, NFT_REG_4, __NFT_REG_MAX, NFT_REG32_00 = 8, NFT_REG32_01, NFT_REG32_02, NFT_REG32_03, NFT_REG32_04, NFT_REG32_05, NFT_REG32_06, NFT_REG32_07, NFT_REG32_08, NFT_REG32_09, NFT_REG32_10, NFT_REG32_11, NFT_REG32_12, NFT_REG32_13, NFT_REG32_14, NFT_REG32_15, }; #define NFT_REG_MAX (__NFT_REG_MAX - 1) #define NFT_REG_SIZE 16 #define NFT_REG32_SIZE 4 #define NFT_REG32_COUNT (NFT_REG32_15 - NFT_REG32_00 + 1) /** * enum nft_verdicts - nf_tables internal verdicts * * @NFT_CONTINUE: continue evaluation of the current rule * @NFT_BREAK: terminate evaluation of the current rule * @NFT_JUMP: push the current chain on the jump stack and jump to a chain * @NFT_GOTO: jump to a chain without pushing the current chain on the jump stack * @NFT_RETURN: return to the topmost chain on the jump stack * * The nf_tables verdicts share their numeric space with the netfilter verdicts. */ enum nft_verdicts { NFT_CONTINUE = -1, NFT_BREAK = -2, NFT_JUMP = -3, NFT_GOTO = -4, NFT_RETURN = -5, }; /** * enum nf_tables_msg_types - nf_tables netlink message types * * @NFT_MSG_NEWTABLE: create a new table (enum nft_table_attributes) * @NFT_MSG_GETTABLE: get a table (enum nft_table_attributes) * @NFT_MSG_DELTABLE: delete a table (enum nft_table_attributes) * @NFT_MSG_NEWCHAIN: create a new chain (enum nft_chain_attributes) * @NFT_MSG_GETCHAIN: get a chain (enum nft_chain_attributes) * @NFT_MSG_DELCHAIN: delete a chain (enum nft_chain_attributes) * @NFT_MSG_NEWRULE: create a new rule (enum nft_rule_attributes) * @NFT_MSG_GETRULE: get a rule (enum nft_rule_attributes) * @NFT_MSG_DELRULE: delete a rule (enum nft_rule_attributes) * @NFT_MSG_NEWSET: create a new set (enum nft_set_attributes) * @NFT_MSG_GETSET: get a set (enum nft_set_attributes) * @NFT_MSG_DELSET: delete a set (enum nft_set_attributes) * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes) * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes) * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes) * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes) * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes) * @NFT_MSG_TRACE: trace event (enum nft_trace_attributes) * @NFT_MSG_NEWOBJ: create a stateful object (enum nft_obj_attributes) * @NFT_MSG_GETOBJ: get a stateful object (enum nft_obj_attributes) * @NFT_MSG_DELOBJ: delete a stateful object (enum nft_obj_attributes) * @NFT_MSG_GETOBJ_RESET: get and reset a stateful object (enum nft_obj_attributes) * @NFT_MSG_NEWFLOWTABLE: add new flow table (enum nft_flowtable_attributes) * @NFT_MSG_GETFLOWTABLE: get flow table (enum nft_flowtable_attributes) * @NFT_MSG_DELFLOWTABLE: delete flow table (enum nft_flowtable_attributes) */ enum nf_tables_msg_types { NFT_MSG_NEWTABLE, NFT_MSG_GETTABLE, NFT_MSG_DELTABLE, NFT_MSG_NEWCHAIN, NFT_MSG_GETCHAIN, NFT_MSG_DELCHAIN, NFT_MSG_NEWRULE, NFT_MSG_GETRULE, NFT_MSG_DELRULE, NFT_MSG_NEWSET, NFT_MSG_GETSET, NFT_MSG_DELSET, NFT_MSG_NEWSETELEM, NFT_MSG_GETSETELEM, NFT_MSG_DELSETELEM, NFT_MSG_NEWGEN, NFT_MSG_GETGEN, NFT_MSG_TRACE, NFT_MSG_NEWOBJ, NFT_MSG_GETOBJ, NFT_MSG_DELOBJ, NFT_MSG_GETOBJ_RESET, NFT_MSG_NEWFLOWTABLE, NFT_MSG_GETFLOWTABLE, NFT_MSG_DELFLOWTABLE, NFT_MSG_MAX, }; /** * enum nft_list_attributes - nf_tables generic list netlink attributes * * @NFTA_LIST_ELEM: list element (NLA_NESTED) */ enum nft_list_attributes { NFTA_LIST_UNPEC, NFTA_LIST_ELEM, __NFTA_LIST_MAX }; #define NFTA_LIST_MAX (__NFTA_LIST_MAX - 1) /** * enum nft_hook_attributes - nf_tables netfilter hook netlink attributes * * @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32) * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32) * @NFTA_HOOK_DEV: netdevice name (NLA_STRING) * @NFTA_HOOK_DEVS: list of netdevices (NLA_NESTED) */ enum nft_hook_attributes { NFTA_HOOK_UNSPEC, NFTA_HOOK_HOOKNUM, NFTA_HOOK_PRIORITY, NFTA_HOOK_DEV, NFTA_HOOK_DEVS, __NFTA_HOOK_MAX }; #define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1) /** * enum nft_table_flags - nf_tables table flags * * @NFT_TABLE_F_DORMANT: this table is not active */ enum nft_table_flags { NFT_TABLE_F_DORMANT = 0x1, }; #define NFT_TABLE_F_MASK (NFT_TABLE_F_DORMANT) /** * enum nft_table_attributes - nf_tables table netlink attributes * * @NFTA_TABLE_NAME: name of the table (NLA_STRING) * @NFTA_TABLE_FLAGS: bitmask of enum nft_table_flags (NLA_U32) * @NFTA_TABLE_USE: number of chains in this table (NLA_U32) */ enum nft_table_attributes { NFTA_TABLE_UNSPEC, NFTA_TABLE_NAME, NFTA_TABLE_FLAGS, NFTA_TABLE_USE, NFTA_TABLE_HANDLE, NFTA_TABLE_PAD, __NFTA_TABLE_MAX }; #define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1) /** * enum nft_chain_attributes - nf_tables chain netlink attributes * * @NFTA_CHAIN_TABLE: name of the table containing the chain (NLA_STRING) * @NFTA_CHAIN_HANDLE: numeric handle of the chain (NLA_U64) * @NFTA_CHAIN_NAME: name of the chain (NLA_STRING) * @NFTA_CHAIN_HOOK: hook specification for basechains (NLA_NESTED: nft_hook_attributes) * @NFTA_CHAIN_POLICY: numeric policy of the chain (NLA_U32) * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32) * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING) * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes) * @NFTA_CHAIN_FLAGS: chain flags */ enum nft_chain_attributes { NFTA_CHAIN_UNSPEC, NFTA_CHAIN_TABLE, NFTA_CHAIN_HANDLE, NFTA_CHAIN_NAME, NFTA_CHAIN_HOOK, NFTA_CHAIN_POLICY, NFTA_CHAIN_USE, NFTA_CHAIN_TYPE, NFTA_CHAIN_COUNTERS, NFTA_CHAIN_PAD, NFTA_CHAIN_FLAGS, __NFTA_CHAIN_MAX }; #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1) /** * enum nft_rule_attributes - nf_tables rule netlink attributes * * @NFTA_RULE_TABLE: name of the table containing the rule (NLA_STRING) * @NFTA_RULE_CHAIN: name of the chain containing the rule (NLA_STRING) * @NFTA_RULE_HANDLE: numeric handle of the rule (NLA_U64) * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes) * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes) * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64) * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN) * @NFTA_RULE_ID: uniquely identifies a rule in a transaction (NLA_U32) * @NFTA_RULE_POSITION_ID: transaction unique identifier of the previous rule (NLA_U32) */ enum nft_rule_attributes { NFTA_RULE_UNSPEC, NFTA_RULE_TABLE, NFTA_RULE_CHAIN, NFTA_RULE_HANDLE, NFTA_RULE_EXPRESSIONS, NFTA_RULE_COMPAT, NFTA_RULE_POSITION, NFTA_RULE_USERDATA, NFTA_RULE_PAD, NFTA_RULE_ID, NFTA_RULE_POSITION_ID, __NFTA_RULE_MAX }; #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1) /** * enum nft_rule_compat_flags - nf_tables rule compat flags * * @NFT_RULE_COMPAT_F_INV: invert the check result */ enum nft_rule_compat_flags { NFT_RULE_COMPAT_F_INV = (1 << 1), NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV, }; /** * enum nft_rule_compat_attributes - nf_tables rule compat attributes * * @NFTA_RULE_COMPAT_PROTO: numeric value of handled protocol (NLA_U32) * @NFTA_RULE_COMPAT_FLAGS: bitmask of enum nft_rule_compat_flags (NLA_U32) */ enum nft_rule_compat_attributes { NFTA_RULE_COMPAT_UNSPEC, NFTA_RULE_COMPAT_PROTO, NFTA_RULE_COMPAT_FLAGS, __NFTA_RULE_COMPAT_MAX }; #define NFTA_RULE_COMPAT_MAX (__NFTA_RULE_COMPAT_MAX - 1) /** * enum nft_set_flags - nf_tables set flags * * @NFT_SET_ANONYMOUS: name allocation, automatic cleanup on unlink * @NFT_SET_CONSTANT: set contents may not change while bound * @NFT_SET_INTERVAL: set contains intervals * @NFT_SET_MAP: set is used as a dictionary * @NFT_SET_TIMEOUT: set uses timeouts * @NFT_SET_EVAL: set can be updated from the evaluation path * @NFT_SET_OBJECT: set contains stateful objects * @NFT_SET_CONCAT: set contains a concatenation * @NFT_SET_EXPR: set contains expressions */ enum nft_set_flags { NFT_SET_ANONYMOUS = 0x1, NFT_SET_CONSTANT = 0x2, NFT_SET_INTERVAL = 0x4, NFT_SET_MAP = 0x8, NFT_SET_TIMEOUT = 0x10, NFT_SET_EVAL = 0x20, NFT_SET_OBJECT = 0x40, NFT_SET_CONCAT = 0x80, NFT_SET_EXPR = 0x100, }; /** * enum nft_set_policies - set selection policy * * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use * @NFT_SET_POL_MEMORY: prefer low memory use over high performance */ enum nft_set_policies { NFT_SET_POL_PERFORMANCE, NFT_SET_POL_MEMORY, }; /** * enum nft_set_desc_attributes - set element description * * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32) * @NFTA_SET_DESC_CONCAT: description of field concatenation (NLA_NESTED) */ enum nft_set_desc_attributes { NFTA_SET_DESC_UNSPEC, NFTA_SET_DESC_SIZE, NFTA_SET_DESC_CONCAT, __NFTA_SET_DESC_MAX }; #define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1) /** * enum nft_set_field_attributes - attributes of concatenated fields * * @NFTA_SET_FIELD_LEN: length of single field, in bits (NLA_U32) */ enum nft_set_field_attributes { NFTA_SET_FIELD_UNSPEC, NFTA_SET_FIELD_LEN, __NFTA_SET_FIELD_MAX }; #define NFTA_SET_FIELD_MAX (__NFTA_SET_FIELD_MAX - 1) /** * enum nft_set_attributes - nf_tables set netlink attributes * * @NFTA_SET_TABLE: table name (NLA_STRING) * @NFTA_SET_NAME: set name (NLA_STRING) * @NFTA_SET_FLAGS: bitmask of enum nft_set_flags (NLA_U32) * @NFTA_SET_KEY_TYPE: key data type, informational purpose only (NLA_U32) * @NFTA_SET_KEY_LEN: key data length (NLA_U32) * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32) * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32) * @NFTA_SET_POLICY: selection policy (NLA_U32) * @NFTA_SET_DESC: set description (NLA_NESTED) * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32) * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64) * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32) * @NFTA_SET_USERDATA: user data (NLA_BINARY) * @NFTA_SET_OBJ_TYPE: stateful object type (NLA_U32: NFT_OBJECT_*) * @NFTA_SET_HANDLE: set handle (NLA_U64) * @NFTA_SET_EXPR: set expression (NLA_NESTED: nft_expr_attributes) * @NFTA_SET_EXPRESSIONS: list of expressions (NLA_NESTED: nft_list_attributes) */ enum nft_set_attributes { NFTA_SET_UNSPEC, NFTA_SET_TABLE, NFTA_SET_NAME, NFTA_SET_FLAGS, NFTA_SET_KEY_TYPE, NFTA_SET_KEY_LEN, NFTA_SET_DATA_TYPE, NFTA_SET_DATA_LEN, NFTA_SET_POLICY, NFTA_SET_DESC, NFTA_SET_ID, NFTA_SET_TIMEOUT, NFTA_SET_GC_INTERVAL, NFTA_SET_USERDATA, NFTA_SET_PAD, NFTA_SET_OBJ_TYPE, NFTA_SET_HANDLE, NFTA_SET_EXPR, NFTA_SET_EXPRESSIONS, __NFTA_SET_MAX }; #define NFTA_SET_MAX (__NFTA_SET_MAX - 1) /** * enum nft_set_elem_flags - nf_tables set element flags * * @NFT_SET_ELEM_INTERVAL_END: element ends the previous interval */ enum nft_set_elem_flags { NFT_SET_ELEM_INTERVAL_END = 0x1, }; /** * enum nft_set_elem_attributes - nf_tables set element netlink attributes * * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data) * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes) * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32) * @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64) * @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64) * @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY) * @NFTA_SET_ELEM_EXPR: expression (NLA_NESTED: nft_expr_attributes) * @NFTA_SET_ELEM_OBJREF: stateful object reference (NLA_STRING) * @NFTA_SET_ELEM_KEY_END: closing key value (NLA_NESTED: nft_data) * @NFTA_SET_ELEM_EXPRESSIONS: list of expressions (NLA_NESTED: nft_list_attributes) */ enum nft_set_elem_attributes { NFTA_SET_ELEM_UNSPEC, NFTA_SET_ELEM_KEY, NFTA_SET_ELEM_DATA, NFTA_SET_ELEM_FLAGS, NFTA_SET_ELEM_TIMEOUT, NFTA_SET_ELEM_EXPIRATION, NFTA_SET_ELEM_USERDATA, NFTA_SET_ELEM_EXPR, NFTA_SET_ELEM_PAD, NFTA_SET_ELEM_OBJREF, NFTA_SET_ELEM_KEY_END, NFTA_SET_ELEM_EXPRESSIONS, __NFTA_SET_ELEM_MAX }; #define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1) /** * enum nft_set_elem_list_attributes - nf_tables set element list netlink attributes * * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING) * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING) * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes) * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32) */ enum nft_set_elem_list_attributes { NFTA_SET_ELEM_LIST_UNSPEC, NFTA_SET_ELEM_LIST_TABLE, NFTA_SET_ELEM_LIST_SET, NFTA_SET_ELEM_LIST_ELEMENTS, NFTA_SET_ELEM_LIST_SET_ID, __NFTA_SET_ELEM_LIST_MAX }; #define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1) /** * enum nft_data_types - nf_tables data types * * @NFT_DATA_VALUE: generic data * @NFT_DATA_VERDICT: netfilter verdict * * The type of data is usually determined by the kernel directly and is not * explicitly specified by userspace. The only difference are sets, where * userspace specifies the key and mapping data types. * * The values 0xffffff00-0xffffffff are reserved for internally used types. * The remaining range can be freely used by userspace to encode types, all * values are equivalent to NFT_DATA_VALUE. */ enum nft_data_types { NFT_DATA_VALUE, NFT_DATA_VERDICT = 0xffffff00U, }; #define NFT_DATA_RESERVED_MASK 0xffffff00U /** * enum nft_data_attributes - nf_tables data netlink attributes * * @NFTA_DATA_VALUE: generic data (NLA_BINARY) * @NFTA_DATA_VERDICT: nf_tables verdict (NLA_NESTED: nft_verdict_attributes) */ enum nft_data_attributes { NFTA_DATA_UNSPEC, NFTA_DATA_VALUE, NFTA_DATA_VERDICT, __NFTA_DATA_MAX }; #define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1) /* Maximum length of a value */ #define NFT_DATA_VALUE_MAXLEN 64 /** * enum nft_verdict_attributes - nf_tables verdict netlink attributes * * @NFTA_VERDICT_CODE: nf_tables verdict (NLA_U32: enum nft_verdicts) * @NFTA_VERDICT_CHAIN: jump target chain name (NLA_STRING) */ enum nft_verdict_attributes { NFTA_VERDICT_UNSPEC, NFTA_VERDICT_CODE, NFTA_VERDICT_CHAIN, __NFTA_VERDICT_MAX }; #define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1) /** * enum nft_expr_attributes - nf_tables expression netlink attributes * * @NFTA_EXPR_NAME: name of the expression type (NLA_STRING) * @NFTA_EXPR_DATA: type specific data (NLA_NESTED) */ enum nft_expr_attributes { NFTA_EXPR_UNSPEC, NFTA_EXPR_NAME, NFTA_EXPR_DATA, __NFTA_EXPR_MAX }; #define NFTA_EXPR_MAX (__NFTA_EXPR_MAX - 1) /** * enum nft_immediate_attributes - nf_tables immediate expression netlink attributes * * @NFTA_IMMEDIATE_DREG: destination register to load data into (NLA_U32) * @NFTA_IMMEDIATE_DATA: data to load (NLA_NESTED: nft_data_attributes) */ enum nft_immediate_attributes { NFTA_IMMEDIATE_UNSPEC, NFTA_IMMEDIATE_DREG, NFTA_IMMEDIATE_DATA, __NFTA_IMMEDIATE_MAX }; #define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1) /** * enum nft_bitwise_attributes - nf_tables bitwise expression netlink attributes * * @NFTA_BITWISE_SREG: source register (NLA_U32: nft_registers) * @NFTA_BITWISE_DREG: destination register (NLA_U32: nft_registers) * @NFTA_BITWISE_LEN: length of operands (NLA_U32) * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes) * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes) * * The bitwise expression performs the following operation: * * dreg = (sreg & mask) ^ xor * * which allow to express all bitwise operations: * * mask xor * NOT: 1 1 * OR: 0 x * XOR: 1 x * AND: x 0 */ enum nft_bitwise_attributes { NFTA_BITWISE_UNSPEC, NFTA_BITWISE_SREG, NFTA_BITWISE_DREG, NFTA_BITWISE_LEN, NFTA_BITWISE_MASK, NFTA_BITWISE_XOR, __NFTA_BITWISE_MAX }; #define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1) /** * enum nft_byteorder_ops - nf_tables byteorder operators * * @NFT_BYTEORDER_NTOH: network to host operator * @NFT_BYTEORDER_HTON: host to network operator */ enum nft_byteorder_ops { NFT_BYTEORDER_NTOH, NFT_BYTEORDER_HTON, }; /** * enum nft_byteorder_attributes - nf_tables byteorder expression netlink attributes * * @NFTA_BYTEORDER_SREG: source register (NLA_U32: nft_registers) * @NFTA_BYTEORDER_DREG: destination register (NLA_U32: nft_registers) * @NFTA_BYTEORDER_OP: operator (NLA_U32: enum nft_byteorder_ops) * @NFTA_BYTEORDER_LEN: length of the data (NLA_U32) * @NFTA_BYTEORDER_SIZE: data size in bytes (NLA_U32: 2 or 4) */ enum nft_byteorder_attributes { NFTA_BYTEORDER_UNSPEC, NFTA_BYTEORDER_SREG, NFTA_BYTEORDER_DREG, NFTA_BYTEORDER_OP, NFTA_BYTEORDER_LEN, NFTA_BYTEORDER_SIZE, __NFTA_BYTEORDER_MAX }; #define NFTA_BYTEORDER_MAX (__NFTA_BYTEORDER_MAX - 1) /** * enum nft_cmp_ops - nf_tables relational operator * * @NFT_CMP_EQ: equal * @NFT_CMP_NEQ: not equal * @NFT_CMP_LT: less than * @NFT_CMP_LTE: less than or equal to * @NFT_CMP_GT: greater than * @NFT_CMP_GTE: greater than or equal to */ enum nft_cmp_ops { NFT_CMP_EQ, NFT_CMP_NEQ, NFT_CMP_LT, NFT_CMP_LTE, NFT_CMP_GT, NFT_CMP_GTE, }; /** * enum nft_cmp_attributes - nf_tables cmp expression netlink attributes * * @NFTA_CMP_SREG: source register of data to compare (NLA_U32: nft_registers) * @NFTA_CMP_OP: cmp operation (NLA_U32: nft_cmp_ops) * @NFTA_CMP_DATA: data to compare against (NLA_NESTED: nft_data_attributes) */ enum nft_cmp_attributes { NFTA_CMP_UNSPEC, NFTA_CMP_SREG, NFTA_CMP_OP, NFTA_CMP_DATA, __NFTA_CMP_MAX }; #define NFTA_CMP_MAX (__NFTA_CMP_MAX - 1) /** * enum nft_range_ops - nf_tables range operator * * @NFT_RANGE_EQ: equal * @NFT_RANGE_NEQ: not equal */ enum nft_range_ops { NFT_RANGE_EQ, NFT_RANGE_NEQ, }; /** * enum nft_range_attributes - nf_tables range expression netlink attributes * * @NFTA_RANGE_SREG: source register of data to compare (NLA_U32: nft_registers) * @NFTA_RANGE_OP: cmp operation (NLA_U32: nft_cmp_ops) * @NFTA_RANGE_FROM_DATA: data range from (NLA_NESTED: nft_data_attributes) * @NFTA_RANGE_TO_DATA: data range to (NLA_NESTED: nft_data_attributes) */ enum nft_range_attributes { NFTA_RANGE_UNSPEC, NFTA_RANGE_SREG, NFTA_RANGE_OP, NFTA_RANGE_FROM_DATA, NFTA_RANGE_TO_DATA, __NFTA_RANGE_MAX }; #define NFTA_RANGE_MAX (__NFTA_RANGE_MAX - 1) enum nft_lookup_flags { NFT_LOOKUP_F_INV = (1 << 0), }; /** * enum nft_lookup_attributes - nf_tables set lookup expression netlink attributes * * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING) * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers) * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers) * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32) * @NFTA_LOOKUP_FLAGS: flags (NLA_U32: enum nft_lookup_flags) */ enum nft_lookup_attributes { NFTA_LOOKUP_UNSPEC, NFTA_LOOKUP_SET, NFTA_LOOKUP_SREG, NFTA_LOOKUP_DREG, NFTA_LOOKUP_SET_ID, NFTA_LOOKUP_FLAGS, __NFTA_LOOKUP_MAX }; #define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) enum nft_dynset_ops { NFT_DYNSET_OP_ADD, NFT_DYNSET_OP_UPDATE, }; enum nft_dynset_flags { NFT_DYNSET_F_INV = (1 << 0), NFT_DYNSET_F_EXPR = (1 << 1), }; /** * enum nft_dynset_attributes - dynset expression attributes * * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING) * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32) * @NFTA_DYNSET_OP: operation (NLA_U32) * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32) * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32) * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64) * @NFTA_DYNSET_EXPR: expression (NLA_NESTED: nft_expr_attributes) * @NFTA_DYNSET_FLAGS: flags (NLA_U32) * @NFTA_DYNSET_EXPRESSIONS: list of expressions (NLA_NESTED: nft_list_attributes) */ enum nft_dynset_attributes { NFTA_DYNSET_UNSPEC, NFTA_DYNSET_SET_NAME, NFTA_DYNSET_SET_ID, NFTA_DYNSET_OP, NFTA_DYNSET_SREG_KEY, NFTA_DYNSET_SREG_DATA, NFTA_DYNSET_TIMEOUT, NFTA_DYNSET_EXPR, NFTA_DYNSET_PAD, NFTA_DYNSET_FLAGS, NFTA_DYNSET_EXPRESSIONS, __NFTA_DYNSET_MAX, }; #define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1) /** * enum nft_payload_bases - nf_tables payload expression offset bases * * @NFT_PAYLOAD_LL_HEADER: link layer header * @NFT_PAYLOAD_NETWORK_HEADER: network header * @NFT_PAYLOAD_TRANSPORT_HEADER: transport header */ enum nft_payload_bases { NFT_PAYLOAD_LL_HEADER, NFT_PAYLOAD_NETWORK_HEADER, NFT_PAYLOAD_TRANSPORT_HEADER, }; /** * enum nft_payload_csum_types - nf_tables payload expression checksum types * * @NFT_PAYLOAD_CSUM_NONE: no checksumming * @NFT_PAYLOAD_CSUM_INET: internet checksum (RFC 791) * @NFT_PAYLOAD_CSUM_SCTP: CRC-32c, for use in SCTP header (RFC 3309) */ enum nft_payload_csum_types { NFT_PAYLOAD_CSUM_NONE, NFT_PAYLOAD_CSUM_INET, NFT_PAYLOAD_CSUM_SCTP, }; enum nft_payload_csum_flags { NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0), }; /** * enum nft_payload_attributes - nf_tables payload expression netlink attributes * * @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers) * @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases) * @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32) * @NFTA_PAYLOAD_LEN: payload length (NLA_U32) * @NFTA_PAYLOAD_SREG: source register to load data from (NLA_U32: nft_registers) * @NFTA_PAYLOAD_CSUM_TYPE: checksum type (NLA_U32) * @NFTA_PAYLOAD_CSUM_OFFSET: checksum offset relative to base (NLA_U32) * @NFTA_PAYLOAD_CSUM_FLAGS: checksum flags (NLA_U32) */ enum nft_payload_attributes { NFTA_PAYLOAD_UNSPEC, NFTA_PAYLOAD_DREG, NFTA_PAYLOAD_BASE, NFTA_PAYLOAD_OFFSET, NFTA_PAYLOAD_LEN, NFTA_PAYLOAD_SREG, NFTA_PAYLOAD_CSUM_TYPE, NFTA_PAYLOAD_CSUM_OFFSET, NFTA_PAYLOAD_CSUM_FLAGS, __NFTA_PAYLOAD_MAX }; #define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1) enum nft_exthdr_flags { NFT_EXTHDR_F_PRESENT = (1 << 0), }; /** * enum nft_exthdr_op - nf_tables match options * * @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers * @NFT_EXTHDR_OP_TCP: match against tcp options * @NFT_EXTHDR_OP_IPV4: match against ipv4 options * @NFT_EXTHDR_OP_SCTP: match against sctp chunks */ enum nft_exthdr_op { NFT_EXTHDR_OP_IPV6, NFT_EXTHDR_OP_TCPOPT, NFT_EXTHDR_OP_IPV4, NFT_EXTHDR_OP_SCTP, __NFT_EXTHDR_OP_MAX }; #define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1) /** * enum nft_exthdr_attributes - nf_tables extension header expression netlink attributes * * @NFTA_EXTHDR_DREG: destination register (NLA_U32: nft_registers) * @NFTA_EXTHDR_TYPE: extension header type (NLA_U8) * @NFTA_EXTHDR_OFFSET: extension header offset (NLA_U32) * @NFTA_EXTHDR_LEN: extension header length (NLA_U32) * @NFTA_EXTHDR_FLAGS: extension header flags (NLA_U32) * @NFTA_EXTHDR_OP: option match type (NLA_U32) * @NFTA_EXTHDR_SREG: option match type (NLA_U32) */ enum nft_exthdr_attributes { NFTA_EXTHDR_UNSPEC, NFTA_EXTHDR_DREG, NFTA_EXTHDR_TYPE, NFTA_EXTHDR_OFFSET, NFTA_EXTHDR_LEN, NFTA_EXTHDR_FLAGS, NFTA_EXTHDR_OP, NFTA_EXTHDR_SREG, __NFTA_EXTHDR_MAX }; #define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1) /** * enum nft_meta_keys - nf_tables meta expression keys * * @NFT_META_LEN: packet length (skb->len) * @NFT_META_PROTOCOL: packet ethertype protocol (skb->protocol), invalid in OUTPUT * @NFT_META_PRIORITY: packet priority (skb->priority) * @NFT_META_MARK: packet mark (skb->mark) * @NFT_META_IIF: packet input interface index (dev->ifindex) * @NFT_META_OIF: packet output interface index (dev->ifindex) * @NFT_META_IIFNAME: packet input interface name (dev->name) * @NFT_META_OIFNAME: packet output interface name (dev->name) * @NFT_META_IIFTYPE: packet input interface type (dev->type) * @NFT_META_OIFTYPE: packet output interface type (dev->type) * @NFT_META_SKUID: originating socket UID (fsuid) * @NFT_META_SKGID: originating socket GID (fsgid) * @NFT_META_NFTRACE: packet nftrace bit * @NFT_META_RTCLASSID: realm value of packet's route (skb->dst->tclassid) * @NFT_META_SECMARK: packet secmark (skb->secmark) * @NFT_META_NFPROTO: netfilter protocol * @NFT_META_L4PROTO: layer 4 protocol number * @NFT_META_BRI_IIFNAME: packet input bridge interface name * @NFT_META_BRI_OIFNAME: packet output bridge interface name * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback * @NFT_META_CPU: cpu id through smp_processor_id() * @NFT_META_IIFGROUP: packet input interface group * @NFT_META_OIFGROUP: packet output interface group * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid) * @NFT_META_PRANDOM: a 32bit pseudo-random number * @NFT_META_SECPATH: boolean, secpath_exists (!!skb->sp) * @NFT_META_IIFKIND: packet input interface kind name (dev->rtnl_link_ops->kind) * @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind) */ enum nft_meta_keys { NFT_META_LEN, NFT_META_PROTOCOL, NFT_META_PRIORITY, NFT_META_MARK, NFT_META_IIF, NFT_META_OIF, NFT_META_IIFNAME, NFT_META_OIFNAME, NFT_META_IIFTYPE, NFT_META_OIFTYPE, NFT_META_SKUID, NFT_META_SKGID, NFT_META_NFTRACE, NFT_META_RTCLASSID, NFT_META_SECMARK, NFT_META_NFPROTO, NFT_META_L4PROTO, NFT_META_BRI_IIFNAME, NFT_META_BRI_OIFNAME, NFT_META_PKTTYPE, NFT_META_CPU, NFT_META_IIFGROUP, NFT_META_OIFGROUP, NFT_META_CGROUP, NFT_META_PRANDOM, NFT_META_SECPATH, NFT_META_IIFKIND, NFT_META_OIFKIND, }; /** * enum nft_rt_keys - nf_tables routing expression keys * * @NFT_RT_CLASSID: realm value of packet's route (skb->dst->tclassid) * @NFT_RT_NEXTHOP4: routing nexthop for IPv4 * @NFT_RT_NEXTHOP6: routing nexthop for IPv6 * @NFT_RT_TCPMSS: fetch current path tcp mss * @NFT_RT_XFRM: boolean, skb->dst->xfrm != NULL */ enum nft_rt_keys { NFT_RT_CLASSID, NFT_RT_NEXTHOP4, NFT_RT_NEXTHOP6, NFT_RT_TCPMSS, NFT_RT_XFRM, __NFT_RT_MAX }; #define NFT_RT_MAX (__NFT_RT_MAX - 1) /** * enum nft_hash_types - nf_tables hash expression types * * @NFT_HASH_JENKINS: Jenkins Hash * @NFT_HASH_SYM: Symmetric Hash */ enum nft_hash_types { NFT_HASH_JENKINS, NFT_HASH_SYM, }; /** * enum nft_hash_attributes - nf_tables hash expression netlink attributes * * @NFTA_HASH_SREG: source register (NLA_U32) * @NFTA_HASH_DREG: destination register (NLA_U32) * @NFTA_HASH_LEN: source data length (NLA_U32) * @NFTA_HASH_MODULUS: modulus value (NLA_U32) * @NFTA_HASH_SEED: seed value (NLA_U32) * @NFTA_HASH_OFFSET: add this offset value to hash result (NLA_U32) * @NFTA_HASH_TYPE: hash operation (NLA_U32: nft_hash_types) * @NFTA_HASH_SET_NAME: name of the map to lookup (NLA_STRING) * @NFTA_HASH_SET_ID: id of the map (NLA_U32) */ enum nft_hash_attributes { NFTA_HASH_UNSPEC, NFTA_HASH_SREG, NFTA_HASH_DREG, NFTA_HASH_LEN, NFTA_HASH_MODULUS, NFTA_HASH_SEED, NFTA_HASH_OFFSET, NFTA_HASH_TYPE, NFTA_HASH_SET_NAME, /* deprecated */ NFTA_HASH_SET_ID, /* deprecated */ __NFTA_HASH_MAX, }; #define NFTA_HASH_MAX (__NFTA_HASH_MAX - 1) /** * enum nft_meta_attributes - nf_tables meta expression netlink attributes * * @NFTA_META_DREG: destination register (NLA_U32) * @NFTA_META_KEY: meta data item to load (NLA_U32: nft_meta_keys) * @NFTA_META_SREG: source register (NLA_U32) */ enum nft_meta_attributes { NFTA_META_UNSPEC, NFTA_META_DREG, NFTA_META_KEY, NFTA_META_SREG, __NFTA_META_MAX }; #define NFTA_META_MAX (__NFTA_META_MAX - 1) /** * enum nft_rt_attributes - nf_tables routing expression netlink attributes * * @NFTA_RT_DREG: destination register (NLA_U32) * @NFTA_RT_KEY: routing data item to load (NLA_U32: nft_rt_keys) */ enum nft_rt_attributes { NFTA_RT_UNSPEC, NFTA_RT_DREG, NFTA_RT_KEY, __NFTA_RT_MAX }; #define NFTA_RT_MAX (__NFTA_RT_MAX - 1) /** * enum nft_socket_attributes - nf_tables socket expression netlink attributes * * @NFTA_SOCKET_KEY: socket key to match * @NFTA_SOCKET_DREG: destination register */ enum nft_socket_attributes { NFTA_SOCKET_UNSPEC, NFTA_SOCKET_KEY, NFTA_SOCKET_DREG, __NFTA_SOCKET_MAX }; #define NFTA_SOCKET_MAX (__NFTA_SOCKET_MAX - 1) /* * enum nft_socket_keys - nf_tables socket expression keys * * @NFT_SOCKET_TRANSPARENT: Value of the IP(V6)_TRANSPARENT socket option_ */ enum nft_socket_keys { NFT_SOCKET_TRANSPARENT, __NFT_SOCKET_MAX }; #define NFT_SOCKET_MAX (__NFT_SOCKET_MAX - 1) /** * enum nft_ct_keys - nf_tables ct expression keys * * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info) * @NFT_CT_DIRECTION: conntrack direction (enum ip_conntrack_dir) * @NFT_CT_STATUS: conntrack status (bitmask of enum ip_conntrack_status) * @NFT_CT_MARK: conntrack mark value * @NFT_CT_SECMARK: conntrack secmark value * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms * @NFT_CT_HELPER: connection tracking helper assigned to conntrack * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address, deprecated) * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address, deprecated) * @NFT_CT_PROTOCOL: conntrack layer 4 protocol * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination * @NFT_CT_LABELS: conntrack labels * @NFT_CT_PKTS: conntrack packets * @NFT_CT_BYTES: conntrack bytes * @NFT_CT_AVGPKT: conntrack average bytes per packet * @NFT_CT_ZONE: conntrack zone * @NFT_CT_EVENTMASK: ctnetlink events to be generated for this conntrack * @NFT_CT_SRC_IP: conntrack layer 3 protocol source (IPv4 address) * @NFT_CT_DST_IP: conntrack layer 3 protocol destination (IPv4 address) * @NFT_CT_SRC_IP6: conntrack layer 3 protocol source (IPv6 address) * @NFT_CT_DST_IP6: conntrack layer 3 protocol destination (IPv6 address) */ enum nft_ct_keys { NFT_CT_STATE, NFT_CT_DIRECTION, NFT_CT_STATUS, NFT_CT_MARK, NFT_CT_SECMARK, NFT_CT_EXPIRATION, NFT_CT_HELPER, NFT_CT_L3PROTOCOL, NFT_CT_SRC, NFT_CT_DST, NFT_CT_PROTOCOL, NFT_CT_PROTO_SRC, NFT_CT_PROTO_DST, NFT_CT_LABELS, NFT_CT_PKTS, NFT_CT_BYTES, NFT_CT_AVGPKT, NFT_CT_ZONE, NFT_CT_EVENTMASK, NFT_CT_SRC_IP, NFT_CT_DST_IP, NFT_CT_SRC_IP6, NFT_CT_DST_IP6, __NFT_CT_MAX }; #define NFT_CT_MAX (__NFT_CT_MAX - 1) /** * enum nft_ct_attributes - nf_tables ct expression netlink attributes * * @NFTA_CT_DREG: destination register (NLA_U32) * @NFTA_CT_KEY: conntrack data item to load (NLA_U32: nft_ct_keys) * @NFTA_CT_DIRECTION: direction in case of directional keys (NLA_U8) * @NFTA_CT_SREG: source register (NLA_U32) */ enum nft_ct_attributes { NFTA_CT_UNSPEC, NFTA_CT_DREG, NFTA_CT_KEY, NFTA_CT_DIRECTION, NFTA_CT_SREG, __NFTA_CT_MAX }; #define NFTA_CT_MAX (__NFTA_CT_MAX - 1) /** * enum nft_flow_attributes - ct offload expression attributes * @NFTA_FLOW_TABLE_NAME: flow table name (NLA_STRING) */ enum nft_offload_attributes { NFTA_FLOW_UNSPEC, NFTA_FLOW_TABLE_NAME, __NFTA_FLOW_MAX, }; #define NFTA_FLOW_MAX (__NFTA_FLOW_MAX - 1) enum nft_limit_type { NFT_LIMIT_PKTS, NFT_LIMIT_PKT_BYTES }; enum nft_limit_flags { NFT_LIMIT_F_INV = (1 << 0), }; /** * enum nft_limit_attributes - nf_tables limit expression netlink attributes * * @NFTA_LIMIT_RATE: refill rate (NLA_U64) * @NFTA_LIMIT_UNIT: refill unit (NLA_U64) * @NFTA_LIMIT_BURST: burst (NLA_U32) * @NFTA_LIMIT_TYPE: type of limit (NLA_U32: enum nft_limit_type) * @NFTA_LIMIT_FLAGS: flags (NLA_U32: enum nft_limit_flags) */ enum nft_limit_attributes { NFTA_LIMIT_UNSPEC, NFTA_LIMIT_RATE, NFTA_LIMIT_UNIT, NFTA_LIMIT_BURST, NFTA_LIMIT_TYPE, NFTA_LIMIT_FLAGS, NFTA_LIMIT_PAD, __NFTA_LIMIT_MAX }; #define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1) enum nft_connlimit_flags { NFT_CONNLIMIT_F_INV = (1 << 0), }; /** * enum nft_connlimit_attributes - nf_tables connlimit expression netlink attributes * * @NFTA_CONNLIMIT_COUNT: number of connections (NLA_U32) * @NFTA_CONNLIMIT_FLAGS: flags (NLA_U32: enum nft_connlimit_flags) */ enum nft_connlimit_attributes { NFTA_CONNLIMIT_UNSPEC, NFTA_CONNLIMIT_COUNT, NFTA_CONNLIMIT_FLAGS, __NFTA_CONNLIMIT_MAX }; #define NFTA_CONNLIMIT_MAX (__NFTA_CONNLIMIT_MAX - 1) /** * enum nft_counter_attributes - nf_tables counter expression netlink attributes * * @NFTA_COUNTER_BYTES: number of bytes (NLA_U64) * @NFTA_COUNTER_PACKETS: number of packets (NLA_U64) */ enum nft_counter_attributes { NFTA_COUNTER_UNSPEC, NFTA_COUNTER_BYTES, NFTA_COUNTER_PACKETS, NFTA_COUNTER_PAD, __NFTA_COUNTER_MAX }; #define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1) /** * enum nft_log_attributes - nf_tables log expression netlink attributes * * @NFTA_LOG_GROUP: netlink group to send messages to (NLA_U32) * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING) * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32) * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32) * @NFTA_LOG_LEVEL: log level (NLA_U32) * @NFTA_LOG_FLAGS: logging flags (NLA_U32) */ enum nft_log_attributes { NFTA_LOG_UNSPEC, NFTA_LOG_GROUP, NFTA_LOG_PREFIX, NFTA_LOG_SNAPLEN, NFTA_LOG_QTHRESHOLD, NFTA_LOG_LEVEL, NFTA_LOG_FLAGS, __NFTA_LOG_MAX }; #define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1) /** * enum nft_log_level - nf_tables log levels * * @NFT_LOGLEVEL_EMERG: system is unusable * @NFT_LOGLEVEL_ALERT: action must be taken immediately * @NFT_LOGLEVEL_CRIT: critical conditions * @NFT_LOGLEVEL_ERR: error conditions * @NFT_LOGLEVEL_WARNING: warning conditions * @NFT_LOGLEVEL_NOTICE: normal but significant condition * @NFT_LOGLEVEL_INFO: informational * @NFT_LOGLEVEL_DEBUG: debug-level messages * @NFT_LOGLEVEL_AUDIT: enabling audit logging */ enum nft_log_level { NFT_LOGLEVEL_EMERG, NFT_LOGLEVEL_ALERT, NFT_LOGLEVEL_CRIT, NFT_LOGLEVEL_ERR, NFT_LOGLEVEL_WARNING, NFT_LOGLEVEL_NOTICE, NFT_LOGLEVEL_INFO, NFT_LOGLEVEL_DEBUG, NFT_LOGLEVEL_AUDIT, __NFT_LOGLEVEL_MAX }; #define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX - 1) /** * enum nft_queue_attributes - nf_tables queue expression netlink attributes * * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16) * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16) * @NFTA_QUEUE_FLAGS: various flags (NLA_U16) * @NFTA_QUEUE_SREG_QNUM: source register of queue number (NLA_U32: nft_registers) */ enum nft_queue_attributes { NFTA_QUEUE_UNSPEC, NFTA_QUEUE_NUM, NFTA_QUEUE_TOTAL, NFTA_QUEUE_FLAGS, NFTA_QUEUE_SREG_QNUM, __NFTA_QUEUE_MAX }; #define NFTA_QUEUE_MAX (__NFTA_QUEUE_MAX - 1) #define NFT_QUEUE_FLAG_BYPASS 0x01 /* for compatibility with v2 */ #define NFT_QUEUE_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */ #define NFT_QUEUE_FLAG_MASK 0x03 enum nft_quota_flags { NFT_QUOTA_F_INV = (1 << 0), NFT_QUOTA_F_DEPLETED = (1 << 1), }; /** * enum nft_quota_attributes - nf_tables quota expression netlink attributes * * @NFTA_QUOTA_BYTES: quota in bytes (NLA_U16) * @NFTA_QUOTA_FLAGS: flags (NLA_U32) * @NFTA_QUOTA_CONSUMED: quota already consumed in bytes (NLA_U64) */ enum nft_quota_attributes { NFTA_QUOTA_UNSPEC, NFTA_QUOTA_BYTES, NFTA_QUOTA_FLAGS, NFTA_QUOTA_PAD, NFTA_QUOTA_CONSUMED, __NFTA_QUOTA_MAX }; #define NFTA_QUOTA_MAX (__NFTA_QUOTA_MAX - 1) /** * enum nft_secmark_attributes - nf_tables secmark object netlink attributes * * @NFTA_SECMARK_CTX: security context (NLA_STRING) */ enum nft_secmark_attributes { NFTA_SECMARK_UNSPEC, NFTA_SECMARK_CTX, __NFTA_SECMARK_MAX, }; #define NFTA_SECMARK_MAX (__NFTA_SECMARK_MAX - 1) /* Max security context length */ #define NFT_SECMARK_CTX_MAXLEN 256 /** * enum nft_reject_types - nf_tables reject expression reject types * * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable * @NFT_REJECT_TCP_RST: reject using TCP RST * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet */ enum nft_reject_types { NFT_REJECT_ICMP_UNREACH, NFT_REJECT_TCP_RST, NFT_REJECT_ICMPX_UNREACH, }; /** * enum nft_reject_code - Generic reject codes for IPv4/IPv6 * * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited * * These codes are mapped to real ICMP and ICMPv6 codes. */ enum nft_reject_inet_code { NFT_REJECT_ICMPX_NO_ROUTE = 0, NFT_REJECT_ICMPX_PORT_UNREACH, NFT_REJECT_ICMPX_HOST_UNREACH, NFT_REJECT_ICMPX_ADMIN_PROHIBITED, __NFT_REJECT_ICMPX_MAX }; #define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX - 1) /** * enum nft_reject_attributes - nf_tables reject expression netlink attributes * * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types) * @NFTA_REJECT_ICMP_CODE: ICMP code to use (NLA_U8) */ enum nft_reject_attributes { NFTA_REJECT_UNSPEC, NFTA_REJECT_TYPE, NFTA_REJECT_ICMP_CODE, __NFTA_REJECT_MAX }; #define NFTA_REJECT_MAX (__NFTA_REJECT_MAX - 1) /** * enum nft_nat_types - nf_tables nat expression NAT types * * @NFT_NAT_SNAT: source NAT * @NFT_NAT_DNAT: destination NAT */ enum nft_nat_types { NFT_NAT_SNAT, NFT_NAT_DNAT, }; /** * enum nft_nat_attributes - nf_tables nat expression netlink attributes * * @NFTA_NAT_TYPE: NAT type (NLA_U32: nft_nat_types) * @NFTA_NAT_FAMILY: NAT family (NLA_U32) * @NFTA_NAT_REG_ADDR_MIN: source register of address range start (NLA_U32: nft_registers) * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers) * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) */ enum nft_nat_attributes { NFTA_NAT_UNSPEC, NFTA_NAT_TYPE, NFTA_NAT_FAMILY, NFTA_NAT_REG_ADDR_MIN, NFTA_NAT_REG_ADDR_MAX, NFTA_NAT_REG_PROTO_MIN, NFTA_NAT_REG_PROTO_MAX, NFTA_NAT_FLAGS, __NFTA_NAT_MAX }; #define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1) /** * enum nft_tproxy_attributes - nf_tables tproxy expression netlink attributes * * NFTA_TPROXY_FAMILY: Target address family (NLA_U32: nft_registers) * NFTA_TPROXY_REG_ADDR: Target address register (NLA_U32: nft_registers) * NFTA_TPROXY_REG_PORT: Target port register (NLA_U32: nft_registers) */ enum nft_tproxy_attributes { NFTA_TPROXY_UNSPEC, NFTA_TPROXY_FAMILY, NFTA_TPROXY_REG_ADDR, NFTA_TPROXY_REG_PORT, __NFTA_TPROXY_MAX }; #define NFTA_TPROXY_MAX (__NFTA_TPROXY_MAX - 1) /** * enum nft_masq_attributes - nf_tables masquerade expression attributes * * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) * @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) * @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) */ enum nft_masq_attributes { NFTA_MASQ_UNSPEC, NFTA_MASQ_FLAGS, NFTA_MASQ_REG_PROTO_MIN, NFTA_MASQ_REG_PROTO_MAX, __NFTA_MASQ_MAX }; #define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1) /** * enum nft_redir_attributes - nf_tables redirect expression netlink attributes * * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) */ enum nft_redir_attributes { NFTA_REDIR_UNSPEC, NFTA_REDIR_REG_PROTO_MIN, NFTA_REDIR_REG_PROTO_MAX, NFTA_REDIR_FLAGS, __NFTA_REDIR_MAX }; #define NFTA_REDIR_MAX (__NFTA_REDIR_MAX - 1) /** * enum nft_dup_attributes - nf_tables dup expression netlink attributes * * @NFTA_DUP_SREG_ADDR: source register of address (NLA_U32: nft_registers) * @NFTA_DUP_SREG_DEV: source register of output interface (NLA_U32: nft_register) */ enum nft_dup_attributes { NFTA_DUP_UNSPEC, NFTA_DUP_SREG_ADDR, NFTA_DUP_SREG_DEV, __NFTA_DUP_MAX }; #define NFTA_DUP_MAX (__NFTA_DUP_MAX - 1) /** * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes * * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register) * @NFTA_FWD_SREG_ADDR: source register of destination address (NLA_U32: nft_register) * @NFTA_FWD_NFPROTO: layer 3 family of source register address (NLA_U32: enum nfproto) */ enum nft_fwd_attributes { NFTA_FWD_UNSPEC, NFTA_FWD_SREG_DEV, NFTA_FWD_SREG_ADDR, NFTA_FWD_NFPROTO, __NFTA_FWD_MAX }; #define NFTA_FWD_MAX (__NFTA_FWD_MAX - 1) /** * enum nft_objref_attributes - nf_tables stateful object expression netlink attributes * * @NFTA_OBJREF_IMM_TYPE: object type for immediate reference (NLA_U32: nft_register) * @NFTA_OBJREF_IMM_NAME: object name for immediate reference (NLA_STRING) * @NFTA_OBJREF_SET_SREG: source register of the data to look for (NLA_U32: nft_registers) * @NFTA_OBJREF_SET_NAME: name of the set where to look for (NLA_STRING) * @NFTA_OBJREF_SET_ID: id of the set where to look for in this transaction (NLA_U32) */ enum nft_objref_attributes { NFTA_OBJREF_UNSPEC, NFTA_OBJREF_IMM_TYPE, NFTA_OBJREF_IMM_NAME, NFTA_OBJREF_SET_SREG, NFTA_OBJREF_SET_NAME, NFTA_OBJREF_SET_ID, __NFTA_OBJREF_MAX }; #define NFTA_OBJREF_MAX (__NFTA_OBJREF_MAX - 1) /** * enum nft_gen_attributes - nf_tables ruleset generation attributes * * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32) */ enum nft_gen_attributes { NFTA_GEN_UNSPEC, NFTA_GEN_ID, NFTA_GEN_PROC_PID, NFTA_GEN_PROC_NAME, __NFTA_GEN_MAX }; #define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1) /* * enum nft_fib_attributes - nf_tables fib expression netlink attributes * * @NFTA_FIB_DREG: destination register (NLA_U32) * @NFTA_FIB_RESULT: desired result (NLA_U32) * @NFTA_FIB_FLAGS: flowi fields to initialize when querying the FIB (NLA_U32) * * The FIB expression performs a route lookup according * to the packet data. */ enum nft_fib_attributes { NFTA_FIB_UNSPEC, NFTA_FIB_DREG, NFTA_FIB_RESULT, NFTA_FIB_FLAGS, __NFTA_FIB_MAX }; #define NFTA_FIB_MAX (__NFTA_FIB_MAX - 1) enum nft_fib_result { NFT_FIB_RESULT_UNSPEC, NFT_FIB_RESULT_OIF, NFT_FIB_RESULT_OIFNAME, NFT_FIB_RESULT_ADDRTYPE, __NFT_FIB_RESULT_MAX }; #define NFT_FIB_RESULT_MAX (__NFT_FIB_RESULT_MAX - 1) enum nft_fib_flags { NFTA_FIB_F_SADDR = 1 << 0, /* look up src */ NFTA_FIB_F_DADDR = 1 << 1, /* look up dst */ NFTA_FIB_F_MARK = 1 << 2, /* use skb->mark */ NFTA_FIB_F_IIF = 1 << 3, /* restrict to iif */ NFTA_FIB_F_OIF = 1 << 4, /* restrict to oif */ NFTA_FIB_F_PRESENT = 1 << 5, /* check existence only */ }; enum nft_ct_helper_attributes { NFTA_CT_HELPER_UNSPEC, NFTA_CT_HELPER_NAME, NFTA_CT_HELPER_L3PROTO, NFTA_CT_HELPER_L4PROTO, __NFTA_CT_HELPER_MAX, }; #define NFTA_CT_HELPER_MAX (__NFTA_CT_HELPER_MAX - 1) #define NFT_OBJECT_UNSPEC 0 #define NFT_OBJECT_COUNTER 1 #define NFT_OBJECT_QUOTA 2 #define NFT_OBJECT_CT_HELPER 3 #define NFT_OBJECT_LIMIT 4 #define NFT_OBJECT_CONNLIMIT 5 #define NFT_OBJECT_TUNNEL 6 #define NFT_OBJECT_CT_TIMEOUT 7 #define NFT_OBJECT_SECMARK 8 #define __NFT_OBJECT_MAX 9 #define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1) /** * enum nft_object_attributes - nf_tables stateful object netlink attributes * * @NFTA_OBJ_TABLE: name of the table containing the expression (NLA_STRING) * @NFTA_OBJ_NAME: name of this expression type (NLA_STRING) * @NFTA_OBJ_TYPE: stateful object type (NLA_U32) * @NFTA_OBJ_DATA: stateful object data (NLA_NESTED) * @NFTA_OBJ_USE: number of references to this expression (NLA_U32) * @NFTA_OBJ_HANDLE: object handle (NLA_U64) */ enum nft_object_attributes { NFTA_OBJ_UNSPEC, NFTA_OBJ_TABLE, NFTA_OBJ_NAME, NFTA_OBJ_TYPE, NFTA_OBJ_DATA, NFTA_OBJ_USE, NFTA_OBJ_HANDLE, NFTA_OBJ_PAD, __NFTA_OBJ_MAX }; #define NFTA_OBJ_MAX (__NFTA_OBJ_MAX - 1) /** * enum nft_flowtable_flags - nf_tables flowtable flags * * @NFT_FLOWTABLE_HW_OFFLOAD: flowtable hardware offload is enabled * @NFT_FLOWTABLE_COUNTER: enable flow counters */ enum nft_flowtable_flags { NFT_FLOWTABLE_HW_OFFLOAD = 0x1, NFT_FLOWTABLE_COUNTER = 0x2, NFT_FLOWTABLE_MASK = (NFT_FLOWTABLE_HW_OFFLOAD | NFT_FLOWTABLE_COUNTER) }; /** * enum nft_flowtable_attributes - nf_tables flow table netlink attributes * * @NFTA_FLOWTABLE_TABLE: name of the table containing the expression (NLA_STRING) * @NFTA_FLOWTABLE_NAME: name of this flow table (NLA_STRING) * @NFTA_FLOWTABLE_HOOK: netfilter hook configuration(NLA_U32) * @NFTA_FLOWTABLE_USE: number of references to this flow table (NLA_U32) * @NFTA_FLOWTABLE_HANDLE: object handle (NLA_U64) * @NFTA_FLOWTABLE_FLAGS: flags (NLA_U32) */ enum nft_flowtable_attributes { NFTA_FLOWTABLE_UNSPEC, NFTA_FLOWTABLE_TABLE, NFTA_FLOWTABLE_NAME, NFTA_FLOWTABLE_HOOK, NFTA_FLOWTABLE_USE, NFTA_FLOWTABLE_HANDLE, NFTA_FLOWTABLE_PAD, NFTA_FLOWTABLE_FLAGS, __NFTA_FLOWTABLE_MAX }; #define NFTA_FLOWTABLE_MAX (__NFTA_FLOWTABLE_MAX - 1) /** * enum nft_flowtable_hook_attributes - nf_tables flow table hook netlink attributes * * @NFTA_FLOWTABLE_HOOK_NUM: netfilter hook number (NLA_U32) * @NFTA_FLOWTABLE_HOOK_PRIORITY: netfilter hook priority (NLA_U32) * @NFTA_FLOWTABLE_HOOK_DEVS: input devices this flow table is bound to (NLA_NESTED) */ enum nft_flowtable_hook_attributes { NFTA_FLOWTABLE_HOOK_UNSPEC, NFTA_FLOWTABLE_HOOK_NUM, NFTA_FLOWTABLE_HOOK_PRIORITY, NFTA_FLOWTABLE_HOOK_DEVS, __NFTA_FLOWTABLE_HOOK_MAX }; #define NFTA_FLOWTABLE_HOOK_MAX (__NFTA_FLOWTABLE_HOOK_MAX - 1) /** * enum nft_device_attributes - nf_tables device netlink attributes * * @NFTA_DEVICE_NAME: name of this device (NLA_STRING) */ enum nft_devices_attributes { NFTA_DEVICE_UNSPEC, NFTA_DEVICE_NAME, __NFTA_DEVICE_MAX }; #define NFTA_DEVICE_MAX (__NFTA_DEVICE_MAX - 1) /* * enum nft_xfrm_attributes - nf_tables xfrm expr netlink attributes * * @NFTA_XFRM_DREG: destination register (NLA_U32) * @NFTA_XFRM_KEY: enum nft_xfrm_keys (NLA_U32) * @NFTA_XFRM_DIR: direction (NLA_U8) * @NFTA_XFRM_SPNUM: index in secpath array (NLA_U32) */ enum nft_xfrm_attributes { NFTA_XFRM_UNSPEC, NFTA_XFRM_DREG, NFTA_XFRM_KEY, NFTA_XFRM_DIR, NFTA_XFRM_SPNUM, __NFTA_XFRM_MAX }; #define NFTA_XFRM_MAX (__NFTA_XFRM_MAX - 1) enum nft_xfrm_keys { NFT_XFRM_KEY_UNSPEC, NFT_XFRM_KEY_DADDR_IP4, NFT_XFRM_KEY_DADDR_IP6, NFT_XFRM_KEY_SADDR_IP4, NFT_XFRM_KEY_SADDR_IP6, NFT_XFRM_KEY_REQID, NFT_XFRM_KEY_SPI, __NFT_XFRM_KEY_MAX, }; #define NFT_XFRM_KEY_MAX (__NFT_XFRM_KEY_MAX - 1) /** * enum nft_trace_attributes - nf_tables trace netlink attributes * * @NFTA_TRACE_TABLE: name of the table (NLA_STRING) * @NFTA_TRACE_CHAIN: name of the chain (NLA_STRING) * @NFTA_TRACE_RULE_HANDLE: numeric handle of the rule (NLA_U64) * @NFTA_TRACE_TYPE: type of the event (NLA_U32: nft_trace_types) * @NFTA_TRACE_VERDICT: verdict returned by hook (NLA_NESTED: nft_verdicts) * @NFTA_TRACE_ID: pseudo-id, same for each skb traced (NLA_U32) * @NFTA_TRACE_LL_HEADER: linklayer header (NLA_BINARY) * @NFTA_TRACE_NETWORK_HEADER: network header (NLA_BINARY) * @NFTA_TRACE_TRANSPORT_HEADER: transport header (NLA_BINARY) * @NFTA_TRACE_IIF: indev ifindex (NLA_U32) * @NFTA_TRACE_IIFTYPE: netdev->type of indev (NLA_U16) * @NFTA_TRACE_OIF: outdev ifindex (NLA_U32) * @NFTA_TRACE_OIFTYPE: netdev->type of outdev (NLA_U16) * @NFTA_TRACE_MARK: nfmark (NLA_U32) * @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32) * @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32) */ enum nft_trace_attributes { NFTA_TRACE_UNSPEC, NFTA_TRACE_TABLE, NFTA_TRACE_CHAIN, NFTA_TRACE_RULE_HANDLE, NFTA_TRACE_TYPE, NFTA_TRACE_VERDICT, NFTA_TRACE_ID, NFTA_TRACE_LL_HEADER, NFTA_TRACE_NETWORK_HEADER, NFTA_TRACE_TRANSPORT_HEADER, NFTA_TRACE_IIF, NFTA_TRACE_IIFTYPE, NFTA_TRACE_OIF, NFTA_TRACE_OIFTYPE, NFTA_TRACE_MARK, NFTA_TRACE_NFPROTO, NFTA_TRACE_POLICY, NFTA_TRACE_PAD, __NFTA_TRACE_MAX }; #define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1) enum nft_trace_types { NFT_TRACETYPE_UNSPEC, NFT_TRACETYPE_POLICY, NFT_TRACETYPE_RETURN, NFT_TRACETYPE_RULE, __NFT_TRACETYPE_MAX }; #define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1) /** * enum nft_ng_attributes - nf_tables number generator expression netlink attributes * * @NFTA_NG_DREG: destination register (NLA_U32) * @NFTA_NG_MODULUS: maximum counter value (NLA_U32) * @NFTA_NG_TYPE: operation type (NLA_U32) * @NFTA_NG_OFFSET: offset to be added to the counter (NLA_U32) * @NFTA_NG_SET_NAME: name of the map to lookup (NLA_STRING) * @NFTA_NG_SET_ID: id of the map (NLA_U32) */ enum nft_ng_attributes { NFTA_NG_UNSPEC, NFTA_NG_DREG, NFTA_NG_MODULUS, NFTA_NG_TYPE, NFTA_NG_OFFSET, NFTA_NG_SET_NAME, /* deprecated */ NFTA_NG_SET_ID, /* deprecated */ __NFTA_NG_MAX }; #define NFTA_NG_MAX (__NFTA_NG_MAX - 1) enum nft_ng_types { NFT_NG_INCREMENTAL, NFT_NG_RANDOM, __NFT_NG_MAX }; #define NFT_NG_MAX (__NFT_NG_MAX - 1) #endif /* _LINUX_NF_TABLES_H */ linux/netfilter/nf_tables_compat.h 0000644 00000001333 15063602052 0013347 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFT_COMPAT_NFNETLINK_H_ #define _NFT_COMPAT_NFNETLINK_H_ enum nft_target_attributes { NFTA_TARGET_UNSPEC, NFTA_TARGET_NAME, NFTA_TARGET_REV, NFTA_TARGET_INFO, __NFTA_TARGET_MAX }; #define NFTA_TARGET_MAX (__NFTA_TARGET_MAX - 1) enum nft_match_attributes { NFTA_MATCH_UNSPEC, NFTA_MATCH_NAME, NFTA_MATCH_REV, NFTA_MATCH_INFO, __NFTA_MATCH_MAX }; #define NFTA_MATCH_MAX (__NFTA_MATCH_MAX - 1) #define NFT_COMPAT_NAME_MAX 32 enum { NFNL_MSG_COMPAT_GET, NFNL_MSG_COMPAT_MAX }; enum { NFTA_COMPAT_UNSPEC = 0, NFTA_COMPAT_NAME, NFTA_COMPAT_REV, NFTA_COMPAT_TYPE, __NFTA_COMPAT_MAX, }; #define NFTA_COMPAT_MAX (__NFTA_COMPAT_MAX - 1) #endif linux/netfilter/nfnetlink.h 0000644 00000004574 15063602052 0012051 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_H #define _NFNETLINK_H #include <linux/types.h> #include <linux/netfilter/nfnetlink_compat.h> enum nfnetlink_groups { NFNLGRP_NONE, #define NFNLGRP_NONE NFNLGRP_NONE NFNLGRP_CONNTRACK_NEW, #define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_UPDATE, #define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_DESTROY, #define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_EXP_NEW, #define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_UPDATE, #define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_DESTROY, #define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_NFTABLES, #define NFNLGRP_NFTABLES NFNLGRP_NFTABLES NFNLGRP_ACCT_QUOTA, #define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA NFNLGRP_NFTRACE, #define NFNLGRP_NFTRACE NFNLGRP_NFTRACE __NFNLGRP_MAX, }; #define NFNLGRP_MAX (__NFNLGRP_MAX - 1) /* General form of address family dependent message. */ struct nfgenmsg { __u8 nfgen_family; /* AF_xxx */ __u8 version; /* nfnetlink version */ __be16 res_id; /* resource id */ }; #define NFNETLINK_V0 0 /* netfilter netlink message types are split in two pieces: * 8 bit subsystem, 8bit operation. */ #define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) #define NFNL_MSG_TYPE(x) (x & 0x00ff) /* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS() * won't work anymore */ #define NFNL_SUBSYS_NONE 0 #define NFNL_SUBSYS_CTNETLINK 1 #define NFNL_SUBSYS_CTNETLINK_EXP 2 #define NFNL_SUBSYS_QUEUE 3 #define NFNL_SUBSYS_ULOG 4 #define NFNL_SUBSYS_OSF 5 #define NFNL_SUBSYS_IPSET 6 #define NFNL_SUBSYS_ACCT 7 #define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8 #define NFNL_SUBSYS_CTHELPER 9 #define NFNL_SUBSYS_NFTABLES 10 #define NFNL_SUBSYS_NFT_COMPAT 11 #define NFNL_SUBSYS_COUNT 12 /* Reserved control nfnetlink messages */ #define NFNL_MSG_BATCH_BEGIN NLMSG_MIN_TYPE #define NFNL_MSG_BATCH_END NLMSG_MIN_TYPE+1 /** * enum nfnl_batch_attributes - nfnetlink batch netlink attributes * * @NFNL_BATCH_GENID: generation ID for this changeset (NLA_U32) */ enum nfnl_batch_attributes { NFNL_BATCH_UNSPEC, NFNL_BATCH_GENID, __NFNL_BATCH_MAX }; #define NFNL_BATCH_MAX (__NFNL_BATCH_MAX - 1) #endif /* _NFNETLINK_H */ linux/netfilter/nfnetlink_acct.h 0000644 00000001604 15063602052 0013032 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNL_ACCT_H_ #define _NFNL_ACCT_H_ #ifndef NFACCT_NAME_MAX #define NFACCT_NAME_MAX 32 #endif enum nfnl_acct_msg_types { NFNL_MSG_ACCT_NEW, NFNL_MSG_ACCT_GET, NFNL_MSG_ACCT_GET_CTRZERO, NFNL_MSG_ACCT_DEL, NFNL_MSG_ACCT_OVERQUOTA, NFNL_MSG_ACCT_MAX }; enum nfnl_acct_flags { NFACCT_F_QUOTA_PKTS = (1 << 0), NFACCT_F_QUOTA_BYTES = (1 << 1), NFACCT_F_OVERQUOTA = (1 << 2), /* can't be set from userspace */ }; enum nfnl_acct_type { NFACCT_UNSPEC, NFACCT_NAME, NFACCT_PKTS, NFACCT_BYTES, NFACCT_USE, NFACCT_FLAGS, NFACCT_QUOTA, NFACCT_FILTER, NFACCT_PAD, __NFACCT_MAX }; #define NFACCT_MAX (__NFACCT_MAX - 1) enum nfnl_attr_filter_type { NFACCT_FILTER_UNSPEC, NFACCT_FILTER_MASK, NFACCT_FILTER_VALUE, __NFACCT_FILTER_MAX }; #define NFACCT_FILTER_MAX (__NFACCT_FILTER_MAX - 1) #endif /* _NFNL_ACCT_H_ */ linux/netfilter/nfnetlink_compat.h 0000644 00000004614 15063602052 0013407 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_COMPAT_H #define _NFNETLINK_COMPAT_H #include <linux/types.h> /* Old nfnetlink macros for userspace */ /* nfnetlink groups: Up to 32 maximum */ #define NF_NETLINK_CONNTRACK_NEW 0x00000001 #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 #define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 #define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 #define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 #define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 /* Generic structure for encapsulation optional netfilter information. * It is reminiscent of sockaddr, but with sa_family replaced * with attribute type. * ! This should someday be put somewhere generic as now rtnetlink and * ! nfnetlink use the same attributes methods. - J. Schulist. */ struct nfattr { __u16 nfa_len; __u16 nfa_type; /* we use 15 bits for the type, and the highest * bit to indicate whether the payload is nested */ }; /* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from * rtnetlink.h, it's time to put this in a generic file */ #define NFNL_NFA_NEST 0x8000 #define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) #define NFA_ALIGNTO 4 #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ && (nfa)->nfa_len <= (len)) #define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) #define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) #define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) #define NFA_NEST(skb, type) \ ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ __start; }) #define NFA_NEST_END(skb, start) \ ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ (skb)->len; }) #define NFA_NEST_CANCEL(skb, start) \ ({ if (start) \ skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ -1; }) #define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) #define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) #endif /* _NFNETLINK_COMPAT_H */ linux/netfilter/nfnetlink_conntrack.h 0000644 00000014020 15063602052 0014076 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPCONNTRACK_NETLINK_H #define _IPCONNTRACK_NETLINK_H #include <linux/netfilter/nfnetlink.h> enum cntl_msg_types { IPCTNL_MSG_CT_NEW, IPCTNL_MSG_CT_GET, IPCTNL_MSG_CT_DELETE, IPCTNL_MSG_CT_GET_CTRZERO, IPCTNL_MSG_CT_GET_STATS_CPU, IPCTNL_MSG_CT_GET_STATS, IPCTNL_MSG_CT_GET_DYING, IPCTNL_MSG_CT_GET_UNCONFIRMED, IPCTNL_MSG_MAX }; enum ctnl_exp_msg_types { IPCTNL_MSG_EXP_NEW, IPCTNL_MSG_EXP_GET, IPCTNL_MSG_EXP_DELETE, IPCTNL_MSG_EXP_GET_STATS_CPU, IPCTNL_MSG_EXP_MAX }; enum ctattr_type { CTA_UNSPEC, CTA_TUPLE_ORIG, CTA_TUPLE_REPLY, CTA_STATUS, CTA_PROTOINFO, CTA_HELP, CTA_NAT_SRC, #define CTA_NAT CTA_NAT_SRC /* backwards compatibility */ CTA_TIMEOUT, CTA_MARK, CTA_COUNTERS_ORIG, CTA_COUNTERS_REPLY, CTA_USE, CTA_ID, CTA_NAT_DST, CTA_TUPLE_MASTER, CTA_SEQ_ADJ_ORIG, CTA_NAT_SEQ_ADJ_ORIG = CTA_SEQ_ADJ_ORIG, CTA_SEQ_ADJ_REPLY, CTA_NAT_SEQ_ADJ_REPLY = CTA_SEQ_ADJ_REPLY, CTA_SECMARK, /* obsolete */ CTA_ZONE, CTA_SECCTX, CTA_TIMESTAMP, CTA_MARK_MASK, CTA_LABELS, CTA_LABELS_MASK, CTA_SYNPROXY, CTA_FILTER, CTA_STATUS_MASK, __CTA_MAX }; #define CTA_MAX (__CTA_MAX - 1) enum ctattr_tuple { CTA_TUPLE_UNSPEC, CTA_TUPLE_IP, CTA_TUPLE_PROTO, CTA_TUPLE_ZONE, __CTA_TUPLE_MAX }; #define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1) enum ctattr_ip { CTA_IP_UNSPEC, CTA_IP_V4_SRC, CTA_IP_V4_DST, CTA_IP_V6_SRC, CTA_IP_V6_DST, __CTA_IP_MAX }; #define CTA_IP_MAX (__CTA_IP_MAX - 1) enum ctattr_l4proto { CTA_PROTO_UNSPEC, CTA_PROTO_NUM, CTA_PROTO_SRC_PORT, CTA_PROTO_DST_PORT, CTA_PROTO_ICMP_ID, CTA_PROTO_ICMP_TYPE, CTA_PROTO_ICMP_CODE, CTA_PROTO_ICMPV6_ID, CTA_PROTO_ICMPV6_TYPE, CTA_PROTO_ICMPV6_CODE, __CTA_PROTO_MAX }; #define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) enum ctattr_protoinfo { CTA_PROTOINFO_UNSPEC, CTA_PROTOINFO_TCP, CTA_PROTOINFO_DCCP, CTA_PROTOINFO_SCTP, __CTA_PROTOINFO_MAX }; #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) enum ctattr_protoinfo_tcp { CTA_PROTOINFO_TCP_UNSPEC, CTA_PROTOINFO_TCP_STATE, CTA_PROTOINFO_TCP_WSCALE_ORIGINAL, CTA_PROTOINFO_TCP_WSCALE_REPLY, CTA_PROTOINFO_TCP_FLAGS_ORIGINAL, CTA_PROTOINFO_TCP_FLAGS_REPLY, __CTA_PROTOINFO_TCP_MAX }; #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) enum ctattr_protoinfo_dccp { CTA_PROTOINFO_DCCP_UNSPEC, CTA_PROTOINFO_DCCP_STATE, CTA_PROTOINFO_DCCP_ROLE, CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ, CTA_PROTOINFO_DCCP_PAD, __CTA_PROTOINFO_DCCP_MAX, }; #define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) enum ctattr_protoinfo_sctp { CTA_PROTOINFO_SCTP_UNSPEC, CTA_PROTOINFO_SCTP_STATE, CTA_PROTOINFO_SCTP_VTAG_ORIGINAL, CTA_PROTOINFO_SCTP_VTAG_REPLY, __CTA_PROTOINFO_SCTP_MAX }; #define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1) enum ctattr_counters { CTA_COUNTERS_UNSPEC, CTA_COUNTERS_PACKETS, /* 64bit counters */ CTA_COUNTERS_BYTES, /* 64bit counters */ CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */ CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */ CTA_COUNTERS_PAD, __CTA_COUNTERS_MAX }; #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) enum ctattr_tstamp { CTA_TIMESTAMP_UNSPEC, CTA_TIMESTAMP_START, CTA_TIMESTAMP_STOP, CTA_TIMESTAMP_PAD, __CTA_TIMESTAMP_MAX }; #define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1) enum ctattr_nat { CTA_NAT_UNSPEC, CTA_NAT_V4_MINIP, #define CTA_NAT_MINIP CTA_NAT_V4_MINIP CTA_NAT_V4_MAXIP, #define CTA_NAT_MAXIP CTA_NAT_V4_MAXIP CTA_NAT_PROTO, CTA_NAT_V6_MINIP, CTA_NAT_V6_MAXIP, __CTA_NAT_MAX }; #define CTA_NAT_MAX (__CTA_NAT_MAX - 1) enum ctattr_protonat { CTA_PROTONAT_UNSPEC, CTA_PROTONAT_PORT_MIN, CTA_PROTONAT_PORT_MAX, __CTA_PROTONAT_MAX }; #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) enum ctattr_seqadj { CTA_SEQADJ_UNSPEC, CTA_SEQADJ_CORRECTION_POS, CTA_SEQADJ_OFFSET_BEFORE, CTA_SEQADJ_OFFSET_AFTER, __CTA_SEQADJ_MAX }; #define CTA_SEQADJ_MAX (__CTA_SEQADJ_MAX - 1) enum ctattr_natseq { CTA_NAT_SEQ_UNSPEC, CTA_NAT_SEQ_CORRECTION_POS, CTA_NAT_SEQ_OFFSET_BEFORE, CTA_NAT_SEQ_OFFSET_AFTER, __CTA_NAT_SEQ_MAX }; #define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) enum ctattr_synproxy { CTA_SYNPROXY_UNSPEC, CTA_SYNPROXY_ISN, CTA_SYNPROXY_ITS, CTA_SYNPROXY_TSOFF, __CTA_SYNPROXY_MAX, }; #define CTA_SYNPROXY_MAX (__CTA_SYNPROXY_MAX - 1) enum ctattr_expect { CTA_EXPECT_UNSPEC, CTA_EXPECT_MASTER, CTA_EXPECT_TUPLE, CTA_EXPECT_MASK, CTA_EXPECT_TIMEOUT, CTA_EXPECT_ID, CTA_EXPECT_HELP_NAME, CTA_EXPECT_ZONE, CTA_EXPECT_FLAGS, CTA_EXPECT_CLASS, CTA_EXPECT_NAT, CTA_EXPECT_FN, __CTA_EXPECT_MAX }; #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) enum ctattr_expect_nat { CTA_EXPECT_NAT_UNSPEC, CTA_EXPECT_NAT_DIR, CTA_EXPECT_NAT_TUPLE, __CTA_EXPECT_NAT_MAX }; #define CTA_EXPECT_NAT_MAX (__CTA_EXPECT_NAT_MAX - 1) enum ctattr_help { CTA_HELP_UNSPEC, CTA_HELP_NAME, CTA_HELP_INFO, __CTA_HELP_MAX }; #define CTA_HELP_MAX (__CTA_HELP_MAX - 1) enum ctattr_secctx { CTA_SECCTX_UNSPEC, CTA_SECCTX_NAME, __CTA_SECCTX_MAX }; #define CTA_SECCTX_MAX (__CTA_SECCTX_MAX - 1) enum ctattr_stats_cpu { CTA_STATS_UNSPEC, CTA_STATS_SEARCHED, /* no longer used */ CTA_STATS_FOUND, CTA_STATS_NEW, /* no longer used */ CTA_STATS_INVALID, CTA_STATS_IGNORE, /* no longer used */ CTA_STATS_DELETE, /* no longer used */ CTA_STATS_DELETE_LIST, /* no longer used */ CTA_STATS_INSERT, CTA_STATS_INSERT_FAILED, CTA_STATS_DROP, CTA_STATS_EARLY_DROP, CTA_STATS_ERROR, CTA_STATS_SEARCH_RESTART, CTA_STATS_CLASH_RESOLVE, __CTA_STATS_MAX, }; #define CTA_STATS_MAX (__CTA_STATS_MAX - 1) enum ctattr_stats_global { CTA_STATS_GLOBAL_UNSPEC, CTA_STATS_GLOBAL_ENTRIES, CTA_STATS_GLOBAL_MAX_ENTRIES, __CTA_STATS_GLOBAL_MAX, }; #define CTA_STATS_GLOBAL_MAX (__CTA_STATS_GLOBAL_MAX - 1) enum ctattr_expect_stats { CTA_STATS_EXP_UNSPEC, CTA_STATS_EXP_NEW, CTA_STATS_EXP_CREATE, CTA_STATS_EXP_DELETE, __CTA_STATS_EXP_MAX, }; #define CTA_STATS_EXP_MAX (__CTA_STATS_EXP_MAX - 1) enum ctattr_filter { CTA_FILTER_UNSPEC, CTA_FILTER_ORIG_FLAGS, CTA_FILTER_REPLY_FLAGS, __CTA_FILTER_MAX }; #define CTA_FILTER_MAX (__CTA_FILTER_MAX - 1) #endif /* _IPCONNTRACK_NETLINK_H */ linux/netfilter/nfnetlink_cthelper.h 0000644 00000002262 15063602052 0013727 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNL_CTHELPER_H_ #define _NFNL_CTHELPER_H_ #define NFCT_HELPER_STATUS_DISABLED 0 #define NFCT_HELPER_STATUS_ENABLED 1 enum nfnl_acct_msg_types { NFNL_MSG_CTHELPER_NEW, NFNL_MSG_CTHELPER_GET, NFNL_MSG_CTHELPER_DEL, NFNL_MSG_CTHELPER_MAX }; enum nfnl_cthelper_type { NFCTH_UNSPEC, NFCTH_NAME, NFCTH_TUPLE, NFCTH_QUEUE_NUM, NFCTH_POLICY, NFCTH_PRIV_DATA_LEN, NFCTH_STATUS, __NFCTH_MAX }; #define NFCTH_MAX (__NFCTH_MAX - 1) enum nfnl_cthelper_policy_type { NFCTH_POLICY_SET_UNSPEC, NFCTH_POLICY_SET_NUM, NFCTH_POLICY_SET, NFCTH_POLICY_SET1 = NFCTH_POLICY_SET, NFCTH_POLICY_SET2, NFCTH_POLICY_SET3, NFCTH_POLICY_SET4, __NFCTH_POLICY_SET_MAX }; #define NFCTH_POLICY_SET_MAX (__NFCTH_POLICY_SET_MAX - 1) enum nfnl_cthelper_pol_type { NFCTH_POLICY_UNSPEC, NFCTH_POLICY_NAME, NFCTH_POLICY_EXPECT_MAX, NFCTH_POLICY_EXPECT_TIMEOUT, __NFCTH_POLICY_MAX }; #define NFCTH_POLICY_MAX (__NFCTH_POLICY_MAX - 1) enum nfnl_cthelper_tuple_type { NFCTH_TUPLE_UNSPEC, NFCTH_TUPLE_L3PROTONUM, NFCTH_TUPLE_L4PROTONUM, __NFCTH_TUPLE_MAX, }; #define NFCTH_TUPLE_MAX (__NFCTH_TUPLE_MAX - 1) #endif /* _NFNL_CTHELPER_H */ linux/netfilter/nfnetlink_cttimeout.h 0000644 00000005562 15063602052 0014144 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _CTTIMEOUT_NETLINK_H #define _CTTIMEOUT_NETLINK_H #include <linux/netfilter/nfnetlink.h> enum ctnl_timeout_msg_types { IPCTNL_MSG_TIMEOUT_NEW, IPCTNL_MSG_TIMEOUT_GET, IPCTNL_MSG_TIMEOUT_DELETE, IPCTNL_MSG_TIMEOUT_DEFAULT_SET, IPCTNL_MSG_TIMEOUT_DEFAULT_GET, IPCTNL_MSG_TIMEOUT_MAX }; enum ctattr_timeout { CTA_TIMEOUT_UNSPEC, CTA_TIMEOUT_NAME, CTA_TIMEOUT_L3PROTO, CTA_TIMEOUT_L4PROTO, CTA_TIMEOUT_DATA, CTA_TIMEOUT_USE, __CTA_TIMEOUT_MAX }; #define CTA_TIMEOUT_MAX (__CTA_TIMEOUT_MAX - 1) enum ctattr_timeout_generic { CTA_TIMEOUT_GENERIC_UNSPEC, CTA_TIMEOUT_GENERIC_TIMEOUT, __CTA_TIMEOUT_GENERIC_MAX }; #define CTA_TIMEOUT_GENERIC_MAX (__CTA_TIMEOUT_GENERIC_MAX - 1) enum ctattr_timeout_tcp { CTA_TIMEOUT_TCP_UNSPEC, CTA_TIMEOUT_TCP_SYN_SENT, CTA_TIMEOUT_TCP_SYN_RECV, CTA_TIMEOUT_TCP_ESTABLISHED, CTA_TIMEOUT_TCP_FIN_WAIT, CTA_TIMEOUT_TCP_CLOSE_WAIT, CTA_TIMEOUT_TCP_LAST_ACK, CTA_TIMEOUT_TCP_TIME_WAIT, CTA_TIMEOUT_TCP_CLOSE, CTA_TIMEOUT_TCP_SYN_SENT2, CTA_TIMEOUT_TCP_RETRANS, CTA_TIMEOUT_TCP_UNACK, __CTA_TIMEOUT_TCP_MAX }; #define CTA_TIMEOUT_TCP_MAX (__CTA_TIMEOUT_TCP_MAX - 1) enum ctattr_timeout_udp { CTA_TIMEOUT_UDP_UNSPEC, CTA_TIMEOUT_UDP_UNREPLIED, CTA_TIMEOUT_UDP_REPLIED, __CTA_TIMEOUT_UDP_MAX }; #define CTA_TIMEOUT_UDP_MAX (__CTA_TIMEOUT_UDP_MAX - 1) enum ctattr_timeout_udplite { CTA_TIMEOUT_UDPLITE_UNSPEC, CTA_TIMEOUT_UDPLITE_UNREPLIED, CTA_TIMEOUT_UDPLITE_REPLIED, __CTA_TIMEOUT_UDPLITE_MAX }; #define CTA_TIMEOUT_UDPLITE_MAX (__CTA_TIMEOUT_UDPLITE_MAX - 1) enum ctattr_timeout_icmp { CTA_TIMEOUT_ICMP_UNSPEC, CTA_TIMEOUT_ICMP_TIMEOUT, __CTA_TIMEOUT_ICMP_MAX }; #define CTA_TIMEOUT_ICMP_MAX (__CTA_TIMEOUT_ICMP_MAX - 1) enum ctattr_timeout_dccp { CTA_TIMEOUT_DCCP_UNSPEC, CTA_TIMEOUT_DCCP_REQUEST, CTA_TIMEOUT_DCCP_RESPOND, CTA_TIMEOUT_DCCP_PARTOPEN, CTA_TIMEOUT_DCCP_OPEN, CTA_TIMEOUT_DCCP_CLOSEREQ, CTA_TIMEOUT_DCCP_CLOSING, CTA_TIMEOUT_DCCP_TIMEWAIT, __CTA_TIMEOUT_DCCP_MAX }; #define CTA_TIMEOUT_DCCP_MAX (__CTA_TIMEOUT_DCCP_MAX - 1) enum ctattr_timeout_sctp { CTA_TIMEOUT_SCTP_UNSPEC, CTA_TIMEOUT_SCTP_CLOSED, CTA_TIMEOUT_SCTP_COOKIE_WAIT, CTA_TIMEOUT_SCTP_COOKIE_ECHOED, CTA_TIMEOUT_SCTP_ESTABLISHED, CTA_TIMEOUT_SCTP_SHUTDOWN_SENT, CTA_TIMEOUT_SCTP_SHUTDOWN_RECD, CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT, CTA_TIMEOUT_SCTP_HEARTBEAT_SENT, CTA_TIMEOUT_SCTP_HEARTBEAT_ACKED, __CTA_TIMEOUT_SCTP_MAX }; #define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1) enum ctattr_timeout_icmpv6 { CTA_TIMEOUT_ICMPV6_UNSPEC, CTA_TIMEOUT_ICMPV6_TIMEOUT, __CTA_TIMEOUT_ICMPV6_MAX }; #define CTA_TIMEOUT_ICMPV6_MAX (__CTA_TIMEOUT_ICMPV6_MAX - 1) enum ctattr_timeout_gre { CTA_TIMEOUT_GRE_UNSPEC, CTA_TIMEOUT_GRE_UNREPLIED, CTA_TIMEOUT_GRE_REPLIED, __CTA_TIMEOUT_GRE_MAX }; #define CTA_TIMEOUT_GRE_MAX (__CTA_TIMEOUT_GRE_MAX - 1) #define CTNL_TIMEOUT_NAME_MAX 32 #endif linux/netfilter/nfnetlink_log.h 0000644 00000005357 15063602052 0012712 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_LOG_H #define _NFNETLINK_LOG_H /* This file describes the netlink messages (i.e. 'protocol packets'), * and not any kind of function definitions. It is shared between kernel and * userspace. Don't put kernel specific stuff in here */ #include <linux/types.h> #include <linux/netfilter/nfnetlink.h> enum nfulnl_msg_types { NFULNL_MSG_PACKET, /* packet from kernel to userspace */ NFULNL_MSG_CONFIG, /* connect to a particular queue */ NFULNL_MSG_MAX }; struct nfulnl_msg_packet_hdr { __be16 hw_protocol; /* hw protocol (network order) */ __u8 hook; /* netfilter hook */ __u8 _pad; }; struct nfulnl_msg_packet_hw { __be16 hw_addrlen; __u16 _pad; __u8 hw_addr[8]; }; struct nfulnl_msg_packet_timestamp { __aligned_be64 sec; __aligned_be64 usec; }; enum nfulnl_attr_type { NFULA_UNSPEC, NFULA_PACKET_HDR, NFULA_MARK, /* __u32 nfmark */ NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */ NFULA_IFINDEX_INDEV, /* __u32 ifindex */ NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */ NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ NFULA_HWADDR, /* nfulnl_msg_packet_hw */ NFULA_PAYLOAD, /* opaque data payload */ NFULA_PREFIX, /* string prefix */ NFULA_UID, /* user id of socket */ NFULA_SEQ, /* instance-local sequence number */ NFULA_SEQ_GLOBAL, /* global sequence number */ NFULA_GID, /* group id of socket */ NFULA_HWTYPE, /* hardware type */ NFULA_HWHEADER, /* hardware header */ NFULA_HWLEN, /* hardware header length */ NFULA_CT, /* nf_conntrack_netlink.h */ NFULA_CT_INFO, /* enum ip_conntrack_info */ __NFULA_MAX }; #define NFULA_MAX (__NFULA_MAX - 1) enum nfulnl_msg_config_cmds { NFULNL_CFG_CMD_NONE, NFULNL_CFG_CMD_BIND, NFULNL_CFG_CMD_UNBIND, NFULNL_CFG_CMD_PF_BIND, NFULNL_CFG_CMD_PF_UNBIND, }; struct nfulnl_msg_config_cmd { __u8 command; /* nfulnl_msg_config_cmds */ } __attribute__ ((packed)); struct nfulnl_msg_config_mode { __be32 copy_range; __u8 copy_mode; __u8 _pad; } __attribute__ ((packed)); enum nfulnl_attr_config { NFULA_CFG_UNSPEC, NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */ NFULA_CFG_MODE, /* nfulnl_msg_config_mode */ NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */ NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */ NFULA_CFG_QTHRESH, /* __u32 */ NFULA_CFG_FLAGS, /* __u16 */ __NFULA_CFG_MAX }; #define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) #define NFULNL_COPY_NONE 0x00 #define NFULNL_COPY_META 0x01 #define NFULNL_COPY_PACKET 0x02 /* 0xff is reserved, don't use it for new copy modes. */ #define NFULNL_CFG_F_SEQ 0x0001 #define NFULNL_CFG_F_SEQ_GLOBAL 0x0002 #define NFULNL_CFG_F_CONNTRACK 0x0004 #endif /* _NFNETLINK_LOG_H */ linux/netfilter/nfnetlink_queue.h 0000644 00000006653 15063602052 0013255 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NFNETLINK_QUEUE_H #define _NFNETLINK_QUEUE_H #include <linux/types.h> #include <linux/netfilter/nfnetlink.h> enum nfqnl_msg_types { NFQNL_MSG_PACKET, /* packet from kernel to userspace */ NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */ NFQNL_MSG_CONFIG, /* connect to a particular queue */ NFQNL_MSG_VERDICT_BATCH, /* batchv from userspace to kernel */ NFQNL_MSG_MAX }; struct nfqnl_msg_packet_hdr { __be32 packet_id; /* unique ID of packet in queue */ __be16 hw_protocol; /* hw protocol (network order) */ __u8 hook; /* netfilter hook */ } __attribute__ ((packed)); struct nfqnl_msg_packet_hw { __be16 hw_addrlen; __u16 _pad; __u8 hw_addr[8]; }; struct nfqnl_msg_packet_timestamp { __aligned_be64 sec; __aligned_be64 usec; }; enum nfqnl_vlan_attr { NFQA_VLAN_UNSPEC, NFQA_VLAN_PROTO, /* __be16 skb vlan_proto */ NFQA_VLAN_TCI, /* __be16 skb htons(vlan_tci) */ __NFQA_VLAN_MAX, }; #define NFQA_VLAN_MAX (__NFQA_VLAN_MAX - 1) enum nfqnl_attr_type { NFQA_UNSPEC, NFQA_PACKET_HDR, NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ NFQA_MARK, /* __u32 nfmark */ NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ NFQA_IFINDEX_INDEV, /* __u32 ifindex */ NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */ NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ NFQA_HWADDR, /* nfqnl_msg_packet_hw */ NFQA_PAYLOAD, /* opaque data payload */ NFQA_CT, /* nf_conntrack_netlink.h */ NFQA_CT_INFO, /* enum ip_conntrack_info */ NFQA_CAP_LEN, /* __u32 length of captured packet */ NFQA_SKB_INFO, /* __u32 skb meta information */ NFQA_EXP, /* nf_conntrack_netlink.h */ NFQA_UID, /* __u32 sk uid */ NFQA_GID, /* __u32 sk gid */ NFQA_SECCTX, /* security context string */ NFQA_VLAN, /* nested attribute: packet vlan info */ NFQA_L2HDR, /* full L2 header */ __NFQA_MAX }; #define NFQA_MAX (__NFQA_MAX - 1) struct nfqnl_msg_verdict_hdr { __be32 verdict; __be32 id; }; enum nfqnl_msg_config_cmds { NFQNL_CFG_CMD_NONE, NFQNL_CFG_CMD_BIND, NFQNL_CFG_CMD_UNBIND, NFQNL_CFG_CMD_PF_BIND, NFQNL_CFG_CMD_PF_UNBIND, }; struct nfqnl_msg_config_cmd { __u8 command; /* nfqnl_msg_config_cmds */ __u8 _pad; __be16 pf; /* AF_xxx for PF_[UN]BIND */ }; enum nfqnl_config_mode { NFQNL_COPY_NONE, NFQNL_COPY_META, NFQNL_COPY_PACKET, }; struct nfqnl_msg_config_params { __be32 copy_range; __u8 copy_mode; /* enum nfqnl_config_mode */ } __attribute__ ((packed)); enum nfqnl_attr_config { NFQA_CFG_UNSPEC, NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ NFQA_CFG_QUEUE_MAXLEN, /* __u32 */ NFQA_CFG_MASK, /* identify which flags to change */ NFQA_CFG_FLAGS, /* value of these flags (__u32) */ __NFQA_CFG_MAX }; #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) /* Flags for NFQA_CFG_FLAGS */ #define NFQA_CFG_F_FAIL_OPEN (1 << 0) #define NFQA_CFG_F_CONNTRACK (1 << 1) #define NFQA_CFG_F_GSO (1 << 2) #define NFQA_CFG_F_UID_GID (1 << 3) #define NFQA_CFG_F_SECCTX (1 << 4) #define NFQA_CFG_F_MAX (1 << 5) /* flags for NFQA_SKB_INFO */ /* packet appears to have wrong checksums, but they are ok */ #define NFQA_SKB_CSUMNOTREADY (1 << 0) /* packet is GSO (i.e., exceeds device mtu) */ #define NFQA_SKB_GSO (1 << 1) /* csum not validated (incoming device doesn't support hw checksum, etc.) */ #define NFQA_SKB_CSUM_NOTVERIFIED (1 << 2) #endif /* _NFNETLINK_QUEUE_H */ linux/netfilter/x_tables.h 0000644 00000010563 15063602052 0011655 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _X_TABLES_H #define _X_TABLES_H #include <linux/kernel.h> #include <linux/types.h> #define XT_FUNCTION_MAXNAMELEN 30 #define XT_EXTENSION_MAXNAMELEN 29 #define XT_TABLE_MAXNAMELEN 32 struct xt_entry_match { union { struct { __u16 match_size; /* Used by userspace */ char name[XT_EXTENSION_MAXNAMELEN]; __u8 revision; } user; struct { __u16 match_size; /* Used inside the kernel */ struct xt_match *match; } kernel; /* Total length */ __u16 match_size; } u; unsigned char data[0]; }; struct xt_entry_target { union { struct { __u16 target_size; /* Used by userspace */ char name[XT_EXTENSION_MAXNAMELEN]; __u8 revision; } user; struct { __u16 target_size; /* Used inside the kernel */ struct xt_target *target; } kernel; /* Total length */ __u16 target_size; } u; unsigned char data[0]; }; #define XT_TARGET_INIT(__name, __size) \ { \ .target.u.user = { \ .target_size = XT_ALIGN(__size), \ .name = __name, \ }, \ } struct xt_standard_target { struct xt_entry_target target; int verdict; }; struct xt_error_target { struct xt_entry_target target; char errorname[XT_FUNCTION_MAXNAMELEN]; }; /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision * kernel supports, if >= revision. */ struct xt_get_revision { char name[XT_EXTENSION_MAXNAMELEN]; __u8 revision; }; /* CONTINUE verdict for targets */ #define XT_CONTINUE 0xFFFFFFFF /* For standard target */ #define XT_RETURN (-NF_REPEAT - 1) /* this is a dummy structure to find out the alignment requirement for a struct * containing all the fundamental data types that are used in ipt_entry, * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my * personal pleasure to remove it -HW */ struct _xt_align { __u8 u8; __u16 u16; __u32 u32; __u64 u64; }; #define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align)) /* Standard return verdict, or do jump. */ #define XT_STANDARD_TARGET "" /* Error verdict. */ #define XT_ERROR_TARGET "ERROR" #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) struct xt_counters { __u64 pcnt, bcnt; /* Packet and byte counters */ }; /* The argument to IPT_SO_ADD_COUNTERS. */ struct xt_counters_info { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; unsigned int num_counters; /* The counters (actually `number' of these). */ struct xt_counters counters[0]; }; #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ /* fn returns 0 to continue iteration */ #define XT_MATCH_ITERATE(type, e, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct xt_entry_match *__m; \ \ for (__i = sizeof(type); \ __i < (e)->target_offset; \ __i += __m->u.match_size) { \ __m = (void *)e + __i; \ \ __ret = fn(__m , ## args); \ if (__ret != 0) \ break; \ } \ __ret; \ }) /* fn returns 0 to continue iteration */ #define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \ ({ \ unsigned int __i, __n; \ int __ret = 0; \ type *__entry; \ \ for (__i = 0, __n = 0; __i < (size); \ __i += __entry->next_offset, __n++) { \ __entry = (void *)(entries) + __i; \ if (__n < n) \ continue; \ \ __ret = fn(__entry , ## args); \ if (__ret != 0) \ break; \ } \ __ret; \ }) /* fn returns 0 to continue iteration */ #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) /* pos is normally a struct ipt_entry/ip6t_entry/etc. */ #define xt_entry_foreach(pos, ehead, esize) \ for ((pos) = (typeof(pos))(ehead); \ (pos) < (typeof(pos))((char *)(ehead) + (esize)); \ (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset)) /* can only be xt_entry_match, so no use of typeof here */ #define xt_ematch_foreach(pos, entry) \ for ((pos) = (struct xt_entry_match *)entry->elems; \ (pos) < (struct xt_entry_match *)((char *)(entry) + \ (entry)->target_offset); \ (pos) = (struct xt_entry_match *)((char *)(pos) + \ (pos)->u.match_size)) #endif /* _X_TABLES_H */ linux/netfilter/xt_AUDIT.h 0000644 00000001316 15063602052 0011431 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Header file for iptables xt_AUDIT target * * (C) 2010-2011 Thomas Graf <tgraf@redhat.com> * (C) 2010-2011 Red Hat, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _XT_AUDIT_TARGET_H #define _XT_AUDIT_TARGET_H #include <linux/types.h> enum { XT_AUDIT_TYPE_ACCEPT = 0, XT_AUDIT_TYPE_DROP, XT_AUDIT_TYPE_REJECT, __XT_AUDIT_TYPE_MAX, }; #define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1) struct xt_audit_info { __u8 type; /* XT_AUDIT_TYPE_* */ }; #endif /* _XT_AUDIT_TARGET_H */ linux/netfilter/xt_CHECKSUM.h 0000644 00000001063 15063602052 0011764 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Header file for iptables ipt_CHECKSUM target * * (C) 2002 by Harald Welte <laforge@gnumonks.org> * (C) 2010 Red Hat Inc * Author: Michael S. Tsirkin <mst@redhat.com> * * This software is distributed under GNU GPL v2, 1991 */ #ifndef _XT_CHECKSUM_TARGET_H #define _XT_CHECKSUM_TARGET_H #include <linux/types.h> #define XT_CHECKSUM_OP_FILL 0x01 /* fill in checksum in IP header */ struct xt_CHECKSUM_info { __u8 operation; /* bitset of operations */ }; #endif /* _XT_CHECKSUM_TARGET_H */ linux/netfilter/xt_CLASSIFY.h 0000644 00000000331 15063602052 0011774 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CLASSIFY_H #define _XT_CLASSIFY_H #include <linux/types.h> struct xt_classify_target_info { __u32 priority; }; #endif /*_XT_CLASSIFY_H */ linux/netfilter/xt_CONNMARK.h 0000644 00000000307 15063602052 0011772 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNMARK_H_target #define _XT_CONNMARK_H_target #include <linux/netfilter/xt_connmark.h> #endif /*_XT_CONNMARK_H_target*/ linux/netfilter/xt_CONNSECMARK.h 0000644 00000000455 15063602052 0012331 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNSECMARK_H_target #define _XT_CONNSECMARK_H_target #include <linux/types.h> enum { CONNSECMARK_SAVE = 1, CONNSECMARK_RESTORE, }; struct xt_connsecmark_target_info { __u8 mode; }; #endif /*_XT_CONNSECMARK_H_target */ linux/netfilter/xt_CT.h 0000644 00000001525 15063602052 0011073 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CT_H #define _XT_CT_H #include <linux/types.h> enum { XT_CT_NOTRACK = 1 << 0, XT_CT_NOTRACK_ALIAS = 1 << 1, XT_CT_ZONE_DIR_ORIG = 1 << 2, XT_CT_ZONE_DIR_REPL = 1 << 3, XT_CT_ZONE_MARK = 1 << 4, XT_CT_MASK = XT_CT_NOTRACK | XT_CT_NOTRACK_ALIAS | XT_CT_ZONE_DIR_ORIG | XT_CT_ZONE_DIR_REPL | XT_CT_ZONE_MARK, }; struct xt_ct_target_info { __u16 flags; __u16 zone; __u32 ct_events; __u32 exp_events; char helper[16]; /* Used internally by the kernel */ struct nf_conn *ct __attribute__((aligned(8))); }; struct xt_ct_target_info_v1 { __u16 flags; __u16 zone; __u32 ct_events; __u32 exp_events; char helper[16]; char timeout[32]; /* Used internally by the kernel */ struct nf_conn *ct __attribute__((aligned(8))); }; #endif /* _XT_CT_H */ linux/netfilter/xt_DSCP.h 0000644 00000001271 15063602052 0011314 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* x_tables module for setting the IPv4/IPv6 DSCP field * * (C) 2002 Harald Welte <laforge@gnumonks.org> * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com> * This software is distributed under GNU GPL v2, 1991 * * See RFC2474 for a description of the DSCP field within the IP Header. * * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp */ #ifndef _XT_DSCP_TARGET_H #define _XT_DSCP_TARGET_H #include <linux/netfilter/xt_dscp.h> #include <linux/types.h> /* target info */ struct xt_DSCP_info { __u8 dscp; }; struct xt_tos_target_info { __u8 tos_value; __u8 tos_mask; }; #endif /* _XT_DSCP_TARGET_H */ linux/netfilter/xt_HMARK.h 0000644 00000001645 15063602052 0011432 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef XT_HMARK_H_ #define XT_HMARK_H_ #include <linux/types.h> #include <linux/netfilter.h> enum { XT_HMARK_SADDR_MASK, XT_HMARK_DADDR_MASK, XT_HMARK_SPI, XT_HMARK_SPI_MASK, XT_HMARK_SPORT, XT_HMARK_DPORT, XT_HMARK_SPORT_MASK, XT_HMARK_DPORT_MASK, XT_HMARK_PROTO_MASK, XT_HMARK_RND, XT_HMARK_MODULUS, XT_HMARK_OFFSET, XT_HMARK_CT, XT_HMARK_METHOD_L3, XT_HMARK_METHOD_L3_4, }; #define XT_HMARK_FLAG(flag) (1 << flag) union hmark_ports { struct { __u16 src; __u16 dst; } p16; struct { __be16 src; __be16 dst; } b16; __u32 v32; __be32 b32; }; struct xt_hmark_info { union nf_inet_addr src_mask; union nf_inet_addr dst_mask; union hmark_ports port_mask; union hmark_ports port_set; __u32 flags; __u16 proto_mask; __u32 hashrnd; __u32 hmodulus; __u32 hoffset; /* Mark offset to start from */ }; #endif /* XT_HMARK_H_ */ linux/netfilter/xt_IDLETIMER.h 0000644 00000002561 15063602052 0012104 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/netfilter/xt_IDLETIMER.h * * Header file for Xtables timer target module. * * Copyright (C) 2004, 2010 Nokia Corporation * Written by Timo Teras <ext-timo.teras@nokia.com> * * Converted to x_tables and forward-ported to 2.6.34 * by Luciano Coelho <luciano.coelho@nokia.com> * * Contact: Luciano Coelho <luciano.coelho@nokia.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef _XT_IDLETIMER_H #define _XT_IDLETIMER_H #include <linux/types.h> #define MAX_IDLETIMER_LABEL_SIZE 28 struct idletimer_tg_info { __u32 timeout; char label[MAX_IDLETIMER_LABEL_SIZE]; /* for kernel module internal use only */ struct idletimer_tg *timer __attribute__((aligned(8))); }; #endif linux/netfilter/xt_LED.h 0000644 00000000726 15063602052 0011173 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_LED_H #define _XT_LED_H #include <linux/types.h> struct xt_led_info { char id[27]; /* Unique ID for this trigger in the LED class */ __u8 always_blink; /* Blink even if the LED is already on */ __u32 delay; /* Delay until LED is switched off after trigger */ /* Kernel data used in the module */ void *internal_data __attribute__((aligned(8))); }; #endif /* _XT_LED_H */ linux/netfilter/xt_LOG.h 0000644 00000001202 15063602052 0011176 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_LOG_H #define _XT_LOG_H /* make sure not to change this without changing nf_log.h:NF_LOG_* (!) */ #define XT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define XT_LOG_TCPOPT 0x02 /* Log TCP options */ #define XT_LOG_IPOPT 0x04 /* Log IP options */ #define XT_LOG_UID 0x08 /* Log UID owning local socket */ #define XT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ #define XT_LOG_MACDECODE 0x20 /* Decode MAC header */ #define XT_LOG_MASK 0x2f struct xt_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif /* _XT_LOG_H */ linux/netfilter/xt_MARK.h 0000644 00000000270 15063602052 0011313 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MARK_H_target #define _XT_MARK_H_target #include <linux/netfilter/xt_mark.h> #endif /*_XT_MARK_H_target */ linux/netfilter/xt_NFLOG.h 0000644 00000001054 15063602052 0011427 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_NFLOG_TARGET #define _XT_NFLOG_TARGET #include <linux/types.h> #define XT_NFLOG_DEFAULT_GROUP 0x1 #define XT_NFLOG_DEFAULT_THRESHOLD 0 #define XT_NFLOG_MASK 0x1 /* This flag indicates that 'len' field in xt_nflog_info is set*/ #define XT_NFLOG_F_COPY_LEN 0x1 struct xt_nflog_info { /* 'len' will be used iff you set XT_NFLOG_F_COPY_LEN in flags */ __u32 len; __u16 group; __u16 threshold; __u16 flags; __u16 pad; char prefix[64]; }; #endif /* _XT_NFLOG_TARGET */ linux/netfilter/xt_NFQUEUE.h 0000644 00000001413 15063602052 0011671 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* iptables module for using NFQUEUE mechanism * * (C) 2005 Harald Welte <laforge@netfilter.org> * * This software is distributed under GNU GPL v2, 1991 * */ #ifndef _XT_NFQ_TARGET_H #define _XT_NFQ_TARGET_H #include <linux/types.h> /* target info */ struct xt_NFQ_info { __u16 queuenum; }; struct xt_NFQ_info_v1 { __u16 queuenum; __u16 queues_total; }; struct xt_NFQ_info_v2 { __u16 queuenum; __u16 queues_total; __u16 bypass; }; struct xt_NFQ_info_v3 { __u16 queuenum; __u16 queues_total; __u16 flags; #define NFQ_FLAG_BYPASS 0x01 /* for compatibility with v2 */ #define NFQ_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */ #define NFQ_FLAG_MASK 0x03 }; #endif /* _XT_NFQ_TARGET_H */ linux/netfilter/xt_RATEEST.h 0000644 00000000606 15063602052 0011673 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RATEEST_TARGET_H #define _XT_RATEEST_TARGET_H #include <linux/types.h> #include <linux/if.h> struct xt_rateest_target_info { char name[IFNAMSIZ]; __s8 interval; __u8 ewma_log; /* Used internally by the kernel */ struct xt_rateest *est __attribute__((aligned(8))); }; #endif /* _XT_RATEEST_TARGET_H */ linux/netfilter/xt_SECMARK.h 0000644 00000001210 15063602052 0011641 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SECMARK_H_target #define _XT_SECMARK_H_target #include <linux/types.h> /* * This is intended for use by various security subsystems (but not * at the same time). * * 'mode' refers to the specific security subsystem which the * packets are being marked for. */ #define SECMARK_MODE_SEL 0x01 /* SELinux */ #define SECMARK_SECCTX_MAX 256 struct xt_secmark_target_info { __u8 mode; __u32 secid; char secctx[SECMARK_SECCTX_MAX]; }; struct xt_secmark_target_info_v1 { __u8 mode; char secctx[SECMARK_SECCTX_MAX]; __u32 secid; }; #endif /*_XT_SECMARK_H_target */ linux/netfilter/xt_SYNPROXY.h 0000644 00000000643 15063602052 0012100 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SYNPROXY_H #define _XT_SYNPROXY_H #include <linux/types.h> #define XT_SYNPROXY_OPT_MSS 0x01 #define XT_SYNPROXY_OPT_WSCALE 0x02 #define XT_SYNPROXY_OPT_SACK_PERM 0x04 #define XT_SYNPROXY_OPT_TIMESTAMP 0x08 #define XT_SYNPROXY_OPT_ECN 0x10 struct xt_synproxy_info { __u8 options; __u8 wscale; __u16 mss; }; #endif /* _XT_SYNPROXY_H */ linux/netfilter/xt_TCPMSS.h 0000644 00000000353 15063602052 0011574 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPMSS_H #define _XT_TCPMSS_H #include <linux/types.h> struct xt_tcpmss_info { __u16 mss; }; #define XT_TCPMSS_CLAMP_PMTU 0xffff #endif /* _XT_TCPMSS_H */ linux/netfilter/xt_TCPOPTSTRIP.h 0000644 00000000627 15063602052 0012422 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPOPTSTRIP_H #define _XT_TCPOPTSTRIP_H #include <linux/types.h> #define tcpoptstrip_set_bit(bmap, idx) \ (bmap[(idx) >> 5] |= 1U << (idx & 31)) #define tcpoptstrip_test_bit(bmap, idx) \ (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) struct xt_tcpoptstrip_target_info { __u32 strip_bmap[8]; }; #endif /* _XT_TCPOPTSTRIP_H */ linux/netfilter/xt_TEE.h 0000644 00000000515 15063602052 0011200 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TEE_TARGET_H #define _XT_TEE_TARGET_H #include <linux/netfilter.h> struct xt_tee_tginfo { union nf_inet_addr gw; char oif[16]; /* used internally by the kernel */ struct xt_tee_priv *priv __attribute__((aligned(8))); }; #endif /* _XT_TEE_TARGET_H */ linux/netfilter/xt_TPROXY.h 0000644 00000001077 15063602052 0011634 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TPROXY_H #define _XT_TPROXY_H #include <linux/types.h> #include <linux/netfilter.h> /* TPROXY target is capable of marking the packet to perform * redirection. We can get rid of that whenever we get support for * mutliple targets in the same rule. */ struct xt_tproxy_target_info { __u32 mark_mask; __u32 mark_value; __be32 laddr; __be16 lport; }; struct xt_tproxy_target_info_v1 { __u32 mark_mask; __u32 mark_value; union nf_inet_addr laddr; __be16 lport; }; #endif /* _XT_TPROXY_H */ linux/netfilter/xt_addrtype.h 0000644 00000002074 15063602052 0012401 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_ADDRTYPE_H #define _XT_ADDRTYPE_H #include <linux/types.h> enum { XT_ADDRTYPE_INVERT_SOURCE = 0x0001, XT_ADDRTYPE_INVERT_DEST = 0x0002, XT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004, XT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008, }; /* rtn_type enum values from rtnetlink.h, but shifted */ enum { XT_ADDRTYPE_UNSPEC = 1 << 0, XT_ADDRTYPE_UNICAST = 1 << 1, /* 1 << RTN_UNICAST */ XT_ADDRTYPE_LOCAL = 1 << 2, /* 1 << RTN_LOCAL, etc */ XT_ADDRTYPE_BROADCAST = 1 << 3, XT_ADDRTYPE_ANYCAST = 1 << 4, XT_ADDRTYPE_MULTICAST = 1 << 5, XT_ADDRTYPE_BLACKHOLE = 1 << 6, XT_ADDRTYPE_UNREACHABLE = 1 << 7, XT_ADDRTYPE_PROHIBIT = 1 << 8, XT_ADDRTYPE_THROW = 1 << 9, XT_ADDRTYPE_NAT = 1 << 10, XT_ADDRTYPE_XRESOLVE = 1 << 11, }; struct xt_addrtype_info_v1 { __u16 source; /* source-type mask */ __u16 dest; /* dest-type mask */ __u32 flags; }; /* revision 0 */ struct xt_addrtype_info { __u16 source; /* source-type mask */ __u16 dest; /* dest-type mask */ __u32 invert_source; __u32 invert_dest; }; #endif linux/netfilter/xt_bpf.h 0000644 00000001647 15063602052 0011341 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_BPF_H #define _XT_BPF_H #include <linux/filter.h> #include <linux/limits.h> #include <linux/types.h> #define XT_BPF_MAX_NUM_INSTR 64 #define XT_BPF_PATH_MAX (XT_BPF_MAX_NUM_INSTR * sizeof(struct sock_filter)) struct bpf_prog; struct xt_bpf_info { __u16 bpf_program_num_elem; struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; /* only used in the kernel */ struct bpf_prog *filter __attribute__((aligned(8))); }; enum xt_bpf_modes { XT_BPF_MODE_BYTECODE, XT_BPF_MODE_FD_PINNED, XT_BPF_MODE_FD_ELF, }; #define XT_BPF_MODE_PATH_PINNED XT_BPF_MODE_FD_PINNED struct xt_bpf_info_v1 { __u16 mode; __u16 bpf_program_num_elem; __s32 fd; union { struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; char path[XT_BPF_PATH_MAX]; }; /* only used in the kernel */ struct bpf_prog *filter __attribute__((aligned(8))); }; #endif /*_XT_BPF_H */ linux/netfilter/xt_cgroup.h 0000644 00000000717 15063602052 0012066 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CGROUP_H #define _XT_CGROUP_H #include <linux/types.h> #include <linux/limits.h> struct xt_cgroup_info_v0 { __u32 id; __u32 invert; }; struct xt_cgroup_info_v1 { __u8 has_path; __u8 has_classid; __u8 invert_path; __u8 invert_classid; char path[PATH_MAX]; __u32 classid; /* kernel internal data */ void *priv __attribute__((aligned(8))); }; #endif /* _XT_CGROUP_H */ linux/netfilter/xt_cluster.h 0000644 00000000566 15063602052 0012252 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CLUSTER_MATCH_H #define _XT_CLUSTER_MATCH_H #include <linux/types.h> enum xt_cluster_flags { XT_CLUSTER_F_INV = (1 << 0) }; struct xt_cluster_match_info { __u32 total_nodes; __u32 node_mask; __u32 hash_seed; __u32 flags; }; #define XT_CLUSTER_NODES_MAX 32 #endif /* _XT_CLUSTER_MATCH_H */ linux/netfilter/xt_comment.h 0000644 00000000346 15063602052 0012227 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_COMMENT_H #define _XT_COMMENT_H #define XT_MAX_COMMENT_LEN 256 struct xt_comment_info { char comment[XT_MAX_COMMENT_LEN]; }; #endif /* XT_COMMENT_H */ linux/netfilter/xt_connbytes.h 0000644 00000001101 15063602052 0012557 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNBYTES_H #define _XT_CONNBYTES_H #include <linux/types.h> enum xt_connbytes_what { XT_CONNBYTES_PKTS, XT_CONNBYTES_BYTES, XT_CONNBYTES_AVGPKT, }; enum xt_connbytes_direction { XT_CONNBYTES_DIR_ORIGINAL, XT_CONNBYTES_DIR_REPLY, XT_CONNBYTES_DIR_BOTH, }; struct xt_connbytes_info { struct { __aligned_u64 from; /* count to be matched */ __aligned_u64 to; /* count to be matched */ } count; __u8 what; /* ipt_connbytes_what */ __u8 direction; /* ipt_connbytes_direction */ }; #endif linux/netfilter/xt_connlabel.h 0000644 00000000550 15063602052 0012517 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNLABEL_H #define _XT_CONNLABEL_H #include <linux/types.h> #define XT_CONNLABEL_MAXBIT 127 enum xt_connlabel_mtopts { XT_CONNLABEL_OP_INVERT = 1 << 0, XT_CONNLABEL_OP_SET = 1 << 1, }; struct xt_connlabel_mtinfo { __u16 bit; __u16 options; }; #endif /* _XT_CONNLABEL_H */ linux/netfilter/xt_connlimit.h 0000644 00000001077 15063602052 0012563 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CONNLIMIT_H #define _XT_CONNLIMIT_H #include <linux/types.h> #include <linux/netfilter.h> struct xt_connlimit_data; enum { XT_CONNLIMIT_INVERT = 1 << 0, XT_CONNLIMIT_DADDR = 1 << 1, }; struct xt_connlimit_info { union { union nf_inet_addr mask; union { __be32 v4_mask; __be32 v6_mask[4]; }; }; unsigned int limit; /* revision 1 */ __u32 flags; /* Used internally by the kernel */ struct nf_conncount_data *data __attribute__((aligned(8))); }; #endif /* _XT_CONNLIMIT_H */ linux/netfilter/xt_connmark.h 0000644 00000001604 15063602052 0012373 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _XT_CONNMARK_H #define _XT_CONNMARK_H #include <linux/types.h> /* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> * by Henrik Nordstrom <hno@marasystems.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ enum { XT_CONNMARK_SET = 0, XT_CONNMARK_SAVE, XT_CONNMARK_RESTORE }; enum { D_SHIFT_LEFT = 0, D_SHIFT_RIGHT, }; struct xt_connmark_tginfo1 { __u32 ctmark, ctmask, nfmask; __u8 mode; }; struct xt_connmark_tginfo2 { __u32 ctmark, ctmask, nfmask; __u8 shift_dir, shift_bits, mode; }; struct xt_connmark_mtinfo1 { __u32 mark, mask; __u8 invert; }; #endif /*_XT_CONNMARK_H*/ linux/netfilter/xt_conntrack.h 0000644 00000004775 15063602052 0012561 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* Header file for kernel module to match connection tracking information. * GPL (C) 2001 Marc Boucher (marc@mbsi.ca). */ #ifndef _XT_CONNTRACK_H #define _XT_CONNTRACK_H #include <linux/types.h> #include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) #define XT_CONNTRACK_STATE_INVALID (1 << 0) #define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) #define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) #define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) /* flags, invflags: */ enum { XT_CONNTRACK_STATE = 1 << 0, XT_CONNTRACK_PROTO = 1 << 1, XT_CONNTRACK_ORIGSRC = 1 << 2, XT_CONNTRACK_ORIGDST = 1 << 3, XT_CONNTRACK_REPLSRC = 1 << 4, XT_CONNTRACK_REPLDST = 1 << 5, XT_CONNTRACK_STATUS = 1 << 6, XT_CONNTRACK_EXPIRES = 1 << 7, XT_CONNTRACK_ORIGSRC_PORT = 1 << 8, XT_CONNTRACK_ORIGDST_PORT = 1 << 9, XT_CONNTRACK_REPLSRC_PORT = 1 << 10, XT_CONNTRACK_REPLDST_PORT = 1 << 11, XT_CONNTRACK_DIRECTION = 1 << 12, XT_CONNTRACK_STATE_ALIAS = 1 << 13, }; struct xt_conntrack_mtinfo1 { union nf_inet_addr origsrc_addr, origsrc_mask; union nf_inet_addr origdst_addr, origdst_mask; union nf_inet_addr replsrc_addr, replsrc_mask; union nf_inet_addr repldst_addr, repldst_mask; __u32 expires_min, expires_max; __u16 l4proto; __be16 origsrc_port, origdst_port; __be16 replsrc_port, repldst_port; __u16 match_flags, invert_flags; __u8 state_mask, status_mask; }; struct xt_conntrack_mtinfo2 { union nf_inet_addr origsrc_addr, origsrc_mask; union nf_inet_addr origdst_addr, origdst_mask; union nf_inet_addr replsrc_addr, replsrc_mask; union nf_inet_addr repldst_addr, repldst_mask; __u32 expires_min, expires_max; __u16 l4proto; __be16 origsrc_port, origdst_port; __be16 replsrc_port, repldst_port; __u16 match_flags, invert_flags; __u16 state_mask, status_mask; }; struct xt_conntrack_mtinfo3 { union nf_inet_addr origsrc_addr, origsrc_mask; union nf_inet_addr origdst_addr, origdst_mask; union nf_inet_addr replsrc_addr, replsrc_mask; union nf_inet_addr repldst_addr, repldst_mask; __u32 expires_min, expires_max; __u16 l4proto; __u16 origsrc_port, origdst_port; __u16 replsrc_port, repldst_port; __u16 match_flags, invert_flags; __u16 state_mask, status_mask; __u16 origsrc_port_high, origdst_port_high; __u16 replsrc_port_high, repldst_port_high; }; #endif /*_XT_CONNTRACK_H*/ linux/netfilter/xt_cpu.h 0000644 00000000307 15063602052 0011351 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_CPU_H #define _XT_CPU_H #include <linux/types.h> struct xt_cpu_info { __u32 cpu; __u32 invert; }; #endif /*_XT_CPU_H*/ linux/netfilter/xt_dccp.h 0000644 00000000743 15063602052 0011477 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_DCCP_H_ #define _XT_DCCP_H_ #include <linux/types.h> #define XT_DCCP_SRC_PORTS 0x01 #define XT_DCCP_DEST_PORTS 0x02 #define XT_DCCP_TYPE 0x04 #define XT_DCCP_OPTION 0x08 #define XT_DCCP_VALID_FLAGS 0x0f struct xt_dccp_info { __u16 dpts[2]; /* Min, Max */ __u16 spts[2]; /* Min, Max */ __u16 flags; __u16 invflags; __u16 typemask; __u8 option; }; #endif /* _XT_DCCP_H_ */ linux/netfilter/xt_devgroup.h 0000644 00000000655 15063602052 0012423 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_DEVGROUP_H #define _XT_DEVGROUP_H #include <linux/types.h> enum xt_devgroup_flags { XT_DEVGROUP_MATCH_SRC = 0x1, XT_DEVGROUP_INVERT_SRC = 0x2, XT_DEVGROUP_MATCH_DST = 0x4, XT_DEVGROUP_INVERT_DST = 0x8, }; struct xt_devgroup_info { __u32 flags; __u32 src_group; __u32 src_mask; __u32 dst_group; __u32 dst_mask; }; #endif /* _XT_DEVGROUP_H */ linux/netfilter/xt_dscp.h 0000644 00000001275 15063602052 0011520 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* x_tables module for matching the IPv4/IPv6 DSCP field * * (C) 2002 Harald Welte <laforge@gnumonks.org> * This software is distributed under GNU GPL v2, 1991 * * See RFC2474 for a description of the DSCP field within the IP Header. * * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp */ #ifndef _XT_DSCP_H #define _XT_DSCP_H #include <linux/types.h> #define XT_DSCP_MASK 0xfc /* 11111100 */ #define XT_DSCP_SHIFT 2 #define XT_DSCP_MAX 0x3f /* 00111111 */ /* match info */ struct xt_dscp_info { __u8 dscp; __u8 invert; }; struct xt_tos_match_info { __u8 tos_mask; __u8 tos_value; __u8 invert; }; #endif /* _XT_DSCP_H */ linux/netfilter/xt_ecn.h 0000644 00000001340 15063602052 0011325 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* iptables module for matching the ECN header in IPv4 and TCP header * * (C) 2002 Harald Welte <laforge@gnumonks.org> * * This software is distributed under GNU GPL v2, 1991 * * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp */ #ifndef _XT_ECN_H #define _XT_ECN_H #include <linux/types.h> #include <linux/netfilter/xt_dscp.h> #define XT_ECN_IP_MASK (~XT_DSCP_MASK) #define XT_ECN_OP_MATCH_IP 0x01 #define XT_ECN_OP_MATCH_ECE 0x10 #define XT_ECN_OP_MATCH_CWR 0x20 #define XT_ECN_OP_MATCH_MASK 0xce /* match info */ struct xt_ecn_info { __u8 operation; __u8 invert; __u8 ip_ect; union { struct { __u8 ect; } tcp; } proto; }; #endif /* _XT_ECN_H */ linux/netfilter/xt_esp.h 0000644 00000000642 15063602052 0011353 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_ESP_H #define _XT_ESP_H #include <linux/types.h> struct xt_esp { __u32 spis[2]; /* Security Parameter Index */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct xt_esp. */ #define XT_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ #define XT_ESP_INV_MASK 0x01 /* All possible flags. */ #endif /*_XT_ESP_H*/ linux/netfilter/xt_hashlimit.h 0000644 00000006270 15063602052 0012551 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_HASHLIMIT_H #define _XT_HASHLIMIT_H #include <linux/types.h> #include <linux/limits.h> #include <linux/if.h> /* timings are in milliseconds. */ #define XT_HASHLIMIT_SCALE 10000 #define XT_HASHLIMIT_SCALE_v2 1000000llu /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 * seconds, or one packet every 59 hours. */ /* packet length accounting is done in 16-byte steps */ #define XT_HASHLIMIT_BYTE_SHIFT 4 /* details of this structure hidden by the implementation */ struct xt_hashlimit_htable; enum { XT_HASHLIMIT_HASH_DIP = 1 << 0, XT_HASHLIMIT_HASH_DPT = 1 << 1, XT_HASHLIMIT_HASH_SIP = 1 << 2, XT_HASHLIMIT_HASH_SPT = 1 << 3, XT_HASHLIMIT_INVERT = 1 << 4, XT_HASHLIMIT_BYTES = 1 << 5, XT_HASHLIMIT_RATE_MATCH = 1 << 6, }; struct hashlimit_cfg { __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ }; struct xt_hashlimit_info { char name [IFNAMSIZ]; /* name */ struct hashlimit_cfg cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo; union { void *ptr; struct xt_hashlimit_info *master; } u; }; struct hashlimit_cfg1 { __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ __u8 srcmask, dstmask; }; struct hashlimit_cfg2 { __u64 avg; /* Average secs between packets * scale */ __u64 burst; /* Period multiplier for upper limit. */ __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ __u8 srcmask, dstmask; }; struct hashlimit_cfg3 { __u64 avg; /* Average secs between packets * scale */ __u64 burst; /* Period multiplier for upper limit. */ __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ /* user specified */ __u32 size; /* how many buckets */ __u32 max; /* max number of entries */ __u32 gc_interval; /* gc interval */ __u32 expire; /* when do entries expire? */ __u32 interval; __u8 srcmask, dstmask; }; struct xt_hashlimit_mtinfo1 { char name[IFNAMSIZ]; struct hashlimit_cfg1 cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); }; struct xt_hashlimit_mtinfo2 { char name[NAME_MAX]; struct hashlimit_cfg2 cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); }; struct xt_hashlimit_mtinfo3 { char name[NAME_MAX]; struct hashlimit_cfg3 cfg; /* Used internally by the kernel */ struct xt_hashlimit_htable *hinfo __attribute__((aligned(8))); }; #endif /* _XT_HASHLIMIT_H */ linux/netfilter/xt_helper.h 0000644 00000000274 15063602052 0012044 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_HELPER_H #define _XT_HELPER_H struct xt_helper_info { int invert; char name[30]; }; #endif /* _XT_HELPER_H */ linux/netfilter/xt_ipcomp.h 0000644 00000000745 15063602052 0012057 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_IPCOMP_H #define _XT_IPCOMP_H #include <linux/types.h> struct xt_ipcomp { __u32 spis[2]; /* Security Parameter Index */ __u8 invflags; /* Inverse flags */ __u8 hdrres; /* Test of the Reserved Filed */ }; /* Values for "invflags" field in struct xt_ipcomp. */ #define XT_IPCOMP_INV_SPI 0x01 /* Invert the sense of spi. */ #define XT_IPCOMP_INV_MASK 0x01 /* All possible flags. */ #endif /*_XT_IPCOMP_H*/ linux/netfilter/xt_iprange.h 0000644 00000001105 15063602052 0012204 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETFILTER_XT_IPRANGE_H #define _LINUX_NETFILTER_XT_IPRANGE_H 1 #include <linux/types.h> #include <linux/netfilter.h> enum { IPRANGE_SRC = 1 << 0, /* match source IP address */ IPRANGE_DST = 1 << 1, /* match destination IP address */ IPRANGE_SRC_INV = 1 << 4, /* negate the condition */ IPRANGE_DST_INV = 1 << 5, /* -"- */ }; struct xt_iprange_mtinfo { union nf_inet_addr src_min, src_max; union nf_inet_addr dst_min, dst_max; __u8 flags; }; #endif /* _LINUX_NETFILTER_XT_IPRANGE_H */ linux/netfilter/xt_ipvs.h 0000644 00000001250 15063602052 0011541 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_IPVS_H #define _XT_IPVS_H #include <linux/types.h> #include <linux/netfilter.h> enum { XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */ XT_IPVS_PROTO = 1 << 1, XT_IPVS_VADDR = 1 << 2, XT_IPVS_VPORT = 1 << 3, XT_IPVS_DIR = 1 << 4, XT_IPVS_METHOD = 1 << 5, XT_IPVS_VPORTCTL = 1 << 6, XT_IPVS_MASK = (1 << 7) - 1, XT_IPVS_ONCE_MASK = XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY }; struct xt_ipvs_mtinfo { union nf_inet_addr vaddr, vmask; __be16 vport; __u8 l4proto; __u8 fwd_method; __be16 vportctl; __u8 invert; __u8 bitmask; }; #endif /* _XT_IPVS_H */ linux/netfilter/xt_l2tp.h 0000644 00000001343 15063602052 0011444 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETFILTER_XT_L2TP_H #define _LINUX_NETFILTER_XT_L2TP_H #include <linux/types.h> enum xt_l2tp_type { XT_L2TP_TYPE_CONTROL, XT_L2TP_TYPE_DATA, }; /* L2TP matching stuff */ struct xt_l2tp_info { __u32 tid; /* tunnel id */ __u32 sid; /* session id */ __u8 version; /* L2TP protocol version */ __u8 type; /* L2TP packet type */ __u8 flags; /* which fields to match */ }; enum { XT_L2TP_TID = (1 << 0), /* match L2TP tunnel id */ XT_L2TP_SID = (1 << 1), /* match L2TP session id */ XT_L2TP_VERSION = (1 << 2), /* match L2TP protocol version */ XT_L2TP_TYPE = (1 << 3), /* match L2TP packet type */ }; #endif /* _LINUX_NETFILTER_XT_L2TP_H */ linux/netfilter/xt_length.h 0000644 00000000335 15063602052 0012044 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_LENGTH_H #define _XT_LENGTH_H #include <linux/types.h> struct xt_length_info { __u16 min, max; __u8 invert; }; #endif /*_XT_LENGTH_H*/ linux/netfilter/xt_limit.h 0000644 00000001241 15063602052 0011676 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RATE_H #define _XT_RATE_H #include <linux/types.h> /* timings are in milliseconds. */ #define XT_LIMIT_SCALE 10000 struct xt_limit_priv; /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 seconds, or one every 59 hours. */ struct xt_rateinfo { __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* Used internally by the kernel */ unsigned long prev; /* moved to xt_limit_priv */ __u32 credit; /* moved to xt_limit_priv */ __u32 credit_cap, cost; struct xt_limit_priv *master; }; #endif /*_XT_RATE_H*/ linux/netfilter/xt_mac.h 0000644 00000000343 15063602052 0011322 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MAC_H #define _XT_MAC_H #include <linux/if_ether.h> struct xt_mac_info { unsigned char srcaddr[ETH_ALEN]; int invert; }; #endif /*_XT_MAC_H*/ linux/netfilter/xt_mark.h 0000644 00000000404 15063602052 0011512 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MARK_H #define _XT_MARK_H #include <linux/types.h> struct xt_mark_tginfo2 { __u32 mark, mask; }; struct xt_mark_mtinfo1 { __u32 mark, mask; __u8 invert; }; #endif /*_XT_MARK_H*/ linux/netfilter/xt_multiport.h 0000644 00000001321 15063602052 0012616 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_MULTIPORT_H #define _XT_MULTIPORT_H #include <linux/types.h> enum xt_multiport_flags { XT_MULTIPORT_SOURCE, XT_MULTIPORT_DESTINATION, XT_MULTIPORT_EITHER }; #define XT_MULTI_PORTS 15 /* Must fit inside union xt_matchinfo: 16 bytes */ struct xt_multiport { __u8 flags; /* Type of comparison */ __u8 count; /* Number of ports */ __u16 ports[XT_MULTI_PORTS]; /* Ports */ }; struct xt_multiport_v1 { __u8 flags; /* Type of comparison */ __u8 count; /* Number of ports */ __u16 ports[XT_MULTI_PORTS]; /* Ports */ __u8 pflags[XT_MULTI_PORTS]; /* Port flags */ __u8 invert; /* Invert flag */ }; #endif /*_XT_MULTIPORT_H*/ linux/netfilter/xt_nfacct.h 0000644 00000000455 15063602052 0012024 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_NFACCT_MATCH_H #define _XT_NFACCT_MATCH_H #include <linux/netfilter/nfnetlink_acct.h> struct nf_acct; struct xt_nfacct_match_info { char name[NFACCT_NAME_MAX]; struct nf_acct *nfacct; }; #endif /* _XT_NFACCT_MATCH_H */ linux/netfilter/xt_osf.h 0000644 00000003451 15063602052 0011354 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru> * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _XT_OSF_H #define _XT_OSF_H #include <linux/types.h> #include <linux/ip.h> #include <linux/tcp.h> #include <linux/netfilter/nf_osf.h> #define XT_OSF_GENRE NF_OSF_GENRE #define XT_OSF_INVERT NF_OSF_INVERT #define XT_OSF_TTL NF_OSF_TTL #define XT_OSF_LOG NF_OSF_LOG #define XT_OSF_LOGLEVEL_ALL NF_OSF_LOGLEVEL_ALL #define XT_OSF_LOGLEVEL_FIRST NF_OSF_LOGLEVEL_FIRST #define XT_OSF_LOGLEVEL_ALL_KNOWN NF_OSF_LOGLEVEL_ALL_KNOWN #define XT_OSF_TTL_TRUE NF_OSF_TTL_TRUE #define XT_OSF_TTL_NOCHECK NF_OSF_TTL_NOCHECK #define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */ #define xt_osf_wc nf_osf_wc #define xt_osf_opt nf_osf_opt #define xt_osf_info nf_osf_info #define xt_osf_user_finger nf_osf_user_finger #define xt_osf_finger nf_osf_finger #define xt_osf_nlmsg nf_osf_nlmsg /* * Add/remove fingerprint from the kernel. */ enum xt_osf_msg_types { OSF_MSG_ADD, OSF_MSG_REMOVE, OSF_MSG_MAX, }; enum xt_osf_attr_type { OSF_ATTR_UNSPEC, OSF_ATTR_FINGER, OSF_ATTR_MAX, }; #endif /* _XT_OSF_H */ linux/netfilter/xt_owner.h 0000644 00000000644 15063602052 0011720 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_OWNER_MATCH_H #define _XT_OWNER_MATCH_H #include <linux/types.h> enum { XT_OWNER_UID = 1 << 0, XT_OWNER_GID = 1 << 1, XT_OWNER_SOCKET = 1 << 2, XT_OWNER_SUPPL_GROUPS = 1 << 3, }; struct xt_owner_match_info { __u32 uid_min, uid_max; __u32 gid_min, gid_max; __u8 match, invert; }; #endif /* _XT_OWNER_MATCH_H */ linux/netfilter/xt_physdev.h 0000644 00000001051 15063602052 0012241 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_PHYSDEV_H #define _XT_PHYSDEV_H #include <linux/types.h> #include <linux/if.h> #define XT_PHYSDEV_OP_IN 0x01 #define XT_PHYSDEV_OP_OUT 0x02 #define XT_PHYSDEV_OP_BRIDGED 0x04 #define XT_PHYSDEV_OP_ISIN 0x08 #define XT_PHYSDEV_OP_ISOUT 0x10 #define XT_PHYSDEV_OP_MASK (0x20 - 1) struct xt_physdev_info { char physindev[IFNAMSIZ]; char in_mask[IFNAMSIZ]; char physoutdev[IFNAMSIZ]; char out_mask[IFNAMSIZ]; __u8 invert; __u8 bitmask; }; #endif /* _XT_PHYSDEV_H */ linux/netfilter/xt_pkttype.h 0000644 00000000274 15063602052 0012265 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_PKTTYPE_H #define _XT_PKTTYPE_H struct xt_pkttype_info { int pkttype; int invert; }; #endif /*_XT_PKTTYPE_H*/ linux/netfilter/xt_policy.h 0000644 00000001776 15063602052 0012074 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_POLICY_H #define _XT_POLICY_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> #define XT_POLICY_MAX_ELEM 4 enum xt_policy_flags { XT_POLICY_MATCH_IN = 0x1, XT_POLICY_MATCH_OUT = 0x2, XT_POLICY_MATCH_NONE = 0x4, XT_POLICY_MATCH_STRICT = 0x8, }; enum xt_policy_modes { XT_POLICY_MODE_TRANSPORT, XT_POLICY_MODE_TUNNEL }; struct xt_policy_spec { __u8 saddr:1, daddr:1, proto:1, mode:1, spi:1, reqid:1; }; union xt_policy_addr { struct in_addr a4; struct in6_addr a6; }; struct xt_policy_elem { union { struct { union xt_policy_addr saddr; union xt_policy_addr smask; union xt_policy_addr daddr; union xt_policy_addr dmask; }; }; __be32 spi; __u32 reqid; __u8 proto; __u8 mode; struct xt_policy_spec match; struct xt_policy_spec invert; }; struct xt_policy_info { struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; __u16 flags; __u16 len; }; #endif /* _XT_POLICY_H */ linux/netfilter/xt_quota.h 0000644 00000000620 15063602052 0011711 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_QUOTA_H #define _XT_QUOTA_H #include <linux/types.h> enum xt_quota_flags { XT_QUOTA_INVERT = 0x1, }; #define XT_QUOTA_MASK 0x1 struct xt_quota_priv; struct xt_quota_info { __u32 flags; __u32 pad; __aligned_u64 quota; /* Used internally by the kernel */ struct xt_quota_priv *master; }; #endif /* _XT_QUOTA_H */ linux/netfilter/xt_rateest.h 0000644 00000001533 15063602052 0012233 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RATEEST_MATCH_H #define _XT_RATEEST_MATCH_H #include <linux/types.h> #include <linux/if.h> enum xt_rateest_match_flags { XT_RATEEST_MATCH_INVERT = 1<<0, XT_RATEEST_MATCH_ABS = 1<<1, XT_RATEEST_MATCH_REL = 1<<2, XT_RATEEST_MATCH_DELTA = 1<<3, XT_RATEEST_MATCH_BPS = 1<<4, XT_RATEEST_MATCH_PPS = 1<<5, }; enum xt_rateest_match_mode { XT_RATEEST_MATCH_NONE, XT_RATEEST_MATCH_EQ, XT_RATEEST_MATCH_LT, XT_RATEEST_MATCH_GT, }; struct xt_rateest_match_info { char name1[IFNAMSIZ]; char name2[IFNAMSIZ]; __u16 flags; __u16 mode; __u32 bps1; __u32 pps1; __u32 bps2; __u32 pps2; /* Used internally by the kernel */ struct xt_rateest *est1 __attribute__((aligned(8))); struct xt_rateest *est2 __attribute__((aligned(8))); }; #endif /* _XT_RATEEST_MATCH_H */ linux/netfilter/xt_realm.h 0000644 00000000334 15063602052 0011662 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_REALM_H #define _XT_REALM_H #include <linux/types.h> struct xt_realm_info { __u32 id; __u32 mask; __u8 invert; }; #endif /* _XT_REALM_H */ linux/netfilter/xt_recent.h 0000644 00000002042 15063602052 0012040 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETFILTER_XT_RECENT_H #define _LINUX_NETFILTER_XT_RECENT_H 1 #include <linux/types.h> #include <linux/netfilter.h> enum { XT_RECENT_CHECK = 1 << 0, XT_RECENT_SET = 1 << 1, XT_RECENT_UPDATE = 1 << 2, XT_RECENT_REMOVE = 1 << 3, XT_RECENT_TTL = 1 << 4, XT_RECENT_REAP = 1 << 5, XT_RECENT_SOURCE = 0, XT_RECENT_DEST = 1, XT_RECENT_NAME_LEN = 200, }; /* Only allowed with --rcheck and --update */ #define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP) #define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\ XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP) struct xt_recent_mtinfo { __u32 seconds; __u32 hit_count; __u8 check_set; __u8 invert; char name[XT_RECENT_NAME_LEN]; __u8 side; }; struct xt_recent_mtinfo_v1 { __u32 seconds; __u32 hit_count; __u8 check_set; __u8 invert; char name[XT_RECENT_NAME_LEN]; __u8 side; union nf_inet_addr mask; }; #endif /* _LINUX_NETFILTER_XT_RECENT_H */ linux/netfilter/xt_rpfilter.h 0000644 00000000500 15063602052 0012404 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_RPATH_H #define _XT_RPATH_H #include <linux/types.h> enum { XT_RPFILTER_LOOSE = 1 << 0, XT_RPFILTER_VALID_MARK = 1 << 1, XT_RPFILTER_ACCEPT_LOCAL = 1 << 2, XT_RPFILTER_INVERT = 1 << 3, }; struct xt_rpfilter_info { __u8 flags; }; #endif linux/netfilter/xt_sctp.h 0000644 00000004426 15063602052 0011541 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SCTP_H_ #define _XT_SCTP_H_ #include <linux/types.h> #define XT_SCTP_SRC_PORTS 0x01 #define XT_SCTP_DEST_PORTS 0x02 #define XT_SCTP_CHUNK_TYPES 0x04 #define XT_SCTP_VALID_FLAGS 0x07 struct xt_sctp_flag_info { __u8 chunktype; __u8 flag; __u8 flag_mask; }; #define XT_NUM_SCTP_FLAGS 4 struct xt_sctp_info { __u16 dpts[2]; /* Min, Max */ __u16 spts[2]; /* Min, Max */ __u32 chunkmap[256 / sizeof (__u32)]; /* Bit mask of chunks to be matched according to RFC 2960 */ #define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */ #define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */ #define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */ __u32 chunk_match_type; struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS]; int flag_count; __u32 flags; __u32 invflags; }; #define bytes(type) (sizeof(type) * 8) #define SCTP_CHUNKMAP_SET(chunkmap, type) \ do { \ (chunkmap)[type / bytes(__u32)] |= \ 1 << (type % bytes(__u32)); \ } while (0) #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ do { \ (chunkmap)[type / bytes(__u32)] &= \ ~(1 << (type % bytes(__u32))); \ } while (0) #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ ({ \ ((chunkmap)[type / bytes (__u32)] & \ (1 << (type % bytes (__u32)))) ? 1: 0; \ }) #define SCTP_CHUNKMAP_RESET(chunkmap) \ memset((chunkmap), 0, sizeof(chunkmap)) #define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ memset((chunkmap), ~0U, sizeof(chunkmap)) #define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ memcpy((destmap), (srcmap), sizeof(srcmap)) #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) static __inline__ _Bool __sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n) { unsigned int i; for (i = 0; i < n; ++i) if (chunkmap[i]) return 0; return 1; } #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) static __inline__ _Bool __sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n) { unsigned int i; for (i = 0; i < n; ++i) if (chunkmap[i] != ~0U) return 0; return 1; } #endif /* _XT_SCTP_H_ */ linux/netfilter/xt_set.h 0000644 00000003443 15063602052 0011361 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SET_H #define _XT_SET_H #include <linux/types.h> #include <linux/netfilter/ipset/ip_set.h> /* Revision 0 interface: backward compatible with netfilter/iptables */ /* * Option flags for kernel operations (xt_set_info_v0) */ #define IPSET_SRC 0x01 /* Source match/add */ #define IPSET_DST 0x02 /* Destination match/add */ #define IPSET_MATCH_INV 0x04 /* Inverse matching */ struct xt_set_info_v0 { ip_set_id_t index; union { __u32 flags[IPSET_DIM_MAX + 1]; struct { __u32 __flags[IPSET_DIM_MAX]; __u8 dim; __u8 flags; } compat; } u; }; /* match and target infos */ struct xt_set_info_match_v0 { struct xt_set_info_v0 match_set; }; struct xt_set_info_target_v0 { struct xt_set_info_v0 add_set; struct xt_set_info_v0 del_set; }; /* Revision 1 match and target */ struct xt_set_info { ip_set_id_t index; __u8 dim; __u8 flags; }; /* match and target infos */ struct xt_set_info_match_v1 { struct xt_set_info match_set; }; struct xt_set_info_target_v1 { struct xt_set_info add_set; struct xt_set_info del_set; }; /* Revision 2 target */ struct xt_set_info_target_v2 { struct xt_set_info add_set; struct xt_set_info del_set; __u32 flags; __u32 timeout; }; /* Revision 3 match */ struct xt_set_info_match_v3 { struct xt_set_info match_set; struct ip_set_counter_match0 packets; struct ip_set_counter_match0 bytes; __u32 flags; }; /* Revision 3 target */ struct xt_set_info_target_v3 { struct xt_set_info add_set; struct xt_set_info del_set; struct xt_set_info map_set; __u32 flags; __u32 timeout; }; /* Revision 4 match */ struct xt_set_info_match_v4 { struct xt_set_info match_set; struct ip_set_counter_match packets; struct ip_set_counter_match bytes; __u32 flags; }; #endif /*_XT_SET_H*/ linux/netfilter/xt_socket.h 0000644 00000001200 15063602052 0012043 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_SOCKET_H #define _XT_SOCKET_H #include <linux/types.h> enum { XT_SOCKET_TRANSPARENT = 1 << 0, XT_SOCKET_NOWILDCARD = 1 << 1, XT_SOCKET_RESTORESKMARK = 1 << 2, }; struct xt_socket_mtinfo1 { __u8 flags; }; #define XT_SOCKET_FLAGS_V1 XT_SOCKET_TRANSPARENT struct xt_socket_mtinfo2 { __u8 flags; }; #define XT_SOCKET_FLAGS_V2 (XT_SOCKET_TRANSPARENT | XT_SOCKET_NOWILDCARD) struct xt_socket_mtinfo3 { __u8 flags; }; #define XT_SOCKET_FLAGS_V3 (XT_SOCKET_TRANSPARENT \ | XT_SOCKET_NOWILDCARD \ | XT_SOCKET_RESTORESKMARK) #endif /* _XT_SOCKET_H */ linux/netfilter/xt_state.h 0000644 00000000513 15063602052 0011701 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_STATE_H #define _XT_STATE_H #define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) #define XT_STATE_INVALID (1 << 0) #define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) struct xt_state_info { unsigned int statemask; }; #endif /*_XT_STATE_H*/ linux/netfilter/xt_statistic.h 0000644 00000001314 15063602052 0012570 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_STATISTIC_H #define _XT_STATISTIC_H #include <linux/types.h> enum xt_statistic_mode { XT_STATISTIC_MODE_RANDOM, XT_STATISTIC_MODE_NTH, __XT_STATISTIC_MODE_MAX }; #define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1) enum xt_statistic_flags { XT_STATISTIC_INVERT = 0x1, }; #define XT_STATISTIC_MASK 0x1 struct xt_statistic_priv; struct xt_statistic_info { __u16 mode; __u16 flags; union { struct { __u32 probability; } random; struct { __u32 every; __u32 packet; __u32 count; /* unused */ } nth; } u; struct xt_statistic_priv *master __attribute__((aligned(8))); }; #endif /* _XT_STATISTIC_H */ linux/netfilter/xt_string.h 0000644 00000001230 15063602052 0012064 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_STRING_H #define _XT_STRING_H #include <linux/types.h> #define XT_STRING_MAX_PATTERN_SIZE 128 #define XT_STRING_MAX_ALGO_NAME_SIZE 16 enum { XT_STRING_FLAG_INVERT = 0x01, XT_STRING_FLAG_IGNORECASE = 0x02 }; struct xt_string_info { __u16 from_offset; __u16 to_offset; char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; char pattern[XT_STRING_MAX_PATTERN_SIZE]; __u8 patlen; union { struct { __u8 invert; } v0; struct { __u8 flags; } v1; } u; /* Used internally by the kernel */ struct ts_config __attribute__((aligned(8))) *config; }; #endif /*_XT_STRING_H*/ linux/netfilter/xt_tcpmss.h 0000644 00000000375 15063602052 0012100 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPMSS_MATCH_H #define _XT_TCPMSS_MATCH_H #include <linux/types.h> struct xt_tcpmss_match_info { __u16 mss_min, mss_max; __u8 invert; }; #endif /*_XT_TCPMSS_MATCH_H*/ linux/netfilter/xt_tcpudp.h 0000644 00000002342 15063602052 0012062 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TCPUDP_H #define _XT_TCPUDP_H #include <linux/types.h> /* TCP matching stuff */ struct xt_tcp { __u16 spts[2]; /* Source port range. */ __u16 dpts[2]; /* Destination port range. */ __u8 option; /* TCP Option iff non-zero*/ __u8 flg_mask; /* TCP flags mask byte */ __u8 flg_cmp; /* TCP flags compare byte */ __u8 invflags; /* Inverse flags */ }; /* Values for "inv" field in struct ipt_tcp. */ #define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ #define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ #define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ #define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ #define XT_TCP_INV_MASK 0x0F /* All possible flags. */ /* UDP matching stuff */ struct xt_udp { __u16 spts[2]; /* Source port range. */ __u16 dpts[2]; /* Destination port range. */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ipt_udp. */ #define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ #define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ #define XT_UDP_INV_MASK 0x03 /* All possible flags. */ #endif linux/netfilter/xt_time.h 0000644 00000001332 15063602052 0011517 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_TIME_H #define _XT_TIME_H 1 #include <linux/types.h> struct xt_time_info { __u32 date_start; __u32 date_stop; __u32 daytime_start; __u32 daytime_stop; __u32 monthdays_match; __u8 weekdays_match; __u8 flags; }; enum { /* Match against local time (instead of UTC) */ XT_TIME_LOCAL_TZ = 1 << 0, /* treat timestart > timestop (e.g. 23:00-01:00) as single period */ XT_TIME_CONTIGUOUS = 1 << 1, /* Shortcuts */ XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE, XT_TIME_ALL_WEEKDAYS = 0xFE, XT_TIME_MIN_DAYTIME = 0, XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1, }; #define XT_TIME_ALL_FLAGS (XT_TIME_LOCAL_TZ|XT_TIME_CONTIGUOUS) #endif /* _XT_TIME_H */ linux/netfilter/xt_u32.h 0000644 00000001360 15063602052 0011173 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _XT_U32_H #define _XT_U32_H 1 #include <linux/types.h> enum xt_u32_ops { XT_U32_AND, XT_U32_LEFTSH, XT_U32_RIGHTSH, XT_U32_AT, }; struct xt_u32_location_element { __u32 number; __u8 nextop; }; struct xt_u32_value_element { __u32 min; __u32 max; }; /* * Any way to allow for an arbitrary number of elements? * For now, I settle with a limit of 10 each. */ #define XT_U32_MAXSIZE 10 struct xt_u32_test { struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; __u8 nnums; __u8 nvalues; }; struct xt_u32 { struct xt_u32_test tests[XT_U32_MAXSIZE+1]; __u8 ntests; __u8 invert; }; #endif /* _XT_U32_H */ linux/netfilter/nf_conntrack_common.h 0000644 00000010754 15063602052 0014073 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _NF_CONNTRACK_COMMON_H #define _NF_CONNTRACK_COMMON_H /* Connection state tracking for netfilter. This is separated from, but required by, the NAT layer; it can also be used by an iptables extension. */ enum ip_conntrack_info { /* Part of an established connection (either direction). */ IP_CT_ESTABLISHED, /* Like NEW, but related to an existing connection, or ICMP error (in either direction). */ IP_CT_RELATED, /* Started a new connection to track (only IP_CT_DIR_ORIGINAL); may be a retransmission. */ IP_CT_NEW, /* >= this indicates reply direction */ IP_CT_IS_REPLY, IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY, IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY, /* No NEW in reply direction. */ /* Number of distinct IP_CT types. */ IP_CT_NUMBER, /* only for userspace compatibility */ IP_CT_NEW_REPLY = IP_CT_NUMBER, }; #define NF_CT_STATE_INVALID_BIT (1 << 0) #define NF_CT_STATE_BIT(ctinfo) (1 << ((ctinfo) % IP_CT_IS_REPLY + 1)) #define NF_CT_STATE_UNTRACKED_BIT (1 << 6) /* Bitset representing status of connection. */ enum ip_conntrack_status { /* It's an expected connection: bit 0 set. This bit never changed */ IPS_EXPECTED_BIT = 0, IPS_EXPECTED = (1 << IPS_EXPECTED_BIT), /* We've seen packets both ways: bit 1 set. Can be set, not unset. */ IPS_SEEN_REPLY_BIT = 1, IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT), /* Conntrack should never be early-expired. */ IPS_ASSURED_BIT = 2, IPS_ASSURED = (1 << IPS_ASSURED_BIT), /* Connection is confirmed: originating packet has left box */ IPS_CONFIRMED_BIT = 3, IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), /* Connection needs src nat in orig dir. This bit never changed. */ IPS_SRC_NAT_BIT = 4, IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT), /* Connection needs dst nat in orig dir. This bit never changed. */ IPS_DST_NAT_BIT = 5, IPS_DST_NAT = (1 << IPS_DST_NAT_BIT), /* Both together. */ IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT), /* Connection needs TCP sequence adjusted. */ IPS_SEQ_ADJUST_BIT = 6, IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT), /* NAT initialization bits. */ IPS_SRC_NAT_DONE_BIT = 7, IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT), IPS_DST_NAT_DONE_BIT = 8, IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT), /* Both together */ IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), /* Connection is dying (removed from lists), can not be unset. */ IPS_DYING_BIT = 9, IPS_DYING = (1 << IPS_DYING_BIT), /* Connection has fixed timeout. */ IPS_FIXED_TIMEOUT_BIT = 10, IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), /* Conntrack is a template */ IPS_TEMPLATE_BIT = 11, IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT), /* Conntrack is a fake untracked entry. Obsolete and not used anymore */ IPS_UNTRACKED_BIT = 12, IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), /* Conntrack got a helper explicitly attached (ruleset, ctnetlink). */ IPS_HELPER_BIT = 13, IPS_HELPER = (1 << IPS_HELPER_BIT), /* Conntrack has been offloaded to flow table. */ IPS_OFFLOAD_BIT = 14, IPS_OFFLOAD = (1 << IPS_OFFLOAD_BIT), /* Conntrack has been offloaded to hardware. */ IPS_HW_OFFLOAD_BIT = 15, IPS_HW_OFFLOAD = (1 << IPS_HW_OFFLOAD_BIT), /* Be careful here, modifying these bits can make things messy, * so don't let users modify them directly. */ IPS_UNCHANGEABLE_MASK = (IPS_NAT_DONE_MASK | IPS_NAT_MASK | IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING | IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_UNTRACKED | IPS_OFFLOAD | IPS_HW_OFFLOAD), __IPS_MAX_BIT = 16, }; /* Connection tracking event types */ enum ip_conntrack_events { IPCT_NEW, /* new conntrack */ IPCT_RELATED, /* related conntrack */ IPCT_DESTROY, /* destroyed conntrack */ IPCT_REPLY, /* connection has seen two-way traffic */ IPCT_ASSURED, /* connection status has changed to assured */ IPCT_PROTOINFO, /* protocol information has changed */ IPCT_HELPER, /* new helper has been set */ IPCT_MARK, /* new mark has been set */ IPCT_SEQADJ, /* sequence adjustment has changed */ IPCT_NATSEQADJ = IPCT_SEQADJ, IPCT_SECMARK, /* new security mark has been set */ IPCT_LABEL, /* new connlabel has been set */ IPCT_SYNPROXY, /* synproxy has been set */ }; enum ip_conntrack_expect_events { IPEXP_NEW, /* new expectation */ IPEXP_DESTROY, /* destroyed expectation */ }; /* expectation flags */ #define NF_CT_EXPECT_PERMANENT 0x1 #define NF_CT_EXPECT_INACTIVE 0x2 #define NF_CT_EXPECT_USERSPACE 0x4 #endif /* _NF_CONNTRACK_COMMON_H */ linux/netfilter_arp/arp_tables.h 0000644 00000013557 15063602052 0013040 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Format of an ARP firewall descriptor * * src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in * network byte order. * flags are stored in host byte order (of course). */ #ifndef _ARPTABLES_H #define _ARPTABLES_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_arp.h> #include <linux/netfilter/x_tables.h> #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define arpt_entry_target xt_entry_target #define arpt_standard_target xt_standard_target #define arpt_error_target xt_error_target #define ARPT_CONTINUE XT_CONTINUE #define ARPT_RETURN XT_RETURN #define arpt_counters_info xt_counters_info #define arpt_counters xt_counters #define ARPT_STANDARD_TARGET XT_STANDARD_TARGET #define ARPT_ERROR_TARGET XT_ERROR_TARGET #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) #define ARPT_DEV_ADDR_LEN_MAX 16 struct arpt_devaddr_info { char addr[ARPT_DEV_ADDR_LEN_MAX]; char mask[ARPT_DEV_ADDR_LEN_MAX]; }; /* Yes, Virginia, you have to zero the padding. */ struct arpt_arp { /* Source and target IP addr */ struct in_addr src, tgt; /* Mask for src and target IP addr */ struct in_addr smsk, tmsk; /* Device hw address length, src+target device addresses */ __u8 arhln, arhln_mask; struct arpt_devaddr_info src_devaddr; struct arpt_devaddr_info tgt_devaddr; /* ARP operation code. */ __be16 arpop, arpop_mask; /* ARP hardware address and protocol address format. */ __be16 arhrd, arhrd_mask; __be16 arpro, arpro_mask; /* The protocol address length is only accepted if it is 4 * so there is no use in offering a way to do filtering on it. */ char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; /* Flags word */ __u8 flags; /* Inverse flags */ __u16 invflags; }; /* Values for "flag" field in struct arpt_ip (general arp structure). * No flags defined yet. */ #define ARPT_F_MASK 0x00 /* All possible flag bits mask. */ /* Values for "inv" field in struct arpt_arp. */ #define ARPT_INV_VIA_IN 0x0001 /* Invert the sense of IN IFACE. */ #define ARPT_INV_VIA_OUT 0x0002 /* Invert the sense of OUT IFACE */ #define ARPT_INV_SRCIP 0x0004 /* Invert the sense of SRC IP. */ #define ARPT_INV_TGTIP 0x0008 /* Invert the sense of TGT IP. */ #define ARPT_INV_SRCDEVADDR 0x0010 /* Invert the sense of SRC DEV ADDR. */ #define ARPT_INV_TGTDEVADDR 0x0020 /* Invert the sense of TGT DEV ADDR. */ #define ARPT_INV_ARPOP 0x0040 /* Invert the sense of ARP OP. */ #define ARPT_INV_ARPHRD 0x0080 /* Invert the sense of ARP HRD. */ #define ARPT_INV_ARPPRO 0x0100 /* Invert the sense of ARP PRO. */ #define ARPT_INV_ARPHLN 0x0200 /* Invert the sense of ARP HLN. */ #define ARPT_INV_MASK 0x03FF /* All possible flag bits mask. */ /* This structure defines each of the firewall rules. Consists of 3 parts which are 1) general ARP header stuff 2) match specific stuff 3) the target to perform if the rule matches */ struct arpt_entry { struct arpt_arp arp; /* Size of arpt_entry + matches */ __u16 target_offset; /* Size of arpt_entry + matches + target */ __u16 next_offset; /* Back pointer */ unsigned int comefrom; /* Packet and byte counters. */ struct xt_counters counters; /* The matches (if any), then the target. */ unsigned char elems[0]; }; /* * New IP firewall options for [gs]etsockopt at the RAW IP level. * Unlike BSD Linux inherits IP options so you don't have to use a raw * socket for this. Instead we check rights in the calls. * * ATTENTION: check linux/in.h before adding new number here. */ #define ARPT_BASE_CTL 96 #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) #define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1) #define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) /* #define ARPT_SO_GET_REVISION_MATCH (APRT_BASE_CTL + 2) */ #define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3) #define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET) /* The argument to ARPT_SO_GET_INFO */ struct arpt_getinfo { /* Which table: caller fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* Kernel fills these in. */ /* Which hook entry points are valid: bitmask */ unsigned int valid_hooks; /* Hook entry points: one per netfilter hook. */ unsigned int hook_entry[NF_ARP_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_ARP_NUMHOOKS]; /* Number of entries */ unsigned int num_entries; /* Size of entries. */ unsigned int size; }; /* The argument to ARPT_SO_SET_REPLACE. */ struct arpt_replace { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; /* Which hook entry points are valid: bitmask. You can't change this. */ unsigned int valid_hooks; /* Number of entries */ unsigned int num_entries; /* Total size of new entries */ unsigned int size; /* Hook entry points. */ unsigned int hook_entry[NF_ARP_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_ARP_NUMHOOKS]; /* Information about old entries: */ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ struct xt_counters *counters; /* The entries (hang off end: not really an array). */ struct arpt_entry entries[0]; }; /* The argument to ARPT_SO_GET_ENTRIES. */ struct arpt_get_entries { /* Which table: user fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* User fills this in: total entry size. */ unsigned int size; /* The entries. */ struct arpt_entry entrytable[0]; }; /* Helper functions */ static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e) { return (void *)e + e->target_offset; } /* * Main firewall chains definitions and global var's definitions. */ #endif /* _ARPTABLES_H */ linux/netfilter_arp/arpt_mangle.h 0000644 00000001136 15063602052 0013203 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ARPT_MANGLE_H #define _ARPT_MANGLE_H #include <linux/netfilter_arp/arp_tables.h> #define ARPT_MANGLE_ADDR_LEN_MAX sizeof(struct in_addr) struct arpt_mangle { char src_devaddr[ARPT_DEV_ADDR_LEN_MAX]; char tgt_devaddr[ARPT_DEV_ADDR_LEN_MAX]; union { struct in_addr src_ip; } u_s; union { struct in_addr tgt_ip; } u_t; __u8 flags; int target; }; #define ARPT_MANGLE_SDEV 0x01 #define ARPT_MANGLE_TDEV 0x02 #define ARPT_MANGLE_SIP 0x04 #define ARPT_MANGLE_TIP 0x08 #define ARPT_MANGLE_MASK 0x0f #endif /* _ARPT_MANGLE_H */ linux/netfilter_bridge/ebt_802_3.h 0000644 00000002372 15063602052 0012754 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_802_3_H #define __LINUX_BRIDGE_EBT_802_3_H #include <linux/types.h> #include <linux/if_ether.h> #define EBT_802_3_SAP 0x01 #define EBT_802_3_TYPE 0x02 #define EBT_802_3_MATCH "802_3" /* * If frame has DSAP/SSAP value 0xaa you must check the SNAP type * to discover what kind of packet we're carrying. */ #define CHECK_TYPE 0xaa /* * Control field may be one or two bytes. If the first byte has * the value 0x03 then the entire length is one byte, otherwise it is two. * One byte controls are used in Unnumbered Information frames. * Two byte controls are used in Numbered Information frames. */ #define IS_UI 0x03 #define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3) /* ui has one byte ctrl, ni has two */ struct hdr_ui { __u8 dsap; __u8 ssap; __u8 ctrl; __u8 orig[3]; __be16 type; }; struct hdr_ni { __u8 dsap; __u8 ssap; __be16 ctrl; __u8 orig[3]; __be16 type; }; struct ebt_802_3_hdr { __u8 daddr[ETH_ALEN]; __u8 saddr[ETH_ALEN]; __be16 len; union { struct hdr_ui ui; struct hdr_ni ni; } llc; }; struct ebt_802_3_info { __u8 sap; __be16 type; __u8 bitmask; __u8 invflags; }; #endif /* __LINUX_BRIDGE_EBT_802_3_H */ linux/netfilter_bridge/ebt_among.h 0000644 00000003773 15063602052 0013330 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_AMONG_H #define __LINUX_BRIDGE_EBT_AMONG_H #include <linux/types.h> #define EBT_AMONG_DST 0x01 #define EBT_AMONG_SRC 0x02 /* Grzegorz Borowiak <grzes@gnu.univ.gda.pl> 2003 * * Write-once-read-many hash table, used for checking if a given * MAC address belongs to a set or not and possibly for checking * if it is related with a given IPv4 address. * * The hash value of an address is its last byte. * * In real-world ethernet addresses, values of the last byte are * evenly distributed and there is no need to consider other bytes. * It would only slow the routines down. * * For MAC address comparison speedup reasons, we introduce a trick. * MAC address is mapped onto an array of two 32-bit integers. * This pair of integers is compared with MAC addresses in the * hash table, which are stored also in form of pairs of integers * (in `cmp' array). This is quick as it requires only two elementary * number comparisons in worst case. Further, we take advantage of * fact that entropy of 3 last bytes of address is larger than entropy * of 3 first bytes. So first we compare 4 last bytes of addresses and * if they are the same we compare 2 first. * * Yes, it is a memory overhead, but in 2003 AD, who cares? */ struct ebt_mac_wormhash_tuple { __u32 cmp[2]; __be32 ip; }; struct ebt_mac_wormhash { int table[257]; int poolsize; struct ebt_mac_wormhash_tuple pool[0]; }; #define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) struct ebt_among_info { int wh_dst_ofs; int wh_src_ofs; int bitmask; }; #define EBT_AMONG_DST_NEG 0x1 #define EBT_AMONG_SRC_NEG 0x2 #define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \ (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL) #define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \ (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL) #define EBT_AMONG_MATCH "among" #endif linux/netfilter_bridge/ebt_arp.h 0000644 00000001604 15063602052 0013000 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_ARP_H #define __LINUX_BRIDGE_EBT_ARP_H #include <linux/types.h> #include <linux/if_ether.h> #define EBT_ARP_OPCODE 0x01 #define EBT_ARP_HTYPE 0x02 #define EBT_ARP_PTYPE 0x04 #define EBT_ARP_SRC_IP 0x08 #define EBT_ARP_DST_IP 0x10 #define EBT_ARP_SRC_MAC 0x20 #define EBT_ARP_DST_MAC 0x40 #define EBT_ARP_GRAT 0x80 #define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \ EBT_ARP_GRAT) #define EBT_ARP_MATCH "arp" struct ebt_arp_info { __be16 htype; __be16 ptype; __be16 opcode; __be32 saddr; __be32 smsk; __be32 daddr; __be32 dmsk; unsigned char smaddr[ETH_ALEN]; unsigned char smmsk[ETH_ALEN]; unsigned char dmaddr[ETH_ALEN]; unsigned char dmmsk[ETH_ALEN]; __u8 bitmask; __u8 invflags; }; #endif linux/netfilter_bridge/ebt_arpreply.h 0000644 00000000441 15063602052 0014052 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H #define __LINUX_BRIDGE_EBT_ARPREPLY_H #include <linux/if_ether.h> struct ebt_arpreply_info { unsigned char mac[ETH_ALEN]; int target; }; #define EBT_ARPREPLY_TARGET "arpreply" #endif linux/netfilter_bridge/ebt_ip.h 0000644 00000002106 15063602052 0012624 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ebt_ip * * Authors: * Bart De Schuymer <bart.de.schuymer@pandora.be> * * April, 2002 * * Changes: * added ip-sport and ip-dport * Innominate Security Technologies AG <mhopf@innominate.com> * September, 2002 */ #ifndef __LINUX_BRIDGE_EBT_IP_H #define __LINUX_BRIDGE_EBT_IP_H #include <linux/types.h> #define EBT_IP_SOURCE 0x01 #define EBT_IP_DEST 0x02 #define EBT_IP_TOS 0x04 #define EBT_IP_PROTO 0x08 #define EBT_IP_SPORT 0x10 #define EBT_IP_DPORT 0x20 #define EBT_IP_ICMP 0x40 #define EBT_IP_IGMP 0x80 #define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ EBT_IP_SPORT | EBT_IP_DPORT | EBT_IP_ICMP | EBT_IP_IGMP) #define EBT_IP_MATCH "ip" /* the same values are used for the invflags */ struct ebt_ip_info { __be32 saddr; __be32 daddr; __be32 smsk; __be32 dmsk; __u8 tos; __u8 protocol; __u8 bitmask; __u8 invflags; union { __u16 sport[2]; __u8 icmp_type[2]; __u8 igmp_type[2]; }; union { __u16 dport[2]; __u8 icmp_code[2]; }; }; #endif linux/netfilter_bridge/ebt_ip6.h 0000644 00000002040 15063602052 0012707 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ebt_ip6 * * Authors: * Kuo-Lang Tseng <kuo-lang.tseng@intel.com> * Manohar Castelino <manohar.r.castelino@intel.com> * * Jan 11, 2008 * */ #ifndef __LINUX_BRIDGE_EBT_IP6_H #define __LINUX_BRIDGE_EBT_IP6_H #include <linux/types.h> #include <linux/in6.h> #define EBT_IP6_SOURCE 0x01 #define EBT_IP6_DEST 0x02 #define EBT_IP6_TCLASS 0x04 #define EBT_IP6_PROTO 0x08 #define EBT_IP6_SPORT 0x10 #define EBT_IP6_DPORT 0x20 #define EBT_IP6_ICMP6 0x40 #define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \ EBT_IP6_ICMP6) #define EBT_IP6_MATCH "ip6" /* the same values are used for the invflags */ struct ebt_ip6_info { struct in6_addr saddr; struct in6_addr daddr; struct in6_addr smsk; struct in6_addr dmsk; __u8 tclass; __u8 protocol; __u8 bitmask; __u8 invflags; union { __u16 sport[2]; __u8 icmpv6_type[2]; }; union { __u16 dport[2]; __u8 icmpv6_code[2]; }; }; #endif linux/netfilter_bridge/ebt_limit.h 0000644 00000001150 15063602052 0013330 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_LIMIT_H #define __LINUX_BRIDGE_EBT_LIMIT_H #include <linux/types.h> #define EBT_LIMIT_MATCH "limit" /* timings are in milliseconds. */ #define EBT_LIMIT_SCALE 10000 /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 seconds, or one every 59 hours. */ struct ebt_limit_info { __u32 avg; /* Average secs between packets * scale */ __u32 burst; /* Period multiplier for upper limit. */ /* Used internally by the kernel */ unsigned long prev; __u32 credit; __u32 credit_cap, cost; }; #endif linux/netfilter_bridge/ebt_log.h 0000644 00000001032 15063602052 0012772 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_LOG_H #define __LINUX_BRIDGE_EBT_LOG_H #include <linux/types.h> #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ #define EBT_LOG_ARP 0x02 #define EBT_LOG_NFLOG 0x04 #define EBT_LOG_IP6 0x08 #define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP | EBT_LOG_IP6) #define EBT_LOG_PREFIX_SIZE 30 #define EBT_LOG_WATCHER "log" struct ebt_log_info { __u8 loglevel; __u8 prefix[EBT_LOG_PREFIX_SIZE]; __u32 bitmask; }; #endif linux/netfilter_bridge/ebt_mark_m.h 0000644 00000000604 15063602052 0013463 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_MARK_M_H #define __LINUX_BRIDGE_EBT_MARK_M_H #include <linux/types.h> #define EBT_MARK_AND 0x01 #define EBT_MARK_OR 0x02 #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) struct ebt_mark_m_info { unsigned long mark, mask; __u8 invert; __u8 bitmask; }; #define EBT_MARK_MATCH "mark_m" #endif linux/netfilter_bridge/ebt_mark_t.h 0000644 00000001477 15063602052 0013503 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_MARK_T_H #define __LINUX_BRIDGE_EBT_MARK_T_H /* The target member is reused for adding new actions, the * value of the real target is -1 to -NUM_STANDARD_TARGETS. * For backward compatibility, the 4 lsb (2 would be enough, * but let's play it safe) are kept to designate this target. * The remaining bits designate the action. By making the set * action 0xfffffff0, the result will look ok for older * versions. [September 2006] */ #define MARK_SET_VALUE (0xfffffff0) #define MARK_OR_VALUE (0xffffffe0) #define MARK_AND_VALUE (0xffffffd0) #define MARK_XOR_VALUE (0xffffffc0) struct ebt_mark_t_info { unsigned long mark; /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ int target; }; #define EBT_MARK_TARGET "mark" #endif linux/netfilter_bridge/ebt_nat.h 0000644 00000000603 15063602052 0012776 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_NAT_H #define __LINUX_BRIDGE_EBT_NAT_H #include <linux/if_ether.h> #define NAT_ARP_BIT (0x00000010) struct ebt_nat_info { unsigned char mac[ETH_ALEN]; /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ int target; }; #define EBT_SNAT_TARGET "snat" #define EBT_DNAT_TARGET "dnat" #endif linux/netfilter_bridge/ebt_nflog.h 0000644 00000000776 15063602052 0013334 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_NFLOG_H #define __LINUX_BRIDGE_EBT_NFLOG_H #include <linux/types.h> #define EBT_NFLOG_MASK 0x0 #define EBT_NFLOG_PREFIX_SIZE 64 #define EBT_NFLOG_WATCHER "nflog" #define EBT_NFLOG_DEFAULT_GROUP 0x1 #define EBT_NFLOG_DEFAULT_THRESHOLD 1 struct ebt_nflog_info { __u32 len; __u16 group; __u16 threshold; __u16 flags; __u16 pad; char prefix[EBT_NFLOG_PREFIX_SIZE]; }; #endif /* __LINUX_BRIDGE_EBT_NFLOG_H */ linux/netfilter_bridge/ebt_pkttype.h 0000644 00000000413 15063602052 0013713 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H #define __LINUX_BRIDGE_EBT_PKTTYPE_H #include <linux/types.h> struct ebt_pkttype_info { __u8 pkt_type; __u8 invert; }; #define EBT_PKTTYPE_MATCH "pkttype" #endif linux/netfilter_bridge/ebt_redirect.h 0000644 00000000436 15063602052 0014021 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_REDIRECT_H #define __LINUX_BRIDGE_EBT_REDIRECT_H struct ebt_redirect_info { /* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */ int target; }; #define EBT_REDIRECT_TARGET "redirect" #endif linux/netfilter_bridge/ebt_stp.h 0000644 00000002126 15063602052 0013024 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_STP_H #define __LINUX_BRIDGE_EBT_STP_H #include <linux/types.h> #define EBT_STP_TYPE 0x0001 #define EBT_STP_FLAGS 0x0002 #define EBT_STP_ROOTPRIO 0x0004 #define EBT_STP_ROOTADDR 0x0008 #define EBT_STP_ROOTCOST 0x0010 #define EBT_STP_SENDERPRIO 0x0020 #define EBT_STP_SENDERADDR 0x0040 #define EBT_STP_PORT 0x0080 #define EBT_STP_MSGAGE 0x0100 #define EBT_STP_MAXAGE 0x0200 #define EBT_STP_HELLOTIME 0x0400 #define EBT_STP_FWDD 0x0800 #define EBT_STP_MASK 0x0fff #define EBT_STP_CONFIG_MASK 0x0ffe #define EBT_STP_MATCH "stp" struct ebt_stp_config_info { __u8 flags; __u16 root_priol, root_priou; char root_addr[6], root_addrmsk[6]; __u32 root_costl, root_costu; __u16 sender_priol, sender_priou; char sender_addr[6], sender_addrmsk[6]; __u16 portl, portu; __u16 msg_agel, msg_ageu; __u16 max_agel, max_ageu; __u16 hello_timel, hello_timeu; __u16 forward_delayl, forward_delayu; }; struct ebt_stp_info { __u8 type; struct ebt_stp_config_info config; __u16 bitmask; __u16 invflags; }; #endif linux/netfilter_bridge/ebt_vlan.h 0000644 00000001317 15063602052 0013157 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BRIDGE_EBT_VLAN_H #define __LINUX_BRIDGE_EBT_VLAN_H #include <linux/types.h> #define EBT_VLAN_ID 0x01 #define EBT_VLAN_PRIO 0x02 #define EBT_VLAN_ENCAP 0x04 #define EBT_VLAN_MASK (EBT_VLAN_ID | EBT_VLAN_PRIO | EBT_VLAN_ENCAP) #define EBT_VLAN_MATCH "vlan" struct ebt_vlan_info { __u16 id; /* VLAN ID {1-4095} */ __u8 prio; /* VLAN User Priority {0-7} */ __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ __u8 bitmask; /* Args bitmask bit 1=1 - ID arg, bit 2=1 User-Priority arg, bit 3=1 encap*/ __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, bit 2=1 - inversed Pirority arg */ }; #endif linux/netfilter_bridge/ebtables.h 0000644 00000022145 15063602052 0013150 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ebtables * * Authors: * Bart De Schuymer <bdschuym@pandora.be> * * ebtables.c,v 2.0, April, 2002 * * This code is strongly inspired by the iptables code which is * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling */ #ifndef __LINUX_BRIDGE_EFF_H #define __LINUX_BRIDGE_EFF_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_bridge.h> #define EBT_TABLE_MAXNAMELEN 32 #define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN #define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN #define EBT_EXTENSION_MAXNAMELEN 31 /* verdicts >0 are "branches" */ #define EBT_ACCEPT -1 #define EBT_DROP -2 #define EBT_CONTINUE -3 #define EBT_RETURN -4 #define NUM_STANDARD_TARGETS 4 /* ebtables target modules store the verdict inside an int. We can * reclaim a part of this int for backwards compatible extensions. * The 4 lsb are more than enough to store the verdict. */ #define EBT_VERDICT_BITS 0x0000000F struct xt_match; struct xt_target; struct ebt_counter { __u64 pcnt; __u64 bcnt; }; struct ebt_replace { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; /* nr of rules in the table */ unsigned int nentries; /* total size of the entries */ unsigned int entries_size; /* start of the chains */ struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; /* nr of counters userspace expects back */ unsigned int num_counters; /* where the kernel will put the old counters */ struct ebt_counter *counters; char *entries; }; struct ebt_replace_kernel { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; /* nr of rules in the table */ unsigned int nentries; /* total size of the entries */ unsigned int entries_size; /* start of the chains */ struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; /* nr of counters userspace expects back */ unsigned int num_counters; /* where the kernel will put the old counters */ struct ebt_counter *counters; char *entries; }; struct ebt_entries { /* this field is always set to zero * See EBT_ENTRY_OR_ENTRIES. * Must be same size as ebt_entry.bitmask */ unsigned int distinguisher; /* the chain name */ char name[EBT_CHAIN_MAXNAMELEN]; /* counter offset for this chain */ unsigned int counter_offset; /* one standard (accept, drop, return) per hook */ int policy; /* nr. of entries */ unsigned int nentries; /* entry list */ char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; /* used for the bitmask of struct ebt_entry */ /* This is a hack to make a difference between an ebt_entry struct and an * ebt_entries struct when traversing the entries from start to end. * Using this simplifies the code a lot, while still being able to use * ebt_entries. * Contrary, iptables doesn't use something like ebt_entries and therefore uses * different techniques for naming the policy and such. So, iptables doesn't * need a hack like this. */ #define EBT_ENTRY_OR_ENTRIES 0x01 /* these are the normal masks */ #define EBT_NOPROTO 0x02 #define EBT_802_3 0x04 #define EBT_SOURCEMAC 0x08 #define EBT_DESTMAC 0x10 #define EBT_F_MASK (EBT_NOPROTO | EBT_802_3 | EBT_SOURCEMAC | EBT_DESTMAC \ | EBT_ENTRY_OR_ENTRIES) #define EBT_IPROTO 0x01 #define EBT_IIN 0x02 #define EBT_IOUT 0x04 #define EBT_ISOURCE 0x8 #define EBT_IDEST 0x10 #define EBT_ILOGICALIN 0x20 #define EBT_ILOGICALOUT 0x40 #define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \ | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST) struct ebt_entry_match { union { struct { char name[EBT_EXTENSION_MAXNAMELEN]; uint8_t revision; }; struct xt_match *match; } u; /* size of data */ unsigned int match_size; unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; struct ebt_entry_watcher { union { struct { char name[EBT_EXTENSION_MAXNAMELEN]; uint8_t revision; }; struct xt_target *watcher; } u; /* size of data */ unsigned int watcher_size; unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; struct ebt_entry_target { union { struct { char name[EBT_EXTENSION_MAXNAMELEN]; uint8_t revision; }; struct xt_target *target; } u; /* size of data */ unsigned int target_size; unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; #define EBT_STANDARD_TARGET "standard" struct ebt_standard_target { struct ebt_entry_target target; int verdict; }; /* one entry */ struct ebt_entry { /* this needs to be the first field */ unsigned int bitmask; unsigned int invflags; __be16 ethproto; /* the physical in-dev */ char in[IFNAMSIZ]; /* the logical in-dev */ char logical_in[IFNAMSIZ]; /* the physical out-dev */ char out[IFNAMSIZ]; /* the logical out-dev */ char logical_out[IFNAMSIZ]; unsigned char sourcemac[ETH_ALEN]; unsigned char sourcemsk[ETH_ALEN]; unsigned char destmac[ETH_ALEN]; unsigned char destmsk[ETH_ALEN]; /* sizeof ebt_entry + matches */ unsigned int watchers_offset; /* sizeof ebt_entry + matches + watchers */ unsigned int target_offset; /* sizeof ebt_entry + matches + watchers + target */ unsigned int next_offset; unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; static __inline__ struct ebt_entry_target * ebt_get_target(struct ebt_entry *e) { return (void *)e + e->target_offset; } /* {g,s}etsockopt numbers */ #define EBT_BASE_CTL 128 #define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) #define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1) #define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1) #define EBT_SO_GET_INFO (EBT_BASE_CTL) #define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1) #define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1) #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1) #define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1) /* blatently stolen from ip_tables.h * fn returns 0 to continue iteration */ #define EBT_MATCH_ITERATE(e, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct ebt_entry_match *__match; \ \ for (__i = sizeof(struct ebt_entry); \ __i < (e)->watchers_offset; \ __i += __match->match_size + \ sizeof(struct ebt_entry_match)) { \ __match = (void *)(e) + __i; \ \ __ret = fn(__match , ## args); \ if (__ret != 0) \ break; \ } \ if (__ret == 0) { \ if (__i != (e)->watchers_offset) \ __ret = -EINVAL; \ } \ __ret; \ }) #define EBT_WATCHER_ITERATE(e, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct ebt_entry_watcher *__watcher; \ \ for (__i = e->watchers_offset; \ __i < (e)->target_offset; \ __i += __watcher->watcher_size + \ sizeof(struct ebt_entry_watcher)) { \ __watcher = (void *)(e) + __i; \ \ __ret = fn(__watcher , ## args); \ if (__ret != 0) \ break; \ } \ if (__ret == 0) { \ if (__i != (e)->target_offset) \ __ret = -EINVAL; \ } \ __ret; \ }) #define EBT_ENTRY_ITERATE(entries, size, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct ebt_entry *__entry; \ \ for (__i = 0; __i < (size);) { \ __entry = (void *)(entries) + __i; \ __ret = fn(__entry , ## args); \ if (__ret != 0) \ break; \ if (__entry->bitmask != 0) \ __i += __entry->next_offset; \ else \ __i += sizeof(struct ebt_entries); \ } \ if (__ret == 0) { \ if (__i != (size)) \ __ret = -EINVAL; \ } \ __ret; \ }) #endif /* __LINUX_BRIDGE_EFF_H */ linux/netfilter_ipv4/ip_tables.h 0000644 00000014767 15063602052 0012772 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * 25-Jul-1998 Major changes to allow for ip chain table * * 3-Jan-2000 Named tables to allow packet selection for different uses. */ /* * Format of an IP firewall descriptor * * src, dst, src_mask, dst_mask are always stored in network byte order. * flags are stored in host byte order (of course). * Port numbers are stored in HOST byte order. */ #ifndef _IPTABLES_H #define _IPTABLES_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_ipv4.h> #include <linux/netfilter/x_tables.h> #define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define ipt_match xt_match #define ipt_target xt_target #define ipt_table xt_table #define ipt_get_revision xt_get_revision #define ipt_entry_match xt_entry_match #define ipt_entry_target xt_entry_target #define ipt_standard_target xt_standard_target #define ipt_error_target xt_error_target #define ipt_counters xt_counters #define IPT_CONTINUE XT_CONTINUE #define IPT_RETURN XT_RETURN /* This group is older than old (iptables < v1.4.0-rc1~89) */ #include <linux/netfilter/xt_tcpudp.h> #define ipt_udp xt_udp #define ipt_tcp xt_tcp #define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT #define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT #define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS #define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION #define IPT_TCP_INV_MASK XT_TCP_INV_MASK #define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT #define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT #define IPT_UDP_INV_MASK XT_UDP_INV_MASK /* The argument to IPT_SO_ADD_COUNTERS. */ #define ipt_counters_info xt_counters_info /* Standard return verdict, or do jump. */ #define IPT_STANDARD_TARGET XT_STANDARD_TARGET /* Error verdict. */ #define IPT_ERROR_TARGET XT_ERROR_TARGET /* fn returns 0 to continue iteration */ #define IPT_MATCH_ITERATE(e, fn, args...) \ XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) /* fn returns 0 to continue iteration */ #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) /* Yes, Virginia, you have to zero the padding. */ struct ipt_ip { /* Source and destination IP addr */ struct in_addr src, dst; /* Mask for src and dest IP addr */ struct in_addr smsk, dmsk; char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; /* Protocol, 0 = ANY */ __u16 proto; /* Flags word */ __u8 flags; /* Inverse flags */ __u8 invflags; }; /* Values for "flag" field in struct ipt_ip (general ip structure). */ #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ /* Values for "inv" field in struct ipt_ip. */ #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ #define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ #define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */ #define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ #define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ #define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ #define IPT_INV_PROTO XT_INV_PROTO #define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ /* This structure defines each of the firewall rules. Consists of 3 parts which are 1) general IP header stuff 2) match specific stuff 3) the target to perform if the rule matches */ struct ipt_entry { struct ipt_ip ip; /* Mark with fields that we care about. */ unsigned int nfcache; /* Size of ipt_entry + matches */ __u16 target_offset; /* Size of ipt_entry + matches + target */ __u16 next_offset; /* Back pointer */ unsigned int comefrom; /* Packet and byte counters. */ struct xt_counters counters; /* The matches (if any), then the target. */ unsigned char elems[0]; }; /* * New IP firewall options for [gs]etsockopt at the RAW IP level. * Unlike BSD Linux inherits IP options so you don't have to use a raw * socket for this. Instead we check rights in the calls. * * ATTENTION: check linux/in.h before adding new number here. */ #define IPT_BASE_CTL 64 #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) #define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) #define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS #define IPT_SO_GET_INFO (IPT_BASE_CTL) #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) #define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) #define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) #define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET /* ICMP matching stuff */ struct ipt_icmp { __u8 type; /* type to match */ __u8 code[2]; /* range of code */ __u8 invflags; /* Inverse flags */ }; /* Values for "inv" field for struct ipt_icmp. */ #define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */ /* The argument to IPT_SO_GET_INFO */ struct ipt_getinfo { /* Which table: caller fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* Kernel fills these in. */ /* Which hook entry points are valid: bitmask */ unsigned int valid_hooks; /* Hook entry points: one per netfilter hook. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Number of entries */ unsigned int num_entries; /* Size of entries. */ unsigned int size; }; /* The argument to IPT_SO_SET_REPLACE. */ struct ipt_replace { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; /* Which hook entry points are valid: bitmask. You can't change this. */ unsigned int valid_hooks; /* Number of entries */ unsigned int num_entries; /* Total size of new entries */ unsigned int size; /* Hook entry points. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Information about old entries: */ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ struct xt_counters *counters; /* The entries (hang off end: not really an array). */ struct ipt_entry entries[0]; }; /* The argument to IPT_SO_GET_ENTRIES. */ struct ipt_get_entries { /* Which table: user fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* User fills this in: total entry size. */ unsigned int size; /* The entries. */ struct ipt_entry entrytable[0]; }; /* Helper functions */ static __inline__ struct xt_entry_target * ipt_get_target(struct ipt_entry *e) { return (void *)e + e->target_offset; } /* * Main firewall chains definitions and global var's definitions. */ #endif /* _IPTABLES_H */ linux/netfilter_ipv4/ipt_CLUSTERIP.h 0000644 00000001465 15063602052 0013245 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_CLUSTERIP_H_target #define _IPT_CLUSTERIP_H_target #include <linux/types.h> #include <linux/if_ether.h> enum clusterip_hashmode { CLUSTERIP_HASHMODE_SIP = 0, CLUSTERIP_HASHMODE_SIP_SPT, CLUSTERIP_HASHMODE_SIP_SPT_DPT, }; #define CLUSTERIP_HASHMODE_MAX CLUSTERIP_HASHMODE_SIP_SPT_DPT #define CLUSTERIP_MAX_NODES 16 #define CLUSTERIP_FLAG_NEW 0x00000001 struct clusterip_config; struct ipt_clusterip_tgt_info { __u32 flags; /* only relevant for new ones */ __u8 clustermac[ETH_ALEN]; __u16 num_total_nodes; __u16 num_local_nodes; __u16 local_nodes[CLUSTERIP_MAX_NODES]; __u32 hash_mode; __u32 hash_initval; /* Used internally by the kernel */ struct clusterip_config *config; }; #endif /*_IPT_CLUSTERIP_H_target*/ linux/netfilter_ipv4/ipt_ECN.h 0000644 00000001605 15063602052 0012274 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Header file for iptables ipt_ECN target * * (C) 2002 by Harald Welte <laforge@gnumonks.org> * * This software is distributed under GNU GPL v2, 1991 * * ipt_ECN.h,v 1.3 2002/05/29 12:17:40 laforge Exp */ #ifndef _IPT_ECN_TARGET_H #define _IPT_ECN_TARGET_H #include <linux/types.h> #include <linux/netfilter/xt_DSCP.h> #define IPT_ECN_IP_MASK (~XT_DSCP_MASK) #define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */ #define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */ #define IPT_ECN_OP_SET_CWR 0x20 /* set CWR bit of TCP header */ #define IPT_ECN_OP_MASK 0xce struct ipt_ECN_info { __u8 operation; /* bitset of operations */ __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ union { struct { __u8 ece:1, cwr:1; /* TCP ECT bits */ } tcp; } proto; }; #endif /* _IPT_ECN_TARGET_H */ linux/netfilter_ipv4/ipt_LOG.h 0000644 00000001322 15063602052 0012304 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_LOG_H #define _IPT_LOG_H #warning "Please update iptables, this file will be removed soon!" /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ #define IPT_LOG_IPOPT 0x04 /* Log IP options */ #define IPT_LOG_UID 0x08 /* Log UID owning local socket */ #define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ #define IPT_LOG_MACDECODE 0x20 /* Decode MAC header */ #define IPT_LOG_MASK 0x2f struct ipt_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif /*_IPT_LOG_H*/ linux/netfilter_ipv4/ipt_REJECT.h 0000644 00000000724 15063602052 0012644 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_REJECT_H #define _IPT_REJECT_H enum ipt_reject_with { IPT_ICMP_NET_UNREACHABLE, IPT_ICMP_HOST_UNREACHABLE, IPT_ICMP_PROT_UNREACHABLE, IPT_ICMP_PORT_UNREACHABLE, IPT_ICMP_ECHOREPLY, IPT_ICMP_NET_PROHIBITED, IPT_ICMP_HOST_PROHIBITED, IPT_TCP_RESET, IPT_ICMP_ADMIN_PROHIBITED }; struct ipt_reject_info { enum ipt_reject_with with; /* reject type */ }; #endif /*_IPT_REJECT_H*/ linux/netfilter_ipv4/ipt_TTL.h 0000644 00000000567 15063602052 0012340 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* TTL modification module for IP tables * (C) 2000 by Harald Welte <laforge@netfilter.org> */ #ifndef _IPT_TTL_H #define _IPT_TTL_H #include <linux/types.h> enum { IPT_TTL_SET = 0, IPT_TTL_INC, IPT_TTL_DEC }; #define IPT_TTL_MAXMODE IPT_TTL_DEC struct ipt_TTL_info { __u8 mode; __u8 ttl; }; #endif linux/netfilter_ipv4/ipt_ah.h 0000644 00000000651 15063602052 0012257 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_AH_H #define _IPT_AH_H #include <linux/types.h> struct ipt_ah { __u32 spis[2]; /* Security Parameter Index */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ipt_ah. */ #define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */ #define IPT_AH_INV_MASK 0x01 /* All possible flags. */ #endif /*_IPT_AH_H*/ linux/netfilter_ipv4/ipt_ecn.h 0000644 00000000657 15063602052 0012442 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IPT_ECN_H #define _IPT_ECN_H #include <linux/netfilter/xt_ecn.h> #define ipt_ecn_info xt_ecn_info enum { IPT_ECN_IP_MASK = XT_ECN_IP_MASK, IPT_ECN_OP_MATCH_IP = XT_ECN_OP_MATCH_IP, IPT_ECN_OP_MATCH_ECE = XT_ECN_OP_MATCH_ECE, IPT_ECN_OP_MATCH_CWR = XT_ECN_OP_MATCH_CWR, IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK, }; #endif /* IPT_ECN_H */ linux/netfilter_ipv4/ipt_ttl.h 0000644 00000000657 15063602052 0012500 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* IP tables module for matching the value of the TTL * (C) 2000 by Harald Welte <laforge@gnumonks.org> */ #ifndef _IPT_TTL_H #define _IPT_TTL_H #include <linux/types.h> enum { IPT_TTL_EQ = 0, /* equals */ IPT_TTL_NE, /* not equals */ IPT_TTL_LT, /* less than */ IPT_TTL_GT, /* greater than */ }; struct ipt_ttl_info { __u8 mode; __u8 ttl; }; #endif linux/netfilter_ipv6/ip6_tables.h 0000644 00000017513 15063602052 0013052 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * 25-Jul-1998 Major changes to allow for ip chain table * * 3-Jan-2000 Named tables to allow packet selection for different uses. */ /* * Format of an IP6 firewall descriptor * * src, dst, src_mask, dst_mask are always stored in network byte order. * flags are stored in host byte order (of course). * Port numbers are stored in HOST byte order. */ #ifndef _IP6_TABLES_H #define _IP6_TABLES_H #include <linux/types.h> #include <linux/if.h> #include <linux/netfilter_ipv6.h> #include <linux/netfilter/x_tables.h> #define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define ip6t_match xt_match #define ip6t_target xt_target #define ip6t_table xt_table #define ip6t_get_revision xt_get_revision #define ip6t_entry_match xt_entry_match #define ip6t_entry_target xt_entry_target #define ip6t_standard_target xt_standard_target #define ip6t_error_target xt_error_target #define ip6t_counters xt_counters #define IP6T_CONTINUE XT_CONTINUE #define IP6T_RETURN XT_RETURN /* Pre-iptables-1.4.0 */ #include <linux/netfilter/xt_tcpudp.h> #define ip6t_tcp xt_tcp #define ip6t_udp xt_udp #define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT #define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT #define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS #define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION #define IP6T_TCP_INV_MASK XT_TCP_INV_MASK #define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT #define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT #define IP6T_UDP_INV_MASK XT_UDP_INV_MASK #define ip6t_counters_info xt_counters_info #define IP6T_STANDARD_TARGET XT_STANDARD_TARGET #define IP6T_ERROR_TARGET XT_ERROR_TARGET #define IP6T_MATCH_ITERATE(e, fn, args...) \ XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) /* Yes, Virginia, you have to zero the padding. */ struct ip6t_ip6 { /* Source and destination IP6 addr */ struct in6_addr src, dst; /* Mask for src and dest IP6 addr */ struct in6_addr smsk, dmsk; char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; /* Upper protocol number * - The allowed value is 0 (any) or protocol number of last parsable * header, which is 50 (ESP), 59 (No Next Header), 135 (MH), or * the non IPv6 extension headers. * - The protocol numbers of IPv6 extension headers except of ESP and * MH do not match any packets. * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol. */ __u16 proto; /* TOS to match iff flags & IP6T_F_TOS */ __u8 tos; /* Flags word */ __u8 flags; /* Inverse flags */ __u8 invflags; }; /* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ #define IP6T_F_PROTO 0x01 /* Set if rule cares about upper protocols */ #define IP6T_F_TOS 0x02 /* Match the TOS. */ #define IP6T_F_GOTO 0x04 /* Set if jump is a goto */ #define IP6T_F_MASK 0x07 /* All possible flag bits mask. */ /* Values for "inv" field in struct ip6t_ip6. */ #define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ #define IP6T_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ #define IP6T_INV_TOS 0x04 /* Invert the sense of TOS. */ #define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ #define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ #define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ #define IP6T_INV_PROTO XT_INV_PROTO #define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ /* This structure defines each of the firewall rules. Consists of 3 parts which are 1) general IP header stuff 2) match specific stuff 3) the target to perform if the rule matches */ struct ip6t_entry { struct ip6t_ip6 ipv6; /* Mark with fields that we care about. */ unsigned int nfcache; /* Size of ipt_entry + matches */ __u16 target_offset; /* Size of ipt_entry + matches + target */ __u16 next_offset; /* Back pointer */ unsigned int comefrom; /* Packet and byte counters. */ struct xt_counters counters; /* The matches (if any), then the target. */ unsigned char elems[0]; }; /* Standard entry */ struct ip6t_standard { struct ip6t_entry entry; struct xt_standard_target target; }; struct ip6t_error { struct ip6t_entry entry; struct xt_error_target target; }; #define IP6T_ENTRY_INIT(__size) \ { \ .target_offset = sizeof(struct ip6t_entry), \ .next_offset = (__size), \ } #define IP6T_STANDARD_INIT(__verdict) \ { \ .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \ .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \ sizeof(struct xt_standard_target)), \ .target.verdict = -(__verdict) - 1, \ } #define IP6T_ERROR_INIT \ { \ .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \ .target = XT_TARGET_INIT(XT_ERROR_TARGET, \ sizeof(struct xt_error_target)), \ .target.errorname = "ERROR", \ } /* * New IP firewall options for [gs]etsockopt at the RAW IP level. * Unlike BSD Linux inherits IP options so you don't have to use * a raw socket for this. Instead we check rights in the calls. * * ATTENTION: check linux/in6.h before adding new number here. */ #define IP6T_BASE_CTL 64 #define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) #define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) #define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS #define IP6T_SO_GET_INFO (IP6T_BASE_CTL) #define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) #define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4) #define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) #define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET /* obtain original address if REDIRECT'd connection */ #define IP6T_SO_ORIGINAL_DST 80 /* ICMP matching stuff */ struct ip6t_icmp { __u8 type; /* type to match */ __u8 code[2]; /* range of code */ __u8 invflags; /* Inverse flags */ }; /* Values for "inv" field for struct ipt_icmp. */ #define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */ /* The argument to IP6T_SO_GET_INFO */ struct ip6t_getinfo { /* Which table: caller fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* Kernel fills these in. */ /* Which hook entry points are valid: bitmask */ unsigned int valid_hooks; /* Hook entry points: one per netfilter hook. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Number of entries */ unsigned int num_entries; /* Size of entries. */ unsigned int size; }; /* The argument to IP6T_SO_SET_REPLACE. */ struct ip6t_replace { /* Which table. */ char name[XT_TABLE_MAXNAMELEN]; /* Which hook entry points are valid: bitmask. You can't change this. */ unsigned int valid_hooks; /* Number of entries */ unsigned int num_entries; /* Total size of new entries */ unsigned int size; /* Hook entry points. */ unsigned int hook_entry[NF_INET_NUMHOOKS]; /* Underflow points. */ unsigned int underflow[NF_INET_NUMHOOKS]; /* Information about old entries: */ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ struct xt_counters *counters; /* The entries (hang off end: not really an array). */ struct ip6t_entry entries[0]; }; /* The argument to IP6T_SO_GET_ENTRIES. */ struct ip6t_get_entries { /* Which table: user fills this in. */ char name[XT_TABLE_MAXNAMELEN]; /* User fills this in: total entry size. */ unsigned int size; /* The entries. */ struct ip6t_entry entrytable[0]; }; /* Helper functions */ static __inline__ struct xt_entry_target * ip6t_get_target(struct ip6t_entry *e) { return (void *)e + e->target_offset; } /* * Main firewall chains definitions and global var's definitions. */ #endif /* _IP6_TABLES_H */ linux/netfilter_ipv6/ip6t_HL.h 0000644 00000000630 15063602052 0012257 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Hop Limit modification module for ip6tables * Maciej Soltysiak <solt@dns.toxicfilms.tv> * Based on HW's TTL module */ #ifndef _IP6T_HL_H #define _IP6T_HL_H #include <linux/types.h> enum { IP6T_HL_SET = 0, IP6T_HL_INC, IP6T_HL_DEC }; #define IP6T_HL_MAXMODE IP6T_HL_DEC struct ip6t_HL_info { __u8 mode; __u8 hop_limit; }; #endif linux/netfilter_ipv6/ip6t_LOG.h 0000644 00000001332 15063602052 0012375 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_LOG_H #define _IP6T_LOG_H #warning "Please update iptables, this file will be removed soon!" /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ #define IP6T_LOG_IPOPT 0x04 /* Log IP options */ #define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ #define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */ #define IP6T_LOG_MACDECODE 0x20 /* Decode MAC header */ #define IP6T_LOG_MASK 0x2f struct ip6t_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif /*_IPT_LOG_H*/ linux/netfilter_ipv6/ip6t_NPT.h 0000644 00000000620 15063602052 0012414 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NETFILTER_IP6T_NPT #define __NETFILTER_IP6T_NPT #include <linux/types.h> #include <linux/netfilter.h> struct ip6t_npt_tginfo { union nf_inet_addr src_pfx; union nf_inet_addr dst_pfx; __u8 src_pfx_len; __u8 dst_pfx_len; /* Used internally by the kernel */ __sum16 adjustment; }; #endif /* __NETFILTER_IP6T_NPT */ linux/netfilter_ipv6/ip6t_REJECT.h 0000644 00000000726 15063602052 0012736 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_REJECT_H #define _IP6T_REJECT_H #include <linux/types.h> enum ip6t_reject_with { IP6T_ICMP6_NO_ROUTE, IP6T_ICMP6_ADM_PROHIBITED, IP6T_ICMP6_NOT_NEIGHBOUR, IP6T_ICMP6_ADDR_UNREACH, IP6T_ICMP6_PORT_UNREACH, IP6T_ICMP6_ECHOREPLY, IP6T_TCP_RESET, IP6T_ICMP6_POLICY_FAIL, IP6T_ICMP6_REJECT_ROUTE }; struct ip6t_reject_info { __u32 with; /* reject type */ }; #endif /*_IP6T_REJECT_H*/ linux/netfilter_ipv6/ip6t_ah.h 0000644 00000001221 15063602052 0012341 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_AH_H #define _IP6T_AH_H #include <linux/types.h> struct ip6t_ah { __u32 spis[2]; /* Security Parameter Index */ __u32 hdrlen; /* Header Length */ __u8 hdrres; /* Test of the Reserved Filed */ __u8 invflags; /* Inverse flags */ }; #define IP6T_AH_SPI 0x01 #define IP6T_AH_LEN 0x02 #define IP6T_AH_RES 0x04 /* Values for "invflags" field in struct ip6t_ah. */ #define IP6T_AH_INV_SPI 0x01 /* Invert the sense of spi. */ #define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ #define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ #endif /*_IP6T_AH_H*/ linux/netfilter_ipv6/ip6t_frag.h 0000644 00000001350 15063602052 0012673 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_FRAG_H #define _IP6T_FRAG_H #include <linux/types.h> struct ip6t_frag { __u32 ids[2]; /* Identification range */ __u32 hdrlen; /* Header Length */ __u8 flags; /* Flags */ __u8 invflags; /* Inverse flags */ }; #define IP6T_FRAG_IDS 0x01 #define IP6T_FRAG_LEN 0x02 #define IP6T_FRAG_RES 0x04 #define IP6T_FRAG_FST 0x08 #define IP6T_FRAG_MF 0x10 #define IP6T_FRAG_NMF 0x20 /* Values for "invflags" field in struct ip6t_frag. */ #define IP6T_FRAG_INV_IDS 0x01 /* Invert the sense of ids. */ #define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ #define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ #endif /*_IP6T_FRAG_H*/ linux/netfilter_ipv6/ip6t_hl.h 0000644 00000000712 15063602052 0012360 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* ip6tables module for matching the Hop Limit value * Maciej Soltysiak <solt@dns.toxicfilms.tv> * Based on HW's ttl module */ #ifndef _IP6T_HL_H #define _IP6T_HL_H #include <linux/types.h> enum { IP6T_HL_EQ = 0, /* equals */ IP6T_HL_NE, /* not equals */ IP6T_HL_LT, /* less than */ IP6T_HL_GT, /* greater than */ }; struct ip6t_hl_info { __u8 mode; __u8 hop_limit; }; #endif linux/netfilter_ipv6/ip6t_ipv6header.h 0000644 00000001205 15063602052 0014010 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* ipv6header match - matches IPv6 packets based on whether they contain certain headers */ /* Original idea: Brad Chapman * Rewritten by: Andras Kis-Szabo <kisza@sch.bme.hu> */ #ifndef __IPV6HEADER_H #define __IPV6HEADER_H #include <linux/types.h> struct ip6t_ipv6header_info { __u8 matchflags; __u8 invflags; __u8 modeflag; }; #define MASK_HOPOPTS 128 #define MASK_DSTOPTS 64 #define MASK_ROUTING 32 #define MASK_FRAGMENT 16 #define MASK_AH 8 #define MASK_ESP 4 #define MASK_NONE 2 #define MASK_PROTO 1 #endif /* __IPV6HEADER_H */ linux/netfilter_ipv6/ip6t_mh.h 0000644 00000000667 15063602052 0012372 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_MH_H #define _IP6T_MH_H #include <linux/types.h> /* MH matching stuff */ struct ip6t_mh { __u8 types[2]; /* MH type range */ __u8 invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ip6t_mh. */ #define IP6T_MH_INV_TYPE 0x01 /* Invert the sense of type. */ #define IP6T_MH_INV_MASK 0x01 /* All possible flags. */ #endif /*_IP6T_MH_H*/ linux/netfilter_ipv6/ip6t_opts.h 0000644 00000001211 15063602052 0012735 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_OPTS_H #define _IP6T_OPTS_H #include <linux/types.h> #define IP6T_OPTS_OPTSNR 16 struct ip6t_opts { __u32 hdrlen; /* Header Length */ __u8 flags; /* */ __u8 invflags; /* Inverse flags */ __u16 opts[IP6T_OPTS_OPTSNR]; /* opts */ __u8 optsnr; /* Nr of OPts */ }; #define IP6T_OPTS_LEN 0x01 #define IP6T_OPTS_OPTS 0x02 #define IP6T_OPTS_NSTRICT 0x04 /* Values for "invflags" field in struct ip6t_rt. */ #define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ #define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ #endif /*_IP6T_OPTS_H*/ linux/netfilter_ipv6/ip6t_rt.h 0000644 00000001731 15063602052 0012404 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_RT_H #define _IP6T_RT_H #include <linux/types.h> #include <linux/in6.h> #define IP6T_RT_HOPS 16 struct ip6t_rt { __u32 rt_type; /* Routing Type */ __u32 segsleft[2]; /* Segments Left */ __u32 hdrlen; /* Header Length */ __u8 flags; /* */ __u8 invflags; /* Inverse flags */ struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ __u8 addrnr; /* Nr of Addresses */ }; #define IP6T_RT_TYP 0x01 #define IP6T_RT_SGS 0x02 #define IP6T_RT_LEN 0x04 #define IP6T_RT_RES 0x08 #define IP6T_RT_FST_MASK 0x30 #define IP6T_RT_FST 0x10 #define IP6T_RT_FST_NSTRICT 0x20 /* Values for "invflags" field in struct ip6t_rt. */ #define IP6T_RT_INV_TYP 0x01 /* Invert the sense of type. */ #define IP6T_RT_INV_SGS 0x02 /* Invert the sense of Segments. */ #define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ #define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ #endif /*_IP6T_RT_H*/ linux/netfilter_ipv6/ip6t_srh.h 0000644 00000006351 15063602052 0012556 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _IP6T_SRH_H #define _IP6T_SRH_H #include <linux/types.h> #include <linux/netfilter.h> /* Values for "mt_flags" field in struct ip6t_srh */ #define IP6T_SRH_NEXTHDR 0x0001 #define IP6T_SRH_LEN_EQ 0x0002 #define IP6T_SRH_LEN_GT 0x0004 #define IP6T_SRH_LEN_LT 0x0008 #define IP6T_SRH_SEGS_EQ 0x0010 #define IP6T_SRH_SEGS_GT 0x0020 #define IP6T_SRH_SEGS_LT 0x0040 #define IP6T_SRH_LAST_EQ 0x0080 #define IP6T_SRH_LAST_GT 0x0100 #define IP6T_SRH_LAST_LT 0x0200 #define IP6T_SRH_TAG 0x0400 #define IP6T_SRH_PSID 0x0800 #define IP6T_SRH_NSID 0x1000 #define IP6T_SRH_LSID 0x2000 #define IP6T_SRH_MASK 0x3FFF /* Values for "mt_invflags" field in struct ip6t_srh */ #define IP6T_SRH_INV_NEXTHDR 0x0001 #define IP6T_SRH_INV_LEN_EQ 0x0002 #define IP6T_SRH_INV_LEN_GT 0x0004 #define IP6T_SRH_INV_LEN_LT 0x0008 #define IP6T_SRH_INV_SEGS_EQ 0x0010 #define IP6T_SRH_INV_SEGS_GT 0x0020 #define IP6T_SRH_INV_SEGS_LT 0x0040 #define IP6T_SRH_INV_LAST_EQ 0x0080 #define IP6T_SRH_INV_LAST_GT 0x0100 #define IP6T_SRH_INV_LAST_LT 0x0200 #define IP6T_SRH_INV_TAG 0x0400 #define IP6T_SRH_INV_PSID 0x0800 #define IP6T_SRH_INV_NSID 0x1000 #define IP6T_SRH_INV_LSID 0x2000 #define IP6T_SRH_INV_MASK 0x3FFF /** * struct ip6t_srh - SRH match options * @ next_hdr: Next header field of SRH * @ hdr_len: Extension header length field of SRH * @ segs_left: Segments left field of SRH * @ last_entry: Last entry field of SRH * @ tag: Tag field of SRH * @ mt_flags: match options * @ mt_invflags: Invert the sense of match options */ struct ip6t_srh { __u8 next_hdr; __u8 hdr_len; __u8 segs_left; __u8 last_entry; __u16 tag; __u16 mt_flags; __u16 mt_invflags; }; /** * struct ip6t_srh1 - SRH match options (revision 1) * @ next_hdr: Next header field of SRH * @ hdr_len: Extension header length field of SRH * @ segs_left: Segments left field of SRH * @ last_entry: Last entry field of SRH * @ tag: Tag field of SRH * @ psid_addr: Address of previous SID in SRH SID list * @ nsid_addr: Address of NEXT SID in SRH SID list * @ lsid_addr: Address of LAST SID in SRH SID list * @ psid_msk: Mask of previous SID in SRH SID list * @ nsid_msk: Mask of next SID in SRH SID list * @ lsid_msk: MAsk of last SID in SRH SID list * @ mt_flags: match options * @ mt_invflags: Invert the sense of match options */ struct ip6t_srh1 { __u8 next_hdr; __u8 hdr_len; __u8 segs_left; __u8 last_entry; __u16 tag; struct in6_addr psid_addr; struct in6_addr nsid_addr; struct in6_addr lsid_addr; struct in6_addr psid_msk; struct in6_addr nsid_msk; struct in6_addr lsid_msk; __u16 mt_flags; __u16 mt_invflags; }; #endif /*_IP6T_SRH_H*/ linux/nfs2.h 0000644 00000002674 15063602052 0006734 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NFS protocol definitions * * This file contains constants for Version 2 of the protocol. */ #ifndef _LINUX_NFS2_H #define _LINUX_NFS2_H #define NFS2_PORT 2049 #define NFS2_MAXDATA 8192 #define NFS2_MAXPATHLEN 1024 #define NFS2_MAXNAMLEN 255 #define NFS2_MAXGROUPS 16 #define NFS2_FHSIZE 32 #define NFS2_COOKIESIZE 4 #define NFS2_FIFO_DEV (-1) #define NFS2MODE_FMT 0170000 #define NFS2MODE_DIR 0040000 #define NFS2MODE_CHR 0020000 #define NFS2MODE_BLK 0060000 #define NFS2MODE_REG 0100000 #define NFS2MODE_LNK 0120000 #define NFS2MODE_SOCK 0140000 #define NFS2MODE_FIFO 0010000 /* NFSv2 file types - beware, these are not the same in NFSv3 */ enum nfs2_ftype { NF2NON = 0, NF2REG = 1, NF2DIR = 2, NF2BLK = 3, NF2CHR = 4, NF2LNK = 5, NF2SOCK = 6, NF2BAD = 7, NF2FIFO = 8 }; struct nfs2_fh { char data[NFS2_FHSIZE]; }; /* * Procedure numbers for NFSv2 */ #define NFS2_VERSION 2 #define NFSPROC_NULL 0 #define NFSPROC_GETATTR 1 #define NFSPROC_SETATTR 2 #define NFSPROC_ROOT 3 #define NFSPROC_LOOKUP 4 #define NFSPROC_READLINK 5 #define NFSPROC_READ 6 #define NFSPROC_WRITECACHE 7 #define NFSPROC_WRITE 8 #define NFSPROC_CREATE 9 #define NFSPROC_REMOVE 10 #define NFSPROC_RENAME 11 #define NFSPROC_LINK 12 #define NFSPROC_SYMLINK 13 #define NFSPROC_MKDIR 14 #define NFSPROC_RMDIR 15 #define NFSPROC_READDIR 16 #define NFSPROC_STATFS 17 #endif /* _LINUX_NFS2_H */ linux/nfs3.h 0000644 00000004625 15063602052 0006733 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * NFSv3 protocol definitions */ #ifndef _LINUX_NFS3_H #define _LINUX_NFS3_H #define NFS3_PORT 2049 #define NFS3_MAXDATA 32768 #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX #define NFS3_MAXGROUPS 16 #define NFS3_FHSIZE 64 #define NFS3_COOKIESIZE 4 #define NFS3_CREATEVERFSIZE 8 #define NFS3_COOKIEVERFSIZE 8 #define NFS3_WRITEVERFSIZE 8 #define NFS3_FIFO_DEV (-1) #define NFS3MODE_FMT 0170000 #define NFS3MODE_DIR 0040000 #define NFS3MODE_CHR 0020000 #define NFS3MODE_BLK 0060000 #define NFS3MODE_REG 0100000 #define NFS3MODE_LNK 0120000 #define NFS3MODE_SOCK 0140000 #define NFS3MODE_FIFO 0010000 /* Flags for access() call */ #define NFS3_ACCESS_READ 0x0001 #define NFS3_ACCESS_LOOKUP 0x0002 #define NFS3_ACCESS_MODIFY 0x0004 #define NFS3_ACCESS_EXTEND 0x0008 #define NFS3_ACCESS_DELETE 0x0010 #define NFS3_ACCESS_EXECUTE 0x0020 #define NFS3_ACCESS_FULL 0x003f /* Flags for create mode */ enum nfs3_createmode { NFS3_CREATE_UNCHECKED = 0, NFS3_CREATE_GUARDED = 1, NFS3_CREATE_EXCLUSIVE = 2 }; /* NFSv3 file system properties */ #define NFS3_FSF_LINK 0x0001 #define NFS3_FSF_SYMLINK 0x0002 #define NFS3_FSF_HOMOGENEOUS 0x0008 #define NFS3_FSF_CANSETTIME 0x0010 /* Some shorthands. See fs/nfsd/nfs3proc.c */ #define NFS3_FSF_DEFAULT 0x001B #define NFS3_FSF_BILLYBOY 0x0018 #define NFS3_FSF_READONLY 0x0008 enum nfs3_ftype { NF3NON = 0, NF3REG = 1, NF3DIR = 2, NF3BLK = 3, NF3CHR = 4, NF3LNK = 5, NF3SOCK = 6, NF3FIFO = 7, /* changed from NFSv2 (was 8) */ NF3BAD = 8 }; enum nfs3_time_how { DONT_CHANGE = 0, SET_TO_SERVER_TIME = 1, SET_TO_CLIENT_TIME = 2, }; struct nfs3_fh { unsigned short size; unsigned char data[NFS3_FHSIZE]; }; #define NFS3_VERSION 3 #define NFS3PROC_NULL 0 #define NFS3PROC_GETATTR 1 #define NFS3PROC_SETATTR 2 #define NFS3PROC_LOOKUP 3 #define NFS3PROC_ACCESS 4 #define NFS3PROC_READLINK 5 #define NFS3PROC_READ 6 #define NFS3PROC_WRITE 7 #define NFS3PROC_CREATE 8 #define NFS3PROC_MKDIR 9 #define NFS3PROC_SYMLINK 10 #define NFS3PROC_MKNOD 11 #define NFS3PROC_REMOVE 12 #define NFS3PROC_RMDIR 13 #define NFS3PROC_RENAME 14 #define NFS3PROC_LINK 15 #define NFS3PROC_READDIR 16 #define NFS3PROC_READDIRPLUS 17 #define NFS3PROC_FSSTAT 18 #define NFS3PROC_FSINFO 19 #define NFS3PROC_PATHCONF 20 #define NFS3PROC_COMMIT 21 #define NFS_MNT3_VERSION 3 #endif /* _LINUX_NFS3_H */ linux/nfs4.h 0000644 00000014707 15063602052 0006736 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/nfs4.h * * NFSv4 protocol definitions. * * Copyright (c) 2002 The Regents of the University of Michigan. * All rights reserved. * * Kendrick Smith <kmsmith@umich.edu> * Andy Adamson <andros@umich.edu> */ #ifndef _LINUX_NFS4_H #define _LINUX_NFS4_H #include <linux/types.h> #define NFS4_BITMAP_SIZE 3 #define NFS4_VERIFIER_SIZE 8 #define NFS4_STATEID_SEQID_SIZE 4 #define NFS4_STATEID_OTHER_SIZE 12 #define NFS4_STATEID_SIZE (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE) #define NFS4_FHSIZE 128 #define NFS4_MAXPATHLEN PATH_MAX #define NFS4_MAXNAMLEN NAME_MAX #define NFS4_OPAQUE_LIMIT 1024 #define NFS4_MAX_SESSIONID_LEN 16 #define NFS4_ACCESS_READ 0x0001 #define NFS4_ACCESS_LOOKUP 0x0002 #define NFS4_ACCESS_MODIFY 0x0004 #define NFS4_ACCESS_EXTEND 0x0008 #define NFS4_ACCESS_DELETE 0x0010 #define NFS4_ACCESS_EXECUTE 0x0020 #define NFS4_ACCESS_XAREAD 0x0040 #define NFS4_ACCESS_XAWRITE 0x0080 #define NFS4_ACCESS_XALIST 0x0100 #define NFS4_FH_PERSISTENT 0x0000 #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 #define NFS4_FH_VOLATILE_ANY 0x0002 #define NFS4_FH_VOL_MIGRATION 0x0004 #define NFS4_FH_VOL_RENAME 0x0008 #define NFS4_OPEN_RESULT_CONFIRM 0x0002 #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 #define NFS4_OPEN_RESULT_PRESERVE_UNLINKED 0x0008 #define NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK 0x0020 #define NFS4_SHARE_ACCESS_MASK 0x000F #define NFS4_SHARE_ACCESS_READ 0x0001 #define NFS4_SHARE_ACCESS_WRITE 0x0002 #define NFS4_SHARE_ACCESS_BOTH 0x0003 #define NFS4_SHARE_DENY_READ 0x0001 #define NFS4_SHARE_DENY_WRITE 0x0002 #define NFS4_SHARE_DENY_BOTH 0x0003 /* nfs41 */ #define NFS4_SHARE_WANT_MASK 0xFF00 #define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000 #define NFS4_SHARE_WANT_READ_DELEG 0x0100 #define NFS4_SHARE_WANT_WRITE_DELEG 0x0200 #define NFS4_SHARE_WANT_ANY_DELEG 0x0300 #define NFS4_SHARE_WANT_NO_DELEG 0x0400 #define NFS4_SHARE_WANT_CANCEL 0x0500 #define NFS4_SHARE_WHEN_MASK 0xF0000 #define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 #define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 #define NFS4_CDFC4_FORE 0x1 #define NFS4_CDFC4_BACK 0x2 #define NFS4_CDFC4_BOTH 0x3 #define NFS4_CDFC4_FORE_OR_BOTH 0x3 #define NFS4_CDFC4_BACK_OR_BOTH 0x7 #define NFS4_CDFS4_FORE 0x1 #define NFS4_CDFS4_BACK 0x2 #define NFS4_CDFS4_BOTH 0x3 #define NFS4_SET_TO_SERVER_TIME 0 #define NFS4_SET_TO_CLIENT_TIME 1 #define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0 #define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1 #define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2 #define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3 #define ACL4_SUPPORT_ALLOW_ACL 0x01 #define ACL4_SUPPORT_DENY_ACL 0x02 #define ACL4_SUPPORT_AUDIT_ACL 0x04 #define ACL4_SUPPORT_ALARM_ACL 0x08 #define NFS4_ACL_AUTO_INHERIT 0x00000001 #define NFS4_ACL_PROTECTED 0x00000002 #define NFS4_ACL_DEFAULTED 0x00000004 #define NFS4_ACE_FILE_INHERIT_ACE 0x00000001 #define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002 #define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004 #define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008 #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 #define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 #define NFS4_ACE_INHERITED_ACE 0x00000080 #define NFS4_ACE_READ_DATA 0x00000001 #define NFS4_ACE_LIST_DIRECTORY 0x00000001 #define NFS4_ACE_WRITE_DATA 0x00000002 #define NFS4_ACE_ADD_FILE 0x00000002 #define NFS4_ACE_APPEND_DATA 0x00000004 #define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004 #define NFS4_ACE_READ_NAMED_ATTRS 0x00000008 #define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010 #define NFS4_ACE_EXECUTE 0x00000020 #define NFS4_ACE_DELETE_CHILD 0x00000040 #define NFS4_ACE_READ_ATTRIBUTES 0x00000080 #define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100 #define NFS4_ACE_WRITE_RETENTION 0x00000200 #define NFS4_ACE_WRITE_RETENTION_HOLD 0x00000400 #define NFS4_ACE_DELETE 0x00010000 #define NFS4_ACE_READ_ACL 0x00020000 #define NFS4_ACE_WRITE_ACL 0x00040000 #define NFS4_ACE_WRITE_OWNER 0x00080000 #define NFS4_ACE_SYNCHRONIZE 0x00100000 #define NFS4_ACE_GENERIC_READ 0x00120081 #define NFS4_ACE_GENERIC_WRITE 0x00160106 #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 #define NFS4_ACE_MASK_ALL 0x001F01FF #define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 #define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 #define EXCHGID4_FLAG_BIND_PRINC_STATEID 0x00000100 #define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 #define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 #define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 #define EXCHGID4_FLAG_MASK_PNFS 0x00070000 #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 #define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 #define EXCHGID4_FLAG_SUPP_FENCE_OPS 0x00000004 /* * Since the validity of these bits depends on whether * they're set in the argument or response, have separate * invalid flag masks for arg (_A) and resp (_R). */ #define EXCHGID4_FLAG_MASK_A 0x40070103 #define EXCHGID4_FLAG_MASK_R 0x80070103 #define EXCHGID4_2_FLAG_MASK_R 0x80070107 #define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004 #define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008 #define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010 #define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020 #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 #define SEQ4_STATUS_LEASE_MOVED 0x00000080 #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 #define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200 #define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400 #define NFS4_SECINFO_STYLE4_CURRENT_FH 0 #define NFS4_SECINFO_STYLE4_PARENT 1 #define NFS4_MAX_UINT64 (~(__u64)0) /* An NFS4 sessions server must support at least NFS4_MAX_OPS operations. * If a compound requires more operations, adjust NFS4_MAX_OPS accordingly. */ #define NFS4_MAX_OPS 8 /* Our NFS4 client back channel server only wants the cb_sequene and the * actual operation per compound */ #define NFS4_MAX_BACK_CHANNEL_OPS 2 #endif /* _LINUX_NFS4_H */ /* * Local variables: * c-basic-offset: 8 * End: */ linux/nfs4_mount.h 0000644 00000003614 15063602052 0010153 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NFS4_MOUNT_H #define _LINUX_NFS4_MOUNT_H /* * linux/include/linux/nfs4_mount.h * * Copyright (C) 2002 Trond Myklebust * * structure passed from user-space to kernel-space during an nfsv4 mount */ /* * WARNING! Do not delete or change the order of these fields. If * a new field is required then add it to the end. The version field * tracks which fields are present. This will ensure some measure of * mount-to-kernel version compatibility. Some of these aren't used yet * but here they are anyway. */ #define NFS4_MOUNT_VERSION 1 struct nfs_string { unsigned int len; const char * data; }; struct nfs4_mount_data { int version; /* 1 */ int flags; /* 1 */ int rsize; /* 1 */ int wsize; /* 1 */ int timeo; /* 1 */ int retrans; /* 1 */ int acregmin; /* 1 */ int acregmax; /* 1 */ int acdirmin; /* 1 */ int acdirmax; /* 1 */ /* see the definition of 'struct clientaddr4' in RFC3010 */ struct nfs_string client_addr; /* 1 */ /* Mount path */ struct nfs_string mnt_path; /* 1 */ /* Server details */ struct nfs_string hostname; /* 1 */ /* Server IP address */ unsigned int host_addrlen; /* 1 */ struct sockaddr * host_addr; /* 1 */ /* Transport protocol to use */ int proto; /* 1 */ /* Pseudo-flavours to use for authentication. See RFC2623 */ int auth_flavourlen; /* 1 */ int *auth_flavours; /* 1 */ }; /* bits in the flags field */ /* Note: the fields that correspond to existing NFSv2/v3 mount options * should mirror the values from include/linux/nfs_mount.h */ #define NFS4_MOUNT_SOFT 0x0001 /* 1 */ #define NFS4_MOUNT_INTR 0x0002 /* 1 */ #define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ #define NFS4_MOUNT_NOAC 0x0020 /* 1 */ #define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ #define NFS4_MOUNT_UNSHARED 0x8000 /* 1 */ #define NFS4_MOUNT_FLAGMASK 0x9033 #endif linux/nfs_fs.h 0000644 00000003151 15063602052 0007331 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/nfs_fs.h * * Copyright (C) 1992 Rick Sladkey * * OS-specific nfs filesystem definitions and declarations */ #ifndef _LINUX_NFS_FS_H #define _LINUX_NFS_FS_H #include <linux/magic.h> /* Default timeout values */ #define NFS_DEF_UDP_TIMEO (11) #define NFS_DEF_UDP_RETRANS (3) #define NFS_DEF_TCP_TIMEO (600) #define NFS_DEF_TCP_RETRANS (2) #define NFS_MAX_UDP_TIMEOUT (60*HZ) #define NFS_MAX_TCP_TIMEOUT (600*HZ) #define NFS_DEF_ACREGMIN (3) #define NFS_DEF_ACREGMAX (60) #define NFS_DEF_ACDIRMIN (30) #define NFS_DEF_ACDIRMAX (60) /* * When flushing a cluster of dirty pages, there can be different * strategies: */ #define FLUSH_SYNC 1 /* file being synced, or contention */ #define FLUSH_STABLE 4 /* commit to stable storage */ #define FLUSH_LOWPRI 8 /* low priority background flush */ #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ #define FLUSH_COND_STABLE 32 /* conditional stable write - only stable * if everything fits in one RPC */ /* * NFS debug flags */ #define NFSDBG_VFS 0x0001 #define NFSDBG_DIRCACHE 0x0002 #define NFSDBG_LOOKUPCACHE 0x0004 #define NFSDBG_PAGECACHE 0x0008 #define NFSDBG_PROC 0x0010 #define NFSDBG_XDR 0x0020 #define NFSDBG_FILE 0x0040 #define NFSDBG_ROOT 0x0080 #define NFSDBG_CALLBACK 0x0100 #define NFSDBG_CLIENT 0x0200 #define NFSDBG_MOUNT 0x0400 #define NFSDBG_FSCACHE 0x0800 #define NFSDBG_PNFS 0x1000 #define NFSDBG_PNFS_LD 0x2000 #define NFSDBG_STATE 0x4000 #define NFSDBG_XATTRCACHE 0x8000 #define NFSDBG_ALL 0xFFFF #endif /* _LINUX_NFS_FS_H */ linux/nfs_idmap.h 0000644 00000004303 15063602053 0010014 0 ustar 00 /* * include/uapi/linux/nfs_idmap.h * * UID and GID to name mapping for clients. * * Copyright (c) 2002 The Regents of the University of Michigan. * All rights reserved. * * Marius Aamodt Eriksen <marius@umich.edu> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef NFS_IDMAP_H #define NFS_IDMAP_H #include <linux/types.h> /* XXX from bits/utmp.h */ #define IDMAP_NAMESZ 128 #define IDMAP_TYPE_USER 0 #define IDMAP_TYPE_GROUP 1 #define IDMAP_CONV_IDTONAME 0 #define IDMAP_CONV_NAMETOID 1 #define IDMAP_STATUS_INVALIDMSG 0x01 #define IDMAP_STATUS_AGAIN 0x02 #define IDMAP_STATUS_LOOKUPFAIL 0x04 #define IDMAP_STATUS_SUCCESS 0x08 struct idmap_msg { __u8 im_type; __u8 im_conv; char im_name[IDMAP_NAMESZ]; __u32 im_id; __u8 im_status; }; #endif /* NFS_IDMAP_H */ linux/nfs_mount.h 0000644 00000004136 15063602053 0010070 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NFS_MOUNT_H #define _LINUX_NFS_MOUNT_H /* * linux/include/linux/nfs_mount.h * * Copyright (C) 1992 Rick Sladkey * * structure passed from user-space to kernel-space during an nfs mount */ #include <linux/in.h> #include <linux/nfs.h> #include <linux/nfs2.h> #include <linux/nfs3.h> /* * WARNING! Do not delete or change the order of these fields. If * a new field is required then add it to the end. The version field * tracks which fields are present. This will ensure some measure of * mount-to-kernel version compatibility. Some of these aren't used yet * but here they are anyway. */ #define NFS_MOUNT_VERSION 6 #define NFS_MAX_CONTEXT_LEN 256 struct nfs_mount_data { int version; /* 1 */ int fd; /* 1 */ struct nfs2_fh old_root; /* 1 */ int flags; /* 1 */ int rsize; /* 1 */ int wsize; /* 1 */ int timeo; /* 1 */ int retrans; /* 1 */ int acregmin; /* 1 */ int acregmax; /* 1 */ int acdirmin; /* 1 */ int acdirmax; /* 1 */ struct sockaddr_in addr; /* 1 */ char hostname[NFS_MAXNAMLEN + 1]; /* 1 */ int namlen; /* 2 */ unsigned int bsize; /* 3 */ struct nfs3_fh root; /* 4 */ int pseudoflavor; /* 5 */ char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ }; /* bits in the flags field visible to user space */ #define NFS_MOUNT_SOFT 0x0001 /* 1 */ #define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */ #define NFS_MOUNT_SECURE 0x0004 /* 1 */ #define NFS_MOUNT_POSIX 0x0008 /* 1 */ #define NFS_MOUNT_NOCTO 0x0010 /* 1 */ #define NFS_MOUNT_NOAC 0x0020 /* 1 */ #define NFS_MOUNT_TCP 0x0040 /* 2 */ #define NFS_MOUNT_VER3 0x0080 /* 3 */ #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ #define NFS_MOUNT_NOACL 0x0800 /* 4 */ #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 non-text parsed mount data only */ #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ #define NFS_MOUNT_FLAGMASK 0xFFFF #endif linux/nfsacl.h 0000644 00000001316 15063602053 0007323 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * File: linux/nfsacl.h * * (C) 2003 Andreas Gruenbacher <agruen@suse.de> */ #ifndef __LINUX_NFSACL_H #define __LINUX_NFSACL_H #define NFS_ACL_PROGRAM 100227 #define ACLPROC2_NULL 0 #define ACLPROC2_GETACL 1 #define ACLPROC2_SETACL 2 #define ACLPROC2_GETATTR 3 #define ACLPROC2_ACCESS 4 #define ACLPROC3_NULL 0 #define ACLPROC3_GETACL 1 #define ACLPROC3_SETACL 2 /* Flags for the getacl/setacl mode */ #define NFS_ACL 0x0001 #define NFS_ACLCNT 0x0002 #define NFS_DFACL 0x0004 #define NFS_DFACLCNT 0x0008 #define NFS_ACL_MASK 0x000f /* Flag for Default ACL entries */ #define NFS_ACL_DEFAULT 0x1000 #endif /* __LINUX_NFSACL_H */ linux/nilfs2_api.h 0000644 00000016645 15063602053 0010116 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * nilfs2_api.h - NILFS2 user space API * * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. */ #ifndef _LINUX_NILFS2_API_H #define _LINUX_NILFS2_API_H #include <linux/types.h> #include <linux/ioctl.h> /** * struct nilfs_cpinfo - checkpoint information * @ci_flags: flags * @ci_pad: padding * @ci_cno: checkpoint number * @ci_create: creation timestamp * @ci_nblk_inc: number of blocks incremented by this checkpoint * @ci_inodes_count: inodes count * @ci_blocks_count: blocks count * @ci_next: next checkpoint number in snapshot list */ struct nilfs_cpinfo { __u32 ci_flags; __u32 ci_pad; __u64 ci_cno; __u64 ci_create; __u64 ci_nblk_inc; __u64 ci_inodes_count; __u64 ci_blocks_count; __u64 ci_next; }; /* checkpoint flags */ enum { NILFS_CPINFO_SNAPSHOT, NILFS_CPINFO_INVALID, NILFS_CPINFO_SKETCH, NILFS_CPINFO_MINOR, }; #define NILFS_CPINFO_FNS(flag, name) \ static __inline__ int \ nilfs_cpinfo_##name(const struct nilfs_cpinfo *cpinfo) \ { \ return !!(cpinfo->ci_flags & (1UL << NILFS_CPINFO_##flag)); \ } NILFS_CPINFO_FNS(SNAPSHOT, snapshot) NILFS_CPINFO_FNS(INVALID, invalid) NILFS_CPINFO_FNS(MINOR, minor) /** * nilfs_suinfo - segment usage information * @sui_lastmod: timestamp of last modification * @sui_nblocks: number of written blocks in segment * @sui_flags: segment usage flags */ struct nilfs_suinfo { __u64 sui_lastmod; __u32 sui_nblocks; __u32 sui_flags; }; /* segment usage flags */ enum { NILFS_SUINFO_ACTIVE, NILFS_SUINFO_DIRTY, NILFS_SUINFO_ERROR, }; #define NILFS_SUINFO_FNS(flag, name) \ static __inline__ int \ nilfs_suinfo_##name(const struct nilfs_suinfo *si) \ { \ return si->sui_flags & (1UL << NILFS_SUINFO_##flag); \ } NILFS_SUINFO_FNS(ACTIVE, active) NILFS_SUINFO_FNS(DIRTY, dirty) NILFS_SUINFO_FNS(ERROR, error) static __inline__ int nilfs_suinfo_clean(const struct nilfs_suinfo *si) { return !si->sui_flags; } /** * nilfs_suinfo_update - segment usage information update * @sup_segnum: segment number * @sup_flags: flags for which fields are active in sup_sui * @sup_reserved: reserved necessary for alignment * @sup_sui: segment usage information */ struct nilfs_suinfo_update { __u64 sup_segnum; __u32 sup_flags; __u32 sup_reserved; struct nilfs_suinfo sup_sui; }; enum { NILFS_SUINFO_UPDATE_LASTMOD, NILFS_SUINFO_UPDATE_NBLOCKS, NILFS_SUINFO_UPDATE_FLAGS, __NR_NILFS_SUINFO_UPDATE_FIELDS, }; #define NILFS_SUINFO_UPDATE_FNS(flag, name) \ static __inline__ void \ nilfs_suinfo_update_set_##name(struct nilfs_suinfo_update *sup) \ { \ sup->sup_flags |= 1UL << NILFS_SUINFO_UPDATE_##flag; \ } \ static __inline__ void \ nilfs_suinfo_update_clear_##name(struct nilfs_suinfo_update *sup) \ { \ sup->sup_flags &= ~(1UL << NILFS_SUINFO_UPDATE_##flag); \ } \ static __inline__ int \ nilfs_suinfo_update_##name(const struct nilfs_suinfo_update *sup) \ { \ return !!(sup->sup_flags & (1UL << NILFS_SUINFO_UPDATE_##flag));\ } NILFS_SUINFO_UPDATE_FNS(LASTMOD, lastmod) NILFS_SUINFO_UPDATE_FNS(NBLOCKS, nblocks) NILFS_SUINFO_UPDATE_FNS(FLAGS, flags) enum { NILFS_CHECKPOINT, NILFS_SNAPSHOT, }; /** * struct nilfs_cpmode - change checkpoint mode structure * @cm_cno: checkpoint number * @cm_mode: mode of checkpoint * @cm_pad: padding */ struct nilfs_cpmode { __u64 cm_cno; __u32 cm_mode; __u32 cm_pad; }; /** * struct nilfs_argv - argument vector * @v_base: pointer on data array from userspace * @v_nmembs: number of members in data array * @v_size: size of data array in bytes * @v_flags: flags * @v_index: start number of target data items */ struct nilfs_argv { __u64 v_base; __u32 v_nmembs; /* number of members */ __u16 v_size; /* size of members */ __u16 v_flags; __u64 v_index; }; /** * struct nilfs_period - period of checkpoint numbers * @p_start: start checkpoint number (inclusive) * @p_end: end checkpoint number (exclusive) */ struct nilfs_period { __u64 p_start; __u64 p_end; }; /** * struct nilfs_cpstat - checkpoint statistics * @cs_cno: checkpoint number * @cs_ncps: number of checkpoints * @cs_nsss: number of snapshots */ struct nilfs_cpstat { __u64 cs_cno; __u64 cs_ncps; __u64 cs_nsss; }; /** * struct nilfs_sustat - segment usage statistics * @ss_nsegs: number of segments * @ss_ncleansegs: number of clean segments * @ss_ndirtysegs: number of dirty segments * @ss_ctime: creation time of the last segment * @ss_nongc_ctime: creation time of the last segment not for GC * @ss_prot_seq: least sequence number of segments which must not be reclaimed */ struct nilfs_sustat { __u64 ss_nsegs; __u64 ss_ncleansegs; __u64 ss_ndirtysegs; __u64 ss_ctime; __u64 ss_nongc_ctime; __u64 ss_prot_seq; }; /** * struct nilfs_vinfo - virtual block number information * @vi_vblocknr: virtual block number * @vi_start: start checkpoint number (inclusive) * @vi_end: end checkpoint number (exclusive) * @vi_blocknr: disk block number */ struct nilfs_vinfo { __u64 vi_vblocknr; __u64 vi_start; __u64 vi_end; __u64 vi_blocknr; }; /** * struct nilfs_vdesc - descriptor of virtual block number * @vd_ino: inode number * @vd_cno: checkpoint number * @vd_vblocknr: virtual block number * @vd_period: period of checkpoint numbers * @vd_blocknr: disk block number * @vd_offset: logical block offset inside a file * @vd_flags: flags (data or node block) * @vd_pad: padding */ struct nilfs_vdesc { __u64 vd_ino; __u64 vd_cno; __u64 vd_vblocknr; struct nilfs_period vd_period; __u64 vd_blocknr; __u64 vd_offset; __u32 vd_flags; __u32 vd_pad; }; /** * struct nilfs_bdesc - descriptor of disk block number * @bd_ino: inode number * @bd_oblocknr: disk block address (for skipping dead blocks) * @bd_blocknr: disk block address * @bd_offset: logical block offset inside a file * @bd_level: level in the b-tree organization * @bd_pad: padding */ struct nilfs_bdesc { __u64 bd_ino; __u64 bd_oblocknr; __u64 bd_blocknr; __u64 bd_offset; __u32 bd_level; __u32 bd_pad; }; #define NILFS_IOCTL_IDENT 'n' #define NILFS_IOCTL_CHANGE_CPMODE \ _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode) #define NILFS_IOCTL_DELETE_CHECKPOINT \ _IOW(NILFS_IOCTL_IDENT, 0x81, __u64) #define NILFS_IOCTL_GET_CPINFO \ _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv) #define NILFS_IOCTL_GET_CPSTAT \ _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat) #define NILFS_IOCTL_GET_SUINFO \ _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv) #define NILFS_IOCTL_GET_SUSTAT \ _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat) #define NILFS_IOCTL_GET_VINFO \ _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv) #define NILFS_IOCTL_GET_BDESCS \ _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv) #define NILFS_IOCTL_CLEAN_SEGMENTS \ _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5]) #define NILFS_IOCTL_SYNC \ _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64) #define NILFS_IOCTL_RESIZE \ _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64) #define NILFS_IOCTL_SET_ALLOC_RANGE \ _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2]) #define NILFS_IOCTL_SET_SUINFO \ _IOW(NILFS_IOCTL_IDENT, 0x8D, struct nilfs_argv) #endif /* _LINUX_NILFS2_API_H */ linux/nilfs2_ondisk.h 0000644 00000043161 15063602053 0010625 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * nilfs2_ondisk.h - NILFS2 on-disk structures * * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. */ /* * linux/include/linux/ext2_fs.h * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * from * * linux/include/linux/minix_fs.h * * Copyright (C) 1991, 1992 Linus Torvalds */ #ifndef _LINUX_NILFS2_ONDISK_H #define _LINUX_NILFS2_ONDISK_H #include <linux/types.h> #include <linux/magic.h> #define NILFS_INODE_BMAP_SIZE 7 /** * struct nilfs_inode - structure of an inode on disk * @i_blocks: blocks count * @i_size: size in bytes * @i_ctime: creation time (seconds) * @i_mtime: modification time (seconds) * @i_ctime_nsec: creation time (nano seconds) * @i_mtime_nsec: modification time (nano seconds) * @i_uid: user id * @i_gid: group id * @i_mode: file mode * @i_links_count: links count * @i_flags: file flags * @i_bmap: block mapping * @i_xattr: extended attributes * @i_generation: file generation (for NFS) * @i_pad: padding */ struct nilfs_inode { __le64 i_blocks; __le64 i_size; __le64 i_ctime; __le64 i_mtime; __le32 i_ctime_nsec; __le32 i_mtime_nsec; __le32 i_uid; __le32 i_gid; __le16 i_mode; __le16 i_links_count; __le32 i_flags; __le64 i_bmap[NILFS_INODE_BMAP_SIZE]; #define i_device_code i_bmap[0] __le64 i_xattr; __le32 i_generation; __le32 i_pad; }; #define NILFS_MIN_INODE_SIZE 128 /** * struct nilfs_super_root - structure of super root * @sr_sum: check sum * @sr_bytes: byte count of the structure * @sr_flags: flags (reserved) * @sr_nongc_ctime: write time of the last segment not for cleaner operation * @sr_dat: DAT file inode * @sr_cpfile: checkpoint file inode * @sr_sufile: segment usage file inode */ struct nilfs_super_root { __le32 sr_sum; __le16 sr_bytes; __le16 sr_flags; __le64 sr_nongc_ctime; struct nilfs_inode sr_dat; struct nilfs_inode sr_cpfile; struct nilfs_inode sr_sufile; }; #define NILFS_SR_MDT_OFFSET(inode_size, i) \ ((unsigned long)&((struct nilfs_super_root *)0)->sr_dat + \ (inode_size) * (i)) #define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0) #define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1) #define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2) #define NILFS_SR_BYTES(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3) /* * Maximal mount counts */ #define NILFS_DFL_MAX_MNT_COUNT 50 /* 50 mounts */ /* * File system states (sbp->s_state, nilfs->ns_mount_state) */ #define NILFS_VALID_FS 0x0001 /* Unmounted cleanly */ #define NILFS_ERROR_FS 0x0002 /* Errors detected */ #define NILFS_RESIZE_FS 0x0004 /* Resize required */ /* * Mount flags (sbi->s_mount_opt) */ #define NILFS_MOUNT_ERROR_MODE 0x0070 /* Error mode mask */ #define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ #define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ #define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ #define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ #define NILFS_MOUNT_STRICT_ORDER 0x2000 /* * Apply strict in-order * semantics also for data */ #define NILFS_MOUNT_NORECOVERY 0x4000 /* * Disable write access during * mount-time recovery */ #define NILFS_MOUNT_DISCARD 0x8000 /* Issue DISCARD requests */ /** * struct nilfs_super_block - structure of super block on disk */ struct nilfs_super_block { /*00*/ __le32 s_rev_level; /* Revision level */ __le16 s_minor_rev_level; /* minor revision level */ __le16 s_magic; /* Magic signature */ __le16 s_bytes; /* * Bytes count of CRC calculation * for this structure. s_reserved * is excluded. */ __le16 s_flags; /* flags */ __le32 s_crc_seed; /* Seed value of CRC calculation */ /*10*/ __le32 s_sum; /* Check sum of super block */ __le32 s_log_block_size; /* * Block size represented as follows * blocksize = * 1 << (s_log_block_size + 10) */ __le64 s_nsegments; /* Number of segments in filesystem */ /*20*/ __le64 s_dev_size; /* block device size in bytes */ __le64 s_first_data_block; /* 1st seg disk block number */ /*30*/ __le32 s_blocks_per_segment; /* number of blocks per full segment */ __le32 s_r_segments_percentage; /* Reserved segments percentage */ __le64 s_last_cno; /* Last checkpoint number */ /*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */ __le64 s_last_seq; /* seq. number of seg written last */ /*50*/ __le64 s_free_blocks_count; /* Free blocks count */ __le64 s_ctime; /* * Creation time (execution time of * newfs) */ /*60*/ __le64 s_mtime; /* Mount time */ __le64 s_wtime; /* Write time */ /*70*/ __le16 s_mnt_count; /* Mount count */ __le16 s_max_mnt_count; /* Maximal mount count */ __le16 s_state; /* File system state */ __le16 s_errors; /* Behaviour when detecting errors */ __le64 s_lastcheck; /* time of last check */ /*80*/ __le32 s_checkinterval; /* max. time between checks */ __le32 s_creator_os; /* OS */ __le16 s_def_resuid; /* Default uid for reserved blocks */ __le16 s_def_resgid; /* Default gid for reserved blocks */ __le32 s_first_ino; /* First non-reserved inode */ /*90*/ __le16 s_inode_size; /* Size of an inode */ __le16 s_dat_entry_size; /* Size of a dat entry */ __le16 s_checkpoint_size; /* Size of a checkpoint */ __le16 s_segment_usage_size; /* Size of a segment usage */ /*98*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ /*A8*/ char s_volume_name[80]; /* volume name */ /*F8*/ __le32 s_c_interval; /* Commit interval of segment */ __le32 s_c_block_max; /* * Threshold of data amount for * the segment construction */ /*100*/ __le64 s_feature_compat; /* Compatible feature set */ __le64 s_feature_compat_ro; /* Read-only compatible feature set */ __le64 s_feature_incompat; /* Incompatible feature set */ __u32 s_reserved[186]; /* padding to the end of the block */ }; /* * Codes for operating systems */ #define NILFS_OS_LINUX 0 /* Codes from 1 to 4 are reserved to keep compatibility with ext2 creator-OS */ /* * Revision levels */ #define NILFS_CURRENT_REV 2 /* current major revision */ #define NILFS_MINOR_REV 0 /* minor revision */ #define NILFS_MIN_SUPP_REV 2 /* minimum supported revision */ /* * Feature set definitions * * If there is a bit set in the incompatible feature set that the kernel * doesn't know about, it should refuse to mount the filesystem. */ #define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL #define NILFS_FEATURE_COMPAT_SUPP 0ULL #define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT #define NILFS_FEATURE_INCOMPAT_SUPP 0ULL /* * Bytes count of super_block for CRC-calculation */ #define NILFS_SB_BYTES \ ((long)&((struct nilfs_super_block *)0)->s_reserved) /* * Special inode number */ #define NILFS_ROOT_INO 2 /* Root file inode */ #define NILFS_DAT_INO 3 /* DAT file */ #define NILFS_CPFILE_INO 4 /* checkpoint file */ #define NILFS_SUFILE_INO 5 /* segment usage file */ #define NILFS_IFILE_INO 6 /* ifile */ #define NILFS_ATIME_INO 7 /* Atime file (reserved) */ #define NILFS_XATTR_INO 8 /* Xattribute file (reserved) */ #define NILFS_SKETCH_INO 10 /* Sketch file */ #define NILFS_USER_INO 11 /* Fisrt user's file inode number */ #define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ #define NILFS_SEG_MIN_BLOCKS 16 /* * Minimum number of blocks in * a full segment */ #define NILFS_PSEG_MIN_BLOCKS 2 /* * Minimum number of blocks in * a partial segment */ #define NILFS_MIN_NRSVSEGS 8 /* * Minimum number of reserved * segments */ /* * We call DAT, cpfile, and sufile root metadata files. Inodes of * these files are written in super root block instead of ifile, and * garbage collector doesn't keep any past versions of these files. */ #define NILFS_ROOT_METADATA_FILE(ino) \ ((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO) /* * bytes offset of secondary super block */ #define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12) /* * Maximal count of links to a file */ #define NILFS_LINK_MAX 32000 /* * Structure of a directory entry * (Same as ext2) */ #define NILFS_NAME_LEN 255 /* * Block size limitations */ #define NILFS_MIN_BLOCK_SIZE 1024 #define NILFS_MAX_BLOCK_SIZE 65536 /* * The new version of the directory entry. Since V0 structures are * stored in intel byte order, and the name_len field could never be * bigger than 255 chars, it's safe to reclaim the extra byte for the * file_type field. */ struct nilfs_dir_entry { __le64 inode; /* Inode number */ __le16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; /* Dir entry type (file, dir, etc) */ char name[NILFS_NAME_LEN]; /* File name */ char pad; }; /* * NILFS directory file types. Only the low 3 bits are used. The * other bits are reserved for now. */ enum { NILFS_FT_UNKNOWN, NILFS_FT_REG_FILE, NILFS_FT_DIR, NILFS_FT_CHRDEV, NILFS_FT_BLKDEV, NILFS_FT_FIFO, NILFS_FT_SOCK, NILFS_FT_SYMLINK, NILFS_FT_MAX }; /* * NILFS_DIR_PAD defines the directory entries boundaries * * NOTE: It must be a multiple of 8 */ #define NILFS_DIR_PAD 8 #define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) #define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ ~NILFS_DIR_ROUND) #define NILFS_MAX_REC_LEN ((1 << 16) - 1) /** * struct nilfs_finfo - file information * @fi_ino: inode number * @fi_cno: checkpoint number * @fi_nblocks: number of blocks (including intermediate blocks) * @fi_ndatablk: number of file data blocks */ struct nilfs_finfo { __le64 fi_ino; __le64 fi_cno; __le32 fi_nblocks; __le32 fi_ndatablk; }; /** * struct nilfs_binfo_v - information on a data block (except DAT) * @bi_vblocknr: virtual block number * @bi_blkoff: block offset */ struct nilfs_binfo_v { __le64 bi_vblocknr; __le64 bi_blkoff; }; /** * struct nilfs_binfo_dat - information on a DAT node block * @bi_blkoff: block offset * @bi_level: level * @bi_pad: padding */ struct nilfs_binfo_dat { __le64 bi_blkoff; __u8 bi_level; __u8 bi_pad[7]; }; /** * union nilfs_binfo: block information * @bi_v: nilfs_binfo_v structure * @bi_dat: nilfs_binfo_dat structure */ union nilfs_binfo { struct nilfs_binfo_v bi_v; struct nilfs_binfo_dat bi_dat; }; /** * struct nilfs_segment_summary - segment summary header * @ss_datasum: checksum of data * @ss_sumsum: checksum of segment summary * @ss_magic: magic number * @ss_bytes: size of this structure in bytes * @ss_flags: flags * @ss_seq: sequence number * @ss_create: creation timestamp * @ss_next: next segment * @ss_nblocks: number of blocks * @ss_nfinfo: number of finfo structures * @ss_sumbytes: total size of segment summary in bytes * @ss_pad: padding * @ss_cno: checkpoint number */ struct nilfs_segment_summary { __le32 ss_datasum; __le32 ss_sumsum; __le32 ss_magic; __le16 ss_bytes; __le16 ss_flags; __le64 ss_seq; __le64 ss_create; __le64 ss_next; __le32 ss_nblocks; __le32 ss_nfinfo; __le32 ss_sumbytes; __le32 ss_pad; __le64 ss_cno; /* array of finfo structures */ }; #define NILFS_SEGSUM_MAGIC 0x1eaffa11 /* segment summary magic number */ /* * Segment summary flags */ #define NILFS_SS_LOGBGN 0x0001 /* begins a logical segment */ #define NILFS_SS_LOGEND 0x0002 /* ends a logical segment */ #define NILFS_SS_SR 0x0004 /* has super root */ #define NILFS_SS_SYNDT 0x0008 /* includes data only updates */ #define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ /** * struct nilfs_btree_node - header of B-tree node block * @bn_flags: flags * @bn_level: level * @bn_nchildren: number of children * @bn_pad: padding */ struct nilfs_btree_node { __u8 bn_flags; __u8 bn_level; __le16 bn_nchildren; __le32 bn_pad; }; /* flags */ #define NILFS_BTREE_NODE_ROOT 0x01 /* level */ #define NILFS_BTREE_LEVEL_DATA 0 #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) #define NILFS_BTREE_LEVEL_MAX 14 /* Max level (exclusive) */ /** * struct nilfs_direct_node - header of built-in bmap array * @dn_flags: flags * @dn_pad: padding */ struct nilfs_direct_node { __u8 dn_flags; __u8 pad[7]; }; /** * struct nilfs_palloc_group_desc - block group descriptor * @pg_nfrees: number of free entries in block group */ struct nilfs_palloc_group_desc { __le32 pg_nfrees; }; /** * struct nilfs_dat_entry - disk address translation entry * @de_blocknr: block number * @de_start: start checkpoint number * @de_end: end checkpoint number * @de_rsv: reserved for future use */ struct nilfs_dat_entry { __le64 de_blocknr; __le64 de_start; __le64 de_end; __le64 de_rsv; }; #define NILFS_MIN_DAT_ENTRY_SIZE 32 /** * struct nilfs_snapshot_list - snapshot list * @ssl_next: next checkpoint number on snapshot list * @ssl_prev: previous checkpoint number on snapshot list */ struct nilfs_snapshot_list { __le64 ssl_next; __le64 ssl_prev; }; /** * struct nilfs_checkpoint - checkpoint structure * @cp_flags: flags * @cp_checkpoints_count: checkpoints count in a block * @cp_snapshot_list: snapshot list * @cp_cno: checkpoint number * @cp_create: creation timestamp * @cp_nblk_inc: number of blocks incremented by this checkpoint * @cp_inodes_count: inodes count * @cp_blocks_count: blocks count * @cp_ifile_inode: inode of ifile */ struct nilfs_checkpoint { __le32 cp_flags; __le32 cp_checkpoints_count; struct nilfs_snapshot_list cp_snapshot_list; __le64 cp_cno; __le64 cp_create; __le64 cp_nblk_inc; __le64 cp_inodes_count; __le64 cp_blocks_count; /* * Do not change the byte offset of ifile inode. * To keep the compatibility of the disk format, * additional fields should be added behind cp_ifile_inode. */ struct nilfs_inode cp_ifile_inode; }; #define NILFS_MIN_CHECKPOINT_SIZE (64 + NILFS_MIN_INODE_SIZE) /* checkpoint flags */ enum { NILFS_CHECKPOINT_SNAPSHOT, NILFS_CHECKPOINT_INVALID, NILFS_CHECKPOINT_SKETCH, NILFS_CHECKPOINT_MINOR, }; #define NILFS_CHECKPOINT_FNS(flag, name) \ static __inline__ void \ nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ { \ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ (1UL << NILFS_CHECKPOINT_##flag)); \ } \ static __inline__ void \ nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ { \ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ ~(1UL << NILFS_CHECKPOINT_##flag)); \ } \ static __inline__ int \ nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ { \ return !!(le32_to_cpu(cp->cp_flags) & \ (1UL << NILFS_CHECKPOINT_##flag)); \ } NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot) NILFS_CHECKPOINT_FNS(INVALID, invalid) NILFS_CHECKPOINT_FNS(MINOR, minor) /** * struct nilfs_cpfile_header - checkpoint file header * @ch_ncheckpoints: number of checkpoints * @ch_nsnapshots: number of snapshots * @ch_snapshot_list: snapshot list */ struct nilfs_cpfile_header { __le64 ch_ncheckpoints; __le64 ch_nsnapshots; struct nilfs_snapshot_list ch_snapshot_list; }; #define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET \ ((sizeof(struct nilfs_cpfile_header) + \ sizeof(struct nilfs_checkpoint) - 1) / \ sizeof(struct nilfs_checkpoint)) /** * struct nilfs_segment_usage - segment usage * @su_lastmod: last modified timestamp * @su_nblocks: number of blocks in segment * @su_flags: flags */ struct nilfs_segment_usage { __le64 su_lastmod; __le32 su_nblocks; __le32 su_flags; }; #define NILFS_MIN_SEGMENT_USAGE_SIZE 16 /* segment usage flag */ enum { NILFS_SEGMENT_USAGE_ACTIVE, NILFS_SEGMENT_USAGE_DIRTY, NILFS_SEGMENT_USAGE_ERROR, }; #define NILFS_SEGMENT_USAGE_FNS(flag, name) \ static __inline__ void \ nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ { \ su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \ (1UL << NILFS_SEGMENT_USAGE_##flag));\ } \ static __inline__ void \ nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ { \ su->su_flags = \ cpu_to_le32(le32_to_cpu(su->su_flags) & \ ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ } \ static __inline__ int \ nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ { \ return !!(le32_to_cpu(su->su_flags) & \ (1UL << NILFS_SEGMENT_USAGE_##flag)); \ } NILFS_SEGMENT_USAGE_FNS(ACTIVE, active) NILFS_SEGMENT_USAGE_FNS(DIRTY, dirty) NILFS_SEGMENT_USAGE_FNS(ERROR, error) static __inline__ void nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) { su->su_lastmod = cpu_to_le64(0); su->su_nblocks = cpu_to_le32(0); su->su_flags = cpu_to_le32(0); } static __inline__ int nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) { return !le32_to_cpu(su->su_flags); } /** * struct nilfs_sufile_header - segment usage file header * @sh_ncleansegs: number of clean segments * @sh_ndirtysegs: number of dirty segments * @sh_last_alloc: last allocated segment number */ struct nilfs_sufile_header { __le64 sh_ncleansegs; __le64 sh_ndirtysegs; __le64 sh_last_alloc; /* ... */ }; #define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET \ ((sizeof(struct nilfs_sufile_header) + \ sizeof(struct nilfs_segment_usage) - 1) / \ sizeof(struct nilfs_segment_usage)) #endif /* _LINUX_NILFS2_ONDISK_H */ linux/nitro_enclaves.h 0000644 00000031540 15063602053 0011072 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ #ifndef _LINUX_NITRO_ENCLAVES_H_ #define _LINUX_NITRO_ENCLAVES_H_ #include <linux/types.h> /** * DOC: Nitro Enclaves (NE) Kernel Driver Interface */ /** * NE_CREATE_VM - The command is used to create a slot that is associated with * an enclave VM. * The generated unique slot id is an output parameter. * The ioctl can be invoked on the /dev/nitro_enclaves fd, before * setting any resources, such as memory and vCPUs, for an * enclave. Memory and vCPUs are set for the slot mapped to an enclave. * A NE CPU pool has to be set before calling this function. The * pool can be set after the NE driver load, using * /sys/module/nitro_enclaves/parameters/ne_cpus. * Its format is the detailed in the cpu-lists section: * https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html * CPU 0 and its siblings have to remain available for the * primary / parent VM, so they cannot be set for enclaves. Full * CPU core(s), from the same NUMA node, need(s) to be included * in the CPU pool. * * Context: Process context. * Return: * * Enclave file descriptor - Enclave file descriptor used with * ioctl calls to set vCPUs and memory * regions, then start the enclave. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_to_user() failure. * * ENOMEM - Memory allocation failure for internal * bookkeeping variables. * * NE_ERR_NO_CPUS_AVAIL_IN_POOL - No NE CPU pool set / no CPUs available * in the pool. * * Error codes from get_unused_fd_flags() and anon_inode_getfile(). * * Error codes from the NE PCI device request. */ #define NE_CREATE_VM _IOR(0xAE, 0x20, __u64) /** * NE_ADD_VCPU - The command is used to set a vCPU for an enclave. The vCPU can * be auto-chosen from the NE CPU pool or it can be set by the * caller, with the note that it needs to be available in the NE * CPU pool. Full CPU core(s), from the same NUMA node, need(s) to * be associated with an enclave. * The vCPU id is an input / output parameter. If its value is 0, * then a CPU is chosen from the enclave CPU pool and returned via * this parameter. * The ioctl can be invoked on the enclave fd, before an enclave * is started. * * Context: Process context. * Return: * * 0 - Logic succesfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure. * * ENOMEM - Memory allocation failure for internal * bookkeeping variables. * * EIO - Current task mm is not the same as the one * that created the enclave. * * NE_ERR_NO_CPUS_AVAIL_IN_POOL - No CPUs available in the NE CPU pool. * * NE_ERR_VCPU_ALREADY_USED - The provided vCPU is already used. * * NE_ERR_VCPU_NOT_IN_CPU_POOL - The provided vCPU is not available in the * NE CPU pool. * * NE_ERR_VCPU_INVALID_CPU_CORE - The core id of the provided vCPU is invalid * or out of range. * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state * (init = before being started). * * NE_ERR_INVALID_VCPU - The provided vCPU is not in the available * CPUs range. * * Error codes from the NE PCI device request. */ #define NE_ADD_VCPU _IOWR(0xAE, 0x21, __u32) /** * NE_GET_IMAGE_LOAD_INFO - The command is used to get information needed for * in-memory enclave image loading e.g. offset in * enclave memory to start placing the enclave image. * The image load info is an input / output parameter. * It includes info provided by the caller - flags - * and returns the offset in enclave memory where to * start placing the enclave image. * The ioctl can be invoked on the enclave fd, before * an enclave is started. * * Context: Process context. * Return: * * 0 - Logic succesfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure. * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state (init = * before being started). * * NE_ERR_INVALID_FLAG_VALUE - The value of the provided flag is invalid. */ #define NE_GET_IMAGE_LOAD_INFO _IOWR(0xAE, 0x22, struct ne_image_load_info) /** * NE_SET_USER_MEMORY_REGION - The command is used to set a memory region for an * enclave, given the allocated memory from the * userspace. Enclave memory needs to be from the * same NUMA node as the enclave CPUs. * The user memory region is an input parameter. It * includes info provided by the caller - flags, * memory size and userspace address. * The ioctl can be invoked on the enclave fd, * before an enclave is started. * * Context: Process context. * Return: * * 0 - Logic succesfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() failure. * * EINVAL - Invalid physical memory region(s) e.g. * unaligned address. * * EIO - Current task mm is not the same as * the one that created the enclave. * * ENOMEM - Memory allocation failure for internal * bookkeeping variables. * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state * (init = before being started). * * NE_ERR_INVALID_MEM_REGION_SIZE - The memory size of the region is not * multiple of 2 MiB. * * NE_ERR_INVALID_MEM_REGION_ADDR - Invalid user space address given. * * NE_ERR_UNALIGNED_MEM_REGION_ADDR - Unaligned user space address given. * * NE_ERR_MEM_REGION_ALREADY_USED - The memory region is already used. * * NE_ERR_MEM_NOT_HUGE_PAGE - The memory region is not backed by * huge pages. * * NE_ERR_MEM_DIFFERENT_NUMA_NODE - The memory region is not from the same * NUMA node as the CPUs. * * NE_ERR_MEM_MAX_REGIONS - The number of memory regions set for * the enclave reached maximum. * * NE_ERR_INVALID_PAGE_SIZE - The memory region is not backed by * pages multiple of 2 MiB. * * NE_ERR_INVALID_FLAG_VALUE - The value of the provided flag is invalid. * * Error codes from get_user_pages(). * * Error codes from the NE PCI device request. */ #define NE_SET_USER_MEMORY_REGION _IOW(0xAE, 0x23, struct ne_user_memory_region) /** * NE_START_ENCLAVE - The command is used to trigger enclave start after the * enclave resources, such as memory and CPU, have been set. * The enclave start info is an input / output parameter. It * includes info provided by the caller - enclave cid and * flags - and returns the cid (if input cid is 0). * The ioctl can be invoked on the enclave fd, after an * enclave slot is created and resources, such as memory and * vCPUs are set for an enclave. * * Context: Process context. * Return: * * 0 - Logic succesfully completed. * * -1 - There was a failure in the ioctl logic. * On failure, errno is set to: * * EFAULT - copy_from_user() / copy_to_user() failure. * * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state * (init = before being started). * * NE_ERR_NO_MEM_REGIONS_ADDED - No memory regions are set. * * NE_ERR_NO_VCPUS_ADDED - No vCPUs are set. * * NE_ERR_FULL_CORES_NOT_USED - Full core(s) not set for the enclave. * * NE_ERR_ENCLAVE_MEM_MIN_SIZE - Enclave memory is less than minimum * memory size (64 MiB). * * NE_ERR_INVALID_FLAG_VALUE - The value of the provided flag is invalid. * * NE_ERR_INVALID_ENCLAVE_CID - The provided enclave CID is invalid. * * Error codes from the NE PCI device request. */ #define NE_START_ENCLAVE _IOWR(0xAE, 0x24, struct ne_enclave_start_info) /** * DOC: NE specific error codes */ /** * NE_ERR_VCPU_ALREADY_USED - The provided vCPU is already used. */ #define NE_ERR_VCPU_ALREADY_USED (256) /** * NE_ERR_VCPU_NOT_IN_CPU_POOL - The provided vCPU is not available in the * NE CPU pool. */ #define NE_ERR_VCPU_NOT_IN_CPU_POOL (257) /** * NE_ERR_VCPU_INVALID_CPU_CORE - The core id of the provided vCPU is invalid * or out of range of the NE CPU pool. */ #define NE_ERR_VCPU_INVALID_CPU_CORE (258) /** * NE_ERR_INVALID_MEM_REGION_SIZE - The user space memory region size is not * multiple of 2 MiB. */ #define NE_ERR_INVALID_MEM_REGION_SIZE (259) /** * NE_ERR_INVALID_MEM_REGION_ADDR - The user space memory region address range * is invalid. */ #define NE_ERR_INVALID_MEM_REGION_ADDR (260) /** * NE_ERR_UNALIGNED_MEM_REGION_ADDR - The user space memory region address is * not aligned. */ #define NE_ERR_UNALIGNED_MEM_REGION_ADDR (261) /** * NE_ERR_MEM_REGION_ALREADY_USED - The user space memory region is already used. */ #define NE_ERR_MEM_REGION_ALREADY_USED (262) /** * NE_ERR_MEM_NOT_HUGE_PAGE - The user space memory region is not backed by * contiguous physical huge page(s). */ #define NE_ERR_MEM_NOT_HUGE_PAGE (263) /** * NE_ERR_MEM_DIFFERENT_NUMA_NODE - The user space memory region is backed by * pages from different NUMA nodes than the CPUs. */ #define NE_ERR_MEM_DIFFERENT_NUMA_NODE (264) /** * NE_ERR_MEM_MAX_REGIONS - The supported max memory regions per enclaves has * been reached. */ #define NE_ERR_MEM_MAX_REGIONS (265) /** * NE_ERR_NO_MEM_REGIONS_ADDED - The command to start an enclave is triggered * and no memory regions are added. */ #define NE_ERR_NO_MEM_REGIONS_ADDED (266) /** * NE_ERR_NO_VCPUS_ADDED - The command to start an enclave is triggered and no * vCPUs are added. */ #define NE_ERR_NO_VCPUS_ADDED (267) /** * NE_ERR_ENCLAVE_MEM_MIN_SIZE - The enclave memory size is lower than the * minimum supported. */ #define NE_ERR_ENCLAVE_MEM_MIN_SIZE (268) /** * NE_ERR_FULL_CORES_NOT_USED - The command to start an enclave is triggered and * full CPU cores are not set. */ #define NE_ERR_FULL_CORES_NOT_USED (269) /** * NE_ERR_NOT_IN_INIT_STATE - The enclave is not in init state when setting * resources or triggering start. */ #define NE_ERR_NOT_IN_INIT_STATE (270) /** * NE_ERR_INVALID_VCPU - The provided vCPU is out of range of the available CPUs. */ #define NE_ERR_INVALID_VCPU (271) /** * NE_ERR_NO_CPUS_AVAIL_IN_POOL - The command to create an enclave is triggered * and no CPUs are available in the pool. */ #define NE_ERR_NO_CPUS_AVAIL_IN_POOL (272) /** * NE_ERR_INVALID_PAGE_SIZE - The user space memory region is not backed by pages * multiple of 2 MiB. */ #define NE_ERR_INVALID_PAGE_SIZE (273) /** * NE_ERR_INVALID_FLAG_VALUE - The provided flag value is invalid. */ #define NE_ERR_INVALID_FLAG_VALUE (274) /** * NE_ERR_INVALID_ENCLAVE_CID - The provided enclave CID is invalid, either * being a well-known value or the CID of the * parent / primary VM. */ #define NE_ERR_INVALID_ENCLAVE_CID (275) /** * DOC: Image load info flags */ /** * NE_EIF_IMAGE - Enclave Image Format (EIF) */ #define NE_EIF_IMAGE (0x01) #define NE_IMAGE_LOAD_MAX_FLAG_VAL (0x02) /** * struct ne_image_load_info - Info necessary for in-memory enclave image * loading (in / out). * @flags: Flags to determine the enclave image type * (e.g. Enclave Image Format - EIF) (in). * @memory_offset: Offset in enclave memory where to start placing the * enclave image (out). */ struct ne_image_load_info { __u64 flags; __u64 memory_offset; }; /** * DOC: User memory region flags */ /** * NE_DEFAULT_MEMORY_REGION - Memory region for enclave general usage. */ #define NE_DEFAULT_MEMORY_REGION (0x00) #define NE_MEMORY_REGION_MAX_FLAG_VAL (0x01) /** * struct ne_user_memory_region - Memory region to be set for an enclave (in). * @flags: Flags to determine the usage for the memory region (in). * @memory_size: The size, in bytes, of the memory region to be set for * an enclave (in). * @userspace_addr: The start address of the userspace allocated memory of * the memory region to set for an enclave (in). */ struct ne_user_memory_region { __u64 flags; __u64 memory_size; __u64 userspace_addr; }; /** * DOC: Enclave start info flags */ /** * NE_ENCLAVE_PRODUCTION_MODE - Start enclave in production mode. */ #define NE_ENCLAVE_PRODUCTION_MODE (0x00) /** * NE_ENCLAVE_DEBUG_MODE - Start enclave in debug mode. */ #define NE_ENCLAVE_DEBUG_MODE (0x01) #define NE_ENCLAVE_START_MAX_FLAG_VAL (0x02) /** * struct ne_enclave_start_info - Setup info necessary for enclave start (in / out). * @flags: Flags for the enclave to start with (e.g. debug mode) (in). * @enclave_cid: Context ID (CID) for the enclave vsock device. If 0 as * input, the CID is autogenerated by the hypervisor and * returned back as output by the driver (in / out). */ struct ne_enclave_start_info { __u64 flags; __u64 enclave_cid; }; #endif /* _LINUX_NITRO_ENCLAVES_H_ */ linux/nl80211.h 0000644 00001216640 15063602053 0007073 0 ustar 00 #ifndef __LINUX_NL80211_H #define __LINUX_NL80211_H /* * 802.11 netlink interface public header * * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> * Copyright 2008 Michael Wu <flamingice@sourmilk.net> * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> * Copyright 2008 Michael Buesch <m@bues.ch> * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com> * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> * Copyright 2008 Colin McCabe <colin@cozybit.com> * Copyright 2015-2017 Intel Deutschland GmbH * Copyright (C) 2018-2022 Intel Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* * This header file defines the userspace API to the wireless stack. Please * be careful not to break things - i.e. don't move anything around or so * unless you can demonstrate that it breaks neither API nor ABI. * * Additions to the API should be accompanied by actual implementations in * an upstream driver, so that example implementations exist in case there * are ever concerns about the precise semantics of the API or changes are * needed, and to ensure that code for dead (no longer implemented) API * can actually be identified and removed. * Nonetheless, semantics should also be documented carefully in this file. */ #include <linux/types.h> #define NL80211_GENL_NAME "nl80211" #define NL80211_MULTICAST_GROUP_CONFIG "config" #define NL80211_MULTICAST_GROUP_SCAN "scan" #define NL80211_MULTICAST_GROUP_REG "regulatory" #define NL80211_MULTICAST_GROUP_MLME "mlme" #define NL80211_MULTICAST_GROUP_VENDOR "vendor" #define NL80211_MULTICAST_GROUP_NAN "nan" #define NL80211_MULTICAST_GROUP_TESTMODE "testmode" #define NL80211_EDMG_BW_CONFIG_MIN 4 #define NL80211_EDMG_BW_CONFIG_MAX 15 #define NL80211_EDMG_CHANNELS_MIN 1 #define NL80211_EDMG_CHANNELS_MAX 0x3c /* 0b00111100 */ /** * DOC: Station handling * * Stations are added per interface, but a special case exists with VLAN * interfaces. When a station is bound to an AP interface, it may be moved * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN). * The station is still assumed to belong to the AP interface it was added * to. * * Station handling varies per interface type and depending on the driver's * capabilities. * * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows: * - a setup station entry is added, not yet authorized, without any rate * or capability information, this just exists to avoid race conditions * - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid * to add rate and capability information to the station and at the same * time mark it authorized. * - %NL80211_TDLS_ENABLE_LINK is then used * - after this, the only valid operation is to remove it by tearing down * the TDLS link (%NL80211_TDLS_DISABLE_LINK) * * TODO: need more info for other interface types */ /** * DOC: Frame transmission/registration support * * Frame transmission and registration support exists to allow userspace * management entities such as wpa_supplicant react to management frames * that are not being handled by the kernel. This includes, for example, * certain classes of action frames that cannot be handled in the kernel * for various reasons. * * Frame registration is done on a per-interface basis and registrations * cannot be removed other than by closing the socket. It is possible to * specify a registration filter to register, for example, only for a * certain type of action frame. In particular with action frames, those * that userspace registers for will not be returned as unhandled by the * driver, so that the registered application has to take responsibility * for doing that. * * The type of frame that can be registered for is also dependent on the * driver and interface type. The frame types are advertised in wiphy * attributes so applications know what to expect. * * NOTE: When an interface changes type while registrations are active, * these registrations are ignored until the interface type is * changed again. This means that changing the interface type can * lead to a situation that couldn't otherwise be produced, but * any such registrations will be dormant in the sense that they * will not be serviced, i.e. they will not receive any frames. * * Frame transmission allows userspace to send for example the required * responses to action frames. It is subject to some sanity checking, * but many frames can be transmitted. When a frame was transmitted, its * status is indicated to the sending socket. * * For more technical details, see the corresponding command descriptions * below. */ /** * DOC: Virtual interface / concurrency capabilities * * Some devices are able to operate with virtual MACs, they can have * more than one virtual interface. The capability handling for this * is a bit complex though, as there may be a number of restrictions * on the types of concurrency that are supported. * * To start with, each device supports the interface types listed in * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the * types there no concurrency is implied. * * Once concurrency is desired, more attributes must be observed: * To start with, since some interface types are purely managed in * software, like the AP-VLAN type in mac80211 for example, there's * an additional list of these, they can be added at any time and * are only restricted by some semantic restrictions (e.g. AP-VLAN * cannot be added without a corresponding AP interface). This list * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute. * * Further, the list of supported combinations is exported. This is * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically, * it exports a list of "groups", and at any point in time the * interfaces that are currently active must fall into any one of * the advertised groups. Within each group, there are restrictions * on the number of interfaces of different types that are supported * and also the number of different channels, along with potentially * some other restrictions. See &enum nl80211_if_combination_attrs. * * All together, these attributes define the concurrency of virtual * interfaces that a given device supports. */ /** * DOC: packet coalesce support * * In most cases, host that receives IPv4 and IPv6 multicast/broadcast * packets does not do anything with these packets. Therefore the * reception of these unwanted packets causes unnecessary processing * and power consumption. * * Packet coalesce feature helps to reduce number of received interrupts * to host by buffering these packets in firmware/hardware for some * predefined time. Received interrupt will be generated when one of the * following events occur. * a) Expiration of hardware timer whose expiration time is set to maximum * coalescing delay of matching coalesce rule. * b) Coalescing buffer in hardware reaches it's limit. * c) Packet doesn't match any of the configured coalesce rules. * * User needs to configure following parameters for creating a coalesce * rule. * a) Maximum coalescing delay * b) List of packet patterns which needs to be matched * c) Condition for coalescence. pattern 'match' or 'no match' * Multiple such rules can be created. */ /** * DOC: WPA/WPA2 EAPOL handshake offload * * By setting @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK flag drivers * can indicate they support offloading EAPOL handshakes for WPA/WPA2 * preshared key authentication in station mode. In %NL80211_CMD_CONNECT * the preshared key should be specified using %NL80211_ATTR_PMK. Drivers * supporting this offload may reject the %NL80211_CMD_CONNECT when no * preshared key material is provided, for example when that driver does * not support setting the temporal keys through %NL80211_CMD_NEW_KEY. * * Similarly @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X flag can be * set by drivers indicating offload support of the PTK/GTK EAPOL * handshakes during 802.1X authentication in station mode. In order to * use the offload the %NL80211_CMD_CONNECT should have * %NL80211_ATTR_WANT_1X_4WAY_HS attribute flag. Drivers supporting this * offload may reject the %NL80211_CMD_CONNECT when the attribute flag is * not present. * * By setting @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK flag drivers * can indicate they support offloading EAPOL handshakes for WPA/WPA2 * preshared key authentication in AP mode. In %NL80211_CMD_START_AP * the preshared key should be specified using %NL80211_ATTR_PMK. Drivers * supporting this offload may reject the %NL80211_CMD_START_AP when no * preshared key material is provided, for example when that driver does * not support setting the temporal keys through %NL80211_CMD_NEW_KEY. * * For 802.1X the PMK or PMK-R0 are set by providing %NL80211_ATTR_PMK * using %NL80211_CMD_SET_PMK. For offloaded FT support also * %NL80211_ATTR_PMKR0_NAME must be provided. */ /** * DOC: FILS shared key authentication offload * * FILS shared key authentication offload can be advertized by drivers by * setting @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD flag. The drivers that support * FILS shared key authentication offload should be able to construct the * authentication and association frames for FILS shared key authentication and * eventually do a key derivation as per IEEE 802.11ai. The below additional * parameters should be given to driver in %NL80211_CMD_CONNECT and/or in * %NL80211_CMD_UPDATE_CONNECT_PARAMS. * %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai * %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message * %NL80211_ATTR_FILS_ERP_RRK - used to generate the rIK and rMSK * rIK should be used to generate an authentication tag on the ERP message and * rMSK should be used to derive a PMKSA. * rIK, rMSK should be generated and keyname_nai, sequence number should be used * as specified in IETF RFC 6696. * * When FILS shared key authentication is completed, driver needs to provide the * below additional parameters to userspace, which can be either after setting * up a connection or after roaming. * %NL80211_ATTR_FILS_KEK - used for key renewal * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used in further EAP-RP exchanges * %NL80211_ATTR_PMKID - used to identify the PMKSA used/generated * %Nl80211_ATTR_PMK - used to update PMKSA cache in userspace * The PMKSA can be maintained in userspace persistently so that it can be used * later after reboots or wifi turn off/on also. * * %NL80211_ATTR_FILS_CACHE_ID is the cache identifier advertized by a FILS * capable AP supporting PMK caching. It specifies the scope within which the * PMKSAs are cached in an ESS. %NL80211_CMD_SET_PMKSA and * %NL80211_CMD_DEL_PMKSA are enhanced to allow support for PMKSA caching based * on FILS cache identifier. Additionally %NL80211_ATTR_PMK is used with * %NL80211_SET_PMKSA to specify the PMK corresponding to a PMKSA for driver to * use in a FILS shared key connection with PMKSA caching. */ /** * DOC: SAE authentication offload * * By setting @NL80211_EXT_FEATURE_SAE_OFFLOAD flag drivers can indicate they * support offloading SAE authentication for WPA3-Personal networks in station * mode. Similarly @NL80211_EXT_FEATURE_SAE_OFFLOAD_AP flag can be set by * drivers indicating the offload support in AP mode. * * The password for SAE should be specified using %NL80211_ATTR_SAE_PASSWORD in * %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP for station and AP mode * respectively. */ /** * DOC: VLAN offload support for setting group keys and binding STAs to VLANs * * By setting @NL80211_EXT_FEATURE_VLAN_OFFLOAD flag drivers can indicate they * support offloading VLAN functionality in a manner where the driver exposes a * single netdev that uses VLAN tagged frames and separate VLAN-specific netdevs * can then be added using RTM_NEWLINK/IFLA_VLAN_ID similarly to the Ethernet * case. Frames received from stations that are not assigned to any VLAN are * delivered on the main netdev and frames to such stations can be sent through * that main netdev. * * %NL80211_CMD_NEW_KEY (for group keys), %NL80211_CMD_NEW_STATION, and * %NL80211_CMD_SET_STATION will optionally specify vlan_id using * %NL80211_ATTR_VLAN_ID. */ /** * DOC: TID configuration * * TID config support can be checked in the %NL80211_ATTR_TID_CONFIG * attribute given in wiphy capabilities. * * The necessary configuration parameters are mentioned in * &enum nl80211_tid_config_attr and it will be passed to the * %NL80211_CMD_SET_TID_CONFIG command in %NL80211_ATTR_TID_CONFIG. * * If the configuration needs to be applied for specific peer then the MAC * address of the peer needs to be passed in %NL80211_ATTR_MAC, otherwise the * configuration will be applied for all the connected peers in the vif except * any peers that have peer specific configuration for the TID by default; if * the %NL80211_TID_CONFIG_ATTR_OVERRIDE flag is set, peer specific values * will be overwritten. * * All this configuration is valid only for STA's current connection * i.e. the configuration will be reset to default when the STA connects back * after disconnection/roaming, and this configuration will be cleared when * the interface goes down. */ /** * DOC: FILS shared key crypto offload * * This feature is applicable to drivers running in AP mode. * * FILS shared key crypto offload can be advertised by drivers by setting * @NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD flag. The drivers that support * FILS shared key crypto offload should be able to encrypt and decrypt * association frames for FILS shared key authentication as per IEEE 802.11ai. * With this capability, for FILS key derivation, drivers depend on userspace. * * After FILS key derivation, userspace shares the FILS AAD details with the * driver and the driver stores the same to use in decryption of association * request and in encryption of association response. The below parameters * should be given to the driver in %NL80211_CMD_SET_FILS_AAD. * %NL80211_ATTR_MAC - STA MAC address, used for storing FILS AAD per STA * %NL80211_ATTR_FILS_KEK - Used for encryption or decryption * %NL80211_ATTR_FILS_NONCES - Used for encryption or decryption * (STA Nonce 16 bytes followed by AP Nonce 16 bytes) * * Once the association is done, the driver cleans the FILS AAD data. */ /** * DOC: Multi-Link Operation * * In Multi-Link Operation, a connection between to MLDs utilizes multiple * links. To use this in nl80211, various commands and responses now need * to or will include the new %NL80211_ATTR_MLO_LINKS attribute. * Additionally, various commands that need to operate on a specific link * now need to be given the %NL80211_ATTR_MLO_LINK_ID attribute, e.g. to * use %NL80211_CMD_START_AP or similar functions. */ /** * enum nl80211_commands - supported nl80211 commands * * @NL80211_CMD_UNSPEC: unspecified command to catch errors * * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request * to get a list of all present wiphys. * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, * %NL80211_ATTR_WIPHY_FREQ_OFFSET (and the attributes determining the * channel width; this is used for setting monitor mode channel), * %NL80211_ATTR_WIPHY_RETRY_SHORT, %NL80211_ATTR_WIPHY_RETRY_LONG, * %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, and/or * %NL80211_ATTR_WIPHY_RTS_THRESHOLD. However, for setting the channel, * see %NL80211_CMD_SET_CHANNEL instead, the support here is for backward * compatibility only. * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request * or rename notification. Has attributes %NL80211_ATTR_WIPHY and * %NL80211_ATTR_WIPHY_NAME. * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME. * * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration; * either a dump request for all interfaces or a specific get with a * single %NL80211_ATTR_IFINDEX is supported. * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE. * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX, * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also * be sent from userspace to request creation of a new virtual interface, * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and * %NL80211_ATTR_IFNAME. * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from * userspace to request deletion of a virtual interface, then requires * attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are * enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS, * and if this command is used for the transmitting interface, then all * the non-transmitting interfaces are deleted as well. * * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC * represents peer's MLD address for MLO pairwise key. For MLO group key, * the link is identified by %NL80211_ATTR_MLO_LINK_ID. * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. * For MLO connection, the link to set default key is identified by * %NL80211_ATTR_MLO_LINK_ID. * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents * peer's MLD address for MLO pairwise key. The link to add MLO * group key is identified by %NL80211_ATTR_MLO_LINK_ID. * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address * for MLO pairwise key. The link to delete group key is identified by * %NL80211_ATTR_MLO_LINK_ID. * * @NL80211_CMD_GET_BEACON: (not used) * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL * attributes. For drivers that generate the beacon and probe responses * internally, the following attributes must be provided: %NL80211_ATTR_IE, * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP. * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID, * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT, * %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS. * The channel to use can be set on the interface or be given using the * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_FREQ_OFFSET, and the * attributes determining channel width. * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP * * @NL80211_CMD_GET_STATION: Get station attributes for station identified by * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_SET_STATION: Set station attributes for station identified by * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the * interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC * or, if no MAC address given, all stations, on the interface identified * by %NL80211_ATTR_IFINDEX. For MLD station, MLD address is used in * %NL80211_ATTR_MAC. %NL80211_ATTR_MGMT_SUBTYPE and * %NL80211_ATTR_REASON_CODE can optionally be used to specify which type * of disconnection indication should be sent to the station * (Deauthentication or Disassociation frame and reason code for that * frame). * * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to * destination %NL80211_ATTR_MAC on the interface identified by * %NL80211_ATTR_IFINDEX. * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to * destination %NL80211_ATTR_MAC on the interface identified by * %NL80211_ATTR_IFINDEX. * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP. * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by * %NL80211_ATTR_MAC. * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the * interface identified by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC * or, if no MAC address given, all mesh paths, on the interface identified * by %NL80211_ATTR_IFINDEX. * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by * %NL80211_ATTR_IFINDEX. * * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set * regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device * has a private regulatory domain, it will be returned. Otherwise, the * global regdomain will be returned. * A device will have a private regulatory domain if it uses the * regulatory_hint() API. Even when a private regdomain is used the channel * information will still be mended according to further hints from * the regulatory core to help with compliance. A dump version of this API * is now available which will returns the global regdomain as well as * all private regdomains of present wiphys (for those that have it). * If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then * its private regdomain is the only valid one for it. The regulatory * core is not used to help with compliance in this case. * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command * after being queried by the kernel. CRDA replies by sending a regulatory * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our * current alpha2 if it found a match. It also provides * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each * regulatory rule is a nested set of attributes given by * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain * to the specified ISO/IEC 3166-1 alpha2 country code. The core will * store this as a valid request and then query userspace for it. * * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the * interface identified by %NL80211_ATTR_IFINDEX * * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the * interface identified by %NL80211_ATTR_IFINDEX * * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The * interface is identified with %NL80211_ATTR_IFINDEX and the management * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be * added to the end of the specified management frame is specified with * %NL80211_ATTR_IE. If the command succeeds, the requested data will be * added to all specified management frames generated by * kernel/firmware/driver. * Note: This command has been removed and it is only reserved at this * point to avoid re-using existing command number. The functionality this * command was planned for has been provided with cleaner design with the * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN, * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE. * * @NL80211_CMD_GET_SCAN: get scan results * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the * probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used to * specify a BSSID to scan for; if not included, the wildcard BSSID will * be used. * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to * NL80211_CMD_GET_SCAN and on the "scan" multicast group) * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, * partial scan results may be available * * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain * intervals and certain number of cycles, as specified by * %NL80211_ATTR_SCHED_SCAN_PLANS. If %NL80211_ATTR_SCHED_SCAN_PLANS is * not specified and only %NL80211_ATTR_SCHED_SCAN_INTERVAL is specified, * scheduled scan will run in an infinite loop with the specified interval. * These attributes are mutually exculsive, * i.e. NL80211_ATTR_SCHED_SCAN_INTERVAL must not be passed if * NL80211_ATTR_SCHED_SCAN_PLANS is defined. * If for some reason scheduled scan is aborted by the driver, all scan * plans are canceled (including scan plans that did not start yet). * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS) * are passed, they are used in the probe requests. For * broadcast, a broadcast SSID must be passed (ie. an empty * string). If no SSID is passed, no probe requests are sent and * a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES, * if passed, define which channels should be scanned; if not * passed, all channels allowed for the current regulatory domain * are used. Extra IEs can also be passed from the userspace by * using the %NL80211_ATTR_IE attribute. The first cycle of the * scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY * is supplied. If the device supports multiple concurrent scheduled * scans, it will allow such when the caller provides the flag attribute * %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it. * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if * scheduled scan is not running. The caller may assume that as soon * as the call returns, it is safe to start a new scheduled scan again. * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan * results available. * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has * stopped. The driver may issue this event at any time during a * scheduled scan. One reason for stopping the scan is if the hardware * does not support starting an association or a normal scan while running * a scheduled scan. This event is also sent when the * %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface * is brought down while a scheduled scan was running. * * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation * or noise level * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to * NL80211_CMD_GET_SURVEY and on the "scan" multicast group) * * @NL80211_CMD_SET_PMKSA: Add a PMKSA cache entry using %NL80211_ATTR_MAC * (for the BSSID), %NL80211_ATTR_PMKID, and optionally %NL80211_ATTR_PMK * (PMK is used for PTKSA derivation in case of FILS shared key offload) or * using %NL80211_ATTR_SSID, %NL80211_ATTR_FILS_CACHE_ID, * %NL80211_ATTR_PMKID, and %NL80211_ATTR_PMK in case of FILS * authentication where %NL80211_ATTR_FILS_CACHE_ID is the identifier * advertized by a FILS capable AP identifying the scope of PMKSA in an * ESS. * @NL80211_CMD_DEL_PMKSA: Delete a PMKSA cache entry, using %NL80211_ATTR_MAC * (for the BSSID) and %NL80211_ATTR_PMKID or using %NL80211_ATTR_SSID, * %NL80211_ATTR_FILS_CACHE_ID, and %NL80211_ATTR_PMKID in case of FILS * authentication. * @NL80211_CMD_FLUSH_PMKSA: Flush all PMKSA cache entries. * * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain * has been changed and provides details of the request information * that caused the change such as who initiated the regulatory request * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on * to (%NL80211_ATTR_REG_ALPHA2). * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon * has been found while world roaming thus enabling active scan or * any mode of operation that initiates TX (beacons) on a channel * where we would not have been able to do either before. As an example * if you are world roaming (regulatory domain set to world or if your * driver is using a custom world roaming regulatory domain) and while * doing a passive scan on the 5 GHz band you find an AP there (if not * on a DFS channel) you will now be able to actively scan for that AP * or use AP mode on your card on that same channel. Note that this will * never be used for channels 1-11 on the 2 GHz band as they are always * enabled world wide. This beacon hint is only sent if your device had * either disabled active scanning or beaconing on a channel. We send to * userspace the wiphy on which we removed a restriction from * (%NL80211_ATTR_WIPHY) and the channel on which this occurred * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER) * the beacon hint was processed. * * @NL80211_CMD_AUTHENTICATE: authentication request and notification. * This command is used both as a command (request to authenticate) and * as an event on the "mlme" multicast group indicating completion of the * authentication process. * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify * the SSID (mainly for association, but is included in authentication * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ + * %NL80211_ATTR_WIPHY_FREQ_OFFSET is used to specify the frequence of the * channel in MHz. %NL80211_ATTR_AUTH_TYPE is used to specify the * authentication type. %NL80211_ATTR_IE is used to define IEs * (VendorSpecificInfo, but also including RSN IE and FT IEs) to be added * to the frame. * When used as an event, this reports reception of an Authentication * frame in station and IBSS modes when the local MLME processed the * frame, i.e., it was for the local STA and was received in correct * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the * MLME SAP interface (kernel providing MLME, userspace SME). The * included %NL80211_ATTR_FRAME attribute contains the management frame * (including both the header and frame body, but not FCS). This event is * also used to indicate if the authentication attempt timed out. In that * case the %NL80211_ATTR_FRAME attribute is replaced with a * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which * pending authentication timed out). * @NL80211_CMD_ASSOCIATE: association request and notification; like * NL80211_CMD_AUTHENTICATE but for Association and Reassociation * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the * request is for the initial association to an ESS (that attribute not * included) or for reassociation within the ESS (that attribute is * included). * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication * primitives). * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). * * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the * event includes %NL80211_ATTR_MAC to describe the source MAC address of * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this * event matches with MLME-MICHAELMICFAILURE.indication() primitive * * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a * FREQ attribute (for the initial frequency if no peer can be found) * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those * should be fixed rather than automatically determined. Can only be * executed on a network interface that is UP, and fixed BSSID/FREQ * may be rejected. Another optional parameter is the beacon interval, * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not * given defaults to 100 TU (102.4ms). * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is * determined by the network interface. * * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute * to identify the device, and the TESTDATA blob attribute to pass through * to the driver. * * @NL80211_CMD_CONNECT: connection request and notification; this command * requests to connect to a specified network but without separating * auth and assoc steps. For this, you need to specify the SSID in a * %NL80211_ATTR_SSID attribute, and can optionally specify the association * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, * %NL80211_ATTR_USE_MFP, %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, * %NL80211_ATTR_WIPHY_FREQ_OFFSET, %NL80211_ATTR_CONTROL_PORT, * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, * %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and * %NL80211_ATTR_WIPHY_FREQ_HINT. * If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are * restrictions on BSS selection, i.e., they effectively prevent roaming * within the ESS. %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT * can be included to provide a recommendation of the initial BSS while * allowing the driver to roam to other BSSes within the ESS and also to * ignore this recommendation if the indicated BSS is not ideal. Only one * set of BSSID,frequency parameters is used (i.e., either the enforcing * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT). * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within * the ESS in case the device is already associated and an association with * a different BSS is desired. * Background scan period can optionally be * specified in %NL80211_ATTR_BG_SCAN_PERIOD, * if not specified default background scan configuration * in driver is used and if period value is 0, bg scan will be disabled. * This attribute is ignored if driver does not support roam scan. * It is also sent as an event, with the BSSID and response IEs when the * connection is established or failed to be established. This can be * determined by the %NL80211_ATTR_STATUS_CODE attribute (0 = success, * non-zero = failure). If %NL80211_ATTR_TIMED_OUT is included in the * event, the connection attempt failed due to not being able to initiate * authentication/association or not receiving a response from the AP. * Non-zero %NL80211_ATTR_STATUS_CODE value is indicated in that case as * well to remain backwards compatible. * @NL80211_CMD_ROAM: Notification indicating the card/driver roamed by itself. * When a security association was established on an 802.1X network using * fast transition, this event should be followed by an * %NL80211_CMD_PORT_AUTHORIZED event. * Following a %NL80211_CMD_ROAM event userspace can issue * %NL80211_CMD_GET_SCAN in order to obtain the scan information for the * new BSS the card/driver roamed to. * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify * userspace that a connection was dropped by the AP or due to other * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and * %NL80211_ATTR_REASON_CODE attributes are used. * * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices * associated with this wiphy must be down and will follow. * * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified * channel for the specified amount of time. This can be used to do * off-channel operations like transmit a Public Action frame and wait for * a response while being associated to an AP on another channel. * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the * frequency for the operation. * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds * to remain on the channel. This command is also used as an event to * notify when the requested duration starts (it may take a while for the * driver to schedule this time due to other concurrent needs for the * radio). * When called, this operation returns a cookie (%NL80211_ATTR_COOKIE) * that will be included with any events pertaining to this request; * the cookie is also used to cancel the request. * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a * pending remain-on-channel duration if the desired operation has been * completed prior to expiration of the originally requested duration. * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to * uniquely identify the request. * This command is also used as an event to notify when a requested * remain-on-channel duration has expired. * * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface * and @NL80211_ATTR_TX_RATES the set of allowed rates. * * @NL80211_CMD_REGISTER_FRAME: Register for receiving certain mgmt frames * (via @NL80211_CMD_FRAME) for processing in userspace. This command * requires an interface index, a frame type attribute (optional for * backward compatibility reasons, if not given assumes action frames) * and a match attribute containing the first few bytes of the frame * that should match, e.g. a single byte for only a category match or * four bytes for vendor frames including the OUI. The registration * cannot be dropped, but is removed automatically when the netlink * socket is closed. Multiple registrations can be made. * The %NL80211_ATTR_RECEIVE_MULTICAST flag attribute can be given if * %NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS is available, in which * case the registration can also be modified to include/exclude the * flag, rather than requiring unregistration to change it. * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for * backward compatibility * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This * command is used both as a request to transmit a management frame and * as an event indicating reception of a frame that was not processed in * kernel code, but is for us (i.e., which may need to be processed in a * user space application). %NL80211_ATTR_FRAME is used to specify the * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ is used * to indicate on which channel the frame is to be transmitted or was * received. If this channel is not the current channel (remain-on-channel * or the operational channel) the device will switch to the given channel * and transmit the frame, optionally waiting for a response for the time * specified using %NL80211_ATTR_DURATION. When called, this operation * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the * TX status event pertaining to the TX request. * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the * management frames at CCK rate or not in 2GHz band. * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA * counters which will be updated to the current value. This attribute * is used during CSA period. * For TX on an MLD, the frequency can be omitted and the link ID be * specified, or if transmitting to a known peer MLD (with MLD addresses * in the frame) both can be omitted and the link will be selected by * lower layers. * For RX notification, %NL80211_ATTR_RX_HW_TIMESTAMP may be included to * indicate the frame RX timestamp and %NL80211_ATTR_TX_HW_TIMESTAMP may * be included to indicate the ack TX timestamp. * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this * command may be used with the corresponding cookie to cancel the wait * time if it is known that it is no longer necessary. This command is * also sent as an event whenever the driver has completed the off-channel * wait time. * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility. * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies * the TX command and %NL80211_ATTR_FRAME includes the contents of the * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged * the frame. %NL80211_ATTR_TX_HW_TIMESTAMP may be included to indicate the * tx timestamp and %NL80211_ATTR_RX_HW_TIMESTAMP may be included to * indicate the ack RX timestamp. * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for * backward compatibility. * * @NL80211_CMD_SET_POWER_SAVE: Set powersave, using %NL80211_ATTR_PS_STATE * @NL80211_CMD_GET_POWER_SAVE: Get powersave status in %NL80211_ATTR_PS_STATE * * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command * is used to configure connection quality monitoring notification trigger * levels. * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This * command is used as an event to indicate the that a trigger level was * reached. * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ * and the attributes determining channel width) the given interface * (identifed by %NL80211_ATTR_IFINDEX) shall operate on. * In case multiple channels are supported by the device, the mechanism * with which it switches channels is implementation-defined. * When a monitor interface is given, it can only switch channel while * no other interfaces are operating to avoid disturbing the operation * of any other interfaces, and other interfaces will again take * precedence when they are used. * * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface * (no longer supported). * * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform * multicast to unicast conversion. When enabled, all multicast packets * with ethertype ARP, IPv4 or IPv6 (possibly within an 802.1Q header) * will be sent out to each station once with the destination (multicast) * MAC address replaced by the station's MAC address. Note that this may * break certain expectations of the receiver, e.g. the ability to drop * unicast IP packets encapsulated in multicast L2 frames, or the ability * to not send destination unreachable messages in such cases. * This can only be toggled per BSS. Configure this on an interface of * type %NL80211_IFTYPE_AP. It applies to all its VLAN interfaces * (%NL80211_IFTYPE_AP_VLAN), except for those in 4addr (WDS) mode. * If %NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED is not present with this * command, the feature is disabled. * * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial * mesh config parameters may be given. * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the * network is determined by the network interface. * * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame * notification. This event is used to indicate that an unprotected * deauthentication frame was dropped when MFP is in use. * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame * notification. This event is used to indicate that an unprotected * disassociation frame was dropped when MFP is in use. * * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a * beacon or probe response from a compatible mesh peer. This is only * sent while no station information (sta_info) exists for the new peer * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH, * @NL80211_MESH_SETUP_USERSPACE_AMPE, or * @NL80211_MESH_SETUP_USERSPACE_MPM is set. On reception of this * notification, userspace may decide to create a new station * (@NL80211_CMD_NEW_STATION). To stop this notification from * reoccurring, the userspace authentication daemon may want to create the * new station with the AUTHENTICATED flag unset and maybe change it later * depending on the authentication result. * * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings. * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings. * Since wireless is more complex than wired ethernet, it supports * various triggers. These triggers can be configured through this * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For * more background information, see * https://wireless.wiki.kernel.org/en/users/Documentation/WoWLAN. * The @NL80211_CMD_SET_WOWLAN command can also be used as a notification * from the driver reporting the wakeup reason. In this case, the * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason * for the wakeup, if it was caused by wireless. If it is not present * in the wakeup notification, the wireless device didn't cause the * wakeup but reports that it was woken up. * * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver * the necessary information for supporting GTK rekey offload. This * feature is typically used during WoWLAN. The configuration data * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and * contains the data in sub-attributes). After rekeying happened, * this command may also be sent by the driver as an MLME event to * inform userspace of the new replay counter. * * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace * of PMKSA caching dandidates. * * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). * In addition, this can be used as an event to request userspace to take * actions on TDLS links (set up a new link or tear down an existing one). * In such events, %NL80211_ATTR_TDLS_OPERATION indicates the requested * operation, %NL80211_ATTR_MAC contains the peer MAC address, and * %NL80211_ATTR_REASON_CODE the reason code to be used (only with * %NL80211_TDLS_TEARDOWN). * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. The * %NL80211_ATTR_TDLS_ACTION attribute determines the type of frame to be * sent. Public Action codes (802.11-2012 8.1.5.1) will be sent as * 802.11 management frames, while TDLS action codes (802.11-2012 * 8.5.13.1) will be encapsulated and sent as data frames. The currently * supported Public Action code is %WLAN_PUB_ACTION_TDLS_DISCOVER_RES * and the currently supported TDLS actions codes are given in * &enum ieee80211_tdls_actioncode. * * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP * (or GO) interface (i.e. hostapd) to ask for unexpected frames to * implement sending deauth to stations that send unexpected class 3 * frames. Also used as the event sent by the kernel when such a frame * is received. * For the event, the %NL80211_ATTR_MAC attribute carries the TA and * other attributes like the interface index are present. * If used as the command it must have an interface index and you can * only unsubscribe from the event by closing the socket. Subscription * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events. * * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame * and wasn't already in a 4-addr VLAN. The event will be sent similarly * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener. * * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface * by sending a null data frame to it and reporting when the frame is * acknowleged. This is used to allow timing out inactive clients. Uses * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a * direct reply with an %NL80211_ATTR_COOKIE that is later used to match * up the event with the request. The event includes the same data and * has %NL80211_ATTR_ACK set if the frame was ACKed. * * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from * other BSSes when any interfaces are in AP mode. This helps implement * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME * messages. Note that per PHY only one application may register. * * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether * No Acknowledgement Policy should be applied. * * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels * independently of the userspace SME, send this event indicating * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the * attributes determining channel width. This indication may also be * sent when a remotely-initiated switch (e.g., when a STA receives a CSA * from the remote AP) is completed; * * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch * has been started on an interface, regardless of the initiator * (ie. whether it was requested from a remote device or * initiated on our own). It indicates that * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may * decide to react to this indication by requesting other * interfaces to change channel as well. * * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by * its %NL80211_ATTR_WDEV identifier. It must have been created with * %NL80211_CMD_NEW_INTERFACE previously. After it has been started, the * P2P Device can be used for P2P operations, e.g. remain-on-channel and * public action frame TX. * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by * its %NL80211_ATTR_WDEV identifier. * * @NL80211_CMD_CONN_FAILED: connection request to an AP failed; used to * notify userspace that AP has rejected the connection request from a * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON * is used for this. * * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames * for IBSS or MESH vif. * * @NL80211_CMD_SET_MAC_ACL: sets ACL for MAC address based access control. * This is to be used with the drivers advertising the support of MAC * address based access control. List of MAC addresses is passed in * %NL80211_ATTR_MAC_ADDRS and ACL policy is passed in * %NL80211_ATTR_ACL_POLICY. Driver will enable ACL with this list, if it * is not already done. The new list will replace any existing list. Driver * will clear its ACL when the list of MAC addresses passed is empty. This * command is used in AP/P2P GO mode. Driver has to make sure to clear its * ACL list during %NL80211_CMD_STOP_AP. * * @NL80211_CMD_RADAR_DETECT: Start a Channel availability check (CAC). Once * a radar is detected or the channel availability scan (CAC) has finished * or was aborted, or a radar was detected, usermode will be notified with * this event. This command is also used to notify userspace about radars * while operating on this channel. * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the * event. * * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features, * i.e. features for the nl80211 protocol rather than device features. * Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap. * * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition * Information Element to the WLAN driver * * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver * to the supplicant. This will carry the target AP's MAC address along * with the relevant Information Elements. This event is used to report * received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE). * * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running * a critical protocol that needs more reliability in the connection to * complete. * * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can * return back to normal. * * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules. * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules. * * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the * new channel information (Channel Switch Announcement - CSA) * in the beacon for some time (as defined in the * %NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the * new channel. Userspace provides the new channel information (using * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel * width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform * other station that transmission must be blocked until the channel * switch is complete. * * @NL80211_CMD_VENDOR: Vendor-specified command/event. The command is specified * by the %NL80211_ATTR_VENDOR_ID attribute and a sub-command in * %NL80211_ATTR_VENDOR_SUBCMD. Parameter(s) can be transported in * %NL80211_ATTR_VENDOR_DATA. * For feature advertisement, the %NL80211_ATTR_VENDOR_DATA attribute is * used in the wiphy data as a nested attribute containing descriptions * (&struct nl80211_vendor_cmd_info) of the supported vendor commands. * This may also be sent as an event with the same attributes. * * @NL80211_CMD_SET_QOS_MAP: Set Interworking QoS mapping for IP DSCP values. * The QoS mapping information is included in %NL80211_ATTR_QOS_MAP. If * that attribute is not included, QoS mapping is disabled. Since this * QoS mapping is relevant for IP packets, it is only valid during an * association. This is cleared on disassociation and AP restart. * * @NL80211_CMD_ADD_TX_TS: Ask the kernel to add a traffic stream for the given * %NL80211_ATTR_TSID and %NL80211_ATTR_MAC with %NL80211_ATTR_USER_PRIO * and %NL80211_ATTR_ADMITTED_TIME parameters. * Note that the action frame handshake with the AP shall be handled by * userspace via the normal management RX/TX framework, this only sets * up the TX TS in the driver/device. * If the admitted time attribute is not added then the request just checks * if a subsequent setup could be successful, the intent is to use this to * avoid setting up a session with the AP when local restrictions would * make that impossible. However, the subsequent "real" setup may still * fail even if the check was successful. * @NL80211_CMD_DEL_TX_TS: Remove an existing TS with the %NL80211_ATTR_TSID * and %NL80211_ATTR_MAC parameters. It isn't necessary to call this * before removing a station entry entirely, or before disassociating * or similar, cleanup will happen in the driver/device in this case. * * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to * destination %NL80211_ATTR_MAC on the interface identified by * %NL80211_ATTR_IFINDEX. * * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and * bandwidth of a channel must be given. * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the * network is determined by the network interface. * * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer, * identified by the %NL80211_ATTR_MAC parameter. A target channel is * provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining * channel width/type. The target operating class is given via * %NL80211_ATTR_OPER_CLASS. * The driver is responsible for continually initiating channel-switching * operations and returning to the base channel for communication with the * AP. * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS * peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel * when this command completes. * * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used * as an event to indicate changes for devices with wiphy-specific regdom * management. * * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is * not running. The driver indicates the status of the scan through * cfg80211_scan_done(). * * @NL80211_CMD_START_NAN: Start NAN operation, identified by its * %NL80211_ATTR_WDEV interface. This interface must have been * previously created with %NL80211_CMD_NEW_INTERFACE. After it * has been started, the NAN interface will create or join a * cluster. This command must have a valid * %NL80211_ATTR_NAN_MASTER_PREF attribute and optional * %NL80211_ATTR_BANDS attributes. If %NL80211_ATTR_BANDS is * omitted or set to 0, it means don't-care and the device will * decide what to use. After this command NAN functions can be * added. * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by * its %NL80211_ATTR_WDEV interface. * @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined * with %NL80211_ATTR_NAN_FUNC nested attribute. When called, this * operation returns the strictly positive and unique instance id * (%NL80211_ATTR_NAN_FUNC_INST_ID) and a cookie (%NL80211_ATTR_COOKIE) * of the function upon success. * Since instance ID's can be re-used, this cookie is the right * way to identify the function. This will avoid races when a termination * event is handled by the user space after it has already added a new * function that got the same instance id from the kernel as the one * which just terminated. * This cookie may be used in NAN events even before the command * returns, so userspace shouldn't process NAN events until it processes * the response to this command. * Look at %NL80211_ATTR_SOCKET_OWNER as well. * @NL80211_CMD_DEL_NAN_FUNCTION: Delete a NAN function by cookie. * This command is also used as a notification sent when a NAN function is * terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID * and %NL80211_ATTR_COOKIE attributes. * @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN * configuration. NAN must be operational (%NL80211_CMD_START_NAN * was executed). It must contain at least one of the following * attributes: %NL80211_ATTR_NAN_MASTER_PREF, * %NL80211_ATTR_BANDS. If %NL80211_ATTR_BANDS is omitted, the * current configuration is not changed. If it is present but * set to zero, the configuration is changed to don't-care * (i.e. the device can decide what to do). * @NL80211_CMD_NAN_FUNC_MATCH: Notification sent when a match is reported. * This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and * %NL80211_ATTR_COOKIE. * * @NL80211_CMD_UPDATE_CONNECT_PARAMS: Update one or more connect parameters * for subsequent roaming cases if the driver or firmware uses internal * BSS selection. This command can be issued only while connected and it * does not result in a change for the current association. Currently, * only the %NL80211_ATTR_IE data is used and updated with this command. * * @NL80211_CMD_SET_PMK: For offloaded 4-Way handshake, set the PMK or PMK-R0 * for the given authenticator address (specified with %NL80211_ATTR_MAC). * When %NL80211_ATTR_PMKR0_NAME is set, %NL80211_ATTR_PMK specifies the * PMK-R0, otherwise it specifies the PMK. * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously * configured PMK for the authenticator address identified by * %NL80211_ATTR_MAC. * @NL80211_CMD_PORT_AUTHORIZED: An event that indicates an 802.1X FT roam was * completed successfully. Drivers that support 4 way handshake offload * should send this event after indicating 802.1X FT assocation with * %NL80211_CMD_ROAM. If the 4 way handshake failed %NL80211_CMD_DISCONNECT * should be indicated instead. * @NL80211_CMD_CONTROL_PORT_FRAME: Control Port (e.g. PAE) frame TX request * and RX notification. This command is used both as a request to transmit * a control port frame and as a notification that a control port frame * has been received. %NL80211_ATTR_FRAME is used to specify the * frame contents. The frame is the raw EAPoL data, without ethernet or * 802.11 headers. * For an MLD transmitter, the %NL80211_ATTR_MLO_LINK_ID may be given and * its effect will depend on the destination: If the destination is known * to be an MLD, this will be used as a hint to select the link to transmit * the frame on. If the destination is not an MLD, this will select both * the link to transmit on and the source address will be set to the link * address of that link. * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added * indicating the protocol type of the received frame; whether the frame * was received unencrypted and the MAC address of the peer respectively. * * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded. * * @NL80211_CMD_EXTERNAL_AUTH: This interface is exclusively defined for host * drivers that do not define separate commands for authentication and * association, but rely on user space for the authentication to happen. * This interface acts both as the event request (driver to user space) * to trigger the authentication and command response (userspace to * driver) to indicate the authentication status. * * User space uses the %NL80211_CMD_CONNECT command to the host driver to * trigger a connection. The host driver selects a BSS and further uses * this interface to offload only the authentication part to the user * space. Authentication frames are passed between the driver and user * space through the %NL80211_CMD_FRAME interface. Host driver proceeds * further with the association after getting successful authentication * status. User space indicates the authentication status through * %NL80211_ATTR_STATUS_CODE attribute in %NL80211_CMD_EXTERNAL_AUTH * command interface. * * Host driver sends MLD address of the AP with %NL80211_ATTR_MLD_ADDR in * %NL80211_CMD_EXTERNAL_AUTH event to indicate user space to enable MLO * during the authentication offload in STA mode while connecting to MLD * APs. Host driver should check %NL80211_ATTR_MLO_SUPPORT flag capability * in %NL80211_CMD_CONNECT to know whether the user space supports enabling * MLO during the authentication offload or not. * User space should enable MLO during the authentication only when it * receives the AP MLD address in authentication offload request. User * space shouldn't enable MLO when the authentication offload request * doesn't indicate the AP MLD address even if the AP is MLO capable. * User space should use %NL80211_ATTR_MLD_ADDR as peer's MLD address and * interface address identified by %NL80211_ATTR_IFINDEX as self MLD * address. User space and host driver to use MLD addresses in RA, TA and * BSSID fields of the frames between them, and host driver translates the * MLD addresses to/from link addresses based on the link chosen for the * authentication. * * Host driver reports this status on an authentication failure to the * user space through the connect result as the user space would have * initiated the connection through the connect request. * * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notify station's * ht opmode or vht opmode changes using any of %NL80211_ATTR_SMPS_MODE, * %NL80211_ATTR_CHANNEL_WIDTH,%NL80211_ATTR_NSS attributes with its * address(specified in %NL80211_ATTR_MAC). * * @NL80211_CMD_GET_FTM_RESPONDER_STATS: Retrieve FTM responder statistics, in * the %NL80211_ATTR_FTM_RESPONDER_STATS attribute. * * @NL80211_CMD_PEER_MEASUREMENT_START: start a (set of) peer measurement(s) * with the given parameters, which are encapsulated in the nested * %NL80211_ATTR_PEER_MEASUREMENTS attribute. Optionally, MAC address * randomization may be enabled and configured by specifying the * %NL80211_ATTR_MAC and %NL80211_ATTR_MAC_MASK attributes. * If a timeout is requested, use the %NL80211_ATTR_TIMEOUT attribute. * A u64 cookie for further %NL80211_ATTR_COOKIE use is returned in * the netlink extended ack message. * * To cancel a measurement, close the socket that requested it. * * Measurement results are reported to the socket that requested the * measurement using @NL80211_CMD_PEER_MEASUREMENT_RESULT when they * become available, so applications must ensure a large enough socket * buffer size. * * Depending on driver support it may or may not be possible to start * multiple concurrent measurements. * @NL80211_CMD_PEER_MEASUREMENT_RESULT: This command number is used for the * result notification from the driver to the requesting socket. * @NL80211_CMD_PEER_MEASUREMENT_COMPLETE: Notification only, indicating that * the measurement completed, using the measurement cookie * (%NL80211_ATTR_COOKIE). * * @NL80211_CMD_NOTIFY_RADAR: Notify the kernel that a radar signal was * detected and reported by a neighboring device on the channel * indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes * determining the width and type. * * @NL80211_CMD_UPDATE_OWE_INFO: This interface allows the host driver to * offload OWE processing to user space. This intends to support * OWE AKM by the host drivers that implement SME but rely * on the user space for the cryptographic/DH IE processing in AP mode. * * @NL80211_CMD_PROBE_MESH_LINK: The requirement for mesh link metric * refreshing, is that from one mesh point we be able to send some data * frames to other mesh points which are not currently selected as a * primary traffic path, but which are only 1 hop away. The absence of * the primary path to the chosen node makes it necessary to apply some * form of marking on a chosen packet stream so that the packets can be * properly steered to the selected node for testing, and not by the * regular mesh path lookup. Further, the packets must be of type data * so that the rate control (often embedded in firmware) is used for * rate selection. * * Here attribute %NL80211_ATTR_MAC is used to specify connected mesh * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame * content. The frame is ethernet data. * * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration * is passed using %NL80211_ATTR_TID_CONFIG attribute. * * @NL80211_CMD_UNPROT_BEACON: Unprotected or incorrectly protected Beacon * frame. This event is used to indicate that a received Beacon frame was * dropped because it did not include a valid MME MIC while beacon * protection was enabled (BIGTK configured in station mode). * * @NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS: Report TX status of a control * port frame transmitted with %NL80211_CMD_CONTROL_PORT_FRAME. * %NL80211_ATTR_COOKIE identifies the TX command and %NL80211_ATTR_FRAME * includes the contents of the frame. %NL80211_ATTR_ACK flag is included * if the recipient acknowledged the frame. * * @NL80211_CMD_SET_SAR_SPECS: SAR power limitation configuration is * passed using %NL80211_ATTR_SAR_SPEC. %NL80211_ATTR_WIPHY is used to * specify the wiphy index to be applied to. * * @NL80211_CMD_OBSS_COLOR_COLLISION: This notification is sent out whenever * mac80211/drv detects a bss color collision. * * @NL80211_CMD_COLOR_CHANGE_REQUEST: This command is used to indicate that * userspace wants to change the BSS color. * * @NL80211_CMD_COLOR_CHANGE_STARTED: Notify userland, that a color change has * started * * @NL80211_CMD_COLOR_CHANGE_ABORTED: Notify userland, that the color change has * been aborted * * @NL80211_CMD_COLOR_CHANGE_COMPLETED: Notify userland that the color change * has completed * * @NL80211_CMD_SET_FILS_AAD: Set FILS AAD data to the driver using - * &NL80211_ATTR_MAC - for STA MAC address * &NL80211_ATTR_FILS_KEK - for KEK * &NL80211_ATTR_FILS_NONCES - for FILS Nonces * (STA Nonce 16 bytes followed by AP Nonce 16 bytes) * * @NL80211_CMD_ASSOC_COMEBACK: notification about an association * temporal rejection with comeback. The event includes %NL80211_ATTR_MAC * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to * specify the timeout value. * * @NL80211_CMD_ADD_LINK: Add a new link to an interface. The * %NL80211_ATTR_MLO_LINK_ID attribute is used for the new link. * @NL80211_CMD_REMOVE_LINK: Remove a link from an interface. This may come * without %NL80211_ATTR_MLO_LINK_ID as an easy way to remove all links * in preparation for e.g. roaming to a regular (non-MLO) AP. * * @NL80211_CMD_ADD_LINK_STA: Add a link to an MLD station * @NL80211_CMD_MODIFY_LINK_STA: Modify a link of an MLD station * @NL80211_CMD_REMOVE_LINK_STA: Remove a link of an MLD station * * @NL80211_CMD_SET_HW_TIMESTAMP: Enable/disable HW timestamping of Timing * measurement and Fine timing measurement frames. If %NL80211_ATTR_MAC * is included, enable/disable HW timestamping only for frames to/from the * specified MAC address. Otherwise enable/disable HW timestamping for * all TM/FTM frames (including ones that were enabled with specific MAC * address). If %NL80211_ATTR_HW_TIMESTAMP_ENABLED is not included, disable * HW timestamping. * The number of peers that HW timestamping can be enabled for concurrently * is indicated by %NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ enum nl80211_commands { /* don't change the order or add anything between, this is ABI! */ NL80211_CMD_UNSPEC, NL80211_CMD_GET_WIPHY, /* can dump */ NL80211_CMD_SET_WIPHY, NL80211_CMD_NEW_WIPHY, NL80211_CMD_DEL_WIPHY, NL80211_CMD_GET_INTERFACE, /* can dump */ NL80211_CMD_SET_INTERFACE, NL80211_CMD_NEW_INTERFACE, NL80211_CMD_DEL_INTERFACE, NL80211_CMD_GET_KEY, NL80211_CMD_SET_KEY, NL80211_CMD_NEW_KEY, NL80211_CMD_DEL_KEY, NL80211_CMD_GET_BEACON, NL80211_CMD_SET_BEACON, NL80211_CMD_START_AP, NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP, NL80211_CMD_STOP_AP, NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP, NL80211_CMD_GET_STATION, NL80211_CMD_SET_STATION, NL80211_CMD_NEW_STATION, NL80211_CMD_DEL_STATION, NL80211_CMD_GET_MPATH, NL80211_CMD_SET_MPATH, NL80211_CMD_NEW_MPATH, NL80211_CMD_DEL_MPATH, NL80211_CMD_SET_BSS, NL80211_CMD_SET_REG, NL80211_CMD_REQ_SET_REG, NL80211_CMD_GET_MESH_CONFIG, NL80211_CMD_SET_MESH_CONFIG, NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */, NL80211_CMD_GET_REG, NL80211_CMD_GET_SCAN, NL80211_CMD_TRIGGER_SCAN, NL80211_CMD_NEW_SCAN_RESULTS, NL80211_CMD_SCAN_ABORTED, NL80211_CMD_REG_CHANGE, NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, NL80211_CMD_DEAUTHENTICATE, NL80211_CMD_DISASSOCIATE, NL80211_CMD_MICHAEL_MIC_FAILURE, NL80211_CMD_REG_BEACON_HINT, NL80211_CMD_JOIN_IBSS, NL80211_CMD_LEAVE_IBSS, NL80211_CMD_TESTMODE, NL80211_CMD_CONNECT, NL80211_CMD_ROAM, NL80211_CMD_DISCONNECT, NL80211_CMD_SET_WIPHY_NETNS, NL80211_CMD_GET_SURVEY, NL80211_CMD_NEW_SURVEY_RESULTS, NL80211_CMD_SET_PMKSA, NL80211_CMD_DEL_PMKSA, NL80211_CMD_FLUSH_PMKSA, NL80211_CMD_REMAIN_ON_CHANNEL, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, NL80211_CMD_SET_TX_BITRATE_MASK, NL80211_CMD_REGISTER_FRAME, NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME, NL80211_CMD_FRAME, NL80211_CMD_ACTION = NL80211_CMD_FRAME, NL80211_CMD_FRAME_TX_STATUS, NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS, NL80211_CMD_SET_POWER_SAVE, NL80211_CMD_GET_POWER_SAVE, NL80211_CMD_SET_CQM, NL80211_CMD_NOTIFY_CQM, NL80211_CMD_SET_CHANNEL, NL80211_CMD_SET_WDS_PEER, NL80211_CMD_FRAME_WAIT_CANCEL, NL80211_CMD_JOIN_MESH, NL80211_CMD_LEAVE_MESH, NL80211_CMD_UNPROT_DEAUTHENTICATE, NL80211_CMD_UNPROT_DISASSOCIATE, NL80211_CMD_NEW_PEER_CANDIDATE, NL80211_CMD_GET_WOWLAN, NL80211_CMD_SET_WOWLAN, NL80211_CMD_START_SCHED_SCAN, NL80211_CMD_STOP_SCHED_SCAN, NL80211_CMD_SCHED_SCAN_RESULTS, NL80211_CMD_SCHED_SCAN_STOPPED, NL80211_CMD_SET_REKEY_OFFLOAD, NL80211_CMD_PMKSA_CANDIDATE, NL80211_CMD_TDLS_OPER, NL80211_CMD_TDLS_MGMT, NL80211_CMD_UNEXPECTED_FRAME, NL80211_CMD_PROBE_CLIENT, NL80211_CMD_REGISTER_BEACONS, NL80211_CMD_UNEXPECTED_4ADDR_FRAME, NL80211_CMD_SET_NOACK_MAP, NL80211_CMD_CH_SWITCH_NOTIFY, NL80211_CMD_START_P2P_DEVICE, NL80211_CMD_STOP_P2P_DEVICE, NL80211_CMD_CONN_FAILED, NL80211_CMD_SET_MCAST_RATE, NL80211_CMD_SET_MAC_ACL, NL80211_CMD_RADAR_DETECT, NL80211_CMD_GET_PROTOCOL_FEATURES, NL80211_CMD_UPDATE_FT_IES, NL80211_CMD_FT_EVENT, NL80211_CMD_CRIT_PROTOCOL_START, NL80211_CMD_CRIT_PROTOCOL_STOP, NL80211_CMD_GET_COALESCE, NL80211_CMD_SET_COALESCE, NL80211_CMD_CHANNEL_SWITCH, NL80211_CMD_VENDOR, NL80211_CMD_SET_QOS_MAP, NL80211_CMD_ADD_TX_TS, NL80211_CMD_DEL_TX_TS, NL80211_CMD_GET_MPP, NL80211_CMD_JOIN_OCB, NL80211_CMD_LEAVE_OCB, NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, NL80211_CMD_TDLS_CHANNEL_SWITCH, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH, NL80211_CMD_WIPHY_REG_CHANGE, NL80211_CMD_ABORT_SCAN, NL80211_CMD_START_NAN, NL80211_CMD_STOP_NAN, NL80211_CMD_ADD_NAN_FUNCTION, NL80211_CMD_DEL_NAN_FUNCTION, NL80211_CMD_CHANGE_NAN_CONFIG, NL80211_CMD_NAN_MATCH, NL80211_CMD_SET_MULTICAST_TO_UNICAST, NL80211_CMD_UPDATE_CONNECT_PARAMS, NL80211_CMD_SET_PMK, NL80211_CMD_DEL_PMK, NL80211_CMD_PORT_AUTHORIZED, NL80211_CMD_RELOAD_REGDB, NL80211_CMD_EXTERNAL_AUTH, NL80211_CMD_STA_OPMODE_CHANGED, NL80211_CMD_CONTROL_PORT_FRAME, NL80211_CMD_GET_FTM_RESPONDER_STATS, NL80211_CMD_PEER_MEASUREMENT_START, NL80211_CMD_PEER_MEASUREMENT_RESULT, NL80211_CMD_PEER_MEASUREMENT_COMPLETE, NL80211_CMD_NOTIFY_RADAR, NL80211_CMD_UPDATE_OWE_INFO, NL80211_CMD_PROBE_MESH_LINK, NL80211_CMD_SET_TID_CONFIG, NL80211_CMD_UNPROT_BEACON, NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS, NL80211_CMD_SET_SAR_SPECS, NL80211_CMD_OBSS_COLOR_COLLISION, NL80211_CMD_COLOR_CHANGE_REQUEST, NL80211_CMD_COLOR_CHANGE_STARTED, NL80211_CMD_COLOR_CHANGE_ABORTED, NL80211_CMD_COLOR_CHANGE_COMPLETED, NL80211_CMD_SET_FILS_AAD, NL80211_CMD_ASSOC_COMEBACK, NL80211_CMD_ADD_LINK, NL80211_CMD_REMOVE_LINK, NL80211_CMD_ADD_LINK_STA, NL80211_CMD_MODIFY_LINK_STA, NL80211_CMD_REMOVE_LINK_STA, NL80211_CMD_SET_HW_TIMESTAMP, /* add new commands above here */ /* used to define NL80211_CMD_MAX below */ __NL80211_CMD_AFTER_LAST, NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 }; /* * Allow user space programs to use #ifdef on new commands by defining them * here */ #define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS #define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE #define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE #define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE #define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE #define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE #define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE #define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS /* source-level API compatibility */ #define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG #define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG #define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE /** * enum nl80211_attrs - nl80211 netlink attributes * * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors * * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. * /sys/class/ieee80211/<phyname>/index * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz, * defines the channel together with the (deprecated) * %NL80211_ATTR_WIPHY_CHANNEL_TYPE attribute or the attributes * %NL80211_ATTR_CHANNEL_WIDTH and if needed %NL80211_ATTR_CENTER_FREQ1 * and %NL80211_ATTR_CENTER_FREQ2 * @NL80211_ATTR_CHANNEL_WIDTH: u32 attribute containing one of the values * of &enum nl80211_chan_width, describing the channel width. See the * documentation of the enum for more information. * @NL80211_ATTR_CENTER_FREQ1: Center frequency of the first part of the * channel, used for anything but 20 MHz bandwidth. In S1G this is the * operating channel center frequency. * @NL80211_ATTR_CENTER_FREQ2: Center frequency of the second part of the * channel, used only for 80+80 MHz bandwidth * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ * if HT20 or HT40 are to be used (i.e., HT disabled if not included): * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including * this attribute) * NL80211_CHAN_HT20 = HT20 only * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel * This attribute is now deprecated. * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is * less than or equal to the RTS threshold; allowed range: 1..255; * dot11ShortRetryLimit; u8 * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is * greater than the RTS threshold; allowed range: 1..255; * dot11ShortLongLimit; u8 * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum * length in octets for frames; allowed range: 256..8000, disable * fragmentation with (u32)-1; dot11FragmentationThreshold; u32 * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length * larger than or equal to this use RTS/CTS handshake); allowed range: * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11 * section 7.3.2.9; dot11CoverageClass; u8 * * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on * @NL80211_ATTR_IFNAME: network interface name * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype * * @NL80211_ATTR_WDEV: wireless device identifier, used for pseudo-devices * that don't have a netdev (u64) * * @NL80211_ATTR_MAC: MAC address (various uses) * * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC * keys * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3) * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 * section 7.3.2.25.1, e.g. 0x000FAC04) * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and * CCMP keys, each six bytes in little endian * @NL80211_ATTR_KEY_DEFAULT: Flag attribute indicating the key is default key * @NL80211_ATTR_KEY_DEFAULT_MGMT: Flag attribute indicating the key is the * default management key * @NL80211_ATTR_CIPHER_SUITES_PAIRWISE: For crypto settings for connect or * other commands, indicates which pairwise cipher suites are used * @NL80211_ATTR_CIPHER_SUITE_GROUP: For crypto settings for connect or * other commands, indicates which group cipher suite is used * * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE * * @NL80211_ATTR_STA_AID: Association ID for the station (u16) * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2) * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by * IEEE 802.11 7.3.1.6 (u16). * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported * rates as defined by IEEE 802.11 7.3.2.2 but without the length * restriction (at most %NL80211_MAX_SUPP_RATES). * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station * to, or the AP interface the station was originally added to. * @NL80211_ATTR_STA_INFO: information about a station, part of station info * given for %NL80211_CMD_GET_STATION, nested attribute containing * info as possible, see &enum nl80211_sta_info. * * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, * consisting of a nested array. * * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link * (see &enum nl80211_plink_action). * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path * info given for %NL80211_CMD_GET_MPATH, nested attribute described at * &enum nl80211_mpath_info. * * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of * &enum nl80211_mntr_flags. * * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the * current regulatory domain should be set to or is already set to. * For example, 'CR', for Costa Rica. This attribute is used by the kernel * to query the CRDA to retrieve one regulatory domain. This attribute can * also be used by userspace to query the kernel for the currently set * regulatory domain. We chose an alpha2 as that is also used by the * IEEE-802.11 country information element to identify a country. * Users can also simply ask the wireless core to set regulatory domain * to a specific alpha2. * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory * rules. * * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled * (u8, 0 or 1) * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled * (u8, 0 or 1) * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic * rates in format defined by IEEE 802.11 7.3.2.2 but without the length * restriction (at most %NL80211_MAX_SUPP_RATES). * * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from * association request when used with NL80211_CMD_NEW_STATION) * * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all * supported interface types, each a flag attribute with the number * of the interface mode. * * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for * %NL80211_CMD_SET_MGMT_EXTRA_IE. * * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with * %NL80211_CMD_SET_MGMT_EXTRA_IE). * * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with * a single scan request, a wiphy attribute. * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can * scan with a single scheduled scan request, a wiphy attribute. * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements * that can be added to a scan request * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information * elements that can be added to a scheduled scan request * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be * used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute. * * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive * scanning and include a zero-length SSID (wildcard) for wildcard scan * @NL80211_ATTR_BSS: scan result BSS * * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain * currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_* * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*) * * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies * an array of command numbers (i.e. a mapping index to command number) * that the driver for the given wiphy supports. * * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and * NL80211_CMD_ASSOCIATE events * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets) * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type, * represented as a u32 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and * %NL80211_CMD_DISASSOCIATE, u16 * * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as * a u32 * * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change * due to considerations from a beacon hint. This attribute reflects * the state of the channel _before_ the beacon hint processing. This * attributes consists of a nested attribute containing * NL80211_FREQUENCY_ATTR_* * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change * due to considerations from a beacon hint. This attribute reflects * the state of the channel _after_ the beacon hint processing. This * attributes consists of a nested attribute containing * NL80211_FREQUENCY_ATTR_* * * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported * cipher suites * * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look * for other networks on different channels * * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this * is used, e.g., with %NL80211_CMD_AUTHENTICATE event * * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is * used for the association (&enum nl80211_mfp, represented as a u32); * this attribute can be used with %NL80211_CMD_ASSOCIATE and * %NL80211_CMD_CONNECT requests. %NL80211_MFP_OPTIONAL is not allowed for * %NL80211_CMD_ASSOCIATE since user space SME is expected and hence, it * must have decided whether to use management frame protection or not. * Setting %NL80211_MFP_OPTIONAL with a %NL80211_CMD_CONNECT request will * let the driver (or the firmware) decide whether to use MFP or not. * * @NL80211_ATTR_STA_FLAGS2: Attribute containing a * &struct nl80211_sta_flag_update. * * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE * request, the driver will assume that the port is unauthorized until * authorized by user space. Otherwise, port is marked authorized by * default in station mode. * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the * ethertype that will be used for key negotiation. It can be * specified with the associate and connect commands. If it is not * specified, the value defaults to 0x888E (PAE, 802.1X). This * attribute is also used as a flag in the wiphy information to * indicate that protocols other than PAE are supported. * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom * ethertype frames used for key negotiation must not be encrypted. * @NL80211_ATTR_CONTROL_PORT_OVER_NL80211: A flag indicating whether control * port frames (e.g. of type given in %NL80211_ATTR_CONTROL_PORT_ETHERTYPE) * will be sent directly to the network interface or sent via the NL80211 * socket. If this attribute is missing, then legacy behavior of sending * control port frames directly to the network interface is used. If the * flag is included, then control port frames are sent over NL80211 instead * using %CMD_CONTROL_PORT_FRAME. If control port routing over NL80211 is * to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER * flag. When used with %NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, pre-auth * frames are not forwared over the control port. * * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. * We recommend using nested, driver-specific attributes within this. * * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT * event was due to the AP disconnecting the station, and not due to * a local disconnect request. * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT * event (u16) * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating * that protected APs should be used. This is also used with NEW_BEACON to * indicate that the BSS is to use protection. * * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON * to indicate which unicast key ciphers will be used with the connection * (an array of u32). * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to * indicate which group key cipher will be used with the connection (a * u32). * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to * indicate which WPA version(s) the AP we want to associate with is using * (a u32 with flags from &enum nl80211_wpa_versions). * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to * indicate which key management algorithm(s) to use (an array of u32). * This attribute is also sent in response to @NL80211_CMD_GET_WIPHY, * indicating the supported AKM suites, intended for specific drivers which * implement SME and have constraints on which AKMs are supported and also * the cases where an AKM support is offloaded to the driver/firmware. * If there is no such notification from the driver, user space should * assume the driver supports all the AKM suites. * * @NL80211_ATTR_REQ_IE: (Re)association request information elements as * sent out by the card, for ROAM and successful CONNECT events. * @NL80211_ATTR_RESP_IE: (Re)association response information elements as * sent by peer, for ROAM and successful CONNECT events. * * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT * commands to specify a request to reassociate within an ESS, i.e., to use * Reassociate Request frame (with the value of this attribute in the * Current AP address field) instead of Association Request frame which is * used for the initial association to an ESS. * * @NL80211_ATTR_KEY: key information in a nested attribute with * %NL80211_KEY_* sub-attributes * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect() * and join_ibss(), key information is in a nested attribute each * with %NL80211_KEY_* sub-attributes * * @NL80211_ATTR_PID: Process ID of a network namespace. * * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for * dumps. This number increases whenever the object list being * dumped changes, and as such userspace can verify that it has * obtained a complete and consistent snapshot by verifying that * all dump messages contain the same generation number. If it * changed then the list changed and the dump should be repeated * completely from scratch. * * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface * * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of * the survey response for %NL80211_CMD_GET_SURVEY, nested attribute * containing info as possible, see &enum survey_info. * * @NL80211_ATTR_PMKID: PMK material for PMKSA caching. * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can * cache, a wiphy attribute. * * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32. * @NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION: Device attribute that * specifies the maximum duration that can be requested with the * remain-on-channel operation, in milliseconds, u32. * * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects. * * @NL80211_ATTR_TX_RATES: Nested set of attributes * (enum nl80211_tx_rate_attributes) describing TX rates per band. The * enum nl80211_band value is used as the index (nla_type() of the nested * data. If a band is not included, it will be configured to allow all * rates based on negotiated supported rates information. This attribute * is used with %NL80211_CMD_SET_TX_BITRATE_MASK and with starting AP, * and joining mesh networks (not IBSS yet). In the later case, it must * specify just a single bitrate, which is to be used for the beacon. * The driver must also specify support for this with the extended * features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, * NL80211_EXT_FEATURE_BEACON_RATE_HT, * NL80211_EXT_FEATURE_BEACON_RATE_VHT and * NL80211_EXT_FEATURE_BEACON_RATE_HE. * * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME. * @NL80211_ATTR_FRAME_TYPE: A u16 indicating the frame type/subtype for the * @NL80211_CMD_REGISTER_FRAME command. * @NL80211_ATTR_TX_FRAME_TYPES: wiphy capability attribute, which is a * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing * information about which frame types can be transmitted with * %NL80211_CMD_FRAME. * @NL80211_ATTR_RX_FRAME_TYPES: wiphy capability attribute, which is a * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing * information about which frame types can be registered for RX. * * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was * acknowledged by the recipient. * * @NL80211_ATTR_PS_STATE: powersave state, using &enum nl80211_ps_state values. * * @NL80211_ATTR_CQM: connection quality monitor configuration in a * nested attribute with %NL80211_ATTR_CQM_* sub-attributes. * * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command * is requesting a local authentication/association state change without * invoking actual management frame exchange. This can be used with * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE, * NL80211_CMD_DISASSOCIATE. * * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations * connected to this BSS. * * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See * &enum nl80211_tx_power_setting for possible values. * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units. * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING * for non-automatic settings. * * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly * means support for per-station GTKs. * * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting. * This can be used to mask out antennas which are not attached or should * not be used for transmitting. If an antenna is not selected in this * bitmap the hardware is not allowed to transmit on this antenna. * * Each bit represents one antenna, starting with antenna 1 at the first * bit. Depending on which antennas are selected in the bitmap, 802.11n * drivers can derive which chainmasks to use (if all antennas belonging to * a particular chain are disabled this chain should be disabled) and if * a chain has diversity antennas wether diversity should be used or not. * HT capabilities (STBC, TX Beamforming, Antenna selection) can be * derived from the available chains after applying the antenna mask. * Non-802.11n drivers can derive wether to use diversity or not. * Drivers may reject configurations or RX/TX mask combinations they cannot * support by returning -EINVAL. * * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving. * This can be used to mask out antennas which are not attached or should * not be used for receiving. If an antenna is not selected in this bitmap * the hardware should not be configured to receive on this antenna. * For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX. * * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available * for configuration as TX antennas via the above parameters. * * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available * for configuration as RX antennas via the above parameters. * * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS * * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be * transmitted on another channel when the channel given doesn't match * the current channel. If the current channel doesn't match and this * flag isn't set, the frame will be rejected. This is also used as an * nl80211 capability flag. * * @NL80211_ATTR_BSS_HT_OPMODE: HT operation mode (u16) * * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags * attributes, specifying what a key should be set as default as. * See &enum nl80211_key_default_types. * * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be * changed once the mesh is active. * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute * containing attributes from &enum nl80211_meshconf_params. * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver * allows auth frames in a mesh to be passed to userspace for processing via * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as defined in * &enum nl80211_plink_state. Used when userspace is driving the peer link * management state machine. @NL80211_MESH_SETUP_USERSPACE_AMPE or * @NL80211_MESH_SETUP_USERSPACE_MPM must be enabled. * * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy * capabilities, the supported WoWLAN triggers * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to * indicate which WoW triggers should be enabled. This is also * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN * triggers. * * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan * cycles, in msecs. * * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more * sets of attributes to match during scheduled scans. Only BSSs * that match any of the sets will be reported. These are * pass-thru filter rules. * For a match to succeed, the BSS must match all attributes of a * set. Since not every hardware supports matching all types of * attributes, there is no guarantee that the reported BSSs are * fully complying with the match sets and userspace needs to be * able to ignore them by itself. * Thus, the implementation is somewhat hardware-dependent, but * this is only an optimization and the userspace application * needs to handle all the non-filtered results anyway. * If the match attributes don't make sense when combined with * the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID * is included in the probe request, but the match attributes * will never let it go through), -EINVAL may be returned. * If omitted, no filtering is done. * * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported * interface combinations. In each nested item, it contains attributes * defined in &enum nl80211_if_combination_attrs. * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that * are managed in software: interfaces of these types aren't subject to * any restrictions in their number or combinations. * * @NL80211_ATTR_REKEY_DATA: nested attribute containing the information * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data. * * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan, * nested array attribute containing an entry for each band, with the entry * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but * without the length restriction (at most %NL80211_MAX_SUPP_RATES). * * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon * and Probe Response (when response to wildcard Probe Request); see * &enum nl80211_hidden_ssid, represented as a u32 * * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame. * This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to * provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the * driver (or firmware) replies to Probe Request frames. * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association * Response frames. This is used with %NL80211_CMD_NEW_BEACON and * %NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into * (Re)Association Response frames when the driver (or firmware) replies to * (Re)Association Request frames. * * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration * of the station, see &enum nl80211_sta_wme_attr. * @NL80211_ATTR_SUPPORT_AP_UAPSD: the device supports uapsd when working * as AP. * * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of * roaming to another AP in the same ESS if the signal lever is low. * * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching * candidate information, see &enum nl80211_pmksa_candidate_attr. * * @NL80211_ATTR_TX_NO_CCK_RATE: Indicates whether to use CCK rate or not * for management frames transmission. In order to avoid p2p probe/action * frames are being transmitted at CCK rate in 2GHz band, the user space * applications use this attribute. * This attribute is used with %NL80211_CMD_TRIGGER_SCAN and * %NL80211_CMD_FRAME commands. * * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup * request, link setup confirm, link teardown, etc.). Values are * described in the TDLS (802.11z) specification. * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a * TDLS conversation between two devices. * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see * &enum nl80211_tdls_operation, represented as a u8. * @NL80211_ATTR_TDLS_SUPPORT: A flag indicating the device can operate * as a TDLS peer sta. * @NL80211_ATTR_TDLS_EXTERNAL_SETUP: The TDLS discovery/setup and teardown * procedures should be performed by sending TDLS packets via * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be * used for asking the driver to perform a TDLS operation. * * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices * that have AP support to indicate that they have the AP SME integrated * with support for the features listed in this attribute, see * &enum nl80211_ap_sme_features. * * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells * the driver to not wait for an acknowledgement. Note that due to this, * it will also not give a status callback nor return a cookie. This is * mostly useful for probe responses to save airtime. * * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from * &enum nl80211_feature_flags and is advertised in wiphy information. * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe * requests while operating in AP-mode. * This attribute holds a bitmap of the supported protocols for * offloading (see &enum nl80211_probe_resp_offload_support_attr). * * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire * probe-response frame. The DA field in the 802.11 header is zero-ed out, * to be filled by the FW. * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable * this feature during association. This is a flag attribute. * Currently only supported in mac80211 drivers. * @NL80211_ATTR_DISABLE_VHT: Force VHT capable interfaces to disable * this feature during association. This is a flag attribute. * Currently only supported in mac80211 drivers. * @NL80211_ATTR_DISABLE_HE: Force HE capable interfaces to disable * this feature during association. This is a flag attribute. * Currently only supported in mac80211 drivers. * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the * ATTR_HT_CAPABILITY to which attention should be paid. * Currently, only mac80211 NICs support this feature. * The values that may be configured are: * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40 * AMPDU density and AMPDU factor. * All values are treated as suggestions and may be ignored * by the driver as required. The actual values may be seen in * the station debugfs ht_caps file. * * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country * abides to when initiating radiation on DFS channels. A country maps * to one DFS region. * * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of * up to 16 TIDs. * * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be * used by the drivers which has MLME in firmware and does not have support * to report per station tx/rx activity to free up the station entry from * the list. This needs to be used when the driver advertises the * capability to timeout the stations. * * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int); * this attribute is (depending on the driver capabilities) added to * received frames indicated with %NL80211_CMD_FRAME. * * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds * or 0 to disable background scan. * * @NL80211_ATTR_USER_REG_HINT_TYPE: type of regulatory hint passed from * userspace. If unset it is assumed the hint comes directly from * a user. If set code could specify exactly what type of source * was used to provide the hint. For the different types of * allowed user regulatory hints see nl80211_user_reg_hint_type. * * @NL80211_ATTR_CONN_FAILED_REASON: The reason for which AP has rejected * the connection request from a station. nl80211_connect_failed_reason * enum has different reasons of connection failure. * * @NL80211_ATTR_AUTH_DATA: Fields and elements in Authentication frames. * This contains the authentication frame body (non-IE and IE data), * excluding the Authentication algorithm number, i.e., starting at the * Authentication transaction sequence number field. It is used with * authentication algorithms that need special fields to be added into * the frames (SAE and FILS). Currently, only the SAE cases use the * initial two fields (Authentication transaction sequence number and * Status code). However, those fields are included in the attribute data * for all authentication algorithms to keep the attribute definition * consistent. * * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from * association request when used with NL80211_CMD_NEW_STATION) * * @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32) * * @NL80211_ATTR_P2P_CTWINDOW: P2P GO Client Traffic Window (u8), used with * the START_AP and SET_BSS commands * @NL80211_ATTR_P2P_OPPPS: P2P GO opportunistic PS (u8), used with the * START_AP and SET_BSS commands. This can have the values 0 or 1; * if not given in START_AP 0 is assumed, if not given in SET_BSS * no change is made. * * @NL80211_ATTR_LOCAL_MESH_POWER_MODE: local mesh STA link-specific power mode * defined in &enum nl80211_mesh_power_mode. * * @NL80211_ATTR_ACL_POLICY: ACL policy, see &enum nl80211_acl_policy, * carried in a u32 attribute * * @NL80211_ATTR_MAC_ADDRS: Array of nested MAC addresses, used for * MAC ACL. * * @NL80211_ATTR_MAC_ACL_MAX: u32 attribute to advertise the maximum * number of MAC addresses that a device can support for MAC * ACL. * * @NL80211_ATTR_RADAR_EVENT: Type of radar event for notification to userspace, * contains a value of enum nl80211_radar_event (u32). * * @NL80211_ATTR_EXT_CAPA: 802.11 extended capabilities that the kernel driver * has and handles. The format is the same as the IE contents. See * 802.11-2012 8.4.2.29 for more information. * @NL80211_ATTR_EXT_CAPA_MASK: Extended capabilities that the kernel driver * has set in the %NL80211_ATTR_EXT_CAPA value, for multibit fields. * * @NL80211_ATTR_STA_CAPABILITY: Station capabilities (u16) are advertised to * the driver, e.g., to enable TDLS power save (PU-APSD). * * @NL80211_ATTR_STA_EXT_CAPABILITY: Station extended capabilities are * advertised to the driver, e.g., to enable TDLS off channel operations * and PU-APSD. * * @NL80211_ATTR_PROTOCOL_FEATURES: global nl80211 feature flags, see * &enum nl80211_protocol_features, the attribute is a u32. * * @NL80211_ATTR_SPLIT_WIPHY_DUMP: flag attribute, userspace supports * receiving the data for a single wiphy split across multiple * messages, given with wiphy dump message * * @NL80211_ATTR_MDID: Mobility Domain Identifier * * @NL80211_ATTR_IE_RIC: Resource Information Container Information * Element * * @NL80211_ATTR_CRIT_PROT_ID: critical protocol identifier requiring increased * reliability, see &enum nl80211_crit_proto_id (u16). * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which * the connection should have increased reliability (u16). * * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16). * This is similar to @NL80211_ATTR_STA_AID but with a difference of being * allowed to be used with the first @NL80211_CMD_SET_STATION command to * update a TDLS peer STA entry. * * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information. * * @NL80211_ATTR_CH_SWITCH_COUNT: u32 attribute specifying the number of TBTT's * until the channel switch event. * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission * must be blocked on the current channel (before the channel switch * operation). Also included in the channel switch started event if quiet * was requested by the AP. * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information * for the time while performing a channel switch. * @NL80211_ATTR_CNTDWN_OFFS_BEACON: An array of offsets (u16) to the channel * switch or color change counters in the beacons tail (%NL80211_ATTR_BEACON_TAIL). * @NL80211_ATTR_CNTDWN_OFFS_PRESP: An array of offsets (u16) to the channel * switch or color change counters in the probe response (%NL80211_ATTR_PROBE_RESP). * * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. * As specified in the &enum nl80211_rxmgmt_flags. * * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels. * * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported * operating classes. * * @NL80211_ATTR_HANDLE_DFS: A flag indicating whether user space * controls DFS operation in IBSS mode. If the flag is included in * %NL80211_CMD_JOIN_IBSS request, the driver will allow use of DFS * channels and reports radar events to userspace. Userspace is required * to react to radar events, e.g. initiate a channel switch or leave the * IBSS network. * * @NL80211_ATTR_SUPPORT_5_MHZ: A flag indicating that the device supports * 5 MHz channel bandwidth. * @NL80211_ATTR_SUPPORT_10_MHZ: A flag indicating that the device supports * 10 MHz channel bandwidth. * * @NL80211_ATTR_OPMODE_NOTIF: Operating mode field from Operating Mode * Notification Element based on association request when used with * %NL80211_CMD_NEW_STATION or %NL80211_CMD_SET_STATION (only when * %NL80211_FEATURE_FULL_AP_CLIENT_STATE is supported, or with TDLS); * u8 attribute. * * @NL80211_ATTR_VENDOR_ID: The vendor ID, either a 24-bit OUI or, if * %NL80211_VENDOR_ID_IS_LINUX is set, a special Linux ID (not used yet) * @NL80211_ATTR_VENDOR_SUBCMD: vendor sub-command * @NL80211_ATTR_VENDOR_DATA: data for the vendor command, if any; this * attribute is also used for vendor command feature advertisement * @NL80211_ATTR_VENDOR_EVENTS: used for event list advertising in the wiphy * info, containing a nested array of possible events * * @NL80211_ATTR_QOS_MAP: IP DSCP mapping for Interworking QoS mapping. This * data is in the format defined for the payload of the QoS Map Set element * in IEEE Std 802.11-2012, 8.4.2.97. * * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS * * @NL80211_ATTR_MAX_AP_ASSOC_STA: Device attribute that indicates how many * associated stations are supported in AP mode (including P2P GO); u32. * Since drivers may not have a fixed limit on the maximum number (e.g., * other concurrent operations may affect this), drivers are allowed to * advertise values that cannot always be met. In such cases, an attempt * to add a new station entry with @NL80211_CMD_NEW_STATION may fail. * * @NL80211_ATTR_CSA_C_OFFSETS_TX: An array of csa counter offsets (u16) which * should be updated when the frame is transmitted. * @NL80211_ATTR_MAX_CSA_COUNTERS: U8 attribute used to advertise the maximum * supported number of csa counters. * * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. * As specified in the &enum nl80211_tdls_peer_capability. * * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface * creation then the new interface will be owned by the netlink socket * that created it and will be destroyed when the socket is closed. * If set during scheduled scan start then the new scan req will be * owned by the netlink socket that created it and the scheduled scan will * be stopped when the socket is closed. * If set during configuration of regulatory indoor operation then the * regulatory indoor configuration would be owned by the netlink socket * that configured the indoor setting, and the indoor operation would be * cleared when the socket is closed. * If set during NAN interface creation, the interface will be destroyed * if the socket is closed just like any other interface. Moreover, NAN * notifications will be sent in unicast to that socket. Without this * attribute, the notifications will be sent to the %NL80211_MCGRP_NAN * multicast group. * If set during %NL80211_CMD_ASSOCIATE or %NL80211_CMD_CONNECT the * station will deauthenticate when the socket is closed. * If set during %NL80211_CMD_JOIN_IBSS the IBSS will be automatically * torn down when the socket is closed. * If set during %NL80211_CMD_JOIN_MESH the mesh setup will be * automatically torn down when the socket is closed. * If set during %NL80211_CMD_START_AP the AP will be automatically * disabled when the socket is closed. * * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is * the TDLS link initiator. * * @NL80211_ATTR_USE_RRM: flag for indicating whether the current connection * shall support Radio Resource Measurements (11k). This attribute can be * used with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests. * User space applications are expected to use this flag only if the * underlying device supports these minimal RRM features: * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES, * %NL80211_FEATURE_QUIET, * Or, if global RRM is supported, see: * %NL80211_EXT_FEATURE_RRM * If this flag is used, driver must add the Power Capabilities IE to the * association request. In addition, it must also set the RRM capability * flag in the association request's Capability Info field. * * @NL80211_ATTR_WIPHY_DYN_ACK: flag attribute used to enable ACK timeout * estimation algorithm (dynack). In order to activate dynack * %NL80211_FEATURE_ACKTO_ESTIMATION feature flag must be set by lower * drivers to indicate dynack capability. Dynack is automatically disabled * setting valid value for coverage class. * * @NL80211_ATTR_TSID: a TSID value (u8 attribute) * @NL80211_ATTR_USER_PRIO: user priority value (u8 attribute) * @NL80211_ATTR_ADMITTED_TIME: admitted time in units of 32 microseconds * (per second) (u16 attribute) * * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see * &enum nl80211_smps_mode. * * @NL80211_ATTR_OPER_CLASS: operating class * * @NL80211_ATTR_MAC_MASK: MAC address mask * * @NL80211_ATTR_WIPHY_SELF_MANAGED_REG: flag attribute indicating this device * is self-managing its regulatory information and any regulatory domain * obtained from it is coming from the device's wiphy and not the global * cfg80211 regdomain. * * @NL80211_ATTR_EXT_FEATURES: extended feature flags contained in a byte * array. The feature flags are identified by their bit index (see &enum * nl80211_ext_feature_index). The bit index is ordered starting at the * least-significant bit of the first byte in the array, ie. bit index 0 * is located at bit 0 of byte 0. bit index 25 would be located at bit 1 * of byte 3 (u8 array). * * @NL80211_ATTR_SURVEY_RADIO_STATS: Request overall radio statistics to be * returned along with other survey data. If set, @NL80211_CMD_GET_SURVEY * may return a survey entry without a channel indicating global radio * statistics (only some values are valid and make sense.) * For devices that don't return such an entry even then, the information * should be contained in the result as the sum of the respective counters * over all channels. * * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a * scheduled scan is started. Or the delay before a WoWLAN * net-detect scan is started, counting from the moment the * system is suspended. This value is a u32, in seconds. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device * is operating in an indoor environment. * * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS: maximum number of scan plans for * scheduled scan supported by the device (u32), a wiphy attribute. * @NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL: maximum interval (in seconds) for * a scan plan (u32), a wiphy attribute. * @NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS: maximum number of iterations in * a scan plan (u32), a wiphy attribute. * @NL80211_ATTR_SCHED_SCAN_PLANS: a list of scan plans for scheduled scan. * Each scan plan defines the number of scan iterations and the interval * between scans. The last scan plan will always run infinitely, * thus it must not specify the number of iterations, only the interval * between scans. The scan plans are executed sequentially. * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. * @NL80211_ATTR_PBSS: flag attribute. If set it means operate * in a PBSS. Specified in %NL80211_CMD_CONNECT to request * connecting to a PCP, and in %NL80211_CMD_START_AP to start * a PCP instead of AP. Relevant for DMG networks only. * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains * attributes according &enum nl80211_bss_select_attr to indicate what * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT * it contains the behaviour-specific attribute containing the parameters for * BSS selection to be done by driver and/or firmware. * * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status * * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment * * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes: * %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA, * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities and * other interface-type specific capabilities per interface type. For MLO, * %NL80211_ATTR_EML_CAPABILITY and %NL80211_ATTR_MLD_CAPA_AND_OPS are * present. * * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO * groupID for monitor mode. * The first 8 bytes are a mask that defines the membership in each * group (there are 64 groups, group 0 and 63 are reserved), * each bit represents a group and set to 1 for being a member in * that group and 0 for not being a member. * The remaining 16 bytes define the position in each group: 2 bits for * each group. * (smaller group numbers represented on most significant bits and bigger * group numbers on least significant bits.) * This attribute is used only if all interfaces are in monitor mode. * Set this attribute in order to monitor packets using the given MU-MIMO * groupID data. * to turn off that feature set all the bits of the groupID to zero. * @NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR: mac address for the sniffer to follow * when using MU-MIMO air sniffer. * to turn that feature off set an invalid mac address * (e.g. FF:FF:FF:FF:FF:FF) * * @NL80211_ATTR_SCAN_START_TIME_TSF: The time at which the scan was actually * started (u64). The time is the TSF of the BSS the interface that * requested the scan is connected to (if available, otherwise this * attribute must not be included). * @NL80211_ATTR_SCAN_START_TIME_TSF_BSSID: The BSS according to which * %NL80211_ATTR_SCAN_START_TIME_TSF is set. * @NL80211_ATTR_MEASUREMENT_DURATION: measurement duration in TUs (u16). If * %NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY is not set, this is the * maximum measurement duration allowed. This attribute is used with * measurement requests. It can also be used with %NL80211_CMD_TRIGGER_SCAN * if the scan is used for beacon report radio measurement. * @NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY: flag attribute that indicates * that the duration specified with %NL80211_ATTR_MEASUREMENT_DURATION is * mandatory. If this flag is not set, the duration is the maximum duration * and the actual measurement duration may be shorter. * * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is * used to pull the stored data for mesh peer in power save state. * * @NL80211_ATTR_NAN_MASTER_PREF: the master preference to be used by * %NL80211_CMD_START_NAN and optionally with * %NL80211_CMD_CHANGE_NAN_CONFIG. Its type is u8 and it can't be 0. * Also, values 1 and 255 are reserved for certification purposes and * should not be used during a normal device operation. * @NL80211_ATTR_BANDS: operating bands configuration. This is a u32 * bitmask of BIT(NL80211_BAND_*) as described in %enum * nl80211_band. For instance, for NL80211_BAND_2GHZ, bit 0 * would be set. This attribute is used with * %NL80211_CMD_START_NAN and %NL80211_CMD_CHANGE_NAN_CONFIG, and * it is optional. If no bands are set, it means don't-care and * the device will decide what to use. * @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See * &enum nl80211_nan_func_attributes for description of this nested * attribute. * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute. * See &enum nl80211_nan_match_attributes. * @NL80211_ATTR_FILS_KEK: KEK for FILS (Re)Association Request/Response frame * protection. * @NL80211_ATTR_FILS_NONCES: Nonces (part of AAD) for FILS (Re)Association * Request/Response frame protection. This attribute contains the 16 octet * STA Nonce followed by 16 octets of AP Nonce. * * @NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED: Indicates whether or not multicast * packets should be send out as unicast to all stations (flag attribute). * * @NL80211_ATTR_BSSID: The BSSID of the AP. Note that %NL80211_ATTR_MAC is also * used in various commands/events for specifying the BSSID. * * @NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI: Relative RSSI threshold by which * other BSSs has to be better or slightly worse than the current * connected BSS so that they get reported to user space. * This will give an opportunity to userspace to consider connecting to * other matching BSSs which have better or slightly worse RSSI than * the current connected BSS by using an offloaded operation to avoid * unnecessary wakeups. * * @NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST: When present the RSSI level for BSSs in * the specified band is to be adjusted before doing * %NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI based comparison to figure out * better BSSs. The attribute value is a packed structure * value as specified by &struct nl80211_bss_select_rssi_adjust. * * @NL80211_ATTR_TIMEOUT_REASON: The reason for which an operation timed out. * u32 attribute with an &enum nl80211_timeout_reason value. This is used, * e.g., with %NL80211_CMD_CONNECT event. * * @NL80211_ATTR_FILS_ERP_USERNAME: EAP Re-authentication Protocol (ERP) * username part of NAI used to refer keys rRK and rIK. This is used with * %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_ERP_REALM: EAP Re-authentication Protocol (ERP) realm part * of NAI specifying the domain name of the ER server. This is used with * %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM: Unsigned 16-bit ERP next sequence number * to use in ERP messages. This is used in generating the FILS wrapped data * for FILS authentication and is used with %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_ERP_RRK: ERP re-authentication Root Key (rRK) for the * NAI specified by %NL80211_ATTR_FILS_ERP_USERNAME and * %NL80211_ATTR_FILS_ERP_REALM. This is used for generating rIK and rMSK * from successful FILS authentication and is used with * %NL80211_CMD_CONNECT. * * @NL80211_ATTR_FILS_CACHE_ID: A 2-octet identifier advertized by a FILS AP * identifying the scope of PMKSAs. This is used with * @NL80211_CMD_SET_PMKSA and @NL80211_CMD_DEL_PMKSA. * * @NL80211_ATTR_PMK: attribute for passing PMK key material. Used with * %NL80211_CMD_SET_PMKSA for the PMKSA identified by %NL80211_ATTR_PMKID. * For %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP it is used to provide * PSK for offloading 4-way handshake for WPA/WPA2-PSK networks. For 802.1X * authentication it is used with %NL80211_CMD_SET_PMK. For offloaded FT * support this attribute specifies the PMK-R0 if NL80211_ATTR_PMKR0_NAME * is included as well. * * @NL80211_ATTR_SCHED_SCAN_MULTI: flag attribute which user-space shall use to * indicate that it supports multiple active scheduled scan requests. * @NL80211_ATTR_SCHED_SCAN_MAX_REQS: indicates maximum number of scheduled * scan request that may be active for the device (u32). * * @NL80211_ATTR_WANT_1X_4WAY_HS: flag attribute which user-space can include * in %NL80211_CMD_CONNECT to indicate that for 802.1X authentication it * wants to use the supported offload of the 4-way handshake. * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT. * @NL80211_ATTR_PORT_AUTHORIZED: (reserved) * * @NL80211_ATTR_EXTERNAL_AUTH_ACTION: Identify the requested external * authentication operation (u32 attribute with an * &enum nl80211_external_auth_action value). This is used with the * %NL80211_CMD_EXTERNAL_AUTH request event. * @NL80211_ATTR_EXTERNAL_AUTH_SUPPORT: Flag attribute indicating that the user * space supports external authentication. This attribute shall be used * with %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP request. The driver * may offload authentication processing to user space if this capability * is indicated in the respective requests from the user space. (This flag * attribute deprecated for %NL80211_CMD_START_AP, use * %NL80211_ATTR_AP_SETTINGS_FLAGS) * * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED. * * @NL80211_ATTR_TXQ_STATS: TXQ statistics (nested attribute, see &enum * nl80211_txq_stats) * @NL80211_ATTR_TXQ_LIMIT: Total packet limit for the TXQ queues for this phy. * The smaller of this and the memory limit is enforced. * @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory limit (in bytes) for the * TXQ queues for this phy. The smaller of this and the packet limit is * enforced. * @NL80211_ATTR_TXQ_QUANTUM: TXQ scheduler quantum (bytes). Number of bytes * a flow is assigned on each round of the DRR scheduler. * @NL80211_ATTR_HE_CAPABILITY: HE Capability information element (from * association request when used with NL80211_CMD_NEW_STATION). Can be set * only if %NL80211_STA_FLAG_WME is set. * * @NL80211_ATTR_FTM_RESPONDER: nested attribute which user-space can include * in %NL80211_CMD_START_AP or %NL80211_CMD_SET_BEACON for fine timing * measurement (FTM) responder functionality and containing parameters as * possible, see &enum nl80211_ftm_responder_attr * * @NL80211_ATTR_FTM_RESPONDER_STATS: Nested attribute with FTM responder * statistics, see &enum nl80211_ftm_responder_stats. * * @NL80211_ATTR_TIMEOUT: Timeout for the given operation in milliseconds (u32), * if the attribute is not given no timeout is requested. Note that 0 is an * invalid value. * * @NL80211_ATTR_PEER_MEASUREMENTS: peer measurements request (and result) * data, uses nested attributes specified in * &enum nl80211_peer_measurement_attrs. * This is also used for capability advertisement in the wiphy information, * with the appropriate sub-attributes. * * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime * scheduler. * * @NL80211_ATTR_STA_TX_POWER_SETTING: Transmit power setting type (u8) for * station associated with the AP. See &enum nl80211_tx_power_setting for * possible values. * @NL80211_ATTR_STA_TX_POWER: Transmit power level (s16) in dBm units. This * allows to set Tx power for a station. If this attribute is not included, * the default per-interface tx power setting will be overriding. Driver * should be picking up the lowest tx power, either tx power per-interface * or per-station. * * @NL80211_ATTR_SAE_PASSWORD: attribute for passing SAE password material. It * is used with %NL80211_CMD_CONNECT to provide password for offloading * SAE authentication for WPA3-Personal networks. * * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support. * * @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection * functionality. * * @NL80211_ATTR_WIPHY_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz * channel(s) that are allowed to be used for EDMG transmissions. * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute) * @NL80211_ATTR_WIPHY_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes * the allowed channel bandwidth configurations. (u8 attribute) * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. * * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key * (u16). * * @NL80211_ATTR_HE_BSS_COLOR: nested attribute for BSS Color Settings. * * @NL80211_ATTR_IFTYPE_AKM_SUITES: nested array attribute, with each entry * using attributes from &enum nl80211_iftype_akm_attributes. This * attribute is sent in a response to %NL80211_CMD_GET_WIPHY indicating * supported AKM suites capability per interface. AKMs advertised in * %NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not * advertised for a specific interface type. * * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a * nested attribute with &enum nl80211_tid_config_attr sub-attributes; * on output (in wiphy attributes) it contains only the feature sub- * attributes. * * @NL80211_ATTR_CONTROL_PORT_NO_PREAUTH: disable preauth frame rx on control * port in order to forward/receive them as ordinary data frames. * * @NL80211_ATTR_PMK_LIFETIME: Maximum lifetime for PMKSA in seconds (u32, * dot11RSNAConfigPMKReauthThreshold; 0 is not a valid value). * An optional parameter configured through %NL80211_CMD_SET_PMKSA. * Drivers that trigger roaming need to know the lifetime of the * configured PMKSA for triggering the full vs. PMKSA caching based * authentication. This timeout helps authentication methods like SAE, * where PMK gets updated only by going through a full (new SAE) * authentication instead of getting updated during an association for EAP * authentication. No new full authentication within the PMK expiry shall * result in a disassociation at the end of the lifetime. * * @NL80211_ATTR_PMK_REAUTH_THRESHOLD: Reauthentication threshold time, in * terms of percentage of %NL80211_ATTR_PMK_LIFETIME * (u8, dot11RSNAConfigPMKReauthThreshold, 1..100). This is an optional * parameter configured through %NL80211_CMD_SET_PMKSA. Requests the * driver to trigger a full authentication roam (without PMKSA caching) * after the reauthentication threshold time, but before the PMK lifetime * has expired. * * Authentication methods like SAE need to be able to generate a new PMKSA * entry without having to force a disconnection after the PMK timeout. If * no roaming occurs between the reauth threshold and PMK expiration, * disassociation is still forced. * @NL80211_ATTR_RECEIVE_MULTICAST: multicast flag for the * %NL80211_CMD_REGISTER_FRAME command, see the description there. * @NL80211_ATTR_WIPHY_FREQ_OFFSET: offset of the associated * %NL80211_ATTR_WIPHY_FREQ in positive KHz. Only valid when supplied with * an %NL80211_ATTR_WIPHY_FREQ_OFFSET. * @NL80211_ATTR_CENTER_FREQ1_OFFSET: Center frequency offset in KHz for the * first channel segment specified in %NL80211_ATTR_CENTER_FREQ1. * @NL80211_ATTR_SCAN_FREQ_KHZ: nested attribute with KHz frequencies * * @NL80211_ATTR_HE_6GHZ_CAPABILITY: HE 6 GHz Band Capability element (from * association request when used with NL80211_CMD_NEW_STATION). * * @NL80211_ATTR_FILS_DISCOVERY: Optional parameter to configure FILS * discovery. It is a nested attribute, see * &enum nl80211_fils_discovery_attributes. * * @NL80211_ATTR_UNSOL_BCAST_PROBE_RESP: Optional parameter to configure * unsolicited broadcast probe response. It is a nested attribute, see * &enum nl80211_unsol_bcast_probe_resp_attributes. * * @NL80211_ATTR_S1G_CAPABILITY: S1G Capability information element (from * association request when used with NL80211_CMD_NEW_STATION) * @NL80211_ATTR_S1G_CAPABILITY_MASK: S1G Capability Information element * override mask. Used with NL80211_ATTR_S1G_CAPABILITY in * NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT. * * @NL80211_ATTR_SAE_PWE: Indicates the mechanism(s) allowed for SAE PWE * derivation in WPA3-Personal networks which are using SAE authentication. * This is a u8 attribute that encapsulates one of the values from * &enum nl80211_sae_pwe_mechanism. * * @NL80211_ATTR_SAR_SPEC: SAR power limitation specification when * used with %NL80211_CMD_SET_SAR_SPECS. The message contains fields * of %nl80211_sar_attrs which specifies the sar type and related * sar specs. Sar specs contains array of %nl80211_sar_specs_attrs. * * @NL80211_ATTR_RECONNECT_REQUESTED: flag attribute, used with deauth and * disassoc events to indicate that an immediate reconnect to the AP * is desired. * * @NL80211_ATTR_OBSS_COLOR_BITMAP: bitmap of the u64 BSS colors for the * %NL80211_CMD_OBSS_COLOR_COLLISION event. * * @NL80211_ATTR_COLOR_CHANGE_COUNT: u8 attribute specifying the number of TBTT's * until the color switch event. * @NL80211_ATTR_COLOR_CHANGE_COLOR: u8 attribute specifying the color that we are * switching to * @NL80211_ATTR_COLOR_CHANGE_ELEMS: Nested set of attributes containing the IE * information for the time while performing a color switch. * * @NL80211_ATTR_MBSSID_CONFIG: Nested attribute for multiple BSSID * advertisements (MBSSID) parameters in AP mode. * Kernel uses this attribute to indicate the driver's support for MBSSID * and enhanced multi-BSSID advertisements (EMA AP) to the userspace. * Userspace should use this attribute to configure per interface MBSSID * parameters. * See &enum nl80211_mbssid_config_attributes for details. * * @NL80211_ATTR_MBSSID_ELEMS: Nested parameter to pass multiple BSSID elements. * Mandatory parameter for the transmitting interface to enable MBSSID. * Optional for the non-transmitting interfaces. * * @NL80211_ATTR_RADAR_BACKGROUND: Configure dedicated offchannel chain * available for radar/CAC detection on some hw. This chain can't be used * to transmit or receive frames and it is bounded to a running wdev. * Background radar/CAC detection allows to avoid the CAC downtime * switching on a different channel during CAC detection on the selected * radar channel. * * @NL80211_ATTR_AP_SETTINGS_FLAGS: u32 attribute contains ap settings flags, * enumerated in &enum nl80211_ap_settings_flags. This attribute shall be * used with %NL80211_CMD_START_AP request. * * @NL80211_ATTR_EHT_CAPABILITY: EHT Capability information element (from * association request when used with NL80211_CMD_NEW_STATION). Can be set * only if %NL80211_STA_FLAG_WME is set. * * @NL80211_ATTR_MLO_LINK_ID: A (u8) link ID for use with MLO, to be used with * various commands that need a link ID to operate. * @NL80211_ATTR_MLO_LINKS: A nested array of links, each containing some * per-link information and a link ID. * @NL80211_ATTR_MLD_ADDR: An MLD address, used with various commands such as * authenticate/associate. * * @NL80211_ATTR_MLO_SUPPORT: Flag attribute to indicate user space supports MLO * connection. Used with %NL80211_CMD_CONNECT. If this attribute is not * included in NL80211_CMD_CONNECT drivers must not perform MLO connection. * * @NL80211_ATTR_MAX_NUM_AKM_SUITES: U16 attribute. Indicates maximum number of * AKM suites allowed for %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and * %NL80211_CMD_START_AP in %NL80211_CMD_GET_WIPHY response. If this * attribute is not present userspace shall consider maximum number of AKM * suites allowed as %NL80211_MAX_NR_AKM_SUITES which is the legacy maximum * number prior to the introduction of this attribute. * * @NL80211_ATTR_EML_CAPABILITY: EML Capability information (u16) * @NL80211_ATTR_MLD_CAPA_AND_OPS: MLD Capabilities and Operations (u16) * * @NL80211_ATTR_TX_HW_TIMESTAMP: Hardware timestamp for TX operation in * nanoseconds (u64). This is the device clock timestamp so it will * probably reset when the device is stopped or the firmware is reset. * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the frame TX * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates * the ack TX timestamp. * @NL80211_ATTR_RX_HW_TIMESTAMP: Hardware timestamp for RX operation in * nanoseconds (u64). This is the device clock timestamp so it will * probably reset when the device is stopped or the firmware is reset. * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates * the incoming frame RX timestamp. * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent * (re)associations. * * @NL80211_ATTR_PUNCT_BITMAP: (u32) Preamble puncturing bitmap, lowest * bit corresponds to the lowest 20 MHz channel. Each bit set to 1 * indicates that the sub-channel is punctured. Higher 16 bits are * reserved. * * @NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS: Maximum number of peers that HW * timestamping can be enabled for concurrently (u16), a wiphy attribute. * A value of 0xffff indicates setting for all peers (i.e. not specifying * an address with %NL80211_CMD_SET_HW_TIMESTAMP) is supported. * @NL80211_ATTR_HW_TIMESTAMP_ENABLED: Indicates whether HW timestamping should * be enabled or not (flag attribute). * * @NL80211_ATTR_EMA_RNR_ELEMS: Optional nested attribute for * reduced neighbor report (RNR) elements. This attribute can be used * only when NL80211_MBSSID_CONFIG_ATTR_EMA is enabled. * Userspace is responsible for splitting the RNR into multiple * elements such that each element excludes the non-transmitting * profiles already included in the MBSSID element * (%NL80211_ATTR_MBSSID_ELEMS) at the same index. Each EMA beacon * will be generated by adding MBSSID and RNR elements at the same * index. If the userspace includes more RNR elements than number of * MBSSID elements then these will be added in every EMA beacon. * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ enum nl80211_attrs { /* don't change the order or add anything between, this is ABI! */ NL80211_ATTR_UNSPEC, NL80211_ATTR_WIPHY, NL80211_ATTR_WIPHY_NAME, NL80211_ATTR_IFINDEX, NL80211_ATTR_IFNAME, NL80211_ATTR_IFTYPE, NL80211_ATTR_MAC, NL80211_ATTR_KEY_DATA, NL80211_ATTR_KEY_IDX, NL80211_ATTR_KEY_CIPHER, NL80211_ATTR_KEY_SEQ, NL80211_ATTR_KEY_DEFAULT, NL80211_ATTR_BEACON_INTERVAL, NL80211_ATTR_DTIM_PERIOD, NL80211_ATTR_BEACON_HEAD, NL80211_ATTR_BEACON_TAIL, NL80211_ATTR_STA_AID, NL80211_ATTR_STA_FLAGS, NL80211_ATTR_STA_LISTEN_INTERVAL, NL80211_ATTR_STA_SUPPORTED_RATES, NL80211_ATTR_STA_VLAN, NL80211_ATTR_STA_INFO, NL80211_ATTR_WIPHY_BANDS, NL80211_ATTR_MNTR_FLAGS, NL80211_ATTR_MESH_ID, NL80211_ATTR_STA_PLINK_ACTION, NL80211_ATTR_MPATH_NEXT_HOP, NL80211_ATTR_MPATH_INFO, NL80211_ATTR_BSS_CTS_PROT, NL80211_ATTR_BSS_SHORT_PREAMBLE, NL80211_ATTR_BSS_SHORT_SLOT_TIME, NL80211_ATTR_HT_CAPABILITY, NL80211_ATTR_SUPPORTED_IFTYPES, NL80211_ATTR_REG_ALPHA2, NL80211_ATTR_REG_RULES, NL80211_ATTR_MESH_CONFIG, NL80211_ATTR_BSS_BASIC_RATES, NL80211_ATTR_WIPHY_TXQ_PARAMS, NL80211_ATTR_WIPHY_FREQ, NL80211_ATTR_WIPHY_CHANNEL_TYPE, NL80211_ATTR_KEY_DEFAULT_MGMT, NL80211_ATTR_MGMT_SUBTYPE, NL80211_ATTR_IE, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, NL80211_ATTR_SCAN_FREQUENCIES, NL80211_ATTR_SCAN_SSIDS, NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */ NL80211_ATTR_BSS, NL80211_ATTR_REG_INITIATOR, NL80211_ATTR_REG_TYPE, NL80211_ATTR_SUPPORTED_COMMANDS, NL80211_ATTR_FRAME, NL80211_ATTR_SSID, NL80211_ATTR_AUTH_TYPE, NL80211_ATTR_REASON_CODE, NL80211_ATTR_KEY_TYPE, NL80211_ATTR_MAX_SCAN_IE_LEN, NL80211_ATTR_CIPHER_SUITES, NL80211_ATTR_FREQ_BEFORE, NL80211_ATTR_FREQ_AFTER, NL80211_ATTR_FREQ_FIXED, NL80211_ATTR_WIPHY_RETRY_SHORT, NL80211_ATTR_WIPHY_RETRY_LONG, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, NL80211_ATTR_WIPHY_RTS_THRESHOLD, NL80211_ATTR_TIMED_OUT, NL80211_ATTR_USE_MFP, NL80211_ATTR_STA_FLAGS2, NL80211_ATTR_CONTROL_PORT, NL80211_ATTR_TESTDATA, NL80211_ATTR_PRIVACY, NL80211_ATTR_DISCONNECTED_BY_AP, NL80211_ATTR_STATUS_CODE, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, NL80211_ATTR_CIPHER_SUITE_GROUP, NL80211_ATTR_WPA_VERSIONS, NL80211_ATTR_AKM_SUITES, NL80211_ATTR_REQ_IE, NL80211_ATTR_RESP_IE, NL80211_ATTR_PREV_BSSID, NL80211_ATTR_KEY, NL80211_ATTR_KEYS, NL80211_ATTR_PID, NL80211_ATTR_4ADDR, NL80211_ATTR_SURVEY_INFO, NL80211_ATTR_PMKID, NL80211_ATTR_MAX_NUM_PMKIDS, NL80211_ATTR_DURATION, NL80211_ATTR_COOKIE, NL80211_ATTR_WIPHY_COVERAGE_CLASS, NL80211_ATTR_TX_RATES, NL80211_ATTR_FRAME_MATCH, NL80211_ATTR_ACK, NL80211_ATTR_PS_STATE, NL80211_ATTR_CQM, NL80211_ATTR_LOCAL_STATE_CHANGE, NL80211_ATTR_AP_ISOLATE, NL80211_ATTR_WIPHY_TX_POWER_SETTING, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, NL80211_ATTR_TX_FRAME_TYPES, NL80211_ATTR_RX_FRAME_TYPES, NL80211_ATTR_FRAME_TYPE, NL80211_ATTR_CONTROL_PORT_ETHERTYPE, NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, NL80211_ATTR_SUPPORT_IBSS_RSN, NL80211_ATTR_WIPHY_ANTENNA_TX, NL80211_ATTR_WIPHY_ANTENNA_RX, NL80211_ATTR_MCAST_RATE, NL80211_ATTR_OFFCHANNEL_TX_OK, NL80211_ATTR_BSS_HT_OPMODE, NL80211_ATTR_KEY_DEFAULT_TYPES, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, NL80211_ATTR_MESH_SETUP, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, NL80211_ATTR_SUPPORT_MESH_AUTH, NL80211_ATTR_STA_PLINK_STATE, NL80211_ATTR_WOWLAN_TRIGGERS, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, NL80211_ATTR_SCHED_SCAN_INTERVAL, NL80211_ATTR_INTERFACE_COMBINATIONS, NL80211_ATTR_SOFTWARE_IFTYPES, NL80211_ATTR_REKEY_DATA, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, NL80211_ATTR_SCAN_SUPP_RATES, NL80211_ATTR_HIDDEN_SSID, NL80211_ATTR_IE_PROBE_RESP, NL80211_ATTR_IE_ASSOC_RESP, NL80211_ATTR_STA_WME, NL80211_ATTR_SUPPORT_AP_UAPSD, NL80211_ATTR_ROAM_SUPPORT, NL80211_ATTR_SCHED_SCAN_MATCH, NL80211_ATTR_MAX_MATCH_SETS, NL80211_ATTR_PMKSA_CANDIDATE, NL80211_ATTR_TX_NO_CCK_RATE, NL80211_ATTR_TDLS_ACTION, NL80211_ATTR_TDLS_DIALOG_TOKEN, NL80211_ATTR_TDLS_OPERATION, NL80211_ATTR_TDLS_SUPPORT, NL80211_ATTR_TDLS_EXTERNAL_SETUP, NL80211_ATTR_DEVICE_AP_SME, NL80211_ATTR_DONT_WAIT_FOR_ACK, NL80211_ATTR_FEATURE_FLAGS, NL80211_ATTR_PROBE_RESP_OFFLOAD, NL80211_ATTR_PROBE_RESP, NL80211_ATTR_DFS_REGION, NL80211_ATTR_DISABLE_HT, NL80211_ATTR_HT_CAPABILITY_MASK, NL80211_ATTR_NOACK_MAP, NL80211_ATTR_INACTIVITY_TIMEOUT, NL80211_ATTR_RX_SIGNAL_DBM, NL80211_ATTR_BG_SCAN_PERIOD, NL80211_ATTR_WDEV, NL80211_ATTR_USER_REG_HINT_TYPE, NL80211_ATTR_CONN_FAILED_REASON, NL80211_ATTR_AUTH_DATA, NL80211_ATTR_VHT_CAPABILITY, NL80211_ATTR_SCAN_FLAGS, NL80211_ATTR_CHANNEL_WIDTH, NL80211_ATTR_CENTER_FREQ1, NL80211_ATTR_CENTER_FREQ2, NL80211_ATTR_P2P_CTWINDOW, NL80211_ATTR_P2P_OPPPS, NL80211_ATTR_LOCAL_MESH_POWER_MODE, NL80211_ATTR_ACL_POLICY, NL80211_ATTR_MAC_ADDRS, NL80211_ATTR_MAC_ACL_MAX, NL80211_ATTR_RADAR_EVENT, NL80211_ATTR_EXT_CAPA, NL80211_ATTR_EXT_CAPA_MASK, NL80211_ATTR_STA_CAPABILITY, NL80211_ATTR_STA_EXT_CAPABILITY, NL80211_ATTR_PROTOCOL_FEATURES, NL80211_ATTR_SPLIT_WIPHY_DUMP, NL80211_ATTR_DISABLE_VHT, NL80211_ATTR_VHT_CAPABILITY_MASK, NL80211_ATTR_MDID, NL80211_ATTR_IE_RIC, NL80211_ATTR_CRIT_PROT_ID, NL80211_ATTR_MAX_CRIT_PROT_DURATION, NL80211_ATTR_PEER_AID, NL80211_ATTR_COALESCE_RULE, NL80211_ATTR_CH_SWITCH_COUNT, NL80211_ATTR_CH_SWITCH_BLOCK_TX, NL80211_ATTR_CSA_IES, NL80211_ATTR_CNTDWN_OFFS_BEACON, NL80211_ATTR_CNTDWN_OFFS_PRESP, NL80211_ATTR_RXMGMT_FLAGS, NL80211_ATTR_STA_SUPPORTED_CHANNELS, NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES, NL80211_ATTR_HANDLE_DFS, NL80211_ATTR_SUPPORT_5_MHZ, NL80211_ATTR_SUPPORT_10_MHZ, NL80211_ATTR_OPMODE_NOTIF, NL80211_ATTR_VENDOR_ID, NL80211_ATTR_VENDOR_SUBCMD, NL80211_ATTR_VENDOR_DATA, NL80211_ATTR_VENDOR_EVENTS, NL80211_ATTR_QOS_MAP, NL80211_ATTR_MAC_HINT, NL80211_ATTR_WIPHY_FREQ_HINT, NL80211_ATTR_MAX_AP_ASSOC_STA, NL80211_ATTR_TDLS_PEER_CAPABILITY, NL80211_ATTR_SOCKET_OWNER, NL80211_ATTR_CSA_C_OFFSETS_TX, NL80211_ATTR_MAX_CSA_COUNTERS, NL80211_ATTR_TDLS_INITIATOR, NL80211_ATTR_USE_RRM, NL80211_ATTR_WIPHY_DYN_ACK, NL80211_ATTR_TSID, NL80211_ATTR_USER_PRIO, NL80211_ATTR_ADMITTED_TIME, NL80211_ATTR_SMPS_MODE, NL80211_ATTR_OPER_CLASS, NL80211_ATTR_MAC_MASK, NL80211_ATTR_WIPHY_SELF_MANAGED_REG, NL80211_ATTR_EXT_FEATURES, NL80211_ATTR_SURVEY_RADIO_STATS, NL80211_ATTR_NETNS_FD, NL80211_ATTR_SCHED_SCAN_DELAY, NL80211_ATTR_REG_INDOOR, NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS, NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL, NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, NL80211_ATTR_SCHED_SCAN_PLANS, NL80211_ATTR_PBSS, NL80211_ATTR_BSS_SELECT, NL80211_ATTR_STA_SUPPORT_P2P_PS, NL80211_ATTR_PAD, NL80211_ATTR_IFTYPE_EXT_CAPA, NL80211_ATTR_MU_MIMO_GROUP_DATA, NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR, NL80211_ATTR_SCAN_START_TIME_TSF, NL80211_ATTR_SCAN_START_TIME_TSF_BSSID, NL80211_ATTR_MEASUREMENT_DURATION, NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY, NL80211_ATTR_MESH_PEER_AID, NL80211_ATTR_NAN_MASTER_PREF, NL80211_ATTR_BANDS, NL80211_ATTR_NAN_FUNC, NL80211_ATTR_NAN_MATCH, NL80211_ATTR_FILS_KEK, NL80211_ATTR_FILS_NONCES, NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED, NL80211_ATTR_BSSID, NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI, NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST, NL80211_ATTR_TIMEOUT_REASON, NL80211_ATTR_FILS_ERP_USERNAME, NL80211_ATTR_FILS_ERP_REALM, NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM, NL80211_ATTR_FILS_ERP_RRK, NL80211_ATTR_FILS_CACHE_ID, NL80211_ATTR_PMK, NL80211_ATTR_SCHED_SCAN_MULTI, NL80211_ATTR_SCHED_SCAN_MAX_REQS, NL80211_ATTR_WANT_1X_4WAY_HS, NL80211_ATTR_PMKR0_NAME, NL80211_ATTR_PORT_AUTHORIZED, NL80211_ATTR_EXTERNAL_AUTH_ACTION, NL80211_ATTR_EXTERNAL_AUTH_SUPPORT, NL80211_ATTR_NSS, NL80211_ATTR_ACK_SIGNAL, NL80211_ATTR_CONTROL_PORT_OVER_NL80211, NL80211_ATTR_TXQ_STATS, NL80211_ATTR_TXQ_LIMIT, NL80211_ATTR_TXQ_MEMORY_LIMIT, NL80211_ATTR_TXQ_QUANTUM, NL80211_ATTR_HE_CAPABILITY, NL80211_ATTR_FTM_RESPONDER, NL80211_ATTR_FTM_RESPONDER_STATS, NL80211_ATTR_TIMEOUT, NL80211_ATTR_PEER_MEASUREMENTS, NL80211_ATTR_AIRTIME_WEIGHT, NL80211_ATTR_STA_TX_POWER_SETTING, NL80211_ATTR_STA_TX_POWER, NL80211_ATTR_SAE_PASSWORD, NL80211_ATTR_TWT_RESPONDER, NL80211_ATTR_HE_OBSS_PD, NL80211_ATTR_WIPHY_EDMG_CHANNELS, NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, NL80211_ATTR_VLAN_ID, NL80211_ATTR_HE_BSS_COLOR, NL80211_ATTR_IFTYPE_AKM_SUITES, NL80211_ATTR_TID_CONFIG, NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, NL80211_ATTR_PMK_LIFETIME, NL80211_ATTR_PMK_REAUTH_THRESHOLD, NL80211_ATTR_RECEIVE_MULTICAST, NL80211_ATTR_WIPHY_FREQ_OFFSET, NL80211_ATTR_CENTER_FREQ1_OFFSET, NL80211_ATTR_SCAN_FREQ_KHZ, NL80211_ATTR_HE_6GHZ_CAPABILITY, NL80211_ATTR_FILS_DISCOVERY, NL80211_ATTR_UNSOL_BCAST_PROBE_RESP, NL80211_ATTR_S1G_CAPABILITY, NL80211_ATTR_S1G_CAPABILITY_MASK, NL80211_ATTR_SAE_PWE, NL80211_ATTR_RECONNECT_REQUESTED, NL80211_ATTR_SAR_SPEC, NL80211_ATTR_DISABLE_HE, NL80211_ATTR_OBSS_COLOR_BITMAP, NL80211_ATTR_COLOR_CHANGE_COUNT, NL80211_ATTR_COLOR_CHANGE_COLOR, NL80211_ATTR_COLOR_CHANGE_ELEMS, NL80211_ATTR_MBSSID_CONFIG, NL80211_ATTR_MBSSID_ELEMS, NL80211_ATTR_RADAR_BACKGROUND, NL80211_ATTR_AP_SETTINGS_FLAGS, NL80211_ATTR_EHT_CAPABILITY, NL80211_ATTR_DISABLE_EHT, NL80211_ATTR_MLO_LINKS, NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MLD_ADDR, NL80211_ATTR_MLO_SUPPORT, NL80211_ATTR_MAX_NUM_AKM_SUITES, NL80211_ATTR_EML_CAPABILITY, NL80211_ATTR_MLD_CAPA_AND_OPS, NL80211_ATTR_TX_HW_TIMESTAMP, NL80211_ATTR_RX_HW_TIMESTAMP, NL80211_ATTR_TD_BITMAP, NL80211_ATTR_PUNCT_BITMAP, NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS, NL80211_ATTR_HW_TIMESTAMP_ENABLED, NL80211_ATTR_EMA_RNR_ELEMS, /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST, NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 }; /* source-level API compatibility */ #define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION #define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG #define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER #define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA #define NL80211_ATTR_CSA_C_OFF_BEACON NL80211_ATTR_CNTDWN_OFFS_BEACON #define NL80211_ATTR_CSA_C_OFF_PRESP NL80211_ATTR_CNTDWN_OFFS_PRESP /* * Allow user space programs to use #ifdef on new attributes by defining them * here */ #define NL80211_CMD_CONNECT NL80211_CMD_CONNECT #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY #define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES #define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS #define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ #define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE #define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE #define NL80211_ATTR_IE NL80211_ATTR_IE #define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR #define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE #define NL80211_ATTR_FRAME NL80211_ATTR_FRAME #define NL80211_ATTR_SSID NL80211_ATTR_SSID #define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE #define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE #define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE #define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP #define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS #define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES #define NL80211_ATTR_KEY NL80211_ATTR_KEY #define NL80211_ATTR_KEYS NL80211_ATTR_KEYS #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS #define NL80211_WIPHY_NAME_MAXLEN 64 #define NL80211_MAX_SUPP_RATES 32 #define NL80211_MAX_SUPP_HT_RATES 77 #define NL80211_MAX_SUPP_REG_RULES 128 #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 #define NL80211_HT_CAPABILITY_LEN 26 #define NL80211_VHT_CAPABILITY_LEN 12 #define NL80211_HE_MIN_CAPABILITY_LEN 16 #define NL80211_HE_MAX_CAPABILITY_LEN 54 #define NL80211_MAX_NR_CIPHER_SUITES 5 /* * NL80211_MAX_NR_AKM_SUITES is obsolete when %NL80211_ATTR_MAX_NUM_AKM_SUITES * present in %NL80211_CMD_GET_WIPHY response. */ #define NL80211_MAX_NR_AKM_SUITES 2 #define NL80211_EHT_MIN_CAPABILITY_LEN 13 #define NL80211_EHT_MAX_CAPABILITY_LEN 51 #define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10 /* default RSSI threshold for scan results if none specified. */ #define NL80211_SCAN_RSSI_THOLD_OFF -300 #define NL80211_CQM_TXE_MAX_INTVL 1800 /** * enum nl80211_iftype - (virtual) interface types * * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides * @NL80211_IFTYPE_ADHOC: independent BSS member * @NL80211_IFTYPE_STATION: managed BSS member * @NL80211_IFTYPE_AP: access point * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces * are a bit special in that they must always be tied to a pre-existing * AP type interface. * @NL80211_IFTYPE_WDS: wireless distribution interface * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames * @NL80211_IFTYPE_MESH_POINT: mesh point * @NL80211_IFTYPE_P2P_CLIENT: P2P client * @NL80211_IFTYPE_P2P_GO: P2P group owner * @NL80211_IFTYPE_P2P_DEVICE: P2P device interface type, this is not a netdev * and therefore can't be created in the normal ways, use the * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE * commands to create and destroy one * @NL80211_IFTYPE_OCB: Outside Context of a BSS * This mode corresponds to the MIB variable dot11OCBActivated=true * @NL80211_IFTYPE_NAN: NAN device interface type (not a netdev) * @NL80211_IFTYPE_MAX: highest interface type number currently defined * @NUM_NL80211_IFTYPES: number of defined interface types * * These values are used with the %NL80211_ATTR_IFTYPE * to set the type of an interface. * */ enum nl80211_iftype { NL80211_IFTYPE_UNSPECIFIED, NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP, NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_WDS, NL80211_IFTYPE_MONITOR, NL80211_IFTYPE_MESH_POINT, NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO, NL80211_IFTYPE_P2P_DEVICE, NL80211_IFTYPE_OCB, NL80211_IFTYPE_NAN, /* keep last */ NUM_NL80211_IFTYPES, NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 }; /** * enum nl80211_sta_flags - station flags * * Station flags. When a station is added to an AP interface, it is * assumed to be already associated (and hence authenticated.) * * @__NL80211_STA_FLAG_INVALID: attribute number 0 is reserved * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X) * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames * with short barker preamble * @NL80211_STA_FLAG_WME: station is WME/QoS capable * @NL80211_STA_FLAG_MFP: station uses management frame protection * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should * only be used in managed mode (even in the flags mask). Note that the * flag can't be changed, it is only valid while adding a station, and * attempts to change it will silently be ignored (rather than rejected * as errors.) * @NL80211_STA_FLAG_ASSOCIATED: station is associated; used with drivers * that support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a * previously added station into associated state * @NL80211_STA_FLAG_MAX: highest station flag number currently defined * @__NL80211_STA_FLAG_AFTER_LAST: internal use */ enum nl80211_sta_flags { __NL80211_STA_FLAG_INVALID, NL80211_STA_FLAG_AUTHORIZED, NL80211_STA_FLAG_SHORT_PREAMBLE, NL80211_STA_FLAG_WME, NL80211_STA_FLAG_MFP, NL80211_STA_FLAG_AUTHENTICATED, NL80211_STA_FLAG_TDLS_PEER, NL80211_STA_FLAG_ASSOCIATED, /* keep last */ __NL80211_STA_FLAG_AFTER_LAST, NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 }; /** * enum nl80211_sta_p2p_ps_status - station support of P2P PS * * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism * @NUM_NL80211_P2P_PS_STATUS: number of values */ enum nl80211_sta_p2p_ps_status { NL80211_P2P_PS_UNSUPPORTED = 0, NL80211_P2P_PS_SUPPORTED, NUM_NL80211_P2P_PS_STATUS, }; #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER /** * struct nl80211_sta_flag_update - station flags mask/set * @mask: mask of station flags to set * @set: which values to set them to * * Both mask and set contain bits as per &enum nl80211_sta_flags. */ struct nl80211_sta_flag_update { __u32 mask; __u32 set; } __attribute__((packed)); /** * enum nl80211_he_gi - HE guard interval * @NL80211_RATE_INFO_HE_GI_0_8: 0.8 usec * @NL80211_RATE_INFO_HE_GI_1_6: 1.6 usec * @NL80211_RATE_INFO_HE_GI_3_2: 3.2 usec */ enum nl80211_he_gi { NL80211_RATE_INFO_HE_GI_0_8, NL80211_RATE_INFO_HE_GI_1_6, NL80211_RATE_INFO_HE_GI_3_2, }; /** * enum nl80211_he_ltf - HE long training field * @NL80211_RATE_INFO_HE_1xLTF: 3.2 usec * @NL80211_RATE_INFO_HE_2xLTF: 6.4 usec * @NL80211_RATE_INFO_HE_4xLTF: 12.8 usec */ enum nl80211_he_ltf { NL80211_RATE_INFO_HE_1XLTF, NL80211_RATE_INFO_HE_2XLTF, NL80211_RATE_INFO_HE_4XLTF, }; /** * enum nl80211_he_ru_alloc - HE RU allocation values * @NL80211_RATE_INFO_HE_RU_ALLOC_26: 26-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_52: 52-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_106: 106-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_242: 242-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_484: 484-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_996: 996-tone RU allocation * @NL80211_RATE_INFO_HE_RU_ALLOC_2x996: 2x996-tone RU allocation */ enum nl80211_he_ru_alloc { NL80211_RATE_INFO_HE_RU_ALLOC_26, NL80211_RATE_INFO_HE_RU_ALLOC_52, NL80211_RATE_INFO_HE_RU_ALLOC_106, NL80211_RATE_INFO_HE_RU_ALLOC_242, NL80211_RATE_INFO_HE_RU_ALLOC_484, NL80211_RATE_INFO_HE_RU_ALLOC_996, NL80211_RATE_INFO_HE_RU_ALLOC_2x996, }; /** * enum nl80211_eht_gi - EHT guard interval * @NL80211_RATE_INFO_EHT_GI_0_8: 0.8 usec * @NL80211_RATE_INFO_EHT_GI_1_6: 1.6 usec * @NL80211_RATE_INFO_EHT_GI_3_2: 3.2 usec */ enum nl80211_eht_gi { NL80211_RATE_INFO_EHT_GI_0_8, NL80211_RATE_INFO_EHT_GI_1_6, NL80211_RATE_INFO_EHT_GI_3_2, }; /** * enum nl80211_eht_ru_alloc - EHT RU allocation values * @NL80211_RATE_INFO_EHT_RU_ALLOC_26: 26-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_52: 52-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_52P26: 52+26-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_106: 106-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_106P26: 106+26 tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_242: 242-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_484: 484-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_484P242: 484+242 tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_996: 996-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_996P484: 996+484 tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_996P484P242: 996+484+242 tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_2x996: 2x996-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_2x996P484: 2x996+484 tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_3x996: 3x996-tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_3x996P484: 3x996+484 tone RU allocation * @NL80211_RATE_INFO_EHT_RU_ALLOC_4x996: 4x996-tone RU allocation */ enum nl80211_eht_ru_alloc { NL80211_RATE_INFO_EHT_RU_ALLOC_26, NL80211_RATE_INFO_EHT_RU_ALLOC_52, NL80211_RATE_INFO_EHT_RU_ALLOC_52P26, NL80211_RATE_INFO_EHT_RU_ALLOC_106, NL80211_RATE_INFO_EHT_RU_ALLOC_106P26, NL80211_RATE_INFO_EHT_RU_ALLOC_242, NL80211_RATE_INFO_EHT_RU_ALLOC_484, NL80211_RATE_INFO_EHT_RU_ALLOC_484P242, NL80211_RATE_INFO_EHT_RU_ALLOC_996, NL80211_RATE_INFO_EHT_RU_ALLOC_996P484, NL80211_RATE_INFO_EHT_RU_ALLOC_996P484P242, NL80211_RATE_INFO_EHT_RU_ALLOC_2x996, NL80211_RATE_INFO_EHT_RU_ALLOC_2x996P484, NL80211_RATE_INFO_EHT_RU_ALLOC_3x996, NL80211_RATE_INFO_EHT_RU_ALLOC_3x996P484, NL80211_RATE_INFO_EHT_RU_ALLOC_4x996, }; /** * enum nl80211_rate_info - bitrate information * * These attribute types are used with %NL80211_STA_INFO_TXRATE * when getting information about the bitrate of a station. * There are 2 attributes for bitrate, a legacy one that represents * a 16-bit value, and new one that represents a 32-bit value. * If the rate value fits into 16 bit, both attributes are reported * with the same value. If the rate is too high to fit into 16 bits * (>6.5535Gbps) only 32-bit attribute is included. * User space tools encouraged to use the 32-bit attribute and fall * back to the 16-bit one for compatibility with older kernels. * * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s) * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8) * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 MHz dualchannel bitrate * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval * @NL80211_RATE_INFO_BITRATE32: total bitrate (u32, 100kbit/s) * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined * @NL80211_RATE_INFO_VHT_MCS: MCS index for VHT (u8) * @NL80211_RATE_INFO_VHT_NSS: number of streams in VHT (u8) * @NL80211_RATE_INFO_80_MHZ_WIDTH: 80 MHz VHT rate * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: unused - 80+80 is treated the * same as 160 for purposes of the bitrates * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate * @NL80211_RATE_INFO_10_MHZ_WIDTH: 10 MHz width - note that this is * a legacy rate and will be reported as the actual bitrate, i.e. * half the base (20 MHz) rate * @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is * a legacy rate and will be reported as the actual bitrate, i.e. * a quarter of the base (20 MHz) rate * @NL80211_RATE_INFO_HE_MCS: HE MCS index (u8, 0-11) * @NL80211_RATE_INFO_HE_NSS: HE NSS value (u8, 1-8) * @NL80211_RATE_INFO_HE_GI: HE guard interval identifier * (u8, see &enum nl80211_he_gi) * @NL80211_RATE_INFO_HE_DCM: HE DCM value (u8, 0/1) * @NL80211_RATE_INFO_RU_ALLOC: HE RU allocation, if not present then * non-OFDMA was used (u8, see &enum nl80211_he_ru_alloc) * @NL80211_RATE_INFO_320_MHZ_WIDTH: 320 MHz bitrate * @NL80211_RATE_INFO_EHT_MCS: EHT MCS index (u8, 0-15) * @NL80211_RATE_INFO_EHT_NSS: EHT NSS value (u8, 1-8) * @NL80211_RATE_INFO_EHT_GI: EHT guard interval identifier * (u8, see &enum nl80211_eht_gi) * @NL80211_RATE_INFO_EHT_RU_ALLOC: EHT RU allocation, if not present then * non-OFDMA was used (u8, see &enum nl80211_eht_ru_alloc) * @__NL80211_RATE_INFO_AFTER_LAST: internal use */ enum nl80211_rate_info { __NL80211_RATE_INFO_INVALID, NL80211_RATE_INFO_BITRATE, NL80211_RATE_INFO_MCS, NL80211_RATE_INFO_40_MHZ_WIDTH, NL80211_RATE_INFO_SHORT_GI, NL80211_RATE_INFO_BITRATE32, NL80211_RATE_INFO_VHT_MCS, NL80211_RATE_INFO_VHT_NSS, NL80211_RATE_INFO_80_MHZ_WIDTH, NL80211_RATE_INFO_80P80_MHZ_WIDTH, NL80211_RATE_INFO_160_MHZ_WIDTH, NL80211_RATE_INFO_10_MHZ_WIDTH, NL80211_RATE_INFO_5_MHZ_WIDTH, NL80211_RATE_INFO_HE_MCS, NL80211_RATE_INFO_HE_NSS, NL80211_RATE_INFO_HE_GI, NL80211_RATE_INFO_HE_DCM, NL80211_RATE_INFO_HE_RU_ALLOC, NL80211_RATE_INFO_320_MHZ_WIDTH, NL80211_RATE_INFO_EHT_MCS, NL80211_RATE_INFO_EHT_NSS, NL80211_RATE_INFO_EHT_GI, NL80211_RATE_INFO_EHT_RU_ALLOC, /* keep last */ __NL80211_RATE_INFO_AFTER_LAST, NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1 }; /** * enum nl80211_sta_bss_param - BSS information collected by STA * * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM * when getting information about the bitrate of a station. * * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag) * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE: whether short preamble is enabled * (flag) * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME: whether short slot time is enabled * (flag) * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8) * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16) * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use */ enum nl80211_sta_bss_param { __NL80211_STA_BSS_PARAM_INVALID, NL80211_STA_BSS_PARAM_CTS_PROT, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE, NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME, NL80211_STA_BSS_PARAM_DTIM_PERIOD, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, /* keep last */ __NL80211_STA_BSS_PARAM_AFTER_LAST, NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1 }; /** * enum nl80211_sta_info - station information * * These attribute types are used with %NL80211_ATTR_STA_INFO * when getting information about a station. * * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) * @NL80211_STA_INFO_RX_BYTES: total received bytes (MPDU length) * (u32, from this station) * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (MPDU length) * (u32, to this station) * @NL80211_STA_INFO_RX_BYTES64: total received bytes (MPDU length) * (u64, from this station) * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (MPDU length) * (u64, to this station) * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute * containing info as possible, see &enum nl80211_rate_info * @NL80211_STA_INFO_RX_PACKETS: total received packet (MSDUs and MMPDUs) * (u32, from this station) * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (MSDUs and MMPDUs) * (u32, to this station) * @NL80211_STA_INFO_TX_RETRIES: total retries (MPDUs) (u32, to this station) * @NL80211_STA_INFO_TX_FAILED: total failed packets (MPDUs) * (u32, to this station) * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) * @NL80211_STA_INFO_LLID: the station's mesh LLID * @NL80211_STA_INFO_PLID: the station's mesh PLID * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station * (see %enum nl80211_plink_state) * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested * attribute, like NL80211_STA_INFO_TX_BITRATE. * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute * containing info as possible, see &enum nl80211_sta_bss_param * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64) * @NL80211_STA_INFO_LOCAL_PM: local mesh STA link-specific power mode * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards * non-peer STA * @NL80211_STA_INFO_CHAIN_SIGNAL: per-chain signal strength of last PPDU * Contains a nested array of signal strength attributes (u8, dBm) * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average * Same format as NL80211_STA_INFO_CHAIN_SIGNAL. * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the * 802.11 header (u32, kbps) * @NL80211_STA_INFO_RX_DROP_MISC: RX packets dropped for unspecified reasons * (u64) * @NL80211_STA_INFO_BEACON_RX: number of beacons received from this peer (u64) * @NL80211_STA_INFO_BEACON_SIGNAL_AVG: signal strength average * for beacons only (u8, dBm) * @NL80211_STA_INFO_TID_STATS: per-TID statistics (see &enum nl80211_tid_stats) * This is a nested attribute where each the inner attribute number is the * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames; * each one of those is again nested with &enum nl80211_tid_stats * attributes carrying the actual values. * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames * received from the station (u64, usec) * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm) * @NL80211_STA_INFO_RX_MPDUS: total number of received packets (MPDUs) * (u32, from this station) * @NL80211_STA_INFO_FCS_ERROR_COUNT: total number of packets (MPDUs) received * with an FCS error (u32, from this station). This count may not include * some packets with an FCS error due to TA corruption. Hence this counter * might not be fully accurate. * @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a * mesh gate (u8, 0 or 1) * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames * sent to the station (u64, usec) * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16) * @NL80211_STA_INFO_AIRTIME_LINK_METRIC: airtime link metric for mesh station * @NL80211_STA_INFO_ASSOC_AT_BOOTTIME: Timestamp (CLOCK_BOOTTIME, nanoseconds) * of STA's association * @NL80211_STA_INFO_CONNECTED_TO_AS: set to true if STA has a path to a * authentication server (u8, 0 or 1) * @__NL80211_STA_INFO_AFTER_LAST: internal * @NL80211_STA_INFO_MAX: highest possible station info attribute */ enum nl80211_sta_info { __NL80211_STA_INFO_INVALID, NL80211_STA_INFO_INACTIVE_TIME, NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, NL80211_STA_INFO_LLID, NL80211_STA_INFO_PLID, NL80211_STA_INFO_PLINK_STATE, NL80211_STA_INFO_SIGNAL, NL80211_STA_INFO_TX_BITRATE, NL80211_STA_INFO_RX_PACKETS, NL80211_STA_INFO_TX_PACKETS, NL80211_STA_INFO_TX_RETRIES, NL80211_STA_INFO_TX_FAILED, NL80211_STA_INFO_SIGNAL_AVG, NL80211_STA_INFO_RX_BITRATE, NL80211_STA_INFO_BSS_PARAM, NL80211_STA_INFO_CONNECTED_TIME, NL80211_STA_INFO_STA_FLAGS, NL80211_STA_INFO_BEACON_LOSS, NL80211_STA_INFO_T_OFFSET, NL80211_STA_INFO_LOCAL_PM, NL80211_STA_INFO_PEER_PM, NL80211_STA_INFO_NONPEER_PM, NL80211_STA_INFO_RX_BYTES64, NL80211_STA_INFO_TX_BYTES64, NL80211_STA_INFO_CHAIN_SIGNAL, NL80211_STA_INFO_CHAIN_SIGNAL_AVG, NL80211_STA_INFO_EXPECTED_THROUGHPUT, NL80211_STA_INFO_RX_DROP_MISC, NL80211_STA_INFO_BEACON_RX, NL80211_STA_INFO_BEACON_SIGNAL_AVG, NL80211_STA_INFO_TID_STATS, NL80211_STA_INFO_RX_DURATION, NL80211_STA_INFO_PAD, NL80211_STA_INFO_ACK_SIGNAL, NL80211_STA_INFO_ACK_SIGNAL_AVG, NL80211_STA_INFO_RX_MPDUS, NL80211_STA_INFO_FCS_ERROR_COUNT, NL80211_STA_INFO_CONNECTED_TO_GATE, NL80211_STA_INFO_TX_DURATION, NL80211_STA_INFO_AIRTIME_WEIGHT, NL80211_STA_INFO_AIRTIME_LINK_METRIC, NL80211_STA_INFO_ASSOC_AT_BOOTTIME, NL80211_STA_INFO_CONNECTED_TO_AS, /* keep last */ __NL80211_STA_INFO_AFTER_LAST, NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 }; /* we renamed this - stay compatible */ #define NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG NL80211_STA_INFO_ACK_SIGNAL_AVG /** * enum nl80211_tid_stats - per TID statistics attributes * @__NL80211_TID_STATS_INVALID: attribute number 0 is reserved * @NL80211_TID_STATS_RX_MSDU: number of MSDUs received (u64) * @NL80211_TID_STATS_TX_MSDU: number of MSDUs transmitted (or * attempted to transmit; u64) * @NL80211_TID_STATS_TX_MSDU_RETRIES: number of retries for * transmitted MSDUs (not counting the first attempt; u64) * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted * MSDUs (u64) * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment * @NL80211_TID_STATS_TXQ_STATS: TXQ stats (nested attribute) * @NUM_NL80211_TID_STATS: number of attributes here * @NL80211_TID_STATS_MAX: highest numbered attribute here */ enum nl80211_tid_stats { __NL80211_TID_STATS_INVALID, NL80211_TID_STATS_RX_MSDU, NL80211_TID_STATS_TX_MSDU, NL80211_TID_STATS_TX_MSDU_RETRIES, NL80211_TID_STATS_TX_MSDU_FAILED, NL80211_TID_STATS_PAD, NL80211_TID_STATS_TXQ_STATS, /* keep last */ NUM_NL80211_TID_STATS, NL80211_TID_STATS_MAX = NUM_NL80211_TID_STATS - 1 }; /** * enum nl80211_txq_stats - per TXQ statistics attributes * @__NL80211_TXQ_STATS_INVALID: attribute number 0 is reserved * @NUM_NL80211_TXQ_STATS: number of attributes here * @NL80211_TXQ_STATS_BACKLOG_BYTES: number of bytes currently backlogged * @NL80211_TXQ_STATS_BACKLOG_PACKETS: number of packets currently * backlogged * @NL80211_TXQ_STATS_FLOWS: total number of new flows seen * @NL80211_TXQ_STATS_DROPS: total number of packet drops * @NL80211_TXQ_STATS_ECN_MARKS: total number of packet ECN marks * @NL80211_TXQ_STATS_OVERLIMIT: number of drops due to queue space overflow * @NL80211_TXQ_STATS_OVERMEMORY: number of drops due to memory limit overflow * (only for per-phy stats) * @NL80211_TXQ_STATS_COLLISIONS: number of hash collisions * @NL80211_TXQ_STATS_TX_BYTES: total number of bytes dequeued from TXQ * @NL80211_TXQ_STATS_TX_PACKETS: total number of packets dequeued from TXQ * @NL80211_TXQ_STATS_MAX_FLOWS: number of flow buckets for PHY * @NL80211_TXQ_STATS_MAX: highest numbered attribute here */ enum nl80211_txq_stats { __NL80211_TXQ_STATS_INVALID, NL80211_TXQ_STATS_BACKLOG_BYTES, NL80211_TXQ_STATS_BACKLOG_PACKETS, NL80211_TXQ_STATS_FLOWS, NL80211_TXQ_STATS_DROPS, NL80211_TXQ_STATS_ECN_MARKS, NL80211_TXQ_STATS_OVERLIMIT, NL80211_TXQ_STATS_OVERMEMORY, NL80211_TXQ_STATS_COLLISIONS, NL80211_TXQ_STATS_TX_BYTES, NL80211_TXQ_STATS_TX_PACKETS, NL80211_TXQ_STATS_MAX_FLOWS, /* keep last */ NUM_NL80211_TXQ_STATS, NL80211_TXQ_STATS_MAX = NUM_NL80211_TXQ_STATS - 1 }; /** * enum nl80211_mpath_flags - nl80211 mesh path flags * * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded */ enum nl80211_mpath_flags { NL80211_MPATH_FLAG_ACTIVE = 1<<0, NL80211_MPATH_FLAG_RESOLVING = 1<<1, NL80211_MPATH_FLAG_SN_VALID = 1<<2, NL80211_MPATH_FLAG_FIXED = 1<<3, NL80211_MPATH_FLAG_RESOLVED = 1<<4, }; /** * enum nl80211_mpath_info - mesh path information * * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting * information about a mesh path. * * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved * @NL80211_MPATH_INFO_FRAME_QLEN: number of queued frames for this destination * @NL80211_MPATH_INFO_SN: destination sequence number * @NL80211_MPATH_INFO_METRIC: metric (cost) of this mesh path * @NL80211_MPATH_INFO_EXPTIME: expiration time for the path, in msec from now * @NL80211_MPATH_INFO_FLAGS: mesh path flags, enumerated in * &enum nl80211_mpath_flags; * @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec * @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries * @NL80211_MPATH_INFO_HOP_COUNT: hop count to destination * @NL80211_MPATH_INFO_PATH_CHANGE: total number of path changes to destination * @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number * currently defined * @__NL80211_MPATH_INFO_AFTER_LAST: internal use */ enum nl80211_mpath_info { __NL80211_MPATH_INFO_INVALID, NL80211_MPATH_INFO_FRAME_QLEN, NL80211_MPATH_INFO_SN, NL80211_MPATH_INFO_METRIC, NL80211_MPATH_INFO_EXPTIME, NL80211_MPATH_INFO_FLAGS, NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, NL80211_MPATH_INFO_DISCOVERY_RETRIES, NL80211_MPATH_INFO_HOP_COUNT, NL80211_MPATH_INFO_PATH_CHANGE, /* keep last */ __NL80211_MPATH_INFO_AFTER_LAST, NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1 }; /** * enum nl80211_band_iftype_attr - Interface type data attributes * * @__NL80211_BAND_IFTYPE_ATTR_INVALID: attribute number 0 is reserved * @NL80211_BAND_IFTYPE_ATTR_IFTYPES: nested attribute containing a flag attribute * for each interface type that supports the band data * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC: HE MAC capabilities as in HE * capabilities IE * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY: HE PHY capabilities as in HE * capabilities IE * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET: HE supported NSS/MCS as in HE * capabilities IE * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE: HE PPE thresholds information as * defined in HE capabilities IE * @NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA: HE 6GHz band capabilities (__le16), * given for all 6 GHz band channels * @NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS: vendor element capabilities that are * advertised on this band/for this iftype (binary) * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC: EHT MAC capabilities as in EHT * capabilities element * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY: EHT PHY capabilities as in EHT * capabilities element * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET: EHT supported NSS/MCS as in EHT * capabilities element * @NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE: EHT PPE thresholds information as * defined in EHT capabilities element * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band attribute currently defined */ enum nl80211_band_iftype_attr { __NL80211_BAND_IFTYPE_ATTR_INVALID, NL80211_BAND_IFTYPE_ATTR_IFTYPES, NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC, NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY, NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET, NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE, NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA, NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS, NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC, NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY, NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MCS_SET, NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE, /* keep last */ __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST, NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_band_attr - band attributes * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band, * an array of nested frequency attributes * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, * an array of nested bitrate attributes * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as * defined in 802.11n * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n * @NL80211_BAND_ATTR_VHT_MCS_SET: 32-byte attribute containing the MCS set as * defined in 802.11ac * @NL80211_BAND_ATTR_VHT_CAPA: VHT capabilities, as in the HT information IE * @NL80211_BAND_ATTR_IFTYPE_DATA: nested array attribute, with each entry using * attributes from &enum nl80211_band_iftype_attr * @NL80211_BAND_ATTR_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz * channel(s) that are allowed to be used for EDMG transmissions. * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. * @NL80211_BAND_ATTR_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes * the allowed channel bandwidth configurations. * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. * @NL80211_BAND_ATTR_S1G_MCS_NSS_SET: S1G capabilities, supported S1G-MCS and NSS * set subfield, as in the S1G information IE, 5 bytes * @NL80211_BAND_ATTR_S1G_CAPA: S1G capabilities information subfield as in the * S1G information IE, 10 bytes * @NL80211_BAND_ATTR_MAX: highest band attribute currently defined * @__NL80211_BAND_ATTR_AFTER_LAST: internal use */ enum nl80211_band_attr { __NL80211_BAND_ATTR_INVALID, NL80211_BAND_ATTR_FREQS, NL80211_BAND_ATTR_RATES, NL80211_BAND_ATTR_HT_MCS_SET, NL80211_BAND_ATTR_HT_CAPA, NL80211_BAND_ATTR_HT_AMPDU_FACTOR, NL80211_BAND_ATTR_HT_AMPDU_DENSITY, NL80211_BAND_ATTR_VHT_MCS_SET, NL80211_BAND_ATTR_VHT_CAPA, NL80211_BAND_ATTR_IFTYPE_DATA, NL80211_BAND_ATTR_EDMG_CHANNELS, NL80211_BAND_ATTR_EDMG_BW_CONFIG, NL80211_BAND_ATTR_S1G_MCS_NSS_SET, NL80211_BAND_ATTR_S1G_CAPA, /* keep last */ __NL80211_BAND_ATTR_AFTER_LAST, NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 }; #define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA /** * enum nl80211_wmm_rule - regulatory wmm rule * * @__NL80211_WMMR_INVALID: attribute number 0 is reserved * @NL80211_WMMR_CW_MIN: Minimum contention window slot. * @NL80211_WMMR_CW_MAX: Maximum contention window slot. * @NL80211_WMMR_AIFSN: Arbitration Inter Frame Space. * @NL80211_WMMR_TXOP: Maximum allowed tx operation time. * @nl80211_WMMR_MAX: highest possible wmm rule. * @__NL80211_WMMR_LAST: Internal use. */ enum nl80211_wmm_rule { __NL80211_WMMR_INVALID, NL80211_WMMR_CW_MIN, NL80211_WMMR_CW_MAX, NL80211_WMMR_AIFSN, NL80211_WMMR_TXOP, /* keep last */ __NL80211_WMMR_LAST, NL80211_WMMR_MAX = __NL80211_WMMR_LAST - 1 }; /** * enum nl80211_frequency_attr - frequency attributes * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current * regulatory domain. * @NL80211_FREQUENCY_ATTR_NO_IR: no mechanisms that initiate radiation * are permitted on this channel, this includes sending probe * requests, or modes of operation that require beaconing. * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm * (100 * dBm). * @NL80211_FREQUENCY_ATTR_DFS_STATE: current state for DFS * (enum nl80211_dfs_state) * @NL80211_FREQUENCY_ATTR_DFS_TIME: time in miliseconds for how long * this channel is in this DFS state. * @NL80211_FREQUENCY_ATTR_NO_HT40_MINUS: HT40- isn't possible with this * channel as the control channel * @NL80211_FREQUENCY_ATTR_NO_HT40_PLUS: HT40+ isn't possible with this * channel as the control channel * @NL80211_FREQUENCY_ATTR_NO_80MHZ: any 80 MHz channel using this channel * as the primary or any of the secondary channels isn't possible, * this includes 80+80 channels * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel * using this channel as the primary or any of the secondary channels * isn't possible * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. * @NL80211_FREQUENCY_ATTR_INDOOR_ONLY: Only indoor use is permitted on this * channel. A channel that has the INDOOR_ONLY attribute can only be * used when there is a clear assessment that the device is operating in * an indoor surroundings, i.e., it is connected to AC power (and not * through portable DC inverters) or is under the control of a master * that is acting as an AP and is connected to AC power. * @NL80211_FREQUENCY_ATTR_IR_CONCURRENT: IR operation is allowed on this * channel if it's connected concurrently to a BSS on the same channel on * the 2 GHz band or to a channel in the same UNII band (on the 5 GHz * band), and IEEE80211_CHAN_RADAR is not set. Instantiating a GO or TDLS * off-channel on a channel that has the IR_CONCURRENT attribute set can be * done when there is a clear assessment that the device is operating under * the guidance of an authorized master, i.e., setting up a GO or TDLS * off-channel while the device is also connected to an AP with DFS and * radar detection on the UNII band (it is up to user-space, i.e., * wpa_supplicant to perform the required verifications). Using this * attribute for IR is disallowed for master interfaces (IBSS, AP). * @NL80211_FREQUENCY_ATTR_NO_20MHZ: 20 MHz operation is not allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations. * This is a nested attribute that contains the wmm limitation per AC. * (see &enum nl80211_wmm_rule) * @NL80211_FREQUENCY_ATTR_NO_HE: HE operation is not allowed on this channel * in current regulatory domain. * @NL80211_FREQUENCY_ATTR_OFFSET: frequency offset in KHz * @NL80211_FREQUENCY_ATTR_1MHZ: 1 MHz operation is allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_2MHZ: 2 MHz operation is allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_4MHZ: 4 MHz operation is allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_8MHZ: 8 MHz operation is allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_16MHZ: 16 MHz operation is allowed * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_NO_320MHZ: any 320 MHz channel using this channel * as the primary or any of the secondary channels isn't possible * @NL80211_FREQUENCY_ATTR_NO_EHT: EHT operation is not allowed on this channel * in current regulatory domain. * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use * * See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122 * for more information on the FCC description of the relaxations allowed * by NL80211_FREQUENCY_ATTR_INDOOR_ONLY and * NL80211_FREQUENCY_ATTR_IR_CONCURRENT. */ enum nl80211_frequency_attr { __NL80211_FREQUENCY_ATTR_INVALID, NL80211_FREQUENCY_ATTR_FREQ, NL80211_FREQUENCY_ATTR_DISABLED, NL80211_FREQUENCY_ATTR_NO_IR, __NL80211_FREQUENCY_ATTR_NO_IBSS, NL80211_FREQUENCY_ATTR_RADAR, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, NL80211_FREQUENCY_ATTR_DFS_STATE, NL80211_FREQUENCY_ATTR_DFS_TIME, NL80211_FREQUENCY_ATTR_NO_HT40_MINUS, NL80211_FREQUENCY_ATTR_NO_HT40_PLUS, NL80211_FREQUENCY_ATTR_NO_80MHZ, NL80211_FREQUENCY_ATTR_NO_160MHZ, NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, NL80211_FREQUENCY_ATTR_INDOOR_ONLY, NL80211_FREQUENCY_ATTR_IR_CONCURRENT, NL80211_FREQUENCY_ATTR_NO_20MHZ, NL80211_FREQUENCY_ATTR_NO_10MHZ, NL80211_FREQUENCY_ATTR_WMM, NL80211_FREQUENCY_ATTR_NO_HE, NL80211_FREQUENCY_ATTR_OFFSET, NL80211_FREQUENCY_ATTR_1MHZ, NL80211_FREQUENCY_ATTR_2MHZ, NL80211_FREQUENCY_ATTR_4MHZ, NL80211_FREQUENCY_ATTR_8MHZ, NL80211_FREQUENCY_ATTR_16MHZ, NL80211_FREQUENCY_ATTR_NO_320MHZ, NL80211_FREQUENCY_ATTR_NO_EHT, /* keep last */ __NL80211_FREQUENCY_ATTR_AFTER_LAST, NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 }; #define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER #define NL80211_FREQUENCY_ATTR_PASSIVE_SCAN NL80211_FREQUENCY_ATTR_NO_IR #define NL80211_FREQUENCY_ATTR_NO_IBSS NL80211_FREQUENCY_ATTR_NO_IR #define NL80211_FREQUENCY_ATTR_NO_IR NL80211_FREQUENCY_ATTR_NO_IR #define NL80211_FREQUENCY_ATTR_GO_CONCURRENT \ NL80211_FREQUENCY_ATTR_IR_CONCURRENT /** * enum nl80211_bitrate_attr - bitrate attributes * @__NL80211_BITRATE_ATTR_INVALID: attribute number 0 is reserved * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported * in 2.4 GHz band. * @NL80211_BITRATE_ATTR_MAX: highest bitrate attribute number * currently defined * @__NL80211_BITRATE_ATTR_AFTER_LAST: internal use */ enum nl80211_bitrate_attr { __NL80211_BITRATE_ATTR_INVALID, NL80211_BITRATE_ATTR_RATE, NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE, /* keep last */ __NL80211_BITRATE_ATTR_AFTER_LAST, NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_initiator - Indicates the initiator of a reg domain request * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world * regulatory domain. * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the * regulatory domain. * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the * wireless core it thinks its knows the regulatory domain we should be in. * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an * 802.11 country information element with regulatory information it * thinks we should consider. cfg80211 only processes the country * code from the IE, and relies on the regulatory domain information * structure passed by userspace (CRDA) from our wireless-regdb. * If a channel is enabled but the country code indicates it should * be disabled we disable the channel and re-enable it upon disassociation. */ enum nl80211_reg_initiator { NL80211_REGDOM_SET_BY_CORE, NL80211_REGDOM_SET_BY_USER, NL80211_REGDOM_SET_BY_DRIVER, NL80211_REGDOM_SET_BY_COUNTRY_IE, }; /** * enum nl80211_reg_type - specifies the type of regulatory domain * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains * to a specific country. When this is set you can count on the * ISO / IEC 3166 alpha2 country code being valid. * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory * domain. * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom * driver specific world regulatory domain. These do not apply system-wide * and are only applicable to the individual devices which have requested * them to be applied. * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product * of an intersection between two regulatory domains -- the previously * set regulatory domain on the system and the last accepted regulatory * domain request to be processed. */ enum nl80211_reg_type { NL80211_REGDOM_TYPE_COUNTRY, NL80211_REGDOM_TYPE_WORLD, NL80211_REGDOM_TYPE_CUSTOM_WORLD, NL80211_REGDOM_TYPE_INTERSECTION, }; /** * enum nl80211_reg_rule_attr - regulatory rule attributes * @__NL80211_REG_RULE_ATTR_INVALID: attribute number 0 is reserved * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional * considerations for a given frequency range. These are the * &enum nl80211_reg_rule_flags. * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory * rule in KHz. This is not a center of frequency but an actual regulatory * band edge. * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule * in KHz. This is not a center a frequency but an actual regulatory * band edge. * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this * frequency range, in KHz. * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain * for a given frequency range. The value is in mBi (100 * dBi). * If you don't have one then don't send this. * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for * a given frequency range. The value is in mBm (100 * dBm). * @NL80211_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. * If not present or 0 default CAC time will be used. * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number * currently defined * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use */ enum nl80211_reg_rule_attr { __NL80211_REG_RULE_ATTR_INVALID, NL80211_ATTR_REG_RULE_FLAGS, NL80211_ATTR_FREQ_RANGE_START, NL80211_ATTR_FREQ_RANGE_END, NL80211_ATTR_FREQ_RANGE_MAX_BW, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, NL80211_ATTR_POWER_RULE_MAX_EIRP, NL80211_ATTR_DFS_CAC_TIME, /* keep last */ __NL80211_REG_RULE_ATTR_AFTER_LAST, NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_sched_scan_match_attr - scheduled scan match attributes * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, * only report BSS with matching SSID. * (This cannot be used together with BSSID.) * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a * BSS in scan results. Filtering is turned off if not specified. Note that * if this attribute is in a match set of its own, then it is treated as * the default value for all matchsets with an SSID, rather than being a * matchset of its own without an RSSI filter. This is due to problems with * how this API was implemented in the past. Also, due to the same problem, * the only way to create a matchset with only an RSSI filter (with this * attribute) is if there's only a single matchset with the RSSI attribute. * @NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI: Flag indicating whether * %NL80211_SCHED_SCAN_MATCH_ATTR_RSSI to be used as absolute RSSI or * relative to current bss's RSSI. * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST: When present the RSSI level for * BSS-es in the specified band is to be adjusted before doing * RSSI-based BSS selection. The attribute value is a packed structure * value as specified by &struct nl80211_bss_select_rssi_adjust. * @NL80211_SCHED_SCAN_MATCH_ATTR_BSSID: BSSID to be used for matching * (this cannot be used together with SSID). * @NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI: Nested attribute that carries the * band specific minimum rssi thresholds for the bands defined in * enum nl80211_band. The minimum rssi threshold value(s32) specific to a * band shall be encapsulated in attribute with type value equals to one * of the NL80211_BAND_* defined in enum nl80211_band. For example, the * minimum rssi threshold value for 2.4GHZ band shall be encapsulated * within an attribute of type NL80211_BAND_2GHZ. And one or more of such * attributes will be nested within this attribute. * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter * attribute number currently defined * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use */ enum nl80211_sched_scan_match_attr { __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, NL80211_SCHED_SCAN_MATCH_ATTR_SSID, NL80211_SCHED_SCAN_MATCH_ATTR_RSSI, NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI, NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST, NL80211_SCHED_SCAN_MATCH_ATTR_BSSID, NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI, /* keep last */ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, NL80211_SCHED_SCAN_MATCH_ATTR_MAX = __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 }; /* only for backward compatibility */ #define NL80211_ATTR_SCHED_SCAN_MATCH_SSID NL80211_SCHED_SCAN_MATCH_ATTR_SSID /** * enum nl80211_reg_rule_flags - regulatory rule flags * * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed * @NL80211_RRF_NO_CCK: CCK modulation not allowed * @NL80211_RRF_NO_INDOOR: indoor operation not allowed * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed * @NL80211_RRF_DFS: DFS support is required to be used * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed, * this includes probe requests or modes of operation that require * beaconing. * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated * base on contiguous rules and wider channels will be allowed to cross * multiple contiguous/overlapping frequency ranges. * @NL80211_RRF_IR_CONCURRENT: See %NL80211_FREQUENCY_ATTR_IR_CONCURRENT * @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed * @NL80211_RRF_NO_HE: HE operation not allowed * @NL80211_RRF_NO_320MHZ: 320MHz operation not allowed */ enum nl80211_reg_rule_flags { NL80211_RRF_NO_OFDM = 1<<0, NL80211_RRF_NO_CCK = 1<<1, NL80211_RRF_NO_INDOOR = 1<<2, NL80211_RRF_NO_OUTDOOR = 1<<3, NL80211_RRF_DFS = 1<<4, NL80211_RRF_PTP_ONLY = 1<<5, NL80211_RRF_PTMP_ONLY = 1<<6, NL80211_RRF_NO_IR = 1<<7, __NL80211_RRF_NO_IBSS = 1<<8, NL80211_RRF_AUTO_BW = 1<<11, NL80211_RRF_IR_CONCURRENT = 1<<12, NL80211_RRF_NO_HT40MINUS = 1<<13, NL80211_RRF_NO_HT40PLUS = 1<<14, NL80211_RRF_NO_80MHZ = 1<<15, NL80211_RRF_NO_160MHZ = 1<<16, NL80211_RRF_NO_HE = 1<<17, NL80211_RRF_NO_320MHZ = 1<<18, }; #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR #define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR #define NL80211_RRF_NO_IR NL80211_RRF_NO_IR #define NL80211_RRF_NO_HT40 (NL80211_RRF_NO_HT40MINUS |\ NL80211_RRF_NO_HT40PLUS) #define NL80211_RRF_GO_CONCURRENT NL80211_RRF_IR_CONCURRENT /* For backport compatibility with older userspace */ #define NL80211_RRF_NO_IR_ALL (NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS) /** * enum nl80211_dfs_regions - regulatory DFS regions * * @NL80211_DFS_UNSET: Country has no DFS master region specified * @NL80211_DFS_FCC: Country follows DFS master rules from FCC * @NL80211_DFS_ETSI: Country follows DFS master rules from ETSI * @NL80211_DFS_JP: Country follows DFS master rules from JP/MKK/Telec */ enum nl80211_dfs_regions { NL80211_DFS_UNSET = 0, NL80211_DFS_FCC = 1, NL80211_DFS_ETSI = 2, NL80211_DFS_JP = 3, }; /** * enum nl80211_user_reg_hint_type - type of user regulatory hint * * @NL80211_USER_REG_HINT_USER: a user sent the hint. This is always * assumed if the attribute is not set. * @NL80211_USER_REG_HINT_CELL_BASE: the hint comes from a cellular * base station. Device drivers that have been tested to work * properly to support this type of hint can enable these hints * by setting the NL80211_FEATURE_CELL_BASE_REG_HINTS feature * capability on the struct wiphy. The wireless core will * ignore all cell base station hints until at least one device * present has been registered with the wireless core that * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a * supported feature. * @NL80211_USER_REG_HINT_INDOOR: a user sent an hint indicating that the * platform is operating in an indoor environment. */ enum nl80211_user_reg_hint_type { NL80211_USER_REG_HINT_USER = 0, NL80211_USER_REG_HINT_CELL_BASE = 1, NL80211_USER_REG_HINT_INDOOR = 2, }; /** * enum nl80211_survey_info - survey information * * These attribute types are used with %NL80211_ATTR_SURVEY_INFO * when getting information about a survey. * * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used * @NL80211_SURVEY_INFO_TIME: amount of time (in ms) that the radio * was turned on (on channel or globally) * @NL80211_SURVEY_INFO_TIME_BUSY: amount of the time the primary * channel was sensed busy (either due to activity or energy detect) * @NL80211_SURVEY_INFO_TIME_EXT_BUSY: amount of time the extension * channel was sensed busy * @NL80211_SURVEY_INFO_TIME_RX: amount of time the radio spent * receiving data (on channel or globally) * @NL80211_SURVEY_INFO_TIME_TX: amount of time the radio spent * transmitting data (on channel or globally) * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan * (on this channel or globally) * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment * @NL80211_SURVEY_INFO_TIME_BSS_RX: amount of time the radio spent * receiving frames destined to the local BSS * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number * currently defined * @NL80211_SURVEY_INFO_FREQUENCY_OFFSET: center frequency offset in KHz * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use */ enum nl80211_survey_info { __NL80211_SURVEY_INFO_INVALID, NL80211_SURVEY_INFO_FREQUENCY, NL80211_SURVEY_INFO_NOISE, NL80211_SURVEY_INFO_IN_USE, NL80211_SURVEY_INFO_TIME, NL80211_SURVEY_INFO_TIME_BUSY, NL80211_SURVEY_INFO_TIME_EXT_BUSY, NL80211_SURVEY_INFO_TIME_RX, NL80211_SURVEY_INFO_TIME_TX, NL80211_SURVEY_INFO_TIME_SCAN, NL80211_SURVEY_INFO_PAD, NL80211_SURVEY_INFO_TIME_BSS_RX, NL80211_SURVEY_INFO_FREQUENCY_OFFSET, /* keep last */ __NL80211_SURVEY_INFO_AFTER_LAST, NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1 }; /* keep old names for compatibility */ #define NL80211_SURVEY_INFO_CHANNEL_TIME NL80211_SURVEY_INFO_TIME #define NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY NL80211_SURVEY_INFO_TIME_BUSY #define NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY NL80211_SURVEY_INFO_TIME_EXT_BUSY #define NL80211_SURVEY_INFO_CHANNEL_TIME_RX NL80211_SURVEY_INFO_TIME_RX #define NL80211_SURVEY_INFO_CHANNEL_TIME_TX NL80211_SURVEY_INFO_TIME_TX /** * enum nl80211_mntr_flags - monitor configuration flags * * Monitor configuration flags. * * @__NL80211_MNTR_FLAG_INVALID: reserved * * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP * @NL80211_MNTR_FLAG_CONTROL: pass control frames * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. * overrides all other flags. * @NL80211_MNTR_FLAG_ACTIVE: use the configured MAC address * and ACK incoming unicast packets. * * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag */ enum nl80211_mntr_flags { __NL80211_MNTR_FLAG_INVALID, NL80211_MNTR_FLAG_FCSFAIL, NL80211_MNTR_FLAG_PLCPFAIL, NL80211_MNTR_FLAG_CONTROL, NL80211_MNTR_FLAG_OTHER_BSS, NL80211_MNTR_FLAG_COOK_FRAMES, NL80211_MNTR_FLAG_ACTIVE, /* keep last */ __NL80211_MNTR_FLAG_AFTER_LAST, NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 }; /** * enum nl80211_mesh_power_mode - mesh power save modes * * @NL80211_MESH_POWER_UNKNOWN: The mesh power mode of the mesh STA is * not known or has not been set yet. * @NL80211_MESH_POWER_ACTIVE: Active mesh power mode. The mesh STA is * in Awake state all the time. * @NL80211_MESH_POWER_LIGHT_SLEEP: Light sleep mode. The mesh STA will * alternate between Active and Doze states, but will wake up for * neighbor's beacons. * @NL80211_MESH_POWER_DEEP_SLEEP: Deep sleep mode. The mesh STA will * alternate between Active and Doze states, but may not wake up * for neighbor's beacons. * * @__NL80211_MESH_POWER_AFTER_LAST - internal use * @NL80211_MESH_POWER_MAX - highest possible power save level */ enum nl80211_mesh_power_mode { NL80211_MESH_POWER_UNKNOWN, NL80211_MESH_POWER_ACTIVE, NL80211_MESH_POWER_LIGHT_SLEEP, NL80211_MESH_POWER_DEEP_SLEEP, __NL80211_MESH_POWER_AFTER_LAST, NL80211_MESH_POWER_MAX = __NL80211_MESH_POWER_AFTER_LAST - 1 }; /** * enum nl80211_meshconf_params - mesh configuration parameters * * Mesh configuration parameters. These can be changed while the mesh is * active. * * @__NL80211_MESHCONF_INVALID: internal use * * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in * millisecond units, used by the Peer Link Open message * * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in * millisecond units, used by the peer link management to close a peer link * * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in * millisecond units * * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed * on this mesh interface * * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link * open retries that can be sent to establish a new peer link instance in a * mesh * * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh * point. * * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically open * peer links when we detect compatible mesh peers. Disabled if * @NL80211_MESH_SETUP_USERSPACE_MPM or @NL80211_MESH_SETUP_USERSPACE_AMPE are * set. * * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames * containing a PREQ that an MP can send to a particular destination (path * target) * * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths * (in milliseconds) * * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait * until giving up on a path discovery (in milliseconds) * * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh * points receiving a PREQ shall consider the forwarding information from * the root to be valid. (TU = time unit) * * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in * TUs) during which an MP can send only one action frame containing a PREQ * reference element * * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) * that it takes for an HWMP information element to propagate across the * mesh * * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not * * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a * source mesh point for path selection elements. * * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between * root announcements are transmitted. * * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has * access to a broader network beyond the MBSS. This is done via Root * Announcement frames. * * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in * TUs) during which a mesh STA can send only one Action frame containing a * PERR element. * * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding * or forwarding entity (default is TRUE - forwarding entity) * * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the * threshold for average signal strength of candidate station to establish * a peer link. * * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors * to synchronize to for 11s default synchronization method * (see 11C.12.2.2) * * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode. * * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute * * @NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT: The time (in TUs) for * which mesh STAs receiving a proactive PREQ shall consider the forwarding * information to the root mesh STA to be valid. * * @NL80211_MESHCONF_HWMP_ROOT_INTERVAL: The interval of time (in TUs) between * proactive PREQs are transmitted. * * @NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL: The minimum interval of time * (in TUs) during which a mesh STA can send only one Action frame * containing a PREQ element for root path confirmation. * * @NL80211_MESHCONF_POWER_MODE: Default mesh power mode for new peer links. * type &enum nl80211_mesh_power_mode (u32) * * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs) * * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've * established peering with for longer than this time (in seconds), then * remove it from the STA's list of peers. You may set this to 0 to disable * the removal of the STA. Default is 30 minutes. * * @NL80211_MESHCONF_CONNECTED_TO_GATE: If set to true then this mesh STA * will advertise that it is connected to a gate in the mesh formation * field. If left unset then the mesh formation field will only * advertise such if there is an active root mesh path. * * @NL80211_MESHCONF_NOLEARN: Try to avoid multi-hop path discovery (e.g. * PREQ/PREP for HWMP) if the destination is a direct neighbor. Note that * this might not be the optimal decision as a multi-hop route might be * better. So if using this setting you will likely also want to disable * dot11MeshForwarding and use another mesh routing protocol on top. * * @NL80211_MESHCONF_CONNECTED_TO_AS: If set to true then this mesh STA * will advertise that it is connected to a authentication server * in the mesh formation field. * * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use */ enum nl80211_meshconf_params { __NL80211_MESHCONF_INVALID, NL80211_MESHCONF_RETRY_TIMEOUT, NL80211_MESHCONF_CONFIRM_TIMEOUT, NL80211_MESHCONF_HOLDING_TIMEOUT, NL80211_MESHCONF_MAX_PEER_LINKS, NL80211_MESHCONF_MAX_RETRIES, NL80211_MESHCONF_TTL, NL80211_MESHCONF_AUTO_OPEN_PLINKS, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, NL80211_MESHCONF_PATH_REFRESH_TIME, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, NL80211_MESHCONF_HWMP_ROOTMODE, NL80211_MESHCONF_ELEMENT_TTL, NL80211_MESHCONF_HWMP_RANN_INTERVAL, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, NL80211_MESHCONF_FORWARDING, NL80211_MESHCONF_RSSI_THRESHOLD, NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR, NL80211_MESHCONF_HT_OPMODE, NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT, NL80211_MESHCONF_HWMP_ROOT_INTERVAL, NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, NL80211_MESHCONF_POWER_MODE, NL80211_MESHCONF_AWAKE_WINDOW, NL80211_MESHCONF_PLINK_TIMEOUT, NL80211_MESHCONF_CONNECTED_TO_GATE, NL80211_MESHCONF_NOLEARN, NL80211_MESHCONF_CONNECTED_TO_AS, /* keep last */ __NL80211_MESHCONF_ATTR_AFTER_LAST, NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_mesh_setup_params - mesh setup parameters * * Mesh setup parameters. These are used to start/join a mesh and cannot be * changed while the mesh is active. * * @__NL80211_MESH_SETUP_INVALID: Internal use * * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a * vendor specific path selection algorithm or disable it to use the * default HWMP. * * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a * vendor specific path metric or disable it to use the default Airtime * metric. * * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a * robust security network ie, or a vendor specific information element * that vendors will use to identify the path selection methods and * metrics in use. * * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication * daemon will be authenticating mesh candidates. * * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication * daemon will be securing peer link frames. AMPE is a secured version of * Mesh Peering Management (MPM) and is implemented with the assistance of * a userspace daemon. When this flag is set, the kernel will send peer * management frames to a userspace daemon that will implement AMPE * functionality (security capabilities selection, key confirmation, and * key management). When the flag is unset (default), the kernel can * autonomously complete (unsecured) mesh peering without the need of a * userspace daemon. * * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a * vendor specific synchronization method or disable it to use the default * neighbor offset synchronization * * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will * implement an MPM which handles peer allocation and state. * * @NL80211_MESH_SETUP_AUTH_PROTOCOL: Inform the kernel of the authentication * method (u8, as defined in IEEE 8.4.2.100.6, e.g. 0x1 for SAE). * Default is no authentication method required. * * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number * * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use */ enum nl80211_mesh_setup_params { __NL80211_MESH_SETUP_INVALID, NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, NL80211_MESH_SETUP_IE, NL80211_MESH_SETUP_USERSPACE_AUTH, NL80211_MESH_SETUP_USERSPACE_AMPE, NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, NL80211_MESH_SETUP_USERSPACE_MPM, NL80211_MESH_SETUP_AUTH_PROTOCOL, /* keep last */ __NL80211_MESH_SETUP_ATTR_AFTER_LAST, NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_txq_attr - TX queue parameter attributes * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved * @NL80211_TXQ_ATTR_AC: AC identifier (NL80211_AC_*) * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning * disabled * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form * 2^n-1 in the range 1..32767] * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form * 2^n-1 in the range 1..32767] * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255] * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number */ enum nl80211_txq_attr { __NL80211_TXQ_ATTR_INVALID, NL80211_TXQ_ATTR_AC, NL80211_TXQ_ATTR_TXOP, NL80211_TXQ_ATTR_CWMIN, NL80211_TXQ_ATTR_CWMAX, NL80211_TXQ_ATTR_AIFS, /* keep last */ __NL80211_TXQ_ATTR_AFTER_LAST, NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 }; enum nl80211_ac { NL80211_AC_VO, NL80211_AC_VI, NL80211_AC_BE, NL80211_AC_BK, NL80211_NUM_ACS }; /* backward compat */ #define NL80211_TXQ_ATTR_QUEUE NL80211_TXQ_ATTR_AC #define NL80211_TXQ_Q_VO NL80211_AC_VO #define NL80211_TXQ_Q_VI NL80211_AC_VI #define NL80211_TXQ_Q_BE NL80211_AC_BE #define NL80211_TXQ_Q_BK NL80211_AC_BK /** * enum nl80211_channel_type - channel type * @NL80211_CHAN_NO_HT: 20 MHz, non-HT channel * @NL80211_CHAN_HT20: 20 MHz HT channel * @NL80211_CHAN_HT40MINUS: HT40 channel, secondary channel * below the control channel * @NL80211_CHAN_HT40PLUS: HT40 channel, secondary channel * above the control channel */ enum nl80211_channel_type { NL80211_CHAN_NO_HT, NL80211_CHAN_HT20, NL80211_CHAN_HT40MINUS, NL80211_CHAN_HT40PLUS }; /** * enum nl80211_key_mode - Key mode * * @NL80211_KEY_RX_TX: (Default) * Key can be used for Rx and Tx immediately * * The following modes can only be selected for unicast keys and when the * driver supports @NL80211_EXT_FEATURE_EXT_KEY_ID: * * @NL80211_KEY_NO_TX: Only allowed in combination with @NL80211_CMD_NEW_KEY: * Unicast key can only be used for Rx, Tx not allowed, yet * @NL80211_KEY_SET_TX: Only allowed in combination with @NL80211_CMD_SET_KEY: * The unicast key identified by idx and mac is cleared for Tx and becomes * the preferred Tx key for the station. */ enum nl80211_key_mode { NL80211_KEY_RX_TX, NL80211_KEY_NO_TX, NL80211_KEY_SET_TX }; /** * enum nl80211_chan_width - channel width definitions * * These values are used with the %NL80211_ATTR_CHANNEL_WIDTH * attribute. * * @NL80211_CHAN_WIDTH_20_NOHT: 20 MHz, non-HT channel * @NL80211_CHAN_WIDTH_20: 20 MHz HT channel * @NL80211_CHAN_WIDTH_40: 40 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well * @NL80211_CHAN_WIDTH_80: 80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well * @NL80211_CHAN_WIDTH_80P80: 80+80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel * @NL80211_CHAN_WIDTH_1: 1 MHz OFDM channel * @NL80211_CHAN_WIDTH_2: 2 MHz OFDM channel * @NL80211_CHAN_WIDTH_4: 4 MHz OFDM channel * @NL80211_CHAN_WIDTH_8: 8 MHz OFDM channel * @NL80211_CHAN_WIDTH_16: 16 MHz OFDM channel * @NL80211_CHAN_WIDTH_320: 320 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 * attribute must be provided as well */ enum nl80211_chan_width { NL80211_CHAN_WIDTH_20_NOHT, NL80211_CHAN_WIDTH_20, NL80211_CHAN_WIDTH_40, NL80211_CHAN_WIDTH_80, NL80211_CHAN_WIDTH_80P80, NL80211_CHAN_WIDTH_160, NL80211_CHAN_WIDTH_5, NL80211_CHAN_WIDTH_10, NL80211_CHAN_WIDTH_1, NL80211_CHAN_WIDTH_2, NL80211_CHAN_WIDTH_4, NL80211_CHAN_WIDTH_8, NL80211_CHAN_WIDTH_16, NL80211_CHAN_WIDTH_320, }; /** * enum nl80211_bss_scan_width - control channel width for a BSS * * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute. * * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide * @NL80211_BSS_CHAN_WIDTH_1: control channel is 1 MHz wide * @NL80211_BSS_CHAN_WIDTH_2: control channel is 2 MHz wide */ enum nl80211_bss_scan_width { NL80211_BSS_CHAN_WIDTH_20, NL80211_BSS_CHAN_WIDTH_10, NL80211_BSS_CHAN_WIDTH_5, NL80211_BSS_CHAN_WIDTH_1, NL80211_BSS_CHAN_WIDTH_2, }; /** * enum nl80211_bss - netlink attributes for a BSS * * @__NL80211_BSS_INVALID: invalid * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets) * @NL80211_BSS_FREQUENCY: frequency in MHz (u32) * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64) * (if @NL80211_BSS_PRESP_DATA is present then this is known to be * from a probe response, otherwise it may be from the same beacon * that the NL80211_BSS_BEACON_TSF will be from) * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the * raw information elements from the probe response/beacon (bin); * if the %NL80211_BSS_BEACON_IES attribute is present and the data is * different then the IEs here are from a Probe Response frame; otherwise * they are from a Beacon frame. * However, if the driver does not indicate the source of the IEs, these * IEs may be from either frame subtype. * If present, the @NL80211_BSS_PRESP_DATA attribute indicates that the * data here is known to be from a probe response, without any heuristics. * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon * in mBm (100 * dBm) (s32) * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon * in unspecified units, scaled to 0..100 (u8) * @NL80211_BSS_STATUS: status, if this BSS is "used" * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information * elements from a Beacon frame (bin); not present if no Beacon frame has * yet been received * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel * (u32, enum nl80211_bss_scan_width) * @NL80211_BSS_BEACON_TSF: TSF of the last received beacon (u64) * (not present if no beacon frame has been received yet) * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and * @NL80211_BSS_TSF is known to be from a probe response (flag attribute) * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry * was last updated by a received frame. The value is expected to be * accurate to about 10ms. (u64, nanoseconds) * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment * @NL80211_BSS_PARENT_TSF: the time at the start of reception of the first * octet of the timestamp field of the last beacon/probe received for * this BSS. The time is the TSF of the BSS specified by * @NL80211_BSS_PARENT_BSSID. (u64). * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF * is set. * @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update. * Contains a nested array of signal strength attributes (u8, dBm), * using the nesting index as the antenna number. * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8). * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it. * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */ enum nl80211_bss { __NL80211_BSS_INVALID, NL80211_BSS_BSSID, NL80211_BSS_FREQUENCY, NL80211_BSS_TSF, NL80211_BSS_BEACON_INTERVAL, NL80211_BSS_CAPABILITY, NL80211_BSS_INFORMATION_ELEMENTS, NL80211_BSS_SIGNAL_MBM, NL80211_BSS_SIGNAL_UNSPEC, NL80211_BSS_STATUS, NL80211_BSS_SEEN_MS_AGO, NL80211_BSS_BEACON_IES, NL80211_BSS_CHAN_WIDTH, NL80211_BSS_BEACON_TSF, NL80211_BSS_PRESP_DATA, NL80211_BSS_LAST_SEEN_BOOTTIME, NL80211_BSS_PAD, NL80211_BSS_PARENT_TSF, NL80211_BSS_PARENT_BSSID, NL80211_BSS_CHAIN_SIGNAL, NL80211_BSS_FREQUENCY_OFFSET, NL80211_BSS_MLO_LINK_ID, NL80211_BSS_MLD_ADDR, /* keep last */ __NL80211_BSS_AFTER_LAST, NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 }; /** * enum nl80211_bss_status - BSS "status" * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS. * Note that this is no longer used since cfg80211 no longer * keeps track of whether or not authentication was done with * a given BSS. * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS. * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS. * * The BSS status is a BSS attribute in scan dumps, which * indicates the status the interface has wrt. this BSS. */ enum nl80211_bss_status { NL80211_BSS_STATUS_AUTHENTICATED, NL80211_BSS_STATUS_ASSOCIATED, NL80211_BSS_STATUS_IBSS_JOINED, }; /** * enum nl80211_auth_type - AuthenticationType * * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) * @NL80211_AUTHTYPE_SAE: Simultaneous authentication of equals * @NL80211_AUTHTYPE_FILS_SK: Fast Initial Link Setup shared key * @NL80211_AUTHTYPE_FILS_SK_PFS: Fast Initial Link Setup shared key with PFS * @NL80211_AUTHTYPE_FILS_PK: Fast Initial Link Setup public key * @__NL80211_AUTHTYPE_NUM: internal * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by * trying multiple times); this is invalid in netlink -- leave out * the attribute for this on CONNECT commands. */ enum nl80211_auth_type { NL80211_AUTHTYPE_OPEN_SYSTEM, NL80211_AUTHTYPE_SHARED_KEY, NL80211_AUTHTYPE_FT, NL80211_AUTHTYPE_NETWORK_EAP, NL80211_AUTHTYPE_SAE, NL80211_AUTHTYPE_FILS_SK, NL80211_AUTHTYPE_FILS_SK_PFS, NL80211_AUTHTYPE_FILS_PK, /* keep last */ __NL80211_AUTHTYPE_NUM, NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1, NL80211_AUTHTYPE_AUTOMATIC }; /** * enum nl80211_key_type - Key Type * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS) * @NUM_NL80211_KEYTYPES: number of defined key types */ enum nl80211_key_type { NL80211_KEYTYPE_GROUP, NL80211_KEYTYPE_PAIRWISE, NL80211_KEYTYPE_PEERKEY, NUM_NL80211_KEYTYPES }; /** * enum nl80211_mfp - Management frame protection state * @NL80211_MFP_NO: Management frame protection not used * @NL80211_MFP_REQUIRED: Management frame protection required * @NL80211_MFP_OPTIONAL: Management frame protection is optional */ enum nl80211_mfp { NL80211_MFP_NO, NL80211_MFP_REQUIRED, NL80211_MFP_OPTIONAL, }; enum nl80211_wpa_versions { NL80211_WPA_VERSION_1 = 1 << 0, NL80211_WPA_VERSION_2 = 1 << 1, NL80211_WPA_VERSION_3 = 1 << 2, }; /** * enum nl80211_key_default_types - key default types * @__NL80211_KEY_DEFAULT_TYPE_INVALID: invalid * @NL80211_KEY_DEFAULT_TYPE_UNICAST: key should be used as default * unicast key * @NL80211_KEY_DEFAULT_TYPE_MULTICAST: key should be used as default * multicast key * @NUM_NL80211_KEY_DEFAULT_TYPES: number of default types */ enum nl80211_key_default_types { __NL80211_KEY_DEFAULT_TYPE_INVALID, NL80211_KEY_DEFAULT_TYPE_UNICAST, NL80211_KEY_DEFAULT_TYPE_MULTICAST, NUM_NL80211_KEY_DEFAULT_TYPES }; /** * enum nl80211_key_attributes - key attributes * @__NL80211_KEY_INVALID: invalid * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC * keys * @NL80211_KEY_IDX: key ID (u8, 0-3) * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 * section 7.3.2.25.1, e.g. 0x000FAC04) * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and * CCMP keys, each six bytes in little endian * @NL80211_KEY_DEFAULT: flag indicating default key * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not * specified the default depends on whether a MAC address was * given with the command using the key or not (u32) * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags * attributes, specifying what a key should be set as default as. * See &enum nl80211_key_default_types. * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode. * Defaults to @NL80211_KEY_RX_TX. * @NL80211_KEY_DEFAULT_BEACON: flag indicating default Beacon frame key * * @__NL80211_KEY_AFTER_LAST: internal * @NL80211_KEY_MAX: highest key attribute */ enum nl80211_key_attributes { __NL80211_KEY_INVALID, NL80211_KEY_DATA, NL80211_KEY_IDX, NL80211_KEY_CIPHER, NL80211_KEY_SEQ, NL80211_KEY_DEFAULT, NL80211_KEY_DEFAULT_MGMT, NL80211_KEY_TYPE, NL80211_KEY_DEFAULT_TYPES, NL80211_KEY_MODE, NL80211_KEY_DEFAULT_BEACON, /* keep last */ __NL80211_KEY_AFTER_LAST, NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 }; /** * enum nl80211_tx_rate_attributes - TX rate set attributes * @__NL80211_TXRATE_INVALID: invalid * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with * 1 = 500 kbps) but without the IE length restriction (at most * %NL80211_MAX_SUPP_RATES in a single array). * @NL80211_TXRATE_HT: HT (MCS) rates allowed for TX rate selection * in an array of MCS numbers. * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection, * see &struct nl80211_txrate_vht * @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi * @NL80211_TXRATE_HE: HE rates allowed for TX rate selection, * see &struct nl80211_txrate_he * @NL80211_TXRATE_HE_GI: configure HE GI, 0.8us, 1.6us and 3.2us. * @NL80211_TXRATE_HE_LTF: configure HE LTF, 1XLTF, 2XLTF and 4XLTF. * @__NL80211_TXRATE_AFTER_LAST: internal * @NL80211_TXRATE_MAX: highest TX rate attribute */ enum nl80211_tx_rate_attributes { __NL80211_TXRATE_INVALID, NL80211_TXRATE_LEGACY, NL80211_TXRATE_HT, NL80211_TXRATE_VHT, NL80211_TXRATE_GI, NL80211_TXRATE_HE, NL80211_TXRATE_HE_GI, NL80211_TXRATE_HE_LTF, /* keep last */ __NL80211_TXRATE_AFTER_LAST, NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1 }; #define NL80211_TXRATE_MCS NL80211_TXRATE_HT #define NL80211_VHT_NSS_MAX 8 /** * struct nl80211_txrate_vht - VHT MCS/NSS txrate bitmap * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.) */ struct nl80211_txrate_vht { __u16 mcs[NL80211_VHT_NSS_MAX]; }; #define NL80211_HE_NSS_MAX 8 /** * struct nl80211_txrate_he - HE MCS/NSS txrate bitmap * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.) */ struct nl80211_txrate_he { __u16 mcs[NL80211_HE_NSS_MAX]; }; enum nl80211_txrate_gi { NL80211_TXRATE_DEFAULT_GI, NL80211_TXRATE_FORCE_SGI, NL80211_TXRATE_FORCE_LGI, }; /** * enum nl80211_band - Frequency band * @NL80211_BAND_2GHZ: 2.4 GHz ISM band * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz) * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz) * @NL80211_BAND_S1GHZ: around 900MHz, supported by S1G PHYs * @NL80211_BAND_LC: light communication band (placeholder) * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace * since newer kernel versions may support more bands */ enum nl80211_band { NL80211_BAND_2GHZ, NL80211_BAND_5GHZ, NL80211_BAND_60GHZ, NL80211_BAND_6GHZ, NL80211_BAND_S1GHZ, NL80211_BAND_LC, NUM_NL80211_BANDS, }; /** * enum nl80211_ps_state - powersave state * @NL80211_PS_DISABLED: powersave is disabled * @NL80211_PS_ENABLED: powersave is enabled */ enum nl80211_ps_state { NL80211_PS_DISABLED, NL80211_PS_ENABLED, }; /** * enum nl80211_attr_cqm - connection quality monitor attributes * @__NL80211_ATTR_CQM_INVALID: invalid * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies * the threshold for the RSSI level at which an event will be sent. Zero * to disable. Alternatively, if %NL80211_EXT_FEATURE_CQM_RSSI_LIST is * set, multiple values can be supplied as a low-to-high sorted array of * threshold values in dBm. Events will be sent when the RSSI value * crosses any of the thresholds. * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies * the minimum amount the RSSI level must change after an event before a * new event may be issued (to reduce effects of RSSI oscillation). * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many * consecutive packets were not acknowledged by the peer * @NL80211_ATTR_CQM_TXE_RATE: TX error rate in %. Minimum % of TX failures * during the given %NL80211_ATTR_CQM_TXE_INTVL before an * %NL80211_CMD_NOTIFY_CQM with reported %NL80211_ATTR_CQM_TXE_RATE and * %NL80211_ATTR_CQM_TXE_PKTS is generated. * @NL80211_ATTR_CQM_TXE_PKTS: number of attempted packets in a given * %NL80211_ATTR_CQM_TXE_INTVL before %NL80211_ATTR_CQM_TXE_RATE is * checked. * @NL80211_ATTR_CQM_TXE_INTVL: interval in seconds. Specifies the periodic * interval in which %NL80211_ATTR_CQM_TXE_PKTS and * %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an * %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting. * @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon * loss event * @NL80211_ATTR_CQM_RSSI_LEVEL: the RSSI value in dBm that triggered the * RSSI threshold event. * @__NL80211_ATTR_CQM_AFTER_LAST: internal * @NL80211_ATTR_CQM_MAX: highest key attribute */ enum nl80211_attr_cqm { __NL80211_ATTR_CQM_INVALID, NL80211_ATTR_CQM_RSSI_THOLD, NL80211_ATTR_CQM_RSSI_HYST, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, NL80211_ATTR_CQM_PKT_LOSS_EVENT, NL80211_ATTR_CQM_TXE_RATE, NL80211_ATTR_CQM_TXE_PKTS, NL80211_ATTR_CQM_TXE_INTVL, NL80211_ATTR_CQM_BEACON_LOSS_EVENT, NL80211_ATTR_CQM_RSSI_LEVEL, /* keep last */ __NL80211_ATTR_CQM_AFTER_LAST, NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1 }; /** * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW: The RSSI level is lower than the * configured threshold * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the * configured threshold * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent) */ enum nl80211_cqm_rssi_threshold_event { NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, NL80211_CQM_RSSI_BEACON_LOSS_EVENT, }; /** * enum nl80211_tx_power_setting - TX power adjustment * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter */ enum nl80211_tx_power_setting { NL80211_TX_POWER_AUTOMATIC, NL80211_TX_POWER_LIMITED, NL80211_TX_POWER_FIXED, }; /** * enum nl80211_tid_config - TID config state * @NL80211_TID_CONFIG_ENABLE: Enable config for the TID * @NL80211_TID_CONFIG_DISABLE: Disable config for the TID */ enum nl80211_tid_config { NL80211_TID_CONFIG_ENABLE, NL80211_TID_CONFIG_DISABLE, }; /* enum nl80211_tx_rate_setting - TX rate configuration type * @NL80211_TX_RATE_AUTOMATIC: automatically determine TX rate * @NL80211_TX_RATE_LIMITED: limit the TX rate by the TX rate parameter * @NL80211_TX_RATE_FIXED: fix TX rate to the TX rate parameter */ enum nl80211_tx_rate_setting { NL80211_TX_RATE_AUTOMATIC, NL80211_TX_RATE_LIMITED, NL80211_TX_RATE_FIXED, }; /* enum nl80211_tid_config_attr - TID specific configuration. * @NL80211_TID_CONFIG_ATTR_PAD: pad attribute for 64-bit values * @NL80211_TID_CONFIG_ATTR_VIF_SUPP: a bitmap (u64) of attributes supported * for per-vif configuration; doesn't list the ones that are generic * (%NL80211_TID_CONFIG_ATTR_TIDS, %NL80211_TID_CONFIG_ATTR_OVERRIDE). * @NL80211_TID_CONFIG_ATTR_PEER_SUPP: same as the previous per-vif one, but * per peer instead. * @NL80211_TID_CONFIG_ATTR_OVERRIDE: flag attribue, if set indicates * that the new configuration overrides all previous peer * configurations, otherwise previous peer specific configurations * should be left untouched. * @NL80211_TID_CONFIG_ATTR_TIDS: a bitmask value of TIDs (bit 0 to 7) * Its type is u16. * @NL80211_TID_CONFIG_ATTR_NOACK: Configure ack policy for the TID. * specified in %NL80211_TID_CONFIG_ATTR_TID. see %enum nl80211_tid_config. * Its type is u8. * @NL80211_TID_CONFIG_ATTR_RETRY_SHORT: Number of retries used with data frame * transmission, user-space sets this configuration in * &NL80211_CMD_SET_TID_CONFIG. It is u8 type, min value is 1 and * the max value is advertised by the driver in this attribute on * output in wiphy capabilities. * @NL80211_TID_CONFIG_ATTR_RETRY_LONG: Number of retries used with data frame * transmission, user-space sets this configuration in * &NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and * the max value is advertised by the driver in this attribute on * output in wiphy capabilities. * @NL80211_TID_CONFIG_ATTR_AMPDU_CTRL: Enable/Disable MPDU aggregation * for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS. * Its type is u8, using the values from &nl80211_tid_config. * @NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL: Enable/Disable RTS_CTS for the TIDs * specified in %NL80211_TID_CONFIG_ATTR_TIDS. It is u8 type, using * the values from &nl80211_tid_config. * @NL80211_TID_CONFIG_ATTR_AMSDU_CTRL: Enable/Disable MSDU aggregation * for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS. * Its type is u8, using the values from &nl80211_tid_config. * @NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE: This attribute will be useful * to notfiy the driver that what type of txrate should be used * for the TIDs specified in %NL80211_TID_CONFIG_ATTR_TIDS. using * the values form &nl80211_tx_rate_setting. * @NL80211_TID_CONFIG_ATTR_TX_RATE: Data frame TX rate mask should be applied * with the parameters passed through %NL80211_ATTR_TX_RATES. * configuration is applied to the data frame for the tid to that connected * station. */ enum nl80211_tid_config_attr { __NL80211_TID_CONFIG_ATTR_INVALID, NL80211_TID_CONFIG_ATTR_PAD, NL80211_TID_CONFIG_ATTR_VIF_SUPP, NL80211_TID_CONFIG_ATTR_PEER_SUPP, NL80211_TID_CONFIG_ATTR_OVERRIDE, NL80211_TID_CONFIG_ATTR_TIDS, NL80211_TID_CONFIG_ATTR_NOACK, NL80211_TID_CONFIG_ATTR_RETRY_SHORT, NL80211_TID_CONFIG_ATTR_RETRY_LONG, NL80211_TID_CONFIG_ATTR_AMPDU_CTRL, NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL, NL80211_TID_CONFIG_ATTR_AMSDU_CTRL, NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE, NL80211_TID_CONFIG_ATTR_TX_RATE, /* keep last */ __NL80211_TID_CONFIG_ATTR_AFTER_LAST, NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_packet_pattern_attr - packet pattern attribute * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has * a zero bit are ignored * @NL80211_PKTPAT_MASK: pattern mask, must be long enough to have * a bit for each byte in the pattern. The lowest-order bit corresponds * to the first byte of the pattern, but the bytes of the pattern are * in a little-endian-like format, i.e. the 9th byte of the pattern * corresponds to the lowest-order bit in the second byte of the mask. * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where * xx indicates "don't care") would be represented by a pattern of * twelve zero bytes, and a mask of "0xed,0x01". * Note that the pattern matching is done as though frames were not * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked * first (including SNAP header unpacking) and then matched. * @NL80211_PKTPAT_OFFSET: packet offset, pattern is matched after * these fixed number of bytes of received packet * @NUM_NL80211_PKTPAT: number of attributes * @MAX_NL80211_PKTPAT: max attribute number */ enum nl80211_packet_pattern_attr { __NL80211_PKTPAT_INVALID, NL80211_PKTPAT_MASK, NL80211_PKTPAT_PATTERN, NL80211_PKTPAT_OFFSET, NUM_NL80211_PKTPAT, MAX_NL80211_PKTPAT = NUM_NL80211_PKTPAT - 1, }; /** * struct nl80211_pattern_support - packet pattern support information * @max_patterns: maximum number of patterns supported * @min_pattern_len: minimum length of each pattern * @max_pattern_len: maximum length of each pattern * @max_pkt_offset: maximum Rx packet offset * * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED or in * %NL80211_ATTR_COALESCE_RULE_PKT_PATTERN when that is part of * %NL80211_ATTR_COALESCE_RULE in the capability information given * by the kernel to userspace. */ struct nl80211_pattern_support { __u32 max_patterns; __u32 min_pattern_len; __u32 max_pattern_len; __u32 max_pkt_offset; } __attribute__((packed)); /* only for backward compatibility */ #define __NL80211_WOWLAN_PKTPAT_INVALID __NL80211_PKTPAT_INVALID #define NL80211_WOWLAN_PKTPAT_MASK NL80211_PKTPAT_MASK #define NL80211_WOWLAN_PKTPAT_PATTERN NL80211_PKTPAT_PATTERN #define NL80211_WOWLAN_PKTPAT_OFFSET NL80211_PKTPAT_OFFSET #define NUM_NL80211_WOWLAN_PKTPAT NUM_NL80211_PKTPAT #define MAX_NL80211_WOWLAN_PKTPAT MAX_NL80211_PKTPAT #define nl80211_wowlan_pattern_support nl80211_pattern_support /** * enum nl80211_wowlan_triggers - WoWLAN trigger definitions * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put * the chip into a special state -- works best with chips that have * support for low-power operation already (flag) * Note that this mode is incompatible with all of the others, if * any others are even supported by the device. * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect * is detected is implementation-specific (flag) * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed * by 16 repetitions of MAC addr, anywhere in payload) (flag) * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns * which are passed in an array of nested attributes, each nested attribute * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern. * Each pattern defines a wakeup packet. Packet offset is associated with * each pattern which is used while matching the pattern. The matching is * done on the MSDU, i.e. as though the packet was an 802.3 packet, so the * pattern matching is done after the packet is converted to the MSDU. * * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute * carrying a &struct nl80211_pattern_support. * * When reporting wakeup. it is a u32 attribute containing the 0-based * index of the pattern that caused the wakeup, in the patterns passed * to the kernel when configuring. * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be * used when setting, used only to indicate that GTK rekeying is supported * by the device (flag) * @NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE: wake up on GTK rekey failure (if * done by the device) (flag) * @NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST: wake up on EAP Identity Request * packet (flag) * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag) * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released * (on devices that have rfkill in the device) (flag) * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211: For wakeup reporting only, contains * the 802.11 packet that caused the wakeup, e.g. a deauth frame. The frame * may be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN * attribute contains the original length. * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN: Original length of the 802.11 * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211 * attribute if the packet was truncated somewhere. * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023: For wakeup reporting only, contains the * 802.11 packet that caused the wakeup, e.g. a magic packet. The frame may * be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN attribute * contains the original length. * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN: Original length of the 802.3 * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023 * attribute if the packet was truncated somewhere. * @NL80211_WOWLAN_TRIG_TCP_CONNECTION: TCP connection wake, see DOC section * "TCP connection wakeup" for more details. This is a nested attribute * containing the exact information for establishing and keeping alive * the TCP connection. * @NL80211_WOWLAN_TRIG_TCP_WAKEUP_MATCH: For wakeup reporting only, the * wakeup packet was received on the TCP connection * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST: For wakeup reporting only, the * TCP connection was lost or failed to be established * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only, * the TCP connection ran out of tokens to use for data to send to the * service * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network * is detected. This is a nested attribute that contains the * same attributes used with @NL80211_CMD_START_SCHED_SCAN. It * specifies how the scan is performed (e.g. the interval, the * channels to scan and the initial delay) as well as the scan * results that will trigger a wake (i.e. the matchsets). This * attribute is also sent in a response to * @NL80211_CMD_GET_WIPHY, indicating the number of match sets * supported by the driver (u32). * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute * containing an array with information about what triggered the * wake up. If no elements are present in the array, it means * that the information is not available. If more than one * element is present, it means that more than one match * occurred. * Each element in the array is a nested attribute that contains * one optional %NL80211_ATTR_SSID attribute and one optional * %NL80211_ATTR_SCAN_FREQUENCIES attribute. At least one of * these attributes must be present. If * %NL80211_ATTR_SCAN_FREQUENCIES contains more than one * frequency, it means that the match occurred in more than one * channel. * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number * * These nested attributes are used to configure the wakeup triggers and * to report the wakeup reason(s). */ enum nl80211_wowlan_triggers { __NL80211_WOWLAN_TRIG_INVALID, NL80211_WOWLAN_TRIG_ANY, NL80211_WOWLAN_TRIG_DISCONNECT, NL80211_WOWLAN_TRIG_MAGIC_PKT, NL80211_WOWLAN_TRIG_PKT_PATTERN, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, NL80211_WOWLAN_TRIG_RFKILL_RELEASE, NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211, NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN, NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023, NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN, NL80211_WOWLAN_TRIG_TCP_CONNECTION, NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH, NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST, NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS, NL80211_WOWLAN_TRIG_NET_DETECT, NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS, /* keep last */ NUM_NL80211_WOWLAN_TRIG, MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1 }; /** * DOC: TCP connection wakeup * * Some devices can establish a TCP connection in order to be woken up by a * packet coming in from outside their network segment, or behind NAT. If * configured, the device will establish a TCP connection to the given * service, and periodically send data to that service. The first data * packet is usually transmitted after SYN/ACK, also ACKing the SYN/ACK. * The data packets can optionally include a (little endian) sequence * number (in the TCP payload!) that is generated by the device, and, also * optionally, a token from a list of tokens. This serves as a keep-alive * with the service, and for NATed connections, etc. * * During this keep-alive period, the server doesn't send any data to the * client. When receiving data, it is compared against the wakeup pattern * (and mask) and if it matches, the host is woken up. Similarly, if the * connection breaks or cannot be established to start with, the host is * also woken up. * * Developer's note: ARP offload is required for this, otherwise TCP * response packets might not go through correctly. */ /** * struct nl80211_wowlan_tcp_data_seq - WoWLAN TCP data sequence * @start: starting value * @offset: offset of sequence number in packet * @len: length of the sequence value to write, 1 through 4 * * Note: don't confuse with the TCP sequence number(s), this is for the * keepalive packet payload. The actual value is written into the packet * in little endian. */ struct nl80211_wowlan_tcp_data_seq { __u32 start, offset, len; }; /** * struct nl80211_wowlan_tcp_data_token - WoWLAN TCP data token config * @offset: offset of token in packet * @len: length of each token * @token_stream: stream of data to be used for the tokens, the length must * be a multiple of @len for this to make sense */ struct nl80211_wowlan_tcp_data_token { __u32 offset, len; __u8 token_stream[]; }; /** * struct nl80211_wowlan_tcp_data_token_feature - data token features * @min_len: minimum token length * @max_len: maximum token length * @bufsize: total available token buffer size (max size of @token_stream) */ struct nl80211_wowlan_tcp_data_token_feature { __u32 min_len, max_len, bufsize; }; /** * enum nl80211_wowlan_tcp_attrs - WoWLAN TCP connection parameters * @__NL80211_WOWLAN_TCP_INVALID: invalid number for nested attributes * @NL80211_WOWLAN_TCP_SRC_IPV4: source IPv4 address (in network byte order) * @NL80211_WOWLAN_TCP_DST_IPV4: destination IPv4 address * (in network byte order) * @NL80211_WOWLAN_TCP_DST_MAC: destination MAC address, this is given because * route lookup when configured might be invalid by the time we suspend, * and doing a route lookup when suspending is no longer possible as it * might require ARP querying. * @NL80211_WOWLAN_TCP_SRC_PORT: source port (u16); optional, if not given a * socket and port will be allocated * @NL80211_WOWLAN_TCP_DST_PORT: destination port (u16) * @NL80211_WOWLAN_TCP_DATA_PAYLOAD: data packet payload, at least one byte. * For feature advertising, a u32 attribute holding the maximum length * of the data payload. * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ: data packet sequence configuration * (if desired), a &struct nl80211_wowlan_tcp_data_seq. For feature * advertising it is just a flag * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN: data packet token configuration, * see &struct nl80211_wowlan_tcp_data_token and for advertising see * &struct nl80211_wowlan_tcp_data_token_feature. * @NL80211_WOWLAN_TCP_DATA_INTERVAL: data interval in seconds, maximum * interval in feature advertising (u32) * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a * u32 attribute holding the maximum length * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for * feature advertising. The mask works like @NL80211_PKTPAT_MASK * but on the TCP payload only. * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes * @MAX_NL80211_WOWLAN_TCP: highest attribute number */ enum nl80211_wowlan_tcp_attrs { __NL80211_WOWLAN_TCP_INVALID, NL80211_WOWLAN_TCP_SRC_IPV4, NL80211_WOWLAN_TCP_DST_IPV4, NL80211_WOWLAN_TCP_DST_MAC, NL80211_WOWLAN_TCP_SRC_PORT, NL80211_WOWLAN_TCP_DST_PORT, NL80211_WOWLAN_TCP_DATA_PAYLOAD, NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN, NL80211_WOWLAN_TCP_DATA_INTERVAL, NL80211_WOWLAN_TCP_WAKE_PAYLOAD, NL80211_WOWLAN_TCP_WAKE_MASK, /* keep last */ NUM_NL80211_WOWLAN_TCP, MAX_NL80211_WOWLAN_TCP = NUM_NL80211_WOWLAN_TCP - 1 }; /** * struct nl80211_coalesce_rule_support - coalesce rule support information * @max_rules: maximum number of rules supported * @pat: packet pattern support information * @max_delay: maximum supported coalescing delay in msecs * * This struct is carried in %NL80211_ATTR_COALESCE_RULE in the * capability information given by the kernel to userspace. */ struct nl80211_coalesce_rule_support { __u32 max_rules; struct nl80211_pattern_support pat; __u32 max_delay; } __attribute__((packed)); /** * enum nl80211_attr_coalesce_rule - coalesce rule attribute * @__NL80211_COALESCE_RULE_INVALID: invalid number for nested attribute * @NL80211_ATTR_COALESCE_RULE_DELAY: delay in msecs used for packet coalescing * @NL80211_ATTR_COALESCE_RULE_CONDITION: condition for packet coalescence, * see &enum nl80211_coalesce_condition. * @NL80211_ATTR_COALESCE_RULE_PKT_PATTERN: packet offset, pattern is matched * after these fixed number of bytes of received packet * @NUM_NL80211_ATTR_COALESCE_RULE: number of attributes * @NL80211_ATTR_COALESCE_RULE_MAX: max attribute number */ enum nl80211_attr_coalesce_rule { __NL80211_COALESCE_RULE_INVALID, NL80211_ATTR_COALESCE_RULE_DELAY, NL80211_ATTR_COALESCE_RULE_CONDITION, NL80211_ATTR_COALESCE_RULE_PKT_PATTERN, /* keep last */ NUM_NL80211_ATTR_COALESCE_RULE, NL80211_ATTR_COALESCE_RULE_MAX = NUM_NL80211_ATTR_COALESCE_RULE - 1 }; /** * enum nl80211_coalesce_condition - coalesce rule conditions * @NL80211_COALESCE_CONDITION_MATCH: coalaesce Rx packets when patterns * in a rule are matched. * @NL80211_COALESCE_CONDITION_NO_MATCH: coalesce Rx packets when patterns * in a rule are not matched. */ enum nl80211_coalesce_condition { NL80211_COALESCE_CONDITION_MATCH, NL80211_COALESCE_CONDITION_NO_MATCH }; /** * enum nl80211_iface_limit_attrs - limit attributes * @NL80211_IFACE_LIMIT_UNSPEC: (reserved) * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that * can be chosen from this set of interface types (u32) * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a * flag attribute for each interface type in this set * @NUM_NL80211_IFACE_LIMIT: number of attributes * @MAX_NL80211_IFACE_LIMIT: highest attribute number */ enum nl80211_iface_limit_attrs { NL80211_IFACE_LIMIT_UNSPEC, NL80211_IFACE_LIMIT_MAX, NL80211_IFACE_LIMIT_TYPES, /* keep last */ NUM_NL80211_IFACE_LIMIT, MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1 }; /** * enum nl80211_if_combination_attrs -- interface combination attributes * * @NL80211_IFACE_COMB_UNSPEC: (reserved) * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits * for given interface types, see &enum nl80211_iface_limit_attrs. * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of * interfaces that can be created in this group. This number doesn't * apply to interfaces purely managed in software, which are listed * in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE. * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that * beacon intervals within this group must be all the same even for * infrastructure and AP/GO combinations, i.e. the GO(s) must adopt * the infrastructure network's beacon interval. * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many * different channels may be used within this group. * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap * of supported channel widths for radar detection. * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap * of supported regulatory regions for radar detection. * @NL80211_IFACE_COMB_BI_MIN_GCD: u32 attribute specifying the minimum GCD of * different beacon intervals supported by all the interface combinations * in this group (if not present, all beacon intervals be identical). * @NUM_NL80211_IFACE_COMB: number of attributes * @MAX_NL80211_IFACE_COMB: highest attribute number * * Examples: * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2 * => allows an AP and a STA that must match BIs * * numbers = [ #{AP, P2P-GO} <= 8 ], BI min gcd, channels = 1, max = 8, * => allows 8 of AP/GO that can have BI gcd >= min gcd * * numbers = [ #{STA} <= 2 ], channels = 2, max = 2 * => allows two STAs on the same or on different channels * * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4 * => allows a STA plus three P2P interfaces * * The list of these four possibilities could completely be contained * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate * that any of these groups must match. * * "Combinations" of just a single interface will not be listed here, * a single interface of any valid interface type is assumed to always * be possible by itself. This means that implicitly, for each valid * interface type, the following group always exists: * numbers = [ #{<type>} <= 1 ], channels = 1, max = 1 */ enum nl80211_if_combination_attrs { NL80211_IFACE_COMB_UNSPEC, NL80211_IFACE_COMB_LIMITS, NL80211_IFACE_COMB_MAXNUM, NL80211_IFACE_COMB_STA_AP_BI_MATCH, NL80211_IFACE_COMB_NUM_CHANNELS, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, NL80211_IFACE_COMB_BI_MIN_GCD, /* keep last */ NUM_NL80211_IFACE_COMB, MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1 }; /** * enum nl80211_plink_state - state of a mesh peer link finite state machine * * @NL80211_PLINK_LISTEN: initial state, considered the implicit * state of non existent mesh peer links * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to * this mesh peer * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received * from this mesh peer * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been * received from this mesh peer * @NL80211_PLINK_ESTAB: mesh peer link is established * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh * plink are discarded, except for authentication frames * @NUM_NL80211_PLINK_STATES: number of peer link states * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states */ enum nl80211_plink_state { NL80211_PLINK_LISTEN, NL80211_PLINK_OPN_SNT, NL80211_PLINK_OPN_RCVD, NL80211_PLINK_CNF_RCVD, NL80211_PLINK_ESTAB, NL80211_PLINK_HOLDING, NL80211_PLINK_BLOCKED, /* keep last */ NUM_NL80211_PLINK_STATES, MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 }; /** * enum nl80211_plink_action - actions to perform in mesh peers * * @NL80211_PLINK_ACTION_NO_ACTION: perform no action * @NL80211_PLINK_ACTION_OPEN: start mesh peer link establishment * @NL80211_PLINK_ACTION_BLOCK: block traffic from this mesh peer * @NUM_NL80211_PLINK_ACTIONS: number of possible actions */ enum plink_actions { NL80211_PLINK_ACTION_NO_ACTION, NL80211_PLINK_ACTION_OPEN, NL80211_PLINK_ACTION_BLOCK, NUM_NL80211_PLINK_ACTIONS, }; #define NL80211_KCK_LEN 16 #define NL80211_KEK_LEN 16 #define NL80211_KCK_EXT_LEN 24 #define NL80211_KEK_EXT_LEN 32 #define NL80211_KCK_EXT_LEN_32 32 #define NL80211_REPLAY_CTR_LEN 8 /** * enum nl80211_rekey_data - attributes for GTK rekey offload * @__NL80211_REKEY_DATA_INVALID: invalid number for nested attributes * @NL80211_REKEY_DATA_KEK: key encryption key (binary) * @NL80211_REKEY_DATA_KCK: key confirmation key (binary) * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary) * @NL80211_REKEY_DATA_AKM: AKM data (OUI, suite type) * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal) * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal) */ enum nl80211_rekey_data { __NL80211_REKEY_DATA_INVALID, NL80211_REKEY_DATA_KEK, NL80211_REKEY_DATA_KCK, NL80211_REKEY_DATA_REPLAY_CTR, NL80211_REKEY_DATA_AKM, /* keep last */ NUM_NL80211_REKEY_DATA, MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1 }; /** * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in * Beacon frames) * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element * in Beacon frames * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID * element in Beacon frames but zero out each byte in the SSID */ enum nl80211_hidden_ssid { NL80211_HIDDEN_SSID_NOT_IN_USE, NL80211_HIDDEN_SSID_ZERO_LEN, NL80211_HIDDEN_SSID_ZERO_CONTENTS }; /** * enum nl80211_sta_wme_attr - station WME attributes * @__NL80211_STA_WME_INVALID: invalid number for nested attribute * @NL80211_STA_WME_UAPSD_QUEUES: bitmap of uapsd queues. the format * is the same as the AC bitmap in the QoS info field. * @NL80211_STA_WME_MAX_SP: max service period. the format is the same * as the MAX_SP field in the QoS info field (but already shifted down). * @__NL80211_STA_WME_AFTER_LAST: internal * @NL80211_STA_WME_MAX: highest station WME attribute */ enum nl80211_sta_wme_attr { __NL80211_STA_WME_INVALID, NL80211_STA_WME_UAPSD_QUEUES, NL80211_STA_WME_MAX_SP, /* keep last */ __NL80211_STA_WME_AFTER_LAST, NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1 }; /** * enum nl80211_pmksa_candidate_attr - attributes for PMKSA caching candidates * @__NL80211_PMKSA_CANDIDATE_INVALID: invalid number for nested attributes * @NL80211_PMKSA_CANDIDATE_INDEX: candidate index (u32; the smaller, the higher * priority) * @NL80211_PMKSA_CANDIDATE_BSSID: candidate BSSID (6 octets) * @NL80211_PMKSA_CANDIDATE_PREAUTH: RSN pre-authentication supported (flag) * @NUM_NL80211_PMKSA_CANDIDATE: number of PMKSA caching candidate attributes * (internal) * @MAX_NL80211_PMKSA_CANDIDATE: highest PMKSA caching candidate attribute * (internal) */ enum nl80211_pmksa_candidate_attr { __NL80211_PMKSA_CANDIDATE_INVALID, NL80211_PMKSA_CANDIDATE_INDEX, NL80211_PMKSA_CANDIDATE_BSSID, NL80211_PMKSA_CANDIDATE_PREAUTH, /* keep last */ NUM_NL80211_PMKSA_CANDIDATE, MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1 }; /** * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request * @NL80211_TDLS_SETUP: Setup TDLS link * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link */ enum nl80211_tdls_operation { NL80211_TDLS_DISCOVERY_REQ, NL80211_TDLS_SETUP, NL80211_TDLS_TEARDOWN, NL80211_TDLS_ENABLE_LINK, NL80211_TDLS_DISABLE_LINK, }; /** * enum nl80211_ap_sme_features - device-integrated AP features * @NL80211_AP_SME_SA_QUERY_OFFLOAD: SA Query procedures offloaded to driver * when user space indicates support for SA Query procedures offload during * "start ap" with %NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT. */ enum nl80211_ap_sme_features { NL80211_AP_SME_SA_QUERY_OFFLOAD = 1 << 0, }; /** * enum nl80211_feature_flags - device/driver features * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back * TX status to the socket error queue when requested with the * socket option. * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up * the connected inactive stations in AP mode. * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested * to work properly to support receiving regulatory hints from * cellular base stations. * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only * here to reserve the value for API/ABI compatibility) * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station * mode * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan * @NL80211_FEATURE_SCAN_FLUSH: Scan flush is supported * @NL80211_FEATURE_AP_SCAN: Support scanning using an AP vif * @NL80211_FEATURE_VIF_TXPOWER: The driver supports per-vif TX power setting * @NL80211_FEATURE_NEED_OBSS_SCAN: The driver expects userspace to perform * OBSS scans and generate 20/40 BSS coex reports. This flag is used only * for drivers implementing the CONNECT API, for AUTH/ASSOC it is implied. * @NL80211_FEATURE_P2P_GO_CTWIN: P2P GO implementation supports CT Window * setting * @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic * powersave * @NL80211_FEATURE_FULL_AP_CLIENT_STATE: The driver supports full state * transitions for AP clients. Without this flag (and if the driver * doesn't have the AP SME in the device) the driver supports adding * stations only when they're associated and adds them in associated * state (to later be transitioned into authorized), with this flag * they should be added before even sending the authentication reply * and then transitioned into authenticated, associated and authorized * states using station flags. * Note that even for drivers that support this, the default is to add * stations in authenticated/associated state, so to add unauthenticated * stations the authenticated/associated bits have to be set in the mask. * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits * (HT40, VHT 80/160 MHz) if this flag is set * @NL80211_FEATURE_USERSPACE_MPM: This driver supports a userspace Mesh * Peering Management entity which may be implemented by registering for * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is * still generated by the driver. * @NL80211_FEATURE_ACTIVE_MONITOR: This driver supports an active monitor * interface. An active monitor interface behaves like a normal monitor * interface, but gets added to the driver. It ensures that incoming * unicast packets directed at the configured interface address get ACKed. * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic * channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the * lifetime of a BSS. * @NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES: This device adds a DS Parameter * Set IE to probe requests. * @NL80211_FEATURE_WFA_TPC_IE_IN_PROBES: This device adds a WFA TPC Report IE * to probe requests. * @NL80211_FEATURE_QUIET: This device, in client mode, supports Quiet Period * requests sent to it by an AP. * @NL80211_FEATURE_TX_POWER_INSERTION: This device is capable of inserting the * current tx power value into the TPC Report IE in the spectrum * management TPC Report action frame, and in the Radio Measurement Link * Measurement Report action frame. * @NL80211_FEATURE_ACKTO_ESTIMATION: This driver supports dynamic ACK timeout * estimation (dynack). %NL80211_ATTR_WIPHY_DYN_ACK flag attribute is used * to enable dynack. * @NL80211_FEATURE_STATIC_SMPS: Device supports static spatial * multiplexing powersave, ie. can turn off all but one chain * even on HT connections that should be using more chains. * @NL80211_FEATURE_DYNAMIC_SMPS: Device supports dynamic spatial * multiplexing powersave, ie. can turn off all but one chain * and then wake the rest up as required after, for example, * rts/cts handshake. * @NL80211_FEATURE_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM * TSPEC sessions (TID aka TSID 0-7) with the %NL80211_CMD_ADD_TX_TS * command. Standard IEEE 802.11 TSPEC setup is not yet supported, it * needs to be able to handle Block-Ack agreements and other things. * @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring * the vif's MAC address upon creation. * See 'macaddr' field in the vif_params (cfg80211.h). * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when * operating as a TDLS peer. * @NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR: This device/driver supports using a * random MAC address during scan (if the device is unassociated); the * %NL80211_SCAN_FLAG_RANDOM_ADDR flag may be set for scans and the MAC * address mask/value will be used. * @NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR: This device/driver supports * using a random MAC address for every scan iteration during scheduled * scan (while not associated), the %NL80211_SCAN_FLAG_RANDOM_ADDR may * be set for scheduled scan and the MAC address mask/value will be used. * @NL80211_FEATURE_ND_RANDOM_MAC_ADDR: This device/driver supports using a * random MAC address for every scan iteration during "net detect", i.e. * scan in unassociated WoWLAN, the %NL80211_SCAN_FLAG_RANDOM_ADDR may * be set for scheduled scan and the MAC address mask/value will be used. */ enum nl80211_feature_flags { NL80211_FEATURE_SK_TX_STATUS = 1 << 0, NL80211_FEATURE_HT_IBSS = 1 << 1, NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4, NL80211_FEATURE_SAE = 1 << 5, NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6, NL80211_FEATURE_SCAN_FLUSH = 1 << 7, NL80211_FEATURE_AP_SCAN = 1 << 8, NL80211_FEATURE_VIF_TXPOWER = 1 << 9, NL80211_FEATURE_NEED_OBSS_SCAN = 1 << 10, NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11, NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12, /* bit 13 is reserved */ NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14, NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, NL80211_FEATURE_USERSPACE_MPM = 1 << 16, NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17, NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = 1 << 18, NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES = 1 << 19, NL80211_FEATURE_WFA_TPC_IE_IN_PROBES = 1 << 20, NL80211_FEATURE_QUIET = 1 << 21, NL80211_FEATURE_TX_POWER_INSERTION = 1 << 22, NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23, NL80211_FEATURE_STATIC_SMPS = 1 << 24, NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25, NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26, NL80211_FEATURE_MAC_ON_CREATE = 1 << 27, NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28, NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29, NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30, NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31, }; /** * enum nl80211_ext_feature_index - bit index of extended features. * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates. * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can * request to use RRM (see %NL80211_ATTR_USE_RRM) with * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set * the ASSOC_REQ_USE_RRM flag in the association request even if * NL80211_FEATURE_QUIET is not advertized. * @NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER: This device supports MU-MIMO air * sniffer which means that it can be configured to hear packets from * certain groups which can be configured by the * %NL80211_ATTR_MU_MIMO_GROUP_DATA attribute, * or can be configured to follow a station by configuring the * %NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR attribute. * @NL80211_EXT_FEATURE_SCAN_START_TIME: This driver includes the actual * time the scan started in scan results event. The time is the TSF of * the BSS that the interface that requested the scan is connected to * (if available). * @NL80211_EXT_FEATURE_BSS_PARENT_TSF: Per BSS, this driver reports the * time the last beacon/probe was received. The time is the TSF of the * BSS that the interface that requested the scan is connected to * (if available). * @NL80211_EXT_FEATURE_SET_SCAN_DWELL: This driver supports configuration of * channel dwell time. * @NL80211_EXT_FEATURE_BEACON_RATE_LEGACY: Driver supports beacon rate * configuration (AP/mesh), supporting a legacy (non HT/VHT) rate. * @NL80211_EXT_FEATURE_BEACON_RATE_HT: Driver supports beacon rate * configuration (AP/mesh) with HT rates. * @NL80211_EXT_FEATURE_BEACON_RATE_VHT: Driver supports beacon rate * configuration (AP/mesh) with VHT rates. * @NL80211_EXT_FEATURE_FILS_STA: This driver supports Fast Initial Link Setup * with user space SME (NL80211_CMD_AUTHENTICATE) in station mode. * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA: This driver supports randomized TA * in @NL80211_CMD_FRAME while not associated. * @NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED: This driver supports * randomized TA in @NL80211_CMD_FRAME while associated. * @NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI: The driver supports sched_scan * for reporting BSSs with better RSSI than the current connected BSS * (%NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI). * @NL80211_EXT_FEATURE_CQM_RSSI_LIST: With this driver the * %NL80211_ATTR_CQM_RSSI_THOLD attribute accepts a list of zero or more * RSSI threshold values to monitor rather than exactly one threshold. * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS shared key * authentication with %NL80211_CMD_CONNECT. * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK: Device wants to do 4-way * handshake with PSK in station mode (PSK is passed as part of the connect * and associate commands), doing it in the host might not be supported. * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X: Device wants to do doing 4-way * handshake with 802.1X in station mode (will pass EAP frames to the host * and accept the set_pmk/del_pmk commands), doing it in the host might not * be supported. * @NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME: Driver is capable of overriding * the max channel attribute in the FILS request params IE with the * actual dwell time. * @NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP: Driver accepts broadcast probe * response * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE: Driver supports sending * the first probe request in each channel at rate of at least 5.5Mbps. * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: Driver supports * probe request tx deferral and suppression * @NL80211_EXT_FEATURE_MFP_OPTIONAL: Driver supports the %NL80211_MFP_OPTIONAL * value in %NL80211_ATTR_USE_MFP. * @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan. * @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan. * @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan. * @NL80211_EXT_FEATURE_DFS_OFFLOAD: HW/driver will offload DFS actions. * Device or driver will do all DFS-related actions by itself, * informing user-space about CAC progress, radar detection event, * channel change triggered by radar detection event. * No need to start CAC from user-space, no need to react to * "radar detected" event. * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211: Driver supports sending and * receiving control port frames over nl80211 instead of the netdevice. * @NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT: This driver/device supports * (average) ACK signal strength reporting. * @NL80211_EXT_FEATURE_TXQS: Driver supports FQ-CoDel-enabled intermediate * TXQs. * @NL80211_EXT_FEATURE_SCAN_RANDOM_SN: Driver/device supports randomizing the * SN in probe request frames if requested by %NL80211_SCAN_FLAG_RANDOM_SN. * @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data * except for supported rates from the probe request content if requested * by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag. * @NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER: Driver supports enabling fine * timing measurement responder role. * * @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0: Driver/device confirm that they are * able to rekey an in-use key correctly. Userspace must not rekey PTK keys * if this flag is not set. Ignoring this can leak clear text packets and/or * freeze the connection. * @NL80211_EXT_FEATURE_EXT_KEY_ID: Driver supports "Extended Key ID for * Individually Addressed Frames" from IEEE802.11-2016. * * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime * fairness for transmitted packets and has enabled airtime fairness * scheduling. * * @NL80211_EXT_FEATURE_AP_PMKSA_CACHING: Driver/device supports PMKSA caching * (set/del PMKSA operations) in AP mode. * * @NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD: Driver supports * filtering of sched scan results using band specific RSSI thresholds. * * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power * to a station. * * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in * station mode (SAE password is passed as part of the connect command). * * @NL80211_EXT_FEATURE_VLAN_OFFLOAD: The driver supports a single netdev * with VLAN tagged frames and separate VLAN-specific netdevs added using * vconfig similarly to the Ethernet case. * * @NL80211_EXT_FEATURE_AQL: The driver supports the Airtime Queue Limit (AQL) * feature, which prevents bufferbloat by using the expected transmission * time to limit the amount of data buffered in the hardware. * * @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection * and can receive key configuration for BIGTK using key indexes 6 and 7. * @NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT: The driver supports Beacon * protection as a client only and cannot transmit protected beacons. * * @NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH: The driver can disable the * forwarding of preauth frames over the control port. They are then * handled as ordinary data frames. * * @NL80211_EXT_FEATURE_PROTECTED_TWT: Driver supports protected TWT frames * * @NL80211_EXT_FEATURE_DEL_IBSS_STA: The driver supports removing stations * in IBSS mode, essentially by dropping their state. * * @NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS: management frame registrations * are possible for multicast frames and those will be reported properly. * * @NL80211_EXT_FEATURE_SCAN_FREQ_KHZ: This driver supports receiving and * reporting scan request with %NL80211_ATTR_SCAN_FREQ_KHZ. In order to * report %NL80211_ATTR_SCAN_FREQ_KHZ, %NL80211_SCAN_FLAG_FREQ_KHZ must be * included in the scan request. * * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS: The driver * can report tx status for control port over nl80211 tx operations. * * @NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION: Driver supports Operating * Channel Validation (OCV) when using driver's SME for RSNA handshakes. * * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK: Device wants to do 4-way * handshake with PSK in AP mode (PSK is passed as part of the start AP * command). * * @NL80211_EXT_FEATURE_SAE_OFFLOAD_AP: Device wants to do SAE authentication * in AP mode (SAE password is passed as part of the start AP command). * * @NL80211_EXT_FEATURE_FILS_DISCOVERY: Driver/device supports FILS discovery * frames transmission * * @NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP: Driver/device supports * unsolicited broadcast probe response transmission * * @NL80211_EXT_FEATURE_BEACON_RATE_HE: Driver supports beacon rate * configuration (AP/mesh) with HE rates. * * @NL80211_EXT_FEATURE_SECURE_LTF: Device supports secure LTF measurement * exchange protocol. * * @NL80211_EXT_FEATURE_SECURE_RTT: Device supports secure RTT measurement * exchange protocol. * * @NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE: Device supports management * frame protection for all management frames exchanged during the * negotiation and range measurement procedure. * * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision * detection and change announcemnts. * * @NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD: Driver running in AP mode supports * FILS encryption and decryption for (Re)Association Request and Response * frames. Userspace has to share FILS AAD details to the driver by using * @NL80211_CMD_SET_FILS_AAD. * * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC * detection. * * @NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE: Device can perform a MAC address * change without having to bring the underlying network device down * first. For example, in station mode this can be used to vary the * origin MAC address prior to a connection to a new AP for privacy * or other reasons. Note that certain driver specific restrictions * might apply, e.g. no scans in progress, no offchannel operations * in progress, and no active connections. * * @NL80211_EXT_FEATURE_PUNCT: Driver supports preamble puncturing in AP mode. * * @NL80211_EXT_FEATURE_SECURE_NAN: Device supports NAN Pairing which enables * authentication, data encryption and message integrity. * * @NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA: Device supports randomized TA * in authentication and deauthentication frames sent to unassociated peer * using @NL80211_CMD_FRAME. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_VHT_IBSS, NL80211_EXT_FEATURE_RRM, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER, NL80211_EXT_FEATURE_SCAN_START_TIME, NL80211_EXT_FEATURE_BSS_PARENT_TSF, NL80211_EXT_FEATURE_SET_SCAN_DWELL, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, NL80211_EXT_FEATURE_BEACON_RATE_HT, NL80211_EXT_FEATURE_BEACON_RATE_VHT, NL80211_EXT_FEATURE_FILS_STA, NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA, NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED, NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI, NL80211_EXT_FEATURE_CQM_RSSI_LIST, NL80211_EXT_FEATURE_FILS_SK_OFFLOAD, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X, NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME, NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP, NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE, NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION, NL80211_EXT_FEATURE_MFP_OPTIONAL, NL80211_EXT_FEATURE_LOW_SPAN_SCAN, NL80211_EXT_FEATURE_LOW_POWER_SCAN, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN, NL80211_EXT_FEATURE_DFS_OFFLOAD, NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT, /* we renamed this - stay compatible */ NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT = NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT, NL80211_EXT_FEATURE_TXQS, NL80211_EXT_FEATURE_SCAN_RANDOM_SN, NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS, NL80211_EXT_FEATURE_AP_PMKSA_CACHING, NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD, NL80211_EXT_FEATURE_EXT_KEY_ID, NL80211_EXT_FEATURE_STA_TX_PWR, NL80211_EXT_FEATURE_SAE_OFFLOAD, NL80211_EXT_FEATURE_VLAN_OFFLOAD, NL80211_EXT_FEATURE_AQL, NL80211_EXT_FEATURE_BEACON_PROTECTION, NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH, NL80211_EXT_FEATURE_PROTECTED_TWT, NL80211_EXT_FEATURE_DEL_IBSS_STA, NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS, NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT, NL80211_EXT_FEATURE_SCAN_FREQ_KHZ, NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS, NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK, NL80211_EXT_FEATURE_SAE_OFFLOAD_AP, NL80211_EXT_FEATURE_FILS_DISCOVERY, NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, NL80211_EXT_FEATURE_BEACON_RATE_HE, NL80211_EXT_FEATURE_SECURE_LTF, NL80211_EXT_FEATURE_SECURE_RTT, NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, NL80211_EXT_FEATURE_BSS_COLOR, NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD, NL80211_EXT_FEATURE_RADAR_BACKGROUND, NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE, NL80211_EXT_FEATURE_PUNCT, NL80211_EXT_FEATURE_SECURE_NAN, NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1 }; /** * enum nl80211_probe_resp_offload_support_attr - optional supported * protocols for probe-response offloading by the driver/FW. * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute. * Each enum value represents a bit in the bitmap of supported * protocols. Typically a subset of probe-requests belonging to a * supported protocol will be excluded from offload and uploaded * to the host. * * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u */ enum nl80211_probe_resp_offload_support_attr { NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2, NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3, }; /** * enum nl80211_connect_failed_reason - connection request failed reasons * @NL80211_CONN_FAIL_MAX_CLIENTS: Maximum number of clients that can be * handled by the AP is reached. * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Connection request is rejected due to ACL. */ enum nl80211_connect_failed_reason { NL80211_CONN_FAIL_MAX_CLIENTS, NL80211_CONN_FAIL_BLOCKED_CLIENT, }; /** * enum nl80211_timeout_reason - timeout reasons * * @NL80211_TIMEOUT_UNSPECIFIED: Timeout reason unspecified. * @NL80211_TIMEOUT_SCAN: Scan (AP discovery) timed out. * @NL80211_TIMEOUT_AUTH: Authentication timed out. * @NL80211_TIMEOUT_ASSOC: Association timed out. */ enum nl80211_timeout_reason { NL80211_TIMEOUT_UNSPECIFIED, NL80211_TIMEOUT_SCAN, NL80211_TIMEOUT_AUTH, NL80211_TIMEOUT_ASSOC, }; /** * enum nl80211_scan_flags - scan request control flags * * Scan request control flags are used to control the handling * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN * requests. * * NL80211_SCAN_FLAG_LOW_SPAN, NL80211_SCAN_FLAG_LOW_POWER, and * NL80211_SCAN_FLAG_HIGH_ACCURACY flags are exclusive of each other, i.e., only * one of them can be used in the request. * * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is configured * as AP and the beaconing has already been configured. This attribute is * dangerous because will destroy stations performance as a lot of frames * will be lost while scanning off-channel, therefore it must be used only * when really needed * @NL80211_SCAN_FLAG_RANDOM_ADDR: use a random MAC address for this scan (or * for scheduled scan: a different one for every scan iteration). When the * flag is set, depending on device capabilities the @NL80211_ATTR_MAC and * @NL80211_ATTR_MAC_MASK attributes may also be given in which case only * the masked bits will be preserved from the MAC address and the remainder * randomised. If the attributes are not given full randomisation (46 bits, * locally administered 1, multicast 0) is assumed. * This flag must not be requested when the feature isn't supported, check * the nl80211 feature flags for the device. * @NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME: fill the dwell time in the FILS * request parameters IE in the probe request * @NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP: accept broadcast probe responses * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE: send probe request frames at * rate of at least 5.5M. In case non OCE AP is discovered in the channel, * only the first probe req in the channel will be sent in high rate. * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: allow probe request * tx deferral (dot11FILSProbeDelay shall be set to 15ms) * and suppression (if it has received a broadcast Probe Response frame, * Beacon frame or FILS Discovery frame from an AP that the STA considers * a suitable candidate for (re-)association - suitable in terms of * SSID and/or RSSI. * @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time taken to * accomplish the scan. Thus, this flag intends the driver to perform the * scan request with lesser span/duration. It is specific to the driver * implementations on how this is accomplished. Scan accuracy may get * impacted with this flag. * @NL80211_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts to consume * optimal possible power. Drivers can resort to their specific means to * optimize the power. Scan accuracy may get impacted with this flag. * @NL80211_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the extent of scan * results obtained. Thus HIGH_ACCURACY scan flag aims to get maximum * possible scan results. This flag hints the driver to use the best * possible scan configuration to improve the accuracy in scanning. * Latency and power use may get impacted with this flag. * @NL80211_SCAN_FLAG_RANDOM_SN: randomize the sequence number in probe * request frames from this scan to avoid correlation/tracking being * possible. * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to * only have supported rates and no additional capabilities (unless * added by userspace explicitly.) * @NL80211_SCAN_FLAG_FREQ_KHZ: report scan results with * %NL80211_ATTR_SCAN_FREQ_KHZ. This also means * %NL80211_ATTR_SCAN_FREQUENCIES will not be included. * @NL80211_SCAN_FLAG_COLOCATED_6GHZ: scan for collocated APs reported by * 2.4/5 GHz APs. When the flag is set, the scan logic will use the * information from the RNR element found in beacons/probe responses * received on the 2.4/5 GHz channels to actively scan only the 6GHz * channels on which APs are expected to be found. Note that when not set, * the scan logic would scan all 6GHz channels, but since transmission of * probe requests on non PSC channels is limited, it is highly likely that * these channels would passively be scanned. Also note that when the flag * is set, in addition to the colocated APs, PSC channels would also be * scanned if the user space has asked for it. */ enum nl80211_scan_flags { NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, NL80211_SCAN_FLAG_FLUSH = 1<<1, NL80211_SCAN_FLAG_AP = 1<<2, NL80211_SCAN_FLAG_RANDOM_ADDR = 1<<3, NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME = 1<<4, NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP = 1<<5, NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE = 1<<6, NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = 1<<7, NL80211_SCAN_FLAG_LOW_SPAN = 1<<8, NL80211_SCAN_FLAG_LOW_POWER = 1<<9, NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10, NL80211_SCAN_FLAG_RANDOM_SN = 1<<11, NL80211_SCAN_FLAG_MIN_PREQ_CONTENT = 1<<12, NL80211_SCAN_FLAG_FREQ_KHZ = 1<<13, NL80211_SCAN_FLAG_COLOCATED_6GHZ = 1<<14, }; /** * enum nl80211_acl_policy - access control policy * * Access control policy is applied on a MAC list set by * %NL80211_CMD_START_AP and %NL80211_CMD_SET_MAC_ACL, to * be used with %NL80211_ATTR_ACL_POLICY. * * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are * listed in ACL, i.e. allow all the stations which are not listed * in ACL to authenticate. * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow the stations which are listed * in ACL, i.e. deny all the stations which are not listed in ACL. */ enum nl80211_acl_policy { NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED, NL80211_ACL_POLICY_DENY_UNLESS_LISTED, }; /** * enum nl80211_smps_mode - SMPS mode * * Requested SMPS mode (for AP mode) * * @NL80211_SMPS_OFF: SMPS off (use all antennas). * @NL80211_SMPS_STATIC: static SMPS (use a single antenna) * @NL80211_SMPS_DYNAMIC: dynamic smps (start with a single antenna and * turn on other antennas after CTS/RTS). */ enum nl80211_smps_mode { NL80211_SMPS_OFF, NL80211_SMPS_STATIC, NL80211_SMPS_DYNAMIC, __NL80211_SMPS_AFTER_LAST, NL80211_SMPS_MAX = __NL80211_SMPS_AFTER_LAST - 1 }; /** * enum nl80211_radar_event - type of radar event for DFS operation * * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace * about detected radars or success of the channel available check (CAC) * * @NL80211_RADAR_DETECTED: A radar pattern has been detected. The channel is * now unusable. * @NL80211_RADAR_CAC_FINISHED: Channel Availability Check has been finished, * the channel is now available. * @NL80211_RADAR_CAC_ABORTED: Channel Availability Check has been aborted, no * change to the channel status. * @NL80211_RADAR_NOP_FINISHED: The Non-Occupancy Period for this channel is * over, channel becomes usable. * @NL80211_RADAR_PRE_CAC_EXPIRED: Channel Availability Check done on this * non-operating channel is expired and no longer valid. New CAC must * be done on this channel before starting the operation. This is not * applicable for ETSI dfs domain where pre-CAC is valid for ever. * @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started, * should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled. */ enum nl80211_radar_event { NL80211_RADAR_DETECTED, NL80211_RADAR_CAC_FINISHED, NL80211_RADAR_CAC_ABORTED, NL80211_RADAR_NOP_FINISHED, NL80211_RADAR_PRE_CAC_EXPIRED, NL80211_RADAR_CAC_STARTED, }; /** * enum nl80211_dfs_state - DFS states for channels * * Channel states used by the DFS code. * * @NL80211_DFS_USABLE: The channel can be used, but channel availability * check (CAC) must be performed before using it for AP or IBSS. * @NL80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it * is therefore marked as not available. * @NL80211_DFS_AVAILABLE: The channel has been CAC checked and is available. */ enum nl80211_dfs_state { NL80211_DFS_USABLE, NL80211_DFS_UNAVAILABLE, NL80211_DFS_AVAILABLE, }; /** * enum nl80211_protocol_features - nl80211 protocol features * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting * wiphy dumps (if requested by the application with the attribute * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the * wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or * %NL80211_ATTR_WDEV. */ enum nl80211_protocol_features { NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP = 1 << 0, }; /** * enum nl80211_crit_proto_id - nl80211 critical protocol identifiers * * @NL80211_CRIT_PROTO_UNSPEC: protocol unspecified. * @NL80211_CRIT_PROTO_DHCP: BOOTP or DHCPv6 protocol. * @NL80211_CRIT_PROTO_EAPOL: EAPOL protocol. * @NL80211_CRIT_PROTO_APIPA: APIPA protocol. * @NUM_NL80211_CRIT_PROTO: must be kept last. */ enum nl80211_crit_proto_id { NL80211_CRIT_PROTO_UNSPEC, NL80211_CRIT_PROTO_DHCP, NL80211_CRIT_PROTO_EAPOL, NL80211_CRIT_PROTO_APIPA, /* add other protocols before this one */ NUM_NL80211_CRIT_PROTO }; /* maximum duration for critical protocol measures */ #define NL80211_CRIT_PROTO_MAX_DURATION 5000 /* msec */ /** * enum nl80211_rxmgmt_flags - flags for received management frame. * * Used by cfg80211_rx_mgmt() * * @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver. * @NL80211_RXMGMT_FLAG_EXTERNAL_AUTH: Host driver intends to offload * the authentication. Exclusively defined for host drivers that * advertises the SME functionality but would like the userspace * to handle certain authentication algorithms (e.g. SAE). */ enum nl80211_rxmgmt_flags { NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0, NL80211_RXMGMT_FLAG_EXTERNAL_AUTH = 1 << 1, }; /* * If this flag is unset, the lower 24 bits are an OUI, if set * a Linux nl80211 vendor ID is used (no such IDs are allocated * yet, so that's not valid so far) */ #define NL80211_VENDOR_ID_IS_LINUX 0x80000000 /** * struct nl80211_vendor_cmd_info - vendor command data * @vendor_id: If the %NL80211_VENDOR_ID_IS_LINUX flag is clear, then the * value is a 24-bit OUI; if it is set then a separately allocated ID * may be used, but no such IDs are allocated yet. New IDs should be * added to this file when needed. * @subcmd: sub-command ID for the command */ struct nl80211_vendor_cmd_info { __u32 vendor_id; __u32 subcmd; }; /** * enum nl80211_tdls_peer_capability - TDLS peer flags. * * Used by tdls_mgmt() to determine which conditional elements need * to be added to TDLS Setup frames. * * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable. * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable. * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable. * @NL80211_TDLS_PEER_HE: TDLS peer is HE capable. */ enum nl80211_tdls_peer_capability { NL80211_TDLS_PEER_HT = 1<<0, NL80211_TDLS_PEER_VHT = 1<<1, NL80211_TDLS_PEER_WMM = 1<<2, NL80211_TDLS_PEER_HE = 1<<3, }; /** * enum nl80211_sched_scan_plan - scanning plan for scheduled scan * @__NL80211_SCHED_SCAN_PLAN_INVALID: attribute number 0 is reserved * @NL80211_SCHED_SCAN_PLAN_INTERVAL: interval between scan iterations. In * seconds (u32). * @NL80211_SCHED_SCAN_PLAN_ITERATIONS: number of scan iterations in this * scan plan (u32). The last scan plan must not specify this attribute * because it will run infinitely. A value of zero is invalid as it will * make the scan plan meaningless. * @NL80211_SCHED_SCAN_PLAN_MAX: highest scheduled scan plan attribute number * currently defined * @__NL80211_SCHED_SCAN_PLAN_AFTER_LAST: internal use */ enum nl80211_sched_scan_plan { __NL80211_SCHED_SCAN_PLAN_INVALID, NL80211_SCHED_SCAN_PLAN_INTERVAL, NL80211_SCHED_SCAN_PLAN_ITERATIONS, /* keep last */ __NL80211_SCHED_SCAN_PLAN_AFTER_LAST, NL80211_SCHED_SCAN_PLAN_MAX = __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1 }; /** * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters. * * @band: band of BSS that must match for RSSI value adjustment. The value * of this field is according to &enum nl80211_band. * @delta: value used to adjust the RSSI value of matching BSS in dB. */ struct nl80211_bss_select_rssi_adjust { __u8 band; __s8 delta; } __attribute__((packed)); /** * enum nl80211_bss_select_attr - attributes for bss selection. * * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved. * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection * is requested. * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS * selection should be done such that the specified band is preferred. * When there are multiple BSS-es in the preferred band, the driver * shall use RSSI-based BSS selection as a second step. The value of * this attribute is according to &enum nl80211_band (u32). * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for * BSS-es in the specified band is to be adjusted before doing * RSSI-based BSS selection. The attribute value is a packed structure * value as specified by &struct nl80211_bss_select_rssi_adjust. * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number. * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use. * * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour * which the driver shall use. */ enum nl80211_bss_select_attr { __NL80211_BSS_SELECT_ATTR_INVALID, NL80211_BSS_SELECT_ATTR_RSSI, NL80211_BSS_SELECT_ATTR_BAND_PREF, NL80211_BSS_SELECT_ATTR_RSSI_ADJUST, /* keep last */ __NL80211_BSS_SELECT_ATTR_AFTER_LAST, NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1 }; /** * enum nl80211_nan_function_type - NAN function type * * Defines the function type of a NAN function * * @NL80211_NAN_FUNC_PUBLISH: function is publish * @NL80211_NAN_FUNC_SUBSCRIBE: function is subscribe * @NL80211_NAN_FUNC_FOLLOW_UP: function is follow-up */ enum nl80211_nan_function_type { NL80211_NAN_FUNC_PUBLISH, NL80211_NAN_FUNC_SUBSCRIBE, NL80211_NAN_FUNC_FOLLOW_UP, /* keep last */ __NL80211_NAN_FUNC_TYPE_AFTER_LAST, NL80211_NAN_FUNC_MAX_TYPE = __NL80211_NAN_FUNC_TYPE_AFTER_LAST - 1, }; /** * enum nl80211_nan_publish_type - NAN publish tx type * * Defines how to send publish Service Discovery Frames * * @NL80211_NAN_SOLICITED_PUBLISH: publish function is solicited * @NL80211_NAN_UNSOLICITED_PUBLISH: publish function is unsolicited */ enum nl80211_nan_publish_type { NL80211_NAN_SOLICITED_PUBLISH = 1 << 0, NL80211_NAN_UNSOLICITED_PUBLISH = 1 << 1, }; /** * enum nl80211_nan_func_term_reason - NAN functions termination reason * * Defines termination reasons of a NAN function * * @NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST: requested by user * @NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED: timeout * @NL80211_NAN_FUNC_TERM_REASON_ERROR: errored */ enum nl80211_nan_func_term_reason { NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST, NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED, NL80211_NAN_FUNC_TERM_REASON_ERROR, }; #define NL80211_NAN_FUNC_SERVICE_ID_LEN 6 #define NL80211_NAN_FUNC_SERVICE_SPEC_INFO_MAX_LEN 0xff #define NL80211_NAN_FUNC_SRF_MAX_LEN 0xff /** * enum nl80211_nan_func_attributes - NAN function attributes * @__NL80211_NAN_FUNC_INVALID: invalid * @NL80211_NAN_FUNC_TYPE: &enum nl80211_nan_function_type (u8). * @NL80211_NAN_FUNC_SERVICE_ID: 6 bytes of the service ID hash as * specified in NAN spec. This is a binary attribute. * @NL80211_NAN_FUNC_PUBLISH_TYPE: relevant if the function's type is * publish. Defines the transmission type for the publish Service Discovery * Frame, see &enum nl80211_nan_publish_type. Its type is u8. * @NL80211_NAN_FUNC_PUBLISH_BCAST: relevant if the function is a solicited * publish. Should the solicited publish Service Discovery Frame be sent to * the NAN Broadcast address. This is a flag. * @NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE: relevant if the function's type is * subscribe. Is the subscribe active. This is a flag. * @NL80211_NAN_FUNC_FOLLOW_UP_ID: relevant if the function's type is follow up. * The instance ID for the follow up Service Discovery Frame. This is u8. * @NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID: relevant if the function's type * is follow up. This is a u8. * The requestor instance ID for the follow up Service Discovery Frame. * @NL80211_NAN_FUNC_FOLLOW_UP_DEST: the MAC address of the recipient of the * follow up Service Discovery Frame. This is a binary attribute. * @NL80211_NAN_FUNC_CLOSE_RANGE: is this function limited for devices in a * close range. The range itself (RSSI) is defined by the device. * This is a flag. * @NL80211_NAN_FUNC_TTL: strictly positive number of DWs this function should * stay active. If not present infinite TTL is assumed. This is a u32. * @NL80211_NAN_FUNC_SERVICE_INFO: array of bytes describing the service * specific info. This is a binary attribute. * @NL80211_NAN_FUNC_SRF: Service Receive Filter. This is a nested attribute. * See &enum nl80211_nan_srf_attributes. * @NL80211_NAN_FUNC_RX_MATCH_FILTER: Receive Matching filter. This is a nested * attribute. It is a list of binary values. * @NL80211_NAN_FUNC_TX_MATCH_FILTER: Transmit Matching filter. This is a * nested attribute. It is a list of binary values. * @NL80211_NAN_FUNC_INSTANCE_ID: The instance ID of the function. * Its type is u8 and it cannot be 0. * @NL80211_NAN_FUNC_TERM_REASON: NAN function termination reason. * See &enum nl80211_nan_func_term_reason. * * @NUM_NL80211_NAN_FUNC_ATTR: internal * @NL80211_NAN_FUNC_ATTR_MAX: highest NAN function attribute */ enum nl80211_nan_func_attributes { __NL80211_NAN_FUNC_INVALID, NL80211_NAN_FUNC_TYPE, NL80211_NAN_FUNC_SERVICE_ID, NL80211_NAN_FUNC_PUBLISH_TYPE, NL80211_NAN_FUNC_PUBLISH_BCAST, NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE, NL80211_NAN_FUNC_FOLLOW_UP_ID, NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID, NL80211_NAN_FUNC_FOLLOW_UP_DEST, NL80211_NAN_FUNC_CLOSE_RANGE, NL80211_NAN_FUNC_TTL, NL80211_NAN_FUNC_SERVICE_INFO, NL80211_NAN_FUNC_SRF, NL80211_NAN_FUNC_RX_MATCH_FILTER, NL80211_NAN_FUNC_TX_MATCH_FILTER, NL80211_NAN_FUNC_INSTANCE_ID, NL80211_NAN_FUNC_TERM_REASON, /* keep last */ NUM_NL80211_NAN_FUNC_ATTR, NL80211_NAN_FUNC_ATTR_MAX = NUM_NL80211_NAN_FUNC_ATTR - 1 }; /** * enum nl80211_nan_srf_attributes - NAN Service Response filter attributes * @__NL80211_NAN_SRF_INVALID: invalid * @NL80211_NAN_SRF_INCLUDE: present if the include bit of the SRF set. * This is a flag. * @NL80211_NAN_SRF_BF: Bloom Filter. Present if and only if * %NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary. * @NL80211_NAN_SRF_BF_IDX: index of the Bloom Filter. Mandatory if * %NL80211_NAN_SRF_BF is present. This is a u8. * @NL80211_NAN_SRF_MAC_ADDRS: list of MAC addresses for the SRF. Present if * and only if %NL80211_NAN_SRF_BF isn't present. This is a nested * attribute. Each nested attribute is a MAC address. * @NUM_NL80211_NAN_SRF_ATTR: internal * @NL80211_NAN_SRF_ATTR_MAX: highest NAN SRF attribute */ enum nl80211_nan_srf_attributes { __NL80211_NAN_SRF_INVALID, NL80211_NAN_SRF_INCLUDE, NL80211_NAN_SRF_BF, NL80211_NAN_SRF_BF_IDX, NL80211_NAN_SRF_MAC_ADDRS, /* keep last */ NUM_NL80211_NAN_SRF_ATTR, NL80211_NAN_SRF_ATTR_MAX = NUM_NL80211_NAN_SRF_ATTR - 1, }; /** * enum nl80211_nan_match_attributes - NAN match attributes * @__NL80211_NAN_MATCH_INVALID: invalid * @NL80211_NAN_MATCH_FUNC_LOCAL: the local function that had the * match. This is a nested attribute. * See &enum nl80211_nan_func_attributes. * @NL80211_NAN_MATCH_FUNC_PEER: the peer function * that caused the match. This is a nested attribute. * See &enum nl80211_nan_func_attributes. * * @NUM_NL80211_NAN_MATCH_ATTR: internal * @NL80211_NAN_MATCH_ATTR_MAX: highest NAN match attribute */ enum nl80211_nan_match_attributes { __NL80211_NAN_MATCH_INVALID, NL80211_NAN_MATCH_FUNC_LOCAL, NL80211_NAN_MATCH_FUNC_PEER, /* keep last */ NUM_NL80211_NAN_MATCH_ATTR, NL80211_NAN_MATCH_ATTR_MAX = NUM_NL80211_NAN_MATCH_ATTR - 1 }; /** * nl80211_external_auth_action - Action to perform with external * authentication request. Used by NL80211_ATTR_EXTERNAL_AUTH_ACTION. * @NL80211_EXTERNAL_AUTH_START: Start the authentication. * @NL80211_EXTERNAL_AUTH_ABORT: Abort the ongoing authentication. */ enum nl80211_external_auth_action { NL80211_EXTERNAL_AUTH_START, NL80211_EXTERNAL_AUTH_ABORT, }; /** * enum nl80211_ftm_responder_attributes - fine timing measurement * responder attributes * @__NL80211_FTM_RESP_ATTR_INVALID: Invalid * @NL80211_FTM_RESP_ATTR_ENABLED: FTM responder is enabled * @NL80211_FTM_RESP_ATTR_LCI: The content of Measurement Report Element * (9.4.2.22 in 802.11-2016) with type 8 - LCI (9.4.2.22.10), * i.e. starting with the measurement token * @NL80211_FTM_RESP_ATTR_CIVIC: The content of Measurement Report Element * (9.4.2.22 in 802.11-2016) with type 11 - Civic (Section 9.4.2.22.13), * i.e. starting with the measurement token * @__NL80211_FTM_RESP_ATTR_LAST: Internal * @NL80211_FTM_RESP_ATTR_MAX: highest FTM responder attribute. */ enum nl80211_ftm_responder_attributes { __NL80211_FTM_RESP_ATTR_INVALID, NL80211_FTM_RESP_ATTR_ENABLED, NL80211_FTM_RESP_ATTR_LCI, NL80211_FTM_RESP_ATTR_CIVICLOC, /* keep last */ __NL80211_FTM_RESP_ATTR_LAST, NL80211_FTM_RESP_ATTR_MAX = __NL80211_FTM_RESP_ATTR_LAST - 1, }; /* * enum nl80211_ftm_responder_stats - FTM responder statistics * * These attribute types are used with %NL80211_ATTR_FTM_RESPONDER_STATS * when getting FTM responder statistics. * * @__NL80211_FTM_STATS_INVALID: attribute number 0 is reserved * @NL80211_FTM_STATS_SUCCESS_NUM: number of FTM sessions in which all frames * were ssfully answered (u32) * @NL80211_FTM_STATS_PARTIAL_NUM: number of FTM sessions in which part of the * frames were successfully answered (u32) * @NL80211_FTM_STATS_FAILED_NUM: number of failed FTM sessions (u32) * @NL80211_FTM_STATS_ASAP_NUM: number of ASAP sessions (u32) * @NL80211_FTM_STATS_NON_ASAP_NUM: number of non-ASAP sessions (u32) * @NL80211_FTM_STATS_TOTAL_DURATION_MSEC: total sessions durations - gives an * indication of how much time the responder was busy (u64, msec) * @NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM: number of unknown FTM triggers - * triggers from initiators that didn't finish successfully the negotiation * phase with the responder (u32) * @NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM: number of FTM reschedule requests * - initiator asks for a new scheduling although it already has scheduled * FTM slot (u32) * @NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM: number of FTM triggers out of * scheduled window (u32) * @NL80211_FTM_STATS_PAD: used for padding, ignore * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal * @NL80211_FTM_STATS_MAX: highest possible FTM responder stats attribute */ enum nl80211_ftm_responder_stats { __NL80211_FTM_STATS_INVALID, NL80211_FTM_STATS_SUCCESS_NUM, NL80211_FTM_STATS_PARTIAL_NUM, NL80211_FTM_STATS_FAILED_NUM, NL80211_FTM_STATS_ASAP_NUM, NL80211_FTM_STATS_NON_ASAP_NUM, NL80211_FTM_STATS_TOTAL_DURATION_MSEC, NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM, NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM, NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM, NL80211_FTM_STATS_PAD, /* keep last */ __NL80211_FTM_STATS_AFTER_LAST, NL80211_FTM_STATS_MAX = __NL80211_FTM_STATS_AFTER_LAST - 1 }; /** * enum nl80211_preamble - frame preamble types * @NL80211_PREAMBLE_LEGACY: legacy (HR/DSSS, OFDM, ERP PHY) preamble * @NL80211_PREAMBLE_HT: HT preamble * @NL80211_PREAMBLE_VHT: VHT preamble * @NL80211_PREAMBLE_DMG: DMG preamble * @NL80211_PREAMBLE_HE: HE preamble */ enum nl80211_preamble { NL80211_PREAMBLE_LEGACY, NL80211_PREAMBLE_HT, NL80211_PREAMBLE_VHT, NL80211_PREAMBLE_DMG, NL80211_PREAMBLE_HE, }; /** * enum nl80211_peer_measurement_type - peer measurement types * @NL80211_PMSR_TYPE_INVALID: invalid/unused, needed as we use * these numbers also for attributes * * @NL80211_PMSR_TYPE_FTM: flight time measurement * * @NUM_NL80211_PMSR_TYPES: internal * @NL80211_PMSR_TYPE_MAX: highest type number */ enum nl80211_peer_measurement_type { NL80211_PMSR_TYPE_INVALID, NL80211_PMSR_TYPE_FTM, NUM_NL80211_PMSR_TYPES, NL80211_PMSR_TYPE_MAX = NUM_NL80211_PMSR_TYPES - 1 }; /** * enum nl80211_peer_measurement_status - peer measurement status * @NL80211_PMSR_STATUS_SUCCESS: measurement completed successfully * @NL80211_PMSR_STATUS_REFUSED: measurement was locally refused * @NL80211_PMSR_STATUS_TIMEOUT: measurement timed out * @NL80211_PMSR_STATUS_FAILURE: measurement failed, a type-dependent * reason may be available in the response data */ enum nl80211_peer_measurement_status { NL80211_PMSR_STATUS_SUCCESS, NL80211_PMSR_STATUS_REFUSED, NL80211_PMSR_STATUS_TIMEOUT, NL80211_PMSR_STATUS_FAILURE, }; /** * enum nl80211_peer_measurement_req - peer measurement request attributes * @__NL80211_PMSR_REQ_ATTR_INVALID: invalid * * @NL80211_PMSR_REQ_ATTR_DATA: This is a nested attribute with measurement * type-specific request data inside. The attributes used are from the * enums named nl80211_peer_measurement_<type>_req. * @NL80211_PMSR_REQ_ATTR_GET_AP_TSF: include AP TSF timestamp, if supported * (flag attribute) * * @NUM_NL80211_PMSR_REQ_ATTRS: internal * @NL80211_PMSR_REQ_ATTR_MAX: highest attribute number */ enum nl80211_peer_measurement_req { __NL80211_PMSR_REQ_ATTR_INVALID, NL80211_PMSR_REQ_ATTR_DATA, NL80211_PMSR_REQ_ATTR_GET_AP_TSF, /* keep last */ NUM_NL80211_PMSR_REQ_ATTRS, NL80211_PMSR_REQ_ATTR_MAX = NUM_NL80211_PMSR_REQ_ATTRS - 1 }; /** * enum nl80211_peer_measurement_resp - peer measurement response attributes * @__NL80211_PMSR_RESP_ATTR_INVALID: invalid * * @NL80211_PMSR_RESP_ATTR_DATA: This is a nested attribute with measurement * type-specific results inside. The attributes used are from the enums * named nl80211_peer_measurement_<type>_resp. * @NL80211_PMSR_RESP_ATTR_STATUS: u32 value with the measurement status * (using values from &enum nl80211_peer_measurement_status.) * @NL80211_PMSR_RESP_ATTR_HOST_TIME: host time (%CLOCK_BOOTTIME) when the * result was measured; this value is not expected to be accurate to * more than 20ms. (u64, nanoseconds) * @NL80211_PMSR_RESP_ATTR_AP_TSF: TSF of the AP that the interface * doing the measurement is connected to when the result was measured. * This shall be accurately reported if supported and requested * (u64, usec) * @NL80211_PMSR_RESP_ATTR_FINAL: If results are sent to the host partially * (*e.g. with FTM per-burst data) this flag will be cleared on all but * the last result; if all results are combined it's set on the single * result. * @NL80211_PMSR_RESP_ATTR_PAD: padding for 64-bit attributes, ignore * * @NUM_NL80211_PMSR_RESP_ATTRS: internal * @NL80211_PMSR_RESP_ATTR_MAX: highest attribute number */ enum nl80211_peer_measurement_resp { __NL80211_PMSR_RESP_ATTR_INVALID, NL80211_PMSR_RESP_ATTR_DATA, NL80211_PMSR_RESP_ATTR_STATUS, NL80211_PMSR_RESP_ATTR_HOST_TIME, NL80211_PMSR_RESP_ATTR_AP_TSF, NL80211_PMSR_RESP_ATTR_FINAL, NL80211_PMSR_RESP_ATTR_PAD, /* keep last */ NUM_NL80211_PMSR_RESP_ATTRS, NL80211_PMSR_RESP_ATTR_MAX = NUM_NL80211_PMSR_RESP_ATTRS - 1 }; /** * enum nl80211_peer_measurement_peer_attrs - peer attributes for measurement * @__NL80211_PMSR_PEER_ATTR_INVALID: invalid * * @NL80211_PMSR_PEER_ATTR_ADDR: peer's MAC address * @NL80211_PMSR_PEER_ATTR_CHAN: channel definition, nested, using top-level * attributes like %NL80211_ATTR_WIPHY_FREQ etc. * @NL80211_PMSR_PEER_ATTR_REQ: This is a nested attribute indexed by * measurement type, with attributes from the * &enum nl80211_peer_measurement_req inside. * @NL80211_PMSR_PEER_ATTR_RESP: This is a nested attribute indexed by * measurement type, with attributes from the * &enum nl80211_peer_measurement_resp inside. * * @NUM_NL80211_PMSR_PEER_ATTRS: internal * @NL80211_PMSR_PEER_ATTR_MAX: highest attribute number */ enum nl80211_peer_measurement_peer_attrs { __NL80211_PMSR_PEER_ATTR_INVALID, NL80211_PMSR_PEER_ATTR_ADDR, NL80211_PMSR_PEER_ATTR_CHAN, NL80211_PMSR_PEER_ATTR_REQ, NL80211_PMSR_PEER_ATTR_RESP, /* keep last */ NUM_NL80211_PMSR_PEER_ATTRS, NL80211_PMSR_PEER_ATTR_MAX = NUM_NL80211_PMSR_PEER_ATTRS - 1, }; /** * enum nl80211_peer_measurement_attrs - peer measurement attributes * @__NL80211_PMSR_ATTR_INVALID: invalid * * @NL80211_PMSR_ATTR_MAX_PEERS: u32 attribute used for capability * advertisement only, indicates the maximum number of peers * measurements can be done with in a single request * @NL80211_PMSR_ATTR_REPORT_AP_TSF: flag attribute in capability * indicating that the connected AP's TSF can be reported in * measurement results * @NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR: flag attribute in capability * indicating that MAC address randomization is supported. * @NL80211_PMSR_ATTR_TYPE_CAPA: capabilities reported by the device, * this contains a nesting indexed by measurement type, and * type-specific capabilities inside, which are from the enums * named nl80211_peer_measurement_<type>_capa. * @NL80211_PMSR_ATTR_PEERS: nested attribute, the nesting index is * meaningless, just a list of peers to measure with, with the * sub-attributes taken from * &enum nl80211_peer_measurement_peer_attrs. * * @NUM_NL80211_PMSR_ATTR: internal * @NL80211_PMSR_ATTR_MAX: highest attribute number */ enum nl80211_peer_measurement_attrs { __NL80211_PMSR_ATTR_INVALID, NL80211_PMSR_ATTR_MAX_PEERS, NL80211_PMSR_ATTR_REPORT_AP_TSF, NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR, NL80211_PMSR_ATTR_TYPE_CAPA, NL80211_PMSR_ATTR_PEERS, /* keep last */ NUM_NL80211_PMSR_ATTR, NL80211_PMSR_ATTR_MAX = NUM_NL80211_PMSR_ATTR - 1 }; /** * enum nl80211_peer_measurement_ftm_capa - FTM capabilities * @__NL80211_PMSR_FTM_CAPA_ATTR_INVALID: invalid * * @NL80211_PMSR_FTM_CAPA_ATTR_ASAP: flag attribute indicating ASAP mode * is supported * @NL80211_PMSR_FTM_CAPA_ATTR_NON_ASAP: flag attribute indicating non-ASAP * mode is supported * @NL80211_PMSR_FTM_CAPA_ATTR_REQ_LCI: flag attribute indicating if LCI * data can be requested during the measurement * @NL80211_PMSR_FTM_CAPA_ATTR_REQ_CIVICLOC: flag attribute indicating if civic * location data can be requested during the measurement * @NL80211_PMSR_FTM_CAPA_ATTR_PREAMBLES: u32 bitmap attribute of bits * from &enum nl80211_preamble. * @NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS: bitmap of values from * &enum nl80211_chan_width indicating the supported channel * bandwidths for FTM. Note that a higher channel bandwidth may be * configured to allow for other measurements types with different * bandwidth requirement in the same measurement. * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT: u32 attribute indicating * the maximum bursts exponent that can be used (if not present anything * is valid) * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating * the maximum FTMs per burst (if not present anything is valid) * @NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED: flag attribute indicating if * trigger based ranging measurement is supported * @NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED: flag attribute indicating * if non trigger based ranging measurement is supported * * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number */ enum nl80211_peer_measurement_ftm_capa { __NL80211_PMSR_FTM_CAPA_ATTR_INVALID, NL80211_PMSR_FTM_CAPA_ATTR_ASAP, NL80211_PMSR_FTM_CAPA_ATTR_NON_ASAP, NL80211_PMSR_FTM_CAPA_ATTR_REQ_LCI, NL80211_PMSR_FTM_CAPA_ATTR_REQ_CIVICLOC, NL80211_PMSR_FTM_CAPA_ATTR_PREAMBLES, NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS, NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT, NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST, NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED, NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED, /* keep last */ NUM_NL80211_PMSR_FTM_CAPA_ATTR, NL80211_PMSR_FTM_CAPA_ATTR_MAX = NUM_NL80211_PMSR_FTM_CAPA_ATTR - 1 }; /** * enum nl80211_peer_measurement_ftm_req - FTM request attributes * @__NL80211_PMSR_FTM_REQ_ATTR_INVALID: invalid * * @NL80211_PMSR_FTM_REQ_ATTR_ASAP: ASAP mode requested (flag) * @NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE: preamble type (see * &enum nl80211_preamble), optional for DMG (u32) * @NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP: number of bursts exponent as in * 802.11-2016 9.4.2.168 "Fine Timing Measurement Parameters element" * (u8, 0-15, optional with default 15 i.e. "no preference") * @NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD: interval between bursts in units * of 100ms (u16, optional with default 0) * @NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION: burst duration, as in 802.11-2016 * Table 9-257 "Burst Duration field encoding" (u8, 0-15, optional with * default 15 i.e. "no preference") * @NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST: number of successful FTM frames * requested per burst * (u8, 0-31, optional with default 0 i.e. "no preference") * @NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES: number of FTMR frame retries * (u8, default 3) * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag) * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data * (flag) * @NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED: request trigger based ranging * measurement (flag). * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED are * mutually exclusive. * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based * ranging will be used. * @NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED: request non trigger based * ranging measurement (flag) * This attribute and %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED are * mutually exclusive. * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based * ranging will be used. * @NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK: negotiate for LMR feedback. Only * valid if either %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED or * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set. * @NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR: optional. The BSS color of the * responder. Only valid if %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED * or %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED is set. * * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number */ enum nl80211_peer_measurement_ftm_req { __NL80211_PMSR_FTM_REQ_ATTR_INVALID, NL80211_PMSR_FTM_REQ_ATTR_ASAP, NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE, NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP, NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD, NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION, NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST, NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES, NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI, NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK, NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR, /* keep last */ NUM_NL80211_PMSR_FTM_REQ_ATTR, NL80211_PMSR_FTM_REQ_ATTR_MAX = NUM_NL80211_PMSR_FTM_REQ_ATTR - 1 }; /** * enum nl80211_peer_measurement_ftm_failure_reasons - FTM failure reasons * @NL80211_PMSR_FTM_FAILURE_UNSPECIFIED: unspecified failure, not used * @NL80211_PMSR_FTM_FAILURE_NO_RESPONSE: no response from the FTM responder * @NL80211_PMSR_FTM_FAILURE_REJECTED: FTM responder rejected measurement * @NL80211_PMSR_FTM_FAILURE_WRONG_CHANNEL: we already know the peer is * on a different channel, so can't measure (if we didn't know, we'd * try and get no response) * @NL80211_PMSR_FTM_FAILURE_PEER_NOT_CAPABLE: peer can't actually do FTM * @NL80211_PMSR_FTM_FAILURE_INVALID_TIMESTAMP: invalid T1/T4 timestamps * received * @NL80211_PMSR_FTM_FAILURE_PEER_BUSY: peer reports busy, you may retry * later (see %NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME) * @NL80211_PMSR_FTM_FAILURE_BAD_CHANGED_PARAMS: parameters were changed * by the peer and are no longer supported */ enum nl80211_peer_measurement_ftm_failure_reasons { NL80211_PMSR_FTM_FAILURE_UNSPECIFIED, NL80211_PMSR_FTM_FAILURE_NO_RESPONSE, NL80211_PMSR_FTM_FAILURE_REJECTED, NL80211_PMSR_FTM_FAILURE_WRONG_CHANNEL, NL80211_PMSR_FTM_FAILURE_PEER_NOT_CAPABLE, NL80211_PMSR_FTM_FAILURE_INVALID_TIMESTAMP, NL80211_PMSR_FTM_FAILURE_PEER_BUSY, NL80211_PMSR_FTM_FAILURE_BAD_CHANGED_PARAMS, }; /** * enum nl80211_peer_measurement_ftm_resp - FTM response attributes * @__NL80211_PMSR_FTM_RESP_ATTR_INVALID: invalid * * @NL80211_PMSR_FTM_RESP_ATTR_FAIL_REASON: FTM-specific failure reason * (u32, optional) * @NL80211_PMSR_FTM_RESP_ATTR_BURST_INDEX: optional, if bursts are reported * as separate results then it will be the burst index 0...(N-1) and * the top level will indicate partial results (u32) * @NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_ATTEMPTS: number of FTM Request frames * transmitted (u32, optional) * @NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_SUCCESSES: number of FTM Request frames * that were acknowleged (u32, optional) * @NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME: retry time received from the * busy peer (u32, seconds) * @NL80211_PMSR_FTM_RESP_ATTR_NUM_BURSTS_EXP: actual number of bursts exponent * used by the responder (similar to request, u8) * @NL80211_PMSR_FTM_RESP_ATTR_BURST_DURATION: actual burst duration used by * the responder (similar to request, u8) * @NL80211_PMSR_FTM_RESP_ATTR_FTMS_PER_BURST: actual FTMs per burst used * by the responder (similar to request, u8) * @NL80211_PMSR_FTM_RESP_ATTR_RSSI_AVG: average RSSI across all FTM action * frames (optional, s32, 1/2 dBm) * @NL80211_PMSR_FTM_RESP_ATTR_RSSI_SPREAD: RSSI spread across all FTM action * frames (optional, s32, 1/2 dBm) * @NL80211_PMSR_FTM_RESP_ATTR_TX_RATE: bitrate we used for the response to the * FTM action frame (optional, nested, using &enum nl80211_rate_info * attributes) * @NL80211_PMSR_FTM_RESP_ATTR_RX_RATE: bitrate the responder used for the FTM * action frame (optional, nested, using &enum nl80211_rate_info attrs) * @NL80211_PMSR_FTM_RESP_ATTR_RTT_AVG: average RTT (s64, picoseconds, optional * but one of RTT/DIST must be present) * @NL80211_PMSR_FTM_RESP_ATTR_RTT_VARIANCE: RTT variance (u64, ps^2, note that * standard deviation is the square root of variance, optional) * @NL80211_PMSR_FTM_RESP_ATTR_RTT_SPREAD: RTT spread (u64, picoseconds, * optional) * @NL80211_PMSR_FTM_RESP_ATTR_DIST_AVG: average distance (s64, mm, optional * but one of RTT/DIST must be present) * @NL80211_PMSR_FTM_RESP_ATTR_DIST_VARIANCE: distance variance (u64, mm^2, note * that standard deviation is the square root of variance, optional) * @NL80211_PMSR_FTM_RESP_ATTR_DIST_SPREAD: distance spread (u64, mm, optional) * @NL80211_PMSR_FTM_RESP_ATTR_LCI: LCI data from peer (binary, optional); * this is the contents of the Measurement Report Element (802.11-2016 * 9.4.2.22.1) starting with the Measurement Token, with Measurement * Type 8. * @NL80211_PMSR_FTM_RESP_ATTR_CIVICLOC: civic location data from peer * (binary, optional); * this is the contents of the Measurement Report Element (802.11-2016 * 9.4.2.22.1) starting with the Measurement Token, with Measurement * Type 11. * @NL80211_PMSR_FTM_RESP_ATTR_PAD: ignore, for u64/s64 padding only * * @NUM_NL80211_PMSR_FTM_RESP_ATTR: internal * @NL80211_PMSR_FTM_RESP_ATTR_MAX: highest attribute number */ enum nl80211_peer_measurement_ftm_resp { __NL80211_PMSR_FTM_RESP_ATTR_INVALID, NL80211_PMSR_FTM_RESP_ATTR_FAIL_REASON, NL80211_PMSR_FTM_RESP_ATTR_BURST_INDEX, NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_ATTEMPTS, NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_SUCCESSES, NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME, NL80211_PMSR_FTM_RESP_ATTR_NUM_BURSTS_EXP, NL80211_PMSR_FTM_RESP_ATTR_BURST_DURATION, NL80211_PMSR_FTM_RESP_ATTR_FTMS_PER_BURST, NL80211_PMSR_FTM_RESP_ATTR_RSSI_AVG, NL80211_PMSR_FTM_RESP_ATTR_RSSI_SPREAD, NL80211_PMSR_FTM_RESP_ATTR_TX_RATE, NL80211_PMSR_FTM_RESP_ATTR_RX_RATE, NL80211_PMSR_FTM_RESP_ATTR_RTT_AVG, NL80211_PMSR_FTM_RESP_ATTR_RTT_VARIANCE, NL80211_PMSR_FTM_RESP_ATTR_RTT_SPREAD, NL80211_PMSR_FTM_RESP_ATTR_DIST_AVG, NL80211_PMSR_FTM_RESP_ATTR_DIST_VARIANCE, NL80211_PMSR_FTM_RESP_ATTR_DIST_SPREAD, NL80211_PMSR_FTM_RESP_ATTR_LCI, NL80211_PMSR_FTM_RESP_ATTR_CIVICLOC, NL80211_PMSR_FTM_RESP_ATTR_PAD, /* keep last */ NUM_NL80211_PMSR_FTM_RESP_ATTR, NL80211_PMSR_FTM_RESP_ATTR_MAX = NUM_NL80211_PMSR_FTM_RESP_ATTR - 1 }; /** * enum nl80211_obss_pd_attributes - OBSS packet detection attributes * @__NL80211_HE_OBSS_PD_ATTR_INVALID: Invalid * * @NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET: the OBSS PD minimum tx power offset. * @NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET: the OBSS PD maximum tx power offset. * @NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET: the non-SRG OBSS PD maximum * tx power offset. * @NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP: bitmap that indicates the BSS color * values used by members of the SRG. * @NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP: bitmap that indicates the partial * BSSID values used by members of the SRG. * @NL80211_HE_OBSS_PD_ATTR_SR_CTRL: The SR Control field of SRP element. * * @__NL80211_HE_OBSS_PD_ATTR_LAST: Internal * @NL80211_HE_OBSS_PD_ATTR_MAX: highest OBSS PD attribute. */ enum nl80211_obss_pd_attributes { __NL80211_HE_OBSS_PD_ATTR_INVALID, NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET, NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET, NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET, NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP, NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP, NL80211_HE_OBSS_PD_ATTR_SR_CTRL, /* keep last */ __NL80211_HE_OBSS_PD_ATTR_LAST, NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1, }; /** * enum nl80211_bss_color_attributes - BSS Color attributes * @__NL80211_HE_BSS_COLOR_ATTR_INVALID: Invalid * * @NL80211_HE_BSS_COLOR_ATTR_COLOR: the current BSS Color. * @NL80211_HE_BSS_COLOR_ATTR_DISABLED: is BSS coloring disabled. * @NL80211_HE_BSS_COLOR_ATTR_PARTIAL: the AID equation to be used.. * * @__NL80211_HE_BSS_COLOR_ATTR_LAST: Internal * @NL80211_HE_BSS_COLOR_ATTR_MAX: highest BSS Color attribute. */ enum nl80211_bss_color_attributes { __NL80211_HE_BSS_COLOR_ATTR_INVALID, NL80211_HE_BSS_COLOR_ATTR_COLOR, NL80211_HE_BSS_COLOR_ATTR_DISABLED, NL80211_HE_BSS_COLOR_ATTR_PARTIAL, /* keep last */ __NL80211_HE_BSS_COLOR_ATTR_LAST, NL80211_HE_BSS_COLOR_ATTR_MAX = __NL80211_HE_BSS_COLOR_ATTR_LAST - 1, }; /** * enum nl80211_iftype_akm_attributes - interface type AKM attributes * @__NL80211_IFTYPE_AKM_ATTR_INVALID: Invalid * * @NL80211_IFTYPE_AKM_ATTR_IFTYPES: nested attribute containing a flag * attribute for each interface type that supports AKM suites specified in * %NL80211_IFTYPE_AKM_ATTR_SUITES * @NL80211_IFTYPE_AKM_ATTR_SUITES: an array of u32. Used to indicate supported * AKM suites for the specified interface types. * * @__NL80211_IFTYPE_AKM_ATTR_LAST: Internal * @NL80211_IFTYPE_AKM_ATTR_MAX: highest interface type AKM attribute. */ enum nl80211_iftype_akm_attributes { __NL80211_IFTYPE_AKM_ATTR_INVALID, NL80211_IFTYPE_AKM_ATTR_IFTYPES, NL80211_IFTYPE_AKM_ATTR_SUITES, /* keep last */ __NL80211_IFTYPE_AKM_ATTR_LAST, NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1, }; /** * enum nl80211_fils_discovery_attributes - FILS discovery configuration * from IEEE Std 802.11ai-2016, Annex C.3 MIB detail. * * @__NL80211_FILS_DISCOVERY_ATTR_INVALID: Invalid * * @NL80211_FILS_DISCOVERY_ATTR_INT_MIN: Minimum packet interval (u32, TU). * Allowed range: 0..10000 (TU = Time Unit) * @NL80211_FILS_DISCOVERY_ATTR_INT_MAX: Maximum packet interval (u32, TU). * Allowed range: 0..10000 (TU = Time Unit) * @NL80211_FILS_DISCOVERY_ATTR_TMPL: Template data for FILS discovery action * frame including the headers. * * @__NL80211_FILS_DISCOVERY_ATTR_LAST: Internal * @NL80211_FILS_DISCOVERY_ATTR_MAX: highest attribute */ enum nl80211_fils_discovery_attributes { __NL80211_FILS_DISCOVERY_ATTR_INVALID, NL80211_FILS_DISCOVERY_ATTR_INT_MIN, NL80211_FILS_DISCOVERY_ATTR_INT_MAX, NL80211_FILS_DISCOVERY_ATTR_TMPL, /* keep last */ __NL80211_FILS_DISCOVERY_ATTR_LAST, NL80211_FILS_DISCOVERY_ATTR_MAX = __NL80211_FILS_DISCOVERY_ATTR_LAST - 1 }; /* * FILS discovery template minimum length with action frame headers and * mandatory fields. */ #define NL80211_FILS_DISCOVERY_TMPL_MIN_LEN 42 /** * enum nl80211_unsol_bcast_probe_resp_attributes - Unsolicited broadcast probe * response configuration. Applicable only in 6GHz. * * @__NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INVALID: Invalid * * @NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT: Maximum packet interval (u32, TU). * Allowed range: 0..20 (TU = Time Unit). IEEE P802.11ax/D6.0 * 26.17.2.3.2 (AP behavior for fast passive scanning). * @NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL: Unsolicited broadcast probe response * frame template (binary). * * @__NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST: Internal * @NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_MAX: highest attribute */ enum nl80211_unsol_bcast_probe_resp_attributes { __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INVALID, NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT, NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL, /* keep last */ __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST, NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_MAX = __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST - 1 }; /** * enum nl80211_sae_pwe_mechanism - The mechanism(s) allowed for SAE PWE * derivation. Applicable only when WPA3-Personal SAE authentication is * used. * * @NL80211_SAE_PWE_UNSPECIFIED: not specified, used internally to indicate that * attribute is not present from userspace. * @NL80211_SAE_PWE_HUNT_AND_PECK: hunting-and-pecking loop only * @NL80211_SAE_PWE_HASH_TO_ELEMENT: hash-to-element only * @NL80211_SAE_PWE_BOTH: both hunting-and-pecking loop and hash-to-element * can be used. */ enum nl80211_sae_pwe_mechanism { NL80211_SAE_PWE_UNSPECIFIED, NL80211_SAE_PWE_HUNT_AND_PECK, NL80211_SAE_PWE_HASH_TO_ELEMENT, NL80211_SAE_PWE_BOTH, }; /** * enum nl80211_sar_type - type of SAR specs * * @NL80211_SAR_TYPE_POWER: power limitation specified in 0.25dBm unit * */ enum nl80211_sar_type { NL80211_SAR_TYPE_POWER, /* add new type here */ /* Keep last */ NUM_NL80211_SAR_TYPE, }; /** * enum nl80211_sar_attrs - Attributes for SAR spec * * @NL80211_SAR_ATTR_TYPE: the SAR type as defined in &enum nl80211_sar_type. * * @NL80211_SAR_ATTR_SPECS: Nested array of SAR power * limit specifications. Each specification contains a set * of %nl80211_sar_specs_attrs. * * For SET operation, it contains array of %NL80211_SAR_ATTR_SPECS_POWER * and %NL80211_SAR_ATTR_SPECS_RANGE_INDEX. * * For sar_capa dump, it contains array of * %NL80211_SAR_ATTR_SPECS_START_FREQ * and %NL80211_SAR_ATTR_SPECS_END_FREQ. * * @__NL80211_SAR_ATTR_LAST: Internal * @NL80211_SAR_ATTR_MAX: highest sar attribute * * These attributes are used with %NL80211_CMD_SET_SAR_SPEC */ enum nl80211_sar_attrs { __NL80211_SAR_ATTR_INVALID, NL80211_SAR_ATTR_TYPE, NL80211_SAR_ATTR_SPECS, __NL80211_SAR_ATTR_LAST, NL80211_SAR_ATTR_MAX = __NL80211_SAR_ATTR_LAST - 1, }; /** * enum nl80211_sar_specs_attrs - Attributes for SAR power limit specs * * @NL80211_SAR_ATTR_SPECS_POWER: Required (s32)value to specify the actual * power limit value in units of 0.25 dBm if type is * NL80211_SAR_TYPE_POWER. (i.e., a value of 44 represents 11 dBm). * 0 means userspace doesn't have SAR limitation on this associated range. * * @NL80211_SAR_ATTR_SPECS_RANGE_INDEX: Required (u32) value to specify the * index of exported freq range table and the associated power limitation * is applied to this range. * * Userspace isn't required to set all the ranges advertised by WLAN driver, * and userspace can skip some certain ranges. These skipped ranges don't * have SAR limitations, and they are same as setting the * %NL80211_SAR_ATTR_SPECS_POWER to any unreasonable high value because any * value higher than regulatory allowed value just means SAR power * limitation is removed, but it's required to set at least one range. * It's not allowed to set duplicated range in one SET operation. * * Every SET operation overwrites previous SET operation. * * @NL80211_SAR_ATTR_SPECS_START_FREQ: Required (u32) value to specify the start * frequency of this range edge when registering SAR capability to wiphy. * It's not a channel center frequency. The unit is kHz. * * @NL80211_SAR_ATTR_SPECS_END_FREQ: Required (u32) value to specify the end * frequency of this range edge when registering SAR capability to wiphy. * It's not a channel center frequency. The unit is kHz. * * @__NL80211_SAR_ATTR_SPECS_LAST: Internal * @NL80211_SAR_ATTR_SPECS_MAX: highest sar specs attribute */ enum nl80211_sar_specs_attrs { __NL80211_SAR_ATTR_SPECS_INVALID, NL80211_SAR_ATTR_SPECS_POWER, NL80211_SAR_ATTR_SPECS_RANGE_INDEX, NL80211_SAR_ATTR_SPECS_START_FREQ, NL80211_SAR_ATTR_SPECS_END_FREQ, __NL80211_SAR_ATTR_SPECS_LAST, NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1, }; /** * enum nl80211_mbssid_config_attributes - multiple BSSID (MBSSID) and enhanced * multi-BSSID advertisements (EMA) in AP mode. * Kernel uses some of these attributes to advertise driver's support for * MBSSID and EMA. * Remaining attributes should be used by the userspace to configure the * features. * * @__NL80211_MBSSID_CONFIG_ATTR_INVALID: Invalid * * @NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES: Used by the kernel to advertise * the maximum number of MBSSID interfaces supported by the driver. * Driver should indicate MBSSID support by setting * wiphy->mbssid_max_interfaces to a value more than or equal to 2. * * @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel * to advertise the maximum profile periodicity supported by the driver * if EMA is enabled. Driver should indicate EMA support to the userspace * by setting wiphy->ema_max_profile_periodicity to * a non-zero value. * * @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of * this BSS (u8) in the multiple BSSID set. * Value must be set to 0 for the transmitting interface and non-zero for * all non-transmitting interfaces. The userspace will be responsible * for using unique indices for the interfaces. * Range: 0 to wiphy->mbssid_max_interfaces-1. * * @NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX: Mandatory parameter for * a non-transmitted profile which provides the interface index (u32) of * the transmitted profile. The value must match one of the interface * indices advertised by the kernel. Optional if the interface being set up * is the transmitting one, however, if provided then the value must match * the interface index of the same. * * @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature. * Setting this flag is permitted only if the driver advertises EMA support * by setting wiphy->ema_max_profile_periodicity to non-zero. * * @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal * @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute */ enum nl80211_mbssid_config_attributes { __NL80211_MBSSID_CONFIG_ATTR_INVALID, NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES, NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY, NL80211_MBSSID_CONFIG_ATTR_INDEX, NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX, NL80211_MBSSID_CONFIG_ATTR_EMA, /* keep last */ __NL80211_MBSSID_CONFIG_ATTR_LAST, NL80211_MBSSID_CONFIG_ATTR_MAX = __NL80211_MBSSID_CONFIG_ATTR_LAST - 1, }; /** * enum nl80211_ap_settings_flags - AP settings flags * * @NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external * authentication. * @NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT: Userspace supports SA Query * procedures offload to driver. If driver advertises * %NL80211_AP_SME_SA_QUERY_OFFLOAD in AP SME features, userspace shall * ignore SA Query procedures and validations when this flag is set by * userspace. */ enum nl80211_ap_settings_flags { NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = 1 << 0, NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, }; #endif /* __LINUX_NL80211_H */ linux/nsfs.h 0000644 00000001177 15063602053 0007033 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_NSFS_H #define __LINUX_NSFS_H #include <linux/ioctl.h> #define NSIO 0xb7 /* Returns a file descriptor that refers to an owning user namespace */ #define NS_GET_USERNS _IO(NSIO, 0x1) /* Returns a file descriptor that refers to a parent namespace */ #define NS_GET_PARENT _IO(NSIO, 0x2) /* Returns the type of namespace (CLONE_NEW* value) referred to by file descriptor */ #define NS_GET_NSTYPE _IO(NSIO, 0x3) /* Get owner UID (in the caller's user namespace) for a user namespace */ #define NS_GET_OWNER_UID _IO(NSIO, 0x4) #endif /* __LINUX_NSFS_H */ linux/nfsd/cld.h 0000644 00000006062 15063602053 0007554 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Upcall description for nfsdcld communication * * Copyright (c) 2012 Red Hat, Inc. * Author(s): Jeff Layton <jlayton@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _NFSD_CLD_H #define _NFSD_CLD_H #include <linux/types.h> /* latest upcall version available */ #define CLD_UPCALL_VERSION 2 /* defined by RFC3530 */ #define NFS4_OPAQUE_LIMIT 1024 #ifndef SHA256_DIGEST_SIZE #define SHA256_DIGEST_SIZE 32 #endif enum cld_command { Cld_Create, /* create a record for this cm_id */ Cld_Remove, /* remove record of this cm_id */ Cld_Check, /* is this cm_id allowed? */ Cld_GraceDone, /* grace period is complete */ Cld_GraceStart, /* grace start (upload client records) */ Cld_GetVersion, /* query max supported upcall version */ }; /* representation of long-form NFSv4 client ID */ struct cld_name { __u16 cn_len; /* length of cm_id */ unsigned char cn_id[NFS4_OPAQUE_LIMIT]; /* client-provided */ } __attribute__((packed)); /* sha256 hash of the kerberos principal */ struct cld_princhash { __u8 cp_len; /* length of cp_data */ unsigned char cp_data[SHA256_DIGEST_SIZE]; /* hash of principal */ } __attribute__((packed)); struct cld_clntinfo { struct cld_name cc_name; struct cld_princhash cc_princhash; } __attribute__((packed)); /* message struct for communication with userspace */ struct cld_msg { __u8 cm_vers; /* upcall version */ __u8 cm_cmd; /* upcall command */ __s16 cm_status; /* return code */ __u32 cm_xid; /* transaction id */ union { __s64 cm_gracetime; /* grace period start time */ struct cld_name cm_name; __u8 cm_version; /* for getting max version */ } __attribute__((packed)) cm_u; } __attribute__((packed)); /* version 2 message can include hash of kerberos principal */ struct cld_msg_v2 { __u8 cm_vers; /* upcall version */ __u8 cm_cmd; /* upcall command */ __s16 cm_status; /* return code */ __u32 cm_xid; /* transaction id */ union { struct cld_name cm_name; __u8 cm_version; /* for getting max version */ struct cld_clntinfo cm_clntinfo; /* name & princ hash */ } __attribute__((packed)) cm_u; } __attribute__((packed)); struct cld_msg_hdr { __u8 cm_vers; /* upcall version */ __u8 cm_cmd; /* upcall command */ __s16 cm_status; /* return code */ __u32 cm_xid; /* transaction id */ } __attribute__((packed)); #endif /* !_NFSD_CLD_H */ linux/nfsd/debug.h 0000644 00000001340 15063602053 0010072 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/nfsd/debug.h * * Debugging-related stuff for nfsd * * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> */ #ifndef LINUX_NFSD_DEBUG_H #define LINUX_NFSD_DEBUG_H #include <linux/sunrpc/debug.h> /* * knfsd debug flags */ #define NFSDDBG_SOCK 0x0001 #define NFSDDBG_FH 0x0002 #define NFSDDBG_EXPORT 0x0004 #define NFSDDBG_SVC 0x0008 #define NFSDDBG_PROC 0x0010 #define NFSDDBG_FILEOP 0x0020 #define NFSDDBG_AUTH 0x0040 #define NFSDDBG_REPCACHE 0x0080 #define NFSDDBG_XDR 0x0100 #define NFSDDBG_LOCKD 0x0200 #define NFSDDBG_PNFS 0x0400 #define NFSDDBG_ALL 0x7FFF #define NFSDDBG_NOCHANGE 0xFFFF #endif /* LINUX_NFSD_DEBUG_H */ linux/nfsd/export.h 0000644 00000004101 15063602053 0010323 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/nfsd/export.h * * Public declarations for NFS exports. The definitions for the * syscall interface are in nfsctl.h * * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef NFSD_EXPORT_H #define NFSD_EXPORT_H # include <linux/types.h> /* * Important limits for the exports stuff. */ #define NFSCLNT_IDMAX 1024 #define NFSCLNT_ADDRMAX 16 #define NFSCLNT_KEYMAX 32 /* * Export flags. * * Please update the expflags[] array in fs/nfsd/export.c when adding * a new flag. */ #define NFSEXP_READONLY 0x0001 #define NFSEXP_INSECURE_PORT 0x0002 #define NFSEXP_ROOTSQUASH 0x0004 #define NFSEXP_ALLSQUASH 0x0008 #define NFSEXP_ASYNC 0x0010 #define NFSEXP_GATHERED_WRITES 0x0020 #define NFSEXP_NOREADDIRPLUS 0x0040 #define NFSEXP_SECURITY_LABEL 0x0080 /* 0x100 currently unused */ #define NFSEXP_NOHIDE 0x0200 #define NFSEXP_NOSUBTREECHECK 0x0400 #define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ #define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */ #define NFSEXP_FSID 0x2000 #define NFSEXP_CROSSMOUNT 0x4000 #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ /* * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 * clients, and only to the single directory that is the root of the * export; further lookup and readdir operations are treated as if every * subdirectory was a mountpoint, and ignored if they are not themselves * exported. This is used by nfsd and mountd to construct the NFSv4 * pseudofilesystem, which provides access only to paths leading to each * exported filesystem. */ #define NFSEXP_V4ROOT 0x10000 #define NFSEXP_PNFS 0x20000 /* All flags that we claim to support. (Note we don't support NOACL.) */ #define NFSEXP_ALLFLAGS 0x3FEFF /* The flags that may vary depending on security flavor: */ #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | NFSEXP_ALLSQUASH \ | NFSEXP_INSECURE_PORT) #endif /* NFSD_EXPORT_H */ linux/nfsd/stats.h 0000644 00000000645 15063602053 0010151 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/nfsd/stats.h * * Statistics for NFS server. * * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */ #ifndef LINUX_NFSD_STATS_H #define LINUX_NFSD_STATS_H #include <linux/nfs4.h> /* thread usage wraps very million seconds (approx one fortnight) */ #define NFSD_USAGE_WRAP (HZ*1000000) #endif /* LINUX_NFSD_STATS_H */ linux/nvme_ioctl.h 0000644 00000004100 15063602053 0010206 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for the NVM Express ioctl interface * Copyright (c) 2011-2014, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #ifndef _LINUX_NVME_IOCTL_H #define _LINUX_NVME_IOCTL_H #include <linux/types.h> struct nvme_user_io { __u8 opcode; __u8 flags; __u16 control; __u16 nblocks; __u16 rsvd; __u64 metadata; __u64 addr; __u64 slba; __u32 dsmgmt; __u32 reftag; __u16 apptag; __u16 appmask; }; struct nvme_passthru_cmd { __u8 opcode; __u8 flags; __u16 rsvd1; __u32 nsid; __u32 cdw2; __u32 cdw3; __u64 metadata; __u64 addr; __u32 metadata_len; __u32 data_len; __u32 cdw10; __u32 cdw11; __u32 cdw12; __u32 cdw13; __u32 cdw14; __u32 cdw15; __u32 timeout_ms; __u32 result; }; struct nvme_passthru_cmd64 { __u8 opcode; __u8 flags; __u16 rsvd1; __u32 nsid; __u32 cdw2; __u32 cdw3; __u64 metadata; __u64 addr; __u32 metadata_len; __u32 data_len; __u32 cdw10; __u32 cdw11; __u32 cdw12; __u32 cdw13; __u32 cdw14; __u32 cdw15; __u32 timeout_ms; __u32 rsvd2; __u64 result; }; #define nvme_admin_cmd nvme_passthru_cmd #define NVME_IOCTL_ID _IO('N', 0x40) #define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) #define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) #define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd) #define NVME_IOCTL_RESET _IO('N', 0x44) #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45) #define NVME_IOCTL_RESCAN _IO('N', 0x46) #define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64) #define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64) #endif /* _LINUX_NVME_IOCTL_H */ linux/nvram.h 0000644 00000001024 15063602053 0007174 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NVRAM_H #define _LINUX_NVRAM_H #include <linux/ioctl.h> /* /dev/nvram ioctls */ #define NVRAM_INIT _IO('p', 0x40) /* initialize NVRAM and set checksum */ #define NVRAM_SETCKS _IO('p', 0x41) /* recalculate checksum */ /* for all current systems, this is where NVRAM starts */ #define NVRAM_FIRST_BYTE 14 /* all these functions expect an NVRAM offset, not an absolute */ #define NVRAM_OFFSET(x) ((x)-NVRAM_FIRST_BYTE) #endif /* _LINUX_NVRAM_H */ linux/omap3isp.h 0000644 00000050565 15063602053 0007622 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * omap3isp.h * * TI OMAP3 ISP - User-space API * * Copyright (C) 2010 Nokia Corporation * Copyright (C) 2009 Texas Instruments, Inc. * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef OMAP3_ISP_USER_H #define OMAP3_ISP_USER_H #include <linux/types.h> #include <linux/videodev2.h> /* * Private IOCTLs * * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module */ #define VIDIOC_OMAP3ISP_CCDC_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config) #define VIDIOC_OMAP3ISP_PRV_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config) #define VIDIOC_OMAP3ISP_AEWB_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config) #define VIDIOC_OMAP3ISP_HIST_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config) #define VIDIOC_OMAP3ISP_AF_CFG \ _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config) #define VIDIOC_OMAP3ISP_STAT_REQ \ _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data) #define VIDIOC_OMAP3ISP_STAT_REQ_TIME32 \ _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data_time32) #define VIDIOC_OMAP3ISP_STAT_EN \ _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long) /* * Events * * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready */ #define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100) #define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1) #define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2) #define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3) struct omap3isp_stat_event_status { __u32 frame_number; __u16 config_counter; __u8 buf_err; }; /* AE/AWB related structures and flags*/ /* H3A Range Constants */ #define OMAP3ISP_AEWB_MAX_SATURATION_LIM 1023 #define OMAP3ISP_AEWB_MIN_WIN_H 2 #define OMAP3ISP_AEWB_MAX_WIN_H 256 #define OMAP3ISP_AEWB_MIN_WIN_W 6 #define OMAP3ISP_AEWB_MAX_WIN_W 256 #define OMAP3ISP_AEWB_MIN_WINVC 1 #define OMAP3ISP_AEWB_MIN_WINHC 1 #define OMAP3ISP_AEWB_MAX_WINVC 128 #define OMAP3ISP_AEWB_MAX_WINHC 36 #define OMAP3ISP_AEWB_MAX_WINSTART 4095 #define OMAP3ISP_AEWB_MIN_SUB_INC 2 #define OMAP3ISP_AEWB_MAX_SUB_INC 32 #define OMAP3ISP_AEWB_MAX_BUF_SIZE 83600 #define OMAP3ISP_AF_IIRSH_MIN 0 #define OMAP3ISP_AF_IIRSH_MAX 4095 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN 1 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX 36 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN 1 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX 128 #define OMAP3ISP_AF_PAXEL_INCREMENT_MIN 2 #define OMAP3ISP_AF_PAXEL_INCREMENT_MAX 32 #define OMAP3ISP_AF_PAXEL_HEIGHT_MIN 2 #define OMAP3ISP_AF_PAXEL_HEIGHT_MAX 256 #define OMAP3ISP_AF_PAXEL_WIDTH_MIN 16 #define OMAP3ISP_AF_PAXEL_WIDTH_MAX 256 #define OMAP3ISP_AF_PAXEL_HZSTART_MIN 1 #define OMAP3ISP_AF_PAXEL_HZSTART_MAX 4095 #define OMAP3ISP_AF_PAXEL_VTSTART_MIN 0 #define OMAP3ISP_AF_PAXEL_VTSTART_MAX 4095 #define OMAP3ISP_AF_THRESHOLD_MAX 255 #define OMAP3ISP_AF_COEF_MAX 4095 #define OMAP3ISP_AF_PAXEL_SIZE 48 #define OMAP3ISP_AF_MAX_BUF_SIZE 221184 /** * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values * saturation_limit: Saturation limit. * @win_height: Window Height. Range 2 - 256, even values only. * @win_width: Window Width. Range 6 - 256, even values only. * @ver_win_count: Vertical Window Count. Range 1 - 128. * @hor_win_count: Horizontal Window Count. Range 1 - 36. * @ver_win_start: Vertical Window Start. Range 0 - 4095. * @hor_win_start: Horizontal Window Start. Range 0 - 4095. * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095. * @blk_win_height: Black Window Height. Range 2 - 256, even values only. * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even * values only. * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even * values only. * @alaw_enable: AEW ALAW EN flag. */ struct omap3isp_h3a_aewb_config { /* * Common fields. * They should be the first ones and must be in the same order as in * ispstat_generic_config struct. */ __u32 buf_size; __u16 config_counter; /* Private fields */ __u16 saturation_limit; __u16 win_height; __u16 win_width; __u16 ver_win_count; __u16 hor_win_count; __u16 ver_win_start; __u16 hor_win_start; __u16 blk_ver_win_start; __u16 blk_win_height; __u16 subsample_ver_inc; __u16 subsample_hor_inc; __u8 alaw_enable; }; /** * struct omap3isp_stat_data - Statistic data sent to or received from user * @ts: Timestamp of returned framestats. * @buf: Pointer to pass to user. * @frame_number: Frame number of requested stats. * @cur_frame: Current frame number being processed. * @config_counter: Number of the configuration associated with the data. */ struct omap3isp_stat_data { struct timeval ts; void *buf; __u32 buf_size; __u16 frame_number; __u16 cur_frame; __u16 config_counter; }; /* Histogram related structs */ /* Flags for number of bins */ #define OMAP3ISP_HIST_BINS_32 0 #define OMAP3ISP_HIST_BINS_64 1 #define OMAP3ISP_HIST_BINS_128 2 #define OMAP3ISP_HIST_BINS_256 3 /* Number of bins * 4 colors * 4-bytes word */ #define OMAP3ISP_HIST_MEM_SIZE_BINS(n) ((1 << ((n)+5))*4*4) #define OMAP3ISP_HIST_MEM_SIZE 1024 #define OMAP3ISP_HIST_MIN_REGIONS 1 #define OMAP3ISP_HIST_MAX_REGIONS 4 #define OMAP3ISP_HIST_MAX_WB_GAIN 255 #define OMAP3ISP_HIST_MIN_WB_GAIN 0 #define OMAP3ISP_HIST_MAX_BIT_WIDTH 14 #define OMAP3ISP_HIST_MIN_BIT_WIDTH 8 #define OMAP3ISP_HIST_MAX_WG 4 #define OMAP3ISP_HIST_MAX_BUF_SIZE 4096 /* Source */ #define OMAP3ISP_HIST_SOURCE_CCDC 0 #define OMAP3ISP_HIST_SOURCE_MEM 1 /* CFA pattern */ #define OMAP3ISP_HIST_CFA_BAYER 0 #define OMAP3ISP_HIST_CFA_FOVEONX3 1 struct omap3isp_hist_region { __u16 h_start; __u16 h_end; __u16 v_start; __u16 v_end; }; struct omap3isp_hist_config { /* * Common fields. * They should be the first ones and must be in the same order as in * ispstat_generic_config struct. */ __u32 buf_size; __u16 config_counter; __u8 num_acc_frames; /* Num of image frames to be processed and accumulated for each histogram frame */ __u16 hist_bins; /* number of bins: 32, 64, 128, or 256 */ __u8 cfa; /* BAYER or FOVEON X3 */ __u8 wg[OMAP3ISP_HIST_MAX_WG]; /* White Balance Gain */ __u8 num_regions; /* number of regions to be configured */ struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS]; }; /* Auto Focus related structs */ #define OMAP3ISP_AF_NUM_COEF 11 enum omap3isp_h3a_af_fvmode { OMAP3ISP_AF_MODE_SUMMED = 0, OMAP3ISP_AF_MODE_PEAK = 1 }; /* Red, Green, and blue pixel location in the AF windows */ enum omap3isp_h3a_af_rgbpos { OMAP3ISP_AF_GR_GB_BAYER = 0, /* GR and GB as Bayer pattern */ OMAP3ISP_AF_RG_GB_BAYER = 1, /* RG and GB as Bayer pattern */ OMAP3ISP_AF_GR_BG_BAYER = 2, /* GR and BG as Bayer pattern */ OMAP3ISP_AF_RG_BG_BAYER = 3, /* RG and BG as Bayer pattern */ OMAP3ISP_AF_GG_RB_CUSTOM = 4, /* GG and RB as custom pattern */ OMAP3ISP_AF_RB_GG_CUSTOM = 5 /* RB and GG as custom pattern */ }; /* Contains the information regarding the Horizontal Median Filter */ struct omap3isp_h3a_af_hmf { __u8 enable; /* Status of Horizontal Median Filter */ __u8 threshold; /* Threshold Value for Horizontal Median Filter */ }; /* Contains the information regarding the IIR Filters */ struct omap3isp_h3a_af_iir { __u16 h_start; /* IIR horizontal start */ __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */ __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */ }; /* Contains the information regarding the Paxels Structure in AF Engine */ struct omap3isp_h3a_af_paxel { __u16 h_start; /* Horizontal Start Position */ __u16 v_start; /* Vertical Start Position */ __u8 width; /* Width of the Paxel */ __u8 height; /* Height of the Paxel */ __u8 h_cnt; /* Horizontal Count */ __u8 v_cnt; /* vertical Count */ __u8 line_inc; /* Line Increment */ }; /* Contains the parameters required for hardware set up of AF Engine */ struct omap3isp_h3a_af_config { /* * Common fields. * They should be the first ones and must be in the same order as in * ispstat_generic_config struct. */ __u32 buf_size; __u16 config_counter; struct omap3isp_h3a_af_hmf hmf; /* HMF configurations */ struct omap3isp_h3a_af_iir iir; /* IIR filter configurations */ struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */ enum omap3isp_h3a_af_rgbpos rgb_pos; /* RGB Positions */ enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */ __u8 alaw_enable; /* AF ALAW status */ }; /* ISP CCDC structs */ /* Abstraction layer CCDC configurations */ #define OMAP3ISP_CCDC_ALAW (1 << 0) #define OMAP3ISP_CCDC_LPF (1 << 1) #define OMAP3ISP_CCDC_BLCLAMP (1 << 2) #define OMAP3ISP_CCDC_BCOMP (1 << 3) #define OMAP3ISP_CCDC_FPC (1 << 4) #define OMAP3ISP_CCDC_CULL (1 << 5) #define OMAP3ISP_CCDC_CONFIG_LSC (1 << 7) #define OMAP3ISP_CCDC_TBL_LSC (1 << 8) #define OMAP3ISP_RGB_MAX 3 /* Enumeration constants for Alaw input width */ enum omap3isp_alaw_ipwidth { OMAP3ISP_ALAW_BIT12_3 = 0x3, OMAP3ISP_ALAW_BIT11_2 = 0x4, OMAP3ISP_ALAW_BIT10_1 = 0x5, OMAP3ISP_ALAW_BIT9_0 = 0x6 }; /** * struct omap3isp_ccdc_lsc_config - LSC configuration * @offset: Table Offset of the gain table. * @gain_mode_n: Vertical dimension of a paxel in LSC configuration. * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration. * @gain_format: Gain table format. * @fmtsph: Start pixel horizontal from start of the HS sync pulse. * @fmtlnh: Number of pixels in horizontal direction to use for the data * reformatter. * @fmtslv: Start line from start of VS sync pulse for the data reformatter. * @fmtlnv: Number of lines in vertical direction for the data reformatter. * @initial_x: X position, in pixels, of the first active pixel in reference * to the first active paxel. Must be an even number. * @initial_y: Y position, in pixels, of the first active pixel in reference * to the first active paxel. Must be an even number. * @size: Size of LSC gain table. Filled when loaded from userspace. */ struct omap3isp_ccdc_lsc_config { __u16 offset; __u8 gain_mode_n; __u8 gain_mode_m; __u8 gain_format; __u16 fmtsph; __u16 fmtlnh; __u16 fmtslv; __u16 fmtlnv; __u8 initial_x; __u8 initial_y; __u32 size; }; /** * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract * @obgain: Optical black average gain. * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample. * @oblines: Optical Black Sample lines. * @oblen: Optical Black Sample Length. * @dcsubval: Digital Black Clamp subtract value. */ struct omap3isp_ccdc_bclamp { __u8 obgain; __u8 obstpixel; __u8 oblines; __u8 oblen; __u16 dcsubval; }; /** * struct omap3isp_ccdc_fpc - Faulty Pixels Correction * @fpnum: Number of faulty pixels to be corrected in the frame. * @fpcaddr: Memory address of the FPC Table */ struct omap3isp_ccdc_fpc { __u16 fpnum; __u32 fpcaddr; }; /** * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters * @b_mg: B/Mg pixels. 2's complement. -128 to +127. * @gb_g: Gb/G pixels. 2's complement. -128 to +127. * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127. * @r_ye: R/Ye pixels. 2's complement. -128 to +127. */ struct omap3isp_ccdc_blcomp { __u8 b_mg; __u8 gb_g; __u8 gr_cy; __u8 r_ye; }; /** * omap3isp_ccdc_culling - Culling parameters * @v_pattern: Vertical culling pattern. * @h_odd: Horizontal Culling pattern for odd lines. * @h_even: Horizontal Culling pattern for even lines. */ struct omap3isp_ccdc_culling { __u8 v_pattern; __u16 h_odd; __u16 h_even; }; /** * omap3isp_ccdc_update_config - CCDC configuration * @update: Specifies which CCDC registers should be updated. * @flag: Specifies which CCDC functions should be enabled. * @alawip: Enable/Disable A-Law compression. * @bclamp: Black clamp control register. * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement. * @fpc: Number of faulty pixels corrected in the frame, address of FPC table. * @cull: Cull control register. * @lsc: Pointer to LSC gain table. */ struct omap3isp_ccdc_update_config { __u16 update; __u16 flag; enum omap3isp_alaw_ipwidth alawip; struct omap3isp_ccdc_bclamp *bclamp; struct omap3isp_ccdc_blcomp *blcomp; struct omap3isp_ccdc_fpc *fpc; struct omap3isp_ccdc_lsc_config *lsc_cfg; struct omap3isp_ccdc_culling *cull; __u8 *lsc; }; /* Preview configurations */ #define OMAP3ISP_PREV_LUMAENH (1 << 0) #define OMAP3ISP_PREV_INVALAW (1 << 1) #define OMAP3ISP_PREV_HRZ_MED (1 << 2) #define OMAP3ISP_PREV_CFA (1 << 3) #define OMAP3ISP_PREV_CHROMA_SUPP (1 << 4) #define OMAP3ISP_PREV_WB (1 << 5) #define OMAP3ISP_PREV_BLKADJ (1 << 6) #define OMAP3ISP_PREV_RGB2RGB (1 << 7) #define OMAP3ISP_PREV_COLOR_CONV (1 << 8) #define OMAP3ISP_PREV_YC_LIMIT (1 << 9) #define OMAP3ISP_PREV_DEFECT_COR (1 << 10) /* Bit 11 was OMAP3ISP_PREV_GAMMABYPASS, now merged with OMAP3ISP_PREV_GAMMA */ #define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12) #define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13) #define OMAP3ISP_PREV_LENS_SHADING (1 << 14) #define OMAP3ISP_PREV_NF (1 << 15) #define OMAP3ISP_PREV_GAMMA (1 << 16) #define OMAP3ISP_PREV_NF_TBL_SIZE 64 #define OMAP3ISP_PREV_CFA_TBL_SIZE 576 #define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4) #define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024 #define OMAP3ISP_PREV_YENH_TBL_SIZE 128 #define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS 4 /** * struct omap3isp_prev_hmed - Horizontal Median Filter * @odddist: Distance between consecutive pixels of same color in the odd line. * @evendist: Distance between consecutive pixels of same color in the even * line. * @thres: Horizontal median filter threshold. */ struct omap3isp_prev_hmed { __u8 odddist; __u8 evendist; __u8 thres; }; /* * Enumeration for CFA Formats supported by preview */ enum omap3isp_cfa_fmt { OMAP3ISP_CFAFMT_BAYER, OMAP3ISP_CFAFMT_SONYVGA, OMAP3ISP_CFAFMT_RGBFOVEON, OMAP3ISP_CFAFMT_DNSPL, OMAP3ISP_CFAFMT_HONEYCOMB, OMAP3ISP_CFAFMT_RRGGBBFOVEON }; /** * struct omap3isp_prev_cfa - CFA Interpolation * @format: CFA Format Enum value supported by preview. * @gradthrs_vert: CFA Gradient Threshold - Vertical. * @gradthrs_horz: CFA Gradient Threshold - Horizontal. * @table: Pointer to the CFA table. */ struct omap3isp_prev_cfa { enum omap3isp_cfa_fmt format; __u8 gradthrs_vert; __u8 gradthrs_horz; __u32 table[4][OMAP3ISP_PREV_CFA_BLK_SIZE]; }; /** * struct omap3isp_prev_csup - Chrominance Suppression * @gain: Gain. * @thres: Threshold. * @hypf_en: Flag to enable/disable the High Pass Filter. */ struct omap3isp_prev_csup { __u8 gain; __u8 thres; __u8 hypf_en; }; /** * struct omap3isp_prev_wbal - White Balance * @dgain: Digital gain (U10Q8). * @coef3: White balance gain - COEF 3 (U8Q5). * @coef2: White balance gain - COEF 2 (U8Q5). * @coef1: White balance gain - COEF 1 (U8Q5). * @coef0: White balance gain - COEF 0 (U8Q5). */ struct omap3isp_prev_wbal { __u16 dgain; __u8 coef3; __u8 coef2; __u8 coef1; __u8 coef0; }; /** * struct omap3isp_prev_blkadj - Black Level Adjustment * @red: Black level offset adjustment for Red in 2's complement format * @green: Black level offset adjustment for Green in 2's complement format * @blue: Black level offset adjustment for Blue in 2's complement format */ struct omap3isp_prev_blkadj { /*Black level offset adjustment for Red in 2's complement format */ __u8 red; /*Black level offset adjustment for Green in 2's complement format */ __u8 green; /* Black level offset adjustment for Blue in 2's complement format */ __u8 blue; }; /** * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending * @matrix: Blending values(S12Q8 format) * [RR] [GR] [BR] * [RG] [GG] [BG] * [RB] [GB] [BB] * @offset: Blending offset value for R,G,B in 2's complement integer format. */ struct omap3isp_prev_rgbtorgb { __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX]; __u16 offset[OMAP3ISP_RGB_MAX]; }; /** * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr * @matrix: Color space conversion coefficients(S10Q8) * [CSCRY] [CSCGY] [CSCBY] * [CSCRCB] [CSCGCB] [CSCBCB] * [CSCRCR] [CSCGCR] [CSCBCR] * @offset: CSC offset values for Y offset, CB offset and CR offset respectively */ struct omap3isp_prev_csc { __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX]; __s16 offset[OMAP3ISP_RGB_MAX]; }; /** * struct omap3isp_prev_yclimit - Y, C Value Limit * @minC: Minimum C value * @maxC: Maximum C value * @minY: Minimum Y value * @maxY: Maximum Y value */ struct omap3isp_prev_yclimit { __u8 minC; __u8 maxC; __u8 minY; __u8 maxY; }; /** * struct omap3isp_prev_dcor - Defect correction * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct */ struct omap3isp_prev_dcor { __u8 couplet_mode_en; __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS]; }; /** * struct omap3isp_prev_nf - Noise Filter * @spread: Spread value to be used in Noise Filter * @table: Pointer to the Noise Filter table */ struct omap3isp_prev_nf { __u8 spread; __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE]; }; /** * struct omap3isp_prev_gtables - Gamma correction tables * @red: Array for red gamma table. * @green: Array for green gamma table. * @blue: Array for blue gamma table. */ struct omap3isp_prev_gtables { __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE]; }; /** * struct omap3isp_prev_luma - Luma enhancement * @table: Array for luma enhancement table. */ struct omap3isp_prev_luma { __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE]; }; /** * struct omap3isp_prev_update_config - Preview engine configuration (user) * @update: Specifies which ISP Preview registers should be updated. * @flag: Specifies which ISP Preview functions should be enabled. * @shading_shift: 3bit value of shift used in shading compensation. * @luma: Pointer to luma enhancement structure. * @hmed: Pointer to structure containing the odd and even distance. * between the pixels in the image along with the filter threshold. * @cfa: Pointer to structure containing the CFA interpolation table, CFA. * format in the image, vertical and horizontal gradient threshold. * @csup: Pointer to Structure for Chrominance Suppression coefficients. * @wbal: Pointer to structure for White Balance. * @blkadj: Pointer to structure for Black Adjustment. * @rgb2rgb: Pointer to structure for RGB to RGB Blending. * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr. * @yclimit: Pointer to structure for Y, C Value Limit. * @dcor: Pointer to structure for defect correction. * @nf: Pointer to structure for Noise Filter * @gamma: Pointer to gamma structure. */ struct omap3isp_prev_update_config { __u32 update; __u32 flag; __u32 shading_shift; struct omap3isp_prev_luma *luma; struct omap3isp_prev_hmed *hmed; struct omap3isp_prev_cfa *cfa; struct omap3isp_prev_csup *csup; struct omap3isp_prev_wbal *wbal; struct omap3isp_prev_blkadj *blkadj; struct omap3isp_prev_rgbtorgb *rgb2rgb; struct omap3isp_prev_csc *csc; struct omap3isp_prev_yclimit *yclimit; struct omap3isp_prev_dcor *dcor; struct omap3isp_prev_nf *nf; struct omap3isp_prev_gtables *gamma; }; #endif /* OMAP3_ISP_USER_H */ linux/omapfb.h 0000644 00000013436 15063602053 0007327 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * File: include/linux/omapfb.h * * Framebuffer driver for TI OMAP boards * * Copyright (C) 2004 Nokia Corporation * Author: Imre Deak <imre.deak@nokia.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __LINUX_OMAPFB_H__ #define __LINUX_OMAPFB_H__ #include <linux/fb.h> #include <linux/ioctl.h> #include <linux/types.h> /* IOCTL commands. */ #define OMAP_IOW(num, dtype) _IOW('O', num, dtype) #define OMAP_IOR(num, dtype) _IOR('O', num, dtype) #define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype) #define OMAP_IO(num) _IO('O', num) #define OMAPFB_MIRROR OMAP_IOW(31, int) #define OMAPFB_SYNC_GFX OMAP_IO(37) #define OMAPFB_VSYNC OMAP_IO(38) #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) #define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps) #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) #define OMAPFB_LCD_TEST OMAP_IOW(45, int) #define OMAPFB_CTRL_TEST OMAP_IOW(46, int) #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old) #define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) #define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key) #define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info) #define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info) #define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window) #define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info) #define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info) #define OMAPFB_WAITFORVSYNC OMAP_IO(57) #define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read) #define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode) #define OMAPFB_WAITFORGO OMAP_IO(60) #define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) #define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) #define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info) #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff #define OMAPFB_CAPS_LCDC_MASK 0x00fff000 #define OMAPFB_CAPS_PANEL_MASK 0xff000000 #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 #define OMAPFB_CAPS_TEARSYNC 0x00002000 #define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000 #define OMAPFB_CAPS_PLANE_SCALE 0x00008000 #define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000 #define OMAPFB_CAPS_WINDOW_SCALE 0x00020000 #define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000 #define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000 #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 /* Values from DSP must map to lower 16-bits */ #define OMAPFB_FORMAT_MASK 0x00ff #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 #define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200 #define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400 #define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800 #define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000 #define OMAPFB_MEMTYPE_SDRAM 0 #define OMAPFB_MEMTYPE_SRAM 1 #define OMAPFB_MEMTYPE_MAX 1 #define OMAPFB_MEM_IDX_ENABLED 0x80 #define OMAPFB_MEM_IDX_MASK 0x7f enum omapfb_color_format { OMAPFB_COLOR_RGB565 = 0, OMAPFB_COLOR_YUV422, OMAPFB_COLOR_YUV420, OMAPFB_COLOR_CLUT_8BPP, OMAPFB_COLOR_CLUT_4BPP, OMAPFB_COLOR_CLUT_2BPP, OMAPFB_COLOR_CLUT_1BPP, OMAPFB_COLOR_RGB444, OMAPFB_COLOR_YUY422, OMAPFB_COLOR_ARGB16, OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */ OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */ OMAPFB_COLOR_ARGB32, OMAPFB_COLOR_RGBA32, OMAPFB_COLOR_RGBX32, }; struct omapfb_update_window { __u32 x, y; __u32 width, height; __u32 format; __u32 out_x, out_y; __u32 out_width, out_height; __u32 reserved[8]; }; struct omapfb_update_window_old { __u32 x, y; __u32 width, height; __u32 format; }; enum omapfb_plane { OMAPFB_PLANE_GFX = 0, OMAPFB_PLANE_VID1, OMAPFB_PLANE_VID2, }; enum omapfb_channel_out { OMAPFB_CHANNEL_OUT_LCD = 0, OMAPFB_CHANNEL_OUT_DIGIT, }; struct omapfb_plane_info { __u32 pos_x; __u32 pos_y; __u8 enabled; __u8 channel_out; __u8 mirror; __u8 mem_idx; __u32 out_width; __u32 out_height; __u32 reserved2[12]; }; struct omapfb_mem_info { __u32 size; __u8 type; __u8 reserved[3]; }; struct omapfb_caps { __u32 ctrl; __u32 plane_color; __u32 wnd_color; }; enum omapfb_color_key_type { OMAPFB_COLOR_KEY_DISABLED = 0, OMAPFB_COLOR_KEY_GFX_DST, OMAPFB_COLOR_KEY_VID_SRC, }; struct omapfb_color_key { __u8 channel_out; __u32 background; __u32 trans_key; __u8 key_type; }; enum omapfb_update_mode { OMAPFB_UPDATE_DISABLED = 0, OMAPFB_AUTO_UPDATE, OMAPFB_MANUAL_UPDATE }; struct omapfb_memory_read { __u16 x; __u16 y; __u16 w; __u16 h; size_t buffer_size; void *buffer; }; struct omapfb_ovl_colormode { __u8 overlay_idx; __u8 mode_idx; __u32 bits_per_pixel; __u32 nonstd; struct fb_bitfield red; struct fb_bitfield green; struct fb_bitfield blue; struct fb_bitfield transp; }; struct omapfb_vram_info { __u32 total; __u32 free; __u32 largest_free_block; __u32 reserved[5]; }; struct omapfb_tearsync_info { __u8 enabled; __u8 reserved1[3]; __u16 line; __u16 reserved2; }; struct omapfb_display_info { __u16 xres; __u16 yres; __u32 width; /* phys width of the display in micrometers */ __u32 height; /* phys height of the display in micrometers */ __u32 reserved[5]; }; #endif /* __LINUX_OMAPFB_H__ */ linux/oom.h 0000644 00000000777 15063602053 0006661 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __INCLUDE_LINUX_OOM_H #define __INCLUDE_LINUX_OOM_H /* * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for * pid. */ #define OOM_SCORE_ADJ_MIN (-1000) #define OOM_SCORE_ADJ_MAX 1000 /* * /proc/<pid>/oom_adj set to -17 protects from the oom killer for legacy * purposes. */ #define OOM_DISABLE (-17) /* inclusive */ #define OOM_ADJUST_MIN (-16) #define OOM_ADJUST_MAX 15 #endif /* __INCLUDE_LINUX_OOM_H */ linux/openat2.h 0000644 00000002411 15063602053 0007422 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_OPENAT2_H #define _LINUX_OPENAT2_H #include <linux/types.h> /* * Arguments for how openat2(2) should open the target path. If only @flags and * @mode are non-zero, then openat2(2) operates very similarly to openat(2). * * However, unlike openat(2), unknown or invalid bits in @flags result in * -EINVAL rather than being silently ignored. @mode must be zero unless one of * {O_CREAT, O_TMPFILE} are set. * * @flags: O_* flags. * @mode: O_CREAT/O_TMPFILE file mode. * @resolve: RESOLVE_* flags. */ struct open_how { __u64 flags; __u64 mode; __u64 resolve; }; /* how->resolve flags for openat2(2). */ #define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings (includes bind-mounts). */ #define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style "magic-links". */ #define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks (implies OEXT_NO_MAGICLINKS) */ #define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like "..", symlinks, and absolute paths which escape the dirfd. */ #define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".." be scoped inside the dirfd (similar to chroot(2)). */ #endif /* _LINUX_OPENAT2_H */ linux/openvswitch.h 0000644 00000116370 15063602053 0010435 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2007-2017 Nicira, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA */ #ifndef __LINUX_OPENVSWITCH_H #define __LINUX_OPENVSWITCH_H 1 #include <linux/types.h> #include <linux/if_ether.h> /** * struct ovs_header - header for OVS Generic Netlink messages. * @dp_ifindex: ifindex of local port for datapath (0 to make a request not * specific to a datapath). * * Attributes following the header are specific to a particular OVS Generic * Netlink family, but all of the OVS families use this header. */ struct ovs_header { int dp_ifindex; }; /* Datapaths. */ #define OVS_DATAPATH_FAMILY "ovs_datapath" #define OVS_DATAPATH_MCGROUP "ovs_datapath" /* V2: * - API users are expected to provide OVS_DP_ATTR_USER_FEATURES * when creating the datapath. */ #define OVS_DATAPATH_VERSION 2 /* First OVS datapath version to support features */ #define OVS_DP_VER_FEATURES 2 enum ovs_datapath_cmd { OVS_DP_CMD_UNSPEC, OVS_DP_CMD_NEW, OVS_DP_CMD_DEL, OVS_DP_CMD_GET, OVS_DP_CMD_SET }; /** * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local * port". This is the name of the network device whose dp_ifindex is given in * the &struct ovs_header. Always present in notifications. Required in * %OVS_DP_NEW requests. May be used as an alternative to specifying * dp_ifindex in other requests (with a dp_ifindex of 0). * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should * not be sent. * @OVS_DP_ATTR_PER_CPU_PIDS: Per-cpu array of PIDs for upcalls when * OVS_DP_F_DISPATCH_UPCALL_PER_CPU feature is set. * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the * datapath. Always present in notifications. * @OVS_DP_ATTR_MEGAFLOW_STATS: Statistics about mega flow masks usage for the * datapath. Always present in notifications. * @OVS_DP_ATTR_IFINDEX: Interface index for a new datapath netdev. Only * valid for %OVS_DP_CMD_NEW requests. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_DP_* commands. */ enum ovs_datapath_attr { OVS_DP_ATTR_UNSPEC, OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */ OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */ OVS_DP_ATTR_PAD, OVS_DP_ATTR_MASKS_CACHE_SIZE, OVS_DP_ATTR_PER_CPU_PIDS, /* Netlink PIDS to receive upcalls in * per-cpu dispatch mode */ OVS_DP_ATTR_IFINDEX, __OVS_DP_ATTR_MAX }; #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) struct ovs_dp_stats { __u64 n_hit; /* Number of flow table matches. */ __u64 n_missed; /* Number of flow table misses. */ __u64 n_lost; /* Number of misses not sent to userspace. */ __u64 n_flows; /* Number of flows present */ }; struct ovs_dp_megaflow_stats { __u64 n_mask_hit; /* Number of masks used for flow lookups. */ __u32 n_masks; /* Number of masks for the datapath. */ __u32 pad0; /* Pad for future expension. */ __u64 n_cache_hit; /* Number of cache matches for flow lookups. */ __u64 pad1; /* Pad for future expension. */ }; struct ovs_vport_stats { __u64 rx_packets; /* total packets received */ __u64 tx_packets; /* total packets transmitted */ __u64 rx_bytes; /* total bytes received */ __u64 tx_bytes; /* total bytes transmitted */ __u64 rx_errors; /* bad packets received */ __u64 tx_errors; /* packet transmit problems */ __u64 rx_dropped; /* no space in linux buffers */ __u64 tx_dropped; /* no space available in linux */ }; /* Allow last Netlink attribute to be unaligned */ #define OVS_DP_F_UNALIGNED (1 << 0) /* Allow datapath to associate multiple Netlink PIDs to each vport */ #define OVS_DP_F_VPORT_PIDS (1 << 1) /* Allow tc offload recirc sharing */ #define OVS_DP_F_TC_RECIRC_SHARING (1 << 2) /* Allow per-cpu dispatch of upcalls */ #define OVS_DP_F_DISPATCH_UPCALL_PER_CPU (1 << 3) /* Fixed logical ports. */ #define OVSP_LOCAL ((__u32)0) /* Packet transfer. */ #define OVS_PACKET_FAMILY "ovs_packet" #define OVS_PACKET_VERSION 0x1 enum ovs_packet_cmd { OVS_PACKET_CMD_UNSPEC, /* Kernel-to-user notifications. */ OVS_PACKET_CMD_MISS, /* Flow table miss. */ OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ /* Userspace commands. */ OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ }; /** * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire * packet as received, from the start of the Ethernet header onward. For * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is * the flow key extracted from the packet as originally received. * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows * userspace to adapt its flow setup strategy by comparing its notion of the * flow key against the kernel's. * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. * Also used in upcall when %OVS_ACTION_ATTR_USERSPACE has optional * %OVS_USERSPACE_ATTR_ACTIONS attribute. * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content * specified there. * @OVS_PACKET_ATTR_EGRESS_TUN_KEY: Present for an %OVS_PACKET_CMD_ACTION * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an * %OVS_USERSPACE_ATTR_EGRESS_TUN_PORT attribute, which is sent only if the * output port is actually a tunnel port. Contains the output tunnel key * extracted from the packet as nested %OVS_TUNNEL_KEY_ATTR_* attributes. * @OVS_PACKET_ATTR_MRU: Present for an %OVS_PACKET_CMD_ACTION and * @OVS_PACKET_ATTR_LEN: Packet size before truncation. * %OVS_PACKET_ATTR_USERSPACE action specify the Maximum received fragment * size. * @OVS_PACKET_ATTR_HASH: Packet hash info (e.g. hash, sw_hash and l4_hash in skb). * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_PACKET_* commands. */ enum ovs_packet_attr { OVS_PACKET_ATTR_UNSPEC, OVS_PACKET_ATTR_PACKET, /* Packet data. */ OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_* attributes. */ OVS_PACKET_ATTR_UNUSED1, OVS_PACKET_ATTR_UNUSED2, OVS_PACKET_ATTR_PROBE, /* Packet operation is a feature probe, error logging should be suppressed. */ OVS_PACKET_ATTR_MRU, /* Maximum received IP fragment size. */ OVS_PACKET_ATTR_LEN, /* Packet size before truncation. */ OVS_PACKET_ATTR_HASH, /* Packet hash. */ __OVS_PACKET_ATTR_MAX }; #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) /* Virtual ports. */ #define OVS_VPORT_FAMILY "ovs_vport" #define OVS_VPORT_MCGROUP "ovs_vport" #define OVS_VPORT_VERSION 0x1 enum ovs_vport_cmd { OVS_VPORT_CMD_UNSPEC, OVS_VPORT_CMD_NEW, OVS_VPORT_CMD_DEL, OVS_VPORT_CMD_GET, OVS_VPORT_CMD_SET }; enum ovs_vport_type { OVS_VPORT_TYPE_UNSPEC, OVS_VPORT_TYPE_NETDEV, /* network device */ OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */ __OVS_VPORT_TYPE_MAX }; #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) /** * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type * of vport. * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes * plus a null terminator. * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. * @OVS_VPORT_ATTR_UPCALL_PID: The array of Netlink socket pids in userspace * among which OVS_PACKET_CMD_MISS upcalls will be distributed for packets * received on this port. If this is a single-element array of value 0, * upcalls should not be sent. * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for * packets sent or received through the vport. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_VPORT_* commands. * * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is * optional; if not specified a free port number is automatically selected. * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type * of vport. * * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to * look up the vport to operate on; otherwise dp_idx from the &struct * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. */ enum ovs_vport_attr { OVS_VPORT_ATTR_UNSPEC, OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */ /* receiving upcalls */ OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ OVS_VPORT_ATTR_PAD, OVS_VPORT_ATTR_IFINDEX, OVS_VPORT_ATTR_NETNSID, OVS_VPORT_ATTR_UPCALL_STATS, __OVS_VPORT_ATTR_MAX }; #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) /** * enum ovs_vport_upcall_attr - attributes for %OVS_VPORT_UPCALL* commands * @OVS_VPORT_UPCALL_SUCCESS: 64-bit upcall success packets. * @OVS_VPORT_UPCALL_FAIL: 64-bit upcall fail packets. */ enum ovs_vport_upcall_attr { OVS_VPORT_UPCALL_ATTR_SUCCESS, OVS_VPORT_UPCALL_ATTR_FAIL, __OVS_VPORT_UPCALL_ATTR_MAX }; #define OVS_VPORT_UPCALL_ATTR_MAX (__OVS_VPORT_UPCALL_ATTR_MAX - 1) enum { OVS_VXLAN_EXT_UNSPEC, OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ __OVS_VXLAN_EXT_MAX, }; #define OVS_VXLAN_EXT_MAX (__OVS_VXLAN_EXT_MAX - 1) /* OVS_VPORT_ATTR_OPTIONS attributes for tunnels. */ enum { OVS_TUNNEL_ATTR_UNSPEC, OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */ OVS_TUNNEL_ATTR_EXTENSION, __OVS_TUNNEL_ATTR_MAX }; #define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1) /* Flows. */ #define OVS_FLOW_FAMILY "ovs_flow" #define OVS_FLOW_MCGROUP "ovs_flow" #define OVS_FLOW_VERSION 0x1 enum ovs_flow_cmd { OVS_FLOW_CMD_UNSPEC, OVS_FLOW_CMD_NEW, OVS_FLOW_CMD_DEL, OVS_FLOW_CMD_GET, OVS_FLOW_CMD_SET }; struct ovs_flow_stats { __u64 n_packets; /* Number of matched packets. */ __u64 n_bytes; /* Number of matched bytes. */ }; enum ovs_key_attr { OVS_KEY_ATTR_UNSPEC, OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */ OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */ OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash is not computed by the datapath. */ OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls. * The implementation may restrict * the accepted length of the array. */ OVS_KEY_ATTR_CT_STATE, /* u32 bitmask of OVS_CS_F_* */ OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */ OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */ OVS_KEY_ATTR_CT_LABELS, /* 16-octet connection tracking label */ OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4, /* struct ovs_key_ct_tuple_ipv4 */ OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6, /* struct ovs_key_ct_tuple_ipv6 */ OVS_KEY_ATTR_NSH, /* Nested set of ovs_nsh_key_* */ __OVS_KEY_ATTR_MAX }; #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) enum ovs_tunnel_key_attr { /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */ OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ OVS_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */ OVS_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */ OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested OVS_VXLAN_EXT_* */ OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ OVS_TUNNEL_KEY_ATTR_PAD, OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* struct erspan_metadata */ OVS_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE, /* No argument. IPV4_INFO_BRIDGE mode.*/ __OVS_TUNNEL_KEY_ATTR_MAX }; #define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1) /** * enum ovs_frag_type - IPv4 and IPv6 fragment type * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. * * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct * ovs_key_ipv6. */ enum ovs_frag_type { OVS_FRAG_TYPE_NONE, OVS_FRAG_TYPE_FIRST, OVS_FRAG_TYPE_LATER, __OVS_FRAG_TYPE_MAX }; #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) struct ovs_key_ethernet { __u8 eth_src[ETH_ALEN]; __u8 eth_dst[ETH_ALEN]; }; struct ovs_key_mpls { __be32 mpls_lse; }; struct ovs_key_ipv4 { __be32 ipv4_src; __be32 ipv4_dst; __u8 ipv4_proto; __u8 ipv4_tos; __u8 ipv4_ttl; __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ }; struct ovs_key_ipv6 { __be32 ipv6_src[4]; __be32 ipv6_dst[4]; __be32 ipv6_label; /* 20-bits in least-significant bits. */ __u8 ipv6_proto; __u8 ipv6_tclass; __u8 ipv6_hlimit; __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ }; struct ovs_key_tcp { __be16 tcp_src; __be16 tcp_dst; }; struct ovs_key_udp { __be16 udp_src; __be16 udp_dst; }; struct ovs_key_sctp { __be16 sctp_src; __be16 sctp_dst; }; struct ovs_key_icmp { __u8 icmp_type; __u8 icmp_code; }; struct ovs_key_icmpv6 { __u8 icmpv6_type; __u8 icmpv6_code; }; struct ovs_key_arp { __be32 arp_sip; __be32 arp_tip; __be16 arp_op; __u8 arp_sha[ETH_ALEN]; __u8 arp_tha[ETH_ALEN]; }; struct ovs_key_nd { __be32 nd_target[4]; __u8 nd_sll[ETH_ALEN]; __u8 nd_tll[ETH_ALEN]; }; #define OVS_CT_LABELS_LEN_32 4 #define OVS_CT_LABELS_LEN (OVS_CT_LABELS_LEN_32 * sizeof(__u32)) struct ovs_key_ct_labels { union { __u8 ct_labels[OVS_CT_LABELS_LEN]; __u32 ct_labels_32[OVS_CT_LABELS_LEN_32]; }; }; /* OVS_KEY_ATTR_CT_STATE flags */ #define OVS_CS_F_NEW 0x01 /* Beginning of a new connection. */ #define OVS_CS_F_ESTABLISHED 0x02 /* Part of an existing connection. */ #define OVS_CS_F_RELATED 0x04 /* Related to an established * connection. */ #define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */ #define OVS_CS_F_INVALID 0x10 /* Could not track connection. */ #define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */ #define OVS_CS_F_SRC_NAT 0x40 /* Packet's source address/port was * mangled by NAT. */ #define OVS_CS_F_DST_NAT 0x80 /* Packet's destination address/port * was mangled by NAT. */ #define OVS_CS_F_NAT_MASK (OVS_CS_F_SRC_NAT | OVS_CS_F_DST_NAT) struct ovs_key_ct_tuple_ipv4 { __be32 ipv4_src; __be32 ipv4_dst; __be16 src_port; __be16 dst_port; __u8 ipv4_proto; }; struct ovs_key_ct_tuple_ipv6 { __be32 ipv6_src[4]; __be32 ipv6_dst[4]; __be16 src_port; __be16 dst_port; __u8 ipv6_proto; }; enum ovs_nsh_key_attr { OVS_NSH_KEY_ATTR_UNSPEC, OVS_NSH_KEY_ATTR_BASE, /* struct ovs_nsh_key_base. */ OVS_NSH_KEY_ATTR_MD1, /* struct ovs_nsh_key_md1. */ OVS_NSH_KEY_ATTR_MD2, /* variable-length octets for MD type 2. */ __OVS_NSH_KEY_ATTR_MAX }; #define OVS_NSH_KEY_ATTR_MAX (__OVS_NSH_KEY_ATTR_MAX - 1) struct ovs_nsh_key_base { __u8 flags; __u8 ttl; __u8 mdtype; __u8 np; __be32 path_hdr; }; #define NSH_MD1_CONTEXT_SIZE 4 struct ovs_nsh_key_md1 { __be32 context[NSH_MD1_CONTEXT_SIZE]; }; /** * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow * key. Always present in notifications. Required for all requests (except * dumps). * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying * the actions to take for packets that match the key. Always present in * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions, * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given. * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this * flow. Present in notifications if the stats would be nonzero. Ignored in * requests. * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the * TCP flags seen on packets in this flow. Only present in notifications for * TCP flows, and only if it would be nonzero. Ignored in requests. * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on * the system monotonic clock, at which a packet was last processed for this * flow. Only present in notifications if a packet has been processed for this * flow. Ignored in requests. * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the * last-used time, accumulated TCP flags, and statistics for this flow. * Otherwise ignored in requests. Never present in notifications. * @OVS_FLOW_ATTR_MASK: Nested %OVS_KEY_ATTR_* attributes specifying the * mask bits for wildcarded flow match. Mask bit value '1' specifies exact * match with corresponding flow key bit, while mask bit value '0' specifies * a wildcarded match. Omitting attribute is treated as wildcarding all * corresponding fields. Optional for all requests. If not present, * all flow key bits are exact match bits. * @OVS_FLOW_ATTR_UFID: A value between 1-16 octets specifying a unique * identifier for the flow. Causes the flow to be indexed by this value rather * than the value of the %OVS_FLOW_ATTR_KEY attribute. Optional for all * requests. Present in notifications if the flow was created with this * attribute. * @OVS_FLOW_ATTR_UFID_FLAGS: A 32-bit value of OR'd %OVS_UFID_F_* * flags that provide alternative semantics for flow installation and * retrieval. Optional for all requests. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_FLOW_* commands. */ enum ovs_flow_attr { OVS_FLOW_ATTR_UNSPEC, OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */ OVS_FLOW_ATTR_PROBE, /* Flow operation is a feature probe, error * logging should be suppressed. */ OVS_FLOW_ATTR_UFID, /* Variable length unique flow identifier. */ OVS_FLOW_ATTR_UFID_FLAGS,/* u32 of OVS_UFID_F_*. */ OVS_FLOW_ATTR_PAD, __OVS_FLOW_ATTR_MAX }; #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) /** * Omit attributes for notifications. * * If a datapath request contains an %OVS_UFID_F_OMIT_* flag, then the datapath * may omit the corresponding %OVS_FLOW_ATTR_* from the response. */ #define OVS_UFID_F_OMIT_KEY (1 << 0) #define OVS_UFID_F_OMIT_MASK (1 << 1) #define OVS_UFID_F_OMIT_ACTIONS (1 << 2) /** * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of * %UINT32_MAX samples all packets and intermediate values sample intermediate * fractions of packets. * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. * Actions are passed as nested attributes. * * Executes the specified actions with the given probability on a per-packet * basis. */ enum ovs_sample_attr { OVS_SAMPLE_ATTR_UNSPEC, OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ __OVS_SAMPLE_ATTR_MAX, }; #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) /** * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION * message should be sent. Required. * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. * @OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: If present, u32 output port to get * tunnel info. * @OVS_USERSPACE_ATTR_ACTIONS: If present, send actions with upcall. */ enum ovs_userspace_attr { OVS_USERSPACE_ATTR_UNSPEC, OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ OVS_USERSPACE_ATTR_EGRESS_TUN_PORT, /* Optional, u32 output port * to get tunnel info. */ OVS_USERSPACE_ATTR_ACTIONS, /* Optional flag to get actions. */ __OVS_USERSPACE_ATTR_MAX }; #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) struct ovs_action_trunc { __u32 max_len; /* Max packet size in bytes. */ }; /** * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument. * @mpls_lse: MPLS label stack entry to push. * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame. * * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected. */ struct ovs_action_push_mpls { __be32 mpls_lse; __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */ }; /** * struct ovs_action_add_mpls - %OVS_ACTION_ATTR_ADD_MPLS action * argument. * @mpls_lse: MPLS label stack entry to push. * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame. * @tun_flags: MPLS tunnel attributes. * * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected. */ struct ovs_action_add_mpls { __be32 mpls_lse; __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */ __u16 tun_flags; }; #define OVS_MPLS_L3_TUNNEL_FLAG_MASK (1 << 0) /* Flag to specify the place of * insertion of MPLS header. * When false, the MPLS header * will be inserted at the start * of the packet. * When true, the MPLS header * will be inserted at the start * of the l3 header. */ /** * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. * @vlan_tpid: Tag protocol identifier (TPID) to push. * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set * (but it will not be set in the 802.1Q header that is pushed). * * The @vlan_tpid value is typically %ETH_P_8021Q or %ETH_P_8021AD. * The only acceptable TPID values are those that the kernel module also parses * as 802.1Q or 802.1AD headers, to prevent %OVS_ACTION_ATTR_PUSH_VLAN followed * by %OVS_ACTION_ATTR_POP_VLAN from having surprising results. */ struct ovs_action_push_vlan { __be16 vlan_tpid; /* 802.1Q or 802.1ad TPID. */ __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ }; /* Data path hash algorithm for computing Datapath hash. * * The algorithm type only specifies the fields in a flow * will be used as part of the hash. Each datapath is free * to use its own hash algorithm. The hash value will be * opaque to the user space daemon. */ enum ovs_hash_alg { OVS_HASH_ALG_L4, OVS_HASH_ALG_SYM_L4, }; /* * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument. * @hash_alg: Algorithm used to compute hash prior to recirculation. * @hash_basis: basis used for computing hash. */ struct ovs_action_hash { __u32 hash_alg; /* One of ovs_hash_alg. */ __u32 hash_basis; }; /** * enum ovs_ct_attr - Attributes for %OVS_ACTION_ATTR_CT action. * @OVS_CT_ATTR_COMMIT: If present, commits the connection to the conntrack * table. This allows future packets for the same connection to be identified * as 'established' or 'related'. The flow key for the current packet will * retain the pre-commit connection state. * @OVS_CT_ATTR_ZONE: u16 connection tracking zone. * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the * mask, the corresponding bit in the value is copied to the connection * tracking mark field in the connection. * @OVS_CT_ATTR_LABELS: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN * mask. For each bit set in the mask, the corresponding bit in the value is * copied to the connection tracking label field in the connection. * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. * @OVS_CT_ATTR_NAT: Nested OVS_NAT_ATTR_* for performing L3 network address * translation (NAT) on the packet. * @OVS_CT_ATTR_FORCE_COMMIT: Like %OVS_CT_ATTR_COMMIT, but instead of doing * nothing if the connection is already committed will check that the current * packet is in conntrack entry's original direction. If directionality does * not match, will delete the existing conntrack entry and commit a new one. * @OVS_CT_ATTR_EVENTMASK: Mask of bits indicating which conntrack event types * (enum ip_conntrack_events IPCT_*) should be reported. For any bit set to * zero, the corresponding event type is not generated. Default behavior * depends on system configuration, but typically all event types are * generated, hence listening on NFNLGRP_CONNTRACK_UPDATE events may get a lot * of events. Explicitly passing this attribute allows limiting the updates * received to the events of interest. The bit 1 << IPCT_NEW, 1 << * IPCT_RELATED, and 1 << IPCT_DESTROY must be set to ones for those events to * be received on NFNLGRP_CONNTRACK_NEW and NFNLGRP_CONNTRACK_DESTROY groups, * respectively. Remaining bits control the changes for which an event is * delivered on the NFNLGRP_CONNTRACK_UPDATE group. * @OVS_CT_ATTR_TIMEOUT: Variable length string defining conntrack timeout. */ enum ovs_ct_attr { OVS_CT_ATTR_UNSPEC, OVS_CT_ATTR_COMMIT, /* No argument, commits connection. */ OVS_CT_ATTR_ZONE, /* u16 zone id. */ OVS_CT_ATTR_MARK, /* mark to associate with this connection. */ OVS_CT_ATTR_LABELS, /* labels to associate with this connection. */ OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of related connections. */ OVS_CT_ATTR_NAT, /* Nested OVS_NAT_ATTR_* */ OVS_CT_ATTR_FORCE_COMMIT, /* No argument */ OVS_CT_ATTR_EVENTMASK, /* u32 mask of IPCT_* events. */ OVS_CT_ATTR_TIMEOUT, /* Associate timeout with this connection for * fine-grain timeout tuning. */ __OVS_CT_ATTR_MAX }; #define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1) /** * enum ovs_nat_attr - Attributes for %OVS_CT_ATTR_NAT. * * @OVS_NAT_ATTR_SRC: Flag for Source NAT (mangle source address/port). * @OVS_NAT_ATTR_DST: Flag for Destination NAT (mangle destination * address/port). Only one of (@OVS_NAT_ATTR_SRC, @OVS_NAT_ATTR_DST) may be * specified. Effective only for packets for ct_state NEW connections. * Packets of committed connections are mangled by the NAT action according to * the committed NAT type regardless of the flags specified. As a corollary, a * NAT action without a NAT type flag will only mangle packets of committed * connections. The following NAT attributes only apply for NEW * (non-committed) connections, and they may be included only when the CT * action has the @OVS_CT_ATTR_COMMIT flag and either @OVS_NAT_ATTR_SRC or * @OVS_NAT_ATTR_DST is also included. * @OVS_NAT_ATTR_IP_MIN: struct in_addr or struct in6_addr * @OVS_NAT_ATTR_IP_MAX: struct in_addr or struct in6_addr * @OVS_NAT_ATTR_PROTO_MIN: u16 L4 protocol specific lower boundary (port) * @OVS_NAT_ATTR_PROTO_MAX: u16 L4 protocol specific upper boundary (port) * @OVS_NAT_ATTR_PERSISTENT: Flag for persistent IP mapping across reboots * @OVS_NAT_ATTR_PROTO_HASH: Flag for pseudo random L4 port mapping (MD5) * @OVS_NAT_ATTR_PROTO_RANDOM: Flag for fully randomized L4 port mapping */ enum ovs_nat_attr { OVS_NAT_ATTR_UNSPEC, OVS_NAT_ATTR_SRC, OVS_NAT_ATTR_DST, OVS_NAT_ATTR_IP_MIN, OVS_NAT_ATTR_IP_MAX, OVS_NAT_ATTR_PROTO_MIN, OVS_NAT_ATTR_PROTO_MAX, OVS_NAT_ATTR_PERSISTENT, OVS_NAT_ATTR_PROTO_HASH, OVS_NAT_ATTR_PROTO_RANDOM, __OVS_NAT_ATTR_MAX, }; #define OVS_NAT_ATTR_MAX (__OVS_NAT_ATTR_MAX - 1) /* * struct ovs_action_push_eth - %OVS_ACTION_ATTR_PUSH_ETH action argument. * @addresses: Source and destination MAC addresses. * @eth_type: Ethernet type */ struct ovs_action_push_eth { struct ovs_key_ethernet addresses; }; /* * enum ovs_check_pkt_len_attr - Attributes for %OVS_ACTION_ATTR_CHECK_PKT_LEN. * * @OVS_CHECK_PKT_LEN_ATTR_PKT_LEN: u16 Packet length to check for. * @OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER: Nested OVS_ACTION_ATTR_* * actions to apply if the packer length is greater than the specified * length in the attr - OVS_CHECK_PKT_LEN_ATTR_PKT_LEN. * @OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL - Nested OVS_ACTION_ATTR_* * actions to apply if the packer length is lesser or equal to the specified * length in the attr - OVS_CHECK_PKT_LEN_ATTR_PKT_LEN. */ enum ovs_check_pkt_len_attr { OVS_CHECK_PKT_LEN_ATTR_UNSPEC, OVS_CHECK_PKT_LEN_ATTR_PKT_LEN, OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER, OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL, __OVS_CHECK_PKT_LEN_ATTR_MAX, }; #define OVS_CHECK_PKT_LEN_ATTR_MAX (__OVS_CHECK_PKT_LEN_ATTR_MAX - 1) /** * enum ovs_action_attr - Action types. * * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. * @OVS_ACTION_ATTR_TRUNC: Output packet to port with truncated packet size. * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested * %OVS_USERSPACE_ATTR_* attributes. * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its * value. * @OVS_ACTION_ATTR_SET_MASKED: Replaces the contents of an existing header. A * nested %OVS_KEY_ATTR_* attribute specifies a header to modify, its value, * and a mask. For every bit set in the mask, the corresponding bit value * is copied from the value to the packet header field, rest of the bits are * left unchanged. The non-masked value bits must be passed in as zeroes. * Masking is not supported for the %OVS_KEY_ATTR_TUNNEL attribute. * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q or 802.1ad header * onto the packet. * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q or 802.1ad header * from the packet. * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in * the nested %OVS_SAMPLE_ATTR_* attributes. * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the * top of the packets MPLS label stack. Set the ethertype of the * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to * indicate the new packet contents. * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the * packet's MPLS label stack. Set the encapsulating frame's ethertype to * indicate the new packet contents. This could potentially still be * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there * is no MPLS label stack, as determined by ethertype, no action is taken. * @OVS_ACTION_ATTR_CT: Track the connection. Populate the conntrack-related * entries in the flow key. * @OVS_ACTION_ATTR_PUSH_ETH: Push a new outermost Ethernet header onto the * packet. * @OVS_ACTION_ATTR_POP_ETH: Pop the outermost Ethernet header off the * packet. * @OVS_ACTION_ATTR_CT_CLEAR: Clear conntrack state from the packet. * @OVS_ACTION_ATTR_PUSH_NSH: push NSH header to the packet. * @OVS_ACTION_ATTR_POP_NSH: pop the outermost NSH header off the packet. * @OVS_ACTION_ATTR_METER: Run packet through a meter, which may drop the * packet, or modify the packet (e.g., change the DSCP field). * @OVS_ACTION_ATTR_CLONE: make a copy of the packet and execute a list of * actions without affecting the original packet and key. * @OVS_ACTION_ATTR_CHECK_PKT_LEN: Check the packet length and execute a set * of actions if greater than the specified packet length, else execute * another set of actions. * @OVS_ACTION_ATTR_ADD_MPLS: Push a new MPLS label stack entry at the * start of the packet or at the start of the l3 header depending on the value * of l3 tunnel flag in the tun_flags field of OVS_ACTION_ATTR_ADD_MPLS * argument. * * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all * fields within a header are modifiable, e.g. the IPv4 protocol and fragment * type may not be changed. * * @OVS_ACTION_ATTR_SET_TO_MASKED: Kernel internal masked set action translated * from the @OVS_ACTION_ATTR_SET. */ enum ovs_action_attr { OVS_ACTION_ATTR_UNSPEC, OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */ OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */ OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */ OVS_ACTION_ATTR_SET_MASKED, /* One nested OVS_KEY_ATTR_* including * data immediately followed by a mask. * The data must be zero for the unmasked * bits. */ OVS_ACTION_ATTR_CT, /* Nested OVS_CT_ATTR_* . */ OVS_ACTION_ATTR_TRUNC, /* u32 struct ovs_action_trunc. */ OVS_ACTION_ATTR_PUSH_ETH, /* struct ovs_action_push_eth. */ OVS_ACTION_ATTR_POP_ETH, /* No argument. */ OVS_ACTION_ATTR_CT_CLEAR, /* No argument. */ OVS_ACTION_ATTR_PUSH_NSH, /* Nested OVS_NSH_KEY_ATTR_*. */ OVS_ACTION_ATTR_POP_NSH, /* No argument. */ OVS_ACTION_ATTR_METER, /* u32 meter ID. */ OVS_ACTION_ATTR_CLONE, /* Nested OVS_CLONE_ATTR_*. */ OVS_ACTION_ATTR_CHECK_PKT_LEN, /* Nested OVS_CHECK_PKT_LEN_ATTR_*. */ OVS_ACTION_ATTR_ADD_MPLS, /* struct ovs_action_add_mpls. */ OVS_ACTION_ATTR_DEC_TTL, /* Nested OVS_DEC_TTL_ATTR_*. */ __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted * from userspace. */ }; #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) /* Meters. */ #define OVS_METER_FAMILY "ovs_meter" #define OVS_METER_MCGROUP "ovs_meter" #define OVS_METER_VERSION 0x1 enum ovs_meter_cmd { OVS_METER_CMD_UNSPEC, OVS_METER_CMD_FEATURES, /* Get features supported by the datapath. */ OVS_METER_CMD_SET, /* Add or modify a meter. */ OVS_METER_CMD_DEL, /* Delete a meter. */ OVS_METER_CMD_GET /* Get meter stats. */ }; enum ovs_meter_attr { OVS_METER_ATTR_UNSPEC, OVS_METER_ATTR_ID, /* u32 meter ID within datapath. */ OVS_METER_ATTR_KBPS, /* No argument. If set, units in kilobits * per second. Otherwise, units in * packets per second. */ OVS_METER_ATTR_STATS, /* struct ovs_flow_stats for the meter. */ OVS_METER_ATTR_BANDS, /* Nested attributes for meter bands. */ OVS_METER_ATTR_USED, /* u64 msecs last used in monotonic time. */ OVS_METER_ATTR_CLEAR, /* Flag to clear stats, used. */ OVS_METER_ATTR_MAX_METERS, /* u32 number of meters supported. */ OVS_METER_ATTR_MAX_BANDS, /* u32 max number of bands per meter. */ OVS_METER_ATTR_PAD, __OVS_METER_ATTR_MAX }; #define OVS_METER_ATTR_MAX (__OVS_METER_ATTR_MAX - 1) enum ovs_band_attr { OVS_BAND_ATTR_UNSPEC, OVS_BAND_ATTR_TYPE, /* u32 OVS_METER_BAND_TYPE_* constant. */ OVS_BAND_ATTR_RATE, /* u32 band rate in meter units (see above). */ OVS_BAND_ATTR_BURST, /* u32 burst size in meter units. */ OVS_BAND_ATTR_STATS, /* struct ovs_flow_stats for the band. */ __OVS_BAND_ATTR_MAX }; #define OVS_BAND_ATTR_MAX (__OVS_BAND_ATTR_MAX - 1) enum ovs_meter_band_type { OVS_METER_BAND_TYPE_UNSPEC, OVS_METER_BAND_TYPE_DROP, /* Drop exceeding packets. */ __OVS_METER_BAND_TYPE_MAX }; #define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1) /* Conntrack limit */ #define OVS_CT_LIMIT_FAMILY "ovs_ct_limit" #define OVS_CT_LIMIT_MCGROUP "ovs_ct_limit" #define OVS_CT_LIMIT_VERSION 0x1 enum ovs_ct_limit_cmd { OVS_CT_LIMIT_CMD_UNSPEC, OVS_CT_LIMIT_CMD_SET, /* Add or modify ct limit. */ OVS_CT_LIMIT_CMD_DEL, /* Delete ct limit. */ OVS_CT_LIMIT_CMD_GET /* Get ct limit. */ }; enum ovs_ct_limit_attr { OVS_CT_LIMIT_ATTR_UNSPEC, OVS_CT_LIMIT_ATTR_ZONE_LIMIT, /* Nested struct ovs_zone_limit. */ __OVS_CT_LIMIT_ATTR_MAX }; #define OVS_CT_LIMIT_ATTR_MAX (__OVS_CT_LIMIT_ATTR_MAX - 1) #define OVS_ZONE_LIMIT_DEFAULT_ZONE -1 struct ovs_zone_limit { int zone_id; __u32 limit; __u32 count; }; enum ovs_dec_ttl_attr { OVS_DEC_TTL_ATTR_UNSPEC, OVS_DEC_TTL_ATTR_ACTION, /* Nested struct nlattr */ __OVS_DEC_TTL_ATTR_MAX }; #define OVS_DEC_TTL_ATTR_MAX (__OVS_DEC_TTL_ATTR_MAX - 1) #endif /* _LINUX_OPENVSWITCH_H */ linux/packet_diag.h 0000644 00000003210 15063602053 0010303 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __PACKET_DIAG_H__ #define __PACKET_DIAG_H__ #include <linux/types.h> struct packet_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; __u16 pad; __u32 pdiag_ino; __u32 pdiag_show; __u32 pdiag_cookie[2]; }; #define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */ #define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ #define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ #define PACKET_SHOW_FANOUT 0x00000008 #define PACKET_SHOW_MEMINFO 0x00000010 #define PACKET_SHOW_FILTER 0x00000020 struct packet_diag_msg { __u8 pdiag_family; __u8 pdiag_type; __u16 pdiag_num; __u32 pdiag_ino; __u32 pdiag_cookie[2]; }; enum { /* PACKET_DIAG_NONE, standard nl API requires this attribute! */ PACKET_DIAG_INFO, PACKET_DIAG_MCLIST, PACKET_DIAG_RX_RING, PACKET_DIAG_TX_RING, PACKET_DIAG_FANOUT, PACKET_DIAG_UID, PACKET_DIAG_MEMINFO, PACKET_DIAG_FILTER, __PACKET_DIAG_MAX, }; #define PACKET_DIAG_MAX (__PACKET_DIAG_MAX - 1) struct packet_diag_info { __u32 pdi_index; __u32 pdi_version; __u32 pdi_reserve; __u32 pdi_copy_thresh; __u32 pdi_tstamp; __u32 pdi_flags; #define PDI_RUNNING 0x1 #define PDI_AUXDATA 0x2 #define PDI_ORIGDEV 0x4 #define PDI_VNETHDR 0x8 #define PDI_LOSS 0x10 }; struct packet_diag_mclist { __u32 pdmc_index; __u32 pdmc_count; __u16 pdmc_type; __u16 pdmc_alen; __u8 pdmc_addr[32]; /* MAX_ADDR_LEN */ }; struct packet_diag_ring { __u32 pdr_block_size; __u32 pdr_block_nr; __u32 pdr_frame_size; __u32 pdr_frame_nr; __u32 pdr_retire_tmo; __u32 pdr_sizeof_priv; __u32 pdr_features; }; #endif linux/param.h 0000644 00000000215 15063602053 0007152 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PARAM_H #define _LINUX_PARAM_H #include <asm/param.h> #endif linux/parport.h 0000644 00000007074 15063602053 0007553 0 ustar 00 /* * Any part of this program may be used in documents licensed under * the GNU Free Documentation License, Version 1.1 or any later version * published by the Free Software Foundation. */ #ifndef _PARPORT_H_ #define _PARPORT_H_ /* Start off with user-visible constants */ /* Maximum of 16 ports per machine */ #define PARPORT_MAX 16 /* Magic numbers */ #define PARPORT_IRQ_NONE -1 #define PARPORT_DMA_NONE -1 #define PARPORT_IRQ_AUTO -2 #define PARPORT_DMA_AUTO -2 #define PARPORT_DMA_NOFIFO -3 #define PARPORT_DISABLE -2 #define PARPORT_IRQ_PROBEONLY -3 #define PARPORT_IOHI_AUTO -1 #define PARPORT_CONTROL_STROBE 0x1 #define PARPORT_CONTROL_AUTOFD 0x2 #define PARPORT_CONTROL_INIT 0x4 #define PARPORT_CONTROL_SELECT 0x8 #define PARPORT_STATUS_ERROR 0x8 #define PARPORT_STATUS_SELECT 0x10 #define PARPORT_STATUS_PAPEROUT 0x20 #define PARPORT_STATUS_ACK 0x40 #define PARPORT_STATUS_BUSY 0x80 /* Type classes for Plug-and-Play probe. */ typedef enum { PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */ PARPORT_CLASS_PRINTER, PARPORT_CLASS_MODEM, PARPORT_CLASS_NET, PARPORT_CLASS_HDC, /* Hard disk controller */ PARPORT_CLASS_PCMCIA, PARPORT_CLASS_MEDIA, /* Multimedia device */ PARPORT_CLASS_FDC, /* Floppy disk controller */ PARPORT_CLASS_PORTS, PARPORT_CLASS_SCANNER, PARPORT_CLASS_DIGCAM, PARPORT_CLASS_OTHER, /* Anything else */ PARPORT_CLASS_UNSPEC, /* No CLS field in ID */ PARPORT_CLASS_SCSIADAPTER } parport_device_class; /* The "modes" entry in parport is a bit field representing the capabilities of the hardware. */ #define PARPORT_MODE_PCSPP (1<<0) /* IBM PC registers available. */ #define PARPORT_MODE_TRISTATE (1<<1) /* Can tristate. */ #define PARPORT_MODE_EPP (1<<2) /* Hardware EPP. */ #define PARPORT_MODE_ECP (1<<3) /* Hardware ECP. */ #define PARPORT_MODE_COMPAT (1<<4) /* Hardware 'printer protocol'. */ #define PARPORT_MODE_DMA (1<<5) /* Hardware can DMA. */ #define PARPORT_MODE_SAFEININT (1<<6) /* SPP registers accessible in IRQ. */ /* IEEE1284 modes: Nibble mode, byte mode, ECP, ECPRLE and EPP are their own 'extensibility request' values. Others are special. 'Real' ECP modes must have the IEEE1284_MODE_ECP bit set. */ #define IEEE1284_MODE_NIBBLE 0 #define IEEE1284_MODE_BYTE (1<<0) #define IEEE1284_MODE_COMPAT (1<<8) #define IEEE1284_MODE_BECP (1<<9) /* Bounded ECP mode */ #define IEEE1284_MODE_ECP (1<<4) #define IEEE1284_MODE_ECPRLE (IEEE1284_MODE_ECP | (1<<5)) #define IEEE1284_MODE_ECPSWE (1<<10) /* Software-emulated */ #define IEEE1284_MODE_EPP (1<<6) #define IEEE1284_MODE_EPPSL (1<<11) /* EPP 1.7 */ #define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */ #define IEEE1284_DEVICEID (1<<2) /* This is a flag */ #define IEEE1284_EXT_LINK (1<<14) /* This flag causes the * extensibility link to * be requested, using * bits 0-6. */ /* For the benefit of parport_read/write, you can use these with * parport_negotiate to use address operations. They have no effect * other than to make parport_read/write use address transfers. */ #define IEEE1284_ADDR (1<<13) /* This is a flag */ #define IEEE1284_DATA 0 /* So is this */ /* Flags for block transfer operations. */ #define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */ #define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */ /* The rest is for the kernel only */ #endif /* _PARPORT_H_ */ linux/patchkey.h 0000644 00000001574 15063602053 0007673 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/patchkey.h> -- definition of _PATCHKEY macro * * Copyright (C) 2005 Stuart Brady * * This exists because awe_voice.h defined its own _PATCHKEY and it wasn't * clear whether removing this would break anything in userspace. * * Do not include this file directly. Please use <sys/soundcard.h> instead. * For kernel code, use <linux/soundcard.h> */ #ifndef _LINUX_PATCHKEY_H_INDIRECT #error "patchkey.h included directly" #endif #ifndef _LINUX_PATCHKEY_H #define _LINUX_PATCHKEY_H /* Endian macros. */ # include <endian.h> #if defined(__BYTE_ORDER) # if __BYTE_ORDER == __BIG_ENDIAN # define _PATCHKEY(id) (0xfd00|id) # elif __BYTE_ORDER == __LITTLE_ENDIAN # define _PATCHKEY(id) ((id<<8)|0x00fd) # else # error "could not determine byte order" # endif #endif #endif /* _LINUX_PATCHKEY_H */ linux/pci.h 0000644 00000002544 15063602053 0006634 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * pci.h * * PCI defines and function prototypes * Copyright 1994, Drew Eckhardt * Copyright 1997--1999 Martin Mares <mj@ucw.cz> * * For more information, please consult the following manuals (look at * http://www.pcisig.com/ for how to get them): * * PCI BIOS Specification * PCI Local Bus Specification * PCI to PCI Bridge Specification * PCI System Design Guide */ #ifndef LINUX_PCI_H #define LINUX_PCI_H #include <linux/pci_regs.h> /* The pci register defines */ /* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded * in a single byte as follows: * * 7:3 = slot * 2:0 = function */ #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) /* Ioctls for /proc/bus/pci/X/Y nodes. */ #define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8) #define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) /* Get controller for PCI device. */ #define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) /* Set mmap state to I/O space. */ #define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) /* Set mmap state to MEM space. */ #define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) /* Enable/disable write-combining. */ #endif /* LINUX_PCI_H */ linux/pci_regs.h 0000644 00000160743 15063602053 0007662 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * PCI standard defines * Copyright 1994, Drew Eckhardt * Copyright 1997--1999 Martin Mares <mj@ucw.cz> * * For more information, please consult the following manuals (look at * http://www.pcisig.com/ for how to get them): * * PCI BIOS Specification * PCI Local Bus Specification * PCI to PCI Bridge Specification * PCI System Design Guide * * For HyperTransport information, please consult the following manuals * from http://www.hypertransport.org : * * The HyperTransport I/O Link Specification */ #ifndef LINUX_PCI_REGS_H #define LINUX_PCI_REGS_H /* * Conventional PCI and PCI-X Mode 1 devices have 256 bytes of * configuration space. PCI-X Mode 2 and PCIe devices have 4096 bytes of * configuration space. */ #define PCI_CFG_SPACE_SIZE 256 #define PCI_CFG_SPACE_EXP_SIZE 4096 /* * Under PCI, each device has 256 bytes of configuration address space, * of which the first 64 bytes are standardized as follows: */ #define PCI_STD_HEADER_SIZEOF 64 #define PCI_STD_NUM_BARS 6 #define PCI_VENDOR_ID 0x00 /* 16 bits */ #define PCI_DEVICE_ID 0x02 /* 16 bits */ #define PCI_COMMAND 0x04 /* 16 bits */ #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ #define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ #define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ #define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ #define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ #define PCI_COMMAND_SERR 0x100 /* Enable SERR */ #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ #define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ #define PCI_STATUS 0x06 /* 16 bits */ #define PCI_STATUS_IMM_READY 0x01 /* Immediate Readiness */ #define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */ #define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ #define PCI_STATUS_66MHZ 0x20 /* Support 66 MHz PCI 2.1 bus */ #define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ #define PCI_STATUS_DEVSEL_FAST 0x000 #define PCI_STATUS_DEVSEL_MEDIUM 0x200 #define PCI_STATUS_DEVSEL_SLOW 0x400 #define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ #define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ #define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ #define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ #define PCI_REVISION_ID 0x08 /* Revision ID */ #define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ #define PCI_CLASS_DEVICE 0x0a /* Device class */ #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ #define PCI_HEADER_TYPE 0x0e /* 8 bits */ #define PCI_HEADER_TYPE_MASK 0x7f #define PCI_HEADER_TYPE_NORMAL 0 #define PCI_HEADER_TYPE_BRIDGE 1 #define PCI_HEADER_TYPE_CARDBUS 2 #define PCI_BIST 0x0f /* 8 bits */ #define PCI_BIST_CODE_MASK 0x0f /* Return result */ #define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ #define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ /* * Base addresses specify locations in memory or I/O space. * Decoded size can be determined by writing a value of * 0xffffffff to the register, and reading it back. Only * 1 bits are decoded. */ #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ #define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ #define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ #define PCI_BASE_ADDRESS_SPACE_IO 0x01 #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) #define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) /* bit 1 is reserved if address_space = 1 */ /* Header type 0 (normal devices) */ #define PCI_CARDBUS_CIS 0x28 #define PCI_SUBSYSTEM_VENDOR_ID 0x2c #define PCI_SUBSYSTEM_ID 0x2e #define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ #define PCI_ROM_ADDRESS_ENABLE 0x01 #define PCI_ROM_ADDRESS_MASK (~0x7ffU) #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ /* 0x35-0x3b are reserved */ #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ #define PCI_MIN_GNT 0x3e /* 8 bits */ #define PCI_MAX_LAT 0x3f /* 8 bits */ /* Header type 1 (PCI-to-PCI bridges) */ #define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ #define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ #define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ #define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ #define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ #define PCI_IO_LIMIT 0x1d #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ #define PCI_IO_RANGE_TYPE_16 0x00 #define PCI_IO_RANGE_TYPE_32 0x01 #define PCI_IO_RANGE_MASK (~0x0fUL) /* Standard 4K I/O windows */ #define PCI_IO_1K_RANGE_MASK (~0x03UL) /* Intel 1K I/O windows */ #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ #define PCI_MEMORY_LIMIT 0x22 #define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL #define PCI_MEMORY_RANGE_MASK (~0x0fUL) #define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ #define PCI_PREF_MEMORY_LIMIT 0x26 #define PCI_PREF_RANGE_TYPE_MASK 0x0fUL #define PCI_PREF_RANGE_TYPE_32 0x00 #define PCI_PREF_RANGE_TYPE_64 0x01 #define PCI_PREF_RANGE_MASK (~0x0fUL) #define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ #define PCI_PREF_LIMIT_UPPER32 0x2c #define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ #define PCI_IO_LIMIT_UPPER16 0x32 /* 0x34 same as for htype 0 */ /* 0x35-0x3b is reserved */ #define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ /* 0x3c-0x3d are same as for htype 0 */ #define PCI_BRIDGE_CONTROL 0x3e #define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ #define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ #define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */ #define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ #define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ #define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ /* Header type 2 (CardBus bridges) */ #define PCI_CB_CAPABILITY_LIST 0x14 /* 0x15 reserved */ #define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ #define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ #define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ #define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ #define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ #define PCI_CB_MEMORY_BASE_0 0x1c #define PCI_CB_MEMORY_LIMIT_0 0x20 #define PCI_CB_MEMORY_BASE_1 0x24 #define PCI_CB_MEMORY_LIMIT_1 0x28 #define PCI_CB_IO_BASE_0 0x2c #define PCI_CB_IO_BASE_0_HI 0x2e #define PCI_CB_IO_LIMIT_0 0x30 #define PCI_CB_IO_LIMIT_0_HI 0x32 #define PCI_CB_IO_BASE_1 0x34 #define PCI_CB_IO_BASE_1_HI 0x36 #define PCI_CB_IO_LIMIT_1 0x38 #define PCI_CB_IO_LIMIT_1_HI 0x3a #define PCI_CB_IO_RANGE_MASK (~0x03UL) /* 0x3c-0x3d are same as for htype 0 */ #define PCI_CB_BRIDGE_CONTROL 0x3e #define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ #define PCI_CB_BRIDGE_CTL_SERR 0x02 #define PCI_CB_BRIDGE_CTL_ISA 0x04 #define PCI_CB_BRIDGE_CTL_VGA 0x08 #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 #define PCI_CB_SUBSYSTEM_ID 0x42 #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ /* 0x48-0x7f reserved */ /* Capability lists */ #define PCI_CAP_LIST_ID 0 /* Capability ID */ #define PCI_CAP_ID_PM 0x01 /* Power Management */ #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ #define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ #define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ #define PCI_CAP_ID_HT 0x08 /* HyperTransport */ #define PCI_CAP_ID_VNDR 0x09 /* Vendor-Specific */ #define PCI_CAP_ID_DBG 0x0A /* Debug port */ #define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ #define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ #define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ #define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */ #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ #define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */ #define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ #define PCI_CAP_ID_EA 0x14 /* PCI Enhanced Allocation */ #define PCI_CAP_ID_MAX PCI_CAP_ID_EA #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ #define PCI_CAP_SIZEOF 4 /* Power Management Registers */ #define PCI_PM_PMC 2 /* PM Capabilities Register */ #define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ #define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ #define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ #define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ #define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxiliary power support mask */ #define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ #define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ #define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ #define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ #define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ #define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ #define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ #define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ #define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ #define PCI_PM_CTRL 4 /* PM control and status register */ #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ #define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */ #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ #define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ #define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ #define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ #define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ #define PCI_PM_DATA_REGISTER 7 /* (??) */ #define PCI_PM_SIZEOF 8 /* AGP registers */ #define PCI_AGP_VERSION 2 /* BCD version number */ #define PCI_AGP_RFU 3 /* Rest of capability flags */ #define PCI_AGP_STATUS 4 /* Status register */ #define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ #define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ #define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ #define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ #define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ #define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ #define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ #define PCI_AGP_COMMAND 8 /* Control register */ #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ #define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ #define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ #define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ #define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ #define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ #define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ #define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ #define PCI_AGP_SIZEOF 12 /* Vital Product Data */ #define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ #define PCI_CAP_VPD_SIZEOF 8 /* Slot Identification */ #define PCI_SID_ESR 2 /* Expansion Slot Register */ #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ /* Message Signalled Interrupt registers */ #define PCI_MSI_FLAGS 2 /* Message Control */ #define PCI_MSI_FLAGS_ENABLE 0x0001 /* MSI feature enabled */ #define PCI_MSI_FLAGS_QMASK 0x000e /* Maximum queue size available */ #define PCI_MSI_FLAGS_QSIZE 0x0070 /* Message queue size configured */ #define PCI_MSI_FLAGS_64BIT 0x0080 /* 64-bit addresses allowed */ #define PCI_MSI_FLAGS_MASKBIT 0x0100 /* Per-vector masking capable */ #define PCI_MSI_RFU 3 /* Rest of capability flags */ #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ #define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */ #define PCI_MSI_PENDING_32 16 /* Pending intrs for 32-bit devices */ #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ #define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ #define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ /* MSI-X registers (in MSI-X capability) */ #define PCI_MSIX_FLAGS 2 /* Message Control */ #define PCI_MSIX_FLAGS_QSIZE 0x07FF /* Table size */ #define PCI_MSIX_FLAGS_MASKALL 0x4000 /* Mask all vectors for this function */ #define PCI_MSIX_FLAGS_ENABLE 0x8000 /* MSI-X enable */ #define PCI_MSIX_TABLE 4 /* Table offset */ #define PCI_MSIX_TABLE_BIR 0x00000007 /* BAR index */ #define PCI_MSIX_TABLE_OFFSET 0xfffffff8 /* Offset into specified BAR */ #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ #define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */ #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ /* MSI-X Table entry format (in memory mapped by a BAR) */ #define PCI_MSIX_ENTRY_SIZE 16 #define PCI_MSIX_ENTRY_LOWER_ADDR 0 /* Message Address */ #define PCI_MSIX_ENTRY_UPPER_ADDR 4 /* Message Upper Address */ #define PCI_MSIX_ENTRY_DATA 8 /* Message Data */ #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 /* Vector Control */ #define PCI_MSIX_ENTRY_CTRL_MASKBIT 0x00000001 /* CompactPCI Hotswap Register */ #define PCI_CHSWP_CSR 2 /* Control and Status Register */ #define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ #define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ #define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ #define PCI_CHSWP_LOO 0x08 /* LED On / Off */ #define PCI_CHSWP_PI 0x30 /* Programming Interface */ #define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ #define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ /* PCI Advanced Feature registers */ #define PCI_AF_LENGTH 2 #define PCI_AF_CAP 3 #define PCI_AF_CAP_TP 0x01 #define PCI_AF_CAP_FLR 0x02 #define PCI_AF_CTRL 4 #define PCI_AF_CTRL_FLR 0x01 #define PCI_AF_STATUS 5 #define PCI_AF_STATUS_TP 0x01 #define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */ /* PCI Enhanced Allocation registers */ #define PCI_EA_NUM_ENT 2 /* Number of Capability Entries */ #define PCI_EA_NUM_ENT_MASK 0x3f /* Num Entries Mask */ #define PCI_EA_FIRST_ENT 4 /* First EA Entry in List */ #define PCI_EA_FIRST_ENT_BRIDGE 8 /* First EA Entry for Bridges */ #define PCI_EA_ES 0x00000007 /* Entry Size */ #define PCI_EA_BEI 0x000000f0 /* BAR Equivalent Indicator */ /* EA fixed Secondary and Subordinate bus numbers for Bridge */ #define PCI_EA_SEC_BUS_MASK 0xff #define PCI_EA_SUB_BUS_MASK 0xff00 #define PCI_EA_SUB_BUS_SHIFT 8 /* 0-5 map to BARs 0-5 respectively */ #define PCI_EA_BEI_BAR0 0 #define PCI_EA_BEI_BAR5 5 #define PCI_EA_BEI_BRIDGE 6 /* Resource behind bridge */ #define PCI_EA_BEI_ENI 7 /* Equivalent Not Indicated */ #define PCI_EA_BEI_ROM 8 /* Expansion ROM */ /* 9-14 map to VF BARs 0-5 respectively */ #define PCI_EA_BEI_VF_BAR0 9 #define PCI_EA_BEI_VF_BAR5 14 #define PCI_EA_BEI_RESERVED 15 /* Reserved - Treat like ENI */ #define PCI_EA_PP 0x0000ff00 /* Primary Properties */ #define PCI_EA_SP 0x00ff0000 /* Secondary Properties */ #define PCI_EA_P_MEM 0x00 /* Non-Prefetch Memory */ #define PCI_EA_P_MEM_PREFETCH 0x01 /* Prefetchable Memory */ #define PCI_EA_P_IO 0x02 /* I/O Space */ #define PCI_EA_P_VF_MEM_PREFETCH 0x03 /* VF Prefetchable Memory */ #define PCI_EA_P_VF_MEM 0x04 /* VF Non-Prefetch Memory */ #define PCI_EA_P_BRIDGE_MEM 0x05 /* Bridge Non-Prefetch Memory */ #define PCI_EA_P_BRIDGE_MEM_PREFETCH 0x06 /* Bridge Prefetchable Memory */ #define PCI_EA_P_BRIDGE_IO 0x07 /* Bridge I/O Space */ /* 0x08-0xfc reserved */ #define PCI_EA_P_MEM_RESERVED 0xfd /* Reserved Memory */ #define PCI_EA_P_IO_RESERVED 0xfe /* Reserved I/O Space */ #define PCI_EA_P_UNAVAILABLE 0xff /* Entry Unavailable */ #define PCI_EA_WRITABLE 0x40000000 /* Writable: 1 = RW, 0 = HwInit */ #define PCI_EA_ENABLE 0x80000000 /* Enable for this entry */ #define PCI_EA_BASE 4 /* Base Address Offset */ #define PCI_EA_MAX_OFFSET 8 /* MaxOffset (resource length) */ /* bit 0 is reserved */ #define PCI_EA_IS_64 0x00000002 /* 64-bit field flag */ #define PCI_EA_FIELD_MASK 0xfffffffc /* For Base & Max Offset */ /* PCI-X registers (Type 0 (non-bridge) devices) */ #define PCI_X_CMD 2 /* Modes & Features */ #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ #define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ #define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */ #define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */ #define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */ #define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */ #define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ /* Max # of outstanding split transactions */ #define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */ #define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */ #define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */ #define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */ #define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */ #define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */ #define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ #define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ #define PCI_X_STATUS 4 /* PCI-X capabilities */ #define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ #define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ #define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ #define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ #define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ #define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ #define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ #define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ #define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ #define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ #define PCI_X_ECC_CSR 8 /* ECC control and status */ #define PCI_CAP_PCIX_SIZEOF_V0 8 /* size of registers for Version 0 */ #define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */ #define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */ /* PCI-X registers (Type 1 (bridge) devices) */ #define PCI_X_BRIDGE_SSTATUS 2 /* Secondary Status */ #define PCI_X_SSTATUS_64BIT 0x0001 /* Secondary AD interface is 64 bits */ #define PCI_X_SSTATUS_133MHZ 0x0002 /* 133 MHz capable */ #define PCI_X_SSTATUS_FREQ 0x03c0 /* Secondary Bus Mode and Frequency */ #define PCI_X_SSTATUS_VERS 0x3000 /* PCI-X Capability Version */ #define PCI_X_SSTATUS_V1 0x1000 /* Mode 2, not Mode 1 */ #define PCI_X_SSTATUS_V2 0x2000 /* Mode 1 or Modes 1 and 2 */ #define PCI_X_SSTATUS_266MHZ 0x4000 /* 266 MHz capable */ #define PCI_X_SSTATUS_533MHZ 0x8000 /* 533 MHz capable */ #define PCI_X_BRIDGE_STATUS 4 /* Bridge Status */ /* PCI Bridge Subsystem ID registers */ #define PCI_SSVID_VENDOR_ID 4 /* PCI Bridge subsystem vendor ID */ #define PCI_SSVID_DEVICE_ID 6 /* PCI Bridge subsystem device ID */ /* PCI Express capability registers */ #define PCI_EXP_FLAGS 2 /* Capabilities register */ #define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ #define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ #define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ #define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCIe to PCI/PCI-X Bridge */ #define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIe Bridge */ #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ #define PCI_EXP_DEVCAP 4 /* Device capabilities */ #define PCI_EXP_DEVCAP_PAYLOAD 0x00000007 /* Max_Payload_Size */ #define PCI_EXP_DEVCAP_PHANTOM 0x00000018 /* Phantom functions */ #define PCI_EXP_DEVCAP_EXT_TAG 0x00000020 /* Extended tags */ #define PCI_EXP_DEVCAP_L0S 0x000001c0 /* L0s Acceptable Latency */ #define PCI_EXP_DEVCAP_L1 0x00000e00 /* L1 Acceptable Latency */ #define PCI_EXP_DEVCAP_ATN_BUT 0x00001000 /* Attention Button Present */ #define PCI_EXP_DEVCAP_ATN_IND 0x00002000 /* Attention Indicator Present */ #define PCI_EXP_DEVCAP_PWR_IND 0x00004000 /* Power Indicator Present */ #define PCI_EXP_DEVCAP_RBER 0x00008000 /* Role-Based Error Reporting */ #define PCI_EXP_DEVCAP_PWR_VAL 0x03fc0000 /* Slot Power Limit Value */ #define PCI_EXP_DEVCAP_PWR_SCL 0x0c000000 /* Slot Power Limit Scale */ #define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */ #define PCI_EXP_DEVCTL 8 /* Device Control */ #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ #define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ #define PCI_EXP_DEVCTL_READRQ_128B 0x0000 /* 128 Bytes */ #define PCI_EXP_DEVCTL_READRQ_256B 0x1000 /* 256 Bytes */ #define PCI_EXP_DEVCTL_READRQ_512B 0x2000 /* 512 Bytes */ #define PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */ #define PCI_EXP_DEVCTL_READRQ_2048B 0x4000 /* 2048 Bytes */ #define PCI_EXP_DEVCTL_READRQ_4096B 0x5000 /* 4096 Bytes */ #define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ #define PCI_EXP_DEVSTA 10 /* Device Status */ #define PCI_EXP_DEVSTA_CED 0x0001 /* Correctable Error Detected */ #define PCI_EXP_DEVSTA_NFED 0x0002 /* Non-Fatal Error Detected */ #define PCI_EXP_DEVSTA_FED 0x0004 /* Fatal Error Detected */ #define PCI_EXP_DEVSTA_URD 0x0008 /* Unsupported Request Detected */ #define PCI_EXP_DEVSTA_AUXPD 0x0010 /* AUX Power Detected */ #define PCI_EXP_DEVSTA_TRPND 0x0020 /* Transactions Pending */ #define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V1 12 /* v1 endpoints without link end here */ #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ #define PCI_EXP_LNKCAP_SLS_2_5GB 0x00000001 /* LNKCAP2 SLS Vector bit 0 */ #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */ #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */ #define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004 /* LNKCAP2 SLS Vector bit 3 */ #define PCI_EXP_LNKCAP_SLS_32_0GB 0x00000005 /* LNKCAP2 SLS Vector bit 4 */ #define PCI_EXP_LNKCAP_SLS_64_0GB 0x00000006 /* LNKCAP2 SLS Vector bit 5 */ #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ #define PCI_EXP_LNKCAP_ASPM_L0S 0x00000400 /* ASPM L0s Support */ #define PCI_EXP_LNKCAP_ASPM_L1 0x00000800 /* ASPM L1 Support */ #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ #define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */ #define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* Clock Power Management */ #define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Surprise Down Error Reporting Capable */ #define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */ #define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */ #define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */ #define PCI_EXP_LNKCTL 16 /* Link Control */ #define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */ #define PCI_EXP_LNKCTL_ASPM_L0S 0x0001 /* L0s Enable */ #define PCI_EXP_LNKCTL_ASPM_L1 0x0002 /* L1 Enable */ #define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ #define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */ #define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */ #define PCI_EXP_LNKCTL_CCC 0x0040 /* Common Clock Configuration */ #define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */ #define PCI_EXP_LNKCTL_CLKREQ_EN 0x0100 /* Enable clkreq */ #define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */ #define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */ #define PCI_EXP_LNKCTL_LABIE 0x0800 /* Link Autonomous Bandwidth Interrupt Enable */ #define PCI_EXP_LNKSTA 18 /* Link Status */ #define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ #define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */ #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */ #define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003 /* Current Link Speed 8.0GT/s */ #define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004 /* Current Link Speed 16.0GT/s */ #define PCI_EXP_LNKSTA_CLS_32_0GB 0x0005 /* Current Link Speed 32.0GT/s */ #define PCI_EXP_LNKSTA_CLS_64_0GB 0x0006 /* Current Link Speed 64.0GT/s */ #define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */ #define PCI_EXP_LNKSTA_NLW_X1 0x0010 /* Current Link Width x1 */ #define PCI_EXP_LNKSTA_NLW_X2 0x0020 /* Current Link Width x2 */ #define PCI_EXP_LNKSTA_NLW_X4 0x0040 /* Current Link Width x4 */ #define PCI_EXP_LNKSTA_NLW_X8 0x0080 /* Current Link Width x8 */ #define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */ #define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ #define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V1 20 /* v1 endpoints with link end here */ #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ #define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */ #define PCI_EXP_SLTCAP_AIP 0x00000008 /* Attention Indicator Present */ #define PCI_EXP_SLTCAP_PIP 0x00000010 /* Power Indicator Present */ #define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */ #define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */ #define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value */ #define PCI_EXP_SLTCAP_SPLS 0x00018000 /* Slot Power Limit Scale */ #define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */ #define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */ #define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ #define PCI_EXP_SLTCTL 24 /* Slot Control */ #define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */ #define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */ #define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */ #define PCI_EXP_SLTCTL_PDCE 0x0008 /* Presence Detect Changed Enable */ #define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */ #define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ #define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */ #define PCI_EXP_SLTCTL_ATTN_IND_SHIFT 6 /* Attention Indicator shift */ #define PCI_EXP_SLTCTL_ATTN_IND_ON 0x0040 /* Attention Indicator on */ #define PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */ #define PCI_EXP_SLTCTL_ATTN_IND_OFF 0x00c0 /* Attention Indicator off */ #define PCI_EXP_SLTCTL_PIC 0x0300 /* Power Indicator Control */ #define PCI_EXP_SLTCTL_PWR_IND_ON 0x0100 /* Power Indicator on */ #define PCI_EXP_SLTCTL_PWR_IND_BLINK 0x0200 /* Power Indicator blinking */ #define PCI_EXP_SLTCTL_PWR_IND_OFF 0x0300 /* Power Indicator off */ #define PCI_EXP_SLTCTL_PCC 0x0400 /* Power Controller Control */ #define PCI_EXP_SLTCTL_PWR_ON 0x0000 /* Power On */ #define PCI_EXP_SLTCTL_PWR_OFF 0x0400 /* Power Off */ #define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */ #define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */ #define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000 /* In-band PD disable */ #define PCI_EXP_SLTSTA 26 /* Slot Status */ #define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */ #define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */ #define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */ #define PCI_EXP_SLTSTA_PDC 0x0008 /* Presence Detect Changed */ #define PCI_EXP_SLTSTA_CC 0x0010 /* Command Completed */ #define PCI_EXP_SLTSTA_MRLSS 0x0020 /* MRL Sensor State */ #define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */ #define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */ #define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */ #define PCI_EXP_RTCTL 28 /* Root Control */ #define PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */ #define PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */ #define PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */ #define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */ #define PCI_EXP_RTCTL_CRSSVE 0x0010 /* CRS Software Visibility Enable */ #define PCI_EXP_RTCAP 30 /* Root Capabilities */ #define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */ #define PCI_EXP_RTSTA 32 /* Root Status */ #define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */ #define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */ /* * The Device Capabilities 2, Device Status 2, Device Control 2, * Link Capabilities 2, Link Status 2, Link Control 2, * Slot Capabilities 2, Slot Status 2, and Slot Control 2 registers * are only present on devices with PCIe Capability version 2. * Use pcie_capability_read_word() and similar interfaces to use them * safely. */ #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ #define PCI_EXP_DEVCAP2_COMP_TMOUT_DIS 0x00000010 /* Completion Timeout Disable supported */ #define PCI_EXP_DEVCAP2_ARI 0x00000020 /* Alternative Routing-ID */ #define PCI_EXP_DEVCAP2_ATOMIC_ROUTE 0x00000040 /* Atomic Op routing */ #define PCI_EXP_DEVCAP2_ATOMIC_COMP32 0x00000080 /* 32b AtomicOp completion */ #define PCI_EXP_DEVCAP2_ATOMIC_COMP64 0x00000100 /* 64b AtomicOp completion */ #define PCI_EXP_DEVCAP2_ATOMIC_COMP128 0x00000200 /* 128b AtomicOp completion */ #define PCI_EXP_DEVCAP2_LTR 0x00000800 /* Latency tolerance reporting */ #define PCI_EXP_DEVCAP2_OBFF_MASK 0x000c0000 /* OBFF support mechanism */ #define PCI_EXP_DEVCAP2_OBFF_MSG 0x00040000 /* New message signaling */ #define PCI_EXP_DEVCAP2_OBFF_WAKE 0x00080000 /* Re-use WAKE# for OBFF */ #define PCI_EXP_DEVCAP2_EE_PREFIX 0x00200000 /* End-End TLP Prefix */ #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ #define PCI_EXP_DEVCTL2_COMP_TIMEOUT 0x000f /* Completion Timeout Value */ #define PCI_EXP_DEVCTL2_COMP_TMOUT_DIS 0x0010 /* Completion Timeout Disable */ #define PCI_EXP_DEVCTL2_ARI 0x0020 /* Alternative Routing-ID */ #define PCI_EXP_DEVCTL2_ATOMIC_REQ 0x0040 /* Set Atomic requests */ #define PCI_EXP_DEVCTL2_ATOMIC_EGRESS_BLOCK 0x0080 /* Block atomic egress */ #define PCI_EXP_DEVCTL2_IDO_REQ_EN 0x0100 /* Allow IDO for requests */ #define PCI_EXP_DEVCTL2_IDO_CMP_EN 0x0200 /* Allow IDO for completions */ #define PCI_EXP_DEVCTL2_LTR_EN 0x0400 /* Enable LTR mechanism */ #define PCI_EXP_DEVCTL2_OBFF_MSGA_EN 0x2000 /* Enable OBFF Message type A */ #define PCI_EXP_DEVCTL2_OBFF_MSGB_EN 0x4000 /* Enable OBFF Message type B */ #define PCI_EXP_DEVCTL2_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ #define PCI_EXP_DEVSTA2 42 /* Device Status 2 */ #define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints without link end here */ #define PCI_EXP_LNKCAP2 44 /* Link Capabilities 2 */ #define PCI_EXP_LNKCAP2_SLS_2_5GB 0x00000002 /* Supported Speed 2.5GT/s */ #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004 /* Supported Speed 5GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008 /* Supported Speed 8GT/s */ #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010 /* Supported Speed 16GT/s */ #define PCI_EXP_LNKCAP2_SLS_32_0GB 0x00000020 /* Supported Speed 32GT/s */ #define PCI_EXP_LNKCAP2_SLS_64_0GB 0x00000040 /* Supported Speed 64GT/s */ #define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100 /* Crosslink supported */ #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ #define PCI_EXP_LNKCTL2_TLS 0x000f #define PCI_EXP_LNKCTL2_TLS_2_5GT 0x0001 /* Supported Speed 2.5GT/s */ #define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */ #define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */ #define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */ #define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005 /* Supported Speed 32GT/s */ #define PCI_EXP_LNKCTL2_TLS_64_0GT 0x0006 /* Supported Speed 64GT/s */ #define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010 /* Enter Compliance */ #define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */ #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52 /* v2 endpoints with link end here */ #define PCI_EXP_SLTCAP2 52 /* Slot Capabilities 2 */ #define PCI_EXP_SLTCAP2_IBPD 0x00000001 /* In-band PD Disable Supported */ #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ #define PCI_EXP_SLTSTA2 58 /* Slot Status 2 */ /* Extended Capabilities (PCI-X 2.0 and Express) */ #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) #define PCI_EXT_CAP_ID_ERR 0x01 /* Advanced Error Reporting */ #define PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel Capability */ #define PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */ #define PCI_EXT_CAP_ID_PWR 0x04 /* Power Budgeting */ #define PCI_EXT_CAP_ID_RCLD 0x05 /* Root Complex Link Declaration */ #define PCI_EXT_CAP_ID_RCILC 0x06 /* Root Complex Internal Link Control */ #define PCI_EXT_CAP_ID_RCEC 0x07 /* Root Complex Event Collector */ #define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */ #define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */ #define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */ #define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor-Specific */ #define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */ #define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */ #define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */ #define PCI_EXT_CAP_ID_ATS 0x0F /* Address Translation Services */ #define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ #define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */ #define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */ #define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */ #define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* Reserved for AMD */ #define PCI_EXT_CAP_ID_REBAR 0x15 /* Resizable BAR */ #define PCI_EXT_CAP_ID_DPA 0x16 /* Dynamic Power Allocation */ #define PCI_EXT_CAP_ID_TPH 0x17 /* TPH Requester */ #define PCI_EXT_CAP_ID_LTR 0x18 /* Latency Tolerance Reporting */ #define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe Capability */ #define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */ #define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */ #define PCI_EXT_CAP_ID_DPC 0x1D /* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1SS 0x1E /* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F /* Precision Time Measurement */ #define PCI_EXT_CAP_ID_DVSEC 0x23 /* Designated Vendor-Specific */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_DVSEC #define PCI_EXT_CAP_DSN_SIZEOF 12 #define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40 /* Advanced Error Reporting */ #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ #define PCI_ERR_UNC_UND 0x00000001 /* Undefined */ #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ #define PCI_ERR_UNC_SURPDN 0x00000020 /* Surprise Down */ #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ #define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ #define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ #define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ #define PCI_ERR_UNC_ACSV 0x00200000 /* ACS Violation */ #define PCI_ERR_UNC_INTN 0x00400000 /* internal error */ #define PCI_ERR_UNC_MCBTLP 0x00800000 /* MC blocked TLP */ #define PCI_ERR_UNC_ATOMEG 0x01000000 /* Atomic egress blocked */ #define PCI_ERR_UNC_TLPPRE 0x02000000 /* TLP prefix blocked */ #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ /* Same bits as above */ #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ /* Same bits as above */ #define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ #define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ #define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ #define PCI_ERR_COR_ADV_NFAT 0x00002000 /* Advisory Non-Fatal */ #define PCI_ERR_COR_INTERNAL 0x00004000 /* Corrected Internal */ #define PCI_ERR_COR_LOG_OVER 0x00008000 /* Header Log Overflow */ #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ /* Same bits as above */ #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ #define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ #define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ #define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ #define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ #define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ #define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 /* Correctable Err Reporting Enable */ #define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 /* Non-Fatal Err Reporting Enable */ #define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 /* Fatal Err Reporting Enable */ #define PCI_ERR_ROOT_STATUS 48 #define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ #define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 /* Multiple ERR_COR */ #define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 /* ERR_FATAL/NONFATAL */ #define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 /* Multiple FATAL/NONFATAL */ #define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First UNC is Fatal */ #define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ #define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ #define PCI_ERR_ROOT_AER_IRQ 0xf8000000 /* Advanced Error Interrupt Message Number */ #define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */ /* Virtual Channel */ #define PCI_VC_PORT_CAP1 4 #define PCI_VC_CAP1_EVCC 0x00000007 /* extended VC count */ #define PCI_VC_CAP1_LPEVCC 0x00000070 /* low prio extended VC count */ #define PCI_VC_CAP1_ARB_SIZE 0x00000c00 #define PCI_VC_PORT_CAP2 8 #define PCI_VC_CAP2_32_PHASE 0x00000002 #define PCI_VC_CAP2_64_PHASE 0x00000004 #define PCI_VC_CAP2_128_PHASE 0x00000008 #define PCI_VC_CAP2_ARB_OFF 0xff000000 #define PCI_VC_PORT_CTRL 12 #define PCI_VC_PORT_CTRL_LOAD_TABLE 0x00000001 #define PCI_VC_PORT_STATUS 14 #define PCI_VC_PORT_STATUS_TABLE 0x00000001 #define PCI_VC_RES_CAP 16 #define PCI_VC_RES_CAP_32_PHASE 0x00000002 #define PCI_VC_RES_CAP_64_PHASE 0x00000004 #define PCI_VC_RES_CAP_128_PHASE 0x00000008 #define PCI_VC_RES_CAP_128_PHASE_TB 0x00000010 #define PCI_VC_RES_CAP_256_PHASE 0x00000020 #define PCI_VC_RES_CAP_ARB_OFF 0xff000000 #define PCI_VC_RES_CTRL 20 #define PCI_VC_RES_CTRL_LOAD_TABLE 0x00010000 #define PCI_VC_RES_CTRL_ARB_SELECT 0x000e0000 #define PCI_VC_RES_CTRL_ID 0x07000000 #define PCI_VC_RES_CTRL_ENABLE 0x80000000 #define PCI_VC_RES_STATUS 26 #define PCI_VC_RES_STATUS_TABLE 0x00000001 #define PCI_VC_RES_STATUS_NEGO 0x00000002 #define PCI_CAP_VC_BASE_SIZEOF 0x10 #define PCI_CAP_VC_PER_VC_SIZEOF 0x0C /* Power Budgeting */ #define PCI_PWR_DSR 4 /* Data Select Register */ #define PCI_PWR_DATA 8 /* Data Register */ #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ #define PCI_PWR_CAP 12 /* Capability */ #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ #define PCI_EXT_CAP_PWR_SIZEOF 16 /* Root Complex Event Collector Endpoint Association */ #define PCI_RCEC_RCIEP_BITMAP 4 /* Associated Bitmap for RCiEPs */ #define PCI_RCEC_BUSN 8 /* RCEC Associated Bus Numbers */ #define PCI_RCEC_BUSN_REG_VER 0x02 /* Least version with BUSN present */ #define PCI_RCEC_BUSN_NEXT(x) (((x) >> 8) & 0xff) #define PCI_RCEC_BUSN_LAST(x) (((x) >> 16) & 0xff) /* Vendor-Specific (VSEC, PCI_EXT_CAP_ID_VNDR) */ #define PCI_VNDR_HEADER 4 /* Vendor-Specific Header */ #define PCI_VNDR_HEADER_ID(x) ((x) & 0xffff) #define PCI_VNDR_HEADER_REV(x) (((x) >> 16) & 0xf) #define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff) /* * HyperTransport sub capability types * * Unfortunately there are both 3 bit and 5 bit capability types defined * in the HT spec, catering for that is a little messy. You probably don't * want to use these directly, just use pci_find_ht_capability() and it * will do the right thing for you. */ #define HT_3BIT_CAP_MASK 0xE0 #define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */ #define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */ #define HT_5BIT_CAP_MASK 0xF8 #define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */ #define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */ #define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */ #define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */ #define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */ #define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */ #define HT_MSI_FLAGS 0x02 /* Offset to flags */ #define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */ #define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */ #define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */ #define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */ #define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */ #define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */ #define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ #define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 HyperTransport configuration */ #define HT_CAPTYPE_PM 0xE0 /* HyperTransport power management configuration */ #define HT_CAP_SIZEOF_LONG 28 /* slave & primary */ #define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */ /* Alternative Routing-ID Interpretation */ #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ #define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */ #define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */ #define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */ #define PCI_ARI_CTRL 0x06 /* ARI Control Register */ #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ #define PCI_EXT_CAP_ARI_SIZEOF 8 /* Address Translation Service */ #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ #define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f) /* Invalidate Queue Depth */ #define PCI_ATS_MAX_QDEP 32 /* Max Invalidate Queue Depth */ #define PCI_ATS_CAP_PAGE_ALIGNED 0x0020 /* Page Aligned Request */ #define PCI_ATS_CTRL 0x06 /* ATS Control Register */ #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ #define PCI_EXT_CAP_ATS_SIZEOF 8 /* Page Request Interface */ #define PCI_PRI_CTRL 0x04 /* PRI control register */ #define PCI_PRI_CTRL_ENABLE 0x0001 /* Enable */ #define PCI_PRI_CTRL_RESET 0x0002 /* Reset */ #define PCI_PRI_STATUS 0x06 /* PRI status register */ #define PCI_PRI_STATUS_RF 0x0001 /* Response Failure */ #define PCI_PRI_STATUS_UPRGI 0x0002 /* Unexpected PRG index */ #define PCI_PRI_STATUS_STOPPED 0x0100 /* PRI Stopped */ #define PCI_PRI_STATUS_PASID 0x8000 /* PRG Response PASID Required */ #define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */ #define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ #define PCI_EXT_CAP_PRI_SIZEOF 16 /* Process Address Space ID */ #define PCI_PASID_CAP 0x04 /* PASID feature register */ #define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */ #define PCI_PASID_CAP_PRIV 0x04 /* Privilege Mode Supported */ #define PCI_PASID_CTRL 0x06 /* PASID control register */ #define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ #define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ #define PCI_PASID_CTRL_PRIV 0x04 /* Privilege Mode Enable */ #define PCI_EXT_CAP_PASID_SIZEOF 8 /* Single Root I/O Virtualization */ #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ #define PCI_SRIOV_CAP_VFM 0x00000001 /* VF Migration Capable */ #define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */ #define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */ #define PCI_SRIOV_CTRL_VFE 0x0001 /* VF Enable */ #define PCI_SRIOV_CTRL_VFM 0x0002 /* VF Migration Enable */ #define PCI_SRIOV_CTRL_INTR 0x0004 /* VF Migration Interrupt Enable */ #define PCI_SRIOV_CTRL_MSE 0x0008 /* VF Memory Space Enable */ #define PCI_SRIOV_CTRL_ARI 0x0010 /* ARI Capable Hierarchy */ #define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */ #define PCI_SRIOV_STATUS_VFM 0x0001 /* VF Migration Status */ #define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */ #define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */ #define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */ #define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */ #define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */ #define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */ #define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */ #define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */ #define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */ #define PCI_SRIOV_BAR 0x24 /* VF BAR0 */ #define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */ #define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/ #define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */ #define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */ #define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */ #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ #define PCI_EXT_CAP_SRIOV_SIZEOF 64 #define PCI_LTR_MAX_SNOOP_LAT 0x4 #define PCI_LTR_MAX_NOSNOOP_LAT 0x6 #define PCI_LTR_VALUE_MASK 0x000003ff #define PCI_LTR_SCALE_MASK 0x00001c00 #define PCI_LTR_SCALE_SHIFT 10 #define PCI_EXT_CAP_LTR_SIZEOF 8 /* Access Control Service */ #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ #define PCI_ACS_SV 0x0001 /* Source Validation */ #define PCI_ACS_TB 0x0002 /* Translation Blocking */ #define PCI_ACS_RR 0x0004 /* P2P Request Redirect */ #define PCI_ACS_CR 0x0008 /* P2P Completion Redirect */ #define PCI_ACS_UF 0x0010 /* Upstream Forwarding */ #define PCI_ACS_EC 0x0020 /* P2P Egress Control */ #define PCI_ACS_DT 0x0040 /* Direct Translated P2P */ #define PCI_ACS_EGRESS_BITS 0x05 /* ACS Egress Control Vector Size */ #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ #define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */ #define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */ /* SATA capability */ #define PCI_SATA_REGS 4 /* SATA REGs specifier */ #define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */ #define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */ #define PCI_SATA_SIZEOF_SHORT 8 #define PCI_SATA_SIZEOF_LONG 16 /* Resizable BARs */ #define PCI_REBAR_CAP 4 /* capability register */ #define PCI_REBAR_CAP_SIZES 0x00FFFFF0 /* supported BAR sizes */ #define PCI_REBAR_CTRL 8 /* control register */ #define PCI_REBAR_CTRL_BAR_IDX 0x00000007 /* BAR index */ #define PCI_REBAR_CTRL_NBAR_MASK 0x000000E0 /* # of resizable BARs */ #define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # of BARs */ #define PCI_REBAR_CTRL_BAR_SIZE 0x00001F00 /* BAR size */ #define PCI_REBAR_CTRL_BAR_SHIFT 8 /* shift for BAR size */ /* Dynamic Power Allocation */ #define PCI_DPA_CAP 4 /* capability register */ #define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */ #define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */ /* TPH Requester */ #define PCI_TPH_CAP 4 /* capability register */ #define PCI_TPH_CAP_LOC_MASK 0x600 /* location mask */ #define PCI_TPH_LOC_NONE 0x000 /* no location */ #define PCI_TPH_LOC_CAP 0x200 /* in capability */ #define PCI_TPH_LOC_MSIX 0x400 /* in MSI-X */ #define PCI_TPH_CAP_ST_MASK 0x07FF0000 /* st table mask */ #define PCI_TPH_CAP_ST_SHIFT 16 /* st table shift */ #define PCI_TPH_BASE_SIZEOF 12 /* size with no st table */ /* Downstream Port Containment */ #define PCI_EXP_DPC_CAP 4 /* DPC Capability */ #define PCI_EXP_DPC_IRQ 0x001F /* Interrupt Message Number */ #define PCI_EXP_DPC_CAP_RP_EXT 0x0020 /* Root Port Extensions */ #define PCI_EXP_DPC_CAP_POISONED_TLP 0x0040 /* Poisoned TLP Egress Blocking Supported */ #define PCI_EXP_DPC_CAP_SW_TRIGGER 0x0080 /* Software Triggering Supported */ #define PCI_EXP_DPC_RP_PIO_LOG_SIZE 0x0F00 /* RP PIO Log Size */ #define PCI_EXP_DPC_CAP_DL_ACTIVE 0x1000 /* ERR_COR signal on DL_Active supported */ #define PCI_EXP_DPC_CTL 6 /* DPC control */ #define PCI_EXP_DPC_CTL_EN_FATAL 0x0001 /* Enable trigger on ERR_FATAL message */ #define PCI_EXP_DPC_CTL_EN_NONFATAL 0x0002 /* Enable trigger on ERR_NONFATAL message */ #define PCI_EXP_DPC_CTL_INT_EN 0x0008 /* DPC Interrupt Enable */ #define PCI_EXP_DPC_STATUS 8 /* DPC Status */ #define PCI_EXP_DPC_STATUS_TRIGGER 0x0001 /* Trigger Status */ #define PCI_EXP_DPC_STATUS_TRIGGER_RSN 0x0006 /* Trigger Reason */ #define PCI_EXP_DPC_STATUS_INTERRUPT 0x0008 /* Interrupt Status */ #define PCI_EXP_DPC_RP_BUSY 0x0010 /* Root Port Busy */ #define PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT 0x0060 /* Trig Reason Extension */ #define PCI_EXP_DPC_SOURCE_ID 10 /* DPC Source Identifier */ #define PCI_EXP_DPC_RP_PIO_STATUS 0x0C /* RP PIO Status */ #define PCI_EXP_DPC_RP_PIO_MASK 0x10 /* RP PIO Mask */ #define PCI_EXP_DPC_RP_PIO_SEVERITY 0x14 /* RP PIO Severity */ #define PCI_EXP_DPC_RP_PIO_SYSERROR 0x18 /* RP PIO SysError */ #define PCI_EXP_DPC_RP_PIO_EXCEPTION 0x1C /* RP PIO Exception */ #define PCI_EXP_DPC_RP_PIO_HEADER_LOG 0x20 /* RP PIO Header Log */ #define PCI_EXP_DPC_RP_PIO_IMPSPEC_LOG 0x30 /* RP PIO ImpSpec Log */ #define PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG 0x34 /* RP PIO TLP Prefix Log */ /* Precision Time Measurement */ #define PCI_PTM_CAP 0x04 /* PTM Capability */ #define PCI_PTM_CAP_REQ 0x00000001 /* Requester capable */ #define PCI_PTM_CAP_ROOT 0x00000004 /* Root capable */ #define PCI_PTM_GRANULARITY_MASK 0x0000FF00 /* Clock granularity */ #define PCI_PTM_CTRL 0x08 /* PTM Control */ #define PCI_PTM_CTRL_ENABLE 0x00000001 /* PTM enable */ #define PCI_PTM_CTRL_ROOT 0x00000002 /* Root select */ /* ASPM L1 PM Substates */ #define PCI_L1SS_CAP 0x04 /* Capabilities Register */ #define PCI_L1SS_CAP_PCIPM_L1_2 0x00000001 /* PCI-PM L1.2 Supported */ #define PCI_L1SS_CAP_PCIPM_L1_1 0x00000002 /* PCI-PM L1.1 Supported */ #define PCI_L1SS_CAP_ASPM_L1_2 0x00000004 /* ASPM L1.2 Supported */ #define PCI_L1SS_CAP_ASPM_L1_1 0x00000008 /* ASPM L1.1 Supported */ #define PCI_L1SS_CAP_L1_PM_SS 0x00000010 /* L1 PM Substates Supported */ #define PCI_L1SS_CAP_CM_RESTORE_TIME 0x0000ff00 /* Port Common_Mode_Restore_Time */ #define PCI_L1SS_CAP_P_PWR_ON_SCALE 0x00030000 /* Port T_POWER_ON scale */ #define PCI_L1SS_CAP_P_PWR_ON_VALUE 0x00f80000 /* Port T_POWER_ON value */ #define PCI_L1SS_CTL1 0x08 /* Control 1 Register */ #define PCI_L1SS_CTL1_PCIPM_L1_2 0x00000001 /* PCI-PM L1.2 Enable */ #define PCI_L1SS_CTL1_PCIPM_L1_1 0x00000002 /* PCI-PM L1.1 Enable */ #define PCI_L1SS_CTL1_ASPM_L1_2 0x00000004 /* ASPM L1.2 Enable */ #define PCI_L1SS_CTL1_ASPM_L1_1 0x00000008 /* ASPM L1.1 Enable */ #define PCI_L1SS_CTL1_L1_2_MASK 0x00000005 #define PCI_L1SS_CTL1_L1SS_MASK 0x0000000f #define PCI_L1SS_CTL1_CM_RESTORE_TIME 0x0000ff00 /* Common_Mode_Restore_Time */ #define PCI_L1SS_CTL1_LTR_L12_TH_VALUE 0x03ff0000 /* LTR_L1.2_THRESHOLD_Value */ #define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000 /* LTR_L1.2_THRESHOLD_Scale */ #define PCI_L1SS_CTL2 0x0c /* Control 2 Register */ /* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */ #define PCI_DVSEC_HEADER1 0x4 /* Designated Vendor-Specific Header1 */ #define PCI_DVSEC_HEADER1_VID(x) ((x) & 0xffff) #define PCI_DVSEC_HEADER1_REV(x) (((x) >> 16) & 0xf) #define PCI_DVSEC_HEADER1_LEN(x) (((x) >> 20) & 0xfff) #define PCI_DVSEC_HEADER2 0x8 /* Designated Vendor-Specific Header2 */ #define PCI_DVSEC_HEADER2_ID(x) ((x) & 0xffff) #endif /* LINUX_PCI_REGS_H */ linux/pcitest.h 0000644 00000001307 15063602054 0007531 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /** * pcitest.h - PCI test uapi defines * * Copyright (C) 2017 Texas Instruments * Author: Kishon Vijay Abraham I <kishon@ti.com> * */ #ifndef __UAPI_LINUX_PCITEST_H #define __UAPI_LINUX_PCITEST_H #define PCITEST_BAR _IO('P', 0x1) #define PCITEST_LEGACY_IRQ _IO('P', 0x2) #define PCITEST_MSI _IOW('P', 0x3, int) #define PCITEST_WRITE _IOW('P', 0x4, unsigned long) #define PCITEST_READ _IOW('P', 0x5, unsigned long) #define PCITEST_COPY _IOW('P', 0x6, unsigned long) #define PCITEST_MSIX _IOW('P', 0x7, int) #define PCITEST_SET_IRQTYPE _IOW('P', 0x8, int) #define PCITEST_GET_IRQTYPE _IO('P', 0x9) #endif /* __UAPI_LINUX_PCITEST_H */ linux/perf_event.h 0000644 00000117204 15063602054 0010217 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Performance events: * * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> * Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar * Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra * * Data type definitions, declarations, prototypes. * * Started by: Thomas Gleixner and Ingo Molnar * * For licencing details see kernel-base/COPYING */ #ifndef _LINUX_PERF_EVENT_H #define _LINUX_PERF_EVENT_H #include <linux/types.h> #include <linux/ioctl.h> #include <asm/byteorder.h> /* * User-space ABI bits: */ /* * attr.type */ enum perf_type_id { PERF_TYPE_HARDWARE = 0, PERF_TYPE_SOFTWARE = 1, PERF_TYPE_TRACEPOINT = 2, PERF_TYPE_HW_CACHE = 3, PERF_TYPE_RAW = 4, PERF_TYPE_BREAKPOINT = 5, PERF_TYPE_MAX, /* non-ABI */ }; /* * attr.config layout for type PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE * PERF_TYPE_HARDWARE: 0xEEEEEEEE000000AA * AA: hardware event ID * EEEEEEEE: PMU type ID * PERF_TYPE_HW_CACHE: 0xEEEEEEEE00DDCCBB * BB: hardware cache ID * CC: hardware cache op ID * DD: hardware cache op result ID * EEEEEEEE: PMU type ID * If the PMU type ID is 0, the PERF_TYPE_RAW will be applied. */ #define PERF_PMU_TYPE_SHIFT 32 #define PERF_HW_EVENT_MASK 0xffffffff /* * Generalized performance event event_id types, used by the * attr.event_id parameter of the sys_perf_event_open() * syscall: */ enum perf_hw_id { /* * Common hardware events, generalized by the kernel: */ PERF_COUNT_HW_CPU_CYCLES = 0, PERF_COUNT_HW_INSTRUCTIONS = 1, PERF_COUNT_HW_CACHE_REFERENCES = 2, PERF_COUNT_HW_CACHE_MISSES = 3, PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, PERF_COUNT_HW_BRANCH_MISSES = 5, PERF_COUNT_HW_BUS_CYCLES = 6, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7, PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, PERF_COUNT_HW_REF_CPU_CYCLES = 9, PERF_COUNT_HW_MAX, /* non-ABI */ }; /* * Generalized hardware cache events: * * { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x * { read, write, prefetch } x * { accesses, misses } */ enum perf_hw_cache_id { PERF_COUNT_HW_CACHE_L1D = 0, PERF_COUNT_HW_CACHE_L1I = 1, PERF_COUNT_HW_CACHE_LL = 2, PERF_COUNT_HW_CACHE_DTLB = 3, PERF_COUNT_HW_CACHE_ITLB = 4, PERF_COUNT_HW_CACHE_BPU = 5, PERF_COUNT_HW_CACHE_NODE = 6, PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ }; enum perf_hw_cache_op_id { PERF_COUNT_HW_CACHE_OP_READ = 0, PERF_COUNT_HW_CACHE_OP_WRITE = 1, PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */ }; enum perf_hw_cache_op_result_id { PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, PERF_COUNT_HW_CACHE_RESULT_MISS = 1, PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */ }; /* * Special "software" events provided by the kernel, even if the hardware * does not support performance events. These events measure various * physical and sw events of the kernel (and allow the profiling of them as * well): */ enum perf_sw_ids { PERF_COUNT_SW_CPU_CLOCK = 0, PERF_COUNT_SW_TASK_CLOCK = 1, PERF_COUNT_SW_PAGE_FAULTS = 2, PERF_COUNT_SW_CONTEXT_SWITCHES = 3, PERF_COUNT_SW_CPU_MIGRATIONS = 4, PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, PERF_COUNT_SW_EMULATION_FAULTS = 8, PERF_COUNT_SW_DUMMY = 9, PERF_COUNT_SW_BPF_OUTPUT = 10, PERF_COUNT_SW_CGROUP_SWITCHES = 11, PERF_COUNT_SW_MAX, /* non-ABI */ }; /* * Bits that can be set in attr.sample_type to request information * in the overflow packets. */ enum perf_event_sample_format { PERF_SAMPLE_IP = 1U << 0, PERF_SAMPLE_TID = 1U << 1, PERF_SAMPLE_TIME = 1U << 2, PERF_SAMPLE_ADDR = 1U << 3, PERF_SAMPLE_READ = 1U << 4, PERF_SAMPLE_CALLCHAIN = 1U << 5, PERF_SAMPLE_ID = 1U << 6, PERF_SAMPLE_CPU = 1U << 7, PERF_SAMPLE_PERIOD = 1U << 8, PERF_SAMPLE_STREAM_ID = 1U << 9, PERF_SAMPLE_RAW = 1U << 10, PERF_SAMPLE_BRANCH_STACK = 1U << 11, PERF_SAMPLE_REGS_USER = 1U << 12, PERF_SAMPLE_STACK_USER = 1U << 13, PERF_SAMPLE_WEIGHT = 1U << 14, PERF_SAMPLE_DATA_SRC = 1U << 15, PERF_SAMPLE_IDENTIFIER = 1U << 16, PERF_SAMPLE_TRANSACTION = 1U << 17, PERF_SAMPLE_REGS_INTR = 1U << 18, PERF_SAMPLE_PHYS_ADDR = 1U << 19, PERF_SAMPLE_AUX = 1U << 20, PERF_SAMPLE_CGROUP = 1U << 21, #ifndef __GENKSYMS__ PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22, PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23, PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24, PERF_SAMPLE_MAX = 1U << 25, /* non-ABI */ #else PERF_SAMPLE_MAX = 1U << 22, /* non-ABI */ #endif /* __GENKSYMS__ */ __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI; internal use */ }; #define PERF_SAMPLE_WEIGHT_TYPE (PERF_SAMPLE_WEIGHT | PERF_SAMPLE_WEIGHT_STRUCT) /* * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set * * If the user does not pass priv level information via branch_sample_type, * the kernel uses the event's priv level. Branch and event priv levels do * not have to match. Branch priv level is checked for permissions. * * The branch types can be combined, however BRANCH_ANY covers all types * of branches and therefore it supersedes all the other types. */ enum perf_branch_sample_type_shift { PERF_SAMPLE_BRANCH_USER_SHIFT = 0, /* user branches */ PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1, /* kernel branches */ PERF_SAMPLE_BRANCH_HV_SHIFT = 2, /* hypervisor branches */ PERF_SAMPLE_BRANCH_ANY_SHIFT = 3, /* any branch types */ PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4, /* any call branch */ PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5, /* any return branch */ PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6, /* indirect calls */ PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7, /* transaction aborts */ PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8, /* in transaction */ PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9, /* not in transaction */ PERF_SAMPLE_BRANCH_COND_SHIFT = 10, /* conditional branches */ PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11, /* call/ret stack */ PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 12, /* indirect jumps */ PERF_SAMPLE_BRANCH_CALL_SHIFT = 13, /* direct call */ PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14, /* no flags */ PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15, /* no cycles */ PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, /* save branch type */ PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17, /* save low level index of raw branch records */ PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */ }; enum perf_branch_sample_type { PERF_SAMPLE_BRANCH_USER = 1U << PERF_SAMPLE_BRANCH_USER_SHIFT, PERF_SAMPLE_BRANCH_KERNEL = 1U << PERF_SAMPLE_BRANCH_KERNEL_SHIFT, PERF_SAMPLE_BRANCH_HV = 1U << PERF_SAMPLE_BRANCH_HV_SHIFT, PERF_SAMPLE_BRANCH_ANY = 1U << PERF_SAMPLE_BRANCH_ANY_SHIFT, PERF_SAMPLE_BRANCH_ANY_CALL = 1U << PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT, PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT, PERF_SAMPLE_BRANCH_IND_CALL = 1U << PERF_SAMPLE_BRANCH_IND_CALL_SHIFT, PERF_SAMPLE_BRANCH_ABORT_TX = 1U << PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT, PERF_SAMPLE_BRANCH_IN_TX = 1U << PERF_SAMPLE_BRANCH_IN_TX_SHIFT, PERF_SAMPLE_BRANCH_NO_TX = 1U << PERF_SAMPLE_BRANCH_NO_TX_SHIFT, PERF_SAMPLE_BRANCH_COND = 1U << PERF_SAMPLE_BRANCH_COND_SHIFT, PERF_SAMPLE_BRANCH_CALL_STACK = 1U << PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT, PERF_SAMPLE_BRANCH_IND_JUMP = 1U << PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT, PERF_SAMPLE_BRANCH_CALL = 1U << PERF_SAMPLE_BRANCH_CALL_SHIFT, PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT, PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT, PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT, PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT, PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT, }; /* * Common flow change classification */ enum { PERF_BR_UNKNOWN = 0, /* unknown */ PERF_BR_COND = 1, /* conditional */ PERF_BR_UNCOND = 2, /* unconditional */ PERF_BR_IND = 3, /* indirect */ PERF_BR_CALL = 4, /* function call */ PERF_BR_IND_CALL = 5, /* indirect function call */ PERF_BR_RET = 6, /* function return */ PERF_BR_SYSCALL = 7, /* syscall */ PERF_BR_SYSRET = 8, /* syscall return */ PERF_BR_COND_CALL = 9, /* conditional function call */ PERF_BR_COND_RET = 10, /* conditional function return */ PERF_BR_ERET = 11, /* exception return */ PERF_BR_IRQ = 12, /* irq */ PERF_BR_MAX, }; /* * Common branch speculation outcome classification */ enum { PERF_BR_SPEC_NA = 0, /* Not available */ PERF_BR_SPEC_WRONG_PATH = 1, /* Speculative but on wrong path */ PERF_BR_NON_SPEC_CORRECT_PATH = 2, /* Non-speculative but on correct path */ PERF_BR_SPEC_CORRECT_PATH = 3, /* Speculative and on correct path */ PERF_BR_SPEC_MAX, }; #define PERF_SAMPLE_BRANCH_PLM_ALL \ (PERF_SAMPLE_BRANCH_USER|\ PERF_SAMPLE_BRANCH_KERNEL|\ PERF_SAMPLE_BRANCH_HV) /* * Values to determine ABI of the registers dump. */ enum perf_sample_regs_abi { PERF_SAMPLE_REGS_ABI_NONE = 0, PERF_SAMPLE_REGS_ABI_32 = 1, PERF_SAMPLE_REGS_ABI_64 = 2, }; /* * Values for the memory transaction event qualifier, mostly for * abort events. Multiple bits can be set. */ enum { PERF_TXN_ELISION = (1 << 0), /* From elision */ PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */ PERF_TXN_SYNC = (1 << 2), /* Instruction is related */ PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */ PERF_TXN_RETRY = (1 << 4), /* Retry possible */ PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */ PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */ PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */ PERF_TXN_MAX = (1 << 8), /* non-ABI */ /* bits 32..63 are reserved for the abort code */ PERF_TXN_ABORT_MASK = (0xffffffffULL << 32), PERF_TXN_ABORT_SHIFT = 32, }; /* * The format of the data returned by read() on a perf event fd, * as specified by attr.read_format: * * struct read_format { * { u64 value; * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 id; } && PERF_FORMAT_ID * } && !PERF_FORMAT_GROUP * * { u64 nr; * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 value; * { u64 id; } && PERF_FORMAT_ID * } cntr[nr]; * } && PERF_FORMAT_GROUP * }; */ enum perf_event_read_format { PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, PERF_FORMAT_ID = 1U << 2, PERF_FORMAT_GROUP = 1U << 3, PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ }; #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ #define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ #define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ #define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */ /* add: sample_stack_user */ #define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */ #define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */ #define PERF_ATTR_SIZE_VER6 120 /* add: aux_sample_size */ /* * Hardware event_id to monitor via a performance monitoring event: * * @sample_max_stack: Max number of frame pointers in a callchain, * should be < /proc/sys/kernel/perf_event_max_stack */ struct perf_event_attr { /* * Major type: hardware/software/tracepoint/etc. */ __u32 type; /* * Size of the attr structure, for fwd/bwd compat. */ __u32 size; /* * Type specific configuration information. */ __u64 config; union { __u64 sample_period; __u64 sample_freq; }; __u64 sample_type; __u64 read_format; __u64 disabled : 1, /* off by default */ inherit : 1, /* children inherit it */ pinned : 1, /* must always be on PMU */ exclusive : 1, /* only group on PMU */ exclude_user : 1, /* don't count user */ exclude_kernel : 1, /* ditto kernel */ exclude_hv : 1, /* ditto hypervisor */ exclude_idle : 1, /* don't count when idle */ mmap : 1, /* include mmap data */ comm : 1, /* include comm data */ freq : 1, /* use freq, not period */ inherit_stat : 1, /* per task counts */ enable_on_exec : 1, /* next exec enables */ task : 1, /* trace fork/exit */ watermark : 1, /* wakeup_watermark */ /* * precise_ip: * * 0 - SAMPLE_IP can have arbitrary skid * 1 - SAMPLE_IP must have constant skid * 2 - SAMPLE_IP requested to have 0 skid * 3 - SAMPLE_IP must have 0 skid * * See also PERF_RECORD_MISC_EXACT_IP */ precise_ip : 2, /* skid constraint */ mmap_data : 1, /* non-exec mmap data */ sample_id_all : 1, /* sample_type all events */ exclude_host : 1, /* don't count in host */ exclude_guest : 1, /* don't count in guest */ exclude_callchain_kernel : 1, /* exclude kernel callchains */ exclude_callchain_user : 1, /* exclude user callchains */ mmap2 : 1, /* include mmap with inode data */ comm_exec : 1, /* flag comm events that are due to an exec */ use_clockid : 1, /* use @clockid for time fields */ context_switch : 1, /* context switch data */ write_backward : 1, /* Write ring buffer from end to beginning */ namespaces : 1, /* include namespaces data */ #ifndef __GENKSYMS__ ksymbol : 1, /* include ksymbol events */ bpf_event : 1, /* include bpf events */ aux_output : 1, /* generate AUX records instead of events */ cgroup : 1, /* include cgroup events */ text_poke : 1, /* include text poke events */ build_id : 1, /* use build id in mmap2 events */ inherit_thread : 1, /* children only inherit if cloned with CLONE_THREAD */ remove_on_exec : 1, /* event is removed from task on exec */ __reserved_1 : 27; #else __reserved_1 : 35; #endif /* __GENKSYMS__ */ union { __u32 wakeup_events; /* wakeup every n events */ __u32 wakeup_watermark; /* bytes before wakeup */ }; __u32 bp_type; union { __u64 bp_addr; __u64 kprobe_func; /* for perf_kprobe */ __u64 uprobe_path; /* for perf_uprobe */ __u64 config1; /* extension of config */ }; union { __u64 bp_len; __u64 kprobe_addr; /* when kprobe_func == NULL */ __u64 probe_offset; /* for perf_[k,u]probe */ __u64 config2; /* extension of config1 */ }; __u64 branch_sample_type; /* enum perf_branch_sample_type */ /* * Defines set of user regs to dump on samples. * See asm/perf_regs.h for details. */ __u64 sample_regs_user; /* * Defines size of the user stack to dump on samples. */ __u32 sample_stack_user; __s32 clockid; /* * Defines set of regs to dump for each sample * state captured on: * - precise = 0: PMU interrupt * - precise > 0: sampled instruction * * See asm/perf_regs.h for details. */ __u64 sample_regs_intr; /* * Wakeup watermark for AUX area */ __u32 aux_watermark; __u16 sample_max_stack; __u16 __reserved_2; #ifndef __GENKSYMS__ __u32 aux_sample_size; __u32 __reserved_3; #endif /* __GENKSYMS__ */ }; /* * Structure used by below PERF_EVENT_IOC_QUERY_BPF command * to query bpf programs attached to the same perf tracepoint * as the given perf event. */ struct perf_event_query_bpf { /* * The below ids array length */ __u32 ids_len; /* * Set by the kernel to indicate the number of * available programs */ __u32 prog_cnt; /* * User provided buffer to store program ids */ __u32 ids[0]; }; /* * Ioctls that can be done on a perf event fd: */ #define PERF_EVENT_IOC_ENABLE _IO ('$', 0) #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) #define PERF_EVENT_IOC_RESET _IO ('$', 3) #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) #define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *) #define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32) #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) #define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *) #define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *) enum perf_event_ioc_flags { PERF_IOC_FLAG_GROUP = 1U << 0, }; /* * Structure of the page that can be mapped via mmap */ struct perf_event_mmap_page { __u32 version; /* version number of this structure */ __u32 compat_version; /* lowest version this is compat with */ /* * Bits needed to read the hw events in user-space. * * u32 seq, time_mult, time_shift, index, width; * u64 count, enabled, running; * u64 cyc, time_offset; * s64 pmc = 0; * * do { * seq = pc->lock; * barrier() * * enabled = pc->time_enabled; * running = pc->time_running; * * if (pc->cap_usr_time && enabled != running) { * cyc = rdtsc(); * time_offset = pc->time_offset; * time_mult = pc->time_mult; * time_shift = pc->time_shift; * } * * index = pc->index; * count = pc->offset; * if (pc->cap_user_rdpmc && index) { * width = pc->pmc_width; * pmc = rdpmc(index - 1); * } * * barrier(); * } while (pc->lock != seq); * * NOTE: for obvious reason this only works on self-monitoring * processes. */ __u32 lock; /* seqlock for synchronization */ __u32 index; /* hardware event identifier */ __s64 offset; /* add to hardware event value */ __u64 time_enabled; /* time event active */ __u64 time_running; /* time event on cpu */ union { __u64 capabilities; struct { __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */ cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */ cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */ cap_user_time : 1, /* The time_{shift,mult,offset} fields are used */ cap_user_time_zero : 1, /* The time_zero field is used */ cap_user_time_short : 1, /* the time_{cycle,mask} fields are used */ cap_____res : 58; }; }; /* * If cap_user_rdpmc this field provides the bit-width of the value * read using the rdpmc() or equivalent instruction. This can be used * to sign extend the result like: * * pmc <<= 64 - width; * pmc >>= 64 - width; // signed shift right * count += pmc; */ __u16 pmc_width; /* * If cap_usr_time the below fields can be used to compute the time * delta since time_enabled (in ns) using rdtsc or similar. * * u64 quot, rem; * u64 delta; * * quot = (cyc >> time_shift); * rem = cyc & (((u64)1 << time_shift) - 1); * delta = time_offset + quot * time_mult + * ((rem * time_mult) >> time_shift); * * Where time_offset,time_mult,time_shift and cyc are read in the * seqcount loop described above. This delta can then be added to * enabled and possible running (if index), improving the scaling: * * enabled += delta; * if (index) * running += delta; * * quot = count / running; * rem = count % running; * count = quot * enabled + (rem * enabled) / running; */ __u16 time_shift; __u32 time_mult; __u64 time_offset; /* * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated * from sample timestamps. * * time = timestamp - time_zero; * quot = time / time_mult; * rem = time % time_mult; * cyc = (quot << time_shift) + (rem << time_shift) / time_mult; * * And vice versa: * * quot = cyc >> time_shift; * rem = cyc & (((u64)1 << time_shift) - 1); * timestamp = time_zero + quot * time_mult + * ((rem * time_mult) >> time_shift); */ __u64 time_zero; __u32 size; /* Header size up to __reserved[] fields. */ __u32 __reserved_1; /* * If cap_usr_time_short, the hardware clock is less than 64bit wide * and we must compute the 'cyc' value, as used by cap_usr_time, as: * * cyc = time_cycles + ((cyc - time_cycles) & time_mask) * * NOTE: this form is explicitly chosen such that cap_usr_time_short * is a correction on top of cap_usr_time, and code that doesn't * know about cap_usr_time_short still works under the assumption * the counter doesn't wrap. */ __u64 time_cycles; __u64 time_mask; /* * Hole for extension of the self monitor capabilities */ __u8 __reserved[116*8]; /* align to 1k. */ /* * Control data for the mmap() data buffer. * * User-space reading the @data_head value should issue an smp_rmb(), * after reading this value. * * When the mapping is PROT_WRITE the @data_tail value should be * written by userspace to reflect the last read data, after issueing * an smp_mb() to separate the data read from the ->data_tail store. * In this case the kernel will not over-write unread data. * * See perf_output_put_handle() for the data ordering. * * data_{offset,size} indicate the location and size of the perf record * buffer within the mmapped area. */ __u64 data_head; /* head in the data section */ __u64 data_tail; /* user-space written tail */ __u64 data_offset; /* where the buffer starts */ __u64 data_size; /* data buffer size */ /* * AUX area is defined by aux_{offset,size} fields that should be set * by the userspace, so that * * aux_offset >= data_offset + data_size * * prior to mmap()ing it. Size of the mmap()ed area should be aux_size. * * Ring buffer pointers aux_{head,tail} have the same semantics as * data_{head,tail} and same ordering rules apply. */ __u64 aux_head; __u64 aux_tail; __u64 aux_offset; __u64 aux_size; }; /* * The current state of perf_event_header::misc bits usage: * ('|' used bit, '-' unused bit) * * 012 CDEF * |||---------|||| * * Where: * 0-2 CPUMODE_MASK * * C PROC_MAP_PARSE_TIMEOUT * D MMAP_DATA / COMM_EXEC / FORK_EXEC / SWITCH_OUT * E MMAP_BUILD_ID / EXACT_IP / SCHED_OUT_PREEMPT * F (reserved) */ #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0) #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) #define PERF_RECORD_MISC_KERNEL (1 << 0) #define PERF_RECORD_MISC_USER (2 << 0) #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) #define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) #define PERF_RECORD_MISC_GUEST_USER (5 << 0) /* * Indicates that /proc/PID/maps parsing are truncated by time out. */ #define PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT (1 << 12) /* * Following PERF_RECORD_MISC_* are used on different * events, so can reuse the same bit position: * * PERF_RECORD_MISC_MMAP_DATA - PERF_RECORD_MMAP* events * PERF_RECORD_MISC_COMM_EXEC - PERF_RECORD_COMM event * PERF_RECORD_MISC_FORK_EXEC - PERF_RECORD_FORK event (perf internal) * PERF_RECORD_MISC_SWITCH_OUT - PERF_RECORD_SWITCH* events */ #define PERF_RECORD_MISC_MMAP_DATA (1 << 13) #define PERF_RECORD_MISC_COMM_EXEC (1 << 13) #define PERF_RECORD_MISC_FORK_EXEC (1 << 13) #define PERF_RECORD_MISC_SWITCH_OUT (1 << 13) /* * These PERF_RECORD_MISC_* flags below are safely reused * for the following events: * * PERF_RECORD_MISC_EXACT_IP - PERF_RECORD_SAMPLE of precise events * PERF_RECORD_MISC_SWITCH_OUT_PREEMPT - PERF_RECORD_SWITCH* events * PERF_RECORD_MISC_MMAP_BUILD_ID - PERF_RECORD_MMAP2 event * * * PERF_RECORD_MISC_EXACT_IP: * Indicates that the content of PERF_SAMPLE_IP points to * the actual instruction that triggered the event. See also * perf_event_attr::precise_ip. * * PERF_RECORD_MISC_SWITCH_OUT_PREEMPT: * Indicates that thread was preempted in TASK_RUNNING state. * * PERF_RECORD_MISC_MMAP_BUILD_ID: * Indicates that mmap2 event carries build id data. */ #define PERF_RECORD_MISC_EXACT_IP (1 << 14) #define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT (1 << 14) #define PERF_RECORD_MISC_MMAP_BUILD_ID (1 << 14) /* * Reserve the last bit to indicate some extended misc field */ #define PERF_RECORD_MISC_EXT_RESERVED (1 << 15) struct perf_event_header { __u32 type; __u16 misc; __u16 size; }; struct perf_ns_link_info { __u64 dev; __u64 ino; }; enum { NET_NS_INDEX = 0, UTS_NS_INDEX = 1, IPC_NS_INDEX = 2, PID_NS_INDEX = 3, USER_NS_INDEX = 4, MNT_NS_INDEX = 5, CGROUP_NS_INDEX = 6, NR_NAMESPACES, /* number of available namespaces */ }; enum perf_event_type { /* * If perf_event_attr.sample_id_all is set then all event types will * have the sample_type selected fields related to where/when * (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU, * IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed * just after the perf_event_header and the fields already present for * the existing fields, i.e. at the end of the payload. That way a newer * perf.data file will be supported by older perf tools, with these new * optional fields being ignored. * * struct sample_id { * { u32 pid, tid; } && PERF_SAMPLE_TID * { u64 time; } && PERF_SAMPLE_TIME * { u64 id; } && PERF_SAMPLE_ID * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID * { u32 cpu, res; } && PERF_SAMPLE_CPU * { u64 id; } && PERF_SAMPLE_IDENTIFIER * } && perf_event_attr::sample_id_all * * Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. The * advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed * relative to header.size. */ /* * The MMAP events record the PROT_EXEC mappings so that we can * correlate userspace IPs to code. They have the following structure: * * struct { * struct perf_event_header header; * * u32 pid, tid; * u64 addr; * u64 len; * u64 pgoff; * char filename[]; * struct sample_id sample_id; * }; */ PERF_RECORD_MMAP = 1, /* * struct { * struct perf_event_header header; * u64 id; * u64 lost; * struct sample_id sample_id; * }; */ PERF_RECORD_LOST = 2, /* * struct { * struct perf_event_header header; * * u32 pid, tid; * char comm[]; * struct sample_id sample_id; * }; */ PERF_RECORD_COMM = 3, /* * struct { * struct perf_event_header header; * u32 pid, ppid; * u32 tid, ptid; * u64 time; * struct sample_id sample_id; * }; */ PERF_RECORD_EXIT = 4, /* * struct { * struct perf_event_header header; * u64 time; * u64 id; * u64 stream_id; * struct sample_id sample_id; * }; */ PERF_RECORD_THROTTLE = 5, PERF_RECORD_UNTHROTTLE = 6, /* * struct { * struct perf_event_header header; * u32 pid, ppid; * u32 tid, ptid; * u64 time; * struct sample_id sample_id; * }; */ PERF_RECORD_FORK = 7, /* * struct { * struct perf_event_header header; * u32 pid, tid; * * struct read_format values; * struct sample_id sample_id; * }; */ PERF_RECORD_READ = 8, /* * struct { * struct perf_event_header header; * * # * # Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. * # The advantage of PERF_SAMPLE_IDENTIFIER is that its position * # is fixed relative to header. * # * * { u64 id; } && PERF_SAMPLE_IDENTIFIER * { u64 ip; } && PERF_SAMPLE_IP * { u32 pid, tid; } && PERF_SAMPLE_TID * { u64 time; } && PERF_SAMPLE_TIME * { u64 addr; } && PERF_SAMPLE_ADDR * { u64 id; } && PERF_SAMPLE_ID * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID * { u32 cpu, res; } && PERF_SAMPLE_CPU * { u64 period; } && PERF_SAMPLE_PERIOD * * { struct read_format values; } && PERF_SAMPLE_READ * * { u64 nr, * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN * * # * # The RAW record below is opaque data wrt the ABI * # * # That is, the ABI doesn't make any promises wrt to * # the stability of its content, it may vary depending * # on event, hardware, kernel version and phase of * # the moon. * # * # In other words, PERF_SAMPLE_RAW contents are not an ABI. * # * * { u32 size; * char data[size];}&& PERF_SAMPLE_RAW * * { u64 nr; * { u64 hw_idx; } && PERF_SAMPLE_BRANCH_HW_INDEX * { u64 from, to, flags } lbr[nr]; * } && PERF_SAMPLE_BRANCH_STACK * * { u64 abi; # enum perf_sample_regs_abi * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER * * { u64 size; * char data[size]; * u64 dyn_size; } && PERF_SAMPLE_STACK_USER * * { union perf_sample_weight * { * u64 full; && PERF_SAMPLE_WEIGHT * #if defined(__LITTLE_ENDIAN_BITFIELD) * struct { * u32 var1_dw; * u16 var2_w; * u16 var3_w; * } && PERF_SAMPLE_WEIGHT_STRUCT * #elif defined(__BIG_ENDIAN_BITFIELD) * struct { * u16 var3_w; * u16 var2_w; * u32 var1_dw; * } && PERF_SAMPLE_WEIGHT_STRUCT * #endif * } * } * { u64 data_src; } && PERF_SAMPLE_DATA_SRC * { u64 transaction; } && PERF_SAMPLE_TRANSACTION * { u64 abi; # enum perf_sample_regs_abi * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR * { u64 phys_addr;} && PERF_SAMPLE_PHYS_ADDR * { u64 size; * char data[size]; } && PERF_SAMPLE_AUX * { u64 data_page_size;} && PERF_SAMPLE_DATA_PAGE_SIZE * { u64 code_page_size;} && PERF_SAMPLE_CODE_PAGE_SIZE * }; */ PERF_RECORD_SAMPLE = 9, /* * The MMAP2 records are an augmented version of MMAP, they add * maj, min, ino numbers to be used to uniquely identify each mapping * * struct { * struct perf_event_header header; * * u32 pid, tid; * u64 addr; * u64 len; * u64 pgoff; * union { * struct { * u32 maj; * u32 min; * u64 ino; * u64 ino_generation; * }; * struct { * u8 build_id_size; * u8 __reserved_1; * u16 __reserved_2; * u8 build_id[20]; * }; * }; * u32 prot, flags; * char filename[]; * struct sample_id sample_id; * }; */ PERF_RECORD_MMAP2 = 10, /* * Records that new data landed in the AUX buffer part. * * struct { * struct perf_event_header header; * * u64 aux_offset; * u64 aux_size; * u64 flags; * struct sample_id sample_id; * }; */ PERF_RECORD_AUX = 11, /* * Indicates that instruction trace has started * * struct { * struct perf_event_header header; * u32 pid; * u32 tid; * struct sample_id sample_id; * }; */ PERF_RECORD_ITRACE_START = 12, /* * Records the dropped/lost sample number. * * struct { * struct perf_event_header header; * * u64 lost; * struct sample_id sample_id; * }; */ PERF_RECORD_LOST_SAMPLES = 13, /* * Records a context switch in or out (flagged by * PERF_RECORD_MISC_SWITCH_OUT). See also * PERF_RECORD_SWITCH_CPU_WIDE. * * struct { * struct perf_event_header header; * struct sample_id sample_id; * }; */ PERF_RECORD_SWITCH = 14, /* * CPU-wide version of PERF_RECORD_SWITCH with next_prev_pid and * next_prev_tid that are the next (switching out) or previous * (switching in) pid/tid. * * struct { * struct perf_event_header header; * u32 next_prev_pid; * u32 next_prev_tid; * struct sample_id sample_id; * }; */ PERF_RECORD_SWITCH_CPU_WIDE = 15, /* * struct { * struct perf_event_header header; * u32 pid; * u32 tid; * u64 nr_namespaces; * { u64 dev, inode; } [nr_namespaces]; * struct sample_id sample_id; * }; */ PERF_RECORD_NAMESPACES = 16, #ifndef __GENKSYMS__ /* * Record ksymbol register/unregister events: * * struct { * struct perf_event_header header; * u64 addr; * u32 len; * u16 ksym_type; * u16 flags; * char name[]; * struct sample_id sample_id; * }; */ PERF_RECORD_KSYMBOL = 17, /* * Record bpf events: * enum perf_bpf_event_type { * PERF_BPF_EVENT_UNKNOWN = 0, * PERF_BPF_EVENT_PROG_LOAD = 1, * PERF_BPF_EVENT_PROG_UNLOAD = 2, * }; * * struct { * struct perf_event_header header; * u16 type; * u16 flags; * u32 id; * u8 tag[BPF_TAG_SIZE]; * struct sample_id sample_id; * }; */ PERF_RECORD_BPF_EVENT = 18, /* * struct { * struct perf_event_header header; * u64 id; * char path[]; * struct sample_id sample_id; * }; */ PERF_RECORD_CGROUP = 19, /* * Records changes to kernel text i.e. self-modified code. 'old_len' is * the number of old bytes, 'new_len' is the number of new bytes. Either * 'old_len' or 'new_len' may be zero to indicate, for example, the * addition or removal of a trampoline. 'bytes' contains the old bytes * followed immediately by the new bytes. * * struct { * struct perf_event_header header; * u64 addr; * u16 old_len; * u16 new_len; * u8 bytes[]; * struct sample_id sample_id; * }; */ PERF_RECORD_TEXT_POKE = 20, #endif /* __GENKSYMS__ */ PERF_RECORD_MAX, /* non-ABI */ }; enum perf_record_ksymbol_type { PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0, PERF_RECORD_KSYMBOL_TYPE_BPF = 1, PERF_RECORD_KSYMBOL_TYPE_MAX /* non-ABI */ }; #define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER (1 << 0) enum perf_bpf_event_type { PERF_BPF_EVENT_UNKNOWN = 0, PERF_BPF_EVENT_PROG_LOAD = 1, PERF_BPF_EVENT_PROG_UNLOAD = 2, PERF_BPF_EVENT_MAX, /* non-ABI */ }; #define PERF_MAX_STACK_DEPTH 127 #define PERF_MAX_CONTEXTS_PER_STACK 8 enum perf_callchain_context { PERF_CONTEXT_HV = (__u64)-32, PERF_CONTEXT_KERNEL = (__u64)-128, PERF_CONTEXT_USER = (__u64)-512, PERF_CONTEXT_GUEST = (__u64)-2048, PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, PERF_CONTEXT_GUEST_USER = (__u64)-2560, PERF_CONTEXT_MAX = (__u64)-4095, }; /** * PERF_RECORD_AUX::flags bits */ #define PERF_AUX_FLAG_TRUNCATED 0x01 /* record was truncated to fit */ #define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */ #define PERF_AUX_FLAG_PARTIAL 0x04 /* record contains gaps */ #define PERF_AUX_FLAG_COLLISION 0x08 /* sample collided with another */ #define PERF_FLAG_FD_NO_GROUP (1UL << 0) #define PERF_FLAG_FD_OUTPUT (1UL << 1) #define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */ #define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */ #if defined(__LITTLE_ENDIAN_BITFIELD) union perf_mem_data_src { __u64 val; struct { __u64 mem_op:5, /* type of opcode */ mem_lvl:14, /* memory hierarchy level */ mem_snoop:5, /* snoop mode */ mem_lock:2, /* lock instr */ mem_dtlb:7, /* tlb access */ mem_lvl_num:4, /* memory hierarchy level number */ mem_remote:1, /* remote */ mem_snoopx:2, /* snoop mode, ext */ #ifndef __GENKSYMS__ mem_blk:3, /* access blocked */ mem_hops:3, /* hop level */ mem_rsvd:18; #else mem_rsvd:24; #endif /* __GENKSYMS__ */ }; }; #elif defined(__BIG_ENDIAN_BITFIELD) union perf_mem_data_src { __u64 val; struct { #ifndef __GENKSYMS__ __u64 mem_rsvd:18, mem_hops:3, /* hop level */ mem_blk:3, /* access blocked */ #else __u64 mem_rsvd:24, #endif /* __GENKSYMS__ */ mem_snoopx:2, /* snoop mode, ext */ mem_remote:1, /* remote */ mem_lvl_num:4, /* memory hierarchy level number */ mem_dtlb:7, /* tlb access */ mem_lock:2, /* lock instr */ mem_snoop:5, /* snoop mode */ mem_lvl:14, /* memory hierarchy level */ mem_op:5; /* type of opcode */ }; }; #else #error "Unknown endianness" #endif /* type of opcode (load/store/prefetch,code) */ #define PERF_MEM_OP_NA 0x01 /* not available */ #define PERF_MEM_OP_LOAD 0x02 /* load instruction */ #define PERF_MEM_OP_STORE 0x04 /* store instruction */ #define PERF_MEM_OP_PFETCH 0x08 /* prefetch */ #define PERF_MEM_OP_EXEC 0x10 /* code (execution) */ #define PERF_MEM_OP_SHIFT 0 /* * PERF_MEM_LVL_* namespace being depricated to some extent in the * favour of newer composite PERF_MEM_{LVLNUM_,REMOTE_,SNOOPX_} fields. * Supporting this namespace inorder to not break defined ABIs. * * memory hierarchy (memory level, hit or miss) */ #define PERF_MEM_LVL_NA 0x01 /* not available */ #define PERF_MEM_LVL_HIT 0x02 /* hit level */ #define PERF_MEM_LVL_MISS 0x04 /* miss level */ #define PERF_MEM_LVL_L1 0x08 /* L1 */ #define PERF_MEM_LVL_LFB 0x10 /* Line Fill Buffer */ #define PERF_MEM_LVL_L2 0x20 /* L2 */ #define PERF_MEM_LVL_L3 0x40 /* L3 */ #define PERF_MEM_LVL_LOC_RAM 0x80 /* Local DRAM */ #define PERF_MEM_LVL_REM_RAM1 0x100 /* Remote DRAM (1 hop) */ #define PERF_MEM_LVL_REM_RAM2 0x200 /* Remote DRAM (2 hops) */ #define PERF_MEM_LVL_REM_CCE1 0x400 /* Remote Cache (1 hop) */ #define PERF_MEM_LVL_REM_CCE2 0x800 /* Remote Cache (2 hops) */ #define PERF_MEM_LVL_IO 0x1000 /* I/O memory */ #define PERF_MEM_LVL_UNC 0x2000 /* Uncached memory */ #define PERF_MEM_LVL_SHIFT 5 #define PERF_MEM_REMOTE_REMOTE 0x01 /* Remote */ #define PERF_MEM_REMOTE_SHIFT 37 #define PERF_MEM_LVLNUM_L1 0x01 /* L1 */ #define PERF_MEM_LVLNUM_L2 0x02 /* L2 */ #define PERF_MEM_LVLNUM_L3 0x03 /* L3 */ #define PERF_MEM_LVLNUM_L4 0x04 /* L4 */ /* 5-0x8 available */ #define PERF_MEM_LVLNUM_CXL 0x09 /* CXL */ #define PERF_MEM_LVLNUM_IO 0x0a /* I/O */ #define PERF_MEM_LVLNUM_ANY_CACHE 0x0b /* Any cache */ #define PERF_MEM_LVLNUM_LFB 0x0c /* LFB */ #define PERF_MEM_LVLNUM_RAM 0x0d /* RAM */ #define PERF_MEM_LVLNUM_PMEM 0x0e /* PMEM */ #define PERF_MEM_LVLNUM_NA 0x0f /* N/A */ #define PERF_MEM_LVLNUM_SHIFT 33 /* snoop mode */ #define PERF_MEM_SNOOP_NA 0x01 /* not available */ #define PERF_MEM_SNOOP_NONE 0x02 /* no snoop */ #define PERF_MEM_SNOOP_HIT 0x04 /* snoop hit */ #define PERF_MEM_SNOOP_MISS 0x08 /* snoop miss */ #define PERF_MEM_SNOOP_HITM 0x10 /* snoop hit modified */ #define PERF_MEM_SNOOP_SHIFT 19 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ #define PERF_MEM_SNOOPX_PEER 0x02 /* xfer from peer */ #define PERF_MEM_SNOOPX_SHIFT 38 /* locked instruction */ #define PERF_MEM_LOCK_NA 0x01 /* not available */ #define PERF_MEM_LOCK_LOCKED 0x02 /* locked transaction */ #define PERF_MEM_LOCK_SHIFT 24 /* TLB access */ #define PERF_MEM_TLB_NA 0x01 /* not available */ #define PERF_MEM_TLB_HIT 0x02 /* hit level */ #define PERF_MEM_TLB_MISS 0x04 /* miss level */ #define PERF_MEM_TLB_L1 0x08 /* L1 */ #define PERF_MEM_TLB_L2 0x10 /* L2 */ #define PERF_MEM_TLB_WK 0x20 /* Hardware Walker*/ #define PERF_MEM_TLB_OS 0x40 /* OS fault handler */ #define PERF_MEM_TLB_SHIFT 26 /* Access blocked */ #define PERF_MEM_BLK_NA 0x01 /* not available */ #define PERF_MEM_BLK_DATA 0x02 /* data could not be forwarded */ #define PERF_MEM_BLK_ADDR 0x04 /* address conflict */ #define PERF_MEM_BLK_SHIFT 40 /* hop level */ #define PERF_MEM_HOPS_0 0x01 /* remote core, same node */ #define PERF_MEM_HOPS_1 0x02 /* remote node, same socket */ #define PERF_MEM_HOPS_2 0x03 /* remote socket, same board */ #define PERF_MEM_HOPS_3 0x04 /* remote board */ /* 5-7 available */ #define PERF_MEM_HOPS_SHIFT 43 #define PERF_MEM_S(a, s) \ (((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) /* * single taken branch record layout: * * from: source instruction (may not always be a branch insn) * to: branch target * mispred: branch target was mispredicted * predicted: branch target was predicted * * support for mispred, predicted is optional. In case it * is not supported mispred = predicted = 0. * * in_tx: running in a hardware transaction * abort: aborting a hardware transaction * cycles: cycles from last branch (or 0 if not supported) * type: branch type * spec: branch speculation info (or 0 if not supported) */ struct perf_branch_entry { __u64 from; __u64 to; __u64 mispred:1, /* target mispredicted */ predicted:1,/* target predicted */ in_tx:1, /* in transaction */ abort:1, /* transaction abort */ cycles:16, /* cycle count to last branch */ type:4, /* branch type */ #ifndef __GENKSYMS__ spec:2, /* branch speculation info */ reserved:38; #else reserved:40; #endif /* __GENKSYMS__ */ }; #ifndef __GENKSYMS__ union perf_sample_weight { __u64 full; #if defined(__LITTLE_ENDIAN_BITFIELD) struct { __u32 var1_dw; __u16 var2_w; __u16 var3_w; }; #elif defined(__BIG_ENDIAN_BITFIELD) struct { __u16 var3_w; __u16 var2_w; __u32 var1_dw; }; #else #error "Unknown endianness" #endif }; #endif /* __GENKSYMS__ */ #endif /* _LINUX_PERF_EVENT_H */ linux/personality.h 0000644 00000004061 15063602054 0010427 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PERSONALITY_H #define _LINUX_PERSONALITY_H /* * Flags for bug emulation. * * These occupy the top three bytes. */ enum { UNAME26 = 0x0020000, ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors * (signal handling) */ MMAP_PAGE_ZERO = 0x0100000, ADDR_COMPAT_LAYOUT = 0x0200000, READ_IMPLIES_EXEC = 0x0400000, ADDR_LIMIT_32BIT = 0x0800000, SHORT_INODE = 0x1000000, WHOLE_SECONDS = 0x2000000, STICKY_TIMEOUTS = 0x4000000, ADDR_LIMIT_3GB = 0x8000000, }; /* * Security-relevant compatibility flags that must be * cleared upon setuid or setgid exec: */ #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \ ADDR_NO_RANDOMIZE | \ ADDR_COMPAT_LAYOUT | \ MMAP_PAGE_ZERO) /* * Personality types. * * These go in the low byte. Avoid using the top bit, it will * conflict with error returns. */ enum { PER_LINUX = 0x0000, PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, PER_BSD = 0x0006, PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, PER_LINUX32 = 0x0008, PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */ PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */ PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */ PER_RISCOS = 0x000c, PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_OSF4 = 0x000f, /* OSF/1 v4 */ PER_HPUX = 0x0010, PER_MASK = 0x00ff, }; #endif /* _LINUX_PERSONALITY_H */ linux/pfkeyv2.h 0000644 00000024511 15063602054 0007446 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* PF_KEY user interface, this is defined by rfc2367 so * do not make arbitrary modifications or else this header * file will not be compliant. */ #ifndef _LINUX_PFKEY2_H #define _LINUX_PFKEY2_H #include <linux/types.h> #define PF_KEY_V2 2 #define PFKEYV2_REVISION 199806L struct sadb_msg { __u8 sadb_msg_version; __u8 sadb_msg_type; __u8 sadb_msg_errno; __u8 sadb_msg_satype; __u16 sadb_msg_len; __u16 sadb_msg_reserved; __u32 sadb_msg_seq; __u32 sadb_msg_pid; } __attribute__((packed)); /* sizeof(struct sadb_msg) == 16 */ struct sadb_ext { __u16 sadb_ext_len; __u16 sadb_ext_type; } __attribute__((packed)); /* sizeof(struct sadb_ext) == 4 */ struct sadb_sa { __u16 sadb_sa_len; __u16 sadb_sa_exttype; __be32 sadb_sa_spi; __u8 sadb_sa_replay; __u8 sadb_sa_state; __u8 sadb_sa_auth; __u8 sadb_sa_encrypt; __u32 sadb_sa_flags; } __attribute__((packed)); /* sizeof(struct sadb_sa) == 16 */ struct sadb_lifetime { __u16 sadb_lifetime_len; __u16 sadb_lifetime_exttype; __u32 sadb_lifetime_allocations; __u64 sadb_lifetime_bytes; __u64 sadb_lifetime_addtime; __u64 sadb_lifetime_usetime; } __attribute__((packed)); /* sizeof(struct sadb_lifetime) == 32 */ struct sadb_address { __u16 sadb_address_len; __u16 sadb_address_exttype; __u8 sadb_address_proto; __u8 sadb_address_prefixlen; __u16 sadb_address_reserved; } __attribute__((packed)); /* sizeof(struct sadb_address) == 8 */ struct sadb_key { __u16 sadb_key_len; __u16 sadb_key_exttype; __u16 sadb_key_bits; __u16 sadb_key_reserved; } __attribute__((packed)); /* sizeof(struct sadb_key) == 8 */ struct sadb_ident { __u16 sadb_ident_len; __u16 sadb_ident_exttype; __u16 sadb_ident_type; __u16 sadb_ident_reserved; __u64 sadb_ident_id; } __attribute__((packed)); /* sizeof(struct sadb_ident) == 16 */ struct sadb_sens { __u16 sadb_sens_len; __u16 sadb_sens_exttype; __u32 sadb_sens_dpd; __u8 sadb_sens_sens_level; __u8 sadb_sens_sens_len; __u8 sadb_sens_integ_level; __u8 sadb_sens_integ_len; __u32 sadb_sens_reserved; } __attribute__((packed)); /* sizeof(struct sadb_sens) == 16 */ /* followed by: __u64 sadb_sens_bitmap[sens_len]; __u64 sadb_integ_bitmap[integ_len]; */ struct sadb_prop { __u16 sadb_prop_len; __u16 sadb_prop_exttype; __u8 sadb_prop_replay; __u8 sadb_prop_reserved[3]; } __attribute__((packed)); /* sizeof(struct sadb_prop) == 8 */ /* followed by: struct sadb_comb sadb_combs[(sadb_prop_len + sizeof(__u64) - sizeof(struct sadb_prop)) / sizeof(struct sadb_comb)]; */ struct sadb_comb { __u8 sadb_comb_auth; __u8 sadb_comb_encrypt; __u16 sadb_comb_flags; __u16 sadb_comb_auth_minbits; __u16 sadb_comb_auth_maxbits; __u16 sadb_comb_encrypt_minbits; __u16 sadb_comb_encrypt_maxbits; __u32 sadb_comb_reserved; __u32 sadb_comb_soft_allocations; __u32 sadb_comb_hard_allocations; __u64 sadb_comb_soft_bytes; __u64 sadb_comb_hard_bytes; __u64 sadb_comb_soft_addtime; __u64 sadb_comb_hard_addtime; __u64 sadb_comb_soft_usetime; __u64 sadb_comb_hard_usetime; } __attribute__((packed)); /* sizeof(struct sadb_comb) == 72 */ struct sadb_supported { __u16 sadb_supported_len; __u16 sadb_supported_exttype; __u32 sadb_supported_reserved; } __attribute__((packed)); /* sizeof(struct sadb_supported) == 8 */ /* followed by: struct sadb_alg sadb_algs[(sadb_supported_len + sizeof(__u64) - sizeof(struct sadb_supported)) / sizeof(struct sadb_alg)]; */ struct sadb_alg { __u8 sadb_alg_id; __u8 sadb_alg_ivlen; __u16 sadb_alg_minbits; __u16 sadb_alg_maxbits; __u16 sadb_alg_reserved; } __attribute__((packed)); /* sizeof(struct sadb_alg) == 8 */ struct sadb_spirange { __u16 sadb_spirange_len; __u16 sadb_spirange_exttype; __u32 sadb_spirange_min; __u32 sadb_spirange_max; __u32 sadb_spirange_reserved; } __attribute__((packed)); /* sizeof(struct sadb_spirange) == 16 */ struct sadb_x_kmprivate { __u16 sadb_x_kmprivate_len; __u16 sadb_x_kmprivate_exttype; __u32 sadb_x_kmprivate_reserved; } __attribute__((packed)); /* sizeof(struct sadb_x_kmprivate) == 8 */ struct sadb_x_sa2 { __u16 sadb_x_sa2_len; __u16 sadb_x_sa2_exttype; __u8 sadb_x_sa2_mode; __u8 sadb_x_sa2_reserved1; __u16 sadb_x_sa2_reserved2; __u32 sadb_x_sa2_sequence; __u32 sadb_x_sa2_reqid; } __attribute__((packed)); /* sizeof(struct sadb_x_sa2) == 16 */ struct sadb_x_policy { __u16 sadb_x_policy_len; __u16 sadb_x_policy_exttype; __u16 sadb_x_policy_type; __u8 sadb_x_policy_dir; __u8 sadb_x_policy_reserved; __u32 sadb_x_policy_id; __u32 sadb_x_policy_priority; } __attribute__((packed)); /* sizeof(struct sadb_x_policy) == 16 */ struct sadb_x_ipsecrequest { __u16 sadb_x_ipsecrequest_len; __u16 sadb_x_ipsecrequest_proto; __u8 sadb_x_ipsecrequest_mode; __u8 sadb_x_ipsecrequest_level; __u16 sadb_x_ipsecrequest_reserved1; __u32 sadb_x_ipsecrequest_reqid; __u32 sadb_x_ipsecrequest_reserved2; } __attribute__((packed)); /* sizeof(struct sadb_x_ipsecrequest) == 16 */ /* This defines the TYPE of Nat Traversal in use. Currently only one * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 */ struct sadb_x_nat_t_type { __u16 sadb_x_nat_t_type_len; __u16 sadb_x_nat_t_type_exttype; __u8 sadb_x_nat_t_type_type; __u8 sadb_x_nat_t_type_reserved[3]; } __attribute__((packed)); /* sizeof(struct sadb_x_nat_t_type) == 8 */ /* Pass a NAT Traversal port (Source or Dest port) */ struct sadb_x_nat_t_port { __u16 sadb_x_nat_t_port_len; __u16 sadb_x_nat_t_port_exttype; __be16 sadb_x_nat_t_port_port; __u16 sadb_x_nat_t_port_reserved; } __attribute__((packed)); /* sizeof(struct sadb_x_nat_t_port) == 8 */ /* Generic LSM security context */ struct sadb_x_sec_ctx { __u16 sadb_x_sec_len; __u16 sadb_x_sec_exttype; __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ __u8 sadb_x_ctx_doi; __u16 sadb_x_ctx_len; } __attribute__((packed)); /* sizeof(struct sadb_sec_ctx) = 8 */ /* Used by MIGRATE to pass addresses IKE will use to perform * negotiation with the peer */ struct sadb_x_kmaddress { __u16 sadb_x_kmaddress_len; __u16 sadb_x_kmaddress_exttype; __u32 sadb_x_kmaddress_reserved; } __attribute__((packed)); /* sizeof(struct sadb_x_kmaddress) == 8 */ /* To specify the SA dump filter */ struct sadb_x_filter { __u16 sadb_x_filter_len; __u16 sadb_x_filter_exttype; __u32 sadb_x_filter_saddr[4]; __u32 sadb_x_filter_daddr[4]; __u16 sadb_x_filter_family; __u8 sadb_x_filter_splen; __u8 sadb_x_filter_dplen; } __attribute__((packed)); /* sizeof(struct sadb_x_filter) == 40 */ /* Message types */ #define SADB_RESERVED 0 #define SADB_GETSPI 1 #define SADB_UPDATE 2 #define SADB_ADD 3 #define SADB_DELETE 4 #define SADB_GET 5 #define SADB_ACQUIRE 6 #define SADB_REGISTER 7 #define SADB_EXPIRE 8 #define SADB_FLUSH 9 #define SADB_DUMP 10 #define SADB_X_PROMISC 11 #define SADB_X_PCHANGE 12 #define SADB_X_SPDUPDATE 13 #define SADB_X_SPDADD 14 #define SADB_X_SPDDELETE 15 #define SADB_X_SPDGET 16 #define SADB_X_SPDACQUIRE 17 #define SADB_X_SPDDUMP 18 #define SADB_X_SPDFLUSH 19 #define SADB_X_SPDSETIDX 20 #define SADB_X_SPDEXPIRE 21 #define SADB_X_SPDDELETE2 22 #define SADB_X_NAT_T_NEW_MAPPING 23 #define SADB_X_MIGRATE 24 #define SADB_MAX 24 /* Security Association flags */ #define SADB_SAFLAGS_PFS 1 #define SADB_SAFLAGS_NOPMTUDISC 0x20000000 #define SADB_SAFLAGS_DECAP_DSCP 0x40000000 #define SADB_SAFLAGS_NOECN 0x80000000 /* Security Association states */ #define SADB_SASTATE_LARVAL 0 #define SADB_SASTATE_MATURE 1 #define SADB_SASTATE_DYING 2 #define SADB_SASTATE_DEAD 3 #define SADB_SASTATE_MAX 3 /* Security Association types */ #define SADB_SATYPE_UNSPEC 0 #define SADB_SATYPE_AH 2 #define SADB_SATYPE_ESP 3 #define SADB_SATYPE_RSVP 5 #define SADB_SATYPE_OSPFV2 6 #define SADB_SATYPE_RIPV2 7 #define SADB_SATYPE_MIP 8 #define SADB_X_SATYPE_IPCOMP 9 #define SADB_SATYPE_MAX 9 /* Authentication algorithms */ #define SADB_AALG_NONE 0 #define SADB_AALG_MD5HMAC 2 #define SADB_AALG_SHA1HMAC 3 #define SADB_X_AALG_SHA2_256HMAC 5 #define SADB_X_AALG_SHA2_384HMAC 6 #define SADB_X_AALG_SHA2_512HMAC 7 #define SADB_X_AALG_RIPEMD160HMAC 8 #define SADB_X_AALG_AES_XCBC_MAC 9 #define SADB_X_AALG_NULL 251 /* kame */ #define SADB_AALG_MAX 251 /* Encryption algorithms */ #define SADB_EALG_NONE 0 #define SADB_EALG_DESCBC 2 #define SADB_EALG_3DESCBC 3 #define SADB_X_EALG_CASTCBC 6 #define SADB_X_EALG_BLOWFISHCBC 7 #define SADB_EALG_NULL 11 #define SADB_X_EALG_AESCBC 12 #define SADB_X_EALG_AESCTR 13 #define SADB_X_EALG_AES_CCM_ICV8 14 #define SADB_X_EALG_AES_CCM_ICV12 15 #define SADB_X_EALG_AES_CCM_ICV16 16 #define SADB_X_EALG_AES_GCM_ICV8 18 #define SADB_X_EALG_AES_GCM_ICV12 19 #define SADB_X_EALG_AES_GCM_ICV16 20 #define SADB_X_EALG_CAMELLIACBC 22 #define SADB_X_EALG_NULL_AES_GMAC 23 #define SADB_EALG_MAX 253 /* last EALG */ /* private allocations should use 249-255 (RFC2407) */ #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ #define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ /* Compression algorithms */ #define SADB_X_CALG_NONE 0 #define SADB_X_CALG_OUI 1 #define SADB_X_CALG_DEFLATE 2 #define SADB_X_CALG_LZS 3 #define SADB_X_CALG_LZJH 4 #define SADB_X_CALG_MAX 4 /* Extension Header values */ #define SADB_EXT_RESERVED 0 #define SADB_EXT_SA 1 #define SADB_EXT_LIFETIME_CURRENT 2 #define SADB_EXT_LIFETIME_HARD 3 #define SADB_EXT_LIFETIME_SOFT 4 #define SADB_EXT_ADDRESS_SRC 5 #define SADB_EXT_ADDRESS_DST 6 #define SADB_EXT_ADDRESS_PROXY 7 #define SADB_EXT_KEY_AUTH 8 #define SADB_EXT_KEY_ENCRYPT 9 #define SADB_EXT_IDENTITY_SRC 10 #define SADB_EXT_IDENTITY_DST 11 #define SADB_EXT_SENSITIVITY 12 #define SADB_EXT_PROPOSAL 13 #define SADB_EXT_SUPPORTED_AUTH 14 #define SADB_EXT_SUPPORTED_ENCRYPT 15 #define SADB_EXT_SPIRANGE 16 #define SADB_X_EXT_KMPRIVATE 17 #define SADB_X_EXT_POLICY 18 #define SADB_X_EXT_SA2 19 /* The next four entries are for setting up NAT Traversal */ #define SADB_X_EXT_NAT_T_TYPE 20 #define SADB_X_EXT_NAT_T_SPORT 21 #define SADB_X_EXT_NAT_T_DPORT 22 #define SADB_X_EXT_NAT_T_OA 23 #define SADB_X_EXT_SEC_CTX 24 /* Used with MIGRATE to pass @ to IKE for negotiation */ #define SADB_X_EXT_KMADDRESS 25 #define SADB_X_EXT_FILTER 26 #define SADB_EXT_MAX 26 /* Identity Extension values */ #define SADB_IDENTTYPE_RESERVED 0 #define SADB_IDENTTYPE_PREFIX 1 #define SADB_IDENTTYPE_FQDN 2 #define SADB_IDENTTYPE_USERFQDN 3 #define SADB_IDENTTYPE_MAX 3 #endif /* !(_LINUX_PFKEY2_H) */ linux/pfrut.h 0000644 00000017463 15063602054 0007230 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Platform Firmware Runtime Update header * * Copyright(c) 2021 Intel Corporation. All rights reserved. */ #ifndef __PFRUT_H__ #define __PFRUT_H__ #include <linux/ioctl.h> #include <linux/types.h> #define PFRUT_IOCTL_MAGIC 0xEE /** * PFRU_IOC_SET_REV - _IOW(PFRUT_IOCTL_MAGIC, 0x01, unsigned int) * * Return: * * 0 - success * * -EFAULT - fail to read the revision id * * -EINVAL - user provides an invalid revision id * * Set the Revision ID for Platform Firmware Runtime Update. */ #define PFRU_IOC_SET_REV _IOW(PFRUT_IOCTL_MAGIC, 0x01, unsigned int) /** * PFRU_IOC_STAGE - _IOW(PFRUT_IOCTL_MAGIC, 0x02, unsigned int) * * Return: * * 0 - success * * -EINVAL - stage phase returns invalid result * * Stage a capsule image from communication buffer and perform authentication. */ #define PFRU_IOC_STAGE _IOW(PFRUT_IOCTL_MAGIC, 0x02, unsigned int) /** * PFRU_IOC_ACTIVATE - _IOW(PFRUT_IOCTL_MAGIC, 0x03, unsigned int) * * Return: * * 0 - success * * -EINVAL - activate phase returns invalid result * * Activate a previously staged capsule image. */ #define PFRU_IOC_ACTIVATE _IOW(PFRUT_IOCTL_MAGIC, 0x03, unsigned int) /** * PFRU_IOC_STAGE_ACTIVATE - _IOW(PFRUT_IOCTL_MAGIC, 0x04, unsigned int) * * Return: * * 0 - success * * -EINVAL - stage/activate phase returns invalid result. * * Perform both stage and activation action. */ #define PFRU_IOC_STAGE_ACTIVATE _IOW(PFRUT_IOCTL_MAGIC, 0x04, unsigned int) /** * PFRU_IOC_QUERY_CAP - _IOR(PFRUT_IOCTL_MAGIC, 0x05, * struct pfru_update_cap_info) * * Return: * * 0 - success * * -EINVAL - query phase returns invalid result * * -EFAULT - the result fails to be copied to userspace * * Retrieve information on the Platform Firmware Runtime Update capability. * The information is a struct pfru_update_cap_info. */ #define PFRU_IOC_QUERY_CAP _IOR(PFRUT_IOCTL_MAGIC, 0x05, struct pfru_update_cap_info) /** * struct pfru_payload_hdr - Capsule file payload header. * * @sig: Signature of this capsule file. * @hdr_version: Revision of this header structure. * @hdr_size: Size of this header, including the OemHeader bytes. * @hw_ver: The supported firmware version. * @rt_ver: Version of the code injection image. * @platform_id: A platform specific GUID to specify the platform what * this capsule image support. */ struct pfru_payload_hdr { __u32 sig; __u32 hdr_version; __u32 hdr_size; __u32 hw_ver; __u32 rt_ver; __u8 platform_id[16]; }; enum pfru_dsm_status { DSM_SUCCEED = 0, DSM_FUNC_NOT_SUPPORT = 1, DSM_INVAL_INPUT = 2, DSM_HARDWARE_ERR = 3, DSM_RETRY_SUGGESTED = 4, DSM_UNKNOWN = 5, DSM_FUNC_SPEC_ERR = 6, }; /** * struct pfru_update_cap_info - Runtime update capability information. * * @status: Indicator of whether this query succeed. * @update_cap: Bitmap to indicate whether the feature is supported. * @code_type: A buffer containing an image type GUID. * @fw_version: Platform firmware version. * @code_rt_version: Code injection runtime version for anti-rollback. * @drv_type: A buffer containing an image type GUID. * @drv_rt_version: The version of the driver update runtime code. * @drv_svn: The secure version number(SVN) of the driver update runtime code. * @platform_id: A buffer containing a platform ID GUID. * @oem_id: A buffer containing an OEM ID GUID. * @oem_info_len: Length of the buffer containing the vendor specific information. */ struct pfru_update_cap_info { __u32 status; __u32 update_cap; __u8 code_type[16]; __u32 fw_version; __u32 code_rt_version; __u8 drv_type[16]; __u32 drv_rt_version; __u32 drv_svn; __u8 platform_id[16]; __u8 oem_id[16]; __u32 oem_info_len; }; /** * struct pfru_com_buf_info - Communication buffer information. * * @status: Indicator of whether this query succeed. * @ext_status: Implementation specific query result. * @addr_lo: Low 32bit physical address of the communication buffer to hold * a runtime update package. * @addr_hi: High 32bit physical address of the communication buffer to hold * a runtime update package. * @buf_size: Maximum size in bytes of the communication buffer. */ struct pfru_com_buf_info { __u32 status; __u32 ext_status; __u64 addr_lo; __u64 addr_hi; __u32 buf_size; }; /** * struct pfru_updated_result - Platform firmware runtime update result information. * @status: Indicator of whether this update succeed. * @ext_status: Implementation specific update result. * @low_auth_time: Low 32bit value of image authentication time in nanosecond. * @high_auth_time: High 32bit value of image authentication time in nanosecond. * @low_exec_time: Low 32bit value of image execution time in nanosecond. * @high_exec_time: High 32bit value of image execution time in nanosecond. */ struct pfru_updated_result { __u32 status; __u32 ext_status; __u64 low_auth_time; __u64 high_auth_time; __u64 low_exec_time; __u64 high_exec_time; }; /** * struct pfrt_log_data_info - Log Data from telemetry service. * @status: Indicator of whether this update succeed. * @ext_status: Implementation specific update result. * @chunk1_addr_lo: Low 32bit physical address of the telemetry data chunk1 * starting address. * @chunk1_addr_hi: High 32bit physical address of the telemetry data chunk1 * starting address. * @chunk2_addr_lo: Low 32bit physical address of the telemetry data chunk2 * starting address. * @chunk2_addr_hi: High 32bit physical address of the telemetry data chunk2 * starting address. * @max_data_size: Maximum supported size of data of all data chunks combined. * @chunk1_size: Data size in bytes of the telemetry data chunk1 buffer. * @chunk2_size: Data size in bytes of the telemetry data chunk2 buffer. * @rollover_cnt: Number of times telemetry data buffer is overwritten * since telemetry buffer reset. * @reset_cnt: Number of times telemetry services resets that results in * rollover count and data chunk buffers are reset. */ struct pfrt_log_data_info { __u32 status; __u32 ext_status; __u64 chunk1_addr_lo; __u64 chunk1_addr_hi; __u64 chunk2_addr_lo; __u64 chunk2_addr_hi; __u32 max_data_size; __u32 chunk1_size; __u32 chunk2_size; __u32 rollover_cnt; __u32 reset_cnt; }; /** * struct pfrt_log_info - Telemetry log information. * @log_level: The telemetry log level. * @log_type: The telemetry log type(history and execution). * @log_revid: The telemetry log revision id. */ struct pfrt_log_info { __u32 log_level; __u32 log_type; __u32 log_revid; }; /** * PFRT_LOG_IOC_SET_INFO - _IOW(PFRUT_IOCTL_MAGIC, 0x06, * struct pfrt_log_info) * * Return: * * 0 - success * * -EFAULT - fail to get the setting parameter * * -EINVAL - fail to set the log level * * Set the PFRT log level and log type. The input information is * a struct pfrt_log_info. */ #define PFRT_LOG_IOC_SET_INFO _IOW(PFRUT_IOCTL_MAGIC, 0x06, struct pfrt_log_info) /** * PFRT_LOG_IOC_GET_INFO - _IOR(PFRUT_IOCTL_MAGIC, 0x07, * struct pfrt_log_info) * * Return: * * 0 - success * * -EINVAL - fail to get the log level * * -EFAULT - fail to copy the result back to userspace * * Retrieve log level and log type of the telemetry. The information is * a struct pfrt_log_info. */ #define PFRT_LOG_IOC_GET_INFO _IOR(PFRUT_IOCTL_MAGIC, 0x07, struct pfrt_log_info) /** * PFRT_LOG_IOC_GET_DATA_INFO - _IOR(PFRUT_IOCTL_MAGIC, 0x08, * struct pfrt_log_data_info) * * Return: * * 0 - success * * -EINVAL - fail to get the log buffer information * * -EFAULT - fail to copy the log buffer information to userspace * * Retrieve data information about the telemetry. The information * is a struct pfrt_log_data_info. */ #define PFRT_LOG_IOC_GET_DATA_INFO _IOR(PFRUT_IOCTL_MAGIC, 0x08, struct pfrt_log_data_info) #endif /* __PFRUT_H__ */ linux/pg.h 0000644 00000004532 15063602054 0006467 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* pg.h (c) 1998 Grant R. Guenther <grant@torque.net> Under the terms of the GNU General Public License pg.h defines the user interface to the generic ATAPI packet command driver for parallel port ATAPI devices (pg). The driver is loosely modelled after the generic SCSI driver, sg, although the actual interface is different. The pg driver provides a simple character device interface for sending ATAPI commands to a device. With the exception of the ATAPI reset operation, all operations are performed by a pair of read and write operations to the appropriate /dev/pgN device. A write operation delivers a command and any outbound data in a single buffer. Normally, the write will succeed unless the device is offline or malfunctioning, or there is already another command pending. If the write succeeds, it should be followed immediately by a read operation, to obtain any returned data and status information. A read will fail if there is no operation in progress. As a special case, the device can be reset with a write operation, and in this case, no following read is expected, or permitted. There are no ioctl() operations. Any single operation may transfer at most PG_MAX_DATA bytes. Note that the driver must copy the data through an internal buffer. In keeping with all current ATAPI devices, command packets are assumed to be exactly 12 bytes in length. To permit future changes to this interface, the headers in the read and write buffers contain a single character "magic" flag. Currently this flag must be the character "P". */ #ifndef _LINUX_PG_H #define _LINUX_PG_H #define PG_MAGIC 'P' #define PG_RESET 'Z' #define PG_COMMAND 'C' #define PG_MAX_DATA 32768 struct pg_write_hdr { char magic; /* == PG_MAGIC */ char func; /* PG_RESET or PG_COMMAND */ int dlen; /* number of bytes expected to transfer */ int timeout; /* number of seconds before timeout */ char packet[12]; /* packet command */ }; struct pg_read_hdr { char magic; /* == PG_MAGIC */ char scsi; /* "scsi" status == sense key */ int dlen; /* size of device transfer request */ int duration; /* time in seconds command took */ char pad[12]; /* not used */ }; #endif /* _LINUX_PG_H */ linux/phantom.h 0000644 00000003166 15063602054 0007531 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2005-2007 Jiri Slaby <jirislaby@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef __PHANTOM_H #define __PHANTOM_H #include <linux/types.h> /* PHN_(G/S)ET_REG param */ struct phm_reg { __u32 reg; __u32 value; }; /* PHN_(G/S)ET_REGS param */ struct phm_regs { __u32 count; __u32 mask; __u32 values[8]; }; #define PH_IOC_MAGIC 'p' #define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) #define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *) #define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) #define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *) /* this ioctl tells the driver, that the caller is not OpenHaptics and might * use improved registers update (no more phantom switchoffs when using * libphantom) */ #define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4) #define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg) #define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg) #define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs) #define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs) #define PHN_CONTROL 0x6 /* control byte in iaddr space */ #define PHN_CTL_AMP 0x1 /* switch after torques change */ #define PHN_CTL_BUT 0x2 /* is button switched */ #define PHN_CTL_IRQ 0x10 /* is irq enabled */ #define PHN_ZERO_FORCE 2048 /* zero torque on motor */ #endif linux/phonet.h 0000644 00000011105 15063602054 0007350 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /** * file phonet.h * * Phonet sockets kernel interface * * Copyright (C) 2008 Nokia Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef LINUX_PHONET_H #define LINUX_PHONET_H #include <linux/types.h> #include <linux/socket.h> /* Automatic protocol selection */ #define PN_PROTO_TRANSPORT 0 /* Phonet datagram socket */ #define PN_PROTO_PHONET 1 /* Phonet pipe */ #define PN_PROTO_PIPE 2 #define PHONET_NPROTO 3 /* Socket options for SOL_PNPIPE level */ #define PNPIPE_ENCAP 1 #define PNPIPE_IFINDEX 2 #define PNPIPE_HANDLE 3 #define PNPIPE_INITSTATE 4 #define PNADDR_ANY 0 #define PNADDR_BROADCAST 0xFC #define PNPORT_RESOURCE_ROUTING 0 /* Values for PNPIPE_ENCAP option */ #define PNPIPE_ENCAP_NONE 0 #define PNPIPE_ENCAP_IP 1 /* ioctls */ #define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) #define SIOCPNENABLEPIPE (SIOCPROTOPRIVATE + 13) #define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14) #define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15) /* Phonet protocol header */ struct phonethdr { __u8 pn_rdev; __u8 pn_sdev; __u8 pn_res; __be16 pn_length; __u8 pn_robj; __u8 pn_sobj; } __attribute__((packed)); /* Common Phonet payload header */ struct phonetmsg { __u8 pn_trans_id; /* transaction ID */ __u8 pn_msg_id; /* message type */ union { struct { __u8 pn_submsg_id; /* message subtype */ __u8 pn_data[5]; } base; struct { __u16 pn_e_res_id; /* extended resource ID */ __u8 pn_e_submsg_id; /* message subtype */ __u8 pn_e_data[3]; } ext; } pn_msg_u; }; #define PN_COMMON_MESSAGE 0xF0 #define PN_COMMGR 0x10 #define PN_PREFIX 0xE0 /* resource for extended messages */ #define pn_submsg_id pn_msg_u.base.pn_submsg_id #define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id #define pn_e_res_id pn_msg_u.ext.pn_e_res_id #define pn_data pn_msg_u.base.pn_data #define pn_e_data pn_msg_u.ext.pn_e_data /* data for unreachable errors */ #define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01 #define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14 #define pn_orig_msg_id pn_data[0] #define pn_status pn_data[1] #define pn_e_orig_msg_id pn_e_data[0] #define pn_e_status pn_e_data[1] /* Phonet socket address structure */ struct sockaddr_pn { __kernel_sa_family_t spn_family; __u8 spn_obj; __u8 spn_dev; __u8 spn_resource; __u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3]; } __attribute__((packed)); /* Well known address */ #define PN_DEV_PC 0x10 static __inline__ __u16 pn_object(__u8 addr, __u16 port) { return (addr << 8) | (port & 0x3ff); } static __inline__ __u8 pn_obj(__u16 handle) { return handle & 0xff; } static __inline__ __u8 pn_dev(__u16 handle) { return handle >> 8; } static __inline__ __u16 pn_port(__u16 handle) { return handle & 0x3ff; } static __inline__ __u8 pn_addr(__u16 handle) { return (handle >> 8) & 0xfc; } static __inline__ void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr) { spn->spn_dev &= 0x03; spn->spn_dev |= addr & 0xfc; } static __inline__ void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port) { spn->spn_dev &= 0xfc; spn->spn_dev |= (port >> 8) & 0x03; spn->spn_obj = port & 0xff; } static __inline__ void pn_sockaddr_set_object(struct sockaddr_pn *spn, __u16 handle) { spn->spn_dev = pn_dev(handle); spn->spn_obj = pn_obj(handle); } static __inline__ void pn_sockaddr_set_resource(struct sockaddr_pn *spn, __u8 resource) { spn->spn_resource = resource; } static __inline__ __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn) { return spn->spn_dev & 0xfc; } static __inline__ __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn) { return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj; } static __inline__ __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn) { return pn_object(spn->spn_dev, spn->spn_obj); } static __inline__ __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn) { return spn->spn_resource; } /* Phonet device ioctl requests */ #endif /* LINUX_PHONET_H */ linux/pkt_cls.h 0000644 00000044117 15063602054 0007523 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_PKT_CLS_H #define __LINUX_PKT_CLS_H #include <linux/types.h> #include <linux/pkt_sched.h> #define TC_COOKIE_MAX_SIZE 16 /* Action attributes */ enum { TCA_ACT_UNSPEC, TCA_ACT_KIND, TCA_ACT_OPTIONS, TCA_ACT_INDEX, TCA_ACT_STATS, TCA_ACT_PAD, TCA_ACT_COOKIE, TCA_ACT_FLAGS, TCA_ACT_HW_STATS, TCA_ACT_USED_HW_STATS, TCA_ACT_IN_HW_COUNT, __TCA_ACT_MAX }; /* See other TCA_ACT_FLAGS_ * flags in include/net/act_api.h. */ #define TCA_ACT_FLAGS_NO_PERCPU_STATS (1 << 0) /* Don't use percpu allocator for * actions stats. */ #define TCA_ACT_FLAGS_SKIP_HW (1 << 1) /* don't offload action to HW */ #define TCA_ACT_FLAGS_SKIP_SW (1 << 2) /* don't use action in SW */ /* tca HW stats type * When user does not pass the attribute, he does not care. * It is the same as if he would pass the attribute with * all supported bits set. * In case no bits are set, user is not interested in getting any HW statistics. */ #define TCA_ACT_HW_STATS_IMMEDIATE (1 << 0) /* Means that in dump, user * gets the current HW stats * state from the device * queried at the dump time. */ #define TCA_ACT_HW_STATS_DELAYED (1 << 1) /* Means that in dump, user gets * HW stats that might be out of date * for some time, maybe couple of * seconds. This is the case when * driver polls stats updates * periodically or when it gets async * stats update from the device. */ #define TCA_ACT_MAX __TCA_ACT_MAX #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) #define TCA_ACT_MAX_PRIO 32 #define TCA_ACT_BIND 1 #define TCA_ACT_NOBIND 0 #define TCA_ACT_UNBIND 1 #define TCA_ACT_NOUNBIND 0 #define TCA_ACT_REPLACE 1 #define TCA_ACT_NOREPLACE 0 #define TC_ACT_UNSPEC (-1) #define TC_ACT_OK 0 #define TC_ACT_RECLASSIFY 1 #define TC_ACT_SHOT 2 #define TC_ACT_PIPE 3 #define TC_ACT_STOLEN 4 #define TC_ACT_QUEUED 5 #define TC_ACT_REPEAT 6 #define TC_ACT_REDIRECT 7 #define TC_ACT_TRAP 8 /* For hw path, this means "trap to cpu" * and don't further process the frame * in hardware. For sw path, this is * equivalent of TC_ACT_STOLEN - drop * the skb and act like everything * is alright. */ #define TC_ACT_VALUE_MAX TC_ACT_TRAP /* There is a special kind of actions called "extended actions", * which need a value parameter. These have a local opcode located in * the highest nibble, starting from 1. The rest of the bits * are used to carry the value. These two parts together make * a combined opcode. */ #define __TC_ACT_EXT_SHIFT 28 #define __TC_ACT_EXT(local) ((local) << __TC_ACT_EXT_SHIFT) #define TC_ACT_EXT_VAL_MASK ((1 << __TC_ACT_EXT_SHIFT) - 1) #define TC_ACT_EXT_OPCODE(combined) ((combined) & (~TC_ACT_EXT_VAL_MASK)) #define TC_ACT_EXT_CMP(combined, opcode) (TC_ACT_EXT_OPCODE(combined) == opcode) #define TC_ACT_JUMP __TC_ACT_EXT(1) #define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2) #define TC_ACT_EXT_OPCODE_MAX TC_ACT_GOTO_CHAIN /* These macros are put here for binary compatibility with userspace apps that * make use of them. For kernel code and new userspace apps, use the TCA_ID_* * versions. */ #define TCA_ACT_GACT 5 #define TCA_ACT_IPT 6 #define TCA_ACT_PEDIT 7 #define TCA_ACT_MIRRED 8 #define TCA_ACT_NAT 9 #define TCA_ACT_XT 10 #define TCA_ACT_SKBEDIT 11 #define TCA_ACT_VLAN 12 #define TCA_ACT_BPF 13 #define TCA_ACT_CONNMARK 14 #define TCA_ACT_SKBMOD 15 #define TCA_ACT_CSUM 16 #define TCA_ACT_TUNNEL_KEY 17 #define TCA_ACT_SIMP 22 #define TCA_ACT_IFE 25 #define TCA_ACT_SAMPLE 26 /* Action type identifiers*/ enum tca_id { TCA_ID_UNSPEC = 0, TCA_ID_POLICE = 1, TCA_ID_GACT = TCA_ACT_GACT, TCA_ID_IPT = TCA_ACT_IPT, TCA_ID_PEDIT = TCA_ACT_PEDIT, TCA_ID_MIRRED = TCA_ACT_MIRRED, TCA_ID_NAT = TCA_ACT_NAT, TCA_ID_XT = TCA_ACT_XT, TCA_ID_SKBEDIT = TCA_ACT_SKBEDIT, TCA_ID_VLAN = TCA_ACT_VLAN, TCA_ID_BPF = TCA_ACT_BPF, TCA_ID_CONNMARK = TCA_ACT_CONNMARK, TCA_ID_SKBMOD = TCA_ACT_SKBMOD, TCA_ID_CSUM = TCA_ACT_CSUM, TCA_ID_TUNNEL_KEY = TCA_ACT_TUNNEL_KEY, TCA_ID_SIMP = TCA_ACT_SIMP, TCA_ID_IFE = TCA_ACT_IFE, TCA_ID_SAMPLE = TCA_ACT_SAMPLE, TCA_ID_CTINFO, TCA_ID_MPLS, TCA_ID_CT, TCA_ID_GATE, /* other actions go here */ __TCA_ID_MAX = 255 }; #define TCA_ID_MAX __TCA_ID_MAX struct tc_police { __u32 index; int action; #define TC_POLICE_UNSPEC TC_ACT_UNSPEC #define TC_POLICE_OK TC_ACT_OK #define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY #define TC_POLICE_SHOT TC_ACT_SHOT #define TC_POLICE_PIPE TC_ACT_PIPE __u32 limit; __u32 burst; __u32 mtu; struct tc_ratespec rate; struct tc_ratespec peakrate; int refcnt; int bindcnt; __u32 capab; }; struct tcf_t { __u64 install; __u64 lastuse; __u64 expires; __u64 firstuse; }; struct tc_cnt { int refcnt; int bindcnt; }; #define tc_gen \ __u32 index; \ __u32 capab; \ int action; \ int refcnt; \ int bindcnt enum { TCA_POLICE_UNSPEC, TCA_POLICE_TBF, TCA_POLICE_RATE, TCA_POLICE_PEAKRATE, TCA_POLICE_AVRATE, TCA_POLICE_RESULT, TCA_POLICE_TM, TCA_POLICE_PAD, TCA_POLICE_RATE64, TCA_POLICE_PEAKRATE64, TCA_POLICE_PKTRATE64, TCA_POLICE_PKTBURST64, __TCA_POLICE_MAX #define TCA_POLICE_RESULT TCA_POLICE_RESULT }; #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) /* tca flags definitions */ #define TCA_CLS_FLAGS_SKIP_HW (1 << 0) /* don't offload filter to HW */ #define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */ #define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */ #define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */ #define TCA_CLS_FLAGS_VERBOSE (1 << 4) /* verbose logging */ /* U32 filters */ #define TC_U32_HTID(h) ((h)&0xFFF00000) #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) #define TC_U32_HASH(h) (((h)>>12)&0xFF) #define TC_U32_NODE(h) ((h)&0xFFF) #define TC_U32_KEY(h) ((h)&0xFFFFF) #define TC_U32_UNSPEC 0 #define TC_U32_ROOT (0xFFF00000) enum { TCA_U32_UNSPEC, TCA_U32_CLASSID, TCA_U32_HASH, TCA_U32_LINK, TCA_U32_DIVISOR, TCA_U32_SEL, TCA_U32_POLICE, TCA_U32_ACT, TCA_U32_INDEV, TCA_U32_PCNT, TCA_U32_MARK, TCA_U32_FLAGS, TCA_U32_PAD, __TCA_U32_MAX }; #define TCA_U32_MAX (__TCA_U32_MAX - 1) struct tc_u32_key { __be32 mask; __be32 val; int off; int offmask; }; struct tc_u32_sel { unsigned char flags; unsigned char offshift; unsigned char nkeys; __be16 offmask; __u16 off; short offoff; short hoff; __be32 hmask; struct tc_u32_key keys[0]; }; struct tc_u32_mark { __u32 val; __u32 mask; __u32 success; }; struct tc_u32_pcnt { __u64 rcnt; __u64 rhit; __u64 kcnts[0]; }; /* Flags */ #define TC_U32_TERMINAL 1 #define TC_U32_OFFSET 2 #define TC_U32_VAROFFSET 4 #define TC_U32_EAT 8 #define TC_U32_MAXDEPTH 8 /* RSVP filter */ enum { TCA_RSVP_UNSPEC, TCA_RSVP_CLASSID, TCA_RSVP_DST, TCA_RSVP_SRC, TCA_RSVP_PINFO, TCA_RSVP_POLICE, TCA_RSVP_ACT, __TCA_RSVP_MAX }; #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) struct tc_rsvp_gpi { __u32 key; __u32 mask; int offset; }; struct tc_rsvp_pinfo { struct tc_rsvp_gpi dpi; struct tc_rsvp_gpi spi; __u8 protocol; __u8 tunnelid; __u8 tunnelhdr; __u8 pad; }; /* ROUTE filter */ enum { TCA_ROUTE4_UNSPEC, TCA_ROUTE4_CLASSID, TCA_ROUTE4_TO, TCA_ROUTE4_FROM, TCA_ROUTE4_IIF, TCA_ROUTE4_POLICE, TCA_ROUTE4_ACT, __TCA_ROUTE4_MAX }; #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) /* FW filter */ enum { TCA_FW_UNSPEC, TCA_FW_CLASSID, TCA_FW_POLICE, TCA_FW_INDEV, TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ TCA_FW_MASK, __TCA_FW_MAX }; #define TCA_FW_MAX (__TCA_FW_MAX - 1) /* TC index filter */ enum { TCA_TCINDEX_UNSPEC, TCA_TCINDEX_HASH, TCA_TCINDEX_MASK, TCA_TCINDEX_SHIFT, TCA_TCINDEX_FALL_THROUGH, TCA_TCINDEX_CLASSID, TCA_TCINDEX_POLICE, TCA_TCINDEX_ACT, __TCA_TCINDEX_MAX }; #define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) /* Flow filter */ enum { FLOW_KEY_SRC, FLOW_KEY_DST, FLOW_KEY_PROTO, FLOW_KEY_PROTO_SRC, FLOW_KEY_PROTO_DST, FLOW_KEY_IIF, FLOW_KEY_PRIORITY, FLOW_KEY_MARK, FLOW_KEY_NFCT, FLOW_KEY_NFCT_SRC, FLOW_KEY_NFCT_DST, FLOW_KEY_NFCT_PROTO_SRC, FLOW_KEY_NFCT_PROTO_DST, FLOW_KEY_RTCLASSID, FLOW_KEY_SKUID, FLOW_KEY_SKGID, FLOW_KEY_VLAN_TAG, FLOW_KEY_RXHASH, __FLOW_KEY_MAX, }; #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) enum { FLOW_MODE_MAP, FLOW_MODE_HASH, }; enum { TCA_FLOW_UNSPEC, TCA_FLOW_KEYS, TCA_FLOW_MODE, TCA_FLOW_BASECLASS, TCA_FLOW_RSHIFT, TCA_FLOW_ADDEND, TCA_FLOW_MASK, TCA_FLOW_XOR, TCA_FLOW_DIVISOR, TCA_FLOW_ACT, TCA_FLOW_POLICE, TCA_FLOW_EMATCHES, TCA_FLOW_PERTURB, __TCA_FLOW_MAX }; #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) /* Basic filter */ struct tc_basic_pcnt { __u64 rcnt; __u64 rhit; }; enum { TCA_BASIC_UNSPEC, TCA_BASIC_CLASSID, TCA_BASIC_EMATCHES, TCA_BASIC_ACT, TCA_BASIC_POLICE, TCA_BASIC_PCNT, TCA_BASIC_PAD, __TCA_BASIC_MAX }; #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) /* Cgroup classifier */ enum { TCA_CGROUP_UNSPEC, TCA_CGROUP_ACT, TCA_CGROUP_POLICE, TCA_CGROUP_EMATCHES, __TCA_CGROUP_MAX, }; #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) /* BPF classifier */ #define TCA_BPF_FLAG_ACT_DIRECT (1 << 0) enum { TCA_BPF_UNSPEC, TCA_BPF_ACT, TCA_BPF_POLICE, TCA_BPF_CLASSID, TCA_BPF_OPS_LEN, TCA_BPF_OPS, TCA_BPF_FD, TCA_BPF_NAME, TCA_BPF_FLAGS, TCA_BPF_FLAGS_GEN, TCA_BPF_TAG, TCA_BPF_ID, __TCA_BPF_MAX, }; #define TCA_BPF_MAX (__TCA_BPF_MAX - 1) /* Flower classifier */ enum { TCA_FLOWER_UNSPEC, TCA_FLOWER_CLASSID, TCA_FLOWER_INDEV, TCA_FLOWER_ACT, TCA_FLOWER_KEY_ETH_DST, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_DST_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_SRC, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_SRC_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_ETH_TYPE, /* be16 */ TCA_FLOWER_KEY_IP_PROTO, /* u8 */ TCA_FLOWER_KEY_IPV4_SRC, /* be32 */ TCA_FLOWER_KEY_IPV4_SRC_MASK, /* be32 */ TCA_FLOWER_KEY_IPV4_DST, /* be32 */ TCA_FLOWER_KEY_IPV4_DST_MASK, /* be32 */ TCA_FLOWER_KEY_IPV6_SRC, /* struct in6_addr */ TCA_FLOWER_KEY_IPV6_SRC_MASK, /* struct in6_addr */ TCA_FLOWER_KEY_IPV6_DST, /* struct in6_addr */ TCA_FLOWER_KEY_IPV6_DST_MASK, /* struct in6_addr */ TCA_FLOWER_KEY_TCP_SRC, /* be16 */ TCA_FLOWER_KEY_TCP_DST, /* be16 */ TCA_FLOWER_KEY_UDP_SRC, /* be16 */ TCA_FLOWER_KEY_UDP_DST, /* be16 */ TCA_FLOWER_FLAGS, TCA_FLOWER_KEY_VLAN_ID, /* be16 */ TCA_FLOWER_KEY_VLAN_PRIO, /* u8 */ TCA_FLOWER_KEY_VLAN_ETH_TYPE, /* be16 */ TCA_FLOWER_KEY_ENC_KEY_ID, /* be32 */ TCA_FLOWER_KEY_ENC_IPV4_SRC, /* be32 */ TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */ TCA_FLOWER_KEY_ENC_IPV4_DST, /* be32 */ TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */ TCA_FLOWER_KEY_ENC_IPV6_SRC, /* struct in6_addr */ TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */ TCA_FLOWER_KEY_ENC_IPV6_DST, /* struct in6_addr */ TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */ TCA_FLOWER_KEY_TCP_SRC_MASK, /* be16 */ TCA_FLOWER_KEY_TCP_DST_MASK, /* be16 */ TCA_FLOWER_KEY_UDP_SRC_MASK, /* be16 */ TCA_FLOWER_KEY_UDP_DST_MASK, /* be16 */ TCA_FLOWER_KEY_SCTP_SRC_MASK, /* be16 */ TCA_FLOWER_KEY_SCTP_DST_MASK, /* be16 */ TCA_FLOWER_KEY_SCTP_SRC, /* be16 */ TCA_FLOWER_KEY_SCTP_DST, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_DST_PORT, /* be16 */ TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, /* be16 */ TCA_FLOWER_KEY_FLAGS, /* be32 */ TCA_FLOWER_KEY_FLAGS_MASK, /* be32 */ TCA_FLOWER_KEY_ICMPV4_CODE, /* u8 */ TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */ TCA_FLOWER_KEY_ICMPV4_TYPE, /* u8 */ TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */ TCA_FLOWER_KEY_ICMPV6_CODE, /* u8 */ TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */ TCA_FLOWER_KEY_ICMPV6_TYPE, /* u8 */ TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */ TCA_FLOWER_KEY_ARP_SIP, /* be32 */ TCA_FLOWER_KEY_ARP_SIP_MASK, /* be32 */ TCA_FLOWER_KEY_ARP_TIP, /* be32 */ TCA_FLOWER_KEY_ARP_TIP_MASK, /* be32 */ TCA_FLOWER_KEY_ARP_OP, /* u8 */ TCA_FLOWER_KEY_ARP_OP_MASK, /* u8 */ TCA_FLOWER_KEY_ARP_SHA, /* ETH_ALEN */ TCA_FLOWER_KEY_ARP_SHA_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_ARP_THA, /* ETH_ALEN */ TCA_FLOWER_KEY_ARP_THA_MASK, /* ETH_ALEN */ TCA_FLOWER_KEY_MPLS_TTL, /* u8 - 8 bits */ TCA_FLOWER_KEY_MPLS_BOS, /* u8 - 1 bit */ TCA_FLOWER_KEY_MPLS_TC, /* u8 - 3 bits */ TCA_FLOWER_KEY_MPLS_LABEL, /* be32 - 20 bits */ TCA_FLOWER_KEY_TCP_FLAGS, /* be16 */ TCA_FLOWER_KEY_TCP_FLAGS_MASK, /* be16 */ TCA_FLOWER_KEY_IP_TOS, /* u8 */ TCA_FLOWER_KEY_IP_TOS_MASK, /* u8 */ TCA_FLOWER_KEY_IP_TTL, /* u8 */ TCA_FLOWER_KEY_IP_TTL_MASK, /* u8 */ TCA_FLOWER_KEY_CVLAN_ID, /* be16 */ TCA_FLOWER_KEY_CVLAN_PRIO, /* u8 */ TCA_FLOWER_KEY_CVLAN_ETH_TYPE, /* be16 */ TCA_FLOWER_KEY_ENC_IP_TOS, /* u8 */ TCA_FLOWER_KEY_ENC_IP_TOS_MASK, /* u8 */ TCA_FLOWER_KEY_ENC_IP_TTL, /* u8 */ TCA_FLOWER_KEY_ENC_IP_TTL_MASK, /* u8 */ TCA_FLOWER_KEY_ENC_OPTS, TCA_FLOWER_KEY_ENC_OPTS_MASK, TCA_FLOWER_IN_HW_COUNT, TCA_FLOWER_KEY_PORT_SRC_MIN, /* be16 */ TCA_FLOWER_KEY_PORT_SRC_MAX, /* be16 */ TCA_FLOWER_KEY_PORT_DST_MIN, /* be16 */ TCA_FLOWER_KEY_PORT_DST_MAX, /* be16 */ TCA_FLOWER_KEY_CT_STATE, /* u16 */ TCA_FLOWER_KEY_CT_STATE_MASK, /* u16 */ TCA_FLOWER_KEY_CT_ZONE, /* u16 */ TCA_FLOWER_KEY_CT_ZONE_MASK, /* u16 */ TCA_FLOWER_KEY_CT_MARK, /* u32 */ TCA_FLOWER_KEY_CT_MARK_MASK, /* u32 */ TCA_FLOWER_KEY_CT_LABELS, /* u128 */ TCA_FLOWER_KEY_CT_LABELS_MASK, /* u128 */ TCA_FLOWER_KEY_MPLS_OPTS, TCA_FLOWER_KEY_HASH, /* u32 */ TCA_FLOWER_KEY_HASH_MASK, /* u32 */ TCA_FLOWER_KEY_NUM_OF_VLANS, /* u8 */ TCA_FLOWER_KEY_PPPOE_SID, /* be16 */ TCA_FLOWER_KEY_PPP_PROTO, /* be16 */ TCA_FLOWER_KEY_L2TPV3_SID, /* be32 */ __TCA_FLOWER_MAX, }; #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) enum { TCA_FLOWER_KEY_CT_FLAGS_NEW = 1 << 0, /* Beginning of a new connection. */ TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1, /* Part of an existing connection. */ TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2, /* Related to an established connection. */ TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3, /* Conntrack has occurred. */ TCA_FLOWER_KEY_CT_FLAGS_INVALID = 1 << 4, /* Conntrack is invalid. */ TCA_FLOWER_KEY_CT_FLAGS_REPLY = 1 << 5, /* Packet is in the reply direction. */ __TCA_FLOWER_KEY_CT_FLAGS_MAX, }; enum { TCA_FLOWER_KEY_ENC_OPTS_UNSPEC, TCA_FLOWER_KEY_ENC_OPTS_GENEVE, /* Nested * TCA_FLOWER_KEY_ENC_OPT_GENEVE_ * attributes */ TCA_FLOWER_KEY_ENC_OPTS_VXLAN, /* Nested * TCA_FLOWER_KEY_ENC_OPT_VXLAN_ * attributes */ TCA_FLOWER_KEY_ENC_OPTS_ERSPAN, /* Nested * TCA_FLOWER_KEY_ENC_OPT_ERSPAN_ * attributes */ __TCA_FLOWER_KEY_ENC_OPTS_MAX, }; #define TCA_FLOWER_KEY_ENC_OPTS_MAX (__TCA_FLOWER_KEY_ENC_OPTS_MAX - 1) enum { TCA_FLOWER_KEY_ENC_OPT_GENEVE_UNSPEC, TCA_FLOWER_KEY_ENC_OPT_GENEVE_CLASS, /* u16 */ TCA_FLOWER_KEY_ENC_OPT_GENEVE_TYPE, /* u8 */ TCA_FLOWER_KEY_ENC_OPT_GENEVE_DATA, /* 4 to 128 bytes */ __TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX, }; #define TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX \ (__TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX - 1) enum { TCA_FLOWER_KEY_ENC_OPT_VXLAN_UNSPEC, TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP, /* u32 */ __TCA_FLOWER_KEY_ENC_OPT_VXLAN_MAX, }; #define TCA_FLOWER_KEY_ENC_OPT_VXLAN_MAX \ (__TCA_FLOWER_KEY_ENC_OPT_VXLAN_MAX - 1) enum { TCA_FLOWER_KEY_ENC_OPT_ERSPAN_UNSPEC, TCA_FLOWER_KEY_ENC_OPT_ERSPAN_VER, /* u8 */ TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX, /* be32 */ TCA_FLOWER_KEY_ENC_OPT_ERSPAN_DIR, /* u8 */ TCA_FLOWER_KEY_ENC_OPT_ERSPAN_HWID, /* u8 */ __TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX, }; #define TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX \ (__TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX - 1) enum { TCA_FLOWER_KEY_MPLS_OPTS_UNSPEC, TCA_FLOWER_KEY_MPLS_OPTS_LSE, __TCA_FLOWER_KEY_MPLS_OPTS_MAX, }; #define TCA_FLOWER_KEY_MPLS_OPTS_MAX (__TCA_FLOWER_KEY_MPLS_OPTS_MAX - 1) enum { TCA_FLOWER_KEY_MPLS_OPT_LSE_UNSPEC, TCA_FLOWER_KEY_MPLS_OPT_LSE_DEPTH, TCA_FLOWER_KEY_MPLS_OPT_LSE_TTL, TCA_FLOWER_KEY_MPLS_OPT_LSE_BOS, TCA_FLOWER_KEY_MPLS_OPT_LSE_TC, TCA_FLOWER_KEY_MPLS_OPT_LSE_LABEL, __TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX, }; #define TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX \ (__TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX - 1) enum { TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0), TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1), }; #define TCA_FLOWER_MASK_FLAGS_RANGE (1 << 0) /* Range-based match */ /* Match-all classifier */ struct tc_matchall_pcnt { __u64 rhit; }; enum { TCA_MATCHALL_UNSPEC, TCA_MATCHALL_CLASSID, TCA_MATCHALL_ACT, TCA_MATCHALL_FLAGS, TCA_MATCHALL_PCNT, TCA_MATCHALL_PAD, __TCA_MATCHALL_MAX, }; #define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1) /* Extended Matches */ struct tcf_ematch_tree_hdr { __u16 nmatches; __u16 progid; }; enum { TCA_EMATCH_TREE_UNSPEC, TCA_EMATCH_TREE_HDR, TCA_EMATCH_TREE_LIST, __TCA_EMATCH_TREE_MAX }; #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) struct tcf_ematch_hdr { __u16 matchid; __u16 kind; __u16 flags; __u16 pad; /* currently unused */ }; /* 0 1 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 * +-----------------------+-+-+---+ * | Unused |S|I| R | * +-----------------------+-+-+---+ * * R(2) ::= relation to next ematch * where: 0 0 END (last ematch) * 0 1 AND * 1 0 OR * 1 1 Unused (invalid) * I(1) ::= invert result * S(1) ::= simple payload */ #define TCF_EM_REL_END 0 #define TCF_EM_REL_AND (1<<0) #define TCF_EM_REL_OR (1<<1) #define TCF_EM_INVERT (1<<2) #define TCF_EM_SIMPLE (1<<3) #define TCF_EM_REL_MASK 3 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) enum { TCF_LAYER_LINK, TCF_LAYER_NETWORK, TCF_LAYER_TRANSPORT, __TCF_LAYER_MAX }; #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) /* Ematch type assignments * 1..32767 Reserved for ematches inside kernel tree * 32768..65535 Free to use, not reliable */ #define TCF_EM_CONTAINER 0 #define TCF_EM_CMP 1 #define TCF_EM_NBYTE 2 #define TCF_EM_U32 3 #define TCF_EM_META 4 #define TCF_EM_TEXT 5 #define TCF_EM_VLAN 6 #define TCF_EM_CANID 7 #define TCF_EM_IPSET 8 #define TCF_EM_IPT 9 #define TCF_EM_MAX 9 enum { TCF_EM_PROG_TC }; enum { TCF_EM_OPND_EQ, TCF_EM_OPND_GT, TCF_EM_OPND_LT }; #endif linux/pkt_sched.h 0000644 00000073130 15063602054 0010025 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_PKT_SCHED_H #define __LINUX_PKT_SCHED_H #include <linux/const.h> #include <linux/types.h> /* Logical priority bands not depending on specific packet scheduler. Every scheduler will map them to real traffic classes, if it has no more precise mechanism to classify packets. These numbers have no special meaning, though their coincidence with obsolete IPv6 values is not occasional :-). New IPv6 drafts preferred full anarchy inspired by diffserv group. Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy class, actually, as rule it will be handled with more care than filler or even bulk. */ #define TC_PRIO_BESTEFFORT 0 #define TC_PRIO_FILLER 1 #define TC_PRIO_BULK 2 #define TC_PRIO_INTERACTIVE_BULK 4 #define TC_PRIO_INTERACTIVE 6 #define TC_PRIO_CONTROL 7 #define TC_PRIO_MAX 15 /* Generic queue statistics, available for all the elements. Particular schedulers may have also their private records. */ struct tc_stats { __u64 bytes; /* Number of enqueued bytes */ __u32 packets; /* Number of enqueued packets */ __u32 drops; /* Packets dropped because of lack of resources */ __u32 overlimits; /* Number of throttle events when this * flow goes out of allocated bandwidth */ __u32 bps; /* Current flow byte rate */ __u32 pps; /* Current flow packet rate */ __u32 qlen; __u32 backlog; }; struct tc_estimator { signed char interval; unsigned char ewma_log; }; /* "Handles" --------- All the traffic control objects have 32bit identifiers, or "handles". They can be considered as opaque numbers from user API viewpoint, but actually they always consist of two fields: major and minor numbers, which are interpreted by kernel specially, that may be used by applications, though not recommended. F.e. qdisc handles always have minor number equal to zero, classes (or flows) have major equal to parent qdisc major, and minor uniquely identifying class inside qdisc. Macros to manipulate handles: */ #define TC_H_MAJ_MASK (0xFFFF0000U) #define TC_H_MIN_MASK (0x0000FFFFU) #define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) #define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) #define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) #define TC_H_UNSPEC (0U) #define TC_H_ROOT (0xFFFFFFFFU) #define TC_H_INGRESS (0xFFFFFFF1U) #define TC_H_CLSACT TC_H_INGRESS #define TC_H_MIN_PRIORITY 0xFFE0U #define TC_H_MIN_INGRESS 0xFFF2U #define TC_H_MIN_EGRESS 0xFFF3U /* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ enum tc_link_layer { TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ TC_LINKLAYER_ETHERNET, TC_LINKLAYER_ATM, }; #define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ struct tc_ratespec { unsigned char cell_log; __u8 linklayer; /* lower 4 bits */ unsigned short overhead; short cell_align; unsigned short mpu; __u32 rate; }; #define TC_RTAB_SIZE 1024 struct tc_sizespec { unsigned char cell_log; unsigned char size_log; short cell_align; int overhead; unsigned int linklayer; unsigned int mpu; unsigned int mtu; unsigned int tsize; }; enum { TCA_STAB_UNSPEC, TCA_STAB_BASE, TCA_STAB_DATA, __TCA_STAB_MAX }; #define TCA_STAB_MAX (__TCA_STAB_MAX - 1) /* FIFO section */ struct tc_fifo_qopt { __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ }; /* SKBPRIO section */ /* * Priorities go from zero to (SKBPRIO_MAX_PRIORITY - 1). * SKBPRIO_MAX_PRIORITY should be at least 64 in order for skbprio to be able * to map one to one the DS field of IPV4 and IPV6 headers. * Memory allocation grows linearly with SKBPRIO_MAX_PRIORITY. */ #define SKBPRIO_MAX_PRIORITY 64 struct tc_skbprio_qopt { __u32 limit; /* Queue length in packets. */ }; /* PRIO section */ #define TCQ_PRIO_BANDS 16 #define TCQ_MIN_PRIO_BANDS 2 struct tc_prio_qopt { int bands; /* Number of bands */ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ }; /* MULTIQ section */ struct tc_multiq_qopt { __u16 bands; /* Number of bands */ __u16 max_bands; /* Maximum number of queues */ }; /* PLUG section */ #define TCQ_PLUG_BUFFER 0 #define TCQ_PLUG_RELEASE_ONE 1 #define TCQ_PLUG_RELEASE_INDEFINITE 2 #define TCQ_PLUG_LIMIT 3 struct tc_plug_qopt { /* TCQ_PLUG_BUFFER: Inset a plug into the queue and * buffer any incoming packets * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head * to beginning of the next plug. * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. * Stop buffering packets until the next TCQ_PLUG_BUFFER * command is received (just act as a pass-thru queue). * TCQ_PLUG_LIMIT: Increase/decrease queue size */ int action; __u32 limit; }; /* TBF section */ struct tc_tbf_qopt { struct tc_ratespec rate; struct tc_ratespec peakrate; __u32 limit; __u32 buffer; __u32 mtu; }; enum { TCA_TBF_UNSPEC, TCA_TBF_PARMS, TCA_TBF_RTAB, TCA_TBF_PTAB, TCA_TBF_RATE64, TCA_TBF_PRATE64, TCA_TBF_BURST, TCA_TBF_PBURST, TCA_TBF_PAD, __TCA_TBF_MAX, }; #define TCA_TBF_MAX (__TCA_TBF_MAX - 1) /* TEQL section */ /* TEQL does not require any parameters */ /* SFQ section */ struct tc_sfq_qopt { unsigned quantum; /* Bytes per round allocated to flow */ int perturb_period; /* Period of hash perturbation */ __u32 limit; /* Maximal packets in queue */ unsigned divisor; /* Hash divisor */ unsigned flows; /* Maximal number of flows */ }; struct tc_sfqred_stats { __u32 prob_drop; /* Early drops, below max threshold */ __u32 forced_drop; /* Early drops, after max threshold */ __u32 prob_mark; /* Marked packets, below max threshold */ __u32 forced_mark; /* Marked packets, after max threshold */ __u32 prob_mark_head; /* Marked packets, below max threshold */ __u32 forced_mark_head;/* Marked packets, after max threshold */ }; struct tc_sfq_qopt_v1 { struct tc_sfq_qopt v0; unsigned int depth; /* max number of packets per flow */ unsigned int headdrop; /* SFQRED parameters */ __u32 limit; /* HARD maximal flow queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ unsigned char flags; __u32 max_P; /* probability, high resolution */ /* SFQRED stats */ struct tc_sfqred_stats stats; }; struct tc_sfq_xstats { __s32 allot; }; /* RED section */ enum { TCA_RED_UNSPEC, TCA_RED_PARMS, TCA_RED_STAB, TCA_RED_MAX_P, TCA_RED_FLAGS, /* bitfield32 */ TCA_RED_EARLY_DROP_BLOCK, /* u32 */ TCA_RED_MARK_BLOCK, /* u32 */ __TCA_RED_MAX, }; #define TCA_RED_MAX (__TCA_RED_MAX - 1) struct tc_red_qopt { __u32 limit; /* HARD maximal queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ /* This field can be used for flags that a RED-like qdisc has * historically supported. E.g. when configuring RED, it can be used for * ECN, HARDDROP and ADAPTATIVE. For SFQ it can be used for ECN, * HARDDROP. Etc. Because this field has not been validated, and is * copied back on dump, any bits besides those to which a given qdisc * has assigned a historical meaning need to be considered for free use * by userspace tools. * * Any further flags need to be passed differently, e.g. through an * attribute (such as TCA_RED_FLAGS above). Such attribute should allow * passing both recent and historic flags in one value. */ unsigned char flags; #define TC_RED_ECN 1 #define TC_RED_HARDDROP 2 #define TC_RED_ADAPTATIVE 4 #define TC_RED_NODROP 8 }; #define TC_RED_HISTORIC_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE) struct tc_red_xstats { __u32 early; /* Early drops */ __u32 pdrop; /* Drops due to queue limits */ __u32 other; /* Drops due to drop() calls */ __u32 marked; /* Marked packets */ }; /* GRED section */ #define MAX_DPs 16 enum { TCA_GRED_UNSPEC, TCA_GRED_PARMS, TCA_GRED_STAB, TCA_GRED_DPS, TCA_GRED_MAX_P, TCA_GRED_LIMIT, TCA_GRED_VQ_LIST, /* nested TCA_GRED_VQ_ENTRY */ __TCA_GRED_MAX, }; #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) enum { TCA_GRED_VQ_ENTRY_UNSPEC, TCA_GRED_VQ_ENTRY, /* nested TCA_GRED_VQ_* */ __TCA_GRED_VQ_ENTRY_MAX, }; #define TCA_GRED_VQ_ENTRY_MAX (__TCA_GRED_VQ_ENTRY_MAX - 1) enum { TCA_GRED_VQ_UNSPEC, TCA_GRED_VQ_PAD, TCA_GRED_VQ_DP, /* u32 */ TCA_GRED_VQ_STAT_BYTES, /* u64 */ TCA_GRED_VQ_STAT_PACKETS, /* u32 */ TCA_GRED_VQ_STAT_BACKLOG, /* u32 */ TCA_GRED_VQ_STAT_PROB_DROP, /* u32 */ TCA_GRED_VQ_STAT_PROB_MARK, /* u32 */ TCA_GRED_VQ_STAT_FORCED_DROP, /* u32 */ TCA_GRED_VQ_STAT_FORCED_MARK, /* u32 */ TCA_GRED_VQ_STAT_PDROP, /* u32 */ TCA_GRED_VQ_STAT_OTHER, /* u32 */ TCA_GRED_VQ_FLAGS, /* u32 */ __TCA_GRED_VQ_MAX }; #define TCA_GRED_VQ_MAX (__TCA_GRED_VQ_MAX - 1) struct tc_gred_qopt { __u32 limit; /* HARD maximal queue length (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */ __u32 DP; /* up to 2^32 DPs */ __u32 backlog; __u32 qave; __u32 forced; __u32 early; __u32 other; __u32 pdrop; __u8 Wlog; /* log(W) */ __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ __u8 Scell_log; /* cell size for idle damping */ __u8 prio; /* prio of this VQ */ __u32 packets; __u32 bytesin; }; /* gred setup */ struct tc_gred_sopt { __u32 DPs; __u32 def_DP; __u8 grio; __u8 flags; __u16 pad1; }; /* CHOKe section */ enum { TCA_CHOKE_UNSPEC, TCA_CHOKE_PARMS, TCA_CHOKE_STAB, TCA_CHOKE_MAX_P, __TCA_CHOKE_MAX, }; #define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) struct tc_choke_qopt { __u32 limit; /* Hard queue length (packets) */ __u32 qth_min; /* Min average threshold (packets) */ __u32 qth_max; /* Max average threshold (packets) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ unsigned char flags; /* see RED flags */ }; struct tc_choke_xstats { __u32 early; /* Early drops */ __u32 pdrop; /* Drops due to queue limits */ __u32 other; /* Drops due to drop() calls */ __u32 marked; /* Marked packets */ __u32 matched; /* Drops due to flow match */ }; /* HTB section */ #define TC_HTB_NUMPRIO 8 #define TC_HTB_MAXDEPTH 8 #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ struct tc_htb_opt { struct tc_ratespec rate; struct tc_ratespec ceil; __u32 buffer; __u32 cbuffer; __u32 quantum; __u32 level; /* out only */ __u32 prio; }; struct tc_htb_glob { __u32 version; /* to match HTB/TC */ __u32 rate2quantum; /* bps->quantum divisor */ __u32 defcls; /* default class number */ __u32 debug; /* debug flags */ /* stats */ __u32 direct_pkts; /* count of non shaped packets */ }; enum { TCA_HTB_UNSPEC, TCA_HTB_PARMS, TCA_HTB_INIT, TCA_HTB_CTAB, TCA_HTB_RTAB, TCA_HTB_DIRECT_QLEN, TCA_HTB_RATE64, TCA_HTB_CEIL64, TCA_HTB_PAD, TCA_HTB_OFFLOAD, __TCA_HTB_MAX, }; #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) struct tc_htb_xstats { __u32 lends; __u32 borrows; __u32 giants; /* unused since 'Make HTB scheduler work with TSO.' */ __s32 tokens; __s32 ctokens; }; /* HFSC section */ struct tc_hfsc_qopt { __u16 defcls; /* default class */ }; struct tc_service_curve { __u32 m1; /* slope of the first segment in bps */ __u32 d; /* x-projection of the first segment in us */ __u32 m2; /* slope of the second segment in bps */ }; struct tc_hfsc_stats { __u64 work; /* total work done */ __u64 rtwork; /* work done by real-time criteria */ __u32 period; /* current period */ __u32 level; /* class level in hierarchy */ }; enum { TCA_HFSC_UNSPEC, TCA_HFSC_RSC, TCA_HFSC_FSC, TCA_HFSC_USC, __TCA_HFSC_MAX, }; #define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) /* CBQ section */ #define TC_CBQ_MAXPRIO 8 #define TC_CBQ_MAXLEVEL 8 #define TC_CBQ_DEF_EWMA 5 struct tc_cbq_lssopt { unsigned char change; unsigned char flags; #define TCF_CBQ_LSS_BOUNDED 1 #define TCF_CBQ_LSS_ISOLATED 2 unsigned char ewma_log; unsigned char level; #define TCF_CBQ_LSS_FLAGS 1 #define TCF_CBQ_LSS_EWMA 2 #define TCF_CBQ_LSS_MAXIDLE 4 #define TCF_CBQ_LSS_MINIDLE 8 #define TCF_CBQ_LSS_OFFTIME 0x10 #define TCF_CBQ_LSS_AVPKT 0x20 __u32 maxidle; __u32 minidle; __u32 offtime; __u32 avpkt; }; struct tc_cbq_wrropt { unsigned char flags; unsigned char priority; unsigned char cpriority; unsigned char __reserved; __u32 allot; __u32 weight; }; struct tc_cbq_ovl { unsigned char strategy; #define TC_CBQ_OVL_CLASSIC 0 #define TC_CBQ_OVL_DELAY 1 #define TC_CBQ_OVL_LOWPRIO 2 #define TC_CBQ_OVL_DROP 3 #define TC_CBQ_OVL_RCLASSIC 4 unsigned char priority2; __u16 pad; __u32 penalty; }; struct tc_cbq_police { unsigned char police; unsigned char __res1; unsigned short __res2; }; struct tc_cbq_fopt { __u32 split; __u32 defmap; __u32 defchange; }; struct tc_cbq_xstats { __u32 borrows; __u32 overactions; __s32 avgidle; __s32 undertime; }; enum { TCA_CBQ_UNSPEC, TCA_CBQ_LSSOPT, TCA_CBQ_WRROPT, TCA_CBQ_FOPT, TCA_CBQ_OVL_STRATEGY, TCA_CBQ_RATE, TCA_CBQ_RTAB, TCA_CBQ_POLICE, __TCA_CBQ_MAX, }; #define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) /* dsmark section */ enum { TCA_DSMARK_UNSPEC, TCA_DSMARK_INDICES, TCA_DSMARK_DEFAULT_INDEX, TCA_DSMARK_SET_TC_INDEX, TCA_DSMARK_MASK, TCA_DSMARK_VALUE, __TCA_DSMARK_MAX, }; #define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) /* ATM section */ enum { TCA_ATM_UNSPEC, TCA_ATM_FD, /* file/socket descriptor */ TCA_ATM_PTR, /* pointer to descriptor - later */ TCA_ATM_HDR, /* LL header */ TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ TCA_ATM_ADDR, /* PVC address (for output only) */ TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ __TCA_ATM_MAX, }; #define TCA_ATM_MAX (__TCA_ATM_MAX - 1) /* Network emulator */ enum { TCA_NETEM_UNSPEC, TCA_NETEM_CORR, TCA_NETEM_DELAY_DIST, TCA_NETEM_REORDER, TCA_NETEM_CORRUPT, TCA_NETEM_LOSS, TCA_NETEM_RATE, TCA_NETEM_ECN, TCA_NETEM_RATE64, TCA_NETEM_PAD, TCA_NETEM_LATENCY64, TCA_NETEM_JITTER64, TCA_NETEM_SLOT, TCA_NETEM_SLOT_DIST, __TCA_NETEM_MAX, }; #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) struct tc_netem_qopt { __u32 latency; /* added delay (us) */ __u32 limit; /* fifo limit (packets) */ __u32 loss; /* random packet loss (0=none ~0=100%) */ __u32 gap; /* re-ordering gap (0 for none) */ __u32 duplicate; /* random packet dup (0=none ~0=100%) */ __u32 jitter; /* random jitter in latency (us) */ }; struct tc_netem_corr { __u32 delay_corr; /* delay correlation */ __u32 loss_corr; /* packet loss correlation */ __u32 dup_corr; /* duplicate correlation */ }; struct tc_netem_reorder { __u32 probability; __u32 correlation; }; struct tc_netem_corrupt { __u32 probability; __u32 correlation; }; struct tc_netem_rate { __u32 rate; /* byte/s */ __s32 packet_overhead; __u32 cell_size; __s32 cell_overhead; }; struct tc_netem_slot { __s64 min_delay; /* nsec */ __s64 max_delay; __s32 max_packets; __s32 max_bytes; __s64 dist_delay; /* nsec */ __s64 dist_jitter; /* nsec */ }; enum { NETEM_LOSS_UNSPEC, NETEM_LOSS_GI, /* General Intuitive - 4 state model */ NETEM_LOSS_GE, /* Gilbert Elliot models */ __NETEM_LOSS_MAX }; #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) /* State transition probabilities for 4 state model */ struct tc_netem_gimodel { __u32 p13; __u32 p31; __u32 p32; __u32 p14; __u32 p23; }; /* Gilbert-Elliot models */ struct tc_netem_gemodel { __u32 p; __u32 r; __u32 h; __u32 k1; }; #define NETEM_DIST_SCALE 8192 #define NETEM_DIST_MAX 16384 /* DRR */ enum { TCA_DRR_UNSPEC, TCA_DRR_QUANTUM, __TCA_DRR_MAX }; #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) struct tc_drr_stats { __u32 deficit; }; /* MQPRIO */ #define TC_QOPT_BITMASK 15 #define TC_QOPT_MAX_QUEUE 16 enum { TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */ TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */ __TC_MQPRIO_HW_OFFLOAD_MAX }; #define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1) enum { TC_MQPRIO_MODE_DCB, TC_MQPRIO_MODE_CHANNEL, __TC_MQPRIO_MODE_MAX }; #define __TC_MQPRIO_MODE_MAX (__TC_MQPRIO_MODE_MAX - 1) enum { TC_MQPRIO_SHAPER_DCB, TC_MQPRIO_SHAPER_BW_RATE, /* Add new shapers below */ __TC_MQPRIO_SHAPER_MAX }; #define __TC_MQPRIO_SHAPER_MAX (__TC_MQPRIO_SHAPER_MAX - 1) struct tc_mqprio_qopt { __u8 num_tc; __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; __u8 hw; __u16 count[TC_QOPT_MAX_QUEUE]; __u16 offset[TC_QOPT_MAX_QUEUE]; }; #define TC_MQPRIO_F_MODE 0x1 #define TC_MQPRIO_F_SHAPER 0x2 #define TC_MQPRIO_F_MIN_RATE 0x4 #define TC_MQPRIO_F_MAX_RATE 0x8 enum { TCA_MQPRIO_UNSPEC, TCA_MQPRIO_MODE, TCA_MQPRIO_SHAPER, TCA_MQPRIO_MIN_RATE64, TCA_MQPRIO_MAX_RATE64, __TCA_MQPRIO_MAX, }; #define TCA_MQPRIO_MAX (__TCA_MQPRIO_MAX - 1) /* SFB */ enum { TCA_SFB_UNSPEC, TCA_SFB_PARMS, __TCA_SFB_MAX, }; #define TCA_SFB_MAX (__TCA_SFB_MAX - 1) /* * Note: increment, decrement are Q0.16 fixed-point values. */ struct tc_sfb_qopt { __u32 rehash_interval; /* delay between hash move, in ms */ __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ __u32 max; /* max len of qlen_min */ __u32 bin_size; /* maximum queue length per bin */ __u32 increment; /* probability increment, (d1 in Blue) */ __u32 decrement; /* probability decrement, (d2 in Blue) */ __u32 limit; /* max SFB queue length */ __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ __u32 penalty_burst; }; struct tc_sfb_xstats { __u32 earlydrop; __u32 penaltydrop; __u32 bucketdrop; __u32 queuedrop; __u32 childdrop; /* drops in child qdisc */ __u32 marked; __u32 maxqlen; __u32 maxprob; __u32 avgprob; }; #define SFB_MAX_PROB 0xFFFF /* QFQ */ enum { TCA_QFQ_UNSPEC, TCA_QFQ_WEIGHT, TCA_QFQ_LMAX, __TCA_QFQ_MAX }; #define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1) struct tc_qfq_stats { __u32 weight; __u32 lmax; }; /* CODEL */ enum { TCA_CODEL_UNSPEC, TCA_CODEL_TARGET, TCA_CODEL_LIMIT, TCA_CODEL_INTERVAL, TCA_CODEL_ECN, TCA_CODEL_CE_THRESHOLD, __TCA_CODEL_MAX }; #define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1) struct tc_codel_xstats { __u32 maxpacket; /* largest packet we've seen so far */ __u32 count; /* how many drops we've done since the last time we * entered dropping state */ __u32 lastcount; /* count at entry to dropping state */ __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */ __s32 drop_next; /* time to drop next packet */ __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */ __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */ __u32 dropping; /* are we in dropping state ? */ __u32 ce_mark; /* number of CE marked packets because of ce_threshold */ }; /* FQ_CODEL */ #define FQ_CODEL_QUANTUM_MAX (1 << 20) enum { TCA_FQ_CODEL_UNSPEC, TCA_FQ_CODEL_TARGET, TCA_FQ_CODEL_LIMIT, TCA_FQ_CODEL_INTERVAL, TCA_FQ_CODEL_ECN, TCA_FQ_CODEL_FLOWS, TCA_FQ_CODEL_QUANTUM, TCA_FQ_CODEL_CE_THRESHOLD, TCA_FQ_CODEL_DROP_BATCH_SIZE, TCA_FQ_CODEL_MEMORY_LIMIT, TCA_FQ_CODEL_CE_THRESHOLD_SELECTOR, TCA_FQ_CODEL_CE_THRESHOLD_MASK, __TCA_FQ_CODEL_MAX }; #define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1) enum { TCA_FQ_CODEL_XSTATS_QDISC, TCA_FQ_CODEL_XSTATS_CLASS, }; struct tc_fq_codel_qd_stats { __u32 maxpacket; /* largest packet we've seen so far */ __u32 drop_overlimit; /* number of time max qdisc * packet limit was hit */ __u32 ecn_mark; /* number of packets we ECN marked * instead of being dropped */ __u32 new_flow_count; /* number of time packets * created a 'new flow' */ __u32 new_flows_len; /* count of flows in new list */ __u32 old_flows_len; /* count of flows in old list */ __u32 ce_mark; /* packets above ce_threshold */ __u32 memory_usage; /* in bytes */ __u32 drop_overmemory; }; struct tc_fq_codel_cl_stats { __s32 deficit; __u32 ldelay; /* in-queue delay seen by most recently * dequeued packet */ __u32 count; __u32 lastcount; __u32 dropping; __s32 drop_next; }; struct tc_fq_codel_xstats { __u32 type; union { struct tc_fq_codel_qd_stats qdisc_stats; struct tc_fq_codel_cl_stats class_stats; }; }; /* FQ */ enum { TCA_FQ_UNSPEC, TCA_FQ_PLIMIT, /* limit of total number of packets in queue */ TCA_FQ_FLOW_PLIMIT, /* limit of packets per flow */ TCA_FQ_QUANTUM, /* RR quantum */ TCA_FQ_INITIAL_QUANTUM, /* RR quantum for new flow */ TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */ TCA_FQ_FLOW_DEFAULT_RATE,/* obsolete, do not use */ TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */ TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */ TCA_FQ_FLOW_REFILL_DELAY, /* flow credit refill delay in usec */ TCA_FQ_ORPHAN_MASK, /* mask applied to orphaned skb hashes */ TCA_FQ_LOW_RATE_THRESHOLD, /* per packet delay under this rate */ TCA_FQ_CE_THRESHOLD, /* DCTCP-like CE-marking threshold */ TCA_FQ_TIMER_SLACK, /* timer slack */ __TCA_FQ_MAX }; #define TCA_FQ_MAX (__TCA_FQ_MAX - 1) struct tc_fq_qd_stats { __u64 gc_flows; __u64 highprio_packets; __u64 tcp_retrans; __u64 throttled; __u64 flows_plimit; __u64 pkts_too_long; __u64 allocation_errors; __s64 time_next_delayed_flow; __u32 flows; __u32 inactive_flows; __u32 throttled_flows; __u32 unthrottle_latency_ns; __u64 ce_mark; /* packets above ce_threshold */ }; /* Heavy-Hitter Filter */ enum { TCA_HHF_UNSPEC, TCA_HHF_BACKLOG_LIMIT, TCA_HHF_QUANTUM, TCA_HHF_HH_FLOWS_LIMIT, TCA_HHF_RESET_TIMEOUT, TCA_HHF_ADMIT_BYTES, TCA_HHF_EVICT_TIMEOUT, TCA_HHF_NON_HH_WEIGHT, __TCA_HHF_MAX }; #define TCA_HHF_MAX (__TCA_HHF_MAX - 1) struct tc_hhf_xstats { __u32 drop_overlimit; /* number of times max qdisc packet limit * was hit */ __u32 hh_overlimit; /* number of times max heavy-hitters was hit */ __u32 hh_tot_count; /* number of captured heavy-hitters so far */ __u32 hh_cur_count; /* number of current heavy-hitters */ }; /* PIE */ enum { TCA_PIE_UNSPEC, TCA_PIE_TARGET, TCA_PIE_LIMIT, TCA_PIE_TUPDATE, TCA_PIE_ALPHA, TCA_PIE_BETA, TCA_PIE_ECN, TCA_PIE_BYTEMODE, TCA_PIE_DQ_RATE_ESTIMATOR, __TCA_PIE_MAX }; #define TCA_PIE_MAX (__TCA_PIE_MAX - 1) struct tc_pie_xstats { __u64 prob; /* current probability */ __u32 delay; /* current delay in ms */ __u32 avg_dq_rate; /* current average dq_rate in * bits/pie_time */ __u32 dq_rate_estimating; /* is avg_dq_rate being calculated? */ __u32 packets_in; /* total number of packets enqueued */ __u32 dropped; /* packets dropped due to pie_action */ __u32 overlimit; /* dropped due to lack of space * in queue */ __u32 maxq; /* maximum queue size */ __u32 ecn_mark; /* packets marked with ecn*/ }; /* FQ PIE */ enum { TCA_FQ_PIE_UNSPEC, TCA_FQ_PIE_LIMIT, TCA_FQ_PIE_FLOWS, TCA_FQ_PIE_TARGET, TCA_FQ_PIE_TUPDATE, TCA_FQ_PIE_ALPHA, TCA_FQ_PIE_BETA, TCA_FQ_PIE_QUANTUM, TCA_FQ_PIE_MEMORY_LIMIT, TCA_FQ_PIE_ECN_PROB, TCA_FQ_PIE_ECN, TCA_FQ_PIE_BYTEMODE, TCA_FQ_PIE_DQ_RATE_ESTIMATOR, __TCA_FQ_PIE_MAX }; #define TCA_FQ_PIE_MAX (__TCA_FQ_PIE_MAX - 1) struct tc_fq_pie_xstats { __u32 packets_in; /* total number of packets enqueued */ __u32 dropped; /* packets dropped due to fq_pie_action */ __u32 overlimit; /* dropped due to lack of space in queue */ __u32 overmemory; /* dropped due to lack of memory in queue */ __u32 ecn_mark; /* packets marked with ecn */ __u32 new_flow_count; /* count of new flows created by packets */ __u32 new_flows_len; /* count of flows in new list */ __u32 old_flows_len; /* count of flows in old list */ __u32 memory_usage; /* total memory across all queues */ }; /* CBS */ struct tc_cbs_qopt { __u8 offload; __u8 _pad[3]; __s32 hicredit; __s32 locredit; __s32 idleslope; __s32 sendslope; }; enum { TCA_CBS_UNSPEC, TCA_CBS_PARMS, __TCA_CBS_MAX, }; #define TCA_CBS_MAX (__TCA_CBS_MAX - 1) /* ETF */ struct tc_etf_qopt { __s32 delta; __s32 clockid; __u32 flags; #define TC_ETF_DEADLINE_MODE_ON _BITUL(0) #define TC_ETF_OFFLOAD_ON _BITUL(1) #define TC_ETF_SKIP_SOCK_CHECK _BITUL(2) }; enum { TCA_ETF_UNSPEC, TCA_ETF_PARMS, __TCA_ETF_MAX, }; #define TCA_ETF_MAX (__TCA_ETF_MAX - 1) /* CAKE */ enum { TCA_CAKE_UNSPEC, TCA_CAKE_PAD, TCA_CAKE_BASE_RATE64, TCA_CAKE_DIFFSERV_MODE, TCA_CAKE_ATM, TCA_CAKE_FLOW_MODE, TCA_CAKE_OVERHEAD, TCA_CAKE_RTT, TCA_CAKE_TARGET, TCA_CAKE_AUTORATE, TCA_CAKE_MEMORY, TCA_CAKE_NAT, TCA_CAKE_RAW, TCA_CAKE_WASH, TCA_CAKE_MPU, TCA_CAKE_INGRESS, TCA_CAKE_ACK_FILTER, TCA_CAKE_SPLIT_GSO, TCA_CAKE_FWMARK, __TCA_CAKE_MAX }; #define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) enum { __TCA_CAKE_STATS_INVALID, TCA_CAKE_STATS_PAD, TCA_CAKE_STATS_CAPACITY_ESTIMATE64, TCA_CAKE_STATS_MEMORY_LIMIT, TCA_CAKE_STATS_MEMORY_USED, TCA_CAKE_STATS_AVG_NETOFF, TCA_CAKE_STATS_MIN_NETLEN, TCA_CAKE_STATS_MAX_NETLEN, TCA_CAKE_STATS_MIN_ADJLEN, TCA_CAKE_STATS_MAX_ADJLEN, TCA_CAKE_STATS_TIN_STATS, TCA_CAKE_STATS_DEFICIT, TCA_CAKE_STATS_COBALT_COUNT, TCA_CAKE_STATS_DROPPING, TCA_CAKE_STATS_DROP_NEXT_US, TCA_CAKE_STATS_P_DROP, TCA_CAKE_STATS_BLUE_TIMER_US, __TCA_CAKE_STATS_MAX }; #define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1) enum { __TCA_CAKE_TIN_STATS_INVALID, TCA_CAKE_TIN_STATS_PAD, TCA_CAKE_TIN_STATS_SENT_PACKETS, TCA_CAKE_TIN_STATS_SENT_BYTES64, TCA_CAKE_TIN_STATS_DROPPED_PACKETS, TCA_CAKE_TIN_STATS_DROPPED_BYTES64, TCA_CAKE_TIN_STATS_ACKS_DROPPED_PACKETS, TCA_CAKE_TIN_STATS_ACKS_DROPPED_BYTES64, TCA_CAKE_TIN_STATS_ECN_MARKED_PACKETS, TCA_CAKE_TIN_STATS_ECN_MARKED_BYTES64, TCA_CAKE_TIN_STATS_BACKLOG_PACKETS, TCA_CAKE_TIN_STATS_BACKLOG_BYTES, TCA_CAKE_TIN_STATS_THRESHOLD_RATE64, TCA_CAKE_TIN_STATS_TARGET_US, TCA_CAKE_TIN_STATS_INTERVAL_US, TCA_CAKE_TIN_STATS_WAY_INDIRECT_HITS, TCA_CAKE_TIN_STATS_WAY_MISSES, TCA_CAKE_TIN_STATS_WAY_COLLISIONS, TCA_CAKE_TIN_STATS_PEAK_DELAY_US, TCA_CAKE_TIN_STATS_AVG_DELAY_US, TCA_CAKE_TIN_STATS_BASE_DELAY_US, TCA_CAKE_TIN_STATS_SPARSE_FLOWS, TCA_CAKE_TIN_STATS_BULK_FLOWS, TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS, TCA_CAKE_TIN_STATS_MAX_SKBLEN, TCA_CAKE_TIN_STATS_FLOW_QUANTUM, __TCA_CAKE_TIN_STATS_MAX }; #define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1) #define TC_CAKE_MAX_TINS (8) enum { CAKE_FLOW_NONE = 0, CAKE_FLOW_SRC_IP, CAKE_FLOW_DST_IP, CAKE_FLOW_HOSTS, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_DST_IP */ CAKE_FLOW_FLOWS, CAKE_FLOW_DUAL_SRC, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_FLOWS */ CAKE_FLOW_DUAL_DST, /* = CAKE_FLOW_DST_IP | CAKE_FLOW_FLOWS */ CAKE_FLOW_TRIPLE, /* = CAKE_FLOW_HOSTS | CAKE_FLOW_FLOWS */ CAKE_FLOW_MAX, }; enum { CAKE_DIFFSERV_DIFFSERV3 = 0, CAKE_DIFFSERV_DIFFSERV4, CAKE_DIFFSERV_DIFFSERV8, CAKE_DIFFSERV_BESTEFFORT, CAKE_DIFFSERV_PRECEDENCE, CAKE_DIFFSERV_MAX }; enum { CAKE_ACK_NONE = 0, CAKE_ACK_FILTER, CAKE_ACK_AGGRESSIVE, CAKE_ACK_MAX }; enum { CAKE_ATM_NONE = 0, CAKE_ATM_ATM, CAKE_ATM_PTM, CAKE_ATM_MAX }; /* TAPRIO */ enum { TC_TAPRIO_CMD_SET_GATES = 0x00, TC_TAPRIO_CMD_SET_AND_HOLD = 0x01, TC_TAPRIO_CMD_SET_AND_RELEASE = 0x02, }; enum { TCA_TAPRIO_SCHED_ENTRY_UNSPEC, TCA_TAPRIO_SCHED_ENTRY_INDEX, /* u32 */ TCA_TAPRIO_SCHED_ENTRY_CMD, /* u8 */ TCA_TAPRIO_SCHED_ENTRY_GATE_MASK, /* u32 */ TCA_TAPRIO_SCHED_ENTRY_INTERVAL, /* u32 */ __TCA_TAPRIO_SCHED_ENTRY_MAX, }; #define TCA_TAPRIO_SCHED_ENTRY_MAX (__TCA_TAPRIO_SCHED_ENTRY_MAX - 1) /* The format for schedule entry list is: * [TCA_TAPRIO_SCHED_ENTRY_LIST] * [TCA_TAPRIO_SCHED_ENTRY] * [TCA_TAPRIO_SCHED_ENTRY_CMD] * [TCA_TAPRIO_SCHED_ENTRY_GATES] * [TCA_TAPRIO_SCHED_ENTRY_INTERVAL] */ enum { TCA_TAPRIO_SCHED_UNSPEC, TCA_TAPRIO_SCHED_ENTRY, __TCA_TAPRIO_SCHED_MAX, }; #define TCA_TAPRIO_SCHED_MAX (__TCA_TAPRIO_SCHED_MAX - 1) /* The format for the admin sched (dump only): * [TCA_TAPRIO_SCHED_ADMIN_SCHED] * [TCA_TAPRIO_ATTR_SCHED_BASE_TIME] * [TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST] * [TCA_TAPRIO_ATTR_SCHED_ENTRY] * [TCA_TAPRIO_ATTR_SCHED_ENTRY_CMD] * [TCA_TAPRIO_ATTR_SCHED_ENTRY_GATES] * [TCA_TAPRIO_ATTR_SCHED_ENTRY_INTERVAL] */ #define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST _BITUL(0) #define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1) enum { TCA_TAPRIO_TC_ENTRY_UNSPEC, TCA_TAPRIO_TC_ENTRY_INDEX, /* u32 */ TCA_TAPRIO_TC_ENTRY_MAX_SDU, /* u32 */ /* add new constants above here */ __TCA_TAPRIO_TC_ENTRY_CNT, TCA_TAPRIO_TC_ENTRY_MAX = (__TCA_TAPRIO_TC_ENTRY_CNT - 1) }; enum { TCA_TAPRIO_ATTR_UNSPEC, TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */ TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST, /* nested of entry */ TCA_TAPRIO_ATTR_SCHED_BASE_TIME, /* s64 */ TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY, /* single entry */ TCA_TAPRIO_ATTR_SCHED_CLOCKID, /* s32 */ TCA_TAPRIO_PAD, TCA_TAPRIO_ATTR_ADMIN_SCHED, /* The admin sched, only used in dump */ TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME, /* s64 */ TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */ TCA_TAPRIO_ATTR_FLAGS, /* u32 */ TCA_TAPRIO_ATTR_TXTIME_DELAY, /* u32 */ TCA_TAPRIO_ATTR_TC_ENTRY, /* nest */ __TCA_TAPRIO_ATTR_MAX, }; #define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1) /* ETS */ #define TCQ_ETS_MAX_BANDS 16 enum { TCA_ETS_UNSPEC, TCA_ETS_NBANDS, /* u8 */ TCA_ETS_NSTRICT, /* u8 */ TCA_ETS_QUANTA, /* nested TCA_ETS_QUANTA_BAND */ TCA_ETS_QUANTA_BAND, /* u32 */ TCA_ETS_PRIOMAP, /* nested TCA_ETS_PRIOMAP_BAND */ TCA_ETS_PRIOMAP_BAND, /* u8 */ __TCA_ETS_MAX, }; #define TCA_ETS_MAX (__TCA_ETS_MAX - 1) #endif linux/pktcdvd.h 0000644 00000005177 15063602054 0007526 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2000 Jens Axboe <axboe@suse.de> * Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com> * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information. * * Packet writing layer for ATAPI and SCSI CD-R, CD-RW, DVD-R, and * DVD-RW devices. * */ #ifndef __PKTCDVD_H #define __PKTCDVD_H #include <linux/types.h> /* * 1 for normal debug messages, 2 is very verbose. 0 to turn it off. */ #define PACKET_DEBUG 1 #define MAX_WRITERS 8 #define PKT_RB_POOL_SIZE 512 /* * How long we should hold a non-full packet before starting data gathering. */ #define PACKET_WAIT_TIME (HZ * 5 / 1000) /* * use drive write caching -- we need deferred error handling to be * able to successfully recover with this option (drive will return good * status as soon as the cdb is validated). */ #if defined(CONFIG_CDROM_PKTCDVD_WCACHE) #define USE_WCACHING 1 #else #define USE_WCACHING 0 #endif /* * No user-servicable parts beyond this point -> */ /* * device types */ #define PACKET_CDR 1 #define PACKET_CDRW 2 #define PACKET_DVDR 3 #define PACKET_DVDRW 4 /* * flags */ #define PACKET_WRITABLE 1 /* pd is writable */ #define PACKET_NWA_VALID 2 /* next writable address valid */ #define PACKET_LRA_VALID 3 /* last recorded address valid */ #define PACKET_MERGE_SEGS 4 /* perform segment merging to keep */ /* underlying cdrom device happy */ /* * Disc status -- from READ_DISC_INFO */ #define PACKET_DISC_EMPTY 0 #define PACKET_DISC_INCOMPLETE 1 #define PACKET_DISC_COMPLETE 2 #define PACKET_DISC_OTHER 3 /* * write type, and corresponding data block type */ #define PACKET_MODE1 1 #define PACKET_MODE2 2 #define PACKET_BLOCK_MODE1 8 #define PACKET_BLOCK_MODE2 10 /* * Last session/border status */ #define PACKET_SESSION_EMPTY 0 #define PACKET_SESSION_INCOMPLETE 1 #define PACKET_SESSION_RESERVED 2 #define PACKET_SESSION_COMPLETE 3 #define PACKET_MCN "4a656e734178626f65323030300000" #undef PACKET_USE_LS #define PKT_CTRL_CMD_SETUP 0 #define PKT_CTRL_CMD_TEARDOWN 1 #define PKT_CTRL_CMD_STATUS 2 struct pkt_ctrl_command { __u32 command; /* in: Setup, teardown, status */ __u32 dev_index; /* in/out: Device index */ __u32 dev; /* in/out: Device nr for cdrw device */ __u32 pkt_dev; /* in/out: Device nr for packet device */ __u32 num_devices; /* out: Largest device index + 1 */ __u32 padding; /* Not used */ }; /* * packet ioctls */ #define PACKET_IOCTL_MAGIC ('X') #define PACKET_CTRL_CMD _IOWR(PACKET_IOCTL_MAGIC, 1, struct pkt_ctrl_command) #endif /* __PKTCDVD_H */ linux/pmu.h 0000644 00000012307 15063602054 0006661 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for talking to the PMU. The PMU is a microcontroller * which controls battery charging and system power on PowerBook 3400 * and 2400 models as well as the RTC and various other things. * * Copyright (C) 1998 Paul Mackerras. */ #ifndef _LINUX_PMU_H #define _LINUX_PMU_H #define PMU_DRIVER_VERSION 2 /* * PMU commands */ #define PMU_POWER_CTRL0 0x10 /* control power of some devices */ #define PMU_POWER_CTRL 0x11 /* control power of some devices */ #define PMU_ADB_CMD 0x20 /* send ADB packet */ #define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */ #define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */ #define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */ #define PMU_SET_RTC 0x30 /* set real-time clock */ #define PMU_READ_RTC 0x38 /* read real-time clock */ #define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */ #define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */ #define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */ #define PMU_PCEJECT 0x4c /* eject PC-card from slot */ #define PMU_BATTERY_STATE 0x6b /* report battery state etc. */ #define PMU_SMART_BATTERY_STATE 0x6f /* report battery state (new way) */ #define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */ #define PMU_INT_ACK 0x78 /* read interrupt bits */ #define PMU_SHUTDOWN 0x7e /* turn power off */ #define PMU_CPU_SPEED 0x7d /* control CPU speed on some models */ #define PMU_SLEEP 0x7f /* put CPU to sleep */ #define PMU_POWER_EVENTS 0x8f /* Send power-event commands to PMU */ #define PMU_I2C_CMD 0x9a /* I2C operations */ #define PMU_RESET 0xd0 /* reset CPU */ #define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */ #define PMU_GET_COVER 0xdc /* report cover open/closed */ #define PMU_SYSTEM_READY 0xdf /* tell PMU we are awake */ #define PMU_GET_VERSION 0xea /* read the PMU version */ /* Bits to use with the PMU_POWER_CTRL0 command */ #define PMU_POW0_ON 0x80 /* OR this to power ON the device */ #define PMU_POW0_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ #define PMU_POW0_HARD_DRIVE 0x04 /* Hard drive power (on wallstreet/lombard ?) */ /* Bits to use with the PMU_POWER_CTRL command */ #define PMU_POW_ON 0x80 /* OR this to power ON the device */ #define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ #define PMU_POW_BACKLIGHT 0x01 /* backlight power */ #define PMU_POW_CHARGER 0x02 /* battery charger power */ #define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) */ #define PMU_POW_MEDIABAY 0x08 /* media bay power (wallstreet/lombard ?) */ /* Bits in PMU interrupt and interrupt mask bytes */ #define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */ #define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */ #define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */ #define PMU_INT_BATTERY 0x20 /* Battery state change */ #define PMU_INT_ENVIRONMENT 0x40 /* Environment interrupts */ #define PMU_INT_TICK 0x80 /* 1-second tick interrupt */ /* Other bits in PMU interrupt valid when PMU_INT_ADB is set */ #define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */ #define PMU_INT_WAITING_CHARGER 0x01 /* ??? */ #define PMU_INT_AUTO_SRQ_POLL 0x02 /* ??? */ /* Bits in the environement message (either obtained via PMU_GET_COVER, * or via PMU_INT_ENVIRONMENT on core99 */ #define PMU_ENV_LID_CLOSED 0x01 /* The lid is closed */ /* I2C related definitions */ #define PMU_I2C_MODE_SIMPLE 0 #define PMU_I2C_MODE_STDSUB 1 #define PMU_I2C_MODE_COMBINED 2 #define PMU_I2C_BUS_STATUS 0 #define PMU_I2C_BUS_SYSCLK 1 #define PMU_I2C_BUS_POWER 2 #define PMU_I2C_STATUS_OK 0 #define PMU_I2C_STATUS_DATAREAD 1 #define PMU_I2C_STATUS_BUSY 0xfe /* Kind of PMU (model) */ enum { PMU_UNKNOWN, PMU_OHARE_BASED, /* 2400, 3400, 3500 (old G3 powerbook) */ PMU_HEATHROW_BASED, /* PowerBook G3 series */ PMU_PADDINGTON_BASED, /* 1999 PowerBook G3 */ PMU_KEYLARGO_BASED, /* Core99 motherboard (PMU99) */ PMU_68K_V1, /* 68K PMU, version 1 */ PMU_68K_V2, /* 68K PMU, version 2 */ }; /* PMU PMU_POWER_EVENTS commands */ enum { PMU_PWR_GET_POWERUP_EVENTS = 0x00, PMU_PWR_SET_POWERUP_EVENTS = 0x01, PMU_PWR_CLR_POWERUP_EVENTS = 0x02, PMU_PWR_GET_WAKEUP_EVENTS = 0x03, PMU_PWR_SET_WAKEUP_EVENTS = 0x04, PMU_PWR_CLR_WAKEUP_EVENTS = 0x05, }; /* Power events wakeup bits */ enum { PMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */ PMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */ PMU_PWR_WAKEUP_AC_CHANGE = 0x04, PMU_PWR_WAKEUP_LID_OPEN = 0x08, PMU_PWR_WAKEUP_RING = 0x10, }; /* * Ioctl commands for the /dev/pmu device */ #include <linux/ioctl.h> /* no param */ #define PMU_IOC_SLEEP _IO('B', 0) /* out param: u32* backlight value: 0 to 15 */ #define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, size_t) /* in param: u32 backlight value: 0 to 15 */ #define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, size_t) /* out param: u32* PMU model */ #define PMU_IOC_GET_MODEL _IOR('B', 3, size_t) /* out param: u32* has_adb: 0 or 1 */ #define PMU_IOC_HAS_ADB _IOR('B', 4, size_t) /* out param: u32* can_sleep: 0 or 1 */ #define PMU_IOC_CAN_SLEEP _IOR('B', 5, size_t) /* no param, but historically was _IOR('B', 6, 0), meaning 4 bytes */ #define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, size_t) #endif /* _LINUX_PMU_H */ linux/poll.h 0000644 00000000026 15063602054 0007021 0 ustar 00 #include <asm/poll.h> linux/posix_acl.h 0000644 00000002346 15063602054 0010043 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * Copyright (C) 2002 Andreas Gruenbacher <a.gruenbacher@computer.org> * Copyright (C) 2016 Red Hat, Inc. * * This file is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * */ #ifndef __UAPI_POSIX_ACL_H #define __UAPI_POSIX_ACL_H #define ACL_UNDEFINED_ID (-1) /* a_type field in acl_user_posix_entry_t */ #define ACL_TYPE_ACCESS (0x8000) #define ACL_TYPE_DEFAULT (0x4000) /* e_tag entry in struct posix_acl_entry */ #define ACL_USER_OBJ (0x01) #define ACL_USER (0x02) #define ACL_GROUP_OBJ (0x04) #define ACL_GROUP (0x08) #define ACL_MASK (0x10) #define ACL_OTHER (0x20) /* permissions in the e_perm field */ #define ACL_READ (0x04) #define ACL_WRITE (0x02) #define ACL_EXECUTE (0x01) #endif /* __UAPI_POSIX_ACL_H */ linux/posix_acl_xattr.h 0000644 00000002133 15063602054 0011257 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ /* * Copyright (C) 2002 Andreas Gruenbacher <a.gruenbacher@computer.org> * Copyright (C) 2016 Red Hat, Inc. * * This file is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * */ #ifndef __UAPI_POSIX_ACL_XATTR_H #define __UAPI_POSIX_ACL_XATTR_H #include <linux/types.h> /* Supported ACL a_version fields */ #define POSIX_ACL_XATTR_VERSION 0x0002 /* An undefined entry e_id value */ #define ACL_UNDEFINED_ID (-1) struct posix_acl_xattr_entry { __le16 e_tag; __le16 e_perm; __le32 e_id; }; struct posix_acl_xattr_header { __le32 a_version; }; #endif /* __UAPI_POSIX_ACL_XATTR_H */ linux/posix_types.h 0000644 00000002112 15063602054 0010437 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_POSIX_TYPES_H #define _LINUX_POSIX_TYPES_H #include <linux/stddef.h> /* * This allows for 1024 file descriptors: if NR_OPEN is ever grown * beyond that you'll have to change this too. But 1024 fd's seem to be * enough even for such "real" unices like OSF/1, so hopefully this is * one limit that doesn't have to be changed [again]. * * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical * place for them. Solved by having dummy defines in <sys/time.h>. */ /* * This macro may have been defined in <gnu/types.h>. But we always * use the one here. */ #undef __FD_SETSIZE #define __FD_SETSIZE 1024 typedef struct { unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; } __kernel_fd_set; /* Type of a signal handler. */ typedef void (*__kernel_sighandler_t)(int); /* Type of a SYSV IPC key. */ typedef int __kernel_key_t; typedef int __kernel_mqd_t; #include <asm/posix_types.h> #endif /* _LINUX_POSIX_TYPES_H */ linux/ppdev.h 0000644 00000006213 15063602054 0007175 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * linux/include/linux/ppdev.h * * User-space parallel port device driver (header file). * * Copyright (C) 1998-9 Tim Waugh <tim@cyberelk.demon.co.uk> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * Added PPGETTIME/PPSETTIME, Fred Barnes, 1999 * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 */ #define PP_IOCTL 'p' /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ #define PPSETMODE _IOW(PP_IOCTL, 0x80, int) /* Read status */ #define PPRSTATUS _IOR(PP_IOCTL, 0x81, unsigned char) #define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) /* Read/write control */ #define PPRCONTROL _IOR(PP_IOCTL, 0x83, unsigned char) #define PPWCONTROL _IOW(PP_IOCTL, 0x84, unsigned char) struct ppdev_frob_struct { unsigned char mask; unsigned char val; }; #define PPFCONTROL _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct) /* Read/write data */ #define PPRDATA _IOR(PP_IOCTL, 0x85, unsigned char) #define PPWDATA _IOW(PP_IOCTL, 0x86, unsigned char) /* Read/write econtrol (not used) */ #define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char) #define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char) /* Read/write FIFO (not used) */ #define PPRFIFO OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char) #define PPWFIFO OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char) /* Claim the port to start using it */ #define PPCLAIM _IO(PP_IOCTL, 0x8b) /* Release the port when you aren't using it */ #define PPRELEASE _IO(PP_IOCTL, 0x8c) /* Yield the port (release it if another driver is waiting, * then reclaim) */ #define PPYIELD _IO(PP_IOCTL, 0x8d) /* Register device exclusively (must be before PPCLAIM). */ #define PPEXCL _IO(PP_IOCTL, 0x8f) /* Data line direction: non-zero for input mode. */ #define PPDATADIR _IOW(PP_IOCTL, 0x90, int) /* Negotiate a particular IEEE 1284 mode. */ #define PPNEGOT _IOW(PP_IOCTL, 0x91, int) /* Set control lines when an interrupt occurs. */ #define PPWCTLONIRQ _IOW(PP_IOCTL, 0x92, unsigned char) /* Clear (and return) interrupt count. */ #define PPCLRIRQ _IOR(PP_IOCTL, 0x93, int) /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */ #define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) /* Set and get port timeout (struct timeval's) */ #define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval) #define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval) /* Get available modes (what the hardware can do) */ #define PPGETMODES _IOR(PP_IOCTL, 0x97, unsigned int) /* Get the current mode and phaze */ #define PPGETMODE _IOR(PP_IOCTL, 0x98, int) #define PPGETPHASE _IOR(PP_IOCTL, 0x99, int) /* get/set flags */ #define PPGETFLAGS _IOR(PP_IOCTL, 0x9a, int) #define PPSETFLAGS _IOW(PP_IOCTL, 0x9b, int) /* flags visible to the world */ #define PP_FASTWRITE (1<<2) #define PP_FASTREAD (1<<3) #define PP_W91284PIC (1<<4) /* only masks user-visible flags */ #define PP_FLAGMASK (PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC) linux/raid/md_p.h 0000644 00000037441 15063602054 0007724 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* md_p.h : physical layout of Linux RAID devices Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. You should have received a copy of the GNU General Public License (for example /usr/src/linux/COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MD_P_H #define _MD_P_H #include <linux/types.h> #include <asm/byteorder.h> /* * RAID superblock. * * The RAID superblock maintains some statistics on each RAID configuration. * Each real device in the RAID set contains it near the end of the device. * Some of the ideas are copied from the ext2fs implementation. * * We currently use 4096 bytes as follows: * * word offset function * * 0 - 31 Constant generic RAID device information. * 32 - 63 Generic state information. * 64 - 127 Personality specific information. * 128 - 511 12 32-words descriptors of the disks in the raid set. * 512 - 911 Reserved. * 912 - 1023 Disk specific descriptor. */ /* * If x is the real device size in bytes, we return an apparent size of: * * y = (x & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES * * and place the 4kB superblock at offset y. */ #define MD_RESERVED_BYTES (64 * 1024) #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) #define MD_SB_BYTES 4096 #define MD_SB_WORDS (MD_SB_BYTES / 4) #define MD_SB_SECTORS (MD_SB_BYTES / 512) /* * The following are counted in 32-bit words */ #define MD_SB_GENERIC_OFFSET 0 #define MD_SB_PERSONALITY_OFFSET 64 #define MD_SB_DISKS_OFFSET 128 #define MD_SB_DESCRIPTOR_OFFSET 992 #define MD_SB_GENERIC_CONSTANT_WORDS 32 #define MD_SB_GENERIC_STATE_WORDS 32 #define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS) #define MD_SB_PERSONALITY_WORDS 64 #define MD_SB_DESCRIPTOR_WORDS 32 #define MD_SB_DISKS 27 #define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS) #define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS) #define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS) /* * Device "operational" state bits */ #define MD_DISK_FAULTY 0 /* disk is faulty / operational */ #define MD_DISK_ACTIVE 1 /* disk is running or spare disk */ #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ #define MD_DISK_CLUSTER_ADD 4 /* Initiate a disk add across the cluster * For clustered enviroments only. */ #define MD_DISK_CANDIDATE 5 /* disk is added as spare (local) until confirmed * For clustered enviroments only. */ #define MD_DISK_FAILFAST 10 /* Send REQ_FAILFAST if there are multiple * devices available - and don't try to * correct read errors. */ #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. * read requests will only be sent here in * dire need */ #define MD_DISK_JOURNAL 18 /* disk is used as the write journal in RAID-5/6 */ #define MD_DISK_ROLE_SPARE 0xffff #define MD_DISK_ROLE_FAULTY 0xfffe #define MD_DISK_ROLE_JOURNAL 0xfffd #define MD_DISK_ROLE_MAX 0xff00 /* max value of regular disk role */ typedef struct mdp_device_descriptor_s { __u32 number; /* 0 Device number in the entire set */ __u32 major; /* 1 Device major number */ __u32 minor; /* 2 Device minor number */ __u32 raid_disk; /* 3 The role of the device in the raid set */ __u32 state; /* 4 Operational state */ __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5]; } mdp_disk_t; #define MD_SB_MAGIC 0xa92b4efc /* * Superblock state bits */ #define MD_SB_CLEAN 0 #define MD_SB_ERRORS 1 #define MD_SB_CLUSTERED 5 /* MD is clustered */ #define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ /* * Notes: * - if an array is being reshaped (restriped) in order to change the * the number of active devices in the array, 'raid_disks' will be * the larger of the old and new numbers. 'delta_disks' will * be the "new - old". So if +ve, raid_disks is the new value, and * "raid_disks-delta_disks" is the old. If -ve, raid_disks is the * old value and "raid_disks+delta_disks" is the new (smaller) value. */ typedef struct mdp_superblock_s { /* * Constant generic information */ __u32 md_magic; /* 0 MD identifier */ __u32 major_version; /* 1 major version to which the set conforms */ __u32 minor_version; /* 2 minor version ... */ __u32 patch_version; /* 3 patchlevel version ... */ __u32 gvalid_words; /* 4 Number of used words in this section */ __u32 set_uuid0; /* 5 Raid set identifier */ __u32 ctime; /* 6 Creation time */ __u32 level; /* 7 Raid personality */ __u32 size; /* 8 Apparent size of each individual disk */ __u32 nr_disks; /* 9 total disks in the raid set */ __u32 raid_disks; /* 10 disks in a fully functional raid set */ __u32 md_minor; /* 11 preferred MD minor device number */ __u32 not_persistent; /* 12 does it have a persistent superblock */ __u32 set_uuid1; /* 13 Raid set identifier #2 */ __u32 set_uuid2; /* 14 Raid set identifier #3 */ __u32 set_uuid3; /* 15 Raid set identifier #4 */ __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16]; /* * Generic state information */ __u32 utime; /* 0 Superblock update time */ __u32 state; /* 1 State bits (clean, ...) */ __u32 active_disks; /* 2 Number of currently active disks */ __u32 working_disks; /* 3 Number of working disks */ __u32 failed_disks; /* 4 Number of failed disks */ __u32 spare_disks; /* 5 Number of spare disks */ __u32 sb_csum; /* 6 checksum of the whole superblock */ #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) __u32 events_hi; /* 7 high-order of superblock update count */ __u32 events_lo; /* 8 low-order of superblock update count */ __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) __u32 events_lo; /* 7 low-order of superblock update count */ __u32 events_hi; /* 8 high-order of superblock update count */ __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ #else #error unspecified endianness #endif __u32 recovery_cp; /* 11 recovery checkpoint sector count */ /* There are only valid for minor_version > 90 */ __u64 reshape_position; /* 12,13 next address in array-space for reshape */ __u32 new_level; /* 14 new level we are reshaping to */ __u32 delta_disks; /* 15 change in number of raid_disks */ __u32 new_layout; /* 16 new layout */ __u32 new_chunk; /* 17 new chunk size (bytes) */ __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18]; /* * Personality information */ __u32 layout; /* 0 the array's physical layout */ __u32 chunk_size; /* 1 chunk size in bytes */ __u32 root_pv; /* 2 LV root PV */ __u32 root_block; /* 3 LV root block */ __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4]; /* * Disks information */ mdp_disk_t disks[MD_SB_DISKS]; /* * Reserved */ __u32 reserved[MD_SB_RESERVED_WORDS]; /* * Active descriptor */ mdp_disk_t this_disk; } mdp_super_t; static __inline__ __u64 md_event(mdp_super_t *sb) { __u64 ev = sb->events_hi; return (ev<<32)| sb->events_lo; } #define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL<<40) - 1) /* * The version-1 superblock : * All numeric fields are little-endian. * * total size: 256 bytes plus 2 per device. * 1K allows 384 devices. */ struct mdp_superblock_1 { /* constant array information - 128 bytes */ __le32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ __le32 major_version; /* 1 */ __le32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */ __le32 pad0; /* always set to 0 when writing */ __u8 set_uuid[16]; /* user-space generated. */ char set_name[32]; /* set and interpreted by user-space */ __le64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ __le32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ __le32 layout; /* only for raid5 and raid10 currently */ __le64 size; /* used size of component devices, in 512byte sectors */ __le32 chunksize; /* in 512byte sectors */ __le32 raid_disks; union { __le32 bitmap_offset; /* sectors after start of superblock that bitmap starts * NOTE: signed, so bitmap can be before superblock * only meaningful of feature_map[0] is set. */ /* only meaningful when feature_map[MD_FEATURE_PPL] is set */ struct { __le16 offset; /* sectors from start of superblock that ppl starts (signed) */ __le16 size; /* ppl size in sectors */ } ppl; }; /* These are only valid with feature bit '4' */ __le32 new_level; /* new level we are reshaping to */ __le64 reshape_position; /* next address in array-space for reshape */ __le32 delta_disks; /* change in number of raid_disks */ __le32 new_layout; /* new layout */ __le32 new_chunk; /* new chunk size (512byte sectors) */ __le32 new_offset; /* signed number to add to data_offset in new * layout. 0 == no-change. This can be * different on each device in the array. */ /* constant this-device information - 64 bytes */ __le64 data_offset; /* sector start of data, often 0 */ __le64 data_size; /* sectors in this device that can be used for data */ __le64 super_offset; /* sector start of this superblock */ union { __le64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */ __le64 journal_tail;/* journal tail of journal device (from data_offset) */ }; __le32 dev_number; /* permanent identifier of this device - not role in raid */ __le32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ __u8 devflags; /* per-device flags. Only two defined...*/ #define WriteMostly1 1 /* mask for writemostly flag in above */ #define FailFast1 2 /* Should avoid retries and fixups and just fail */ /* Bad block log. If there are any bad blocks the feature flag is set. * If offset and size are non-zero, that space is reserved and available */ __u8 bblog_shift; /* shift from sectors to block size */ __le16 bblog_size; /* number of sectors reserved for list */ __le32 bblog_offset; /* sector offset from superblock to bblog, * signed - not unsigned */ /* array state information - 64 bytes */ __le64 utime; /* 40 bits second, 24 bits microseconds */ __le64 events; /* incremented when superblock updated */ __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ __le32 sb_csum; /* checksum up to devs[max_dev] */ __le32 max_dev; /* size of devs[] array to consider */ __u8 pad3[64-32]; /* set to 0 when writing */ /* device state information. Indexed by dev_number. * 2 bytes per device * Note there are no per-device state flags. State information is rolled * into the 'roles' value. If a device is spare or faulty, then it doesn't * have a meaningful role. */ __le16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ }; /* feature_map bits */ #define MD_FEATURE_BITMAP_OFFSET 1 #define MD_FEATURE_RECOVERY_OFFSET 2 /* recovery_offset is present and * must be honoured */ #define MD_FEATURE_RESHAPE_ACTIVE 4 #define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */ #define MD_FEATURE_REPLACEMENT 16 /* This device is replacing an * active device with same 'role'. * 'recovery_offset' is also set. */ #define MD_FEATURE_RESHAPE_BACKWARDS 32 /* Reshape doesn't change number * of devices, but is going * backwards anyway. */ #define MD_FEATURE_NEW_OFFSET 64 /* new_offset must be honoured */ #define MD_FEATURE_RECOVERY_BITMAP 128 /* recovery that is happening * is guided by bitmap. */ #define MD_FEATURE_CLUSTERED 256 /* clustered MD */ #define MD_FEATURE_JOURNAL 512 /* support write cache */ #define MD_FEATURE_PPL 1024 /* support PPL */ #define MD_FEATURE_MULTIPLE_PPLS 2048 /* support for multiple PPLs */ #define MD_FEATURE_RAID0_LAYOUT 4096 /* layout is meaningful for RAID0 */ #define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \ |MD_FEATURE_RECOVERY_OFFSET \ |MD_FEATURE_RESHAPE_ACTIVE \ |MD_FEATURE_BAD_BLOCKS \ |MD_FEATURE_REPLACEMENT \ |MD_FEATURE_RESHAPE_BACKWARDS \ |MD_FEATURE_NEW_OFFSET \ |MD_FEATURE_RECOVERY_BITMAP \ |MD_FEATURE_CLUSTERED \ |MD_FEATURE_JOURNAL \ |MD_FEATURE_PPL \ |MD_FEATURE_MULTIPLE_PPLS \ |MD_FEATURE_RAID0_LAYOUT \ ) struct r5l_payload_header { __le16 type; __le16 flags; } __attribute__ ((__packed__)); enum r5l_payload_type { R5LOG_PAYLOAD_DATA = 0, R5LOG_PAYLOAD_PARITY = 1, R5LOG_PAYLOAD_FLUSH = 2, }; struct r5l_payload_data_parity { struct r5l_payload_header header; __le32 size; /* sector. data/parity size. each 4k * has a checksum */ __le64 location; /* sector. For data, it's raid sector. For * parity, it's stripe sector */ __le32 checksum[]; } __attribute__ ((__packed__)); enum r5l_payload_data_parity_flag { R5LOG_PAYLOAD_FLAG_DISCARD = 1, /* payload is discard */ /* * RESHAPED/RESHAPING is only set when there is reshape activity. Note, * both data/parity of a stripe should have the same flag set * * RESHAPED: reshape is running, and this stripe finished reshape * RESHAPING: reshape is running, and this stripe isn't reshaped */ R5LOG_PAYLOAD_FLAG_RESHAPED = 2, R5LOG_PAYLOAD_FLAG_RESHAPING = 3, }; struct r5l_payload_flush { struct r5l_payload_header header; __le32 size; /* flush_stripes size, bytes */ __le64 flush_stripes[]; } __attribute__ ((__packed__)); enum r5l_payload_flush_flag { R5LOG_PAYLOAD_FLAG_FLUSH_STRIPE = 1, /* data represents whole stripe */ }; struct r5l_meta_block { __le32 magic; __le32 checksum; __u8 version; __u8 __zero_pading_1; __le16 __zero_pading_2; __le32 meta_size; /* whole size of the block */ __le64 seq; __le64 position; /* sector, start from rdev->data_offset, current position */ struct r5l_payload_header payloads[]; } __attribute__ ((__packed__)); #define R5LOG_VERSION 0x1 #define R5LOG_MAGIC 0x6433c509 struct ppl_header_entry { __le64 data_sector; /* raid sector of the new data */ __le32 pp_size; /* length of partial parity */ __le32 data_size; /* length of data */ __le32 parity_disk; /* member disk containing parity */ __le32 checksum; /* checksum of partial parity data for this * entry (~crc32c) */ } __attribute__ ((__packed__)); #define PPL_HEADER_SIZE 4096 #define PPL_HDR_RESERVED 512 #define PPL_HDR_ENTRY_SPACE \ (PPL_HEADER_SIZE - PPL_HDR_RESERVED - 4 * sizeof(__le32) - sizeof(__le64)) #define PPL_HDR_MAX_ENTRIES \ (PPL_HDR_ENTRY_SPACE / sizeof(struct ppl_header_entry)) struct ppl_header { __u8 reserved[PPL_HDR_RESERVED];/* reserved space, fill with 0xff */ __le32 signature; /* signature (family number of volume) */ __le32 padding; /* zero pad */ __le64 generation; /* generation number of the header */ __le32 entries_count; /* number of entries in entry array */ __le32 checksum; /* checksum of the header (~crc32c) */ struct ppl_header_entry entries[PPL_HDR_MAX_ENTRIES]; } __attribute__ ((__packed__)); #endif linux/raid/md_u.h 0000644 00000010604 15063602054 0007721 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* md_u.h : user <=> kernel API between Linux raidtools and RAID drivers Copyright (C) 1998 Ingo Molnar This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. You should have received a copy of the GNU General Public License (for example /usr/src/linux/COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MD_U_H #define _MD_U_H /* * Different major versions are not compatible. * Different minor versions are only downward compatible. * Different patchlevel versions are downward and upward compatible. */ #define MD_MAJOR_VERSION 0 #define MD_MINOR_VERSION 90 /* * MD_PATCHLEVEL_VERSION indicates kernel functionality. * >=1 means different superblock formats are selectable using SET_ARRAY_INFO * and major_version/minor_version accordingly * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT * in the super status byte * >=3 means that bitmap superblock version 4 is supported, which uses * little-ending representation rather than host-endian */ #define MD_PATCHLEVEL_VERSION 3 /* ioctls */ /* status */ #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) /* configuration */ #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) #define SET_DISK_INFO _IO (MD_MAJOR, 0x24) #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) /* usage */ #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) /* 0x31 was START_ARRAY */ #define STOP_ARRAY _IO (MD_MAJOR, 0x32) #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) #define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35) /* 63 partitions with the alternate major number (mdp) */ #define MdpMinorShift 6 typedef struct mdu_version_s { int major; int minor; int patchlevel; } mdu_version_t; typedef struct mdu_array_info_s { /* * Generic constant information */ int major_version; int minor_version; int patch_version; unsigned int ctime; int level; int size; int nr_disks; int raid_disks; int md_minor; int not_persistent; /* * Generic state information */ unsigned int utime; /* 0 Superblock update time */ int state; /* 1 State bits (clean, ...) */ int active_disks; /* 2 Number of currently active disks */ int working_disks; /* 3 Number of working disks */ int failed_disks; /* 4 Number of failed disks */ int spare_disks; /* 5 Number of spare disks */ /* * Personality information */ int layout; /* 0 the array's physical layout */ int chunk_size; /* 1 chunk size in bytes */ } mdu_array_info_t; /* non-obvious values for 'level' */ #define LEVEL_MULTIPATH (-4) #define LEVEL_LINEAR (-1) #define LEVEL_FAULTY (-5) /* we need a value for 'no level specified' and 0 * means 'raid0', so we need something else. This is * for internal use only */ #define LEVEL_NONE (-1000000) typedef struct mdu_disk_info_s { /* * configuration/status of one particular disk */ int number; int major; int minor; int raid_disk; int state; } mdu_disk_info_t; typedef struct mdu_start_info_s { /* * configuration/status of one particular disk */ int major; int minor; int raid_disk; int state; } mdu_start_info_t; typedef struct mdu_bitmap_file_s { char pathname[4096]; } mdu_bitmap_file_t; typedef struct mdu_param_s { int personality; /* 1,2,3,4 */ int chunk_size; /* in bytes */ int max_fault; /* unused for now */ } mdu_param_t; #endif /* _MD_U_H */ linux/ppp-comp.h 0000644 00000004737 15063602054 0007623 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ppp-comp.h - Definitions for doing PPP packet compression. * * Copyright 1994-1998 Paul Mackerras. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #ifndef _NET_PPP_COMP_H #define _NET_PPP_COMP_H /* * CCP codes. */ #define CCP_CONFREQ 1 #define CCP_CONFACK 2 #define CCP_TERMREQ 5 #define CCP_TERMACK 6 #define CCP_RESETREQ 14 #define CCP_RESETACK 15 /* * Max # bytes for a CCP option */ #define CCP_MAX_OPTION_LENGTH 32 /* * Parts of a CCP packet. */ #define CCP_CODE(dp) ((dp)[0]) #define CCP_ID(dp) ((dp)[1]) #define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) #define CCP_HDRLEN 4 #define CCP_OPT_CODE(dp) ((dp)[0]) #define CCP_OPT_LENGTH(dp) ((dp)[1]) #define CCP_OPT_MINLEN 2 /* * Definitions for BSD-Compress. */ #define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ #define CILEN_BSD_COMPRESS 3 /* length of config. option */ /* Macros for handling the 3rd byte of the BSD-Compress config option. */ #define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ #define BSD_VERSION(x) ((x) >> 5) /* version of option format */ #define BSD_CURRENT_VERSION 1 /* current version number */ #define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) #define BSD_MIN_BITS 9 /* smallest code size supported */ #define BSD_MAX_BITS 15 /* largest code size supported */ /* * Definitions for Deflate. */ #define CI_DEFLATE 26 /* config option for Deflate */ #define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ #define CILEN_DEFLATE 4 /* length of its config option */ #define DEFLATE_MIN_SIZE 9 #define DEFLATE_MAX_SIZE 15 #define DEFLATE_METHOD_VAL 8 #define DEFLATE_SIZE(x) (((x) >> 4) + 8) #define DEFLATE_METHOD(x) ((x) & 0x0F) #define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL) #define DEFLATE_CHK_SEQUENCE 0 /* * Definitions for MPPE. */ #define CI_MPPE 18 /* config option for MPPE */ #define CILEN_MPPE 6 /* length of config option */ /* * Definitions for other, as yet unsupported, compression methods. */ #define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ #define CILEN_PREDICTOR_1 2 /* length of its config option */ #define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ #define CILEN_PREDICTOR_2 2 /* length of its config option */ #endif /* _NET_PPP_COMP_H */ linux/ppp-ioctl.h 0000644 00000012543 15063602054 0007771 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ppp-ioctl.h - PPP ioctl definitions. * * Copyright 1999-2002 Paul Mackerras. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #ifndef _PPP_IOCTL_H #define _PPP_IOCTL_H #include <linux/types.h> #include <linux/ppp_defs.h> /* * Bit definitions for flags argument to PPPIOCGFLAGS/PPPIOCSFLAGS. */ #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ #define SC_COMP_AC 0x00000002 /* header compression (output) */ #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ #define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ #define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ #define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ #define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ #define SC_DEBUG 0x00010000 /* enable debug messages */ #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ #define SC_SYNC 0x00200000 /* synchronous serial mode */ #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ #define SC_MASK 0x0f600fff /* bits that user can change */ /* state bits */ #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ /* Used with PPPIOCGNPMODE/PPPIOCSNPMODE */ struct npioctl { int protocol; /* PPP protocol, e.g. PPP_IP */ enum NPmode mode; }; /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ struct ppp_option_data { __u8 *ptr; __u32 length; int transmit; }; /* For PPPIOCGL2TPSTATS */ struct pppol2tp_ioc_stats { __u16 tunnel_id; /* redundant */ __u16 session_id; /* if zero, get tunnel stats */ __u32 using_ipsec:1; /* valid only for session_id == 0 */ __aligned_u64 tx_packets; __aligned_u64 tx_bytes; __aligned_u64 tx_errors; __aligned_u64 rx_packets; __aligned_u64 rx_bytes; __aligned_u64 rx_seq_discards; __aligned_u64 rx_oos_packets; __aligned_u64 rx_errors; }; /* * Ioctl definitions. */ #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ #define PPPIOCDETACH _IOW('t', 60, int) /* obsolete, do not use */ #define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ #define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) #endif /* _PPP_IOCTL_H */ linux/ppp_defs.h 0000644 00000011763 15063602054 0007665 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ppp_defs.h - PPP definitions. * * Copyright 1994-2000 Paul Mackerras. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #include <linux/types.h> #ifndef _PPP_DEFS_H_ #define _PPP_DEFS_H_ /* * The basic PPP frame. */ #define PPP_HDRLEN 4 /* octets for standard ppp header */ #define PPP_FCSLEN 2 /* octets for FCS */ #define PPP_MRU 1500 /* default MRU = max length of info field */ #define PPP_ADDRESS(p) (((__u8 *)(p))[0]) #define PPP_CONTROL(p) (((__u8 *)(p))[1]) #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) /* * Significant octet values. */ #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ #define PPP_UI 0x03 /* Unnumbered Information */ #define PPP_FLAG 0x7e /* Flag Sequence */ #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ /* * Protocol field values. */ #define PPP_IP 0x21 /* Internet Protocol */ #define PPP_AT 0x29 /* AppleTalk Protocol */ #define PPP_IPX 0x2b /* IPX protocol */ #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ #define PPP_MP 0x3d /* Multilink protocol */ #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ #define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */ #define PPP_COMP 0xfd /* compressed packet */ #define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */ #define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */ #define PPP_IPCP 0x8021 /* IP Control Protocol */ #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ #define PPP_IPXCP 0x802b /* IPX Control Protocol */ #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ #define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */ #define PPP_CCP 0x80fd /* Compression Control Protocol */ #define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */ #define PPP_LCP 0xc021 /* Link Control Protocol */ #define PPP_PAP 0xc023 /* Password Authentication Protocol */ #define PPP_LQR 0xc025 /* Link Quality Report protocol */ #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ #define PPP_CBCP 0xc029 /* Callback Control Protocol */ /* * Values for FCS calculations. */ #define PPP_INITFCS 0xffff /* Initial FCS value */ #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ /* * Extended asyncmap - allows any character to be escaped. */ typedef __u32 ext_accm[8]; /* * What to do with network protocol (NP) packets. */ enum NPmode { NPMODE_PASS, /* pass the packet through */ NPMODE_DROP, /* silently drop the packet */ NPMODE_ERROR, /* return an error */ NPMODE_QUEUE /* save it up for later. */ }; /* * Statistics for LQRP and pppstats */ struct pppstat { __u32 ppp_discards; /* # frames discarded */ __u32 ppp_ibytes; /* bytes received */ __u32 ppp_ioctects; /* bytes received not in error */ __u32 ppp_ipackets; /* packets received */ __u32 ppp_ierrors; /* receive errors */ __u32 ppp_ilqrs; /* # LQR frames received */ __u32 ppp_obytes; /* raw bytes sent */ __u32 ppp_ooctects; /* frame bytes sent */ __u32 ppp_opackets; /* packets sent */ __u32 ppp_oerrors; /* transmit errors */ __u32 ppp_olqrs; /* # LQR frames sent */ }; struct vjstat { __u32 vjs_packets; /* outbound packets */ __u32 vjs_compressed; /* outbound compressed packets */ __u32 vjs_searches; /* searches for connection state */ __u32 vjs_misses; /* times couldn't find conn. state */ __u32 vjs_uncompressedin; /* inbound uncompressed packets */ __u32 vjs_compressedin; /* inbound compressed packets */ __u32 vjs_errorin; /* inbound unknown type packets */ __u32 vjs_tossed; /* inbound packets tossed because of error */ }; struct compstat { __u32 unc_bytes; /* total uncompressed bytes */ __u32 unc_packets; /* total uncompressed packets */ __u32 comp_bytes; /* compressed bytes */ __u32 comp_packets; /* compressed packets */ __u32 inc_bytes; /* incompressible bytes */ __u32 inc_packets; /* incompressible packets */ /* the compression ratio is defined as in_count / bytes_out */ __u32 in_count; /* Bytes received */ __u32 bytes_out; /* Bytes transmitted */ double ratio; /* not computed in kernel. */ }; struct ppp_stats { struct pppstat p; /* basic PPP statistics */ struct vjstat vj; /* VJ header compression statistics */ }; struct ppp_comp_stats { struct compstat c; /* packet compression statistics */ struct compstat d; /* packet decompression statistics */ }; /* * The following structure records the time in seconds since * the last NP packet was sent or received. */ struct ppp_idle { __kernel_time_t xmit_idle; /* time since last NP packet sent */ __kernel_time_t recv_idle; /* time since last NP packet received */ }; #endif /* _PPP_DEFS_H_ */ linux/pps.h 0000644 00000011176 15063602054 0006665 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * PPS API header * * Copyright (C) 2005-2009 Rodolfo Giometti <giometti@linux.it> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _PPS_H_ #define _PPS_H_ #include <linux/types.h> #define PPS_VERSION "5.3.6" #define PPS_MAX_SOURCES 16 /* should be enough... */ /* Implementation note: the logical states ``assert'' and ``clear'' * are implemented in terms of the chip register, i.e. ``assert'' * means the bit is set. */ /* * 3.2 New data structures */ #define PPS_API_VERS_1 1 #define PPS_API_VERS PPS_API_VERS_1 /* we use API version 1 */ #define PPS_MAX_NAME_LEN 32 /* 32-bit vs. 64-bit compatibility. * * 0n i386, the alignment of a uint64_t is only 4 bytes, while on most other * architectures it's 8 bytes. On i386, there will be no padding between the * two consecutive 'struct pps_ktime' members of struct pps_kinfo and struct * pps_kparams. But on most platforms there will be padding to ensure correct * alignment. * * The simple fix is probably to add an explicit padding. * [David Woodhouse] */ struct pps_ktime { __s64 sec; __s32 nsec; __u32 flags; }; struct pps_ktime_compat { __s64 sec; __s32 nsec; __u32 flags; } __attribute__((packed, aligned(4))); #define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */ struct pps_kinfo { __u32 assert_sequence; /* seq. num. of assert event */ __u32 clear_sequence; /* seq. num. of clear event */ struct pps_ktime assert_tu; /* time of assert event */ struct pps_ktime clear_tu; /* time of clear event */ int current_mode; /* current mode bits */ }; struct pps_kinfo_compat { __u32 assert_sequence; /* seq. num. of assert event */ __u32 clear_sequence; /* seq. num. of clear event */ struct pps_ktime_compat assert_tu; /* time of assert event */ struct pps_ktime_compat clear_tu; /* time of clear event */ int current_mode; /* current mode bits */ }; struct pps_kparams { int api_version; /* API version # */ int mode; /* mode bits */ struct pps_ktime assert_off_tu; /* offset compensation for assert */ struct pps_ktime clear_off_tu; /* offset compensation for clear */ }; /* * 3.3 Mode bit definitions */ /* Device/implementation parameters */ #define PPS_CAPTUREASSERT 0x01 /* capture assert events */ #define PPS_CAPTURECLEAR 0x02 /* capture clear events */ #define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */ #define PPS_OFFSETASSERT 0x10 /* apply compensation for assert event */ #define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear event */ #define PPS_CANWAIT 0x100 /* can we wait for an event? */ #define PPS_CANPOLL 0x200 /* bit reserved for future use */ /* Kernel actions */ #define PPS_ECHOASSERT 0x40 /* feed back assert event to output */ #define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */ /* Timestamp formats */ #define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */ #define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */ /* * 3.4.4 New functions: disciplining the kernel timebase */ /* Kernel consumers */ #define PPS_KC_HARDPPS 0 /* hardpps() (or equivalent) */ #define PPS_KC_HARDPPS_PLL 1 /* hardpps() constrained to use a phase-locked loop */ #define PPS_KC_HARDPPS_FLL 2 /* hardpps() constrained to use a frequency-locked loop */ /* * Here begins the implementation-specific part! */ struct pps_fdata { struct pps_kinfo info; struct pps_ktime timeout; }; struct pps_fdata_compat { struct pps_kinfo_compat info; struct pps_ktime_compat timeout; }; struct pps_bind_args { int tsformat; /* format of time stamps */ int edge; /* selected event type */ int consumer; /* selected kernel consumer */ }; #include <linux/ioctl.h> #define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *) #define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *) #define PPS_GETCAP _IOR('p', 0xa3, int *) #define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *) #define PPS_KC_BIND _IOW('p', 0xa5, struct pps_bind_args *) #endif /* _PPS_H_ */ linux/pr.h 0000644 00000002061 15063602054 0006475 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _PR_H #define _PR_H #include <linux/types.h> enum pr_type { PR_WRITE_EXCLUSIVE = 1, PR_EXCLUSIVE_ACCESS = 2, PR_WRITE_EXCLUSIVE_REG_ONLY = 3, PR_EXCLUSIVE_ACCESS_REG_ONLY = 4, PR_WRITE_EXCLUSIVE_ALL_REGS = 5, PR_EXCLUSIVE_ACCESS_ALL_REGS = 6, }; struct pr_reservation { __u64 key; __u32 type; __u32 flags; }; struct pr_registration { __u64 old_key; __u64 new_key; __u32 flags; __u32 __pad; }; struct pr_preempt { __u64 old_key; __u64 new_key; __u32 type; __u32 flags; }; struct pr_clear { __u64 key; __u32 flags; __u32 __pad; }; #define PR_FL_IGNORE_KEY (1 << 0) /* ignore existing key */ #define IOC_PR_REGISTER _IOW('p', 200, struct pr_registration) #define IOC_PR_RESERVE _IOW('p', 201, struct pr_reservation) #define IOC_PR_RELEASE _IOW('p', 202, struct pr_reservation) #define IOC_PR_PREEMPT _IOW('p', 203, struct pr_preempt) #define IOC_PR_PREEMPT_ABORT _IOW('p', 204, struct pr_preempt) #define IOC_PR_CLEAR _IOW('p', 205, struct pr_clear) #endif /* _PR_H */ linux/prctl.h 0000644 00000017527 15063602054 0007215 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PRCTL_H #define _LINUX_PRCTL_H #include <linux/types.h> /* Values to pass as first argument to prctl() */ #define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ #define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */ /* Get/set current->mm->dumpable */ #define PR_GET_DUMPABLE 3 #define PR_SET_DUMPABLE 4 /* Get/set unaligned access control bits (if meaningful) */ #define PR_GET_UNALIGN 5 #define PR_SET_UNALIGN 6 # define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ # define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ /* Get/set whether or not to drop capabilities on setuid() away from * uid 0 (as per security/commoncap.c) */ #define PR_GET_KEEPCAPS 7 #define PR_SET_KEEPCAPS 8 /* Get/set floating-point emulation control bits (if meaningful) */ #define PR_GET_FPEMU 9 #define PR_SET_FPEMU 10 # define PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */ # define PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */ /* Get/set floating-point exception mode (if meaningful) */ #define PR_GET_FPEXC 11 #define PR_SET_FPEXC 12 # define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */ # define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */ # define PR_FP_EXC_OVF 0x020000 /* floating point overflow */ # define PR_FP_EXC_UND 0x040000 /* floating point underflow */ # define PR_FP_EXC_RES 0x080000 /* floating point inexact result */ # define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */ # define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */ # define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */ # define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ # define PR_FP_EXC_PRECISE 3 /* precise exception mode */ /* Get/set whether we use statistical process timing or accurate timestamp * based process timing */ #define PR_GET_TIMING 13 #define PR_SET_TIMING 14 # define PR_TIMING_STATISTICAL 0 /* Normal, traditional, statistical process timing */ # define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based process timing */ #define PR_SET_NAME 15 /* Set process name */ #define PR_GET_NAME 16 /* Get process name */ /* Get/set process endian */ #define PR_GET_ENDIAN 19 #define PR_SET_ENDIAN 20 # define PR_ENDIAN_BIG 0 # define PR_ENDIAN_LITTLE 1 /* True little endian mode */ # define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ /* Get/set process seccomp mode */ #define PR_GET_SECCOMP 21 #define PR_SET_SECCOMP 22 /* Get/set the capability bounding set (as per security/commoncap.c) */ #define PR_CAPBSET_READ 23 #define PR_CAPBSET_DROP 24 /* Get/set the process' ability to use the timestamp counter instruction */ #define PR_GET_TSC 25 #define PR_SET_TSC 26 # define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ # define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ /* Get/set securebits (as per security/commoncap.c) */ #define PR_GET_SECUREBITS 27 #define PR_SET_SECUREBITS 28 /* * Get/set the timerslack as used by poll/select/nanosleep * A value of 0 means "use default" */ #define PR_SET_TIMERSLACK 29 #define PR_GET_TIMERSLACK 30 #define PR_TASK_PERF_EVENTS_DISABLE 31 #define PR_TASK_PERF_EVENTS_ENABLE 32 /* * Set early/late kill mode for hwpoison memory corruption. * This influences when the process gets killed on a memory corruption. */ #define PR_MCE_KILL 33 # define PR_MCE_KILL_CLEAR 0 # define PR_MCE_KILL_SET 1 # define PR_MCE_KILL_LATE 0 # define PR_MCE_KILL_EARLY 1 # define PR_MCE_KILL_DEFAULT 2 #define PR_MCE_KILL_GET 34 /* * Tune up process memory map specifics. */ #define PR_SET_MM 35 # define PR_SET_MM_START_CODE 1 # define PR_SET_MM_END_CODE 2 # define PR_SET_MM_START_DATA 3 # define PR_SET_MM_END_DATA 4 # define PR_SET_MM_START_STACK 5 # define PR_SET_MM_START_BRK 6 # define PR_SET_MM_BRK 7 # define PR_SET_MM_ARG_START 8 # define PR_SET_MM_ARG_END 9 # define PR_SET_MM_ENV_START 10 # define PR_SET_MM_ENV_END 11 # define PR_SET_MM_AUXV 12 # define PR_SET_MM_EXE_FILE 13 # define PR_SET_MM_MAP 14 # define PR_SET_MM_MAP_SIZE 15 /* * This structure provides new memory descriptor * map which mostly modifies /proc/pid/stat[m] * output for a task. This mostly done in a * sake of checkpoint/restore functionality. */ struct prctl_mm_map { __u64 start_code; /* code section bounds */ __u64 end_code; __u64 start_data; /* data section bounds */ __u64 end_data; __u64 start_brk; /* heap for brk() syscall */ __u64 brk; __u64 start_stack; /* stack starts at */ __u64 arg_start; /* command line arguments bounds */ __u64 arg_end; __u64 env_start; /* environment variables bounds */ __u64 env_end; __u64 *auxv; /* auxiliary vector */ __u32 auxv_size; /* vector size */ __u32 exe_fd; /* /proc/$pid/exe link file */ }; /* * Set specific pid that is allowed to ptrace the current task. * A value of 0 mean "no process". */ #define PR_SET_PTRACER 0x59616d61 # define PR_SET_PTRACER_ANY ((unsigned long)-1) #define PR_SET_CHILD_SUBREAPER 36 #define PR_GET_CHILD_SUBREAPER 37 /* * If no_new_privs is set, then operations that grant new privileges (i.e. * execve) will either fail or not grant them. This affects suid/sgid, * file capabilities, and LSMs. * * Operations that merely manipulate or drop existing privileges (setresuid, * capset, etc.) will still work. Drop those privileges if you want them gone. * * Changing LSM security domain is considered a new privilege. So, for example, * asking selinux for a specific new context (e.g. with runcon) will result * in execve returning -EPERM. * * See Documentation/userspace-api/no_new_privs.rst for more details. */ #define PR_SET_NO_NEW_PRIVS 38 #define PR_GET_NO_NEW_PRIVS 39 #define PR_GET_TID_ADDRESS 40 #define PR_SET_THP_DISABLE 41 #define PR_GET_THP_DISABLE 42 /* * Tell the kernel to start/stop helping userspace manage bounds tables. */ #define PR_MPX_ENABLE_MANAGEMENT 43 #define PR_MPX_DISABLE_MANAGEMENT 44 #define PR_SET_FP_MODE 45 #define PR_GET_FP_MODE 46 # define PR_FP_MODE_FR (1 << 0) /* 64b FP registers */ # define PR_FP_MODE_FRE (1 << 1) /* 32b compatibility */ /* Control the ambient capability set */ #define PR_CAP_AMBIENT 47 # define PR_CAP_AMBIENT_IS_SET 1 # define PR_CAP_AMBIENT_RAISE 2 # define PR_CAP_AMBIENT_LOWER 3 # define PR_CAP_AMBIENT_CLEAR_ALL 4 /* arm64 Scalable Vector Extension controls */ /* Flag values must be kept in sync with ptrace NT_ARM_SVE interface */ #define PR_SVE_SET_VL 50 /* set task vector length */ # define PR_SVE_SET_VL_ONEXEC (1 << 18) /* defer effect until exec */ #define PR_SVE_GET_VL 51 /* get task vector length */ /* Bits common to PR_SVE_SET_VL and PR_SVE_GET_VL */ # define PR_SVE_VL_LEN_MASK 0xffff # define PR_SVE_VL_INHERIT (1 << 17) /* inherit across exec */ /* Per task speculation control */ #define PR_GET_SPECULATION_CTRL 52 #define PR_SET_SPECULATION_CTRL 53 /* Speculation control variants */ # define PR_SPEC_STORE_BYPASS 0 # define PR_SPEC_INDIRECT_BRANCH 1 /* Return and control values for PR_SET/GET_SPECULATION_CTRL */ # define PR_SPEC_NOT_AFFECTED 0 # define PR_SPEC_PRCTL (1UL << 0) # define PR_SPEC_ENABLE (1UL << 1) # define PR_SPEC_DISABLE (1UL << 2) # define PR_SPEC_FORCE_DISABLE (1UL << 3) # define PR_SPEC_DISABLE_NOEXEC (1UL << 4) /* Reset arm64 pointer authentication keys */ #define PR_PAC_RESET_KEYS 54 # define PR_PAC_APIAKEY (1UL << 0) # define PR_PAC_APIBKEY (1UL << 1) # define PR_PAC_APDAKEY (1UL << 2) # define PR_PAC_APDBKEY (1UL << 3) # define PR_PAC_APGAKEY (1UL << 4) /* Control reclaim behavior when allocating memory */ #define PR_SET_IO_FLUSHER 57 #define PR_GET_IO_FLUSHER 58 #endif /* _LINUX_PRCTL_H */ linux/psample.h 0000644 00000004337 15063602054 0007525 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_PSAMPLE_H #define __UAPI_PSAMPLE_H enum { PSAMPLE_ATTR_IIFINDEX, PSAMPLE_ATTR_OIFINDEX, PSAMPLE_ATTR_ORIGSIZE, PSAMPLE_ATTR_SAMPLE_GROUP, PSAMPLE_ATTR_GROUP_SEQ, PSAMPLE_ATTR_SAMPLE_RATE, PSAMPLE_ATTR_DATA, PSAMPLE_ATTR_GROUP_REFCOUNT, PSAMPLE_ATTR_TUNNEL, PSAMPLE_ATTR_PAD, PSAMPLE_ATTR_OUT_TC, /* u16 */ PSAMPLE_ATTR_OUT_TC_OCC, /* u64, bytes */ PSAMPLE_ATTR_LATENCY, /* u64, nanoseconds */ PSAMPLE_ATTR_TIMESTAMP, /* u64, nanoseconds */ PSAMPLE_ATTR_PROTO, /* u16 */ __PSAMPLE_ATTR_MAX }; enum psample_command { PSAMPLE_CMD_SAMPLE, PSAMPLE_CMD_GET_GROUP, PSAMPLE_CMD_NEW_GROUP, PSAMPLE_CMD_DEL_GROUP, }; enum psample_tunnel_key_attr { PSAMPLE_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ PSAMPLE_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ PSAMPLE_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ PSAMPLE_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ PSAMPLE_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ PSAMPLE_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ PSAMPLE_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ PSAMPLE_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ PSAMPLE_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ PSAMPLE_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */ PSAMPLE_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */ PSAMPLE_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested VXLAN opts* */ PSAMPLE_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ PSAMPLE_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ PSAMPLE_TUNNEL_KEY_ATTR_PAD, PSAMPLE_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* struct erspan_metadata */ PSAMPLE_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE, /* No argument. IPV4_INFO_BRIDGE mode.*/ __PSAMPLE_TUNNEL_KEY_ATTR_MAX }; /* Can be overridden at runtime by module option */ #define PSAMPLE_ATTR_MAX (__PSAMPLE_ATTR_MAX - 1) #define PSAMPLE_NL_MCGRP_CONFIG_NAME "config" #define PSAMPLE_NL_MCGRP_SAMPLE_NAME "packets" #define PSAMPLE_GENL_NAME "psample" #define PSAMPLE_GENL_VERSION 1 #endif linux/psci.h 0000644 00000010350 15063602054 0007012 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ARM Power State and Coordination Interface (PSCI) header * * This header holds common PSCI defines and macros shared * by: ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. * * Copyright (C) 2014 Linaro Ltd. * Author: Anup Patel <anup.patel@linaro.org> */ #ifndef _LINUX_PSCI_H #define _LINUX_PSCI_H /* * PSCI v0.1 interface * * The PSCI v0.1 function numbers are implementation defined. * * Only PSCI return values such as: SUCCESS, NOT_SUPPORTED, * INVALID_PARAMS, and DENIED defined below are applicable * to PSCI v0.1. */ /* PSCI v0.2 interface */ #define PSCI_0_2_FN_BASE 0x84000000 #define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n)) #define PSCI_0_2_64BIT 0x40000000 #define PSCI_0_2_FN64_BASE \ (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT) #define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n)) #define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) #define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) #define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) #define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) #define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) #define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) #define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) #define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) #define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) #define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) #define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) #define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) #define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) #define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) #define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) #define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) #define PSCI_1_1_FN_SYSTEM_RESET2 PSCI_0_2_FN(18) #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) #define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18) /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff #define PSCI_0_2_POWER_STATE_ID_SHIFT 0 #define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16 #define PSCI_0_2_POWER_STATE_TYPE_MASK \ (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT) #define PSCI_0_2_POWER_STATE_AFFL_SHIFT 24 #define PSCI_0_2_POWER_STATE_AFFL_MASK \ (0x3 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) /* PSCI extended power state encoding for CPU_SUSPEND function */ #define PSCI_1_0_EXT_POWER_STATE_ID_MASK 0xfffffff #define PSCI_1_0_EXT_POWER_STATE_ID_SHIFT 0 #define PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT 30 #define PSCI_1_0_EXT_POWER_STATE_TYPE_MASK \ (0x1 << PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT) /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */ #define PSCI_0_2_AFFINITY_LEVEL_ON 0 #define PSCI_0_2_AFFINITY_LEVEL_OFF 1 #define PSCI_0_2_AFFINITY_LEVEL_ON_PENDING 2 /* PSCI v0.2 multicore support in Trusted OS returned by MIGRATE_INFO_TYPE */ #define PSCI_0_2_TOS_UP_MIGRATE 0 #define PSCI_0_2_TOS_UP_NO_MIGRATE 1 #define PSCI_0_2_TOS_MP 2 /* PSCI version decoding (independent of PSCI version) */ #define PSCI_VERSION_MAJOR_SHIFT 16 #define PSCI_VERSION_MINOR_MASK \ ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1) #define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK #define PSCI_VERSION_MAJOR(ver) \ (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT) #define PSCI_VERSION_MINOR(ver) \ ((ver) & PSCI_VERSION_MINOR_MASK) #define PSCI_VERSION(maj, min) \ ((((maj) << PSCI_VERSION_MAJOR_SHIFT) & PSCI_VERSION_MAJOR_MASK) | \ ((min) & PSCI_VERSION_MINOR_MASK)) /* PSCI features decoding (>=1.0) */ #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT 1 #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) #define PSCI_1_0_OS_INITIATED BIT(0) #define PSCI_1_0_SUSPEND_MODE_PC 0 #define PSCI_1_0_SUSPEND_MODE_OSI 1 /* PSCI return values (inclusive of all PSCI versions) */ #define PSCI_RET_SUCCESS 0 #define PSCI_RET_NOT_SUPPORTED -1 #define PSCI_RET_INVALID_PARAMS -2 #define PSCI_RET_DENIED -3 #define PSCI_RET_ALREADY_ON -4 #define PSCI_RET_ON_PENDING -5 #define PSCI_RET_INTERNAL_FAILURE -6 #define PSCI_RET_NOT_PRESENT -7 #define PSCI_RET_DISABLED -8 #define PSCI_RET_INVALID_ADDRESS -9 #endif /* _LINUX_PSCI_H */ linux/psp-sev.h 0000644 00000010752 15063602054 0007457 0 ustar 00 /* * Userspace interface for AMD Secure Encrypted Virtualization (SEV) * platform management commands. * * Copyright (C) 2016-2017 Advanced Micro Devices, Inc. * * Author: Brijesh Singh <brijesh.singh@amd.com> * * SEV API specification is available at: https://developer.amd.com/sev/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __PSP_SEV_USER_H__ #define __PSP_SEV_USER_H__ #include <linux/types.h> /** * SEV platform commands */ enum { SEV_FACTORY_RESET = 0, SEV_PLATFORM_STATUS, SEV_PEK_GEN, SEV_PEK_CSR, SEV_PDH_GEN, SEV_PDH_CERT_EXPORT, SEV_PEK_CERT_IMPORT, SEV_GET_ID, /* This command is deprecated, use SEV_GET_ID2 */ SEV_GET_ID2, SEV_MAX, }; /** * SEV Firmware status code */ typedef enum { /* * This error code is not in the SEV spec. Its purpose is to convey that * there was an error that prevented the SEV firmware from being called. * The SEV API error codes are 16 bits, so the -1 value will not overlap * with possible values from the specification. */ SEV_RET_NO_FW_CALL = -1, SEV_RET_SUCCESS = 0, SEV_RET_INVALID_PLATFORM_STATE, SEV_RET_INVALID_GUEST_STATE, SEV_RET_INAVLID_CONFIG, SEV_RET_INVALID_LEN, SEV_RET_ALREADY_OWNED, SEV_RET_INVALID_CERTIFICATE, SEV_RET_POLICY_FAILURE, SEV_RET_INACTIVE, SEV_RET_INVALID_ADDRESS, SEV_RET_BAD_SIGNATURE, SEV_RET_BAD_MEASUREMENT, SEV_RET_ASID_OWNED, SEV_RET_INVALID_ASID, SEV_RET_WBINVD_REQUIRED, SEV_RET_DFFLUSH_REQUIRED, SEV_RET_INVALID_GUEST, SEV_RET_INVALID_COMMAND, SEV_RET_ACTIVE, SEV_RET_HWSEV_RET_PLATFORM, SEV_RET_HWSEV_RET_UNSAFE, SEV_RET_UNSUPPORTED, SEV_RET_INVALID_PARAM, SEV_RET_RESOURCE_LIMIT, SEV_RET_SECURE_DATA_INVALID, SEV_RET_MAX, } sev_ret_code; /** * struct sev_user_data_status - PLATFORM_STATUS command parameters * * @major: major API version * @minor: minor API version * @state: platform state * @flags: platform config flags * @build: firmware build id for API version * @guest_count: number of active guests */ struct sev_user_data_status { __u8 api_major; /* Out */ __u8 api_minor; /* Out */ __u8 state; /* Out */ __u32 flags; /* Out */ __u8 build; /* Out */ __u32 guest_count; /* Out */ } __attribute__((packed)); #define SEV_STATUS_FLAGS_CONFIG_ES 0x0100 /** * struct sev_user_data_pek_csr - PEK_CSR command parameters * * @address: PEK certificate chain * @length: length of certificate */ struct sev_user_data_pek_csr { __u64 address; /* In */ __u32 length; /* In/Out */ } __attribute__((packed)); /** * struct sev_user_data_cert_import - PEK_CERT_IMPORT command parameters * * @pek_address: PEK certificate chain * @pek_len: length of PEK certificate * @oca_address: OCA certificate chain * @oca_len: length of OCA certificate */ struct sev_user_data_pek_cert_import { __u64 pek_cert_address; /* In */ __u32 pek_cert_len; /* In */ __u64 oca_cert_address; /* In */ __u32 oca_cert_len; /* In */ } __attribute__((packed)); /** * struct sev_user_data_pdh_cert_export - PDH_CERT_EXPORT command parameters * * @pdh_address: PDH certificate address * @pdh_len: length of PDH certificate * @cert_chain_address: PDH certificate chain * @cert_chain_len: length of PDH certificate chain */ struct sev_user_data_pdh_cert_export { __u64 pdh_cert_address; /* In */ __u32 pdh_cert_len; /* In/Out */ __u64 cert_chain_address; /* In */ __u32 cert_chain_len; /* In/Out */ } __attribute__((packed)); /** * struct sev_user_data_get_id - GET_ID command parameters (deprecated) * * @socket1: Buffer to pass unique ID of first socket * @socket2: Buffer to pass unique ID of second socket */ struct sev_user_data_get_id { __u8 socket1[64]; /* Out */ __u8 socket2[64]; /* Out */ } __attribute__((packed)); /** * struct sev_user_data_get_id2 - GET_ID command parameters * @address: Buffer to store unique ID * @length: length of the unique ID */ struct sev_user_data_get_id2 { __u64 address; /* In */ __u32 length; /* In/Out */ } __attribute__((packed)); /** * struct sev_issue_cmd - SEV ioctl parameters * * @cmd: SEV commands to execute * @opaque: pointer to the command structure * @error: SEV FW return code on failure */ struct sev_issue_cmd { __u32 cmd; /* In */ __u64 data; /* In */ __u32 error; /* Out */ } __attribute__((packed)); #define SEV_IOC_TYPE 'S' #define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd) #endif /* __PSP_USER_SEV_H */ linux/ptp_clock.h 0000644 00000016440 15063602054 0010040 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * PTP 1588 clock support - user space interface * * Copyright (C) 2010 OMICRON electronics GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _PTP_CLOCK_H_ #define _PTP_CLOCK_H_ #include <linux/ioctl.h> #include <linux/types.h> /* * Bits of the ptp_extts_request.flags field: */ #define PTP_ENABLE_FEATURE (1<<0) #define PTP_RISING_EDGE (1<<1) #define PTP_FALLING_EDGE (1<<2) #define PTP_STRICT_FLAGS (1<<3) #define PTP_EXTTS_EDGES (PTP_RISING_EDGE | PTP_FALLING_EDGE) /* * flag fields valid for the new PTP_EXTTS_REQUEST2 ioctl. */ #define PTP_EXTTS_VALID_FLAGS (PTP_ENABLE_FEATURE | \ PTP_RISING_EDGE | \ PTP_FALLING_EDGE | \ PTP_STRICT_FLAGS) /* * flag fields valid for the original PTP_EXTTS_REQUEST ioctl. * DO NOT ADD NEW FLAGS HERE. */ #define PTP_EXTTS_V1_VALID_FLAGS (PTP_ENABLE_FEATURE | \ PTP_RISING_EDGE | \ PTP_FALLING_EDGE) /* * Bits of the ptp_perout_request.flags field: */ #define PTP_PEROUT_ONE_SHOT (1<<0) #define PTP_PEROUT_DUTY_CYCLE (1<<1) #define PTP_PEROUT_PHASE (1<<2) /* * flag fields valid for the new PTP_PEROUT_REQUEST2 ioctl. */ #define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT | \ PTP_PEROUT_DUTY_CYCLE | \ PTP_PEROUT_PHASE) /* * No flags are valid for the original PTP_PEROUT_REQUEST ioctl */ #define PTP_PEROUT_V1_VALID_FLAGS (0) /* * struct ptp_clock_time - represents a time value * * The sign of the seconds field applies to the whole value. The * nanoseconds field is always unsigned. The reserved field is * included for sub-nanosecond resolution, should the demand for * this ever appear. * */ struct ptp_clock_time { __s64 sec; /* seconds */ __u32 nsec; /* nanoseconds */ __u32 reserved; }; struct ptp_clock_caps { int max_adj; /* Maximum frequency adjustment in parts per billon. */ int n_alarm; /* Number of programmable alarms. */ int n_ext_ts; /* Number of external time stamp channels. */ int n_per_out; /* Number of programmable periodic signals. */ int pps; /* Whether the clock supports a PPS callback. */ int n_pins; /* Number of input/output pins. */ /* Whether the clock supports precise system-device cross timestamps */ int cross_timestamping; /* Whether the clock supports adjust phase */ int adjust_phase; int rsv[12]; /* Reserved for future use. */ }; struct ptp_extts_request { unsigned int index; /* Which channel to configure. */ unsigned int flags; /* Bit field for PTP_xxx flags. */ unsigned int rsv[2]; /* Reserved for future use. */ }; struct ptp_perout_request { union { /* * Absolute start time. * Valid only if (flags & PTP_PEROUT_PHASE) is unset. */ struct ptp_clock_time start; /* * Phase offset. The signal should start toggling at an * unspecified integer multiple of the period, plus this value. * The start time should be "as soon as possible". * Valid only if (flags & PTP_PEROUT_PHASE) is set. */ struct ptp_clock_time phase; }; struct ptp_clock_time period; /* Desired period, zero means disable. */ unsigned int index; /* Which channel to configure. */ unsigned int flags; union { /* * The "on" time of the signal. * Must be lower than the period. * Valid only if (flags & PTP_PEROUT_DUTY_CYCLE) is set. */ struct ptp_clock_time on; /* Reserved for future use. */ unsigned int rsv[4]; }; }; #define PTP_MAX_SAMPLES 25 /* Maximum allowed offset measurement samples. */ struct ptp_sys_offset { unsigned int n_samples; /* Desired number of measurements. */ unsigned int rsv[3]; /* Reserved for future use. */ /* * Array of interleaved system/phc time stamps. The kernel * will provide 2*n_samples + 1 time stamps, with the last * one as a system time stamp. */ struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; }; struct ptp_sys_offset_extended { unsigned int n_samples; /* Desired number of measurements. */ unsigned int rsv[3]; /* Reserved for future use. */ /* * Array of [system, phc, system] time stamps. The kernel will provide * 3*n_samples time stamps. */ struct ptp_clock_time ts[PTP_MAX_SAMPLES][3]; }; struct ptp_sys_offset_precise { struct ptp_clock_time device; struct ptp_clock_time sys_realtime; struct ptp_clock_time sys_monoraw; unsigned int rsv[4]; /* Reserved for future use. */ }; enum ptp_pin_function { PTP_PF_NONE, PTP_PF_EXTTS, PTP_PF_PEROUT, PTP_PF_PHYSYNC, }; struct ptp_pin_desc { /* * Hardware specific human readable pin name. This field is * set by the kernel during the PTP_PIN_GETFUNC ioctl and is * ignored for the PTP_PIN_SETFUNC ioctl. */ char name[64]; /* * Pin index in the range of zero to ptp_clock_caps.n_pins - 1. */ unsigned int index; /* * Which of the PTP_PF_xxx functions to use on this pin. */ unsigned int func; /* * The specific channel to use for this function. * This corresponds to the 'index' field of the * PTP_EXTTS_REQUEST and PTP_PEROUT_REQUEST ioctls. */ unsigned int chan; /* * Reserved for future use. */ unsigned int rsv[5]; }; #define PTP_CLK_MAGIC '=' #define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) #define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request) #define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) #define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) #define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset) #define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc) #define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc) #define PTP_SYS_OFFSET_PRECISE \ _IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise) #define PTP_SYS_OFFSET_EXTENDED \ _IOWR(PTP_CLK_MAGIC, 9, struct ptp_sys_offset_extended) #define PTP_CLOCK_GETCAPS2 _IOR(PTP_CLK_MAGIC, 10, struct ptp_clock_caps) #define PTP_EXTTS_REQUEST2 _IOW(PTP_CLK_MAGIC, 11, struct ptp_extts_request) #define PTP_PEROUT_REQUEST2 _IOW(PTP_CLK_MAGIC, 12, struct ptp_perout_request) #define PTP_ENABLE_PPS2 _IOW(PTP_CLK_MAGIC, 13, int) #define PTP_SYS_OFFSET2 _IOW(PTP_CLK_MAGIC, 14, struct ptp_sys_offset) #define PTP_PIN_GETFUNC2 _IOWR(PTP_CLK_MAGIC, 15, struct ptp_pin_desc) #define PTP_PIN_SETFUNC2 _IOW(PTP_CLK_MAGIC, 16, struct ptp_pin_desc) #define PTP_SYS_OFFSET_PRECISE2 \ _IOWR(PTP_CLK_MAGIC, 17, struct ptp_sys_offset_precise) #define PTP_SYS_OFFSET_EXTENDED2 \ _IOWR(PTP_CLK_MAGIC, 18, struct ptp_sys_offset_extended) struct ptp_extts_event { struct ptp_clock_time t; /* Time event occured. */ unsigned int index; /* Which channel produced the event. */ unsigned int flags; /* Reserved for future use. */ unsigned int rsv[2]; /* Reserved for future use. */ }; #endif linux/ptrace.h 0000644 00000007132 15063602054 0007336 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_PTRACE_H #define _LINUX_PTRACE_H /* ptrace.h */ /* structs and defines to help the user use the ptrace system call. */ /* has the defines to get at the registers. */ #include <linux/types.h> #define PTRACE_TRACEME 0 #define PTRACE_PEEKTEXT 1 #define PTRACE_PEEKDATA 2 #define PTRACE_PEEKUSR 3 #define PTRACE_POKETEXT 4 #define PTRACE_POKEDATA 5 #define PTRACE_POKEUSR 6 #define PTRACE_CONT 7 #define PTRACE_KILL 8 #define PTRACE_SINGLESTEP 9 #define PTRACE_ATTACH 16 #define PTRACE_DETACH 17 #define PTRACE_SYSCALL 24 /* 0x4200-0x4300 are reserved for architecture-independent additions. */ #define PTRACE_SETOPTIONS 0x4200 #define PTRACE_GETEVENTMSG 0x4201 #define PTRACE_GETSIGINFO 0x4202 #define PTRACE_SETSIGINFO 0x4203 /* * Generic ptrace interface that exports the architecture specific regsets * using the corresponding NT_* types (which are also used in the core dump). * Please note that the NT_PRSTATUS note type in a core dump contains a full * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the * other user_regset flavors, the user_regset layout and the ELF core dump note * payload are exactly the same layout. * * This interface usage is as follows: * struct iovec iov = { buf, len}; * * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov); * * On the successful completion, iov.len will be updated by the kernel, * specifying how much the kernel has written/read to/from the user's iov.buf. */ #define PTRACE_GETREGSET 0x4204 #define PTRACE_SETREGSET 0x4205 #define PTRACE_SEIZE 0x4206 #define PTRACE_INTERRUPT 0x4207 #define PTRACE_LISTEN 0x4208 #define PTRACE_PEEKSIGINFO 0x4209 struct ptrace_peeksiginfo_args { __u64 off; /* from which siginfo to start */ __u32 flags; __s32 nr; /* how may siginfos to take */ }; #define PTRACE_GETSIGMASK 0x420a #define PTRACE_SETSIGMASK 0x420b #define PTRACE_SECCOMP_GET_FILTER 0x420c #define PTRACE_SECCOMP_GET_METADATA 0x420d struct seccomp_metadata { __u64 filter_off; /* Input: which filter */ __u64 flags; /* Output: filter's flags */ }; #define PTRACE_GET_RSEQ_CONFIGURATION 0x420f struct ptrace_rseq_configuration { __u64 rseq_abi_pointer; __u32 rseq_abi_size; __u32 signature; __u32 flags; __u32 pad; }; /* Read signals from a shared (process wide) queue */ #define PTRACE_PEEKSIGINFO_SHARED (1 << 0) /* Wait extended result codes for the above trace options. */ #define PTRACE_EVENT_FORK 1 #define PTRACE_EVENT_VFORK 2 #define PTRACE_EVENT_CLONE 3 #define PTRACE_EVENT_EXEC 4 #define PTRACE_EVENT_VFORK_DONE 5 #define PTRACE_EVENT_EXIT 6 #define PTRACE_EVENT_SECCOMP 7 /* Extended result codes which enabled by means other than options. */ #define PTRACE_EVENT_STOP 128 /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */ #define PTRACE_O_TRACESYSGOOD 1 #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) #define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP) /* eventless options */ #define PTRACE_O_EXITKILL (1 << 20) #define PTRACE_O_SUSPEND_SECCOMP (1 << 21) #define PTRACE_O_MASK (\ 0x000000ff | PTRACE_O_EXITKILL | PTRACE_O_SUSPEND_SECCOMP) #include <asm/ptrace.h> #endif /* _LINUX_PTRACE_H */ linux/qemu_fw_cfg.h 0000644 00000004645 15063602054 0010350 0 ustar 00 /* SPDX-License-Identifier: BSD-3-Clause */ #ifndef _LINUX_FW_CFG_H #define _LINUX_FW_CFG_H #include <linux/types.h> #define FW_CFG_ACPI_DEVICE_ID "QEMU0002" /* selector key values for "well-known" fw_cfg entries */ #define FW_CFG_SIGNATURE 0x00 #define FW_CFG_ID 0x01 #define FW_CFG_UUID 0x02 #define FW_CFG_RAM_SIZE 0x03 #define FW_CFG_NOGRAPHIC 0x04 #define FW_CFG_NB_CPUS 0x05 #define FW_CFG_MACHINE_ID 0x06 #define FW_CFG_KERNEL_ADDR 0x07 #define FW_CFG_KERNEL_SIZE 0x08 #define FW_CFG_KERNEL_CMDLINE 0x09 #define FW_CFG_INITRD_ADDR 0x0a #define FW_CFG_INITRD_SIZE 0x0b #define FW_CFG_BOOT_DEVICE 0x0c #define FW_CFG_NUMA 0x0d #define FW_CFG_BOOT_MENU 0x0e #define FW_CFG_MAX_CPUS 0x0f #define FW_CFG_KERNEL_ENTRY 0x10 #define FW_CFG_KERNEL_DATA 0x11 #define FW_CFG_INITRD_DATA 0x12 #define FW_CFG_CMDLINE_ADDR 0x13 #define FW_CFG_CMDLINE_SIZE 0x14 #define FW_CFG_CMDLINE_DATA 0x15 #define FW_CFG_SETUP_ADDR 0x16 #define FW_CFG_SETUP_SIZE 0x17 #define FW_CFG_SETUP_DATA 0x18 #define FW_CFG_FILE_DIR 0x19 #define FW_CFG_FILE_FIRST 0x20 #define FW_CFG_FILE_SLOTS_MIN 0x10 #define FW_CFG_WRITE_CHANNEL 0x4000 #define FW_CFG_ARCH_LOCAL 0x8000 #define FW_CFG_ENTRY_MASK (~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)) #define FW_CFG_INVALID 0xffff /* width in bytes of fw_cfg control register */ #define FW_CFG_CTL_SIZE 0x02 /* fw_cfg "file name" is up to 56 characters (including terminating nul) */ #define FW_CFG_MAX_FILE_PATH 56 /* size in bytes of fw_cfg signature */ #define FW_CFG_SIG_SIZE 4 /* FW_CFG_ID bits */ #define FW_CFG_VERSION 0x01 #define FW_CFG_VERSION_DMA 0x02 /* fw_cfg file directory entry type */ struct fw_cfg_file { __be32 size; __be16 select; __u16 reserved; char name[FW_CFG_MAX_FILE_PATH]; }; /* FW_CFG_DMA_CONTROL bits */ #define FW_CFG_DMA_CTL_ERROR 0x01 #define FW_CFG_DMA_CTL_READ 0x02 #define FW_CFG_DMA_CTL_SKIP 0x04 #define FW_CFG_DMA_CTL_SELECT 0x08 #define FW_CFG_DMA_CTL_WRITE 0x10 #define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */ /* Control as first field allows for different structures selected by this * field, which might be useful in the future */ struct fw_cfg_dma_access { __be32 control; __be32 length; __be64 address; }; #define FW_CFG_VMCOREINFO_FILENAME "etc/vmcoreinfo" #define FW_CFG_VMCOREINFO_FORMAT_NONE 0x0 #define FW_CFG_VMCOREINFO_FORMAT_ELF 0x1 struct fw_cfg_vmcoreinfo { __le16 host_format; __le16 guest_format; __le32 size; __le64 paddr; }; #endif linux/qnx4_fs.h 0000644 00000004430 15063602054 0007440 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Name : qnx4_fs.h * Author : Richard Frowijn * Function : qnx4 global filesystem definitions * History : 23-03-1998 created */ #ifndef _LINUX_QNX4_FS_H #define _LINUX_QNX4_FS_H #include <linux/types.h> #include <linux/qnxtypes.h> #include <linux/magic.h> #define QNX4_ROOT_INO 1 #define QNX4_MAX_XTNTS_PER_XBLK 60 /* for di_status */ #define QNX4_FILE_USED 0x01 #define QNX4_FILE_MODIFIED 0x02 #define QNX4_FILE_BUSY 0x04 #define QNX4_FILE_LINK 0x08 #define QNX4_FILE_INODE 0x10 #define QNX4_FILE_FSYSCLEAN 0x20 #define QNX4_I_MAP_SLOTS 8 #define QNX4_Z_MAP_SLOTS 64 #define QNX4_VALID_FS 0x0001 /* Clean fs. */ #define QNX4_ERROR_FS 0x0002 /* fs has errors. */ #define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ #define QNX4_BLOCK_SIZE_BITS 9 /* blocksize shift */ #define QNX4_DIR_ENTRY_SIZE 0x040 /* dir entry size of 64 bytes */ #define QNX4_DIR_ENTRY_SIZE_BITS 6 /* dir entry size shift */ #define QNX4_XBLK_ENTRY_SIZE 0x200 /* xblk entry size */ #define QNX4_INODES_PER_BLOCK 0x08 /* 512 / 64 */ /* for filenames */ #define QNX4_SHORT_NAME_MAX 16 #define QNX4_NAME_MAX 48 /* * This is the original qnx4 inode layout on disk. */ struct qnx4_inode_entry { char di_fname[QNX4_SHORT_NAME_MAX]; qnx4_off_t di_size; qnx4_xtnt_t di_first_xtnt; __le32 di_xblk; __le32 di_ftime; __le32 di_mtime; __le32 di_atime; __le32 di_ctime; qnx4_nxtnt_t di_num_xtnts; qnx4_mode_t di_mode; qnx4_muid_t di_uid; qnx4_mgid_t di_gid; qnx4_nlink_t di_nlink; __u8 di_zero[4]; qnx4_ftype_t di_type; __u8 di_status; }; struct qnx4_link_info { char dl_fname[QNX4_NAME_MAX]; __le32 dl_inode_blk; __u8 dl_inode_ndx; __u8 dl_spare[10]; __u8 dl_status; }; struct qnx4_xblk { __le32 xblk_next_xblk; __le32 xblk_prev_xblk; __u8 xblk_num_xtnts; __u8 xblk_spare[3]; __le32 xblk_num_blocks; qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK]; char xblk_signature[8]; qnx4_xtnt_t xblk_first_xtnt; }; struct qnx4_super_block { struct qnx4_inode_entry RootDir; struct qnx4_inode_entry Inode; struct qnx4_inode_entry Boot; struct qnx4_inode_entry AltBoot; }; #endif linux/qnxtypes.h 0000644 00000001160 15063602054 0007746 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Name : qnxtypes.h * Author : Richard Frowijn * Function : standard qnx types * History : 22-03-1998 created * */ #ifndef _QNX4TYPES_H #define _QNX4TYPES_H #include <linux/types.h> typedef __le16 qnx4_nxtnt_t; typedef __u8 qnx4_ftype_t; typedef struct { __le32 xtnt_blk; __le32 xtnt_size; } qnx4_xtnt_t; typedef __le16 qnx4_mode_t; typedef __le16 qnx4_muid_t; typedef __le16 qnx4_mgid_t; typedef __le32 qnx4_off_t; typedef __le16 qnx4_nlink_t; #endif linux/qrtr.h 0000644 00000001575 15063602054 0007055 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_QRTR_H #define _LINUX_QRTR_H #include <linux/socket.h> #include <linux/types.h> #define QRTR_NODE_BCAST 0xffffffffu #define QRTR_PORT_CTRL 0xfffffffeu struct sockaddr_qrtr { __kernel_sa_family_t sq_family; __u32 sq_node; __u32 sq_port; }; enum qrtr_pkt_type { QRTR_TYPE_DATA = 1, QRTR_TYPE_HELLO = 2, QRTR_TYPE_BYE = 3, QRTR_TYPE_NEW_SERVER = 4, QRTR_TYPE_DEL_SERVER = 5, QRTR_TYPE_DEL_CLIENT = 6, QRTR_TYPE_RESUME_TX = 7, QRTR_TYPE_EXIT = 8, QRTR_TYPE_PING = 9, QRTR_TYPE_NEW_LOOKUP = 10, QRTR_TYPE_DEL_LOOKUP = 11, }; struct qrtr_ctrl_pkt { __le32 cmd; union { struct { __le32 service; __le32 instance; __le32 node; __le32 port; } server; struct { __le32 node; __le32 port; } client; }; } __attribute__((packed)); #endif /* _LINUX_QRTR_H */ linux/quota.h 0000644 00000014223 15063602054 0007210 0 ustar 00 /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Robert Elz at The University of Melbourne. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_QUOTA_ #define _LINUX_QUOTA_ #include <linux/types.h> #define __DQUOT_VERSION__ "dquot_6.6.0" #define MAXQUOTAS 3 #define USRQUOTA 0 /* element used for user quotas */ #define GRPQUOTA 1 /* element used for group quotas */ #define PRJQUOTA 2 /* element used for project quotas */ /* * Definitions for the default names of the quotas files. */ #define INITQFNAMES { \ "user", /* USRQUOTA */ \ "group", /* GRPQUOTA */ \ "project", /* PRJQUOTA */ \ "undefined", \ }; /* * Command definitions for the 'quotactl' system call. * The commands are broken into a main command defined below * and a subcommand that is used to convey the type of * quota that is being manipulated (see above). */ #define SUBCMDMASK 0x00ff #define SUBCMDSHIFT 8 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) #define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ #define Q_QUOTAON 0x800002 /* turn quotas on */ #define Q_QUOTAOFF 0x800003 /* turn quotas off */ #define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ #define Q_GETINFO 0x800005 /* get information about quota files */ #define Q_SETINFO 0x800006 /* set information about quota files */ #define Q_GETQUOTA 0x800007 /* get user quota structure */ #define Q_SETQUOTA 0x800008 /* set user quota structure */ #define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */ /* Quota format type IDs */ #define QFMT_VFS_OLD 1 #define QFMT_VFS_V0 2 #define QFMT_OCFS2 3 #define QFMT_VFS_V1 4 /* Size of block in which space limits are passed through the quota * interface */ #define QIF_DQBLKSIZE_BITS 10 #define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS) /* * Quota structure used for communication with userspace via quotactl * Following flags are used to specify which fields are valid */ enum { QIF_BLIMITS_B = 0, QIF_SPACE_B, QIF_ILIMITS_B, QIF_INODES_B, QIF_BTIME_B, QIF_ITIME_B, }; #define QIF_BLIMITS (1 << QIF_BLIMITS_B) #define QIF_SPACE (1 << QIF_SPACE_B) #define QIF_ILIMITS (1 << QIF_ILIMITS_B) #define QIF_INODES (1 << QIF_INODES_B) #define QIF_BTIME (1 << QIF_BTIME_B) #define QIF_ITIME (1 << QIF_ITIME_B) #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) #define QIF_USAGE (QIF_SPACE | QIF_INODES) #define QIF_TIMES (QIF_BTIME | QIF_ITIME) #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) struct if_dqblk { __u64 dqb_bhardlimit; __u64 dqb_bsoftlimit; __u64 dqb_curspace; __u64 dqb_ihardlimit; __u64 dqb_isoftlimit; __u64 dqb_curinodes; __u64 dqb_btime; __u64 dqb_itime; __u32 dqb_valid; }; struct if_nextdqblk { __u64 dqb_bhardlimit; __u64 dqb_bsoftlimit; __u64 dqb_curspace; __u64 dqb_ihardlimit; __u64 dqb_isoftlimit; __u64 dqb_curinodes; __u64 dqb_btime; __u64 dqb_itime; __u32 dqb_valid; __u32 dqb_id; }; /* * Structure used for setting quota information about file via quotactl * Following flags are used to specify which fields are valid */ #define IIF_BGRACE 1 #define IIF_IGRACE 2 #define IIF_FLAGS 4 #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) enum { DQF_ROOT_SQUASH_B = 0, DQF_SYS_FILE_B = 16, /* Kernel internal flags invisible to userspace */ DQF_PRIVATE }; /* Root squash enabled (for v1 quota format) */ #define DQF_ROOT_SQUASH (1 << DQF_ROOT_SQUASH_B) /* Quota stored in a system file */ #define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) struct if_dqinfo { __u64 dqi_bgrace; __u64 dqi_igrace; __u32 dqi_flags; /* DFQ_* */ __u32 dqi_valid; }; /* * Definitions for quota netlink interface */ #define QUOTA_NL_NOWARN 0 #define QUOTA_NL_IHARDWARN 1 /* Inode hardlimit reached */ #define QUOTA_NL_ISOFTLONGWARN 2 /* Inode grace time expired */ #define QUOTA_NL_ISOFTWARN 3 /* Inode softlimit reached */ #define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */ #define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */ #define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */ #define QUOTA_NL_IHARDBELOW 7 /* Usage got below inode hardlimit */ #define QUOTA_NL_ISOFTBELOW 8 /* Usage got below inode softlimit */ #define QUOTA_NL_BHARDBELOW 9 /* Usage got below block hardlimit */ #define QUOTA_NL_BSOFTBELOW 10 /* Usage got below block softlimit */ enum { QUOTA_NL_C_UNSPEC, QUOTA_NL_C_WARNING, __QUOTA_NL_C_MAX, }; #define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1) enum { QUOTA_NL_A_UNSPEC, QUOTA_NL_A_QTYPE, QUOTA_NL_A_EXCESS_ID, QUOTA_NL_A_WARNING, QUOTA_NL_A_DEV_MAJOR, QUOTA_NL_A_DEV_MINOR, QUOTA_NL_A_CAUSED_ID, QUOTA_NL_A_PAD, __QUOTA_NL_A_MAX, }; #define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1) #endif /* _LINUX_QUOTA_ */ linux/radeonfb.h 0000644 00000000550 15063602054 0007635 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_RADEONFB_H__ #define __LINUX_RADEONFB_H__ #include <asm/ioctl.h> #include <linux/types.h> #define ATY_RADEON_LCD_ON 0x00000001 #define ATY_RADEON_CRT_ON 0x00000002 #define FBIO_RADEON_GET_MIRROR _IOR('@', 3, size_t) #define FBIO_RADEON_SET_MIRROR _IOW('@', 4, size_t) #endif linux/random.h 0000644 00000002532 15063602054 0007337 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/random.h * * Include file for the random number generator. */ #ifndef _LINUX_RANDOM_H #define _LINUX_RANDOM_H #include <linux/types.h> #include <linux/ioctl.h> #include <linux/irqnr.h> /* ioctl()'s for the random number generator */ /* Get the entropy count. */ #define RNDGETENTCNT _IOR( 'R', 0x00, int ) /* Add to (or subtract from) the entropy count. (Superuser only.) */ #define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) /* Get the contents of the entropy pool. (Superuser only.) */ #define RNDGETPOOL _IOR( 'R', 0x02, int [2] ) /* * Write bytes into the entropy pool and add to the entropy count. * (Superuser only.) */ #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] ) /* Clear entropy count to 0. (Superuser only.) */ #define RNDZAPENTCNT _IO( 'R', 0x04 ) /* Clear the entropy pool and associated counters. (Superuser only.) */ #define RNDCLEARPOOL _IO( 'R', 0x06 ) /* Reseed CRNG. (Superuser only.) */ #define RNDRESEEDCRNG _IO( 'R', 0x07 ) struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; }; /* * Flags for getrandom(2) * * GRND_NONBLOCK Don't block and return EAGAIN instead * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom */ #define GRND_NONBLOCK 0x0001 #define GRND_RANDOM 0x0002 #endif /* _LINUX_RANDOM_H */ linux/raw.h 0000644 00000000555 15063602054 0006653 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_RAW_H #define __LINUX_RAW_H #include <linux/types.h> #define RAW_SETBIND _IO( 0xac, 0 ) #define RAW_GETBIND _IO( 0xac, 1 ) struct raw_config_request { int raw_minor; __u64 block_major; __u64 block_minor; }; #define MAX_RAW_MINORS CONFIG_MAX_RAW_DEVS #endif /* __LINUX_RAW_H */ linux/rds.h 0000644 00000022125 15063602054 0006647 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2008 Oracle. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #ifndef _LINUX_RDS_H #define _LINUX_RDS_H #include <linux/types.h> #include <linux/socket.h> /* For __kernel_sockaddr_storage. */ #define RDS_IB_ABI_VERSION 0x301 #define SOL_RDS 276 /* * setsockopt/getsockopt for SOL_RDS */ #define RDS_CANCEL_SENT_TO 1 #define RDS_GET_MR 2 #define RDS_FREE_MR 3 /* deprecated: RDS_BARRIER 4 */ #define RDS_RECVERR 5 #define RDS_CONG_MONITOR 6 #define RDS_GET_MR_FOR_DEST 7 #define SO_RDS_TRANSPORT 8 /* Socket option to tap receive path latency * SO_RDS: SO_RDS_MSG_RXPATH_LATENCY * Format used struct rds_rx_trace_so */ #define SO_RDS_MSG_RXPATH_LATENCY 10 /* supported values for SO_RDS_TRANSPORT */ #define RDS_TRANS_IB 0 #define RDS_TRANS_IWARP 1 #define RDS_TRANS_TCP 2 #define RDS_TRANS_COUNT 3 #define RDS_TRANS_NONE (~0) /* * Control message types for SOL_RDS. * * CMSG_RDMA_ARGS (sendmsg) * Request a RDMA transfer to/from the specified * memory ranges. * The cmsg_data is a struct rds_rdma_args. * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg) * Kernel informs application about intended * source/destination of a RDMA transfer * RDS_CMSG_RDMA_MAP (sendmsg) * Application asks kernel to map the given * memory range into a IB MR, and send the * R_Key along in an RDS extension header. * The cmsg_data is a struct rds_get_mr_args, * the same as for the GET_MR setsockopt. * RDS_CMSG_RDMA_STATUS (recvmsg) * Returns the status of a completed RDMA operation. * RDS_CMSG_RXPATH_LATENCY(recvmsg) * Returns rds message latencies in various stages of receive * path in nS. Its set per socket using SO_RDS_MSG_RXPATH_LATENCY * socket option. Legitimate points are defined in * enum rds_message_rxpath_latency. More points can be added in * future. CSMG format is struct rds_cmsg_rx_trace. */ #define RDS_CMSG_RDMA_ARGS 1 #define RDS_CMSG_RDMA_DEST 2 #define RDS_CMSG_RDMA_MAP 3 #define RDS_CMSG_RDMA_STATUS 4 #define RDS_CMSG_CONG_UPDATE 5 #define RDS_CMSG_ATOMIC_FADD 6 #define RDS_CMSG_ATOMIC_CSWP 7 #define RDS_CMSG_MASKED_ATOMIC_FADD 8 #define RDS_CMSG_MASKED_ATOMIC_CSWP 9 #define RDS_CMSG_RXPATH_LATENCY 11 #define RDS_CMSG_ZCOPY_COOKIE 12 #define RDS_CMSG_ZCOPY_COMPLETION 13 #define RDS_INFO_FIRST 10000 #define RDS_INFO_COUNTERS 10000 #define RDS_INFO_CONNECTIONS 10001 /* 10002 aka RDS_INFO_FLOWS is deprecated */ #define RDS_INFO_SEND_MESSAGES 10003 #define RDS_INFO_RETRANS_MESSAGES 10004 #define RDS_INFO_RECV_MESSAGES 10005 #define RDS_INFO_SOCKETS 10006 #define RDS_INFO_TCP_SOCKETS 10007 #define RDS_INFO_IB_CONNECTIONS 10008 #define RDS_INFO_CONNECTION_STATS 10009 #define RDS_INFO_IWARP_CONNECTIONS 10010 #define RDS_INFO_LAST 10010 struct rds_info_counter { __u8 name[32]; __u64 value; } __attribute__((packed)); #define RDS_INFO_CONNECTION_FLAG_SENDING 0x01 #define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02 #define RDS_INFO_CONNECTION_FLAG_CONNECTED 0x04 #define TRANSNAMSIZ 16 struct rds_info_connection { __u64 next_tx_seq; __u64 next_rx_seq; __be32 laddr; __be32 faddr; __u8 transport[TRANSNAMSIZ]; /* null term ascii */ __u8 flags; } __attribute__((packed)); #define RDS_INFO_MESSAGE_FLAG_ACK 0x01 #define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02 struct rds_info_message { __u64 seq; __u32 len; __be32 laddr; __be32 faddr; __be16 lport; __be16 fport; __u8 flags; } __attribute__((packed)); struct rds_info_socket { __u32 sndbuf; __be32 bound_addr; __be32 connected_addr; __be16 bound_port; __be16 connected_port; __u32 rcvbuf; __u64 inum; } __attribute__((packed)); struct rds_info_tcp_socket { __be32 local_addr; __be16 local_port; __be32 peer_addr; __be16 peer_port; __u64 hdr_rem; __u64 data_rem; __u32 last_sent_nxt; __u32 last_expected_una; __u32 last_seen_una; } __attribute__((packed)); #define RDS_IB_GID_LEN 16 struct rds_info_rdma_connection { __be32 src_addr; __be32 dst_addr; __u8 src_gid[RDS_IB_GID_LEN]; __u8 dst_gid[RDS_IB_GID_LEN]; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 rdma_mr_max; __u32 rdma_mr_size; }; /* RDS message Receive Path Latency points */ enum rds_message_rxpath_latency { RDS_MSG_RX_HDR_TO_DGRAM_START = 0, RDS_MSG_RX_DGRAM_REASSEMBLE, RDS_MSG_RX_DGRAM_DELIVERED, RDS_MSG_RX_DGRAM_TRACE_MAX }; struct rds_rx_trace_so { __u8 rx_traces; __u8 rx_trace_pos[RDS_MSG_RX_DGRAM_TRACE_MAX]; }; struct rds_cmsg_rx_trace { __u8 rx_traces; __u8 rx_trace_pos[RDS_MSG_RX_DGRAM_TRACE_MAX]; __u64 rx_trace[RDS_MSG_RX_DGRAM_TRACE_MAX]; }; /* * Congestion monitoring. * Congestion control in RDS happens at the host connection * level by exchanging a bitmap marking congested ports. * By default, a process sleeping in poll() is always woken * up when the congestion map is updated. * With explicit monitoring, an application can have more * fine-grained control. * The application installs a 64bit mask value in the socket, * where each bit corresponds to a group of ports. * When a congestion update arrives, RDS checks the set of * ports that are now uncongested against the list bit mask * installed in the socket, and if they overlap, we queue a * cong_notification on the socket. * * To install the congestion monitor bitmask, use RDS_CONG_MONITOR * with the 64bit mask. * Congestion updates are received via RDS_CMSG_CONG_UPDATE * control messages. * * The correspondence between bits and ports is * 1 << (portnum % 64) */ #define RDS_CONG_MONITOR_SIZE 64 #define RDS_CONG_MONITOR_BIT(port) (((unsigned int) port) % RDS_CONG_MONITOR_SIZE) #define RDS_CONG_MONITOR_MASK(port) (1ULL << RDS_CONG_MONITOR_BIT(port)) /* * RDMA related types */ /* * This encapsulates a remote memory location. * In the current implementation, it contains the R_Key * of the remote memory region, and the offset into it * (so that the application does not have to worry about * alignment). */ typedef __u64 rds_rdma_cookie_t; struct rds_iovec { __u64 addr; __u64 bytes; }; struct rds_get_mr_args { struct rds_iovec vec; __u64 cookie_addr; __u64 flags; }; struct rds_get_mr_for_dest_args { struct __kernel_sockaddr_storage dest_addr; struct rds_iovec vec; __u64 cookie_addr; __u64 flags; }; struct rds_free_mr_args { rds_rdma_cookie_t cookie; __u64 flags; }; struct rds_rdma_args { rds_rdma_cookie_t cookie; struct rds_iovec remote_vec; __u64 local_vec_addr; __u64 nr_local; __u64 flags; __u64 user_token; }; struct rds_atomic_args { rds_rdma_cookie_t cookie; __u64 local_addr; __u64 remote_addr; union { struct { __u64 compare; __u64 swap; } cswp; struct { __u64 add; } fadd; struct { __u64 compare; __u64 swap; __u64 compare_mask; __u64 swap_mask; } m_cswp; struct { __u64 add; __u64 nocarry_mask; } m_fadd; }; __u64 flags; __u64 user_token; }; struct rds_rdma_notify { __u64 user_token; __s32 status; }; #define RDS_RDMA_SUCCESS 0 #define RDS_RDMA_REMOTE_ERROR 1 #define RDS_RDMA_CANCELED 2 #define RDS_RDMA_DROPPED 3 #define RDS_RDMA_OTHER_ERROR 4 #define RDS_MAX_ZCOOKIES 8 struct rds_zcopy_cookies { __u32 num; __u32 cookies[RDS_MAX_ZCOOKIES]; }; /* * Common set of flags for all RDMA related structs */ #define RDS_RDMA_READWRITE 0x0001 #define RDS_RDMA_FENCE 0x0002 /* use FENCE for immediate send */ #define RDS_RDMA_INVALIDATE 0x0004 /* invalidate R_Key after freeing MR */ #define RDS_RDMA_USE_ONCE 0x0008 /* free MR after use */ #define RDS_RDMA_DONTWAIT 0x0010 /* Don't wait in SET_BARRIER */ #define RDS_RDMA_NOTIFY_ME 0x0020 /* Notify when operation completes */ #define RDS_RDMA_SILENT 0x0040 /* Do not interrupt remote */ #endif /* IB_RDS_H */ linux/reboot.h 0000644 00000002477 15063602054 0007361 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_REBOOT_H #define _LINUX_REBOOT_H /* * Magic values required to use _reboot() system call. */ #define LINUX_REBOOT_MAGIC1 0xfee1dead #define LINUX_REBOOT_MAGIC2 672274793 #define LINUX_REBOOT_MAGIC2A 85072278 #define LINUX_REBOOT_MAGIC2B 369367448 #define LINUX_REBOOT_MAGIC2C 537993216 /* * Commands accepted by the _reboot() system call. * * RESTART Restart system using default command and mode. * HALT Stop OS and give system control to ROM monitor, if any. * CAD_ON Ctrl-Alt-Del sequence causes RESTART command. * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task. * POWER_OFF Stop OS and remove all power from system, if possible. * RESTART2 Restart system using given command string. * SW_SUSPEND Suspend system using software suspend if compiled in. * KEXEC Restart system using a previously loaded Linux kernel */ #define LINUX_REBOOT_CMD_RESTART 0x01234567 #define LINUX_REBOOT_CMD_HALT 0xCDEF0123 #define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF #define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 #define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2 #define LINUX_REBOOT_CMD_KEXEC 0x45584543 #endif /* _LINUX_REBOOT_H */ linux/reiserfs_fs.h 0000644 00000001407 15063602054 0010371 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details */ #ifndef _LINUX_REISER_FS_H #define _LINUX_REISER_FS_H #include <linux/types.h> #include <linux/magic.h> /* * include/linux/reiser_fs.h * * Reiser File System constants and structures * */ /* ioctl's command */ #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) /* define following flags to be the same as in ext2, so that chattr(1), lsattr(1) will work with us. */ #define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS #define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION #endif /* _LINUX_REISER_FS_H */ linux/reiserfs_xattr.h 0000644 00000001025 15063602054 0011117 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* File: linux/reiserfs_xattr.h */ #ifndef _LINUX_REISERFS_XATTR_H #define _LINUX_REISERFS_XATTR_H #include <linux/types.h> /* Magic value in header */ #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ struct reiserfs_xattr_header { __le32 h_magic; /* magic number for identification */ __le32 h_hash; /* hash of the value */ }; struct reiserfs_security_handle { const char *name; void *value; size_t length; }; #endif /* _LINUX_REISERFS_XATTR_H */ linux/resource.h 0000644 00000004453 15063602054 0007712 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_RESOURCE_H #define _LINUX_RESOURCE_H #include <linux/time.h> #include <linux/types.h> /* * Resource control/accounting header file for linux */ /* * Definition of struct rusage taken from BSD 4.3 Reno * * We don't support all of these yet, but we might as well have them.... * Otherwise, each time we add new items, programs which depend on this * structure will lose. This reduces the chances of that happening. */ #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN (-1) #define RUSAGE_BOTH (-2) /* sys_wait4() uses this */ #define RUSAGE_THREAD 1 /* only the calling thread */ struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ __kernel_long_t ru_maxrss; /* maximum resident set size */ __kernel_long_t ru_ixrss; /* integral shared memory size */ __kernel_long_t ru_idrss; /* integral unshared data size */ __kernel_long_t ru_isrss; /* integral unshared stack size */ __kernel_long_t ru_minflt; /* page reclaims */ __kernel_long_t ru_majflt; /* page faults */ __kernel_long_t ru_nswap; /* swaps */ __kernel_long_t ru_inblock; /* block input operations */ __kernel_long_t ru_oublock; /* block output operations */ __kernel_long_t ru_msgsnd; /* messages sent */ __kernel_long_t ru_msgrcv; /* messages received */ __kernel_long_t ru_nsignals; /* signals received */ __kernel_long_t ru_nvcsw; /* voluntary context switches */ __kernel_long_t ru_nivcsw; /* involuntary " */ }; struct rlimit { __kernel_ulong_t rlim_cur; __kernel_ulong_t rlim_max; }; #define RLIM64_INFINITY (~0ULL) struct rlimit64 { __u64 rlim_cur; __u64 rlim_max; }; #define PRIO_MIN (-20) #define PRIO_MAX 20 #define PRIO_PROCESS 0 #define PRIO_PGRP 1 #define PRIO_USER 2 /* * Limit the stack by to some sane default: root can always * increase this limit if needed.. 8MB seems reasonable. */ #define _STK_LIM (8*1024*1024) /* * GPG2 wants 64kB of mlocked memory, to make sure pass phrases * and other sensitive information are never written to disk. */ #define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) /* * Due to binary compatibility, the actual resource numbers * may be different for different linux versions.. */ #include <asm/resource.h> #endif /* _LINUX_RESOURCE_H */ linux/rfkill.h 0000644 00000014720 15063602054 0007344 0 ustar 00 /* * Copyright (C) 2006 - 2007 Ivo van Doorn * Copyright (C) 2007 Dmitry Torokhov * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __RFKILL_H #define __RFKILL_H #include <linux/types.h> /* define userspace visible states */ #define RFKILL_STATE_SOFT_BLOCKED 0 #define RFKILL_STATE_UNBLOCKED 1 #define RFKILL_STATE_HARD_BLOCKED 2 /** * enum rfkill_type - type of rfkill switch. * * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type) * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. * @RFKILL_TYPE_GPS: switch is on a GPS device. * @RFKILL_TYPE_FM: switch is on a FM radio device. * @RFKILL_TYPE_NFC: switch is on an NFC device. * @NUM_RFKILL_TYPES: number of defined rfkill types */ enum rfkill_type { RFKILL_TYPE_ALL = 0, RFKILL_TYPE_WLAN, RFKILL_TYPE_BLUETOOTH, RFKILL_TYPE_UWB, RFKILL_TYPE_WIMAX, RFKILL_TYPE_WWAN, RFKILL_TYPE_GPS, RFKILL_TYPE_FM, RFKILL_TYPE_NFC, NUM_RFKILL_TYPES, }; /** * enum rfkill_operation - operation types * @RFKILL_OP_ADD: a device was added * @RFKILL_OP_DEL: a device was removed * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) * into a state, also updating the default state used for devices that * are hot-plugged later. */ enum rfkill_operation { RFKILL_OP_ADD = 0, RFKILL_OP_DEL, RFKILL_OP_CHANGE, RFKILL_OP_CHANGE_ALL, }; /** * enum rfkill_hard_block_reasons - hard block reasons * @RFKILL_HARD_BLOCK_SIGNAL: the hardware rfkill signal is active * @RFKILL_HARD_BLOCK_NOT_OWNER: the NIC is not owned by the host */ enum rfkill_hard_block_reasons { RFKILL_HARD_BLOCK_SIGNAL = 1 << 0, RFKILL_HARD_BLOCK_NOT_OWNER = 1 << 1, }; /** * struct rfkill_event - events for userspace on /dev/rfkill * @idx: index of dev rfkill * @type: type of the rfkill struct * @op: operation code * @hard: hard state (0/1) * @soft: soft state (0/1) * * Structure used for userspace communication on /dev/rfkill, * used for events from the kernel and control to the kernel. */ struct rfkill_event { __u32 idx; __u8 type; __u8 op; __u8 soft; __u8 hard; } __attribute__((packed)); /** * struct rfkill_event_ext - events for userspace on /dev/rfkill * @idx: index of dev rfkill * @type: type of the rfkill struct * @op: operation code * @hard: hard state (0/1) * @soft: soft state (0/1) * @hard_block_reasons: valid if hard is set. One or several reasons from * &enum rfkill_hard_block_reasons. * * Structure used for userspace communication on /dev/rfkill, * used for events from the kernel and control to the kernel. * * See the extensibility docs below. */ struct rfkill_event_ext { __u32 idx; __u8 type; __u8 op; __u8 soft; __u8 hard; /* * older kernels will accept/send only up to this point, * and if extended further up to any chunk marked below */ __u8 hard_block_reasons; } __attribute__((packed)); /** * DOC: Extensibility * * Originally, we had planned to allow backward and forward compatible * changes by just adding fields at the end of the structure that are * then not reported on older kernels on read(), and not written to by * older kernels on write(), with the kernel reporting the size it did * accept as the result. * * This would have allowed userspace to detect on read() and write() * which kernel structure version it was dealing with, and if was just * recompiled it would have gotten the new fields, but obviously not * accessed them, but things should've continued to work. * * Unfortunately, while actually exercising this mechanism to add the * hard block reasons field, we found that userspace (notably systemd) * did all kinds of fun things not in line with this scheme: * * 1. treat the (expected) short writes as an error; * 2. ask to read sizeof(struct rfkill_event) but then compare the * actual return value to RFKILL_EVENT_SIZE_V1 and treat any * mismatch as an error. * * As a consequence, just recompiling with a new struct version caused * things to no longer work correctly on old and new kernels. * * Hence, we've rolled back &struct rfkill_event to the original version * and added &struct rfkill_event_ext. This effectively reverts to the * old behaviour for all userspace, unless it explicitly opts in to the * rules outlined here by using the new &struct rfkill_event_ext. * * Additionally, some other userspace (bluez, g-s-d) was reading with a * large size but as streaming reads rather than message-based, or with * too strict checks for the returned size. So eventually, we completely * reverted this, and extended messages need to be opted in to by using * an ioctl: * * ioctl(fd, RFKILL_IOCTL_MAX_SIZE, sizeof(struct rfkill_event_ext)); * * Userspace using &struct rfkill_event_ext and the ioctl must adhere to * the following rules: * * 1. accept short writes, optionally using them to detect that it's * running on an older kernel; * 2. accept short reads, knowing that this means it's running on an * older kernel; * 3. treat reads that are as long as requested as acceptable, not * checking against RFKILL_EVENT_SIZE_V1 or such. */ #define RFKILL_EVENT_SIZE_V1 sizeof(struct rfkill_event) /* ioctl for turning off rfkill-input (if present) */ #define RFKILL_IOC_MAGIC 'R' #define RFKILL_IOC_NOINPUT 1 #define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) #define RFKILL_IOC_MAX_SIZE 2 #define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_EXT_SIZE, __u32) /* and that's all userspace gets */ #endif /* __RFKILL_H */ linux/rio_cm_cdev.h 0000644 00000006260 15063602054 0010332 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Copyright (c) 2015, Integrated Device Technology Inc. * Copyright (c) 2015, Prodrive Technologies * Copyright (c) 2015, RapidIO Trade Association * All rights reserved. * * This software is available to you under a choice of one of two licenses. * You may choose to be licensed under the terms of the GNU General Public * License(GPL) Version 2, or the BSD-3 Clause license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RIO_CM_CDEV_H_ #define _RIO_CM_CDEV_H_ #include <linux/types.h> struct rio_cm_channel { __u16 id; __u16 remote_channel; __u16 remote_destid; __u8 mport_id; }; struct rio_cm_msg { __u16 ch_num; __u16 size; __u32 rxto; /* receive timeout in mSec. 0 = blocking */ __u64 msg; }; struct rio_cm_accept { __u16 ch_num; __u16 pad0; __u32 wait_to; /* accept timeout in mSec. 0 = blocking */ }; /* RapidIO Channelized Messaging Driver IOCTLs */ #define RIO_CM_IOC_MAGIC 'c' #define RIO_CM_EP_GET_LIST_SIZE _IOWR(RIO_CM_IOC_MAGIC, 1, __u32) #define RIO_CM_EP_GET_LIST _IOWR(RIO_CM_IOC_MAGIC, 2, __u32) #define RIO_CM_CHAN_CREATE _IOWR(RIO_CM_IOC_MAGIC, 3, __u16) #define RIO_CM_CHAN_CLOSE _IOW(RIO_CM_IOC_MAGIC, 4, __u16) #define RIO_CM_CHAN_BIND _IOW(RIO_CM_IOC_MAGIC, 5, struct rio_cm_channel) #define RIO_CM_CHAN_LISTEN _IOW(RIO_CM_IOC_MAGIC, 6, __u16) #define RIO_CM_CHAN_ACCEPT _IOWR(RIO_CM_IOC_MAGIC, 7, struct rio_cm_accept) #define RIO_CM_CHAN_CONNECT _IOW(RIO_CM_IOC_MAGIC, 8, struct rio_cm_channel) #define RIO_CM_CHAN_SEND _IOW(RIO_CM_IOC_MAGIC, 9, struct rio_cm_msg) #define RIO_CM_CHAN_RECEIVE _IOWR(RIO_CM_IOC_MAGIC, 10, struct rio_cm_msg) #define RIO_CM_MPORT_GET_LIST _IOWR(RIO_CM_IOC_MAGIC, 11, __u32) #endif /* _RIO_CM_CDEV_H_ */ linux/rio_mport_cdev.h 0000644 00000022162 15063602054 0011073 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Copyright (c) 2015-2016, Integrated Device Technology Inc. * Copyright (c) 2015, Prodrive Technologies * Copyright (c) 2015, Texas Instruments Incorporated * Copyright (c) 2015, RapidIO Trade Association * All rights reserved. * * This software is available to you under a choice of one of two licenses. * You may choose to be licensed under the terms of the GNU General Public * License(GPL) Version 2, or the BSD-3 Clause license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RIO_MPORT_CDEV_H_ #define _RIO_MPORT_CDEV_H_ #include <linux/ioctl.h> #include <linux/types.h> struct rio_mport_maint_io { __u16 rioid; /* destID of remote device */ __u8 hopcount; /* hopcount to remote device */ __u8 pad0[5]; __u32 offset; /* offset in register space */ __u32 length; /* length in bytes */ __u64 buffer; /* pointer to data buffer */ }; /* * Definitions for RapidIO data transfers: * - memory mapped (MAPPED) * - packet generation from memory (TRANSFER) */ #define RIO_TRANSFER_MODE_MAPPED (1 << 0) #define RIO_TRANSFER_MODE_TRANSFER (1 << 1) #define RIO_CAP_DBL_SEND (1 << 2) #define RIO_CAP_DBL_RECV (1 << 3) #define RIO_CAP_PW_SEND (1 << 4) #define RIO_CAP_PW_RECV (1 << 5) #define RIO_CAP_MAP_OUTB (1 << 6) #define RIO_CAP_MAP_INB (1 << 7) struct rio_mport_properties { __u16 hdid; __u8 id; /* Physical port ID */ __u8 index; __u32 flags; __u32 sys_size; /* Default addressing size */ __u8 port_ok; __u8 link_speed; __u8 link_width; __u8 pad0; __u32 dma_max_sge; __u32 dma_max_size; __u32 dma_align; __u32 transfer_mode; /* Default transfer mode */ __u32 cap_sys_size; /* Capable system sizes */ __u32 cap_addr_size; /* Capable addressing sizes */ __u32 cap_transfer_mode; /* Capable transfer modes */ __u32 cap_mport; /* Mport capabilities */ }; /* * Definitions for RapidIO events; * - incoming port-writes * - incoming doorbells */ #define RIO_DOORBELL (1 << 0) #define RIO_PORTWRITE (1 << 1) struct rio_doorbell { __u16 rioid; __u16 payload; }; struct rio_doorbell_filter { __u16 rioid; /* Use RIO_INVALID_DESTID to match all ids */ __u16 low; __u16 high; __u16 pad0; }; struct rio_portwrite { __u32 payload[16]; }; struct rio_pw_filter { __u32 mask; __u32 low; __u32 high; __u32 pad0; }; /* RapidIO base address for inbound requests set to value defined below * indicates that no specific RIO-to-local address translation is requested * and driver should use direct (one-to-one) address mapping. */ #define RIO_MAP_ANY_ADDR (__u64)(~((__u64) 0)) struct rio_mmap { __u16 rioid; __u16 pad0[3]; __u64 rio_addr; __u64 length; __u64 handle; __u64 address; }; struct rio_dma_mem { __u64 length; /* length of DMA memory */ __u64 dma_handle; /* handle associated with this memory */ __u64 address; }; struct rio_event { __u32 header; /* event type RIO_DOORBELL or RIO_PORTWRITE */ union { struct rio_doorbell doorbell; /* header for RIO_DOORBELL */ struct rio_portwrite portwrite; /* header for RIO_PORTWRITE */ } u; __u32 pad0; }; enum rio_transfer_sync { RIO_TRANSFER_SYNC, /* synchronous transfer */ RIO_TRANSFER_ASYNC, /* asynchronous transfer */ RIO_TRANSFER_FAF, /* fire-and-forget transfer */ }; enum rio_transfer_dir { RIO_TRANSFER_DIR_READ, /* Read operation */ RIO_TRANSFER_DIR_WRITE, /* Write operation */ }; /* * RapidIO data exchange transactions are lists of individual transfers. Each * transfer exchanges data between two RapidIO devices by remote direct memory * access and has its own completion code. * * The RapidIO specification defines four types of data exchange requests: * NREAD, NWRITE, SWRITE and NWRITE_R. The RapidIO DMA channel interface allows * to specify the required type of write operation or combination of them when * only the last data packet requires response. * * NREAD: read up to 256 bytes from remote device memory into local memory * NWRITE: write up to 256 bytes from local memory to remote device memory * without confirmation * SWRITE: as NWRITE, but all addresses and payloads must be 64-bit aligned * NWRITE_R: as NWRITE, but expect acknowledgment from remote device. * * The default exchange is chosen from NREAD and any of the WRITE modes as the * driver sees fit. For write requests the user can explicitly choose between * any of the write modes for each transaction. */ enum rio_exchange { RIO_EXCHANGE_DEFAULT, /* Default method */ RIO_EXCHANGE_NWRITE, /* All packets using NWRITE */ RIO_EXCHANGE_SWRITE, /* All packets using SWRITE */ RIO_EXCHANGE_NWRITE_R, /* Last packet NWRITE_R, others NWRITE */ RIO_EXCHANGE_SWRITE_R, /* Last packet NWRITE_R, others SWRITE */ RIO_EXCHANGE_NWRITE_R_ALL, /* All packets using NWRITE_R */ }; struct rio_transfer_io { __u64 rio_addr; /* Address in target's RIO mem space */ __u64 loc_addr; __u64 handle; __u64 offset; /* Offset in buffer */ __u64 length; /* Length in bytes */ __u16 rioid; /* Target destID */ __u16 method; /* Data exchange method, one of rio_exchange enum */ __u32 completion_code; /* Completion code for this transfer */ }; struct rio_transaction { __u64 block; /* Pointer to array of <count> transfers */ __u32 count; /* Number of transfers */ __u32 transfer_mode; /* Data transfer mode */ __u16 sync; /* Synch method, one of rio_transfer_sync enum */ __u16 dir; /* Transfer direction, one of rio_transfer_dir enum */ __u32 pad0; }; struct rio_async_tx_wait { __u32 token; /* DMA transaction ID token */ __u32 timeout; /* Wait timeout in msec, if 0 use default TO */ }; #define RIO_MAX_DEVNAME_SZ 20 struct rio_rdev_info { __u16 destid; __u8 hopcount; __u8 pad0; __u32 comptag; char name[RIO_MAX_DEVNAME_SZ + 1]; }; /* Driver IOCTL codes */ #define RIO_MPORT_DRV_MAGIC 'm' #define RIO_MPORT_MAINT_HDID_SET \ _IOW(RIO_MPORT_DRV_MAGIC, 1, __u16) #define RIO_MPORT_MAINT_COMPTAG_SET \ _IOW(RIO_MPORT_DRV_MAGIC, 2, __u32) #define RIO_MPORT_MAINT_PORT_IDX_GET \ _IOR(RIO_MPORT_DRV_MAGIC, 3, __u32) #define RIO_MPORT_GET_PROPERTIES \ _IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties) #define RIO_MPORT_MAINT_READ_LOCAL \ _IOR(RIO_MPORT_DRV_MAGIC, 5, struct rio_mport_maint_io) #define RIO_MPORT_MAINT_WRITE_LOCAL \ _IOW(RIO_MPORT_DRV_MAGIC, 6, struct rio_mport_maint_io) #define RIO_MPORT_MAINT_READ_REMOTE \ _IOR(RIO_MPORT_DRV_MAGIC, 7, struct rio_mport_maint_io) #define RIO_MPORT_MAINT_WRITE_REMOTE \ _IOW(RIO_MPORT_DRV_MAGIC, 8, struct rio_mport_maint_io) #define RIO_ENABLE_DOORBELL_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 9, struct rio_doorbell_filter) #define RIO_DISABLE_DOORBELL_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 10, struct rio_doorbell_filter) #define RIO_ENABLE_PORTWRITE_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 11, struct rio_pw_filter) #define RIO_DISABLE_PORTWRITE_RANGE \ _IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter) #define RIO_SET_EVENT_MASK \ _IOW(RIO_MPORT_DRV_MAGIC, 13, __u32) #define RIO_GET_EVENT_MASK \ _IOR(RIO_MPORT_DRV_MAGIC, 14, __u32) #define RIO_MAP_OUTBOUND \ _IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap) #define RIO_UNMAP_OUTBOUND \ _IOW(RIO_MPORT_DRV_MAGIC, 16, struct rio_mmap) #define RIO_MAP_INBOUND \ _IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap) #define RIO_UNMAP_INBOUND \ _IOW(RIO_MPORT_DRV_MAGIC, 18, __u64) #define RIO_ALLOC_DMA \ _IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem) #define RIO_FREE_DMA \ _IOW(RIO_MPORT_DRV_MAGIC, 20, __u64) #define RIO_TRANSFER \ _IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction) #define RIO_WAIT_FOR_ASYNC \ _IOW(RIO_MPORT_DRV_MAGIC, 22, struct rio_async_tx_wait) #define RIO_DEV_ADD \ _IOW(RIO_MPORT_DRV_MAGIC, 23, struct rio_rdev_info) #define RIO_DEV_DEL \ _IOW(RIO_MPORT_DRV_MAGIC, 24, struct rio_rdev_info) #endif /* _RIO_MPORT_CDEV_H_ */ linux/romfs_fs.h 0000644 00000002326 15063602054 0007676 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_ROMFS_FS_H #define __LINUX_ROMFS_FS_H #include <linux/types.h> #include <linux/fs.h> /* The basic structures of the romfs filesystem */ #define ROMBSIZE BLOCK_SIZE #define ROMBSBITS BLOCK_SIZE_BITS #define ROMBMASK (ROMBSIZE-1) #define ROMFS_MAGIC 0x7275 #define ROMFS_MAXFN 128 #define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff)) #define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff)) #define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d))) #define ROMSB_WORD0 __mk4('-','r','o','m') #define ROMSB_WORD1 __mk4('1','f','s','-') /* On-disk "super block" */ struct romfs_super_block { __be32 word0; __be32 word1; __be32 size; __be32 checksum; char name[0]; /* volume name */ }; /* On disk inode */ struct romfs_inode { __be32 next; /* low 4 bits see ROMFH_ */ __be32 spec; __be32 size; __be32 checksum; char name[0]; }; #define ROMFH_TYPE 7 #define ROMFH_HRD 0 #define ROMFH_DIR 1 #define ROMFH_REG 2 #define ROMFH_SYM 3 #define ROMFH_BLK 4 #define ROMFH_CHR 5 #define ROMFH_SCK 6 #define ROMFH_FIF 7 #define ROMFH_EXEC 8 /* Alignment */ #define ROMFH_SIZE 16 #define ROMFH_PAD (ROMFH_SIZE-1) #define ROMFH_MASK (~ROMFH_PAD) #endif linux/rose.h 0000644 00000004270 15063602054 0007030 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel Rose implementation. * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the * definition of the ax25_address structure. */ #ifndef ROSE_KERNEL_H #define ROSE_KERNEL_H #include <linux/socket.h> #include <linux/ax25.h> #define ROSE_MTU 251 #define ROSE_MAX_DIGIS 6 #define ROSE_DEFER 1 #define ROSE_T1 2 #define ROSE_T2 3 #define ROSE_T3 4 #define ROSE_IDLE 5 #define ROSE_QBITINCL 6 #define ROSE_HOLDBACK 7 #define SIOCRSGCAUSE (SIOCPROTOPRIVATE+0) #define SIOCRSSCAUSE (SIOCPROTOPRIVATE+1) #define SIOCRSL2CALL (SIOCPROTOPRIVATE+2) #define SIOCRSSL2CALL (SIOCPROTOPRIVATE+2) #define SIOCRSACCEPT (SIOCPROTOPRIVATE+3) #define SIOCRSCLRRT (SIOCPROTOPRIVATE+4) #define SIOCRSGL2CALL (SIOCPROTOPRIVATE+5) #define SIOCRSGFACILITIES (SIOCPROTOPRIVATE+6) #define ROSE_DTE_ORIGINATED 0x00 #define ROSE_NUMBER_BUSY 0x01 #define ROSE_INVALID_FACILITY 0x03 #define ROSE_NETWORK_CONGESTION 0x05 #define ROSE_OUT_OF_ORDER 0x09 #define ROSE_ACCESS_BARRED 0x0B #define ROSE_NOT_OBTAINABLE 0x0D #define ROSE_REMOTE_PROCEDURE 0x11 #define ROSE_LOCAL_PROCEDURE 0x13 #define ROSE_SHIP_ABSENT 0x39 typedef struct { char rose_addr[5]; } rose_address; struct sockaddr_rose { __kernel_sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; int srose_ndigis; ax25_address srose_digi; }; struct full_sockaddr_rose { __kernel_sa_family_t srose_family; rose_address srose_addr; ax25_address srose_call; unsigned int srose_ndigis; ax25_address srose_digis[ROSE_MAX_DIGIS]; }; struct rose_route_struct { rose_address address; unsigned short mask; ax25_address neighbour; char device[16]; unsigned char ndigis; ax25_address digipeaters[AX25_MAX_DIGIS]; }; struct rose_cause_struct { unsigned char cause; unsigned char diagnostic; }; struct rose_facilities_struct { rose_address source_addr, dest_addr; ax25_address source_call, dest_call; unsigned char source_ndigis, dest_ndigis; ax25_address source_digis[ROSE_MAX_DIGIS]; ax25_address dest_digis[ROSE_MAX_DIGIS]; unsigned int rand; rose_address fail_addr; ax25_address fail_call; }; #endif linux/route.h 0000644 00000004434 15063602054 0007220 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the IP router interface. * * Version: @(#)route.h 1.0.3 05/27/93 * * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 * for the purposes of compatibility only. * * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * Changes: * Mike McLagan : Routing by source * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_ROUTE_H #define _LINUX_ROUTE_H #include <linux/if.h> /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ struct rtentry { unsigned long rt_pad1; struct sockaddr rt_dst; /* target address */ struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ struct sockaddr rt_genmask; /* target network mask (IP) */ unsigned short rt_flags; short rt_pad2; unsigned long rt_pad3; void *rt_pad4; short rt_metric; /* +1 for binary compatibility! */ char *rt_dev; /* forcing the device at add */ unsigned long rt_mtu; /* per route MTU/Window */ #define rt_mss rt_mtu /* Compatibility :-( */ unsigned long rt_window; /* Window clamping */ unsigned short rt_irtt; /* Initial RTT */ }; #define RTF_UP 0x0001 /* route usable */ #define RTF_GATEWAY 0x0002 /* destination is a gateway */ #define RTF_HOST 0x0004 /* host entry (net otherwise) */ #define RTF_REINSTATE 0x0008 /* reinstate route after tmout */ #define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */ #define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */ #define RTF_MTU 0x0040 /* specific MTU for this route */ #define RTF_MSS RTF_MTU /* Compatibility :-( */ #define RTF_WINDOW 0x0080 /* per route window clamping */ #define RTF_IRTT 0x0100 /* Initial round trip time */ #define RTF_REJECT 0x0200 /* Reject route */ /* * <linux/ipv6_route.h> uses RTF values >= 64k */ #endif /* _LINUX_ROUTE_H */ linux/rpmsg.h 0000644 00000001040 15063602054 0007200 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2016, Linaro Ltd. */ #ifndef _RPMSG_H_ #define _RPMSG_H_ #include <linux/ioctl.h> #include <linux/types.h> /** * struct rpmsg_endpoint_info - endpoint info representation * @name: name of service * @src: local address * @dst: destination address */ struct rpmsg_endpoint_info { char name[32]; __u32 src; __u32 dst; }; #define RPMSG_CREATE_EPT_IOCTL _IOW(0xb5, 0x1, struct rpmsg_endpoint_info) #define RPMSG_DESTROY_EPT_IOCTL _IO(0xb5, 0x2) #endif linux/rseq.h 0000644 00000011450 15063602054 0007030 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef _LINUX_RSEQ_H #define _LINUX_RSEQ_H /* * linux/rseq.h * * Restartable sequences system call API * * Copyright (c) 2015-2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> */ #include <linux/types.h> #include <asm/byteorder.h> enum rseq_cpu_id_state { RSEQ_CPU_ID_UNINITIALIZED = -1, RSEQ_CPU_ID_REGISTRATION_FAILED = -2, }; enum rseq_flags { RSEQ_FLAG_UNREGISTER = (1 << 0), }; enum rseq_cs_flags_bit { RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0, RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1, RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2, }; enum rseq_cs_flags { RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT), RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), }; /* * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always * contained within a single cache-line. It is usually declared as * link-time constant data. */ struct rseq_cs { /* Version of this structure. */ __u32 version; /* enum rseq_cs_flags */ __u32 flags; __u64 start_ip; /* Offset from start_ip. */ __u64 post_commit_offset; __u64 abort_ip; } __attribute__((aligned(4 * sizeof(__u64)))); /* * struct rseq is aligned on 4 * 8 bytes to ensure it is always * contained within a single cache-line. * * A single struct rseq per thread is allowed. */ struct rseq { /* * Restartable sequences cpu_id_start field. Updated by the * kernel. Read by user-space with single-copy atomicity * semantics. This field should only be read by the thread which * registered this data structure. Aligned on 32-bit. Always * contains a value in the range of possible CPUs, although the * value may not be the actual current CPU (e.g. if rseq is not * initialized). This CPU number value should always be compared * against the value of the cpu_id field before performing a rseq * commit or returning a value read from a data structure indexed * using the cpu_id_start value. */ __u32 cpu_id_start; /* * Restartable sequences cpu_id field. Updated by the kernel. * Read by user-space with single-copy atomicity semantics. This * field should only be read by the thread which registered this * data structure. Aligned on 32-bit. Values * RSEQ_CPU_ID_UNINITIALIZED and RSEQ_CPU_ID_REGISTRATION_FAILED * have a special semantic: the former means "rseq uninitialized", * and latter means "rseq initialization failed". This value is * meant to be read within rseq critical sections and compared * with the cpu_id_start value previously read, before performing * the commit instruction, or read and compared with the * cpu_id_start value before returning a value loaded from a data * structure indexed using the cpu_id_start value. */ __u32 cpu_id; /* * Restartable sequences rseq_cs field. * * Contains NULL when no critical section is active for the current * thread, or holds a pointer to the currently active struct rseq_cs. * * Updated by user-space, which sets the address of the currently * active rseq_cs at the beginning of assembly instruction sequence * block, and set to NULL by the kernel when it restarts an assembly * instruction sequence block, as well as when the kernel detects that * it is preempting or delivering a signal outside of the range * targeted by the rseq_cs. Also needs to be set to NULL by user-space * before reclaiming memory that contains the targeted struct rseq_cs. * * Read and set by the kernel. Set by user-space with single-copy * atomicity semantics. This field should only be updated by the * thread which registered this data structure. Aligned on 64-bit. */ union { __u64 ptr64; #ifdef __LP64__ __u64 ptr; #else struct { #if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(__BIG_ENDIAN) __u32 padding; /* Initialized to zero. */ __u32 ptr32; #else /* LITTLE */ __u32 ptr32; __u32 padding; /* Initialized to zero. */ #endif /* ENDIAN */ } ptr; #endif } rseq_cs; /* * Restartable sequences flags field. * * This field should only be updated by the thread which * registered this data structure. Read by the kernel. * Mainly used for single-stepping through rseq critical sections * with debuggers. * * - RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT * Inhibit instruction sequence block restart on preemption * for this thread. * - RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL * Inhibit instruction sequence block restart on signal * delivery for this thread. * - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE * Inhibit instruction sequence block restart on migration for * this thread. */ __u32 flags; } __attribute__((aligned(4 * sizeof(__u64)))); #endif /* _LINUX_RSEQ_H */ linux/rtc.h 0000644 00000007651 15063602054 0006656 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Generic RTC interface. * This version contains the part of the user interface to the Real Time Clock * service. It is used with both the legacy mc146818 and also EFI * Struct rtc_time and first 12 ioctl by Paul Gortmaker, 1996 - separated out * from <linux/mc146818rtc.h> to this file for 2.4 kernels. * * Copyright (C) 1999 Hewlett-Packard Co. * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com> */ #ifndef _LINUX_RTC_H_ #define _LINUX_RTC_H_ /* * The struct used to pass data via the following ioctl. Similar to the * struct tm in <time.h>, but it needs to be here so that the kernel * source is self contained, allowing cross-compiles, etc. etc. */ struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; /* * This data structure is inspired by the EFI (v0.92) wakeup * alarm API. */ struct rtc_wkalrm { unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */ unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */ struct rtc_time time; /* time the alarm is set to */ }; /* * Data structure to control PLL correction some better RTC feature * pll_value is used to get or set current value of correction, * the rest of the struct is used to query HW capabilities. * This is modeled after the RTC used in Q40/Q60 computers but * should be sufficiently flexible for other devices * * +ve pll_value means clock will run faster by * pll_value*pll_posmult/pll_clock * -ve pll_value means clock will run slower by * pll_value*pll_negmult/pll_clock */ struct rtc_pll_info { int pll_ctrl; /* placeholder for fancier control */ int pll_value; /* get/set correction value */ int pll_max; /* max +ve (faster) adjustment value */ int pll_min; /* max -ve (slower) adjustment value */ int pll_posmult; /* factor for +ve correction */ int pll_negmult; /* factor for -ve correction */ long pll_clock; /* base PLL frequency */ }; /* * ioctl calls that are permitted to the /dev/rtc interface, if * any of the RTC drivers are enabled. */ #define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */ #define RTC_AIE_OFF _IO('p', 0x02) /* ... off */ #define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on */ #define RTC_UIE_OFF _IO('p', 0x04) /* ... off */ #define RTC_PIE_ON _IO('p', 0x05) /* Periodic int. enable on */ #define RTC_PIE_OFF _IO('p', 0x06) /* ... off */ #define RTC_WIE_ON _IO('p', 0x0f) /* Watchdog int. enable on */ #define RTC_WIE_OFF _IO('p', 0x10) /* ... off */ #define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) /* Set alarm time */ #define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) /* Read alarm time */ #define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) /* Read RTC time */ #define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */ #define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) /* Read IRQ rate */ #define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) /* Set IRQ rate */ #define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) /* Read epoch */ #define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) /* Set epoch */ #define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/ #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/ #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ #define RTC_VL_READ _IOR('p', 0x13, int) /* Voltage low detector */ #define RTC_VL_CLR _IO('p', 0x14) /* Clear voltage low information */ /* interrupt flags */ #define RTC_IRQF 0x80 /* Any of the following is active */ #define RTC_PF 0x40 /* Periodic interrupt */ #define RTC_AF 0x20 /* Alarm interrupt */ #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ #define RTC_MAX_FREQ 8192 #endif /* _LINUX_RTC_H_ */ linux/rtnetlink.h 0000644 00000047351 15063602054 0010101 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_RTNETLINK_H #define __LINUX_RTNETLINK_H #include <linux/types.h> #include <linux/netlink.h> #include <linux/if_link.h> #include <linux/if_addr.h> #include <linux/neighbour.h> /* rtnetlink families. Values up to 127 are reserved for real address * families, values above 128 may be used arbitrarily. */ #define RTNL_FAMILY_IPMR 128 #define RTNL_FAMILY_IP6MR 129 #define RTNL_FAMILY_MAX 129 /**** * Routing/neighbour discovery messages. ****/ /* Types of messages */ enum { RTM_BASE = 16, #define RTM_BASE RTM_BASE RTM_NEWLINK = 16, #define RTM_NEWLINK RTM_NEWLINK RTM_DELLINK, #define RTM_DELLINK RTM_DELLINK RTM_GETLINK, #define RTM_GETLINK RTM_GETLINK RTM_SETLINK, #define RTM_SETLINK RTM_SETLINK RTM_NEWADDR = 20, #define RTM_NEWADDR RTM_NEWADDR RTM_DELADDR, #define RTM_DELADDR RTM_DELADDR RTM_GETADDR, #define RTM_GETADDR RTM_GETADDR RTM_NEWROUTE = 24, #define RTM_NEWROUTE RTM_NEWROUTE RTM_DELROUTE, #define RTM_DELROUTE RTM_DELROUTE RTM_GETROUTE, #define RTM_GETROUTE RTM_GETROUTE RTM_NEWNEIGH = 28, #define RTM_NEWNEIGH RTM_NEWNEIGH RTM_DELNEIGH, #define RTM_DELNEIGH RTM_DELNEIGH RTM_GETNEIGH, #define RTM_GETNEIGH RTM_GETNEIGH RTM_NEWRULE = 32, #define RTM_NEWRULE RTM_NEWRULE RTM_DELRULE, #define RTM_DELRULE RTM_DELRULE RTM_GETRULE, #define RTM_GETRULE RTM_GETRULE RTM_NEWQDISC = 36, #define RTM_NEWQDISC RTM_NEWQDISC RTM_DELQDISC, #define RTM_DELQDISC RTM_DELQDISC RTM_GETQDISC, #define RTM_GETQDISC RTM_GETQDISC RTM_NEWTCLASS = 40, #define RTM_NEWTCLASS RTM_NEWTCLASS RTM_DELTCLASS, #define RTM_DELTCLASS RTM_DELTCLASS RTM_GETTCLASS, #define RTM_GETTCLASS RTM_GETTCLASS RTM_NEWTFILTER = 44, #define RTM_NEWTFILTER RTM_NEWTFILTER RTM_DELTFILTER, #define RTM_DELTFILTER RTM_DELTFILTER RTM_GETTFILTER, #define RTM_GETTFILTER RTM_GETTFILTER RTM_NEWACTION = 48, #define RTM_NEWACTION RTM_NEWACTION RTM_DELACTION, #define RTM_DELACTION RTM_DELACTION RTM_GETACTION, #define RTM_GETACTION RTM_GETACTION RTM_NEWPREFIX = 52, #define RTM_NEWPREFIX RTM_NEWPREFIX RTM_GETMULTICAST = 58, #define RTM_GETMULTICAST RTM_GETMULTICAST RTM_GETANYCAST = 62, #define RTM_GETANYCAST RTM_GETANYCAST RTM_NEWNEIGHTBL = 64, #define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL RTM_GETNEIGHTBL = 66, #define RTM_GETNEIGHTBL RTM_GETNEIGHTBL RTM_SETNEIGHTBL, #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL RTM_NEWNDUSEROPT = 68, #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT RTM_NEWADDRLABEL = 72, #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL RTM_DELADDRLABEL, #define RTM_DELADDRLABEL RTM_DELADDRLABEL RTM_GETADDRLABEL, #define RTM_GETADDRLABEL RTM_GETADDRLABEL RTM_GETDCB = 78, #define RTM_GETDCB RTM_GETDCB RTM_SETDCB, #define RTM_SETDCB RTM_SETDCB RTM_NEWNETCONF = 80, #define RTM_NEWNETCONF RTM_NEWNETCONF RTM_DELNETCONF, #define RTM_DELNETCONF RTM_DELNETCONF RTM_GETNETCONF = 82, #define RTM_GETNETCONF RTM_GETNETCONF RTM_NEWMDB = 84, #define RTM_NEWMDB RTM_NEWMDB RTM_DELMDB = 85, #define RTM_DELMDB RTM_DELMDB RTM_GETMDB = 86, #define RTM_GETMDB RTM_GETMDB RTM_NEWNSID = 88, #define RTM_NEWNSID RTM_NEWNSID RTM_DELNSID = 89, #define RTM_DELNSID RTM_DELNSID RTM_GETNSID = 90, #define RTM_GETNSID RTM_GETNSID RTM_NEWSTATS = 92, #define RTM_NEWSTATS RTM_NEWSTATS RTM_GETSTATS = 94, #define RTM_GETSTATS RTM_GETSTATS RTM_NEWCACHEREPORT = 96, #define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT RTM_NEWCHAIN = 100, #define RTM_NEWCHAIN RTM_NEWCHAIN RTM_DELCHAIN, #define RTM_DELCHAIN RTM_DELCHAIN RTM_GETCHAIN, #define RTM_GETCHAIN RTM_GETCHAIN RTM_NEWNEXTHOP = 104, #define RTM_NEWNEXTHOP RTM_NEWNEXTHOP RTM_DELNEXTHOP, #define RTM_DELNEXTHOP RTM_DELNEXTHOP RTM_GETNEXTHOP, #define RTM_GETNEXTHOP RTM_GETNEXTHOP RTM_NEWLINKPROP = 108, #define RTM_NEWLINKPROP RTM_NEWLINKPROP RTM_DELLINKPROP, #define RTM_DELLINKPROP RTM_DELLINKPROP RTM_GETLINKPROP, #define RTM_GETLINKPROP RTM_GETLINKPROP RTM_NEWVLAN = 112, #define RTM_NEWNVLAN RTM_NEWVLAN RTM_DELVLAN, #define RTM_DELVLAN RTM_DELVLAN RTM_GETVLAN, #define RTM_GETVLAN RTM_GETVLAN __RTM_MAX, #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) }; #define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) #define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) #define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) /* Generic structure for encapsulation of optional route information. It is reminiscent of sockaddr, but with sa_family replaced with attribute type. */ struct rtattr { unsigned short rta_len; unsigned short rta_type; }; /* Macros to handle rtattributes */ #define RTA_ALIGNTO 4U #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ (rta)->rta_len >= sizeof(struct rtattr) && \ (rta)->rta_len <= (len)) #define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) #define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) /****************************************************************************** * Definitions used in routing table administration. ****/ struct rtmsg { unsigned char rtm_family; unsigned char rtm_dst_len; unsigned char rtm_src_len; unsigned char rtm_tos; unsigned char rtm_table; /* Routing table id */ unsigned char rtm_protocol; /* Routing protocol; see below */ unsigned char rtm_scope; /* See below */ unsigned char rtm_type; /* See below */ unsigned rtm_flags; }; /* rtm_type */ enum { RTN_UNSPEC, RTN_UNICAST, /* Gateway or direct route */ RTN_LOCAL, /* Accept locally */ RTN_BROADCAST, /* Accept locally as broadcast, send as broadcast */ RTN_ANYCAST, /* Accept locally as broadcast, but send as unicast */ RTN_MULTICAST, /* Multicast route */ RTN_BLACKHOLE, /* Drop */ RTN_UNREACHABLE, /* Destination is unreachable */ RTN_PROHIBIT, /* Administratively prohibited */ RTN_THROW, /* Not in this table */ RTN_NAT, /* Translate this address */ RTN_XRESOLVE, /* Use external resolver */ __RTN_MAX }; #define RTN_MAX (__RTN_MAX - 1) /* rtm_protocol */ #define RTPROT_UNSPEC 0 #define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; not used by current IPv4 */ #define RTPROT_KERNEL 2 /* Route installed by kernel */ #define RTPROT_BOOT 3 /* Route installed during boot */ #define RTPROT_STATIC 4 /* Route installed by administrator */ /* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; they are just passed from user and back as is. It will be used by hypothetical multiple routing daemons. Note that protocol values should be standardized in order to avoid conflicts. */ #define RTPROT_GATED 8 /* Apparently, GateD */ #define RTPROT_RA 9 /* RDISC/ND router advertisements */ #define RTPROT_MRT 10 /* Merit MRT */ #define RTPROT_ZEBRA 11 /* Zebra */ #define RTPROT_BIRD 12 /* BIRD */ #define RTPROT_DNROUTED 13 /* DECnet routing daemon */ #define RTPROT_XORP 14 /* XORP */ #define RTPROT_NTK 15 /* Netsukuku */ #define RTPROT_DHCP 16 /* DHCP client */ #define RTPROT_MROUTED 17 /* Multicast daemon */ #define RTPROT_BABEL 42 /* Babel daemon */ #define RTPROT_BGP 186 /* BGP Routes */ #define RTPROT_ISIS 187 /* ISIS Routes */ #define RTPROT_OSPF 188 /* OSPF Routes */ #define RTPROT_RIP 189 /* RIP Routes */ #define RTPROT_EIGRP 192 /* EIGRP Routes */ /* rtm_scope Really it is not scope, but sort of distance to the destination. NOWHERE are reserved for not existing destinations, HOST is our local addresses, LINK are destinations, located on directly attached link and UNIVERSE is everywhere in the Universe. Intermediate values are also possible f.e. interior routes could be assigned a value between UNIVERSE and LINK. */ enum rt_scope_t { RT_SCOPE_UNIVERSE=0, /* User defined values */ RT_SCOPE_SITE=200, RT_SCOPE_LINK=253, RT_SCOPE_HOST=254, RT_SCOPE_NOWHERE=255 }; /* rtm_flags */ #define RTM_F_NOTIFY 0x100 /* Notify user of route change */ #define RTM_F_CLONED 0x200 /* This route is cloned */ #define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ #define RTM_F_PREFIX 0x800 /* Prefix addresses */ #define RTM_F_LOOKUP_TABLE 0x1000 /* set rtm_table to FIB lookup result */ #define RTM_F_FIB_MATCH 0x2000 /* return full fib lookup match */ #define RTM_F_OFFLOAD 0x4000 /* route is offloaded */ #define RTM_F_TRAP 0x8000 /* route is trapping packets */ /* Reserved table identifiers */ enum rt_class_t { RT_TABLE_UNSPEC=0, /* User defined values */ RT_TABLE_COMPAT=252, RT_TABLE_DEFAULT=253, RT_TABLE_MAIN=254, RT_TABLE_LOCAL=255, RT_TABLE_MAX=0xFFFFFFFF }; /* Routing message attributes */ enum rtattr_type_t { RTA_UNSPEC, RTA_DST, RTA_SRC, RTA_IIF, RTA_OIF, RTA_GATEWAY, RTA_PRIORITY, RTA_PREFSRC, RTA_METRICS, RTA_MULTIPATH, RTA_PROTOINFO, /* no longer used */ RTA_FLOW, RTA_CACHEINFO, RTA_SESSION, /* no longer used */ RTA_MP_ALGO, /* no longer used */ RTA_TABLE, RTA_MARK, RTA_MFC_STATS, RTA_VIA, RTA_NEWDST, RTA_PREF, RTA_ENCAP_TYPE, RTA_ENCAP, RTA_EXPIRES, RTA_PAD, RTA_UID, RTA_TTL_PROPAGATE, RTA_IP_PROTO, RTA_SPORT, RTA_DPORT, RTA_NH_ID, __RTA_MAX }; #define RTA_MAX (__RTA_MAX - 1) #define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) /* RTM_MULTIPATH --- array of struct rtnexthop. * * "struct rtnexthop" describes all necessary nexthop information, * i.e. parameters of path to a destination via this nexthop. * * At the moment it is impossible to set different prefsrc, mtu, window * and rtt for different paths from multipath. */ struct rtnexthop { unsigned short rtnh_len; unsigned char rtnh_flags; unsigned char rtnh_hops; int rtnh_ifindex; }; /* rtnh_flags */ #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ #define RTNH_F_OFFLOAD 8 /* offloaded route */ #define RTNH_F_LINKDOWN 16 /* carrier-down on nexthop */ #define RTNH_F_UNRESOLVED 32 /* The entry is unresolved (ipmr) */ #define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD) /* Macros to handle hexthops */ #define RTNH_ALIGNTO 4 #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ ((int)(rtnh)->rtnh_len) <= (len)) #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) #define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) #define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) /* RTA_VIA */ struct rtvia { __kernel_sa_family_t rtvia_family; __u8 rtvia_addr[0]; }; /* RTM_CACHEINFO */ struct rta_cacheinfo { __u32 rta_clntref; __u32 rta_lastuse; __s32 rta_expires; __u32 rta_error; __u32 rta_used; #define RTNETLINK_HAVE_PEERINFO 1 __u32 rta_id; __u32 rta_ts; __u32 rta_tsage; }; /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ enum { RTAX_UNSPEC, #define RTAX_UNSPEC RTAX_UNSPEC RTAX_LOCK, #define RTAX_LOCK RTAX_LOCK RTAX_MTU, #define RTAX_MTU RTAX_MTU RTAX_WINDOW, #define RTAX_WINDOW RTAX_WINDOW RTAX_RTT, #define RTAX_RTT RTAX_RTT RTAX_RTTVAR, #define RTAX_RTTVAR RTAX_RTTVAR RTAX_SSTHRESH, #define RTAX_SSTHRESH RTAX_SSTHRESH RTAX_CWND, #define RTAX_CWND RTAX_CWND RTAX_ADVMSS, #define RTAX_ADVMSS RTAX_ADVMSS RTAX_REORDERING, #define RTAX_REORDERING RTAX_REORDERING RTAX_HOPLIMIT, #define RTAX_HOPLIMIT RTAX_HOPLIMIT RTAX_INITCWND, #define RTAX_INITCWND RTAX_INITCWND RTAX_FEATURES, #define RTAX_FEATURES RTAX_FEATURES RTAX_RTO_MIN, #define RTAX_RTO_MIN RTAX_RTO_MIN RTAX_INITRWND, #define RTAX_INITRWND RTAX_INITRWND RTAX_QUICKACK, #define RTAX_QUICKACK RTAX_QUICKACK RTAX_CC_ALGO, #define RTAX_CC_ALGO RTAX_CC_ALGO RTAX_FASTOPEN_NO_COOKIE, #define RTAX_FASTOPEN_NO_COOKIE RTAX_FASTOPEN_NO_COOKIE __RTAX_MAX }; #define RTAX_MAX (__RTAX_MAX - 1) #define RTAX_FEATURE_ECN (1 << 0) #define RTAX_FEATURE_SACK (1 << 1) #define RTAX_FEATURE_TIMESTAMP (1 << 2) #define RTAX_FEATURE_ALLFRAG (1 << 3) #define RTAX_FEATURE_MASK (RTAX_FEATURE_ECN | RTAX_FEATURE_SACK | \ RTAX_FEATURE_TIMESTAMP | RTAX_FEATURE_ALLFRAG) struct rta_session { __u8 proto; __u8 pad1; __u16 pad2; union { struct { __u16 sport; __u16 dport; } ports; struct { __u8 type; __u8 code; __u16 ident; } icmpt; __u32 spi; } u; }; struct rta_mfc_stats { __u64 mfcs_packets; __u64 mfcs_bytes; __u64 mfcs_wrong_if; }; /**** * General form of address family dependent message. ****/ struct rtgenmsg { unsigned char rtgen_family; }; /***************************************************************** * Link layer specific messages. ****/ /* struct ifinfomsg * passes link level specific information, not dependent * on network protocol. */ struct ifinfomsg { unsigned char ifi_family; unsigned char __ifi_pad; unsigned short ifi_type; /* ARPHRD_* */ int ifi_index; /* Link index */ unsigned ifi_flags; /* IFF_* flags */ unsigned ifi_change; /* IFF_* change mask */ }; /******************************************************************** * prefix information ****/ struct prefixmsg { unsigned char prefix_family; unsigned char prefix_pad1; unsigned short prefix_pad2; int prefix_ifindex; unsigned char prefix_type; unsigned char prefix_len; unsigned char prefix_flags; unsigned char prefix_pad3; }; enum { PREFIX_UNSPEC, PREFIX_ADDRESS, PREFIX_CACHEINFO, __PREFIX_MAX }; #define PREFIX_MAX (__PREFIX_MAX - 1) struct prefix_cacheinfo { __u32 preferred_time; __u32 valid_time; }; /***************************************************************** * Traffic control messages. ****/ struct tcmsg { unsigned char tcm_family; unsigned char tcm__pad1; unsigned short tcm__pad2; int tcm_ifindex; __u32 tcm_handle; __u32 tcm_parent; /* tcm_block_index is used instead of tcm_parent * in case tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK */ #define tcm_block_index tcm_parent __u32 tcm_info; }; /* For manipulation of filters in shared block, tcm_ifindex is set to * TCM_IFINDEX_MAGIC_BLOCK, and tcm_parent is aliased to tcm_block_index * which is the block index. */ #define TCM_IFINDEX_MAGIC_BLOCK (0xFFFFFFFFU) enum { TCA_UNSPEC, TCA_KIND, TCA_OPTIONS, TCA_STATS, TCA_XSTATS, TCA_RATE, TCA_FCNT, TCA_STATS2, TCA_STAB, TCA_PAD, TCA_DUMP_INVISIBLE, TCA_CHAIN, TCA_HW_OFFLOAD, TCA_INGRESS_BLOCK, TCA_EGRESS_BLOCK, TCA_DUMP_FLAGS, TCA_EXT_WARN_MSG, __TCA_MAX }; #define TCA_MAX (__TCA_MAX - 1) #define TCA_DUMP_FLAGS_TERSE (1 << 0) /* Means that in dump user gets only basic * data necessary to identify the objects * (handle, cookie, etc.) and stats. */ #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) /******************************************************************** * Neighbor Discovery userland options ****/ struct nduseroptmsg { unsigned char nduseropt_family; unsigned char nduseropt_pad1; unsigned short nduseropt_opts_len; /* Total length of options */ int nduseropt_ifindex; __u8 nduseropt_icmp_type; __u8 nduseropt_icmp_code; unsigned short nduseropt_pad2; unsigned int nduseropt_pad3; /* Followed by one or more ND options */ }; enum { NDUSEROPT_UNSPEC, NDUSEROPT_SRCADDR, __NDUSEROPT_MAX }; #define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) /* RTnetlink multicast groups - backwards compatibility for userspace */ #define RTMGRP_LINK 1 #define RTMGRP_NOTIFY 2 #define RTMGRP_NEIGH 4 #define RTMGRP_TC 8 #define RTMGRP_IPV4_IFADDR 0x10 #define RTMGRP_IPV4_MROUTE 0x20 #define RTMGRP_IPV4_ROUTE 0x40 #define RTMGRP_IPV4_RULE 0x80 #define RTMGRP_IPV6_IFADDR 0x100 #define RTMGRP_IPV6_MROUTE 0x200 #define RTMGRP_IPV6_ROUTE 0x400 #define RTMGRP_IPV6_IFINFO 0x800 #define RTMGRP_DECnet_IFADDR 0x1000 #define RTMGRP_DECnet_ROUTE 0x4000 #define RTMGRP_IPV6_PREFIX 0x20000 /* RTnetlink multicast groups */ enum rtnetlink_groups { RTNLGRP_NONE, #define RTNLGRP_NONE RTNLGRP_NONE RTNLGRP_LINK, #define RTNLGRP_LINK RTNLGRP_LINK RTNLGRP_NOTIFY, #define RTNLGRP_NOTIFY RTNLGRP_NOTIFY RTNLGRP_NEIGH, #define RTNLGRP_NEIGH RTNLGRP_NEIGH RTNLGRP_TC, #define RTNLGRP_TC RTNLGRP_TC RTNLGRP_IPV4_IFADDR, #define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_MROUTE, #define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_ROUTE, #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_RULE, #define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE RTNLGRP_IPV6_IFADDR, #define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_MROUTE, #define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_ROUTE, #define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_IFINFO, #define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO RTNLGRP_DECnet_IFADDR, #define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR RTNLGRP_NOP2, RTNLGRP_DECnet_ROUTE, #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_RULE, #define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE RTNLGRP_NOP4, RTNLGRP_IPV6_PREFIX, #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_RULE, #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE RTNLGRP_ND_USEROPT, #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT RTNLGRP_PHONET_IFADDR, #define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_ROUTE, #define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE RTNLGRP_DCB, #define RTNLGRP_DCB RTNLGRP_DCB RTNLGRP_IPV4_NETCONF, #define RTNLGRP_IPV4_NETCONF RTNLGRP_IPV4_NETCONF RTNLGRP_IPV6_NETCONF, #define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF RTNLGRP_MDB, #define RTNLGRP_MDB RTNLGRP_MDB RTNLGRP_MPLS_ROUTE, #define RTNLGRP_MPLS_ROUTE RTNLGRP_MPLS_ROUTE RTNLGRP_NSID, #define RTNLGRP_NSID RTNLGRP_NSID RTNLGRP_MPLS_NETCONF, #define RTNLGRP_MPLS_NETCONF RTNLGRP_MPLS_NETCONF RTNLGRP_IPV4_MROUTE_R, #define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV6_MROUTE_R, #define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R RTNLGRP_NEXTHOP, #define RTNLGRP_NEXTHOP RTNLGRP_NEXTHOP RTNLGRP_BRVLAN, #define RTNLGRP_BRVLAN RTNLGRP_BRVLAN __RTNLGRP_MAX }; #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) /* TC action piece */ struct tcamsg { unsigned char tca_family; unsigned char tca__pad1; unsigned short tca__pad2; }; enum { TCA_ROOT_UNSPEC, TCA_ROOT_TAB, #define TCA_ACT_TAB TCA_ROOT_TAB #define TCAA_MAX TCA_ROOT_TAB TCA_ROOT_FLAGS, TCA_ROOT_COUNT, TCA_ROOT_TIME_DELTA, /* in msecs */ TCA_ROOT_EXT_WARN_MSG, __TCA_ROOT_MAX, #define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1) }; #define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) /* tcamsg flags stored in attribute TCA_ROOT_FLAGS * * TCA_ACT_FLAG_LARGE_DUMP_ON user->kernel to request for larger than * TCA_ACT_MAX_PRIO actions in a dump. All dump responses will contain the * number of actions being dumped stored in for user app's consumption in * TCA_ROOT_COUNT * * TCA_ACT_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only * includes essential action info (kind, index, etc.) * */ #define TCA_FLAG_LARGE_DUMP_ON (1 << 0) #define TCA_ACT_FLAG_LARGE_DUMP_ON TCA_FLAG_LARGE_DUMP_ON #define TCA_ACT_FLAG_TERSE_DUMP (1 << 1) /* New extended info filters for IFLA_EXT_MASK */ #define RTEXT_FILTER_VF (1 << 0) #define RTEXT_FILTER_BRVLAN (1 << 1) #define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2) #define RTEXT_FILTER_SKIP_STATS (1 << 3) #define RTEXT_FILTER_MRP (1 << 4) #define RTEXT_FILTER_CFM_CONFIG (1 << 5) #define RTEXT_FILTER_CFM_STATUS (1 << 6) #define RTEXT_FILTER_MST (1 << 7) /* End of information exported to user level */ #endif /* __LINUX_RTNETLINK_H */ linux/rxrpc.h 0000644 00000011730 15063602054 0007215 0 ustar 00 /* Types and definitions for AF_RXRPC. * * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public Licence * as published by the Free Software Foundation; either version * 2 of the Licence, or (at your option) any later version. */ #ifndef _LINUX_RXRPC_H #define _LINUX_RXRPC_H #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h> /* * RxRPC socket address */ struct sockaddr_rxrpc { __kernel_sa_family_t srx_family; /* address family */ __u16 srx_service; /* service desired */ __u16 transport_type; /* type of transport socket (SOCK_DGRAM) */ __u16 transport_len; /* length of transport address */ union { __kernel_sa_family_t family; /* transport address family */ struct sockaddr_in sin; /* IPv4 transport address */ struct sockaddr_in6 sin6; /* IPv6 transport address */ } transport; }; /* * RxRPC socket options */ #define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */ #define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */ #define RXRPC_EXCLUSIVE_CONNECTION 3 /* Deprecated; use RXRPC_EXCLUSIVE_CALL instead */ #define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */ #define RXRPC_UPGRADEABLE_SERVICE 5 /* Upgrade service[0] -> service[1] */ #define RXRPC_SUPPORTED_CMSG 6 /* Get highest supported control message type */ /* * RxRPC control messages * - If neither abort or accept are specified, the message is a data message. * - terminal messages mean that a user call ID tag can be recycled * - s/r/- indicate whether these are applicable to sendmsg() and/or recvmsg() */ enum rxrpc_cmsg_type { RXRPC_USER_CALL_ID = 1, /* sr: user call ID specifier */ RXRPC_ABORT = 2, /* sr: abort request / notification [terminal] */ RXRPC_ACK = 3, /* -r: [Service] RPC op final ACK received [terminal] */ RXRPC_NET_ERROR = 5, /* -r: network error received [terminal] */ RXRPC_BUSY = 6, /* -r: server busy received [terminal] */ RXRPC_LOCAL_ERROR = 7, /* -r: local error generated [terminal] */ RXRPC_NEW_CALL = 8, /* -r: [Service] new incoming call notification */ RXRPC_ACCEPT = 9, /* s-: [Service] accept request */ RXRPC_EXCLUSIVE_CALL = 10, /* s-: Call should be on exclusive connection */ RXRPC_UPGRADE_SERVICE = 11, /* s-: Request service upgrade for client call */ RXRPC_TX_LENGTH = 12, /* s-: Total length of Tx data */ RXRPC_SET_CALL_TIMEOUT = 13, /* s-: Set one or more call timeouts */ RXRPC__SUPPORTED }; /* * RxRPC security levels */ #define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */ #define RXRPC_SECURITY_AUTH 1 /* authenticated packets */ #define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */ /* * RxRPC security indices */ #define RXRPC_SECURITY_NONE 0 /* no security protocol */ #define RXRPC_SECURITY_RXKAD 2 /* kaserver or kerberos 4 */ #define RXRPC_SECURITY_RXGK 4 /* gssapi-based */ #define RXRPC_SECURITY_RXK5 5 /* kerberos 5 */ /* * RxRPC-level abort codes */ #define RX_CALL_DEAD -1 /* call/conn has been inactive and is shut down */ #define RX_INVALID_OPERATION -2 /* invalid operation requested / attempted */ #define RX_CALL_TIMEOUT -3 /* call timeout exceeded */ #define RX_EOF -4 /* unexpected end of data on read op */ #define RX_PROTOCOL_ERROR -5 /* low-level protocol error */ #define RX_USER_ABORT -6 /* generic user abort */ #define RX_ADDRINUSE -7 /* UDP port in use */ #define RX_DEBUGI_BADTYPE -8 /* bad debugging packet type */ /* * (un)marshalling abort codes (rxgen) */ #define RXGEN_CC_MARSHAL -450 #define RXGEN_CC_UNMARSHAL -451 #define RXGEN_SS_MARSHAL -452 #define RXGEN_SS_UNMARSHAL -453 #define RXGEN_DECODE -454 #define RXGEN_OPCODE -455 #define RXGEN_SS_XDRFREE -456 #define RXGEN_CC_XDRFREE -457 /* * Rx kerberos security abort codes * - unfortunately we have no generalised security abort codes to say things * like "unsupported security", so we have to use these instead and hope the * other side understands */ #define RXKADINCONSISTENCY 19270400 /* security module structure inconsistent */ #define RXKADPACKETSHORT 19270401 /* packet too short for security challenge */ #define RXKADLEVELFAIL 19270402 /* security level negotiation failed */ #define RXKADTICKETLEN 19270403 /* ticket length too short or too long */ #define RXKADOUTOFSEQUENCE 19270404 /* packet had bad sequence number */ #define RXKADNOAUTH 19270405 /* caller not authorised */ #define RXKADBADKEY 19270406 /* illegal key: bad parity or weak */ #define RXKADBADTICKET 19270407 /* security object was passed a bad ticket */ #define RXKADUNKNOWNKEY 19270408 /* ticket contained unknown key version number */ #define RXKADEXPIRED 19270409 /* authentication expired */ #define RXKADSEALEDINCON 19270410 /* sealed data inconsistent */ #define RXKADDATALEN 19270411 /* user data too long */ #define RXKADILLEGALLEVEL 19270412 /* caller not authorised to use encrypted conns */ #endif /* _LINUX_RXRPC_H */ linux/scc.h 0000644 00000010765 15063602054 0006636 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */ #ifndef _SCC_H #define _SCC_H /* selection of hardware types */ #define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */ #define EAGLE 0x01 /* hardware type for EAGLE card */ #define PC100 0x02 /* hardware type for PC100 card */ #define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */ #define DRSI 0x08 /* hardware type for DRSI PC*Packet card */ #define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */ /* DEV ioctl() commands */ enum SCC_ioctl_cmds { SIOCSCCRESERVED = SIOCDEVPRIVATE, SIOCSCCCFG, SIOCSCCINI, SIOCSCCCHANINI, SIOCSCCSMEM, SIOCSCCGKISS, SIOCSCCSKISS, SIOCSCCGSTAT, SIOCSCCCAL }; /* Device parameter control (from WAMPES) */ enum L1_params { PARAM_DATA, PARAM_TXDELAY, PARAM_PERSIST, PARAM_SLOTTIME, PARAM_TXTAIL, PARAM_FULLDUP, PARAM_SOFTDCD, /* was: PARAM_HW */ PARAM_MUTE, /* ??? */ PARAM_DTR, PARAM_RTS, PARAM_SPEED, PARAM_ENDDELAY, /* ??? */ PARAM_GROUP, PARAM_IDLE, PARAM_MIN, PARAM_MAXKEY, PARAM_WAIT, PARAM_MAXDEFER, PARAM_TX, PARAM_HWEVENT = 31, PARAM_RETURN = 255 /* reset kiss mode */ }; /* fulldup parameter */ enum FULLDUP_modes { KISS_DUPLEX_HALF, /* normal CSMA operation */ KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */ KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */ KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */ }; /* misc. parameters */ #define TIMER_OFF 65535U /* to switch off timers */ #define NO_SUCH_PARAM 65534U /* param not implemented */ /* HWEVENT parameter */ enum HWEVENT_opts { HWEV_DCD_ON, HWEV_DCD_OFF, HWEV_ALL_SENT }; /* channel grouping */ #define RXGROUP 0100 /* if set, only tx when all channels clear */ #define TXGROUP 0200 /* if set, don't transmit simultaneously */ /* Tx/Rx clock sources */ enum CLOCK_sources { CLK_DPLL, /* normal halfduplex operation */ CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */ CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */ /* modems without clock regeneration */ CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */ /* MODEMs without clock recovery */ }; /* Tx state */ enum TX_state { TXS_IDLE, /* Transmitter off, no data pending */ TXS_BUSY, /* waiting for permission to send / tailtime */ TXS_ACTIVE, /* Transmitter on, sending data */ TXS_NEWFRAME, /* reset CRC and send (next) frame */ TXS_IDLE2, /* Transmitter on, no data pending */ TXS_WAIT, /* Waiting for Mintime to expire */ TXS_TIMEOUT /* We had a transmission timeout */ }; typedef unsigned long io_port; /* type definition for an 'io port address' */ /* SCC statistical information */ struct scc_stat { long rxints; /* Receiver interrupts */ long txints; /* Transmitter interrupts */ long exints; /* External/status interrupts */ long spints; /* Special receiver interrupts */ long txframes; /* Packets sent */ long rxframes; /* Number of Frames Actually Received */ long rxerrs; /* CRC Errors */ long txerrs; /* KISS errors */ unsigned int nospace; /* "Out of buffers" */ unsigned int rx_over; /* Receiver Overruns */ unsigned int tx_under; /* Transmitter Underruns */ unsigned int tx_state; /* Transmitter state */ int tx_queued; /* tx frames enqueued */ unsigned int maxqueue; /* allocated tx_buffers */ unsigned int bufsize; /* used buffersize */ }; struct scc_modem { long speed; /* Line speed, bps */ char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */ char nrz; /* NRZ instead of NRZI */ }; struct scc_kiss_cmd { int command; /* one of the KISS-Commands defined above */ unsigned param; /* KISS-Param */ }; struct scc_hw_config { io_port data_a; /* data port channel A */ io_port ctrl_a; /* control port channel A */ io_port data_b; /* data port channel B */ io_port ctrl_b; /* control port channel B */ io_port vector_latch; /* INTACK-Latch (#) */ io_port special; /* special function port */ int irq; /* irq */ long clock; /* clock */ char option; /* command for function port */ char brand; /* hardware type */ char escc; /* use ext. features of a 8580/85180/85280 */ }; /* (#) only one INTACK latch allowed. */ struct scc_mem_config { unsigned int dummy; unsigned int bufsize; }; struct scc_calibrate { unsigned int time; unsigned char pattern; }; #endif /* _SCC_H */ linux/sched.h 0000644 00000005355 15063602054 0007153 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SCHED_H #define _LINUX_SCHED_H /* * cloning flags: */ #define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ #define CLONE_VM 0x00000100 /* set if VM shared between processes */ #define CLONE_FS 0x00000200 /* set if fs info shared between processes */ #define CLONE_FILES 0x00000400 /* set if open files shared between processes */ #define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ #define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ #define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ #define CLONE_THREAD 0x00010000 /* Same thread group? */ #define CLONE_NEWNS 0x00020000 /* New mount namespace group */ #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ #define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ #define CLONE_DETACHED 0x00400000 /* Unused, ignored */ #define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ #define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ #define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */ #define CLONE_NEWUTS 0x04000000 /* New utsname namespace */ #define CLONE_NEWIPC 0x08000000 /* New ipc namespace */ #define CLONE_NEWUSER 0x10000000 /* New user namespace */ #define CLONE_NEWPID 0x20000000 /* New pid namespace */ #define CLONE_NEWNET 0x40000000 /* New network namespace */ #define CLONE_IO 0x80000000 /* Clone io context */ /* * cloning flags intersect with CSIGNAL so can be used with unshare and clone3 * syscalls only: */ #define CLONE_NEWTIME 0x00000080 /* New time namespace */ /* * Scheduling policies */ #define SCHED_NORMAL 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_BATCH 3 /* SCHED_ISO: reserved but not implemented yet */ #define SCHED_IDLE 5 #define SCHED_DEADLINE 6 /* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */ #define SCHED_RESET_ON_FORK 0x40000000 /* * For the sched_{set,get}attr() calls */ #define SCHED_FLAG_RESET_ON_FORK 0x01 #define SCHED_FLAG_RECLAIM 0x02 #define SCHED_FLAG_DL_OVERRUN 0x04 #define SCHED_FLAG_KEEP_POLICY 0x08 #define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ SCHED_FLAG_RECLAIM | \ SCHED_FLAG_DL_OVERRUN | \ SCHED_FLAG_KEEP_POLICY) #endif /* _LINUX_SCHED_H */ linux/scif_ioctl.h 0000644 00000014356 15063602054 0010204 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Intel MIC Platform Software Stack (MPSS) * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2014 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * BSD LICENSE * * Copyright(c) 2014 Intel Corporation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Intel SCIF driver. * */ /* * ----------------------------------------- * SCIF IOCTL interface information * ----------------------------------------- */ #ifndef SCIF_IOCTL_H #define SCIF_IOCTL_H #include <linux/types.h> /** * struct scif_port_id - SCIF port information * @node: node on which port resides * @port: local port number */ struct scif_port_id { __u16 node; __u16 port; }; /** * struct scifioctl_connect - used for SCIF_CONNECT IOCTL * @self: used to read back the assigned port_id * @peer: destination node and port to connect to */ struct scifioctl_connect { struct scif_port_id self; struct scif_port_id peer; }; /** * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL * @flags: flags * @peer: global id of peer endpoint * @endpt: new connected endpoint descriptor */ struct scifioctl_accept { __s32 flags; struct scif_port_id peer; __u64 endpt; }; /** * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL * @msg: message buffer address * @len: message length * @flags: flags * @out_len: number of bytes sent/received */ struct scifioctl_msg { __u64 msg; __s32 len; __s32 flags; __s32 out_len; }; /** * struct scifioctl_reg - used for SCIF_REG IOCTL * @addr: starting virtual address * @len: length of range * @offset: offset of window * @prot: read/write protection * @flags: flags * @out_offset: offset returned */ struct scifioctl_reg { __u64 addr; __u64 len; __s64 offset; __s32 prot; __s32 flags; __s64 out_offset; }; /** * struct scifioctl_unreg - used for SCIF_UNREG IOCTL * @offset: start of range to unregister * @len: length of range to unregister */ struct scifioctl_unreg { __s64 offset; __u64 len; }; /** * struct scifioctl_copy - used for SCIF DMA copy IOCTLs * * @loffset: offset in local registered address space to/from * which to copy * @len: length of range to copy * @roffset: offset in remote registered address space to/from * which to copy * @addr: user virtual address to/from which to copy * @flags: flags * * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM * and SCIF_VREADFROM IOCTL's. */ struct scifioctl_copy { __s64 loffset; __u64 len; __s64 roffset; __u64 addr; __s32 flags; }; /** * struct scifioctl_fence_mark - used for SCIF_FENCE_MARK IOCTL * @flags: flags * @mark: fence handle which is a pointer to a __s32 */ struct scifioctl_fence_mark { __s32 flags; __u64 mark; }; /** * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL * @loff: local offset * @lval: value to write to loffset * @roff: remote offset * @rval: value to write to roffset * @flags: flags */ struct scifioctl_fence_signal { __s64 loff; __u64 lval; __s64 roff; __u64 rval; __s32 flags; }; /** * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL * @nodes: pointer to an array of node_ids * @self: ID of the current node * @len: length of array */ struct scifioctl_node_ids { __u64 nodes; __u64 self; __s32 len; }; #define SCIF_BIND _IOWR('s', 1, __u64) #define SCIF_LISTEN _IOW('s', 2, __s32) #define SCIF_CONNECT _IOWR('s', 3, struct scifioctl_connect) #define SCIF_ACCEPTREQ _IOWR('s', 4, struct scifioctl_accept) #define SCIF_ACCEPTREG _IOWR('s', 5, __u64) #define SCIF_SEND _IOWR('s', 6, struct scifioctl_msg) #define SCIF_RECV _IOWR('s', 7, struct scifioctl_msg) #define SCIF_REG _IOWR('s', 8, struct scifioctl_reg) #define SCIF_UNREG _IOWR('s', 9, struct scifioctl_unreg) #define SCIF_READFROM _IOWR('s', 10, struct scifioctl_copy) #define SCIF_WRITETO _IOWR('s', 11, struct scifioctl_copy) #define SCIF_VREADFROM _IOWR('s', 12, struct scifioctl_copy) #define SCIF_VWRITETO _IOWR('s', 13, struct scifioctl_copy) #define SCIF_GET_NODEIDS _IOWR('s', 14, struct scifioctl_node_ids) #define SCIF_FENCE_MARK _IOWR('s', 15, struct scifioctl_fence_mark) #define SCIF_FENCE_WAIT _IOWR('s', 16, __s32) #define SCIF_FENCE_SIGNAL _IOWR('s', 17, struct scifioctl_fence_signal) #endif /* SCIF_IOCTL_H */ linux/screen_info.h 0000644 00000004657 15063602054 0010363 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _SCREEN_INFO_H #define _SCREEN_INFO_H #include <linux/types.h> /* * These are set up by the setup-routine at boot-time: */ struct screen_info { __u8 orig_x; /* 0x00 */ __u8 orig_y; /* 0x01 */ __u16 ext_mem_k; /* 0x02 */ __u16 orig_video_page; /* 0x04 */ __u8 orig_video_mode; /* 0x06 */ __u8 orig_video_cols; /* 0x07 */ __u8 flags; /* 0x08 */ __u8 unused2; /* 0x09 */ __u16 orig_video_ega_bx;/* 0x0a */ __u16 unused3; /* 0x0c */ __u8 orig_video_lines; /* 0x0e */ __u8 orig_video_isVGA; /* 0x0f */ __u16 orig_video_points;/* 0x10 */ /* VESA graphic mode -- linear frame buffer */ __u16 lfb_width; /* 0x12 */ __u16 lfb_height; /* 0x14 */ __u16 lfb_depth; /* 0x16 */ __u32 lfb_base; /* 0x18 */ __u32 lfb_size; /* 0x1c */ __u16 cl_magic, cl_offset; /* 0x20 */ __u16 lfb_linelength; /* 0x24 */ __u8 red_size; /* 0x26 */ __u8 red_pos; /* 0x27 */ __u8 green_size; /* 0x28 */ __u8 green_pos; /* 0x29 */ __u8 blue_size; /* 0x2a */ __u8 blue_pos; /* 0x2b */ __u8 rsvd_size; /* 0x2c */ __u8 rsvd_pos; /* 0x2d */ __u16 vesapm_seg; /* 0x2e */ __u16 vesapm_off; /* 0x30 */ __u16 pages; /* 0x32 */ __u16 vesa_attributes; /* 0x34 */ __u32 capabilities; /* 0x36 */ __u32 ext_lfb_base; /* 0x3a */ __u8 _reserved[2]; /* 0x3e */ } __attribute__((packed)); #define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */ #define VIDEO_TYPE_CGA 0x11 /* CGA Display */ #define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */ #define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */ #define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */ #define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */ #define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */ #define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */ #define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */ #define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */ #define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */ #define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */ #define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ #define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ #define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */ #define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0) #define VIDEO_CAPABILITY_64BIT_BASE (1 << 1) /* Frame buffer base is 64-bit */ #endif /* _SCREEN_INFO_H */ linux/sctp.h 0000644 00000106232 15063602054 0007032 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* SCTP kernel implementation * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2002 Intel Corp. * * This file is part of the SCTP kernel implementation * * This header represents the structures and constants needed to support * the SCTP Extension to the Sockets API. * * This SCTP implementation is free software; * you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This SCTP implementation is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <linux-sctp@vger.kernel.org> * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * * Written or modified by: * La Monte H.P. Yarroll <piggy@acm.org> * R. Stewart <randall@sctp.chicago.il.us> * K. Morneau <kmorneau@cisco.com> * Q. Xie <qxie1@email.mot.com> * Karl Knutson <karl@athena.chicago.il.us> * Jon Grimm <jgrimm@us.ibm.com> * Daisy Chang <daisyc@us.ibm.com> * Ryan Layer <rmlayer@us.ibm.com> * Ardelle Fan <ardelle.fan@intel.com> * Sridhar Samudrala <sri@us.ibm.com> * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com> * Vlad Yasevich <vladislav.yasevich@hp.com> * * Any bugs reported given to us we will try to fix... any fixes shared will * be incorporated into the next SCTP release. */ #ifndef _SCTP_H #define _SCTP_H #include <linux/types.h> #include <linux/socket.h> typedef __s32 sctp_assoc_t; #define SCTP_FUTURE_ASSOC 0 #define SCTP_CURRENT_ASSOC 1 #define SCTP_ALL_ASSOC 2 /* The following symbols come from the Sockets API Extensions for * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. */ #define SCTP_RTOINFO 0 #define SCTP_ASSOCINFO 1 #define SCTP_INITMSG 2 #define SCTP_NODELAY 3 /* Get/set nodelay option. */ #define SCTP_AUTOCLOSE 4 #define SCTP_SET_PEER_PRIMARY_ADDR 5 #define SCTP_PRIMARY_ADDR 6 #define SCTP_ADAPTATION_LAYER 7 #define SCTP_DISABLE_FRAGMENTS 8 #define SCTP_PEER_ADDR_PARAMS 9 #define SCTP_DEFAULT_SEND_PARAM 10 #define SCTP_EVENTS 11 #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ #define SCTP_STATUS 14 #define SCTP_GET_PEER_ADDR_INFO 15 #define SCTP_DELAYED_ACK_TIME 16 #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME #define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME #define SCTP_CONTEXT 17 #define SCTP_FRAGMENT_INTERLEAVE 18 #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ #define SCTP_MAX_BURST 20 /* Set/Get max burst */ #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ #define SCTP_HMAC_IDENT 22 #define SCTP_AUTH_KEY 23 #define SCTP_AUTH_ACTIVE_KEY 24 #define SCTP_AUTH_DELETE_KEY 25 #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ #define SCTP_AUTO_ASCONF 30 #define SCTP_PEER_ADDR_THLDS 31 #define SCTP_RECVRCVINFO 32 #define SCTP_RECVNXTINFO 33 #define SCTP_DEFAULT_SNDINFO 34 #define SCTP_AUTH_DEACTIVATE_KEY 35 #define SCTP_REUSE_PORT 36 #define SCTP_PEER_ADDR_THLDS_V2 37 /* Internal Socket Options. Some of the sctp library functions are * implemented using these socket options. */ #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ /* Options 104-106 are deprecated and removed. Do not use this space */ #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ #define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ #define SCTP_GET_ASSOC_STATS 112 /* Read only */ #define SCTP_PR_SUPPORTED 113 #define SCTP_DEFAULT_PRINFO 114 #define SCTP_PR_ASSOC_STATUS 115 #define SCTP_PR_STREAM_STATUS 116 #define SCTP_RECONFIG_SUPPORTED 117 #define SCTP_ENABLE_STREAM_RESET 118 #define SCTP_RESET_STREAMS 119 #define SCTP_RESET_ASSOC 120 #define SCTP_ADD_STREAMS 121 #define SCTP_SOCKOPT_PEELOFF_FLAGS 122 #define SCTP_STREAM_SCHEDULER 123 #define SCTP_STREAM_SCHEDULER_VALUE 124 #define SCTP_INTERLEAVING_SUPPORTED 125 #define SCTP_SENDMSG_CONNECT 126 #define SCTP_EVENT 127 #define SCTP_ASCONF_SUPPORTED 128 #define SCTP_AUTH_SUPPORTED 129 #define SCTP_ECN_SUPPORTED 130 #define SCTP_EXPOSE_POTENTIALLY_FAILED_STATE 131 #define SCTP_EXPOSE_PF_STATE SCTP_EXPOSE_POTENTIALLY_FAILED_STATE #define SCTP_REMOTE_UDP_ENCAPS_PORT 132 #define SCTP_PLPMTUD_PROBE_INTERVAL 133 /* PR-SCTP policies */ #define SCTP_PR_SCTP_NONE 0x0000 #define SCTP_PR_SCTP_TTL 0x0010 #define SCTP_PR_SCTP_RTX 0x0020 #define SCTP_PR_SCTP_PRIO 0x0030 #define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO #define SCTP_PR_SCTP_MASK 0x0030 #define __SCTP_PR_INDEX(x) ((x >> 4) - 1) #define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x) #define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK) #define SCTP_PR_SET_POLICY(flags, x) \ do { \ flags &= ~SCTP_PR_SCTP_MASK; \ flags |= x; \ } while (0) #define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL) #define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX) #define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO) /* For enable stream reset */ #define SCTP_ENABLE_RESET_STREAM_REQ 0x01 #define SCTP_ENABLE_RESET_ASSOC_REQ 0x02 #define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x04 #define SCTP_ENABLE_STRRESET_MASK 0x07 #define SCTP_STREAM_RESET_INCOMING 0x01 #define SCTP_STREAM_RESET_OUTGOING 0x02 /* These are bit fields for msghdr->msg_flags. See section 5.1. */ /* On user space Linux, these live in <bits/socket.h> as an enum. */ enum sctp_msg_flags { MSG_NOTIFICATION = 0x8000, #define MSG_NOTIFICATION MSG_NOTIFICATION }; /* 5.3.1 SCTP Initiation Structure (SCTP_INIT) * * This cmsghdr structure provides information for initializing new * SCTP associations with sendmsg(). The SCTP_INITMSG socket option * uses this same data structure. This structure is not used for * recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg */ struct sctp_initmsg { __u16 sinit_num_ostreams; __u16 sinit_max_instreams; __u16 sinit_max_attempts; __u16 sinit_max_init_timeo; }; /* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV) * * This cmsghdr structure specifies SCTP options for sendmsg() and * describes SCTP header information about a received message through * recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo */ struct sctp_sndrcvinfo { __u16 sinfo_stream; __u16 sinfo_ssn; __u16 sinfo_flags; __u32 sinfo_ppid; __u32 sinfo_context; __u32 sinfo_timetolive; __u32 sinfo_tsn; __u32 sinfo_cumtsn; sctp_assoc_t sinfo_assoc_id; }; /* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo */ struct sctp_sndinfo { __u16 snd_sid; __u16 snd_flags; __u32 snd_ppid; __u32 snd_context; sctp_assoc_t snd_assoc_id; }; /* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO) * * This cmsghdr structure describes SCTP receive information * about a received message through recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo */ struct sctp_rcvinfo { __u16 rcv_sid; __u16 rcv_ssn; __u16 rcv_flags; __u32 rcv_ppid; __u32 rcv_tsn; __u32 rcv_cumtsn; __u32 rcv_context; sctp_assoc_t rcv_assoc_id; }; /* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO) * * This cmsghdr structure describes SCTP receive information * of the next message that will be delivered through recvmsg() * if this information is already available when delivering * the current message. * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo */ struct sctp_nxtinfo { __u16 nxt_sid; __u16 nxt_flags; __u32 nxt_ppid; __u32 nxt_length; sctp_assoc_t nxt_assoc_id; }; /* 5.3.7 SCTP PR-SCTP Information Structure (SCTP_PRINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_PRINFO struct sctp_prinfo */ struct sctp_prinfo { __u16 pr_policy; __u32 pr_value; }; /* 5.3.8 SCTP AUTH Information Structure (SCTP_AUTHINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ------------------- * IPPROTO_SCTP SCTP_AUTHINFO struct sctp_authinfo */ struct sctp_authinfo { __u16 auth_keynumber; }; /* * sinfo_flags: 16 bits (unsigned integer) * * This field may contain any of the following flags and is composed of * a bitwise OR of these values. */ enum sctp_sinfo_flags { SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */ SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */ SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */ SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */ /* 2 bits here have been used by SCTP_PR_SCTP_MASK */ SCTP_SENDALL = (1 << 6), SCTP_PR_SCTP_ALL = (1 << 7), SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */ SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */ }; typedef union { __u8 raw; struct sctp_initmsg init; struct sctp_sndrcvinfo sndrcv; } sctp_cmsg_data_t; /* These are cmsg_types. */ typedef enum sctp_cmsg_type { SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ #define SCTP_INIT SCTP_INIT SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ #define SCTP_SNDRCV SCTP_SNDRCV SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */ #define SCTP_SNDINFO SCTP_SNDINFO SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */ #define SCTP_RCVINFO SCTP_RCVINFO SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */ #define SCTP_NXTINFO SCTP_NXTINFO SCTP_PRINFO, /* 5.3.7 SCTP PR-SCTP Information Structure */ #define SCTP_PRINFO SCTP_PRINFO SCTP_AUTHINFO, /* 5.3.8 SCTP AUTH Information Structure */ #define SCTP_AUTHINFO SCTP_AUTHINFO SCTP_DSTADDRV4, /* 5.3.9 SCTP Destination IPv4 Address Structure */ #define SCTP_DSTADDRV4 SCTP_DSTADDRV4 SCTP_DSTADDRV6, /* 5.3.10 SCTP Destination IPv6 Address Structure */ #define SCTP_DSTADDRV6 SCTP_DSTADDRV6 } sctp_cmsg_t; /* * 5.3.1.1 SCTP_ASSOC_CHANGE * * Communication notifications inform the ULP that an SCTP association * has either begun or ended. The identifier for a new association is * provided by this notificaion. The notification information has the * following format: * */ struct sctp_assoc_change { __u16 sac_type; __u16 sac_flags; __u32 sac_length; __u16 sac_state; __u16 sac_error; __u16 sac_outbound_streams; __u16 sac_inbound_streams; sctp_assoc_t sac_assoc_id; __u8 sac_info[0]; }; /* * sac_state: 32 bits (signed integer) * * This field holds one of a number of values that communicate the * event that happened to the association. They include: * * Note: The following state names deviate from the API draft as * the names clash too easily with other kernel symbols. */ enum sctp_sac_state { SCTP_COMM_UP, SCTP_COMM_LOST, SCTP_RESTART, SCTP_SHUTDOWN_COMP, SCTP_CANT_STR_ASSOC, }; /* * 5.3.1.2 SCTP_PEER_ADDR_CHANGE * * When a destination address on a multi-homed peer encounters a change * an interface details event is sent. The information has the * following structure: */ struct sctp_paddr_change { __u16 spc_type; __u16 spc_flags; __u32 spc_length; struct sockaddr_storage spc_aaddr; int spc_state; int spc_error; sctp_assoc_t spc_assoc_id; } __attribute__((packed, aligned(4))); /* * spc_state: 32 bits (signed integer) * * This field holds one of a number of values that communicate the * event that happened to the address. They include: */ enum sctp_spc_state { SCTP_ADDR_AVAILABLE, SCTP_ADDR_UNREACHABLE, SCTP_ADDR_REMOVED, SCTP_ADDR_ADDED, SCTP_ADDR_MADE_PRIM, SCTP_ADDR_CONFIRMED, SCTP_ADDR_POTENTIALLY_FAILED, #define SCTP_ADDR_PF SCTP_ADDR_POTENTIALLY_FAILED }; /* * 5.3.1.3 SCTP_REMOTE_ERROR * * A remote peer may send an Operational Error message to its peer. * This message indicates a variety of error conditions on an * association. The entire error TLV as it appears on the wire is * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP * specification [SCTP] and any extensions for a list of possible * error formats. SCTP error TLVs have the format: */ struct sctp_remote_error { __u16 sre_type; __u16 sre_flags; __u32 sre_length; __be16 sre_error; sctp_assoc_t sre_assoc_id; __u8 sre_data[0]; }; /* * 5.3.1.4 SCTP_SEND_FAILED * * If SCTP cannot deliver a message it may return the message as a * notification. */ struct sctp_send_failed { __u16 ssf_type; __u16 ssf_flags; __u32 ssf_length; __u32 ssf_error; struct sctp_sndrcvinfo ssf_info; sctp_assoc_t ssf_assoc_id; __u8 ssf_data[0]; }; struct sctp_send_failed_event { __u16 ssf_type; __u16 ssf_flags; __u32 ssf_length; __u32 ssf_error; struct sctp_sndinfo ssfe_info; sctp_assoc_t ssf_assoc_id; __u8 ssf_data[0]; }; /* * ssf_flags: 16 bits (unsigned integer) * * The flag value will take one of the following values * * SCTP_DATA_UNSENT - Indicates that the data was never put on * the wire. * * SCTP_DATA_SENT - Indicates that the data was put on the wire. * Note that this does not necessarily mean that the * data was (or was not) successfully delivered. */ enum sctp_ssf_flags { SCTP_DATA_UNSENT, SCTP_DATA_SENT, }; /* * 5.3.1.5 SCTP_SHUTDOWN_EVENT * * When a peer sends a SHUTDOWN, SCTP delivers this notification to * inform the application that it should cease sending data. */ struct sctp_shutdown_event { __u16 sse_type; __u16 sse_flags; __u32 sse_length; sctp_assoc_t sse_assoc_id; }; /* * 5.3.1.6 SCTP_ADAPTATION_INDICATION * * When a peer sends a Adaptation Layer Indication parameter , SCTP * delivers this notification to inform the application * that of the peers requested adaptation layer. */ struct sctp_adaptation_event { __u16 sai_type; __u16 sai_flags; __u32 sai_length; __u32 sai_adaptation_ind; sctp_assoc_t sai_assoc_id; }; /* * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT * * When a receiver is engaged in a partial delivery of a * message this notification will be used to indicate * various events. */ struct sctp_pdapi_event { __u16 pdapi_type; __u16 pdapi_flags; __u32 pdapi_length; __u32 pdapi_indication; sctp_assoc_t pdapi_assoc_id; __u32 pdapi_stream; __u32 pdapi_seq; }; enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; /* * 5.3.1.8. SCTP_AUTHENTICATION_EVENT * * When a receiver is using authentication this message will provide * notifications regarding new keys being made active as well as errors. */ struct sctp_authkey_event { __u16 auth_type; __u16 auth_flags; __u32 auth_length; __u16 auth_keynumber; __u16 auth_altkeynumber; __u32 auth_indication; sctp_assoc_t auth_assoc_id; }; enum { SCTP_AUTH_NEW_KEY, #define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY /* compatible with before */ SCTP_AUTH_FREE_KEY, SCTP_AUTH_NO_AUTH, }; /* * 6.1.9. SCTP_SENDER_DRY_EVENT * * When the SCTP stack has no more user data to send or retransmit, this * notification is given to the user. Also, at the time when a user app * subscribes to this event, if there is no data to be sent or * retransmit, the stack will immediately send up this notification. */ struct sctp_sender_dry_event { __u16 sender_dry_type; __u16 sender_dry_flags; __u32 sender_dry_length; sctp_assoc_t sender_dry_assoc_id; }; #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 #define SCTP_STREAM_RESET_DENIED 0x0004 #define SCTP_STREAM_RESET_FAILED 0x0008 struct sctp_stream_reset_event { __u16 strreset_type; __u16 strreset_flags; __u32 strreset_length; sctp_assoc_t strreset_assoc_id; __u16 strreset_stream_list[]; }; #define SCTP_ASSOC_RESET_DENIED 0x0004 #define SCTP_ASSOC_RESET_FAILED 0x0008 struct sctp_assoc_reset_event { __u16 assocreset_type; __u16 assocreset_flags; __u32 assocreset_length; sctp_assoc_t assocreset_assoc_id; __u32 assocreset_local_tsn; __u32 assocreset_remote_tsn; }; #define SCTP_ASSOC_CHANGE_DENIED 0x0004 #define SCTP_ASSOC_CHANGE_FAILED 0x0008 #define SCTP_STREAM_CHANGE_DENIED SCTP_ASSOC_CHANGE_DENIED #define SCTP_STREAM_CHANGE_FAILED SCTP_ASSOC_CHANGE_FAILED struct sctp_stream_change_event { __u16 strchange_type; __u16 strchange_flags; __u32 strchange_length; sctp_assoc_t strchange_assoc_id; __u16 strchange_instrms; __u16 strchange_outstrms; }; /* * Described in Section 7.3 * Ancillary Data and Notification Interest Options */ struct sctp_event_subscribe { __u8 sctp_data_io_event; __u8 sctp_association_event; __u8 sctp_address_event; __u8 sctp_send_failure_event; __u8 sctp_peer_error_event; __u8 sctp_shutdown_event; __u8 sctp_partial_delivery_event; __u8 sctp_adaptation_layer_event; __u8 sctp_authentication_event; __u8 sctp_sender_dry_event; __u8 sctp_stream_reset_event; __u8 sctp_assoc_reset_event; __u8 sctp_stream_change_event; __u8 sctp_send_failure_event_event; }; /* * 5.3.1 SCTP Notification Structure * * The notification structure is defined as the union of all * notification types. * */ union sctp_notification { struct { __u16 sn_type; /* Notification type. */ __u16 sn_flags; __u32 sn_length; } sn_header; struct sctp_assoc_change sn_assoc_change; struct sctp_paddr_change sn_paddr_change; struct sctp_remote_error sn_remote_error; struct sctp_send_failed sn_send_failed; struct sctp_shutdown_event sn_shutdown_event; struct sctp_adaptation_event sn_adaptation_event; struct sctp_pdapi_event sn_pdapi_event; struct sctp_authkey_event sn_authkey_event; struct sctp_sender_dry_event sn_sender_dry_event; struct sctp_stream_reset_event sn_strreset_event; struct sctp_assoc_reset_event sn_assocreset_event; struct sctp_stream_change_event sn_strchange_event; struct sctp_send_failed_event sn_send_failed_event; }; /* Section 5.3.1 * All standard values for sn_type flags are greater than 2^15. * Values from 2^15 and down are reserved. */ enum sctp_sn_type { SCTP_SN_TYPE_BASE = (1<<15), SCTP_DATA_IO_EVENT = SCTP_SN_TYPE_BASE, #define SCTP_DATA_IO_EVENT SCTP_DATA_IO_EVENT SCTP_ASSOC_CHANGE, #define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE SCTP_PEER_ADDR_CHANGE, #define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE SCTP_SEND_FAILED, #define SCTP_SEND_FAILED SCTP_SEND_FAILED SCTP_REMOTE_ERROR, #define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR SCTP_SHUTDOWN_EVENT, #define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT SCTP_PARTIAL_DELIVERY_EVENT, #define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT SCTP_ADAPTATION_INDICATION, #define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION SCTP_AUTHENTICATION_EVENT, #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT SCTP_SENDER_DRY_EVENT, #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT SCTP_STREAM_RESET_EVENT, #define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT SCTP_ASSOC_RESET_EVENT, #define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT SCTP_STREAM_CHANGE_EVENT, #define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT SCTP_SEND_FAILED_EVENT, #define SCTP_SEND_FAILED_EVENT SCTP_SEND_FAILED_EVENT SCTP_SN_TYPE_MAX = SCTP_SEND_FAILED_EVENT, #define SCTP_SN_TYPE_MAX SCTP_SN_TYPE_MAX }; /* Notification error codes used to fill up the error fields in some * notifications. * SCTP_PEER_ADDRESS_CHAGE : spc_error * SCTP_ASSOC_CHANGE : sac_error * These names should be potentially included in the draft 04 of the SCTP * sockets API specification. */ typedef enum sctp_sn_error { SCTP_FAILED_THRESHOLD, SCTP_RECEIVED_SACK, SCTP_HEARTBEAT_SUCCESS, SCTP_RESPONSE_TO_USER_REQ, SCTP_INTERNAL_ERROR, SCTP_SHUTDOWN_GUARD_EXPIRES, SCTP_PEER_FAULTY, } sctp_sn_error_t; /* * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) * * The protocol parameters used to initialize and bound retransmission * timeout (RTO) are tunable. See [SCTP] for more information on how * these parameters are used in RTO calculation. */ struct sctp_rtoinfo { sctp_assoc_t srto_assoc_id; __u32 srto_initial; __u32 srto_max; __u32 srto_min; }; /* * 7.1.2 Association Parameters (SCTP_ASSOCINFO) * * This option is used to both examine and set various association and * endpoint parameters. */ struct sctp_assocparams { sctp_assoc_t sasoc_assoc_id; __u16 sasoc_asocmaxrxt; __u16 sasoc_number_peer_destinations; __u32 sasoc_peer_rwnd; __u32 sasoc_local_rwnd; __u32 sasoc_cookie_life; }; /* * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) * * Requests that the peer mark the enclosed address as the association * primary. The enclosed address must be one of the association's * locally bound addresses. The following structure is used to make a * set primary request: */ struct sctp_setpeerprim { sctp_assoc_t sspp_assoc_id; struct sockaddr_storage sspp_addr; } __attribute__((packed, aligned(4))); /* * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) * * Requests that the local SCTP stack use the enclosed peer address as * the association primary. The enclosed address must be one of the * association peer's addresses. The following structure is used to * make a set peer primary request: */ struct sctp_prim { sctp_assoc_t ssp_assoc_id; struct sockaddr_storage ssp_addr; } __attribute__((packed, aligned(4))); /* For backward compatibility use, define the old name too */ #define sctp_setprim sctp_prim /* * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) * * Requests that the local endpoint set the specified Adaptation Layer * Indication parameter for all future INIT and INIT-ACK exchanges. */ struct sctp_setadaptation { __u32 ssb_adaptation_ind; }; /* * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) * * Applications can enable or disable heartbeats for any peer address * of an association, modify an address's heartbeat interval, force a * heartbeat to be sent immediately, and adjust the address's maximum * number of retransmissions sent before an address is considered * unreachable. The following structure is used to access and modify an * address's parameters: */ enum sctp_spp_flags { SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ SPP_IPV6_FLOWLABEL = 1<<8, SPP_DSCP = 1<<9, }; struct sctp_paddrparams { sctp_assoc_t spp_assoc_id; struct sockaddr_storage spp_address; __u32 spp_hbinterval; __u16 spp_pathmaxrxt; __u32 spp_pathmtu; __u32 spp_sackdelay; __u32 spp_flags; __u32 spp_ipv6_flowlabel; __u8 spp_dscp; } __attribute__((packed, aligned(4))); /* * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) * * This set option adds a chunk type that the user is requesting to be * received only in an authenticated way. Changes to the list of chunks * will only effect future associations on the socket. */ struct sctp_authchunk { __u8 sauth_chunk; }; /* * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) * * This option gets or sets the list of HMAC algorithms that the local * endpoint requires the peer to use. */ /* This here is only used by user space as is. It might not be a good idea * to export/reveal the whole structure with reserved fields etc. */ enum { SCTP_AUTH_HMAC_ID_SHA1 = 1, SCTP_AUTH_HMAC_ID_SHA256 = 3, }; struct sctp_hmacalgo { __u32 shmac_num_idents; __u16 shmac_idents[]; }; /* Sadly, user and kernel space have different names for * this structure member, so this is to not break anything. */ #define shmac_number_of_idents shmac_num_idents /* * 7.1.20. Set a shared key (SCTP_AUTH_KEY) * * This option will set a shared secret key which is used to build an * association shared key. */ struct sctp_authkey { sctp_assoc_t sca_assoc_id; __u16 sca_keynumber; __u16 sca_keylength; __u8 sca_key[]; }; /* * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) * * This option will get or set the active shared key to be used to build * the association shared key. */ struct sctp_authkeyid { sctp_assoc_t scact_assoc_id; __u16 scact_keynumber; }; /* * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK) * * This option will effect the way delayed acks are performed. This * option allows you to get or set the delayed ack time, in * milliseconds. It also allows changing the delayed ack frequency. * Changing the frequency to 1 disables the delayed sack algorithm. If * the assoc_id is 0, then this sets or gets the endpoints default * values. If the assoc_id field is non-zero, then the set or get * effects the specified association for the one to many model (the * assoc_id field is ignored by the one to one model). Note that if * sack_delay or sack_freq are 0 when setting this option, then the * current values will remain unchanged. */ struct sctp_sack_info { sctp_assoc_t sack_assoc_id; uint32_t sack_delay; uint32_t sack_freq; }; struct sctp_assoc_value { sctp_assoc_t assoc_id; uint32_t assoc_value; }; struct sctp_stream_value { sctp_assoc_t assoc_id; uint16_t stream_id; uint16_t stream_value; }; /* * 7.2.2 Peer Address Information * * Applications can retrieve information about a specific peer address * of an association, including its reachability state, congestion * window, and retransmission timer values. This information is * read-only. The following structure is used to access this * information: */ struct sctp_paddrinfo { sctp_assoc_t spinfo_assoc_id; struct sockaddr_storage spinfo_address; __s32 spinfo_state; __u32 spinfo_cwnd; __u32 spinfo_srtt; __u32 spinfo_rto; __u32 spinfo_mtu; } __attribute__((packed, aligned(4))); /* Peer addresses's state. */ /* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] * calls. * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. * Not yet confirmed by a heartbeat and not available for data * transfers. * ACTIVE : Peer address confirmed, active and available for data transfers. * INACTIVE: Peer address inactive and not available for data transfers. */ enum sctp_spinfo_state { SCTP_INACTIVE, SCTP_PF, #define SCTP_POTENTIALLY_FAILED SCTP_PF SCTP_ACTIVE, SCTP_UNCONFIRMED, SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ }; /* * 7.2.1 Association Status (SCTP_STATUS) * * Applications can retrieve current status information about an * association, including association state, peer receiver window size, * number of unacked data chunks, and number of data chunks pending * receipt. This information is read-only. The following structure is * used to access this information: */ struct sctp_status { sctp_assoc_t sstat_assoc_id; __s32 sstat_state; __u32 sstat_rwnd; __u16 sstat_unackdata; __u16 sstat_penddata; __u16 sstat_instrms; __u16 sstat_outstrms; __u32 sstat_fragmentation_point; struct sctp_paddrinfo sstat_primary; }; /* * 7.2.3. Get the list of chunks the peer requires to be authenticated * (SCTP_PEER_AUTH_CHUNKS) * * This option gets a list of chunks for a specified association that * the peer requires to be received authenticated only. */ struct sctp_authchunks { sctp_assoc_t gauth_assoc_id; __u32 gauth_number_of_chunks; uint8_t gauth_chunks[]; }; /* The broken spelling has been released already in lksctp-tools header, * so don't break anyone, now that it's fixed. */ #define guth_number_of_chunks gauth_number_of_chunks /* Association states. */ enum sctp_sstat_state { SCTP_EMPTY = 0, SCTP_CLOSED = 1, SCTP_COOKIE_WAIT = 2, SCTP_COOKIE_ECHOED = 3, SCTP_ESTABLISHED = 4, SCTP_SHUTDOWN_PENDING = 5, SCTP_SHUTDOWN_SENT = 6, SCTP_SHUTDOWN_RECEIVED = 7, SCTP_SHUTDOWN_ACK_SENT = 8, }; /* * 8.2.6. Get the Current Identifiers of Associations * (SCTP_GET_ASSOC_ID_LIST) * * This option gets the current list of SCTP association identifiers of * the SCTP associations handled by a one-to-many style socket. */ struct sctp_assoc_ids { __u32 gaids_number_of_ids; sctp_assoc_t gaids_assoc_id[]; }; /* * 8.3, 8.5 get all peer/local addresses in an association. * This parameter struct is used by SCTP_GET_PEER_ADDRS and * SCTP_GET_LOCAL_ADDRS socket options used internally to implement * sctp_getpaddrs() and sctp_getladdrs() API. */ struct sctp_getaddrs_old { sctp_assoc_t assoc_id; int addr_num; struct sockaddr *addrs; }; struct sctp_getaddrs { sctp_assoc_t assoc_id; /*input*/ __u32 addr_num; /*output*/ __u8 addrs[0]; /*output, variable size*/ }; /* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves * association stats. All stats are counts except sas_maxrto and * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since * the last call. Will return 0 when RTO was not update since last call */ struct sctp_assoc_stats { sctp_assoc_t sas_assoc_id; /* Input */ /* Transport of observed max RTO */ struct sockaddr_storage sas_obs_rto_ipaddr; __u64 sas_maxrto; /* Maximum Observed RTO for period */ __u64 sas_isacks; /* SACKs received */ __u64 sas_osacks; /* SACKs sent */ __u64 sas_opackets; /* Packets sent */ __u64 sas_ipackets; /* Packets received */ __u64 sas_rtxchunks; /* Retransmitted Chunks */ __u64 sas_outofseqtsns;/* TSN received > next expected */ __u64 sas_idupchunks; /* Dups received (ordered+unordered) */ __u64 sas_gapcnt; /* Gap Acknowledgements Received */ __u64 sas_ouodchunks; /* Unordered data chunks sent */ __u64 sas_iuodchunks; /* Unordered data chunks received */ __u64 sas_oodchunks; /* Ordered data chunks sent */ __u64 sas_iodchunks; /* Ordered data chunks received */ __u64 sas_octrlchunks; /* Control chunks sent */ __u64 sas_ictrlchunks; /* Control chunks received */ }; /* * 8.1 sctp_bindx() * * The flags parameter is formed from the bitwise OR of zero or more of the * following currently defined flags: */ #define SCTP_BINDX_ADD_ADDR 0x01 #define SCTP_BINDX_REM_ADDR 0x02 /* This is the structure that is passed as an argument(optval) to * getsockopt(SCTP_SOCKOPT_PEELOFF). */ typedef struct { sctp_assoc_t associd; int sd; } sctp_peeloff_arg_t; typedef struct { sctp_peeloff_arg_t p_arg; unsigned flags; } sctp_peeloff_flags_arg_t; /* * Peer Address Thresholds socket option */ struct sctp_paddrthlds { sctp_assoc_t spt_assoc_id; struct sockaddr_storage spt_address; __u16 spt_pathmaxrxt; __u16 spt_pathpfthld; }; /* Use a new structure with spt_pathcpthld for back compatibility */ struct sctp_paddrthlds_v2 { sctp_assoc_t spt_assoc_id; struct sockaddr_storage spt_address; __u16 spt_pathmaxrxt; __u16 spt_pathpfthld; __u16 spt_pathcpthld; }; /* * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status */ struct sctp_prstatus { sctp_assoc_t sprstat_assoc_id; __u16 sprstat_sid; __u16 sprstat_policy; __u64 sprstat_abandoned_unsent; __u64 sprstat_abandoned_sent; }; struct sctp_default_prinfo { sctp_assoc_t pr_assoc_id; __u32 pr_value; __u16 pr_policy; }; struct sctp_info { __u32 sctpi_tag; __u32 sctpi_state; __u32 sctpi_rwnd; __u16 sctpi_unackdata; __u16 sctpi_penddata; __u16 sctpi_instrms; __u16 sctpi_outstrms; __u32 sctpi_fragmentation_point; __u32 sctpi_inqueue; __u32 sctpi_outqueue; __u32 sctpi_overall_error; __u32 sctpi_max_burst; __u32 sctpi_maxseg; __u32 sctpi_peer_rwnd; __u32 sctpi_peer_tag; __u8 sctpi_peer_capable; __u8 sctpi_peer_sack; __u16 __reserved1; /* assoc status info */ __u64 sctpi_isacks; __u64 sctpi_osacks; __u64 sctpi_opackets; __u64 sctpi_ipackets; __u64 sctpi_rtxchunks; __u64 sctpi_outofseqtsns; __u64 sctpi_idupchunks; __u64 sctpi_gapcnt; __u64 sctpi_ouodchunks; __u64 sctpi_iuodchunks; __u64 sctpi_oodchunks; __u64 sctpi_iodchunks; __u64 sctpi_octrlchunks; __u64 sctpi_ictrlchunks; /* primary transport info */ struct sockaddr_storage sctpi_p_address; __s32 sctpi_p_state; __u32 sctpi_p_cwnd; __u32 sctpi_p_srtt; __u32 sctpi_p_rto; __u32 sctpi_p_hbinterval; __u32 sctpi_p_pathmaxrxt; __u32 sctpi_p_sackdelay; __u32 sctpi_p_sackfreq; __u32 sctpi_p_ssthresh; __u32 sctpi_p_partial_bytes_acked; __u32 sctpi_p_flight_size; __u16 sctpi_p_error; __u16 __reserved2; /* sctp sock info */ __u32 sctpi_s_autoclose; __u32 sctpi_s_adaptation_ind; __u32 sctpi_s_pd_point; __u8 sctpi_s_nodelay; __u8 sctpi_s_disable_fragments; __u8 sctpi_s_v4mapped; __u8 sctpi_s_frag_interleave; __u32 sctpi_s_type; __u32 __reserved3; }; struct sctp_reset_streams { sctp_assoc_t srs_assoc_id; uint16_t srs_flags; uint16_t srs_number_streams; /* 0 == ALL */ uint16_t srs_stream_list[]; /* list if srs_num_streams is not 0 */ }; struct sctp_add_streams { sctp_assoc_t sas_assoc_id; uint16_t sas_instrms; uint16_t sas_outstrms; }; struct sctp_event { sctp_assoc_t se_assoc_id; uint16_t se_type; uint8_t se_on; }; struct sctp_udpencaps { sctp_assoc_t sue_assoc_id; struct sockaddr_storage sue_address; uint16_t sue_port; }; /* SCTP Stream schedulers */ enum sctp_sched_type { SCTP_SS_FCFS, SCTP_SS_DEFAULT = SCTP_SS_FCFS, SCTP_SS_PRIO, SCTP_SS_RR, SCTP_SS_MAX = SCTP_SS_RR }; /* Probe Interval socket option */ struct sctp_probeinterval { sctp_assoc_t spi_assoc_id; struct sockaddr_storage spi_address; __u32 spi_interval; }; #endif /* _SCTP_H */ linux/sdla.h 0000644 00000005427 15063602054 0007010 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Global definitions for the Frame relay interface. * * Version: @(#)if_ifrad.h 0.20 13 Apr 96 * * Author: Mike McLagan <mike.mclagan@linux.org> * * Changes: * 0.15 Mike McLagan Structure packing * * 0.20 Mike McLagan New flags for S508 buffer handling * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef SDLA_H #define SDLA_H /* adapter type */ #define SDLA_TYPES #define SDLA_S502A 5020 #define SDLA_S502E 5021 #define SDLA_S503 5030 #define SDLA_S507 5070 #define SDLA_S508 5080 #define SDLA_S509 5090 #define SDLA_UNKNOWN -1 /* port selection flags for the S508 */ #define SDLA_S508_PORT_V35 0x00 #define SDLA_S508_PORT_RS232 0x02 /* Z80 CPU speeds */ #define SDLA_CPU_3M 0x00 #define SDLA_CPU_5M 0x01 #define SDLA_CPU_7M 0x02 #define SDLA_CPU_8M 0x03 #define SDLA_CPU_10M 0x04 #define SDLA_CPU_16M 0x05 #define SDLA_CPU_12M 0x06 /* some private IOCTLs */ #define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1) #define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2) #define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3) #define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4) #define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5) #define SDLA_READMEM (FRAD_LAST_IOCTL + 6) struct sdla_mem { int addr; int len; void *data; }; #define SDLA_START (FRAD_LAST_IOCTL + 7) #define SDLA_STOP (FRAD_LAST_IOCTL + 8) /* some offsets in the Z80's memory space */ #define SDLA_NMIADDR 0x0000 #define SDLA_CONF_ADDR 0x0010 #define SDLA_S502A_NMIADDR 0x0066 #define SDLA_CODE_BASEADDR 0x0100 #define SDLA_WINDOW_SIZE 0x2000 #define SDLA_ADDR_MASK 0x1FFF /* largest handleable block of data */ #define SDLA_MAX_DATA 4080 #define SDLA_MAX_MTU 4072 /* MAX_DATA - sizeof(fradhdr) */ #define SDLA_MAX_DLCI 24 /* this should be the same as frad_conf */ struct sdla_conf { short station; short config; short kbaud; short clocking; short max_frm; short T391; short T392; short N391; short N392; short N393; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; }; /* this should be the same as dlci_conf */ struct sdla_dlci_conf { short config; short CIR_fwd; short Bc_fwd; short Be_fwd; short CIR_bwd; short Bc_bwd; short Be_bwd; short Tc_fwd; short Tc_bwd; short Tf_max; short Tb_max; }; #endif /* SDLA_H */ linux/seccomp.h 0000644 00000004321 15063602054 0007506 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SECCOMP_H #define _LINUX_SECCOMP_H #include <linux/types.h> /* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */ #define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */ #define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */ #define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */ /* Valid operations for seccomp syscall. */ #define SECCOMP_SET_MODE_STRICT 0 #define SECCOMP_SET_MODE_FILTER 1 #define SECCOMP_GET_ACTION_AVAIL 2 /* Valid flags for SECCOMP_SET_MODE_FILTER */ #define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0) #define SECCOMP_FILTER_FLAG_LOG (1UL << 1) #define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2) /* * All BPF programs must return a 32-bit value. * The bottom 16-bits are for optional return data. * The upper 16-bits are ordered from least permissive values to most, * as a signed value (so 0x8000000 is negative). * * The ordering ensures that a min_t() over composed return values always * selects the least permissive choice. */ #define SECCOMP_RET_KILL_PROCESS 0x80000000U /* kill the process */ #define SECCOMP_RET_KILL_THREAD 0x00000000U /* kill the thread */ #define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD #define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */ #define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */ #define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */ #define SECCOMP_RET_LOG 0x7ffc0000U /* allow after logging */ #define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ /* Masks for the return value sections. */ #define SECCOMP_RET_ACTION_FULL 0xffff0000U #define SECCOMP_RET_ACTION 0x7fff0000U #define SECCOMP_RET_DATA 0x0000ffffU /** * struct seccomp_data - the format the BPF program executes over. * @nr: the system call number * @arch: indicates system call convention as an AUDIT_ARCH_* value * as defined in <linux/audit.h>. * @instruction_pointer: at the time of the system call. * @args: up to 6 system call arguments always stored as 64-bit values * regardless of the architecture. */ struct seccomp_data { int nr; __u32 arch; __u64 instruction_pointer; __u64 args[6]; }; #endif /* _LINUX_SECCOMP_H */ linux/tee.h 0000644 00000031555 15063602054 0006643 0 ustar 00 /* * Copyright (c) 2015-2016, Linaro Limited * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef __TEE_H #define __TEE_H #include <linux/ioctl.h> #include <linux/types.h> /* * This file describes the API provided by a TEE driver to user space. * * Each TEE driver defines a TEE specific protocol which is used for the * data passed back and forth using TEE_IOC_CMD. */ /* Helpers to make the ioctl defines */ #define TEE_IOC_MAGIC 0xa4 #define TEE_IOC_BASE 0 /* Flags relating to shared memory */ #define TEE_IOCTL_SHM_MAPPED 0x1 /* memory mapped in normal world */ #define TEE_IOCTL_SHM_DMA_BUF 0x2 /* dma-buf handle on shared memory */ #define TEE_MAX_ARG_SIZE 1024 #define TEE_GEN_CAP_GP (1 << 0)/* GlobalPlatform compliant TEE */ #define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */ #define TEE_GEN_CAP_REG_MEM (1 << 2)/* Supports registering shared memory */ #define TEE_GEN_CAP_MEMREF_NULL (1 << 3)/* NULL MemRef support */ #define TEE_MEMREF_NULL (__u64)(-1) /* NULL MemRef Buffer */ /* * TEE Implementation ID */ #define TEE_IMPL_ID_OPTEE 1 /* * OP-TEE specific capabilities */ #define TEE_OPTEE_CAP_TZ (1 << 0) /** * struct tee_ioctl_version_data - TEE version * @impl_id: [out] TEE implementation id * @impl_caps: [out] Implementation specific capabilities * @gen_caps: [out] Generic capabilities, defined by TEE_GEN_CAPS_* above * * Identifies the TEE implementation, @impl_id is one of TEE_IMPL_ID_* above. * @impl_caps is implementation specific, for example TEE_OPTEE_CAP_* * is valid when @impl_id == TEE_IMPL_ID_OPTEE. */ struct tee_ioctl_version_data { __u32 impl_id; __u32 impl_caps; __u32 gen_caps; }; /** * TEE_IOC_VERSION - query version of TEE * * Takes a tee_ioctl_version_data struct and returns with the TEE version * data filled in. */ #define TEE_IOC_VERSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 0, \ struct tee_ioctl_version_data) /** * struct tee_ioctl_shm_alloc_data - Shared memory allocate argument * @size: [in/out] Size of shared memory to allocate * @flags: [in/out] Flags to/from allocation. * @id: [out] Identifier of the shared memory * * The flags field should currently be zero as input. Updated by the call * with actual flags as defined by TEE_IOCTL_SHM_* above. * This structure is used as argument for TEE_IOC_SHM_ALLOC below. */ struct tee_ioctl_shm_alloc_data { __u64 size; __u32 flags; __s32 id; }; /** * TEE_IOC_SHM_ALLOC - allocate shared memory * * Allocates shared memory between the user space process and secure OS. * * Returns a file descriptor on success or < 0 on failure * * The returned file descriptor is used to map the shared memory into user * space. The shared memory is freed when the descriptor is closed and the * memory is unmapped. */ #define TEE_IOC_SHM_ALLOC _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 1, \ struct tee_ioctl_shm_alloc_data) /** * struct tee_ioctl_buf_data - Variable sized buffer * @buf_ptr: [in] A pointer to a buffer * @buf_len: [in] Length of the buffer above * * Used as argument for TEE_IOC_OPEN_SESSION, TEE_IOC_INVOKE, * TEE_IOC_SUPPL_RECV, and TEE_IOC_SUPPL_SEND below. */ struct tee_ioctl_buf_data { __u64 buf_ptr; __u64 buf_len; }; /* * Attributes for struct tee_ioctl_param, selects field in the union */ #define TEE_IOCTL_PARAM_ATTR_TYPE_NONE 0 /* parameter not used */ /* * These defines value parameters (struct tee_ioctl_param_value) */ #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT 1 #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT 2 #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT 3 /* input and output */ /* * These defines shared memory reference parameters (struct * tee_ioctl_param_memref) */ #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT 5 #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT 6 #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT 7 /* input and output */ /* * Mask for the type part of the attribute, leaves room for more types */ #define TEE_IOCTL_PARAM_ATTR_TYPE_MASK 0xff /* Meta parameter carrying extra information about the message. */ #define TEE_IOCTL_PARAM_ATTR_META 0x100 /* Mask of all known attr bits */ #define TEE_IOCTL_PARAM_ATTR_MASK \ (TEE_IOCTL_PARAM_ATTR_TYPE_MASK | TEE_IOCTL_PARAM_ATTR_META) /* * Matches TEEC_LOGIN_* in GP TEE Client API * Are only defined for GP compliant TEEs */ #define TEE_IOCTL_LOGIN_PUBLIC 0 #define TEE_IOCTL_LOGIN_USER 1 #define TEE_IOCTL_LOGIN_GROUP 2 #define TEE_IOCTL_LOGIN_APPLICATION 4 #define TEE_IOCTL_LOGIN_USER_APPLICATION 5 #define TEE_IOCTL_LOGIN_GROUP_APPLICATION 6 /** * struct tee_ioctl_param - parameter * @attr: attributes * @a: if a memref, offset into the shared memory object, else a value parameter * @b: if a memref, size of the buffer, else a value parameter * @c: if a memref, shared memory identifier, else a value parameter * * @attr & TEE_PARAM_ATTR_TYPE_MASK indicates if memref or value is used in * the union. TEE_PARAM_ATTR_TYPE_VALUE_* indicates value and * TEE_PARAM_ATTR_TYPE_MEMREF_* indicates memref. TEE_PARAM_ATTR_TYPE_NONE * indicates that none of the members are used. * * Shared memory is allocated with TEE_IOC_SHM_ALLOC which returns an * identifier representing the shared memory object. A memref can reference * a part of a shared memory by specifying an offset (@a) and size (@b) of * the object. To supply the entire shared memory object set the offset * (@a) to 0 and size (@b) to the previously returned size of the object. * * A client may need to present a NULL pointer in the argument * passed to a trusted application in the TEE. * This is also a requirement in GlobalPlatform Client API v1.0c * (section 3.2.5 memory references), which can be found at * http://www.globalplatform.org/specificationsdevice.asp * * If a NULL pointer is passed to a TA in the TEE, the (@c) * IOCTL parameters value must be set to TEE_MEMREF_NULL indicating a NULL * memory reference. */ struct tee_ioctl_param { __u64 attr; __u64 a; __u64 b; __u64 c; }; #define TEE_IOCTL_UUID_LEN 16 /** * struct tee_ioctl_open_session_arg - Open session argument * @uuid: [in] UUID of the Trusted Application * @clnt_uuid: [in] UUID of client * @clnt_login: [in] Login class of client, TEE_IOCTL_LOGIN_* above * @cancel_id: [in] Cancellation id, a unique value to identify this request * @session: [out] Session id * @ret: [out] return value * @ret_origin [out] origin of the return value * @num_params [in] number of parameters following this struct */ struct tee_ioctl_open_session_arg { __u8 uuid[TEE_IOCTL_UUID_LEN]; __u8 clnt_uuid[TEE_IOCTL_UUID_LEN]; __u32 clnt_login; __u32 cancel_id; __u32 session; __u32 ret; __u32 ret_origin; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_OPEN_SESSION - opens a session to a Trusted Application * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_ioctl_open_session_arg followed by any array of struct * tee_ioctl_param */ #define TEE_IOC_OPEN_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 2, \ struct tee_ioctl_buf_data) /** * struct tee_ioctl_invoke_func_arg - Invokes a function in a Trusted * Application * @func: [in] Trusted Application function, specific to the TA * @session: [in] Session id * @cancel_id: [in] Cancellation id, a unique value to identify this request * @ret: [out] return value * @ret_origin [out] origin of the return value * @num_params [in] number of parameters following this struct */ struct tee_ioctl_invoke_arg { __u32 func; __u32 session; __u32 cancel_id; __u32 ret; __u32 ret_origin; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_INVOKE - Invokes a function in a Trusted Application * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_invoke_func_arg followed by any array of struct tee_param */ #define TEE_IOC_INVOKE _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 3, \ struct tee_ioctl_buf_data) /** * struct tee_ioctl_cancel_arg - Cancels an open session or invoke ioctl * @cancel_id: [in] Cancellation id, a unique value to identify this request * @session: [in] Session id, if the session is opened, else set to 0 */ struct tee_ioctl_cancel_arg { __u32 cancel_id; __u32 session; }; /** * TEE_IOC_CANCEL - Cancels an open session or invoke */ #define TEE_IOC_CANCEL _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 4, \ struct tee_ioctl_cancel_arg) /** * struct tee_ioctl_close_session_arg - Closes an open session * @session: [in] Session id */ struct tee_ioctl_close_session_arg { __u32 session; }; /** * TEE_IOC_CLOSE_SESSION - Closes a session */ #define TEE_IOC_CLOSE_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 5, \ struct tee_ioctl_close_session_arg) /** * struct tee_iocl_supp_recv_arg - Receive a request for a supplicant function * @func: [in] supplicant function * @num_params [in/out] number of parameters following this struct * * @num_params is the number of params that tee-supplicant has room to * receive when input, @num_params is the number of actual params * tee-supplicant receives when output. */ struct tee_iocl_supp_recv_arg { __u32 func; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_SUPPL_RECV - Receive a request for a supplicant function * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_iocl_supp_recv_arg followed by any array of struct tee_param */ #define TEE_IOC_SUPPL_RECV _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 6, \ struct tee_ioctl_buf_data) /** * struct tee_iocl_supp_send_arg - Send a response to a received request * @ret: [out] return value * @num_params [in] number of parameters following this struct */ struct tee_iocl_supp_send_arg { __u32 ret; __u32 num_params; /* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; }; /** * TEE_IOC_SUPPL_SEND - Receive a request for a supplicant function * * Takes a struct tee_ioctl_buf_data which contains a struct * tee_iocl_supp_send_arg followed by any array of struct tee_param */ #define TEE_IOC_SUPPL_SEND _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 7, \ struct tee_ioctl_buf_data) /** * struct tee_ioctl_shm_register_data - Shared memory register argument * @addr: [in] Start address of shared memory to register * @length: [in/out] Length of shared memory to register * @flags: [in/out] Flags to/from registration. * @id: [out] Identifier of the shared memory * * The flags field should currently be zero as input. Updated by the call * with actual flags as defined by TEE_IOCTL_SHM_* above. * This structure is used as argument for TEE_IOC_SHM_REGISTER below. */ struct tee_ioctl_shm_register_data { __u64 addr; __u64 length; __u32 flags; __s32 id; }; /** * TEE_IOC_SHM_REGISTER - Register shared memory argument * * Registers shared memory between the user space process and secure OS. * * Returns a file descriptor on success or < 0 on failure * * The shared memory is unregisterred when the descriptor is closed. */ #define TEE_IOC_SHM_REGISTER _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 9, \ struct tee_ioctl_shm_register_data) /* * Five syscalls are used when communicating with the TEE driver. * open(): opens the device associated with the driver * ioctl(): as described above operating on the file descriptor from open() * close(): two cases * - closes the device file descriptor * - closes a file descriptor connected to allocated shared memory * mmap(): maps shared memory into user space using information from struct * tee_ioctl_shm_alloc_data * munmap(): unmaps previously shared memory */ #endif /*__TEE_H*/ linux/sched/types.h 0000644 00000005200 15063602054 0010304 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SCHED_TYPES_H #define _LINUX_SCHED_TYPES_H #include <linux/types.h> struct sched_param { int sched_priority; }; #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ /* * Extended scheduling parameters data structure. * * This is needed because the original struct sched_param can not be * altered without introducing ABI issues with legacy applications * (e.g., in sched_getparam()). * * However, the possibility of specifying more than just a priority for * the tasks may be useful for a wide variety of application fields, e.g., * multimedia, streaming, automation and control, and many others. * * This variant (sched_attr) is meant at describing a so-called * sporadic time-constrained task. In such model a task is specified by: * - the activation period or minimum instance inter-arrival time; * - the maximum (or average, depending on the actual scheduling * discipline) computation time of all instances, a.k.a. runtime; * - the deadline (relative to the actual activation time) of each * instance. * Very briefly, a periodic (sporadic) task asks for the execution of * some specific computation --which is typically called an instance-- * (at most) every period. Moreover, each instance typically lasts no more * than the runtime and must be completed by time instant t equal to * the instance activation time + the deadline. * * This is reflected by the actual fields of the sched_attr structure: * * @size size of the structure, for fwd/bwd compat. * * @sched_policy task's scheduling policy * @sched_flags for customizing the scheduler behaviour * @sched_nice task's nice value (SCHED_NORMAL/BATCH) * @sched_priority task's static priority (SCHED_FIFO/RR) * @sched_deadline representative of the task's deadline * @sched_runtime representative of the task's runtime * @sched_period representative of the task's period * * Given this task model, there are a multiplicity of scheduling algorithms * and policies, that can be used to ensure all the tasks will make their * timing constraints. * * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the * only user of this new interface. More information about the algorithm * available in the scheduling class file or in Documentation/. */ struct sched_attr { __u32 size; __u32 sched_policy; __u64 sched_flags; /* SCHED_NORMAL, SCHED_BATCH */ __s32 sched_nice; /* SCHED_FIFO, SCHED_RR */ __u32 sched_priority; /* SCHED_DEADLINE */ __u64 sched_runtime; __u64 sched_deadline; __u64 sched_period; }; #endif /* _LINUX_SCHED_TYPES_H */ linux/securebits.h 0000644 00000005220 15063602054 0010224 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SECUREBITS_H #define _LINUX_SECUREBITS_H /* Each securesetting is implemented using two bits. One bit specifies whether the setting is on or off. The other bit specify whether the setting is locked or not. A setting which is locked cannot be changed from user-level. */ #define issecure_mask(X) (1 << (X)) #define SECUREBITS_DEFAULT 0x00000000 /* When set UID 0 has no special privileges. When unset, we support inheritance of root-permissions and suid-root executable under compatibility mode. We raise the effective and inheritable bitmasks *of the executable file* if the effective uid of the new process is 0. If the real uid is 0, we raise the effective (legacy) bit of the executable file. */ #define SECURE_NOROOT 0 #define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */ #define SECBIT_NOROOT (issecure_mask(SECURE_NOROOT)) #define SECBIT_NOROOT_LOCKED (issecure_mask(SECURE_NOROOT_LOCKED)) /* When set, setuid to/from uid 0 does not trigger capability-"fixup". When unset, to provide compatiblility with old programs relying on set*uid to gain/lose privilege, transitions to/from uid 0 cause capabilities to be gained/lost. */ #define SECURE_NO_SETUID_FIXUP 2 #define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */ #define SECBIT_NO_SETUID_FIXUP (issecure_mask(SECURE_NO_SETUID_FIXUP)) #define SECBIT_NO_SETUID_FIXUP_LOCKED \ (issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED)) /* When set, a process can retain its capabilities even after transitioning to a non-root user (the set-uid fixup suppressed by bit 2). Bit-4 is cleared when a process calls exec(); setting both bit 4 and 5 will create a barrier through exec that no exec()'d child can use this feature again. */ #define SECURE_KEEP_CAPS 4 #define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */ #define SECBIT_KEEP_CAPS (issecure_mask(SECURE_KEEP_CAPS)) #define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED)) /* When set, a process cannot add new capabilities to its ambient set. */ #define SECURE_NO_CAP_AMBIENT_RAISE 6 #define SECURE_NO_CAP_AMBIENT_RAISE_LOCKED 7 /* make bit-6 immutable */ #define SECBIT_NO_CAP_AMBIENT_RAISE (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) #define SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED \ (issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED)) #define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ issecure_mask(SECURE_NO_SETUID_FIXUP) | \ issecure_mask(SECURE_KEEP_CAPS) | \ issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE)) #define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1) #endif /* _LINUX_SECUREBITS_H */ linux/sed-opal.h 0000644 00000006313 15063602054 0007564 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright © 2016 Intel Corporation * * Authors: * Rafael Antognolli <rafael.antognolli@intel.com> * Scott Bauer <scott.bauer@intel.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #ifndef _SED_OPAL_H #define _SED_OPAL_H #include <linux/types.h> #define OPAL_KEY_MAX 256 #define OPAL_MAX_LRS 9 enum opal_mbr { OPAL_MBR_ENABLE = 0x0, OPAL_MBR_DISABLE = 0x01, }; enum opal_user { OPAL_ADMIN1 = 0x0, OPAL_USER1 = 0x01, OPAL_USER2 = 0x02, OPAL_USER3 = 0x03, OPAL_USER4 = 0x04, OPAL_USER5 = 0x05, OPAL_USER6 = 0x06, OPAL_USER7 = 0x07, OPAL_USER8 = 0x08, OPAL_USER9 = 0x09, }; enum opal_lock_state { OPAL_RO = 0x01, /* 0001 */ OPAL_RW = 0x02, /* 0010 */ OPAL_LK = 0x04, /* 0100 */ }; struct opal_key { __u8 lr; __u8 key_len; __u8 __align[6]; __u8 key[OPAL_KEY_MAX]; }; struct opal_lr_act { struct opal_key key; __u32 sum; __u8 num_lrs; __u8 lr[OPAL_MAX_LRS]; __u8 align[2]; /* Align to 8 byte boundary */ }; struct opal_session_info { __u32 sum; __u32 who; struct opal_key opal_key; }; struct opal_user_lr_setup { __u64 range_start; __u64 range_length; __u32 RLE; /* Read Lock enabled */ __u32 WLE; /* Write Lock Enabled */ struct opal_session_info session; }; struct opal_lock_unlock { struct opal_session_info session; __u32 l_state; __u8 __align[4]; }; struct opal_new_pw { struct opal_session_info session; /* When we're not operating in sum, and we first set * passwords we need to set them via ADMIN authority. * After passwords are changed, we can set them via, * User authorities. * Because of this restriction we need to know about * Two different users. One in 'session' which we will use * to start the session and new_userr_pw as the user we're * chaning the pw for. */ struct opal_session_info new_user_pw; }; struct opal_mbr_data { struct opal_key key; __u8 enable_disable; __u8 __align[7]; }; #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) #define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act) #define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw) #define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info) #define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key) #define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup) #define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock) #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data) #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info) #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info) #endif /* _SED_OPAL_H */ linux/seg6.h 0000644 00000002222 15063602054 0006717 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * SR-IPv6 implementation * * Author: * David Lebrun <david.lebrun@uclouvain.be> * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_SEG6_H #define _LINUX_SEG6_H #include <linux/types.h> #include <linux/in6.h> /* For struct in6_addr. */ /* * SRH */ struct ipv6_sr_hdr { __u8 nexthdr; __u8 hdrlen; __u8 type; __u8 segments_left; __u8 first_segment; /* Represents the last_entry field of SRH */ __u8 flags; __u16 tag; struct in6_addr segments[0]; }; #define SR6_FLAG1_PROTECTED (1 << 6) #define SR6_FLAG1_OAM (1 << 5) #define SR6_FLAG1_ALERT (1 << 4) #define SR6_FLAG1_HMAC (1 << 3) #define SR6_TLV_INGRESS 1 #define SR6_TLV_EGRESS 2 #define SR6_TLV_OPAQUE 3 #define SR6_TLV_PADDING 4 #define SR6_TLV_HMAC 5 #define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) struct sr6_tlv { __u8 type; __u8 len; __u8 data[0]; }; #endif linux/seg6_genl.h 0000644 00000001115 15063602054 0007724 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SEG6_GENL_H #define _LINUX_SEG6_GENL_H #define SEG6_GENL_NAME "SEG6" #define SEG6_GENL_VERSION 0x1 enum { SEG6_ATTR_UNSPEC, SEG6_ATTR_DST, SEG6_ATTR_DSTLEN, SEG6_ATTR_HMACKEYID, SEG6_ATTR_SECRET, SEG6_ATTR_SECRETLEN, SEG6_ATTR_ALGID, SEG6_ATTR_HMACINFO, __SEG6_ATTR_MAX, }; #define SEG6_ATTR_MAX (__SEG6_ATTR_MAX - 1) enum { SEG6_CMD_UNSPEC, SEG6_CMD_SETHMAC, SEG6_CMD_DUMPHMAC, SEG6_CMD_SET_TUNSRC, SEG6_CMD_GET_TUNSRC, __SEG6_CMD_MAX, }; #define SEG6_CMD_MAX (__SEG6_CMD_MAX - 1) #endif linux/seg6_hmac.h 0000644 00000000647 15063602054 0007720 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SEG6_HMAC_H #define _LINUX_SEG6_HMAC_H #include <linux/types.h> #include <linux/seg6.h> #define SEG6_HMAC_SECRET_LEN 64 #define SEG6_HMAC_FIELD_LEN 32 struct sr6_tlv_hmac { struct sr6_tlv tlvhdr; __u16 reserved; __be32 hmackeyid; __u8 hmac[SEG6_HMAC_FIELD_LEN]; }; enum { SEG6_HMAC_ALGO_SHA1 = 1, SEG6_HMAC_ALGO_SHA256 = 2, }; #endif linux/seg6_iptunnel.h 0000644 00000001637 15063602054 0010646 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * SR-IPv6 implementation * * Author: * David Lebrun <david.lebrun@uclouvain.be> * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_SEG6_IPTUNNEL_H #define _LINUX_SEG6_IPTUNNEL_H #include <linux/seg6.h> /* For struct ipv6_sr_hdr. */ enum { SEG6_IPTUNNEL_UNSPEC, SEG6_IPTUNNEL_SRH, __SEG6_IPTUNNEL_MAX, }; #define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1) struct seg6_iptunnel_encap { int mode; struct ipv6_sr_hdr srh[0]; }; #define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3)) enum { SEG6_IPTUN_MODE_INLINE, SEG6_IPTUN_MODE_ENCAP, SEG6_IPTUN_MODE_L2ENCAP, }; #endif linux/seg6_local.h 0000644 00000004014 15063602054 0010072 0 ustar 00 /* * SR-IPv6 implementation * * Author: * David Lebrun <david.lebrun@uclouvain.be> * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_SEG6_LOCAL_H #define _LINUX_SEG6_LOCAL_H #include <linux/seg6.h> enum { SEG6_LOCAL_UNSPEC, SEG6_LOCAL_ACTION, SEG6_LOCAL_SRH, SEG6_LOCAL_TABLE, SEG6_LOCAL_NH4, SEG6_LOCAL_NH6, SEG6_LOCAL_IIF, SEG6_LOCAL_OIF, SEG6_LOCAL_BPF, __SEG6_LOCAL_MAX, }; #define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1) enum { SEG6_LOCAL_ACTION_UNSPEC = 0, /* node segment */ SEG6_LOCAL_ACTION_END = 1, /* adjacency segment (IPv6 cross-connect) */ SEG6_LOCAL_ACTION_END_X = 2, /* lookup of next seg NH in table */ SEG6_LOCAL_ACTION_END_T = 3, /* decap and L2 cross-connect */ SEG6_LOCAL_ACTION_END_DX2 = 4, /* decap and IPv6 cross-connect */ SEG6_LOCAL_ACTION_END_DX6 = 5, /* decap and IPv4 cross-connect */ SEG6_LOCAL_ACTION_END_DX4 = 6, /* decap and lookup of DA in v6 table */ SEG6_LOCAL_ACTION_END_DT6 = 7, /* decap and lookup of DA in v4 table */ SEG6_LOCAL_ACTION_END_DT4 = 8, /* binding segment with insertion */ SEG6_LOCAL_ACTION_END_B6 = 9, /* binding segment with encapsulation */ SEG6_LOCAL_ACTION_END_B6_ENCAP = 10, /* binding segment with MPLS encap */ SEG6_LOCAL_ACTION_END_BM = 11, /* lookup last seg in table */ SEG6_LOCAL_ACTION_END_S = 12, /* forward to SR-unaware VNF with static proxy */ SEG6_LOCAL_ACTION_END_AS = 13, /* forward to SR-unaware VNF with masquerading */ SEG6_LOCAL_ACTION_END_AM = 14, /* custom BPF action */ SEG6_LOCAL_ACTION_END_BPF = 15, __SEG6_LOCAL_ACTION_MAX, }; #define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1) enum { SEG6_LOCAL_BPF_PROG_UNSPEC, SEG6_LOCAL_BPF_PROG, SEG6_LOCAL_BPF_PROG_NAME, __SEG6_LOCAL_BPF_PROG_MAX, }; #define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1) #endif linux/selinux_netlink.h 0000644 00000002253 15063602054 0011272 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Netlink event notifications for SELinux. * * Author: James Morris <jmorris@redhat.com> * * Copyright (C) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * as published by the Free Software Foundation. */ #ifndef _LINUX_SELINUX_NETLINK_H #define _LINUX_SELINUX_NETLINK_H #include <linux/types.h> /* Message types. */ #define SELNL_MSG_BASE 0x10 enum { SELNL_MSG_SETENFORCE = SELNL_MSG_BASE, SELNL_MSG_POLICYLOAD, SELNL_MSG_MAX }; /* Multicast groups - backwards compatiblility for userspace */ #define SELNL_GRP_NONE 0x00000000 #define SELNL_GRP_AVC 0x00000001 /* AVC notifications */ #define SELNL_GRP_ALL 0xffffffff enum selinux_nlgroups { SELNLGRP_NONE, #define SELNLGRP_NONE SELNLGRP_NONE SELNLGRP_AVC, #define SELNLGRP_AVC SELNLGRP_AVC __SELNLGRP_MAX }; #define SELNLGRP_MAX (__SELNLGRP_MAX - 1) /* Message structures */ struct selnl_msg_setenforce { __s32 val; }; struct selnl_msg_policyload { __u32 seqno; }; #endif /* _LINUX_SELINUX_NETLINK_H */ linux/sem.h 0000644 00000005743 15063602054 0006652 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SEM_H #define _LINUX_SEM_H #include <linux/ipc.h> /* semop flags */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ /* semctl Command Definitions. */ #define GETPID 11 /* get sempid */ #define GETVAL 12 /* get semval */ #define GETALL 13 /* get all semval's */ #define GETNCNT 14 /* get semncnt */ #define GETZCNT 15 /* get semzcnt */ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ /* ipcs ctl cmds */ #define SEM_STAT 18 #define SEM_INFO 19 #define SEM_STAT_ANY 20 /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct semid_ds { struct ipc_perm sem_perm; /* permissions .. see ipc.h */ __kernel_time_t sem_otime; /* last semop time */ __kernel_time_t sem_ctime; /* create/last semctl() time */ struct sem *sem_base; /* ptr to first semaphore in array */ struct sem_queue *sem_pending; /* pending operations to be processed */ struct sem_queue **sem_pending_last; /* last pending operation */ struct sem_undo *undo; /* undo requests on this array */ unsigned short sem_nsems; /* no. of semaphores in array */ }; /* Include the definition of semid64_ds */ #include <asm/sembuf.h> /* semop system calls takes an array of these. */ struct sembuf { unsigned short sem_num; /* semaphore index in array */ short sem_op; /* semaphore operation */ short sem_flg; /* operation flags */ }; /* arg for semctl system calls. */ union semun { int val; /* value for SETVAL */ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ unsigned short *array; /* array for GETALL & SETALL */ struct seminfo *__buf; /* buffer for IPC_INFO */ void *__pad; }; struct seminfo { int semmap; int semmni; int semmns; int semmnu; int semmsl; int semopm; int semume; int semusz; int semvmx; int semaem; }; /* * SEMMNI, SEMMSL and SEMMNS are default values which can be * modified by sysctl. * The values has been chosen to be larger than necessary for any * known configuration. * * SEMOPM should not be increased beyond 1000, otherwise there is the * risk that semop()/semtimedop() fails due to kernel memory fragmentation when * allocating the sop array. */ #define SEMMNI 32000 /* <= IPCMNI max # of semaphore identifiers */ #define SEMMSL 32000 /* <= INT_MAX max num of semaphores per id */ #define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */ #define SEMOPM 500 /* <= 1 000 max num of ops per semop call */ #define SEMVMX 32767 /* <= 32767 semaphore maximum value */ #define SEMAEM SEMVMX /* adjust on exit max value */ /* unused */ #define SEMUME SEMOPM /* max num of undo entries per process */ #define SEMMNU SEMMNS /* num of undo structures system wide */ #define SEMMAP SEMMNS /* # of entries in semaphore map */ #define SEMUSZ 20 /* sizeof struct sem_undo */ #endif /* _LINUX_SEM_H */ linux/serial.h 0000644 00000007432 15063602054 0007342 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * include/linux/serial.h * * Copyright (C) 1992 by Theodore Ts'o. * * Redistribution of this file is permitted under the terms of the GNU * Public License (GPL) */ #ifndef _LINUX_SERIAL_H #define _LINUX_SERIAL_H #include <linux/types.h> #include <linux/tty_flags.h> struct serial_struct { int type; int line; unsigned int port; int irq; int flags; int xmit_fifo_size; int custom_divisor; int baud_base; unsigned short close_delay; char io_type; char reserved_char[1]; int hub6; unsigned short closing_wait; /* time to wait before closing */ unsigned short closing_wait2; /* no longer used... */ unsigned char *iomem_base; unsigned short iomem_reg_shift; unsigned int port_high; unsigned long iomap_base; /* cookie passed into ioremap */ }; /* * For the close wait times, 0 means wait forever for serial port to * flush its output. 65535 means don't wait at all. */ #define ASYNC_CLOSING_WAIT_INF 0 #define ASYNC_CLOSING_WAIT_NONE 65535 /* * These are the supported serial types. */ #define PORT_UNKNOWN 0 #define PORT_8250 1 #define PORT_16450 2 #define PORT_16550 3 #define PORT_16550A 4 #define PORT_CIRRUS 5 /* usurped by cyclades.c */ #define PORT_16650 6 #define PORT_16650V2 7 #define PORT_16750 8 #define PORT_STARTECH 9 /* usurped by cyclades.c */ #define PORT_16C950 10 /* Oxford Semiconductor */ #define PORT_16654 11 #define PORT_16850 12 #define PORT_RSA 13 /* RSA-DV II/S card */ #define PORT_MAX 13 #define SERIAL_IO_PORT 0 #define SERIAL_IO_HUB6 1 #define SERIAL_IO_MEM 2 #define SERIAL_IO_MEM32 3 #define SERIAL_IO_AU 4 #define SERIAL_IO_TSI 5 #define SERIAL_IO_MEM32BE 6 #define SERIAL_IO_MEM16 7 #define UART_CLEAR_FIFO 0x01 #define UART_USE_FIFO 0x02 #define UART_STARTECH 0x04 #define UART_NATSEMI 0x08 /* * Multiport serial configuration structure --- external structure */ struct serial_multiport_struct { int irq; int port1; unsigned char mask1, match1; int port2; unsigned char mask2, match2; int port3; unsigned char mask3, match3; int port4; unsigned char mask4, match4; int port_monitor; int reserved[32]; }; /* * Serial input interrupt line counters -- external structure * Four lines can interrupt: CTS, DSR, RI, DCD */ struct serial_icounter_struct { int cts, dsr, rng, dcd; int rx, tx; int frame, overrun, parity, brk; int buf_overrun; int reserved[9]; }; /* * Serial interface for controlling RS485 settings on chips with suitable * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your * platform. The set function returns the new state, with any unsupported bits * reverted appropriately. */ struct serial_rs485 { __u32 flags; /* RS485 feature flags */ #define SER_RS485_ENABLED (1 << 0) /* If enabled */ #define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for RTS pin when sending */ #define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for RTS pin after sent*/ #define SER_RS485_RX_DURING_TX (1 << 4) #define SER_RS485_TERMINATE_BUS (1 << 5) /* Enable bus termination (if supported) */ __u32 delay_rts_before_send; /* Delay before send (milliseconds) */ __u32 delay_rts_after_send; /* Delay after send (milliseconds) */ __u32 padding[5]; /* Memory is cheap, new structs are a royal PITA .. */ }; /* * Serial interface for controlling ISO7816 settings on chips with suitable * support. Set with TIOCSISO7816 and get with TIOCGISO7816 if supported by * your platform. */ struct serial_iso7816 { __u32 flags; /* ISO7816 feature flags */ #define SER_ISO7816_ENABLED (1 << 0) #define SER_ISO7816_T_PARAM (0x0f << 4) #define SER_ISO7816_T(t) (((t) & 0x0f) << 4) __u32 tg; __u32 sc_fi; __u32 sc_di; __u32 clk; __u32 reserved[5]; }; #endif /* _LINUX_SERIAL_H */ linux/serial_core.h 0000644 00000014145 15063602054 0010351 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * linux/drivers/char/serial_core.h * * Copyright (C) 2000 Deep Blue Solutions Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef LINUX_SERIAL_CORE_H #define LINUX_SERIAL_CORE_H #include <linux/serial.h> /* * The type definitions. These are from Ted Ts'o's serial.h */ #define PORT_UNKNOWN 0 #define PORT_8250 1 #define PORT_16450 2 #define PORT_16550 3 #define PORT_16550A 4 #define PORT_CIRRUS 5 #define PORT_16650 6 #define PORT_16650V2 7 #define PORT_16750 8 #define PORT_STARTECH 9 #define PORT_16C950 10 #define PORT_16654 11 #define PORT_16850 12 #define PORT_RSA 13 #define PORT_NS16550A 14 #define PORT_XSCALE 15 #define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ #define PORT_OCTEON 17 /* Cavium OCTEON internal UART */ #define PORT_AR7 18 /* Texas Instruments AR7 internal UART */ #define PORT_U6_16550A 19 /* ST-Ericsson U6xxx internal UART */ #define PORT_TEGRA 20 /* NVIDIA Tegra internal UART */ #define PORT_XR17D15X 21 /* Exar XR17D15x UART */ #define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ #define PORT_BRCM_TRUMANAGE 25 #define PORT_ALTR_16550_F32 26 /* Altera 16550 UART with 32 FIFOs */ #define PORT_ALTR_16550_F64 27 /* Altera 16550 UART with 64 FIFOs */ #define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */ #define PORT_RT2880 29 /* Ralink RT2880 internal UART */ #define PORT_16550A_FSL64 30 /* Freescale 16550 UART with 64 FIFOs */ /* * ARM specific type numbers. These are not currently guaranteed * to be implemented, and will change in the future. These are * separate so any additions to the old serial.c that occur before * we are merged can be easily merged here. */ #define PORT_PXA 31 #define PORT_AMBA 32 #define PORT_CLPS711X 33 #define PORT_SA1100 34 #define PORT_UART00 35 #define PORT_OWL 36 #define PORT_21285 37 /* Sparc type numbers. */ #define PORT_SUNZILOG 38 #define PORT_SUNSAB 39 /* Nuvoton UART */ #define PORT_NPCM 40 /* Intel EG20 */ #define PORT_PCH_8LINE 44 #define PORT_PCH_2LINE 45 /* DEC */ #define PORT_DZ 46 #define PORT_ZS 47 /* Parisc type numbers. */ #define PORT_MUX 48 /* Atmel AT91 SoC */ #define PORT_ATMEL 49 /* Macintosh Zilog type numbers */ #define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ #define PORT_PMAC_ZILOG 51 /* SH-SCI */ #define PORT_SCI 52 #define PORT_SCIF 53 #define PORT_IRDA 54 /* Samsung S3C2410 SoC and derivatives thereof */ #define PORT_S3C2410 55 /* SGI IP22 aka Indy / Challenge S / Indigo 2 */ #define PORT_IP22ZILOG 56 /* Sharp LH7a40x -- an ARM9 SoC series */ #define PORT_LH7A40X 57 /* PPC CPM type number */ #define PORT_CPM 58 /* MPC52xx (and MPC512x) type numbers */ #define PORT_MPC52xx 59 /* IBM icom */ #define PORT_ICOM 60 /* Samsung S3C2440 SoC */ #define PORT_S3C2440 61 /* Motorola i.MX SoC */ #define PORT_IMX 62 /* Marvell MPSC */ #define PORT_MPSC 63 /* TXX9 type number */ #define PORT_TXX9 64 /* NEC VR4100 series SIU/DSIU */ #define PORT_VR41XX_SIU 65 #define PORT_VR41XX_DSIU 66 /* Samsung S3C2400 SoC */ #define PORT_S3C2400 67 /* M32R SIO */ #define PORT_M32R_SIO 68 /*Digi jsm */ #define PORT_JSM 69 #define PORT_PNX8XXX 70 /* Hilscher netx */ #define PORT_NETX 71 /* SUN4V Hypervisor Console */ #define PORT_SUNHV 72 #define PORT_S3C2412 73 /* Xilinx uartlite */ #define PORT_UARTLITE 74 /* Blackfin bf5xx */ #define PORT_BFIN 75 /* Micrel KS8695 */ #define PORT_KS8695 76 /* Broadcom SB1250, etc. SOC */ #define PORT_SB1250_DUART 77 /* Freescale ColdFire */ #define PORT_MCF 78 /* Blackfin SPORT */ #define PORT_BFIN_SPORT 79 /* MN10300 on-chip UART numbers */ #define PORT_MN10300 80 #define PORT_MN10300_CTS 81 #define PORT_SC26XX 82 /* SH-SCI */ #define PORT_SCIFA 83 #define PORT_S3C6400 84 /* NWPSERIAL, now removed */ #define PORT_NWPSERIAL 85 /* MAX3100 */ #define PORT_MAX3100 86 /* Timberdale UART */ #define PORT_TIMBUART 87 /* Qualcomm MSM SoCs */ #define PORT_MSM 88 /* BCM63xx family SoCs */ #define PORT_BCM63XX 89 /* Aeroflex Gaisler GRLIB APBUART */ #define PORT_APBUART 90 /* Altera UARTs */ #define PORT_ALTERA_JTAGUART 91 #define PORT_ALTERA_UART 92 /* SH-SCI */ #define PORT_SCIFB 93 /* MAX310X */ #define PORT_MAX310X 94 /* TI DA8xx/66AK2x */ #define PORT_DA830 95 /* TI OMAP-UART */ #define PORT_OMAP 96 /* VIA VT8500 SoC */ #define PORT_VT8500 97 /* Cadence (Xilinx Zynq) UART */ #define PORT_XUARTPS 98 /* Atheros AR933X SoC */ #define PORT_AR933X 99 /* Energy Micro efm32 SoC */ #define PORT_EFMUART 100 /* ARC (Synopsys) on-chip UART */ #define PORT_ARC 101 /* Rocketport EXPRESS/INFINITY */ #define PORT_RP2 102 /* Freescale lpuart */ #define PORT_LPUART 103 /* SH-SCI */ #define PORT_HSCIF 104 /* ST ASC type numbers */ #define PORT_ASC 105 /* Tilera TILE-Gx UART */ #define PORT_TILEGX 106 /* MEN 16z135 UART */ #define PORT_MEN_Z135 107 /* SC16IS74xx */ #define PORT_SC16IS7XX 108 /* MESON */ #define PORT_MESON 109 /* Conexant Digicolor */ #define PORT_DIGICOLOR 110 /* SPRD SERIAL */ #define PORT_SPRD 111 /* Cris v10 / v32 SoC */ #define PORT_CRIS 112 /* STM32 USART */ #define PORT_STM32 113 /* MVEBU UART */ #define PORT_MVEBU 114 /* Microchip PIC32 UART */ #define PORT_PIC32 115 /* MPS2 UART */ #define PORT_MPS2UART 116 /* MediaTek BTIF */ #define PORT_MTK_BTIF 117 /* Sunix UART */ #define PORT_SUNIX 121 #endif /* LINUX_SERIAL_CORE_H */ linux/serial_reg.h 0000644 00000036210 15063602054 0010173 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * include/linux/serial_reg.h * * Copyright (C) 1992, 1994 by Theodore Ts'o. * * Redistribution of this file is permitted under the terms of the GNU * Public License (GPL) * * These are the UART port assignments, expressed as offsets from the base * register. These assignments should hold for any serial port based on * a 8250, 16450, or 16550(A). */ #ifndef _LINUX_SERIAL_REG_H #define _LINUX_SERIAL_REG_H /* * DLAB=0 */ #define UART_RX 0 /* In: Receive buffer */ #define UART_TX 0 /* Out: Transmit buffer */ #define UART_IER 1 /* Out: Interrupt Enable Register */ #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ /* * Sleep mode for ST16650 and TI16750. For the ST16650, EFR[4]=1 */ #define UART_IERX_SLEEP 0x10 /* Enable sleep mode */ #define UART_IIR 2 /* In: Interrupt ID Register */ #define UART_IIR_NO_INT 0x01 /* No interrupts pending */ #define UART_IIR_ID 0x0e /* Mask for the interrupt ID */ #define UART_IIR_MSI 0x00 /* Modem status interrupt */ #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ #define UART_IIR_RDI 0x04 /* Receiver data interrupt */ #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */ #define UART_IIR_BUSY 0x07 /* DesignWare APB Busy Detect */ #define UART_IIR_RX_TIMEOUT 0x0c /* OMAP RX Timeout interrupt */ #define UART_IIR_XOFF 0x10 /* OMAP XOFF/Special Character */ #define UART_IIR_CTS_RTS_DSR 0x20 /* OMAP CTS/RTS/DSR Change */ #define UART_FCR 2 /* Out: FIFO Control Register */ #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ #define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ #define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */ #define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */ /* * Note: The FIFO trigger levels are chip specific: * RX:76 = 00 01 10 11 TX:54 = 00 01 10 11 * PC16550D: 1 4 8 14 xx xx xx xx * TI16C550A: 1 4 8 14 xx xx xx xx * TI16C550C: 1 4 8 14 xx xx xx xx * ST16C550: 1 4 8 14 xx xx xx xx * ST16C650: 8 16 24 28 16 8 24 30 PORT_16650V2 * NS16C552: 1 4 8 14 xx xx xx xx * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 * TI16C752: 8 16 56 60 8 16 32 56 * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA */ #define UART_FCR_R_TRIG_00 0x00 #define UART_FCR_R_TRIG_01 0x40 #define UART_FCR_R_TRIG_10 0x80 #define UART_FCR_R_TRIG_11 0xc0 #define UART_FCR_T_TRIG_00 0x00 #define UART_FCR_T_TRIG_01 0x10 #define UART_FCR_T_TRIG_10 0x20 #define UART_FCR_T_TRIG_11 0x30 #define UART_FCR_TRIGGER_MASK 0xC0 /* Mask for the FIFO trigger range */ #define UART_FCR_TRIGGER_1 0x00 /* Mask for trigger set at 1 */ #define UART_FCR_TRIGGER_4 0x40 /* Mask for trigger set at 4 */ #define UART_FCR_TRIGGER_8 0x80 /* Mask for trigger set at 8 */ #define UART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */ /* 16650 definitions */ #define UART_FCR6_R_TRIGGER_8 0x00 /* Mask for receive trigger set at 1 */ #define UART_FCR6_R_TRIGGER_16 0x40 /* Mask for receive trigger set at 4 */ #define UART_FCR6_R_TRIGGER_24 0x80 /* Mask for receive trigger set at 8 */ #define UART_FCR6_R_TRIGGER_28 0xC0 /* Mask for receive trigger set at 14 */ #define UART_FCR6_T_TRIGGER_16 0x00 /* Mask for transmit trigger set at 16 */ #define UART_FCR6_T_TRIGGER_8 0x10 /* Mask for transmit trigger set at 8 */ #define UART_FCR6_T_TRIGGER_24 0x20 /* Mask for transmit trigger set at 24 */ #define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ #define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750 and some Freescale UARTs) */ #define UART_FCR_R_TRIG_SHIFT 6 #define UART_FCR_R_TRIG_BITS(x) \ (((x) & UART_FCR_TRIGGER_MASK) >> UART_FCR_R_TRIG_SHIFT) #define UART_FCR_R_TRIG_MAX_STATE 4 #define UART_LCR 3 /* Out: Line Control Register */ /* * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits. */ #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ #define UART_LCR_SBC 0x40 /* Set break control */ #define UART_LCR_SPAR 0x20 /* Stick parity (?) */ #define UART_LCR_EPAR 0x10 /* Even parity select */ #define UART_LCR_PARITY 0x08 /* Parity Enable */ #define UART_LCR_STOP 0x04 /* Stop bits: 0=1 bit, 1=2 bits */ #define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */ #define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */ #define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ #define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ /* * Access to some registers depends on register access / configuration * mode. */ #define UART_LCR_CONF_MODE_A UART_LCR_DLAB /* Configutation mode A */ #define UART_LCR_CONF_MODE_B 0xBF /* Configutation mode B */ #define UART_MCR 4 /* Out: Modem Control Register */ #define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */ #define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */ #define UART_MCR_XONANY 0x20 /* Enable Xon Any (TI16C752, EFR[4]=1) */ #define UART_MCR_AFE 0x20 /* Enable auto-RTS/CTS (TI16C550C/TI16C750) */ #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ #define UART_MCR_OUT2 0x08 /* Out2 complement */ #define UART_MCR_OUT1 0x04 /* Out1 complement */ #define UART_MCR_RTS 0x02 /* RTS complement */ #define UART_MCR_DTR 0x01 /* DTR complement */ #define UART_LSR 5 /* In: Line Status Register */ #define UART_LSR_FIFOE 0x80 /* Fifo error */ #define UART_LSR_TEMT 0x40 /* Transmitter empty */ #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */ #define UART_LSR_BI 0x10 /* Break interrupt indicator */ #define UART_LSR_FE 0x08 /* Frame error indicator */ #define UART_LSR_PE 0x04 /* Parity error indicator */ #define UART_LSR_OE 0x02 /* Overrun error indicator */ #define UART_LSR_DR 0x01 /* Receiver data ready */ #define UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */ #define UART_MSR 6 /* In: Modem Status Register */ #define UART_MSR_DCD 0x80 /* Data Carrier Detect */ #define UART_MSR_RI 0x40 /* Ring Indicator */ #define UART_MSR_DSR 0x20 /* Data Set Ready */ #define UART_MSR_CTS 0x10 /* Clear to Send */ #define UART_MSR_DDCD 0x08 /* Delta DCD */ #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */ #define UART_MSR_DDSR 0x02 /* Delta DSR */ #define UART_MSR_DCTS 0x01 /* Delta CTS */ #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ #define UART_SCR 7 /* I/O: Scratch Register */ /* * DLAB=1 */ #define UART_DLL 0 /* Out: Divisor Latch Low */ #define UART_DLM 1 /* Out: Divisor Latch High */ #define UART_DIV_MAX 0xFFFF /* Max divisor value */ /* * LCR=0xBF (or DLAB=1 for 16C660) */ #define UART_EFR 2 /* I/O: Extended Features Register */ #define UART_XR_EFR 9 /* I/O: Extended Features Register (XR17D15x) */ #define UART_EFR_CTS 0x80 /* CTS flow control */ #define UART_EFR_RTS 0x40 /* RTS flow control */ #define UART_EFR_SCD 0x20 /* Special character detect */ #define UART_EFR_ECB 0x10 /* Enhanced control bit */ /* * the low four bits control software flow control */ /* * LCR=0xBF, TI16C752, ST16650, ST16650A, ST16654 */ #define UART_XON1 4 /* I/O: Xon character 1 */ #define UART_XON2 5 /* I/O: Xon character 2 */ #define UART_XOFF1 6 /* I/O: Xoff character 1 */ #define UART_XOFF2 7 /* I/O: Xoff character 2 */ /* * EFR[4]=1 MCR[6]=1, TI16C752 */ #define UART_TI752_TCR 6 /* I/O: transmission control register */ #define UART_TI752_TLR 7 /* I/O: trigger level register */ /* * LCR=0xBF, XR16C85x */ #define UART_TRG 0 /* FCTR bit 7 selects Rx or Tx * In: Fifo count * Out: Fifo custom trigger levels */ /* * These are the definitions for the Programmable Trigger Register */ #define UART_TRG_1 0x01 #define UART_TRG_4 0x04 #define UART_TRG_8 0x08 #define UART_TRG_16 0x10 #define UART_TRG_32 0x20 #define UART_TRG_64 0x40 #define UART_TRG_96 0x60 #define UART_TRG_120 0x78 #define UART_TRG_128 0x80 #define UART_FCTR 1 /* Feature Control Register */ #define UART_FCTR_RTS_NODELAY 0x00 /* RTS flow control delay */ #define UART_FCTR_RTS_4DELAY 0x01 #define UART_FCTR_RTS_6DELAY 0x02 #define UART_FCTR_RTS_8DELAY 0x03 #define UART_FCTR_IRDA 0x04 /* IrDa data encode select */ #define UART_FCTR_TX_INT 0x08 /* Tx interrupt type select */ #define UART_FCTR_TRGA 0x00 /* Tx/Rx 550 trigger table select */ #define UART_FCTR_TRGB 0x10 /* Tx/Rx 650 trigger table select */ #define UART_FCTR_TRGC 0x20 /* Tx/Rx 654 trigger table select */ #define UART_FCTR_TRGD 0x30 /* Tx/Rx 850 programmable trigger select */ #define UART_FCTR_SCR_SWAP 0x40 /* Scratch pad register swap */ #define UART_FCTR_RX 0x00 /* Programmable trigger mode select */ #define UART_FCTR_TX 0x80 /* Programmable trigger mode select */ /* * LCR=0xBF, FCTR[6]=1 */ #define UART_EMSR 7 /* Extended Mode Select Register */ #define UART_EMSR_FIFO_COUNT 0x01 /* Rx/Tx select */ #define UART_EMSR_ALT_COUNT 0x02 /* Alternating count select */ /* * The Intel XScale on-chip UARTs define these bits */ #define UART_IER_DMAE 0x80 /* DMA Requests Enable */ #define UART_IER_UUE 0x40 /* UART Unit Enable */ #define UART_IER_NRZE 0x20 /* NRZ coding Enable */ #define UART_IER_RTOIE 0x10 /* Receiver Time Out Interrupt Enable */ #define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ #define UART_FCR_PXAR1 0x00 /* receive FIFO threshold = 1 */ #define UART_FCR_PXAR8 0x40 /* receive FIFO threshold = 8 */ #define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ #define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ /* * These register definitions are for the 16C950 */ #define UART_ASR 0x01 /* Additional Status Register */ #define UART_RFL 0x03 /* Receiver FIFO level */ #define UART_TFL 0x04 /* Transmitter FIFO level */ #define UART_ICR 0x05 /* Index Control Register */ /* The 16950 ICR registers */ #define UART_ACR 0x00 /* Additional Control Register */ #define UART_CPR 0x01 /* Clock Prescalar Register */ #define UART_TCR 0x02 /* Times Clock Register */ #define UART_CKS 0x03 /* Clock Select Register */ #define UART_TTL 0x04 /* Transmitter Interrupt Trigger Level */ #define UART_RTL 0x05 /* Receiver Interrupt Trigger Level */ #define UART_FCL 0x06 /* Flow Control Level Lower */ #define UART_FCH 0x07 /* Flow Control Level Higher */ #define UART_ID1 0x08 /* ID #1 */ #define UART_ID2 0x09 /* ID #2 */ #define UART_ID3 0x0A /* ID #3 */ #define UART_REV 0x0B /* Revision */ #define UART_CSR 0x0C /* Channel Software Reset */ #define UART_NMR 0x0D /* Nine-bit Mode Register */ #define UART_CTR 0xFF /* * The 16C950 Additional Control Register */ #define UART_ACR_RXDIS 0x01 /* Receiver disable */ #define UART_ACR_TXDIS 0x02 /* Transmitter disable */ #define UART_ACR_DSRFC 0x04 /* DSR Flow Control */ #define UART_ACR_TLENB 0x20 /* 950 trigger levels enable */ #define UART_ACR_ICRRD 0x40 /* ICR Read enable */ #define UART_ACR_ASREN 0x80 /* Additional status enable */ /* * These definitions are for the RSA-DV II/S card, from * * Kiyokazu SUTO <suto@ks-and-ks.ne.jp> */ #define UART_RSA_BASE (-8) #define UART_RSA_MSR ((UART_RSA_BASE) + 0) /* I/O: Mode Select Register */ #define UART_RSA_MSR_SWAP (1 << 0) /* Swap low/high 8 bytes in I/O port addr */ #define UART_RSA_MSR_FIFO (1 << 2) /* Enable the external FIFO */ #define UART_RSA_MSR_FLOW (1 << 3) /* Enable the auto RTS/CTS flow control */ #define UART_RSA_MSR_ITYP (1 << 4) /* Level (1) / Edge triger (0) */ #define UART_RSA_IER ((UART_RSA_BASE) + 1) /* I/O: Interrupt Enable Register */ #define UART_RSA_IER_Rx_FIFO_H (1 << 0) /* Enable Rx FIFO half full int. */ #define UART_RSA_IER_Tx_FIFO_H (1 << 1) /* Enable Tx FIFO half full int. */ #define UART_RSA_IER_Tx_FIFO_E (1 << 2) /* Enable Tx FIFO empty int. */ #define UART_RSA_IER_Rx_TOUT (1 << 3) /* Enable char receive timeout int */ #define UART_RSA_IER_TIMER (1 << 4) /* Enable timer interrupt */ #define UART_RSA_SRR ((UART_RSA_BASE) + 2) /* IN: Status Read Register */ #define UART_RSA_SRR_Tx_FIFO_NEMP (1 << 0) /* Tx FIFO is not empty (1) */ #define UART_RSA_SRR_Tx_FIFO_NHFL (1 << 1) /* Tx FIFO is not half full (1) */ #define UART_RSA_SRR_Tx_FIFO_NFUL (1 << 2) /* Tx FIFO is not full (1) */ #define UART_RSA_SRR_Rx_FIFO_NEMP (1 << 3) /* Rx FIFO is not empty (1) */ #define UART_RSA_SRR_Rx_FIFO_NHFL (1 << 4) /* Rx FIFO is not half full (1) */ #define UART_RSA_SRR_Rx_FIFO_NFUL (1 << 5) /* Rx FIFO is not full (1) */ #define UART_RSA_SRR_Rx_TOUT (1 << 6) /* Character reception timeout occurred (1) */ #define UART_RSA_SRR_TIMER (1 << 7) /* Timer interrupt occurred */ #define UART_RSA_FRR ((UART_RSA_BASE) + 2) /* OUT: FIFO Reset Register */ #define UART_RSA_TIVSR ((UART_RSA_BASE) + 3) /* I/O: Timer Interval Value Set Register */ #define UART_RSA_TCR ((UART_RSA_BASE) + 4) /* OUT: Timer Control Register */ #define UART_RSA_TCR_SWITCH (1 << 0) /* Timer on */ /* * The RSA DSV/II board has two fixed clock frequencies. One is the * standard rate, and the other is 8 times faster. */ #define SERIAL_RSA_BAUD_BASE (921600) #define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8) /* Extra registers for TI DA8xx/66AK2x */ #define UART_DA830_PWREMU_MGMT 12 /* PWREMU_MGMT register bits */ #define UART_DA830_PWREMU_MGMT_FREE (1 << 0) /* Free-running mode */ #define UART_DA830_PWREMU_MGMT_URRST (1 << 13) /* Receiver reset/enable */ #define UART_DA830_PWREMU_MGMT_UTRST (1 << 14) /* Transmitter reset/enable */ /* * Extra serial register definitions for the internal UARTs * in TI OMAP processors. */ #define OMAP1_UART1_BASE 0xfffb0000 #define OMAP1_UART2_BASE 0xfffb0800 #define OMAP1_UART3_BASE 0xfffb9800 #define UART_OMAP_MDR1 0x08 /* Mode definition register */ #define UART_OMAP_MDR2 0x09 /* Mode definition register 2 */ #define UART_OMAP_SCR 0x10 /* Supplementary control register */ #define UART_OMAP_SSR 0x11 /* Supplementary status register */ #define UART_OMAP_EBLR 0x12 /* BOF length register */ #define UART_OMAP_OSC_12M_SEL 0x13 /* OMAP1510 12MHz osc select */ #define UART_OMAP_MVER 0x14 /* Module version register */ #define UART_OMAP_SYSC 0x15 /* System configuration register */ #define UART_OMAP_SYSS 0x16 /* System status register */ #define UART_OMAP_WER 0x17 /* Wake-up enable register */ #define UART_OMAP_TX_LVL 0x1a /* TX FIFO level register */ /* * These are the definitions for the MDR1 register */ #define UART_OMAP_MDR1_16X_MODE 0x00 /* UART 16x mode */ #define UART_OMAP_MDR1_SIR_MODE 0x01 /* SIR mode */ #define UART_OMAP_MDR1_16X_ABAUD_MODE 0x02 /* UART 16x auto-baud */ #define UART_OMAP_MDR1_13X_MODE 0x03 /* UART 13x mode */ #define UART_OMAP_MDR1_MIR_MODE 0x04 /* MIR mode */ #define UART_OMAP_MDR1_FIR_MODE 0x05 /* FIR mode */ #define UART_OMAP_MDR1_CIR_MODE 0x06 /* CIR mode */ #define UART_OMAP_MDR1_DISABLE 0x07 /* Disable (default state) */ /* * These are definitions for the Altera ALTR_16550_F32/F64/F128 * Normalized from 0x100 to 0x40 because of shift by 2 (32 bit regs). */ #define UART_ALTR_AFR 0x40 /* Additional Features Register */ #define UART_ALTR_EN_TXFIFO_LW 0x01 /* Enable the TX FIFO Low Watermark */ #define UART_ALTR_TX_LOW 0x41 /* Tx FIFO Low Watermark */ #endif /* _LINUX_SERIAL_REG_H */ linux/serio.h 0000644 00000003765 15063602055 0007212 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 1999-2002 Vojtech Pavlik * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #ifndef _SERIO_H #define _SERIO_H #include <linux/ioctl.h> #define SPIOCSTYPE _IOW('q', 0x01, unsigned long) /* * bit masks for use in "interrupt" flags (3rd argument) */ #define SERIO_TIMEOUT BIT(0) #define SERIO_PARITY BIT(1) #define SERIO_FRAME BIT(2) #define SERIO_OOB_DATA BIT(3) /* * Serio types */ #define SERIO_XT 0x00 #define SERIO_8042 0x01 #define SERIO_RS232 0x02 #define SERIO_HIL_MLC 0x03 #define SERIO_PS_PSTHRU 0x05 #define SERIO_8042_XL 0x06 /* * Serio protocols */ #define SERIO_UNKNOWN 0x00 #define SERIO_MSC 0x01 #define SERIO_SUN 0x02 #define SERIO_MS 0x03 #define SERIO_MP 0x04 #define SERIO_MZ 0x05 #define SERIO_MZP 0x06 #define SERIO_MZPP 0x07 #define SERIO_VSXXXAA 0x08 #define SERIO_SUNKBD 0x10 #define SERIO_WARRIOR 0x18 #define SERIO_SPACEORB 0x19 #define SERIO_MAGELLAN 0x1a #define SERIO_SPACEBALL 0x1b #define SERIO_GUNZE 0x1c #define SERIO_IFORCE 0x1d #define SERIO_STINGER 0x1e #define SERIO_NEWTON 0x1f #define SERIO_STOWAWAY 0x20 #define SERIO_H3600 0x21 #define SERIO_PS2SER 0x22 #define SERIO_TWIDKBD 0x23 #define SERIO_TWIDJOY 0x24 #define SERIO_HIL 0x25 #define SERIO_SNES232 0x26 #define SERIO_SEMTECH 0x27 #define SERIO_LKKBD 0x28 #define SERIO_ELO 0x29 #define SERIO_MICROTOUCH 0x30 #define SERIO_PENMOUNT 0x31 #define SERIO_TOUCHRIGHT 0x32 #define SERIO_TOUCHWIN 0x33 #define SERIO_TAOSEVM 0x34 #define SERIO_FUJITSU 0x35 #define SERIO_ZHENHUA 0x36 #define SERIO_INEXIO 0x37 #define SERIO_TOUCHIT213 0x38 #define SERIO_W8001 0x39 #define SERIO_DYNAPRO 0x3a #define SERIO_HAMPSHIRE 0x3b #define SERIO_PS2MULT 0x3c #define SERIO_TSC40 0x3d #define SERIO_WACOM_IV 0x3e #define SERIO_EGALAX 0x3f #define SERIO_PULSE8_CEC 0x40 #define SERIO_RAINSHADOW_CEC 0x41 #endif /* _SERIO_H */ linux/sev-guest.h 0000644 00000004377 15063602055 0010013 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* * Userspace interface for AMD SEV and SNP guest driver. * * Copyright (C) 2021 Advanced Micro Devices, Inc. * * Author: Brijesh Singh <brijesh.singh@amd.com> * * SEV API specification is available at: https://developer.amd.com/sev/ */ #ifndef __UAPI_LINUX_SEV_GUEST_H_ #define __UAPI_LINUX_SEV_GUEST_H_ #include <linux/types.h> struct snp_report_req { /* user data that should be included in the report */ __u8 user_data[64]; /* The vmpl level to be included in the report */ __u32 vmpl; /* Must be zero filled */ __u8 rsvd[28]; }; struct snp_report_resp { /* response data, see SEV-SNP spec for the format */ __u8 data[4000]; }; struct snp_derived_key_req { __u32 root_key_select; __u32 rsvd; __u64 guest_field_select; __u32 vmpl; __u32 guest_svn; __u64 tcb_version; }; struct snp_derived_key_resp { /* response data, see SEV-SNP spec for the format */ __u8 data[64]; }; struct snp_guest_request_ioctl { /* message version number (must be non-zero) */ __u8 msg_version; /* Request and response structure address */ __u64 req_data; __u64 resp_data; /* bits[63:32]: VMM error code, bits[31:0] firmware error code (see psp-sev.h) */ union { __u64 exitinfo2; struct { __u32 fw_error; __u32 vmm_error; }; }; }; struct snp_ext_report_req { struct snp_report_req data; /* where to copy the certificate blob */ __u64 certs_address; /* length of the certificate blob */ __u32 certs_len; }; #define SNP_GUEST_REQ_IOC_TYPE 'S' /* Get SNP attestation report */ #define SNP_GET_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x0, struct snp_guest_request_ioctl) /* Get a derived key from the root */ #define SNP_GET_DERIVED_KEY _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x1, struct snp_guest_request_ioctl) /* Get SNP extended report as defined in the GHCB specification version 2. */ #define SNP_GET_EXT_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x2, struct snp_guest_request_ioctl) /* Guest message request EXIT_INFO_2 constants */ #define SNP_GUEST_FW_ERR_MASK GENMASK_ULL(31, 0) #define SNP_GUEST_VMM_ERR_SHIFT 32 #define SNP_GUEST_VMM_ERR(x) (((u64)x) << SNP_GUEST_VMM_ERR_SHIFT) #define SNP_GUEST_VMM_ERR_INVALID_LEN 1 #define SNP_GUEST_VMM_ERR_BUSY 2 #endif /* __UAPI_LINUX_SEV_GUEST_H_ */ linux/shm.h 0000644 00000007311 15063602055 0006647 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SHM_H_ #define _LINUX_SHM_H_ #include <linux/ipc.h> #include <linux/errno.h> #include <asm-generic/hugetlb_encode.h> #include <unistd.h> /* * SHMMNI, SHMMAX and SHMALL are default upper limits which can be * modified by sysctl. The SHMMAX and SHMALL values have been chosen to * be as large possible without facilitating scenarios where userspace * causes overflows when adjusting the limits via operations of the form * "retrieve current limit; add X; update limit". It is therefore not * advised to make SHMMAX and SHMALL any larger. These limits are * suitable for both 32 and 64-bit systems. */ #define SHMMIN 1 /* min shared seg size (bytes) */ #define SHMMNI 4096 /* max num of segs system wide */ #define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */ #define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */ #define SHMSEG SHMMNI /* max shared segs per process */ /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct shmid_ds { struct ipc_perm shm_perm; /* operation perms */ int shm_segsz; /* size of segment (bytes) */ __kernel_time_t shm_atime; /* last attach time */ __kernel_time_t shm_dtime; /* last detach time */ __kernel_time_t shm_ctime; /* last change time */ __kernel_ipc_pid_t shm_cpid; /* pid of creator */ __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ unsigned short shm_nattch; /* no. of current attaches */ unsigned short shm_unused; /* compatibility */ void *shm_unused2; /* ditto - used by DIPC */ void *shm_unused3; /* unused */ }; /* Include the definition of shmid64_ds and shminfo64 */ #include <asm/shmbuf.h> /* * shmget() shmflg values. */ /* The bottom nine bits are the same as open(2) mode flags */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ /* Bits 9 & 10 are IPC_CREAT and IPC_EXCL */ #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ #define SHM_NORESERVE 010000 /* don't check for reservations */ /* * Huge page size encoding when SHM_HUGETLB is specified, and a huge page * size other than the default is desired. See hugetlb_encode.h */ #define SHM_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT #define SHM_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK #define SHM_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB #define SHM_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB #define SHM_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB #define SHM_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB #define SHM_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB #define SHM_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB #define SHM_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB #define SHM_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB #define SHM_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB #define SHM_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB #define SHM_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB #define SHM_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB /* * shmat() shmflg values */ #define SHM_RDONLY 010000 /* read-only access */ #define SHM_RND 020000 /* round attach address to SHMLBA boundary */ #define SHM_REMAP 040000 /* take-over region on attach */ #define SHM_EXEC 0100000 /* execution access */ /* super user shmctl commands */ #define SHM_LOCK 11 #define SHM_UNLOCK 12 /* ipcs ctl commands */ #define SHM_STAT 13 #define SHM_INFO 14 #define SHM_STAT_ANY 15 /* Obsolete, used only for backwards compatibility */ struct shminfo { int shmmax; int shmmin; int shmmni; int shmseg; int shmall; }; struct shm_info { int used_ids; __kernel_ulong_t shm_tot; /* total allocated shm */ __kernel_ulong_t shm_rss; /* total resident shm */ __kernel_ulong_t shm_swp; /* total swapped shm */ __kernel_ulong_t swap_attempts; __kernel_ulong_t swap_successes; }; #endif /* _LINUX_SHM_H_ */ linux/signal.h 0000644 00000000604 15063602055 0007333 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SIGNAL_H #define _LINUX_SIGNAL_H #include <asm/signal.h> #include <asm/siginfo.h> #define SS_ONSTACK 1 #define SS_DISABLE 2 /* bit-flags */ #define SS_AUTODISARM (1U << 31) /* disable sas during sighandling */ /* mask for all SS_xxx flags */ #define SS_FLAG_BITS SS_AUTODISARM #endif /* _LINUX_SIGNAL_H */ linux/signalfd.h 0000644 00000002321 15063602055 0007643 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/signalfd.h * * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> * */ #ifndef _LINUX_SIGNALFD_H #define _LINUX_SIGNALFD_H #include <linux/types.h> /* For O_CLOEXEC and O_NONBLOCK */ #include <linux/fcntl.h> /* Flags for signalfd4. */ #define SFD_CLOEXEC O_CLOEXEC #define SFD_NONBLOCK O_NONBLOCK struct signalfd_siginfo { __u32 ssi_signo; __s32 ssi_errno; __s32 ssi_code; __u32 ssi_pid; __u32 ssi_uid; __s32 ssi_fd; __u32 ssi_tid; __u32 ssi_band; __u32 ssi_overrun; __u32 ssi_trapno; __s32 ssi_status; __s32 ssi_int; __u64 ssi_ptr; __u64 ssi_utime; __u64 ssi_stime; __u64 ssi_addr; __u16 ssi_addr_lsb; __u16 __pad2; __s32 ssi_syscall; __u64 ssi_call_addr; __u32 ssi_arch; /* * Pad strcture to 128 bytes. Remember to update the * pad size when you add new members. We use a fixed * size structure to avoid compatibility problems with * future versions, and we leave extra space for additional * members. We use fixed size members because this strcture * comes out of a read(2) and we really don't want to have * a compat on read(2). */ __u8 __pad[28]; }; #endif /* _LINUX_SIGNALFD_H */ linux/smc.h 0000644 00000020501 15063602055 0006636 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Shared Memory Communications over RDMA (SMC-R) and RoCE * * Definitions for generic netlink based configuration of an SMC-R PNET table * * Copyright IBM Corp. 2016 * * Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com> */ #ifndef _LINUX_SMC_H_ #define _LINUX_SMC_H_ /* Netlink SMC_PNETID attributes */ enum { SMC_PNETID_UNSPEC, SMC_PNETID_NAME, SMC_PNETID_ETHNAME, SMC_PNETID_IBNAME, SMC_PNETID_IBPORT, __SMC_PNETID_MAX, SMC_PNETID_MAX = __SMC_PNETID_MAX - 1 }; enum { /* SMC PNET Table commands */ SMC_PNETID_GET = 1, SMC_PNETID_ADD, SMC_PNETID_DEL, SMC_PNETID_FLUSH }; #define SMCR_GENL_FAMILY_NAME "SMC_PNETID" #define SMCR_GENL_FAMILY_VERSION 1 /* gennetlink interface to access non-socket information from SMC module */ #define SMC_GENL_FAMILY_NAME "SMC_GEN_NETLINK" #define SMC_GENL_FAMILY_VERSION 1 #define SMC_PCI_ID_STR_LEN 16 /* Max length of pci id string */ #define SMC_MAX_HOSTNAME_LEN 32 /* Max length of the hostname */ #define SMC_MAX_UEID 4 /* Max number of user EIDs */ #define SMC_MAX_EID_LEN 32 /* Max length of an EID */ /* SMC_GENL_FAMILY commands */ enum { SMC_NETLINK_GET_SYS_INFO = 1, SMC_NETLINK_GET_LGR_SMCR, SMC_NETLINK_GET_LINK_SMCR, SMC_NETLINK_GET_LGR_SMCD, SMC_NETLINK_GET_DEV_SMCD, SMC_NETLINK_GET_DEV_SMCR, SMC_NETLINK_GET_STATS, SMC_NETLINK_GET_FBACK_STATS, SMC_NETLINK_DUMP_UEID, SMC_NETLINK_ADD_UEID, SMC_NETLINK_REMOVE_UEID, SMC_NETLINK_FLUSH_UEID, SMC_NETLINK_DUMP_SEID, SMC_NETLINK_ENABLE_SEID, SMC_NETLINK_DISABLE_SEID, SMC_NETLINK_DUMP_HS_LIMITATION, SMC_NETLINK_ENABLE_HS_LIMITATION, SMC_NETLINK_DISABLE_HS_LIMITATION, }; /* SMC_GENL_FAMILY top level attributes */ enum { SMC_GEN_UNSPEC, SMC_GEN_SYS_INFO, /* nest */ SMC_GEN_LGR_SMCR, /* nest */ SMC_GEN_LINK_SMCR, /* nest */ SMC_GEN_LGR_SMCD, /* nest */ SMC_GEN_DEV_SMCD, /* nest */ SMC_GEN_DEV_SMCR, /* nest */ SMC_GEN_STATS, /* nest */ SMC_GEN_FBACK_STATS, /* nest */ __SMC_GEN_MAX, SMC_GEN_MAX = __SMC_GEN_MAX - 1 }; /* SMC_GEN_SYS_INFO attributes */ enum { SMC_NLA_SYS_UNSPEC, SMC_NLA_SYS_VER, /* u8 */ SMC_NLA_SYS_REL, /* u8 */ SMC_NLA_SYS_IS_ISM_V2, /* u8 */ SMC_NLA_SYS_LOCAL_HOST, /* string */ SMC_NLA_SYS_SEID, /* string */ SMC_NLA_SYS_IS_SMCR_V2, /* u8 */ __SMC_NLA_SYS_MAX, SMC_NLA_SYS_MAX = __SMC_NLA_SYS_MAX - 1 }; /* SMC_NLA_LGR_D_V2_COMMON and SMC_NLA_LGR_R_V2_COMMON nested attributes */ enum { SMC_NLA_LGR_V2_VER, /* u8 */ SMC_NLA_LGR_V2_REL, /* u8 */ SMC_NLA_LGR_V2_OS, /* u8 */ SMC_NLA_LGR_V2_NEG_EID, /* string */ SMC_NLA_LGR_V2_PEER_HOST, /* string */ __SMC_NLA_LGR_V2_MAX, SMC_NLA_LGR_V2_MAX = __SMC_NLA_LGR_V2_MAX - 1 }; /* SMC_NLA_LGR_R_V2 nested attributes */ enum { SMC_NLA_LGR_R_V2_UNSPEC, SMC_NLA_LGR_R_V2_DIRECT, /* u8 */ __SMC_NLA_LGR_R_V2_MAX, SMC_NLA_LGR_R_V2_MAX = __SMC_NLA_LGR_R_V2_MAX - 1 }; /* SMC_GEN_LGR_SMCR attributes */ enum { SMC_NLA_LGR_R_UNSPEC, SMC_NLA_LGR_R_ID, /* u32 */ SMC_NLA_LGR_R_ROLE, /* u8 */ SMC_NLA_LGR_R_TYPE, /* u8 */ SMC_NLA_LGR_R_PNETID, /* string */ SMC_NLA_LGR_R_VLAN_ID, /* u8 */ SMC_NLA_LGR_R_CONNS_NUM, /* u32 */ SMC_NLA_LGR_R_V2_COMMON, /* nest */ SMC_NLA_LGR_R_V2, /* nest */ SMC_NLA_LGR_R_NET_COOKIE, /* u64 */ SMC_NLA_LGR_R_PAD, /* flag */ SMC_NLA_LGR_R_BUF_TYPE, /* u8 */ __SMC_NLA_LGR_R_MAX, SMC_NLA_LGR_R_MAX = __SMC_NLA_LGR_R_MAX - 1 }; /* SMC_GEN_LINK_SMCR attributes */ enum { SMC_NLA_LINK_UNSPEC, SMC_NLA_LINK_ID, /* u8 */ SMC_NLA_LINK_IB_DEV, /* string */ SMC_NLA_LINK_IB_PORT, /* u8 */ SMC_NLA_LINK_GID, /* string */ SMC_NLA_LINK_PEER_GID, /* string */ SMC_NLA_LINK_CONN_CNT, /* u32 */ SMC_NLA_LINK_NET_DEV, /* u32 */ SMC_NLA_LINK_UID, /* u32 */ SMC_NLA_LINK_PEER_UID, /* u32 */ SMC_NLA_LINK_STATE, /* u32 */ __SMC_NLA_LINK_MAX, SMC_NLA_LINK_MAX = __SMC_NLA_LINK_MAX - 1 }; /* SMC_GEN_LGR_SMCD attributes */ enum { SMC_NLA_LGR_D_UNSPEC, SMC_NLA_LGR_D_ID, /* u32 */ SMC_NLA_LGR_D_GID, /* u64 */ SMC_NLA_LGR_D_PEER_GID, /* u64 */ SMC_NLA_LGR_D_VLAN_ID, /* u8 */ SMC_NLA_LGR_D_CONNS_NUM, /* u32 */ SMC_NLA_LGR_D_PNETID, /* string */ SMC_NLA_LGR_D_CHID, /* u16 */ SMC_NLA_LGR_D_PAD, /* flag */ SMC_NLA_LGR_D_V2_COMMON, /* nest */ __SMC_NLA_LGR_D_MAX, SMC_NLA_LGR_D_MAX = __SMC_NLA_LGR_D_MAX - 1 }; /* SMC_NLA_DEV_PORT nested attributes */ enum { SMC_NLA_DEV_PORT_UNSPEC, SMC_NLA_DEV_PORT_PNET_USR, /* u8 */ SMC_NLA_DEV_PORT_PNETID, /* string */ SMC_NLA_DEV_PORT_NETDEV, /* u32 */ SMC_NLA_DEV_PORT_STATE, /* u8 */ SMC_NLA_DEV_PORT_VALID, /* u8 */ SMC_NLA_DEV_PORT_LNK_CNT, /* u32 */ __SMC_NLA_DEV_PORT_MAX, SMC_NLA_DEV_PORT_MAX = __SMC_NLA_DEV_PORT_MAX - 1 }; /* SMC_GEN_DEV_SMCD and SMC_GEN_DEV_SMCR attributes */ enum { SMC_NLA_DEV_UNSPEC, SMC_NLA_DEV_USE_CNT, /* u32 */ SMC_NLA_DEV_IS_CRIT, /* u8 */ SMC_NLA_DEV_PCI_FID, /* u32 */ SMC_NLA_DEV_PCI_CHID, /* u16 */ SMC_NLA_DEV_PCI_VENDOR, /* u16 */ SMC_NLA_DEV_PCI_DEVICE, /* u16 */ SMC_NLA_DEV_PCI_ID, /* string */ SMC_NLA_DEV_PORT, /* nest */ SMC_NLA_DEV_PORT2, /* nest */ SMC_NLA_DEV_IB_NAME, /* string */ __SMC_NLA_DEV_MAX, SMC_NLA_DEV_MAX = __SMC_NLA_DEV_MAX - 1 }; /* SMC_NLA_STATS_T_TX(RX)_RMB_SIZE nested attributes */ /* SMC_NLA_STATS_TX(RX)PLOAD_SIZE nested attributes */ enum { SMC_NLA_STATS_PLOAD_PAD, SMC_NLA_STATS_PLOAD_8K, /* u64 */ SMC_NLA_STATS_PLOAD_16K, /* u64 */ SMC_NLA_STATS_PLOAD_32K, /* u64 */ SMC_NLA_STATS_PLOAD_64K, /* u64 */ SMC_NLA_STATS_PLOAD_128K, /* u64 */ SMC_NLA_STATS_PLOAD_256K, /* u64 */ SMC_NLA_STATS_PLOAD_512K, /* u64 */ SMC_NLA_STATS_PLOAD_1024K, /* u64 */ SMC_NLA_STATS_PLOAD_G_1024K, /* u64 */ __SMC_NLA_STATS_PLOAD_MAX, SMC_NLA_STATS_PLOAD_MAX = __SMC_NLA_STATS_PLOAD_MAX - 1 }; /* SMC_NLA_STATS_T_TX(RX)_RMB_STATS nested attributes */ enum { SMC_NLA_STATS_RMB_PAD, SMC_NLA_STATS_RMB_SIZE_SM_PEER_CNT, /* u64 */ SMC_NLA_STATS_RMB_SIZE_SM_CNT, /* u64 */ SMC_NLA_STATS_RMB_FULL_PEER_CNT, /* u64 */ SMC_NLA_STATS_RMB_FULL_CNT, /* u64 */ SMC_NLA_STATS_RMB_REUSE_CNT, /* u64 */ SMC_NLA_STATS_RMB_ALLOC_CNT, /* u64 */ SMC_NLA_STATS_RMB_DGRADE_CNT, /* u64 */ __SMC_NLA_STATS_RMB_MAX, SMC_NLA_STATS_RMB_MAX = __SMC_NLA_STATS_RMB_MAX - 1 }; /* SMC_NLA_STATS_SMCD_TECH and _SMCR_TECH nested attributes */ enum { SMC_NLA_STATS_T_PAD, SMC_NLA_STATS_T_TX_RMB_SIZE, /* nest */ SMC_NLA_STATS_T_RX_RMB_SIZE, /* nest */ SMC_NLA_STATS_T_TXPLOAD_SIZE, /* nest */ SMC_NLA_STATS_T_RXPLOAD_SIZE, /* nest */ SMC_NLA_STATS_T_TX_RMB_STATS, /* nest */ SMC_NLA_STATS_T_RX_RMB_STATS, /* nest */ SMC_NLA_STATS_T_CLNT_V1_SUCC, /* u64 */ SMC_NLA_STATS_T_CLNT_V2_SUCC, /* u64 */ SMC_NLA_STATS_T_SRV_V1_SUCC, /* u64 */ SMC_NLA_STATS_T_SRV_V2_SUCC, /* u64 */ SMC_NLA_STATS_T_SENDPAGE_CNT, /* u64 */ SMC_NLA_STATS_T_SPLICE_CNT, /* u64 */ SMC_NLA_STATS_T_CORK_CNT, /* u64 */ SMC_NLA_STATS_T_NDLY_CNT, /* u64 */ SMC_NLA_STATS_T_URG_DATA_CNT, /* u64 */ SMC_NLA_STATS_T_RX_BYTES, /* u64 */ SMC_NLA_STATS_T_TX_BYTES, /* u64 */ SMC_NLA_STATS_T_RX_CNT, /* u64 */ SMC_NLA_STATS_T_TX_CNT, /* u64 */ __SMC_NLA_STATS_T_MAX, SMC_NLA_STATS_T_MAX = __SMC_NLA_STATS_T_MAX - 1 }; /* SMC_GEN_STATS attributes */ enum { SMC_NLA_STATS_PAD, SMC_NLA_STATS_SMCD_TECH, /* nest */ SMC_NLA_STATS_SMCR_TECH, /* nest */ SMC_NLA_STATS_CLNT_HS_ERR_CNT, /* u64 */ SMC_NLA_STATS_SRV_HS_ERR_CNT, /* u64 */ __SMC_NLA_STATS_MAX, SMC_NLA_STATS_MAX = __SMC_NLA_STATS_MAX - 1 }; /* SMC_GEN_FBACK_STATS attributes */ enum { SMC_NLA_FBACK_STATS_PAD, SMC_NLA_FBACK_STATS_TYPE, /* u8 */ SMC_NLA_FBACK_STATS_SRV_CNT, /* u64 */ SMC_NLA_FBACK_STATS_CLNT_CNT, /* u64 */ SMC_NLA_FBACK_STATS_RSN_CODE, /* u32 */ SMC_NLA_FBACK_STATS_RSN_CNT, /* u16 */ __SMC_NLA_FBACK_STATS_MAX, SMC_NLA_FBACK_STATS_MAX = __SMC_NLA_FBACK_STATS_MAX - 1 }; /* SMC_NETLINK_UEID attributes */ enum { SMC_NLA_EID_TABLE_UNSPEC, SMC_NLA_EID_TABLE_ENTRY, /* string */ __SMC_NLA_EID_TABLE_MAX, SMC_NLA_EID_TABLE_MAX = __SMC_NLA_EID_TABLE_MAX - 1 }; /* SMC_NETLINK_SEID attributes */ enum { SMC_NLA_SEID_UNSPEC, SMC_NLA_SEID_ENTRY, /* string */ SMC_NLA_SEID_ENABLED, /* u8 */ __SMC_NLA_SEID_TABLE_MAX, SMC_NLA_SEID_TABLE_MAX = __SMC_NLA_SEID_TABLE_MAX - 1 }; /* SMC_NETLINK_HS_LIMITATION attributes */ enum { SMC_NLA_HS_LIMITATION_UNSPEC, SMC_NLA_HS_LIMITATION_ENABLED, /* u8 */ __SMC_NLA_HS_LIMITATION_MAX, SMC_NLA_HS_LIMITATION_MAX = __SMC_NLA_HS_LIMITATION_MAX - 1 }; /* SMC socket options */ #define SMC_LIMIT_HS 1 /* constraint on smc handshake */ #endif /* _LINUX_SMC_H */ linux/smc_diag.h 0000644 00000005250 15063602055 0007626 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _SMC_DIAG_H_ #define _SMC_DIAG_H_ #include <linux/types.h> #include <linux/inet_diag.h> #include <rdma/ib_user_verbs.h> /* Request structure */ struct smc_diag_req { __u8 diag_family; __u8 pad[2]; __u8 diag_ext; /* Query extended information */ struct inet_diag_sockid id; }; /* Base info structure. It contains socket identity (addrs/ports/cookie) based * on the internal clcsock, and more SMC-related socket data */ struct smc_diag_msg { __u8 diag_family; __u8 diag_state; __u8 diag_mode; __u8 diag_shutdown; struct inet_diag_sockid id; __u32 diag_uid; __u64 diag_inode; }; /* Mode of a connection */ enum { SMC_DIAG_MODE_SMCR, SMC_DIAG_MODE_FALLBACK_TCP, SMC_DIAG_MODE_SMCD, }; /* Extensions */ enum { SMC_DIAG_NONE, SMC_DIAG_CONNINFO, SMC_DIAG_LGRINFO, SMC_DIAG_SHUTDOWN, SMC_DIAG_DMBINFO, SMC_DIAG_FALLBACK, __SMC_DIAG_MAX, }; #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) /* SMC_DIAG_CONNINFO */ struct smc_diag_cursor { __u16 reserved; __u16 wrap; __u32 count; }; struct smc_diag_conninfo { __u32 token; /* unique connection id */ __u32 sndbuf_size; /* size of send buffer */ __u32 rmbe_size; /* size of RMB element */ __u32 peer_rmbe_size; /* size of peer RMB element */ /* local RMB element cursors */ struct smc_diag_cursor rx_prod; /* received producer cursor */ struct smc_diag_cursor rx_cons; /* received consumer cursor */ /* peer RMB element cursors */ struct smc_diag_cursor tx_prod; /* sent producer cursor */ struct smc_diag_cursor tx_cons; /* sent consumer cursor */ __u8 rx_prod_flags; /* received producer flags */ __u8 rx_conn_state_flags; /* recvd connection flags*/ __u8 tx_prod_flags; /* sent producer flags */ __u8 tx_conn_state_flags; /* sent connection flags*/ /* send buffer cursors */ struct smc_diag_cursor tx_prep; /* prepared to be sent cursor */ struct smc_diag_cursor tx_sent; /* sent cursor */ struct smc_diag_cursor tx_fin; /* confirmed sent cursor */ }; /* SMC_DIAG_LINKINFO */ struct smc_diag_linkinfo { __u8 link_id; /* link identifier */ __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ __u8 ibport; /* RDMA device port number */ __u8 gid[40]; /* local GID */ __u8 peer_gid[40]; /* peer GID */ }; struct smc_diag_lgrinfo { struct smc_diag_linkinfo lnk[1]; __u8 role; }; struct smc_diag_fallback { __u32 reason; __u32 peer_diagnosis; }; struct smcd_diag_dmbinfo { /* SMC-D Socket internals */ __u32 linkid; /* Link identifier */ __u64 peer_gid; /* Peer GID */ __u64 my_gid; /* My GID */ __u64 token; /* Token of DMB */ __u64 peer_token; /* Token of remote DMBE */ }; #endif /* _SMC_DIAG_H_ */ linux/smiapp.h 0000644 00000002042 15063602055 0007345 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/uapi/linux/smiapp.h * * Generic driver for SMIA/SMIA++ compliant camera modules * * Copyright (C) 2014 Intel Corporation * Contact: Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * */ #ifndef __UAPI_LINUX_SMIAPP_H_ #define __UAPI_LINUX_SMIAPP_H_ #define V4L2_SMIAPP_TEST_PATTERN_MODE_DISABLED 0 #define V4L2_SMIAPP_TEST_PATTERN_MODE_SOLID_COLOUR 1 #define V4L2_SMIAPP_TEST_PATTERN_MODE_COLOUR_BARS 2 #define V4L2_SMIAPP_TEST_PATTERN_MODE_COLOUR_BARS_GREY 3 #define V4L2_SMIAPP_TEST_PATTERN_MODE_PN9 4 #endif /* __UAPI_LINUX_SMIAPP_H_ */ linux/snmp.h 0000644 00000032537 15063602055 0007045 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for MIBs * * Author: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> */ #ifndef _LINUX_SNMP_H #define _LINUX_SNMP_H /* ipstats mib definitions */ /* * RFC 1213: MIB-II * RFC 2011 (updates 1213): SNMPv2-MIB-IP * RFC 2863: Interfaces Group MIB * RFC 2465: IPv6 MIB: General Group * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables */ enum { IPSTATS_MIB_NUM = 0, /* frequently written fields in fast path, kept in same cache line */ IPSTATS_MIB_INPKTS, /* InReceives */ IPSTATS_MIB_INOCTETS, /* InOctets */ IPSTATS_MIB_INDELIVERS, /* InDelivers */ IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ IPSTATS_MIB_OUTPKTS, /* OutRequests */ IPSTATS_MIB_OUTOCTETS, /* OutOctets */ /* other fields */ IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ IPSTATS_MIB_INADDRERRORS, /* InAddrErrors */ IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */ IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */ IPSTATS_MIB_INDISCARDS, /* InDiscards */ IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ IPSTATS_MIB_REASMREQDS, /* ReasmReqds */ IPSTATS_MIB_REASMOKS, /* ReasmOKs */ IPSTATS_MIB_REASMFAILS, /* ReasmFails */ IPSTATS_MIB_FRAGOKS, /* FragOKs */ IPSTATS_MIB_FRAGFAILS, /* FragFails */ IPSTATS_MIB_FRAGCREATES, /* FragCreates */ IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */ IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */ IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */ IPSTATS_MIB_CSUMERRORS, /* InCsumErrors */ IPSTATS_MIB_NOECTPKTS, /* InNoECTPkts */ IPSTATS_MIB_ECT1PKTS, /* InECT1Pkts */ IPSTATS_MIB_ECT0PKTS, /* InECT0Pkts */ IPSTATS_MIB_CEPKTS, /* InCEPkts */ IPSTATS_MIB_REASM_OVERLAPS, /* ReasmOverlaps */ __IPSTATS_MIB_MAX }; /* icmp mib definitions */ /* * RFC 1213: MIB-II ICMP Group * RFC 2011 (updates 1213): SNMPv2 MIB for IP: ICMP group */ enum { ICMP_MIB_NUM = 0, ICMP_MIB_INMSGS, /* InMsgs */ ICMP_MIB_INERRORS, /* InErrors */ ICMP_MIB_INDESTUNREACHS, /* InDestUnreachs */ ICMP_MIB_INTIMEEXCDS, /* InTimeExcds */ ICMP_MIB_INPARMPROBS, /* InParmProbs */ ICMP_MIB_INSRCQUENCHS, /* InSrcQuenchs */ ICMP_MIB_INREDIRECTS, /* InRedirects */ ICMP_MIB_INECHOS, /* InEchos */ ICMP_MIB_INECHOREPS, /* InEchoReps */ ICMP_MIB_INTIMESTAMPS, /* InTimestamps */ ICMP_MIB_INTIMESTAMPREPS, /* InTimestampReps */ ICMP_MIB_INADDRMASKS, /* InAddrMasks */ ICMP_MIB_INADDRMASKREPS, /* InAddrMaskReps */ ICMP_MIB_OUTMSGS, /* OutMsgs */ ICMP_MIB_OUTERRORS, /* OutErrors */ ICMP_MIB_OUTDESTUNREACHS, /* OutDestUnreachs */ ICMP_MIB_OUTTIMEEXCDS, /* OutTimeExcds */ ICMP_MIB_OUTPARMPROBS, /* OutParmProbs */ ICMP_MIB_OUTSRCQUENCHS, /* OutSrcQuenchs */ ICMP_MIB_OUTREDIRECTS, /* OutRedirects */ ICMP_MIB_OUTECHOS, /* OutEchos */ ICMP_MIB_OUTECHOREPS, /* OutEchoReps */ ICMP_MIB_OUTTIMESTAMPS, /* OutTimestamps */ ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */ ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */ ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */ ICMP_MIB_CSUMERRORS, /* InCsumErrors */ __ICMP_MIB_MAX }; #define __ICMPMSG_MIB_MAX 512 /* Out+In for all 8-bit ICMP types */ /* icmp6 mib definitions */ /* * RFC 2466: ICMPv6-MIB */ enum { ICMP6_MIB_NUM = 0, ICMP6_MIB_INMSGS, /* InMsgs */ ICMP6_MIB_INERRORS, /* InErrors */ ICMP6_MIB_OUTMSGS, /* OutMsgs */ ICMP6_MIB_OUTERRORS, /* OutErrors */ ICMP6_MIB_CSUMERRORS, /* InCsumErrors */ __ICMP6_MIB_MAX }; #define __ICMP6MSG_MIB_MAX 512 /* Out+In for all 8-bit ICMPv6 types */ /* tcp mib definitions */ /* * RFC 1213: MIB-II TCP group * RFC 2012 (updates 1213): SNMPv2-MIB-TCP */ enum { TCP_MIB_NUM = 0, TCP_MIB_RTOALGORITHM, /* RtoAlgorithm */ TCP_MIB_RTOMIN, /* RtoMin */ TCP_MIB_RTOMAX, /* RtoMax */ TCP_MIB_MAXCONN, /* MaxConn */ TCP_MIB_ACTIVEOPENS, /* ActiveOpens */ TCP_MIB_PASSIVEOPENS, /* PassiveOpens */ TCP_MIB_ATTEMPTFAILS, /* AttemptFails */ TCP_MIB_ESTABRESETS, /* EstabResets */ TCP_MIB_CURRESTAB, /* CurrEstab */ TCP_MIB_INSEGS, /* InSegs */ TCP_MIB_OUTSEGS, /* OutSegs */ TCP_MIB_RETRANSSEGS, /* RetransSegs */ TCP_MIB_INERRS, /* InErrs */ TCP_MIB_OUTRSTS, /* OutRsts */ TCP_MIB_CSUMERRORS, /* InCsumErrors */ __TCP_MIB_MAX }; /* udp mib definitions */ /* * RFC 1213: MIB-II UDP group * RFC 2013 (updates 1213): SNMPv2-MIB-UDP */ enum { UDP_MIB_NUM = 0, UDP_MIB_INDATAGRAMS, /* InDatagrams */ UDP_MIB_NOPORTS, /* NoPorts */ UDP_MIB_INERRORS, /* InErrors */ UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ UDP_MIB_CSUMERRORS, /* InCsumErrors */ UDP_MIB_IGNOREDMULTI, /* IgnoredMulti */ #ifndef __GENKSYMS__ UDP_MIB_MEMERRORS, /* MemErrors */ #endif __UDP_MIB_MAX }; /* linux mib definitions */ enum { LINUX_MIB_NUM = 0, LINUX_MIB_SYNCOOKIESSENT, /* SyncookiesSent */ LINUX_MIB_SYNCOOKIESRECV, /* SyncookiesRecv */ LINUX_MIB_SYNCOOKIESFAILED, /* SyncookiesFailed */ LINUX_MIB_EMBRYONICRSTS, /* EmbryonicRsts */ LINUX_MIB_PRUNECALLED, /* PruneCalled */ LINUX_MIB_RCVPRUNED, /* RcvPruned */ LINUX_MIB_OFOPRUNED, /* OfoPruned */ LINUX_MIB_OUTOFWINDOWICMPS, /* OutOfWindowIcmps */ LINUX_MIB_LOCKDROPPEDICMPS, /* LockDroppedIcmps */ LINUX_MIB_ARPFILTER, /* ArpFilter */ LINUX_MIB_TIMEWAITED, /* TimeWaited */ LINUX_MIB_TIMEWAITRECYCLED, /* TimeWaitRecycled */ LINUX_MIB_TIMEWAITKILLED, /* TimeWaitKilled */ LINUX_MIB_PAWSACTIVEREJECTED, /* PAWSActiveRejected */ LINUX_MIB_PAWSESTABREJECTED, /* PAWSEstabRejected */ LINUX_MIB_DELAYEDACKS, /* DelayedACKs */ LINUX_MIB_DELAYEDACKLOCKED, /* DelayedACKLocked */ LINUX_MIB_DELAYEDACKLOST, /* DelayedACKLost */ LINUX_MIB_LISTENOVERFLOWS, /* ListenOverflows */ LINUX_MIB_LISTENDROPS, /* ListenDrops */ LINUX_MIB_TCPHPHITS, /* TCPHPHits */ LINUX_MIB_TCPPUREACKS, /* TCPPureAcks */ LINUX_MIB_TCPHPACKS, /* TCPHPAcks */ LINUX_MIB_TCPRENORECOVERY, /* TCPRenoRecovery */ LINUX_MIB_TCPSACKRECOVERY, /* TCPSackRecovery */ LINUX_MIB_TCPSACKRENEGING, /* TCPSACKReneging */ LINUX_MIB_TCPSACKREORDER, /* TCPSACKReorder */ LINUX_MIB_TCPRENOREORDER, /* TCPRenoReorder */ LINUX_MIB_TCPTSREORDER, /* TCPTSReorder */ LINUX_MIB_TCPFULLUNDO, /* TCPFullUndo */ LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */ LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */ LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */ LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */ LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */ LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */ LINUX_MIB_TCPLOSSFAILURES, /* TCPLossFailures */ LINUX_MIB_TCPFASTRETRANS, /* TCPFastRetrans */ LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */ LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */ LINUX_MIB_TCPLOSSPROBES, /* TCPLossProbes */ LINUX_MIB_TCPLOSSPROBERECOVERY, /* TCPLossProbeRecovery */ LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */ LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */ LINUX_MIB_TCPRCVCOLLAPSED, /* TCPRcvCollapsed */ LINUX_MIB_TCPDSACKOLDSENT, /* TCPDSACKOldSent */ LINUX_MIB_TCPDSACKOFOSENT, /* TCPDSACKOfoSent */ LINUX_MIB_TCPDSACKRECV, /* TCPDSACKRecv */ LINUX_MIB_TCPDSACKOFORECV, /* TCPDSACKOfoRecv */ LINUX_MIB_TCPABORTONDATA, /* TCPAbortOnData */ LINUX_MIB_TCPABORTONCLOSE, /* TCPAbortOnClose */ LINUX_MIB_TCPABORTONMEMORY, /* TCPAbortOnMemory */ LINUX_MIB_TCPABORTONTIMEOUT, /* TCPAbortOnTimeout */ LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ LINUX_MIB_TCPMEMORYPRESSURESCHRONO, /* TCPMemoryPressuresChrono */ LINUX_MIB_TCPSACKDISCARD, /* TCPSACKDiscard */ LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ LINUX_MIB_TCPMD5FAILURE, /* TCPMD5Failure */ LINUX_MIB_SACKSHIFTED, LINUX_MIB_SACKMERGED, LINUX_MIB_SACKSHIFTFALLBACK, LINUX_MIB_TCPBACKLOGDROP, LINUX_MIB_PFMEMALLOCDROP, LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ LINUX_MIB_TCPDEFERACCEPTDROP, LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ LINUX_MIB_TCPRETRANSFAIL, /* TCPRetransFail */ LINUX_MIB_TCPRCVCOALESCE, /* TCPRcvCoalesce */ #ifndef __GENKSYMS__ LINUX_MIB_TCPBACKLOGCOALESCE, /* TCPBacklogCoalesce */ #endif LINUX_MIB_TCPOFOQUEUE, /* TCPOFOQueue */ LINUX_MIB_TCPOFODROP, /* TCPOFODrop */ LINUX_MIB_TCPOFOMERGE, /* TCPOFOMerge */ LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */ LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */ LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */ LINUX_MIB_TCPFASTOPENACTIVEFAIL, /* TCPFastOpenActiveFail */ LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/ LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ LINUX_MIB_TCPFASTOPENBLACKHOLE, /* TCPFastOpenBlackholeDetect */ LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ LINUX_MIB_TCPAUTOCORKING, /* TCPAutoCorking */ LINUX_MIB_TCPFROMZEROWINDOWADV, /* TCPFromZeroWindowAdv */ LINUX_MIB_TCPTOZEROWINDOWADV, /* TCPToZeroWindowAdv */ LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */ LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */ LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */ LINUX_MIB_TCPHYSTARTTRAINDETECT, /* TCPHystartTrainDetect */ LINUX_MIB_TCPHYSTARTTRAINCWND, /* TCPHystartTrainCwnd */ LINUX_MIB_TCPHYSTARTDELAYDETECT, /* TCPHystartDelayDetect */ LINUX_MIB_TCPHYSTARTDELAYCWND, /* TCPHystartDelayCwnd */ LINUX_MIB_TCPACKSKIPPEDSYNRECV, /* TCPACKSkippedSynRecv */ LINUX_MIB_TCPACKSKIPPEDPAWS, /* TCPACKSkippedPAWS */ LINUX_MIB_TCPACKSKIPPEDSEQ, /* TCPACKSkippedSeq */ LINUX_MIB_TCPACKSKIPPEDFINWAIT2, /* TCPACKSkippedFinWait2 */ LINUX_MIB_TCPACKSKIPPEDTIMEWAIT, /* TCPACKSkippedTimeWait */ LINUX_MIB_TCPACKSKIPPEDCHALLENGE, /* TCPACKSkippedChallenge */ LINUX_MIB_TCPWINPROBE, /* TCPWinProbe */ LINUX_MIB_TCPKEEPALIVE, /* TCPKeepAlive */ LINUX_MIB_TCPMTUPFAIL, /* TCPMTUPFail */ LINUX_MIB_TCPMTUPSUCCESS, /* TCPMTUPSuccess */ LINUX_MIB_TCPDELIVERED, /* TCPDelivered */ LINUX_MIB_TCPDELIVEREDCE, /* TCPDeliveredCE */ LINUX_MIB_TCPACKCOMPRESSED, /* TCPAckCompressed */ #ifndef __GENKSYMS__ LINUX_MIB_TCPZEROWINDOWDROP, /* TCPZeroWindowDrop */ LINUX_MIB_TCPRCVQDROP, /* TCPRcvQDrop */ LINUX_MIB_TCPWQUEUETOOBIG, /* TCPWqueueTooBig */ LINUX_MIB_TCPTIMEOUTREHASH, /* TCPTimeoutRehash */ #endif __LINUX_MIB_MAX }; /* linux Xfrm mib definitions */ enum { LINUX_MIB_XFRMNUM = 0, LINUX_MIB_XFRMINERROR, /* XfrmInError */ LINUX_MIB_XFRMINBUFFERERROR, /* XfrmInBufferError */ LINUX_MIB_XFRMINHDRERROR, /* XfrmInHdrError */ LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */ LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */ LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */ LINUX_MIB_XFRMINSTATESEQERROR, /* XfrmInStateSeqError */ LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */ LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */ LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */ LINUX_MIB_XFRMINTMPLMISMATCH, /* XfrmInTmplMismatch */ LINUX_MIB_XFRMINNOPOLS, /* XfrmInNoPols */ LINUX_MIB_XFRMINPOLBLOCK, /* XfrmInPolBlock */ LINUX_MIB_XFRMINPOLERROR, /* XfrmInPolError */ LINUX_MIB_XFRMOUTERROR, /* XfrmOutError */ LINUX_MIB_XFRMOUTBUNDLEGENERROR, /* XfrmOutBundleGenError */ LINUX_MIB_XFRMOUTBUNDLECHECKERROR, /* XfrmOutBundleCheckError */ LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */ LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */ LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */ LINUX_MIB_XFRMOUTSTATESEQERROR, /* XfrmOutStateSeqError */ LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */ LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */ LINUX_MIB_XFRMACQUIREERROR, /* XfrmAcquireError */ __LINUX_MIB_XFRMMAX }; /* linux TLS mib definitions */ enum { LINUX_MIB_TLSNUM = 0, LINUX_MIB_TLSCURRTXSW, /* TlsCurrTxSw */ LINUX_MIB_TLSCURRRXSW, /* TlsCurrRxSw */ LINUX_MIB_TLSCURRTXDEVICE, /* TlsCurrTxDevice */ LINUX_MIB_TLSCURRRXDEVICE, /* TlsCurrRxDevice */ LINUX_MIB_TLSTXSW, /* TlsTxSw */ LINUX_MIB_TLSRXSW, /* TlsRxSw */ LINUX_MIB_TLSTXDEVICE, /* TlsTxDevice */ LINUX_MIB_TLSRXDEVICE, /* TlsRxDevice */ LINUX_MIB_TLSDECRYPTERROR, /* TlsDecryptError */ LINUX_MIB_TLSRXDEVICERESYNC, /* TlsRxDeviceResync */ __LINUX_MIB_TLSMAX }; #endif /* _LINUX_SNMP_H */ linux/sock_diag.h 0000644 00000002425 15063602055 0010004 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __SOCK_DIAG_H__ #define __SOCK_DIAG_H__ #include <linux/types.h> #define SOCK_DIAG_BY_FAMILY 20 #define SOCK_DESTROY 21 struct sock_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; }; enum { SK_MEMINFO_RMEM_ALLOC, SK_MEMINFO_RCVBUF, SK_MEMINFO_WMEM_ALLOC, SK_MEMINFO_SNDBUF, SK_MEMINFO_FWD_ALLOC, SK_MEMINFO_WMEM_QUEUED, SK_MEMINFO_OPTMEM, SK_MEMINFO_BACKLOG, SK_MEMINFO_DROPS, SK_MEMINFO_VARS, }; enum sknetlink_groups { SKNLGRP_NONE, SKNLGRP_INET_TCP_DESTROY, SKNLGRP_INET_UDP_DESTROY, SKNLGRP_INET6_TCP_DESTROY, SKNLGRP_INET6_UDP_DESTROY, __SKNLGRP_MAX, }; #define SKNLGRP_MAX (__SKNLGRP_MAX - 1) enum { SK_DIAG_BPF_STORAGE_REQ_NONE, SK_DIAG_BPF_STORAGE_REQ_MAP_FD, __SK_DIAG_BPF_STORAGE_REQ_MAX, }; #define SK_DIAG_BPF_STORAGE_REQ_MAX (__SK_DIAG_BPF_STORAGE_REQ_MAX - 1) enum { SK_DIAG_BPF_STORAGE_REP_NONE, SK_DIAG_BPF_STORAGE, __SK_DIAG_BPF_STORAGE_REP_MAX, }; #define SK_DIAB_BPF_STORAGE_REP_MAX (__SK_DIAG_BPF_STORAGE_REP_MAX - 1) enum { SK_DIAG_BPF_STORAGE_NONE, SK_DIAG_BPF_STORAGE_PAD, SK_DIAG_BPF_STORAGE_MAP_ID, SK_DIAG_BPF_STORAGE_MAP_VALUE, __SK_DIAG_BPF_STORAGE_MAX, }; #define SK_DIAG_BPF_STORAGE_MAX (__SK_DIAG_BPF_STORAGE_MAX - 1) #endif /* __SOCK_DIAG_H__ */ linux/socket.h 0000644 00000001605 15063602055 0007350 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SOCKET_H #define _LINUX_SOCKET_H /* * Desired design of maximum size and alignment (see RFC2553) */ #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) /* Implementation specific desired alignment */ typedef unsigned short __kernel_sa_family_t; struct __kernel_sockaddr_storage { __kernel_sa_family_t ss_family; /* address family */ /* Following field(s) are implementation specific */ char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; /* space to achieve desired size, */ /* _SS_MAXSIZE value minus size of ss_family */ } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ #define SOCK_TXREHASH_DEFAULT 255 #define SOCK_TXREHASH_DISABLED 0 #define SOCK_TXREHASH_ENABLED 1 #endif /* _LINUX_SOCKET_H */ linux/sockios.h 0000644 00000013732 15063602055 0007536 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions of the socket-level I/O control calls. * * Version: @(#)sockios.h 1.0.2 03/09/93 * * Authors: Ross Biro * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_SOCKIOS_H #define _LINUX_SOCKIOS_H #include <asm/sockios.h> /* Linux-specific socket ioctls */ #define SIOCINQ FIONREAD #define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ #define SOCK_IOC_TYPE 0x89 /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ #define SIOCDELRT 0x890C /* delete routing table entry */ #define SIOCRTMSG 0x890D /* unused */ /* Socket configuration controls. */ #define SIOCGIFNAME 0x8910 /* get iface name */ #define SIOCSIFLINK 0x8911 /* set iface channel */ #define SIOCGIFCONF 0x8912 /* get iface list */ #define SIOCGIFFLAGS 0x8913 /* get flags */ #define SIOCSIFFLAGS 0x8914 /* set flags */ #define SIOCGIFADDR 0x8915 /* get PA address */ #define SIOCSIFADDR 0x8916 /* set PA address */ #define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ #define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ #define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ #define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ #define SIOCGIFNETMASK 0x891b /* get network PA mask */ #define SIOCSIFNETMASK 0x891c /* set network PA mask */ #define SIOCGIFMETRIC 0x891d /* get metric */ #define SIOCSIFMETRIC 0x891e /* set metric */ #define SIOCGIFMEM 0x891f /* get memory address (BSD) */ #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ #define SIOCSIFNAME 0x8923 /* set interface name */ #define SIOCSIFHWADDR 0x8924 /* set hardware address */ #define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ #define SIOCSIFENCAP 0x8926 #define SIOCGIFHWADDR 0x8927 /* Get hardware address */ #define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ #define SIOCSIFSLAVE 0x8930 #define SIOCADDMULTI 0x8931 /* Multicast address lists */ #define SIOCDELMULTI 0x8932 #define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ #define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ #define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ #define SIOCGIFPFLAGS 0x8935 #define SIOCDIFADDR 0x8936 /* delete PA address */ #define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ #define SIOCGIFCOUNT 0x8938 /* get number of devices */ #define SIOCGIFBR 0x8940 /* Bridging support */ #define SIOCSIFBR 0x8941 /* Set bridging options */ #define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ #define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ /* SIOCGIFDIVERT was: 0x8944 Frame diversion support */ /* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */ #define SIOCETHTOOL 0x8946 /* Ethtool interface */ #define SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ #define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ #define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ #define SIOCWANDEV 0x894A /* get/set netdev parameters */ #define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ #define SIOCGSKNS 0x894C /* get socket network namespace */ /* ARP cache control calls. */ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ #define SIOCDARP 0x8953 /* delete ARP table entry */ #define SIOCGARP 0x8954 /* get ARP table entry */ #define SIOCSARP 0x8955 /* set ARP table entry */ /* RARP cache control calls. */ #define SIOCDRARP 0x8960 /* delete RARP table entry */ #define SIOCGRARP 0x8961 /* get RARP table entry */ #define SIOCSRARP 0x8962 /* set RARP table entry */ /* Driver configuration calls */ #define SIOCGIFMAP 0x8970 /* Get device parameters */ #define SIOCSIFMAP 0x8971 /* Set device parameters */ /* DLCI configuration calls */ #define SIOCADDDLCI 0x8980 /* Create new DLCI device */ #define SIOCDELDLCI 0x8981 /* Delete DLCI device */ #define SIOCGIFVLAN 0x8982 /* 802.1Q VLAN support */ #define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ /* bonding calls */ #define SIOCBONDENSLAVE 0x8990 /* enslave a device to the bond */ #define SIOCBONDRELEASE 0x8991 /* release a slave from the bond*/ #define SIOCBONDSETHWADDR 0x8992 /* set the hw addr of the bond */ #define SIOCBONDSLAVEINFOQUERY 0x8993 /* rtn info about slave state */ #define SIOCBONDINFOQUERY 0x8994 /* rtn info about bond state */ #define SIOCBONDCHANGEACTIVE 0x8995 /* update to a new active slave */ /* bridge calls */ #define SIOCBRADDBR 0x89a0 /* create new bridge device */ #define SIOCBRDELBR 0x89a1 /* remove bridge device */ #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ #define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ /* hardware time stamping: parameters in linux/net_tstamp.h */ #define SIOCSHWTSTAMP 0x89b0 /* set and get config */ #define SIOCGHWTSTAMP 0x89b1 /* get config */ /* Device private ioctl calls */ /* * These 16 ioctls are available to devices via the do_ioctl() device * vector. Each device should include this file and redefine these names * as their own. Because these are device dependent it is a good idea * _NOT_ to issue them to random objects and hope. * * THESE IOCTLS ARE _DEPRECATED_ AND WILL DISAPPEAR IN 2.5.X -DaveM */ #define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ /* * These 16 ioctl calls are protocol private */ #define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ #endif /* _LINUX_SOCKIOS_H */ linux/sonet.h 0000644 00000004362 15063602055 0007213 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* sonet.h - SONET/SHD physical layer control */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_SONET_H #define LINUX_SONET_H #define __SONET_ITEMS \ __HANDLE_ITEM(section_bip); /* section parity errors (B1) */ \ __HANDLE_ITEM(line_bip); /* line parity errors (B2) */ \ __HANDLE_ITEM(path_bip); /* path parity errors (B3) */ \ __HANDLE_ITEM(line_febe); /* line parity errors at remote */ \ __HANDLE_ITEM(path_febe); /* path parity errors at remote */ \ __HANDLE_ITEM(corr_hcs); /* correctable header errors */ \ __HANDLE_ITEM(uncorr_hcs); /* uncorrectable header errors */ \ __HANDLE_ITEM(tx_cells); /* cells sent */ \ __HANDLE_ITEM(rx_cells); /* cells received */ struct sonet_stats { #define __HANDLE_ITEM(i) int i __SONET_ITEMS #undef __HANDLE_ITEM } __attribute__ ((packed)); #define SONET_GETSTAT _IOR('a',ATMIOC_PHYTYP,struct sonet_stats) /* get statistics */ #define SONET_GETSTATZ _IOR('a',ATMIOC_PHYTYP+1,struct sonet_stats) /* ... and zero counters */ #define SONET_SETDIAG _IOWR('a',ATMIOC_PHYTYP+2,int) /* set error insertion */ #define SONET_CLRDIAG _IOWR('a',ATMIOC_PHYTYP+3,int) /* clear error insertion */ #define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int) /* query error insertion */ #define SONET_SETFRAMING _IOW('a',ATMIOC_PHYTYP+5,int) /* set framing mode (SONET/SDH) */ #define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int) /* get framing mode */ #define SONET_GETFRSENSE _IOR('a',ATMIOC_PHYTYP+7, \ unsigned char[SONET_FRSENSE_SIZE]) /* get framing sense information */ #define SONET_INS_SBIP 1 /* section BIP */ #define SONET_INS_LBIP 2 /* line BIP */ #define SONET_INS_PBIP 4 /* path BIP */ #define SONET_INS_FRAME 8 /* out of frame */ #define SONET_INS_LOS 16 /* set line to zero */ #define SONET_INS_LAIS 32 /* line alarm indication signal */ #define SONET_INS_PAIS 64 /* path alarm indication signal */ #define SONET_INS_HCS 128 /* insert HCS error */ #define SONET_FRAME_SONET 0 /* SONET STS-3 framing */ #define SONET_FRAME_SDH 1 /* SDH STM-1 framing */ #define SONET_FRSENSE_SIZE 6 /* C1[3],H1[3] (0xff for unknown) */ #endif /* LINUX_SONET_H */ linux/sonypi.h 0000644 00000012275 15063602055 0007406 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Sony Programmable I/O Control Device driver for VAIO * * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net> * * Copyright (C) 2005 Narayanan R S <nars@kadamba.org> * Copyright (C) 2001-2002 Alcôve <www.alcove.com> * * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au> * * Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp> * * Copyright (C) 2000 Takaya Kinjo <t-kinjo@tc4.so-net.ne.jp> * * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com> * * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef _SONYPI_H_ #define _SONYPI_H_ #include <linux/types.h> /* events the user application reading /dev/sonypi can use */ #define SONYPI_EVENT_IGNORE 0 #define SONYPI_EVENT_JOGDIAL_DOWN 1 #define SONYPI_EVENT_JOGDIAL_UP 2 #define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3 #define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4 #define SONYPI_EVENT_JOGDIAL_PRESSED 5 #define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */ #define SONYPI_EVENT_CAPTURE_PRESSED 7 #define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */ #define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9 #define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10 #define SONYPI_EVENT_FNKEY_ESC 11 #define SONYPI_EVENT_FNKEY_F1 12 #define SONYPI_EVENT_FNKEY_F2 13 #define SONYPI_EVENT_FNKEY_F3 14 #define SONYPI_EVENT_FNKEY_F4 15 #define SONYPI_EVENT_FNKEY_F5 16 #define SONYPI_EVENT_FNKEY_F6 17 #define SONYPI_EVENT_FNKEY_F7 18 #define SONYPI_EVENT_FNKEY_F8 19 #define SONYPI_EVENT_FNKEY_F9 20 #define SONYPI_EVENT_FNKEY_F10 21 #define SONYPI_EVENT_FNKEY_F11 22 #define SONYPI_EVENT_FNKEY_F12 23 #define SONYPI_EVENT_FNKEY_1 24 #define SONYPI_EVENT_FNKEY_2 25 #define SONYPI_EVENT_FNKEY_D 26 #define SONYPI_EVENT_FNKEY_E 27 #define SONYPI_EVENT_FNKEY_F 28 #define SONYPI_EVENT_FNKEY_S 29 #define SONYPI_EVENT_FNKEY_B 30 #define SONYPI_EVENT_BLUETOOTH_PRESSED 31 #define SONYPI_EVENT_PKEY_P1 32 #define SONYPI_EVENT_PKEY_P2 33 #define SONYPI_EVENT_PKEY_P3 34 #define SONYPI_EVENT_BACK_PRESSED 35 #define SONYPI_EVENT_LID_CLOSED 36 #define SONYPI_EVENT_LID_OPENED 37 #define SONYPI_EVENT_BLUETOOTH_ON 38 #define SONYPI_EVENT_BLUETOOTH_OFF 39 #define SONYPI_EVENT_HELP_PRESSED 40 #define SONYPI_EVENT_FNKEY_ONLY 41 #define SONYPI_EVENT_JOGDIAL_FAST_DOWN 42 #define SONYPI_EVENT_JOGDIAL_FAST_UP 43 #define SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED 44 #define SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED 45 #define SONYPI_EVENT_JOGDIAL_VFAST_DOWN 46 #define SONYPI_EVENT_JOGDIAL_VFAST_UP 47 #define SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED 48 #define SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED 49 #define SONYPI_EVENT_ZOOM_PRESSED 50 #define SONYPI_EVENT_THUMBPHRASE_PRESSED 51 #define SONYPI_EVENT_MEYE_FACE 52 #define SONYPI_EVENT_MEYE_OPPOSITE 53 #define SONYPI_EVENT_MEMORYSTICK_INSERT 54 #define SONYPI_EVENT_MEMORYSTICK_EJECT 55 #define SONYPI_EVENT_ANYBUTTON_RELEASED 56 #define SONYPI_EVENT_BATTERY_INSERT 57 #define SONYPI_EVENT_BATTERY_REMOVE 58 #define SONYPI_EVENT_FNKEY_RELEASED 59 #define SONYPI_EVENT_WIRELESS_ON 60 #define SONYPI_EVENT_WIRELESS_OFF 61 #define SONYPI_EVENT_ZOOM_IN_PRESSED 62 #define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 #define SONYPI_EVENT_CD_EJECT_PRESSED 64 #define SONYPI_EVENT_MODEKEY_PRESSED 65 #define SONYPI_EVENT_PKEY_P4 66 #define SONYPI_EVENT_PKEY_P5 67 #define SONYPI_EVENT_SETTINGKEY_PRESSED 68 #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 #define SONYPI_EVENT_MEDIA_PRESSED 72 #define SONYPI_EVENT_VENDOR_PRESSED 73 /* get/set brightness */ #define SONYPI_IOCGBRT _IOR('v', 0, __u8) #define SONYPI_IOCSBRT _IOW('v', 0, __u8) /* get battery full capacity/remaining capacity */ #define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16) #define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16) #define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16) #define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16) /* get battery flags: battery1/battery2/ac adapter present */ #define SONYPI_BFLAGS_B1 0x01 #define SONYPI_BFLAGS_B2 0x02 #define SONYPI_BFLAGS_AC 0x04 #define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8) /* get/set bluetooth subsystem state on/off */ #define SONYPI_IOCGBLUE _IOR('v', 8, __u8) #define SONYPI_IOCSBLUE _IOW('v', 9, __u8) /* get/set fan state on/off */ #define SONYPI_IOCGFAN _IOR('v', 10, __u8) #define SONYPI_IOCSFAN _IOW('v', 11, __u8) /* get temperature (C) */ #define SONYPI_IOCGTEMP _IOR('v', 12, __u8) #endif /* _SONYPI_H_ */ linux/sound.h 0000644 00000002325 15063602055 0007210 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SOUND_H #define _LINUX_SOUND_H /* * Minor numbers for the sound driver. */ #include <linux/fs.h> #define SND_DEV_CTL 0 /* Control port /dev/mixer */ #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM synthesizer and MIDI output) */ #define SND_DEV_MIDIN 2 /* Raw midi access */ #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */ #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */ #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */ /* #define SND_DEV_STATUS 6 */ /* /dev/sndstat (obsolete) */ #define SND_DEV_UNUSED 6 #define SND_DEV_AWFM 7 /* Reserved */ #define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */ /* #define SND_DEV_SNDPROC 9 */ /* /dev/sndproc for programmable devices (not used) */ /* #define SND_DEV_DMMIDI 9 */ #define SND_DEV_SYNTH 9 /* Raw synth access /dev/synth (same as /dev/dmfm) */ #define SND_DEV_DMFM 10 /* Raw synth access /dev/dmfm */ #define SND_DEV_UNKNOWN11 11 #define SND_DEV_ADSP 12 /* Like /dev/dsp (obsolete) */ #define SND_DEV_AMIDI 13 /* Like /dev/midi (obsolete) */ #define SND_DEV_ADMMIDI 14 /* Like /dev/dmmidi (onsolete) */ #endif /* _LINUX_SOUND_H */ linux/soundcard.h 0000644 00000131726 15063602055 0010052 0 ustar 00 /* * Copyright by Hannu Savolainen 1993-1997 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. 2. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef SOUNDCARD_H #define SOUNDCARD_H /* * OSS interface version. With versions earlier than 3.6 this value is * an integer with value less than 361. In versions 3.6 and later * it's a six digit hexadecimal value. For example value * of 0x030600 represents OSS version 3.6.0. * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of * the currently active driver. */ #define SOUND_VERSION 0x030802 #define OPEN_SOUND_SYSTEM /* In Linux we need to be prepared for cross compiling */ #include <linux/ioctl.h> /* Endian macros. */ # include <endian.h> /* * Supported card ID numbers (Should be somewhere else?) */ #define SNDCARD_ADLIB 1 #define SNDCARD_SB 2 #define SNDCARD_PAS 3 #define SNDCARD_GUS 4 #define SNDCARD_MPU401 5 #define SNDCARD_SB16 6 #define SNDCARD_SB16MIDI 7 #define SNDCARD_UART6850 8 #define SNDCARD_GUS16 9 #define SNDCARD_MSS 10 #define SNDCARD_PSS 11 #define SNDCARD_SSCAPE 12 #define SNDCARD_PSS_MPU 13 #define SNDCARD_PSS_MSS 14 #define SNDCARD_SSCAPE_MSS 15 #define SNDCARD_TRXPRO 16 #define SNDCARD_TRXPRO_SB 17 #define SNDCARD_TRXPRO_MPU 18 #define SNDCARD_MAD16 19 #define SNDCARD_MAD16_MPU 20 #define SNDCARD_CS4232 21 #define SNDCARD_CS4232_MPU 22 #define SNDCARD_MAUI 23 #define SNDCARD_PSEUDO_MSS 24 #define SNDCARD_GUSPNP 25 #define SNDCARD_UART401 26 /* Sound card numbers 27 to N are reserved. Don't add more numbers here. */ /*********************************** * IOCTL Commands for /dev/sequencer */ #ifndef _SIOWR #if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__))) /* Use already defined ioctl defines if they exist (except with Sun or Sparc) */ #define SIOCPARM_MASK IOCPARM_MASK #define SIOC_VOID IOC_VOID #define SIOC_OUT IOC_OUT #define SIOC_IN IOC_IN #define SIOC_INOUT IOC_INOUT #define _SIOC_SIZE _IOC_SIZE #define _SIOC_DIR _IOC_DIR #define _SIOC_NONE _IOC_NONE #define _SIOC_READ _IOC_READ #define _SIOC_WRITE _IOC_WRITE #define _SIO _IO #define _SIOR _IOR #define _SIOW _IOW #define _SIOWR _IOWR #else /* Ioctl's have the command encoded in the lower word, * and the size of any in or out parameters in the upper * word. The high 2 bits of the upper word are used * to encode the in/out status of the parameter; for now * we restrict parameters to at most 8191 bytes. */ /* #define SIOCTYPE (0xff<<8) */ #define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */ #define SIOC_VOID 0x00000000 /* no parameters */ #define SIOC_OUT 0x20000000 /* copy out parameters */ #define SIOC_IN 0x40000000 /* copy in parameters */ #define SIOC_INOUT (SIOC_IN|SIOC_OUT) /* the 0x20000000 is so we can distinguish new ioctl's from old */ #define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y)) #define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) /* this should be _SIORW, but stdio got there first */ #define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK) #define _SIOC_DIR(x) (x & 0xf0000000) #define _SIOC_NONE SIOC_VOID #define _SIOC_READ SIOC_OUT #define _SIOC_WRITE SIOC_IN # endif /* _IOWR */ #endif /* !_SIOWR */ #define SNDCTL_SEQ_RESET _SIO ('Q', 0) #define SNDCTL_SEQ_SYNC _SIO ('Q', 1) #define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info) #define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */ #define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int) #define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int) #define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int) #define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */ #define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int) #define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int) #define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int) #define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int) #define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info) #define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int) #define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */ #define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */ #define SNDCTL_SEQ_PANIC _SIO ('Q',17) #define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) #define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) #define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info) #define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control) #define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample) typedef struct synth_control { int devno; /* Synthesizer # */ char data[4000]; /* Device spesific command/data record */ }synth_control; typedef struct remove_sample { int devno; /* Synthesizer # */ int bankno; /* MIDI bank # (0=General MIDI) */ int instrno; /* MIDI instrument number */ } remove_sample; typedef struct seq_event_rec { unsigned char arr[8]; } seq_event_rec; #define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int) #define SNDCTL_TMR_START _SIO ('T', 2) #define SNDCTL_TMR_STOP _SIO ('T', 3) #define SNDCTL_TMR_CONTINUE _SIO ('T', 4) #define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int) #define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int) # define TMR_INTERNAL 0x00000001 # define TMR_EXTERNAL 0x00000002 # define TMR_MODE_MIDI 0x00000010 # define TMR_MODE_FSK 0x00000020 # define TMR_MODE_CLS 0x00000040 # define TMR_MODE_SMPTE 0x00000080 #define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int) #define SNDCTL_TMR_SELECT _SIOW ('T', 8, int) /* * Some big endian/little endian handling macros */ #define _LINUX_PATCHKEY_H_INDIRECT #include <linux/patchkey.h> #undef _LINUX_PATCHKEY_H_INDIRECT # if defined(__BYTE_ORDER) # if __BYTE_ORDER == __BIG_ENDIAN # define AFMT_S16_NE AFMT_S16_BE # elif __BYTE_ORDER == __LITTLE_ENDIAN # define AFMT_S16_NE AFMT_S16_LE # else # error "could not determine byte order" # endif # endif /* * Sample loading mechanism for internal synthesizers (/dev/sequencer) * The following patch_info structure has been designed to support * Gravis UltraSound. It tries to be universal format for uploading * sample based patches but is probably too limited. * * (PBD) As Hannu guessed, the GUS structure is too limited for * the WaveFront, but this is the right place for a constant definition. */ struct patch_info { unsigned short key; /* Use WAVE_PATCH here */ #define WAVE_PATCH _PATCHKEY(0x04) #define GUS_PATCH WAVE_PATCH #define WAVEFRONT_PATCH _PATCHKEY(0x06) short device_no; /* Synthesizer number */ short instr_no; /* Midi pgm# */ unsigned int mode; /* * The least significant byte has the same format than the GUS .PAT * files */ #define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */ #define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */ #define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */ #define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */ #define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ #define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ #define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ #define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */ /* (use the env_rate/env_offs fields). */ /* Linux specific bits */ #define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ #define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ #define WAVE_SCALE 0x00040000 /* The scaling info is valid */ #define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */ /* Reserved bits */ #define WAVE_ROM 0x40000000 /* For future use */ #define WAVE_MULAW 0x20000000 /* For future use */ /* Other bits must be zeroed */ int len; /* Size of the wave data in bytes */ int loop_start, loop_end; /* Byte offsets from the beginning */ /* * The base_freq and base_note fields are used when computing the * playback speed for a note. The base_note defines the tone frequency * which is heard if the sample is played using the base_freq as the * playback speed. * * The low_note and high_note fields define the minimum and maximum note * frequencies for which this sample is valid. It is possible to define * more than one samples for an instrument number at the same time. The * low_note and high_note fields are used to select the most suitable one. * * The fields base_note, high_note and low_note should contain * the note frequency multiplied by 1000. For example value for the * middle A is 440*1000. */ unsigned int base_freq; unsigned int base_note; unsigned int high_note; unsigned int low_note; int panning; /* -128=left, 127=right */ int detuning; /* New fields introduced in version 1.99.5 */ /* Envelope. Enabled by mode bit WAVE_ENVELOPES */ unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */ unsigned char env_offset[ 6 ]; /* 255 == 100% */ /* * The tremolo, vibrato and scale info are not supported yet. * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or * WAVE_SCALE */ unsigned char tremolo_sweep; unsigned char tremolo_rate; unsigned char tremolo_depth; unsigned char vibrato_sweep; unsigned char vibrato_rate; unsigned char vibrato_depth; int scale_frequency; unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */ int volume; int fractions; int reserved1; int spare[2]; char data[1]; /* The waveform data starts here */ }; struct sysex_info { short key; /* Use SYSEX_PATCH or MAUI_PATCH here */ #define SYSEX_PATCH _PATCHKEY(0x05) #define MAUI_PATCH _PATCHKEY(0x06) short device_no; /* Synthesizer number */ int len; /* Size of the sysex data in bytes */ unsigned char data[1]; /* Sysex data starts here */ }; /* * /dev/sequencer input events. * * The data written to the /dev/sequencer is a stream of events. Events * are records of 4 or 8 bytes. The first byte defines the size. * Any number of events can be written with a write call. There * is a set of macros for sending these events. Use these macros if you * want to maximize portability of your program. * * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. * (All input events are currently 4 bytes long. Be prepared to support * 8 byte events also. If you receive any event having first byte >= 128, * it's a 8 byte event. * * The events are documented at the end of this file. * * Normal events (4 bytes) * There is also a 8 byte version of most of the 4 byte events. The * 8 byte one is recommended. */ #define SEQ_NOTEOFF 0 #define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */ #define SEQ_NOTEON 1 #define SEQ_FMNOTEON SEQ_NOTEON #define SEQ_WAIT TMR_WAIT_ABS #define SEQ_PGMCHANGE 3 #define SEQ_FMPGMCHANGE SEQ_PGMCHANGE #define SEQ_SYNCTIMER TMR_START #define SEQ_MIDIPUTC 5 #define SEQ_DRUMON 6 /*** OBSOLETE ***/ #define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ #define SEQ_ECHO TMR_ECHO /* For synching programs with output */ #define SEQ_AFTERTOUCH 9 #define SEQ_CONTROLLER 10 /******************************************* * Midi controller numbers ******************************************* * Controllers 0 to 31 (0x00 to 0x1f) and * 32 to 63 (0x20 to 0x3f) are continuous * controllers. * In the MIDI 1.0 these controllers are sent using * two messages. Controller numbers 0 to 31 are used * to send the MSB and the controller numbers 32 to 63 * are for the LSB. Note that just 7 bits are used in MIDI bytes. */ #define CTL_BANK_SELECT 0x00 #define CTL_MODWHEEL 0x01 #define CTL_BREATH 0x02 /* undefined 0x03 */ #define CTL_FOOT 0x04 #define CTL_PORTAMENTO_TIME 0x05 #define CTL_DATA_ENTRY 0x06 #define CTL_MAIN_VOLUME 0x07 #define CTL_BALANCE 0x08 /* undefined 0x09 */ #define CTL_PAN 0x0a #define CTL_EXPRESSION 0x0b /* undefined 0x0c */ /* undefined 0x0d */ /* undefined 0x0e */ /* undefined 0x0f */ #define CTL_GENERAL_PURPOSE1 0x10 #define CTL_GENERAL_PURPOSE2 0x11 #define CTL_GENERAL_PURPOSE3 0x12 #define CTL_GENERAL_PURPOSE4 0x13 /* undefined 0x14 - 0x1f */ /* undefined 0x20 */ /* The controller numbers 0x21 to 0x3f are reserved for the */ /* least significant bytes of the controllers 0x00 to 0x1f. */ /* These controllers are not recognised by the driver. */ /* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */ /* 0=OFF and 127=ON (intermediate values are possible) */ #define CTL_DAMPER_PEDAL 0x40 #define CTL_SUSTAIN 0x40 /* Alias */ #define CTL_HOLD 0x40 /* Alias */ #define CTL_PORTAMENTO 0x41 #define CTL_SOSTENUTO 0x42 #define CTL_SOFT_PEDAL 0x43 /* undefined 0x44 */ #define CTL_HOLD2 0x45 /* undefined 0x46 - 0x4f */ #define CTL_GENERAL_PURPOSE5 0x50 #define CTL_GENERAL_PURPOSE6 0x51 #define CTL_GENERAL_PURPOSE7 0x52 #define CTL_GENERAL_PURPOSE8 0x53 /* undefined 0x54 - 0x5a */ #define CTL_EXT_EFF_DEPTH 0x5b #define CTL_TREMOLO_DEPTH 0x5c #define CTL_CHORUS_DEPTH 0x5d #define CTL_DETUNE_DEPTH 0x5e #define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */ #define CTL_PHASER_DEPTH 0x5f #define CTL_DATA_INCREMENT 0x60 #define CTL_DATA_DECREMENT 0x61 #define CTL_NONREG_PARM_NUM_LSB 0x62 #define CTL_NONREG_PARM_NUM_MSB 0x63 #define CTL_REGIST_PARM_NUM_LSB 0x64 #define CTL_REGIST_PARM_NUM_MSB 0x65 /* undefined 0x66 - 0x78 */ /* reserved 0x79 - 0x7f */ /* Pseudo controllers (not midi compatible) */ #define CTRL_PITCH_BENDER 255 #define CTRL_PITCH_BENDER_RANGE 254 #define CTRL_EXPRESSION 253 /* Obsolete */ #define CTRL_MAIN_VOLUME 252 /* Obsolete */ #define SEQ_BALANCE 11 #define SEQ_VOLMODE 12 /* * Volume mode decides how volumes are used */ #define VOL_METHOD_ADAGIO 1 #define VOL_METHOD_LINEAR 2 /* * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as * input events. */ /* * Event codes 0xf0 to 0xfc are reserved for future extensions. */ #define SEQ_FULLSIZE 0xfd /* Long events */ /* * SEQ_FULLSIZE events are used for loading patches/samples to the * synthesizer devices. These events are passed directly to the driver * of the associated synthesizer device. There is no limit to the size * of the extended events. These events are not queued but executed * immediately when the write() is called (execution can take several * seconds of time). * * When a SEQ_FULLSIZE message is written to the device, it must * be written using exactly one write() call. Other events cannot * be mixed to the same write. * * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the * /dev/sequencer. Don't write other data together with the instrument structure * Set the key field of the structure to FM_PATCH. The device field is used to * route the patch to the corresponding device. * * For wave table use struct patch_info. Initialize the key field * to WAVE_PATCH. */ #define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ #define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ /* * Record for FM patches */ typedef unsigned char sbi_instr_data[32]; struct sbi_instrument { unsigned short key; /* FM_PATCH or OPL3_PATCH */ #define FM_PATCH _PATCHKEY(0x01) #define OPL3_PATCH _PATCHKEY(0x03) short device; /* Synth# (0-4) */ int channel; /* Program# to be initialized */ sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */ }; struct synth_info { /* Read only */ char name[30]; int device; /* 0-N. INITIALIZE BEFORE CALLING */ int synth_type; #define SYNTH_TYPE_FM 0 #define SYNTH_TYPE_SAMPLE 1 #define SYNTH_TYPE_MIDI 2 /* Midi interface */ int synth_subtype; #define FM_TYPE_ADLIB 0x00 #define FM_TYPE_OPL3 0x01 #define MIDI_TYPE_MPU401 0x401 #define SAMPLE_TYPE_BASIC 0x10 #define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC #define SAMPLE_TYPE_WAVEFRONT 0x11 int perc_mode; /* No longer supported */ int nr_voices; int nr_drums; /* Obsolete field */ int instr_bank_size; unsigned int capabilities; #define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ #define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ #define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ int dummies[19]; /* Reserve space */ }; struct sound_timer_info { char name[32]; int caps; }; #define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */ struct midi_info { char name[30]; int device; /* 0-N. INITIALIZE BEFORE CALLING */ unsigned int capabilities; /* To be defined later */ int dev_type; int dummies[18]; /* Reserve space */ }; /******************************************** * ioctl commands for the /dev/midi## */ typedef struct { unsigned char cmd; char nr_args, nr_returns; unsigned char data[30]; } mpu_command_rec; #define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int) #define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int) #define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec) /******************************************** * IOCTL commands for /dev/dsp and /dev/audio */ #define SNDCTL_DSP_RESET _SIO ('P', 0) #define SNDCTL_DSP_SYNC _SIO ('P', 1) #define SNDCTL_DSP_SPEED _SIOWR('P', 2, int) #define SNDCTL_DSP_STEREO _SIOWR('P', 3, int) #define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int) #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT #define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int) #define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS #define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int) #define SNDCTL_DSP_POST _SIO ('P', 8) #define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int) #define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) /* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */ #define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */ #define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/ # define AFMT_QUERY 0x00000000 /* Return current fmt */ # define AFMT_MU_LAW 0x00000001 # define AFMT_A_LAW 0x00000002 # define AFMT_IMA_ADPCM 0x00000004 # define AFMT_U8 0x00000008 # define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/ # define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */ # define AFMT_S8 0x00000040 # define AFMT_U16_LE 0x00000080 /* Little endian U16 */ # define AFMT_U16_BE 0x00000100 /* Big endian U16 */ # define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ # define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ /* * Buffer status queries. */ typedef struct audio_buf_info { int fragments; /* # of available fragments (partially usend ones not counted) */ int fragstotal; /* Total # of fragments allocated */ int fragsize; /* Size of a fragment in bytes */ int bytes; /* Available space in bytes (includes partially used fragments) */ /* Note! 'bytes' could be more than fragments*fragsize */ } audio_buf_info; #define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info) #define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info) #define SNDCTL_DSP_NONBLOCK _SIO ('P',14) #define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int) # define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ # define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ # define DSP_CAP_REALTIME 0x00000200 /* Real time capability */ # define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */ /* internal buffers which may */ /* cause some delays and */ /* decrease precision of timing */ # define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */ /* Sometimes it's a DSP */ /* but usually not */ # define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ # define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */ # define DSP_CAP_MULTI 0x00004000 /* support multiple open */ # define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */ #define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int) #define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int) # define PCM_ENABLE_INPUT 0x00000001 # define PCM_ENABLE_OUTPUT 0x00000002 typedef struct count_info { int bytes; /* Total # of bytes processed */ int blocks; /* # of fragment transitions since last time */ int ptr; /* Current DMA pointer value */ } count_info; #define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info) #define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info) typedef struct buffmem_desc { unsigned *buffer; int size; } buffmem_desc; #define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc) #define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc) #define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) #define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) #define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int) #define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int) #define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int) # define DSP_BIND_QUERY 0x00000000 # define DSP_BIND_FRONT 0x00000001 # define DSP_BIND_SURR 0x00000002 # define DSP_BIND_CENTER_LFE 0x00000004 # define DSP_BIND_HANDSET 0x00000008 # define DSP_BIND_MIC 0x00000010 # define DSP_BIND_MODEM1 0x00000020 # define DSP_BIND_MODEM2 0x00000040 # define DSP_BIND_I2S 0x00000080 # define DSP_BIND_SPDIF 0x00000100 #define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int) #define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int) # define SPDIF_PRO 0x0001 # define SPDIF_N_AUD 0x0002 # define SPDIF_COPY 0x0004 # define SPDIF_PRE 0x0008 # define SPDIF_CC 0x07f0 # define SPDIF_L 0x0800 # define SPDIF_DRS 0x4000 # define SPDIF_V 0x8000 /* * Application's profile defines the way how playback underrun situations should be handled. * * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the * playback buffer whenever an underrun occurs. This consumes some time * prevents looping the existing buffer. * APF_CPUINTENS is intended to be set by CPU intensive applications which * are likely to run out of time occasionally. In this mode the buffer cleanup is * disabled which saves CPU time but also let's the previous buffer content to * be played during the "pause" after the underrun. */ #define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int) #define APF_NORMAL 0 /* Normal applications */ #define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */ #define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */ #define SOUND_PCM_READ_RATE _SIOR ('P', 2, int) #define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int) #define SOUND_PCM_READ_BITS _SIOR ('P', 5, int) #define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int) /* Some alias names */ #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED #define SOUND_PCM_POST SNDCTL_DSP_POST #define SOUND_PCM_RESET SNDCTL_DSP_RESET #define SOUND_PCM_SYNC SNDCTL_DSP_SYNC #define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE #define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT #define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS #define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT #define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE #define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE #define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK #define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS #define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER #define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER #define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO #define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR #define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR #define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF #define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF /* * ioctl calls to be used in communication with coprocessors and * DSP chips. */ typedef struct copr_buffer { int command; /* Set to 0 if not used */ int flags; #define CPF_NONE 0x0000 #define CPF_FIRST 0x0001 /* First block */ #define CPF_LAST 0x0002 /* Last block */ int len; int offs; /* If required by the device (0 if not used) */ unsigned char data[4000]; /* NOTE! 4000 is not 4k */ } copr_buffer; typedef struct copr_debug_buf { int command; /* Used internally. Set to 0 */ int parm1; int parm2; int flags; int len; /* Length of data in bytes */ } copr_debug_buf; typedef struct copr_msg { int len; unsigned char data[4000]; } copr_msg; #define SNDCTL_COPR_RESET _SIO ('C', 0) #define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer) #define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf) #define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf) #define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf) #define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf) #define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf) #define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf) #define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg) #define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg) /********************************************* * IOCTL commands for /dev/mixer */ /* * Mixer devices * * There can be up to 20 different analog mixer channels. The * SOUND_MIXER_NRDEVICES gives the currently supported maximum. * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells * the devices supported by the particular mixer. */ #define SOUND_MIXER_NRDEVICES 25 #define SOUND_MIXER_VOLUME 0 #define SOUND_MIXER_BASS 1 #define SOUND_MIXER_TREBLE 2 #define SOUND_MIXER_SYNTH 3 #define SOUND_MIXER_PCM 4 #define SOUND_MIXER_SPEAKER 5 #define SOUND_MIXER_LINE 6 #define SOUND_MIXER_MIC 7 #define SOUND_MIXER_CD 8 #define SOUND_MIXER_IMIX 9 /* Recording monitor */ #define SOUND_MIXER_ALTPCM 10 #define SOUND_MIXER_RECLEV 11 /* Recording level */ #define SOUND_MIXER_IGAIN 12 /* Input gain */ #define SOUND_MIXER_OGAIN 13 /* Output gain */ /* * The AD1848 codec and compatibles have three line level inputs * (line, aux1 and aux2). Since each card manufacturer have assigned * different meanings to these inputs, it's inpractical to assign * specific meanings (line, cd, synth etc.) to them. */ #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ #define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ #define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ #define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ #define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ #define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ #define SOUND_MIXER_PHONEIN 20 /* Phone input */ #define SOUND_MIXER_PHONEOUT 21 /* Phone output */ #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ #define SOUND_MIXER_RADIO 23 /* Radio in */ #define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ /* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */ /* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */ #define SOUND_ONOFF_MIN 28 #define SOUND_ONOFF_MAX 30 /* Note! Number 31 cannot be used since the sign bit is reserved */ #define SOUND_MIXER_NONE 31 /* * The following unsupported macros are no longer functional. * Use SOUND_MIXER_PRIVATE# macros in future. */ #define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE #define SOUND_MIXER_MUTE SOUND_MIXER_NONE #define SOUND_MIXER_LOUD SOUND_MIXER_NONE #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ "line1", "line2", "line3", "dig1", "dig2", "dig3", \ "phin", "phout", "video", "radio", "monitor"} /* Device bitmask identifiers */ #define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */ #define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */ #define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */ #define SOUND_MIXER_CAPS 0xfc # define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */ #define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ #define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */ #define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */ /* Device mask bits */ #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) #define SOUND_MASK_CD (1 << SOUND_MIXER_CD) #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) /* Obsolete macros */ #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) #define MIXER_READ(dev) _SIOR('M', dev, int) #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) #define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) #define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) #define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) #define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) #define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) /* Obsolete macros */ #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) #define MIXER_WRITE(dev) _SIOWR('M', dev, int) #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) #define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) #define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) #define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) #define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) #define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) /* Obsolete macros */ #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) typedef struct mixer_info { char id[16]; char name[32]; int modify_counter; int fillers[10]; } mixer_info; typedef struct _old_mixer_info /* Obsolete */ { char id[16]; char name[32]; } _old_mixer_info; #define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info) #define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info) /* * A mechanism for accessing "proprietary" mixer features. This method * permits passing 128 bytes of arbitrary data between a mixer application * and the mixer driver. Interpretation of the record is defined by * the particular mixer driver. */ typedef unsigned char mixer_record[128]; #define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record) /* * Two ioctls for special souncard function */ #define SOUND_MIXER_AGC _SIOWR('M', 103, int) #define SOUND_MIXER_3DSE _SIOWR('M', 104, int) /* * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers. * These features can be used when accessing device specific features. */ #define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int) #define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int) #define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int) #define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int) #define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int) /* * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used * for querying current mixer settings from the driver and for loading * default volume settings _prior_ activating the mixer (loading * doesn't affect current state of the mixer hardware). These calls * are for internal use only. */ typedef struct mixer_vol_table { int num; /* Index to volume table */ char name[32]; int levels[32]; } mixer_vol_table; #define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table) #define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table) /* * An ioctl for identifying the driver version. It will return value * of the SOUND_VERSION macro used when compiling the driver. * This call was introduced in OSS version 3.6 and it will not work * with earlier versions (returns EINVAL). */ #define OSS_GETVERSION _SIOR ('M', 118, int) /* * Level 2 event types for /dev/sequencer */ /* * The 4 most significant bits of byte 0 specify the class of * the event: * * 0x8X = system level events, * 0x9X = device/port specific events, event[1] = device/port, * The last 4 bits give the subtype: * 0x02 = Channel event (event[3] = chn). * 0x01 = note event (event[4] = note). * (0x01 is not used alone but always with bit 0x02). * event[2] = MIDI message code (0x80=note off etc.) * */ #define EV_SEQ_LOCAL 0x80 #define EV_TIMING 0x81 #define EV_CHN_COMMON 0x92 #define EV_CHN_VOICE 0x93 #define EV_SYSEX 0x94 /* * Event types 200 to 220 are reserved for application use. * These numbers will not be used by the driver. */ /* * Events for event type EV_CHN_VOICE */ #define MIDI_NOTEOFF 0x80 #define MIDI_NOTEON 0x90 #define MIDI_KEY_PRESSURE 0xA0 /* * Events for event type EV_CHN_COMMON */ #define MIDI_CTL_CHANGE 0xB0 #define MIDI_PGM_CHANGE 0xC0 #define MIDI_CHN_PRESSURE 0xD0 #define MIDI_PITCH_BEND 0xE0 #define MIDI_SYSTEM_PREFIX 0xF0 /* * Timer event types */ #define TMR_WAIT_REL 1 /* Time relative to the prev time */ #define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ #define TMR_STOP 3 #define TMR_START 4 #define TMR_CONTINUE 5 #define TMR_TEMPO 6 #define TMR_ECHO 8 #define TMR_CLOCK 9 /* MIDI clock */ #define TMR_SPP 10 /* Song position pointer */ #define TMR_TIMESIG 11 /* Time signature */ /* * Local event types */ #define LOCL_STARTAUDIO 1 /* * Some convenience macros to simplify programming of the * /dev/sequencer interface * * This is a legacy interface for applications written against * the OSSlib-3.8 style interface. It is no longer possible * to actually link against OSSlib with this header, but we * still provide these macros for programs using them. * * If you want to use OSSlib, it is recommended that you get * the GPL version of OSS-4.x and build against that version * of the header. * * We redefine the extern keyword so that make headers_check * does not complain about SEQ_USE_EXTBUF. */ #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() void seqbuf_dump(void); /* This function must be provided by programs */ #define SEQ_PM_DEFINES int __foo_bar___ #define SEQ_LOAD_GMINSTR(dev, instr) #define SEQ_LOAD_GMDRUM(dev, drum) #define _SEQ_EXTERN extern #define SEQ_USE_EXTBUF() \ _SEQ_EXTERN unsigned char _seqbuf[]; \ _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr #ifndef USE_SIMPLE_MACROS /* Sample seqbuf_dump() implementation: * * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes * * int seqfd; -- The file descriptor for /dev/sequencer. * * void * seqbuf_dump () * { * if (_seqbufptr) * if (write (seqfd, _seqbuf, _seqbufptr) == -1) * { * perror ("write /dev/sequencer"); * exit (-1); * } * _seqbufptr = 0; * } */ #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() #define _SEQ_ADVBUF(len) _seqbufptr += len #define SEQ_DUMPBUF seqbuf_dump #else /* * This variation of the sequencer macros is used just to format one event * using fixed buffer. * * The program using the macro library must define the following macros before * using this library. * * #define _seqbuf name of the buffer (unsigned char[]) * #define _SEQ_ADVBUF(len) If the applic needs to know the exact * size of the event, this macro can be used. * Otherwise this must be defined as empty. * #define _seqbufptr Define the name of index variable or 0 if * not required. */ #define _SEQ_NEEDBUF(len) /* empty */ #endif #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ _seqbuf[_seqbufptr+2] = (dev);\ _seqbuf[_seqbufptr+3] = (mode);\ _seqbuf[_seqbufptr+4] = 0;\ _seqbuf[_seqbufptr+5] = 0;\ _seqbuf[_seqbufptr+6] = 0;\ _seqbuf[_seqbufptr+7] = 0;\ _SEQ_ADVBUF(8);} /* * Midi voice messages */ #define _CHN_VOICE(dev, event, chn, note, parm) \ {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = EV_CHN_VOICE;\ _seqbuf[_seqbufptr+1] = (dev);\ _seqbuf[_seqbufptr+2] = (event);\ _seqbuf[_seqbufptr+3] = (chn);\ _seqbuf[_seqbufptr+4] = (note);\ _seqbuf[_seqbufptr+5] = (parm);\ _seqbuf[_seqbufptr+6] = (0);\ _seqbuf[_seqbufptr+7] = 0;\ _SEQ_ADVBUF(8);} #define SEQ_START_NOTE(dev, chn, note, vol) \ _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) #define SEQ_STOP_NOTE(dev, chn, note, vol) \ _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) /* * Midi channel messages */ #define _CHN_COMMON(dev, event, chn, p1, p2, w14) \ {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = EV_CHN_COMMON;\ _seqbuf[_seqbufptr+1] = (dev);\ _seqbuf[_seqbufptr+2] = (event);\ _seqbuf[_seqbufptr+3] = (chn);\ _seqbuf[_seqbufptr+4] = (p1);\ _seqbuf[_seqbufptr+5] = (p2);\ *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ _SEQ_ADVBUF(8);} /* * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits * sending any MIDI bytes but it's absolutely not possible. Trying to do * so _will_ cause problems with MPU401 intelligent mode). * * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be * sent by calling SEQ_SYSEX() several times (there must be no other events * between them). First sysex fragment must have 0xf0 in the first byte * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte * between these sysex start and end markers cannot be larger than 0x7f. Also * lengths of each fragments (except the last one) must be 6. * * Breaking the above rules may work with some MIDI ports but is likely to * cause fatal problems with some other devices (such as MPU401). */ #define SEQ_SYSEX(dev, buf, len) \ {int ii, ll=(len); \ unsigned char *bufp=buf;\ if (ll>6)ll=6;\ _SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = EV_SYSEX;\ _seqbuf[_seqbufptr+1] = (dev);\ for(ii=0;ii<ll;ii++)\ _seqbuf[_seqbufptr+ii+2] = bufp[ii];\ for(ii=ll;ii<6;ii++)\ _seqbuf[_seqbufptr+ii+2] = 0xff;\ _SEQ_ADVBUF(8);} #define SEQ_CHN_PRESSURE(dev, chn, pressure) \ _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) #define SEQ_SET_PATCH SEQ_PGM_CHANGE #define SEQ_PGM_CHANGE(dev, chn, patch) \ _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) #define SEQ_CONTROL(dev, chn, controller, value) \ _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) #define SEQ_BENDER(dev, chn, value) \ _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value) #define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\ _seqbuf[_seqbufptr+2] = (dev);\ _seqbuf[_seqbufptr+3] = (voice);\ _seqbuf[_seqbufptr+4] = (controller);\ _seqbuf[_seqbufptr+5] = ((value)&0xff);\ _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\ _seqbuf[_seqbufptr+7] = 0;\ _SEQ_ADVBUF(8);} /* * The following 5 macros are incorrectly implemented and obsolete. * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. */ #define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) #define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) /* * Timing and synchronization macros */ #define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr+0] = EV_TIMING; \ _seqbuf[_seqbufptr+1] = (ev); \ _seqbuf[_seqbufptr+2] = 0;\ _seqbuf[_seqbufptr+3] = 0;\ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ _SEQ_ADVBUF(8);} #define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) #define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) #define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) #define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) #define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) #define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) #define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) #define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) #define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) /* * Local control events */ #define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ _seqbuf[_seqbufptr+1] = (ev); \ _seqbuf[_seqbufptr+2] = 0;\ _seqbuf[_seqbufptr+3] = 0;\ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ _SEQ_ADVBUF(8);} #define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) /* * Events for the level 1 interface only */ #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\ _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ _seqbuf[_seqbufptr+1] = (byte);\ _seqbuf[_seqbufptr+2] = (device);\ _seqbuf[_seqbufptr+3] = 0;\ _SEQ_ADVBUF(4);} /* * Patch loading. */ #define SEQ_WRPATCH(patchx, len) \ {if (_seqbufptr) SEQ_DUMPBUF();\ if (write(seqfd, (char*)(patchx), len)==-1) \ perror("Write patch: /dev/sequencer");} #define SEQ_WRPATCH2(patchx, len) \ (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) #endif /* SOUNDCARD_H */ linux/stat.h 0000644 00000014320 15063602055 0007031 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_STAT_H #define _LINUX_STAT_H #include <linux/types.h> #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) #define S_IFMT 00170000 #define S_IFSOCK 0140000 #define S_IFLNK 0120000 #define S_IFREG 0100000 #define S_IFBLK 0060000 #define S_IFDIR 0040000 #define S_IFCHR 0020000 #define S_IFIFO 0010000 #define S_ISUID 0004000 #define S_ISGID 0002000 #define S_ISVTX 0001000 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) #define S_IRWXU 00700 #define S_IRUSR 00400 #define S_IWUSR 00200 #define S_IXUSR 00100 #define S_IRWXG 00070 #define S_IRGRP 00040 #define S_IWGRP 00020 #define S_IXGRP 00010 #define S_IRWXO 00007 #define S_IROTH 00004 #define S_IWOTH 00002 #define S_IXOTH 00001 #endif /* * Timestamp structure for the timestamps in struct statx. * * tv_sec holds the number of seconds before (negative) or after (positive) * 00:00:00 1st January 1970 UTC. * * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time. * * __reserved is held in case we need a yet finer resolution. */ struct statx_timestamp { __s64 tv_sec; __u32 tv_nsec; __s32 __reserved; }; /* * Structures for the extended file attribute retrieval system call * (statx()). * * The caller passes a mask of what they're specifically interested in as a * parameter to statx(). What statx() actually got will be indicated in * st_mask upon return. * * For each bit in the mask argument: * * - if the datum is not supported: * * - the bit will be cleared, and * * - the datum will be set to an appropriate fabricated value if one is * available (eg. CIFS can take a default uid and gid), otherwise * * - the field will be cleared; * * - otherwise, if explicitly requested: * * - the datum will be synchronised to the server if AT_STATX_FORCE_SYNC is * set or if the datum is considered out of date, and * * - the field will be filled in and the bit will be set; * * - otherwise, if not requested, but available in approximate form without any * effort, it will be filled in anyway, and the bit will be set upon return * (it might not be up to date, however, and no attempt will be made to * synchronise the internal state first); * * - otherwise the field and the bit will be cleared before returning. * * Items in STATX_BASIC_STATS may be marked unavailable on return, but they * will have values installed for compatibility purposes so that stat() and * co. can be emulated in userspace. */ struct statx { /* 0x00 */ __u32 stx_mask; /* What results were written [uncond] */ __u32 stx_blksize; /* Preferred general I/O size [uncond] */ __u64 stx_attributes; /* Flags conveying information about the file [uncond] */ /* 0x10 */ __u32 stx_nlink; /* Number of hard links */ __u32 stx_uid; /* User ID of owner */ __u32 stx_gid; /* Group ID of owner */ __u16 stx_mode; /* File mode */ __u16 __spare0[1]; /* 0x20 */ __u64 stx_ino; /* Inode number */ __u64 stx_size; /* File size */ __u64 stx_blocks; /* Number of 512-byte blocks allocated */ __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */ /* 0x40 */ struct statx_timestamp stx_atime; /* Last access time */ struct statx_timestamp stx_btime; /* File creation time */ struct statx_timestamp stx_ctime; /* Last attribute change time */ struct statx_timestamp stx_mtime; /* Last data modification time */ /* 0x80 */ __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ __u32 stx_rdev_minor; __u32 stx_dev_major; /* ID of device containing file [uncond] */ __u32 stx_dev_minor; /* 0x90 */ __u64 __spare2[14]; /* Spare space for future expansion */ /* 0x100 */ }; /* * Flags to be stx_mask * * Query request/result mask for statx() and struct statx::stx_mask. * * These bits should be set in the mask argument of statx() to request * particular items when calling statx(). */ #define STATX_TYPE 0x00000001U /* Want/got stx_mode & S_IFMT */ #define STATX_MODE 0x00000002U /* Want/got stx_mode & ~S_IFMT */ #define STATX_NLINK 0x00000004U /* Want/got stx_nlink */ #define STATX_UID 0x00000008U /* Want/got stx_uid */ #define STATX_GID 0x00000010U /* Want/got stx_gid */ #define STATX_ATIME 0x00000020U /* Want/got stx_atime */ #define STATX_MTIME 0x00000040U /* Want/got stx_mtime */ #define STATX_CTIME 0x00000080U /* Want/got stx_ctime */ #define STATX_INO 0x00000100U /* Want/got stx_ino */ #define STATX_SIZE 0x00000200U /* Want/got stx_size */ #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */ #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ #define STATX_ALL 0x00000fffU /* All currently supported flags */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ /* * Attributes to be found in stx_attributes and masked in stx_attributes_mask. * * These give information about the features or the state of a file that might * be of use to ordinary userspace programs such as GUIs or ls rather than * specialised tools. * * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags * semantically. Where possible, the numerical value is picked to correspond * also. Note that the DAX attribute indicates that the file is in the CPU * direct access state. It does not correspond to the per-inode flag that * some filesystems support. * */ #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */ #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */ #define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */ #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */ #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */ #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */ #define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */ #endif /* _LINUX_STAT_H */ linux/stddef.h 0000644 00000002774 15063602055 0007341 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_STDDEF_H #define _LINUX_STDDEF_H #ifndef __always_inline #define __always_inline __inline__ #endif /** * __struct_group() - Create a mirrored named and anonyomous struct * * @TAG: The tag name for the named sub-struct (usually empty) * @NAME: The identifier name of the mirrored sub-struct * @ATTRS: Any struct attributes (usually empty) * @MEMBERS: The member declarations for the mirrored structs * * Used to create an anonymous union of two structs with identical layout * and size: one anonymous and one named. The former's members can be used * normally without sub-struct naming, and the latter can be used to * reason about the start, end, and size of the group of struct members. * The named struct can also be explicitly tagged for layer reuse, as well * as both having struct attributes appended. */ #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ union { \ struct { MEMBERS } ATTRS; \ struct TAG { MEMBERS } ATTRS NAME; \ } #endif /* * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union * * @TYPE: The type of each flexible array element * @NAME: The name of the flexible array member * * In order to have a flexible array member in a union or alone in a * struct, it needs to be wrapped in an anonymous struct with at least 1 * named member, but that member can be empty. */ #define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ struct { \ struct { } __empty_ ## NAME; \ TYPE NAME[]; \ } linux/stm.h 0000644 00000002373 15063602055 0006666 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * System Trace Module (STM) userspace interfaces * Copyright (c) 2014, Intel Corporation. * * STM class implements generic infrastructure for System Trace Module devices * as defined in MIPI STPv2 specification. */ #ifndef _LINUX_STM_H #define _LINUX_STM_H #include <linux/types.h> /* Maximum allowed master and channel values */ #define STP_MASTER_MAX 0xffff #define STP_CHANNEL_MAX 0xffff /** * struct stp_policy_id - identification for the STP policy * @size: size of the structure including real id[] length * @master: assigned master * @channel: first assigned channel * @width: number of requested channels * @id: identification string * * User must calculate the total size of the structure and put it into * @size field, fill out the @id and desired @width. In return, kernel * fills out @master, @channel and @width. */ struct stp_policy_id { __u32 size; __u16 master; __u16 channel; __u16 width; /* padding */ __u16 __reserved_0; __u32 __reserved_1; char id[0]; }; #define STP_POLICY_ID_SET _IOWR('%', 0, struct stp_policy_id) #define STP_POLICY_ID_GET _IOR('%', 1, struct stp_policy_id) #define STP_SET_OPTIONS _IOW('%', 2, __u64) #endif /* _LINUX_STM_H */ linux/string.h 0000644 00000000356 15063602055 0007370 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_STRING_H_ #define _LINUX_STRING_H_ /* We don't want strings.h stuff being used by user stuff by accident */ #include <string.h> #endif /* _LINUX_STRING_H_ */ linux/suspend_ioctls.h 0000644 00000002627 15063602055 0011123 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SUSPEND_IOCTLS_H #define _LINUX_SUSPEND_IOCTLS_H #include <linux/types.h> /* * This structure is used to pass the values needed for the identification * of the resume swap area from a user space to the kernel via the * SNAPSHOT_SET_SWAP_AREA ioctl */ struct resume_swap_area { __kernel_loff_t offset; __u32 dev; } __attribute__((packed)); #define SNAPSHOT_IOC_MAGIC '3' #define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1) #define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2) #define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4) #define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5) #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) #define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \ struct resume_swap_area) #define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, __kernel_loff_t) #define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15) #define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16) #define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int) #define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18) #define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, __kernel_loff_t) #define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, __kernel_loff_t) #define SNAPSHOT_IOC_MAXNR 20 #endif /* _LINUX_SUSPEND_IOCTLS_H */ linux/swab.h 0000644 00000015411 15063602055 0007014 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SWAB_H #define _LINUX_SWAB_H #include <linux/types.h> #include <asm/bitsperlong.h> #include <asm/swab.h> /* * casts are necessary for constants, because we never know how for sure * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. */ #define ___constant_swab16(x) ((__u16)( \ (((__u16)(x) & (__u16)0x00ffU) << 8) | \ (((__u16)(x) & (__u16)0xff00U) >> 8))) #define ___constant_swab32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ (((__u32)(x) & (__u32)0xff000000UL) >> 24))) #define ___constant_swab64(x) ((__u64)( \ (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \ (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \ (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) #define ___constant_swahw32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) #define ___constant_swahb32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) /* * Implement the following as inlines, but define the interface using * macros to allow constant folding when possible: * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 */ static __inline__ __u16 __fswab16(__u16 val) { #if defined (__arch_swab16) return __arch_swab16(val); #else return ___constant_swab16(val); #endif } static __inline__ __u32 __fswab32(__u32 val) { #if defined(__arch_swab32) return __arch_swab32(val); #else return ___constant_swab32(val); #endif } static __inline__ __u64 __fswab64(__u64 val) { #if defined (__arch_swab64) return __arch_swab64(val); #elif defined(__SWAB_64_THRU_32__) __u32 h = val >> 32; __u32 l = val & ((1ULL << 32) - 1); return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h))); #else return ___constant_swab64(val); #endif } static __inline__ __u32 __fswahw32(__u32 val) { #ifdef __arch_swahw32 return __arch_swahw32(val); #else return ___constant_swahw32(val); #endif } static __inline__ __u32 __fswahb32(__u32 val) { #ifdef __arch_swahb32 return __arch_swahb32(val); #else return ___constant_swahb32(val); #endif } /** * __swab16 - return a byteswapped 16-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP16__ #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) #else #define __swab16(x) \ (__builtin_constant_p((__u16)(x)) ? \ ___constant_swab16(x) : \ __fswab16(x)) #endif /** * __swab32 - return a byteswapped 32-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP32__ #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) #else #define __swab32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swab32(x) : \ __fswab32(x)) #endif /** * __swab64 - return a byteswapped 64-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP64__ #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x)) #else #define __swab64(x) \ (__builtin_constant_p((__u64)(x)) ? \ ___constant_swab64(x) : \ __fswab64(x)) #endif static __always_inline unsigned long __swab(const unsigned long y) { #if __BITS_PER_LONG == 64 return __swab64(y); #else /* __BITS_PER_LONG == 32 */ return __swab32(y); #endif } /** * __swahw32 - return a word-swapped 32-bit value * @x: value to wordswap * * __swahw32(0x12340000) is 0x00001234 */ #define __swahw32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swahw32(x) : \ __fswahw32(x)) /** * __swahb32 - return a high and low byte-swapped 32-bit value * @x: value to byteswap * * __swahb32(0x12345678) is 0x34127856 */ #define __swahb32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swahb32(x) : \ __fswahb32(x)) /** * __swab16p - return a byteswapped 16-bit value from a pointer * @p: pointer to a naturally-aligned 16-bit value */ static __always_inline __u16 __swab16p(const __u16 *p) { #ifdef __arch_swab16p return __arch_swab16p(p); #else return __swab16(*p); #endif } /** * __swab32p - return a byteswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value */ static __always_inline __u32 __swab32p(const __u32 *p) { #ifdef __arch_swab32p return __arch_swab32p(p); #else return __swab32(*p); #endif } /** * __swab64p - return a byteswapped 64-bit value from a pointer * @p: pointer to a naturally-aligned 64-bit value */ static __always_inline __u64 __swab64p(const __u64 *p) { #ifdef __arch_swab64p return __arch_swab64p(p); #else return __swab64(*p); #endif } /** * __swahw32p - return a wordswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value * * See __swahw32() for details of wordswapping. */ static __inline__ __u32 __swahw32p(const __u32 *p) { #ifdef __arch_swahw32p return __arch_swahw32p(p); #else return __swahw32(*p); #endif } /** * __swahb32p - return a high and low byteswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value * * See __swahb32() for details of high/low byteswapping. */ static __inline__ __u32 __swahb32p(const __u32 *p) { #ifdef __arch_swahb32p return __arch_swahb32p(p); #else return __swahb32(*p); #endif } /** * __swab16s - byteswap a 16-bit value in-place * @p: pointer to a naturally-aligned 16-bit value */ static __inline__ void __swab16s(__u16 *p) { #ifdef __arch_swab16s __arch_swab16s(p); #else *p = __swab16p(p); #endif } /** * __swab32s - byteswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value */ static __always_inline void __swab32s(__u32 *p) { #ifdef __arch_swab32s __arch_swab32s(p); #else *p = __swab32p(p); #endif } /** * __swab64s - byteswap a 64-bit value in-place * @p: pointer to a naturally-aligned 64-bit value */ static __always_inline void __swab64s(__u64 *p) { #ifdef __arch_swab64s __arch_swab64s(p); #else *p = __swab64p(p); #endif } /** * __swahw32s - wordswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value * * See __swahw32() for details of wordswapping */ static __inline__ void __swahw32s(__u32 *p) { #ifdef __arch_swahw32s __arch_swahw32s(p); #else *p = __swahw32p(p); #endif } /** * __swahb32s - high and low byteswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value * * See __swahb32() for details of high and low byte swapping */ static __inline__ void __swahb32s(__u32 *p) { #ifdef __arch_swahb32s __arch_swahb32s(p); #else *p = __swahb32p(p); #endif } #endif /* _LINUX_SWAB_H */ linux/switchtec_ioctl.h 0000644 00000012216 15063602055 0011247 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Microsemi Switchtec PCIe Driver * Copyright (c) 2017, Microsemi Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * */ #ifndef _LINUX_SWITCHTEC_IOCTL_H #define _LINUX_SWITCHTEC_IOCTL_H #include <linux/types.h> #define SWITCHTEC_IOCTL_PART_CFG0 0 #define SWITCHTEC_IOCTL_PART_CFG1 1 #define SWITCHTEC_IOCTL_PART_IMG0 2 #define SWITCHTEC_IOCTL_PART_IMG1 3 #define SWITCHTEC_IOCTL_PART_NVLOG 4 #define SWITCHTEC_IOCTL_PART_VENDOR0 5 #define SWITCHTEC_IOCTL_PART_VENDOR1 6 #define SWITCHTEC_IOCTL_PART_VENDOR2 7 #define SWITCHTEC_IOCTL_PART_VENDOR3 8 #define SWITCHTEC_IOCTL_PART_VENDOR4 9 #define SWITCHTEC_IOCTL_PART_VENDOR5 10 #define SWITCHTEC_IOCTL_PART_VENDOR6 11 #define SWITCHTEC_IOCTL_PART_VENDOR7 12 #define SWITCHTEC_IOCTL_PART_BL2_0 13 #define SWITCHTEC_IOCTL_PART_BL2_1 14 #define SWITCHTEC_IOCTL_PART_MAP_0 15 #define SWITCHTEC_IOCTL_PART_MAP_1 16 #define SWITCHTEC_IOCTL_PART_KEY_0 17 #define SWITCHTEC_IOCTL_PART_KEY_1 18 #define SWITCHTEC_NUM_PARTITIONS_GEN3 13 #define SWITCHTEC_NUM_PARTITIONS_GEN4 19 /* obsolete: for compatibility with old userspace software */ #define SWITCHTEC_IOCTL_NUM_PARTITIONS SWITCHTEC_NUM_PARTITIONS_GEN3 struct switchtec_ioctl_flash_info { __u64 flash_length; __u32 num_partitions; __u32 padding; }; #define SWITCHTEC_IOCTL_PART_ACTIVE 1 #define SWITCHTEC_IOCTL_PART_RUNNING 2 struct switchtec_ioctl_flash_part_info { __u32 flash_partition; __u32 address; __u32 length; __u32 active; }; struct switchtec_ioctl_event_summary_legacy { __u64 global; __u64 part_bitmap; __u32 local_part; __u32 padding; __u32 part[48]; __u32 pff[48]; }; struct switchtec_ioctl_event_summary { __u64 global; __u64 part_bitmap; __u32 local_part; __u32 padding; __u32 part[48]; __u32 pff[255]; }; #define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 0 #define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 1 #define SWITCHTEC_IOCTL_EVENT_ISP_ERROR 2 #define SWITCHTEC_IOCTL_EVENT_SYS_RESET 3 #define SWITCHTEC_IOCTL_EVENT_FW_EXC 4 #define SWITCHTEC_IOCTL_EVENT_FW_NMI 5 #define SWITCHTEC_IOCTL_EVENT_FW_NON_FATAL 6 #define SWITCHTEC_IOCTL_EVENT_FW_FATAL 7 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP 8 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP_ASYNC 9 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP 10 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP_ASYNC 11 #define SWITCHTEC_IOCTL_EVENT_GPIO_INT 12 #define SWITCHTEC_IOCTL_EVENT_PART_RESET 13 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP 14 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP_ASYNC 15 #define SWITCHTEC_IOCTL_EVENT_DYN_PART_BIND_COMP 16 #define SWITCHTEC_IOCTL_EVENT_AER_IN_P2P 17 #define SWITCHTEC_IOCTL_EVENT_AER_IN_VEP 18 #define SWITCHTEC_IOCTL_EVENT_DPC 19 #define SWITCHTEC_IOCTL_EVENT_CTS 20 #define SWITCHTEC_IOCTL_EVENT_HOTPLUG 21 #define SWITCHTEC_IOCTL_EVENT_IER 22 #define SWITCHTEC_IOCTL_EVENT_THRESH 23 #define SWITCHTEC_IOCTL_EVENT_POWER_MGMT 24 #define SWITCHTEC_IOCTL_EVENT_TLP_THROTTLING 25 #define SWITCHTEC_IOCTL_EVENT_FORCE_SPEED 26 #define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27 #define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28 #define SWITCHTEC_IOCTL_EVENT_GFMS 29 #define SWITCHTEC_IOCTL_EVENT_INTERCOMM_REQ_NOTIFY 30 #define SWITCHTEC_IOCTL_EVENT_UEC 31 #define SWITCHTEC_IOCTL_MAX_EVENTS 32 #define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX -1 #define SWITCHTEC_IOCTL_EVENT_IDX_ALL -2 #define SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR (1 << 0) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL (1 << 1) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_LOG (1 << 2) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_CLI (1 << 3) #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_FATAL (1 << 4) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_POLL (1 << 5) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_LOG (1 << 6) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_CLI (1 << 7) #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_FATAL (1 << 8) #define SWITCHTEC_IOCTL_EVENT_FLAG_UNUSED (~0x1ff) struct switchtec_ioctl_event_ctl { __u32 event_id; __s32 index; __u32 flags; __u32 occurred; __u32 count; __u32 data[5]; }; #define SWITCHTEC_IOCTL_PFF_VEP 100 struct switchtec_ioctl_pff_port { __u32 pff; __u32 partition; __u32 port; }; #define SWITCHTEC_IOCTL_FLASH_INFO \ _IOR('W', 0x40, struct switchtec_ioctl_flash_info) #define SWITCHTEC_IOCTL_FLASH_PART_INFO \ _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info) #define SWITCHTEC_IOCTL_EVENT_SUMMARY \ _IOR('W', 0x42, struct switchtec_ioctl_event_summary) #define SWITCHTEC_IOCTL_EVENT_SUMMARY_LEGACY \ _IOR('W', 0x42, struct switchtec_ioctl_event_summary_legacy) #define SWITCHTEC_IOCTL_EVENT_CTL \ _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl) #define SWITCHTEC_IOCTL_PFF_TO_PORT \ _IOWR('W', 0x44, struct switchtec_ioctl_pff_port) #define SWITCHTEC_IOCTL_PORT_TO_PFF \ _IOWR('W', 0x45, struct switchtec_ioctl_pff_port) #endif linux/sync_file.h 0000644 00000005503 15063602055 0010034 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2012 Google, Inc. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef _LINUX_SYNC_H #define _LINUX_SYNC_H #include <linux/ioctl.h> #include <linux/types.h> /** * struct sync_merge_data - data passed to merge ioctl * @name: name of new fence * @fd2: file descriptor of second fence * @fence: returns the fd of the new fence to userspace * @flags: merge_data flags * @pad: padding for 64-bit alignment, should always be zero */ struct sync_merge_data { char name[32]; __s32 fd2; __s32 fence; __u32 flags; __u32 pad; }; /** * struct sync_fence_info - detailed fence information * @obj_name: name of parent sync_timeline * @driver_name: name of driver implementing the parent * @status: status of the fence 0:active 1:signaled <0:error * @flags: fence_info flags * @timestamp_ns: timestamp of status change in nanoseconds */ struct sync_fence_info { char obj_name[32]; char driver_name[32]; __s32 status; __u32 flags; __u64 timestamp_ns; }; /** * struct sync_file_info - data returned from fence info ioctl * @name: name of fence * @status: status of fence. 1: signaled 0:active <0:error * @flags: sync_file_info flags * @num_fences number of fences in the sync_file * @pad: padding for 64-bit alignment, should always be zero * @sync_fence_info: pointer to array of structs sync_fence_info with all * fences in the sync_file */ struct sync_file_info { char name[32]; __s32 status; __u32 flags; __u32 num_fences; __u32 pad; __u64 sync_fence_info; }; #define SYNC_IOC_MAGIC '>' /** * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the * old API to get weird errors when trying to handling sync_files. The API * change happened during the de-stage of the Sync Framework when there was * no upstream users available. */ /** * DOC: SYNC_IOC_MERGE - merge two fences * * Takes a struct sync_merge_data. Creates a new fence containing copies of * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the * new fence's fd in sync_merge_data.fence */ #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) /** * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file * * Takes a struct sync_file_info. If num_fences is 0, the field is updated * with the actual number of fences. If num_fences is > 0, the system will * use the pointer provided on sync_fence_info to return up to num_fences of * struct sync_fence_info, with detailed fence information. */ #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info) #endif /* _LINUX_SYNC_H */ linux/synclink.h 0000644 00000021431 15063602055 0007711 0 ustar 00 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ /* * SyncLink Multiprotocol Serial Adapter Driver * * $Id: synclink.h,v 3.14 2006/07/17 20:15:43 paulkf Exp $ * * Copyright (C) 1998-2000 by Microgate Corporation * * Redistribution of this file is permitted under * the terms of the GNU Public License (GPL) */ #ifndef _SYNCLINK_H_ #define _SYNCLINK_H_ #define SYNCLINK_H_VERSION 3.6 #include <linux/types.h> #define BIT0 0x0001 #define BIT1 0x0002 #define BIT2 0x0004 #define BIT3 0x0008 #define BIT4 0x0010 #define BIT5 0x0020 #define BIT6 0x0040 #define BIT7 0x0080 #define BIT8 0x0100 #define BIT9 0x0200 #define BIT10 0x0400 #define BIT11 0x0800 #define BIT12 0x1000 #define BIT13 0x2000 #define BIT14 0x4000 #define BIT15 0x8000 #define BIT16 0x00010000 #define BIT17 0x00020000 #define BIT18 0x00040000 #define BIT19 0x00080000 #define BIT20 0x00100000 #define BIT21 0x00200000 #define BIT22 0x00400000 #define BIT23 0x00800000 #define BIT24 0x01000000 #define BIT25 0x02000000 #define BIT26 0x04000000 #define BIT27 0x08000000 #define BIT28 0x10000000 #define BIT29 0x20000000 #define BIT30 0x40000000 #define BIT31 0x80000000 #define HDLC_MAX_FRAME_SIZE 65535 #define MAX_ASYNC_TRANSMIT 4096 #define MAX_ASYNC_BUFFER_SIZE 4096 #define ASYNC_PARITY_NONE 0 #define ASYNC_PARITY_EVEN 1 #define ASYNC_PARITY_ODD 2 #define ASYNC_PARITY_SPACE 3 #define HDLC_FLAG_UNDERRUN_ABORT7 0x0000 #define HDLC_FLAG_UNDERRUN_ABORT15 0x0001 #define HDLC_FLAG_UNDERRUN_FLAG 0x0002 #define HDLC_FLAG_UNDERRUN_CRC 0x0004 #define HDLC_FLAG_SHARE_ZERO 0x0010 #define HDLC_FLAG_AUTO_CTS 0x0020 #define HDLC_FLAG_AUTO_DCD 0x0040 #define HDLC_FLAG_AUTO_RTS 0x0080 #define HDLC_FLAG_RXC_DPLL 0x0100 #define HDLC_FLAG_RXC_BRG 0x0200 #define HDLC_FLAG_RXC_TXCPIN 0x8000 #define HDLC_FLAG_RXC_RXCPIN 0x0000 #define HDLC_FLAG_TXC_DPLL 0x0400 #define HDLC_FLAG_TXC_BRG 0x0800 #define HDLC_FLAG_TXC_TXCPIN 0x0000 #define HDLC_FLAG_TXC_RXCPIN 0x0008 #define HDLC_FLAG_DPLL_DIV8 0x1000 #define HDLC_FLAG_DPLL_DIV16 0x2000 #define HDLC_FLAG_DPLL_DIV32 0x0000 #define HDLC_FLAG_HDLC_LOOPMODE 0x4000 #define HDLC_CRC_NONE 0 #define HDLC_CRC_16_CCITT 1 #define HDLC_CRC_32_CCITT 2 #define HDLC_CRC_MASK 0x00ff #define HDLC_CRC_RETURN_EX 0x8000 #define RX_OK 0 #define RX_CRC_ERROR 1 #define HDLC_TXIDLE_FLAGS 0 #define HDLC_TXIDLE_ALT_ZEROS_ONES 1 #define HDLC_TXIDLE_ZEROS 2 #define HDLC_TXIDLE_ONES 3 #define HDLC_TXIDLE_ALT_MARK_SPACE 4 #define HDLC_TXIDLE_SPACE 5 #define HDLC_TXIDLE_MARK 6 #define HDLC_TXIDLE_CUSTOM_8 0x10000000 #define HDLC_TXIDLE_CUSTOM_16 0x20000000 #define HDLC_ENCODING_NRZ 0 #define HDLC_ENCODING_NRZB 1 #define HDLC_ENCODING_NRZI_MARK 2 #define HDLC_ENCODING_NRZI_SPACE 3 #define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE #define HDLC_ENCODING_BIPHASE_MARK 4 #define HDLC_ENCODING_BIPHASE_SPACE 5 #define HDLC_ENCODING_BIPHASE_LEVEL 6 #define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7 #define HDLC_PREAMBLE_LENGTH_8BITS 0 #define HDLC_PREAMBLE_LENGTH_16BITS 1 #define HDLC_PREAMBLE_LENGTH_32BITS 2 #define HDLC_PREAMBLE_LENGTH_64BITS 3 #define HDLC_PREAMBLE_PATTERN_NONE 0 #define HDLC_PREAMBLE_PATTERN_ZEROS 1 #define HDLC_PREAMBLE_PATTERN_FLAGS 2 #define HDLC_PREAMBLE_PATTERN_10 3 #define HDLC_PREAMBLE_PATTERN_01 4 #define HDLC_PREAMBLE_PATTERN_ONES 5 #define MGSL_MODE_ASYNC 1 #define MGSL_MODE_HDLC 2 #define MGSL_MODE_MONOSYNC 3 #define MGSL_MODE_BISYNC 4 #define MGSL_MODE_RAW 6 #define MGSL_MODE_BASE_CLOCK 7 #define MGSL_MODE_XSYNC 8 #define MGSL_BUS_TYPE_ISA 1 #define MGSL_BUS_TYPE_EISA 2 #define MGSL_BUS_TYPE_PCI 5 #define MGSL_INTERFACE_MASK 0xf #define MGSL_INTERFACE_DISABLE 0 #define MGSL_INTERFACE_RS232 1 #define MGSL_INTERFACE_V35 2 #define MGSL_INTERFACE_RS422 3 #define MGSL_INTERFACE_RTS_EN 0x10 #define MGSL_INTERFACE_LL 0x20 #define MGSL_INTERFACE_RL 0x40 #define MGSL_INTERFACE_MSB_FIRST 0x80 typedef struct _MGSL_PARAMS { /* Common */ unsigned long mode; /* Asynchronous or HDLC */ unsigned char loopback; /* internal loopback mode */ /* HDLC Only */ unsigned short flags; unsigned char encoding; /* NRZ, NRZI, etc. */ unsigned long clock_speed; /* external clock speed in bits per second */ unsigned char addr_filter; /* receive HDLC address filter, 0xFF = disable */ unsigned short crc_type; /* None, CRC16-CCITT, or CRC32-CCITT */ unsigned char preamble_length; unsigned char preamble; /* Async Only */ unsigned long data_rate; /* bits per second */ unsigned char data_bits; /* 7 or 8 data bits */ unsigned char stop_bits; /* 1 or 2 stop bits */ unsigned char parity; /* none, even, or odd */ } MGSL_PARAMS, *PMGSL_PARAMS; #define MICROGATE_VENDOR_ID 0x13c0 #define SYNCLINK_DEVICE_ID 0x0010 #define MGSCC_DEVICE_ID 0x0020 #define SYNCLINK_SCA_DEVICE_ID 0x0030 #define SYNCLINK_GT_DEVICE_ID 0x0070 #define SYNCLINK_GT4_DEVICE_ID 0x0080 #define SYNCLINK_AC_DEVICE_ID 0x0090 #define SYNCLINK_GT2_DEVICE_ID 0x00A0 #define MGSL_MAX_SERIAL_NUMBER 30 /* ** device diagnostics status */ #define DiagStatus_OK 0 #define DiagStatus_AddressFailure 1 #define DiagStatus_AddressConflict 2 #define DiagStatus_IrqFailure 3 #define DiagStatus_IrqConflict 4 #define DiagStatus_DmaFailure 5 #define DiagStatus_DmaConflict 6 #define DiagStatus_PciAdapterNotFound 7 #define DiagStatus_CantAssignPciResources 8 #define DiagStatus_CantAssignPciMemAddr 9 #define DiagStatus_CantAssignPciIoAddr 10 #define DiagStatus_CantAssignPciIrq 11 #define DiagStatus_MemoryError 12 #define SerialSignal_DCD 0x01 /* Data Carrier Detect */ #define SerialSignal_TXD 0x02 /* Transmit Data */ #define SerialSignal_RI 0x04 /* Ring Indicator */ #define SerialSignal_RXD 0x08 /* Receive Data */ #define SerialSignal_CTS 0x10 /* Clear to Send */ #define SerialSignal_RTS 0x20 /* Request to Send */ #define SerialSignal_DSR 0x40 /* Data Set Ready */ #define SerialSignal_DTR 0x80 /* Data Terminal Ready */ /* * Counters of the input lines (CTS, DSR, RI, CD) interrupts */ struct mgsl_icount { __u32 cts, dsr, rng, dcd, tx, rx; __u32 frame, parity, overrun, brk; __u32 buf_overrun; __u32 txok; __u32 txunder; __u32 txabort; __u32 txtimeout; __u32 rxshort; __u32 rxlong; __u32 rxabort; __u32 rxover; __u32 rxcrc; __u32 rxok; __u32 exithunt; __u32 rxidle; }; struct gpio_desc { __u32 state; __u32 smask; __u32 dir; __u32 dmask; }; #define DEBUG_LEVEL_DATA 1 #define DEBUG_LEVEL_ERROR 2 #define DEBUG_LEVEL_INFO 3 #define DEBUG_LEVEL_BH 4 #define DEBUG_LEVEL_ISR 5 /* ** Event bit flags for use with MgslWaitEvent */ #define MgslEvent_DsrActive 0x0001 #define MgslEvent_DsrInactive 0x0002 #define MgslEvent_Dsr 0x0003 #define MgslEvent_CtsActive 0x0004 #define MgslEvent_CtsInactive 0x0008 #define MgslEvent_Cts 0x000c #define MgslEvent_DcdActive 0x0010 #define MgslEvent_DcdInactive 0x0020 #define MgslEvent_Dcd 0x0030 #define MgslEvent_RiActive 0x0040 #define MgslEvent_RiInactive 0x0080 #define MgslEvent_Ri 0x00c0 #define MgslEvent_ExitHuntMode 0x0100 #define MgslEvent_IdleReceived 0x0200 /* Private IOCTL codes: * * MGSL_IOCSPARAMS set MGSL_PARAMS structure values * MGSL_IOCGPARAMS get current MGSL_PARAMS structure values * MGSL_IOCSTXIDLE set current transmit idle mode * MGSL_IOCGTXIDLE get current transmit idle mode * MGSL_IOCTXENABLE enable or disable transmitter * MGSL_IOCRXENABLE enable or disable receiver * MGSL_IOCTXABORT abort transmitting frame (HDLC) * MGSL_IOCGSTATS return current statistics * MGSL_IOCWAITEVENT wait for specified event to occur * MGSL_LOOPTXDONE transmit in HDLC LoopMode done * MGSL_IOCSIF set the serial interface type * MGSL_IOCGIF get the serial interface type */ #define MGSL_MAGIC_IOC 'm' #define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS) #define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS) #define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2) #define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3) #define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4) #define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5) #define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6) #define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7) #define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int) #define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15) #define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9) #define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10) #define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11) #define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc) #define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc) #define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc) #define MGSL_IOCSXSYNC _IO(MGSL_MAGIC_IOC, 19) #define MGSL_IOCGXSYNC _IO(MGSL_MAGIC_IOC, 20) #define MGSL_IOCSXCTRL _IO(MGSL_MAGIC_IOC, 21) #define MGSL_IOCGXCTRL _IO(MGSL_MAGIC_IOC, 22) #endif /* _SYNCLINK_H_ */ linux/sysctl.h 0000644 00000062362 15063602055 0007410 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * sysctl.h: General linux system control interface * * Begun 24 March 1995, Stephen Tweedie * **************************************************************** **************************************************************** ** ** WARNING: ** The values in this file are exported to user space via ** the sysctl() binary interface. Do *NOT* change the ** numbering of any existing values here, and do not change ** any numbers within any one set of values. If you have to ** redefine an existing interface, use a new number for it. ** The kernel will then return -ENOTDIR to any application using ** the old binary interface. ** **************************************************************** **************************************************************** */ #ifndef _LINUX_SYSCTL_H #define _LINUX_SYSCTL_H #include <linux/kernel.h> #include <linux/types.h> #define CTL_MAXNAME 10 /* how many path components do we allow in a call to sysctl? In other words, what is the largest acceptable value for the nlen member of a struct __sysctl_args to have? */ struct __sysctl_args { int *name; int nlen; void *oldval; size_t *oldlenp; void *newval; size_t newlen; unsigned long __unused[4]; }; /* Define sysctl names first */ /* Top-level names: */ enum { CTL_KERN=1, /* General kernel info and control */ CTL_VM=2, /* VM management */ CTL_NET=3, /* Networking */ CTL_PROC=4, /* removal breaks strace(1) compilation */ CTL_FS=5, /* Filesystems */ CTL_DEBUG=6, /* Debugging */ CTL_DEV=7, /* Devices */ CTL_BUS=8, /* Busses */ CTL_ABI=9, /* Binary emulation */ CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ CTL_ARLAN=254, /* arlan wireless driver */ CTL_S390DBF=5677, /* s390 debug */ CTL_SUNRPC=7249, /* sunrpc debug */ CTL_PM=9899, /* frv power management */ CTL_FRV=9898, /* frv specific sysctls */ }; /* CTL_BUS names: */ enum { CTL_BUS_ISA=1 /* ISA */ }; /* /proc/sys/fs/inotify/ */ enum { INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */ INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */ INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */ }; /* CTL_KERN names: */ enum { KERN_OSTYPE=1, /* string: system version */ KERN_OSRELEASE=2, /* string: system release */ KERN_OSREV=3, /* int: system revision */ KERN_VERSION=4, /* string: compile time info */ KERN_SECUREMASK=5, /* struct: maximum rights mask */ KERN_PROF=6, /* table: profiling information */ KERN_NODENAME=7, /* string: hostname */ KERN_DOMAINNAME=8, /* string: domainname */ KERN_PANIC=15, /* int: panic timeout */ KERN_REALROOTDEV=16, /* real root device to mount after initrd */ KERN_SPARC_REBOOT=21, /* reboot command on Sparc */ KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */ KERN_PRINTK=23, /* struct: control printk logging parameters */ KERN_NAMETRANS=24, /* Name translation */ KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ KERN_MODPROBE=28, /* string: modprobe path */ KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */ KERN_ACCT=30, /* BSD process accounting parameters */ KERN_PPC_L2CR=31, /* l2cr register on PPC */ KERN_RTSIGNR=32, /* Number of rt sigs queued */ KERN_RTSIGMAX=33, /* Max queuable */ KERN_SHMMAX=34, /* long: Maximum shared memory segment */ KERN_MSGMAX=35, /* int: Maximum size of a messege */ KERN_MSGMNB=36, /* int: Maximum message queue size */ KERN_MSGPOOL=37, /* int: Maximum system message pool size */ KERN_SYSRQ=38, /* int: Sysreq enable */ KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */ KERN_RANDOM=40, /* Random driver */ KERN_SHMALL=41, /* int: Maximum size of shared memory */ KERN_MSGMNI=42, /* int: msg queue identifiers */ KERN_SEM=43, /* struct: sysv semaphore limits */ KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */ KERN_SHMMNI=45, /* int: shm array identifiers */ KERN_OVERFLOWUID=46, /* int: overflow UID */ KERN_OVERFLOWGID=47, /* int: overflow GID */ KERN_SHMPATH=48, /* string: path to shm fs */ KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */ KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ KERN_TAINTED=53, /* int: various kernel tainted flags */ KERN_CADPID=54, /* int: PID of the process to notify on CAD */ KERN_PIDMAX=55, /* int: PID # limit */ KERN_CORE_PATTERN=56, /* string: pattern for core-file names */ KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */ KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */ KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */ KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */ KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */ KERN_PTY=62, /* dir: pty driver */ KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */ KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */ KERN_HZ_TIMER=65, /* int: hz timer on or off */ KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */ KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */ KERN_RANDOMIZE=68, /* int: randomize virtual address space */ KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */ KERN_SPIN_RETRY=70, /* int: number of spinlock retries */ KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ KERN_COMPAT_LOG=73, /* int: print compat layer messages */ KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */ KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ KERN_PANIC_ON_WARN=77, /* int: call panic() in WARN() functions */ KERN_PANIC_PRINT=78, /* ulong: bitmask to print system info on panic */ }; /* CTL_VM names: */ enum { VM_UNUSED1=1, /* was: struct: Set vm swapping control */ VM_UNUSED2=2, /* was; int: Linear or sqrt() swapout for hogs */ VM_UNUSED3=3, /* was: struct: Set free page thresholds */ VM_UNUSED4=4, /* Spare */ VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */ VM_UNUSED5=6, /* was: struct: Set buffer memory thresholds */ VM_UNUSED7=7, /* was: struct: Set cache memory thresholds */ VM_UNUSED8=8, /* was: struct: Control kswapd behaviour */ VM_UNUSED9=9, /* was: struct: Set page table cache parameters */ VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */ VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */ VM_DIRTY_RATIO=12, /* dirty_ratio */ VM_DIRTY_WB_CS=13, /* dirty_writeback_centisecs */ VM_DIRTY_EXPIRE_CS=14, /* dirty_expire_centisecs */ VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */ VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */ VM_PAGEBUF=17, /* struct: Control pagebuf parameters */ VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */ VM_SWAPPINESS=19, /* Tendency to steal mapped memory */ VM_LOWMEM_RESERVE_RATIO=20,/* reservation ratio for lower memory zones */ VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */ VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */ VM_LAPTOP_MODE=23, /* vm laptop mode */ VM_BLOCK_DUMP=24, /* block dump mode */ VM_HUGETLB_GROUP=25, /* permitted hugetlb group */ VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */ VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */ VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */ VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */ VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */ VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ }; /* CTL_NET names: */ enum { NET_CORE=1, NET_ETHER=2, NET_802=3, NET_UNIX=4, NET_IPV4=5, NET_IPX=6, NET_ATALK=7, NET_NETROM=8, NET_AX25=9, NET_BRIDGE=10, NET_ROSE=11, NET_IPV6=12, NET_X25=13, NET_TR=14, NET_DECNET=15, NET_ECONET=16, NET_SCTP=17, NET_LLC=18, NET_NETFILTER=19, NET_DCCP=20, NET_IRDA=412, }; /* /proc/sys/kernel/random */ enum { RANDOM_POOLSIZE=1, RANDOM_ENTROPY_COUNT=2, RANDOM_READ_THRESH=3, RANDOM_WRITE_THRESH=4, RANDOM_BOOT_ID=5, RANDOM_UUID=6 }; /* /proc/sys/kernel/pty */ enum { PTY_MAX=1, PTY_NR=2 }; /* /proc/sys/bus/isa */ enum { BUS_ISA_MEM_BASE=1, BUS_ISA_PORT_BASE=2, BUS_ISA_PORT_SHIFT=3 }; /* /proc/sys/net/core */ enum { NET_CORE_WMEM_MAX=1, NET_CORE_RMEM_MAX=2, NET_CORE_WMEM_DEFAULT=3, NET_CORE_RMEM_DEFAULT=4, /* was NET_CORE_DESTROY_DELAY */ NET_CORE_MAX_BACKLOG=6, NET_CORE_FASTROUTE=7, NET_CORE_MSG_COST=8, NET_CORE_MSG_BURST=9, NET_CORE_OPTMEM_MAX=10, NET_CORE_HOT_LIST_LENGTH=11, NET_CORE_DIVERT_VERSION=12, NET_CORE_NO_CONG_THRESH=13, NET_CORE_NO_CONG=14, NET_CORE_LO_CONG=15, NET_CORE_MOD_CONG=16, NET_CORE_DEV_WEIGHT=17, NET_CORE_SOMAXCONN=18, NET_CORE_BUDGET=19, NET_CORE_AEVENT_ETIME=20, NET_CORE_AEVENT_RSEQTH=21, NET_CORE_WARNINGS=22, }; /* /proc/sys/net/ethernet */ /* /proc/sys/net/802 */ /* /proc/sys/net/unix */ enum { NET_UNIX_DESTROY_DELAY=1, NET_UNIX_DELETE_DELAY=2, NET_UNIX_MAX_DGRAM_QLEN=3, }; /* /proc/sys/net/netfilter */ enum { NET_NF_CONNTRACK_MAX=1, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_NF_CONNTRACK_UDP_TIMEOUT=10, NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_NF_CONNTRACK_BUCKETS=14, NET_NF_CONNTRACK_LOG_INVALID=15, NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_NF_CONNTRACK_TCP_LOOSE=17, NET_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_NF_CONNTRACK_COUNT=27, NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28, NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, NET_NF_CONNTRACK_CHECKSUM=32, }; /* /proc/sys/net/ipv4 */ enum { /* v2.0 compatibile variables */ NET_IPV4_FORWARD=8, NET_IPV4_DYNADDR=9, NET_IPV4_CONF=16, NET_IPV4_NEIGH=17, NET_IPV4_ROUTE=18, NET_IPV4_FIB_HASH=19, NET_IPV4_NETFILTER=20, NET_IPV4_TCP_TIMESTAMPS=33, NET_IPV4_TCP_WINDOW_SCALING=34, NET_IPV4_TCP_SACK=35, NET_IPV4_TCP_RETRANS_COLLAPSE=36, NET_IPV4_DEFAULT_TTL=37, NET_IPV4_AUTOCONFIG=38, NET_IPV4_NO_PMTU_DISC=39, NET_IPV4_TCP_SYN_RETRIES=40, NET_IPV4_IPFRAG_HIGH_THRESH=41, NET_IPV4_IPFRAG_LOW_THRESH=42, NET_IPV4_IPFRAG_TIME=43, NET_IPV4_TCP_MAX_KA_PROBES=44, NET_IPV4_TCP_KEEPALIVE_TIME=45, NET_IPV4_TCP_KEEPALIVE_PROBES=46, NET_IPV4_TCP_RETRIES1=47, NET_IPV4_TCP_RETRIES2=48, NET_IPV4_TCP_FIN_TIMEOUT=49, NET_IPV4_IP_MASQ_DEBUG=50, NET_TCP_SYNCOOKIES=51, NET_TCP_STDURG=52, NET_TCP_RFC1337=53, NET_TCP_SYN_TAILDROP=54, NET_TCP_MAX_SYN_BACKLOG=55, NET_IPV4_LOCAL_PORT_RANGE=56, NET_IPV4_ICMP_ECHO_IGNORE_ALL=57, NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58, NET_IPV4_ICMP_SOURCEQUENCH_RATE=59, NET_IPV4_ICMP_DESTUNREACH_RATE=60, NET_IPV4_ICMP_TIMEEXCEED_RATE=61, NET_IPV4_ICMP_PARAMPROB_RATE=62, NET_IPV4_ICMP_ECHOREPLY_RATE=63, NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64, NET_IPV4_IGMP_MAX_MEMBERSHIPS=65, NET_TCP_TW_RECYCLE=66, NET_IPV4_ALWAYS_DEFRAG=67, NET_IPV4_TCP_KEEPALIVE_INTVL=68, NET_IPV4_INET_PEER_THRESHOLD=69, NET_IPV4_INET_PEER_MINTTL=70, NET_IPV4_INET_PEER_MAXTTL=71, NET_IPV4_INET_PEER_GC_MINTIME=72, NET_IPV4_INET_PEER_GC_MAXTIME=73, NET_TCP_ORPHAN_RETRIES=74, NET_TCP_ABORT_ON_OVERFLOW=75, NET_TCP_SYNACK_RETRIES=76, NET_TCP_MAX_ORPHANS=77, NET_TCP_MAX_TW_BUCKETS=78, NET_TCP_FACK=79, NET_TCP_REORDERING=80, NET_TCP_ECN=81, NET_TCP_DSACK=82, NET_TCP_MEM=83, NET_TCP_WMEM=84, NET_TCP_RMEM=85, NET_TCP_APP_WIN=86, NET_TCP_ADV_WIN_SCALE=87, NET_IPV4_NONLOCAL_BIND=88, NET_IPV4_ICMP_RATELIMIT=89, NET_IPV4_ICMP_RATEMASK=90, NET_TCP_TW_REUSE=91, NET_TCP_FRTO=92, NET_TCP_LOW_LATENCY=93, NET_IPV4_IPFRAG_SECRET_INTERVAL=94, NET_IPV4_IGMP_MAX_MSF=96, NET_TCP_NO_METRICS_SAVE=97, NET_TCP_DEFAULT_WIN_SCALE=105, NET_TCP_MODERATE_RCVBUF=106, NET_TCP_TSO_WIN_DIVISOR=107, NET_TCP_BIC_BETA=108, NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, NET_TCP_CONG_CONTROL=110, NET_TCP_ABC=111, NET_IPV4_IPFRAG_MAX_DIST=112, NET_TCP_MTU_PROBING=113, NET_TCP_BASE_MSS=114, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, NET_TCP_DMA_COPYBREAK=116, NET_TCP_SLOW_START_AFTER_IDLE=117, NET_CIPSOV4_CACHE_ENABLE=118, NET_CIPSOV4_CACHE_BUCKET_SIZE=119, NET_CIPSOV4_RBM_OPTFMT=120, NET_CIPSOV4_RBM_STRICTVALID=121, NET_TCP_AVAIL_CONG_CONTROL=122, NET_TCP_ALLOWED_CONG_CONTROL=123, NET_TCP_MAX_SSTHRESH=124, NET_TCP_FRTO_RESPONSE=125, }; enum { NET_IPV4_ROUTE_FLUSH=1, NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */ NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */ NET_IPV4_ROUTE_GC_THRESH=4, NET_IPV4_ROUTE_MAX_SIZE=5, NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, NET_IPV4_ROUTE_GC_TIMEOUT=7, NET_IPV4_ROUTE_GC_INTERVAL=8, /* obsolete since 2.6.38 */ NET_IPV4_ROUTE_REDIRECT_LOAD=9, NET_IPV4_ROUTE_REDIRECT_NUMBER=10, NET_IPV4_ROUTE_REDIRECT_SILENCE=11, NET_IPV4_ROUTE_ERROR_COST=12, NET_IPV4_ROUTE_ERROR_BURST=13, NET_IPV4_ROUTE_GC_ELASTICITY=14, NET_IPV4_ROUTE_MTU_EXPIRES=15, NET_IPV4_ROUTE_MIN_PMTU=16, NET_IPV4_ROUTE_MIN_ADVMSS=17, NET_IPV4_ROUTE_SECRET_INTERVAL=18, NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19, }; enum { NET_PROTO_CONF_ALL=-2, NET_PROTO_CONF_DEFAULT=-3 /* And device ifindices ... */ }; enum { NET_IPV4_CONF_FORWARDING=1, NET_IPV4_CONF_MC_FORWARDING=2, NET_IPV4_CONF_PROXY_ARP=3, NET_IPV4_CONF_ACCEPT_REDIRECTS=4, NET_IPV4_CONF_SECURE_REDIRECTS=5, NET_IPV4_CONF_SEND_REDIRECTS=6, NET_IPV4_CONF_SHARED_MEDIA=7, NET_IPV4_CONF_RP_FILTER=8, NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9, NET_IPV4_CONF_BOOTP_RELAY=10, NET_IPV4_CONF_LOG_MARTIANS=11, NET_IPV4_CONF_TAG=12, NET_IPV4_CONF_ARPFILTER=13, NET_IPV4_CONF_MEDIUM_ID=14, NET_IPV4_CONF_NOXFRM=15, NET_IPV4_CONF_NOPOLICY=16, NET_IPV4_CONF_FORCE_IGMP_VERSION=17, NET_IPV4_CONF_ARP_ANNOUNCE=18, NET_IPV4_CONF_ARP_IGNORE=19, NET_IPV4_CONF_PROMOTE_SECONDARIES=20, NET_IPV4_CONF_ARP_ACCEPT=21, NET_IPV4_CONF_ARP_NOTIFY=22, }; /* /proc/sys/net/ipv4/netfilter */ enum { NET_IPV4_NF_CONNTRACK_MAX=1, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_IPV4_NF_CONNTRACK_BUCKETS=14, NET_IPV4_NF_CONNTRACK_LOG_INVALID=15, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17, NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_IPV4_NF_CONNTRACK_COUNT=27, NET_IPV4_NF_CONNTRACK_CHECKSUM=28, }; /* /proc/sys/net/ipv6 */ enum { NET_IPV6_CONF=16, NET_IPV6_NEIGH=17, NET_IPV6_ROUTE=18, NET_IPV6_ICMP=19, NET_IPV6_BINDV6ONLY=20, NET_IPV6_IP6FRAG_HIGH_THRESH=21, NET_IPV6_IP6FRAG_LOW_THRESH=22, NET_IPV6_IP6FRAG_TIME=23, NET_IPV6_IP6FRAG_SECRET_INTERVAL=24, NET_IPV6_MLD_MAX_MSF=25, }; enum { NET_IPV6_ROUTE_FLUSH=1, NET_IPV6_ROUTE_GC_THRESH=2, NET_IPV6_ROUTE_MAX_SIZE=3, NET_IPV6_ROUTE_GC_MIN_INTERVAL=4, NET_IPV6_ROUTE_GC_TIMEOUT=5, NET_IPV6_ROUTE_GC_INTERVAL=6, NET_IPV6_ROUTE_GC_ELASTICITY=7, NET_IPV6_ROUTE_MTU_EXPIRES=8, NET_IPV6_ROUTE_MIN_ADVMSS=9, NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10 }; enum { NET_IPV6_FORWARDING=1, NET_IPV6_HOP_LIMIT=2, NET_IPV6_MTU=3, NET_IPV6_ACCEPT_RA=4, NET_IPV6_ACCEPT_REDIRECTS=5, NET_IPV6_AUTOCONF=6, NET_IPV6_DAD_TRANSMITS=7, NET_IPV6_RTR_SOLICITS=8, NET_IPV6_RTR_SOLICIT_INTERVAL=9, NET_IPV6_RTR_SOLICIT_DELAY=10, NET_IPV6_USE_TEMPADDR=11, NET_IPV6_TEMP_VALID_LFT=12, NET_IPV6_TEMP_PREFERED_LFT=13, NET_IPV6_REGEN_MAX_RETRY=14, NET_IPV6_MAX_DESYNC_FACTOR=15, NET_IPV6_MAX_ADDRESSES=16, NET_IPV6_FORCE_MLD_VERSION=17, NET_IPV6_ACCEPT_RA_DEFRTR=18, NET_IPV6_ACCEPT_RA_PINFO=19, NET_IPV6_ACCEPT_RA_RTR_PREF=20, NET_IPV6_RTR_PROBE_INTERVAL=21, NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, NET_IPV6_PROXY_NDP=23, NET_IPV6_ACCEPT_SOURCE_ROUTE=25, NET_IPV6_ACCEPT_RA_FROM_LOCAL=26, NET_IPV6_ACCEPT_RA_RT_INFO_MIN_PLEN=27, __NET_IPV6_MAX }; /* /proc/sys/net/ipv6/icmp */ enum { NET_IPV6_ICMP_RATELIMIT=1 }; /* /proc/sys/net/<protocol>/neigh/<dev> */ enum { NET_NEIGH_MCAST_SOLICIT=1, NET_NEIGH_UCAST_SOLICIT=2, NET_NEIGH_APP_SOLICIT=3, NET_NEIGH_RETRANS_TIME=4, NET_NEIGH_REACHABLE_TIME=5, NET_NEIGH_DELAY_PROBE_TIME=6, NET_NEIGH_GC_STALE_TIME=7, NET_NEIGH_UNRES_QLEN=8, NET_NEIGH_PROXY_QLEN=9, NET_NEIGH_ANYCAST_DELAY=10, NET_NEIGH_PROXY_DELAY=11, NET_NEIGH_LOCKTIME=12, NET_NEIGH_GC_INTERVAL=13, NET_NEIGH_GC_THRESH1=14, NET_NEIGH_GC_THRESH2=15, NET_NEIGH_GC_THRESH3=16, NET_NEIGH_RETRANS_TIME_MS=17, NET_NEIGH_REACHABLE_TIME_MS=18, }; /* /proc/sys/net/dccp */ enum { NET_DCCP_DEFAULT=1, }; /* /proc/sys/net/ipx */ enum { NET_IPX_PPROP_BROADCASTING=1, NET_IPX_FORWARDING=2 }; /* /proc/sys/net/llc */ enum { NET_LLC2=1, NET_LLC_STATION=2, }; /* /proc/sys/net/llc/llc2 */ enum { NET_LLC2_TIMEOUT=1, }; /* /proc/sys/net/llc/station */ enum { NET_LLC_STATION_ACK_TIMEOUT=1, }; /* /proc/sys/net/llc/llc2/timeout */ enum { NET_LLC2_ACK_TIMEOUT=1, NET_LLC2_P_TIMEOUT=2, NET_LLC2_REJ_TIMEOUT=3, NET_LLC2_BUSY_TIMEOUT=4, }; /* /proc/sys/net/appletalk */ enum { NET_ATALK_AARP_EXPIRY_TIME=1, NET_ATALK_AARP_TICK_TIME=2, NET_ATALK_AARP_RETRANSMIT_LIMIT=3, NET_ATALK_AARP_RESOLVE_TIME=4 }; /* /proc/sys/net/netrom */ enum { NET_NETROM_DEFAULT_PATH_QUALITY=1, NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2, NET_NETROM_NETWORK_TTL_INITIALISER=3, NET_NETROM_TRANSPORT_TIMEOUT=4, NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5, NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6, NET_NETROM_TRANSPORT_BUSY_DELAY=7, NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, NET_NETROM_ROUTING_CONTROL=10, NET_NETROM_LINK_FAILS_COUNT=11, NET_NETROM_RESET=12 }; /* /proc/sys/net/ax25 */ enum { NET_AX25_IP_DEFAULT_MODE=1, NET_AX25_DEFAULT_MODE=2, NET_AX25_BACKOFF_TYPE=3, NET_AX25_CONNECT_MODE=4, NET_AX25_STANDARD_WINDOW=5, NET_AX25_EXTENDED_WINDOW=6, NET_AX25_T1_TIMEOUT=7, NET_AX25_T2_TIMEOUT=8, NET_AX25_T3_TIMEOUT=9, NET_AX25_IDLE_TIMEOUT=10, NET_AX25_N2=11, NET_AX25_PACLEN=12, NET_AX25_PROTOCOL=13, NET_AX25_DAMA_SLAVE_TIMEOUT=14 }; /* /proc/sys/net/rose */ enum { NET_ROSE_RESTART_REQUEST_TIMEOUT=1, NET_ROSE_CALL_REQUEST_TIMEOUT=2, NET_ROSE_RESET_REQUEST_TIMEOUT=3, NET_ROSE_CLEAR_REQUEST_TIMEOUT=4, NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5, NET_ROSE_ROUTING_CONTROL=6, NET_ROSE_LINK_FAIL_TIMEOUT=7, NET_ROSE_MAX_VCS=8, NET_ROSE_WINDOW_SIZE=9, NET_ROSE_NO_ACTIVITY_TIMEOUT=10 }; /* /proc/sys/net/x25 */ enum { NET_X25_RESTART_REQUEST_TIMEOUT=1, NET_X25_CALL_REQUEST_TIMEOUT=2, NET_X25_RESET_REQUEST_TIMEOUT=3, NET_X25_CLEAR_REQUEST_TIMEOUT=4, NET_X25_ACK_HOLD_BACK_TIMEOUT=5, NET_X25_FORWARD=6 }; /* /proc/sys/net/token-ring */ enum { NET_TR_RIF_TIMEOUT=1 }; /* /proc/sys/net/decnet/ */ enum { NET_DECNET_NODE_TYPE = 1, NET_DECNET_NODE_ADDRESS = 2, NET_DECNET_NODE_NAME = 3, NET_DECNET_DEFAULT_DEVICE = 4, NET_DECNET_TIME_WAIT = 5, NET_DECNET_DN_COUNT = 6, NET_DECNET_DI_COUNT = 7, NET_DECNET_DR_COUNT = 8, NET_DECNET_DST_GC_INTERVAL = 9, NET_DECNET_CONF = 10, NET_DECNET_NO_FC_MAX_CWND = 11, NET_DECNET_MEM = 12, NET_DECNET_RMEM = 13, NET_DECNET_WMEM = 14, NET_DECNET_DEBUG_LEVEL = 255 }; /* /proc/sys/net/decnet/conf/<dev> */ enum { NET_DECNET_CONF_LOOPBACK = -2, NET_DECNET_CONF_DDCMP = -3, NET_DECNET_CONF_PPP = -4, NET_DECNET_CONF_X25 = -5, NET_DECNET_CONF_GRE = -6, NET_DECNET_CONF_ETHER = -7 /* ... and ifindex of devices */ }; /* /proc/sys/net/decnet/conf/<dev>/ */ enum { NET_DECNET_CONF_DEV_PRIORITY = 1, NET_DECNET_CONF_DEV_T1 = 2, NET_DECNET_CONF_DEV_T2 = 3, NET_DECNET_CONF_DEV_T3 = 4, NET_DECNET_CONF_DEV_FORWARDING = 5, NET_DECNET_CONF_DEV_BLKSIZE = 6, NET_DECNET_CONF_DEV_STATE = 7 }; /* /proc/sys/net/sctp */ enum { NET_SCTP_RTO_INITIAL = 1, NET_SCTP_RTO_MIN = 2, NET_SCTP_RTO_MAX = 3, NET_SCTP_RTO_ALPHA = 4, NET_SCTP_RTO_BETA = 5, NET_SCTP_VALID_COOKIE_LIFE = 6, NET_SCTP_ASSOCIATION_MAX_RETRANS = 7, NET_SCTP_PATH_MAX_RETRANS = 8, NET_SCTP_MAX_INIT_RETRANSMITS = 9, NET_SCTP_HB_INTERVAL = 10, NET_SCTP_PRESERVE_ENABLE = 11, NET_SCTP_MAX_BURST = 12, NET_SCTP_ADDIP_ENABLE = 13, NET_SCTP_PRSCTP_ENABLE = 14, NET_SCTP_SNDBUF_POLICY = 15, NET_SCTP_SACK_TIMEOUT = 16, NET_SCTP_RCVBUF_POLICY = 17, }; /* /proc/sys/net/bridge */ enum { NET_BRIDGE_NF_CALL_ARPTABLES = 1, NET_BRIDGE_NF_CALL_IPTABLES = 2, NET_BRIDGE_NF_CALL_IP6TABLES = 3, NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, }; /* CTL_FS names: */ enum { FS_NRINODE=1, /* int:current number of allocated inodes */ FS_STATINODE=2, FS_MAXINODE=3, /* int:maximum number of inodes that can be allocated */ FS_NRDQUOT=4, /* int:current number of allocated dquots */ FS_MAXDQUOT=5, /* int:maximum number of dquots that can be allocated */ FS_NRFILE=6, /* int:current number of allocated filedescriptors */ FS_MAXFILE=7, /* int:maximum number of filedescriptors that can be allocated */ FS_DENTRY=8, FS_NRSUPER=9, /* int:current number of allocated super_blocks */ FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */ FS_OVERFLOWUID=11, /* int: overflow UID */ FS_OVERFLOWGID=12, /* int: overflow GID */ FS_LEASES=13, /* int: leases enabled */ FS_DIR_NOTIFY=14, /* int: directory notification enabled */ FS_LEASE_TIME=15, /* int: maximum time to wait for a lease break */ FS_DQSTATS=16, /* disc quota usage statistics and control */ FS_XFS=17, /* struct: control xfs parameters */ FS_AIO_NR=18, /* current system-wide number of aio requests */ FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ FS_INOTIFY=20, /* inotify submenu */ FS_OCFS2=988, /* ocfs2 */ }; /* /proc/sys/fs/quota/ */ enum { FS_DQ_LOOKUPS = 1, FS_DQ_DROPS = 2, FS_DQ_READS = 3, FS_DQ_WRITES = 4, FS_DQ_CACHE_HITS = 5, FS_DQ_ALLOCATED = 6, FS_DQ_FREE = 7, FS_DQ_SYNCS = 8, FS_DQ_WARNINGS = 9, }; /* CTL_DEBUG names: */ /* CTL_DEV names: */ enum { DEV_CDROM=1, DEV_HWMON=2, DEV_PARPORT=3, DEV_RAID=4, DEV_MAC_HID=5, DEV_SCSI=6, DEV_IPMI=7, }; /* /proc/sys/dev/cdrom */ enum { DEV_CDROM_INFO=1, DEV_CDROM_AUTOCLOSE=2, DEV_CDROM_AUTOEJECT=3, DEV_CDROM_DEBUG=4, DEV_CDROM_LOCK=5, DEV_CDROM_CHECK_MEDIA=6 }; /* /proc/sys/dev/parport */ enum { DEV_PARPORT_DEFAULT=-3 }; /* /proc/sys/dev/raid */ enum { DEV_RAID_SPEED_LIMIT_MIN=1, DEV_RAID_SPEED_LIMIT_MAX=2 }; /* /proc/sys/dev/parport/default */ enum { DEV_PARPORT_DEFAULT_TIMESLICE=1, DEV_PARPORT_DEFAULT_SPINTIME=2 }; /* /proc/sys/dev/parport/parport n */ enum { DEV_PARPORT_SPINTIME=1, DEV_PARPORT_BASE_ADDR=2, DEV_PARPORT_IRQ=3, DEV_PARPORT_DMA=4, DEV_PARPORT_MODES=5, DEV_PARPORT_DEVICES=6, DEV_PARPORT_AUTOPROBE=16 }; /* /proc/sys/dev/parport/parport n/devices/ */ enum { DEV_PARPORT_DEVICES_ACTIVE=-3, }; /* /proc/sys/dev/parport/parport n/devices/device n */ enum { DEV_PARPORT_DEVICE_TIMESLICE=1, }; /* /proc/sys/dev/mac_hid */ enum { DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1, DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2, DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3, DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4, DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5, DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 }; /* /proc/sys/dev/scsi */ enum { DEV_SCSI_LOGGING_LEVEL=1, }; /* /proc/sys/dev/ipmi */ enum { DEV_IPMI_POWEROFF_POWERCYCLE=1, }; /* /proc/sys/abi */ enum { ABI_DEFHANDLER_COFF=1, /* default handler for coff binaries */ ABI_DEFHANDLER_ELF=2, /* default handler for ELF binaries */ ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */ ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */ ABI_TRACE=5, /* tracing flags */ ABI_FAKE_UTSNAME=6, /* fake target utsname information */ }; #endif /* _LINUX_SYSCTL_H */ linux/tdx-guest.h 0000644 00000002431 15063602055 0010002 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Userspace interface for TDX guest driver * * Copyright (C) 2022 Intel Corporation */ #ifndef _LINUX_TDX_GUEST_H_ #define _LINUX_TDX_GUEST_H_ #include <linux/ioctl.h> #include <linux/types.h> /* Length of the REPORTDATA used in TDG.MR.REPORT TDCALL */ #define TDX_REPORTDATA_LEN 64 /* Length of TDREPORT used in TDG.MR.REPORT TDCALL */ #define TDX_REPORT_LEN 1024 /** * struct tdx_report_req - Request struct for TDX_CMD_GET_REPORT0 IOCTL. * * @reportdata: User buffer with REPORTDATA to be included into TDREPORT. * Typically it can be some nonce provided by attestation * service, so the generated TDREPORT can be uniquely verified. * @tdreport: User buffer to store TDREPORT output from TDCALL[TDG.MR.REPORT]. */ struct tdx_report_req { __u8 reportdata[TDX_REPORTDATA_LEN]; __u8 tdreport[TDX_REPORT_LEN]; }; /* * TDX_CMD_GET_REPORT0 - Get TDREPORT0 (a.k.a. TDREPORT subtype 0) using * TDCALL[TDG.MR.REPORT] * * Return 0 on success, -EIO on TDCALL execution failure, and * standard errno on other general error cases. */ #define TDX_CMD_GET_REPORT0 _IOWR('T', 1, struct tdx_report_req) #endif /* _LINUX_TDX_GUEST_H_ */ linux/termios.h 0000644 00000000772 15063602055 0007546 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TERMIOS_H #define _LINUX_TERMIOS_H #include <linux/types.h> #include <asm/termios.h> #define NFF 5 struct termiox { __u16 x_hflag; __u16 x_cflag; __u16 x_rflag[NFF]; __u16 x_sflag; }; #define RTSXOFF 0x0001 /* RTS flow control on input */ #define CTSXON 0x0002 /* CTS flow control on output */ #define DTRXOFF 0x0004 /* DTR flow control on input */ #define DSRXON 0x0008 /* DCD flow control on output */ #endif linux/spi/spidev.h 0000644 00000011724 15063602055 0010150 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * include/linux/spi/spidev.h * * Copyright (C) 2006 SWAPP * Andrea Paterniani <a.paterniani@swapp-eng.it> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef SPIDEV_H #define SPIDEV_H #include <linux/types.h> #include <linux/ioctl.h> /* User space versions of kernel symbols for SPI clocking modes, * matching <linux/spi/spi.h> */ #define SPI_CPHA 0x01 #define SPI_CPOL 0x02 #define SPI_MODE_0 (0|0) #define SPI_MODE_1 (0|SPI_CPHA) #define SPI_MODE_2 (SPI_CPOL|0) #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) #define SPI_CS_HIGH 0x04 #define SPI_LSB_FIRST 0x08 #define SPI_3WIRE 0x10 #define SPI_LOOP 0x20 #define SPI_NO_CS 0x40 #define SPI_READY 0x80 #define SPI_TX_DUAL 0x100 #define SPI_TX_QUAD 0x200 #define SPI_RX_DUAL 0x400 #define SPI_RX_QUAD 0x800 /*---------------------------------------------------------------------------*/ /* IOCTL commands */ #define SPI_IOC_MAGIC 'k' /** * struct spi_ioc_transfer - describes a single SPI transfer * @tx_buf: Holds pointer to userspace buffer with transmit data, or null. * If no data is provided, zeroes are shifted out. * @rx_buf: Holds pointer to userspace buffer for receive data, or null. * @len: Length of tx and rx buffers, in bytes. * @speed_hz: Temporary override of the device's bitrate. * @bits_per_word: Temporary override of the device's wordsize. * @delay_usecs: If nonzero, how long to delay after the last bit transfer * before optionally deselecting the device before the next transfer. * @cs_change: True to deselect device before starting the next transfer. * * This structure is mapped directly to the kernel spi_transfer structure; * the fields have the same meanings, except of course that the pointers * are in a different address space (and may be of different sizes in some * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel). * Zero-initialize the structure, including currently unused fields, to * accommodate potential future updates. * * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync(). * Pass it an array of related transfers, they'll execute together. * Each transfer may be half duplex (either direction) or full duplex. * * struct spi_ioc_transfer mesg[4]; * ... * status = ioctl(fd, SPI_IOC_MESSAGE(4), mesg); * * So for example one transfer might send a nine bit command (right aligned * in a 16-bit word), the next could read a block of 8-bit data before * terminating that command by temporarily deselecting the chip; the next * could send a different nine bit command (re-selecting the chip), and the * last transfer might write some register values. */ struct spi_ioc_transfer { __u64 tx_buf; __u64 rx_buf; __u32 len; __u32 speed_hz; __u16 delay_usecs; __u8 bits_per_word; __u8 cs_change; __u8 tx_nbits; __u8 rx_nbits; __u16 pad; /* If the contents of 'struct spi_ioc_transfer' ever change * incompatibly, then the ioctl number (currently 0) must change; * ioctls with constant size fields get a bit more in the way of * error checking than ones (like this) where that field varies. * * NOTE: struct layout is the same in 64bit and 32bit userspace. */ }; /* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */ #define SPI_MSGSIZE(N) \ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) /* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) (limited to 8 bits) */ #define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8) #define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8) /* Read / Write SPI bit justification */ #define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, __u8) #define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, __u8) /* Read / Write SPI device word length (1..N) */ #define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, __u8) #define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, __u8) /* Read / Write SPI device default max speed hz */ #define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32) #define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32) /* Read / Write of the SPI mode field */ #define SPI_IOC_RD_MODE32 _IOR(SPI_IOC_MAGIC, 5, __u32) #define SPI_IOC_WR_MODE32 _IOW(SPI_IOC_MAGIC, 5, __u32) #endif /* SPIDEV_H */ linux/sunrpc/debug.h 0000644 00000002170 15063602055 0010456 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/sunrpc/debug.h * * Debugging support for sunrpc module * * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> */ #ifndef _LINUX_SUNRPC_DEBUG_H_ #define _LINUX_SUNRPC_DEBUG_H_ /* * RPC debug facilities */ #define RPCDBG_XPRT 0x0001 #define RPCDBG_CALL 0x0002 #define RPCDBG_DEBUG 0x0004 #define RPCDBG_NFS 0x0008 #define RPCDBG_AUTH 0x0010 #define RPCDBG_BIND 0x0020 #define RPCDBG_SCHED 0x0040 #define RPCDBG_TRANS 0x0080 #define RPCDBG_SVCXPRT 0x0100 #define RPCDBG_SVCDSP 0x0200 #define RPCDBG_MISC 0x0400 #define RPCDBG_CACHE 0x0800 #define RPCDBG_ALL 0x7fff /* * Declarations for the sysctl debug interface, which allows to read or * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc * module currently registers its sysctl table dynamically, the sysctl path * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>. */ enum { CTL_RPCDEBUG = 1, CTL_NFSDEBUG, CTL_NFSDDEBUG, CTL_NLMDEBUG, CTL_SLOTTABLE_UDP, CTL_SLOTTABLE_TCP, CTL_MIN_RESVPORT, CTL_MAX_RESVPORT, }; #endif /* _LINUX_SUNRPC_DEBUG_H_ */ linux/sysinfo.h 0000644 00000002031 15063602055 0007544 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SYSINFO_H #define _LINUX_SYSINFO_H #include <linux/types.h> #define SI_LOAD_SHIFT 16 struct sysinfo { __kernel_long_t uptime; /* Seconds since boot */ __kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */ __kernel_ulong_t totalram; /* Total usable main memory size */ __kernel_ulong_t freeram; /* Available memory size */ __kernel_ulong_t sharedram; /* Amount of shared memory */ __kernel_ulong_t bufferram; /* Memory used by buffers */ __kernel_ulong_t totalswap; /* Total swap space size */ __kernel_ulong_t freeswap; /* swap space still available */ __u16 procs; /* Number of current processes */ __u16 pad; /* Explicit padding for m68k */ __kernel_ulong_t totalhigh; /* Total high memory size */ __kernel_ulong_t freehigh; /* Available high memory size */ __u32 mem_unit; /* Memory unit size in bytes */ char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */ }; #endif /* _LINUX_SYSINFO_H */ linux/target_core_user.h 0000644 00000011031 15063602055 0011406 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __TARGET_CORE_USER_H #define __TARGET_CORE_USER_H /* This header will be used by application too */ #include <linux/types.h> #include <linux/uio.h> #define TCMU_VERSION "2.0" /** * DOC: Ring Design * Ring Design * ----------- * * The mmaped area is divided into three parts: * 1) The mailbox (struct tcmu_mailbox, below); * 2) The command ring; * 3) Everything beyond the command ring (data). * * The mailbox tells userspace the offset of the command ring from the * start of the shared memory region, and how big the command ring is. * * The kernel passes SCSI commands to userspace by putting a struct * tcmu_cmd_entry in the ring, updating mailbox->cmd_head, and poking * userspace via UIO's interrupt mechanism. * * tcmu_cmd_entry contains a header. If the header type is PAD, * userspace should skip hdr->length bytes (mod cmdr_size) to find the * next cmd_entry. * * Otherwise, the entry will contain offsets into the mmaped area that * contain the cdb and data buffers -- the latter accessible via the * iov array. iov addresses are also offsets into the shared area. * * When userspace is completed handling the command, set * entry->rsp.scsi_status, fill in rsp.sense_buffer if appropriate, * and also set mailbox->cmd_tail equal to the old cmd_tail plus * hdr->length, mod cmdr_size. If cmd_tail doesn't equal cmd_head, it * should process the next packet the same way, and so on. */ #define TCMU_MAILBOX_VERSION 2 #define ALIGN_SIZE 64 /* Should be enough for most CPUs */ #define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0) /* Out-of-order completions */ #define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1) /* Read data length */ #define TCMU_MAILBOX_FLAG_CAP_TMR (1 << 2) /* TMR notifications */ #define TCMU_MAILBOX_FLAG_CAP_KEEP_BUF (1<<3) /* Keep buf after cmd completion */ struct tcmu_mailbox { __u16 version; __u16 flags; __u32 cmdr_off; __u32 cmdr_size; __u32 cmd_head; /* Updated by user. On its own cacheline */ __u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE))); } __attribute__((packed)); enum tcmu_opcode { TCMU_OP_PAD = 0, TCMU_OP_CMD, TCMU_OP_TMR, }; /* * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode. */ struct tcmu_cmd_entry_hdr { __u32 len_op; __u16 cmd_id; __u8 kflags; #define TCMU_UFLAG_UNKNOWN_OP 0x1 #define TCMU_UFLAG_READ_LEN 0x2 #define TCMU_UFLAG_KEEP_BUF 0x4 __u8 uflags; } __attribute__((packed)); #define TCMU_OP_MASK 0x7 static __inline__ enum tcmu_opcode tcmu_hdr_get_op(__u32 len_op) { return len_op & TCMU_OP_MASK; } static __inline__ void tcmu_hdr_set_op(__u32 *len_op, enum tcmu_opcode op) { *len_op &= ~TCMU_OP_MASK; *len_op |= (op & TCMU_OP_MASK); } static __inline__ __u32 tcmu_hdr_get_len(__u32 len_op) { return len_op & ~TCMU_OP_MASK; } static __inline__ void tcmu_hdr_set_len(__u32 *len_op, __u32 len) { *len_op &= TCMU_OP_MASK; *len_op |= len; } /* Currently the same as SCSI_SENSE_BUFFERSIZE */ #define TCMU_SENSE_BUFFERSIZE 96 struct tcmu_cmd_entry { struct tcmu_cmd_entry_hdr hdr; union { struct { __u32 iov_cnt; __u32 iov_bidi_cnt; __u32 iov_dif_cnt; __u64 cdb_off; __u64 __pad1; __u64 __pad2; struct iovec iov[0]; } req; struct { __u8 scsi_status; __u8 __pad1; __u16 __pad2; __u32 read_len; char sense_buffer[TCMU_SENSE_BUFFERSIZE]; } rsp; }; } __attribute__((packed)); struct tcmu_tmr_entry { struct tcmu_cmd_entry_hdr hdr; #define TCMU_TMR_UNKNOWN 0 #define TCMU_TMR_ABORT_TASK 1 #define TCMU_TMR_ABORT_TASK_SET 2 #define TCMU_TMR_CLEAR_ACA 3 #define TCMU_TMR_CLEAR_TASK_SET 4 #define TCMU_TMR_LUN_RESET 5 #define TCMU_TMR_TARGET_WARM_RESET 6 #define TCMU_TMR_TARGET_COLD_RESET 7 /* Pseudo reset due to received PR OUT */ #define TCMU_TMR_LUN_RESET_PRO 128 __u8 tmr_type; __u8 __pad1; __u16 __pad2; __u32 cmd_cnt; __u64 __pad3; __u64 __pad4; __u16 cmd_ids[0]; } __attribute__((packed)); #define TCMU_OP_ALIGN_SIZE sizeof(__u64) enum tcmu_genl_cmd { TCMU_CMD_UNSPEC, TCMU_CMD_ADDED_DEVICE, TCMU_CMD_REMOVED_DEVICE, TCMU_CMD_RECONFIG_DEVICE, TCMU_CMD_ADDED_DEVICE_DONE, TCMU_CMD_REMOVED_DEVICE_DONE, TCMU_CMD_RECONFIG_DEVICE_DONE, TCMU_CMD_SET_FEATURES, __TCMU_CMD_MAX, }; #define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1) enum tcmu_genl_attr { TCMU_ATTR_UNSPEC, TCMU_ATTR_DEVICE, TCMU_ATTR_MINOR, TCMU_ATTR_PAD, TCMU_ATTR_DEV_CFG, TCMU_ATTR_DEV_SIZE, TCMU_ATTR_WRITECACHE, TCMU_ATTR_CMD_STATUS, TCMU_ATTR_DEVICE_ID, TCMU_ATTR_SUPP_KERN_CMD_REPLY, __TCMU_ATTR_MAX, }; #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1) #endif linux/taskstats.h 0000644 00000016014 15063602055 0010101 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ /* taskstats.h - exporting per-task statistics * * Copyright (C) Shailabh Nagar, IBM Corp. 2006 * (C) Balbir Singh, IBM Corp. 2006 * (C) Jay Lan, SGI, 2006 * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef _LINUX_TASKSTATS_H #define _LINUX_TASKSTATS_H #include <linux/types.h> /* Format for per-task data returned to userland when * - a task exits * - listener requests stats for a task * * The struct is versioned. Newer versions should only add fields to * the bottom of the struct to maintain backward compatibility. * * * To add new fields * a) bump up TASKSTATS_VERSION * b) add comment indicating new version number at end of struct * c) add new fields after version comment; maintain 64-bit alignment */ #define TASKSTATS_VERSION 9 #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN * in linux/sched.h */ struct taskstats { /* The version number of this struct. This field is always set to * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>. * Each time the struct is changed, the value should be incremented. */ __u16 version; __u32 ac_exitcode; /* Exit status */ /* The accounting flags of a task as defined in <linux/acct.h> * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG. */ __u8 ac_flag; /* Record flags */ __u8 ac_nice; /* task_nice */ /* Delay accounting fields start * * All values, until comment "Delay accounting fields end" are * available only if delay accounting is enabled, even though the last * few fields are not delays * * xxx_count is the number of delay values recorded * xxx_delay_total is the corresponding cumulative delay in nanoseconds * * xxx_delay_total wraps around to zero on overflow * xxx_count incremented regardless of overflow */ /* Delay waiting for cpu, while runnable * count, delay_total NOT updated atomically */ __u64 cpu_count __attribute__((aligned(8))); __u64 cpu_delay_total; /* Following four fields atomically updated using task->delays->lock */ /* Delay waiting for synchronous block I/O to complete * does not account for delays in I/O submission */ __u64 blkio_count; __u64 blkio_delay_total; /* Delay waiting for page fault I/O (swap in only) */ __u64 swapin_count; __u64 swapin_delay_total; /* cpu "wall-clock" running time * On some architectures, value will adjust for cpu time stolen * from the kernel in involuntary waits due to virtualization. * Value is cumulative, in nanoseconds, without a corresponding count * and wraps around to zero silently on overflow */ __u64 cpu_run_real_total; /* cpu "virtual" running time * Uses time intervals seen by the kernel i.e. no adjustment * for kernel's involuntary waits due to virtualization. * Value is cumulative, in nanoseconds, without a corresponding count * and wraps around to zero silently on overflow */ __u64 cpu_run_virtual_total; /* Delay accounting fields end */ /* version 1 ends here */ /* Basic Accounting Fields start */ char ac_comm[TS_COMM_LEN]; /* Command name */ __u8 ac_sched __attribute__((aligned(8))); /* Scheduling discipline */ __u8 ac_pad[3]; __u32 ac_uid __attribute__((aligned(8))); /* User ID */ __u32 ac_gid; /* Group ID */ __u32 ac_pid; /* Process ID */ __u32 ac_ppid; /* Parent process ID */ __u32 ac_btime; /* Begin time [sec since 1970] */ __u64 ac_etime __attribute__((aligned(8))); /* Elapsed time [usec] */ __u64 ac_utime; /* User CPU time [usec] */ __u64 ac_stime; /* SYstem CPU time [usec] */ __u64 ac_minflt; /* Minor Page Fault Count */ __u64 ac_majflt; /* Major Page Fault Count */ /* Basic Accounting Fields end */ /* Extended accounting fields start */ /* Accumulated RSS usage in duration of a task, in MBytes-usecs. * The current rss usage is added to this counter every time * a tick is charged to a task's system time. So, at the end we * will have memory usage multiplied by system time. Thus an * average usage per system time unit can be calculated. */ __u64 coremem; /* accumulated RSS usage in MB-usec */ /* Accumulated virtual memory usage in duration of a task. * Same as acct_rss_mem1 above except that we keep track of VM usage. */ __u64 virtmem; /* accumulated VM usage in MB-usec */ /* High watermark of RSS and virtual memory usage in duration of * a task, in KBytes. */ __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */ __u64 hiwater_vm; /* High-water VM usage, in KB */ /* The following four fields are I/O statistics of a task. */ __u64 read_char; /* bytes read */ __u64 write_char; /* bytes written */ __u64 read_syscalls; /* read syscalls */ __u64 write_syscalls; /* write syscalls */ /* Extended accounting fields end */ #define TASKSTATS_HAS_IO_ACCOUNTING /* Per-task storage I/O accounting starts */ __u64 read_bytes; /* bytes of read I/O */ __u64 write_bytes; /* bytes of write I/O */ __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */ __u64 nvcsw; /* voluntary_ctxt_switches */ __u64 nivcsw; /* nonvoluntary_ctxt_switches */ /* time accounting for SMT machines */ __u64 ac_utimescaled; /* utime scaled on frequency etc */ __u64 ac_stimescaled; /* stime scaled on frequency etc */ __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ /* Delay waiting for memory reclaim */ __u64 freepages_count; __u64 freepages_delay_total; #ifndef __GENKSYMS__ /* Delay waiting for thrashing page */ __u64 thrashing_count; __u64 thrashing_delay_total; #endif }; /* * Commands sent from userspace * Not versioned. New commands should only be inserted at the enum's end * prior to __TASKSTATS_CMD_MAX */ enum { TASKSTATS_CMD_UNSPEC = 0, /* Reserved */ TASKSTATS_CMD_GET, /* user->kernel request/get-response */ TASKSTATS_CMD_NEW, /* kernel->user event */ __TASKSTATS_CMD_MAX, }; #define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1) enum { TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */ TASKSTATS_TYPE_PID, /* Process id */ TASKSTATS_TYPE_TGID, /* Thread group id */ TASKSTATS_TYPE_STATS, /* taskstats structure */ TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */ TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */ TASKSTATS_TYPE_NULL, /* contains nothing */ __TASKSTATS_TYPE_MAX, }; #define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1) enum { TASKSTATS_CMD_ATTR_UNSPEC = 0, TASKSTATS_CMD_ATTR_PID, TASKSTATS_CMD_ATTR_TGID, TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, __TASKSTATS_CMD_ATTR_MAX, }; #define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1) /* NETLINK_GENERIC related info */ #define TASKSTATS_GENL_NAME "TASKSTATS" #define TASKSTATS_GENL_VERSION 0x1 #endif /* _LINUX_TASKSTATS_H */ linux/tcp.h 0000644 00000023300 15063602055 0006642 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the TCP protocol. * * Version: @(#)tcp.h 1.0.2 04/28/93 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_TCP_H #define _LINUX_TCP_H #include <linux/types.h> #include <asm/byteorder.h> #include <linux/socket.h> struct tcphdr { __be16 source; __be16 dest; __be32 seq; __be32 ack_seq; #if defined(__LITTLE_ENDIAN_BITFIELD) __u16 res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u16 doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1; #else #error "Adjust your <asm/byteorder.h> defines" #endif __be16 window; __sum16 check; __be16 urg_ptr; }; /* * The union cast uses a gcc extension to avoid aliasing problems * (union is compatible to any of its members) * This means this part of the code is -fstrict-aliasing safe now. */ union tcp_word_hdr { struct tcphdr hdr; __be32 words[5]; }; #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) enum { TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000), TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000), TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000), TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000), TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000), TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000), TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000), TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000) }; /* * TCP general constants */ #define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */ #define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */ /* TCP socket options */ #define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ #define TCP_MAXSEG 2 /* Limit MSS */ #define TCP_CORK 3 /* Never send partially complete segments */ #define TCP_KEEPIDLE 4 /* Start keeplives after this period */ #define TCP_KEEPINTVL 5 /* Interval between keepalives */ #define TCP_KEEPCNT 6 /* Number of keepalives before death */ #define TCP_SYNCNT 7 /* Number of SYN retransmits */ #define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ #define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ #define TCP_INFO 11 /* Information about this connection. */ #define TCP_QUICKACK 12 /* Block/reenable quick acks */ #define TCP_CONGESTION 13 /* Congestion control algorithm */ #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ #define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ #define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ #define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ #define TCP_REPAIR 19 /* TCP sock is under repair right now */ #define TCP_REPAIR_QUEUE 20 #define TCP_QUEUE_SEQ 21 #define TCP_REPAIR_OPTIONS 22 #define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */ #define TCP_TIMESTAMP 24 #define TCP_NOTSENT_LOWAT 25 /* limit number of unsent bytes in write queue */ #define TCP_CC_INFO 26 /* Get Congestion Control (optional) info */ #define TCP_SAVE_SYN 27 /* Record SYN headers for new connections */ #define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ #define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ #define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ #define TCP_ULP 31 /* Attach a ULP to a TCP connection */ #define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */ #define TCP_FASTOPEN_KEY 33 /* Set the key for Fast Open (cookie) */ #define TCP_FASTOPEN_NO_COOKIE 34 /* Enable TFO without a TFO cookie */ #define TCP_ZEROCOPY_RECEIVE 35 #define TCP_INQ 36 /* Notify bytes available to read as a cmsg on read */ #define TCP_CM_INQ TCP_INQ #define TCP_REPAIR_ON 1 #define TCP_REPAIR_OFF 0 #define TCP_REPAIR_OFF_NO_WP -1 /* Turn off without window probes */ struct tcp_repair_opt { __u32 opt_code; __u32 opt_val; }; struct tcp_repair_window { __u32 snd_wl1; __u32 snd_wnd; __u32 max_window; __u32 rcv_wnd; __u32 rcv_wup; }; enum { TCP_NO_QUEUE, TCP_RECV_QUEUE, TCP_SEND_QUEUE, TCP_QUEUES_NR, }; /* for TCP_INFO socket option */ #define TCPI_OPT_TIMESTAMPS 1 #define TCPI_OPT_SACK 2 #define TCPI_OPT_WSCALE 4 #define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */ #define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ #define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */ enum tcp_ca_state { TCP_CA_Open = 0, #define TCPF_CA_Open (1<<TCP_CA_Open) TCP_CA_Disorder = 1, #define TCPF_CA_Disorder (1<<TCP_CA_Disorder) TCP_CA_CWR = 2, #define TCPF_CA_CWR (1<<TCP_CA_CWR) TCP_CA_Recovery = 3, #define TCPF_CA_Recovery (1<<TCP_CA_Recovery) TCP_CA_Loss = 4 #define TCPF_CA_Loss (1<<TCP_CA_Loss) }; struct tcp_info { __u8 tcpi_state; __u8 tcpi_ca_state; __u8 tcpi_retransmits; __u8 tcpi_probes; __u8 tcpi_backoff; __u8 tcpi_options; __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; __u8 tcpi_delivery_rate_app_limited:1; __u32 tcpi_rto; __u32 tcpi_ato; __u32 tcpi_snd_mss; __u32 tcpi_rcv_mss; __u32 tcpi_unacked; __u32 tcpi_sacked; __u32 tcpi_lost; __u32 tcpi_retrans; __u32 tcpi_fackets; /* Times. */ __u32 tcpi_last_data_sent; __u32 tcpi_last_ack_sent; /* Not remembered, sorry. */ __u32 tcpi_last_data_recv; __u32 tcpi_last_ack_recv; /* Metrics. */ __u32 tcpi_pmtu; __u32 tcpi_rcv_ssthresh; __u32 tcpi_rtt; __u32 tcpi_rttvar; __u32 tcpi_snd_ssthresh; __u32 tcpi_snd_cwnd; __u32 tcpi_advmss; __u32 tcpi_reordering; __u32 tcpi_rcv_rtt; __u32 tcpi_rcv_space; __u32 tcpi_total_retrans; __u64 tcpi_pacing_rate; __u64 tcpi_max_pacing_rate; __u64 tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */ __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */ __u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */ __u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */ __u32 tcpi_notsent_bytes; __u32 tcpi_min_rtt; __u32 tcpi_data_segs_in; /* RFC4898 tcpEStatsDataSegsIn */ __u32 tcpi_data_segs_out; /* RFC4898 tcpEStatsDataSegsOut */ __u64 tcpi_delivery_rate; __u64 tcpi_busy_time; /* Time (usec) busy sending data */ __u64 tcpi_rwnd_limited; /* Time (usec) limited by receive window */ __u64 tcpi_sndbuf_limited; /* Time (usec) limited by send buffer */ __u32 tcpi_delivered; __u32 tcpi_delivered_ce; __u64 tcpi_bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut */ __u64 tcpi_bytes_retrans; /* RFC4898 tcpEStatsPerfOctetsRetrans */ __u32 tcpi_dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups */ __u32 tcpi_reord_seen; /* reordering events seen */ __u32 tcpi_rcv_ooopack; /* Out-of-order packets received */ __u32 tcpi_snd_wnd; /* peer's advertised receive window after * scaling (bytes) */ }; /* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */ enum { TCP_NLA_PAD, TCP_NLA_BUSY, /* Time (usec) busy sending data */ TCP_NLA_RWND_LIMITED, /* Time (usec) limited by receive window */ TCP_NLA_SNDBUF_LIMITED, /* Time (usec) limited by send buffer */ TCP_NLA_DATA_SEGS_OUT, /* Data pkts sent including retransmission */ TCP_NLA_TOTAL_RETRANS, /* Data pkts retransmitted */ TCP_NLA_PACING_RATE, /* Pacing rate in bytes per second */ TCP_NLA_DELIVERY_RATE, /* Delivery rate in bytes per second */ TCP_NLA_SND_CWND, /* Sending congestion window */ TCP_NLA_REORDERING, /* Reordering metric */ TCP_NLA_MIN_RTT, /* minimum RTT */ TCP_NLA_RECUR_RETRANS, /* Recurring retransmits for the current pkt */ TCP_NLA_DELIVERY_RATE_APP_LMT, /* delivery rate application limited ? */ TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */ TCP_NLA_CA_STATE, /* ca_state of socket */ TCP_NLA_SND_SSTHRESH, /* Slow start size threshold */ TCP_NLA_DELIVERED, /* Data pkts delivered incl. out-of-order */ TCP_NLA_DELIVERED_CE, /* Like above but only ones w/ CE marks */ TCP_NLA_BYTES_SENT, /* Data bytes sent including retransmission */ TCP_NLA_BYTES_RETRANS, /* Data bytes retransmitted */ TCP_NLA_DSACK_DUPS, /* DSACK blocks received */ TCP_NLA_REORD_SEEN, /* reordering events seen */ TCP_NLA_SRTT, /* smoothed RTT in usecs */ TCP_NLA_TIMEOUT_REHASH, /* Timeout-triggered rehash attempts */ }; /* for TCP_MD5SIG socket option */ #define TCP_MD5SIG_MAXKEYLEN 80 /* tcp_md5sig extension flags for TCP_MD5SIG_EXT */ #define TCP_MD5SIG_FLAG_PREFIX 1 /* address prefix length */ struct tcp_md5sig { struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ __u8 tcpm_flags; /* extension flags */ __u8 tcpm_prefixlen; /* address prefix */ __u16 tcpm_keylen; /* key length */ __u32 __tcpm_pad; /* zero */ __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ }; /* INET_DIAG_MD5SIG */ struct tcp_diag_md5sig { __u8 tcpm_family; __u8 tcpm_prefixlen; __u16 tcpm_keylen; __be32 tcpm_addr[4]; __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; }; /* setsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, ...) */ struct tcp_zerocopy_receive { __u64 address; /* in: address of mapping */ __u32 length; /* in/out: number of bytes to map/mapped */ __u32 recv_skip_hint; /* out: amount of bytes to skip */ }; #endif /* _LINUX_TCP_H */ linux/tcp_metrics.h 0000644 00000003015 15063602055 0010371 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* tcp_metrics.h - TCP Metrics Interface */ #ifndef _LINUX_TCP_METRICS_H #define _LINUX_TCP_METRICS_H #include <linux/types.h> /* NETLINK_GENERIC related info */ #define TCP_METRICS_GENL_NAME "tcp_metrics" #define TCP_METRICS_GENL_VERSION 0x1 enum tcp_metric_index { TCP_METRIC_RTT, /* in ms units */ TCP_METRIC_RTTVAR, /* in ms units */ TCP_METRIC_SSTHRESH, TCP_METRIC_CWND, TCP_METRIC_REORDERING, TCP_METRIC_RTT_US, /* in usec units */ TCP_METRIC_RTTVAR_US, /* in usec units */ /* Always last. */ __TCP_METRIC_MAX, }; #define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1) enum { TCP_METRICS_ATTR_UNSPEC, TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */ TCP_METRICS_ATTR_ADDR_IPV6, /* binary */ TCP_METRICS_ATTR_AGE, /* msecs */ TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */ TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */ TCP_METRICS_ATTR_VALS, /* nested +1, u32 */ TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */ TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */ TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */ TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */ TCP_METRICS_ATTR_SADDR_IPV6, /* binary */ TCP_METRICS_ATTR_PAD, __TCP_METRICS_ATTR_MAX, }; #define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1) enum { TCP_METRICS_CMD_UNSPEC, TCP_METRICS_CMD_GET, TCP_METRICS_CMD_DEL, __TCP_METRICS_CMD_MAX, }; #define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1) #endif /* _LINUX_TCP_METRICS_H */ linux/thermal.h 0000644 00000006355 15063602055 0007523 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_THERMAL_H #define _LINUX_THERMAL_H #define THERMAL_NAME_LENGTH 20 enum thermal_device_mode { THERMAL_DEVICE_DISABLED = 0, THERMAL_DEVICE_ENABLED, }; enum thermal_trip_type { THERMAL_TRIP_ACTIVE = 0, THERMAL_TRIP_PASSIVE, THERMAL_TRIP_HOT, THERMAL_TRIP_CRITICAL, }; /* Adding event notification support elements */ #define THERMAL_GENL_FAMILY_NAME "thermal" #define THERMAL_GENL_VERSION 0x01 #define THERMAL_GENL_SAMPLING_GROUP_NAME "sampling" #define THERMAL_GENL_EVENT_GROUP_NAME "event" /* Attributes of thermal_genl_family */ enum thermal_genl_attr { THERMAL_GENL_ATTR_UNSPEC, THERMAL_GENL_ATTR_TZ, THERMAL_GENL_ATTR_TZ_ID, THERMAL_GENL_ATTR_TZ_TEMP, THERMAL_GENL_ATTR_TZ_TRIP, THERMAL_GENL_ATTR_TZ_TRIP_ID, THERMAL_GENL_ATTR_TZ_TRIP_TYPE, THERMAL_GENL_ATTR_TZ_TRIP_TEMP, THERMAL_GENL_ATTR_TZ_TRIP_HYST, THERMAL_GENL_ATTR_TZ_MODE, THERMAL_GENL_ATTR_TZ_NAME, THERMAL_GENL_ATTR_TZ_CDEV_WEIGHT, THERMAL_GENL_ATTR_TZ_GOV, THERMAL_GENL_ATTR_TZ_GOV_NAME, THERMAL_GENL_ATTR_CDEV, THERMAL_GENL_ATTR_CDEV_ID, THERMAL_GENL_ATTR_CDEV_CUR_STATE, THERMAL_GENL_ATTR_CDEV_MAX_STATE, THERMAL_GENL_ATTR_CDEV_NAME, THERMAL_GENL_ATTR_GOV_NAME, THERMAL_GENL_ATTR_CPU_CAPABILITY, THERMAL_GENL_ATTR_CPU_CAPABILITY_ID, THERMAL_GENL_ATTR_CPU_CAPABILITY_PERFORMANCE, THERMAL_GENL_ATTR_CPU_CAPABILITY_EFFICIENCY, __THERMAL_GENL_ATTR_MAX, }; #define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1) enum thermal_genl_sampling { THERMAL_GENL_SAMPLING_TEMP, __THERMAL_GENL_SAMPLING_MAX, }; #define THERMAL_GENL_SAMPLING_MAX (__THERMAL_GENL_SAMPLING_MAX - 1) /* Events of thermal_genl_family */ enum thermal_genl_event { THERMAL_GENL_EVENT_UNSPEC, THERMAL_GENL_EVENT_TZ_CREATE, /* Thermal zone creation */ THERMAL_GENL_EVENT_TZ_DELETE, /* Thermal zone deletion */ THERMAL_GENL_EVENT_TZ_DISABLE, /* Thermal zone disabed */ THERMAL_GENL_EVENT_TZ_ENABLE, /* Thermal zone enabled */ THERMAL_GENL_EVENT_TZ_TRIP_UP, /* Trip point crossed the way up */ THERMAL_GENL_EVENT_TZ_TRIP_DOWN, /* Trip point crossed the way down */ THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, /* Trip point changed */ THERMAL_GENL_EVENT_TZ_TRIP_ADD, /* Trip point added */ THERMAL_GENL_EVENT_TZ_TRIP_DELETE, /* Trip point deleted */ THERMAL_GENL_EVENT_CDEV_ADD, /* Cdev bound to the thermal zone */ THERMAL_GENL_EVENT_CDEV_DELETE, /* Cdev unbound */ THERMAL_GENL_EVENT_CDEV_STATE_UPDATE, /* Cdev state updated */ THERMAL_GENL_EVENT_TZ_GOV_CHANGE, /* Governor policy changed */ THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE, /* CPU capability changed */ __THERMAL_GENL_EVENT_MAX, }; #define THERMAL_GENL_EVENT_MAX (__THERMAL_GENL_EVENT_MAX - 1) /* Commands supported by the thermal_genl_family */ enum thermal_genl_cmd { THERMAL_GENL_CMD_UNSPEC, THERMAL_GENL_CMD_TZ_GET_ID, /* List of thermal zones id */ THERMAL_GENL_CMD_TZ_GET_TRIP, /* List of thermal trips */ THERMAL_GENL_CMD_TZ_GET_TEMP, /* Get the thermal zone temperature */ THERMAL_GENL_CMD_TZ_GET_GOV, /* Get the thermal zone governor */ THERMAL_GENL_CMD_TZ_GET_MODE, /* Get the thermal zone mode */ THERMAL_GENL_CMD_CDEV_GET, /* List of cdev id */ __THERMAL_GENL_CMD_MAX, }; #define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) #endif /* _LINUX_THERMAL_H */ linux/tc_act/tc_bpf.h 0000644 00000000775 15063602055 0010561 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us> */ #ifndef __LINUX_TC_BPF_H #define __LINUX_TC_BPF_H #include <linux/pkt_cls.h> struct tc_act_bpf { tc_gen; }; enum { TCA_ACT_BPF_UNSPEC, TCA_ACT_BPF_TM, TCA_ACT_BPF_PARMS, TCA_ACT_BPF_OPS_LEN, TCA_ACT_BPF_OPS, TCA_ACT_BPF_FD, TCA_ACT_BPF_NAME, TCA_ACT_BPF_PAD, TCA_ACT_BPF_TAG, TCA_ACT_BPF_ID, __TCA_ACT_BPF_MAX, }; #define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) #endif linux/tc_act/tc_connmark.h 0000644 00000000606 15063602055 0011613 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_TC_CONNMARK_H #define __UAPI_TC_CONNMARK_H #include <linux/types.h> #include <linux/pkt_cls.h> struct tc_connmark { tc_gen; __u16 zone; }; enum { TCA_CONNMARK_UNSPEC, TCA_CONNMARK_PARMS, TCA_CONNMARK_TM, TCA_CONNMARK_PAD, __TCA_CONNMARK_MAX }; #define TCA_CONNMARK_MAX (__TCA_CONNMARK_MAX - 1) #endif linux/tc_act/tc_csum.h 0000644 00000001204 15063602055 0010745 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_CSUM_H #define __LINUX_TC_CSUM_H #include <linux/types.h> #include <linux/pkt_cls.h> enum { TCA_CSUM_UNSPEC, TCA_CSUM_PARMS, TCA_CSUM_TM, TCA_CSUM_PAD, __TCA_CSUM_MAX }; #define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1) enum { TCA_CSUM_UPDATE_FLAG_IPV4HDR = 1, TCA_CSUM_UPDATE_FLAG_ICMP = 2, TCA_CSUM_UPDATE_FLAG_IGMP = 4, TCA_CSUM_UPDATE_FLAG_TCP = 8, TCA_CSUM_UPDATE_FLAG_UDP = 16, TCA_CSUM_UPDATE_FLAG_UDPLITE = 32, TCA_CSUM_UPDATE_FLAG_SCTP = 64, }; struct tc_csum { tc_gen; __u32 update_flags; }; #endif /* __LINUX_TC_CSUM_H */ linux/tc_act/tc_ct.h 0000644 00000001646 15063602055 0010416 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_TC_CT_H #define __UAPI_TC_CT_H #include <linux/types.h> #include <linux/pkt_cls.h> enum { TCA_CT_UNSPEC, TCA_CT_PARMS, TCA_CT_TM, TCA_CT_ACTION, /* u16 */ TCA_CT_ZONE, /* u16 */ TCA_CT_MARK, /* u32 */ TCA_CT_MARK_MASK, /* u32 */ TCA_CT_LABELS, /* u128 */ TCA_CT_LABELS_MASK, /* u128 */ TCA_CT_NAT_IPV4_MIN, /* be32 */ TCA_CT_NAT_IPV4_MAX, /* be32 */ TCA_CT_NAT_IPV6_MIN, /* struct in6_addr */ TCA_CT_NAT_IPV6_MAX, /* struct in6_addr */ TCA_CT_NAT_PORT_MIN, /* be16 */ TCA_CT_NAT_PORT_MAX, /* be16 */ TCA_CT_PAD, __TCA_CT_MAX }; #define TCA_CT_MAX (__TCA_CT_MAX - 1) #define TCA_CT_ACT_COMMIT (1 << 0) #define TCA_CT_ACT_FORCE (1 << 1) #define TCA_CT_ACT_CLEAR (1 << 2) #define TCA_CT_ACT_NAT (1 << 3) #define TCA_CT_ACT_NAT_SRC (1 << 4) #define TCA_CT_ACT_NAT_DST (1 << 5) struct tc_ct { tc_gen; }; #endif /* __UAPI_TC_CT_H */ linux/tc_act/tc_ctinfo.h 0000644 00000001054 15063602055 0011263 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_TC_CTINFO_H #define __UAPI_TC_CTINFO_H #include <linux/types.h> #include <linux/pkt_cls.h> struct tc_ctinfo { tc_gen; }; enum { TCA_CTINFO_UNSPEC, TCA_CTINFO_PAD, TCA_CTINFO_TM, TCA_CTINFO_ACT, TCA_CTINFO_ZONE, TCA_CTINFO_PARMS_DSCP_MASK, TCA_CTINFO_PARMS_DSCP_STATEMASK, TCA_CTINFO_PARMS_CPMARK_MASK, TCA_CTINFO_STATS_DSCP_SET, TCA_CTINFO_STATS_DSCP_ERROR, TCA_CTINFO_STATS_CPMARK_SET, __TCA_CTINFO_MAX }; #define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1) #endif linux/tc_act/tc_defact.h 0000644 00000000502 15063602055 0011224 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_DEF_H #define __LINUX_TC_DEF_H #include <linux/pkt_cls.h> struct tc_defact { tc_gen; }; enum { TCA_DEF_UNSPEC, TCA_DEF_TM, TCA_DEF_PARMS, TCA_DEF_DATA, TCA_DEF_PAD, __TCA_DEF_MAX }; #define TCA_DEF_MAX (__TCA_DEF_MAX - 1) #endif linux/tc_act/tc_gact.h 0000644 00000001162 15063602055 0010717 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_GACT_H #define __LINUX_TC_GACT_H #include <linux/types.h> #include <linux/pkt_cls.h> struct tc_gact { tc_gen; }; struct tc_gact_p { #define PGACT_NONE 0 #define PGACT_NETRAND 1 #define PGACT_DETERM 2 #define MAX_RAND (PGACT_DETERM + 1 ) __u16 ptype; __u16 pval; int paction; }; enum { TCA_GACT_UNSPEC, TCA_GACT_TM, TCA_GACT_PARMS, TCA_GACT_PROB, TCA_GACT_PAD, __TCA_GACT_MAX }; #define TCA_GACT_MAX (__TCA_GACT_MAX - 1) #endif linux/tc_act/tc_gate.h 0000644 00000001546 15063602055 0010727 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* Copyright 2020 NXP */ #ifndef __LINUX_TC_GATE_H #define __LINUX_TC_GATE_H #include <linux/pkt_cls.h> struct tc_gate { tc_gen; }; enum { TCA_GATE_ENTRY_UNSPEC, TCA_GATE_ENTRY_INDEX, TCA_GATE_ENTRY_GATE, TCA_GATE_ENTRY_INTERVAL, TCA_GATE_ENTRY_IPV, TCA_GATE_ENTRY_MAX_OCTETS, __TCA_GATE_ENTRY_MAX, }; #define TCA_GATE_ENTRY_MAX (__TCA_GATE_ENTRY_MAX - 1) enum { TCA_GATE_ONE_ENTRY_UNSPEC, TCA_GATE_ONE_ENTRY, __TCA_GATE_ONE_ENTRY_MAX, }; #define TCA_GATE_ONE_ENTRY_MAX (__TCA_GATE_ONE_ENTRY_MAX - 1) enum { TCA_GATE_UNSPEC, TCA_GATE_TM, TCA_GATE_PARMS, TCA_GATE_PAD, TCA_GATE_PRIORITY, TCA_GATE_ENTRY_LIST, TCA_GATE_BASE_TIME, TCA_GATE_CYCLE_TIME, TCA_GATE_CYCLE_TIME_EXT, TCA_GATE_FLAGS, TCA_GATE_CLOCKID, __TCA_GATE_MAX, }; #define TCA_GATE_MAX (__TCA_GATE_MAX - 1) #endif linux/tc_act/tc_ife.h 0000644 00000001130 15063602055 0010537 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UAPI_TC_IFE_H #define __UAPI_TC_IFE_H #include <linux/types.h> #include <linux/pkt_cls.h> #include <linux/ife.h> /* Flag bits for now just encoding/decoding; mutually exclusive */ #define IFE_ENCODE 1 #define IFE_DECODE 0 struct tc_ife { tc_gen; __u16 flags; }; /*XXX: We need to encode the total number of bytes consumed */ enum { TCA_IFE_UNSPEC, TCA_IFE_PARMS, TCA_IFE_TM, TCA_IFE_DMAC, TCA_IFE_SMAC, TCA_IFE_TYPE, TCA_IFE_METALST, TCA_IFE_PAD, __TCA_IFE_MAX }; #define TCA_IFE_MAX (__TCA_IFE_MAX - 1) #endif linux/tc_act/tc_ipt.h 0000644 00000000637 15063602055 0010603 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_IPT_H #define __LINUX_TC_IPT_H #include <linux/pkt_cls.h> enum { TCA_IPT_UNSPEC, TCA_IPT_TABLE, TCA_IPT_HOOK, TCA_IPT_INDEX, TCA_IPT_CNT, TCA_IPT_TM, TCA_IPT_TARG, TCA_IPT_PAD, __TCA_IPT_MAX }; #define TCA_IPT_MAX (__TCA_IPT_MAX - 1) #endif linux/tc_act/tc_mirred.h 0000644 00000001330 15063602055 0011260 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_MIR_H #define __LINUX_TC_MIR_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TCA_EGRESS_REDIR 1 /* packet redirect to EGRESS*/ #define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */ #define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ struct tc_mirred { tc_gen; int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ __u32 ifindex; /* ifindex of egress port */ }; enum { TCA_MIRRED_UNSPEC, TCA_MIRRED_TM, TCA_MIRRED_PARMS, TCA_MIRRED_PAD, __TCA_MIRRED_MAX }; #define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) #endif linux/tc_act/tc_mpls.h 0000644 00000002000 15063602055 0010744 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (C) 2019 Netronome Systems, Inc. */ #ifndef __LINUX_TC_MPLS_H #define __LINUX_TC_MPLS_H #include <linux/pkt_cls.h> #define TCA_MPLS_ACT_POP 1 #define TCA_MPLS_ACT_PUSH 2 #define TCA_MPLS_ACT_MODIFY 3 #define TCA_MPLS_ACT_DEC_TTL 4 #define TCA_MPLS_ACT_MAC_PUSH 5 struct tc_mpls { tc_gen; /* generic TC action fields. */ int m_action; /* action of type TCA_MPLS_ACT_*. */ }; enum { TCA_MPLS_UNSPEC, TCA_MPLS_TM, /* struct tcf_t; time values associated with action. */ TCA_MPLS_PARMS, /* struct tc_mpls; action type and general TC fields. */ TCA_MPLS_PAD, TCA_MPLS_PROTO, /* be16; eth_type of pushed or next (for pop) header. */ TCA_MPLS_LABEL, /* u32; MPLS label. Lower 20 bits are used. */ TCA_MPLS_TC, /* u8; MPLS TC field. Lower 3 bits are used. */ TCA_MPLS_TTL, /* u8; MPLS TTL field. Must not be 0. */ TCA_MPLS_BOS, /* u8; MPLS BOS field. Either 1 or 0. */ __TCA_MPLS_MAX, }; #define TCA_MPLS_MAX (__TCA_MPLS_MAX - 1) #endif linux/tc_act/tc_nat.h 0000644 00000000650 15063602055 0010564 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_NAT_H #define __LINUX_TC_NAT_H #include <linux/pkt_cls.h> #include <linux/types.h> enum { TCA_NAT_UNSPEC, TCA_NAT_PARMS, TCA_NAT_TM, TCA_NAT_PAD, __TCA_NAT_MAX }; #define TCA_NAT_MAX (__TCA_NAT_MAX - 1) #define TCA_NAT_FLAG_EGRESS 1 struct tc_nat { tc_gen; __be32 old_addr; __be32 new_addr; __be32 mask; __u32 flags; }; #endif linux/tc_act/tc_pedit.h 0000644 00000002767 15063602055 0011122 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_PED_H #define __LINUX_TC_PED_H #include <linux/types.h> #include <linux/pkt_cls.h> enum { TCA_PEDIT_UNSPEC, TCA_PEDIT_TM, TCA_PEDIT_PARMS, TCA_PEDIT_PAD, TCA_PEDIT_PARMS_EX, TCA_PEDIT_KEYS_EX, TCA_PEDIT_KEY_EX, __TCA_PEDIT_MAX }; #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) enum { TCA_PEDIT_KEY_EX_HTYPE = 1, TCA_PEDIT_KEY_EX_CMD = 2, __TCA_PEDIT_KEY_EX_MAX }; #define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1) /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It * means no specific header type - offset is relative to the network layer */ enum pedit_header_type { TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0, TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1, TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2, TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3, TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4, TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5, __PEDIT_HDR_TYPE_MAX, }; #define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1) enum pedit_cmd { TCA_PEDIT_KEY_EX_CMD_SET = 0, TCA_PEDIT_KEY_EX_CMD_ADD = 1, __PEDIT_CMD_MAX, }; #define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1) struct tc_pedit_key { __u32 mask; /* AND */ __u32 val; /*XOR */ __u32 off; /*offset */ __u32 at; __u32 offmask; __u32 shift; }; struct tc_pedit_sel { tc_gen; unsigned char nkeys; unsigned char flags; struct tc_pedit_key keys[0]; }; #define tc_pedit tc_pedit_sel #endif linux/tc_act/tc_sample.h 0000644 00000000710 15063602055 0011260 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_SAMPLE_H #define __LINUX_TC_SAMPLE_H #include <linux/types.h> #include <linux/pkt_cls.h> #include <linux/if_ether.h> struct tc_sample { tc_gen; }; enum { TCA_SAMPLE_UNSPEC, TCA_SAMPLE_TM, TCA_SAMPLE_PARMS, TCA_SAMPLE_RATE, TCA_SAMPLE_TRUNC_SIZE, TCA_SAMPLE_PSAMPLE_GROUP, TCA_SAMPLE_PAD, __TCA_SAMPLE_MAX }; #define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1) #endif linux/tc_act/tc_skbedit.h 0000644 00000001520 15063602055 0011424 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 2008, Intel Corporation. * * Author: Alexander Duyck <alexander.h.duyck@intel.com> */ #ifndef __LINUX_TC_SKBEDIT_H #define __LINUX_TC_SKBEDIT_H #include <linux/pkt_cls.h> #define SKBEDIT_F_PRIORITY 0x1 #define SKBEDIT_F_QUEUE_MAPPING 0x2 #define SKBEDIT_F_MARK 0x4 #define SKBEDIT_F_PTYPE 0x8 #define SKBEDIT_F_MASK 0x10 #define SKBEDIT_F_INHERITDSFIELD 0x20 #define SKBEDIT_F_TXQ_SKBHASH 0x40 struct tc_skbedit { tc_gen; }; enum { TCA_SKBEDIT_UNSPEC, TCA_SKBEDIT_TM, TCA_SKBEDIT_PARMS, TCA_SKBEDIT_PRIORITY, TCA_SKBEDIT_QUEUE_MAPPING, TCA_SKBEDIT_MARK, TCA_SKBEDIT_PAD, TCA_SKBEDIT_PTYPE, TCA_SKBEDIT_MASK, TCA_SKBEDIT_FLAGS, TCA_SKBEDIT_QUEUE_MAPPING_MAX, __TCA_SKBEDIT_MAX }; #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) #endif linux/tc_act/tc_skbmod.h 0000644 00000001113 15063602055 0011254 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2016, Jamal Hadi Salim */ #ifndef __LINUX_TC_SKBMOD_H #define __LINUX_TC_SKBMOD_H #include <linux/pkt_cls.h> #define SKBMOD_F_DMAC 0x1 #define SKBMOD_F_SMAC 0x2 #define SKBMOD_F_ETYPE 0x4 #define SKBMOD_F_SWAPMAC 0x8 #define SKBMOD_F_ECN 0x10 struct tc_skbmod { tc_gen; __u64 flags; }; enum { TCA_SKBMOD_UNSPEC, TCA_SKBMOD_TM, TCA_SKBMOD_PARMS, TCA_SKBMOD_DMAC, TCA_SKBMOD_SMAC, TCA_SKBMOD_ETYPE, TCA_SKBMOD_PAD, __TCA_SKBMOD_MAX }; #define TCA_SKBMOD_MAX (__TCA_SKBMOD_MAX - 1) #endif linux/tc_act/tc_tunnel_key.h 0000644 00000004656 15063602055 0012171 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2016, Amir Vadai <amir@vadai.me> * Copyright (c) 2016, Mellanox Technologies. All rights reserved. */ #ifndef __LINUX_TC_TUNNEL_KEY_H #define __LINUX_TC_TUNNEL_KEY_H #include <linux/pkt_cls.h> #define TCA_TUNNEL_KEY_ACT_SET 1 #define TCA_TUNNEL_KEY_ACT_RELEASE 2 struct tc_tunnel_key { tc_gen; int t_action; }; enum { TCA_TUNNEL_KEY_UNSPEC, TCA_TUNNEL_KEY_TM, TCA_TUNNEL_KEY_PARMS, TCA_TUNNEL_KEY_ENC_IPV4_SRC, /* be32 */ TCA_TUNNEL_KEY_ENC_IPV4_DST, /* be32 */ TCA_TUNNEL_KEY_ENC_IPV6_SRC, /* struct in6_addr */ TCA_TUNNEL_KEY_ENC_IPV6_DST, /* struct in6_addr */ TCA_TUNNEL_KEY_ENC_KEY_ID, /* be64 */ TCA_TUNNEL_KEY_PAD, TCA_TUNNEL_KEY_ENC_DST_PORT, /* be16 */ TCA_TUNNEL_KEY_NO_CSUM, /* u8 */ TCA_TUNNEL_KEY_ENC_OPTS, /* Nested TCA_TUNNEL_KEY_ENC_OPTS_ * attributes */ TCA_TUNNEL_KEY_ENC_TOS, /* u8 */ TCA_TUNNEL_KEY_ENC_TTL, /* u8 */ TCA_TUNNEL_KEY_NO_FRAG, /* flag */ __TCA_TUNNEL_KEY_MAX, }; #define TCA_TUNNEL_KEY_MAX (__TCA_TUNNEL_KEY_MAX - 1) enum { TCA_TUNNEL_KEY_ENC_OPTS_UNSPEC, TCA_TUNNEL_KEY_ENC_OPTS_GENEVE, /* Nested * TCA_TUNNEL_KEY_ENC_OPTS_ * attributes */ TCA_TUNNEL_KEY_ENC_OPTS_VXLAN, /* Nested * TCA_TUNNEL_KEY_ENC_OPTS_ * attributes */ TCA_TUNNEL_KEY_ENC_OPTS_ERSPAN, /* Nested * TCA_TUNNEL_KEY_ENC_OPTS_ * attributes */ __TCA_TUNNEL_KEY_ENC_OPTS_MAX, }; #define TCA_TUNNEL_KEY_ENC_OPTS_MAX (__TCA_TUNNEL_KEY_ENC_OPTS_MAX - 1) enum { TCA_TUNNEL_KEY_ENC_OPT_GENEVE_UNSPEC, TCA_TUNNEL_KEY_ENC_OPT_GENEVE_CLASS, /* be16 */ TCA_TUNNEL_KEY_ENC_OPT_GENEVE_TYPE, /* u8 */ TCA_TUNNEL_KEY_ENC_OPT_GENEVE_DATA, /* 4 to 128 bytes */ __TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX, }; #define TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX \ (__TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX - 1) enum { TCA_TUNNEL_KEY_ENC_OPT_VXLAN_UNSPEC, TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP, /* u32 */ __TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX, }; #define TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX \ (__TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX - 1) enum { TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_UNSPEC, TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_VER, /* u8 */ TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_INDEX, /* be32 */ TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_DIR, /* u8 */ TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_HWID, /* u8 */ __TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX, }; #define TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX \ (__TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX - 1) #endif linux/tc_act/tc_vlan.h 0000644 00000001240 15063602055 0010736 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> */ #ifndef __LINUX_TC_VLAN_H #define __LINUX_TC_VLAN_H #include <linux/pkt_cls.h> #define TCA_VLAN_ACT_POP 1 #define TCA_VLAN_ACT_PUSH 2 #define TCA_VLAN_ACT_MODIFY 3 #define TCA_VLAN_ACT_POP_ETH 4 #define TCA_VLAN_ACT_PUSH_ETH 5 struct tc_vlan { tc_gen; int v_action; }; enum { TCA_VLAN_UNSPEC, TCA_VLAN_TM, TCA_VLAN_PARMS, TCA_VLAN_PUSH_VLAN_ID, TCA_VLAN_PUSH_VLAN_PROTOCOL, TCA_VLAN_PAD, TCA_VLAN_PUSH_VLAN_PRIORITY, TCA_VLAN_PUSH_ETH_DST, TCA_VLAN_PUSH_ETH_SRC, __TCA_VLAN_MAX, }; #define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) #endif linux/tc_ematch/tc_em_cmp.h 0000644 00000000636 15063602055 0011740 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_CMP_H #define __LINUX_TC_EM_CMP_H #include <linux/types.h> #include <linux/pkt_cls.h> struct tcf_em_cmp { __u32 val; __u32 mask; __u16 off; __u8 align:4; __u8 flags:4; __u8 layer:4; __u8 opnd:4; }; enum { TCF_EM_ALIGN_U8 = 1, TCF_EM_ALIGN_U16 = 2, TCF_EM_ALIGN_U32 = 4 }; #define TCF_EM_CMP_TRANS 1 #endif linux/tc_ematch/tc_em_ipt.h 0000644 00000000607 15063602055 0011753 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_IPT_H #define __LINUX_TC_EM_IPT_H #include <linux/types.h> #include <linux/pkt_cls.h> enum { TCA_EM_IPT_UNSPEC, TCA_EM_IPT_HOOK, TCA_EM_IPT_MATCH_NAME, TCA_EM_IPT_MATCH_REVISION, TCA_EM_IPT_NFPROTO, TCA_EM_IPT_MATCH_DATA, __TCA_EM_IPT_MAX }; #define TCA_EM_IPT_MAX (__TCA_EM_IPT_MAX - 1) #endif linux/tc_ematch/tc_em_meta.h 0000644 00000004104 15063602055 0012101 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_META_H #define __LINUX_TC_EM_META_H #include <linux/types.h> #include <linux/pkt_cls.h> enum { TCA_EM_META_UNSPEC, TCA_EM_META_HDR, TCA_EM_META_LVALUE, TCA_EM_META_RVALUE, __TCA_EM_META_MAX }; #define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) struct tcf_meta_val { __u16 kind; __u8 shift; __u8 op; }; #define TCF_META_TYPE_MASK (0xf << 12) #define TCF_META_TYPE(kind) (((kind) & TCF_META_TYPE_MASK) >> 12) #define TCF_META_ID_MASK 0x7ff #define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) enum { TCF_META_TYPE_VAR, TCF_META_TYPE_INT, __TCF_META_TYPE_MAX }; #define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) enum { TCF_META_ID_VALUE, TCF_META_ID_RANDOM, TCF_META_ID_LOADAVG_0, TCF_META_ID_LOADAVG_1, TCF_META_ID_LOADAVG_2, TCF_META_ID_DEV, TCF_META_ID_PRIORITY, TCF_META_ID_PROTOCOL, TCF_META_ID_PKTTYPE, TCF_META_ID_PKTLEN, TCF_META_ID_DATALEN, TCF_META_ID_MACLEN, TCF_META_ID_NFMARK, TCF_META_ID_TCINDEX, TCF_META_ID_RTCLASSID, TCF_META_ID_RTIIF, TCF_META_ID_SK_FAMILY, TCF_META_ID_SK_STATE, TCF_META_ID_SK_REUSE, TCF_META_ID_SK_BOUND_IF, TCF_META_ID_SK_REFCNT, TCF_META_ID_SK_SHUTDOWN, TCF_META_ID_SK_PROTO, TCF_META_ID_SK_TYPE, TCF_META_ID_SK_RCVBUF, TCF_META_ID_SK_RMEM_ALLOC, TCF_META_ID_SK_WMEM_ALLOC, TCF_META_ID_SK_OMEM_ALLOC, TCF_META_ID_SK_WMEM_QUEUED, TCF_META_ID_SK_RCV_QLEN, TCF_META_ID_SK_SND_QLEN, TCF_META_ID_SK_ERR_QLEN, TCF_META_ID_SK_FORWARD_ALLOCS, TCF_META_ID_SK_SNDBUF, TCF_META_ID_SK_ALLOCS, __TCF_META_ID_SK_ROUTE_CAPS, /* unimplemented but in ABI already */ TCF_META_ID_SK_HASH, TCF_META_ID_SK_LINGERTIME, TCF_META_ID_SK_ACK_BACKLOG, TCF_META_ID_SK_MAX_ACK_BACKLOG, TCF_META_ID_SK_PRIO, TCF_META_ID_SK_RCVLOWAT, TCF_META_ID_SK_RCVTIMEO, TCF_META_ID_SK_SNDTIMEO, TCF_META_ID_SK_SENDMSG_OFF, TCF_META_ID_SK_WRITE_PENDING, TCF_META_ID_VLAN_TAG, TCF_META_ID_RXHASH, __TCF_META_ID_MAX }; #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) struct tcf_meta_hdr { struct tcf_meta_val left; struct tcf_meta_val right; }; #endif linux/tc_ematch/tc_em_nbyte.h 0000644 00000000377 15063602055 0012304 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_NBYTE_H #define __LINUX_TC_EM_NBYTE_H #include <linux/types.h> #include <linux/pkt_cls.h> struct tcf_em_nbyte { __u16 off; __u16 len:12; __u8 layer:4; }; #endif linux/tc_ematch/tc_em_text.h 0000644 00000000600 15063602055 0012134 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_TC_EM_TEXT_H #define __LINUX_TC_EM_TEXT_H #include <linux/types.h> #include <linux/pkt_cls.h> #define TC_EM_TEXT_ALGOSIZ 16 struct tcf_em_text { char algo[TC_EM_TEXT_ALGOSIZ]; __u16 from_offset; __u16 to_offset; __u16 pattern_len; __u8 from_layer:4; __u8 to_layer:4; __u8 pad; }; #endif linux/time.h 0000644 00000003324 15063602055 0007016 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TIME_H #define _LINUX_TIME_H #include <linux/types.h> #include <linux/time_types.h> #ifndef _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC struct timespec { __kernel_time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; #endif struct timeval { __kernel_time_t tv_sec; /* seconds */ __kernel_suseconds_t tv_usec; /* microseconds */ }; struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ int tz_dsttime; /* type of dst correction */ }; /* * Names of the interval timers, and structure * defining a timer setting: */ #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 struct itimerspec { struct timespec it_interval; /* timer period */ struct timespec it_value; /* timer expiration */ }; struct itimerval { struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */ }; /* * The IDs of the various system clocks (for POSIX.1b interval timers): */ #define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 1 #define CLOCK_PROCESS_CPUTIME_ID 2 #define CLOCK_THREAD_CPUTIME_ID 3 #define CLOCK_MONOTONIC_RAW 4 #define CLOCK_REALTIME_COARSE 5 #define CLOCK_MONOTONIC_COARSE 6 #define CLOCK_BOOTTIME 7 #define CLOCK_REALTIME_ALARM 8 #define CLOCK_BOOTTIME_ALARM 9 /* * The driver implementing this got removed. The clock ID is kept as a * place holder. Do not reuse! */ #define CLOCK_SGI_CYCLE 10 #define CLOCK_TAI 11 #define MAX_CLOCKS 16 #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) #define CLOCKS_MONO CLOCK_MONOTONIC /* * The various flags for setting POSIX.1b interval timers: */ #define TIMER_ABSTIME 0x01 #endif /* _LINUX_TIME_H */ linux/time_types.h 0000644 00000002227 15063602055 0010243 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TIME_TYPES_H #define _LINUX_TIME_TYPES_H #include <linux/types.h> #ifndef __kernel_timespec struct __kernel_timespec { __kernel_time64_t tv_sec; /* seconds */ long long tv_nsec; /* nanoseconds */ }; #endif #ifndef __kernel_itimerspec struct __kernel_itimerspec { struct __kernel_timespec it_interval; /* timer period */ struct __kernel_timespec it_value; /* timer expiration */ }; #endif /* * legacy timeval structure, only embedded in structures that * traditionally used 'timeval' to pass time intervals (not absolute * times). Do not add new users. If user space fails to compile * here, this is probably because it is not y2038 safe and needs to * be changed to use another interface. */ #ifndef __kernel_old_timeval struct __kernel_old_timeval { __kernel_long_t tv_sec; __kernel_long_t tv_usec; }; #endif struct __kernel_old_timespec { __kernel_time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; struct __kernel_sock_timeval { __s64 tv_sec; __s64 tv_usec; }; #endif /* _LINUX_TIME_TYPES_H */ linux/timerfd.h 0000644 00000001650 15063602055 0007512 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/timerfd.h * * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> * */ #ifndef _LINUX_TIMERFD_H #define _LINUX_TIMERFD_H #include <linux/types.h> /* For O_CLOEXEC and O_NONBLOCK */ #include <linux/fcntl.h> /* For _IO helpers */ #include <linux/ioctl.h> /* * CAREFUL: Check include/asm-generic/fcntl.h when defining * new flags, since they might collide with O_* ones. We want * to re-use O_* flags that couldn't possibly have a meaning * from eventfd, in order to leave a free define-space for * shared O_* flags. * * Also make sure to update the masks in include/linux/timerfd.h * when adding new flags. */ #define TFD_TIMER_ABSTIME (1 << 0) #define TFD_TIMER_CANCEL_ON_SET (1 << 1) #define TFD_CLOEXEC O_CLOEXEC #define TFD_NONBLOCK O_NONBLOCK #define TFD_IOC_SET_TICKS _IOW('T', 0, __u64) #endif /* _LINUX_TIMERFD_H */ linux/times.h 0000644 00000000426 15063602055 0007201 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TIMES_H #define _LINUX_TIMES_H #include <linux/types.h> struct tms { __kernel_clock_t tms_utime; __kernel_clock_t tms_stime; __kernel_clock_t tms_cutime; __kernel_clock_t tms_cstime; }; #endif linux/timex.h 0000644 00000014403 15063602055 0007206 0 ustar 00 /***************************************************************************** * * * Copyright (c) David L. Mills 1993 * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * * that the above copyright notice appears in all copies and that both the * * copyright notice and this permission notice appear in supporting * * documentation, and that the name University of Delaware not be used in * * advertising or publicity pertaining to distribution of the software * * without specific, written prior permission. The University of Delaware * * makes no representations about the suitability this software for any * * purpose. It is provided "as is" without express or implied warranty. * * * *****************************************************************************/ /* * Modification history timex.h * * 29 Dec 97 Russell King * Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h * for ARM machines * * 9 Jan 97 Adrian Sun * Shifted LATCH define to allow access to alpha machines. * * 26 Sep 94 David L. Mills * Added defines for hybrid phase/frequency-lock loop. * * 19 Mar 94 David L. Mills * Moved defines from kernel routines to header file and added new * defines for PPS phase-lock loop. * * 20 Feb 94 David L. Mills * Revised status codes and structures for external clock and PPS * signal discipline. * * 28 Nov 93 David L. Mills * Adjusted parameters to improve stability and increase poll * interval. * * 17 Sep 93 David L. Mills * Created file $NTP/include/sys/timex.h * 07 Oct 93 Torsten Duwe * Derived linux/timex.h * 1995-08-13 Torsten Duwe * kernel PLL updated to 1994-12-13 specs (rfc-1589) * 1997-08-30 Ulrich Windl * Added new constant NTP_PHASE_LIMIT * 2004-08-12 Christoph Lameter * Reworked time interpolation logic */ #ifndef _LINUX_TIMEX_H #define _LINUX_TIMEX_H #include <linux/time.h> #define NTP_API 4 /* NTP API version */ /* * syscall interface - used (mainly by NTP daemon) * to discipline kernel clock oscillator */ struct timex { unsigned int modes; /* mode selector */ __kernel_long_t offset; /* time offset (usec) */ __kernel_long_t freq; /* frequency offset (scaled ppm) */ __kernel_long_t maxerror;/* maximum error (usec) */ __kernel_long_t esterror;/* estimated error (usec) */ int status; /* clock command/status */ __kernel_long_t constant;/* pll time constant */ __kernel_long_t precision;/* clock precision (usec) (read only) */ __kernel_long_t tolerance;/* clock frequency tolerance (ppm) * (read only) */ struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ __kernel_long_t tick; /* (modified) usecs between clock ticks */ __kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */ __kernel_long_t jitter; /* pps jitter (us) (ro) */ int shift; /* interval duration (s) (shift) (ro) */ __kernel_long_t stabil; /* pps stability (scaled ppm) (ro) */ __kernel_long_t jitcnt; /* jitter limit exceeded (ro) */ __kernel_long_t calcnt; /* calibration intervals (ro) */ __kernel_long_t errcnt; /* calibration errors (ro) */ __kernel_long_t stbcnt; /* stability limit exceeded (ro) */ int tai; /* TAI offset (ro) */ int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; /* * Mode codes (timex.mode) */ #define ADJ_OFFSET 0x0001 /* time offset */ #define ADJ_FREQUENCY 0x0002 /* frequency offset */ #define ADJ_MAXERROR 0x0004 /* maximum time error */ #define ADJ_ESTERROR 0x0008 /* estimated time error */ #define ADJ_STATUS 0x0010 /* clock status */ #define ADJ_TIMECONST 0x0020 /* pll time constant */ #define ADJ_TAI 0x0080 /* set TAI offset */ #define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ #define ADJ_MICRO 0x1000 /* select microsecond resolution */ #define ADJ_NANO 0x2000 /* select nanosecond resolution */ #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ /* NTP userland likes the MOD_ prefix better */ #define MOD_OFFSET ADJ_OFFSET #define MOD_FREQUENCY ADJ_FREQUENCY #define MOD_MAXERROR ADJ_MAXERROR #define MOD_ESTERROR ADJ_ESTERROR #define MOD_STATUS ADJ_STATUS #define MOD_TIMECONST ADJ_TIMECONST #define MOD_TAI ADJ_TAI #define MOD_MICRO ADJ_MICRO #define MOD_NANO ADJ_NANO /* * Status codes (timex.status) */ #define STA_PLL 0x0001 /* enable PLL updates (rw) */ #define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ #define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ #define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ #define STA_INS 0x0010 /* insert leap (rw) */ #define STA_DEL 0x0020 /* delete leap (rw) */ #define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ #define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ #define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ #define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ #define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ /* read-only bits */ #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) /* * Clock states (time_state) */ #define TIME_OK 0 /* clock synchronized, no leap second */ #define TIME_INS 1 /* insert leap second */ #define TIME_DEL 2 /* delete leap second */ #define TIME_OOP 3 /* leap second in progress */ #define TIME_WAIT 4 /* leap second has occurred */ #define TIME_ERROR 5 /* clock not synchronized */ #define TIME_BAD TIME_ERROR /* bw compat */ #endif /* _LINUX_TIMEX_H */ linux/tiocl.h 0000644 00000003301 15063602055 0007165 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TIOCL_H #define _LINUX_TIOCL_H #define TIOCL_SETSEL 2 /* set a selection */ #define TIOCL_SELCHAR 0 /* select characters */ #define TIOCL_SELWORD 1 /* select whole words */ #define TIOCL_SELLINE 2 /* select whole lines */ #define TIOCL_SELPOINTER 3 /* show the pointer */ #define TIOCL_SELCLEAR 4 /* clear visibility of selection */ #define TIOCL_SELMOUSEREPORT 16 /* report beginning of selection */ #define TIOCL_SELBUTTONMASK 15 /* button mask for report */ /* selection extent */ struct tiocl_selection { unsigned short xs; /* X start */ unsigned short ys; /* Y start */ unsigned short xe; /* X end */ unsigned short ye; /* Y end */ unsigned short sel_mode; /* selection mode */ }; #define TIOCL_PASTESEL 3 /* paste previous selection */ #define TIOCL_UNBLANKSCREEN 4 /* unblank screen */ #define TIOCL_SELLOADLUT 5 /* set characters to be considered alphabetic when selecting */ /* u32[8] bit array, 4 bytes-aligned with type */ /* these two don't return a value: they write it back in the type */ #define TIOCL_GETSHIFTSTATE 6 /* write shift state */ #define TIOCL_GETMOUSEREPORTING 7 /* write whether mouse event are reported */ #define TIOCL_SETVESABLANK 10 /* set vesa blanking mode */ #define TIOCL_SETKMSGREDIRECT 11 /* restrict kernel messages to a vt */ #define TIOCL_GETFGCONSOLE 12 /* get foreground vt */ #define TIOCL_SCROLLCONSOLE 13 /* scroll console */ #define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */ #define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */ #define TIOCL_GETKMSGREDIRECT 17 /* get the vt the kernel messages are restricted to */ #endif /* _LINUX_TIOCL_H */ linux/tipc.h 0000644 00000021171 15063602055 0007017 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * include/uapi/linux/tipc.h: Header for TIPC socket interface * * Copyright (c) 2003-2006, 2015-2016 Ericsson AB * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIPC_H_ #define _LINUX_TIPC_H_ #include <linux/types.h> #include <linux/sockios.h> /* * TIPC addressing primitives */ struct tipc_socket_addr { __u32 ref; __u32 node; }; struct tipc_service_addr { __u32 type; __u32 instance; }; struct tipc_service_range { __u32 type; __u32 lower; __u32 upper; }; /* * Application-accessible service types */ #define TIPC_NODE_STATE 0 /* node state service type */ #define TIPC_TOP_SRV 1 /* topology server service type */ #define TIPC_LINK_STATE 2 /* link state service type */ #define TIPC_RESERVED_TYPES 64 /* lowest user-allowed service type */ /* * Publication scopes when binding service / service range */ enum tipc_scope { TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */ TIPC_NODE_SCOPE = 3 }; /* * Limiting values for messages */ #define TIPC_MAX_USER_MSG_SIZE 66000U /* * Message importance levels */ #define TIPC_LOW_IMPORTANCE 0 #define TIPC_MEDIUM_IMPORTANCE 1 #define TIPC_HIGH_IMPORTANCE 2 #define TIPC_CRITICAL_IMPORTANCE 3 /* * Msg rejection/connection shutdown reasons */ #define TIPC_OK 0 #define TIPC_ERR_NO_NAME 1 #define TIPC_ERR_NO_PORT 2 #define TIPC_ERR_NO_NODE 3 #define TIPC_ERR_OVERLOAD 4 #define TIPC_CONN_SHUTDOWN 5 /* * TIPC topology subscription service definitions */ #define TIPC_SUB_PORTS 0x01 /* filter: evt at each match */ #define TIPC_SUB_SERVICE 0x02 /* filter: evt at first up/last down */ #define TIPC_SUB_CANCEL 0x04 /* filter: cancel a subscription */ #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ struct tipc_subscr { struct tipc_service_range seq; /* range of interest */ __u32 timeout; /* subscription duration (in ms) */ __u32 filter; /* bitmask of filter options */ char usr_handle[8]; /* available for subscriber use */ }; #define TIPC_PUBLISHED 1 /* publication event */ #define TIPC_WITHDRAWN 2 /* withdrawal event */ #define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ struct tipc_event { __u32 event; /* event type */ __u32 found_lower; /* matching range */ __u32 found_upper; /* " " */ struct tipc_socket_addr port; /* associated socket */ struct tipc_subscr s; /* associated subscription */ }; /* * Socket API */ #ifndef AF_TIPC #define AF_TIPC 30 #endif #ifndef PF_TIPC #define PF_TIPC AF_TIPC #endif #ifndef SOL_TIPC #define SOL_TIPC 271 #endif #define TIPC_ADDR_MCAST 1 #define TIPC_SERVICE_RANGE 1 #define TIPC_SERVICE_ADDR 2 #define TIPC_SOCKET_ADDR 3 struct sockaddr_tipc { unsigned short family; unsigned char addrtype; signed char scope; union { struct tipc_socket_addr id; struct tipc_service_range nameseq; struct { struct tipc_service_addr name; __u32 domain; } name; } addr; }; /* * Ancillary data objects supported by recvmsg() */ #define TIPC_ERRINFO 1 /* error info */ #define TIPC_RETDATA 2 /* returned data */ #define TIPC_DESTNAME 3 /* destination name */ /* * TIPC-specific socket option names */ #define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ #define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */ #define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ #define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ #define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ #define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */ #define TIPC_MCAST_BROADCAST 133 /* Default: TIPC selects. No arg */ #define TIPC_MCAST_REPLICAST 134 /* Default: TIPC selects. No arg */ #define TIPC_GROUP_JOIN 135 /* Takes struct tipc_group_req* */ #define TIPC_GROUP_LEAVE 136 /* No argument */ #define TIPC_SOCK_RECVQ_USED 137 /* Default: none (read only) */ #define TIPC_NODELAY 138 /* Default: false */ /* * Flag values */ #define TIPC_GROUP_LOOPBACK 0x1 /* Receive copy of sent msg when match */ #define TIPC_GROUP_MEMBER_EVTS 0x2 /* Receive membership events in socket */ struct tipc_group_req { __u32 type; /* group id */ __u32 instance; /* member id */ __u32 scope; /* cluster/node */ __u32 flags; }; /* * Maximum sizes of TIPC bearer-related names (including terminating NULL) * The string formatting for each name element is: * media: media * interface: media:interface name * link: node:interface-node:interface */ #define TIPC_NODEID_LEN 16 #define TIPC_MAX_MEDIA_NAME 16 #define TIPC_MAX_IF_NAME 16 #define TIPC_MAX_BEARER_NAME 32 #define TIPC_MAX_LINK_NAME 68 #define SIOCGETLINKNAME SIOCPROTOPRIVATE #define SIOCGETNODEID (SIOCPROTOPRIVATE + 1) struct tipc_sioc_ln_req { __u32 peer; __u32 bearer_id; char linkname[TIPC_MAX_LINK_NAME]; }; struct tipc_sioc_nodeid_req { __u32 peer; char node_id[TIPC_NODEID_LEN]; }; /* * TIPC Crypto, AEAD */ #define TIPC_AEAD_ALG_NAME (32) struct tipc_aead_key { char alg_name[TIPC_AEAD_ALG_NAME]; unsigned int keylen; /* in bytes */ char key[]; }; #define TIPC_AEAD_KEYLEN_MIN (16 + 4) #define TIPC_AEAD_KEYLEN_MAX (32 + 4) #define TIPC_AEAD_KEY_SIZE_MAX (sizeof(struct tipc_aead_key) + \ TIPC_AEAD_KEYLEN_MAX) static __inline__ int tipc_aead_key_size(struct tipc_aead_key *key) { return sizeof(*key) + key->keylen; } #define TIPC_REKEYING_NOW (~0U) /* The macros and functions below are deprecated: */ #define TIPC_CFG_SRV 0 #define TIPC_ZONE_SCOPE 1 #define TIPC_ADDR_NAMESEQ 1 #define TIPC_ADDR_NAME 2 #define TIPC_ADDR_ID 3 #define TIPC_NODE_BITS 12 #define TIPC_CLUSTER_BITS 12 #define TIPC_ZONE_BITS 8 #define TIPC_NODE_OFFSET 0 #define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS #define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS) #define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1) #define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1) #define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1) #define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET) #define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET) #define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET) #define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK) #define tipc_portid tipc_socket_addr #define tipc_name tipc_service_addr #define tipc_name_seq tipc_service_range static __inline__ __u32 tipc_addr(unsigned int zone, unsigned int cluster, unsigned int node) { return (zone << TIPC_ZONE_OFFSET) | (cluster << TIPC_CLUSTER_OFFSET) | node; } static __inline__ unsigned int tipc_zone(__u32 addr) { return addr >> TIPC_ZONE_OFFSET; } static __inline__ unsigned int tipc_cluster(__u32 addr) { return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET; } static __inline__ unsigned int tipc_node(__u32 addr) { return addr & TIPC_NODE_MASK; } #endif linux/tipc_config.h 0000644 00000034564 15063602055 0010356 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * include/uapi/linux/tipc_config.h: Header for TIPC configuration interface * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005-2007, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIPC_CONFIG_H_ #define _LINUX_TIPC_CONFIG_H_ #include <linux/types.h> #include <linux/string.h> #include <linux/tipc.h> #include <asm/byteorder.h> #include <arpa/inet.h> /* for ntohs etc. */ /* * Configuration * * All configuration management messaging involves sending a request message * to the TIPC configuration service on a node, which sends a reply message * back. (In the future multi-message replies may be supported.) * * Both request and reply messages consist of a transport header and payload. * The transport header contains info about the desired operation; * the payload consists of zero or more type/length/value (TLV) items * which specify parameters or results for the operation. * * For many operations, the request and reply messages have a fixed number * of TLVs (usually zero or one); however, some reply messages may return * a variable number of TLVs. A failed request is denoted by the presence * of an "error string" TLV in the reply message instead of the TLV(s) the * reply should contain if the request succeeds. */ /* * Public commands: * May be issued by any process. * Accepted by own node, or by remote node only if remote management enabled. */ #define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */ #define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */ #define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */ #define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */ #define TIPC_CMD_GET_LINKS 0x0004 /* tx net_addr, rx link_info(s) */ #define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ #define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ /* * Protected commands: * May only be issued by "network administration capable" process. * Accepted by own node, or by remote node only if remote management enabled * and this node is zone manager. */ #define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PUBL 0x4005 /* obsoleted */ #define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* obsoleted */ #define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ #define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ #define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ #define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ #define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */ #define TIPC_CMD_DISABLE_BEARER 0x4102 /* tx bearer_name, rx none */ #define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */ #define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */ #define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */ #define TIPC_CMD_SET_LOG_SIZE 0x410A /* obsoleted */ #define TIPC_CMD_DUMP_LOG 0x410B /* obsoleted */ #define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ /* * Private commands: * May only be issued by "network administration capable" process. * Accepted by own node only; cannot be used on a remote node. */ #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* obsoleted */ #define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* obsoleted */ #define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ #define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ #define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ /* * Reserved commands: * May not be issued by any process. * Used internally by TIPC. */ #define TIPC_CMD_NOT_NET_ADMIN 0xC001 /* tx none, rx none */ /* * TLV types defined for TIPC */ #define TIPC_TLV_NONE 0 /* no TLV present */ #define TIPC_TLV_VOID 1 /* empty TLV (0 data bytes)*/ #define TIPC_TLV_UNSIGNED 2 /* 32-bit integer */ #define TIPC_TLV_STRING 3 /* char[128] (max) */ #define TIPC_TLV_LARGE_STRING 4 /* char[2048] (max) */ #define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */ #define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */ #define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */ #define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */ #define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */ #define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */ #define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */ #define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */ #define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */ #define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */ #define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */ #define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */ /* * Link priority limits (min, default, max, media default) */ #define TIPC_MIN_LINK_PRI 0 #define TIPC_DEF_LINK_PRI 10 #define TIPC_MAX_LINK_PRI 31 #define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1) /* * Link tolerance limits (min, default, max), in ms */ #define TIPC_MIN_LINK_TOL 50 #define TIPC_DEF_LINK_TOL 1500 #define TIPC_MAX_LINK_TOL 30000 #if (TIPC_MIN_LINK_TOL < 16) #error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)" #endif /* * Link window limits (min, default, max), in packets */ #define TIPC_MIN_LINK_WIN 16 #define TIPC_DEF_LINK_WIN 50 #define TIPC_MAX_LINK_WIN 8191 /* * Default MTU for UDP media */ #define TIPC_DEF_LINK_UDP_MTU 14000 struct tipc_node_info { __be32 addr; /* network address of node */ __be32 up; /* 0=down, 1= up */ }; struct tipc_link_info { __be32 dest; /* network address of peer node */ __be32 up; /* 0=down, 1=up */ char str[TIPC_MAX_LINK_NAME]; /* link name */ }; struct tipc_bearer_config { __be32 priority; /* Range [1,31]. Override per link */ __be32 disc_domain; /* <Z.C.N> describing desired nodes */ char name[TIPC_MAX_BEARER_NAME]; }; struct tipc_link_config { __be32 value; char name[TIPC_MAX_LINK_NAME]; }; #define TIPC_NTQ_ALLTYPES 0x80000000 struct tipc_name_table_query { __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ __be32 lowbound; /* (i.e. displays all entries of name table) */ __be32 upbound; }; /* * The error string TLV is a null-terminated string describing the cause * of the request failure. To simplify error processing (and to save space) * the first character of the string can be a special error code character * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason. */ #define TIPC_CFG_TLV_ERROR "\x80" /* request contains incorrect TLV(s) */ #define TIPC_CFG_NOT_NET_ADMIN "\x81" /* must be network administrator */ #define TIPC_CFG_NOT_ZONE_MSTR "\x82" /* must be zone master */ #define TIPC_CFG_NO_REMOTE "\x83" /* remote management not enabled */ #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ #define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ /* * A TLV consists of a descriptor, followed by the TLV value. * TLV descriptor fields are stored in network byte order; * TLV values must also be stored in network byte order (where applicable). * TLV descriptors must be aligned to addresses which are multiple of 4, * so up to 3 bytes of padding may exist at the end of the TLV value area. * There must not be any padding between the TLV descriptor and its value. */ struct tlv_desc { __be16 tlv_len; /* TLV length (descriptor + value) */ __be16 tlv_type; /* TLV identifier */ }; #define TLV_ALIGNTO 4 #define TLV_ALIGN(datalen) (((datalen)+(TLV_ALIGNTO-1)) & ~(TLV_ALIGNTO-1)) #define TLV_LENGTH(datalen) (sizeof(struct tlv_desc) + (datalen)) #define TLV_SPACE(datalen) (TLV_ALIGN(TLV_LENGTH(datalen))) #define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0))) static __inline__ int TLV_OK(const void *tlv, __u16 space) { /* * Would also like to check that "tlv" is a multiple of 4, * but don't know how to do this in a portable way. * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler * won't allow binary "&" with a pointer. * - Tried casting "tlv" to integer type, but causes warning about size * mismatch when pointer is bigger than chosen type (int, long, ...). */ return (space >= TLV_SPACE(0)) && (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space); } static __inline__ int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type) { return TLV_OK(tlv, space) && (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type); } static __inline__ int TLV_GET_LEN(struct tlv_desc *tlv) { return ntohs(tlv->tlv_len); } static __inline__ void TLV_SET_LEN(struct tlv_desc *tlv, __u16 len) { tlv->tlv_len = htons(len); } static __inline__ int TLV_CHECK_TYPE(struct tlv_desc *tlv, __u16 type) { return (ntohs(tlv->tlv_type) == type); } static __inline__ void TLV_SET_TYPE(struct tlv_desc *tlv, __u16 type) { tlv->tlv_type = htons(type); } static __inline__ int TLV_SET(void *tlv, __u16 type, void *data, __u16 len) { struct tlv_desc *tlv_ptr; int tlv_len; tlv_len = TLV_LENGTH(len); tlv_ptr = (struct tlv_desc *)tlv; tlv_ptr->tlv_type = htons(type); tlv_ptr->tlv_len = htons(tlv_len); if (len && data) memcpy(TLV_DATA(tlv_ptr), data, tlv_len); return TLV_SPACE(len); } /* * A TLV list descriptor simplifies processing of messages * containing multiple TLVs. */ struct tlv_list_desc { struct tlv_desc *tlv_ptr; /* ptr to current TLV */ __u32 tlv_space; /* # bytes from curr TLV to list end */ }; static __inline__ void TLV_LIST_INIT(struct tlv_list_desc *list, void *data, __u32 space) { list->tlv_ptr = (struct tlv_desc *)data; list->tlv_space = space; } static __inline__ int TLV_LIST_EMPTY(struct tlv_list_desc *list) { return (list->tlv_space == 0); } static __inline__ int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type) { return TLV_CHECK(list->tlv_ptr, list->tlv_space, exp_type); } static __inline__ void *TLV_LIST_DATA(struct tlv_list_desc *list) { return TLV_DATA(list->tlv_ptr); } static __inline__ void TLV_LIST_STEP(struct tlv_list_desc *list) { __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len)); list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space); list->tlv_space -= tlv_space; } /* * Configuration messages exchanged via NETLINK_GENERIC use the following * family id, name, version and command. */ #define TIPC_GENL_NAME "TIPC" #define TIPC_GENL_VERSION 0x1 #define TIPC_GENL_CMD 0x1 /* * TIPC specific header used in NETLINK_GENERIC requests. */ struct tipc_genlmsghdr { __u32 dest; /* Destination address */ __u16 cmd; /* Command */ __u16 reserved; /* Unused */ }; #define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr)) /* * Configuration messages exchanged via TIPC sockets use the TIPC configuration * message header, which is defined below. This structure is analogous * to the Netlink message header, but fields are stored in network byte order * and no padding is permitted between the header and the message data * that follows. */ struct tipc_cfg_msg_hdr { __be32 tcm_len; /* Message length (including header) */ __be16 tcm_type; /* Command type */ __be16 tcm_flags; /* Additional flags */ char tcm_reserved[8]; /* Unused */ }; #define TCM_F_REQUEST 0x1 /* Flag: Request message */ #define TCM_F_MORE 0x2 /* Flag: Message to be continued */ #define TCM_ALIGN(datalen) (((datalen)+3) & ~3) #define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen) #define TCM_SPACE(datalen) (TCM_ALIGN(TCM_LENGTH(datalen))) #define TCM_DATA(tcm_hdr) ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0))) static __inline__ int TCM_SET(void *msg, __u16 cmd, __u16 flags, void *data, __u16 data_len) { struct tipc_cfg_msg_hdr *tcm_hdr; int msg_len; msg_len = TCM_LENGTH(data_len); tcm_hdr = (struct tipc_cfg_msg_hdr *)msg; tcm_hdr->tcm_len = htonl(msg_len); tcm_hdr->tcm_type = htons(cmd); tcm_hdr->tcm_flags = htons(flags); if (data_len && data) memcpy(TCM_DATA(msg), data, data_len); return TCM_SPACE(data_len); } #endif linux/tipc_netlink.h 0000644 00000022263 15063602055 0010546 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Copyright (c) 2014, Ericsson AB * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIPC_NETLINK_H_ #define _LINUX_TIPC_NETLINK_H_ #define TIPC_GENL_V2_NAME "TIPCv2" #define TIPC_GENL_V2_VERSION 0x1 /* Netlink commands */ enum { TIPC_NL_UNSPEC, TIPC_NL_LEGACY, TIPC_NL_BEARER_DISABLE, TIPC_NL_BEARER_ENABLE, TIPC_NL_BEARER_GET, TIPC_NL_BEARER_SET, TIPC_NL_SOCK_GET, TIPC_NL_PUBL_GET, TIPC_NL_LINK_GET, TIPC_NL_LINK_SET, TIPC_NL_LINK_RESET_STATS, TIPC_NL_MEDIA_GET, TIPC_NL_MEDIA_SET, TIPC_NL_NODE_GET, TIPC_NL_NET_GET, TIPC_NL_NET_SET, TIPC_NL_NAME_TABLE_GET, TIPC_NL_MON_SET, TIPC_NL_MON_GET, TIPC_NL_MON_PEER_GET, TIPC_NL_PEER_REMOVE, TIPC_NL_BEARER_ADD, TIPC_NL_UDP_GET_REMOTEIP, TIPC_NL_KEY_SET, TIPC_NL_KEY_FLUSH, TIPC_NL_ADDR_LEGACY_GET, __TIPC_NL_CMD_MAX, TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1 }; /* Top level netlink attributes */ enum { TIPC_NLA_UNSPEC, TIPC_NLA_BEARER, /* nest */ TIPC_NLA_SOCK, /* nest */ TIPC_NLA_PUBL, /* nest */ TIPC_NLA_LINK, /* nest */ TIPC_NLA_MEDIA, /* nest */ TIPC_NLA_NODE, /* nest */ TIPC_NLA_NET, /* nest */ TIPC_NLA_NAME_TABLE, /* nest */ TIPC_NLA_MON, /* nest */ TIPC_NLA_MON_PEER, /* nest */ __TIPC_NLA_MAX, TIPC_NLA_MAX = __TIPC_NLA_MAX - 1 }; /* Bearer info */ enum { TIPC_NLA_BEARER_UNSPEC, TIPC_NLA_BEARER_NAME, /* string */ TIPC_NLA_BEARER_PROP, /* nest */ TIPC_NLA_BEARER_DOMAIN, /* u32 */ TIPC_NLA_BEARER_UDP_OPTS, /* nest */ __TIPC_NLA_BEARER_MAX, TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1 }; enum { TIPC_NLA_UDP_UNSPEC, TIPC_NLA_UDP_LOCAL, /* sockaddr_storage */ TIPC_NLA_UDP_REMOTE, /* sockaddr_storage */ TIPC_NLA_UDP_MULTI_REMOTEIP, /* flag */ __TIPC_NLA_UDP_MAX, TIPC_NLA_UDP_MAX = __TIPC_NLA_UDP_MAX - 1 }; /* Socket info */ enum { TIPC_NLA_SOCK_UNSPEC, TIPC_NLA_SOCK_ADDR, /* u32 */ TIPC_NLA_SOCK_REF, /* u32 */ TIPC_NLA_SOCK_CON, /* nest */ TIPC_NLA_SOCK_HAS_PUBL, /* flag */ TIPC_NLA_SOCK_STAT, /* nest */ TIPC_NLA_SOCK_TYPE, /* u32 */ TIPC_NLA_SOCK_INO, /* u32 */ TIPC_NLA_SOCK_UID, /* u32 */ TIPC_NLA_SOCK_TIPC_STATE, /* u32 */ TIPC_NLA_SOCK_COOKIE, /* u64 */ TIPC_NLA_SOCK_PAD, /* flag */ TIPC_NLA_SOCK_GROUP, /* nest */ __TIPC_NLA_SOCK_MAX, TIPC_NLA_SOCK_MAX = __TIPC_NLA_SOCK_MAX - 1 }; /* Link info */ enum { TIPC_NLA_LINK_UNSPEC, TIPC_NLA_LINK_NAME, /* string */ TIPC_NLA_LINK_DEST, /* u32 */ TIPC_NLA_LINK_MTU, /* u32 */ TIPC_NLA_LINK_BROADCAST, /* flag */ TIPC_NLA_LINK_UP, /* flag */ TIPC_NLA_LINK_ACTIVE, /* flag */ TIPC_NLA_LINK_PROP, /* nest */ TIPC_NLA_LINK_STATS, /* nest */ TIPC_NLA_LINK_RX, /* u32 */ TIPC_NLA_LINK_TX, /* u32 */ __TIPC_NLA_LINK_MAX, TIPC_NLA_LINK_MAX = __TIPC_NLA_LINK_MAX - 1 }; /* Media info */ enum { TIPC_NLA_MEDIA_UNSPEC, TIPC_NLA_MEDIA_NAME, /* string */ TIPC_NLA_MEDIA_PROP, /* nest */ __TIPC_NLA_MEDIA_MAX, TIPC_NLA_MEDIA_MAX = __TIPC_NLA_MEDIA_MAX - 1 }; /* Node info */ enum { TIPC_NLA_NODE_UNSPEC, TIPC_NLA_NODE_ADDR, /* u32 */ TIPC_NLA_NODE_UP, /* flag */ TIPC_NLA_NODE_ID, /* data */ TIPC_NLA_NODE_KEY, /* data */ TIPC_NLA_NODE_KEY_MASTER, /* flag */ TIPC_NLA_NODE_REKEYING, /* u32 */ __TIPC_NLA_NODE_MAX, TIPC_NLA_NODE_MAX = __TIPC_NLA_NODE_MAX - 1 }; /* Net info */ enum { TIPC_NLA_NET_UNSPEC, TIPC_NLA_NET_ID, /* u32 */ TIPC_NLA_NET_ADDR, /* u32 */ TIPC_NLA_NET_NODEID, /* u64 */ TIPC_NLA_NET_NODEID_W1, /* u64 */ TIPC_NLA_NET_ADDR_LEGACY, /* flag */ __TIPC_NLA_NET_MAX, TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1 }; /* Name table info */ enum { TIPC_NLA_NAME_TABLE_UNSPEC, TIPC_NLA_NAME_TABLE_PUBL, /* nest */ __TIPC_NLA_NAME_TABLE_MAX, TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1 }; /* Monitor info */ enum { TIPC_NLA_MON_UNSPEC, TIPC_NLA_MON_ACTIVATION_THRESHOLD, /* u32 */ TIPC_NLA_MON_REF, /* u32 */ TIPC_NLA_MON_ACTIVE, /* flag */ TIPC_NLA_MON_BEARER_NAME, /* string */ TIPC_NLA_MON_PEERCNT, /* u32 */ TIPC_NLA_MON_LISTGEN, /* u32 */ __TIPC_NLA_MON_MAX, TIPC_NLA_MON_MAX = __TIPC_NLA_MON_MAX - 1 }; /* Publication info */ enum { TIPC_NLA_PUBL_UNSPEC, TIPC_NLA_PUBL_TYPE, /* u32 */ TIPC_NLA_PUBL_LOWER, /* u32 */ TIPC_NLA_PUBL_UPPER, /* u32 */ TIPC_NLA_PUBL_SCOPE, /* u32 */ TIPC_NLA_PUBL_NODE, /* u32 */ TIPC_NLA_PUBL_REF, /* u32 */ TIPC_NLA_PUBL_KEY, /* u32 */ __TIPC_NLA_PUBL_MAX, TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1 }; /* Monitor peer info */ enum { TIPC_NLA_MON_PEER_UNSPEC, TIPC_NLA_MON_PEER_ADDR, /* u32 */ TIPC_NLA_MON_PEER_DOMGEN, /* u32 */ TIPC_NLA_MON_PEER_APPLIED, /* u32 */ TIPC_NLA_MON_PEER_UPMAP, /* u64 */ TIPC_NLA_MON_PEER_MEMBERS, /* tlv */ TIPC_NLA_MON_PEER_UP, /* flag */ TIPC_NLA_MON_PEER_HEAD, /* flag */ TIPC_NLA_MON_PEER_LOCAL, /* flag */ TIPC_NLA_MON_PEER_PAD, /* flag */ __TIPC_NLA_MON_PEER_MAX, TIPC_NLA_MON_PEER_MAX = __TIPC_NLA_MON_PEER_MAX - 1 }; /* Nest, socket group info */ enum { TIPC_NLA_SOCK_GROUP_ID, /* u32 */ TIPC_NLA_SOCK_GROUP_OPEN, /* flag */ TIPC_NLA_SOCK_GROUP_NODE_SCOPE, /* flag */ TIPC_NLA_SOCK_GROUP_CLUSTER_SCOPE, /* flag */ TIPC_NLA_SOCK_GROUP_INSTANCE, /* u32 */ TIPC_NLA_SOCK_GROUP_BC_SEND_NEXT, /* u32 */ __TIPC_NLA_SOCK_GROUP_MAX, TIPC_NLA_SOCK_GROUP_MAX = __TIPC_NLA_SOCK_GROUP_MAX - 1 }; /* Nest, connection info */ enum { TIPC_NLA_CON_UNSPEC, TIPC_NLA_CON_FLAG, /* flag */ TIPC_NLA_CON_NODE, /* u32 */ TIPC_NLA_CON_SOCK, /* u32 */ TIPC_NLA_CON_TYPE, /* u32 */ TIPC_NLA_CON_INST, /* u32 */ __TIPC_NLA_CON_MAX, TIPC_NLA_CON_MAX = __TIPC_NLA_CON_MAX - 1 }; /* Nest, socket statistics info */ enum { TIPC_NLA_SOCK_STAT_RCVQ, /* u32 */ TIPC_NLA_SOCK_STAT_SENDQ, /* u32 */ TIPC_NLA_SOCK_STAT_LINK_CONG, /* flag */ TIPC_NLA_SOCK_STAT_CONN_CONG, /* flag */ TIPC_NLA_SOCK_STAT_DROP, /* u32 */ __TIPC_NLA_SOCK_STAT_MAX, TIPC_NLA_SOCK_STAT_MAX = __TIPC_NLA_SOCK_STAT_MAX - 1 }; /* Nest, link propreties. Valid for link, media and bearer */ enum { TIPC_NLA_PROP_UNSPEC, TIPC_NLA_PROP_PRIO, /* u32 */ TIPC_NLA_PROP_TOL, /* u32 */ TIPC_NLA_PROP_WIN, /* u32 */ TIPC_NLA_PROP_MTU, /* u32 */ TIPC_NLA_PROP_BROADCAST, /* u32 */ TIPC_NLA_PROP_BROADCAST_RATIO, /* u32 */ __TIPC_NLA_PROP_MAX, TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1 }; /* Nest, statistics info */ enum { TIPC_NLA_STATS_UNSPEC, TIPC_NLA_STATS_RX_INFO, /* u32 */ TIPC_NLA_STATS_RX_FRAGMENTS, /* u32 */ TIPC_NLA_STATS_RX_FRAGMENTED, /* u32 */ TIPC_NLA_STATS_RX_BUNDLES, /* u32 */ TIPC_NLA_STATS_RX_BUNDLED, /* u32 */ TIPC_NLA_STATS_TX_INFO, /* u32 */ TIPC_NLA_STATS_TX_FRAGMENTS, /* u32 */ TIPC_NLA_STATS_TX_FRAGMENTED, /* u32 */ TIPC_NLA_STATS_TX_BUNDLES, /* u32 */ TIPC_NLA_STATS_TX_BUNDLED, /* u32 */ TIPC_NLA_STATS_MSG_PROF_TOT, /* u32 */ TIPC_NLA_STATS_MSG_LEN_CNT, /* u32 */ TIPC_NLA_STATS_MSG_LEN_TOT, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P0, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P1, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P2, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P3, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P4, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P5, /* u32 */ TIPC_NLA_STATS_MSG_LEN_P6, /* u32 */ TIPC_NLA_STATS_RX_STATES, /* u32 */ TIPC_NLA_STATS_RX_PROBES, /* u32 */ TIPC_NLA_STATS_RX_NACKS, /* u32 */ TIPC_NLA_STATS_RX_DEFERRED, /* u32 */ TIPC_NLA_STATS_TX_STATES, /* u32 */ TIPC_NLA_STATS_TX_PROBES, /* u32 */ TIPC_NLA_STATS_TX_NACKS, /* u32 */ TIPC_NLA_STATS_TX_ACKS, /* u32 */ TIPC_NLA_STATS_RETRANSMITTED, /* u32 */ TIPC_NLA_STATS_DUPLICATES, /* u32 */ TIPC_NLA_STATS_LINK_CONGS, /* u32 */ TIPC_NLA_STATS_MAX_QUEUE, /* u32 */ TIPC_NLA_STATS_AVG_QUEUE, /* u32 */ __TIPC_NLA_STATS_MAX, TIPC_NLA_STATS_MAX = __TIPC_NLA_STATS_MAX - 1 }; #endif linux/tipc_sockets_diag.h 0000644 00000000724 15063602055 0011537 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* AF_TIPC sock_diag interface for querying open sockets */ #ifndef __TIPC_SOCKETS_DIAG_H__ #define __TIPC_SOCKETS_DIAG_H__ #include <linux/types.h> #include <linux/sock_diag.h> /* Request */ struct tipc_sock_diag_req { __u8 sdiag_family; /* must be AF_TIPC */ __u8 sdiag_protocol; /* must be 0 */ __u16 pad; /* must be 0 */ __u32 tidiag_states; /* query*/ }; #endif /* __TIPC_SOCKETS_DIAG_H__ */ linux/tls.h 0000644 00000010300 15063602055 0006652 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef _LINUX_TLS_H #define _LINUX_TLS_H #include <linux/types.h> /* TLS socket options */ #define TLS_TX 1 /* Set transmit parameters */ #define TLS_RX 2 /* Set receive parameters */ /* Supported versions */ #define TLS_VERSION_MINOR(ver) ((ver) & 0xFF) #define TLS_VERSION_MAJOR(ver) (((ver) >> 8) & 0xFF) #define TLS_VERSION_NUMBER(id) ((((id##_VERSION_MAJOR) & 0xFF) << 8) | \ ((id##_VERSION_MINOR) & 0xFF)) #define TLS_1_2_VERSION_MAJOR 0x3 #define TLS_1_2_VERSION_MINOR 0x3 #define TLS_1_2_VERSION TLS_VERSION_NUMBER(TLS_1_2) #define TLS_1_3_VERSION_MAJOR 0x3 #define TLS_1_3_VERSION_MINOR 0x4 #define TLS_1_3_VERSION TLS_VERSION_NUMBER(TLS_1_3) /* Supported ciphers */ #define TLS_CIPHER_AES_GCM_128 51 #define TLS_CIPHER_AES_GCM_128_IV_SIZE 8 #define TLS_CIPHER_AES_GCM_128_KEY_SIZE 16 #define TLS_CIPHER_AES_GCM_128_SALT_SIZE 4 #define TLS_CIPHER_AES_GCM_128_TAG_SIZE 16 #define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE 8 #define TLS_CIPHER_AES_GCM_256 52 #define TLS_CIPHER_AES_GCM_256_IV_SIZE 8 #define TLS_CIPHER_AES_GCM_256_KEY_SIZE 32 #define TLS_CIPHER_AES_GCM_256_SALT_SIZE 4 #define TLS_CIPHER_AES_GCM_256_TAG_SIZE 16 #define TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE 8 #define TLS_CIPHER_AES_CCM_128 53 #define TLS_CIPHER_AES_CCM_128_IV_SIZE 8 #define TLS_CIPHER_AES_CCM_128_KEY_SIZE 16 #define TLS_CIPHER_AES_CCM_128_SALT_SIZE 4 #define TLS_CIPHER_AES_CCM_128_TAG_SIZE 16 #define TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE 8 #define TLS_SET_RECORD_TYPE 1 #define TLS_GET_RECORD_TYPE 2 struct tls_crypto_info { __u16 version; __u16 cipher_type; }; struct tls12_crypto_info_aes_gcm_128 { struct tls_crypto_info info; unsigned char iv[TLS_CIPHER_AES_GCM_128_IV_SIZE]; unsigned char key[TLS_CIPHER_AES_GCM_128_KEY_SIZE]; unsigned char salt[TLS_CIPHER_AES_GCM_128_SALT_SIZE]; unsigned char rec_seq[TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE]; }; struct tls12_crypto_info_aes_gcm_256 { struct tls_crypto_info info; unsigned char iv[TLS_CIPHER_AES_GCM_256_IV_SIZE]; unsigned char key[TLS_CIPHER_AES_GCM_256_KEY_SIZE]; unsigned char salt[TLS_CIPHER_AES_GCM_256_SALT_SIZE]; unsigned char rec_seq[TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE]; }; struct tls12_crypto_info_aes_ccm_128 { struct tls_crypto_info info; unsigned char iv[TLS_CIPHER_AES_CCM_128_IV_SIZE]; unsigned char key[TLS_CIPHER_AES_CCM_128_KEY_SIZE]; unsigned char salt[TLS_CIPHER_AES_CCM_128_SALT_SIZE]; unsigned char rec_seq[TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE]; }; enum { TLS_INFO_UNSPEC, TLS_INFO_VERSION, TLS_INFO_CIPHER, TLS_INFO_TXCONF, TLS_INFO_RXCONF, __TLS_INFO_MAX, }; #define TLS_INFO_MAX (__TLS_INFO_MAX - 1) #define TLS_CONF_BASE 1 #define TLS_CONF_SW 2 #define TLS_CONF_HW 3 #define TLS_CONF_HW_RECORD 4 #endif /* _LINUX_TLS_H */ linux/toshiba.h 0000644 00000003612 15063602055 0007511 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops * * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk) * Copyright (c) 2015 Azael Avalos <coproscefalo@gmail.com> * * Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers * on making sure the structure is aligned and packed. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * */ #ifndef _LINUX_TOSHIBA_H #define _LINUX_TOSHIBA_H /* * Toshiba modules paths */ #define TOSH_PROC "/proc/toshiba" #define TOSH_DEVICE "/dev/toshiba" #define TOSHIBA_ACPI_PROC "/proc/acpi/toshiba" #define TOSHIBA_ACPI_DEVICE "/dev/toshiba_acpi" /* * Toshiba SMM structure */ typedef struct { unsigned int eax; unsigned int ebx __attribute__ ((packed)); unsigned int ecx __attribute__ ((packed)); unsigned int edx __attribute__ ((packed)); unsigned int esi __attribute__ ((packed)); unsigned int edi __attribute__ ((packed)); } SMMRegisters; /* * IOCTLs (0x90 - 0x91) */ #define TOSH_SMM _IOWR('t', 0x90, SMMRegisters) /* * Convenience toshiba_acpi command. * * The System Configuration Interface (SCI) is opened/closed internally * to avoid userspace of buggy BIOSes. * * The toshiba_acpi module checks whether the eax register is set with * SCI_GET (0xf300) or SCI_SET (0xf400), returning -EINVAL if not. */ #define TOSHIBA_ACPI_SCI _IOWR('t', 0x91, SMMRegisters) #endif /* _LINUX_TOSHIBA_H */ linux/tty.h 0000644 00000003061 15063602055 0006676 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TTY_H #define _LINUX_TTY_H /* * 'tty.h' defines some structures used by tty_io.c and some defines. */ #define NR_LDISCS 30 /* line disciplines */ #define N_TTY 0 #define N_SLIP 1 #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 #define N_AX25 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ #define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */ /* cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ #define N_HCI 15 /* Bluetooth HCI UART */ #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ #define N_PPS 18 /* Pulse per Second */ #define N_V253 19 /* Codec control over voice modem */ #define N_CAIF 20 /* CAIF protocol for talking to modems */ #define N_GSM0710 21 /* GSM 0710 Mux */ #define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */ #define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */ #define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */ #define N_NCI 25 /* NFC NCI UART */ #define N_SPEAKUP 26 /* Speakup communication with synths */ #define N_NULL 27 /* Null ldisc used for error handling */ #endif /* _LINUX_TTY_H */ linux/tty_flags.h 0000644 00000010657 15063602055 0010063 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TTY_FLAGS_H #define _LINUX_TTY_FLAGS_H /* * Definitions for async_struct (and serial_struct) flags field also * shared by the tty_port flags structures. * * Define ASYNCB_* for convenient use with {test,set,clear}_bit. * * Bits [0..ASYNCB_LAST_USER] are userspace defined/visible/changeable * [x] in the bit comments indicates the flag is defunct and no longer used. */ #define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes * on the callout port */ #define ASYNCB_FOURPORT 1 /* Set OUT1, OUT2 per AST Fourport settings */ #define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */ #define ASYNCB_SPLIT_TERMIOS 3 /* [x] Separate termios for dialin/callout */ #define ASYNCB_SPD_HI 4 /* Use 57600 instead of 38400 bps */ #define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */ #define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */ #define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during * autoconfiguration */ #define ASYNCB_SESSION_LOCKOUT 8 /* [x] Lock out cua opens based on session */ #define ASYNCB_PGRP_LOCKOUT 9 /* [x] Lock out cua opens based on pgrp */ #define ASYNCB_CALLOUT_NOHUP 10 /* [x] Don't do hangups for cua device */ #define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */ #define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */ #define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */ #define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety * checks. Note: can be dangerous! */ #define ASYNCB_AUTOPROBE 15 /* [x] Port was autoprobed by PCI/PNP code */ #define ASYNCB_MAGIC_MULTIPLIER 16 /* Use special CLK or divisor */ #define ASYNCB_LAST_USER 16 /* * Internal flags used only by kernel (read-only) * * WARNING: These flags are no longer used and have been superceded by the * TTY_PORT_ flags in the iflags field (and not userspace-visible) */ #ifndef _KERNEL_ #define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ #define ASYNCB_SUSPENDED 30 /* Serial port is suspended */ #define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ #define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */ #define ASYNCB_CLOSING 27 /* Serial port is closing */ #define ASYNCB_CTS_FLOW 26 /* Do CTS flow control */ #define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */ #define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */ #define ASYNCB_CONS_FLOW 23 /* flow control for console */ #define ASYNCB_FIRST_KERNEL 22 #endif /* Masks */ #define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) #define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED) #define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT) #define ASYNC_SAK (1U << ASYNCB_SAK) #define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS) #define ASYNC_SPD_HI (1U << ASYNCB_SPD_HI) #define ASYNC_SPD_VHI (1U << ASYNCB_SPD_VHI) #define ASYNC_SKIP_TEST (1U << ASYNCB_SKIP_TEST) #define ASYNC_AUTO_IRQ (1U << ASYNCB_AUTO_IRQ) #define ASYNC_SESSION_LOCKOUT (1U << ASYNCB_SESSION_LOCKOUT) #define ASYNC_PGRP_LOCKOUT (1U << ASYNCB_PGRP_LOCKOUT) #define ASYNC_CALLOUT_NOHUP (1U << ASYNCB_CALLOUT_NOHUP) #define ASYNC_HARDPPS_CD (1U << ASYNCB_HARDPPS_CD) #define ASYNC_SPD_SHI (1U << ASYNCB_SPD_SHI) #define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY) #define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) #define ASYNC_MAGIC_MULTIPLIER (1U << ASYNCB_MAGIC_MULTIPLIER) #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) #define ASYNC_DEPRECATED (ASYNC_SESSION_LOCKOUT | ASYNC_PGRP_LOCKOUT | \ ASYNC_CALLOUT_NOHUP | ASYNC_AUTOPROBE) #define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \ ASYNC_LOW_LATENCY) #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) #ifndef _KERNEL_ /* These flags are no longer used (and were always masked from userspace) */ #define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED) #define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE) #define ASYNC_BOOT_AUTOCONF (1U << ASYNCB_BOOT_AUTOCONF) #define ASYNC_CLOSING (1U << ASYNCB_CLOSING) #define ASYNC_CTS_FLOW (1U << ASYNCB_CTS_FLOW) #define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD) #define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ) #define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW) #define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1)) #endif #endif linux/types.h 0000644 00000002704 15063602055 0007225 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H #include <asm/types.h> #ifndef __ASSEMBLY__ #include <linux/posix_types.h> /* * Below are truly Linux-specific types that should never collide with * any application/library that wants linux/types.h. */ #ifdef __CHECKER__ #define __bitwise__ __attribute__((bitwise)) #else #define __bitwise__ #endif #define __bitwise __bitwise__ typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; typedef __u32 __bitwise __be32; typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; typedef __u16 __bitwise __sum16; typedef __u32 __bitwise __wsum; /* * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid * common 32/64-bit compat problems. * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other * architectures) and to 8-byte boundaries on 64-bit architectures. The new * aligned_64 type enforces 8-byte alignment so that structs containing * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. * No conversions are necessary between 32-bit user-space and a 64-bit kernel. */ #define __aligned_u64 __u64 __attribute__((aligned(8))) #define __aligned_be64 __be64 __attribute__((aligned(8))) #define __aligned_le64 __le64 __attribute__((aligned(8))) typedef unsigned __bitwise __poll_t; #endif /* __ASSEMBLY__ */ #endif /* _LINUX_TYPES_H */ linux/udf_fs_i.h 0000644 00000001271 15063602055 0007635 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * udf_fs_i.h * * This file is intended for the Linux kernel/module. * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. */ #ifndef _UDF_FS_I_H #define _UDF_FS_I_H 1 /* exported IOCTLs, we have 'l', 0x40-0x7f */ #define UDF_GETEASIZE _IOR('l', 0x40, int) #define UDF_GETEABLOCK _IOR('l', 0x41, void *) #define UDF_GETVOLIDENT _IOR('l', 0x42, void *) #define UDF_RELOCATE_BLOCKS _IOWR('l', 0x43, long) #endif /* _UDF_FS_I_H */ linux/udp.h 0000644 00000003175 15063602055 0006654 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Definitions for the UDP protocol. * * Version: @(#)udp.h 1.0.2 04/28/93 * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_UDP_H #define _LINUX_UDP_H #include <linux/types.h> struct udphdr { __be16 source; __be16 dest; __be16 len; __sum16 check; }; /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments */ #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ #define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */ #define UDP_NO_CHECK6_RX 102 /* Disable accpeting checksum for UDP6 */ #define UDP_SEGMENT 103 /* Set GSO segmentation size */ #define UDP_GRO 104 /* This socket can receive UDP GRO packets */ /* UDP encapsulation types */ #define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ #define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ #define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ #define UDP_ENCAP_GTP0 4 /* GSM TS 09.60 */ #define UDP_ENCAP_GTP1U 5 /* 3GPP TS 29.060 */ #define TCP_ENCAP_ESPINTCP 7 /* Yikes, this is really xfrm encap types. */ #endif /* _LINUX_UDP_H */ linux/uhid.h 0000644 00000011050 15063602055 0007004 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __UHID_H_ #define __UHID_H_ /* * User-space I/O driver support for HID subsystem * Copyright (c) 2012 David Herrmann */ /* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. */ /* * Public header for user-space communication. We try to keep every structure * aligned but to be safe we also use __attribute__((__packed__)). Therefore, * the communication should be ABI compatible even between architectures. */ #include <linux/input.h> #include <linux/types.h> #include <linux/hid.h> enum uhid_event_type { __UHID_LEGACY_CREATE, UHID_DESTROY, UHID_START, UHID_STOP, UHID_OPEN, UHID_CLOSE, UHID_OUTPUT, __UHID_LEGACY_OUTPUT_EV, __UHID_LEGACY_INPUT, UHID_GET_REPORT, UHID_GET_REPORT_REPLY, UHID_CREATE2, UHID_INPUT2, UHID_SET_REPORT, UHID_SET_REPORT_REPLY, }; struct uhid_create2_req { __u8 name[128]; __u8 phys[64]; __u8 uniq[64]; __u16 rd_size; __u16 bus; __u32 vendor; __u32 product; __u32 version; __u32 country; __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE]; } __attribute__((__packed__)); enum uhid_dev_flag { UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0), UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1), UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2), }; struct uhid_start_req { __u64 dev_flags; }; #define UHID_DATA_MAX 4096 enum uhid_report_type { UHID_FEATURE_REPORT, UHID_OUTPUT_REPORT, UHID_INPUT_REPORT, }; struct uhid_input2_req { __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); struct uhid_output_req { __u8 data[UHID_DATA_MAX]; __u16 size; __u8 rtype; } __attribute__((__packed__)); struct uhid_get_report_req { __u32 id; __u8 rnum; __u8 rtype; } __attribute__((__packed__)); struct uhid_get_report_reply_req { __u32 id; __u16 err; __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); struct uhid_set_report_req { __u32 id; __u8 rnum; __u8 rtype; __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); struct uhid_set_report_reply_req { __u32 id; __u16 err; } __attribute__((__packed__)); /* * Compat Layer * All these commands and requests are obsolete. You should avoid using them in * new code. We support them for backwards-compatibility, but you might not get * access to new feature in case you use them. */ enum uhid_legacy_event_type { UHID_CREATE = __UHID_LEGACY_CREATE, UHID_OUTPUT_EV = __UHID_LEGACY_OUTPUT_EV, UHID_INPUT = __UHID_LEGACY_INPUT, UHID_FEATURE = UHID_GET_REPORT, UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY, }; /* Obsolete! Use UHID_CREATE2. */ struct uhid_create_req { __u8 name[128]; __u8 phys[64]; __u8 uniq[64]; __u8 *rd_data; __u16 rd_size; __u16 bus; __u32 vendor; __u32 product; __u32 version; __u32 country; } __attribute__((__packed__)); /* Obsolete! Use UHID_INPUT2. */ struct uhid_input_req { __u8 data[UHID_DATA_MAX]; __u16 size; } __attribute__((__packed__)); /* Obsolete! Kernel uses UHID_OUTPUT exclusively now. */ struct uhid_output_ev_req { __u16 type; __u16 code; __s32 value; } __attribute__((__packed__)); /* Obsolete! Kernel uses ABI compatible UHID_GET_REPORT. */ struct uhid_feature_req { __u32 id; __u8 rnum; __u8 rtype; } __attribute__((__packed__)); /* Obsolete! Use ABI compatible UHID_GET_REPORT_REPLY. */ struct uhid_feature_answer_req { __u32 id; __u16 err; __u16 size; __u8 data[UHID_DATA_MAX]; } __attribute__((__packed__)); /* * UHID Events * All UHID events from and to the kernel are encoded as "struct uhid_event". * The "type" field contains a UHID_* type identifier. All payload depends on * that type and can be accessed via ev->u.XYZ accordingly. * If user-space writes short events, they're extended with 0s by the kernel. If * the kernel writes short events, user-space shall extend them with 0s. */ struct uhid_event { __u32 type; union { struct uhid_create_req create; struct uhid_input_req input; struct uhid_output_req output; struct uhid_output_ev_req output_ev; struct uhid_feature_req feature; struct uhid_get_report_req get_report; struct uhid_feature_answer_req feature_answer; struct uhid_get_report_reply_req get_report_reply; struct uhid_create2_req create2; struct uhid_input2_req input2; struct uhid_set_report_req set_report; struct uhid_set_report_reply_req set_report_reply; struct uhid_start_req start; } u; } __attribute__((__packed__)); #endif /* __UHID_H_ */ linux/uinput.h 0000644 00000022055 15063602055 0007406 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * User level driver support for input subsystem * * Heavily based on evdev.c by Vojtech Pavlik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> * * Changes/Revisions: * 0.5 08/13/2015 (David Herrmann <dh.herrmann@gmail.com> & * Benjamin Tissoires <benjamin.tissoires@redhat.com>) * - add UI_DEV_SETUP ioctl * - add UI_ABS_SETUP ioctl * - add UI_GET_VERSION ioctl * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>) * - add UI_GET_SYSNAME ioctl * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>) * - update ff support for the changes in kernel interface * - add UINPUT_VERSION * 0.2 16/10/2004 (Micah Dowty <micah@navi.cx>) * - added force feedback support * - added UI_SET_PHYS * 0.1 20/06/2002 * - first public version */ #ifndef __UINPUT_H_ #define __UINPUT_H_ #include <linux/types.h> #include <linux/input.h> #define UINPUT_VERSION 5 #define UINPUT_MAX_NAME_SIZE 80 struct uinput_ff_upload { __u32 request_id; __s32 retval; struct ff_effect effect; struct ff_effect old; }; struct uinput_ff_erase { __u32 request_id; __s32 retval; __u32 effect_id; }; /* ioctl */ #define UINPUT_IOCTL_BASE 'U' #define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1) #define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2) struct uinput_setup { struct input_id id; char name[UINPUT_MAX_NAME_SIZE]; __u32 ff_effects_max; }; /** * UI_DEV_SETUP - Set device parameters for setup * * This ioctl sets parameters for the input device to be created. It * supersedes the old "struct uinput_user_dev" method, which wrote this data * via write(). To actually set the absolute axes UI_ABS_SETUP should be * used. * * The ioctl takes a "struct uinput_setup" object as argument. The fields of * this object are as follows: * id: See the description of "struct input_id". This field is * copied unchanged into the new device. * name: This is used unchanged as name for the new device. * ff_effects_max: This limits the maximum numbers of force-feedback effects. * See below for a description of FF with uinput. * * This ioctl can be called multiple times and will overwrite previous values. * If this ioctl fails with -EINVAL, it is recommended to use the old * "uinput_user_dev" method via write() as a fallback, in case you run on an * old kernel that does not support this ioctl. * * This ioctl may fail with -EINVAL if it is not supported or if you passed * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the * passed uinput_setup object cannot be read/written. * If this call fails, partial data may have already been applied to the * internal device. */ #define UI_DEV_SETUP _IOW(UINPUT_IOCTL_BASE, 3, struct uinput_setup) struct uinput_abs_setup { __u16 code; /* axis code */ /* __u16 filler; */ struct input_absinfo absinfo; }; /** * UI_ABS_SETUP - Set absolute axis information for the device to setup * * This ioctl sets one absolute axis information for the input device to be * created. It supersedes the old "struct uinput_user_dev" method, which wrote * part of this data and the content of UI_DEV_SETUP via write(). * * The ioctl takes a "struct uinput_abs_setup" object as argument. The fields * of this object are as follows: * code: The corresponding input code associated with this axis * (ABS_X, ABS_Y, etc...) * absinfo: See "struct input_absinfo" for a description of this field. * This field is copied unchanged into the kernel for the * specified axis. If the axis is not enabled via * UI_SET_ABSBIT, this ioctl will enable it. * * This ioctl can be called multiple times and will overwrite previous values. * If this ioctl fails with -EINVAL, it is recommended to use the old * "uinput_user_dev" method via write() as a fallback, in case you run on an * old kernel that does not support this ioctl. * * This ioctl may fail with -EINVAL if it is not supported or if you passed * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the * passed uinput_setup object cannot be read/written. * If this call fails, partial data may have already been applied to the * internal device. */ #define UI_ABS_SETUP _IOW(UINPUT_IOCTL_BASE, 4, struct uinput_abs_setup) #define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int) #define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int) #define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int) #define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int) #define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int) #define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int) #define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int) #define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) #define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) #define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int) #define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int) #define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) #define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) #define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) #define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) /** * UI_GET_SYSNAME - get the sysfs name of the created uinput device * * @return the sysfs name of the created virtual input device. * The complete sysfs path is then /sys/devices/virtual/input/--NAME-- * Usually, it is in the form "inputN" */ #define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len) /** * UI_GET_VERSION - Return version of uinput protocol * * This writes uinput protocol version implemented by the kernel into * the integer pointed to by the ioctl argument. The protocol version * is hard-coded in the kernel and is independent of the uinput device. */ #define UI_GET_VERSION _IOR(UINPUT_IOCTL_BASE, 45, unsigned int) /* * To write a force-feedback-capable driver, the upload_effect * and erase_effect callbacks in input_dev must be implemented. * The uinput driver will generate a fake input event when one of * these callbacks are invoked. The userspace code then uses * ioctls to retrieve additional parameters and send the return code. * The callback blocks until this return code is sent. * * The described callback mechanism is only used if ff_effects_max * is set. * * To implement upload_effect(): * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD. * A request ID will be given in 'value'. * 2. Allocate a uinput_ff_upload struct, fill in request_id with * the 'value' from the EV_UINPUT event. * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the * uinput_ff_upload struct. It will be filled in with the * ff_effects passed to upload_effect(). * 4. Perform the effect upload, and place a return code back into the uinput_ff_upload struct. * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the * uinput_ff_upload_effect struct. This will complete execution * of our upload_effect() handler. * * To implement erase_effect(): * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE. * A request ID will be given in 'value'. * 2. Allocate a uinput_ff_erase struct, fill in request_id with * the 'value' from the EV_UINPUT event. * 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the * uinput_ff_erase struct. It will be filled in with the * effect ID passed to erase_effect(). * 4. Perform the effect erasure, and place a return code back * into the uinput_ff_erase struct. * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the * uinput_ff_erase_effect struct. This will complete execution * of our erase_effect() handler. */ /* * This is the new event type, used only by uinput. * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value' * is the unique request ID. This number was picked * arbitrarily, above EV_MAX (since the input system * never sees it) but in the range of a 16-bit int. */ #define EV_UINPUT 0x0101 #define UI_FF_UPLOAD 1 #define UI_FF_ERASE 2 struct uinput_user_dev { char name[UINPUT_MAX_NAME_SIZE]; struct input_id id; __u32 ff_effects_max; __s32 absmax[ABS_CNT]; __s32 absmin[ABS_CNT]; __s32 absfuzz[ABS_CNT]; __s32 absflat[ABS_CNT]; }; #endif /* __UINPUT_H_ */ linux/uio.h 0000644 00000001334 15063602055 0006653 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Berkeley style UIO structures - Alan Cox 1994. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef __LINUX_UIO_H #define __LINUX_UIO_H #include <linux/types.h> struct iovec { void *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ }; /* * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) */ #define UIO_FASTIOV 8 #define UIO_MAXIOV 1024 #endif /* __LINUX_UIO_H */ linux/uleds.h 0000644 00000001436 15063602055 0007176 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Userspace driver support for the LED subsystem * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __ULEDS_H_ #define __ULEDS_H_ #define LED_MAX_NAME_SIZE 64 struct uleds_user_dev { char name[LED_MAX_NAME_SIZE]; int max_brightness; }; #endif /* __ULEDS_H_ */ linux/ultrasound.h 0000644 00000010722 15063602055 0010260 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ULTRASOUND_H_ #define _ULTRASOUND_H_ /* * ultrasound.h - Macros for programming the Gravis Ultrasound * These macros are extremely device dependent * and not portable. */ /* * Copyright (C) by Hannu Savolainen 1993-1997 * * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) * Version 2 (June 1991). See the "COPYING" file distributed with this software * for more info. */ /* * Private events for Gravis Ultrasound (GUS) * * Format: * byte 0 - SEQ_PRIVATE (0xfe) * byte 1 - Synthesizer device number (0-N) * byte 2 - Command (see below) * byte 3 - Voice number (0-31) * bytes 4 and 5 - parameter P1 (unsigned short) * bytes 6 and 7 - parameter P2 (unsigned short) * * Commands: * Each command affects one voice defined in byte 3. * Unused parameters (P1 and/or P2 *MUST* be initialized to zero). * _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16) * _GUS_VOICESAMPLE- ************ OBSOLETE ************* * _GUS_VOICEON - Starts voice (P1=voice mode) * _GUS_VOICEOFF - Stops voice (no parameters) * _GUS_VOICEFADE - Stops the voice smoothly. * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7) * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) * (Like GUS_VOICEVOL but doesn't change the hw * volume. It just updates volume in the voice table). * * _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume) * _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate) * _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode) * _GUS_RAMPON - Starts volume ramping (no parameters) * _GUS_RAMPOFF - Stops volume ramping (no parameters) * _GUS_VOLUME_SCALE - Changes the volume calculation constants * for all voices. */ #define _GUS_NUMVOICES 0x00 #define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */ #define _GUS_VOICEON 0x02 #define _GUS_VOICEOFF 0x03 #define _GUS_VOICEMODE 0x04 #define _GUS_VOICEBALA 0x05 #define _GUS_VOICEFREQ 0x06 #define _GUS_VOICEVOL 0x07 #define _GUS_RAMPRANGE 0x08 #define _GUS_RAMPRATE 0x09 #define _GUS_RAMPMODE 0x0a #define _GUS_RAMPON 0x0b #define _GUS_RAMPOFF 0x0c #define _GUS_VOICEFADE 0x0d #define _GUS_VOLUME_SCALE 0x0e #define _GUS_VOICEVOL2 0x0f #define _GUS_VOICE_POS 0x10 /* * GUS API macros */ #define _GUS_CMD(chn, voice, cmd, p1, p2) \ {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\ _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\ _seqbuf[_seqbufptr+3] = voice;\ *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\ *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\ _SEQ_ADVBUF(8);} #define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0) #define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */ #define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0) #define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0) #define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0) #define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0) #define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0) #define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \ (p) & 0xffff, ((p) >> 16) & 0xffff) #define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0) #define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0) #define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high)) #define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2)) #define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0) #define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0) #define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0) #define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2)) #define GUS_VOICE_POS(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICE_POS, \ (p) & 0xffff, ((p) >> 16) & 0xffff) #endif linux/un.h 0000644 00000000600 15063602055 0006474 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UN_H #define _LINUX_UN_H #include <linux/socket.h> #define UNIX_PATH_MAX 108 struct sockaddr_un { __kernel_sa_family_t sun_family; /* AF_UNIX */ char sun_path[UNIX_PATH_MAX]; /* pathname */ }; #define SIOCUNIXFILE (SIOCPROTOPRIVATE + 0) /* open a socket file with O_PATH */ #endif /* _LINUX_UN_H */ linux/unistd.h 0000644 00000000334 15063602055 0007364 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UNISTD_H_ #define _LINUX_UNISTD_H_ /* * Include machine specific syscall numbers */ #include <asm/unistd.h> #endif /* _LINUX_UNISTD_H_ */ linux/unix_diag.h 0000644 00000002345 15063602055 0010031 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __UNIX_DIAG_H__ #define __UNIX_DIAG_H__ #include <linux/types.h> struct unix_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; __u16 pad; __u32 udiag_states; __u32 udiag_ino; __u32 udiag_show; __u32 udiag_cookie[2]; }; #define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */ #define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */ #define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */ #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ struct unix_diag_msg { __u8 udiag_family; __u8 udiag_type; __u8 udiag_state; __u8 pad; __u32 udiag_ino; __u32 udiag_cookie[2]; }; enum { /* UNIX_DIAG_NONE, standard nl API requires this attribute! */ UNIX_DIAG_NAME, UNIX_DIAG_VFS, UNIX_DIAG_PEER, UNIX_DIAG_ICONS, UNIX_DIAG_RQLEN, UNIX_DIAG_MEMINFO, UNIX_DIAG_SHUTDOWN, __UNIX_DIAG_MAX, }; #define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1) struct unix_diag_vfs { __u32 udiag_vfs_ino; __u32 udiag_vfs_dev; }; struct unix_diag_rqlen { __u32 udiag_rqueue; __u32 udiag_wqueue; }; #endif linux/usbdevice_fs.h 0000644 00000020175 15063602055 0010524 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /*****************************************************************************/ /* * usbdevice_fs.h -- USB device file system. * * Copyright (C) 2000 * Thomas Sailer (sailer@ife.ee.ethz.ch) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * History: * 0.1 04.01.2000 Created */ /*****************************************************************************/ #ifndef _LINUX_USBDEVICE_FS_H #define _LINUX_USBDEVICE_FS_H #include <linux/types.h> #include <linux/magic.h> /* --------------------------------------------------------------------- */ /* usbdevfs ioctl codes */ struct usbdevfs_ctrltransfer { __u8 bRequestType; __u8 bRequest; __u16 wValue; __u16 wIndex; __u16 wLength; __u32 timeout; /* in milliseconds */ void *data; }; struct usbdevfs_bulktransfer { unsigned int ep; unsigned int len; unsigned int timeout; /* in milliseconds */ void *data; }; struct usbdevfs_setinterface { unsigned int interface; unsigned int altsetting; }; struct usbdevfs_disconnectsignal { unsigned int signr; void *context; }; #define USBDEVFS_MAXDRIVERNAME 255 struct usbdevfs_getdriver { unsigned int interface; char driver[USBDEVFS_MAXDRIVERNAME + 1]; }; struct usbdevfs_connectinfo { unsigned int devnum; unsigned char slow; }; struct usbdevfs_conninfo_ex { __u32 size; /* Size of the structure from the kernel's */ /* point of view. Can be used by userspace */ /* to determine how much data can be */ /* used/trusted. */ __u32 busnum; /* USB bus number, as enumerated by the */ /* kernel, the device is connected to. */ __u32 devnum; /* Device address on the bus. */ __u32 speed; /* USB_SPEED_* constants from ch9.h */ __u8 num_ports; /* Number of ports the device is connected */ /* to on the way to the root hub. It may */ /* be bigger than size of 'ports' array so */ /* userspace can detect overflows. */ __u8 ports[7]; /* List of ports on the way from the root */ /* hub to the device. Current limit in */ /* USB specification is 7 tiers (root hub, */ /* 5 intermediate hubs, device), which */ /* gives at most 6 port entries. */ }; #define USBDEVFS_URB_SHORT_NOT_OK 0x01 #define USBDEVFS_URB_ISO_ASAP 0x02 #define USBDEVFS_URB_BULK_CONTINUATION 0x04 #define USBDEVFS_URB_NO_FSBR 0x20 /* Not used */ #define USBDEVFS_URB_ZERO_PACKET 0x40 #define USBDEVFS_URB_NO_INTERRUPT 0x80 #define USBDEVFS_URB_TYPE_ISO 0 #define USBDEVFS_URB_TYPE_INTERRUPT 1 #define USBDEVFS_URB_TYPE_CONTROL 2 #define USBDEVFS_URB_TYPE_BULK 3 struct usbdevfs_iso_packet_desc { unsigned int length; unsigned int actual_length; unsigned int status; }; struct usbdevfs_urb { unsigned char type; unsigned char endpoint; int status; unsigned int flags; void *buffer; int buffer_length; int actual_length; int start_frame; union { int number_of_packets; /* Only used for isoc urbs */ unsigned int stream_id; /* Only used with bulk streams */ }; int error_count; unsigned int signr; /* signal to be sent on completion, or 0 if none should be sent. */ void *usercontext; struct usbdevfs_iso_packet_desc iso_frame_desc[0]; }; /* ioctls for talking directly to drivers */ struct usbdevfs_ioctl { int ifno; /* interface 0..N ; negative numbers reserved */ int ioctl_code; /* MUST encode size + direction of data so the * macros in <asm/ioctl.h> give correct values */ void *data; /* param buffer (in, or out) */ }; /* You can do most things with hubs just through control messages, * except find out what device connects to what port. */ struct usbdevfs_hub_portinfo { char nports; /* number of downstream ports in this hub */ char port [127]; /* e.g. port 3 connects to device 27 */ }; /* System and bus capability flags */ #define USBDEVFS_CAP_ZERO_PACKET 0x01 #define USBDEVFS_CAP_BULK_CONTINUATION 0x02 #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04 #define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08 #define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10 #define USBDEVFS_CAP_MMAP 0x20 #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 #define USBDEVFS_CAP_CONNINFO_EX 0x80 #define USBDEVFS_CAP_SUSPEND 0x100 /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ /* disconnect-and-claim if the driver matches the driver field */ #define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01 /* disconnect-and-claim except when the driver matches the driver field */ #define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02 struct usbdevfs_disconnect_claim { unsigned int interface; unsigned int flags; char driver[USBDEVFS_MAXDRIVERNAME + 1]; }; struct usbdevfs_streams { unsigned int num_streams; /* Not used by USBDEVFS_FREE_STREAMS */ unsigned int num_eps; unsigned char eps[0]; }; /* * USB_SPEED_* values returned by USBDEVFS_GET_SPEED are defined in * linux/usb/ch9.h */ #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32) #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver) #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32) #define USBDEVFS_DISCARDURB _IO('U', 11) #define USBDEVFS_REAPURB _IOW('U', 12, void *) #define USBDEVFS_REAPURB32 _IOW('U', 12, __u32) #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32) #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32) #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) #define USBDEVFS_RESET _IO('U', 20) #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) #define USBDEVFS_DISCONNECT _IO('U', 22) #define USBDEVFS_CONNECT _IO('U', 23) #define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int) #define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int) #define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32) #define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim) #define USBDEVFS_ALLOC_STREAMS _IOR('U', 28, struct usbdevfs_streams) #define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams) #define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32) #define USBDEVFS_GET_SPEED _IO('U', 31) /* * Returns struct usbdevfs_conninfo_ex; length is variable to allow * extending size of the data returned. */ #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len) #define USBDEVFS_FORBID_SUSPEND _IO('U', 33) #define USBDEVFS_ALLOW_SUSPEND _IO('U', 34) #define USBDEVFS_WAIT_FOR_RESUME _IO('U', 35) #endif /* _LINUX_USBDEVICE_FS_H */ linux/usbip.h 0000644 00000001200 15063602055 0007171 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * usbip.h * * USBIP uapi defines and function prototypes etc. */ #ifndef _LINUX_USBIP_H #define _LINUX_USBIP_H /* usbip device status - exported in usbip device sysfs status */ enum usbip_device_status { /* sdev is available. */ SDEV_ST_AVAILABLE = 0x01, /* sdev is now used. */ SDEV_ST_USED, /* sdev is unusable because of a fatal error. */ SDEV_ST_ERROR, /* vdev does not connect a remote device. */ VDEV_ST_NULL, /* vdev is used, but the USB address is not assigned yet */ VDEV_ST_NOTASSIGNED, VDEV_ST_USED, VDEV_ST_ERROR }; #endif /* _LINUX_USBIP_H */ linux/usb/audio.h 0000644 00000046042 15063602055 0007756 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/usb/audio.h> -- USB Audio definitions. * * Copyright (C) 2006 Thumtronics Pty Ltd. * Developed for Thumtronics by Grey Innovation * Ben Williamson <ben.williamson@greyinnovation.com> * * This software is distributed under the terms of the GNU General Public * License ("GPL") version 2, as published by the Free Software Foundation. * * This file holds USB constants and structures defined * by the USB Device Class Definition for Audio Devices. * Comments below reference relevant sections of that document: * * http://www.usb.org/developers/devclass_docs/audio10.pdf * * Types and defines in this file are either specific to version 1.0 of * this standard or common for newer versions. */ #ifndef __LINUX_USB_AUDIO_H #define __LINUX_USB_AUDIO_H #include <linux/types.h> /* bInterfaceProtocol values to denote the version of the standard used */ #define UAC_VERSION_1 0x00 #define UAC_VERSION_2 0x20 #define UAC_VERSION_3 0x30 /* A.2 Audio Interface Subclass Codes */ #define USB_SUBCLASS_AUDIOCONTROL 0x01 #define USB_SUBCLASS_AUDIOSTREAMING 0x02 #define USB_SUBCLASS_MIDISTREAMING 0x03 /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ #define UAC_HEADER 0x01 #define UAC_INPUT_TERMINAL 0x02 #define UAC_OUTPUT_TERMINAL 0x03 #define UAC_MIXER_UNIT 0x04 #define UAC_SELECTOR_UNIT 0x05 #define UAC_FEATURE_UNIT 0x06 #define UAC1_PROCESSING_UNIT 0x07 #define UAC1_EXTENSION_UNIT 0x08 /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ #define UAC_AS_GENERAL 0x01 #define UAC_FORMAT_TYPE 0x02 #define UAC_FORMAT_SPECIFIC 0x03 /* A.7 Processing Unit Process Types */ #define UAC_PROCESS_UNDEFINED 0x00 #define UAC_PROCESS_UP_DOWNMIX 0x01 #define UAC_PROCESS_DOLBY_PROLOGIC 0x02 #define UAC_PROCESS_STEREO_EXTENDER 0x03 #define UAC_PROCESS_REVERB 0x04 #define UAC_PROCESS_CHORUS 0x05 #define UAC_PROCESS_DYN_RANGE_COMP 0x06 /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ #define UAC_EP_GENERAL 0x01 /* A.9 Audio Class-Specific Request Codes */ #define UAC_SET_ 0x00 #define UAC_GET_ 0x80 #define UAC__CUR 0x1 #define UAC__MIN 0x2 #define UAC__MAX 0x3 #define UAC__RES 0x4 #define UAC__MEM 0x5 #define UAC_SET_CUR (UAC_SET_ | UAC__CUR) #define UAC_GET_CUR (UAC_GET_ | UAC__CUR) #define UAC_SET_MIN (UAC_SET_ | UAC__MIN) #define UAC_GET_MIN (UAC_GET_ | UAC__MIN) #define UAC_SET_MAX (UAC_SET_ | UAC__MAX) #define UAC_GET_MAX (UAC_GET_ | UAC__MAX) #define UAC_SET_RES (UAC_SET_ | UAC__RES) #define UAC_GET_RES (UAC_GET_ | UAC__RES) #define UAC_SET_MEM (UAC_SET_ | UAC__MEM) #define UAC_GET_MEM (UAC_GET_ | UAC__MEM) #define UAC_GET_STAT 0xff /* A.10 Control Selector Codes */ /* A.10.1 Terminal Control Selectors */ #define UAC_TERM_COPY_PROTECT 0x01 /* A.10.2 Feature Unit Control Selectors */ #define UAC_FU_MUTE 0x01 #define UAC_FU_VOLUME 0x02 #define UAC_FU_BASS 0x03 #define UAC_FU_MID 0x04 #define UAC_FU_TREBLE 0x05 #define UAC_FU_GRAPHIC_EQUALIZER 0x06 #define UAC_FU_AUTOMATIC_GAIN 0x07 #define UAC_FU_DELAY 0x08 #define UAC_FU_BASS_BOOST 0x09 #define UAC_FU_LOUDNESS 0x0a #define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1)) /* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */ #define UAC_UD_ENABLE 0x01 #define UAC_UD_MODE_SELECT 0x02 /* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */ #define UAC_DP_ENABLE 0x01 #define UAC_DP_MODE_SELECT 0x02 /* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */ #define UAC_3D_ENABLE 0x01 #define UAC_3D_SPACE 0x02 /* A.10.3.4 Reverberation Processing Unit Control Selectors */ #define UAC_REVERB_ENABLE 0x01 #define UAC_REVERB_LEVEL 0x02 #define UAC_REVERB_TIME 0x03 #define UAC_REVERB_FEEDBACK 0x04 /* A.10.3.5 Chorus Processing Unit Control Selectors */ #define UAC_CHORUS_ENABLE 0x01 #define UAC_CHORUS_LEVEL 0x02 #define UAC_CHORUS_RATE 0x03 #define UAC_CHORUS_DEPTH 0x04 /* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */ #define UAC_DCR_ENABLE 0x01 #define UAC_DCR_RATE 0x02 #define UAC_DCR_MAXAMPL 0x03 #define UAC_DCR_THRESHOLD 0x04 #define UAC_DCR_ATTACK_TIME 0x05 #define UAC_DCR_RELEASE_TIME 0x06 /* A.10.4 Extension Unit Control Selectors */ #define UAC_XU_ENABLE 0x01 /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ #define UAC_MS_HEADER 0x01 #define UAC_MIDI_IN_JACK 0x02 #define UAC_MIDI_OUT_JACK 0x03 /* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */ #define UAC_MS_GENERAL 0x01 /* Terminals - 2.1 USB Terminal Types */ #define UAC_TERMINAL_UNDEFINED 0x100 #define UAC_TERMINAL_STREAMING 0x101 #define UAC_TERMINAL_VENDOR_SPEC 0x1FF /* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ struct uac1_ac_header_descriptor { __u8 bLength; /* 8 + n */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ __le16 bcdADC; /* 0x0100 */ __le16 wTotalLength; /* includes Unit and Terminal desc. */ __u8 bInCollection; /* n */ __u8 baInterfaceNr[]; /* [n] */ } __attribute__ ((packed)); #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ struct uac1_ac_header_descriptor_##n { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __le16 bcdADC; \ __le16 wTotalLength; \ __u8 bInCollection; \ __u8 baInterfaceNr[n]; \ } __attribute__ ((packed)) /* 4.3.2.1 Input Terminal Descriptor */ struct uac_input_terminal_descriptor { __u8 bLength; /* in bytes: 12 */ __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ __u8 bTerminalID; /* Constant uniquely terminal ID */ __le16 wTerminalType; /* USB Audio Terminal Types */ __u8 bAssocTerminal; /* ID of the Output Terminal associated */ __u8 bNrChannels; /* Number of logical output channels */ __le16 wChannelConfig; __u8 iChannelNames; __u8 iTerminal; } __attribute__ ((packed)); #define UAC_DT_INPUT_TERMINAL_SIZE 12 /* Terminals - 2.2 Input Terminal Types */ #define UAC_INPUT_TERMINAL_UNDEFINED 0x200 #define UAC_INPUT_TERMINAL_MICROPHONE 0x201 #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 /* Terminals - control selectors */ #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 /* 4.3.2.2 Output Terminal Descriptor */ struct uac1_output_terminal_descriptor { __u8 bLength; /* in bytes: 9 */ __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ __u8 bTerminalID; /* Constant uniquely terminal ID */ __le16 wTerminalType; /* USB Audio Terminal Types */ __u8 bAssocTerminal; /* ID of the Input Terminal associated */ __u8 bSourceID; /* ID of the connected Unit or Terminal*/ __u8 iTerminal; } __attribute__ ((packed)); #define UAC_DT_OUTPUT_TERMINAL_SIZE 9 /* Terminals - 2.3 Output Terminal Types */ #define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300 #define UAC_OUTPUT_TERMINAL_SPEAKER 0x301 #define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302 #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 /* Terminals - 2.4 Bi-directional Terminal Types */ #define UAC_BIDIR_TERMINAL_UNDEFINED 0x400 #define UAC_BIDIR_TERMINAL_HANDSET 0x401 #define UAC_BIDIR_TERMINAL_HEADSET 0x402 #define UAC_BIDIR_TERMINAL_SPEAKER_PHONE 0x403 #define UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING 0x404 #define UAC_BIDIR_TERMINAL_ECHO_CANCELING 0x405 /* Set bControlSize = 2 as default setting */ #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ struct uac_feature_unit_descriptor_##ch { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bUnitID; \ __u8 bSourceID; \ __u8 bControlSize; \ __le16 bmaControls[ch + 1]; \ __u8 iFeature; \ } __attribute__ ((packed)) /* 4.3.2.3 Mixer Unit Descriptor */ struct uac_mixer_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUnitID; __u8 bNrInPins; __u8 baSourceID[]; } __attribute__ ((packed)); static __inline__ __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc) { return desc->baSourceID[desc->bNrInPins]; } static __inline__ __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc, int protocol) { if (protocol == UAC_VERSION_1) return (desc->baSourceID[desc->bNrInPins + 2] << 8) | desc->baSourceID[desc->bNrInPins + 1]; else return (desc->baSourceID[desc->bNrInPins + 4] << 24) | (desc->baSourceID[desc->bNrInPins + 3] << 16) | (desc->baSourceID[desc->bNrInPins + 2] << 8) | (desc->baSourceID[desc->bNrInPins + 1]); } static __inline__ __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc, int protocol) { return (protocol == UAC_VERSION_1) ? desc->baSourceID[desc->bNrInPins + 3] : desc->baSourceID[desc->bNrInPins + 5]; } static __inline__ __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return &desc->baSourceID[desc->bNrInPins + 4]; case UAC_VERSION_2: return &desc->baSourceID[desc->bNrInPins + 6]; case UAC_VERSION_3: return &desc->baSourceID[desc->bNrInPins + 2]; default: return NULL; } } static __inline__ __u16 uac3_mixer_unit_wClusterDescrID(struct uac_mixer_unit_descriptor *desc) { return (desc->baSourceID[desc->bNrInPins + 1] << 8) | desc->baSourceID[desc->bNrInPins]; } static __inline__ __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) { __u8 *raw = (__u8 *) desc; return raw[desc->bLength - 1]; } /* 4.3.2.4 Selector Unit Descriptor */ struct uac_selector_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUintID; __u8 bNrInPins; __u8 baSourceID[]; } __attribute__ ((packed)); static __inline__ __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc) { __u8 *raw = (__u8 *) desc; return raw[desc->bLength - 1]; } /* 4.3.2.5 Feature Unit Descriptor */ struct uac_feature_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUnitID; __u8 bSourceID; __u8 bControlSize; __u8 bmaControls[0]; /* variable length */ } __attribute__((packed)); static __inline__ __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc) { __u8 *raw = (__u8 *) desc; return raw[desc->bLength - 1]; } /* 4.3.2.6 Processing Unit Descriptors */ struct uac_processing_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUnitID; __le16 wProcessType; __u8 bNrInPins; __u8 baSourceID[]; } __attribute__ ((packed)); static __inline__ __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc) { return desc->baSourceID[desc->bNrInPins]; } static __inline__ __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc, int protocol) { if (protocol == UAC_VERSION_1) return (desc->baSourceID[desc->bNrInPins + 2] << 8) | desc->baSourceID[desc->bNrInPins + 1]; else return (desc->baSourceID[desc->bNrInPins + 4] << 24) | (desc->baSourceID[desc->bNrInPins + 3] << 16) | (desc->baSourceID[desc->bNrInPins + 2] << 8) | (desc->baSourceID[desc->bNrInPins + 1]); } static __inline__ __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc, int protocol) { return (protocol == UAC_VERSION_1) ? desc->baSourceID[desc->bNrInPins + 3] : desc->baSourceID[desc->bNrInPins + 5]; } static __inline__ __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return desc->baSourceID[desc->bNrInPins + 4]; case UAC_VERSION_2: return 2; /* in UAC2, this value is constant */ case UAC_VERSION_3: return 4; /* in UAC3, this value is constant */ default: return 1; } } static __inline__ __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return &desc->baSourceID[desc->bNrInPins + 5]; case UAC_VERSION_2: return &desc->baSourceID[desc->bNrInPins + 6]; case UAC_VERSION_3: return &desc->baSourceID[desc->bNrInPins + 2]; default: return NULL; } } static __inline__ __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, int protocol) { __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); switch (protocol) { case UAC_VERSION_1: case UAC_VERSION_2: default: return *(uac_processing_unit_bmControls(desc, protocol) + control_size); case UAC_VERSION_3: return 0; /* UAC3 does not have this field */ } } static __inline__ __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, int protocol) { __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); switch (protocol) { case UAC_VERSION_1: case UAC_VERSION_2: default: return uac_processing_unit_bmControls(desc, protocol) + control_size + 1; case UAC_VERSION_3: return uac_processing_unit_bmControls(desc, protocol) + control_size; } } /* * Extension Unit (XU) has almost compatible layout with Processing Unit, but * on UAC2, it has a different bmControls size (bControlSize); it's 1 byte for * XU while 2 bytes for PU. The last iExtension field is a one-byte index as * well as iProcessing field of PU. */ static __inline__ __u8 uac_extension_unit_bControlSize(struct uac_processing_unit_descriptor *desc, int protocol) { switch (protocol) { case UAC_VERSION_1: return desc->baSourceID[desc->bNrInPins + 4]; case UAC_VERSION_2: return 1; /* in UAC2, this value is constant */ case UAC_VERSION_3: return 4; /* in UAC3, this value is constant */ default: return 1; } } static __inline__ __u8 uac_extension_unit_iExtension(struct uac_processing_unit_descriptor *desc, int protocol) { __u8 control_size = uac_extension_unit_bControlSize(desc, protocol); switch (protocol) { case UAC_VERSION_1: case UAC_VERSION_2: default: return *(uac_processing_unit_bmControls(desc, protocol) + control_size); case UAC_VERSION_3: return 0; /* UAC3 does not have this field */ } } /* 4.5.2 Class-Specific AS Interface Descriptor */ struct uac1_as_header_descriptor { __u8 bLength; /* in bytes: 7 */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* AS_GENERAL */ __u8 bTerminalLink; /* Terminal ID of connected Terminal */ __u8 bDelay; /* Delay introduced by the data path */ __le16 wFormatTag; /* The Audio Data Format */ } __attribute__ ((packed)); #define UAC_DT_AS_HEADER_SIZE 7 /* Formats - A.1.1 Audio Data Format Type I Codes */ #define UAC_FORMAT_TYPE_I_UNDEFINED 0x0 #define UAC_FORMAT_TYPE_I_PCM 0x1 #define UAC_FORMAT_TYPE_I_PCM8 0x2 #define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3 #define UAC_FORMAT_TYPE_I_ALAW 0x4 #define UAC_FORMAT_TYPE_I_MULAW 0x5 struct uac_format_type_i_continuous_descriptor { __u8 bLength; /* in bytes: 8 + (ns * 3) */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* FORMAT_TYPE */ __u8 bFormatType; /* FORMAT_TYPE_1 */ __u8 bNrChannels; /* physical channels in the stream */ __u8 bSubframeSize; /* */ __u8 bBitResolution; __u8 bSamFreqType; __u8 tLowerSamFreq[3]; __u8 tUpperSamFreq[3]; } __attribute__ ((packed)); #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 struct uac_format_type_i_discrete_descriptor { __u8 bLength; /* in bytes: 8 + (ns * 3) */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* FORMAT_TYPE */ __u8 bFormatType; /* FORMAT_TYPE_1 */ __u8 bNrChannels; /* physical channels in the stream */ __u8 bSubframeSize; /* */ __u8 bBitResolution; __u8 bSamFreqType; __u8 tSamFreq[][3]; } __attribute__ ((packed)); #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ struct uac_format_type_i_discrete_descriptor_##n { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bFormatType; \ __u8 bNrChannels; \ __u8 bSubframeSize; \ __u8 bBitResolution; \ __u8 bSamFreqType; \ __u8 tSamFreq[n][3]; \ } __attribute__ ((packed)) #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) struct uac_format_type_i_ext_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bFormatType; __u8 bSubslotSize; __u8 bBitResolution; __u8 bHeaderLength; __u8 bControlSize; __u8 bSideBandProtocol; } __attribute__((packed)); /* Formats - Audio Data Format Type I Codes */ #define UAC_FORMAT_TYPE_II_MPEG 0x1001 #define UAC_FORMAT_TYPE_II_AC3 0x1002 struct uac_format_type_ii_discrete_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bFormatType; __le16 wMaxBitRate; __le16 wSamplesPerFrame; __u8 bSamFreqType; __u8 tSamFreq[][3]; } __attribute__((packed)); struct uac_format_type_ii_ext_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bFormatType; __le16 wMaxBitRate; __le16 wSamplesPerFrame; __u8 bHeaderLength; __u8 bSideBandProtocol; } __attribute__((packed)); /* type III */ #define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006 /* Formats - A.2 Format Type Codes */ #define UAC_FORMAT_TYPE_UNDEFINED 0x0 #define UAC_FORMAT_TYPE_I 0x1 #define UAC_FORMAT_TYPE_II 0x2 #define UAC_FORMAT_TYPE_III 0x3 #define UAC_EXT_FORMAT_TYPE_I 0x81 #define UAC_EXT_FORMAT_TYPE_II 0x82 #define UAC_EXT_FORMAT_TYPE_III 0x83 struct uac_iso_endpoint_descriptor { __u8 bLength; /* in bytes: 7 */ __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ __u8 bDescriptorSubtype; /* EP_GENERAL */ __u8 bmAttributes; __u8 bLockDelayUnits; __le16 wLockDelay; } __attribute__((packed)); #define UAC_ISO_ENDPOINT_DESC_SIZE 7 #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 #define UAC_EP_CS_ATTR_FILL_MAX 0x80 /* status word format (3.7.1.1) */ #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2 #define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7) #define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6) struct uac1_status_word { __u8 bStatusType; __u8 bOriginator; } __attribute__((packed)); #endif /* __LINUX_USB_AUDIO_H */ linux/usb/cdc-wdm.h 0000644 00000001343 15063602055 0010166 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * USB CDC Device Management userspace API definitions * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ #ifndef __LINUX_USB_CDC_WDM_H #define __LINUX_USB_CDC_WDM_H #include <linux/types.h> /* * This IOCTL is used to retrieve the wMaxCommand for the device, * defining the message limit for both reading and writing. * * For CDC WDM functions this will be the wMaxCommand field of the * Device Management Functional Descriptor. */ #define IOCTL_WDM_MAX_COMMAND _IOR('H', 0xA0, __u16) #endif /* __LINUX_USB_CDC_WDM_H */ linux/usb/cdc.h 0000644 00000032246 15063602055 0007407 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * USB Communications Device Class (CDC) definitions * * CDC says how to talk to lots of different types of network adapters, * notably ethernet adapters and various modems. It's used mostly with * firmware based USB peripherals. */ #ifndef __UAPI_LINUX_USB_CDC_H #define __UAPI_LINUX_USB_CDC_H #include <linux/types.h> #define USB_CDC_SUBCLASS_ACM 0x02 #define USB_CDC_SUBCLASS_ETHERNET 0x06 #define USB_CDC_SUBCLASS_WHCM 0x08 #define USB_CDC_SUBCLASS_DMM 0x09 #define USB_CDC_SUBCLASS_MDLM 0x0a #define USB_CDC_SUBCLASS_OBEX 0x0b #define USB_CDC_SUBCLASS_EEM 0x0c #define USB_CDC_SUBCLASS_NCM 0x0d #define USB_CDC_SUBCLASS_MBIM 0x0e #define USB_CDC_PROTO_NONE 0 #define USB_CDC_ACM_PROTO_AT_V25TER 1 #define USB_CDC_ACM_PROTO_AT_PCCA101 2 #define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3 #define USB_CDC_ACM_PROTO_AT_GSM 4 #define USB_CDC_ACM_PROTO_AT_3G 5 #define USB_CDC_ACM_PROTO_AT_CDMA 6 #define USB_CDC_ACM_PROTO_VENDOR 0xff #define USB_CDC_PROTO_EEM 7 #define USB_CDC_NCM_PROTO_NTB 1 #define USB_CDC_MBIM_PROTO_NTB 2 /*-------------------------------------------------------------------------*/ /* * Class-Specific descriptors ... there are a couple dozen of them */ #define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ #define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ #define USB_CDC_COUNTRY_TYPE 0x07 #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ #define USB_CDC_WHCM_TYPE 0x11 #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ #define USB_CDC_DMM_TYPE 0x14 #define USB_CDC_OBEX_TYPE 0x15 #define USB_CDC_NCM_TYPE 0x1a #define USB_CDC_MBIM_TYPE 0x1b #define USB_CDC_MBIM_EXTENDED_TYPE 0x1c /* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ struct usb_cdc_header_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdCDC; } __attribute__ ((packed)); /* "Call Management Descriptor" from CDC spec 5.2.3.2 */ struct usb_cdc_call_mgmt_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bmCapabilities; #define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01 #define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02 __u8 bDataInterface; } __attribute__ ((packed)); /* "Abstract Control Management Descriptor" from CDC spec 5.2.3.3 */ struct usb_cdc_acm_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bmCapabilities; } __attribute__ ((packed)); /* capabilities from 5.2.3.3 */ #define USB_CDC_COMM_FEATURE 0x01 #define USB_CDC_CAP_LINE 0x02 #define USB_CDC_CAP_BRK 0x04 #define USB_CDC_CAP_NOTIFY 0x08 /* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ struct usb_cdc_union_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bMasterInterface0; __u8 bSlaveInterface0; /* ... and there could be other slave interfaces */ } __attribute__ ((packed)); /* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */ struct usb_cdc_country_functional_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 iCountryCodeRelDate; __le16 wCountyCode0; /* ... and there can be a lot of country codes */ } __attribute__ ((packed)); /* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ struct usb_cdc_network_terminal_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bEntityId; __u8 iName; __u8 bChannelIndex; __u8 bPhysicalInterface; } __attribute__ ((packed)); /* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */ struct usb_cdc_ether_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 iMACAddress; __le32 bmEthernetStatistics; __le16 wMaxSegmentSize; __le16 wNumberMCFilters; __u8 bNumberPowerFilters; } __attribute__ ((packed)); /* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */ struct usb_cdc_dmm_desc { __u8 bFunctionLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u16 bcdVersion; __le16 wMaxCommand; } __attribute__ ((packed)); /* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ struct usb_cdc_mdlm_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdVersion; __u8 bGUID[16]; } __attribute__ ((packed)); /* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */ struct usb_cdc_mdlm_detail_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; /* type is associated with mdlm_desc.bGUID */ __u8 bGuidDescriptorType; __u8 bDetailData[0]; } __attribute__ ((packed)); /* "OBEX Control Model Functional Descriptor" */ struct usb_cdc_obex_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdVersion; } __attribute__ ((packed)); /* "NCM Control Model Functional Descriptor" */ struct usb_cdc_ncm_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdNcmVersion; __u8 bmNetworkCapabilities; } __attribute__ ((packed)); /* "MBIM Control Model Functional Descriptor" */ struct usb_cdc_mbim_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdMBIMVersion; __le16 wMaxControlMessage; __u8 bNumberFilters; __u8 bMaxFilterSize; __le16 wMaxSegmentSize; __u8 bmNetworkCapabilities; } __attribute__ ((packed)); /* "MBIM Extended Functional Descriptor" from CDC MBIM spec 1.0 errata-1 */ struct usb_cdc_mbim_extended_desc { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdMBIMExtendedVersion; __u8 bMaxOutstandingCommandMessages; __le16 wMTU; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * Class-Specific Control Requests (6.2) * * section 3.6.2.1 table 4 has the ACM profile, for modems. * section 3.8.2 table 10 has the ethernet profile. * * Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant, * heavily dependent on the encapsulated (proprietary) command mechanism. */ #define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 #define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 #define USB_CDC_REQ_SET_LINE_CODING 0x20 #define USB_CDC_REQ_GET_LINE_CODING 0x21 #define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 #define USB_CDC_REQ_SEND_BREAK 0x23 #define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 #define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 #define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 #define USB_CDC_GET_ETHERNET_STATISTIC 0x44 #define USB_CDC_GET_NTB_PARAMETERS 0x80 #define USB_CDC_GET_NET_ADDRESS 0x81 #define USB_CDC_SET_NET_ADDRESS 0x82 #define USB_CDC_GET_NTB_FORMAT 0x83 #define USB_CDC_SET_NTB_FORMAT 0x84 #define USB_CDC_GET_NTB_INPUT_SIZE 0x85 #define USB_CDC_SET_NTB_INPUT_SIZE 0x86 #define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87 #define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88 #define USB_CDC_GET_CRC_MODE 0x89 #define USB_CDC_SET_CRC_MODE 0x8a /* Line Coding Structure from CDC spec 6.2.13 */ struct usb_cdc_line_coding { __le32 dwDTERate; __u8 bCharFormat; #define USB_CDC_1_STOP_BITS 0 #define USB_CDC_1_5_STOP_BITS 1 #define USB_CDC_2_STOP_BITS 2 __u8 bParityType; #define USB_CDC_NO_PARITY 0 #define USB_CDC_ODD_PARITY 1 #define USB_CDC_EVEN_PARITY 2 #define USB_CDC_MARK_PARITY 3 #define USB_CDC_SPACE_PARITY 4 __u8 bDataBits; } __attribute__ ((packed)); /* Control Signal Bitmap Values from 6.2.14 SetControlLineState */ #define USB_CDC_CTRL_DTR (1 << 0) #define USB_CDC_CTRL_RTS (1 << 1) /* table 62; bits in multicast filter */ #define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0) #define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */ #define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2) #define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3) #define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */ /*-------------------------------------------------------------------------*/ /* * Class-Specific Notifications (6.3) sent by interrupt transfers * * section 3.8.2 table 11 of the CDC spec lists Ethernet notifications * section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS * RNDIS also defines its own bit-incompatible notifications */ #define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00 #define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01 #define USB_CDC_NOTIFY_SERIAL_STATE 0x20 #define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a struct usb_cdc_notification { __u8 bmRequestType; __u8 bNotificationType; __le16 wValue; __le16 wIndex; __le16 wLength; } __attribute__ ((packed)); /* UART State Bitmap Values from 6.3.5 SerialState */ #define USB_CDC_SERIAL_STATE_DCD (1 << 0) #define USB_CDC_SERIAL_STATE_DSR (1 << 1) #define USB_CDC_SERIAL_STATE_BREAK (1 << 2) #define USB_CDC_SERIAL_STATE_RING_SIGNAL (1 << 3) #define USB_CDC_SERIAL_STATE_FRAMING (1 << 4) #define USB_CDC_SERIAL_STATE_PARITY (1 << 5) #define USB_CDC_SERIAL_STATE_OVERRUN (1 << 6) struct usb_cdc_speed_change { __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */ __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */ } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * Class Specific structures and constants * * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1 * */ struct usb_cdc_ncm_ntb_parameters { __le16 wLength; __le16 bmNtbFormatsSupported; __le32 dwNtbInMaxSize; __le16 wNdpInDivisor; __le16 wNdpInPayloadRemainder; __le16 wNdpInAlignment; __le16 wPadding1; __le32 dwNtbOutMaxSize; __le16 wNdpOutDivisor; __le16 wNdpOutPayloadRemainder; __le16 wNdpOutAlignment; __le16 wNtbOutMaxDatagrams; } __attribute__ ((packed)); /* * CDC NCM transfer headers, CDC NCM subclass 3.2 */ #define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */ #define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */ struct usb_cdc_ncm_nth16 { __le32 dwSignature; __le16 wHeaderLength; __le16 wSequence; __le16 wBlockLength; __le16 wNdpIndex; } __attribute__ ((packed)); struct usb_cdc_ncm_nth32 { __le32 dwSignature; __le16 wHeaderLength; __le16 wSequence; __le32 dwBlockLength; __le32 dwNdpIndex; } __attribute__ ((packed)); /* * CDC NCM datagram pointers, CDC NCM subclass 3.3 */ #define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ #define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ #define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ #define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ #define USB_CDC_MBIM_NDP16_IPS_SIGN 0x00535049 /* IPS<sessionID> : IPS0 for now */ #define USB_CDC_MBIM_NDP32_IPS_SIGN 0x00737069 /* ips<sessionID> : ips0 for now */ #define USB_CDC_MBIM_NDP16_DSS_SIGN 0x00535344 /* DSS<sessionID> */ #define USB_CDC_MBIM_NDP32_DSS_SIGN 0x00737364 /* dss<sessionID> */ /* 16-bit NCM Datagram Pointer Entry */ struct usb_cdc_ncm_dpe16 { __le16 wDatagramIndex; __le16 wDatagramLength; } __attribute__((__packed__)); /* 16-bit NCM Datagram Pointer Table */ struct usb_cdc_ncm_ndp16 { __le32 dwSignature; __le16 wLength; __le16 wNextNdpIndex; struct usb_cdc_ncm_dpe16 dpe16[0]; } __attribute__ ((packed)); /* 32-bit NCM Datagram Pointer Entry */ struct usb_cdc_ncm_dpe32 { __le32 dwDatagramIndex; __le32 dwDatagramLength; } __attribute__((__packed__)); /* 32-bit NCM Datagram Pointer Table */ struct usb_cdc_ncm_ndp32 { __le32 dwSignature; __le16 wLength; __le16 wReserved6; __le32 dwNextNdpIndex; __le32 dwReserved12; struct usb_cdc_ncm_dpe32 dpe32[0]; } __attribute__ ((packed)); /* CDC NCM subclass 3.2.1 and 3.2.2 */ #define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C #define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010 /* CDC NCM subclass 3.3.3 Datagram Formatting */ #define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30 #define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31 /* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */ #define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00 #define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE /* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */ #define USB_CDC_NCM_NCAP_ETH_FILTER (1 << 0) #define USB_CDC_NCM_NCAP_NET_ADDRESS (1 << 1) #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) #define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5) /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) #define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1) /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ #define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04 #define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C /* CDC NCM subclass 6.2.5 SetNtbFormat */ #define USB_CDC_NCM_NTB16_FORMAT 0x00 #define USB_CDC_NCM_NTB32_FORMAT 0x01 /* CDC NCM subclass 6.2.7 SetNtbInputSize */ #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 /* NTB Input Size Structure */ struct usb_cdc_ncm_ndp_input_size { __le32 dwNtbInMaxSize; __le16 wNtbInMaxDatagrams; __le16 wReserved; } __attribute__ ((packed)); /* CDC NCM subclass 6.2.11 SetCrcMode */ #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 #define USB_CDC_NCM_CRC_APPENDED 0x01 #endif /* __UAPI_LINUX_USB_CDC_H */ linux/usb/ch11.h 0000644 00000021675 15063602055 0007416 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file holds Hub protocol constants and data structures that are * defined in chapter 11 (Hub Specification) of the USB 2.0 specification. * * It is used/shared between the USB core, the HCDs and couple of other USB * drivers. */ #ifndef __LINUX_CH11_H #define __LINUX_CH11_H #include <linux/types.h> /* __u8 etc */ /* This is arbitrary. * From USB 2.0 spec Table 11-13, offset 7, a hub can * have up to 255 ports. The most yet reported is 10. * * Current Wireless USB host hardware (Intel i1480 for example) allows * up to 22 devices to connect. Upcoming hardware might raise that * limit. Because the arrays need to add a bit for hub status data, we * use 31, so plus one evens out to four bytes. */ #define USB_MAXCHILDREN 31 /* See USB 3.1 spec Table 10-5 */ #define USB_SS_MAXPORTS 15 /* * Hub request types */ #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) /* * Port status type for GetPortStatus requests added in USB 3.1 * See USB 3.1 spec Table 10-12 */ #define HUB_PORT_STATUS 0 #define HUB_PORT_PD_STATUS 1 #define HUB_EXT_PORT_STATUS 2 /* * Hub class requests * See USB 2.0 spec Table 11-16 */ #define HUB_CLEAR_TT_BUFFER 8 #define HUB_RESET_TT 9 #define HUB_GET_TT_STATE 10 #define HUB_STOP_TT 11 /* * Hub class additional requests defined by USB 3.0 spec * See USB 3.0 spec Table 10-6 */ #define HUB_SET_DEPTH 12 #define HUB_GET_PORT_ERR_COUNT 13 /* * Hub Class feature numbers * See USB 2.0 spec Table 11-17 */ #define C_HUB_LOCAL_POWER 0 #define C_HUB_OVER_CURRENT 1 /* * Port feature numbers * See USB 2.0 spec Table 11-17 */ #define USB_PORT_FEAT_CONNECTION 0 #define USB_PORT_FEAT_ENABLE 1 #define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */ #define USB_PORT_FEAT_OVER_CURRENT 3 #define USB_PORT_FEAT_RESET 4 #define USB_PORT_FEAT_L1 5 /* L1 suspend */ #define USB_PORT_FEAT_POWER 8 #define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */ #define USB_PORT_FEAT_C_CONNECTION 16 #define USB_PORT_FEAT_C_ENABLE 17 #define USB_PORT_FEAT_C_SUSPEND 18 #define USB_PORT_FEAT_C_OVER_CURRENT 19 #define USB_PORT_FEAT_C_RESET 20 #define USB_PORT_FEAT_TEST 21 #define USB_PORT_FEAT_INDICATOR 22 #define USB_PORT_FEAT_C_PORT_L1 23 /* * Port feature selectors added by USB 3.0 spec. * See USB 3.0 spec Table 10-7 */ #define USB_PORT_FEAT_LINK_STATE 5 #define USB_PORT_FEAT_U1_TIMEOUT 23 #define USB_PORT_FEAT_U2_TIMEOUT 24 #define USB_PORT_FEAT_C_PORT_LINK_STATE 25 #define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26 #define USB_PORT_FEAT_REMOTE_WAKE_MASK 27 #define USB_PORT_FEAT_BH_PORT_RESET 28 #define USB_PORT_FEAT_C_BH_PORT_RESET 29 #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 #define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8) /* USB 3.0 hub remote wake mask bits, see table 10-14 */ #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10) /* * Hub Status and Hub Change results * See USB 2.0 spec Table 11-19 and Table 11-20 * USB 3.1 extends the port status request and may return 4 additional bytes. * See USB 3.1 spec section 10.16.2.6 Table 10-12 and 10-15 */ struct usb_port_status { __le16 wPortStatus; __le16 wPortChange; __le32 dwExtPortStatus; } __attribute__ ((packed)); /* * wPortStatus bit field * See USB 2.0 spec Table 11-21 */ #define USB_PORT_STAT_CONNECTION 0x0001 #define USB_PORT_STAT_ENABLE 0x0002 #define USB_PORT_STAT_SUSPEND 0x0004 #define USB_PORT_STAT_OVERCURRENT 0x0008 #define USB_PORT_STAT_RESET 0x0010 #define USB_PORT_STAT_L1 0x0020 /* bits 6 to 7 are reserved */ #define USB_PORT_STAT_POWER 0x0100 #define USB_PORT_STAT_LOW_SPEED 0x0200 #define USB_PORT_STAT_HIGH_SPEED 0x0400 #define USB_PORT_STAT_TEST 0x0800 #define USB_PORT_STAT_INDICATOR 0x1000 /* bits 13 to 15 are reserved */ /* * Additions to wPortStatus bit field from USB 3.0 * See USB 3.0 spec Table 10-10 */ #define USB_PORT_STAT_LINK_STATE 0x01e0 #define USB_SS_PORT_STAT_POWER 0x0200 #define USB_SS_PORT_STAT_SPEED 0x1c00 #define USB_PORT_STAT_SPEED_5GBPS 0x0000 /* Valid only if port is enabled */ /* Bits that are the same from USB 2.0 */ #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \ USB_PORT_STAT_ENABLE | \ USB_PORT_STAT_OVERCURRENT | \ USB_PORT_STAT_RESET) /* * Definitions for PORT_LINK_STATE values * (bits 5-8) in wPortStatus */ #define USB_SS_PORT_LS_U0 0x0000 #define USB_SS_PORT_LS_U1 0x0020 #define USB_SS_PORT_LS_U2 0x0040 #define USB_SS_PORT_LS_U3 0x0060 #define USB_SS_PORT_LS_SS_DISABLED 0x0080 #define USB_SS_PORT_LS_RX_DETECT 0x00a0 #define USB_SS_PORT_LS_SS_INACTIVE 0x00c0 #define USB_SS_PORT_LS_POLLING 0x00e0 #define USB_SS_PORT_LS_RECOVERY 0x0100 #define USB_SS_PORT_LS_HOT_RESET 0x0120 #define USB_SS_PORT_LS_COMP_MOD 0x0140 #define USB_SS_PORT_LS_LOOPBACK 0x0160 /* * wPortChange bit field * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10 * Bits 0 to 5 shown, bits 6 to 15 are reserved */ #define USB_PORT_STAT_C_CONNECTION 0x0001 #define USB_PORT_STAT_C_ENABLE 0x0002 #define USB_PORT_STAT_C_SUSPEND 0x0004 #define USB_PORT_STAT_C_OVERCURRENT 0x0008 #define USB_PORT_STAT_C_RESET 0x0010 #define USB_PORT_STAT_C_L1 0x0020 /* * USB 3.0 wPortChange bit fields * See USB 3.0 spec Table 10-11 */ #define USB_PORT_STAT_C_BH_RESET 0x0020 #define USB_PORT_STAT_C_LINK_STATE 0x0040 #define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 /* * USB 3.1 dwExtPortStatus field masks * See USB 3.1 spec 10.16.2.6.3 Table 10-15 */ #define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f #define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0 #define USB_EXT_PORT_STAT_RX_LANES 0x00000f00 #define USB_EXT_PORT_STAT_TX_LANES 0x0000f000 #define USB_EXT_PORT_RX_LANES(p) \ (((p) & USB_EXT_PORT_STAT_RX_LANES) >> 8) #define USB_EXT_PORT_TX_LANES(p) \ (((p) & USB_EXT_PORT_STAT_TX_LANES) >> 12) /* * wHubCharacteristics (masks) * See USB 2.0 spec Table 11-13, offset 3 */ #define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */ #define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */ #define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */ #define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */ #define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */ #define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */ #define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */ #define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */ #define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */ #define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */ #define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */ struct usb_hub_status { __le16 wHubStatus; __le16 wHubChange; } __attribute__ ((packed)); /* * Hub Status & Hub Change bit masks * See USB 2.0 spec Table 11-19 and Table 11-20 * Bits 0 and 1 for wHubStatus and wHubChange * Bits 2 to 15 are reserved for both */ #define HUB_STATUS_LOCAL_POWER 0x0001 #define HUB_STATUS_OVERCURRENT 0x0002 #define HUB_CHANGE_LOCAL_POWER 0x0001 #define HUB_CHANGE_OVERCURRENT 0x0002 /* * Hub descriptor * See USB 2.0 spec Table 11-13 */ #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) #define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a) #define USB_DT_HUB_NONVAR_SIZE 7 #define USB_DT_SS_HUB_SIZE 12 /* * Hub Device descriptor * USB Hub class device protocols */ #define USB_HUB_PR_FS 0 /* Full speed hub */ #define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */ #define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */ #define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */ #define USB_HUB_PR_SS 3 /* Super speed hub */ struct usb_hub_descriptor { __u8 bDescLength; __u8 bDescriptorType; __u8 bNbrPorts; __le16 wHubCharacteristics; __u8 bPwrOn2PwrGood; __u8 bHubContrCurrent; /* 2.0 and 3.0 hubs differ here */ union { struct { /* add 1 bit for hub status change; round to bytes */ __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; } __attribute__ ((packed)) hs; struct { __u8 bHubHdrDecLat; __le16 wHubDelay; __le16 DeviceRemovable; } __attribute__ ((packed)) ss; } u; } __attribute__ ((packed)); /* port indicator status selectors, tables 11-7 and 11-25 */ #define HUB_LED_AUTO 0 #define HUB_LED_AMBER 1 #define HUB_LED_GREEN 2 #define HUB_LED_OFF 3 enum hub_led_mode { INDICATOR_AUTO = 0, INDICATOR_CYCLE, /* software blinks for attention: software, hardware, reserved */ INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF, INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF, INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF } __attribute__ ((packed)); /* Transaction Translator Think Times, in bits */ #define HUB_TTTT_8_BITS 0x00 #define HUB_TTTT_16_BITS 0x20 #define HUB_TTTT_24_BITS 0x40 #define HUB_TTTT_32_BITS 0x60 #endif /* __LINUX_CH11_H */ linux/usb/ch9.h 0000644 00000115142 15063602055 0007336 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file holds USB constants and structures that are needed for * USB device APIs. These are used by the USB device model, which is * defined in chapter 9 of the USB 2.0 specification and in the * Wireless USB 1.0 (spread around). Linux has several APIs in C that * need these: * * - the master/host side Linux-USB kernel driver API; * - the "usbfs" user space API; and * - the Linux "gadget" slave/device/peripheral side driver API. * * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems * act either as a USB master/host or as a USB slave/device. That means * the master and slave side APIs benefit from working well together. * * There's also "Wireless USB", using low power short range radios for * peripheral interconnection but otherwise building on the USB framework. * * Note all descriptors are declared '__attribute__((packed))' so that: * * [a] they never get padded, either internally (USB spec writers * probably handled that) or externally; * * [b] so that accessing bigger-than-a-bytes fields will never * generate bus errors on any platform, even when the location of * its descriptor inside a bundle isn't "naturally aligned", and * * [c] for consistency, removing all doubt even when it appears to * someone that the two other points are non-issues for that * particular descriptor type. */ #ifndef __LINUX_USB_CH9_H #define __LINUX_USB_CH9_H #include <linux/types.h> /* __u8 etc */ #include <asm/byteorder.h> /* le16_to_cpu */ /*-------------------------------------------------------------------------*/ /* CONTROL REQUEST SUPPORT */ /* * USB directions * * This bit flag is used in endpoint descriptors' bEndpointAddress field. * It's also one of three fields in control requests bRequestType. */ #define USB_DIR_OUT 0 /* to device */ #define USB_DIR_IN 0x80 /* to host */ /* * USB types, the second of three bRequestType fields */ #define USB_TYPE_MASK (0x03 << 5) #define USB_TYPE_STANDARD (0x00 << 5) #define USB_TYPE_CLASS (0x01 << 5) #define USB_TYPE_VENDOR (0x02 << 5) #define USB_TYPE_RESERVED (0x03 << 5) /* * USB recipients, the third of three bRequestType fields */ #define USB_RECIP_MASK 0x1f #define USB_RECIP_DEVICE 0x00 #define USB_RECIP_INTERFACE 0x01 #define USB_RECIP_ENDPOINT 0x02 #define USB_RECIP_OTHER 0x03 /* From Wireless USB 1.0 */ #define USB_RECIP_PORT 0x04 #define USB_RECIP_RPIPE 0x05 /* * Standard requests, for the bRequest field of a SETUP packet. * * These are qualified by the bRequestType field, so that for example * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved * by a GET_STATUS request. */ #define USB_REQ_GET_STATUS 0x00 #define USB_REQ_CLEAR_FEATURE 0x01 #define USB_REQ_SET_FEATURE 0x03 #define USB_REQ_SET_ADDRESS 0x05 #define USB_REQ_GET_DESCRIPTOR 0x06 #define USB_REQ_SET_DESCRIPTOR 0x07 #define USB_REQ_GET_CONFIGURATION 0x08 #define USB_REQ_SET_CONFIGURATION 0x09 #define USB_REQ_GET_INTERFACE 0x0A #define USB_REQ_SET_INTERFACE 0x0B #define USB_REQ_SYNCH_FRAME 0x0C #define USB_REQ_SET_SEL 0x30 #define USB_REQ_SET_ISOCH_DELAY 0x31 #define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ #define USB_REQ_GET_ENCRYPTION 0x0E #define USB_REQ_RPIPE_ABORT 0x0E #define USB_REQ_SET_HANDSHAKE 0x0F #define USB_REQ_RPIPE_RESET 0x0F #define USB_REQ_GET_HANDSHAKE 0x10 #define USB_REQ_SET_CONNECTION 0x11 #define USB_REQ_SET_SECURITY_DATA 0x12 #define USB_REQ_GET_SECURITY_DATA 0x13 #define USB_REQ_SET_WUSB_DATA 0x14 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15 #define USB_REQ_LOOPBACK_DATA_READ 0x16 #define USB_REQ_SET_INTERFACE_DS 0x17 /* specific requests for USB Power Delivery */ #define USB_REQ_GET_PARTNER_PDO 20 #define USB_REQ_GET_BATTERY_STATUS 21 #define USB_REQ_SET_PDO 22 #define USB_REQ_GET_VDM 23 #define USB_REQ_SEND_VDM 24 /* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command, * used by hubs to put ports into a new L1 suspend state, except that it * forgot to define its number ... */ /* * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and * are read as a bit array returned by USB_REQ_GET_STATUS. (So there * are at most sixteen features of each type.) Hubs may also support a * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend. */ #define USB_DEVICE_SELF_POWERED 0 /* (read only) */ #define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ #define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */ #define USB_DEVICE_BATTERY 2 /* (wireless) */ #define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */ #define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/ #define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */ #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ /* * Test Mode Selectors * See USB 2.0 spec Table 9-7 */ #define TEST_J 1 #define TEST_K 2 #define TEST_SE0_NAK 3 #define TEST_PACKET 4 #define TEST_FORCE_EN 5 /* Status Type */ #define USB_STATUS_TYPE_STANDARD 0 #define USB_STATUS_TYPE_PTM 1 /* * New Feature Selectors as added by USB 3.0 * See USB 3.0 spec Table 9-7 */ #define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */ #define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */ #define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */ #define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */ #define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00 /* * Suspend Options, Table 9-8 USB 3.0 spec */ #define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0)) #define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1)) /* * Interface status, Figure 9-5 USB 3.0 spec */ #define USB_INTRF_STAT_FUNC_RW_CAP 1 #define USB_INTRF_STAT_FUNC_RW 2 #define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ /* Bit array elements as returned by the USB_REQ_GET_STATUS request. */ #define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */ #define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */ #define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */ /* * Feature selectors from Table 9-8 USB Power Delivery spec */ #define USB_DEVICE_BATTERY_WAKE_MASK 40 #define USB_DEVICE_OS_IS_PD_AWARE 41 #define USB_DEVICE_POLICY_MODE 42 #define USB_PORT_PR_SWAP 43 #define USB_PORT_GOTO_MIN 44 #define USB_PORT_RETURN_POWER 45 #define USB_PORT_ACCEPT_PD_REQUEST 46 #define USB_PORT_REJECT_PD_REQUEST 47 #define USB_PORT_PORT_PD_RESET 48 #define USB_PORT_C_PORT_PD_CHANGE 49 #define USB_PORT_CABLE_PD_RESET 50 #define USB_DEVICE_CHARGING_POLICY 54 /** * struct usb_ctrlrequest - SETUP data for a USB device control request * @bRequestType: matches the USB bmRequestType field * @bRequest: matches the USB bRequest field * @wValue: matches the USB wValue field (le16 byte order) * @wIndex: matches the USB wIndex field (le16 byte order) * @wLength: matches the USB wLength field (le16 byte order) * * This structure is used to send control requests to a USB device. It matches * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the * USB spec for a fuller description of the different fields, and what they are * used for. * * Note that the driver for any interface can issue control requests. * For most devices, interfaces don't coordinate with each other, so * such requests may be made at any time. */ struct usb_ctrlrequest { __u8 bRequestType; __u8 bRequest; __le16 wValue; __le16 wIndex; __le16 wLength; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or * (rarely) accepted by SET_DESCRIPTOR. * * Note that all multi-byte values here are encoded in little endian * byte order "on the wire". Within the kernel and when exposed * through the Linux-USB APIs, they are not converted to cpu byte * order; it is the responsibility of the client code to do this. * The single exception is when device and configuration descriptors (but * not other descriptors) are read from character devices * (i.e. /dev/bus/usb/BBB/DDD); * in this case the fields are converted to host endianness by the kernel. */ /* * Descriptor types ... USB 2.0 spec table 9.5 */ #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 #define USB_DT_STRING 0x03 #define USB_DT_INTERFACE 0x04 #define USB_DT_ENDPOINT 0x05 #define USB_DT_DEVICE_QUALIFIER 0x06 #define USB_DT_OTHER_SPEED_CONFIG 0x07 #define USB_DT_INTERFACE_POWER 0x08 /* these are from a minor usb 2.0 revision (ECN) */ #define USB_DT_OTG 0x09 #define USB_DT_DEBUG 0x0a #define USB_DT_INTERFACE_ASSOCIATION 0x0b /* these are from the Wireless USB spec */ #define USB_DT_SECURITY 0x0c #define USB_DT_KEY 0x0d #define USB_DT_ENCRYPTION_TYPE 0x0e #define USB_DT_BOS 0x0f #define USB_DT_DEVICE_CAPABILITY 0x10 #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 #define USB_DT_WIRE_ADAPTER 0x21 #define USB_DT_RPIPE 0x22 #define USB_DT_CS_RADIO_CONTROL 0x23 /* From the T10 UAS specification */ #define USB_DT_PIPE_USAGE 0x24 /* From the USB 3.0 spec */ #define USB_DT_SS_ENDPOINT_COMP 0x30 /* From the USB 3.1 spec */ #define USB_DT_SSP_ISOC_ENDPOINT_COMP 0x31 /* Conventional codes for class-specific descriptors. The convention is * defined in the USB "Common Class" Spec (3.11). Individual class specs * are authoritative for their usage, not the "common class" writeup. */ #define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE) #define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG) #define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING) #define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE) #define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT) /* All standard descriptors have these 2 fields at the beginning */ struct usb_descriptor_header { __u8 bLength; __u8 bDescriptorType; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE: Device descriptor */ struct usb_device_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __le16 idVendor; __le16 idProduct; __le16 bcdDevice; __u8 iManufacturer; __u8 iProduct; __u8 iSerialNumber; __u8 bNumConfigurations; } __attribute__ ((packed)); #define USB_DT_DEVICE_SIZE 18 /* * Device and/or Interface Class codes * as found in bDeviceClass or bInterfaceClass * and defined by www.usb.org documents */ #define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ #define USB_CLASS_AUDIO 1 #define USB_CLASS_COMM 2 #define USB_CLASS_HID 3 #define USB_CLASS_PHYSICAL 5 #define USB_CLASS_STILL_IMAGE 6 #define USB_CLASS_PRINTER 7 #define USB_CLASS_MASS_STORAGE 8 #define USB_CLASS_HUB 9 #define USB_CLASS_CDC_DATA 0x0a #define USB_CLASS_CSCID 0x0b /* chip+ smart card */ #define USB_CLASS_CONTENT_SEC 0x0d /* content security */ #define USB_CLASS_VIDEO 0x0e #define USB_CLASS_WIRELESS_CONTROLLER 0xe0 #define USB_CLASS_PERSONAL_HEALTHCARE 0x0f #define USB_CLASS_AUDIO_VIDEO 0x10 #define USB_CLASS_BILLBOARD 0x11 #define USB_CLASS_USB_TYPE_C_BRIDGE 0x12 #define USB_CLASS_MISC 0xef #define USB_CLASS_APP_SPEC 0xfe #define USB_CLASS_VENDOR_SPEC 0xff #define USB_SUBCLASS_VENDOR_SPEC 0xff /*-------------------------------------------------------------------------*/ /* USB_DT_CONFIG: Configuration descriptor information. * * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the * descriptor type is different. Highspeed-capable devices can look * different depending on what speed they're currently running. Only * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG * descriptors. */ struct usb_config_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumInterfaces; __u8 bConfigurationValue; __u8 iConfiguration; __u8 bmAttributes; __u8 bMaxPower; } __attribute__ ((packed)); #define USB_DT_CONFIG_SIZE 9 /* from config descriptor bmAttributes */ #define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */ #define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */ #define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */ #define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */ /*-------------------------------------------------------------------------*/ /* USB String descriptors can contain at most 126 characters. */ #define USB_MAX_STRING_LEN 126 /* USB_DT_STRING: String descriptor */ struct usb_string_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wData[1]; /* UTF-16LE encoded */ } __attribute__ ((packed)); /* note that "string" zero is special, it holds language codes that * the device supports, not Unicode characters. */ /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE: Interface descriptor */ struct usb_interface_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bInterfaceNumber; __u8 bAlternateSetting; __u8 bNumEndpoints; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; __u8 iInterface; } __attribute__ ((packed)); #define USB_DT_INTERFACE_SIZE 9 /*-------------------------------------------------------------------------*/ /* USB_DT_ENDPOINT: Endpoint descriptor */ struct usb_endpoint_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEndpointAddress; __u8 bmAttributes; __le16 wMaxPacketSize; __u8 bInterval; /* NOTE: these two are _only_ in audio endpoints. */ /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */ __u8 bRefresh; __u8 bSynchAddress; } __attribute__ ((packed)); #define USB_DT_ENDPOINT_SIZE 7 #define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ /* * Endpoints */ #define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */ #define USB_ENDPOINT_DIR_MASK 0x80 #define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ #define USB_ENDPOINT_XFER_CONTROL 0 #define USB_ENDPOINT_XFER_ISOC 1 #define USB_ENDPOINT_XFER_BULK 2 #define USB_ENDPOINT_XFER_INT 3 #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 #define USB_ENDPOINT_MAXP_MASK 0x07ff #define USB_EP_MAXP_MULT_SHIFT 11 #define USB_EP_MAXP_MULT_MASK (3 << USB_EP_MAXP_MULT_SHIFT) #define USB_EP_MAXP_MULT(m) \ (((m) & USB_EP_MAXP_MULT_MASK) >> USB_EP_MAXP_MULT_SHIFT) /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */ #define USB_ENDPOINT_INTRTYPE 0x30 #define USB_ENDPOINT_INTR_PERIODIC (0 << 4) #define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4) #define USB_ENDPOINT_SYNCTYPE 0x0c #define USB_ENDPOINT_SYNC_NONE (0 << 2) #define USB_ENDPOINT_SYNC_ASYNC (1 << 2) #define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2) #define USB_ENDPOINT_SYNC_SYNC (3 << 2) #define USB_ENDPOINT_USAGE_MASK 0x30 #define USB_ENDPOINT_USAGE_DATA 0x00 #define USB_ENDPOINT_USAGE_FEEDBACK 0x10 #define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */ /*-------------------------------------------------------------------------*/ /** * usb_endpoint_num - get the endpoint's number * @epd: endpoint to be checked * * Returns @epd's number: 0 to 15. */ static __inline__ int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) { return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; } /** * usb_endpoint_type - get the endpoint's transfer type * @epd: endpoint to be checked * * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according * to @epd's transfer type. */ static __inline__ int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) { return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; } /** * usb_endpoint_dir_in - check if the endpoint has IN direction * @epd: endpoint to be checked * * Returns true if the endpoint is of type IN, otherwise it returns false. */ static __inline__ int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) { return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); } /** * usb_endpoint_dir_out - check if the endpoint has OUT direction * @epd: endpoint to be checked * * Returns true if the endpoint is of type OUT, otherwise it returns false. */ static __inline__ int usb_endpoint_dir_out( const struct usb_endpoint_descriptor *epd) { return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); } /** * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type bulk, otherwise it returns false. */ static __inline__ int usb_endpoint_xfer_bulk( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK); } /** * usb_endpoint_xfer_control - check if the endpoint has control transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type control, otherwise it returns false. */ static __inline__ int usb_endpoint_xfer_control( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_CONTROL); } /** * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type interrupt, otherwise it returns * false. */ static __inline__ int usb_endpoint_xfer_int( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT); } /** * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type * @epd: endpoint to be checked * * Returns true if the endpoint is of type isochronous, otherwise it returns * false. */ static __inline__ int usb_endpoint_xfer_isoc( const struct usb_endpoint_descriptor *epd) { return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC); } /** * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN * @epd: endpoint to be checked * * Returns true if the endpoint has bulk transfer type and IN direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_bulk_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd); } /** * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT * @epd: endpoint to be checked * * Returns true if the endpoint has bulk transfer type and OUT direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_bulk_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd); } /** * usb_endpoint_is_int_in - check if the endpoint is interrupt IN * @epd: endpoint to be checked * * Returns true if the endpoint has interrupt transfer type and IN direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_int_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd); } /** * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT * @epd: endpoint to be checked * * Returns true if the endpoint has interrupt transfer type and OUT direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_int_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd); } /** * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN * @epd: endpoint to be checked * * Returns true if the endpoint has isochronous transfer type and IN direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_isoc_in( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd); } /** * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT * @epd: endpoint to be checked * * Returns true if the endpoint has isochronous transfer type and OUT direction, * otherwise it returns false. */ static __inline__ int usb_endpoint_is_isoc_out( const struct usb_endpoint_descriptor *epd) { return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd); } /** * usb_endpoint_maxp - get endpoint's max packet size * @epd: endpoint to be checked * * Returns @epd's max packet bits [10:0] */ static __inline__ int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) { return __le16_to_cpu(epd->wMaxPacketSize) & USB_ENDPOINT_MAXP_MASK; } /** * usb_endpoint_maxp_mult - get endpoint's transactional opportunities * @epd: endpoint to be checked * * Return @epd's wMaxPacketSize[12:11] + 1 */ static __inline__ int usb_endpoint_maxp_mult(const struct usb_endpoint_descriptor *epd) { int maxp = __le16_to_cpu(epd->wMaxPacketSize); return USB_EP_MAXP_MULT(maxp) + 1; } static __inline__ int usb_endpoint_interrupt_type( const struct usb_endpoint_descriptor *epd) { return epd->bmAttributes & USB_ENDPOINT_INTRTYPE; } /*-------------------------------------------------------------------------*/ /* USB_DT_SSP_ISOC_ENDPOINT_COMP: SuperSpeedPlus Isochronous Endpoint Companion * descriptor */ struct usb_ssp_isoc_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wReseved; __le32 dwBytesPerInterval; } __attribute__ ((packed)); #define USB_DT_SSP_ISOC_EP_COMP_SIZE 8 /*-------------------------------------------------------------------------*/ /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ struct usb_ss_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bmAttributes; __le16 wBytesPerInterval; } __attribute__ ((packed)); #define USB_DT_SS_EP_COMP_SIZE 6 /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ static __inline__ int usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp) { int max_streams; if (!comp) return 0; max_streams = comp->bmAttributes & 0x1f; if (!max_streams) return 0; max_streams = 1 << max_streams; return max_streams; } /* Bits 1:0 of bmAttributes if this is an isoc endpoint */ #define USB_SS_MULT(p) (1 + ((p) & 0x3)) /* Bit 7 of bmAttributes if a SSP isoc endpoint companion descriptor exists */ #define USB_SS_SSP_ISOC_COMP(p) ((p) & (1 << 7)) /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ struct usb_qualifier_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __u8 bNumConfigurations; __u8 bRESERVED; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_OTG (from OTG 1.0a supplement) */ struct usb_otg_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bmAttributes; /* support for HNP, SRP, etc */ } __attribute__ ((packed)); /* USB_DT_OTG (from OTG 2.0 supplement) */ struct usb_otg20_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bmAttributes; /* support for HNP, SRP and ADP, etc */ __le16 bcdOTG; /* OTG and EH supplement release number * in binary-coded decimal(i.e. 2.0 is 0200H) */ } __attribute__ ((packed)); /* from usb_otg_descriptor.bmAttributes */ #define USB_OTG_SRP (1 << 0) #define USB_OTG_HNP (1 << 1) /* swap host/device roles */ #define USB_OTG_ADP (1 << 2) /* support ADP */ #define OTG_STS_SELECTOR 0xF000 /* OTG status selector */ /*-------------------------------------------------------------------------*/ /* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ struct usb_debug_descriptor { __u8 bLength; __u8 bDescriptorType; /* bulk endpoints with 8 byte maxpacket */ __u8 bDebugInEndpoint; __u8 bDebugOutEndpoint; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */ struct usb_interface_assoc_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bFirstInterface; __u8 bInterfaceCount; __u8 bFunctionClass; __u8 bFunctionSubClass; __u8 bFunctionProtocol; __u8 iFunction; } __attribute__ ((packed)); #define USB_DT_INTERFACE_ASSOCIATION_SIZE 8 /*-------------------------------------------------------------------------*/ /* USB_DT_SECURITY: group of wireless security descriptors, including * encryption types available for setting up a CC/association. */ struct usb_security_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumEncryptionTypes; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys * may be retrieved. */ struct usb_key_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 tTKID[3]; __u8 bReserved; __u8 bKeyData[0]; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */ struct usb_encryption_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEncryptionType; #define USB_ENC_TYPE_UNSECURE 0 #define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */ #define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */ #define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ __u8 bEncryptionValue; /* use in SET_ENCRYPTION */ __u8 bAuthKeyIndex; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_DT_BOS: group of device-level capabilities */ struct usb_bos_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumDeviceCaps; } __attribute__((packed)); #define USB_DT_BOS_SIZE 5 /*-------------------------------------------------------------------------*/ /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ struct usb_dev_cap_header { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; } __attribute__((packed)); #define USB_CAP_TYPE_WIRELESS_USB 1 struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; #define USB_WIRELESS_P2P_DRD (1 << 1) #define USB_WIRELESS_BEACON_MASK (3 << 2) #define USB_WIRELESS_BEACON_SELF (1 << 2) #define USB_WIRELESS_BEACON_DIRECTED (2 << 2) #define USB_WIRELESS_BEACON_NONE (3 << 2) __le16 wPHYRates; /* bit rates, Mbps */ #define USB_WIRELESS_PHY_53 (1 << 0) /* always set */ #define USB_WIRELESS_PHY_80 (1 << 1) #define USB_WIRELESS_PHY_107 (1 << 2) /* always set */ #define USB_WIRELESS_PHY_160 (1 << 3) #define USB_WIRELESS_PHY_200 (1 << 4) /* always set */ #define USB_WIRELESS_PHY_320 (1 << 5) #define USB_WIRELESS_PHY_400 (1 << 6) #define USB_WIRELESS_PHY_480 (1 << 7) __u8 bmTFITXPowerInfo; /* TFI power levels */ __u8 bmFFITXPowerInfo; /* FFI power levels */ __le16 bmBandGroup; __u8 bReserved; } __attribute__((packed)); #define USB_DT_USB_WIRELESS_CAP_SIZE 11 /* USB 2.0 Extension descriptor */ #define USB_CAP_TYPE_EXT 2 struct usb_ext_cap_descriptor { /* Link Power Management */ __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __le32 bmAttributes; #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ #define USB_BESL_SUPPORT (1 << 2) /* supports BESL */ #define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/ #define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */ #define USB_SET_BESL_BASELINE(p) (((p) & 0xf) << 8) #define USB_SET_BESL_DEEP(p) (((p) & 0xf) << 12) #define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8) #define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12) } __attribute__((packed)); #define USB_DT_USB_EXT_CAP_SIZE 7 /* * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB * specific device level capabilities */ #define USB_SS_CAP_TYPE 3 struct usb_ss_cap_descriptor { /* Link Power Management */ __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; #define USB_LTM_SUPPORT (1 << 1) /* supports LTM */ __le16 wSpeedSupported; #define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */ #define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */ #define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */ #define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */ __u8 bFunctionalitySupport; __u8 bU1devExitLat; __le16 bU2DevExitLat; } __attribute__((packed)); #define USB_DT_USB_SS_CAP_SIZE 10 /* * Container ID Capability descriptor: Defines the instance unique ID used to * identify the instance across all operating modes */ #define CONTAINER_ID_TYPE 4 struct usb_ss_container_id_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __u8 ContainerID[16]; /* 128-bit number */ } __attribute__((packed)); #define USB_DT_USB_SS_CONTN_ID_SIZE 20 /* * SuperSpeed Plus USB Capability descriptor: Defines the set of * SuperSpeed Plus USB specific device level capabilities */ #define USB_SSP_CAP_TYPE 0xa struct usb_ssp_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __le32 bmAttributes; #define USB_SSP_SUBLINK_SPEED_ATTRIBS (0x1f << 0) /* sublink speed entries */ #define USB_SSP_SUBLINK_SPEED_IDS (0xf << 5) /* speed ID entries */ __le16 wFunctionalitySupport; #define USB_SSP_MIN_SUBLINK_SPEED_ATTRIBUTE_ID (0xf) #define USB_SSP_MIN_RX_LANE_COUNT (0xf << 8) #define USB_SSP_MIN_TX_LANE_COUNT (0xf << 12) __le16 wReserved; __le32 bmSublinkSpeedAttr[1]; /* list of sublink speed attrib entries */ #define USB_SSP_SUBLINK_SPEED_SSID (0xf) /* sublink speed ID */ #define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4) /* Lanespeed exponent */ #define USB_SSP_SUBLINK_SPEED_LSE_BPS 0 #define USB_SSP_SUBLINK_SPEED_LSE_KBPS 1 #define USB_SSP_SUBLINK_SPEED_LSE_MBPS 2 #define USB_SSP_SUBLINK_SPEED_LSE_GBPS 3 #define USB_SSP_SUBLINK_SPEED_ST (0x3 << 6) /* Sublink type */ #define USB_SSP_SUBLINK_SPEED_ST_SYM_RX 0 #define USB_SSP_SUBLINK_SPEED_ST_ASYM_RX 1 #define USB_SSP_SUBLINK_SPEED_ST_SYM_TX 2 #define USB_SSP_SUBLINK_SPEED_ST_ASYM_TX 3 #define USB_SSP_SUBLINK_SPEED_RSVD (0x3f << 8) /* Reserved */ #define USB_SSP_SUBLINK_SPEED_LP (0x3 << 14) /* Link protocol */ #define USB_SSP_SUBLINK_SPEED_LP_SS 0 #define USB_SSP_SUBLINK_SPEED_LP_SSP 1 #define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16) /* Lanespeed mantissa */ } __attribute__((packed)); /* * USB Power Delivery Capability Descriptor: * Defines capabilities for PD */ /* Defines the various PD Capabilities of this device */ #define USB_PD_POWER_DELIVERY_CAPABILITY 0x06 /* Provides information on each battery supported by the device */ #define USB_PD_BATTERY_INFO_CAPABILITY 0x07 /* The Consumer characteristics of a Port on the device */ #define USB_PD_PD_CONSUMER_PORT_CAPABILITY 0x08 /* The provider characteristics of a Port on the device */ #define USB_PD_PD_PROVIDER_PORT_CAPABILITY 0x09 struct usb_pd_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; /* set to USB_PD_POWER_DELIVERY_CAPABILITY */ __u8 bReserved; __le32 bmAttributes; #define USB_PD_CAP_BATTERY_CHARGING (1 << 1) /* supports Battery Charging specification */ #define USB_PD_CAP_USB_PD (1 << 2) /* supports USB Power Delivery specification */ #define USB_PD_CAP_PROVIDER (1 << 3) /* can provide power */ #define USB_PD_CAP_CONSUMER (1 << 4) /* can consume power */ #define USB_PD_CAP_CHARGING_POLICY (1 << 5) /* supports CHARGING_POLICY feature */ #define USB_PD_CAP_TYPE_C_CURRENT (1 << 6) /* supports power capabilities defined in the USB Type-C Specification */ #define USB_PD_CAP_PWR_AC (1 << 8) #define USB_PD_CAP_PWR_BAT (1 << 9) #define USB_PD_CAP_PWR_USE_V_BUS (1 << 14) __le16 bmProviderPorts; /* Bit zero refers to the UFP of the device */ __le16 bmConsumerPorts; __le16 bcdBCVersion; __le16 bcdPDVersion; __le16 bcdUSBTypeCVersion; } __attribute__((packed)); struct usb_pd_cap_battery_info_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; /* Index of string descriptor shall contain the user friendly name for this battery */ __u8 iBattery; /* Index of string descriptor shall contain the Serial Number String for this battery */ __u8 iSerial; __u8 iManufacturer; __u8 bBatteryId; /* uniquely identifies this battery in status Messages */ __u8 bReserved; /* * Shall contain the Battery Charge value above which this * battery is considered to be fully charged but not necessarily * “topped off.” */ __le32 dwChargedThreshold; /* in mWh */ /* * Shall contain the minimum charge level of this battery such * that above this threshold, a device can be assured of being * able to power up successfully (see Battery Charging 1.2). */ __le32 dwWeakThreshold; /* in mWh */ __le32 dwBatteryDesignCapacity; /* in mWh */ __le32 dwBatteryLastFullchargeCapacity; /* in mWh */ } __attribute__((packed)); struct usb_pd_cap_consumer_port_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __u8 bmCapabilities; /* port will oerate under: */ #define USB_PD_CAP_CONSUMER_BC (1 << 0) /* BC */ #define USB_PD_CAP_CONSUMER_PD (1 << 1) /* PD */ #define USB_PD_CAP_CONSUMER_TYPE_C (1 << 2) /* USB Type-C Current */ __le16 wMinVoltage; /* in 50mV units */ __le16 wMaxVoltage; /* in 50mV units */ __u16 wReserved; __le32 dwMaxOperatingPower; /* in 10 mW - operating at steady state */ __le32 dwMaxPeakPower; /* in 10mW units - operating at peak power */ __le32 dwMaxPeakPowerTime; /* in 100ms units - duration of peak */ #define USB_PD_CAP_CONSUMER_UNKNOWN_PEAK_POWER_TIME 0xffff } __attribute__((packed)); struct usb_pd_cap_provider_port_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved1; __u8 bmCapabilities; /* port will oerate under: */ #define USB_PD_CAP_PROVIDER_BC (1 << 0) /* BC */ #define USB_PD_CAP_PROVIDER_PD (1 << 1) /* PD */ #define USB_PD_CAP_PROVIDER_TYPE_C (1 << 2) /* USB Type-C Current */ __u8 bNumOfPDObjects; __u8 bReserved2; __le32 wPowerDataObject[]; } __attribute__((packed)); /* * Precision time measurement capability descriptor: advertised by devices and * hubs that support PTM */ #define USB_PTM_CAP_TYPE 0xb struct usb_ptm_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; } __attribute__((packed)); #define USB_DT_USB_PTM_ID_SIZE 3 /* * The size of the descriptor for the Sublink Speed Attribute Count * (SSAC) specified in bmAttributes[4:0]. SSAC is zero-based */ #define USB_DT_USB_SSP_CAP_SIZE(ssac) (12 + (ssac + 1) * 4) /*-------------------------------------------------------------------------*/ /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with * each endpoint descriptor for a wireless device */ struct usb_wireless_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bMaxSequence; __le16 wMaxStreamDelay; __le16 wOverTheAirPacketSize; __u8 bOverTheAirInterval; __u8 bmCompAttributes; #define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */ #define USB_ENDPOINT_SWITCH_NO 0 #define USB_ENDPOINT_SWITCH_SWITCH 1 #define USB_ENDPOINT_SWITCH_SCALE 2 } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless * host and a device for connection set up, mutual authentication, and * exchanging short lived session keys. The handshake depends on a CC. */ struct usb_handshake { __u8 bMessageNumber; __u8 bStatus; __u8 tTKID[3]; __u8 bReserved; __u8 CDID[16]; __u8 nonce[16]; __u8 MIC[8]; } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC). * A CC may also be set up using non-wireless secure channels (including * wired USB!), and some devices may support CCs with multiple hosts. */ struct usb_connection_context { __u8 CHID[16]; /* persistent host id */ __u8 CDID[16]; /* device id (unique w/in host context) */ __u8 CK[16]; /* connection key */ } __attribute__((packed)); /*-------------------------------------------------------------------------*/ /* USB 2.0 defines three speeds, here's how Linux identifies them */ enum usb_device_speed { USB_SPEED_UNKNOWN = 0, /* enumerating */ USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ USB_SPEED_HIGH, /* usb 2.0 */ USB_SPEED_WIRELESS, /* wireless (usb 2.5) */ USB_SPEED_SUPER, /* usb 3.0 */ USB_SPEED_SUPER_PLUS, /* usb 3.1 */ }; enum usb_device_state { /* NOTATTACHED isn't in the USB spec, and this state acts * the same as ATTACHED ... but it's clearer this way. */ USB_STATE_NOTATTACHED = 0, /* chapter 9 and authentication (wireless) device states */ USB_STATE_ATTACHED, USB_STATE_POWERED, /* wired */ USB_STATE_RECONNECTING, /* auth */ USB_STATE_UNAUTHENTICATED, /* auth */ USB_STATE_DEFAULT, /* limited function */ USB_STATE_ADDRESS, USB_STATE_CONFIGURED, /* most functions */ USB_STATE_SUSPENDED /* NOTE: there are actually four different SUSPENDED * states, returning to POWERED, DEFAULT, ADDRESS, or * CONFIGURED respectively when SOF tokens flow again. * At this level there's no difference between L1 and L2 * suspend states. (L2 being original USB 1.1 suspend.) */ }; enum usb3_link_state { USB3_LPM_U0 = 0, USB3_LPM_U1, USB3_LPM_U2, USB3_LPM_U3 }; /* * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1. * 0xff means the parent hub will accept transitions to U1, but will not * initiate a transition. * * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved * values. * * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2. * 0xff means the parent hub will accept transitions to U2, but will not * initiate a transition. * * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means * 65.024ms. */ #define USB3_LPM_DISABLED 0x0 #define USB3_LPM_U1_MAX_TIMEOUT 0x7F #define USB3_LPM_U2_MAX_TIMEOUT 0xFE #define USB3_LPM_DEVICE_INITIATED 0xFF struct usb_set_sel_req { __u8 u1_sel; __u8 u1_pel; __le16 u2_sel; __le16 u2_pel; } __attribute__ ((packed)); /* * The Set System Exit Latency control transfer provides one byte each for * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each * are two bytes long. */ #define USB3_LPM_MAX_U1_SEL_PEL 0xFF #define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF /*-------------------------------------------------------------------------*/ /* * As per USB compliance update, a device that is actively drawing * more than 100mA from USB must report itself as bus-powered in * the GetStatus(DEVICE) call. * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34 */ #define USB_SELF_POWER_VBUS_MAX_DRAW 100 #endif /* __LINUX_USB_CH9_H */ linux/usb/charger.h 0000644 00000001126 15063602056 0010263 0 ustar 00 /* * This file defines the USB charger type and state that are needed for * USB device APIs. */ #ifndef __LINUX_USB_CHARGER_H #define __LINUX_USB_CHARGER_H /* * USB charger type: * SDP (Standard Downstream Port) * DCP (Dedicated Charging Port) * CDP (Charging Downstream Port) * ACA (Accessory Charger Adapters) */ enum usb_charger_type { UNKNOWN_TYPE = 0, SDP_TYPE = 1, DCP_TYPE = 2, CDP_TYPE = 3, ACA_TYPE = 4, }; /* USB charger state */ enum usb_charger_state { USB_CHARGER_DEFAULT = 0, USB_CHARGER_PRESENT = 1, USB_CHARGER_ABSENT = 2, }; #endif /* __LINUX_USB_CHARGER_H */ linux/usb/functionfs.h 0000644 00000024202 15063602056 0011026 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_FUNCTIONFS_H__ #define __LINUX_FUNCTIONFS_H__ #include <linux/types.h> #include <linux/ioctl.h> #include <linux/usb/ch9.h> enum { FUNCTIONFS_DESCRIPTORS_MAGIC = 1, FUNCTIONFS_STRINGS_MAGIC = 2, FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3, }; enum functionfs_flags { FUNCTIONFS_HAS_FS_DESC = 1, FUNCTIONFS_HAS_HS_DESC = 2, FUNCTIONFS_HAS_SS_DESC = 4, FUNCTIONFS_HAS_MS_OS_DESC = 8, FUNCTIONFS_VIRTUAL_ADDR = 16, FUNCTIONFS_EVENTFD = 32, FUNCTIONFS_ALL_CTRL_RECIP = 64, FUNCTIONFS_CONFIG0_SETUP = 128, }; /* Descriptor of an non-audio endpoint */ struct usb_endpoint_descriptor_no_audio { __u8 bLength; __u8 bDescriptorType; __u8 bEndpointAddress; __u8 bmAttributes; __le16 wMaxPacketSize; __u8 bInterval; } __attribute__((packed)); struct usb_functionfs_descs_head_v2 { __le32 magic; __le32 length; __le32 flags; /* * __le32 fs_count, hs_count, fs_count; must be included manually in * the structure taking flags into consideration. */ } __attribute__((packed)); /* Legacy format, deprecated as of 3.14. */ struct usb_functionfs_descs_head { __le32 magic; __le32 length; __le32 fs_count; __le32 hs_count; } __attribute__((packed, deprecated)); /* MS OS Descriptor header */ struct usb_os_desc_header { __u8 interface; __le32 dwLength; __le16 bcdVersion; __le16 wIndex; union { struct { __u8 bCount; __u8 Reserved; }; __le16 wCount; }; } __attribute__((packed)); struct usb_ext_compat_desc { __u8 bFirstInterfaceNumber; __u8 Reserved1; __u8 CompatibleID[8]; __u8 SubCompatibleID[8]; __u8 Reserved2[6]; }; struct usb_ext_prop_desc { __le32 dwSize; __le32 dwPropertyDataType; __le16 wPropertyNameLength; } __attribute__((packed)); /* * Descriptors format: * * | off | name | type | description | * |-----+-----------+--------------+--------------------------------------| * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2 | * | 4 | length | LE32 | length of the whole data chunk | * | 8 | flags | LE32 | combination of functionfs_flags | * | | eventfd | LE32 | eventfd file descriptor | * | | fs_count | LE32 | number of full-speed descriptors | * | | hs_count | LE32 | number of high-speed descriptors | * | | ss_count | LE32 | number of super-speed descriptors | * | | os_count | LE32 | number of MS OS descriptors | * | | fs_descrs | Descriptor[] | list of full-speed descriptors | * | | hs_descrs | Descriptor[] | list of high-speed descriptors | * | | ss_descrs | Descriptor[] | list of super-speed descriptors | * | | os_descrs | OSDesc[] | list of MS OS descriptors | * * Depending on which flags are set, various fields may be missing in the * structure. Any flags that are not recognised cause the whole block to be * rejected with -ENOSYS. * * Legacy descriptors format (deprecated as of 3.14): * * | off | name | type | description | * |-----+-----------+--------------+--------------------------------------| * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC | * | 4 | length | LE32 | length of the whole data chunk | * | 8 | fs_count | LE32 | number of full-speed descriptors | * | 12 | hs_count | LE32 | number of high-speed descriptors | * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors | * | | hs_descrs | Descriptor[] | list of high-speed descriptors | * * All numbers must be in little endian order. * * Descriptor[] is an array of valid USB descriptors which have the following * format: * * | off | name | type | description | * |-----+-----------------+------+--------------------------| * | 0 | bLength | U8 | length of the descriptor | * | 1 | bDescriptorType | U8 | descriptor type | * | 2 | payload | | descriptor's payload | * * OSDesc[] is an array of valid MS OS Feature Descriptors which have one of * the following formats: * * | off | name | type | description | * |-----+-----------------+------+--------------------------| * | 0 | inteface | U8 | related interface number | * | 1 | dwLength | U32 | length of the descriptor | * | 5 | bcdVersion | U16 | currently supported: 1 | * | 7 | wIndex | U16 | currently supported: 4 | * | 9 | bCount | U8 | number of ext. compat. | * | 10 | Reserved | U8 | 0 | * | 11 | ExtCompat[] | | list of ext. compat. d. | * * | off | name | type | description | * |-----+-----------------+------+--------------------------| * | 0 | inteface | U8 | related interface number | * | 1 | dwLength | U32 | length of the descriptor | * | 5 | bcdVersion | U16 | currently supported: 1 | * | 7 | wIndex | U16 | currently supported: 5 | * | 9 | wCount | U16 | number of ext. compat. | * | 11 | ExtProp[] | | list of ext. prop. d. | * * ExtCompat[] is an array of valid Extended Compatiblity descriptors * which have the following format: * * | off | name | type | description | * |-----+-----------------------+------+-------------------------------------| * | 0 | bFirstInterfaceNumber | U8 | index of the interface or of the 1st| * | | | | interface in an IAD group | * | 1 | Reserved | U8 | 1 | * | 2 | CompatibleID | U8[8]| compatible ID string | * | 10 | SubCompatibleID | U8[8]| subcompatible ID string | * | 18 | Reserved | U8[6]| 0 | * * ExtProp[] is an array of valid Extended Properties descriptors * which have the following format: * * | off | name | type | description | * |-----+-----------------------+------+-------------------------------------| * | 0 | dwSize | U32 | length of the descriptor | * | 4 | dwPropertyDataType | U32 | 1..7 | * | 8 | wPropertyNameLength | U16 | bPropertyName length (NL) | * | 10 | bPropertyName |U8[NL]| name of this property | * |10+NL| dwPropertyDataLength | U32 | bPropertyData length (DL) | * |14+NL| bProperty |U8[DL]| payload of this property | */ struct usb_functionfs_strings_head { __le32 magic; __le32 length; __le32 str_count; __le32 lang_count; } __attribute__((packed)); /* * Strings format: * * | off | name | type | description | * |-----+------------+-----------------------+----------------------------| * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC | * | 4 | length | LE32 | length of the data chunk | * | 8 | str_count | LE32 | number of strings | * | 12 | lang_count | LE32 | number of languages | * | 16 | stringtab | StringTab[lang_count] | table of strings per lang | * * For each language there is one stringtab entry (ie. there are lang_count * stringtab entires). Each StringTab has following format: * * | off | name | type | description | * |-----+---------+-------------------+------------------------------------| * | 0 | lang | LE16 | language code | * | 2 | strings | String[str_count] | array of strings in given language | * * For each string there is one strings entry (ie. there are str_count * string entries). Each String is a NUL terminated string encoded in * UTF-8. */ /* * Events are delivered on the ep0 file descriptor, when the user mode driver * reads from this file descriptor after writing the descriptors. Don't * stop polling this descriptor. */ enum usb_functionfs_event_type { FUNCTIONFS_BIND, FUNCTIONFS_UNBIND, FUNCTIONFS_ENABLE, FUNCTIONFS_DISABLE, FUNCTIONFS_SETUP, FUNCTIONFS_SUSPEND, FUNCTIONFS_RESUME }; /* NOTE: this structure must stay the same size and layout on * both 32-bit and 64-bit kernels. */ struct usb_functionfs_event { union { /* SETUP: packet; DATA phase i/o precedes next event *(setup.bmRequestType & USB_DIR_IN) flags direction */ struct usb_ctrlrequest setup; } __attribute__((packed)) u; /* enum usb_functionfs_event_type */ __u8 type; __u8 _pad[3]; } __attribute__((packed)); /* Endpoint ioctls */ /* The same as in gadgetfs */ /* IN transfers may be reported to the gadget driver as complete * when the fifo is loaded, before the host reads the data; * OUT transfers may be reported to the host's "client" driver as * complete when they're sitting in the FIFO unread. * THIS returns how many bytes are "unclaimed" in the endpoint fifo * (needed for precise fault handling, when the hardware allows it) */ #define FUNCTIONFS_FIFO_STATUS _IO('g', 1) /* discards any unclaimed data in the fifo. */ #define FUNCTIONFS_FIFO_FLUSH _IO('g', 2) /* resets endpoint halt+toggle; used to implement set_interface. * some hardware (like pxa2xx) can't support this. */ #define FUNCTIONFS_CLEAR_HALT _IO('g', 3) /* Specific for functionfs */ /* * Returns reverse mapping of an interface. Called on EP0. If there * is no such interface returns -EDOM. If function is not active * returns -ENODEV. */ #define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128) /* * Returns real bEndpointAddress of an endpoint. If endpoint shuts down * during the call, returns -ESHUTDOWN. */ #define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129) /* * Returns endpoint descriptor. If endpoint shuts down during the call, * returns -ESHUTDOWN. */ #define FUNCTIONFS_ENDPOINT_DESC _IOR('g', 130, \ struct usb_endpoint_descriptor) #endif /* __LINUX_FUNCTIONFS_H__ */ linux/usb/g_printer.h 0000644 00000002551 15063602056 0010644 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * g_printer.h -- Header file for USB Printer gadget driver * * Copyright (C) 2007 Craig W. Nadler * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_USB_G_PRINTER_H #define __LINUX_USB_G_PRINTER_H #define PRINTER_NOT_ERROR 0x08 #define PRINTER_SELECTED 0x10 #define PRINTER_PAPER_EMPTY 0x20 /* The 'g' code is also used by gadgetfs ioctl requests. * Don't add any colliding codes to either driver, and keep * them in unique ranges (size 0x20 for now). */ #define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) #define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) #endif /* __LINUX_USB_G_PRINTER_H */ linux/usb/g_uvc.h 0000644 00000002061 15063602056 0007752 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ */ /* * g_uvc.h -- USB Video Class Gadget driver API * * Copyright (C) 2009-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> */ #ifndef __LINUX_USB_G_UVC_H #define __LINUX_USB_G_UVC_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/usb/ch9.h> #define UVC_EVENT_FIRST (V4L2_EVENT_PRIVATE_START + 0) #define UVC_EVENT_CONNECT (V4L2_EVENT_PRIVATE_START + 0) #define UVC_EVENT_DISCONNECT (V4L2_EVENT_PRIVATE_START + 1) #define UVC_EVENT_STREAMON (V4L2_EVENT_PRIVATE_START + 2) #define UVC_EVENT_STREAMOFF (V4L2_EVENT_PRIVATE_START + 3) #define UVC_EVENT_SETUP (V4L2_EVENT_PRIVATE_START + 4) #define UVC_EVENT_DATA (V4L2_EVENT_PRIVATE_START + 5) #define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 5) struct uvc_request_data { __s32 length; __u8 data[60]; }; struct uvc_event { union { enum usb_device_speed speed; struct usb_ctrlrequest req; struct uvc_request_data data; }; }; #define UVCIOC_SEND_RESPONSE _IOW('U', 1, struct uvc_request_data) #endif /* __LINUX_USB_G_UVC_H */ linux/usb/gadgetfs.h 0000644 00000005402 15063602056 0010435 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Filesystem based user-mode API to USB Gadget controller hardware * * Other than ep0 operations, most things are done by read() and write() * on endpoint files found in one directory. They are configured by * writing descriptors, and then may be used for normal stream style * i/o requests. When ep0 is configured, the device can enumerate; * when it's closed, the device disconnects from usb. Operations on * ep0 require ioctl() operations. * * Configuration and device descriptors get written to /dev/gadget/$CHIP, * which may then be used to read usb_gadgetfs_event structs. The driver * may activate endpoints as it handles SET_CONFIGURATION setup events, * or earlier; writing endpoint descriptors to /dev/gadget/$ENDPOINT * then performing data transfers by reading or writing. */ #ifndef __LINUX_USB_GADGETFS_H #define __LINUX_USB_GADGETFS_H #include <linux/types.h> #include <linux/ioctl.h> #include <linux/usb/ch9.h> /* * Events are delivered on the ep0 file descriptor, when the user mode driver * reads from this file descriptor after writing the descriptors. Don't * stop polling this descriptor. */ enum usb_gadgetfs_event_type { GADGETFS_NOP = 0, GADGETFS_CONNECT, GADGETFS_DISCONNECT, GADGETFS_SETUP, GADGETFS_SUSPEND, /* and likely more ! */ }; /* NOTE: this structure must stay the same size and layout on * both 32-bit and 64-bit kernels. */ struct usb_gadgetfs_event { union { /* NOP, DISCONNECT, SUSPEND: nothing * ... some hardware can't report disconnection */ /* CONNECT: just the speed */ enum usb_device_speed speed; /* SETUP: packet; DATA phase i/o precedes next event *(setup.bmRequestType & USB_DIR_IN) flags direction * ... includes SET_CONFIGURATION, SET_INTERFACE */ struct usb_ctrlrequest setup; } u; enum usb_gadgetfs_event_type type; }; /* The 'g' code is also used by printer gadget ioctl requests. * Don't add any colliding codes to either driver, and keep * them in unique ranges (size 0x20 for now). */ /* endpoint ioctls */ /* IN transfers may be reported to the gadget driver as complete * when the fifo is loaded, before the host reads the data; * OUT transfers may be reported to the host's "client" driver as * complete when they're sitting in the FIFO unread. * THIS returns how many bytes are "unclaimed" in the endpoint fifo * (needed for precise fault handling, when the hardware allows it) */ #define GADGETFS_FIFO_STATUS _IO('g', 1) /* discards any unclaimed data in the fifo. */ #define GADGETFS_FIFO_FLUSH _IO('g', 2) /* resets endpoint halt+toggle; used to implement set_interface. * some hardware (like pxa2xx) can't support this. */ #define GADGETFS_CLEAR_HALT _IO('g', 3) #endif /* __LINUX_USB_GADGETFS_H */ linux/usb/midi.h 0000644 00000006552 15063602056 0007602 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * <linux/usb/midi.h> -- USB MIDI definitions. * * Copyright (C) 2006 Thumtronics Pty Ltd. * Developed for Thumtronics by Grey Innovation * Ben Williamson <ben.williamson@greyinnovation.com> * * This software is distributed under the terms of the GNU General Public * License ("GPL") version 2, as published by the Free Software Foundation. * * This file holds USB constants and structures defined * by the USB Device Class Definition for MIDI Devices. * Comments below reference relevant sections of that document: * * http://www.usb.org/developers/devclass_docs/midi10.pdf */ #ifndef __LINUX_USB_MIDI_H #define __LINUX_USB_MIDI_H #include <linux/types.h> /* A.1 MS Class-Specific Interface Descriptor Subtypes */ #define USB_MS_HEADER 0x01 #define USB_MS_MIDI_IN_JACK 0x02 #define USB_MS_MIDI_OUT_JACK 0x03 #define USB_MS_ELEMENT 0x04 /* A.2 MS Class-Specific Endpoint Descriptor Subtypes */ #define USB_MS_GENERAL 0x01 /* A.3 MS MIDI IN and OUT Jack Types */ #define USB_MS_EMBEDDED 0x01 #define USB_MS_EXTERNAL 0x02 /* 6.1.2.1 Class-Specific MS Interface Header Descriptor */ struct usb_ms_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __le16 bcdMSC; __le16 wTotalLength; } __attribute__ ((packed)); #define USB_DT_MS_HEADER_SIZE 7 /* 6.1.2.2 MIDI IN Jack Descriptor */ struct usb_midi_in_jack_descriptor { __u8 bLength; __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */ __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ __u8 bJackID; __u8 iJack; } __attribute__ ((packed)); #define USB_DT_MIDI_IN_SIZE 6 struct usb_midi_source_pin { __u8 baSourceID; __u8 baSourcePin; } __attribute__ ((packed)); /* 6.1.2.3 MIDI OUT Jack Descriptor */ struct usb_midi_out_jack_descriptor { __u8 bLength; __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */ __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ __u8 bJackID; __u8 bNrInputPins; /* p */ struct usb_midi_source_pin pins[]; /* [p] */ /*__u8 iJack; -- omitted due to variable-sized pins[] */ } __attribute__ ((packed)); #define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p)) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \ struct usb_midi_out_jack_descriptor_##p { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bJackType; \ __u8 bJackID; \ __u8 bNrInputPins; \ struct usb_midi_source_pin pins[p]; \ __u8 iJack; \ } __attribute__ ((packed)) /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ struct usb_ms_endpoint_descriptor { __u8 bLength; /* 4+n */ __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ __u8 bDescriptorSubtype; /* USB_MS_GENERAL */ __u8 bNumEmbMIDIJack; /* n */ __u8 baAssocJackID[]; /* [n] */ } __attribute__ ((packed)); #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) /* As above, but more useful for defining your own descriptors: */ #define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \ struct usb_ms_endpoint_descriptor_##n { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \ __u8 bNumEmbMIDIJack; \ __u8 baAssocJackID[n]; \ } __attribute__ ((packed)) #endif /* __LINUX_USB_MIDI_H */ linux/usb/tmc.h 0000644 00000011366 15063602056 0007442 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany * Copyright (C) 2008 Novell, Inc. * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de> * Copyright (C) 2015 Dave Penkler <dpenkler@gmail.com> * Copyright (C) 2018 IVI Foundation, Inc. * * This file holds USB constants defined by the USB Device Class * and USB488 Subclass Definitions for Test and Measurement devices * published by the USB-IF. * * It also has the ioctl and capability definitions for the * usbtmc kernel driver that userspace needs to know about. */ #ifndef __LINUX_USB_TMC_H #define __LINUX_USB_TMC_H #include <linux/types.h> /* __u8 etc */ /* USB TMC status values */ #define USBTMC_STATUS_SUCCESS 0x01 #define USBTMC_STATUS_PENDING 0x02 #define USBTMC_STATUS_FAILED 0x80 #define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81 #define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82 #define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83 /* USB TMC requests values */ #define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1 #define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2 #define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3 #define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4 #define USBTMC_REQUEST_INITIATE_CLEAR 5 #define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6 #define USBTMC_REQUEST_GET_CAPABILITIES 7 #define USBTMC_REQUEST_INDICATOR_PULSE 64 #define USBTMC488_REQUEST_READ_STATUS_BYTE 128 #define USBTMC488_REQUEST_REN_CONTROL 160 #define USBTMC488_REQUEST_GOTO_LOCAL 161 #define USBTMC488_REQUEST_LOCAL_LOCKOUT 162 struct usbtmc_request { __u8 bRequestType; __u8 bRequest; __u16 wValue; __u16 wIndex; __u16 wLength; } __attribute__ ((packed)); struct usbtmc_ctrlrequest { struct usbtmc_request req; void *data; /* pointer to user space */ } __attribute__ ((packed)); struct usbtmc_termchar { __u8 term_char; __u8 term_char_enabled; } __attribute__ ((packed)); /* * usbtmc_message->flags: */ #define USBTMC_FLAG_ASYNC 0x0001 #define USBTMC_FLAG_APPEND 0x0002 #define USBTMC_FLAG_IGNORE_TRAILER 0x0004 struct usbtmc_message { __u32 transfer_size; /* size of bytes to transfer */ __u32 transferred; /* size of received/written bytes */ __u32 flags; /* bit 0: 0 = synchronous; 1 = asynchronous */ void *message; /* pointer to header and data in user space */ } __attribute__ ((packed)); /* Request values for USBTMC driver's ioctl entry point */ #define USBTMC_IOC_NR 91 #define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1) #define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2) #define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3) #define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4) #define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6) #define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7) #define USBTMC_IOCTL_CTRL_REQUEST _IOWR(USBTMC_IOC_NR, 8, struct usbtmc_ctrlrequest) #define USBTMC_IOCTL_GET_TIMEOUT _IOR(USBTMC_IOC_NR, 9, __u32) #define USBTMC_IOCTL_SET_TIMEOUT _IOW(USBTMC_IOC_NR, 10, __u32) #define USBTMC_IOCTL_EOM_ENABLE _IOW(USBTMC_IOC_NR, 11, __u8) #define USBTMC_IOCTL_CONFIG_TERMCHAR _IOW(USBTMC_IOC_NR, 12, struct usbtmc_termchar) #define USBTMC_IOCTL_WRITE _IOWR(USBTMC_IOC_NR, 13, struct usbtmc_message) #define USBTMC_IOCTL_READ _IOWR(USBTMC_IOC_NR, 14, struct usbtmc_message) #define USBTMC_IOCTL_WRITE_RESULT _IOWR(USBTMC_IOC_NR, 15, __u32) #define USBTMC_IOCTL_API_VERSION _IOR(USBTMC_IOC_NR, 16, __u32) #define USBTMC488_IOCTL_GET_CAPS _IOR(USBTMC_IOC_NR, 17, unsigned char) #define USBTMC488_IOCTL_READ_STB _IOR(USBTMC_IOC_NR, 18, unsigned char) #define USBTMC488_IOCTL_REN_CONTROL _IOW(USBTMC_IOC_NR, 19, unsigned char) #define USBTMC488_IOCTL_GOTO_LOCAL _IO(USBTMC_IOC_NR, 20) #define USBTMC488_IOCTL_LOCAL_LOCKOUT _IO(USBTMC_IOC_NR, 21) #define USBTMC488_IOCTL_TRIGGER _IO(USBTMC_IOC_NR, 22) #define USBTMC488_IOCTL_WAIT_SRQ _IOW(USBTMC_IOC_NR, 23, __u32) #define USBTMC_IOCTL_MSG_IN_ATTR _IOR(USBTMC_IOC_NR, 24, __u8) #define USBTMC_IOCTL_AUTO_ABORT _IOW(USBTMC_IOC_NR, 25, __u8) #define USBTMC_IOCTL_GET_STB _IOR(USBTMC_IOC_NR, 26, __u8) #define USBTMC_IOCTL_GET_SRQ_STB _IOR(USBTMC_IOC_NR, 27, __u8) /* Cancel and cleanup asynchronous calls */ #define USBTMC_IOCTL_CANCEL_IO _IO(USBTMC_IOC_NR, 35) #define USBTMC_IOCTL_CLEANUP_IO _IO(USBTMC_IOC_NR, 36) /* Driver encoded usb488 capabilities */ #define USBTMC488_CAPABILITY_TRIGGER 1 #define USBTMC488_CAPABILITY_SIMPLE 2 #define USBTMC488_CAPABILITY_REN_CONTROL 2 #define USBTMC488_CAPABILITY_GOTO_LOCAL 2 #define USBTMC488_CAPABILITY_LOCAL_LOCKOUT 2 #define USBTMC488_CAPABILITY_488_DOT_2 4 #define USBTMC488_CAPABILITY_DT1 16 #define USBTMC488_CAPABILITY_RL1 32 #define USBTMC488_CAPABILITY_SR1 64 #define USBTMC488_CAPABILITY_FULL_SCPI 128 #endif linux/usb/video.h 0000644 00000041617 15063602056 0007767 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * USB Video Class definitions. * * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be> * * This file holds USB constants and structures defined by the USB Device * Class Definition for Video Devices. Unless otherwise stated, comments * below reference relevant sections of the USB Video Class 1.1 specification * available at * * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip */ #ifndef __LINUX_USB_VIDEO_H #define __LINUX_USB_VIDEO_H #include <linux/types.h> /* -------------------------------------------------------------------------- * UVC constants */ /* A.2. Video Interface Subclass Codes */ #define UVC_SC_UNDEFINED 0x00 #define UVC_SC_VIDEOCONTROL 0x01 #define UVC_SC_VIDEOSTREAMING 0x02 #define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03 /* A.3. Video Interface Protocol Codes */ #define UVC_PC_PROTOCOL_UNDEFINED 0x00 #define UVC_PC_PROTOCOL_15 0x01 /* A.5. Video Class-Specific VC Interface Descriptor Subtypes */ #define UVC_VC_DESCRIPTOR_UNDEFINED 0x00 #define UVC_VC_HEADER 0x01 #define UVC_VC_INPUT_TERMINAL 0x02 #define UVC_VC_OUTPUT_TERMINAL 0x03 #define UVC_VC_SELECTOR_UNIT 0x04 #define UVC_VC_PROCESSING_UNIT 0x05 #define UVC_VC_EXTENSION_UNIT 0x06 /* A.6. Video Class-Specific VS Interface Descriptor Subtypes */ #define UVC_VS_UNDEFINED 0x00 #define UVC_VS_INPUT_HEADER 0x01 #define UVC_VS_OUTPUT_HEADER 0x02 #define UVC_VS_STILL_IMAGE_FRAME 0x03 #define UVC_VS_FORMAT_UNCOMPRESSED 0x04 #define UVC_VS_FRAME_UNCOMPRESSED 0x05 #define UVC_VS_FORMAT_MJPEG 0x06 #define UVC_VS_FRAME_MJPEG 0x07 #define UVC_VS_FORMAT_MPEG2TS 0x0a #define UVC_VS_FORMAT_DV 0x0c #define UVC_VS_COLORFORMAT 0x0d #define UVC_VS_FORMAT_FRAME_BASED 0x10 #define UVC_VS_FRAME_FRAME_BASED 0x11 #define UVC_VS_FORMAT_STREAM_BASED 0x12 /* A.7. Video Class-Specific Endpoint Descriptor Subtypes */ #define UVC_EP_UNDEFINED 0x00 #define UVC_EP_GENERAL 0x01 #define UVC_EP_ENDPOINT 0x02 #define UVC_EP_INTERRUPT 0x03 /* A.8. Video Class-Specific Request Codes */ #define UVC_RC_UNDEFINED 0x00 #define UVC_SET_CUR 0x01 #define UVC_GET_CUR 0x81 #define UVC_GET_MIN 0x82 #define UVC_GET_MAX 0x83 #define UVC_GET_RES 0x84 #define UVC_GET_LEN 0x85 #define UVC_GET_INFO 0x86 #define UVC_GET_DEF 0x87 /* A.9.1. VideoControl Interface Control Selectors */ #define UVC_VC_CONTROL_UNDEFINED 0x00 #define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01 #define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02 /* A.9.2. Terminal Control Selectors */ #define UVC_TE_CONTROL_UNDEFINED 0x00 /* A.9.3. Selector Unit Control Selectors */ #define UVC_SU_CONTROL_UNDEFINED 0x00 #define UVC_SU_INPUT_SELECT_CONTROL 0x01 /* A.9.4. Camera Terminal Control Selectors */ #define UVC_CT_CONTROL_UNDEFINED 0x00 #define UVC_CT_SCANNING_MODE_CONTROL 0x01 #define UVC_CT_AE_MODE_CONTROL 0x02 #define UVC_CT_AE_PRIORITY_CONTROL 0x03 #define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04 #define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05 #define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06 #define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07 #define UVC_CT_FOCUS_AUTO_CONTROL 0x08 #define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09 #define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a #define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b #define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c #define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d #define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e #define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f #define UVC_CT_ROLL_RELATIVE_CONTROL 0x10 #define UVC_CT_PRIVACY_CONTROL 0x11 /* A.9.5. Processing Unit Control Selectors */ #define UVC_PU_CONTROL_UNDEFINED 0x00 #define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01 #define UVC_PU_BRIGHTNESS_CONTROL 0x02 #define UVC_PU_CONTRAST_CONTROL 0x03 #define UVC_PU_GAIN_CONTROL 0x04 #define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05 #define UVC_PU_HUE_CONTROL 0x06 #define UVC_PU_SATURATION_CONTROL 0x07 #define UVC_PU_SHARPNESS_CONTROL 0x08 #define UVC_PU_GAMMA_CONTROL 0x09 #define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a #define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b #define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c #define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d #define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e #define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f #define UVC_PU_HUE_AUTO_CONTROL 0x10 #define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11 #define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12 /* A.9.7. VideoStreaming Interface Control Selectors */ #define UVC_VS_CONTROL_UNDEFINED 0x00 #define UVC_VS_PROBE_CONTROL 0x01 #define UVC_VS_COMMIT_CONTROL 0x02 #define UVC_VS_STILL_PROBE_CONTROL 0x03 #define UVC_VS_STILL_COMMIT_CONTROL 0x04 #define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05 #define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06 #define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07 #define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08 #define UVC_VS_SYNC_DELAY_CONTROL 0x09 /* B.1. USB Terminal Types */ #define UVC_TT_VENDOR_SPECIFIC 0x0100 #define UVC_TT_STREAMING 0x0101 /* B.2. Input Terminal Types */ #define UVC_ITT_VENDOR_SPECIFIC 0x0200 #define UVC_ITT_CAMERA 0x0201 #define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202 /* B.3. Output Terminal Types */ #define UVC_OTT_VENDOR_SPECIFIC 0x0300 #define UVC_OTT_DISPLAY 0x0301 #define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302 /* B.4. External Terminal Types */ #define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400 #define UVC_COMPOSITE_CONNECTOR 0x0401 #define UVC_SVIDEO_CONNECTOR 0x0402 #define UVC_COMPONENT_CONNECTOR 0x0403 /* 2.4.2.2. Status Packet Type */ #define UVC_STATUS_TYPE_CONTROL 1 #define UVC_STATUS_TYPE_STREAMING 2 /* 2.4.3.3. Payload Header Information */ #define UVC_STREAM_EOH (1 << 7) #define UVC_STREAM_ERR (1 << 6) #define UVC_STREAM_STI (1 << 5) #define UVC_STREAM_RES (1 << 4) #define UVC_STREAM_SCR (1 << 3) #define UVC_STREAM_PTS (1 << 2) #define UVC_STREAM_EOF (1 << 1) #define UVC_STREAM_FID (1 << 0) /* 4.1.2. Control Capabilities */ #define UVC_CONTROL_CAP_GET (1 << 0) #define UVC_CONTROL_CAP_SET (1 << 1) #define UVC_CONTROL_CAP_DISABLED (1 << 2) #define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3) #define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4) /* 3.9.2.6 Color Matching Descriptor Values */ enum uvc_color_primaries_values { UVC_COLOR_PRIMARIES_UNSPECIFIED, UVC_COLOR_PRIMARIES_BT_709_SRGB, UVC_COLOR_PRIMARIES_BT_470_2_M, UVC_COLOR_PRIMARIES_BT_470_2_B_G, UVC_COLOR_PRIMARIES_SMPTE_170M, UVC_COLOR_PRIMARIES_SMPTE_240M, }; enum uvc_transfer_characteristics_values { UVC_TRANSFER_CHARACTERISTICS_UNSPECIFIED, UVC_TRANSFER_CHARACTERISTICS_BT_709, UVC_TRANSFER_CHARACTERISTICS_BT_470_2_M, UVC_TRANSFER_CHARACTERISTICS_BT_470_2_B_G, UVC_TRANSFER_CHARACTERISTICS_SMPTE_170M, UVC_TRANSFER_CHARACTERISTICS_SMPTE_240M, UVC_TRANSFER_CHARACTERISTICS_LINEAR, UVC_TRANSFER_CHARACTERISTICS_SRGB, }; enum uvc_matrix_coefficients { UVC_MATRIX_COEFFICIENTS_UNSPECIFIED, UVC_MATRIX_COEFFICIENTS_BT_709, UVC_MATRIX_COEFFICIENTS_FCC, UVC_MATRIX_COEFFICIENTS_BT_470_2_B_G, UVC_MATRIX_COEFFICIENTS_SMPTE_170M, UVC_MATRIX_COEFFICIENTS_SMPTE_240M, }; /* ------------------------------------------------------------------------ * UVC structures */ /* All UVC descriptors have these 3 fields at the beginning */ struct uvc_descriptor_header { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; } __attribute__((packed)); /* 3.7.2. Video Control Interface Header Descriptor */ struct uvc_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 bcdUVC; __le16 wTotalLength; __le32 dwClockFrequency; __u8 bInCollection; __u8 baInterfaceNr[]; } __attribute__((__packed__)); #define UVC_DT_HEADER_SIZE(n) (12+(n)) #define UVC_HEADER_DESCRIPTOR(n) \ uvc_header_descriptor_##n #define DECLARE_UVC_HEADER_DESCRIPTOR(n) \ struct UVC_HEADER_DESCRIPTOR(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __le16 bcdUVC; \ __le16 wTotalLength; \ __le32 dwClockFrequency; \ __u8 bInCollection; \ __u8 baInterfaceNr[n]; \ } __attribute__ ((packed)) /* 3.7.2.1. Input Terminal Descriptor */ struct uvc_input_terminal_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bTerminalID; __le16 wTerminalType; __u8 bAssocTerminal; __u8 iTerminal; } __attribute__((__packed__)); #define UVC_DT_INPUT_TERMINAL_SIZE 8 /* 3.7.2.2. Output Terminal Descriptor */ struct uvc_output_terminal_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bTerminalID; __le16 wTerminalType; __u8 bAssocTerminal; __u8 bSourceID; __u8 iTerminal; } __attribute__((__packed__)); #define UVC_DT_OUTPUT_TERMINAL_SIZE 9 /* 3.7.2.3. Camera Terminal Descriptor */ struct uvc_camera_terminal_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bTerminalID; __le16 wTerminalType; __u8 bAssocTerminal; __u8 iTerminal; __le16 wObjectiveFocalLengthMin; __le16 wObjectiveFocalLengthMax; __le16 wOcularFocalLength; __u8 bControlSize; __u8 bmControls[3]; } __attribute__((__packed__)); #define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n)) /* 3.7.2.4. Selector Unit Descriptor */ struct uvc_selector_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bUnitID; __u8 bNrInPins; __u8 baSourceID[0]; __u8 iSelector; } __attribute__((__packed__)); #define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n)) #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ uvc_selector_unit_descriptor_##n #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bUnitID; \ __u8 bNrInPins; \ __u8 baSourceID[n]; \ __u8 iSelector; \ } __attribute__ ((packed)) /* 3.7.2.5. Processing Unit Descriptor */ struct uvc_processing_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bUnitID; __u8 bSourceID; __le16 wMaxMultiplier; __u8 bControlSize; __u8 bmControls[2]; __u8 iProcessing; __u8 bmVideoStandards; } __attribute__((__packed__)); #define UVC_DT_PROCESSING_UNIT_SIZE(n) (10+(n)) /* 3.7.2.6. Extension Unit Descriptor */ struct uvc_extension_unit_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bUnitID; __u8 guidExtensionCode[16]; __u8 bNumControls; __u8 bNrInPins; __u8 baSourceID[0]; __u8 bControlSize; __u8 bmControls[0]; __u8 iExtension; } __attribute__((__packed__)); #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ uvc_extension_unit_descriptor_##p_##n #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bUnitID; \ __u8 guidExtensionCode[16]; \ __u8 bNumControls; \ __u8 bNrInPins; \ __u8 baSourceID[p]; \ __u8 bControlSize; \ __u8 bmControls[n]; \ __u8 iExtension; \ } __attribute__ ((packed)) /* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */ struct uvc_control_endpoint_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __le16 wMaxTransferSize; } __attribute__((__packed__)); #define UVC_DT_CONTROL_ENDPOINT_SIZE 5 /* 3.9.2.1. Input Header Descriptor */ struct uvc_input_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bNumFormats; __le16 wTotalLength; __u8 bEndpointAddress; __u8 bmInfo; __u8 bTerminalLink; __u8 bStillCaptureMethod; __u8 bTriggerSupport; __u8 bTriggerUsage; __u8 bControlSize; __u8 bmaControls[]; } __attribute__((__packed__)); #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ uvc_input_header_descriptor_##n_##p #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bNumFormats; \ __le16 wTotalLength; \ __u8 bEndpointAddress; \ __u8 bmInfo; \ __u8 bTerminalLink; \ __u8 bStillCaptureMethod; \ __u8 bTriggerSupport; \ __u8 bTriggerUsage; \ __u8 bControlSize; \ __u8 bmaControls[p][n]; \ } __attribute__ ((packed)) /* 3.9.2.2. Output Header Descriptor */ struct uvc_output_header_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bNumFormats; __le16 wTotalLength; __u8 bEndpointAddress; __u8 bTerminalLink; __u8 bControlSize; __u8 bmaControls[]; } __attribute__((__packed__)); #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ uvc_output_header_descriptor_##n_##p #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bNumFormats; \ __le16 wTotalLength; \ __u8 bEndpointAddress; \ __u8 bTerminalLink; \ __u8 bControlSize; \ __u8 bmaControls[p][n]; \ } __attribute__ ((packed)) /* 3.9.2.6. Color matching descriptor */ struct uvc_color_matching_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bColorPrimaries; __u8 bTransferCharacteristics; __u8 bMatrixCoefficients; } __attribute__((__packed__)); #define UVC_DT_COLOR_MATCHING_SIZE 6 /* 4.3.1.1. Video Probe and Commit Controls */ struct uvc_streaming_control { __u16 bmHint; __u8 bFormatIndex; __u8 bFrameIndex; __u32 dwFrameInterval; __u16 wKeyFrameRate; __u16 wPFrameRate; __u16 wCompQuality; __u16 wCompWindowSize; __u16 wDelay; __u32 dwMaxVideoFrameSize; __u32 dwMaxPayloadTransferSize; __u32 dwClockFrequency; __u8 bmFramingInfo; __u8 bPreferedVersion; __u8 bMinVersion; __u8 bMaxVersion; } __attribute__((__packed__)); /* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */ struct uvc_format_uncompressed { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFormatIndex; __u8 bNumFrameDescriptors; __u8 guidFormat[16]; __u8 bBitsPerPixel; __u8 bDefaultFrameIndex; __u8 bAspectRatioX; __u8 bAspectRatioY; __u8 bmInterfaceFlags; __u8 bCopyProtect; } __attribute__((__packed__)); #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27 /* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */ struct uvc_frame_uncompressed { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFrameIndex; __u8 bmCapabilities; __le16 wWidth; __le16 wHeight; __le32 dwMinBitRate; __le32 dwMaxBitRate; __le32 dwMaxVideoFrameBufferSize; __le32 dwDefaultFrameInterval; __u8 bFrameIntervalType; __le32 dwFrameInterval[]; } __attribute__((__packed__)); #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n)) #define UVC_FRAME_UNCOMPRESSED(n) \ uvc_frame_uncompressed_##n #define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \ struct UVC_FRAME_UNCOMPRESSED(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bFrameIndex; \ __u8 bmCapabilities; \ __le16 wWidth; \ __le16 wHeight; \ __le32 dwMinBitRate; \ __le32 dwMaxBitRate; \ __le32 dwMaxVideoFrameBufferSize; \ __le32 dwDefaultFrameInterval; \ __u8 bFrameIntervalType; \ __le32 dwFrameInterval[n]; \ } __attribute__ ((packed)) /* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */ struct uvc_format_mjpeg { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFormatIndex; __u8 bNumFrameDescriptors; __u8 bmFlags; __u8 bDefaultFrameIndex; __u8 bAspectRatioX; __u8 bAspectRatioY; __u8 bmInterfaceFlags; __u8 bCopyProtect; } __attribute__((__packed__)); #define UVC_DT_FORMAT_MJPEG_SIZE 11 /* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */ struct uvc_frame_mjpeg { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubType; __u8 bFrameIndex; __u8 bmCapabilities; __le16 wWidth; __le16 wHeight; __le32 dwMinBitRate; __le32 dwMaxBitRate; __le32 dwMaxVideoFrameBufferSize; __le32 dwDefaultFrameInterval; __u8 bFrameIntervalType; __le32 dwFrameInterval[]; } __attribute__((__packed__)); #define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n)) #define UVC_FRAME_MJPEG(n) \ uvc_frame_mjpeg_##n #define DECLARE_UVC_FRAME_MJPEG(n) \ struct UVC_FRAME_MJPEG(n) { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubType; \ __u8 bFrameIndex; \ __u8 bmCapabilities; \ __le16 wWidth; \ __le16 wHeight; \ __le32 dwMinBitRate; \ __le32 dwMaxBitRate; \ __le32 dwMaxVideoFrameBufferSize; \ __le32 dwDefaultFrameInterval; \ __u8 bFrameIntervalType; \ __le32 dwFrameInterval[n]; \ } __attribute__ ((packed)) #endif /* __LINUX_USB_VIDEO_H */ linux/userfaultfd.h 0000644 00000017136 15063602056 0010413 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/userfaultfd.h * * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> * Copyright (C) 2015 Red Hat, Inc. * */ #ifndef _LINUX_USERFAULTFD_H #define _LINUX_USERFAULTFD_H #include <linux/types.h> /* * If the UFFDIO_API is upgraded someday, the UFFDIO_UNREGISTER and * UFFDIO_WAKE ioctls should be defined as _IOW and not as _IOR. In * userfaultfd.h we assumed the kernel was reading (instead _IOC_READ * means the userland is reading). */ #define UFFD_API ((__u64)0xAA) #define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | \ UFFD_FEATURE_EVENT_FORK | \ UFFD_FEATURE_EVENT_REMAP | \ UFFD_FEATURE_EVENT_REMOVE | \ UFFD_FEATURE_EVENT_UNMAP | \ UFFD_FEATURE_MISSING_HUGETLBFS | \ UFFD_FEATURE_MISSING_SHMEM | \ UFFD_FEATURE_SIGBUS | \ UFFD_FEATURE_THREAD_ID) #define UFFD_API_IOCTLS \ ((__u64)1 << _UFFDIO_REGISTER | \ (__u64)1 << _UFFDIO_UNREGISTER | \ (__u64)1 << _UFFDIO_API) #define UFFD_API_RANGE_IOCTLS \ ((__u64)1 << _UFFDIO_WAKE | \ (__u64)1 << _UFFDIO_COPY | \ (__u64)1 << _UFFDIO_ZEROPAGE | \ (__u64)1 << _UFFDIO_WRITEPROTECT) #define UFFD_API_RANGE_IOCTLS_BASIC \ ((__u64)1 << _UFFDIO_WAKE | \ (__u64)1 << _UFFDIO_COPY) /* * Valid ioctl command number range with this API is from 0x00 to * 0x3F. UFFDIO_API is the fixed number, everything else can be * changed by implementing a different UFFD_API. If sticking to the * same UFFD_API more ioctl can be added and userland will be aware of * which ioctl the running kernel implements through the ioctl command * bitmask written by the UFFDIO_API. */ #define _UFFDIO_REGISTER (0x00) #define _UFFDIO_UNREGISTER (0x01) #define _UFFDIO_WAKE (0x02) #define _UFFDIO_COPY (0x03) #define _UFFDIO_ZEROPAGE (0x04) #define _UFFDIO_WRITEPROTECT (0x06) #define _UFFDIO_API (0x3F) /* userfaultfd ioctl ids */ #define UFFDIO 0xAA #define UFFDIO_API _IOWR(UFFDIO, _UFFDIO_API, \ struct uffdio_api) #define UFFDIO_REGISTER _IOWR(UFFDIO, _UFFDIO_REGISTER, \ struct uffdio_register) #define UFFDIO_UNREGISTER _IOR(UFFDIO, _UFFDIO_UNREGISTER, \ struct uffdio_range) #define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, \ struct uffdio_range) #define UFFDIO_COPY _IOWR(UFFDIO, _UFFDIO_COPY, \ struct uffdio_copy) #define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, \ struct uffdio_zeropage) #define UFFDIO_WRITEPROTECT _IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, \ struct uffdio_writeprotect) /* read() structure */ struct uffd_msg { __u8 event; __u8 reserved1; __u16 reserved2; __u32 reserved3; union { struct { __u64 flags; __u64 address; union { __u32 ptid; } feat; } pagefault; struct { __u32 ufd; } fork; struct { __u64 from; __u64 to; __u64 len; } remap; struct { __u64 start; __u64 end; } remove; struct { /* unused reserved fields */ __u64 reserved1; __u64 reserved2; __u64 reserved3; } reserved; } arg; } __attribute__((packed)); /* * Start at 0x12 and not at 0 to be more strict against bugs. */ #define UFFD_EVENT_PAGEFAULT 0x12 #define UFFD_EVENT_FORK 0x13 #define UFFD_EVENT_REMAP 0x14 #define UFFD_EVENT_REMOVE 0x15 #define UFFD_EVENT_UNMAP 0x16 /* flags for UFFD_EVENT_PAGEFAULT */ #define UFFD_PAGEFAULT_FLAG_WRITE (1<<0) /* If this was a write fault */ #define UFFD_PAGEFAULT_FLAG_WP (1<<1) /* If reason is VM_UFFD_WP */ struct uffdio_api { /* userland asks for an API number and the features to enable */ __u64 api; /* * Kernel answers below with the all available features for * the API, this notifies userland of which events and/or * which flags for each event are enabled in the current * kernel. * * Note: UFFD_EVENT_PAGEFAULT and UFFD_PAGEFAULT_FLAG_WRITE * are to be considered implicitly always enabled in all kernels as * long as the uffdio_api.api requested matches UFFD_API. * * UFFD_FEATURE_MISSING_HUGETLBFS means an UFFDIO_REGISTER * with UFFDIO_REGISTER_MODE_MISSING mode will succeed on * hugetlbfs virtual memory ranges. Adding or not adding * UFFD_FEATURE_MISSING_HUGETLBFS to uffdio_api.features has * no real functional effect after UFFDIO_API returns, but * it's only useful for an initial feature set probe at * UFFDIO_API time. There are two ways to use it: * * 1) by adding UFFD_FEATURE_MISSING_HUGETLBFS to the * uffdio_api.features before calling UFFDIO_API, an error * will be returned by UFFDIO_API on a kernel without * hugetlbfs missing support * * 2) the UFFD_FEATURE_MISSING_HUGETLBFS can not be added in * uffdio_api.features and instead it will be set by the * kernel in the uffdio_api.features if the kernel supports * it, so userland can later check if the feature flag is * present in uffdio_api.features after UFFDIO_API * succeeded. * * UFFD_FEATURE_MISSING_SHMEM works the same as * UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem * (i.e. tmpfs and other shmem based APIs). * * UFFD_FEATURE_SIGBUS feature means no page-fault * (UFFD_EVENT_PAGEFAULT) event will be delivered, instead * a SIGBUS signal will be sent to the faulting process. * * UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will * be returned, if feature is not requested 0 will be returned. */ #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0) #define UFFD_FEATURE_EVENT_FORK (1<<1) #define UFFD_FEATURE_EVENT_REMAP (1<<2) #define UFFD_FEATURE_EVENT_REMOVE (1<<3) #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) #define UFFD_FEATURE_MISSING_SHMEM (1<<5) #define UFFD_FEATURE_EVENT_UNMAP (1<<6) #define UFFD_FEATURE_SIGBUS (1<<7) #define UFFD_FEATURE_THREAD_ID (1<<8) __u64 features; __u64 ioctls; }; struct uffdio_range { __u64 start; __u64 len; }; struct uffdio_register { struct uffdio_range range; #define UFFDIO_REGISTER_MODE_MISSING ((__u64)1<<0) #define UFFDIO_REGISTER_MODE_WP ((__u64)1<<1) __u64 mode; /* * kernel answers which ioctl commands are available for the * range, keep at the end as the last 8 bytes aren't read. */ __u64 ioctls; }; struct uffdio_copy { __u64 dst; __u64 src; __u64 len; #define UFFDIO_COPY_MODE_DONTWAKE ((__u64)1<<0) /* * UFFDIO_COPY_MODE_WP will map the page write protected on * the fly. UFFDIO_COPY_MODE_WP is available only if the * write protected ioctl is implemented for the range * according to the uffdio_register.ioctls. */ #define UFFDIO_COPY_MODE_WP ((__u64)1<<1) __u64 mode; /* * "copy" is written by the ioctl and must be at the end: the * copy_from_user will not read the last 8 bytes. */ __s64 copy; }; struct uffdio_zeropage { struct uffdio_range range; #define UFFDIO_ZEROPAGE_MODE_DONTWAKE ((__u64)1<<0) __u64 mode; /* * "zeropage" is written by the ioctl and must be at the end: * the copy_from_user will not read the last 8 bytes. */ __s64 zeropage; }; struct uffdio_writeprotect { struct uffdio_range range; /* * UFFDIO_WRITEPROTECT_MODE_WP: set the flag to write protect a range, * unset the flag to undo protection of a range which was previously * write protected. * * UFFDIO_WRITEPROTECT_MODE_DONTWAKE: set the flag to avoid waking up * any wait thread after the operation succeeds. * * NOTE: Write protecting a region (WP=1) is unrelated to page faults, * therefore DONTWAKE flag is meaningless with WP=1. Removing write * protection (WP=0) in response to a page fault wakes the faulting * task unless DONTWAKE is set. */ #define UFFDIO_WRITEPROTECT_MODE_WP ((__u64)1<<0) #define UFFDIO_WRITEPROTECT_MODE_DONTWAKE ((__u64)1<<1) __u64 mode; }; #endif /* _LINUX_USERFAULTFD_H */ linux/userio.h 0000644 00000002754 15063602056 0007375 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* * userio: virtual serio device support * Copyright (C) 2015 Red Hat * Copyright (C) 2015 Lyude (Stephen Chandler Paul) <cpaul@redhat.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * This is the public header used for user-space communication with the userio * driver. __attribute__((__packed__)) is used for all structs to keep ABI * compatibility between all architectures. */ #ifndef _USERIO_H #define _USERIO_H #include <linux/types.h> enum userio_cmd_type { USERIO_CMD_REGISTER = 0, USERIO_CMD_SET_PORT_TYPE = 1, USERIO_CMD_SEND_INTERRUPT = 2 }; /* * userio Commands * All commands sent to /dev/userio are encoded using this structure. The type * field should contain a USERIO_CMD* value that indicates what kind of command * is being sent to userio. The data field should contain the accompanying * argument for the command, if there is one. */ struct userio_cmd { __u8 type; __u8 data; } __attribute__((__packed__)); #endif /* !_USERIO_H */ linux/utime.h 0000644 00000000327 15063602056 0007204 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UTIME_H #define _LINUX_UTIME_H #include <linux/types.h> struct utimbuf { __kernel_time_t actime; __kernel_time_t modtime; }; #endif linux/utsname.h 0000644 00000001235 15063602056 0007534 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_UTSNAME_H #define _LINUX_UTSNAME_H #define __OLD_UTS_LEN 8 struct oldold_utsname { char sysname[9]; char nodename[9]; char release[9]; char version[9]; char machine[9]; }; #define __NEW_UTS_LEN 64 struct old_utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; }; struct new_utsname { char sysname[__NEW_UTS_LEN + 1]; char nodename[__NEW_UTS_LEN + 1]; char release[__NEW_UTS_LEN + 1]; char version[__NEW_UTS_LEN + 1]; char machine[__NEW_UTS_LEN + 1]; char domainname[__NEW_UTS_LEN + 1]; }; #endif /* _LINUX_UTSNAME_H */ linux/uuid.h 0000644 00000002514 15063602056 0007027 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * UUID/GUID definition * * Copyright (C) 2010, Intel Corp. * Huang Ying <ying.huang@intel.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _LINUX_UUID_H_ #define _LINUX_UUID_H_ #include <linux/types.h> typedef struct { __u8 b[16]; } guid_t; #define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ ((guid_t) \ {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ (b) & 0xff, ((b) >> 8) & 0xff, \ (c) & 0xff, ((c) >> 8) & 0xff, \ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) /* backwards compatibility, don't use in new code */ typedef guid_t uuid_le; #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) #define NULL_UUID_LE \ UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00) #endif /* _LINUX_UUID_H_ */ linux/uvcvideo.h 0000644 00000005113 15063602056 0007703 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_UVCVIDEO_H_ #define __LINUX_UVCVIDEO_H_ #include <linux/ioctl.h> #include <linux/types.h> /* * Dynamic controls */ /* Data types for UVC control data */ #define UVC_CTRL_DATA_TYPE_RAW 0 #define UVC_CTRL_DATA_TYPE_SIGNED 1 #define UVC_CTRL_DATA_TYPE_UNSIGNED 2 #define UVC_CTRL_DATA_TYPE_BOOLEAN 3 #define UVC_CTRL_DATA_TYPE_ENUM 4 #define UVC_CTRL_DATA_TYPE_BITMASK 5 /* Control flags */ #define UVC_CTRL_FLAG_SET_CUR (1 << 0) #define UVC_CTRL_FLAG_GET_CUR (1 << 1) #define UVC_CTRL_FLAG_GET_MIN (1 << 2) #define UVC_CTRL_FLAG_GET_MAX (1 << 3) #define UVC_CTRL_FLAG_GET_RES (1 << 4) #define UVC_CTRL_FLAG_GET_DEF (1 << 5) /* Control should be saved at suspend and restored at resume. */ #define UVC_CTRL_FLAG_RESTORE (1 << 6) /* Control can be updated by the camera. */ #define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7) /* Control supports asynchronous reporting */ #define UVC_CTRL_FLAG_ASYNCHRONOUS (1 << 8) #define UVC_CTRL_FLAG_GET_RANGE \ (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \ UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \ UVC_CTRL_FLAG_GET_DEF) #define UVC_MENU_NAME_LEN 32 struct uvc_menu_info { __u32 value; __u8 name[UVC_MENU_NAME_LEN]; }; struct uvc_xu_control_mapping { __u32 id; __u8 name[32]; __u8 entity[16]; __u8 selector; __u8 size; __u8 offset; __u32 v4l2_type; __u32 data_type; struct uvc_menu_info *menu_info; __u32 menu_count; __u32 reserved[4]; }; struct uvc_xu_control_query { __u8 unit; __u8 selector; __u8 query; /* Video Class-Specific Request Code, */ /* defined in linux/usb/video.h A.8. */ __u16 size; __u8 *data; }; #define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping) #define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query) /* * Metadata node */ /** * struct uvc_meta_buf - metadata buffer building block * @ns - system timestamp of the payload in nanoseconds * @sof - USB Frame Number * @length - length of the payload header * @flags - payload header flags * @buf - optional device-specific header data * * UVC metadata nodes fill buffers with possibly multiple instances of this * struct. The first two fields are added by the driver, they can be used for * clock synchronisation. The rest is an exact copy of a UVC payload header. * Only complete objects with complete buffers are included. Therefore it's * always sizeof(meta->ns) + sizeof(meta->sof) + meta->length bytes large. */ struct uvc_meta_buf { __u64 ns; __u16 sof; __u8 length; __u8 flags; __u8 buf[]; } __attribute__((packed)); #endif linux/v4l2-common.h 0000644 00000010121 15063602056 0010127 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * include/linux/v4l2-common.h * * Common V4L2 and V4L2 subdev definitions. * * Users are advised to #include this file either through videodev2.h * (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer * to this file directly. * * Copyright (C) 2012 Nokia Corporation * Contact: Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Alternatively you can redistribute this file under the terms of the * BSD license as stated below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef __V4L2_COMMON__ #define __V4L2_COMMON__ #include <linux/types.h> /* * * Selection interface definitions * */ /* Current cropping area */ #define V4L2_SEL_TGT_CROP 0x0000 /* Default cropping area */ #define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 /* Cropping bounds */ #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 /* Native frame size */ #define V4L2_SEL_TGT_NATIVE_SIZE 0x0003 /* Current composing area */ #define V4L2_SEL_TGT_COMPOSE 0x0100 /* Default composing area */ #define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 /* Composing bounds */ #define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 /* Current composing area plus all padding pixels */ #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 /* Backward compatibility target definitions --- to be removed. */ #define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP #define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE #define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP #define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE #define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS #define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS /* Selection flags */ #define V4L2_SEL_FLAG_GE (1 << 0) #define V4L2_SEL_FLAG_LE (1 << 1) #define V4L2_SEL_FLAG_KEEP_CONFIG (1 << 2) /* Backward compatibility flag definitions --- to be removed. */ #define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE #define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE #define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG struct v4l2_edid { __u32 pad; __u32 start_block; __u32 blocks; __u32 reserved[5]; __u8 *edid; }; #endif /* __V4L2_COMMON__ */ linux/v4l2-controls.h 0000644 00000145101 15063602056 0010511 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Video for Linux Two controls header file * * Copyright (C) 1999-2012 the contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Alternatively you can redistribute this file under the terms of the * BSD license as stated below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The contents of this header was split off from videodev2.h. All control * definitions should be added to this header, which is included by * videodev2.h. */ #ifndef __LINUX_V4L2_CONTROLS_H #define __LINUX_V4L2_CONTROLS_H #include <linux/types.h> /* Control classes */ #define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator controls */ #define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ #define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ #define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */ #define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */ #define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */ #define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */ #define V4L2_CTRL_CLASS_RF_TUNER 0x00a20000 /* RF tuner controls */ #define V4L2_CTRL_CLASS_DETECT 0x00a30000 /* Detection controls */ /* User-class control IDs */ #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) #define V4L2_CID_USER_BASE V4L2_CID_BASE #define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) #define V4L2_CID_SATURATION (V4L2_CID_BASE+2) #define V4L2_CID_HUE (V4L2_CID_BASE+3) #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) #define V4L2_CID_GAMMA (V4L2_CID_BASE+16) #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ #define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) #define V4L2_CID_GAIN (V4L2_CID_BASE+19) #define V4L2_CID_HFLIP (V4L2_CID_BASE+20) #define V4L2_CID_VFLIP (V4L2_CID_BASE+21) #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) enum v4l2_power_line_frequency { V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3, }; #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) #define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) #define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) #define V4L2_CID_COLORFX (V4L2_CID_BASE+31) enum v4l2_colorfx { V4L2_COLORFX_NONE = 0, V4L2_COLORFX_BW = 1, V4L2_COLORFX_SEPIA = 2, V4L2_COLORFX_NEGATIVE = 3, V4L2_COLORFX_EMBOSS = 4, V4L2_COLORFX_SKETCH = 5, V4L2_COLORFX_SKY_BLUE = 6, V4L2_COLORFX_GRASS_GREEN = 7, V4L2_COLORFX_SKIN_WHITEN = 8, V4L2_COLORFX_VIVID = 9, V4L2_COLORFX_AQUA = 10, V4L2_COLORFX_ART_FREEZE = 11, V4L2_COLORFX_SILHOUETTE = 12, V4L2_COLORFX_SOLARIZATION = 13, V4L2_COLORFX_ANTIQUE = 14, V4L2_COLORFX_SET_CBCR = 15, }; #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) #define V4L2_CID_ROTATE (V4L2_CID_BASE+34) #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) #define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) #define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37) #define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38) #define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39) #define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40) #define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) #define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42) /* last CID + 1 */ #define V4L2_CID_LASTP1 (V4L2_CID_BASE+43) /* USER-class private control IDs */ /* The base for the meye driver controls. See linux/meye.h for the list * of controls. We reserve 16 controls for this driver. */ #define V4L2_CID_USER_MEYE_BASE (V4L2_CID_USER_BASE + 0x1000) /* The base for the bttv driver controls. * We reserve 32 controls for this driver. */ #define V4L2_CID_USER_BTTV_BASE (V4L2_CID_USER_BASE + 0x1010) /* The base for the s2255 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_S2255_BASE (V4L2_CID_USER_BASE + 0x1030) /* * The base for the si476x driver controls. See include/media/drv-intf/si476x.h * for the list of controls. Total of 16 controls is reserved for this driver */ #define V4L2_CID_USER_SI476X_BASE (V4L2_CID_USER_BASE + 0x1040) /* The base for the TI VPE driver controls. Total of 16 controls is reserved for * this driver */ #define V4L2_CID_USER_TI_VPE_BASE (V4L2_CID_USER_BASE + 0x1050) /* The base for the saa7134 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_SAA7134_BASE (V4L2_CID_USER_BASE + 0x1060) /* The base for the adv7180 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_ADV7180_BASE (V4L2_CID_USER_BASE + 0x1070) /* The base for the tc358743 driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE (V4L2_CID_USER_BASE + 0x1080) /* The base for the max217x driver controls. * We reserve 32 controls for this driver */ #define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) /* The base for the imx driver controls. * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_IMX_BASE (V4L2_CID_USER_BASE + 0x1090) /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) #define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) /* MPEG streams, specific to multiplexed streams */ #define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) enum v4l2_mpeg_stream_type { V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ }; #define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) #define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) #define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) #define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) #define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) #define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) #define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) enum v4l2_mpeg_stream_vbi_fmt { V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ }; /* MPEG audio controls specific to multiplexed streams */ #define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) enum v4l2_mpeg_audio_sampling_freq { V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, }; #define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) enum v4l2_mpeg_audio_encoding { V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, V4L2_MPEG_AUDIO_ENCODING_AAC = 3, V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, }; #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) enum v4l2_mpeg_audio_l1_bitrate { V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, }; #define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) enum v4l2_mpeg_audio_l2_bitrate { V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, }; #define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) enum v4l2_mpeg_audio_l3_bitrate { V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, }; #define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) enum v4l2_mpeg_audio_mode { V4L2_MPEG_AUDIO_MODE_STEREO = 0, V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, V4L2_MPEG_AUDIO_MODE_DUAL = 2, V4L2_MPEG_AUDIO_MODE_MONO = 3, }; #define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) enum v4l2_mpeg_audio_mode_extension { V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, }; #define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) enum v4l2_mpeg_audio_emphasis { V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, }; #define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) enum v4l2_mpeg_audio_crc { V4L2_MPEG_AUDIO_CRC_NONE = 0, V4L2_MPEG_AUDIO_CRC_CRC16 = 1, }; #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) #define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) #define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) enum v4l2_mpeg_audio_ac3_bitrate { V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, }; #define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112) enum v4l2_mpeg_audio_dec_playback { V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0, V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1, V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2, V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3, V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4, V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5, }; #define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113) /* MPEG video controls specific to multiplexed streams */ #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) enum v4l2_mpeg_video_encoding { V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, }; #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) enum v4l2_mpeg_video_aspect { V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, }; #define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) #define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) #define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) #define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) #define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) enum v4l2_mpeg_video_bitrate_mode { V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, }; #define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) #define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) #define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) #define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) #define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212) #define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213) #define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214) #define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215) #define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216) enum v4l2_mpeg_video_header_mode { V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0, V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1, }; #define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217) #define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218) #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219) #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220) #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221) enum v4l2_mpeg_video_multi_slice_mode { V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0, V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1, V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, }; #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) #define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) #define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) #define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225) #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226) #define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE+227) #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229) #define V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS (V4L2_CID_MPEG_BASE+250) #define V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION (V4L2_CID_MPEG_BASE+251) #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) #define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303) #define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304) #define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350) #define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351) #define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352) #define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353) #define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354) #define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355) #define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356) #define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357) enum v4l2_mpeg_video_h264_entropy_mode { V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0, V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1, }; #define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358) #define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359) enum v4l2_mpeg_video_h264_level { V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0, V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1, V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2, V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3, V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4, V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5, V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6, V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7, V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8, V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9, V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10, V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11, V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12, V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13, V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14, V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15, }; #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360) #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361) #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362) enum v4l2_mpeg_video_h264_loop_filter_mode { V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0, V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1, V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2, }; #define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363) enum v4l2_mpeg_video_h264_profile { V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2, V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10, V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11, V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12, V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13, V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14, V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15, V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16, }; #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364) #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365) #define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366) #define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367) enum v4l2_mpeg_video_h264_vui_sar_idc { V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16, V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17, }; #define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING (V4L2_CID_MPEG_BASE+368) #define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 (V4L2_CID_MPEG_BASE+369) #define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (V4L2_CID_MPEG_BASE+370) enum v4l2_mpeg_video_h264_sei_fp_arrangement_type { V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHECKERBOARD = 0, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN = 1, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_ROW = 2, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_SIDE_BY_SIDE = 3, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM = 4, V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL = 5, }; #define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_BASE+371) #define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_BASE+372) enum v4l2_mpeg_video_h264_fmo_map_type { V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5, V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6, }; #define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP (V4L2_CID_MPEG_BASE+373) #define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (V4L2_CID_MPEG_BASE+374) enum v4l2_mpeg_video_h264_fmo_change_dir { V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0, V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1, }; #define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE (V4L2_CID_MPEG_BASE+375) #define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH (V4L2_CID_MPEG_BASE+376) #define V4L2_CID_MPEG_VIDEO_H264_ASO (V4L2_CID_MPEG_BASE+377) #define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER (V4L2_CID_MPEG_BASE+378) #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING (V4L2_CID_MPEG_BASE+379) #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (V4L2_CID_MPEG_BASE+380) enum v4l2_mpeg_video_h264_hierarchical_coding_type { V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0, V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1, }; #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_MPEG_BASE+381) #define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE+382) #define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400) #define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401) #define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402) #define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403) #define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404) #define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405) enum v4l2_mpeg_video_mpeg4_level { V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0, V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1, V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2, V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3, V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4, V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5, V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6, V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7, }; #define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406) enum v4l2_mpeg_video_mpeg4_profile { V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0, V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1, V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2, V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3, V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4, }; #define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407) /* Control IDs for VP8 streams * Although VP8 is not part of MPEG we add these controls to the MPEG class * as that class is already handling other video compression standards */ #define V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS (V4L2_CID_MPEG_BASE+500) enum v4l2_vp8_num_partitions { V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION = 0, V4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS = 1, V4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS = 2, V4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS = 3, }; #define V4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4 (V4L2_CID_MPEG_BASE+501) #define V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES (V4L2_CID_MPEG_BASE+502) enum v4l2_vp8_num_ref_frames { V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME = 0, V4L2_CID_MPEG_VIDEO_VPX_2_REF_FRAME = 1, V4L2_CID_MPEG_VIDEO_VPX_3_REF_FRAME = 2, }; #define V4L2_CID_MPEG_VIDEO_VPX_FILTER_LEVEL (V4L2_CID_MPEG_BASE+503) #define V4L2_CID_MPEG_VIDEO_VPX_FILTER_SHARPNESS (V4L2_CID_MPEG_BASE+504) #define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD (V4L2_CID_MPEG_BASE+505) #define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL (V4L2_CID_MPEG_BASE+506) enum v4l2_vp8_golden_frame_sel { V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV = 0, V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD = 1, }; #define V4L2_CID_MPEG_VIDEO_VPX_MIN_QP (V4L2_CID_MPEG_BASE+507) #define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE+508) #define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509) #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_MPEG_BASE+510) #define V4L2_CID_MPEG_VIDEO_VPX_PROFILE (V4L2_CID_MPEG_BASE+511) /* CIDs for HEVC encoding. */ #define V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP (V4L2_CID_MPEG_BASE + 600) #define V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP (V4L2_CID_MPEG_BASE + 601) #define V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP (V4L2_CID_MPEG_BASE + 602) #define V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP (V4L2_CID_MPEG_BASE + 603) #define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP (V4L2_CID_MPEG_BASE + 604) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_QP (V4L2_CID_MPEG_BASE + 605) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE (V4L2_CID_MPEG_BASE + 606) enum v4l2_mpeg_video_hevc_hier_coding_type { V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_B = 0, V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_P = 1, }; #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER (V4L2_CID_MPEG_BASE + 607) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_QP (V4L2_CID_MPEG_BASE + 608) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_QP (V4L2_CID_MPEG_BASE + 609) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_QP (V4L2_CID_MPEG_BASE + 610) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_QP (V4L2_CID_MPEG_BASE + 611) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_QP (V4L2_CID_MPEG_BASE + 612) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_QP (V4L2_CID_MPEG_BASE + 613) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_QP (V4L2_CID_MPEG_BASE + 614) #define V4L2_CID_MPEG_VIDEO_HEVC_PROFILE (V4L2_CID_MPEG_BASE + 615) enum v4l2_mpeg_video_hevc_profile { V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN = 0, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE = 1, V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10 = 2, }; #define V4L2_CID_MPEG_VIDEO_HEVC_LEVEL (V4L2_CID_MPEG_BASE + 616) enum v4l2_mpeg_video_hevc_level { V4L2_MPEG_VIDEO_HEVC_LEVEL_1 = 0, V4L2_MPEG_VIDEO_HEVC_LEVEL_2 = 1, V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 = 2, V4L2_MPEG_VIDEO_HEVC_LEVEL_3 = 3, V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 = 4, V4L2_MPEG_VIDEO_HEVC_LEVEL_4 = 5, V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 = 6, V4L2_MPEG_VIDEO_HEVC_LEVEL_5 = 7, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1 = 8, V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2 = 9, V4L2_MPEG_VIDEO_HEVC_LEVEL_6 = 10, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1 = 11, V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2 = 12, }; #define V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION (V4L2_CID_MPEG_BASE + 617) #define V4L2_CID_MPEG_VIDEO_HEVC_TIER (V4L2_CID_MPEG_BASE + 618) enum v4l2_mpeg_video_hevc_tier { V4L2_MPEG_VIDEO_HEVC_TIER_MAIN = 0, V4L2_MPEG_VIDEO_HEVC_TIER_HIGH = 1, }; #define V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH (V4L2_CID_MPEG_BASE + 619) #define V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE + 620) enum v4l2_cid_mpeg_video_hevc_loop_filter_mode { V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_DISABLED = 0, V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_ENABLED = 1, V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2, }; #define V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2 (V4L2_CID_MPEG_BASE + 621) #define V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2 (V4L2_CID_MPEG_BASE + 622) #define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE (V4L2_CID_MPEG_BASE + 623) enum v4l2_cid_mpeg_video_hevc_refresh_type { V4L2_MPEG_VIDEO_HEVC_REFRESH_NONE = 0, V4L2_MPEG_VIDEO_HEVC_REFRESH_CRA = 1, V4L2_MPEG_VIDEO_HEVC_REFRESH_IDR = 2, }; #define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD (V4L2_CID_MPEG_BASE + 624) #define V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU (V4L2_CID_MPEG_BASE + 625) #define V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED (V4L2_CID_MPEG_BASE + 626) #define V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT (V4L2_CID_MPEG_BASE + 627) #define V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB (V4L2_CID_MPEG_BASE + 628) #define V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID (V4L2_CID_MPEG_BASE + 629) #define V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING (V4L2_CID_MPEG_BASE + 630) #define V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1 (V4L2_CID_MPEG_BASE + 631) #define V4L2_CID_MPEG_VIDEO_HEVC_INTRA_PU_SPLIT (V4L2_CID_MPEG_BASE + 632) #define V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION (V4L2_CID_MPEG_BASE + 633) #define V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE (V4L2_CID_MPEG_BASE + 634) #define V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD (V4L2_CID_MPEG_BASE + 635) enum v4l2_cid_mpeg_video_hevc_size_of_length_field { V4L2_MPEG_VIDEO_HEVC_SIZE_0 = 0, V4L2_MPEG_VIDEO_HEVC_SIZE_1 = 1, V4L2_MPEG_VIDEO_HEVC_SIZE_2 = 2, V4L2_MPEG_VIDEO_HEVC_SIZE_4 = 3, }; #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_BR (V4L2_CID_MPEG_BASE + 636) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_BR (V4L2_CID_MPEG_BASE + 637) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_BR (V4L2_CID_MPEG_BASE + 638) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_BR (V4L2_CID_MPEG_BASE + 639) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_BR (V4L2_CID_MPEG_BASE + 640) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_BR (V4L2_CID_MPEG_BASE + 641) #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR (V4L2_CID_MPEG_BASE + 642) #define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES (V4L2_CID_MPEG_BASE + 643) #define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR (V4L2_CID_MPEG_BASE + 644) /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) #define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) enum v4l2_mpeg_cx2341x_video_median_filter_type { V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) /* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */ #define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100) #define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0) #define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1) #define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2) enum v4l2_mpeg_mfc51_video_frame_skip_mode { V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0, V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1, V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2, }; #define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3) enum v4l2_mpeg_mfc51_video_force_frame_type { V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0, V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1, V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2, }; #define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4) #define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5) #define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6) #define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53) #define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54) /* Camera class control IDs */ #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) #define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) enum v4l2_exposure_auto_type { V4L2_EXPOSURE_AUTO = 0, V4L2_EXPOSURE_MANUAL = 1, V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, V4L2_EXPOSURE_APERTURE_PRIORITY = 3 }; #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) #define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) #define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) #define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) #define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) #define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) #define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) #define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) #define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) #define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) #define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19) #define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20) enum v4l2_auto_n_preset_white_balance { V4L2_WHITE_BALANCE_MANUAL = 0, V4L2_WHITE_BALANCE_AUTO = 1, V4L2_WHITE_BALANCE_INCANDESCENT = 2, V4L2_WHITE_BALANCE_FLUORESCENT = 3, V4L2_WHITE_BALANCE_FLUORESCENT_H = 4, V4L2_WHITE_BALANCE_HORIZON = 5, V4L2_WHITE_BALANCE_DAYLIGHT = 6, V4L2_WHITE_BALANCE_FLASH = 7, V4L2_WHITE_BALANCE_CLOUDY = 8, V4L2_WHITE_BALANCE_SHADE = 9, }; #define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21) #define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22) #define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23) #define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24) enum v4l2_iso_sensitivity_auto_type { V4L2_ISO_SENSITIVITY_MANUAL = 0, V4L2_ISO_SENSITIVITY_AUTO = 1, }; #define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25) enum v4l2_exposure_metering { V4L2_EXPOSURE_METERING_AVERAGE = 0, V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1, V4L2_EXPOSURE_METERING_SPOT = 2, V4L2_EXPOSURE_METERING_MATRIX = 3, }; #define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26) enum v4l2_scene_mode { V4L2_SCENE_MODE_NONE = 0, V4L2_SCENE_MODE_BACKLIGHT = 1, V4L2_SCENE_MODE_BEACH_SNOW = 2, V4L2_SCENE_MODE_CANDLE_LIGHT = 3, V4L2_SCENE_MODE_DAWN_DUSK = 4, V4L2_SCENE_MODE_FALL_COLORS = 5, V4L2_SCENE_MODE_FIREWORKS = 6, V4L2_SCENE_MODE_LANDSCAPE = 7, V4L2_SCENE_MODE_NIGHT = 8, V4L2_SCENE_MODE_PARTY_INDOOR = 9, V4L2_SCENE_MODE_PORTRAIT = 10, V4L2_SCENE_MODE_SPORTS = 11, V4L2_SCENE_MODE_SUNSET = 12, V4L2_SCENE_MODE_TEXT = 13, }; #define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27) #define V4L2_LOCK_EXPOSURE (1 << 0) #define V4L2_LOCK_WHITE_BALANCE (1 << 1) #define V4L2_LOCK_FOCUS (1 << 2) #define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28) #define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29) #define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30) #define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0) #define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0) #define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1) #define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2) #define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31) enum v4l2_auto_focus_range { V4L2_AUTO_FOCUS_RANGE_AUTO = 0, V4L2_AUTO_FOCUS_RANGE_NORMAL = 1, V4L2_AUTO_FOCUS_RANGE_MACRO = 2, V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, }; #define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32) #define V4L2_CID_TILT_SPEED (V4L2_CID_CAMERA_CLASS_BASE+33) /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) #define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) #define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) #define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) #define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) #define V4L2_CID_RDS_TX_MONO_STEREO (V4L2_CID_FM_TX_CLASS_BASE + 7) #define V4L2_CID_RDS_TX_ARTIFICIAL_HEAD (V4L2_CID_FM_TX_CLASS_BASE + 8) #define V4L2_CID_RDS_TX_COMPRESSED (V4L2_CID_FM_TX_CLASS_BASE + 9) #define V4L2_CID_RDS_TX_DYNAMIC_PTY (V4L2_CID_FM_TX_CLASS_BASE + 10) #define V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT (V4L2_CID_FM_TX_CLASS_BASE + 11) #define V4L2_CID_RDS_TX_TRAFFIC_PROGRAM (V4L2_CID_FM_TX_CLASS_BASE + 12) #define V4L2_CID_RDS_TX_MUSIC_SPEECH (V4L2_CID_FM_TX_CLASS_BASE + 13) #define V4L2_CID_RDS_TX_ALT_FREQS_ENABLE (V4L2_CID_FM_TX_CLASS_BASE + 14) #define V4L2_CID_RDS_TX_ALT_FREQS (V4L2_CID_FM_TX_CLASS_BASE + 15) #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64) #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65) #define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66) #define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80) #define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81) #define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82) #define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83) #define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84) #define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96) #define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97) #define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98) #define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) enum v4l2_preemphasis { V4L2_PREEMPHASIS_DISABLED = 0, V4L2_PREEMPHASIS_50_uS = 1, V4L2_PREEMPHASIS_75_uS = 2, }; #define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) #define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) /* Flash and privacy (indicator) light controls */ #define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900) #define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1) #define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1) enum v4l2_flash_led_mode { V4L2_FLASH_LED_MODE_NONE, V4L2_FLASH_LED_MODE_FLASH, V4L2_FLASH_LED_MODE_TORCH, }; #define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2) enum v4l2_flash_strobe_source { V4L2_FLASH_STROBE_SOURCE_SOFTWARE, V4L2_FLASH_STROBE_SOURCE_EXTERNAL, }; #define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3) #define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4) #define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5) #define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6) #define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7) #define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8) #define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9) #define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10) #define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0) #define V4L2_FLASH_FAULT_TIMEOUT (1 << 1) #define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2) #define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3) #define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4) #define V4L2_FLASH_FAULT_INDICATOR (1 << 5) #define V4L2_FLASH_FAULT_UNDER_VOLTAGE (1 << 6) #define V4L2_FLASH_FAULT_INPUT_VOLTAGE (1 << 7) #define V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE (1 << 8) #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) /* JPEG-class control IDs */ #define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900) #define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1) #define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1) enum v4l2_jpeg_chroma_subsampling { V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0, V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1, V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2, V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3, V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4, V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5, }; #define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2) #define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3) #define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4) #define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0) #define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1) #define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16) #define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) #define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) /* Image source controls */ #define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900) #define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1) #define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1) #define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2) #define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3) #define V4L2_CID_TEST_PATTERN_RED (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 4) #define V4L2_CID_TEST_PATTERN_GREENR (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5) #define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6) #define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7) /* Image processing controls */ #define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900) #define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1) #define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1) #define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2) #define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3) #define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4) #define V4L2_CID_DIGITAL_GAIN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) /* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) #define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1) #define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1) #define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2) #define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3) #define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4) enum v4l2_dv_tx_mode { V4L2_DV_TX_MODE_DVI_D = 0, V4L2_DV_TX_MODE_HDMI = 1, }; #define V4L2_CID_DV_TX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 5) enum v4l2_dv_rgb_range { V4L2_DV_RGB_RANGE_AUTO = 0, V4L2_DV_RGB_RANGE_LIMITED = 1, V4L2_DV_RGB_RANGE_FULL = 2, }; #define V4L2_CID_DV_TX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 6) enum v4l2_dv_it_content_type { V4L2_DV_IT_CONTENT_TYPE_GRAPHICS = 0, V4L2_DV_IT_CONTENT_TYPE_PHOTO = 1, V4L2_DV_IT_CONTENT_TYPE_CINEMA = 2, V4L2_DV_IT_CONTENT_TYPE_GAME = 3, V4L2_DV_IT_CONTENT_TYPE_NO_ITC = 4, }; #define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100) #define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101) #define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 102) #define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900) #define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1) #define V4L2_CID_TUNE_DEEMPHASIS (V4L2_CID_FM_RX_CLASS_BASE + 1) enum v4l2_deemphasis { V4L2_DEEMPHASIS_DISABLED = V4L2_PREEMPHASIS_DISABLED, V4L2_DEEMPHASIS_50_uS = V4L2_PREEMPHASIS_50_uS, V4L2_DEEMPHASIS_75_uS = V4L2_PREEMPHASIS_75_uS, }; #define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2) #define V4L2_CID_RDS_RX_PTY (V4L2_CID_FM_RX_CLASS_BASE + 3) #define V4L2_CID_RDS_RX_PS_NAME (V4L2_CID_FM_RX_CLASS_BASE + 4) #define V4L2_CID_RDS_RX_RADIO_TEXT (V4L2_CID_FM_RX_CLASS_BASE + 5) #define V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT (V4L2_CID_FM_RX_CLASS_BASE + 6) #define V4L2_CID_RDS_RX_TRAFFIC_PROGRAM (V4L2_CID_FM_RX_CLASS_BASE + 7) #define V4L2_CID_RDS_RX_MUSIC_SPEECH (V4L2_CID_FM_RX_CLASS_BASE + 8) #define V4L2_CID_RF_TUNER_CLASS_BASE (V4L2_CTRL_CLASS_RF_TUNER | 0x900) #define V4L2_CID_RF_TUNER_CLASS (V4L2_CTRL_CLASS_RF_TUNER | 1) #define V4L2_CID_RF_TUNER_BANDWIDTH_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 11) #define V4L2_CID_RF_TUNER_BANDWIDTH (V4L2_CID_RF_TUNER_CLASS_BASE + 12) #define V4L2_CID_RF_TUNER_RF_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 32) #define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 41) #define V4L2_CID_RF_TUNER_LNA_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 42) #define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 51) #define V4L2_CID_RF_TUNER_MIXER_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 52) #define V4L2_CID_RF_TUNER_IF_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 61) #define V4L2_CID_RF_TUNER_IF_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 62) #define V4L2_CID_RF_TUNER_PLL_LOCK (V4L2_CID_RF_TUNER_CLASS_BASE + 91) /* Detection-class control IDs defined by V4L2 */ #define V4L2_CID_DETECT_CLASS_BASE (V4L2_CTRL_CLASS_DETECT | 0x900) #define V4L2_CID_DETECT_CLASS (V4L2_CTRL_CLASS_DETECT | 1) #define V4L2_CID_DETECT_MD_MODE (V4L2_CID_DETECT_CLASS_BASE + 1) enum v4l2_detect_md_mode { V4L2_DETECT_MD_MODE_DISABLED = 0, V4L2_DETECT_MD_MODE_GLOBAL = 1, V4L2_DETECT_MD_MODE_THRESHOLD_GRID = 2, V4L2_DETECT_MD_MODE_REGION_GRID = 3, }; #define V4L2_CID_DETECT_MD_GLOBAL_THRESHOLD (V4L2_CID_DETECT_CLASS_BASE + 2) #define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3) #define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4) #define V4L2_MPEG2_PICTURE_CODING_TYPE_I 1 #define V4L2_MPEG2_PICTURE_CODING_TYPE_P 2 #define V4L2_MPEG2_PICTURE_CODING_TYPE_B 3 #define V4L2_MPEG2_PICTURE_CODING_TYPE_D 4 struct v4l2_mpeg2_sequence { /* ISO/IEC 13818-2, ITU-T Rec. H.262: Sequence header */ __u16 horizontal_size; __u16 vertical_size; __u32 vbv_buffer_size; /* ISO/IEC 13818-2, ITU-T Rec. H.262: Sequence extension */ __u8 profile_and_level_indication; __u8 progressive_sequence; __u8 chroma_format; __u8 pad; }; struct v4l2_mpeg2_picture { /* ISO/IEC 13818-2, ITU-T Rec. H.262: Picture header */ __u8 picture_coding_type; /* ISO/IEC 13818-2, ITU-T Rec. H.262: Picture coding extension */ __u8 f_code[2][2]; __u8 intra_dc_precision; __u8 picture_structure; __u8 top_field_first; __u8 frame_pred_frame_dct; __u8 concealment_motion_vectors; __u8 q_scale_type; __u8 intra_vlc_format; __u8 alternate_scan; __u8 repeat_first_field; __u8 progressive_frame; __u8 pad; }; struct v4l2_ctrl_mpeg2_slice_params { __u32 bit_size; __u32 data_bit_offset; struct v4l2_mpeg2_sequence sequence; struct v4l2_mpeg2_picture picture; /* ISO/IEC 13818-2, ITU-T Rec. H.262: Slice */ __u8 quantiser_scale_code; __u8 backward_ref_index; __u8 forward_ref_index; __u8 pad; }; struct v4l2_ctrl_mpeg2_quantization { /* ISO/IEC 13818-2, ITU-T Rec. H.262: Quant matrix extension */ __u8 load_intra_quantiser_matrix; __u8 load_non_intra_quantiser_matrix; __u8 load_chroma_intra_quantiser_matrix; __u8 load_chroma_non_intra_quantiser_matrix; __u8 intra_quantiser_matrix[64]; __u8 non_intra_quantiser_matrix[64]; __u8 chroma_intra_quantiser_matrix[64]; __u8 chroma_non_intra_quantiser_matrix[64]; }; #endif linux/v4l2-dv-timings.h 0000644 00000075512 15063602056 0010737 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * V4L2 DV timings header. * * Copyright (C) 2012-2016 Hans Verkuil <hans.verkuil@cisco.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _V4L2_DV_TIMINGS_H #define _V4L2_DV_TIMINGS_H #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) /* Sadly gcc versions older than 4.6 have a bug in how they initialize anonymous unions where they require additional curly brackets. This violates the C1x standard. This workaround adds the curly brackets if needed. */ #define V4L2_INIT_BT_TIMINGS(_width, args...) \ { .bt = { _width , ## args } } #else #define V4L2_INIT_BT_TIMINGS(_width, args...) \ .bt = { _width , ## args } #endif /* CEA-861-F timings (i.e. standard HDTV timings) */ #define V4L2_DV_BT_CEA_640X480P59_94 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 25175000, 16, 96, 48, 10, 2, 33, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 1) \ } /* Note: these are the nominal timings, for HDMI links this format is typically * double-clocked to meet the minimum pixelclock requirements. */ #define V4L2_DV_BT_CEA_720X480I59_94 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 480, 1, 0, \ 13500000, 19, 62, 57, 4, 3, 15, 4, 3, 16, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_PICTURE_ASPECT | V4L2_DV_FL_HAS_CEA861_VIC, \ { 4, 3 }, 6) \ } #define V4L2_DV_BT_CEA_720X480P59_94 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \ 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_PICTURE_ASPECT | \ V4L2_DV_FL_HAS_CEA861_VIC, { 4, 3 }, 2) \ } /* Note: these are the nominal timings, for HDMI links this format is typically * double-clocked to meet the minimum pixelclock requirements. */ #define V4L2_DV_BT_CEA_720X576I50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 576, 1, 0, \ 13500000, 12, 63, 69, 2, 3, 19, 2, 3, 20, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_PICTURE_ASPECT | V4L2_DV_FL_HAS_CEA861_VIC, \ { 4, 3 }, 21) \ } #define V4L2_DV_BT_CEA_720X576P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \ 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_PICTURE_ASPECT | \ V4L2_DV_FL_HAS_CEA861_VIC, { 4, 3 }, 17) \ } #define V4L2_DV_BT_CEA_1280X720P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 59400000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 60) \ } #define V4L2_DV_BT_CEA_1280X720P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 61) \ } #define V4L2_DV_BT_CEA_1280X720P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 62) \ } #define V4L2_DV_BT_CEA_1280X720P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 19) \ } #define V4L2_DV_BT_CEA_1280X720P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 4) \ } #define V4L2_DV_BT_CEA_1920X1080P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 32) \ } #define V4L2_DV_BT_CEA_1920X1080P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 33) \ } #define V4L2_DV_BT_CEA_1920X1080P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 34) \ } #define V4L2_DV_BT_CEA_1920X1080I50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 20) \ } #define V4L2_DV_BT_CEA_1920X1080P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 31) \ } #define V4L2_DV_BT_CEA_1920X1080I60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | \ V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 5) \ } #define V4L2_DV_BT_CEA_1920X1080P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 16) \ } #define V4L2_DV_BT_CEA_3840X2160P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 1276, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC | V4L2_DV_FL_HAS_HDMI_VIC, \ { 0, 0 }, 93, 3) \ } #define V4L2_DV_BT_CEA_3840X2160P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC | \ V4L2_DV_FL_HAS_HDMI_VIC, { 0, 0 }, 94, 2) \ } #define V4L2_DV_BT_CEA_3840X2160P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC | V4L2_DV_FL_HAS_HDMI_VIC, \ { 0, 0 }, 95, 1) \ } #define V4L2_DV_BT_CEA_3840X2160P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 96) \ } #define V4L2_DV_BT_CEA_3840X2160P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 97) \ } #define V4L2_DV_BT_CEA_4096X2160P24 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 1020, 88, 296, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC | V4L2_DV_FL_HAS_HDMI_VIC, \ { 0, 0 }, 98, 4) \ } #define V4L2_DV_BT_CEA_4096X2160P25 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 99) \ } #define V4L2_DV_BT_CEA_4096X2160P30 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 297000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 100) \ } #define V4L2_DV_BT_CEA_4096X2160P50 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_IS_CE_VIDEO | V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 101) \ } #define V4L2_DV_BT_CEA_4096X2160P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 594000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \ V4L2_DV_BT_STD_CEA861, \ V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO | \ V4L2_DV_FL_HAS_CEA861_VIC, { 0, 0 }, 102) \ } /* VESA Discrete Monitor Timings as per version 1.0, revision 12 */ #define V4L2_DV_BT_DMT_640X350P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 350, 0, V4L2_DV_HSYNC_POS_POL, \ 31500000, 32, 64, 96, 32, 3, 60, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_640X400P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 400, 0, V4L2_DV_VSYNC_POS_POL, \ 31500000, 32, 64, 96, 1, 3, 41, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_720X400P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 400, 0, V4L2_DV_VSYNC_POS_POL, \ 35500000, 36, 72, 108, 1, 3, 42, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } /* VGA resolutions */ #define V4L2_DV_BT_DMT_640X480P60 V4L2_DV_BT_CEA_640X480P59_94 #define V4L2_DV_BT_DMT_640X480P72 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 31500000, 24, 40, 128, 9, 3, 28, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_640X480P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 31500000, 16, 64, 120, 1, 3, 16, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_640X480P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \ 36000000, 56, 56, 80, 1, 3, 25, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } /* SVGA resolutions */ #define V4L2_DV_BT_DMT_800X600P56 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 36000000, 24, 72, 128, 1, 2, 22, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 40000000, 40, 128, 88, 1, 4, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P72 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 50000000, 56, 120, 64, 37, 6, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 49500000, 16, 80, 160, 1, 3, 21, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 56250000, 32, 64, 152, 1, 3, 27, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_800X600P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL, \ 73250000, 48, 32, 80, 3, 4, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_848X480P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(848, 480, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 33750000, 16, 112, 112, 6, 8, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768I43 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 1, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 44900000, 8, 176, 56, 0, 4, 20, 0, 4, 21, \ V4L2_DV_BT_STD_DMT, 0) \ } /* XGA resolutions */ #define V4L2_DV_BT_DMT_1024X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \ 65000000, 24, 136, 160, 3, 6, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P70 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \ 75000000, 24, 136, 144, 3, 6, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 78750000, 16, 96, 176, 1, 3, 28, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 94500000, 48, 96, 208, 1, 3, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1024X768P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1024, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 115500000, 48, 32, 80, 3, 4, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* XGA+ resolution */ #define V4L2_DV_BT_DMT_1152X864P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1152, 864, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 64, 128, 256, 1, 3, 32, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X720P60 V4L2_DV_BT_CEA_1280X720P60 /* WXGA resolutions */ #define V4L2_DV_BT_DMT_1280X768P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 68250000, 48, 32, 80, 3, 7, 12, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \ 79500000, 64, 128, 192, 3, 7, 20, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X768P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \ 102250000, 80, 128, 208, 3, 7, 27, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X768P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \ 117500000, 80, 136, 216, 3, 7, 31, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X768P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 140250000, 48, 32, 80, 3, 7, 35, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X800P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \ 71000000, 48, 32, 80, 3, 6, 14, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X800P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \ 83500000, 72, 128, 200, 3, 6, 22, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X800P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \ 106500000, 80, 128, 208, 3, 6, 29, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X800P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \ 122500000, 80, 136, 216, 3, 6, 34, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1280X800P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \ 146250000, 48, 32, 80, 3, 6, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1280X960P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 960, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 96, 112, 312, 1, 3, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X960P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 960, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 148500000, 64, 160, 224, 1, 3, 47, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X960P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 960, 0, V4L2_DV_HSYNC_POS_POL, \ 175500000, 48, 32, 80, 3, 4, 50, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* SXGA resolutions */ #define V4L2_DV_BT_DMT_1280X1024P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 48, 112, 248, 1, 3, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X1024P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 135000000, 16, 144, 248, 1, 3, 38, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X1024P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 157500000, 64, 160, 224, 1, 3, 44, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1280X1024P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL, \ 187250000, 48, 32, 80, 3, 7, 50, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1360X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1360, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 85500000, 64, 112, 256, 3, 6, 18, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1360X768P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1360, 768, 0, V4L2_DV_HSYNC_POS_POL, \ 148250000, 48, 32, 80, 3, 5, 37, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1366X768P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1366, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1366X768P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1366, 768, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 72000000, 14, 56, 64, 1, 3, 28, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \ } /* SXGA+ resolutions */ #define V4L2_DV_BT_DMT_1400X1050P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 101000000, 48, 32, 80, 3, 4, 23, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1400X1050P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 121750000, 88, 144, 232, 3, 4, 32, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1400X1050P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 156000000, 104, 144, 248, 3, 4, 42, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1400X1050P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 179500000, 104, 152, 256, 3, 4, 48, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1400X1050P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 208000000, 48, 32, 80, 3, 4, 55, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* WXGA+ resolutions */ #define V4L2_DV_BT_DMT_1440X900P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \ 88750000, 48, 32, 80, 3, 6, 17, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1440X900P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \ 106500000, 80, 152, 232, 3, 6, 25, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1440X900P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \ 136750000, 96, 152, 248, 3, 6, 33, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1440X900P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \ 157000000, 104, 152, 256, 3, 6, 39, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1440X900P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \ 182750000, 48, 32, 80, 3, 6, 44, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1600X900P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 900, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108000000, 24, 80, 96, 1, 3, 96, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \ } /* UXGA resolutions */ #define V4L2_DV_BT_DMT_1600X1200P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 162000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P65 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 175500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P70 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 189000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 202500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 229500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1600X1200P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL, \ 268250000, 48, 32, 80, 3, 4, 64, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* WSXGA+ resolutions */ #define V4L2_DV_BT_DMT_1680X1050P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 119000000, 48, 32, 80, 3, 6, 21, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1680X1050P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 146250000, 104, 176, 280, 3, 6, 30, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1680X1050P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 187000000, 120, 176, 296, 3, 6, 40, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1680X1050P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \ 214750000, 128, 176, 304, 3, 6, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1680X1050P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \ 245500000, 48, 32, 80, 3, 6, 53, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1792X1344P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \ 204750000, 128, 200, 328, 1, 3, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1792X1344P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \ 261000000, 96, 216, 352, 1, 3, 69, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1792X1344P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_HSYNC_POS_POL, \ 333250000, 48, 32, 80, 3, 4, 72, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1856X1392P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \ 218250000, 96, 224, 352, 1, 3, 43, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1856X1392P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \ 288000000, 128, 224, 352, 1, 3, 104, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1856X1392P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_HSYNC_POS_POL, \ 356500000, 48, 32, 80, 3, 4, 75, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1920X1080P60 V4L2_DV_BT_CEA_1920X1080P60 /* WUXGA resolutions */ #define V4L2_DV_BT_DMT_1920X1200P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \ 154000000, 48, 32, 80, 3, 6, 26, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1920X1200P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \ 193250000, 136, 200, 336, 3, 6, 36, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1920X1200P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \ 245250000, 136, 208, 344, 3, 6, 46, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1920X1200P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \ 281250000, 144, 208, 352, 3, 6, 53, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_1920X1200P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \ 317000000, 48, 32, 80, 3, 6, 62, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_1920X1440P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \ 234000000, 128, 208, 344, 1, 3, 56, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1920X1440P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \ 297000000, 144, 224, 352, 1, 3, 56, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, 0) \ } #define V4L2_DV_BT_DMT_1920X1440P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_HSYNC_POS_POL, \ 380500000, 48, 32, 80, 3, 4, 78, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_2048X1152P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2048, 1152, 0, \ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 162000000, 26, 80, 96, 1, 3, 44, 0, 0, 0, \ V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \ } /* WQXGA resolutions */ #define V4L2_DV_BT_DMT_2560X1600P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \ 268500000, 48, 32, 80, 3, 6, 37, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_2560X1600P60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \ 348500000, 192, 280, 472, 3, 6, 49, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_2560X1600P75 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \ 443250000, 208, 280, 488, 3, 6, 63, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_2560X1600P85 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \ 505250000, 208, 280, 488, 3, 6, 73, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \ } #define V4L2_DV_BT_DMT_2560X1600P120_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \ 552750000, 48, 32, 80, 3, 6, 85, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* 4K resolutions */ #define V4L2_DV_BT_DMT_4096X2160P60_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 556744000, 8, 32, 40, 48, 8, 6, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } #define V4L2_DV_BT_DMT_4096X2160P59_94_RB { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 556188000, 8, 32, 40, 48, 8, 6, 0, 0, 0, \ V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \ V4L2_DV_FL_REDUCED_BLANKING) \ } /* SDI timings definitions */ /* SMPTE-125M */ #define V4L2_DV_BT_SDI_720X487I60 { \ .type = V4L2_DV_BT_656_1120, \ V4L2_INIT_BT_TIMINGS(720, 487, 1, \ V4L2_DV_HSYNC_POS_POL, \ 13500000, 16, 121, 0, 0, 19, 0, 0, 19, 0, \ V4L2_DV_BT_STD_SDI, \ V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) \ } #endif linux/v4l2-mediabus.h 0000644 00000011755 15063602056 0010446 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Media Bus API header * * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __LINUX_V4L2_MEDIABUS_H #define __LINUX_V4L2_MEDIABUS_H #include <linux/media-bus-format.h> #include <linux/types.h> #include <linux/videodev2.h> /** * struct v4l2_mbus_framefmt - frame format on the media bus * @width: image width * @height: image height * @code: data format code (from enum v4l2_mbus_pixelcode) * @field: used interlacing type (from enum v4l2_field) * @colorspace: colorspace of the data (from enum v4l2_colorspace) * @ycbcr_enc: YCbCr encoding of the data (from enum v4l2_ycbcr_encoding) * @quantization: quantization of the data (from enum v4l2_quantization) * @xfer_func: transfer function of the data (from enum v4l2_xfer_func) */ struct v4l2_mbus_framefmt { __u32 width; __u32 height; __u32 code; __u32 field; __u32 colorspace; __u16 ycbcr_enc; __u16 quantization; __u16 xfer_func; __u16 reserved[11]; }; /* * enum v4l2_mbus_pixelcode and its definitions are now deprecated, and * MEDIA_BUS_FMT_ definitions (defined in media-bus-format.h) should be * used instead. * * New defines should only be added to media-bus-format.h. The * v4l2_mbus_pixelcode enum is frozen. */ #define V4L2_MBUS_FROM_MEDIA_BUS_FMT(name) \ V4L2_MBUS_FMT_ ## name = MEDIA_BUS_FMT_ ## name enum v4l2_mbus_pixelcode { V4L2_MBUS_FROM_MEDIA_BUS_FMT(FIXED), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB666_1X18), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(ARGB8888_1X32), V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UV8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1_5X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_2X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_2X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YDYUYDYV8_1X16), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_1X20), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUV10_1X30), V4L2_MBUS_FROM_MEDIA_BUS_FMT(AYUV8_1X32), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_2X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_1X24), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_ALAW8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_DPCM8_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_BE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_LE), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_1X10), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB12_1X12), V4L2_MBUS_FROM_MEDIA_BUS_FMT(JPEG_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(S5C_UYVY_JPEG_1X8), V4L2_MBUS_FROM_MEDIA_BUS_FMT(AHSV8888_1X32), }; #endif linux/v4l2-subdev.h 0000644 00000013720 15063602056 0010137 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * V4L2 subdev userspace API * * Copyright (C) 2010 Nokia Corporation * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_V4L2_SUBDEV_H #define __LINUX_V4L2_SUBDEV_H #include <linux/ioctl.h> #include <linux/types.h> #include <linux/v4l2-common.h> #include <linux/v4l2-mediabus.h> /** * enum v4l2_subdev_format_whence - Media bus format type * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device */ enum v4l2_subdev_format_whence { V4L2_SUBDEV_FORMAT_TRY = 0, V4L2_SUBDEV_FORMAT_ACTIVE = 1, }; /** * struct v4l2_subdev_format - Pad-level media bus format * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @format: media bus format (format code and frame size) */ struct v4l2_subdev_format { __u32 which; __u32 pad; struct v4l2_mbus_framefmt format; __u32 reserved[8]; }; /** * struct v4l2_subdev_crop - Pad-level crop settings * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @rect: pad crop rectangle boundaries */ struct v4l2_subdev_crop { __u32 which; __u32 pad; struct v4l2_rect rect; __u32 reserved[8]; }; /** * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration * @pad: pad number, as reported by the media API * @index: format index during enumeration * @code: format code (MEDIA_BUS_FMT_ definitions) * @which: format type (from enum v4l2_subdev_format_whence) */ struct v4l2_subdev_mbus_code_enum { __u32 pad; __u32 index; __u32 code; __u32 which; __u32 reserved[8]; }; /** * struct v4l2_subdev_frame_size_enum - Media bus format enumeration * @pad: pad number, as reported by the media API * @index: format index during enumeration * @code: format code (MEDIA_BUS_FMT_ definitions) * @which: format type (from enum v4l2_subdev_format_whence) */ struct v4l2_subdev_frame_size_enum { __u32 index; __u32 pad; __u32 code; __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; __u32 which; __u32 reserved[8]; }; /** * struct v4l2_subdev_frame_interval - Pad-level frame rate * @pad: pad number, as reported by the media API * @interval: frame interval in seconds */ struct v4l2_subdev_frame_interval { __u32 pad; struct v4l2_fract interval; __u32 reserved[9]; }; /** * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration * @pad: pad number, as reported by the media API * @index: frame interval index during enumeration * @code: format code (MEDIA_BUS_FMT_ definitions) * @width: frame width in pixels * @height: frame height in pixels * @interval: frame interval in seconds * @which: format type (from enum v4l2_subdev_format_whence) */ struct v4l2_subdev_frame_interval_enum { __u32 index; __u32 pad; __u32 code; __u32 width; __u32 height; struct v4l2_fract interval; __u32 which; __u32 reserved[8]; }; /** * struct v4l2_subdev_selection - selection info * * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY * @pad: pad number, as reported by the media API * @target: Selection target, used to choose one of possible rectangles, * defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of the selection window * @reserved: for future use, set to zero for now * * Hardware may use multiple helper windows to process a video stream. * The structure is used to exchange this selection areas between * an application and a driver. */ struct v4l2_subdev_selection { __u32 which; __u32 pad; __u32 target; __u32 flags; struct v4l2_rect r; __u32 reserved[8]; }; /* Backwards compatibility define --- to be removed */ #define v4l2_subdev_edid v4l2_edid #define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) #define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) #define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval) #define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval) #define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) #define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) #define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection) /* The following ioctls are identical to the ioctls in videodev2.h */ #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid) #define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid) #define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) #define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) #define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings) #define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings) #define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap) #endif linux/vbox_err.h 0000644 00000016131 15063602056 0007707 0 ustar 00 /* SPDX-License-Identifier: MIT */ /* Copyright (C) 2017 Oracle Corporation */ #ifndef __UAPI_VBOX_ERR_H__ #define __UAPI_VBOX_ERR_H__ #define VINF_SUCCESS 0 #define VERR_GENERAL_FAILURE (-1) #define VERR_INVALID_PARAMETER (-2) #define VERR_INVALID_MAGIC (-3) #define VERR_INVALID_HANDLE (-4) #define VERR_LOCK_FAILED (-5) #define VERR_INVALID_POINTER (-6) #define VERR_IDT_FAILED (-7) #define VERR_NO_MEMORY (-8) #define VERR_ALREADY_LOADED (-9) #define VERR_PERMISSION_DENIED (-10) #define VERR_VERSION_MISMATCH (-11) #define VERR_NOT_IMPLEMENTED (-12) #define VERR_INVALID_FLAGS (-13) #define VERR_NOT_EQUAL (-18) #define VERR_NOT_SYMLINK (-19) #define VERR_NO_TMP_MEMORY (-20) #define VERR_INVALID_FMODE (-21) #define VERR_WRONG_ORDER (-22) #define VERR_NO_TLS_FOR_SELF (-23) #define VERR_FAILED_TO_SET_SELF_TLS (-24) #define VERR_NO_CONT_MEMORY (-26) #define VERR_NO_PAGE_MEMORY (-27) #define VERR_THREAD_IS_DEAD (-29) #define VERR_THREAD_NOT_WAITABLE (-30) #define VERR_PAGE_TABLE_NOT_PRESENT (-31) #define VERR_INVALID_CONTEXT (-32) #define VERR_TIMER_BUSY (-33) #define VERR_ADDRESS_CONFLICT (-34) #define VERR_UNRESOLVED_ERROR (-35) #define VERR_INVALID_FUNCTION (-36) #define VERR_NOT_SUPPORTED (-37) #define VERR_ACCESS_DENIED (-38) #define VERR_INTERRUPTED (-39) #define VERR_TIMEOUT (-40) #define VERR_BUFFER_OVERFLOW (-41) #define VERR_TOO_MUCH_DATA (-42) #define VERR_MAX_THRDS_REACHED (-43) #define VERR_MAX_PROCS_REACHED (-44) #define VERR_SIGNAL_REFUSED (-45) #define VERR_SIGNAL_PENDING (-46) #define VERR_SIGNAL_INVALID (-47) #define VERR_STATE_CHANGED (-48) #define VERR_INVALID_UUID_FORMAT (-49) #define VERR_PROCESS_NOT_FOUND (-50) #define VERR_PROCESS_RUNNING (-51) #define VERR_TRY_AGAIN (-52) #define VERR_PARSE_ERROR (-53) #define VERR_OUT_OF_RANGE (-54) #define VERR_NUMBER_TOO_BIG (-55) #define VERR_NO_DIGITS (-56) #define VERR_NEGATIVE_UNSIGNED (-57) #define VERR_NO_TRANSLATION (-58) #define VERR_NOT_FOUND (-78) #define VERR_INVALID_STATE (-79) #define VERR_OUT_OF_RESOURCES (-80) #define VERR_FILE_NOT_FOUND (-102) #define VERR_PATH_NOT_FOUND (-103) #define VERR_INVALID_NAME (-104) #define VERR_ALREADY_EXISTS (-105) #define VERR_TOO_MANY_OPEN_FILES (-106) #define VERR_SEEK (-107) #define VERR_NEGATIVE_SEEK (-108) #define VERR_SEEK_ON_DEVICE (-109) #define VERR_EOF (-110) #define VERR_READ_ERROR (-111) #define VERR_WRITE_ERROR (-112) #define VERR_WRITE_PROTECT (-113) #define VERR_SHARING_VIOLATION (-114) #define VERR_FILE_LOCK_FAILED (-115) #define VERR_FILE_LOCK_VIOLATION (-116) #define VERR_CANT_CREATE (-117) #define VERR_CANT_DELETE_DIRECTORY (-118) #define VERR_NOT_SAME_DEVICE (-119) #define VERR_FILENAME_TOO_LONG (-120) #define VERR_MEDIA_NOT_PRESENT (-121) #define VERR_MEDIA_NOT_RECOGNIZED (-122) #define VERR_FILE_NOT_LOCKED (-123) #define VERR_FILE_LOCK_LOST (-124) #define VERR_DIR_NOT_EMPTY (-125) #define VERR_NOT_A_DIRECTORY (-126) #define VERR_IS_A_DIRECTORY (-127) #define VERR_FILE_TOO_BIG (-128) #define VERR_NET_IO_ERROR (-400) #define VERR_NET_OUT_OF_RESOURCES (-401) #define VERR_NET_HOST_NOT_FOUND (-402) #define VERR_NET_PATH_NOT_FOUND (-403) #define VERR_NET_PRINT_ERROR (-404) #define VERR_NET_NO_NETWORK (-405) #define VERR_NET_NOT_UNIQUE_NAME (-406) #define VERR_NET_IN_PROGRESS (-436) #define VERR_NET_ALREADY_IN_PROGRESS (-437) #define VERR_NET_NOT_SOCKET (-438) #define VERR_NET_DEST_ADDRESS_REQUIRED (-439) #define VERR_NET_MSG_SIZE (-440) #define VERR_NET_PROTOCOL_TYPE (-441) #define VERR_NET_PROTOCOL_NOT_AVAILABLE (-442) #define VERR_NET_PROTOCOL_NOT_SUPPORTED (-443) #define VERR_NET_SOCKET_TYPE_NOT_SUPPORTED (-444) #define VERR_NET_OPERATION_NOT_SUPPORTED (-445) #define VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED (-446) #define VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED (-447) #define VERR_NET_ADDRESS_IN_USE (-448) #define VERR_NET_ADDRESS_NOT_AVAILABLE (-449) #define VERR_NET_DOWN (-450) #define VERR_NET_UNREACHABLE (-451) #define VERR_NET_CONNECTION_RESET (-452) #define VERR_NET_CONNECTION_ABORTED (-453) #define VERR_NET_CONNECTION_RESET_BY_PEER (-454) #define VERR_NET_NO_BUFFER_SPACE (-455) #define VERR_NET_ALREADY_CONNECTED (-456) #define VERR_NET_NOT_CONNECTED (-457) #define VERR_NET_SHUTDOWN (-458) #define VERR_NET_TOO_MANY_REFERENCES (-459) #define VERR_NET_CONNECTION_TIMED_OUT (-460) #define VERR_NET_CONNECTION_REFUSED (-461) #define VERR_NET_HOST_DOWN (-464) #define VERR_NET_HOST_UNREACHABLE (-465) #define VERR_NET_PROTOCOL_ERROR (-466) #define VERR_NET_INCOMPLETE_TX_PACKET (-467) /* misc. unsorted codes */ #define VERR_RESOURCE_BUSY (-138) #define VERR_DISK_FULL (-152) #define VERR_TOO_MANY_SYMLINKS (-156) #define VERR_NO_MORE_FILES (-201) #define VERR_INTERNAL_ERROR (-225) #define VERR_INTERNAL_ERROR_2 (-226) #define VERR_INTERNAL_ERROR_3 (-227) #define VERR_INTERNAL_ERROR_4 (-228) #define VERR_DEV_IO_ERROR (-250) #define VERR_IO_BAD_LENGTH (-255) #define VERR_BROKEN_PIPE (-301) #define VERR_NO_DATA (-304) #define VERR_SEM_DESTROYED (-363) #define VERR_DEADLOCK (-365) #define VERR_BAD_EXE_FORMAT (-608) #define VINF_HGCM_ASYNC_EXECUTE (2903) #endif linux/vbox_vmmdev_types.h 0000644 00000020244 15063602056 0011641 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */ /* * Virtual Device for Guest <-> VMM/Host communication, type definitions * which are also used for the vboxguest ioctl interface / by vboxsf * * Copyright (C) 2006-2016 Oracle Corporation */ #ifndef __UAPI_VBOX_VMMDEV_TYPES_H__ #define __UAPI_VBOX_VMMDEV_TYPES_H__ #include <asm/bitsperlong.h> #include <linux/types.h> /* * We cannot use linux' compiletime_assert here because it expects to be used * inside a function only. Use a typedef to a char array with a negative size. */ #define VMMDEV_ASSERT_SIZE(type, size) \ typedef char type ## _asrt_size[1 - 2*!!(sizeof(struct type) != (size))] /** enum vmmdev_request_type - VMMDev request types. */ enum vmmdev_request_type { VMMDEVREQ_INVALID_REQUEST = 0, VMMDEVREQ_GET_MOUSE_STATUS = 1, VMMDEVREQ_SET_MOUSE_STATUS = 2, VMMDEVREQ_SET_POINTER_SHAPE = 3, VMMDEVREQ_GET_HOST_VERSION = 4, VMMDEVREQ_IDLE = 5, VMMDEVREQ_GET_HOST_TIME = 10, VMMDEVREQ_GET_HYPERVISOR_INFO = 20, VMMDEVREQ_SET_HYPERVISOR_INFO = 21, VMMDEVREQ_REGISTER_PATCH_MEMORY = 22, /* since version 3.0.6 */ VMMDEVREQ_DEREGISTER_PATCH_MEMORY = 23, /* since version 3.0.6 */ VMMDEVREQ_SET_POWER_STATUS = 30, VMMDEVREQ_ACKNOWLEDGE_EVENTS = 41, VMMDEVREQ_CTL_GUEST_FILTER_MASK = 42, VMMDEVREQ_REPORT_GUEST_INFO = 50, VMMDEVREQ_REPORT_GUEST_INFO2 = 58, /* since version 3.2.0 */ VMMDEVREQ_REPORT_GUEST_STATUS = 59, /* since version 3.2.8 */ VMMDEVREQ_REPORT_GUEST_USER_STATE = 74, /* since version 4.3 */ /* Retrieve a display resize request sent by the host, deprecated. */ VMMDEVREQ_GET_DISPLAY_CHANGE_REQ = 51, VMMDEVREQ_VIDEMODE_SUPPORTED = 52, VMMDEVREQ_GET_HEIGHT_REDUCTION = 53, /** * @VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2: * Retrieve a display resize request sent by the host. * * Queries a display resize request sent from the host. If the * event_ack member is sent to true and there is an unqueried request * available for one of the virtual display then that request will * be returned. If several displays have unqueried requests the lowest * numbered display will be chosen first. Only the most recent unseen * request for each display is remembered. * If event_ack is set to false, the last host request queried with * event_ack set is resent, or failing that the most recent received * from the host. If no host request was ever received then all zeros * are returned. */ VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2 = 54, VMMDEVREQ_REPORT_GUEST_CAPABILITIES = 55, VMMDEVREQ_SET_GUEST_CAPABILITIES = 56, VMMDEVREQ_VIDEMODE_SUPPORTED2 = 57, /* since version 3.2.0 */ VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX = 80, /* since version 4.2.4 */ VMMDEVREQ_HGCM_CONNECT = 60, VMMDEVREQ_HGCM_DISCONNECT = 61, VMMDEVREQ_HGCM_CALL32 = 62, VMMDEVREQ_HGCM_CALL64 = 63, VMMDEVREQ_HGCM_CANCEL = 64, VMMDEVREQ_HGCM_CANCEL2 = 65, VMMDEVREQ_VIDEO_ACCEL_ENABLE = 70, VMMDEVREQ_VIDEO_ACCEL_FLUSH = 71, VMMDEVREQ_VIDEO_SET_VISIBLE_REGION = 72, VMMDEVREQ_GET_SEAMLESS_CHANGE_REQ = 73, VMMDEVREQ_QUERY_CREDENTIALS = 100, VMMDEVREQ_REPORT_CREDENTIALS_JUDGEMENT = 101, VMMDEVREQ_REPORT_GUEST_STATS = 110, VMMDEVREQ_GET_MEMBALLOON_CHANGE_REQ = 111, VMMDEVREQ_GET_STATISTICS_CHANGE_REQ = 112, VMMDEVREQ_CHANGE_MEMBALLOON = 113, VMMDEVREQ_GET_VRDPCHANGE_REQ = 150, VMMDEVREQ_LOG_STRING = 200, VMMDEVREQ_GET_CPU_HOTPLUG_REQ = 210, VMMDEVREQ_SET_CPU_HOTPLUG_STATUS = 211, VMMDEVREQ_REGISTER_SHARED_MODULE = 212, VMMDEVREQ_UNREGISTER_SHARED_MODULE = 213, VMMDEVREQ_CHECK_SHARED_MODULES = 214, VMMDEVREQ_GET_PAGE_SHARING_STATUS = 215, VMMDEVREQ_DEBUG_IS_PAGE_SHARED = 216, VMMDEVREQ_GET_SESSION_ID = 217, /* since version 3.2.8 */ VMMDEVREQ_WRITE_COREDUMP = 218, VMMDEVREQ_GUEST_HEARTBEAT = 219, VMMDEVREQ_HEARTBEAT_CONFIGURE = 220, /* Ensure the enum is a 32 bit data-type */ VMMDEVREQ_SIZEHACK = 0x7fffffff }; #if __BITS_PER_LONG == 64 #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL64 #else #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL32 #endif /** HGCM service location types. */ enum vmmdev_hgcm_service_location_type { VMMDEV_HGCM_LOC_INVALID = 0, VMMDEV_HGCM_LOC_LOCALHOST = 1, VMMDEV_HGCM_LOC_LOCALHOST_EXISTING = 2, /* Ensure the enum is a 32 bit data-type */ VMMDEV_HGCM_LOC_SIZEHACK = 0x7fffffff }; /** HGCM host service location. */ struct vmmdev_hgcm_service_location_localhost { /** Service name */ char service_name[128]; }; VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location_localhost, 128); /** HGCM service location. */ struct vmmdev_hgcm_service_location { /** Type of the location. */ enum vmmdev_hgcm_service_location_type type; union { struct vmmdev_hgcm_service_location_localhost localhost; } u; }; VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location, 128 + 4); /** HGCM function parameter type. */ enum vmmdev_hgcm_function_parameter_type { VMMDEV_HGCM_PARM_TYPE_INVALID = 0, VMMDEV_HGCM_PARM_TYPE_32BIT = 1, VMMDEV_HGCM_PARM_TYPE_64BIT = 2, /** Deprecated Doesn't work, use PAGELIST. */ VMMDEV_HGCM_PARM_TYPE_PHYSADDR = 3, /** In and Out, user-memory */ VMMDEV_HGCM_PARM_TYPE_LINADDR = 4, /** In, user-memory (read; host<-guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_IN = 5, /** Out, user-memory (write; host->guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_OUT = 6, /** In and Out, kernel-memory */ VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL = 7, /** In, kernel-memory (read; host<-guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN = 8, /** Out, kernel-memory (write; host->guest) */ VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT = 9, /** Physical addresses of locked pages for a buffer. */ VMMDEV_HGCM_PARM_TYPE_PAGELIST = 10, /* Ensure the enum is a 32 bit data-type */ VMMDEV_HGCM_PARM_TYPE_SIZEHACK = 0x7fffffff }; /** HGCM function parameter, 32-bit client. */ struct vmmdev_hgcm_function_parameter32 { enum vmmdev_hgcm_function_parameter_type type; union { __u32 value32; __u64 value64; struct { __u32 size; union { __u32 phys_addr; __u32 linear_addr; } u; } pointer; struct { /** Size of the buffer described by the page list. */ __u32 size; /** Relative to the request header. */ __u32 offset; } page_list; } u; } __attribute__((packed)); VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter32, 4 + 8); /** HGCM function parameter, 64-bit client. */ struct vmmdev_hgcm_function_parameter64 { enum vmmdev_hgcm_function_parameter_type type; union { __u32 value32; __u64 value64; struct { __u32 size; union { __u64 phys_addr; __u64 linear_addr; } u; } __attribute__((packed)) pointer; struct { /** Size of the buffer described by the page list. */ __u32 size; /** Relative to the request header. */ __u32 offset; } page_list; } __attribute__((packed)) u; } __attribute__((packed)); VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter64, 4 + 12); #if __BITS_PER_LONG == 64 #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter64 #else #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter32 #endif #define VMMDEV_HGCM_F_PARM_DIRECTION_NONE 0x00000000U #define VMMDEV_HGCM_F_PARM_DIRECTION_TO_HOST 0x00000001U #define VMMDEV_HGCM_F_PARM_DIRECTION_FROM_HOST 0x00000002U #define VMMDEV_HGCM_F_PARM_DIRECTION_BOTH 0x00000003U /** * struct vmmdev_hgcm_pagelist - VMMDEV_HGCM_PARM_TYPE_PAGELIST parameters * point to this structure to actually describe the buffer. */ struct vmmdev_hgcm_pagelist { __u32 flags; /** VMMDEV_HGCM_F_PARM_*. */ __u16 offset_first_page; /** Data offset in the first page. */ __u16 page_count; /** Number of pages. */ __u64 pages[1]; /** Page addresses. */ }; VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8); #endif linux/vboxguest.h 0000644 00000021031 15063602056 0010102 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */ /* * VBoxGuest - VirtualBox Guest Additions Driver Interface. * * Copyright (C) 2006-2016 Oracle Corporation */ #ifndef __UAPI_VBOXGUEST_H__ #define __UAPI_VBOXGUEST_H__ #include <asm/bitsperlong.h> #include <linux/ioctl.h> #include <linux/vbox_err.h> #include <linux/vbox_vmmdev_types.h> /* Version of vbg_ioctl_hdr structure. */ #define VBG_IOCTL_HDR_VERSION 0x10001 /* Default request type. Use this for non-VMMDev requests. */ #define VBG_IOCTL_HDR_TYPE_DEFAULT 0 /** * Common ioctl header. * * This is a mirror of vmmdev_request_header to prevent duplicating data and * needing to verify things multiple times. */ struct vbg_ioctl_hdr { /** IN: The request input size, and output size if size_out is zero. */ __u32 size_in; /** IN: Structure version (VBG_IOCTL_HDR_VERSION) */ __u32 version; /** IN: The VMMDev request type or VBG_IOCTL_HDR_TYPE_DEFAULT. */ __u32 type; /** * OUT: The VBox status code of the operation, out direction only. * This is a VINF_ or VERR_ value as defined in vbox_err.h. */ __s32 rc; /** IN: Output size. Set to zero to use size_in as output size. */ __u32 size_out; /** Reserved, MBZ. */ __u32 reserved; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hdr, 24); /* * The VBoxGuest I/O control version. * * As usual, the high word contains the major version and changes to it * signifies incompatible changes. * * The lower word is the minor version number, it is increased when new * functions are added or existing changed in a backwards compatible manner. */ #define VBG_IOC_VERSION 0x00010000u /** * VBG_IOCTL_DRIVER_VERSION_INFO data structure * * Note VBG_IOCTL_DRIVER_VERSION_INFO may switch the session to a backwards * compatible interface version if uClientVersion indicates older client code. */ struct vbg_ioctl_driver_version_info { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Requested interface version (VBG_IOC_VERSION). */ __u32 req_version; /** * Minimum interface version number (typically the * major version part of VBG_IOC_VERSION). */ __u32 min_version; /** Reserved, MBZ. */ __u32 reserved1; /** Reserved, MBZ. */ __u32 reserved2; } in; struct { /** Version for this session (typ. VBG_IOC_VERSION). */ __u32 session_version; /** Version of the IDC interface (VBG_IOC_VERSION). */ __u32 driver_version; /** The SVN revision of the driver, or 0. */ __u32 driver_revision; /** Reserved \#1 (zero until defined). */ __u32 reserved1; /** Reserved \#2 (zero until defined). */ __u32 reserved2; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); #define VBG_IOCTL_DRIVER_VERSION_INFO \ _IOWR('V', 0, struct vbg_ioctl_driver_version_info) /* IOCTL to perform a VMM Device request less than 1KB in size. */ #define VBG_IOCTL_VMMDEV_REQUEST(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 2, s) /* IOCTL to perform a VMM Device request larger then 1KB. */ #define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) /** VBG_IOCTL_HGCM_CONNECT data structure. */ struct vbg_ioctl_hgcm_connect { struct vbg_ioctl_hdr hdr; union { struct { struct vmmdev_hgcm_service_location loc; } in; struct { __u32 client_id; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_connect, 24 + 132); #define VBG_IOCTL_HGCM_CONNECT \ _IOWR('V', 4, struct vbg_ioctl_hgcm_connect) /** VBG_IOCTL_HGCM_DISCONNECT data structure. */ struct vbg_ioctl_hgcm_disconnect { struct vbg_ioctl_hdr hdr; union { struct { __u32 client_id; } in; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_disconnect, 24 + 4); #define VBG_IOCTL_HGCM_DISCONNECT \ _IOWR('V', 5, struct vbg_ioctl_hgcm_disconnect) /** VBG_IOCTL_HGCM_CALL data structure. */ struct vbg_ioctl_hgcm_call { /** The header. */ struct vbg_ioctl_hdr hdr; /** Input: The id of the caller. */ __u32 client_id; /** Input: Function number. */ __u32 function; /** * Input: How long to wait (milliseconds) for completion before * cancelling the call. Set to -1 to wait indefinitely. */ __u32 timeout_ms; /** Interruptable flag, ignored for userspace calls. */ __u8 interruptible; /** Explicit padding, MBZ. */ __u8 reserved; /** * Input: How many parameters following this structure. * * The parameters are either HGCMFunctionParameter64 or 32, * depending on whether we're receiving a 64-bit or 32-bit request. * * The current maximum is 61 parameters (given a 1KB max request size, * and a 64-bit parameter size of 16 bytes). */ __u16 parm_count; /* * Parameters follow in form: * struct hgcm_function_parameter<32|64> parms[parm_count] */ }; VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_call, 24 + 16); #define VBG_IOCTL_HGCM_CALL_32(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 6, s) #define VBG_IOCTL_HGCM_CALL_64(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 7, s) #if __BITS_PER_LONG == 64 #define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_64(s) #else #define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_32(s) #endif /** VBG_IOCTL_LOG data structure. */ struct vbg_ioctl_log { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** * The log message, this may be zero terminated. If it * is not zero terminated then the length is determined * from the input size. */ char msg[1]; } in; } u; }; #define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ struct vbg_ioctl_wait_for_events { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Timeout in milliseconds. */ __u32 timeout_ms; /** Events to wait for. */ __u32 events; } in; struct { /** Events that occurred. */ __u32 events; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_wait_for_events, 24 + 8); #define VBG_IOCTL_WAIT_FOR_EVENTS \ _IOWR('V', 10, struct vbg_ioctl_wait_for_events) /* * IOCTL to VBoxGuest to interrupt (cancel) any pending * VBG_IOCTL_WAIT_FOR_EVENTS and return. * * Handled inside the vboxguest driver and not seen by the host at all. * After calling this, VBG_IOCTL_WAIT_FOR_EVENTS should no longer be called in * the same session. Any VBOXGUEST_IOCTL_WAITEVENT calls in the same session * done after calling this will directly exit with -EINTR. */ #define VBG_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS \ _IOWR('V', 11, struct vbg_ioctl_hdr) /** VBG_IOCTL_CHANGE_FILTER_MASK data structure. */ struct vbg_ioctl_change_filter { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Flags to set. */ __u32 or_mask; /** Flags to remove. */ __u32 not_mask; } in; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_change_filter, 24 + 8); /* IOCTL to VBoxGuest to control the event filter mask. */ #define VBG_IOCTL_CHANGE_FILTER_MASK \ _IOWR('V', 12, struct vbg_ioctl_change_filter) /** VBG_IOCTL_CHANGE_GUEST_CAPABILITIES data structure. */ struct vbg_ioctl_set_guest_caps { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** Capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */ __u32 or_mask; /** Capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */ __u32 not_mask; } in; struct { /** Capabilities held by the session after the call. */ __u32 session_caps; /** Capabilities for all the sessions after the call. */ __u32 global_caps; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_set_guest_caps, 24 + 8); #define VBG_IOCTL_CHANGE_GUEST_CAPABILITIES \ _IOWR('V', 14, struct vbg_ioctl_set_guest_caps) /** VBG_IOCTL_CHECK_BALLOON data structure. */ struct vbg_ioctl_check_balloon { /** The header. */ struct vbg_ioctl_hdr hdr; union { struct { /** The size of the balloon in chunks of 1MB. */ __u32 balloon_chunks; /** * false = handled in R0, no further action required. * true = allocate balloon memory in R3. */ __u8 handle_in_r3; /** Explicit padding, MBZ. */ __u8 padding[3]; } out; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_check_balloon, 24 + 8); /* * IOCTL to check memory ballooning. * * The guest kernel module will ask the host for the current size of the * balloon and adjust the size. Or it will set handle_in_r3 = true and R3 is * responsible for allocating memory and calling VBG_IOCTL_CHANGE_BALLOON. */ #define VBG_IOCTL_CHECK_BALLOON \ _IOWR('V', 17, struct vbg_ioctl_check_balloon) /** VBG_IOCTL_WRITE_CORE_DUMP data structure. */ struct vbg_ioctl_write_coredump { struct vbg_ioctl_hdr hdr; union { struct { __u32 flags; /** Flags (reserved, MBZ). */ } in; } u; }; VMMDEV_ASSERT_SIZE(vbg_ioctl_write_coredump, 24 + 4); #define VBG_IOCTL_WRITE_CORE_DUMP \ _IOWR('V', 19, struct vbg_ioctl_write_coredump) #endif linux/vdpa.h 0000644 00000002615 15063602056 0007015 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * vdpa device management interface * Copyright (c) 2020 Mellanox Technologies Ltd. All rights reserved. */ #ifndef _LINUX_VDPA_H_ #define _LINUX_VDPA_H_ #define VDPA_GENL_NAME "vdpa" #define VDPA_GENL_VERSION 0x1 enum vdpa_command { VDPA_CMD_UNSPEC, VDPA_CMD_MGMTDEV_NEW, VDPA_CMD_MGMTDEV_GET, /* can dump */ VDPA_CMD_DEV_NEW, VDPA_CMD_DEV_DEL, VDPA_CMD_DEV_GET, /* can dump */ VDPA_CMD_DEV_CONFIG_GET, /* can dump */ }; enum vdpa_attr { VDPA_ATTR_UNSPEC, /* Pad attribute for 64b alignment */ VDPA_ATTR_PAD = VDPA_ATTR_UNSPEC, /* bus name (optional) + dev name together make the parent device handle */ VDPA_ATTR_MGMTDEV_BUS_NAME, /* string */ VDPA_ATTR_MGMTDEV_DEV_NAME, /* string */ VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES, /* u64 */ VDPA_ATTR_DEV_NAME, /* string */ VDPA_ATTR_DEV_ID, /* u32 */ VDPA_ATTR_DEV_VENDOR_ID, /* u32 */ VDPA_ATTR_DEV_MAX_VQS, /* u32 */ VDPA_ATTR_DEV_MAX_VQ_SIZE, /* u16 */ VDPA_ATTR_DEV_MIN_VQ_SIZE, /* u16 */ VDPA_ATTR_DEV_NET_CFG_MACADDR, /* binary */ VDPA_ATTR_DEV_NET_STATUS, /* u8 */ VDPA_ATTR_DEV_NET_CFG_MAX_VQP, /* u16 */ VDPA_ATTR_DEV_NET_CFG_MTU, /* u16 */ VDPA_ATTR_DEV_NEGOTIATED_FEATURES, /* u64 */ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS, /* u32 */ VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */ /* new attributes must be added above here */ VDPA_ATTR_MAX, }; #endif linux/version.h 0000644 00000000656 15063602056 0007553 0 ustar 00 #define LINUX_VERSION_CODE 266752 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #define RHEL_MAJOR 8 #define RHEL_MINOR 10 #define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b)) #define RHEL_RELEASE_CODE 2058 #define RHEL_RELEASE "553.70.1" #define LINUX_VERSION_MAJOR 4 #define LINUX_VERSION_PATCHLEVEL 18 #define LINUX_VERSION_SUBLEVEL 0 #define KERNEL_HEADERS_CHECKSUM "ea6cbf40c5ca102e2767b8057b08120d97f31640" linux/veth.h 0000644 00000000340 15063602056 0007022 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __NET_VETH_H_ #define __NET_VETH_H_ enum { VETH_INFO_UNSPEC, VETH_INFO_PEER, __VETH_INFO_MAX #define VETH_INFO_MAX (__VETH_INFO_MAX - 1) }; #endif linux/vfio.h 0000644 00000145777 15063602056 0007047 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * VFIO API definition * * Copyright (C) 2012 Red Hat, Inc. All rights reserved. * Author: Alex Williamson <alex.williamson@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef VFIO_H #define VFIO_H #include <linux/types.h> #include <linux/ioctl.h> #define VFIO_API_VERSION 0 /* Kernel & User level defines for VFIO IOCTLs. */ /* Extensions */ #define VFIO_TYPE1_IOMMU 1 #define VFIO_SPAPR_TCE_IOMMU 2 #define VFIO_TYPE1v2_IOMMU 3 /* * IOMMU enforces DMA cache coherence (ex. PCIe NoSnoop stripping). This * capability is subject to change as groups are added or removed. */ #define VFIO_DMA_CC_IOMMU 4 /* Check if EEH is supported */ #define VFIO_EEH 5 /* Two-stage IOMMU */ #define VFIO_TYPE1_NESTING_IOMMU 6 /* Implies v2 */ #define VFIO_SPAPR_TCE_v2_IOMMU 7 /* * The No-IOMMU IOMMU offers no translation or isolation for devices and * supports no ioctls outside of VFIO_CHECK_EXTENSION. Use of VFIO's No-IOMMU * code will taint the host kernel and should be used with extreme caution. */ #define VFIO_NOIOMMU_IOMMU 8 /* * The IOCTL interface is designed for extensibility by embedding the * structure length (argsz) and flags into structures passed between * kernel and userspace. We therefore use the _IO() macro for these * defines to avoid implicitly embedding a size into the ioctl request. * As structure fields are added, argsz will increase to match and flag * bits will be defined to indicate additional fields with valid data. * It's *always* the caller's responsibility to indicate the size of * the structure passed by setting argsz appropriately. */ #define VFIO_TYPE (';') #define VFIO_BASE 100 /* * For extension of INFO ioctls, VFIO makes use of a capability chain * designed after PCI/e capabilities. A flag bit indicates whether * this capability chain is supported and a field defined in the fixed * structure defines the offset of the first capability in the chain. * This field is only valid when the corresponding bit in the flags * bitmap is set. This offset field is relative to the start of the * INFO buffer, as is the next field within each capability header. * The id within the header is a shared address space per INFO ioctl, * while the version field is specific to the capability id. The * contents following the header are specific to the capability id. */ struct vfio_info_cap_header { __u16 id; /* Identifies capability */ __u16 version; /* Version specific to the capability ID */ __u32 next; /* Offset of next capability */ }; /* * Callers of INFO ioctls passing insufficiently sized buffers will see * the capability chain flag bit set, a zero value for the first capability * offset (if available within the provided argsz), and argsz will be * updated to report the necessary buffer size. For compatibility, the * INFO ioctl will not report error in this case, but the capability chain * will not be available. */ /* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */ /** * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0) * * Report the version of the VFIO API. This allows us to bump the entire * API version should we later need to add or change features in incompatible * ways. * Return: VFIO_API_VERSION * Availability: Always */ #define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0) /** * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32) * * Check whether an extension is supported. * Return: 0 if not supported, 1 (or some other positive integer) if supported. * Availability: Always */ #define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1) /** * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32) * * Set the iommu to the given type. The type must be supported by an * iommu driver as verified by calling CHECK_EXTENSION using the same * type. A group must be set to this file descriptor before this * ioctl is available. The IOMMU interfaces enabled by this call are * specific to the value set. * Return: 0 on success, -errno on failure * Availability: When VFIO group attached */ #define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2) /* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */ /** * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3, * struct vfio_group_status) * * Retrieve information about the group. Fills in provided * struct vfio_group_info. Caller sets argsz. * Return: 0 on succes, -errno on failure. * Availability: Always */ struct vfio_group_status { __u32 argsz; __u32 flags; #define VFIO_GROUP_FLAGS_VIABLE (1 << 0) #define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1) }; #define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3) /** * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32) * * Set the container for the VFIO group to the open VFIO file * descriptor provided. Groups may only belong to a single * container. Containers may, at their discretion, support multiple * groups. Only when a container is set are all of the interfaces * of the VFIO file descriptor and the VFIO group file descriptor * available to the user. * Return: 0 on success, -errno on failure. * Availability: Always */ #define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4) /** * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5) * * Remove the group from the attached container. This is the * opposite of the SET_CONTAINER call and returns the group to * an initial state. All device file descriptors must be released * prior to calling this interface. When removing the last group * from a container, the IOMMU will be disabled and all state lost, * effectively also returning the VFIO file descriptor to an initial * state. * Return: 0 on success, -errno on failure. * Availability: When attached to container */ #define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5) /** * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char) * * Return a new file descriptor for the device object described by * the provided string. The string should match a device listed in * the devices subdirectory of the IOMMU group sysfs entry. The * group containing the device must already be added to this context. * Return: new file descriptor on success, -errno on failure. * Availability: When attached to container */ #define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6) /* --------------- IOCTLs for DEVICE file descriptors --------------- */ /** * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7, * struct vfio_device_info) * * Retrieve information about the device. Fills in provided * struct vfio_device_info. Caller sets argsz. * Return: 0 on success, -errno on failure. */ struct vfio_device_info { __u32 argsz; __u32 flags; #define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */ #define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */ #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */ #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */ #define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */ #define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */ #define VFIO_DEVICE_FLAGS_CAPS (1 << 7) /* Info supports caps */ __u32 num_regions; /* Max region index + 1 */ __u32 num_irqs; /* Max IRQ index + 1 */ __u32 cap_offset; /* Offset within info struct of first cap */ }; #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) /* * Vendor driver using Mediated device framework should provide device_api * attribute in supported type attribute groups. Device API string should be one * of the following corresponding to device flags in vfio_device_info structure. */ #define VFIO_DEVICE_API_PCI_STRING "vfio-pci" #define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform" #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba" #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw" #define VFIO_DEVICE_API_AP_STRING "vfio-ap" /* * The following capabilities are unique to s390 zPCI devices. Their contents * are further-defined in vfio_zdev.h */ #define VFIO_DEVICE_INFO_CAP_ZPCI_BASE 1 #define VFIO_DEVICE_INFO_CAP_ZPCI_GROUP 2 #define VFIO_DEVICE_INFO_CAP_ZPCI_UTIL 3 #define VFIO_DEVICE_INFO_CAP_ZPCI_PFIP 4 /** * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8, * struct vfio_region_info) * * Retrieve information about a device region. Caller provides * struct vfio_region_info with index value set. Caller sets argsz. * Implementation of region mapping is bus driver specific. This is * intended to describe MMIO, I/O port, as well as bus specific * regions (ex. PCI config space). Zero sized regions may be used * to describe unimplemented regions (ex. unimplemented PCI BARs). * Return: 0 on success, -errno on failure. */ struct vfio_region_info { __u32 argsz; __u32 flags; #define VFIO_REGION_INFO_FLAG_READ (1 << 0) /* Region supports read */ #define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) /* Region supports write */ #define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) /* Region supports mmap */ #define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) /* Info supports caps */ __u32 index; /* Region index */ __u32 cap_offset; /* Offset within info struct of first cap */ __u64 size; /* Region size (bytes) */ __u64 offset; /* Region offset from start of device fd */ }; #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) /* * The sparse mmap capability allows finer granularity of specifying areas * within a region with mmap support. When specified, the user should only * mmap the offset ranges specified by the areas array. mmaps outside of the * areas specified may fail (such as the range covering a PCI MSI-X table) or * may result in improper device behavior. * * The structures below define version 1 of this capability. */ #define VFIO_REGION_INFO_CAP_SPARSE_MMAP 1 struct vfio_region_sparse_mmap_area { __u64 offset; /* Offset of mmap'able area within region */ __u64 size; /* Size of mmap'able area */ }; struct vfio_region_info_cap_sparse_mmap { struct vfio_info_cap_header header; __u32 nr_areas; __u32 reserved; struct vfio_region_sparse_mmap_area areas[]; }; /* * The device specific type capability allows regions unique to a specific * device or class of devices to be exposed. This helps solve the problem for * vfio bus drivers of defining which region indexes correspond to which region * on the device, without needing to resort to static indexes, as done by * vfio-pci. For instance, if we were to go back in time, we might remove * VFIO_PCI_VGA_REGION_INDEX and let vfio-pci simply define that all indexes * greater than or equal to VFIO_PCI_NUM_REGIONS are device specific and we'd * make a "VGA" device specific type to describe the VGA access space. This * means that non-VGA devices wouldn't need to waste this index, and thus the * address space associated with it due to implementation of device file * descriptor offsets in vfio-pci. * * The current implementation is now part of the user ABI, so we can't use this * for VGA, but there are other upcoming use cases, such as opregions for Intel * IGD devices and framebuffers for vGPU devices. We missed VGA, but we'll * use this for future additions. * * The structure below defines version 1 of this capability. */ #define VFIO_REGION_INFO_CAP_TYPE 2 struct vfio_region_info_cap_type { struct vfio_info_cap_header header; __u32 type; /* global per bus driver */ __u32 subtype; /* type specific */ }; /* * List of region types, global per bus driver. * If you introduce a new type, please add it here. */ /* PCI region type containing a PCI vendor part */ #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31) #define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) #define VFIO_REGION_TYPE_GFX (1) #define VFIO_REGION_TYPE_CCW (2) #define VFIO_REGION_TYPE_MIGRATION (3) /* sub-types for VFIO_REGION_TYPE_PCI_* */ /* 8086 vendor PCI sub-types */ #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1) #define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2) #define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) /* 10de vendor PCI sub-types */ /* * NVIDIA GPU NVlink2 RAM is coherent RAM mapped onto the host address space. */ #define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM (1) /* 1014 vendor PCI sub-types */ /* * IBM NPU NVlink2 ATSD (Address Translation Shootdown) register of NPU * to do TLB invalidation on a GPU. */ #define VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD (1) /* sub-types for VFIO_REGION_TYPE_GFX */ #define VFIO_REGION_SUBTYPE_GFX_EDID (1) /** * struct vfio_region_gfx_edid - EDID region layout. * * Set display link state and EDID blob. * * The EDID blob has monitor information such as brand, name, serial * number, physical size, supported video modes and more. * * This special region allows userspace (typically qemu) set a virtual * EDID for the virtual monitor, which allows a flexible display * configuration. * * For the edid blob spec look here: * https://en.wikipedia.org/wiki/Extended_Display_Identification_Data * * On linux systems you can find the EDID blob in sysfs: * /sys/class/drm/${card}/${connector}/edid * * You can use the edid-decode ulility (comes with xorg-x11-utils) to * decode the EDID blob. * * @edid_offset: location of the edid blob, relative to the * start of the region (readonly). * @edid_max_size: max size of the edid blob (readonly). * @edid_size: actual edid size (read/write). * @link_state: display link state (read/write). * VFIO_DEVICE_GFX_LINK_STATE_UP: Monitor is turned on. * VFIO_DEVICE_GFX_LINK_STATE_DOWN: Monitor is turned off. * @max_xres: max display width (0 == no limitation, readonly). * @max_yres: max display height (0 == no limitation, readonly). * * EDID update protocol: * (1) set link-state to down. * (2) update edid blob and size. * (3) set link-state to up. */ struct vfio_region_gfx_edid { __u32 edid_offset; __u32 edid_max_size; __u32 edid_size; __u32 max_xres; __u32 max_yres; __u32 link_state; #define VFIO_DEVICE_GFX_LINK_STATE_UP 1 #define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2 }; /* sub-types for VFIO_REGION_TYPE_CCW */ #define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1) #define VFIO_REGION_SUBTYPE_CCW_SCHIB (2) #define VFIO_REGION_SUBTYPE_CCW_CRW (3) /* sub-types for VFIO_REGION_TYPE_MIGRATION */ #define VFIO_REGION_SUBTYPE_MIGRATION (1) /* * The structure vfio_device_migration_info is placed at the 0th offset of * the VFIO_REGION_SUBTYPE_MIGRATION region to get and set VFIO device related * migration information. Field accesses from this structure are only supported * at their native width and alignment. Otherwise, the result is undefined and * vendor drivers should return an error. * * device_state: (read/write) * - The user application writes to this field to inform the vendor driver * about the device state to be transitioned to. * - The vendor driver should take the necessary actions to change the * device state. After successful transition to a given state, the * vendor driver should return success on write(device_state, state) * system call. If the device state transition fails, the vendor driver * should return an appropriate -errno for the fault condition. * - On the user application side, if the device state transition fails, * that is, if write(device_state, state) returns an error, read * device_state again to determine the current state of the device from * the vendor driver. * - The vendor driver should return previous state of the device unless * the vendor driver has encountered an internal error, in which case * the vendor driver may report the device_state VFIO_DEVICE_STATE_ERROR. * - The user application must use the device reset ioctl to recover the * device from VFIO_DEVICE_STATE_ERROR state. If the device is * indicated to be in a valid device state by reading device_state, the * user application may attempt to transition the device to any valid * state reachable from the current state or terminate itself. * * device_state consists of 3 bits: * - If bit 0 is set, it indicates the _RUNNING state. If bit 0 is clear, * it indicates the _STOP state. When the device state is changed to * _STOP, driver should stop the device before write() returns. * - If bit 1 is set, it indicates the _SAVING state, which means that the * driver should start gathering device state information that will be * provided to the VFIO user application to save the device's state. * - If bit 2 is set, it indicates the _RESUMING state, which means that * the driver should prepare to resume the device. Data provided through * the migration region should be used to resume the device. * Bits 3 - 31 are reserved for future use. To preserve them, the user * application should perform a read-modify-write operation on this * field when modifying the specified bits. * * +------- _RESUMING * |+------ _SAVING * ||+----- _RUNNING * ||| * 000b => Device Stopped, not saving or resuming * 001b => Device running, which is the default state * 010b => Stop the device & save the device state, stop-and-copy state * 011b => Device running and save the device state, pre-copy state * 100b => Device stopped and the device state is resuming * 101b => Invalid state * 110b => Error state * 111b => Invalid state * * State transitions: * * _RESUMING _RUNNING Pre-copy Stop-and-copy _STOP * (100b) (001b) (011b) (010b) (000b) * 0. Running or default state * | * * 1. Normal Shutdown (optional) * |------------------------------------->| * * 2. Save the state or suspend * |------------------------->|---------->| * * 3. Save the state during live migration * |----------->|------------>|---------->| * * 4. Resuming * |<---------| * * 5. Resumed * |--------->| * * 0. Default state of VFIO device is _RUNNING when the user application starts. * 1. During normal shutdown of the user application, the user application may * optionally change the VFIO device state from _RUNNING to _STOP. This * transition is optional. The vendor driver must support this transition but * must not require it. * 2. When the user application saves state or suspends the application, the * device state transitions from _RUNNING to stop-and-copy and then to _STOP. * On state transition from _RUNNING to stop-and-copy, driver must stop the * device, save the device state and send it to the application through the * migration region. The sequence to be followed for such transition is given * below. * 3. In live migration of user application, the state transitions from _RUNNING * to pre-copy, to stop-and-copy, and to _STOP. * On state transition from _RUNNING to pre-copy, the driver should start * gathering the device state while the application is still running and send * the device state data to application through the migration region. * On state transition from pre-copy to stop-and-copy, the driver must stop * the device, save the device state and send it to the user application * through the migration region. * Vendor drivers must support the pre-copy state even for implementations * where no data is provided to the user before the stop-and-copy state. The * user must not be required to consume all migration data before the device * transitions to a new state, including the stop-and-copy state. * The sequence to be followed for above two transitions is given below. * 4. To start the resuming phase, the device state should be transitioned from * the _RUNNING to the _RESUMING state. * In the _RESUMING state, the driver should use the device state data * received through the migration region to resume the device. * 5. After providing saved device data to the driver, the application should * change the state from _RESUMING to _RUNNING. * * reserved: * Reads on this field return zero and writes are ignored. * * pending_bytes: (read only) * The number of pending bytes still to be migrated from the vendor driver. * * data_offset: (read only) * The user application should read data_offset field from the migration * region. The user application should read the device data from this * offset within the migration region during the _SAVING state or write * the device data during the _RESUMING state. See below for details of * sequence to be followed. * * data_size: (read/write) * The user application should read data_size to get the size in bytes of * the data copied in the migration region during the _SAVING state and * write the size in bytes of the data copied in the migration region * during the _RESUMING state. * * The format of the migration region is as follows: * ------------------------------------------------------------------ * |vfio_device_migration_info| data section | * | | /////////////////////////////// | * ------------------------------------------------------------------ * ^ ^ * offset 0-trapped part data_offset * * The structure vfio_device_migration_info is always followed by the data * section in the region, so data_offset will always be nonzero. The offset * from where the data is copied is decided by the kernel driver. The data * section can be trapped, mmapped, or partitioned, depending on how the kernel * driver defines the data section. The data section partition can be defined * as mapped by the sparse mmap capability. If mmapped, data_offset must be * page aligned, whereas initial section which contains the * vfio_device_migration_info structure, might not end at the offset, which is * page aligned. The user is not required to access through mmap regardless * of the capabilities of the region mmap. * The vendor driver should determine whether and how to partition the data * section. The vendor driver should return data_offset accordingly. * * The sequence to be followed while in pre-copy state and stop-and-copy state * is as follows: * a. Read pending_bytes, indicating the start of a new iteration to get device * data. Repeated read on pending_bytes at this stage should have no side * effects. * If pending_bytes == 0, the user application should not iterate to get data * for that device. * If pending_bytes > 0, perform the following steps. * b. Read data_offset, indicating that the vendor driver should make data * available through the data section. The vendor driver should return this * read operation only after data is available from (region + data_offset) * to (region + data_offset + data_size). * c. Read data_size, which is the amount of data in bytes available through * the migration region. * Read on data_offset and data_size should return the offset and size of * the current buffer if the user application reads data_offset and * data_size more than once here. * d. Read data_size bytes of data from (region + data_offset) from the * migration region. * e. Process the data. * f. Read pending_bytes, which indicates that the data from the previous * iteration has been read. If pending_bytes > 0, go to step b. * * The user application can transition from the _SAVING|_RUNNING * (pre-copy state) to the _SAVING (stop-and-copy) state regardless of the * number of pending bytes. The user application should iterate in _SAVING * (stop-and-copy) until pending_bytes is 0. * * The sequence to be followed while _RESUMING device state is as follows: * While data for this device is available, repeat the following steps: * a. Read data_offset from where the user application should write data. * b. Write migration data starting at the migration region + data_offset for * the length determined by data_size from the migration source. * c. Write data_size, which indicates to the vendor driver that data is * written in the migration region. Vendor driver must return this write * operations on consuming data. Vendor driver should apply the * user-provided migration region data to the device resume state. * * If an error occurs during the above sequences, the vendor driver can return * an error code for next read() or write() operation, which will terminate the * loop. The user application should then take the next necessary action, for * example, failing migration or terminating the user application. * * For the user application, data is opaque. The user application should write * data in the same order as the data is received and the data should be of * same transaction size at the source. */ struct vfio_device_migration_info { __u32 device_state; /* VFIO device state */ #define VFIO_DEVICE_STATE_STOP (0) #define VFIO_DEVICE_STATE_RUNNING (1 << 0) #define VFIO_DEVICE_STATE_SAVING (1 << 1) #define VFIO_DEVICE_STATE_RESUMING (1 << 2) #define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_RUNNING | \ VFIO_DEVICE_STATE_SAVING | \ VFIO_DEVICE_STATE_RESUMING) #define VFIO_DEVICE_STATE_VALID(state) \ (state & VFIO_DEVICE_STATE_RESUMING ? \ (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_RESUMING : 1) #define VFIO_DEVICE_STATE_IS_ERROR(state) \ ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_SAVING | \ VFIO_DEVICE_STATE_RESUMING)) #define VFIO_DEVICE_STATE_SET_ERROR(state) \ ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_SATE_SAVING | \ VFIO_DEVICE_STATE_RESUMING) __u32 reserved; __u64 pending_bytes; __u64 data_offset; __u64 data_size; }; /* * The MSIX mappable capability informs that MSIX data of a BAR can be mmapped * which allows direct access to non-MSIX registers which happened to be within * the same system page. * * Even though the userspace gets direct access to the MSIX data, the existing * VFIO_DEVICE_SET_IRQS interface must still be used for MSIX configuration. */ #define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE 3 /* * Capability with compressed real address (aka SSA - small system address) * where GPU RAM is mapped on a system bus. Used by a GPU for DMA routing * and by the userspace to associate a NVLink bridge with a GPU. */ #define VFIO_REGION_INFO_CAP_NVLINK2_SSATGT 4 struct vfio_region_info_cap_nvlink2_ssatgt { struct vfio_info_cap_header header; __u64 tgt; }; /* * Capability with an NVLink link speed. The value is read by * the NVlink2 bridge driver from the bridge's "ibm,nvlink-speed" * property in the device tree. The value is fixed in the hardware * and failing to provide the correct value results in the link * not working with no indication from the driver why. */ #define VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD 5 struct vfio_region_info_cap_nvlink2_lnkspd { struct vfio_info_cap_header header; __u32 link_speed; __u32 __pad; }; /** * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9, * struct vfio_irq_info) * * Retrieve information about a device IRQ. Caller provides * struct vfio_irq_info with index value set. Caller sets argsz. * Implementation of IRQ mapping is bus driver specific. Indexes * using multiple IRQs are primarily intended to support MSI-like * interrupt blocks. Zero count irq blocks may be used to describe * unimplemented interrupt types. * * The EVENTFD flag indicates the interrupt index supports eventfd based * signaling. * * The MASKABLE flags indicates the index supports MASK and UNMASK * actions described below. * * AUTOMASKED indicates that after signaling, the interrupt line is * automatically masked by VFIO and the user needs to unmask the line * to receive new interrupts. This is primarily intended to distinguish * level triggered interrupts. * * The NORESIZE flag indicates that the interrupt lines within the index * are setup as a set and new subindexes cannot be enabled without first * disabling the entire index. This is used for interrupts like PCI MSI * and MSI-X where the driver may only use a subset of the available * indexes, but VFIO needs to enable a specific number of vectors * upfront. In the case of MSI-X, where the user can enable MSI-X and * then add and unmask vectors, it's up to userspace to make the decision * whether to allocate the maximum supported number of vectors or tear * down setup and incrementally increase the vectors as each is enabled. */ struct vfio_irq_info { __u32 argsz; __u32 flags; #define VFIO_IRQ_INFO_EVENTFD (1 << 0) #define VFIO_IRQ_INFO_MASKABLE (1 << 1) #define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) #define VFIO_IRQ_INFO_NORESIZE (1 << 3) __u32 index; /* IRQ index */ __u32 count; /* Number of IRQs within this index */ }; #define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) /** * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set) * * Set signaling, masking, and unmasking of interrupts. Caller provides * struct vfio_irq_set with all fields set. 'start' and 'count' indicate * the range of subindexes being specified. * * The DATA flags specify the type of data provided. If DATA_NONE, the * operation performs the specified action immediately on the specified * interrupt(s). For example, to unmask AUTOMASKED interrupt [0,0]: * flags = (DATA_NONE|ACTION_UNMASK), index = 0, start = 0, count = 1. * * DATA_BOOL allows sparse support for the same on arrays of interrupts. * For example, to mask interrupts [0,1] and [0,3] (but not [0,2]): * flags = (DATA_BOOL|ACTION_MASK), index = 0, start = 1, count = 3, * data = {1,0,1} * * DATA_EVENTFD binds the specified ACTION to the provided __s32 eventfd. * A value of -1 can be used to either de-assign interrupts if already * assigned or skip un-assigned interrupts. For example, to set an eventfd * to be trigger for interrupts [0,0] and [0,2]: * flags = (DATA_EVENTFD|ACTION_TRIGGER), index = 0, start = 0, count = 3, * data = {fd1, -1, fd2} * If index [0,1] is previously set, two count = 1 ioctls calls would be * required to set [0,0] and [0,2] without changing [0,1]. * * Once a signaling mechanism is set, DATA_BOOL or DATA_NONE can be used * with ACTION_TRIGGER to perform kernel level interrupt loopback testing * from userspace (ie. simulate hardware triggering). * * Setting of an event triggering mechanism to userspace for ACTION_TRIGGER * enables the interrupt index for the device. Individual subindex interrupts * can be disabled using the -1 value for DATA_EVENTFD or the index can be * disabled as a whole with: flags = (DATA_NONE|ACTION_TRIGGER), count = 0. * * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while * ACTION_TRIGGER specifies kernel->user signaling. */ struct vfio_irq_set { __u32 argsz; __u32 flags; #define VFIO_IRQ_SET_DATA_NONE (1 << 0) /* Data not present */ #define VFIO_IRQ_SET_DATA_BOOL (1 << 1) /* Data is bool (u8) */ #define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) /* Data is eventfd (s32) */ #define VFIO_IRQ_SET_ACTION_MASK (1 << 3) /* Mask interrupt */ #define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) /* Unmask interrupt */ #define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) /* Trigger interrupt */ __u32 index; __u32 start; __u32 count; __u8 data[]; }; #define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10) #define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | \ VFIO_IRQ_SET_DATA_BOOL | \ VFIO_IRQ_SET_DATA_EVENTFD) #define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | \ VFIO_IRQ_SET_ACTION_UNMASK | \ VFIO_IRQ_SET_ACTION_TRIGGER) /** * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11) * * Reset a device. */ #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) /* * The VFIO-PCI bus driver makes use of the following fixed region and * IRQ index mapping. Unimplemented regions return a size of zero. * Unimplemented IRQ types return a count of zero. */ enum { VFIO_PCI_BAR0_REGION_INDEX, VFIO_PCI_BAR1_REGION_INDEX, VFIO_PCI_BAR2_REGION_INDEX, VFIO_PCI_BAR3_REGION_INDEX, VFIO_PCI_BAR4_REGION_INDEX, VFIO_PCI_BAR5_REGION_INDEX, VFIO_PCI_ROM_REGION_INDEX, VFIO_PCI_CONFIG_REGION_INDEX, /* * Expose VGA regions defined for PCI base class 03, subclass 00. * This includes I/O port ranges 0x3b0 to 0x3bb and 0x3c0 to 0x3df * as well as the MMIO range 0xa0000 to 0xbffff. Each implemented * range is found at it's identity mapped offset from the region * offset, for example 0x3b0 is region_info.offset + 0x3b0. Areas * between described ranges are unimplemented. */ VFIO_PCI_VGA_REGION_INDEX, VFIO_PCI_NUM_REGIONS = 9 /* Fixed user ABI, region indexes >=9 use */ /* device specific cap to define content. */ }; enum { VFIO_PCI_INTX_IRQ_INDEX, VFIO_PCI_MSI_IRQ_INDEX, VFIO_PCI_MSIX_IRQ_INDEX, VFIO_PCI_ERR_IRQ_INDEX, VFIO_PCI_REQ_IRQ_INDEX, VFIO_PCI_NUM_IRQS }; /* * The vfio-ccw bus driver makes use of the following fixed region and * IRQ index mapping. Unimplemented regions return a size of zero. * Unimplemented IRQ types return a count of zero. */ enum { VFIO_CCW_CONFIG_REGION_INDEX, VFIO_CCW_NUM_REGIONS }; enum { VFIO_CCW_IO_IRQ_INDEX, VFIO_CCW_CRW_IRQ_INDEX, VFIO_CCW_REQ_IRQ_INDEX, VFIO_CCW_NUM_IRQS }; /** * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IORW(VFIO_TYPE, VFIO_BASE + 12, * struct vfio_pci_hot_reset_info) * * Return: 0 on success, -errno on failure: * -enospc = insufficient buffer, -enodev = unsupported for device. */ struct vfio_pci_dependent_device { __u32 group_id; __u16 segment; __u8 bus; __u8 devfn; /* Use PCI_SLOT/PCI_FUNC */ }; struct vfio_pci_hot_reset_info { __u32 argsz; __u32 flags; __u32 count; struct vfio_pci_dependent_device devices[]; }; #define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) /** * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13, * struct vfio_pci_hot_reset) * * Return: 0 on success, -errno on failure. */ struct vfio_pci_hot_reset { __u32 argsz; __u32 flags; __u32 count; __s32 group_fds[]; }; #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) /** * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14, * struct vfio_device_query_gfx_plane) * * Set the drm_plane_type and flags, then retrieve the gfx plane info. * * flags supported: * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_DMABUF are set * to ask if the mdev supports dma-buf. 0 on support, -EINVAL on no * support for dma-buf. * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_REGION are set * to ask if the mdev supports region. 0 on support, -EINVAL on no * support for region. * - VFIO_GFX_PLANE_TYPE_DMABUF or VFIO_GFX_PLANE_TYPE_REGION is set * with each call to query the plane info. * - Others are invalid and return -EINVAL. * * Note: * 1. Plane could be disabled by guest. In that case, success will be * returned with zero-initialized drm_format, size, width and height * fields. * 2. x_hot/y_hot is set to 0xFFFFFFFF if no hotspot information available * * Return: 0 on success, -errno on other failure. */ struct vfio_device_gfx_plane_info { __u32 argsz; __u32 flags; #define VFIO_GFX_PLANE_TYPE_PROBE (1 << 0) #define VFIO_GFX_PLANE_TYPE_DMABUF (1 << 1) #define VFIO_GFX_PLANE_TYPE_REGION (1 << 2) /* in */ __u32 drm_plane_type; /* type of plane: DRM_PLANE_TYPE_* */ /* out */ __u32 drm_format; /* drm format of plane */ __u64 drm_format_mod; /* tiled mode */ __u32 width; /* width of plane */ __u32 height; /* height of plane */ __u32 stride; /* stride of plane */ __u32 size; /* size of plane in bytes, align on page*/ __u32 x_pos; /* horizontal position of cursor plane */ __u32 y_pos; /* vertical position of cursor plane*/ __u32 x_hot; /* horizontal position of cursor hotspot */ __u32 y_hot; /* vertical position of cursor hotspot */ union { __u32 region_index; /* region index */ __u32 dmabuf_id; /* dma-buf id */ }; }; #define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14) /** * VFIO_DEVICE_GET_GFX_DMABUF - _IOW(VFIO_TYPE, VFIO_BASE + 15, __u32) * * Return a new dma-buf file descriptor for an exposed guest framebuffer * described by the provided dmabuf_id. The dmabuf_id is returned from VFIO_ * DEVICE_QUERY_GFX_PLANE as a token of the exposed guest framebuffer. */ #define VFIO_DEVICE_GET_GFX_DMABUF _IO(VFIO_TYPE, VFIO_BASE + 15) /** * VFIO_DEVICE_IOEVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 16, * struct vfio_device_ioeventfd) * * Perform a write to the device at the specified device fd offset, with * the specified data and width when the provided eventfd is triggered. * vfio bus drivers may not support this for all regions, for all widths, * or at all. vfio-pci currently only enables support for BAR regions, * excluding the MSI-X vector table. * * Return: 0 on success, -errno on failure. */ struct vfio_device_ioeventfd { __u32 argsz; __u32 flags; #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) /* 1-byte write */ #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) /* 2-byte write */ #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) /* 4-byte write */ #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) /* 8-byte write */ #define VFIO_DEVICE_IOEVENTFD_SIZE_MASK (0xf) __u64 offset; /* device fd offset of write */ __u64 data; /* data to be written */ __s32 fd; /* -1 for de-assignment */ }; #define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 16) /** * VFIO_DEVICE_FEATURE - _IORW(VFIO_TYPE, VFIO_BASE + 17, * struct vfio_device_feature) * * Get, set, or probe feature data of the device. The feature is selected * using the FEATURE_MASK portion of the flags field. Support for a feature * can be probed by setting both the FEATURE_MASK and PROBE bits. A probe * may optionally include the GET and/or SET bits to determine read vs write * access of the feature respectively. Probing a feature will return success * if the feature is supported and all of the optionally indicated GET/SET * methods are supported. The format of the data portion of the structure is * specific to the given feature. The data portion is not required for * probing. GET and SET are mutually exclusive, except for use with PROBE. * * Return 0 on success, -errno on failure. */ struct vfio_device_feature { __u32 argsz; __u32 flags; #define VFIO_DEVICE_FEATURE_MASK (0xffff) /* 16-bit feature index */ #define VFIO_DEVICE_FEATURE_GET (1 << 16) /* Get feature into data[] */ #define VFIO_DEVICE_FEATURE_SET (1 << 17) /* Set feature from data[] */ #define VFIO_DEVICE_FEATURE_PROBE (1 << 18) /* Probe feature support */ __u8 data[]; }; #define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17) /* * Provide support for setting a PCI VF Token, which is used as a shared * secret between PF and VF drivers. This feature may only be set on a * PCI SR-IOV PF when SR-IOV is enabled on the PF and there are no existing * open VFs. Data provided when setting this feature is a 16-byte array * (__u8 b[16]), representing a UUID. */ #define VFIO_DEVICE_FEATURE_PCI_VF_TOKEN (0) /* -------- API for Type1 VFIO IOMMU -------- */ /** * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info) * * Retrieve information about the IOMMU object. Fills in provided * struct vfio_iommu_info. Caller sets argsz. * * XXX Should we do these by CHECK_EXTENSION too? */ struct vfio_iommu_type1_info { __u32 argsz; __u32 flags; #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */ #define VFIO_IOMMU_INFO_CAPS (1 << 1) /* Info supports caps */ __u64 iova_pgsizes; /* Bitmap of supported page sizes */ __u32 cap_offset; /* Offset within info struct of first cap */ }; /* * The IOVA capability allows to report the valid IOVA range(s) * excluding any non-relaxable reserved regions exposed by * devices attached to the container. Any DMA map attempt * outside the valid iova range will return error. * * The structures below define version 1 of this capability. */ #define VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE 1 struct vfio_iova_range { __u64 start; __u64 end; }; struct vfio_iommu_type1_info_cap_iova_range { struct vfio_info_cap_header header; __u32 nr_iovas; __u32 reserved; struct vfio_iova_range iova_ranges[]; }; /* * The migration capability allows to report supported features for migration. * * The structures below define version 1 of this capability. * * The existence of this capability indicates that IOMMU kernel driver supports * dirty page logging. * * pgsize_bitmap: Kernel driver returns bitmap of supported page sizes for dirty * page logging. * max_dirty_bitmap_size: Kernel driver returns maximum supported dirty bitmap * size in bytes that can be used by user applications when getting the dirty * bitmap. */ #define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 2 struct vfio_iommu_type1_info_cap_migration { struct vfio_info_cap_header header; __u32 flags; __u64 pgsize_bitmap; __u64 max_dirty_bitmap_size; /* in bytes */ }; /* * The DMA available capability allows to report the current number of * simultaneously outstanding DMA mappings that are allowed. * * The structure below defines version 1 of this capability. * * avail: specifies the current number of outstanding DMA mappings allowed. */ #define VFIO_IOMMU_TYPE1_INFO_DMA_AVAIL 3 struct vfio_iommu_type1_info_dma_avail { struct vfio_info_cap_header header; __u32 avail; }; #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) /** * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map) * * Map process virtual addresses to IO virtual addresses using the * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required. */ struct vfio_iommu_type1_dma_map { __u32 argsz; __u32 flags; #define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from device */ #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */ __u64 vaddr; /* Process virtual address */ __u64 iova; /* IO virtual address */ __u64 size; /* Size of mapping (bytes) */ }; #define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) struct vfio_bitmap { __u64 pgsize; /* page size for bitmap in bytes */ __u64 size; /* in bytes */ __u64 *data; /* one bit per page */ }; /** * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14, * struct vfio_dma_unmap) * * Unmap IO virtual addresses using the provided struct vfio_dma_unmap. * Caller sets argsz. The actual unmapped size is returned in the size * field. No guarantee is made to the user that arbitrary unmaps of iova * or size different from those used in the original mapping call will * succeed. * VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap * before unmapping IO virtual addresses. When this flag is set, the user must * provide a struct vfio_bitmap in data[]. User must provide zero-allocated * memory via vfio_bitmap.data and its size in the vfio_bitmap.size field. * A bit in the bitmap represents one page, of user provided page size in * vfio_bitmap.pgsize field, consecutively starting from iova offset. Bit set * indicates that the page at that offset from iova is dirty. A Bitmap of the * pages in the range of unmapped size is returned in the user-provided * vfio_bitmap.data. */ struct vfio_iommu_type1_dma_unmap { __u32 argsz; __u32 flags; #define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0) __u64 iova; /* IO virtual address */ __u64 size; /* Size of mapping (bytes) */ __u8 data[]; }; #define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) /* * IOCTLs to enable/disable IOMMU container usage. * No parameters are supported. */ #define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) #define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) /** * VFIO_IOMMU_DIRTY_PAGES - _IOWR(VFIO_TYPE, VFIO_BASE + 17, * struct vfio_iommu_type1_dirty_bitmap) * IOCTL is used for dirty pages logging. * Caller should set flag depending on which operation to perform, details as * below: * * Calling the IOCTL with VFIO_IOMMU_DIRTY_PAGES_FLAG_START flag set, instructs * the IOMMU driver to log pages that are dirtied or potentially dirtied by * the device; designed to be used when a migration is in progress. Dirty pages * are logged until logging is disabled by user application by calling the IOCTL * with VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP flag. * * Calling the IOCTL with VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP flag set, instructs * the IOMMU driver to stop logging dirtied pages. * * Calling the IOCTL with VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP flag set * returns the dirty pages bitmap for IOMMU container for a given IOVA range. * The user must specify the IOVA range and the pgsize through the structure * vfio_iommu_type1_dirty_bitmap_get in the data[] portion. This interface * supports getting a bitmap of the smallest supported pgsize only and can be * modified in future to get a bitmap of any specified supported pgsize. The * user must provide a zeroed memory area for the bitmap memory and specify its * size in bitmap.size. One bit is used to represent one page consecutively * starting from iova offset. The user should provide page size in bitmap.pgsize * field. A bit set in the bitmap indicates that the page at that offset from * iova is dirty. The caller must set argsz to a value including the size of * structure vfio_iommu_type1_dirty_bitmap_get, but excluding the size of the * actual bitmap. If dirty pages logging is not enabled, an error will be * returned. * * Only one of the flags _START, _STOP and _GET may be specified at a time. * */ struct vfio_iommu_type1_dirty_bitmap { __u32 argsz; __u32 flags; #define VFIO_IOMMU_DIRTY_PAGES_FLAG_START (1 << 0) #define VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP (1 << 1) #define VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP (1 << 2) __u8 data[]; }; struct vfio_iommu_type1_dirty_bitmap_get { __u64 iova; /* IO virtual address */ __u64 size; /* Size of iova range */ struct vfio_bitmap bitmap; }; #define VFIO_IOMMU_DIRTY_PAGES _IO(VFIO_TYPE, VFIO_BASE + 17) /* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */ /* * The SPAPR TCE DDW info struct provides the information about * the details of Dynamic DMA window capability. * * @pgsizes contains a page size bitmask, 4K/64K/16M are supported. * @max_dynamic_windows_supported tells the maximum number of windows * which the platform can create. * @levels tells the maximum number of levels in multi-level IOMMU tables; * this allows splitting a table into smaller chunks which reduces * the amount of physically contiguous memory required for the table. */ struct vfio_iommu_spapr_tce_ddw_info { __u64 pgsizes; /* Bitmap of supported page sizes */ __u32 max_dynamic_windows_supported; __u32 levels; }; /* * The SPAPR TCE info struct provides the information about the PCI bus * address ranges available for DMA, these values are programmed into * the hardware so the guest has to know that information. * * The DMA 32 bit window start is an absolute PCI bus address. * The IOVA address passed via map/unmap ioctls are absolute PCI bus * addresses too so the window works as a filter rather than an offset * for IOVA addresses. * * Flags supported: * - VFIO_IOMMU_SPAPR_INFO_DDW: informs the userspace that dynamic DMA windows * (DDW) support is present. @ddw is only supported when DDW is present. */ struct vfio_iommu_spapr_tce_info { __u32 argsz; __u32 flags; #define VFIO_IOMMU_SPAPR_INFO_DDW (1 << 0) /* DDW supported */ __u32 dma32_window_start; /* 32 bit window start (bytes) */ __u32 dma32_window_size; /* 32 bit window size (bytes) */ struct vfio_iommu_spapr_tce_ddw_info ddw; }; #define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) /* * EEH PE operation struct provides ways to: * - enable/disable EEH functionality; * - unfreeze IO/DMA for frozen PE; * - read PE state; * - reset PE; * - configure PE; * - inject EEH error. */ struct vfio_eeh_pe_err { __u32 type; __u32 func; __u64 addr; __u64 mask; }; struct vfio_eeh_pe_op { __u32 argsz; __u32 flags; __u32 op; union { struct vfio_eeh_pe_err err; }; }; #define VFIO_EEH_PE_DISABLE 0 /* Disable EEH functionality */ #define VFIO_EEH_PE_ENABLE 1 /* Enable EEH functionality */ #define VFIO_EEH_PE_UNFREEZE_IO 2 /* Enable IO for frozen PE */ #define VFIO_EEH_PE_UNFREEZE_DMA 3 /* Enable DMA for frozen PE */ #define VFIO_EEH_PE_GET_STATE 4 /* PE state retrieval */ #define VFIO_EEH_PE_STATE_NORMAL 0 /* PE in functional state */ #define VFIO_EEH_PE_STATE_RESET 1 /* PE reset in progress */ #define VFIO_EEH_PE_STATE_STOPPED 2 /* Stopped DMA and IO */ #define VFIO_EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA only */ #define VFIO_EEH_PE_STATE_UNAVAIL 5 /* State unavailable */ #define VFIO_EEH_PE_RESET_DEACTIVATE 5 /* Deassert PE reset */ #define VFIO_EEH_PE_RESET_HOT 6 /* Assert hot reset */ #define VFIO_EEH_PE_RESET_FUNDAMENTAL 7 /* Assert fundamental reset */ #define VFIO_EEH_PE_CONFIGURE 8 /* PE configuration */ #define VFIO_EEH_PE_INJECT_ERR 9 /* Inject EEH error */ #define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21) /** * VFIO_IOMMU_SPAPR_REGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 17, struct vfio_iommu_spapr_register_memory) * * Registers user space memory where DMA is allowed. It pins * user pages and does the locked memory accounting so * subsequent VFIO_IOMMU_MAP_DMA/VFIO_IOMMU_UNMAP_DMA calls * get faster. */ struct vfio_iommu_spapr_register_memory { __u32 argsz; __u32 flags; __u64 vaddr; /* Process virtual address */ __u64 size; /* Size of mapping (bytes) */ }; #define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17) /** * VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 18, struct vfio_iommu_spapr_register_memory) * * Unregisters user space memory registered with * VFIO_IOMMU_SPAPR_REGISTER_MEMORY. * Uses vfio_iommu_spapr_register_memory for parameters. */ #define VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 18) /** * VFIO_IOMMU_SPAPR_TCE_CREATE - _IOWR(VFIO_TYPE, VFIO_BASE + 19, struct vfio_iommu_spapr_tce_create) * * Creates an additional TCE table and programs it (sets a new DMA window) * to every IOMMU group in the container. It receives page shift, window * size and number of levels in the TCE table being created. * * It allocates and returns an offset on a PCI bus of the new DMA window. */ struct vfio_iommu_spapr_tce_create { __u32 argsz; __u32 flags; /* in */ __u32 page_shift; __u32 __resv1; __u64 window_size; __u32 levels; __u32 __resv2; /* out */ __u64 start_addr; }; #define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19) /** * VFIO_IOMMU_SPAPR_TCE_REMOVE - _IOW(VFIO_TYPE, VFIO_BASE + 20, struct vfio_iommu_spapr_tce_remove) * * Unprograms a TCE table from all groups in the container and destroys it. * It receives a PCI bus offset as a window id. */ struct vfio_iommu_spapr_tce_remove { __u32 argsz; __u32 flags; /* in */ __u64 start_addr; }; #define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) /* ***************************************************************** */ #endif /* VFIO_H */ linux/vfio_ccw.h 0000644 00000002445 15063602056 0007663 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Interfaces for vfio-ccw * * Copyright IBM Corp. 2017 * * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> */ #ifndef _VFIO_CCW_H_ #define _VFIO_CCW_H_ #include <linux/types.h> /* used for START SUBCHANNEL, always present */ struct ccw_io_region { #define ORB_AREA_SIZE 12 __u8 orb_area[ORB_AREA_SIZE]; #define SCSW_AREA_SIZE 12 __u8 scsw_area[SCSW_AREA_SIZE]; #define IRB_AREA_SIZE 96 __u8 irb_area[IRB_AREA_SIZE]; __u32 ret_code; } __attribute__((packed)); /* * used for processing commands that trigger asynchronous actions * Note: this is controlled by a capability */ #define VFIO_CCW_ASYNC_CMD_HSCH (1 << 0) #define VFIO_CCW_ASYNC_CMD_CSCH (1 << 1) struct ccw_cmd_region { __u32 command; __u32 ret_code; } __attribute__((packed)); /* * Used for processing commands that read the subchannel-information block * Reading this region triggers a stsch() to hardware * Note: this is controlled by a capability */ struct ccw_schib_region { #define SCHIB_AREA_SIZE 52 __u8 schib_area[SCHIB_AREA_SIZE]; } __attribute__((packed)); /* * Used for returning a Channel Report Word to userspace. * Note: this is controlled by a capability */ struct ccw_crw_region { __u32 crw; __u32 pad; } __attribute__((packed)); #endif linux/vfio_zdev.h 0000644 00000004756 15063602056 0010066 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * VFIO Region definitions for ZPCI devices * * Copyright IBM Corp. 2020 * * Author(s): Pierre Morel <pmorel@linux.ibm.com> * Matthew Rosato <mjrosato@linux.ibm.com> */ #ifndef _VFIO_ZDEV_H_ #define _VFIO_ZDEV_H_ #include <linux/types.h> #include <linux/vfio.h> /** * VFIO_DEVICE_INFO_CAP_ZPCI_BASE - Base PCI Function information * * This capability provides a set of descriptive information about the * associated PCI function. */ struct vfio_device_info_cap_zpci_base { struct vfio_info_cap_header header; __u64 start_dma; /* Start of available DMA addresses */ __u64 end_dma; /* End of available DMA addresses */ __u16 pchid; /* Physical Channel ID */ __u16 vfn; /* Virtual function number */ __u16 fmb_length; /* Measurement Block Length (in bytes) */ __u8 pft; /* PCI Function Type */ __u8 gid; /* PCI function group ID */ /* End of version 1 */ __u32 fh; /* PCI function handle */ /* End of version 2 */ }; /** * VFIO_DEVICE_INFO_CAP_ZPCI_GROUP - Base PCI Function Group information * * This capability provides a set of descriptive information about the group of * PCI functions that the associated device belongs to. */ struct vfio_device_info_cap_zpci_group { struct vfio_info_cap_header header; __u64 dasm; /* DMA Address space mask */ __u64 msi_addr; /* MSI address */ __u64 flags; #define VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH 1 /* Program-specified TLB refresh */ __u16 mui; /* Measurement Block Update Interval */ __u16 noi; /* Maximum number of MSIs */ __u16 maxstbl; /* Maximum Store Block Length */ __u8 version; /* Supported PCI Version */ /* End of version 1 */ __u8 reserved; __u16 imaxstbl; /* Maximum Interpreted Store Block Length */ /* End of version 2 */ }; /** * VFIO_DEVICE_INFO_CAP_ZPCI_UTIL - Utility String * * This capability provides the utility string for the associated device, which * is a device identifier string made up of EBCDID characters. 'size' specifies * the length of 'util_str'. */ struct vfio_device_info_cap_zpci_util { struct vfio_info_cap_header header; __u32 size; __u8 util_str[]; }; /** * VFIO_DEVICE_INFO_CAP_ZPCI_PFIP - PCI Function Path * * This capability provides the PCI function path string, which is an identifier * that describes the internal hardware path of the device. 'size' specifies * the length of 'pfip'. */ struct vfio_device_info_cap_zpci_pfip { struct vfio_info_cap_header header; __u32 size; __u8 pfip[]; }; #endif linux/vhost.h 0000644 00000014422 15063602056 0007225 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_VHOST_H #define _LINUX_VHOST_H /* Userspace interface for in-kernel virtio accelerators. */ /* vhost is used to reduce the number of system calls involved in virtio. * * Existing virtio net code is used in the guest without modification. * * This header includes interface used by userspace hypervisor for * device configuration. */ #include <linux/vhost_types.h> #include <linux/types.h> #include <linux/ioctl.h> #define VHOST_FILE_UNBIND -1 /* ioctls */ #define VHOST_VIRTIO 0xAF /* Features bitmask for forward compatibility. Transport bits are used for * vhost specific features. */ #define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64) #define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64) /* Set current process as the (exclusive) owner of this file descriptor. This * must be called before any other vhost command. Further calls to * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */ #define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01) /* Give up ownership, and reset the device to default values. * Allows subsequent call to VHOST_OWNER_SET to succeed. */ #define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02) /* Set up/modify memory layout */ #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory) /* Write logging setup. */ /* Memory writes can optionally be logged by setting bit at an offset * (calculated from the physical address) from specified log base. * The bit is set using an atomic 32 bit operation. */ /* Set base address for logging. */ #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64) /* Specify an eventfd file descriptor to signal on log write. */ #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int) /* Ring setup. */ /* Set number of descriptors in ring. This parameter can not * be modified while ring is running (bound to a device). */ #define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state) /* Set addresses for the ring. */ #define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr) /* Base value where queue looks for available descriptors */ #define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state) /* Get accessor: reads index, writes value in num */ #define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state) /* Set the vring byte order in num. Valid values are VHOST_VRING_LITTLE_ENDIAN * or VHOST_VRING_BIG_ENDIAN (other values return -EINVAL). * The byte order cannot be changed while the device is active: trying to do so * returns -EBUSY. * This is a legacy only API that is simply ignored when VIRTIO_F_VERSION_1 is * set. * Not all kernel configurations support this ioctl, but all configurations that * support SET also support GET. */ #define VHOST_VRING_LITTLE_ENDIAN 0 #define VHOST_VRING_BIG_ENDIAN 1 #define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state) #define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state) /* The following ioctls use eventfd file descriptors to signal and poll * for events. */ /* Set eventfd to poll for added buffers */ #define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file) /* Set eventfd to signal when buffers have beed used */ #define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file) /* Set eventfd to signal an error */ #define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file) /* Set busy loop timeout (in us) */ #define VHOST_SET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x23, \ struct vhost_vring_state) /* Get busy loop timeout (in us) */ #define VHOST_GET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x24, \ struct vhost_vring_state) /* Set or get vhost backend capability */ /* Use message type V2 */ #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1 /* IOTLB can accept batching hints */ #define VHOST_BACKEND_F_IOTLB_BATCH 0x2 #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64) #define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64) /* VHOST_NET specific defines */ /* Attach virtio net ring to a raw socket, or tap device. * The socket must be already bound to an ethernet device, this device will be * used for transmit. Pass fd -1 to unbind from the socket and the transmit * device. This can be used to stop the ring (e.g. for migration). */ #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file) /* VHOST_SCSI specific defines */ #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) /* Changing this breaks userspace. */ #define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int) /* Set and get the events missed flag */ #define VHOST_SCSI_SET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x43, __u32) #define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32) /* VHOST_VSOCK specific defines */ #define VHOST_VSOCK_SET_GUEST_CID _IOW(VHOST_VIRTIO, 0x60, __u64) #define VHOST_VSOCK_SET_RUNNING _IOW(VHOST_VIRTIO, 0x61, int) /* VHOST_VDPA specific defines */ /* Get the device id. The device ids follow the same definition of * the device id defined in virtio-spec. */ #define VHOST_VDPA_GET_DEVICE_ID _IOR(VHOST_VIRTIO, 0x70, __u32) /* Get and set the status. The status bits follow the same definition * of the device status defined in virtio-spec. */ #define VHOST_VDPA_GET_STATUS _IOR(VHOST_VIRTIO, 0x71, __u8) #define VHOST_VDPA_SET_STATUS _IOW(VHOST_VIRTIO, 0x72, __u8) /* Get and set the device config. The device config follows the same * definition of the device config defined in virtio-spec. */ #define VHOST_VDPA_GET_CONFIG _IOR(VHOST_VIRTIO, 0x73, \ struct vhost_vdpa_config) #define VHOST_VDPA_SET_CONFIG _IOW(VHOST_VIRTIO, 0x74, \ struct vhost_vdpa_config) /* Enable/disable the ring. */ #define VHOST_VDPA_SET_VRING_ENABLE _IOW(VHOST_VIRTIO, 0x75, \ struct vhost_vring_state) /* Get the max ring size. */ #define VHOST_VDPA_GET_VRING_NUM _IOR(VHOST_VIRTIO, 0x76, __u16) /* Set event fd for config interrupt*/ #define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int) /* Get the valid iova range */ #define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \ struct vhost_vdpa_iova_range) #endif linux/vhost_types.h 0000644 00000007635 15063602056 0010461 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_VHOST_TYPES_H #define _LINUX_VHOST_TYPES_H /* Userspace interface for in-kernel virtio accelerators. */ /* vhost is used to reduce the number of system calls involved in virtio. * * Existing virtio net code is used in the guest without modification. * * This header includes interface used by userspace hypervisor for * device configuration. */ #include <linux/types.h> #include <linux/virtio_config.h> #include <linux/virtio_ring.h> struct vhost_vring_state { unsigned int index; unsigned int num; }; struct vhost_vring_file { unsigned int index; int fd; /* Pass -1 to unbind from file. */ }; struct vhost_vring_addr { unsigned int index; /* Option flags. */ unsigned int flags; /* Flag values: */ /* Whether log address is valid. If set enables logging. */ #define VHOST_VRING_F_LOG 0 /* Start of array of descriptors (virtually contiguous) */ __u64 desc_user_addr; /* Used structure address. Must be 32 bit aligned */ __u64 used_user_addr; /* Available structure address. Must be 16 bit aligned */ __u64 avail_user_addr; /* Logging support. */ /* Log writes to used structure, at offset calculated from specified * address. Address must be 32 bit aligned. */ __u64 log_guest_addr; }; /* no alignment requirement */ struct vhost_iotlb_msg { __u64 iova; __u64 size; __u64 uaddr; #define VHOST_ACCESS_RO 0x1 #define VHOST_ACCESS_WO 0x2 #define VHOST_ACCESS_RW 0x3 __u8 perm; #define VHOST_IOTLB_MISS 1 #define VHOST_IOTLB_UPDATE 2 #define VHOST_IOTLB_INVALIDATE 3 #define VHOST_IOTLB_ACCESS_FAIL 4 /* * VHOST_IOTLB_BATCH_BEGIN and VHOST_IOTLB_BATCH_END allow modifying * multiple mappings in one go: beginning with * VHOST_IOTLB_BATCH_BEGIN, followed by any number of * VHOST_IOTLB_UPDATE messages, and ending with VHOST_IOTLB_BATCH_END. * When one of these two values is used as the message type, the rest * of the fields in the message are ignored. There's no guarantee that * these changes take place automatically in the device. */ #define VHOST_IOTLB_BATCH_BEGIN 5 #define VHOST_IOTLB_BATCH_END 6 __u8 type; }; #define VHOST_IOTLB_MSG 0x1 #define VHOST_IOTLB_MSG_V2 0x2 struct vhost_msg { int type; union { struct vhost_iotlb_msg iotlb; __u8 padding[64]; }; }; struct vhost_msg_v2 { __u32 type; __u32 reserved; union { struct vhost_iotlb_msg iotlb; __u8 padding[64]; }; }; struct vhost_memory_region { __u64 guest_phys_addr; __u64 memory_size; /* bytes */ __u64 userspace_addr; __u64 flags_padding; /* No flags are currently specified. */ }; /* All region addresses and sizes must be 4K aligned. */ #define VHOST_PAGE_SIZE 0x1000 struct vhost_memory { __u32 nregions; __u32 padding; struct vhost_memory_region regions[0]; }; /* VHOST_SCSI specific definitions */ /* * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. * * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate + * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage * ABI Rev 1: January 2013. Ignore vhost_tpgt field in struct vhost_scsi_target. * All the targets under vhost_wwpn can be seen and used by guset. */ #define VHOST_SCSI_ABI_VERSION 1 struct vhost_scsi_target { int abi_version; char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */ unsigned short vhost_tpgt; unsigned short reserved; }; /* VHOST_VDPA specific definitions */ struct vhost_vdpa_config { __u32 off; __u32 len; __u8 buf[0]; }; /* vhost vdpa IOVA range * @first: First address that can be mapped by vhost-vDPA * @last: Last address that can be mapped by vhost-vDPA */ struct vhost_vdpa_iova_range { __u64 first; __u64 last; }; /* Feature bits */ /* Log all write descriptors. Can be changed while device is active. */ #define VHOST_F_LOG_ALL 26 /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ #define VHOST_NET_F_VIRTIO_NET_HDR 27 #endif linux/videodev2.h 0000644 00000261165 15063602056 0007761 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * Video for Linux Two header file * * Copyright (C) 1999-2012 the contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Alternatively you can redistribute this file under the terms of the * BSD license as stated below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Header file for v4l or V4L2 drivers and applications * with public API. * All kernel-specific stuff were moved to media/v4l2-dev.h, so * no #if __KERNEL tests are allowed here * * See https://linuxtv.org for more info * * Author: Bill Dirks <bill@thedirks.org> * Justin Schoeman * Hans Verkuil <hverkuil@xs4all.nl> * et al. */ #ifndef __LINUX_VIDEODEV2_H #define __LINUX_VIDEODEV2_H #include <sys/time.h> #include <linux/ioctl.h> #include <linux/types.h> #include <linux/v4l2-common.h> #include <linux/v4l2-controls.h> /* * Common stuff for both V4L1 and V4L2 * Moved from videodev.h */ #define VIDEO_MAX_FRAME 32 #define VIDEO_MAX_PLANES 8 /* * M I S C E L L A N E O U S */ /* Four-character-code (FOURCC) */ #define v4l2_fourcc(a, b, c, d)\ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) #define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31)) /* * E N U M S */ enum v4l2_field { V4L2_FIELD_ANY = 0, /* driver can choose from none, top, bottom, interlaced depending on whatever it thinks is approximate ... */ V4L2_FIELD_NONE = 1, /* this device has no fields ... */ V4L2_FIELD_TOP = 2, /* top field only */ V4L2_FIELD_BOTTOM = 3, /* bottom field only */ V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one buffer, top-bottom order */ V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into separate buffers */ V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field first and the top field is transmitted first */ V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field first and the bottom field is transmitted first */ }; #define V4L2_FIELD_HAS_TOP(field) \ ((field) == V4L2_FIELD_TOP ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTTOM(field) \ ((field) == V4L2_FIELD_BOTTOM ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTH(field) \ ((field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_T_OR_B(field) \ ((field) == V4L2_FIELD_BOTTOM ||\ (field) == V4L2_FIELD_TOP ||\ (field) == V4L2_FIELD_ALTERNATE) #define V4L2_FIELD_IS_INTERLACED(field) \ ((field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT) #define V4L2_FIELD_IS_SEQUENTIAL(field) \ ((field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) enum v4l2_buf_type { V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, V4L2_BUF_TYPE_VBI_CAPTURE = 4, V4L2_BUF_TYPE_VBI_OUTPUT = 5, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, V4L2_BUF_TYPE_SDR_CAPTURE = 11, V4L2_BUF_TYPE_SDR_OUTPUT = 12, V4L2_BUF_TYPE_META_CAPTURE = 13, V4L2_BUF_TYPE_META_OUTPUT = 14, /* Deprecated, do not use */ V4L2_BUF_TYPE_PRIVATE = 0x80, }; #define V4L2_TYPE_IS_MULTIPLANAR(type) \ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) #define V4L2_TYPE_IS_OUTPUT(type) \ ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \ || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \ || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \ || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT \ || (type) == V4L2_BUF_TYPE_SDR_OUTPUT \ || (type) == V4L2_BUF_TYPE_META_OUTPUT) enum v4l2_tuner_type { V4L2_TUNER_RADIO = 1, V4L2_TUNER_ANALOG_TV = 2, V4L2_TUNER_DIGITAL_TV = 3, V4L2_TUNER_SDR = 4, V4L2_TUNER_RF = 5, }; /* Deprecated, do not use */ #define V4L2_TUNER_ADC V4L2_TUNER_SDR enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, V4L2_MEMORY_DMABUF = 4, }; /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ enum v4l2_colorspace { /* * Default colorspace, i.e. let the driver figure it out. * Can only be used with video capture. */ V4L2_COLORSPACE_DEFAULT = 0, /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */ V4L2_COLORSPACE_SMPTE170M = 1, /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */ V4L2_COLORSPACE_SMPTE240M = 2, /* Rec.709: used for HDTV */ V4L2_COLORSPACE_REC709 = 3, /* * Deprecated, do not use. No driver will ever return this. This was * based on a misunderstanding of the bt878 datasheet. */ V4L2_COLORSPACE_BT878 = 4, /* * NTSC 1953 colorspace. This only makes sense when dealing with * really, really old NTSC recordings. Superseded by SMPTE 170M. */ V4L2_COLORSPACE_470_SYSTEM_M = 5, /* * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when * dealing with really old PAL/SECAM recordings. Superseded by * SMPTE 170M. */ V4L2_COLORSPACE_470_SYSTEM_BG = 6, /* * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601 * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG. */ V4L2_COLORSPACE_JPEG = 7, /* For RGB colorspaces such as produces by most webcams. */ V4L2_COLORSPACE_SRGB = 8, /* opRGB colorspace */ V4L2_COLORSPACE_OPRGB = 9, /* BT.2020 colorspace, used for UHDTV. */ V4L2_COLORSPACE_BT2020 = 10, /* Raw colorspace: for RAW unprocessed images */ V4L2_COLORSPACE_RAW = 11, /* DCI-P3 colorspace, used by cinema projectors */ V4L2_COLORSPACE_DCI_P3 = 12, }; /* * Determine how COLORSPACE_DEFAULT should map to a proper colorspace. * This depends on whether this is a SDTV image (use SMPTE 170M), an * HDTV image (use Rec. 709), or something else (use sRGB). */ #define V4L2_MAP_COLORSPACE_DEFAULT(is_sdtv, is_hdtv) \ ((is_sdtv) ? V4L2_COLORSPACE_SMPTE170M : \ ((is_hdtv) ? V4L2_COLORSPACE_REC709 : V4L2_COLORSPACE_SRGB)) enum v4l2_xfer_func { /* * Mapping of V4L2_XFER_FUNC_DEFAULT to actual transfer functions * for the various colorspaces: * * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M, * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_REC709 and * V4L2_COLORSPACE_BT2020: V4L2_XFER_FUNC_709 * * V4L2_COLORSPACE_SRGB, V4L2_COLORSPACE_JPEG: V4L2_XFER_FUNC_SRGB * * V4L2_COLORSPACE_OPRGB: V4L2_XFER_FUNC_OPRGB * * V4L2_COLORSPACE_SMPTE240M: V4L2_XFER_FUNC_SMPTE240M * * V4L2_COLORSPACE_RAW: V4L2_XFER_FUNC_NONE * * V4L2_COLORSPACE_DCI_P3: V4L2_XFER_FUNC_DCI_P3 */ V4L2_XFER_FUNC_DEFAULT = 0, V4L2_XFER_FUNC_709 = 1, V4L2_XFER_FUNC_SRGB = 2, V4L2_XFER_FUNC_OPRGB = 3, V4L2_XFER_FUNC_SMPTE240M = 4, V4L2_XFER_FUNC_NONE = 5, V4L2_XFER_FUNC_DCI_P3 = 6, V4L2_XFER_FUNC_SMPTE2084 = 7, }; /* * Determine how XFER_FUNC_DEFAULT should map to a proper transfer function. * This depends on the colorspace. */ #define V4L2_MAP_XFER_FUNC_DEFAULT(colsp) \ ((colsp) == V4L2_COLORSPACE_OPRGB ? V4L2_XFER_FUNC_OPRGB : \ ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_XFER_FUNC_SMPTE240M : \ ((colsp) == V4L2_COLORSPACE_DCI_P3 ? V4L2_XFER_FUNC_DCI_P3 : \ ((colsp) == V4L2_COLORSPACE_RAW ? V4L2_XFER_FUNC_NONE : \ ((colsp) == V4L2_COLORSPACE_SRGB || (colsp) == V4L2_COLORSPACE_JPEG ? \ V4L2_XFER_FUNC_SRGB : V4L2_XFER_FUNC_709))))) enum v4l2_ycbcr_encoding { /* * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the * various colorspaces: * * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M, * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_SRGB, * V4L2_COLORSPACE_OPRGB and V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601 * * V4L2_COLORSPACE_REC709 and V4L2_COLORSPACE_DCI_P3: V4L2_YCBCR_ENC_709 * * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020 * * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M */ V4L2_YCBCR_ENC_DEFAULT = 0, /* ITU-R 601 -- SDTV */ V4L2_YCBCR_ENC_601 = 1, /* Rec. 709 -- HDTV */ V4L2_YCBCR_ENC_709 = 2, /* ITU-R 601/EN 61966-2-4 Extended Gamut -- SDTV */ V4L2_YCBCR_ENC_XV601 = 3, /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */ V4L2_YCBCR_ENC_XV709 = 4, /* * sYCC (Y'CbCr encoding of sRGB), identical to ENC_601. It was added * originally due to a misunderstanding of the sYCC standard. It should * not be used, instead use V4L2_YCBCR_ENC_601. */ V4L2_YCBCR_ENC_SYCC = 5, /* BT.2020 Non-constant Luminance Y'CbCr */ V4L2_YCBCR_ENC_BT2020 = 6, /* BT.2020 Constant Luminance Y'CbcCrc */ V4L2_YCBCR_ENC_BT2020_CONST_LUM = 7, /* SMPTE 240M -- Obsolete HDTV */ V4L2_YCBCR_ENC_SMPTE240M = 8, }; /* * enum v4l2_hsv_encoding values should not collide with the ones from * enum v4l2_ycbcr_encoding. */ enum v4l2_hsv_encoding { /* Hue mapped to 0 - 179 */ V4L2_HSV_ENC_180 = 128, /* Hue mapped to 0-255 */ V4L2_HSV_ENC_256 = 129, }; /* * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding. * This depends on the colorspace. */ #define V4L2_MAP_YCBCR_ENC_DEFAULT(colsp) \ (((colsp) == V4L2_COLORSPACE_REC709 || \ (colsp) == V4L2_COLORSPACE_DCI_P3) ? V4L2_YCBCR_ENC_709 : \ ((colsp) == V4L2_COLORSPACE_BT2020 ? V4L2_YCBCR_ENC_BT2020 : \ ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_YCBCR_ENC_SMPTE240M : \ V4L2_YCBCR_ENC_601))) enum v4l2_quantization { /* * The default for R'G'B' quantization is always full range, except * for the BT2020 colorspace. For Y'CbCr the quantization is always * limited range, except for COLORSPACE_JPEG: this is full range. */ V4L2_QUANTIZATION_DEFAULT = 0, V4L2_QUANTIZATION_FULL_RANGE = 1, V4L2_QUANTIZATION_LIM_RANGE = 2, }; /* * Determine how QUANTIZATION_DEFAULT should map to a proper quantization. * This depends on whether the image is RGB or not, the colorspace and the * Y'CbCr encoding. */ #define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_hsv, colsp, ycbcr_enc) \ (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \ V4L2_QUANTIZATION_LIM_RANGE : \ (((is_rgb_or_hsv) || (colsp) == V4L2_COLORSPACE_JPEG) ? \ V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) /* * Deprecated names for opRGB colorspace (IEC 61966-2-5) * * WARNING: Please don't use these deprecated defines in your code, as * there is a chance we have to remove them in the future. */ #define V4L2_COLORSPACE_ADOBERGB V4L2_COLORSPACE_OPRGB #define V4L2_XFER_FUNC_ADOBERGB V4L2_XFER_FUNC_OPRGB enum v4l2_priority { V4L2_PRIORITY_UNSET = 0, /* not initialized */ V4L2_PRIORITY_BACKGROUND = 1, V4L2_PRIORITY_INTERACTIVE = 2, V4L2_PRIORITY_RECORD = 3, V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, }; struct v4l2_rect { __s32 left; __s32 top; __u32 width; __u32 height; }; struct v4l2_fract { __u32 numerator; __u32 denominator; }; /** * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP * * @driver: name of the driver module (e.g. "bttv") * @card: name of the card (e.g. "Hauppauge WinTV") * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) ) * @version: KERNEL_VERSION * @capabilities: capabilities of the physical device as a whole * @device_caps: capabilities accessed via this particular device (node) * @reserved: reserved fields for future extensions */ struct v4l2_capability { __u8 driver[16]; __u8 card[32]; __u8 bus_info[32]; __u32 version; __u32 capabilities; __u32 device_caps; __u32 reserved[3]; }; /* Values for 'capabilities' field */ #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ #define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ #define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ /* Is a video capture device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 /* Is a video output device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 /* Is a video mem-to-mem device that supports multiplanar formats */ #define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000 /* Is a video mem-to-mem device */ #define V4L2_CAP_VIDEO_M2M 0x00008000 #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ #define V4L2_CAP_SDR_CAPTURE 0x00100000 /* Is a SDR capture device */ #define V4L2_CAP_EXT_PIX_FORMAT 0x00200000 /* Supports the extended pixel format */ #define V4L2_CAP_SDR_OUTPUT 0x00400000 /* Is a SDR output device */ #define V4L2_CAP_META_CAPTURE 0x00800000 /* Is a metadata capture device */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ #define V4L2_CAP_META_OUTPUT 0x08000000 /* Is a metadata output device */ #define V4L2_CAP_TOUCH 0x10000000 /* Is a touch device */ #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ /* * V I D E O I M A G E F O R M A T */ struct v4l2_pix_format { __u32 width; __u32 height; __u32 pixelformat; __u32 field; /* enum v4l2_field */ __u32 bytesperline; /* for padding, zero if unused */ __u32 sizeimage; __u32 colorspace; /* enum v4l2_colorspace */ __u32 priv; /* private data, depends on pixelformat */ __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */ union { /* enum v4l2_ycbcr_encoding */ __u32 ycbcr_enc; /* enum v4l2_hsv_encoding */ __u32 hsv_enc; }; __u32 quantization; /* enum v4l2_quantization */ __u32 xfer_func; /* enum v4l2_xfer_func */ }; /* Pixel format FOURCC depth Description */ /* RGB formats */ #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ #define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2') /* 16 aaaarrrr ggggbbbb */ #define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2') /* 16 xxxxrrrr ggggbbbb */ #define V4L2_PIX_FMT_RGBA444 v4l2_fourcc('R', 'A', '1', '2') /* 16 rrrrgggg bbbbaaaa */ #define V4L2_PIX_FMT_RGBX444 v4l2_fourcc('R', 'X', '1', '2') /* 16 rrrrgggg bbbbxxxx */ #define V4L2_PIX_FMT_ABGR444 v4l2_fourcc('A', 'B', '1', '2') /* 16 aaaabbbb ggggrrrr */ #define V4L2_PIX_FMT_XBGR444 v4l2_fourcc('X', 'B', '1', '2') /* 16 xxxxbbbb ggggrrrr */ /* * Originally this had 'BA12' as fourcc, but this clashed with the older * V4L2_PIX_FMT_SGRBG12 which inexplicably used that same fourcc. * So use 'GA12' instead for V4L2_PIX_FMT_BGRA444. */ #define V4L2_PIX_FMT_BGRA444 v4l2_fourcc('G', 'A', '1', '2') /* 16 bbbbgggg rrrraaaa */ #define V4L2_PIX_FMT_BGRX444 v4l2_fourcc('B', 'X', '1', '2') /* 16 bbbbgggg rrrrxxxx */ #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ #define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5') /* 16 ARGB-1-5-5-5 */ #define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5') /* 16 XRGB-1-5-5-5 */ #define V4L2_PIX_FMT_RGBA555 v4l2_fourcc('R', 'A', '1', '5') /* 16 RGBA-5-5-5-1 */ #define V4L2_PIX_FMT_RGBX555 v4l2_fourcc('R', 'X', '1', '5') /* 16 RGBX-5-5-5-1 */ #define V4L2_PIX_FMT_ABGR555 v4l2_fourcc('A', 'B', '1', '5') /* 16 ABGR-1-5-5-5 */ #define V4L2_PIX_FMT_XBGR555 v4l2_fourcc('X', 'B', '1', '5') /* 16 XBGR-1-5-5-5 */ #define V4L2_PIX_FMT_BGRA555 v4l2_fourcc('B', 'A', '1', '5') /* 16 BGRA-5-5-5-1 */ #define V4L2_PIX_FMT_BGRX555 v4l2_fourcc('B', 'X', '1', '5') /* 16 BGRX-5-5-5-1 */ #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ #define V4L2_PIX_FMT_ARGB555X v4l2_fourcc_be('A', 'R', '1', '5') /* 16 ARGB-5-5-5 BE */ #define V4L2_PIX_FMT_XRGB555X v4l2_fourcc_be('X', 'R', '1', '5') /* 16 XRGB-5-5-5 BE */ #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ #define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */ #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ #define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4') /* 32 BGRA-8-8-8-8 */ #define V4L2_PIX_FMT_XBGR32 v4l2_fourcc('X', 'R', '2', '4') /* 32 BGRX-8-8-8-8 */ #define V4L2_PIX_FMT_BGRA32 v4l2_fourcc('R', 'A', '2', '4') /* 32 ABGR-8-8-8-8 */ #define V4L2_PIX_FMT_BGRX32 v4l2_fourcc('R', 'X', '2', '4') /* 32 XBGR-8-8-8-8 */ #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ #define V4L2_PIX_FMT_RGBA32 v4l2_fourcc('A', 'B', '2', '4') /* 32 RGBA-8-8-8-8 */ #define V4L2_PIX_FMT_RGBX32 v4l2_fourcc('X', 'B', '2', '4') /* 32 RGBX-8-8-8-8 */ #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */ #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ /* Grey bit-packed formats */ #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ /* Chrominance formats */ #define V4L2_PIX_FMT_UV8 v4l2_fourcc('U', 'V', '8', ' ') /* 8 UV 4:4 */ /* Luminance+Chrominance formats */ #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ #define V4L2_PIX_FMT_AYUV32 v4l2_fourcc('A', 'Y', 'U', 'V') /* 32 AYUV-8-8-8-8 */ #define V4L2_PIX_FMT_XYUV32 v4l2_fourcc('X', 'Y', 'U', 'V') /* 32 XYUV-8-8-8-8 */ #define V4L2_PIX_FMT_VUYA32 v4l2_fourcc('V', 'U', 'Y', 'A') /* 32 VUYA-8-8-8-8 */ #define V4L2_PIX_FMT_VUYX32 v4l2_fourcc('V', 'U', 'Y', 'X') /* 32 VUYX-8-8-8-8 */ #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 12 YVU411 planar */ #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ /* three non contiguous planes - Y, Cb, Cr */ #define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */ #define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'M', '2', '1') /* 12 YVU420 planar */ #define V4L2_PIX_FMT_YUV422M v4l2_fourcc('Y', 'M', '1', '6') /* 16 YUV422 planar */ #define V4L2_PIX_FMT_YVU422M v4l2_fourcc('Y', 'M', '6', '1') /* 16 YVU422 planar */ #define V4L2_PIX_FMT_YUV444M v4l2_fourcc('Y', 'M', '2', '4') /* 24 YUV444 planar */ #define V4L2_PIX_FMT_YVU444M v4l2_fourcc('Y', 'M', '4', '2') /* 24 YVU444 planar */ /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ #define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ /* 10bit raw bayer packed, 5 bytes for every 4 pixels */ #define V4L2_PIX_FMT_SBGGR10P v4l2_fourcc('p', 'B', 'A', 'A') #define V4L2_PIX_FMT_SGBRG10P v4l2_fourcc('p', 'G', 'A', 'A') #define V4L2_PIX_FMT_SGRBG10P v4l2_fourcc('p', 'g', 'A', 'A') #define V4L2_PIX_FMT_SRGGB10P v4l2_fourcc('p', 'R', 'A', 'A') /* 10bit raw bayer a-law compressed to 8 bits */ #define V4L2_PIX_FMT_SBGGR10ALAW8 v4l2_fourcc('a', 'B', 'A', '8') #define V4L2_PIX_FMT_SGBRG10ALAW8 v4l2_fourcc('a', 'G', 'A', '8') #define V4L2_PIX_FMT_SGRBG10ALAW8 v4l2_fourcc('a', 'g', 'A', '8') #define V4L2_PIX_FMT_SRGGB10ALAW8 v4l2_fourcc('a', 'R', 'A', '8') /* 10bit raw bayer DPCM compressed to 8 bits */ #define V4L2_PIX_FMT_SBGGR10DPCM8 v4l2_fourcc('b', 'B', 'A', '8') #define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8') #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') #define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8') #define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */ /* 12bit raw bayer packed, 6 bytes for every 4 pixels */ #define V4L2_PIX_FMT_SBGGR12P v4l2_fourcc('p', 'B', 'C', 'C') #define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C') #define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C') #define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C') /* 14bit raw bayer packed, 7 bytes for every 4 pixels */ #define V4L2_PIX_FMT_SBGGR14P v4l2_fourcc('p', 'B', 'E', 'E') #define V4L2_PIX_FMT_SGBRG14P v4l2_fourcc('p', 'G', 'E', 'E') #define V4L2_PIX_FMT_SGRBG14P v4l2_fourcc('p', 'g', 'E', 'E') #define V4L2_PIX_FMT_SRGGB14P v4l2_fourcc('p', 'R', 'E', 'E') #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG16 v4l2_fourcc('G', 'B', '1', '6') /* 16 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB16 v4l2_fourcc('R', 'G', '1', '6') /* 16 RGRG.. GBGB.. */ /* HSV formats */ #define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3') #define V4L2_PIX_FMT_HSV32 v4l2_fourcc('H', 'S', 'V', '4') /* compressed formats */ #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */ #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */ #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */ #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */ #define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */ #define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */ #define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */ #define V4L2_PIX_FMT_MPEG2_SLICE v4l2_fourcc('M', 'G', '2', 'S') /* MPEG-2 parsed slice data */ #define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */ #define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */ #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ #define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */ #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ #define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka H.265 */ #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */ /* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ #define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ #define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ #define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ #define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */ #define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ #define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ #define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ #define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ #define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ #define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ #define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */ #define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */ #define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */ #define V4L2_PIX_FMT_Y8I v4l2_fourcc('Y', '8', 'I', ' ') /* Greyscale 8-bit L/R interleaved */ #define V4L2_PIX_FMT_Y12I v4l2_fourcc('Y', '1', '2', 'I') /* Greyscale 12-bit L/R interleaved */ #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */ #define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ #define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */ #define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */ #define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */ /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */ #define V4L2_PIX_FMT_IPU3_SGBRG10 v4l2_fourcc('i', 'p', '3', 'g') /* IPU3 packed 10-bit GBRG bayer */ #define V4L2_PIX_FMT_IPU3_SGRBG10 v4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */ #define V4L2_PIX_FMT_IPU3_SRGGB10 v4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */ /* SDR formats - used only for Software Defined Radio devices */ #define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */ #define V4L2_SDR_FMT_CU16LE v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */ #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ #define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ #define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ #define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16 v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ #define V4L2_TCH_FMT_DELTA_TD08 v4l2_fourcc('T', 'D', '0', '8') /* 8-bit signed deltas */ #define V4L2_TCH_FMT_TU16 v4l2_fourcc('T', 'U', '1', '6') /* 16-bit unsigned touch data */ #define V4L2_TCH_FMT_TU08 v4l2_fourcc('T', 'U', '0', '8') /* 8-bit unsigned touch data */ /* Meta-data formats */ #define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 1-D Histogram */ #define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */ #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */ #define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */ /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe /* Flags */ #define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001 /* * F O R M A T E N U M E R A T I O N */ struct v4l2_fmtdesc { __u32 index; /* Format number */ __u32 type; /* enum v4l2_buf_type */ __u32 flags; __u8 description[32]; /* Description string */ __u32 pixelformat; /* Format fourcc */ __u32 reserved[4]; }; #define V4L2_FMT_FLAG_COMPRESSED 0x0001 #define V4L2_FMT_FLAG_EMULATED 0x0002 /* Frame Size and frame rate enumeration */ /* * F R A M E S I Z E E N U M E R A T I O N */ enum v4l2_frmsizetypes { V4L2_FRMSIZE_TYPE_DISCRETE = 1, V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, V4L2_FRMSIZE_TYPE_STEPWISE = 3, }; struct v4l2_frmsize_discrete { __u32 width; /* Frame width [pixel] */ __u32 height; /* Frame height [pixel] */ }; struct v4l2_frmsize_stepwise { __u32 min_width; /* Minimum frame width [pixel] */ __u32 max_width; /* Maximum frame width [pixel] */ __u32 step_width; /* Frame width step size [pixel] */ __u32 min_height; /* Minimum frame height [pixel] */ __u32 max_height; /* Maximum frame height [pixel] */ __u32 step_height; /* Frame height step size [pixel] */ }; struct v4l2_frmsizeenum { __u32 index; /* Frame size number */ __u32 pixel_format; /* Pixel format */ __u32 type; /* Frame size type the device supports. */ union { /* Frame size */ struct v4l2_frmsize_discrete discrete; struct v4l2_frmsize_stepwise stepwise; }; __u32 reserved[2]; /* Reserved space for future use */ }; /* * F R A M E R A T E E N U M E R A T I O N */ enum v4l2_frmivaltypes { V4L2_FRMIVAL_TYPE_DISCRETE = 1, V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, V4L2_FRMIVAL_TYPE_STEPWISE = 3, }; struct v4l2_frmival_stepwise { struct v4l2_fract min; /* Minimum frame interval [s] */ struct v4l2_fract max; /* Maximum frame interval [s] */ struct v4l2_fract step; /* Frame interval step size [s] */ }; struct v4l2_frmivalenum { __u32 index; /* Frame format index */ __u32 pixel_format; /* Pixel format */ __u32 width; /* Frame width */ __u32 height; /* Frame height */ __u32 type; /* Frame interval type the device supports. */ union { /* Frame interval */ struct v4l2_fract discrete; struct v4l2_frmival_stepwise stepwise; }; __u32 reserved[2]; /* Reserved space for future use */ }; /* * T I M E C O D E */ struct v4l2_timecode { __u32 type; __u32 flags; __u8 frames; __u8 seconds; __u8 minutes; __u8 hours; __u8 userbits[4]; }; /* Type */ #define V4L2_TC_TYPE_24FPS 1 #define V4L2_TC_TYPE_25FPS 2 #define V4L2_TC_TYPE_30FPS 3 #define V4L2_TC_TYPE_50FPS 4 #define V4L2_TC_TYPE_60FPS 5 /* Flags */ #define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ #define V4L2_TC_FLAG_COLORFRAME 0x0002 #define V4L2_TC_USERBITS_field 0x000C #define V4L2_TC_USERBITS_USERDEFINED 0x0000 #define V4L2_TC_USERBITS_8BITCHARS 0x0008 /* The above is based on SMPTE timecodes */ struct v4l2_jpegcompression { int quality; int APPn; /* Number of APP segment to be written, * must be 0..15 */ int APP_len; /* Length of data in JPEG APPn segment */ char APP_data[60]; /* Data in the JPEG APPn segment. */ int COM_len; /* Length of data in JPEG COM segment */ char COM_data[60]; /* Data in JPEG COM segment */ __u32 jpeg_markers; /* Which markers should go into the JPEG * output. Unless you exactly know what * you do, leave them untouched. * Including less markers will make the * resulting code smaller, but there will * be fewer applications which can read it. * The presence of the APP and COM marker * is influenced by APP_len and COM_len * ONLY, not by this property! */ #define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ #define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will * always use APP0 */ }; /* * M E M O R Y - M A P P I N G B U F F E R S */ struct v4l2_requestbuffers { __u32 count; __u32 type; /* enum v4l2_buf_type */ __u32 memory; /* enum v4l2_memory */ __u32 capabilities; __u32 reserved[1]; }; /* capabilities for struct v4l2_requestbuffers and v4l2_create_buffers */ #define V4L2_BUF_CAP_SUPPORTS_MMAP (1 << 0) #define V4L2_BUF_CAP_SUPPORTS_USERPTR (1 << 1) #define V4L2_BUF_CAP_SUPPORTS_DMABUF (1 << 2) #define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3) /** * struct v4l2_plane - plane info for multi-planar buffers * @bytesused: number of bytes occupied by data in the plane (payload) * @length: size of this plane (NOT the payload) in bytes * @mem_offset: when memory in the associated struct v4l2_buffer is * V4L2_MEMORY_MMAP, equals the offset from the start of * the device memory for this plane (or is a "cookie" that * should be passed to mmap() called on the video node) * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer * pointing to this plane * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file * descriptor associated with this plane * @data_offset: offset in the plane to the start of data; usually 0, * unless there is a header in front of the data * * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer * with two planes can have one plane for Y, and another for interleaved CbCr * components. Each plane can reside in a separate memory buffer, or even in * a completely separate memory node (e.g. in embedded devices). */ struct v4l2_plane { __u32 bytesused; __u32 length; union { __u32 mem_offset; unsigned long userptr; __s32 fd; } m; __u32 data_offset; __u32 reserved[11]; }; /** * struct v4l2_buffer - video buffer info * @index: id number of the buffer * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for * multiplanar buffers); * @bytesused: number of bytes occupied by data in the buffer (payload); * unused (set to 0) for multiplanar buffers * @flags: buffer informational flags * @field: enum v4l2_field; field order of the image in the buffer * @timestamp: frame timestamp * @timecode: frame timecode * @sequence: sequence count of this frame * @memory: enum v4l2_memory; the method, in which the actual video data is * passed * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; * offset from the start of the device memory for this plane, * (or a "cookie" that should be passed to mmap() as offset) * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; * a userspace pointer pointing to this buffer * @fd: for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF; * a userspace file descriptor associated with this buffer * @planes: for multiplanar buffers; userspace pointer to the array of plane * info structs for this buffer * @length: size in bytes of the buffer (NOT its payload) for single-plane * buffers (when type != *_MPLANE); number of elements in the * planes array for multi-plane buffers * * Contains data exchanged by application and driver using one of the Streaming * I/O methods. */ struct v4l2_buffer { __u32 index; __u32 type; __u32 bytesused; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; /* memory location */ __u32 memory; union { __u32 offset; unsigned long userptr; struct v4l2_plane *planes; __s32 fd; } m; __u32 length; __u32 reserved2; __u32 reserved; }; /* Flags for 'flags' field */ /* Buffer is mapped (flag) */ #define V4L2_BUF_FLAG_MAPPED 0x00000001 /* Buffer is queued for processing */ #define V4L2_BUF_FLAG_QUEUED 0x00000002 /* Buffer is ready */ #define V4L2_BUF_FLAG_DONE 0x00000004 /* Image is a keyframe (I-frame) */ #define V4L2_BUF_FLAG_KEYFRAME 0x00000008 /* Image is a P-frame */ #define V4L2_BUF_FLAG_PFRAME 0x00000010 /* Image is a B-frame */ #define V4L2_BUF_FLAG_BFRAME 0x00000020 /* Buffer is ready, but the data contained within is corrupted. */ #define V4L2_BUF_FLAG_ERROR 0x00000040 /* timecode field is valid */ #define V4L2_BUF_FLAG_TIMECODE 0x00000100 /* Buffer is prepared for queuing */ #define V4L2_BUF_FLAG_PREPARED 0x00000400 /* Cache handling flags */ #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000 /* Timestamp type */ #define V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000 #define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000 #define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000 #define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 /* Timestamp sources. */ #define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 #define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000 #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 /* mem2mem encoder/decoder */ #define V4L2_BUF_FLAG_LAST 0x00100000 /** * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor * * @index: id number of the buffer * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for * multiplanar buffers); * @plane: index of the plane to be exported, 0 for single plane queues * @flags: flags for newly created file, currently only O_CLOEXEC is * supported, refer to manual of open syscall for more details * @fd: file descriptor associated with DMABUF (set by driver) * * Contains data used for exporting a video buffer as DMABUF file descriptor. * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF * (identical to the cookie used to mmap() the buffer to userspace). All * reserved fields must be set to zero. The field reserved0 is expected to * become a structure 'type' allowing an alternative layout of the structure * content. Therefore this field should not be used for any other extensions. */ struct v4l2_exportbuffer { __u32 type; /* enum v4l2_buf_type */ __u32 index; __u32 plane; __u32 flags; __s32 fd; __u32 reserved[11]; }; /* * O V E R L A Y P R E V I E W */ struct v4l2_framebuffer { __u32 capability; __u32 flags; /* FIXME: in theory we should pass something like PCI device + memory * region + offset instead of some physical address */ void *base; struct { __u32 width; __u32 height; __u32 pixelformat; __u32 field; /* enum v4l2_field */ __u32 bytesperline; /* for padding, zero if unused */ __u32 sizeimage; __u32 colorspace; /* enum v4l2_colorspace */ __u32 priv; /* reserved field, set to 0 */ } fmt; }; /* Flags for the 'capability' field. Read only */ #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 #define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 /* Flags for the 'flags' field. */ #define V4L2_FBUF_FLAG_PRIMARY 0x0001 #define V4L2_FBUF_FLAG_OVERLAY 0x0002 #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 #define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 struct v4l2_clip { struct v4l2_rect c; struct v4l2_clip *next; }; struct v4l2_window { struct v4l2_rect w; __u32 field; /* enum v4l2_field */ __u32 chromakey; struct v4l2_clip *clips; __u32 clipcount; void *bitmap; __u8 global_alpha; }; /* * C A P T U R E P A R A M E T E R S */ struct v4l2_captureparm { __u32 capability; /* Supported modes */ __u32 capturemode; /* Current mode */ struct v4l2_fract timeperframe; /* Time per frame in seconds */ __u32 extendedmode; /* Driver-specific extensions */ __u32 readbuffers; /* # of buffers for read */ __u32 reserved[4]; }; /* Flags for 'capability' and 'capturemode' fields */ #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ struct v4l2_outputparm { __u32 capability; /* Supported modes */ __u32 outputmode; /* Current mode */ struct v4l2_fract timeperframe; /* Time per frame in seconds */ __u32 extendedmode; /* Driver-specific extensions */ __u32 writebuffers; /* # of buffers for write */ __u32 reserved[4]; }; /* * I N P U T I M A G E C R O P P I N G */ struct v4l2_cropcap { __u32 type; /* enum v4l2_buf_type */ struct v4l2_rect bounds; struct v4l2_rect defrect; struct v4l2_fract pixelaspect; }; struct v4l2_crop { __u32 type; /* enum v4l2_buf_type */ struct v4l2_rect c; }; /** * struct v4l2_selection - selection info * @type: buffer type (do not use *_MPLANE types) * @target: Selection target, used to choose one of possible rectangles; * defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraints flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of selection window * @reserved: for future use, rounds structure size to 64 bytes, set to zero * * Hardware may use multiple helper windows to process a video stream. * The structure is used to exchange this selection areas between * an application and a driver. */ struct v4l2_selection { __u32 type; __u32 target; __u32 flags; struct v4l2_rect r; __u32 reserved[9]; }; /* * A N A L O G V I D E O S T A N D A R D */ typedef __u64 v4l2_std_id; /* one bit for each */ #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */ #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */ #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */ #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) #define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) /* ATSC/HDTV */ #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) /* FIXME: Although std_id is 64 bits, there is an issue on PPC32 architecture that makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding this value to 32 bits. As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), it should work fine. However, if needed to add more than two standards, v4l2-common.c should be fixed. */ /* * Some macros to merge video standards in order to make live easier for the * drivers and V4L2 applications */ /* * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is * Missing here. */ #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ V4L2_STD_NTSC_M_JP |\ V4L2_STD_NTSC_M_KR) /* Secam macros */ #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ V4L2_STD_SECAM_K |\ V4L2_STD_SECAM_K1) /* All Secam Standards */ #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ V4L2_STD_SECAM_G |\ V4L2_STD_SECAM_H |\ V4L2_STD_SECAM_DK |\ V4L2_STD_SECAM_L |\ V4L2_STD_SECAM_LC) /* PAL macros */ #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ V4L2_STD_PAL_B1 |\ V4L2_STD_PAL_G) #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ V4L2_STD_PAL_D1 |\ V4L2_STD_PAL_K) /* * "Common" PAL - This macro is there to be compatible with the old * V4L1 concept of "PAL": /BGDKHI. * Several PAL standards are missing here: /M, /N and /Nc */ #define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ V4L2_STD_PAL_DK |\ V4L2_STD_PAL_H |\ V4L2_STD_PAL_I) /* Chroma "agnostic" standards */ #define V4L2_STD_B (V4L2_STD_PAL_B |\ V4L2_STD_PAL_B1 |\ V4L2_STD_SECAM_B) #define V4L2_STD_G (V4L2_STD_PAL_G |\ V4L2_STD_SECAM_G) #define V4L2_STD_H (V4L2_STD_PAL_H |\ V4L2_STD_SECAM_H) #define V4L2_STD_L (V4L2_STD_SECAM_L |\ V4L2_STD_SECAM_LC) #define V4L2_STD_GH (V4L2_STD_G |\ V4L2_STD_H) #define V4L2_STD_DK (V4L2_STD_PAL_DK |\ V4L2_STD_SECAM_DK) #define V4L2_STD_BG (V4L2_STD_B |\ V4L2_STD_G) #define V4L2_STD_MN (V4L2_STD_PAL_M |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc |\ V4L2_STD_NTSC) /* Standards where MTS/BTSC stereo could be found */ #define V4L2_STD_MTS (V4L2_STD_NTSC_M |\ V4L2_STD_PAL_M |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc) /* Standards for Countries with 60Hz Line frequency */ #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ V4L2_STD_PAL_60 |\ V4L2_STD_NTSC |\ V4L2_STD_NTSC_443) /* Standards for Countries with 50Hz Line frequency */ #define V4L2_STD_625_50 (V4L2_STD_PAL |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc |\ V4L2_STD_SECAM) #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ V4L2_STD_ATSC_16_VSB) /* Macros with none and all analog standards */ #define V4L2_STD_UNKNOWN 0 #define V4L2_STD_ALL (V4L2_STD_525_60 |\ V4L2_STD_625_50) struct v4l2_standard { __u32 index; v4l2_std_id id; __u8 name[24]; struct v4l2_fract frameperiod; /* Frames, not fields */ __u32 framelines; __u32 reserved[4]; }; /* * D V B T T I M I N G S */ /** struct v4l2_bt_timings - BT.656/BT.1120 timing data * @width: total width of the active video in pixels * @height: total height of the active video in lines * @interlaced: Interlaced or progressive * @polarities: Positive or negative polarities * @pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000 * @hfrontporch:Horizontal front porch in pixels * @hsync: Horizontal Sync length in pixels * @hbackporch: Horizontal back porch in pixels * @vfrontporch:Vertical front porch in lines * @vsync: Vertical Sync length in lines * @vbackporch: Vertical back porch in lines * @il_vfrontporch:Vertical front porch for the even field * (aka field 2) of interlaced field formats * @il_vsync: Vertical Sync length for the even field * (aka field 2) of interlaced field formats * @il_vbackporch:Vertical back porch for the even field * (aka field 2) of interlaced field formats * @standards: Standards the timing belongs to * @flags: Flags * @picture_aspect: The picture aspect ratio (hor/vert). * @cea861_vic: VIC code as per the CEA-861 standard. * @hdmi_vic: VIC code as per the HDMI standard. * @reserved: Reserved fields, must be zeroed. * * A note regarding vertical interlaced timings: height refers to the total * height of the active video frame (= two fields). The blanking timings refer * to the blanking of each field. So the height of the total frame is * calculated as follows: * * tot_height = height + vfrontporch + vsync + vbackporch + * il_vfrontporch + il_vsync + il_vbackporch * * The active height of each field is height / 2. */ struct v4l2_bt_timings { __u32 width; __u32 height; __u32 interlaced; __u32 polarities; __u64 pixelclock; __u32 hfrontporch; __u32 hsync; __u32 hbackporch; __u32 vfrontporch; __u32 vsync; __u32 vbackporch; __u32 il_vfrontporch; __u32 il_vsync; __u32 il_vbackporch; __u32 standards; __u32 flags; struct v4l2_fract picture_aspect; __u8 cea861_vic; __u8 hdmi_vic; __u8 reserved[46]; } __attribute__ ((packed)); /* Interlaced or progressive format */ #define V4L2_DV_PROGRESSIVE 0 #define V4L2_DV_INTERLACED 1 /* Polarities. If bit is not set, it is assumed to be negative polarity */ #define V4L2_DV_VSYNC_POS_POL 0x00000001 #define V4L2_DV_HSYNC_POS_POL 0x00000002 /* Timings standards */ #define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */ #define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */ #define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */ #define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */ #define V4L2_DV_BT_STD_SDI (1 << 4) /* SDI Timings */ /* Flags */ /* * CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary * GTF' curve (GTF). In both cases the horizontal and/or vertical blanking * intervals are reduced, allowing a higher resolution over the same * bandwidth. This is a read-only flag. */ #define V4L2_DV_FL_REDUCED_BLANKING (1 << 0) /* * CEA-861 specific: set for CEA-861 formats with a framerate of a multiple * of six. These formats can be optionally played at 1 / 1.001 speed. * This is a read-only flag. */ #define V4L2_DV_FL_CAN_REDUCE_FPS (1 << 1) /* * CEA-861 specific: only valid for video transmitters, the flag is cleared * by receivers. * If the framerate of the format is a multiple of six, then the pixelclock * used to set up the transmitter is divided by 1.001 to make it compatible * with 60 Hz based standards such as NTSC and PAL-M that use a framerate of * 29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate * such frequencies, then the flag will also be cleared. */ #define V4L2_DV_FL_REDUCED_FPS (1 << 2) /* * Specific to interlaced formats: if set, then field 1 is really one half-line * longer and field 2 is really one half-line shorter, so each field has * exactly the same number of half-lines. Whether half-lines can be detected * or used depends on the hardware. */ #define V4L2_DV_FL_HALF_LINE (1 << 3) /* * If set, then this is a Consumer Electronics (CE) video format. Such formats * differ from other formats (commonly called IT formats) in that if RGB * encoding is used then by default the RGB values use limited range (i.e. * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861 * except for the 640x480 format are CE formats. */ #define V4L2_DV_FL_IS_CE_VIDEO (1 << 4) /* Some formats like SMPTE-125M have an interlaced signal with a odd * total height. For these formats, if this flag is set, the first * field has the extra line. If not, it is the second field. */ #define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE (1 << 5) /* * If set, then the picture_aspect field is valid. Otherwise assume that the * pixels are square, so the picture aspect ratio is the same as the width to * height ratio. */ #define V4L2_DV_FL_HAS_PICTURE_ASPECT (1 << 6) /* * If set, then the cea861_vic field is valid and contains the Video * Identification Code as per the CEA-861 standard. */ #define V4L2_DV_FL_HAS_CEA861_VIC (1 << 7) /* * If set, then the hdmi_vic field is valid and contains the Video * Identification Code as per the HDMI standard (HDMI Vendor Specific * InfoFrame). */ #define V4L2_DV_FL_HAS_HDMI_VIC (1 << 8) /* * CEA-861 specific: only valid for video receivers. * If set, then HW can detect the difference between regular FPS and * 1000/1001 FPS. Note: This flag is only valid for HDMI VIC codes with * the V4L2_DV_FL_CAN_REDUCE_FPS flag set. */ #define V4L2_DV_FL_CAN_DETECT_REDUCED_FPS (1 << 9) /* A few useful defines to calculate the total blanking and frame sizes */ #define V4L2_DV_BT_BLANKING_WIDTH(bt) \ ((bt)->hfrontporch + (bt)->hsync + (bt)->hbackporch) #define V4L2_DV_BT_FRAME_WIDTH(bt) \ ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt)) #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \ ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \ (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) #define V4L2_DV_BT_FRAME_HEIGHT(bt) \ ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt)) /** struct v4l2_dv_timings - DV timings * @type: the type of the timings * @bt: BT656/1120 timings */ struct v4l2_dv_timings { __u32 type; union { struct v4l2_bt_timings bt; __u32 reserved[32]; }; } __attribute__ ((packed)); /* Values for the type field */ #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ /** struct v4l2_enum_dv_timings - DV timings enumeration * @index: enumeration index * @pad: the pad number for which to enumerate timings (used with * v4l-subdev nodes only) * @reserved: must be zeroed * @timings: the timings for the given index */ struct v4l2_enum_dv_timings { __u32 index; __u32 pad; __u32 reserved[2]; struct v4l2_dv_timings timings; }; /** struct v4l2_bt_timings_cap - BT.656/BT.1120 timing capabilities * @min_width: width in pixels * @max_width: width in pixels * @min_height: height in lines * @max_height: height in lines * @min_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000 * @max_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000 * @standards: Supported standards * @capabilities: Supported capabilities * @reserved: Must be zeroed */ struct v4l2_bt_timings_cap { __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; __u64 min_pixelclock; __u64 max_pixelclock; __u32 standards; __u32 capabilities; __u32 reserved[16]; } __attribute__ ((packed)); /* Supports interlaced formats */ #define V4L2_DV_BT_CAP_INTERLACED (1 << 0) /* Supports progressive formats */ #define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1) /* Supports CVT/GTF reduced blanking */ #define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2) /* Supports custom formats */ #define V4L2_DV_BT_CAP_CUSTOM (1 << 3) /** struct v4l2_dv_timings_cap - DV timings capabilities * @type: the type of the timings (same as in struct v4l2_dv_timings) * @pad: the pad number for which to query capabilities (used with * v4l-subdev nodes only) * @bt: the BT656/1120 timings capabilities */ struct v4l2_dv_timings_cap { __u32 type; __u32 pad; __u32 reserved[2]; union { struct v4l2_bt_timings_cap bt; __u32 raw_data[32]; }; }; /* * V I D E O I N P U T S */ struct v4l2_input { __u32 index; /* Which input */ __u8 name[32]; /* Label */ __u32 type; /* Type of input */ __u32 audioset; /* Associated audios (bitfield) */ __u32 tuner; /* enum v4l2_tuner_type */ v4l2_std_id std; __u32 status; __u32 capabilities; __u32 reserved[3]; }; /* Values for the 'type' field */ #define V4L2_INPUT_TYPE_TUNER 1 #define V4L2_INPUT_TYPE_CAMERA 2 #define V4L2_INPUT_TYPE_TOUCH 3 /* field 'status' - general */ #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ #define V4L2_IN_ST_NO_SIGNAL 0x00000002 #define V4L2_IN_ST_NO_COLOR 0x00000004 /* field 'status' - sensor orientation */ /* If sensor is mounted upside down set both bits */ #define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ #define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ /* field 'status' - analog */ #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ #define V4L2_IN_ST_NO_V_LOCK 0x00000400 /* No vertical sync lock */ #define V4L2_IN_ST_NO_STD_LOCK 0x00000800 /* No standard format lock */ /* field 'status' - digital */ #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ #define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ #define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ /* field 'status' - VCR and set-top box */ #define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ /* capabilities flags */ #define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ #define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */ #define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ #define V4L2_IN_CAP_NATIVE_SIZE 0x00000008 /* Supports setting native size */ /* * V I D E O O U T P U T S */ struct v4l2_output { __u32 index; /* Which output */ __u8 name[32]; /* Label */ __u32 type; /* Type of output */ __u32 audioset; /* Associated audios (bitfield) */ __u32 modulator; /* Associated modulator */ v4l2_std_id std; __u32 capabilities; __u32 reserved[3]; }; /* Values for the 'type' field */ #define V4L2_OUTPUT_TYPE_MODULATOR 1 #define V4L2_OUTPUT_TYPE_ANALOG 2 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 /* capabilities flags */ #define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ #define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */ #define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ #define V4L2_OUT_CAP_NATIVE_SIZE 0x00000008 /* Supports setting native size */ /* * C O N T R O L S */ struct v4l2_control { __u32 id; __s32 value; }; struct v4l2_ext_control { __u32 id; __u32 size; __u32 reserved2[1]; union { __s32 value; __s64 value64; char *string; __u8 *p_u8; __u16 *p_u16; __u32 *p_u32; struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; struct v4l2_ctrl_mpeg2_quantization *p_mpeg2_quantization; void *ptr; }; } __attribute__ ((packed)); struct v4l2_ext_controls { union { __u32 ctrl_class; __u32 which; }; __u32 count; __u32 error_idx; __s32 request_fd; __u32 reserved[1]; struct v4l2_ext_control *controls; }; #define V4L2_CTRL_ID_MASK (0x0fffffff) #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_ID2WHICH(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) #define V4L2_CTRL_MAX_DIMS (4) #define V4L2_CTRL_WHICH_CUR_VAL 0 #define V4L2_CTRL_WHICH_DEF_VAL 0x0f000000 #define V4L2_CTRL_WHICH_REQUEST_VAL 0x0f010000 enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER = 1, V4L2_CTRL_TYPE_BOOLEAN = 2, V4L2_CTRL_TYPE_MENU = 3, V4L2_CTRL_TYPE_BUTTON = 4, V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, V4L2_CTRL_TYPE_BITMASK = 8, V4L2_CTRL_TYPE_INTEGER_MENU = 9, /* Compound types are >= 0x0100 */ V4L2_CTRL_COMPOUND_TYPES = 0x0100, V4L2_CTRL_TYPE_U8 = 0x0100, V4L2_CTRL_TYPE_U16 = 0x0101, V4L2_CTRL_TYPE_U32 = 0x0102, V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103, V4L2_CTRL_TYPE_MPEG2_QUANTIZATION = 0x0104, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ struct v4l2_queryctrl { __u32 id; __u32 type; /* enum v4l2_ctrl_type */ __u8 name[32]; /* Whatever */ __s32 minimum; /* Note signedness */ __s32 maximum; __s32 step; __s32 default_value; __u32 flags; __u32 reserved[2]; }; /* Used in the VIDIOC_QUERY_EXT_CTRL ioctl for querying extended controls */ struct v4l2_query_ext_ctrl { __u32 id; __u32 type; char name[32]; __s64 minimum; __s64 maximum; __u64 step; __s64 default_value; __u32 flags; __u32 elem_size; __u32 elems; __u32 nr_of_dims; __u32 dims[V4L2_CTRL_MAX_DIMS]; __u32 reserved[32]; }; /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ struct v4l2_querymenu { __u32 id; __u32 index; union { __u8 name[32]; /* Whatever */ __s64 value; }; __u32 reserved; } __attribute__ ((packed)); /* Control flags */ #define V4L2_CTRL_FLAG_DISABLED 0x0001 #define V4L2_CTRL_FLAG_GRABBED 0x0002 #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 #define V4L2_CTRL_FLAG_UPDATE 0x0008 #define V4L2_CTRL_FLAG_INACTIVE 0x0010 #define V4L2_CTRL_FLAG_SLIDER 0x0020 #define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 #define V4L2_CTRL_FLAG_VOLATILE 0x0080 #define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100 #define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200 #define V4L2_CTRL_FLAG_MODIFY_LAYOUT 0x0400 /* Query flags, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 #define V4L2_CTRL_FLAG_NEXT_COMPOUND 0x40000000 /* User-class control IDs defined by V4L2 */ #define V4L2_CID_MAX_CTRLS 1024 /* IDs reserved for driver specific controls */ #define V4L2_CID_PRIVATE_BASE 0x08000000 /* * T U N I N G */ struct v4l2_tuner { __u32 index; __u8 name[32]; __u32 type; /* enum v4l2_tuner_type */ __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 rxsubchans; __u32 audmode; __s32 signal; __s32 afc; __u32 reserved[4]; }; struct v4l2_modulator { __u32 index; __u8 name[32]; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 txsubchans; __u32 type; /* enum v4l2_tuner_type */ __u32 reserved[3]; }; /* Flags for the 'capability' field */ #define V4L2_TUNER_CAP_LOW 0x0001 #define V4L2_TUNER_CAP_NORM 0x0002 #define V4L2_TUNER_CAP_HWSEEK_BOUNDED 0x0004 #define V4L2_TUNER_CAP_HWSEEK_WRAP 0x0008 #define V4L2_TUNER_CAP_STEREO 0x0010 #define V4L2_TUNER_CAP_LANG2 0x0020 #define V4L2_TUNER_CAP_SAP 0x0020 #define V4L2_TUNER_CAP_LANG1 0x0040 #define V4L2_TUNER_CAP_RDS 0x0080 #define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100 #define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200 #define V4L2_TUNER_CAP_FREQ_BANDS 0x0400 #define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 #define V4L2_TUNER_CAP_1HZ 0x1000 /* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001 #define V4L2_TUNER_SUB_STEREO 0x0002 #define V4L2_TUNER_SUB_LANG2 0x0004 #define V4L2_TUNER_SUB_SAP 0x0004 #define V4L2_TUNER_SUB_LANG1 0x0008 #define V4L2_TUNER_SUB_RDS 0x0010 /* Values for the 'audmode' field */ #define V4L2_TUNER_MODE_MONO 0x0000 #define V4L2_TUNER_MODE_STEREO 0x0001 #define V4L2_TUNER_MODE_LANG2 0x0002 #define V4L2_TUNER_MODE_SAP 0x0002 #define V4L2_TUNER_MODE_LANG1 0x0003 #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 struct v4l2_frequency { __u32 tuner; __u32 type; /* enum v4l2_tuner_type */ __u32 frequency; __u32 reserved[8]; }; #define V4L2_BAND_MODULATION_VSB (1 << 1) #define V4L2_BAND_MODULATION_FM (1 << 2) #define V4L2_BAND_MODULATION_AM (1 << 3) struct v4l2_frequency_band { __u32 tuner; __u32 type; /* enum v4l2_tuner_type */ __u32 index; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 modulation; __u32 reserved[9]; }; struct v4l2_hw_freq_seek { __u32 tuner; __u32 type; /* enum v4l2_tuner_type */ __u32 seek_upward; __u32 wrap_around; __u32 spacing; __u32 rangelow; __u32 rangehigh; __u32 reserved[5]; }; /* * R D S */ struct v4l2_rds_data { __u8 lsb; __u8 msb; __u8 block; } __attribute__ ((packed)); #define V4L2_RDS_BLOCK_MSK 0x7 #define V4L2_RDS_BLOCK_A 0 #define V4L2_RDS_BLOCK_B 1 #define V4L2_RDS_BLOCK_C 2 #define V4L2_RDS_BLOCK_D 3 #define V4L2_RDS_BLOCK_C_ALT 4 #define V4L2_RDS_BLOCK_INVALID 7 #define V4L2_RDS_BLOCK_CORRECTED 0x40 #define V4L2_RDS_BLOCK_ERROR 0x80 /* * A U D I O */ struct v4l2_audio { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; /* Flags for the 'capability' field */ #define V4L2_AUDCAP_STEREO 0x00001 #define V4L2_AUDCAP_AVL 0x00002 /* Flags for the 'mode' field */ #define V4L2_AUDMODE_AVL 0x00001 struct v4l2_audioout { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; /* * M P E G S E R V I C E S */ #if 1 #define V4L2_ENC_IDX_FRAME_I (0) #define V4L2_ENC_IDX_FRAME_P (1) #define V4L2_ENC_IDX_FRAME_B (2) #define V4L2_ENC_IDX_FRAME_MASK (0xf) struct v4l2_enc_idx_entry { __u64 offset; __u64 pts; __u32 length; __u32 flags; __u32 reserved[2]; }; #define V4L2_ENC_IDX_ENTRIES (64) struct v4l2_enc_idx { __u32 entries; __u32 entries_cap; __u32 reserved[4]; struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; }; #define V4L2_ENC_CMD_START (0) #define V4L2_ENC_CMD_STOP (1) #define V4L2_ENC_CMD_PAUSE (2) #define V4L2_ENC_CMD_RESUME (3) /* Flags for V4L2_ENC_CMD_STOP */ #define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) struct v4l2_encoder_cmd { __u32 cmd; __u32 flags; union { struct { __u32 data[8]; } raw; }; }; /* Decoder commands */ #define V4L2_DEC_CMD_START (0) #define V4L2_DEC_CMD_STOP (1) #define V4L2_DEC_CMD_PAUSE (2) #define V4L2_DEC_CMD_RESUME (3) /* Flags for V4L2_DEC_CMD_START */ #define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0) /* Flags for V4L2_DEC_CMD_PAUSE */ #define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0) /* Flags for V4L2_DEC_CMD_STOP */ #define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0) #define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1) /* Play format requirements (returned by the driver): */ /* The decoder has no special format requirements */ #define V4L2_DEC_START_FMT_NONE (0) /* The decoder requires full GOPs */ #define V4L2_DEC_START_FMT_GOP (1) /* The structure must be zeroed before use by the application This ensures it can be extended safely in the future. */ struct v4l2_decoder_cmd { __u32 cmd; __u32 flags; union { struct { __u64 pts; } stop; struct { /* 0 or 1000 specifies normal speed, 1 specifies forward single stepping, -1 specifies backward single stepping, >1: playback at speed/1000 of the normal speed, <-1: reverse playback at (-speed/1000) of the normal speed. */ __s32 speed; __u32 format; } start; struct { __u32 data[16]; } raw; }; }; #endif /* * D A T A S E R V I C E S ( V B I ) * * Data services API by Michael Schimek */ /* Raw VBI */ struct v4l2_vbi_format { __u32 sampling_rate; /* in 1 Hz */ __u32 offset; __u32 samples_per_line; __u32 sample_format; /* V4L2_PIX_FMT_* */ __s32 start[2]; __u32 count[2]; __u32 flags; /* V4L2_VBI_* */ __u32 reserved[2]; /* must be zero */ }; /* VBI flags */ #define V4L2_VBI_UNSYNC (1 << 0) #define V4L2_VBI_INTERLACED (1 << 1) /* ITU-R start lines for each field */ #define V4L2_VBI_ITU_525_F1_START (1) #define V4L2_VBI_ITU_525_F2_START (264) #define V4L2_VBI_ITU_625_F1_START (1) #define V4L2_VBI_ITU_625_F2_START (314) /* Sliced VBI * * This implements is a proposal V4L2 API to allow SLICED VBI * required for some hardware encoders. It should change without * notice in the definitive implementation. */ struct v4l2_sliced_vbi_format { __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field (equals frame lines 313-336 for 625 line video standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; __u32 io_size; __u32 reserved[2]; /* must be zero */ }; /* Teletext World System Teletext (WST), defined on ITU-R BT.653-2 */ #define V4L2_SLICED_TELETEXT_B (0x0001) /* Video Program System, defined on ETS 300 231*/ #define V4L2_SLICED_VPS (0x0400) /* Closed Caption, defined on EIA-608 */ #define V4L2_SLICED_CAPTION_525 (0x1000) /* Wide Screen System, defined on ITU-R BT1119.1 */ #define V4L2_SLICED_WSS_625 (0x4000) #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) struct v4l2_sliced_vbi_cap { __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field (equals frame lines 313-336 for 625 line video standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; __u32 type; /* enum v4l2_buf_type */ __u32 reserved[3]; /* must be 0 */ }; struct v4l2_sliced_vbi_data { __u32 id; __u32 field; /* 0: first field, 1: second field */ __u32 line; /* 1-23 */ __u32 reserved; /* must be 0 */ __u8 data[48]; }; /* * Sliced VBI data inserted into MPEG Streams */ /* * V4L2_MPEG_STREAM_VBI_FMT_IVTV: * * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI * data * * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header * definitions are not included here. See the MPEG-2 specifications for details * on these headers. */ /* Line type IDs */ #define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1) #define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4) #define V4L2_MPEG_VBI_IVTV_WSS_625 (5) #define V4L2_MPEG_VBI_IVTV_VPS (7) struct v4l2_mpeg_vbi_itv0_line { __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */ __u8 data[42]; /* Sliced VBI data for the line */ } __attribute__ ((packed)); struct v4l2_mpeg_vbi_itv0 { __le32 linemask[2]; /* Bitmasks of VBI service lines present */ struct v4l2_mpeg_vbi_itv0_line line[35]; } __attribute__ ((packed)); struct v4l2_mpeg_vbi_ITV0 { struct v4l2_mpeg_vbi_itv0_line line[36]; } __attribute__ ((packed)); #define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0" #define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0" struct v4l2_mpeg_vbi_fmt_ivtv { __u8 magic[4]; union { struct v4l2_mpeg_vbi_itv0 itv0; struct v4l2_mpeg_vbi_ITV0 ITV0; }; } __attribute__ ((packed)); /* * A G G R E G A T E S T R U C T U R E S */ /** * struct v4l2_plane_pix_format - additional, per-plane format definition * @sizeimage: maximum size in bytes required for data, for which * this plane will be used * @bytesperline: distance in bytes between the leftmost pixels in two * adjacent lines */ struct v4l2_plane_pix_format { __u32 sizeimage; __u32 bytesperline; __u16 reserved[6]; } __attribute__ ((packed)); /** * struct v4l2_pix_format_mplane - multiplanar format definition * @width: image width in pixels * @height: image height in pixels * @pixelformat: little endian four character code (fourcc) * @field: enum v4l2_field; field order (for interlaced video) * @colorspace: enum v4l2_colorspace; supplemental to pixelformat * @plane_fmt: per-plane information * @num_planes: number of planes for this format * @flags: format flags (V4L2_PIX_FMT_FLAG_*) * @ycbcr_enc: enum v4l2_ycbcr_encoding, Y'CbCr encoding * @quantization: enum v4l2_quantization, colorspace quantization * @xfer_func: enum v4l2_xfer_func, colorspace transfer function */ struct v4l2_pix_format_mplane { __u32 width; __u32 height; __u32 pixelformat; __u32 field; __u32 colorspace; struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; __u8 num_planes; __u8 flags; union { __u8 ycbcr_enc; __u8 hsv_enc; }; __u8 quantization; __u8 xfer_func; __u8 reserved[7]; } __attribute__ ((packed)); /** * struct v4l2_sdr_format - SDR format definition * @pixelformat: little endian four character code (fourcc) * @buffersize: maximum size in bytes required for data */ struct v4l2_sdr_format { __u32 pixelformat; __u32 buffersize; __u8 reserved[24]; } __attribute__ ((packed)); /** * struct v4l2_meta_format - metadata format definition * @dataformat: little endian four character code (fourcc) * @buffersize: maximum size in bytes required for data */ struct v4l2_meta_format { __u32 dataformat; __u32 buffersize; } __attribute__ ((packed)); /** * struct v4l2_format - stream data format * @type: enum v4l2_buf_type; type of the data stream * @pix: definition of an image format * @pix_mp: definition of a multiplanar image format * @win: definition of an overlaid image * @vbi: raw VBI capture or output parameters * @sliced: sliced VBI capture or output parameters * @raw_data: placeholder for future extensions and custom formats */ struct v4l2_format { __u32 type; union { struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ struct v4l2_sdr_format sdr; /* V4L2_BUF_TYPE_SDR_CAPTURE */ struct v4l2_meta_format meta; /* V4L2_BUF_TYPE_META_CAPTURE */ __u8 raw_data[200]; /* user-defined */ } fmt; }; /* Stream type-dependent parameters */ struct v4l2_streamparm { __u32 type; /* enum v4l2_buf_type */ union { struct v4l2_captureparm capture; struct v4l2_outputparm output; __u8 raw_data[200]; /* user-defined */ } parm; }; /* * E V E N T S */ #define V4L2_EVENT_ALL 0 #define V4L2_EVENT_VSYNC 1 #define V4L2_EVENT_EOS 2 #define V4L2_EVENT_CTRL 3 #define V4L2_EVENT_FRAME_SYNC 4 #define V4L2_EVENT_SOURCE_CHANGE 5 #define V4L2_EVENT_MOTION_DET 6 #define V4L2_EVENT_PRIVATE_START 0x08000000 /* Payload for V4L2_EVENT_VSYNC */ struct v4l2_event_vsync { /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */ __u8 field; } __attribute__ ((packed)); /* Payload for V4L2_EVENT_CTRL */ #define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) #define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) #define V4L2_EVENT_CTRL_CH_RANGE (1 << 2) struct v4l2_event_ctrl { __u32 changes; __u32 type; union { __s32 value; __s64 value64; }; __u32 flags; __s32 minimum; __s32 maximum; __s32 step; __s32 default_value; }; struct v4l2_event_frame_sync { __u32 frame_sequence; }; #define V4L2_EVENT_SRC_CH_RESOLUTION (1 << 0) struct v4l2_event_src_change { __u32 changes; }; #define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ (1 << 0) /** * struct v4l2_event_motion_det - motion detection event * @flags: if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the * frame_sequence field is valid. * @frame_sequence: the frame sequence number associated with this event. * @region_mask: which regions detected motion. */ struct v4l2_event_motion_det { __u32 flags; __u32 frame_sequence; __u32 region_mask; }; struct v4l2_event { __u32 type; union { struct v4l2_event_vsync vsync; struct v4l2_event_ctrl ctrl; struct v4l2_event_frame_sync frame_sync; struct v4l2_event_src_change src_change; struct v4l2_event_motion_det motion_det; __u8 data[64]; } u; __u32 pending; __u32 sequence; struct timespec timestamp; __u32 id; __u32 reserved[8]; }; #define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0) #define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1) struct v4l2_event_subscription { __u32 type; __u32 id; __u32 flags; __u32 reserved[5]; }; /* * A D V A N C E D D E B U G G I N G * * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! */ /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ #define V4L2_CHIP_MATCH_BRIDGE 0 /* Match against chip ID on the bridge (0 for the bridge) */ #define V4L2_CHIP_MATCH_SUBDEV 4 /* Match against subdev index */ /* The following four defines are no longer in use */ #define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE #define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ #define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ #define V4L2_CHIP_MATCH_AC97 3 /* Match against ancillary AC97 chip */ struct v4l2_dbg_match { __u32 type; /* Match type */ union { /* Match this chip, meaning determined by type */ __u32 addr; char name[32]; }; } __attribute__ ((packed)); struct v4l2_dbg_register { struct v4l2_dbg_match match; __u32 size; /* register size in bytes */ __u64 reg; __u64 val; } __attribute__ ((packed)); #define V4L2_CHIP_FL_READABLE (1 << 0) #define V4L2_CHIP_FL_WRITABLE (1 << 1) /* VIDIOC_DBG_G_CHIP_INFO */ struct v4l2_dbg_chip_info { struct v4l2_dbg_match match; char name[32]; __u32 flags; __u32 reserved[32]; } __attribute__ ((packed)); /** * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument * @index: on return, index of the first created buffer * @count: entry: number of requested buffers, * return: number of created buffers * @memory: enum v4l2_memory; buffer memory type * @format: frame format, for which buffers are requested * @capabilities: capabilities of this buffer type. * @reserved: future extensions */ struct v4l2_create_buffers { __u32 index; __u32 count; __u32 memory; struct v4l2_format format; __u32 capabilities; __u32 reserved[7]; }; /* * I O C T L C O D E S F O R V I D E O D E V I C E S * */ #define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) #define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) #define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) #define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) #define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) #define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) #define VIDIOC_OVERLAY _IOW('V', 14, int) #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) #define VIDIOC_EXPBUF _IOWR('V', 16, struct v4l2_exportbuffer) #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) #define VIDIOC_STREAMON _IOW('V', 18, int) #define VIDIOC_STREAMOFF _IOW('V', 19, int) #define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) #define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) #define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) #define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) #define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) #define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) #define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) #define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) #define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) #define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) #define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) #define VIDIOC_G_INPUT _IOR('V', 38, int) #define VIDIOC_S_INPUT _IOWR('V', 39, int) #define VIDIOC_G_EDID _IOWR('V', 40, struct v4l2_edid) #define VIDIOC_S_EDID _IOWR('V', 41, struct v4l2_edid) #define VIDIOC_G_OUTPUT _IOR('V', 46, int) #define VIDIOC_S_OUTPUT _IOWR('V', 47, int) #define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) #define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) #define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) #define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) #define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) #define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) #define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) #define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) #define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) #define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) #define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) #define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) #define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) #define VIDIOC_G_PRIORITY _IOR('V', 67, __u32) /* enum v4l2_priority */ #define VIDIOC_S_PRIORITY _IOW('V', 68, __u32) /* enum v4l2_priority */ #define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) #define VIDIOC_LOG_STATUS _IO('V', 70) #define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) #define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) #define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) #define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) #define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) #define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) #define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) /* * Experimental, meant for debugging, testing and internal use. * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. * You must be root to use these ioctls. Never use these in applications! */ #define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) #define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) #define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) #define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) #define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) #define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) #define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) #define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) #define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd) #define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd) #define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings) #define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings) #define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap) #define VIDIOC_ENUM_FREQ_BANDS _IOWR('V', 101, struct v4l2_frequency_band) /* * Experimental, meant for debugging, testing and internal use. * Never use this in applications! */ #define VIDIOC_DBG_G_CHIP_INFO _IOWR('V', 102, struct v4l2_dbg_chip_info) #define VIDIOC_QUERY_EXT_CTRL _IOWR('V', 103, struct v4l2_query_ext_ctrl) /* Reminder: when adding new ioctls please add support for them to drivers/media/v4l2-core/v4l2-compat-ioctl32.c as well! */ #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ #endif /* __LINUX_VIDEODEV2_H */ linux/virtio_9p.h 0000644 00000003771 15063602056 0010013 0 ustar 00 #ifndef _LINUX_VIRTIO_9P_H #define _LINUX_VIRTIO_9P_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> /* The feature bitmap for virtio 9P */ /* The mount point is specified in a config variable */ #define VIRTIO_9P_MOUNT_TAG 0 struct virtio_9p_config { /* length of the tag name */ __u16 tag_len; /* non-NULL terminated tag name */ __u8 tag[0]; } __attribute__((packed)); #endif /* _LINUX_VIRTIO_9P_H */ linux/virtio_balloon.h 0000644 00000012232 15063602056 0011101 0 ustar 00 #ifndef _LINUX_VIRTIO_BALLOON_H #define _LINUX_VIRTIO_BALLOON_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> /* The feature bitmap for virtio balloon */ #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ #define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory Stats virtqueue */ #define VIRTIO_BALLOON_F_DEFLATE_ON_OOM 2 /* Deflate balloon on OOM */ #define VIRTIO_BALLOON_F_FREE_PAGE_HINT 3 /* VQ to report free pages */ #define VIRTIO_BALLOON_F_PAGE_POISON 4 /* Guest is using page poisoning */ #define VIRTIO_BALLOON_F_REPORTING 5 /* Page reporting virtqueue */ /* Size of a PFN in the balloon interface. */ #define VIRTIO_BALLOON_PFN_SHIFT 12 #define VIRTIO_BALLOON_CMD_ID_STOP 0 #define VIRTIO_BALLOON_CMD_ID_DONE 1 struct virtio_balloon_config { /* Number of pages host wants Guest to give up. */ __u32 num_pages; /* Number of pages we've actually got in balloon. */ __u32 actual; /* * Free page hint command id, readonly by guest. * Was previously named free_page_report_cmd_id so we * need to carry that name for legacy support. */ union { __u32 free_page_hint_cmd_id; __u32 free_page_report_cmd_id; /* deprecated */ }; /* Stores PAGE_POISON if page poisoning is in use */ __u32 poison_val; }; #define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ #define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */ #define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */ #define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ #define VIRTIO_BALLOON_S_AVAIL 6 /* Available memory as in /proc */ #define VIRTIO_BALLOON_S_CACHES 7 /* Disk caches */ #define VIRTIO_BALLOON_S_HTLB_PGALLOC 8 /* Hugetlb page allocations */ #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */ #define VIRTIO_BALLOON_S_NR 10 #define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \ VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \ VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \ VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \ VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \ VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \ VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \ VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \ VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \ VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \ VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \ } #define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("") /* * Memory statistics structure. * Driver fills an array of these structures and passes to device. * * NOTE: fields are laid out in a way that would make compiler add padding * between and after fields, so we have to use compiler-specific attributes to * pack it, to disable this padding. This also often causes compiler to * generate suboptimal code. * * We maintain this statistics structure format for backwards compatibility, * but don't follow this example. * * If implementing a similar structure, do something like the below instead: * struct virtio_balloon_stat { * __virtio16 tag; * __u8 reserved[6]; * __virtio64 val; * }; * * In other words, add explicit reserved fields to align field and * structure boundaries at field size, avoiding compiler padding * without the packed attribute. */ struct virtio_balloon_stat { __virtio16 tag; __virtio64 val; } __attribute__((packed)); #endif /* _LINUX_VIRTIO_BALLOON_H */ linux/virtio_blk.h 0000644 00000015215 15063602056 0010227 0 ustar 00 #ifndef _LINUX_VIRTIO_BLK_H #define _LINUX_VIRTIO_BLK_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #include <linux/virtio_types.h> /* Feature bits */ #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */ #define VIRTIO_BLK_F_DISCARD 13 /* DISCARD is supported */ #define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */ /* Legacy feature bits */ #ifndef VIRTIO_BLK_NO_LEGACY #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ #define VIRTIO_BLK_F_FLUSH 9 /* Flush command supported */ #define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ /* Old (deprecated) name for VIRTIO_BLK_F_FLUSH. */ #define VIRTIO_BLK_F_WCE VIRTIO_BLK_F_FLUSH #endif /* !VIRTIO_BLK_NO_LEGACY */ #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ struct virtio_blk_config { /* The capacity (in 512-byte sectors). */ __u64 capacity; /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ __u32 size_max; /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ __u32 seg_max; /* geometry of the device (if VIRTIO_BLK_F_GEOMETRY) */ struct virtio_blk_geometry { __u16 cylinders; __u8 heads; __u8 sectors; } geometry; /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ __u32 blk_size; /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */ /* exponent for physical block per logical block. */ __u8 physical_block_exp; /* alignment offset in logical blocks. */ __u8 alignment_offset; /* minimum I/O size without performance penalty in logical blocks. */ __u16 min_io_size; /* optimal sustained I/O size in logical blocks. */ __u32 opt_io_size; /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ __u8 wce; __u8 unused; /* number of vqs, only available when VIRTIO_BLK_F_MQ is set */ __u16 num_queues; /* the next 3 entries are guarded by VIRTIO_BLK_F_DISCARD */ /* * The maximum discard sectors (in 512-byte sectors) for * one segment. */ __u32 max_discard_sectors; /* * The maximum number of discard segments in a * discard command. */ __u32 max_discard_seg; /* Discard commands must be aligned to this number of sectors. */ __u32 discard_sector_alignment; /* the next 3 entries are guarded by VIRTIO_BLK_F_WRITE_ZEROES */ /* * The maximum number of write zeroes sectors (in 512-byte sectors) in * one segment. */ __u32 max_write_zeroes_sectors; /* * The maximum number of segments in a write zeroes * command. */ __u32 max_write_zeroes_seg; /* * Set if a VIRTIO_BLK_T_WRITE_ZEROES request may result in the * deallocation of one or more of the sectors. */ __u8 write_zeroes_may_unmap; __u8 unused1[3]; } __attribute__((packed)); /* * Command types * * Usage is a bit tricky as some bits are used as flags and some are not. * * Rules: * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own * and may not be combined with any of the other flags. */ /* These two define direction. */ #define VIRTIO_BLK_T_IN 0 #define VIRTIO_BLK_T_OUT 1 #ifndef VIRTIO_BLK_NO_LEGACY /* This bit says it's a scsi command, not an actual read or write. */ #define VIRTIO_BLK_T_SCSI_CMD 2 #endif /* VIRTIO_BLK_NO_LEGACY */ /* Cache flush command */ #define VIRTIO_BLK_T_FLUSH 4 /* Get device ID command */ #define VIRTIO_BLK_T_GET_ID 8 /* Discard command */ #define VIRTIO_BLK_T_DISCARD 11 /* Write zeroes command */ #define VIRTIO_BLK_T_WRITE_ZEROES 13 #ifndef VIRTIO_BLK_NO_LEGACY /* Barrier before this op. */ #define VIRTIO_BLK_T_BARRIER 0x80000000 #endif /* !VIRTIO_BLK_NO_LEGACY */ /* * This comes first in the read scatter-gather list. * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, * this is the first element of the read scatter-gather list. */ struct virtio_blk_outhdr { /* VIRTIO_BLK_T* */ __virtio32 type; /* io priority. */ __virtio32 ioprio; /* Sector (ie. 512 byte offset) */ __virtio64 sector; }; /* Unmap this range (only valid for write zeroes command) */ #define VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP 0x00000001 /* Discard/write zeroes range for each request. */ struct virtio_blk_discard_write_zeroes { /* discard/write zeroes start sector */ __le64 sector; /* number of discard/write zeroes sectors */ __le32 num_sectors; /* flags for this range */ __le32 flags; }; #ifndef VIRTIO_BLK_NO_LEGACY struct virtio_scsi_inhdr { __virtio32 errors; __virtio32 data_len; __virtio32 sense_len; __virtio32 residual; }; #endif /* !VIRTIO_BLK_NO_LEGACY */ /* And this is the final byte of the write scatter-gather list. */ #define VIRTIO_BLK_S_OK 0 #define VIRTIO_BLK_S_IOERR 1 #define VIRTIO_BLK_S_UNSUPP 2 #endif /* _LINUX_VIRTIO_BLK_H */ linux/virtio_bt.h 0000644 00000001404 15063602056 0010057 0 ustar 00 /* SPDX-License-Identifier: BSD-3-Clause */ #ifndef _LINUX_VIRTIO_BT_H #define _LINUX_VIRTIO_BT_H #include <linux/virtio_types.h> /* Feature bits */ #define VIRTIO_BT_F_VND_HCI 0 /* Indicates vendor command support */ #define VIRTIO_BT_F_MSFT_EXT 1 /* Indicates MSFT vendor support */ #define VIRTIO_BT_F_AOSP_EXT 2 /* Indicates AOSP vendor support */ enum virtio_bt_config_type { VIRTIO_BT_CONFIG_TYPE_PRIMARY = 0, VIRTIO_BT_CONFIG_TYPE_AMP = 1, }; enum virtio_bt_config_vendor { VIRTIO_BT_CONFIG_VENDOR_NONE = 0, VIRTIO_BT_CONFIG_VENDOR_ZEPHYR = 1, VIRTIO_BT_CONFIG_VENDOR_INTEL = 2, VIRTIO_BT_CONFIG_VENDOR_REALTEK = 3, }; struct virtio_bt_config { __u8 type; __u16 vendor; __u16 msft_opcode; } __attribute__((packed)); #endif /* _LINUX_VIRTIO_BT_H */ linux/virtio_config.h 0000644 00000007645 15063602056 0010734 0 ustar 00 #ifndef _LINUX_VIRTIO_CONFIG_H #define _LINUX_VIRTIO_CONFIG_H /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so * anyone can use the definitions to implement compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* Virtio devices use a standardized configuration space to define their * features and pass configuration information, but each implementation can * store and access that space differently. */ #include <linux/types.h> /* Status byte for guest to report progress, and synchronize features. */ /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 /* We have found a driver for the device. */ #define VIRTIO_CONFIG_S_DRIVER 2 /* Driver has used its parts of the config, and is happy */ #define VIRTIO_CONFIG_S_DRIVER_OK 4 /* Driver has finished configuring features */ #define VIRTIO_CONFIG_S_FEATURES_OK 8 /* Device entered invalid state, driver must reset it */ #define VIRTIO_CONFIG_S_NEEDS_RESET 0x40 /* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80 /* * Virtio feature bits VIRTIO_TRANSPORT_F_START through * VIRTIO_TRANSPORT_F_END are reserved for the transport * being used (e.g. virtio_ring, virtio_pci etc.), the * rest are per-device feature bits. */ #define VIRTIO_TRANSPORT_F_START 28 #define VIRTIO_TRANSPORT_F_END 38 #ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've * suppressed them? */ #define VIRTIO_F_NOTIFY_ON_EMPTY 24 /* Can the device handle any descriptor layout? */ #define VIRTIO_F_ANY_LAYOUT 27 #endif /* VIRTIO_CONFIG_NO_LEGACY */ /* v1.0 compliant. */ #define VIRTIO_F_VERSION_1 32 /* * If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature. * If set - use platform DMA tools to access the memory. * * Note the reverse polarity (compared to most other features), * this is for compatibility with legacy systems. */ #define VIRTIO_F_ACCESS_PLATFORM 33 /* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace) */ #define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM /* This feature indicates support for the packed virtqueue layout. */ #define VIRTIO_F_RING_PACKED 34 /* * This feature indicates that memory accesses by the driver and the * device are ordered in a way described by the platform. */ #define VIRTIO_F_ORDER_PLATFORM 36 /* * Does the device support Single Root I/O Virtualization? */ #define VIRTIO_F_SR_IOV 37 #endif /* _LINUX_VIRTIO_CONFIG_H */ linux/virtio_console.h 0000644 00000006100 15063602056 0011112 0 ustar 00 /* * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so * anyone can use the definitions to implement compatible drivers/servers: * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright (C) Red Hat, Inc., 2009, 2010, 2011 * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011 */ #ifndef _LINUX_VIRTIO_CONSOLE_H #define _LINUX_VIRTIO_CONSOLE_H #include <linux/types.h> #include <linux/virtio_types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> /* Feature bits */ #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ #define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */ #define VIRTIO_CONSOLE_F_EMERG_WRITE 2 /* Does host support emergency write? */ #define VIRTIO_CONSOLE_BAD_ID (~(__u32)0) struct virtio_console_config { /* colums of the screens */ __u16 cols; /* rows of the screens */ __u16 rows; /* max. number of ports this device can hold */ __u32 max_nr_ports; /* emergency write register */ __u32 emerg_wr; } __attribute__((packed)); /* * A message that's passed between the Host and the Guest for a * particular port. */ struct virtio_console_control { __virtio32 id; /* Port number */ __virtio16 event; /* The kind of control event (see below) */ __virtio16 value; /* Extra information for the key */ }; /* Some events for control messages */ #define VIRTIO_CONSOLE_DEVICE_READY 0 #define VIRTIO_CONSOLE_PORT_ADD 1 #define VIRTIO_CONSOLE_PORT_REMOVE 2 #define VIRTIO_CONSOLE_PORT_READY 3 #define VIRTIO_CONSOLE_CONSOLE_PORT 4 #define VIRTIO_CONSOLE_RESIZE 5 #define VIRTIO_CONSOLE_PORT_OPEN 6 #define VIRTIO_CONSOLE_PORT_NAME 7 #endif /* _LINUX_VIRTIO_CONSOLE_H */ linux/virtio_crypto.h 0000644 00000033062 15063602056 0010777 0 ustar 00 #ifndef _VIRTIO_CRYPTO_H #define _VIRTIO_CRYPTO_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #define VIRTIO_CRYPTO_SERVICE_CIPHER 0 #define VIRTIO_CRYPTO_SERVICE_HASH 1 #define VIRTIO_CRYPTO_SERVICE_MAC 2 #define VIRTIO_CRYPTO_SERVICE_AEAD 3 #define VIRTIO_CRYPTO_OPCODE(service, op) (((service) << 8) | (op)) struct virtio_crypto_ctrl_header { #define VIRTIO_CRYPTO_CIPHER_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x02) #define VIRTIO_CRYPTO_CIPHER_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x03) #define VIRTIO_CRYPTO_HASH_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x02) #define VIRTIO_CRYPTO_HASH_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x03) #define VIRTIO_CRYPTO_MAC_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x02) #define VIRTIO_CRYPTO_MAC_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x03) #define VIRTIO_CRYPTO_AEAD_CREATE_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x02) #define VIRTIO_CRYPTO_AEAD_DESTROY_SESSION \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x03) __le32 opcode; __le32 algo; __le32 flag; /* data virtqueue id */ __le32 queue_id; }; struct virtio_crypto_cipher_session_para { #define VIRTIO_CRYPTO_NO_CIPHER 0 #define VIRTIO_CRYPTO_CIPHER_ARC4 1 #define VIRTIO_CRYPTO_CIPHER_AES_ECB 2 #define VIRTIO_CRYPTO_CIPHER_AES_CBC 3 #define VIRTIO_CRYPTO_CIPHER_AES_CTR 4 #define VIRTIO_CRYPTO_CIPHER_DES_ECB 5 #define VIRTIO_CRYPTO_CIPHER_DES_CBC 6 #define VIRTIO_CRYPTO_CIPHER_3DES_ECB 7 #define VIRTIO_CRYPTO_CIPHER_3DES_CBC 8 #define VIRTIO_CRYPTO_CIPHER_3DES_CTR 9 #define VIRTIO_CRYPTO_CIPHER_KASUMI_F8 10 #define VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2 11 #define VIRTIO_CRYPTO_CIPHER_AES_F8 12 #define VIRTIO_CRYPTO_CIPHER_AES_XTS 13 #define VIRTIO_CRYPTO_CIPHER_ZUC_EEA3 14 __le32 algo; /* length of key */ __le32 keylen; #define VIRTIO_CRYPTO_OP_ENCRYPT 1 #define VIRTIO_CRYPTO_OP_DECRYPT 2 /* encrypt or decrypt */ __le32 op; __le32 padding; }; struct virtio_crypto_session_input { /* Device-writable part */ __le64 session_id; __le32 status; __le32 padding; }; struct virtio_crypto_cipher_session_req { struct virtio_crypto_cipher_session_para para; __u8 padding[32]; }; struct virtio_crypto_hash_session_para { #define VIRTIO_CRYPTO_NO_HASH 0 #define VIRTIO_CRYPTO_HASH_MD5 1 #define VIRTIO_CRYPTO_HASH_SHA1 2 #define VIRTIO_CRYPTO_HASH_SHA_224 3 #define VIRTIO_CRYPTO_HASH_SHA_256 4 #define VIRTIO_CRYPTO_HASH_SHA_384 5 #define VIRTIO_CRYPTO_HASH_SHA_512 6 #define VIRTIO_CRYPTO_HASH_SHA3_224 7 #define VIRTIO_CRYPTO_HASH_SHA3_256 8 #define VIRTIO_CRYPTO_HASH_SHA3_384 9 #define VIRTIO_CRYPTO_HASH_SHA3_512 10 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE128 11 #define VIRTIO_CRYPTO_HASH_SHA3_SHAKE256 12 __le32 algo; /* hash result length */ __le32 hash_result_len; __u8 padding[8]; }; struct virtio_crypto_hash_create_session_req { struct virtio_crypto_hash_session_para para; __u8 padding[40]; }; struct virtio_crypto_mac_session_para { #define VIRTIO_CRYPTO_NO_MAC 0 #define VIRTIO_CRYPTO_MAC_HMAC_MD5 1 #define VIRTIO_CRYPTO_MAC_HMAC_SHA1 2 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_224 3 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_256 4 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_384 5 #define VIRTIO_CRYPTO_MAC_HMAC_SHA_512 6 #define VIRTIO_CRYPTO_MAC_CMAC_3DES 25 #define VIRTIO_CRYPTO_MAC_CMAC_AES 26 #define VIRTIO_CRYPTO_MAC_KASUMI_F9 27 #define VIRTIO_CRYPTO_MAC_SNOW3G_UIA2 28 #define VIRTIO_CRYPTO_MAC_GMAC_AES 41 #define VIRTIO_CRYPTO_MAC_GMAC_TWOFISH 42 #define VIRTIO_CRYPTO_MAC_CBCMAC_AES 49 #define VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9 50 #define VIRTIO_CRYPTO_MAC_XCBC_AES 53 __le32 algo; /* hash result length */ __le32 hash_result_len; /* length of authenticated key */ __le32 auth_key_len; __le32 padding; }; struct virtio_crypto_mac_create_session_req { struct virtio_crypto_mac_session_para para; __u8 padding[40]; }; struct virtio_crypto_aead_session_para { #define VIRTIO_CRYPTO_NO_AEAD 0 #define VIRTIO_CRYPTO_AEAD_GCM 1 #define VIRTIO_CRYPTO_AEAD_CCM 2 #define VIRTIO_CRYPTO_AEAD_CHACHA20_POLY1305 3 __le32 algo; /* length of key */ __le32 key_len; /* hash result length */ __le32 hash_result_len; /* length of the additional authenticated data (AAD) in bytes */ __le32 aad_len; /* encrypt or decrypt, See above VIRTIO_CRYPTO_OP_* */ __le32 op; __le32 padding; }; struct virtio_crypto_aead_create_session_req { struct virtio_crypto_aead_session_para para; __u8 padding[32]; }; struct virtio_crypto_alg_chain_session_para { #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER 1 #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH 2 __le32 alg_chain_order; /* Plain hash */ #define VIRTIO_CRYPTO_SYM_HASH_MODE_PLAIN 1 /* Authenticated hash (mac) */ #define VIRTIO_CRYPTO_SYM_HASH_MODE_AUTH 2 /* Nested hash */ #define VIRTIO_CRYPTO_SYM_HASH_MODE_NESTED 3 __le32 hash_mode; struct virtio_crypto_cipher_session_para cipher_param; union { struct virtio_crypto_hash_session_para hash_param; struct virtio_crypto_mac_session_para mac_param; __u8 padding[16]; } u; /* length of the additional authenticated data (AAD) in bytes */ __le32 aad_len; __le32 padding; }; struct virtio_crypto_alg_chain_session_req { struct virtio_crypto_alg_chain_session_para para; }; struct virtio_crypto_sym_create_session_req { union { struct virtio_crypto_cipher_session_req cipher; struct virtio_crypto_alg_chain_session_req chain; __u8 padding[48]; } u; /* Device-readable part */ /* No operation */ #define VIRTIO_CRYPTO_SYM_OP_NONE 0 /* Cipher only operation on the data */ #define VIRTIO_CRYPTO_SYM_OP_CIPHER 1 /* * Chain any cipher with any hash or mac operation. The order * depends on the value of alg_chain_order param */ #define VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING 2 __le32 op_type; __le32 padding; }; struct virtio_crypto_destroy_session_req { /* Device-readable part */ __le64 session_id; __u8 padding[48]; }; /* The request of the control virtqueue's packet */ struct virtio_crypto_op_ctrl_req { struct virtio_crypto_ctrl_header header; union { struct virtio_crypto_sym_create_session_req sym_create_session; struct virtio_crypto_hash_create_session_req hash_create_session; struct virtio_crypto_mac_create_session_req mac_create_session; struct virtio_crypto_aead_create_session_req aead_create_session; struct virtio_crypto_destroy_session_req destroy_session; __u8 padding[56]; } u; }; struct virtio_crypto_op_header { #define VIRTIO_CRYPTO_CIPHER_ENCRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x00) #define VIRTIO_CRYPTO_CIPHER_DECRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_CIPHER, 0x01) #define VIRTIO_CRYPTO_HASH \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_HASH, 0x00) #define VIRTIO_CRYPTO_MAC \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_MAC, 0x00) #define VIRTIO_CRYPTO_AEAD_ENCRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x00) #define VIRTIO_CRYPTO_AEAD_DECRYPT \ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x01) __le32 opcode; /* algo should be service-specific algorithms */ __le32 algo; /* session_id should be service-specific algorithms */ __le64 session_id; /* control flag to control the request */ __le32 flag; __le32 padding; }; struct virtio_crypto_cipher_para { /* * Byte Length of valid IV/Counter * * For block ciphers in CBC or F8 mode, or for Kasumi in F8 mode, or for * SNOW3G in UEA2 mode, this is the length of the IV (which * must be the same as the block length of the cipher). * For block ciphers in CTR mode, this is the length of the counter * (which must be the same as the block length of the cipher). * For AES-XTS, this is the 128bit tweak, i, from IEEE Std 1619-2007. * * The IV/Counter will be updated after every partial cryptographic * operation. */ __le32 iv_len; /* length of source data */ __le32 src_data_len; /* length of dst data */ __le32 dst_data_len; __le32 padding; }; struct virtio_crypto_hash_para { /* length of source data */ __le32 src_data_len; /* hash result length */ __le32 hash_result_len; }; struct virtio_crypto_mac_para { struct virtio_crypto_hash_para hash; }; struct virtio_crypto_aead_para { /* * Byte Length of valid IV data pointed to by the below iv_addr * parameter. * * For GCM mode, this is either 12 (for 96-bit IVs) or 16, in which * case iv_addr points to J0. * For CCM mode, this is the length of the nonce, which can be in the * range 7 to 13 inclusive. */ __le32 iv_len; /* length of additional auth data */ __le32 aad_len; /* length of source data */ __le32 src_data_len; /* length of dst data */ __le32 dst_data_len; }; struct virtio_crypto_cipher_data_req { /* Device-readable part */ struct virtio_crypto_cipher_para para; __u8 padding[24]; }; struct virtio_crypto_hash_data_req { /* Device-readable part */ struct virtio_crypto_hash_para para; __u8 padding[40]; }; struct virtio_crypto_mac_data_req { /* Device-readable part */ struct virtio_crypto_mac_para para; __u8 padding[40]; }; struct virtio_crypto_alg_chain_data_para { __le32 iv_len; /* Length of source data */ __le32 src_data_len; /* Length of destination data */ __le32 dst_data_len; /* Starting point for cipher processing in source data */ __le32 cipher_start_src_offset; /* Length of the source data that the cipher will be computed on */ __le32 len_to_cipher; /* Starting point for hash processing in source data */ __le32 hash_start_src_offset; /* Length of the source data that the hash will be computed on */ __le32 len_to_hash; /* Length of the additional auth data */ __le32 aad_len; /* Length of the hash result */ __le32 hash_result_len; __le32 reserved; }; struct virtio_crypto_alg_chain_data_req { /* Device-readable part */ struct virtio_crypto_alg_chain_data_para para; }; struct virtio_crypto_sym_data_req { union { struct virtio_crypto_cipher_data_req cipher; struct virtio_crypto_alg_chain_data_req chain; __u8 padding[40]; } u; /* See above VIRTIO_CRYPTO_SYM_OP_* */ __le32 op_type; __le32 padding; }; struct virtio_crypto_aead_data_req { /* Device-readable part */ struct virtio_crypto_aead_para para; __u8 padding[32]; }; /* The request of the data virtqueue's packet */ struct virtio_crypto_op_data_req { struct virtio_crypto_op_header header; union { struct virtio_crypto_sym_data_req sym_req; struct virtio_crypto_hash_data_req hash_req; struct virtio_crypto_mac_data_req mac_req; struct virtio_crypto_aead_data_req aead_req; __u8 padding[48]; } u; }; #define VIRTIO_CRYPTO_OK 0 #define VIRTIO_CRYPTO_ERR 1 #define VIRTIO_CRYPTO_BADMSG 2 #define VIRTIO_CRYPTO_NOTSUPP 3 #define VIRTIO_CRYPTO_INVSESS 4 /* Invalid session id */ /* The accelerator hardware is ready */ #define VIRTIO_CRYPTO_S_HW_READY (1 << 0) struct virtio_crypto_config { /* See VIRTIO_CRYPTO_OP_* above */ __u32 status; /* * Maximum number of data queue */ __u32 max_dataqueues; /* * Specifies the services mask which the device support, * see VIRTIO_CRYPTO_SERVICE_* above */ __u32 crypto_services; /* Detailed algorithms mask */ __u32 cipher_algo_l; __u32 cipher_algo_h; __u32 hash_algo; __u32 mac_algo_l; __u32 mac_algo_h; __u32 aead_algo; /* Maximum length of cipher key */ __u32 max_cipher_key_len; /* Maximum length of authenticated key */ __u32 max_auth_key_len; __u32 reserve; /* Maximum size of each crypto request's content */ __u64 max_size; }; struct virtio_crypto_inhdr { /* See VIRTIO_CRYPTO_* above */ __u8 status; }; #endif linux/virtio_fs.h 0000644 00000001074 15063602056 0010065 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ #ifndef _LINUX_VIRTIO_FS_H #define _LINUX_VIRTIO_FS_H #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #include <linux/virtio_types.h> struct virtio_fs_config { /* Filesystem name (UTF-8, not NUL-terminated, padded with NULs) */ __u8 tag[36]; /* Number of request queues */ __u32 num_request_queues; } __attribute__((packed)); /* For the id field in virtio_pci_shm_cap */ #define VIRTIO_FS_SHMCAP_ID_CACHE 0 #endif /* _LINUX_VIRTIO_FS_H */ linux/virtio_gpu.h 0000644 00000026276 15063602056 0010263 0 ustar 00 /* * Virtio GPU Device * * Copyright Red Hat, Inc. 2013-2014 * * Authors: * Dave Airlie <airlied@redhat.com> * Gerd Hoffmann <kraxel@redhat.com> * * This header is BSD licensed so anyone can use the definitions * to implement compatible drivers/servers: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef VIRTIO_GPU_HW_H #define VIRTIO_GPU_HW_H #include <linux/types.h> /* * VIRTIO_GPU_CMD_CTX_* * VIRTIO_GPU_CMD_*_3D */ #define VIRTIO_GPU_F_VIRGL 0 /* * VIRTIO_GPU_CMD_GET_EDID */ #define VIRTIO_GPU_F_EDID 1 /* * VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID */ #define VIRTIO_GPU_F_RESOURCE_UUID 2 /* * VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB */ #define VIRTIO_GPU_F_RESOURCE_BLOB 3 /* * VIRTIO_GPU_CMD_CREATE_CONTEXT with * context_init and multiple timelines */ #define VIRTIO_GPU_F_CONTEXT_INIT 4 enum virtio_gpu_ctrl_type { VIRTIO_GPU_UNDEFINED = 0, /* 2d commands */ VIRTIO_GPU_CMD_GET_DISPLAY_INFO = 0x0100, VIRTIO_GPU_CMD_RESOURCE_CREATE_2D, VIRTIO_GPU_CMD_RESOURCE_UNREF, VIRTIO_GPU_CMD_SET_SCANOUT, VIRTIO_GPU_CMD_RESOURCE_FLUSH, VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D, VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING, VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING, VIRTIO_GPU_CMD_GET_CAPSET_INFO, VIRTIO_GPU_CMD_GET_CAPSET, VIRTIO_GPU_CMD_GET_EDID, VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID, VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB, VIRTIO_GPU_CMD_SET_SCANOUT_BLOB, /* 3d commands */ VIRTIO_GPU_CMD_CTX_CREATE = 0x0200, VIRTIO_GPU_CMD_CTX_DESTROY, VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE, VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE, VIRTIO_GPU_CMD_RESOURCE_CREATE_3D, VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D, VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D, VIRTIO_GPU_CMD_SUBMIT_3D, VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB, VIRTIO_GPU_CMD_RESOURCE_UNMAP_BLOB, /* cursor commands */ VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300, VIRTIO_GPU_CMD_MOVE_CURSOR, /* success responses */ VIRTIO_GPU_RESP_OK_NODATA = 0x1100, VIRTIO_GPU_RESP_OK_DISPLAY_INFO, VIRTIO_GPU_RESP_OK_CAPSET_INFO, VIRTIO_GPU_RESP_OK_CAPSET, VIRTIO_GPU_RESP_OK_EDID, VIRTIO_GPU_RESP_OK_RESOURCE_UUID, VIRTIO_GPU_RESP_OK_MAP_INFO, /* error responses */ VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200, VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY, VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID, VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID, VIRTIO_GPU_RESP_ERR_INVALID_CONTEXT_ID, VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER, }; enum virtio_gpu_shm_id { VIRTIO_GPU_SHM_ID_UNDEFINED = 0, /* * VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB * VIRTIO_GPU_CMD_RESOURCE_UNMAP_BLOB */ VIRTIO_GPU_SHM_ID_HOST_VISIBLE = 1 }; #define VIRTIO_GPU_FLAG_FENCE (1 << 0) /* * If the following flag is set, then ring_idx contains the index * of the command ring that needs to used when creating the fence */ #define VIRTIO_GPU_FLAG_INFO_RING_IDX (1 << 1) struct virtio_gpu_ctrl_hdr { __le32 type; __le32 flags; __le64 fence_id; __le32 ctx_id; __u8 ring_idx; __u8 padding[3]; }; /* data passed in the cursor vq */ struct virtio_gpu_cursor_pos { __le32 scanout_id; __le32 x; __le32 y; __le32 padding; }; /* VIRTIO_GPU_CMD_UPDATE_CURSOR, VIRTIO_GPU_CMD_MOVE_CURSOR */ struct virtio_gpu_update_cursor { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_cursor_pos pos; /* update & move */ __le32 resource_id; /* update only */ __le32 hot_x; /* update only */ __le32 hot_y; /* update only */ __le32 padding; }; /* data passed in the control vq, 2d related */ struct virtio_gpu_rect { __le32 x; __le32 y; __le32 width; __le32 height; }; /* VIRTIO_GPU_CMD_RESOURCE_UNREF */ struct virtio_gpu_resource_unref { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_CMD_RESOURCE_CREATE_2D: create a 2d resource with a format */ struct virtio_gpu_resource_create_2d { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 format; __le32 width; __le32 height; }; /* VIRTIO_GPU_CMD_SET_SCANOUT */ struct virtio_gpu_set_scanout { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_rect r; __le32 scanout_id; __le32 resource_id; }; /* VIRTIO_GPU_CMD_RESOURCE_FLUSH */ struct virtio_gpu_resource_flush { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_rect r; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D: simple transfer to_host */ struct virtio_gpu_transfer_to_host_2d { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_rect r; __le64 offset; __le32 resource_id; __le32 padding; }; struct virtio_gpu_mem_entry { __le64 addr; __le32 length; __le32 padding; }; /* VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING */ struct virtio_gpu_resource_attach_backing { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 nr_entries; }; /* VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING */ struct virtio_gpu_resource_detach_backing { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_RESP_OK_DISPLAY_INFO */ #define VIRTIO_GPU_MAX_SCANOUTS 16 struct virtio_gpu_resp_display_info { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_display_one { struct virtio_gpu_rect r; __le32 enabled; __le32 flags; } pmodes[VIRTIO_GPU_MAX_SCANOUTS]; }; /* data passed in the control vq, 3d related */ struct virtio_gpu_box { __le32 x, y, z; __le32 w, h, d; }; /* VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D, VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D */ struct virtio_gpu_transfer_host_3d { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_box box; __le64 offset; __le32 resource_id; __le32 level; __le32 stride; __le32 layer_stride; }; /* VIRTIO_GPU_CMD_RESOURCE_CREATE_3D */ #define VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP (1 << 0) struct virtio_gpu_resource_create_3d { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 target; __le32 format; __le32 bind; __le32 width; __le32 height; __le32 depth; __le32 array_size; __le32 last_level; __le32 nr_samples; __le32 flags; __le32 padding; }; /* VIRTIO_GPU_CMD_CTX_CREATE */ #define VIRTIO_GPU_CONTEXT_INIT_CAPSET_ID_MASK 0x000000ff struct virtio_gpu_ctx_create { struct virtio_gpu_ctrl_hdr hdr; __le32 nlen; __le32 context_init; char debug_name[64]; }; /* VIRTIO_GPU_CMD_CTX_DESTROY */ struct virtio_gpu_ctx_destroy { struct virtio_gpu_ctrl_hdr hdr; }; /* VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE, VIRTIO_GPU_CMD_CTX_DETACH_RESOURCE */ struct virtio_gpu_ctx_resource { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_CMD_SUBMIT_3D */ struct virtio_gpu_cmd_submit { struct virtio_gpu_ctrl_hdr hdr; __le32 size; __le32 padding; }; #define VIRTIO_GPU_CAPSET_VIRGL 1 #define VIRTIO_GPU_CAPSET_VIRGL2 2 /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */ struct virtio_gpu_get_capset_info { struct virtio_gpu_ctrl_hdr hdr; __le32 capset_index; __le32 padding; }; /* VIRTIO_GPU_RESP_OK_CAPSET_INFO */ struct virtio_gpu_resp_capset_info { struct virtio_gpu_ctrl_hdr hdr; __le32 capset_id; __le32 capset_max_version; __le32 capset_max_size; __le32 padding; }; /* VIRTIO_GPU_CMD_GET_CAPSET */ struct virtio_gpu_get_capset { struct virtio_gpu_ctrl_hdr hdr; __le32 capset_id; __le32 capset_version; }; /* VIRTIO_GPU_RESP_OK_CAPSET */ struct virtio_gpu_resp_capset { struct virtio_gpu_ctrl_hdr hdr; __u8 capset_data[]; }; /* VIRTIO_GPU_CMD_GET_EDID */ struct virtio_gpu_cmd_get_edid { struct virtio_gpu_ctrl_hdr hdr; __le32 scanout; __le32 padding; }; /* VIRTIO_GPU_RESP_OK_EDID */ struct virtio_gpu_resp_edid { struct virtio_gpu_ctrl_hdr hdr; __le32 size; __le32 padding; __u8 edid[1024]; }; #define VIRTIO_GPU_EVENT_DISPLAY (1 << 0) struct virtio_gpu_config { __le32 events_read; __le32 events_clear; __le32 num_scanouts; __le32 num_capsets; }; /* simple formats for fbcon/X use */ enum virtio_gpu_formats { VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM = 1, VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM = 2, VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM = 3, VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM = 4, VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM = 67, VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM = 68, VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM = 121, VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM = 134, }; /* VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID */ struct virtio_gpu_resource_assign_uuid { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; /* VIRTIO_GPU_RESP_OK_RESOURCE_UUID */ struct virtio_gpu_resp_resource_uuid { struct virtio_gpu_ctrl_hdr hdr; __u8 uuid[16]; }; /* VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB */ struct virtio_gpu_resource_create_blob { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; #define VIRTIO_GPU_BLOB_MEM_GUEST 0x0001 #define VIRTIO_GPU_BLOB_MEM_HOST3D 0x0002 #define VIRTIO_GPU_BLOB_MEM_HOST3D_GUEST 0x0003 #define VIRTIO_GPU_BLOB_FLAG_USE_MAPPABLE 0x0001 #define VIRTIO_GPU_BLOB_FLAG_USE_SHAREABLE 0x0002 #define VIRTIO_GPU_BLOB_FLAG_USE_CROSS_DEVICE 0x0004 /* zero is invalid blob mem */ __le32 blob_mem; __le32 blob_flags; __le32 nr_entries; __le64 blob_id; __le64 size; /* * sizeof(nr_entries * virtio_gpu_mem_entry) bytes follow */ }; /* VIRTIO_GPU_CMD_SET_SCANOUT_BLOB */ struct virtio_gpu_set_scanout_blob { struct virtio_gpu_ctrl_hdr hdr; struct virtio_gpu_rect r; __le32 scanout_id; __le32 resource_id; __le32 width; __le32 height; __le32 format; __le32 padding; __le32 strides[4]; __le32 offsets[4]; }; /* VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB */ struct virtio_gpu_resource_map_blob { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; __le64 offset; }; /* VIRTIO_GPU_RESP_OK_MAP_INFO */ #define VIRTIO_GPU_MAP_CACHE_MASK 0x0f #define VIRTIO_GPU_MAP_CACHE_NONE 0x00 #define VIRTIO_GPU_MAP_CACHE_CACHED 0x01 #define VIRTIO_GPU_MAP_CACHE_UNCACHED 0x02 #define VIRTIO_GPU_MAP_CACHE_WC 0x03 struct virtio_gpu_resp_map_info { struct virtio_gpu_ctrl_hdr hdr; __u32 map_info; __u32 padding; }; /* VIRTIO_GPU_CMD_RESOURCE_UNMAP_BLOB */ struct virtio_gpu_resource_unmap_blob { struct virtio_gpu_ctrl_hdr hdr; __le32 resource_id; __le32 padding; }; #endif linux/virtio_ids.h 0000644 00000006305 15063602056 0010236 0 ustar 00 #ifndef _LINUX_VIRTIO_IDS_H #define _LINUX_VIRTIO_IDS_H /* * Virtio IDs * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #define VIRTIO_ID_NET 1 /* virtio net */ #define VIRTIO_ID_BLOCK 2 /* virtio block */ #define VIRTIO_ID_CONSOLE 3 /* virtio console */ #define VIRTIO_ID_RNG 4 /* virtio rng */ #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ #define VIRTIO_ID_SCSI 8 /* virtio scsi */ #define VIRTIO_ID_9P 9 /* 9p virtio console */ #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ #define VIRTIO_ID_CAIF 12 /* Virtio caif */ #define VIRTIO_ID_GPU 16 /* virtio GPU */ #define VIRTIO_ID_INPUT 18 /* virtio input */ #define VIRTIO_ID_VSOCK 19 /* virtio vsock transport */ #define VIRTIO_ID_CRYPTO 20 /* virtio crypto */ #define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */ #define VIRTIO_ID_MEM 24 /* virtio mem */ #define VIRTIO_ID_SOUND 25 /* virtio sound */ #define VIRTIO_ID_FS 26 /* virtio filesystem */ #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ #define VIRTIO_ID_BT 40 /* virtio bluetooth */ /* * Virtio Transitional IDs */ #define VIRTIO_TRANS_ID_NET 1000 /* transitional virtio net */ #define VIRTIO_TRANS_ID_BLOCK 1001 /* transitional virtio block */ #define VIRTIO_TRANS_ID_BALLOON 1002 /* transitional virtio balloon */ #define VIRTIO_TRANS_ID_CONSOLE 1003 /* transitional virtio console */ #define VIRTIO_TRANS_ID_SCSI 1004 /* transitional virtio SCSI */ #define VIRTIO_TRANS_ID_RNG 1005 /* transitional virtio rng */ #define VIRTIO_TRANS_ID_9P 1009 /* transitional virtio 9p console */ #endif /* _LINUX_VIRTIO_IDS_H */ linux/virtio_input.h 0000644 00000004712 15063602056 0010616 0 ustar 00 #ifndef _LINUX_VIRTIO_INPUT_H #define _LINUX_VIRTIO_INPUT_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> enum virtio_input_config_select { VIRTIO_INPUT_CFG_UNSET = 0x00, VIRTIO_INPUT_CFG_ID_NAME = 0x01, VIRTIO_INPUT_CFG_ID_SERIAL = 0x02, VIRTIO_INPUT_CFG_ID_DEVIDS = 0x03, VIRTIO_INPUT_CFG_PROP_BITS = 0x10, VIRTIO_INPUT_CFG_EV_BITS = 0x11, VIRTIO_INPUT_CFG_ABS_INFO = 0x12, }; struct virtio_input_absinfo { __u32 min; __u32 max; __u32 fuzz; __u32 flat; __u32 res; }; struct virtio_input_devids { __u16 bustype; __u16 vendor; __u16 product; __u16 version; }; struct virtio_input_config { __u8 select; __u8 subsel; __u8 size; __u8 reserved[5]; union { char string[128]; __u8 bitmap[128]; struct virtio_input_absinfo abs; struct virtio_input_devids ids; } u; }; struct virtio_input_event { __le16 type; __le16 code; __le32 value; }; #endif /* _LINUX_VIRTIO_INPUT_H */ linux/virtio_iommu.h 0000644 00000007307 15063602056 0010610 0 ustar 00 /* SPDX-License-Identifier: BSD-3-Clause */ /* * Virtio-iommu definition v0.12 * * Copyright (C) 2019 Arm Ltd. */ #ifndef _LINUX_VIRTIO_IOMMU_H #define _LINUX_VIRTIO_IOMMU_H #include <linux/types.h> /* Feature bits */ #define VIRTIO_IOMMU_F_INPUT_RANGE 0 #define VIRTIO_IOMMU_F_DOMAIN_RANGE 1 #define VIRTIO_IOMMU_F_MAP_UNMAP 2 #define VIRTIO_IOMMU_F_BYPASS 3 #define VIRTIO_IOMMU_F_PROBE 4 #define VIRTIO_IOMMU_F_MMIO 5 struct virtio_iommu_range_64 { __le64 start; __le64 end; }; struct virtio_iommu_range_32 { __le32 start; __le32 end; }; struct virtio_iommu_config { /* Supported page sizes */ __le64 page_size_mask; /* Supported IOVA range */ struct virtio_iommu_range_64 input_range; /* Max domain ID size */ struct virtio_iommu_range_32 domain_range; /* Probe buffer size */ __le32 probe_size; }; /* Request types */ #define VIRTIO_IOMMU_T_ATTACH 0x01 #define VIRTIO_IOMMU_T_DETACH 0x02 #define VIRTIO_IOMMU_T_MAP 0x03 #define VIRTIO_IOMMU_T_UNMAP 0x04 #define VIRTIO_IOMMU_T_PROBE 0x05 /* Status types */ #define VIRTIO_IOMMU_S_OK 0x00 #define VIRTIO_IOMMU_S_IOERR 0x01 #define VIRTIO_IOMMU_S_UNSUPP 0x02 #define VIRTIO_IOMMU_S_DEVERR 0x03 #define VIRTIO_IOMMU_S_INVAL 0x04 #define VIRTIO_IOMMU_S_RANGE 0x05 #define VIRTIO_IOMMU_S_NOENT 0x06 #define VIRTIO_IOMMU_S_FAULT 0x07 #define VIRTIO_IOMMU_S_NOMEM 0x08 struct virtio_iommu_req_head { __u8 type; __u8 reserved[3]; }; struct virtio_iommu_req_tail { __u8 status; __u8 reserved[3]; }; struct virtio_iommu_req_attach { struct virtio_iommu_req_head head; __le32 domain; __le32 endpoint; __u8 reserved[8]; struct virtio_iommu_req_tail tail; }; struct virtio_iommu_req_detach { struct virtio_iommu_req_head head; __le32 domain; __le32 endpoint; __u8 reserved[8]; struct virtio_iommu_req_tail tail; }; #define VIRTIO_IOMMU_MAP_F_READ (1 << 0) #define VIRTIO_IOMMU_MAP_F_WRITE (1 << 1) #define VIRTIO_IOMMU_MAP_F_MMIO (1 << 2) #define VIRTIO_IOMMU_MAP_F_MASK (VIRTIO_IOMMU_MAP_F_READ | \ VIRTIO_IOMMU_MAP_F_WRITE | \ VIRTIO_IOMMU_MAP_F_MMIO) struct virtio_iommu_req_map { struct virtio_iommu_req_head head; __le32 domain; __le64 virt_start; __le64 virt_end; __le64 phys_start; __le32 flags; struct virtio_iommu_req_tail tail; }; struct virtio_iommu_req_unmap { struct virtio_iommu_req_head head; __le32 domain; __le64 virt_start; __le64 virt_end; __u8 reserved[4]; struct virtio_iommu_req_tail tail; }; #define VIRTIO_IOMMU_PROBE_T_NONE 0 #define VIRTIO_IOMMU_PROBE_T_RESV_MEM 1 #define VIRTIO_IOMMU_PROBE_T_MASK 0xfff struct virtio_iommu_probe_property { __le16 type; __le16 length; }; #define VIRTIO_IOMMU_RESV_MEM_T_RESERVED 0 #define VIRTIO_IOMMU_RESV_MEM_T_MSI 1 struct virtio_iommu_probe_resv_mem { struct virtio_iommu_probe_property head; __u8 subtype; __u8 reserved[3]; __le64 start; __le64 end; }; struct virtio_iommu_req_probe { struct virtio_iommu_req_head head; __le32 endpoint; __u8 reserved[64]; __u8 properties[]; /* * Tail follows the variable-length properties array. No padding, * property lengths are all aligned on 8 bytes. */ }; /* Fault types */ #define VIRTIO_IOMMU_FAULT_R_UNKNOWN 0 #define VIRTIO_IOMMU_FAULT_R_DOMAIN 1 #define VIRTIO_IOMMU_FAULT_R_MAPPING 2 #define VIRTIO_IOMMU_FAULT_F_READ (1 << 0) #define VIRTIO_IOMMU_FAULT_F_WRITE (1 << 1) #define VIRTIO_IOMMU_FAULT_F_EXEC (1 << 2) #define VIRTIO_IOMMU_FAULT_F_ADDRESS (1 << 8) struct virtio_iommu_fault { __u8 reason; __u8 reserved[3]; __le32 flags; __le32 endpoint; __u8 reserved2[4]; __le64 address; }; #endif linux/virtio_mem.h 0000644 00000015765 15063602056 0010247 0 ustar 00 /* SPDX-License-Identifier: BSD-3-Clause */ /* * Virtio Mem Device * * Copyright Red Hat, Inc. 2020 * * Authors: * David Hildenbrand <david@redhat.com> * * This header is BSD licensed so anyone can use the definitions * to implement compatible drivers/servers: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_VIRTIO_MEM_H #define _LINUX_VIRTIO_MEM_H #include <linux/types.h> #include <linux/virtio_types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> /* * Each virtio-mem device manages a dedicated region in physical address * space. Each device can belong to a single NUMA node, multiple devices * for a single NUMA node are possible. A virtio-mem device is like a * "resizable DIMM" consisting of small memory blocks that can be plugged * or unplugged. The device driver is responsible for (un)plugging memory * blocks on demand. * * Virtio-mem devices can only operate on their assigned memory region in * order to (un)plug memory. A device cannot (un)plug memory belonging to * other devices. * * The "region_size" corresponds to the maximum amount of memory that can * be provided by a device. The "size" corresponds to the amount of memory * that is currently plugged. "requested_size" corresponds to a request * from the device to the device driver to (un)plug blocks. The * device driver should try to (un)plug blocks in order to reach the * "requested_size". It is impossible to plug more memory than requested. * * The "usable_region_size" represents the memory region that can actually * be used to (un)plug memory. It is always at least as big as the * "requested_size" and will grow dynamically. It will only shrink when * explicitly triggered (VIRTIO_MEM_REQ_UNPLUG). * * There are no guarantees what will happen if unplugged memory is * read/written. In general, unplugged memory should not be touched, because * the resulting action is undefined. There is one exception: without * VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, unplugged memory inside the usable * region can be read, to simplify creation of memory dumps. * * It can happen that the device cannot process a request, because it is * busy. The device driver has to retry later. * * Usually, during system resets all memory will get unplugged, so the * device driver can start with a clean state. However, in specific * scenarios (if the device is busy) it can happen that the device still * has memory plugged. The device driver can request to unplug all memory * (VIRTIO_MEM_REQ_UNPLUG) - which might take a while to succeed if the * device is busy. */ /* --- virtio-mem: feature bits --- */ /* node_id is an ACPI PXM and is valid */ #define VIRTIO_MEM_F_ACPI_PXM 0 /* unplugged memory must not be accessed */ #define VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE 1 /* --- virtio-mem: guest -> host requests --- */ /* request to plug memory blocks */ #define VIRTIO_MEM_REQ_PLUG 0 /* request to unplug memory blocks */ #define VIRTIO_MEM_REQ_UNPLUG 1 /* request to unplug all blocks and shrink the usable size */ #define VIRTIO_MEM_REQ_UNPLUG_ALL 2 /* request information about the plugged state of memory blocks */ #define VIRTIO_MEM_REQ_STATE 3 struct virtio_mem_req_plug { __virtio64 addr; __virtio16 nb_blocks; __virtio16 padding[3]; }; struct virtio_mem_req_unplug { __virtio64 addr; __virtio16 nb_blocks; __virtio16 padding[3]; }; struct virtio_mem_req_state { __virtio64 addr; __virtio16 nb_blocks; __virtio16 padding[3]; }; struct virtio_mem_req { __virtio16 type; __virtio16 padding[3]; union { struct virtio_mem_req_plug plug; struct virtio_mem_req_unplug unplug; struct virtio_mem_req_state state; } u; }; /* --- virtio-mem: host -> guest response --- */ /* * Request processed successfully, applicable for * - VIRTIO_MEM_REQ_PLUG * - VIRTIO_MEM_REQ_UNPLUG * - VIRTIO_MEM_REQ_UNPLUG_ALL * - VIRTIO_MEM_REQ_STATE */ #define VIRTIO_MEM_RESP_ACK 0 /* * Request denied - e.g. trying to plug more than requested, applicable for * - VIRTIO_MEM_REQ_PLUG */ #define VIRTIO_MEM_RESP_NACK 1 /* * Request cannot be processed right now, try again later, applicable for * - VIRTIO_MEM_REQ_PLUG * - VIRTIO_MEM_REQ_UNPLUG * - VIRTIO_MEM_REQ_UNPLUG_ALL */ #define VIRTIO_MEM_RESP_BUSY 2 /* * Error in request (e.g. addresses/alignment), applicable for * - VIRTIO_MEM_REQ_PLUG * - VIRTIO_MEM_REQ_UNPLUG * - VIRTIO_MEM_REQ_STATE */ #define VIRTIO_MEM_RESP_ERROR 3 /* State of memory blocks is "plugged" */ #define VIRTIO_MEM_STATE_PLUGGED 0 /* State of memory blocks is "unplugged" */ #define VIRTIO_MEM_STATE_UNPLUGGED 1 /* State of memory blocks is "mixed" */ #define VIRTIO_MEM_STATE_MIXED 2 struct virtio_mem_resp_state { __virtio16 state; }; struct virtio_mem_resp { __virtio16 type; __virtio16 padding[3]; union { struct virtio_mem_resp_state state; } u; }; /* --- virtio-mem: configuration --- */ struct virtio_mem_config { /* Block size and alignment. Cannot change. */ __le64 block_size; /* Valid with VIRTIO_MEM_F_ACPI_PXM. Cannot change. */ __le16 node_id; __u8 padding[6]; /* Start address of the memory region. Cannot change. */ __le64 addr; /* Region size (maximum). Cannot change. */ __le64 region_size; /* * Currently usable region size. Can grow up to region_size. Can * shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL (in which case no config * update will be sent). */ __le64 usable_region_size; /* * Currently used size. Changes due to plug/unplug requests, but no * config updates will be sent. */ __le64 plugged_size; /* Requested size. New plug requests cannot exceed it. Can change. */ __le64 requested_size; }; #endif /* _LINUX_VIRTIO_MEM_H */ linux/virtio_mmio.h 0000644 00000011551 15063602056 0010417 0 ustar 00 /* * Virtio platform device driver * * Copyright 2011, ARM Ltd. * * Based on Virtio PCI driver by Anthony Liguori, copyright IBM Corp. 2007 * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_VIRTIO_MMIO_H #define _LINUX_VIRTIO_MMIO_H /* * Control registers */ /* Magic value ("virt" string) - Read Only */ #define VIRTIO_MMIO_MAGIC_VALUE 0x000 /* Virtio device version - Read Only */ #define VIRTIO_MMIO_VERSION 0x004 /* Virtio device ID - Read Only */ #define VIRTIO_MMIO_DEVICE_ID 0x008 /* Virtio vendor ID - Read Only */ #define VIRTIO_MMIO_VENDOR_ID 0x00c /* Bitmask of the features supported by the device (host) * (32 bits per set) - Read Only */ #define VIRTIO_MMIO_DEVICE_FEATURES 0x010 /* Device (host) features set selector - Write Only */ #define VIRTIO_MMIO_DEVICE_FEATURES_SEL 0x014 /* Bitmask of features activated by the driver (guest) * (32 bits per set) - Write Only */ #define VIRTIO_MMIO_DRIVER_FEATURES 0x020 /* Activated features set selector - Write Only */ #define VIRTIO_MMIO_DRIVER_FEATURES_SEL 0x024 #ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */ /* Guest's memory page size in bytes - Write Only */ #define VIRTIO_MMIO_GUEST_PAGE_SIZE 0x028 #endif /* Queue selector - Write Only */ #define VIRTIO_MMIO_QUEUE_SEL 0x030 /* Maximum size of the currently selected queue - Read Only */ #define VIRTIO_MMIO_QUEUE_NUM_MAX 0x034 /* Queue size for the currently selected queue - Write Only */ #define VIRTIO_MMIO_QUEUE_NUM 0x038 #ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */ /* Used Ring alignment for the currently selected queue - Write Only */ #define VIRTIO_MMIO_QUEUE_ALIGN 0x03c /* Guest's PFN for the currently selected queue - Read Write */ #define VIRTIO_MMIO_QUEUE_PFN 0x040 #endif /* Ready bit for the currently selected queue - Read Write */ #define VIRTIO_MMIO_QUEUE_READY 0x044 /* Queue notifier - Write Only */ #define VIRTIO_MMIO_QUEUE_NOTIFY 0x050 /* Interrupt status - Read Only */ #define VIRTIO_MMIO_INTERRUPT_STATUS 0x060 /* Interrupt acknowledge - Write Only */ #define VIRTIO_MMIO_INTERRUPT_ACK 0x064 /* Device status register - Read Write */ #define VIRTIO_MMIO_STATUS 0x070 /* Selected queue's Descriptor Table address, 64 bits in two halves */ #define VIRTIO_MMIO_QUEUE_DESC_LOW 0x080 #define VIRTIO_MMIO_QUEUE_DESC_HIGH 0x084 /* Selected queue's Available Ring address, 64 bits in two halves */ #define VIRTIO_MMIO_QUEUE_AVAIL_LOW 0x090 #define VIRTIO_MMIO_QUEUE_AVAIL_HIGH 0x094 /* Selected queue's Used Ring address, 64 bits in two halves */ #define VIRTIO_MMIO_QUEUE_USED_LOW 0x0a0 #define VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4 /* Shared memory region id */ #define VIRTIO_MMIO_SHM_SEL 0x0ac /* Shared memory region length, 64 bits in two halves */ #define VIRTIO_MMIO_SHM_LEN_LOW 0x0b0 #define VIRTIO_MMIO_SHM_LEN_HIGH 0x0b4 /* Shared memory region base address, 64 bits in two halves */ #define VIRTIO_MMIO_SHM_BASE_LOW 0x0b8 #define VIRTIO_MMIO_SHM_BASE_HIGH 0x0bc /* Configuration atomicity value */ #define VIRTIO_MMIO_CONFIG_GENERATION 0x0fc /* The config space is defined by each driver as * the per-driver configuration space - Read Write */ #define VIRTIO_MMIO_CONFIG 0x100 /* * Interrupt flags (re: interrupt status & acknowledge registers) */ #define VIRTIO_MMIO_INT_VRING (1 << 0) #define VIRTIO_MMIO_INT_CONFIG (1 << 1) #endif linux/virtio_net.h 0000644 00000024465 15063602056 0010254 0 ustar 00 #ifndef _LINUX_VIRTIO_NET_H #define _LINUX_VIRTIO_NET_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #include <linux/virtio_types.h> #include <linux/if_ether.h> /* The feature bitmap for virtio net */ #define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ #define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2 /* Dynamic offload configuration. */ #define VIRTIO_NET_F_MTU 3 /* Initial MTU advice */ #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ #define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */ #define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */ #define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */ #define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ #define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ #define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ #define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ #define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */ #define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ #define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ #define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ #define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ #define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the * network */ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ #define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another device * with the same MAC. */ #define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */ #ifndef VIRTIO_NET_NO_LEGACY #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ #endif /* VIRTIO_NET_NO_LEGACY */ #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ #define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ struct virtio_net_config { /* The config defining mac address (if VIRTIO_NET_F_MAC) */ __u8 mac[ETH_ALEN]; /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ __u16 status; /* Maximum number of each of transmit and receive queues; * see VIRTIO_NET_F_MQ and VIRTIO_NET_CTRL_MQ. * Legal values are between 1 and 0x8000 */ __u16 max_virtqueue_pairs; /* Default maximum transmit unit advice */ __u16 mtu; /* * speed, in units of 1Mb. All values 0 to INT_MAX are legal. * Any other value stands for unknown. */ __u32 speed; /* * 0x00 - half duplex * 0x01 - full duplex * Any other value stands for unknown. */ __u8 duplex; } __attribute__((packed)); /* * This header comes first in the scatter-gather list. If you don't * specify GSO or CSUM features, you can simply ignore the header. * * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf, * only flattened. */ struct virtio_net_hdr_v1 { #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */ #define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */ __u8 flags; #define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */ #define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */ #define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */ #define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */ #define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */ __u8 gso_type; __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ __virtio16 csum_start; /* Position to start checksumming from */ __virtio16 csum_offset; /* Offset after that to place checksum */ __virtio16 num_buffers; /* Number of merged rx buffers */ }; #ifndef VIRTIO_NET_NO_LEGACY /* This header comes first in the scatter-gather list. * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must * be the first element of the scatter-gather list. If you don't * specify GSO or CSUM features, you can simply ignore the header. */ struct virtio_net_hdr { /* See VIRTIO_NET_HDR_F_* */ __u8 flags; /* See VIRTIO_NET_HDR_GSO_* */ __u8 gso_type; __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ __virtio16 csum_start; /* Position to start checksumming from */ __virtio16 csum_offset; /* Offset after that to place checksum */ }; /* This is the version of the header to use when the MRG_RXBUF * feature has been negotiated. */ struct virtio_net_hdr_mrg_rxbuf { struct virtio_net_hdr hdr; __virtio16 num_buffers; /* Number of merged rx buffers */ }; #endif /* ...VIRTIO_NET_NO_LEGACY */ /* * Control virtqueue data structures * * The control virtqueue expects a header in the first sg entry * and an ack/status response in the last entry. Data for the * command goes in between. */ struct virtio_net_ctrl_hdr { __u8 class; __u8 cmd; } __attribute__((packed)); typedef __u8 virtio_net_ctrl_ack; #define VIRTIO_NET_OK 0 #define VIRTIO_NET_ERR 1 /* * Control the RX mode, ie. promisucous, allmulti, etc... * All commands require an "out" sg entry containing a 1 byte * state value, zero = disable, non-zero = enable. Commands * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature. * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA. */ #define VIRTIO_NET_CTRL_RX 0 #define VIRTIO_NET_CTRL_RX_PROMISC 0 #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 #define VIRTIO_NET_CTRL_RX_ALLUNI 2 #define VIRTIO_NET_CTRL_RX_NOMULTI 3 #define VIRTIO_NET_CTRL_RX_NOUNI 4 #define VIRTIO_NET_CTRL_RX_NOBCAST 5 /* * Control the MAC * * The MAC filter table is managed by the hypervisor, the guest should * assume the size is infinite. Filtering should be considered * non-perfect, ie. based on hypervisor resources, the guest may * received packets from sources not specified in the filter list. * * In addition to the class/cmd header, the TABLE_SET command requires * two out scatterlists. Each contains a 4 byte count of entries followed * by a concatenated byte stream of the ETH_ALEN MAC addresses. The * first sg list contains unicast addresses, the second is for multicast. * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature * is available. * * The ADDR_SET command requests one out scatterlist, it contains a * 6 bytes MAC address. This functionality is present if the * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available. */ struct virtio_net_ctrl_mac { __virtio32 entries; __u8 macs[][ETH_ALEN]; } __attribute__((packed)); #define VIRTIO_NET_CTRL_MAC 1 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0 #define VIRTIO_NET_CTRL_MAC_ADDR_SET 1 /* * Control VLAN filtering * * The VLAN filter table is controlled via a simple ADD/DEL interface. * VLAN IDs not added may be filterd by the hypervisor. Del is the * opposite of add. Both commands expect an out entry containing a 2 * byte VLAN ID. VLAN filterting is available with the * VIRTIO_NET_F_CTRL_VLAN feature bit. */ #define VIRTIO_NET_CTRL_VLAN 2 #define VIRTIO_NET_CTRL_VLAN_ADD 0 #define VIRTIO_NET_CTRL_VLAN_DEL 1 /* * Control link announce acknowledgement * * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that * driver has recevied the notification; device would clear the * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives * this command. */ #define VIRTIO_NET_CTRL_ANNOUNCE 3 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0 /* * Control Receive Flow Steering * * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET * enables Receive Flow Steering, specifying the number of the transmit and * receive queues that will be used. After the command is consumed and acked by * the device, the device will not steer new packets on receive virtqueues * other than specified nor read from transmit virtqueues other than specified. * Accordingly, driver should not transmit new packets on virtqueues other than * specified. */ struct virtio_net_ctrl_mq { __virtio16 virtqueue_pairs; }; #define VIRTIO_NET_CTRL_MQ 4 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 /* * Control network offloads * * Reconfigures the network offloads that Guest can handle. * * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit. * * Command data format matches the feature bit mask exactly. * * See VIRTIO_NET_F_GUEST_* for the list of offloads * that can be enabled/disabled. */ #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5 #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0 #endif /* _LINUX_VIRTIO_NET_H */ linux/virtio_pci.h 0000644 00000016356 15063602056 0010241 0 ustar 00 /* * Virtio PCI driver * * This module allows virtio devices to be used over a virtual PCI device. * This can be used with QEMU based VMMs like KVM or Xen. * * Copyright IBM Corp. 2007 * * Authors: * Anthony Liguori <aliguori@us.ibm.com> * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_VIRTIO_PCI_H #define _LINUX_VIRTIO_PCI_H #include <linux/types.h> #ifndef VIRTIO_PCI_NO_LEGACY /* A 32-bit r/o bitmask of the features supported by the host */ #define VIRTIO_PCI_HOST_FEATURES 0 /* A 32-bit r/w bitmask of features activated by the guest */ #define VIRTIO_PCI_GUEST_FEATURES 4 /* A 32-bit r/w PFN for the currently selected queue */ #define VIRTIO_PCI_QUEUE_PFN 8 /* A 16-bit r/o queue size for the currently selected queue */ #define VIRTIO_PCI_QUEUE_NUM 12 /* A 16-bit r/w queue selector */ #define VIRTIO_PCI_QUEUE_SEL 14 /* A 16-bit r/w queue notifier */ #define VIRTIO_PCI_QUEUE_NOTIFY 16 /* An 8-bit device status register. */ #define VIRTIO_PCI_STATUS 18 /* An 8-bit r/o interrupt status register. Reading the value will return the * current contents of the ISR and will also clear it. This is effectively * a read-and-acknowledge. */ #define VIRTIO_PCI_ISR 19 /* MSI-X registers: only enabled if MSI-X is enabled. */ /* A 16-bit vector for configuration changes. */ #define VIRTIO_MSI_CONFIG_VECTOR 20 /* A 16-bit vector for selected queue notifications. */ #define VIRTIO_MSI_QUEUE_VECTOR 22 /* The remaining space is defined by each driver as the per-driver * configuration space */ #define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20) /* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */ #define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled) /* Virtio ABI version, this must match exactly */ #define VIRTIO_PCI_ABI_VERSION 0 /* How many bits to shift physical queue address written to QUEUE_PFN. * 12 is historical, and due to x86 page size. */ #define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12 /* The alignment to use between consumer and producer parts of vring. * x86 pagesize again. */ #define VIRTIO_PCI_VRING_ALIGN 4096 #endif /* VIRTIO_PCI_NO_LEGACY */ /* The bit of the ISR which indicates a device configuration change. */ #define VIRTIO_PCI_ISR_CONFIG 0x2 /* Vector value used to disable MSI for queue */ #define VIRTIO_MSI_NO_VECTOR 0xffff #ifndef VIRTIO_PCI_NO_MODERN /* IDs for different capabilities. Must all exist. */ /* Common configuration */ #define VIRTIO_PCI_CAP_COMMON_CFG 1 /* Notifications */ #define VIRTIO_PCI_CAP_NOTIFY_CFG 2 /* ISR access */ #define VIRTIO_PCI_CAP_ISR_CFG 3 /* Device specific configuration */ #define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* PCI configuration access */ #define VIRTIO_PCI_CAP_PCI_CFG 5 /* Additional shared memory capability */ #define VIRTIO_PCI_CAP_SHARED_MEMORY_CFG 8 /* This is the PCI capability header: */ struct virtio_pci_cap { __u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */ __u8 cap_next; /* Generic PCI field: next ptr. */ __u8 cap_len; /* Generic PCI field: capability length */ __u8 cfg_type; /* Identifies the structure. */ __u8 bar; /* Where to find it. */ __u8 id; /* Multiple capabilities of the same type */ __u8 padding[2]; /* Pad to full dword. */ __le32 offset; /* Offset within bar. */ __le32 length; /* Length of the structure, in bytes. */ }; struct virtio_pci_cap64 { struct virtio_pci_cap cap; __le32 offset_hi; /* Most sig 32 bits of offset */ __le32 length_hi; /* Most sig 32 bits of length */ }; struct virtio_pci_notify_cap { struct virtio_pci_cap cap; __le32 notify_off_multiplier; /* Multiplier for queue_notify_off. */ }; /* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */ struct virtio_pci_common_cfg { /* About the whole device. */ __le32 device_feature_select; /* read-write */ __le32 device_feature; /* read-only */ __le32 guest_feature_select; /* read-write */ __le32 guest_feature; /* read-write */ __le16 msix_config; /* read-write */ __le16 num_queues; /* read-only */ __u8 device_status; /* read-write */ __u8 config_generation; /* read-only */ /* About a specific virtqueue. */ __le16 queue_select; /* read-write */ __le16 queue_size; /* read-write, power of 2. */ __le16 queue_msix_vector; /* read-write */ __le16 queue_enable; /* read-write */ __le16 queue_notify_off; /* read-only */ __le32 queue_desc_lo; /* read-write */ __le32 queue_desc_hi; /* read-write */ __le32 queue_avail_lo; /* read-write */ __le32 queue_avail_hi; /* read-write */ __le32 queue_used_lo; /* read-write */ __le32 queue_used_hi; /* read-write */ }; /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ struct virtio_pci_cfg_cap { struct virtio_pci_cap cap; __u8 pci_cfg_data[4]; /* Data for BAR access. */ }; /* Macro versions of offsets for the Old Timers! */ #define VIRTIO_PCI_CAP_VNDR 0 #define VIRTIO_PCI_CAP_NEXT 1 #define VIRTIO_PCI_CAP_LEN 2 #define VIRTIO_PCI_CAP_CFG_TYPE 3 #define VIRTIO_PCI_CAP_BAR 4 #define VIRTIO_PCI_CAP_OFFSET 8 #define VIRTIO_PCI_CAP_LENGTH 12 #define VIRTIO_PCI_NOTIFY_CAP_MULT 16 #define VIRTIO_PCI_COMMON_DFSELECT 0 #define VIRTIO_PCI_COMMON_DF 4 #define VIRTIO_PCI_COMMON_GFSELECT 8 #define VIRTIO_PCI_COMMON_GF 12 #define VIRTIO_PCI_COMMON_MSIX 16 #define VIRTIO_PCI_COMMON_NUMQ 18 #define VIRTIO_PCI_COMMON_STATUS 20 #define VIRTIO_PCI_COMMON_CFGGENERATION 21 #define VIRTIO_PCI_COMMON_Q_SELECT 22 #define VIRTIO_PCI_COMMON_Q_SIZE 24 #define VIRTIO_PCI_COMMON_Q_MSIX 26 #define VIRTIO_PCI_COMMON_Q_ENABLE 28 #define VIRTIO_PCI_COMMON_Q_NOFF 30 #define VIRTIO_PCI_COMMON_Q_DESCLO 32 #define VIRTIO_PCI_COMMON_Q_DESCHI 36 #define VIRTIO_PCI_COMMON_Q_AVAILLO 40 #define VIRTIO_PCI_COMMON_Q_AVAILHI 44 #define VIRTIO_PCI_COMMON_Q_USEDLO 48 #define VIRTIO_PCI_COMMON_Q_USEDHI 52 #endif /* VIRTIO_PCI_NO_MODERN */ #endif linux/virtio_ring.h 0000644 00000016511 15063602056 0010416 0 ustar 00 #ifndef _LINUX_VIRTIO_RING_H #define _LINUX_VIRTIO_RING_H /* An interface for efficient virtio implementation, currently for use by KVM, * but hopefully others soon. Do NOT change this since it will * break existing servers and clients. * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ #include <stdint.h> #include <linux/types.h> #include <linux/virtio_types.h> /* This marks a buffer as continuing via the next field. */ #define VRING_DESC_F_NEXT 1 /* This marks a buffer as write-only (otherwise read-only). */ #define VRING_DESC_F_WRITE 2 /* This means the buffer contains a list of buffer descriptors. */ #define VRING_DESC_F_INDIRECT 4 /* * Mark a descriptor as available or used in packed ring. * Notice: they are defined as shifts instead of shifted values. */ #define VRING_PACKED_DESC_F_AVAIL 7 #define VRING_PACKED_DESC_F_USED 15 /* The Host uses this in used->flags to advise the Guest: don't kick me when * you add a buffer. It's unreliable, so it's simply an optimization. Guest * will still kick if it's out of buffers. */ #define VRING_USED_F_NO_NOTIFY 1 /* The Guest uses this in avail->flags to advise the Host: don't interrupt me * when you consume a buffer. It's unreliable, so it's simply an * optimization. */ #define VRING_AVAIL_F_NO_INTERRUPT 1 /* Enable events in packed ring. */ #define VRING_PACKED_EVENT_FLAG_ENABLE 0x0 /* Disable events in packed ring. */ #define VRING_PACKED_EVENT_FLAG_DISABLE 0x1 /* * Enable events for a specific descriptor in packed ring. * (as specified by Descriptor Ring Change Event Offset/Wrap Counter). * Only valid if VIRTIO_RING_F_EVENT_IDX has been negotiated. */ #define VRING_PACKED_EVENT_FLAG_DESC 0x2 /* * Wrap counter bit shift in event suppression structure * of packed ring. */ #define VRING_PACKED_EVENT_F_WRAP_CTR 15 /* We support indirect buffer descriptors */ #define VIRTIO_RING_F_INDIRECT_DESC 28 /* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick * at the end of the used ring. Guest should ignore the used->flags field. */ #define VIRTIO_RING_F_EVENT_IDX 29 /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ struct vring_desc { /* Address (guest-physical). */ __virtio64 addr; /* Length. */ __virtio32 len; /* The flags as indicated above. */ __virtio16 flags; /* We chain unused descriptors via this, too */ __virtio16 next; }; struct vring_avail { __virtio16 flags; __virtio16 idx; __virtio16 ring[]; }; /* u32 is used here for ids for padding reasons. */ struct vring_used_elem { /* Index of start of used descriptor chain. */ __virtio32 id; /* Total length of the descriptor chain which was used (written to) */ __virtio32 len; }; struct vring_used { __virtio16 flags; __virtio16 idx; struct vring_used_elem ring[]; }; struct vring { unsigned int num; struct vring_desc *desc; struct vring_avail *avail; struct vring_used *used; }; /* Alignment requirements for vring elements. * When using pre-virtio 1.0 layout, these fall out naturally. */ #define VRING_AVAIL_ALIGN_SIZE 2 #define VRING_USED_ALIGN_SIZE 4 #define VRING_DESC_ALIGN_SIZE 16 #ifndef VIRTIO_RING_NO_LEGACY /* The standard layout for the ring is a continuous chunk of memory which looks * like this. We assume num is a power of 2. * * struct vring * { * // The actual descriptors (16 bytes each) * struct vring_desc desc[num]; * * // A ring of available descriptor heads with free-running index. * __virtio16 avail_flags; * __virtio16 avail_idx; * __virtio16 available[num]; * __virtio16 used_event_idx; * * // Padding to the next align boundary. * char pad[]; * * // A ring of used descriptor heads with free-running index. * __virtio16 used_flags; * __virtio16 used_idx; * struct vring_used_elem used[num]; * __virtio16 avail_event_idx; * }; */ /* We publish the used event index at the end of the available ring, and vice * versa. They are at the end for backwards compatibility. */ #define vring_used_event(vr) ((vr)->avail->ring[(vr)->num]) #define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num]) static __inline__ void vring_init(struct vring *vr, unsigned int num, void *p, unsigned long align) { vr->num = num; vr->desc = p; vr->avail = p + num*sizeof(struct vring_desc); vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) + align-1) & ~(align - 1)); } static __inline__ unsigned vring_size(unsigned int num, unsigned long align) { return ((sizeof(struct vring_desc) * num + sizeof(__virtio16) * (3 + num) + align - 1) & ~(align - 1)) + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num; } #endif /* VIRTIO_RING_NO_LEGACY */ /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ /* Assuming a given event_idx value from the other side, if * we have just incremented index from old to new_idx, * should we trigger an event? */ static __inline__ int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) { /* Note: Xen has similar logic for notification hold-off * in include/xen/interface/io/ring.h with req_event and req_prod * corresponding to event_idx + 1 and new_idx respectively. * Note also that req_event and req_prod in Xen start at 1, * event indexes in virtio start at 0. */ return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old); } struct vring_packed_desc_event { /* Descriptor Ring Change Event Offset/Wrap Counter. */ __le16 off_wrap; /* Descriptor Ring Change Event Flags. */ __le16 flags; }; struct vring_packed_desc { /* Buffer Address. */ __le64 addr; /* Buffer Length. */ __le32 len; /* Buffer ID. */ __le16 id; /* The flags depending on descriptor type. */ __le16 flags; }; #endif /* _LINUX_VIRTIO_RING_H */ linux/virtio_rng.h 0000644 00000000411 15063602056 0010235 0 ustar 00 #ifndef _LINUX_VIRTIO_RNG_H #define _LINUX_VIRTIO_RNG_H /* This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. */ #include <linux/virtio_ids.h> #include <linux/virtio_config.h> #endif /* _LINUX_VIRTIO_RNG_H */ linux/virtio_scsi.h 0000644 00000013623 15063602056 0010421 0 ustar 00 /* * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _LINUX_VIRTIO_SCSI_H #define _LINUX_VIRTIO_SCSI_H #include <linux/virtio_types.h> /* Default values of the CDB and sense data size configuration fields */ #define VIRTIO_SCSI_CDB_DEFAULT_SIZE 32 #define VIRTIO_SCSI_SENSE_DEFAULT_SIZE 96 #ifndef VIRTIO_SCSI_CDB_SIZE #define VIRTIO_SCSI_CDB_SIZE VIRTIO_SCSI_CDB_DEFAULT_SIZE #endif #ifndef VIRTIO_SCSI_SENSE_SIZE #define VIRTIO_SCSI_SENSE_SIZE VIRTIO_SCSI_SENSE_DEFAULT_SIZE #endif /* SCSI command request, followed by data-out */ struct virtio_scsi_cmd_req { __u8 lun[8]; /* Logical Unit Number */ __virtio64 tag; /* Command identifier */ __u8 task_attr; /* Task attribute */ __u8 prio; /* SAM command priority field */ __u8 crn; __u8 cdb[VIRTIO_SCSI_CDB_SIZE]; } __attribute__((packed)); /* SCSI command request, followed by protection information */ struct virtio_scsi_cmd_req_pi { __u8 lun[8]; /* Logical Unit Number */ __virtio64 tag; /* Command identifier */ __u8 task_attr; /* Task attribute */ __u8 prio; /* SAM command priority field */ __u8 crn; __virtio32 pi_bytesout; /* DataOUT PI Number of bytes */ __virtio32 pi_bytesin; /* DataIN PI Number of bytes */ __u8 cdb[VIRTIO_SCSI_CDB_SIZE]; } __attribute__((packed)); /* Response, followed by sense data and data-in */ struct virtio_scsi_cmd_resp { __virtio32 sense_len; /* Sense data length */ __virtio32 resid; /* Residual bytes in data buffer */ __virtio16 status_qualifier; /* Status qualifier */ __u8 status; /* Command completion status */ __u8 response; /* Response values */ __u8 sense[VIRTIO_SCSI_SENSE_SIZE]; } __attribute__((packed)); /* Task Management Request */ struct virtio_scsi_ctrl_tmf_req { __virtio32 type; __virtio32 subtype; __u8 lun[8]; __virtio64 tag; } __attribute__((packed)); struct virtio_scsi_ctrl_tmf_resp { __u8 response; } __attribute__((packed)); /* Asynchronous notification query/subscription */ struct virtio_scsi_ctrl_an_req { __virtio32 type; __u8 lun[8]; __virtio32 event_requested; } __attribute__((packed)); struct virtio_scsi_ctrl_an_resp { __virtio32 event_actual; __u8 response; } __attribute__((packed)); struct virtio_scsi_event { __virtio32 event; __u8 lun[8]; __virtio32 reason; } __attribute__((packed)); struct virtio_scsi_config { __u32 num_queues; __u32 seg_max; __u32 max_sectors; __u32 cmd_per_lun; __u32 event_info_size; __u32 sense_size; __u32 cdb_size; __u16 max_channel; __u16 max_target; __u32 max_lun; } __attribute__((packed)); /* Feature Bits */ #define VIRTIO_SCSI_F_INOUT 0 #define VIRTIO_SCSI_F_HOTPLUG 1 #define VIRTIO_SCSI_F_CHANGE 2 #define VIRTIO_SCSI_F_T10_PI 3 /* Response codes */ #define VIRTIO_SCSI_S_OK 0 #define VIRTIO_SCSI_S_OVERRUN 1 #define VIRTIO_SCSI_S_ABORTED 2 #define VIRTIO_SCSI_S_BAD_TARGET 3 #define VIRTIO_SCSI_S_RESET 4 #define VIRTIO_SCSI_S_BUSY 5 #define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6 #define VIRTIO_SCSI_S_TARGET_FAILURE 7 #define VIRTIO_SCSI_S_NEXUS_FAILURE 8 #define VIRTIO_SCSI_S_FAILURE 9 #define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10 #define VIRTIO_SCSI_S_FUNCTION_REJECTED 11 #define VIRTIO_SCSI_S_INCORRECT_LUN 12 /* Controlq type codes. */ #define VIRTIO_SCSI_T_TMF 0 #define VIRTIO_SCSI_T_AN_QUERY 1 #define VIRTIO_SCSI_T_AN_SUBSCRIBE 2 /* Valid TMF subtypes. */ #define VIRTIO_SCSI_T_TMF_ABORT_TASK 0 #define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1 #define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2 #define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3 #define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4 #define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5 #define VIRTIO_SCSI_T_TMF_QUERY_TASK 6 #define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7 /* Events. */ #define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000 #define VIRTIO_SCSI_T_NO_EVENT 0 #define VIRTIO_SCSI_T_TRANSPORT_RESET 1 #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2 #define VIRTIO_SCSI_T_PARAM_CHANGE 3 /* Reasons of transport reset event */ #define VIRTIO_SCSI_EVT_RESET_HARD 0 #define VIRTIO_SCSI_EVT_RESET_RESCAN 1 #define VIRTIO_SCSI_EVT_RESET_REMOVED 2 #define VIRTIO_SCSI_S_SIMPLE 0 #define VIRTIO_SCSI_S_ORDERED 1 #define VIRTIO_SCSI_S_HEAD 2 #define VIRTIO_SCSI_S_ACA 3 #endif /* _LINUX_VIRTIO_SCSI_H */ linux/virtio_snd.h 0000644 00000022130 15063602057 0010236 0 ustar 00 /* SPDX-License-Identifier: BSD-3-Clause */ /* * Copyright (C) 2021 OpenSynergy GmbH */ #ifndef VIRTIO_SND_IF_H #define VIRTIO_SND_IF_H #include <linux/virtio_types.h> /******************************************************************************* * CONFIGURATION SPACE */ struct virtio_snd_config { /* # of available physical jacks */ __le32 jacks; /* # of available PCM streams */ __le32 streams; /* # of available channel maps */ __le32 chmaps; }; enum { /* device virtqueue indexes */ VIRTIO_SND_VQ_CONTROL = 0, VIRTIO_SND_VQ_EVENT, VIRTIO_SND_VQ_TX, VIRTIO_SND_VQ_RX, /* # of device virtqueues */ VIRTIO_SND_VQ_MAX }; /******************************************************************************* * COMMON DEFINITIONS */ /* supported dataflow directions */ enum { VIRTIO_SND_D_OUTPUT = 0, VIRTIO_SND_D_INPUT }; enum { /* jack control request types */ VIRTIO_SND_R_JACK_INFO = 1, VIRTIO_SND_R_JACK_REMAP, /* PCM control request types */ VIRTIO_SND_R_PCM_INFO = 0x0100, VIRTIO_SND_R_PCM_SET_PARAMS, VIRTIO_SND_R_PCM_PREPARE, VIRTIO_SND_R_PCM_RELEASE, VIRTIO_SND_R_PCM_START, VIRTIO_SND_R_PCM_STOP, /* channel map control request types */ VIRTIO_SND_R_CHMAP_INFO = 0x0200, /* jack event types */ VIRTIO_SND_EVT_JACK_CONNECTED = 0x1000, VIRTIO_SND_EVT_JACK_DISCONNECTED, /* PCM event types */ VIRTIO_SND_EVT_PCM_PERIOD_ELAPSED = 0x1100, VIRTIO_SND_EVT_PCM_XRUN, /* common status codes */ VIRTIO_SND_S_OK = 0x8000, VIRTIO_SND_S_BAD_MSG, VIRTIO_SND_S_NOT_SUPP, VIRTIO_SND_S_IO_ERR }; /* common header */ struct virtio_snd_hdr { __le32 code; }; /* event notification */ struct virtio_snd_event { /* VIRTIO_SND_EVT_XXX */ struct virtio_snd_hdr hdr; /* optional event data */ __le32 data; }; /* common control request to query an item information */ struct virtio_snd_query_info { /* VIRTIO_SND_R_XXX_INFO */ struct virtio_snd_hdr hdr; /* item start identifier */ __le32 start_id; /* item count to query */ __le32 count; /* item information size in bytes */ __le32 size; }; /* common item information header */ struct virtio_snd_info { /* function group node id (High Definition Audio Specification 7.1.2) */ __le32 hda_fn_nid; }; /******************************************************************************* * JACK CONTROL MESSAGES */ struct virtio_snd_jack_hdr { /* VIRTIO_SND_R_JACK_XXX */ struct virtio_snd_hdr hdr; /* 0 ... virtio_snd_config::jacks - 1 */ __le32 jack_id; }; /* supported jack features */ enum { VIRTIO_SND_JACK_F_REMAP = 0 }; struct virtio_snd_jack_info { /* common header */ struct virtio_snd_info hdr; /* supported feature bit map (1 << VIRTIO_SND_JACK_F_XXX) */ __le32 features; /* pin configuration (High Definition Audio Specification 7.3.3.31) */ __le32 hda_reg_defconf; /* pin capabilities (High Definition Audio Specification 7.3.4.9) */ __le32 hda_reg_caps; /* current jack connection status (0: disconnected, 1: connected) */ __u8 connected; __u8 padding[7]; }; /* jack remapping control request */ struct virtio_snd_jack_remap { /* .code = VIRTIO_SND_R_JACK_REMAP */ struct virtio_snd_jack_hdr hdr; /* selected association number */ __le32 association; /* selected sequence number */ __le32 sequence; }; /******************************************************************************* * PCM CONTROL MESSAGES */ struct virtio_snd_pcm_hdr { /* VIRTIO_SND_R_PCM_XXX */ struct virtio_snd_hdr hdr; /* 0 ... virtio_snd_config::streams - 1 */ __le32 stream_id; }; /* supported PCM stream features */ enum { VIRTIO_SND_PCM_F_SHMEM_HOST = 0, VIRTIO_SND_PCM_F_SHMEM_GUEST, VIRTIO_SND_PCM_F_MSG_POLLING, VIRTIO_SND_PCM_F_EVT_SHMEM_PERIODS, VIRTIO_SND_PCM_F_EVT_XRUNS }; /* supported PCM sample formats */ enum { /* analog formats (width / physical width) */ VIRTIO_SND_PCM_FMT_IMA_ADPCM = 0, /* 4 / 4 bits */ VIRTIO_SND_PCM_FMT_MU_LAW, /* 8 / 8 bits */ VIRTIO_SND_PCM_FMT_A_LAW, /* 8 / 8 bits */ VIRTIO_SND_PCM_FMT_S8, /* 8 / 8 bits */ VIRTIO_SND_PCM_FMT_U8, /* 8 / 8 bits */ VIRTIO_SND_PCM_FMT_S16, /* 16 / 16 bits */ VIRTIO_SND_PCM_FMT_U16, /* 16 / 16 bits */ VIRTIO_SND_PCM_FMT_S18_3, /* 18 / 24 bits */ VIRTIO_SND_PCM_FMT_U18_3, /* 18 / 24 bits */ VIRTIO_SND_PCM_FMT_S20_3, /* 20 / 24 bits */ VIRTIO_SND_PCM_FMT_U20_3, /* 20 / 24 bits */ VIRTIO_SND_PCM_FMT_S24_3, /* 24 / 24 bits */ VIRTIO_SND_PCM_FMT_U24_3, /* 24 / 24 bits */ VIRTIO_SND_PCM_FMT_S20, /* 20 / 32 bits */ VIRTIO_SND_PCM_FMT_U20, /* 20 / 32 bits */ VIRTIO_SND_PCM_FMT_S24, /* 24 / 32 bits */ VIRTIO_SND_PCM_FMT_U24, /* 24 / 32 bits */ VIRTIO_SND_PCM_FMT_S32, /* 32 / 32 bits */ VIRTIO_SND_PCM_FMT_U32, /* 32 / 32 bits */ VIRTIO_SND_PCM_FMT_FLOAT, /* 32 / 32 bits */ VIRTIO_SND_PCM_FMT_FLOAT64, /* 64 / 64 bits */ /* digital formats (width / physical width) */ VIRTIO_SND_PCM_FMT_DSD_U8, /* 8 / 8 bits */ VIRTIO_SND_PCM_FMT_DSD_U16, /* 16 / 16 bits */ VIRTIO_SND_PCM_FMT_DSD_U32, /* 32 / 32 bits */ VIRTIO_SND_PCM_FMT_IEC958_SUBFRAME /* 32 / 32 bits */ }; /* supported PCM frame rates */ enum { VIRTIO_SND_PCM_RATE_5512 = 0, VIRTIO_SND_PCM_RATE_8000, VIRTIO_SND_PCM_RATE_11025, VIRTIO_SND_PCM_RATE_16000, VIRTIO_SND_PCM_RATE_22050, VIRTIO_SND_PCM_RATE_32000, VIRTIO_SND_PCM_RATE_44100, VIRTIO_SND_PCM_RATE_48000, VIRTIO_SND_PCM_RATE_64000, VIRTIO_SND_PCM_RATE_88200, VIRTIO_SND_PCM_RATE_96000, VIRTIO_SND_PCM_RATE_176400, VIRTIO_SND_PCM_RATE_192000, VIRTIO_SND_PCM_RATE_384000 }; struct virtio_snd_pcm_info { /* common header */ struct virtio_snd_info hdr; /* supported feature bit map (1 << VIRTIO_SND_PCM_F_XXX) */ __le32 features; /* supported sample format bit map (1 << VIRTIO_SND_PCM_FMT_XXX) */ __le64 formats; /* supported frame rate bit map (1 << VIRTIO_SND_PCM_RATE_XXX) */ __le64 rates; /* dataflow direction (VIRTIO_SND_D_XXX) */ __u8 direction; /* minimum # of supported channels */ __u8 channels_min; /* maximum # of supported channels */ __u8 channels_max; __u8 padding[5]; }; /* set PCM stream format */ struct virtio_snd_pcm_set_params { /* .code = VIRTIO_SND_R_PCM_SET_PARAMS */ struct virtio_snd_pcm_hdr hdr; /* size of the hardware buffer */ __le32 buffer_bytes; /* size of the hardware period */ __le32 period_bytes; /* selected feature bit map (1 << VIRTIO_SND_PCM_F_XXX) */ __le32 features; /* selected # of channels */ __u8 channels; /* selected sample format (VIRTIO_SND_PCM_FMT_XXX) */ __u8 format; /* selected frame rate (VIRTIO_SND_PCM_RATE_XXX) */ __u8 rate; __u8 padding; }; /******************************************************************************* * PCM I/O MESSAGES */ /* I/O request header */ struct virtio_snd_pcm_xfer { /* 0 ... virtio_snd_config::streams - 1 */ __le32 stream_id; }; /* I/O request status */ struct virtio_snd_pcm_status { /* VIRTIO_SND_S_XXX */ __le32 status; /* current device latency */ __le32 latency_bytes; }; /******************************************************************************* * CHANNEL MAP CONTROL MESSAGES */ struct virtio_snd_chmap_hdr { /* VIRTIO_SND_R_CHMAP_XXX */ struct virtio_snd_hdr hdr; /* 0 ... virtio_snd_config::chmaps - 1 */ __le32 chmap_id; }; /* standard channel position definition */ enum { VIRTIO_SND_CHMAP_NONE = 0, /* undefined */ VIRTIO_SND_CHMAP_NA, /* silent */ VIRTIO_SND_CHMAP_MONO, /* mono stream */ VIRTIO_SND_CHMAP_FL, /* front left */ VIRTIO_SND_CHMAP_FR, /* front right */ VIRTIO_SND_CHMAP_RL, /* rear left */ VIRTIO_SND_CHMAP_RR, /* rear right */ VIRTIO_SND_CHMAP_FC, /* front center */ VIRTIO_SND_CHMAP_LFE, /* low frequency (LFE) */ VIRTIO_SND_CHMAP_SL, /* side left */ VIRTIO_SND_CHMAP_SR, /* side right */ VIRTIO_SND_CHMAP_RC, /* rear center */ VIRTIO_SND_CHMAP_FLC, /* front left center */ VIRTIO_SND_CHMAP_FRC, /* front right center */ VIRTIO_SND_CHMAP_RLC, /* rear left center */ VIRTIO_SND_CHMAP_RRC, /* rear right center */ VIRTIO_SND_CHMAP_FLW, /* front left wide */ VIRTIO_SND_CHMAP_FRW, /* front right wide */ VIRTIO_SND_CHMAP_FLH, /* front left high */ VIRTIO_SND_CHMAP_FCH, /* front center high */ VIRTIO_SND_CHMAP_FRH, /* front right high */ VIRTIO_SND_CHMAP_TC, /* top center */ VIRTIO_SND_CHMAP_TFL, /* top front left */ VIRTIO_SND_CHMAP_TFR, /* top front right */ VIRTIO_SND_CHMAP_TFC, /* top front center */ VIRTIO_SND_CHMAP_TRL, /* top rear left */ VIRTIO_SND_CHMAP_TRR, /* top rear right */ VIRTIO_SND_CHMAP_TRC, /* top rear center */ VIRTIO_SND_CHMAP_TFLC, /* top front left center */ VIRTIO_SND_CHMAP_TFRC, /* top front right center */ VIRTIO_SND_CHMAP_TSL, /* top side left */ VIRTIO_SND_CHMAP_TSR, /* top side right */ VIRTIO_SND_CHMAP_LLFE, /* left LFE */ VIRTIO_SND_CHMAP_RLFE, /* right LFE */ VIRTIO_SND_CHMAP_BC, /* bottom center */ VIRTIO_SND_CHMAP_BLC, /* bottom left center */ VIRTIO_SND_CHMAP_BRC /* bottom right center */ }; /* maximum possible number of channels */ #define VIRTIO_SND_CHMAP_MAX_SIZE 18 struct virtio_snd_chmap_info { /* common header */ struct virtio_snd_info hdr; /* dataflow direction (VIRTIO_SND_D_XXX) */ __u8 direction; /* # of valid channel position values */ __u8 channels; /* channel position values (VIRTIO_SND_CHMAP_XXX) */ __u8 positions[VIRTIO_SND_CHMAP_MAX_SIZE]; }; #endif /* VIRTIO_SND_IF_H */ linux/virtio_types.h 0000644 00000004151 15063602057 0010621 0 ustar 00 #ifndef _LINUX_VIRTIO_TYPES_H #define _LINUX_VIRTIO_TYPES_H /* Type definitions for virtio implementations. * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright (C) 2014 Red Hat, Inc. * Author: Michael S. Tsirkin <mst@redhat.com> */ #include <linux/types.h> /* * __virtio{16,32,64} have the following meaning: * - __u{16,32,64} for virtio devices in legacy mode, accessed in native endian * - __le{16,32,64} for standard-compliant virtio devices */ typedef __u16 __bitwise __virtio16; typedef __u32 __bitwise __virtio32; typedef __u64 __bitwise __virtio64; #endif /* _LINUX_VIRTIO_TYPES_H */ linux/virtio_vsock.h 0000644 00000006016 15063602057 0010604 0 ustar 00 /* * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so * anyone can use the definitions to implement compatible drivers/servers: * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright (C) Red Hat, Inc., 2013-2015 * Copyright (C) Asias He <asias@redhat.com>, 2013 * Copyright (C) Stefan Hajnoczi <stefanha@redhat.com>, 2015 */ #ifndef _LINUX_VIRTIO_VSOCK_H #define _LINUX_VIRTIO_VSOCK_H #include <linux/types.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> struct virtio_vsock_config { __le64 guest_cid; } __attribute__((packed)); enum virtio_vsock_event_id { VIRTIO_VSOCK_EVENT_TRANSPORT_RESET = 0, }; struct virtio_vsock_event { __le32 id; } __attribute__((packed)); struct virtio_vsock_hdr { __le64 src_cid; __le64 dst_cid; __le32 src_port; __le32 dst_port; __le32 len; __le16 type; /* enum virtio_vsock_type */ __le16 op; /* enum virtio_vsock_op */ __le32 flags; __le32 buf_alloc; __le32 fwd_cnt; } __attribute__((packed)); enum virtio_vsock_type { VIRTIO_VSOCK_TYPE_STREAM = 1, }; enum virtio_vsock_op { VIRTIO_VSOCK_OP_INVALID = 0, /* Connect operations */ VIRTIO_VSOCK_OP_REQUEST = 1, VIRTIO_VSOCK_OP_RESPONSE = 2, VIRTIO_VSOCK_OP_RST = 3, VIRTIO_VSOCK_OP_SHUTDOWN = 4, /* To send payload */ VIRTIO_VSOCK_OP_RW = 5, /* Tell the peer our credit info */ VIRTIO_VSOCK_OP_CREDIT_UPDATE = 6, /* Request the peer to send the credit info to us */ VIRTIO_VSOCK_OP_CREDIT_REQUEST = 7, }; /* VIRTIO_VSOCK_OP_SHUTDOWN flags values */ enum virtio_vsock_shutdown { VIRTIO_VSOCK_SHUTDOWN_RCV = 1, VIRTIO_VSOCK_SHUTDOWN_SEND = 2, }; #endif /* _LINUX_VIRTIO_VSOCK_H */ linux/vm_sockets.h 0000644 00000014536 15063602057 0010246 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * VMware vSockets Driver * * Copyright (C) 2007-2013 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation version 2 and no later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #ifndef _VM_SOCKETS_H #define _VM_SOCKETS_H #include <linux/socket.h> #include <linux/types.h> /* Option name for STREAM socket buffer size. Use as the option name in * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that * specifies the size of the buffer underlying a vSockets STREAM socket. * Value is clamped to the MIN and MAX. */ #define SO_VM_SOCKETS_BUFFER_SIZE 0 /* Option name for STREAM socket minimum buffer size. Use as the option name * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long that * specifies the minimum size allowed for the buffer underlying a vSockets * STREAM socket. */ #define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1 /* Option name for STREAM socket maximum buffer size. Use as the option name * in setsockopt(3) or getsockopt(3) to set or get an unsigned long long * that specifies the maximum size allowed for the buffer underlying a * vSockets STREAM socket. */ #define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2 /* Option name for socket peer's host-specific VM ID. Use as the option name * in getsockopt(3) to get a host-specific identifier for the peer endpoint's * VM. The identifier is a signed integer. * Only available for hypervisor endpoints. */ #define SO_VM_SOCKETS_PEER_HOST_VM_ID 3 /* Option name for determining if a socket is trusted. Use as the option name * in getsockopt(3) to determine if a socket is trusted. The value is a * signed integer. */ #define SO_VM_SOCKETS_TRUSTED 5 /* Option name for STREAM socket connection timeout. Use as the option name * in setsockopt(3) or getsockopt(3) to set or get the connection * timeout for a STREAM socket. */ #define SO_VM_SOCKETS_CONNECT_TIMEOUT 6 /* Option name for using non-blocking send/receive. Use as the option name * for setsockopt(3) or getsockopt(3) to set or get the non-blocking * transmit/receive flag for a STREAM socket. This flag determines whether * send() and recv() can be called in non-blocking contexts for the given * socket. The value is a signed integer. * * This option is only relevant to kernel endpoints, where descheduling the * thread of execution is not allowed, for example, while holding a spinlock. * It is not to be confused with conventional non-blocking socket operations. * * Only available for hypervisor endpoints. */ #define SO_VM_SOCKETS_NONBLOCK_TXRX 7 /* The vSocket equivalent of INADDR_ANY. This works for the svm_cid field of * sockaddr_vm and indicates the context ID of the current endpoint. */ #define VMADDR_CID_ANY -1U /* Bind to any available port. Works for the svm_port field of * sockaddr_vm. */ #define VMADDR_PORT_ANY -1U /* Use this as the destination CID in an address when referring to the * hypervisor. VMCI relies on it being 0, but this would be useful for other * transports too. */ #define VMADDR_CID_HYPERVISOR 0 /* Use this as the destination CID in an address when referring to the * local communication (loopback). * (This was VMADDR_CID_RESERVED, but even VMCI doesn't use it anymore, * it was a legacy value from an older release). */ #define VMADDR_CID_LOCAL 1 /* Use this as the destination CID in an address when referring to the host * (any process other than the hypervisor). VMCI relies on it being 2, but * this would be useful for other transports too. */ #define VMADDR_CID_HOST 2 /* The current default use case for the vsock channel is the following: * local vsock communication between guest and host and nested VMs setup. * In addition to this, implicitly, the vsock packets are forwarded to the host * if no host->guest vsock transport is set. * * Set this flag value in the sockaddr_vm corresponding field if the vsock * packets need to be always forwarded to the host. Using this behavior, * vsock communication between sibling VMs can be setup. * * This way can explicitly distinguish between vsock channels created for * different use cases, such as nested VMs (or local communication between * guest and host) and sibling VMs. * * The flag can be set in the connect logic in the user space application flow. * In the listen logic (from kernel space) the flag is set on the remote peer * address. This happens for an incoming connection when it is routed from the * host and comes from the guest (local CID and remote CID > VMADDR_CID_HOST). */ #define VMADDR_FLAG_TO_HOST 0x01 /* Invalid vSockets version. */ #define VM_SOCKETS_INVALID_VERSION -1U /* The epoch (first) component of the vSockets version. A single byte * representing the epoch component of the vSockets version. */ #define VM_SOCKETS_VERSION_EPOCH(_v) (((_v) & 0xFF000000) >> 24) /* The major (second) component of the vSockets version. A single byte * representing the major component of the vSockets version. Typically * changes for every major release of a product. */ #define VM_SOCKETS_VERSION_MAJOR(_v) (((_v) & 0x00FF0000) >> 16) /* The minor (third) component of the vSockets version. Two bytes representing * the minor component of the vSockets version. */ #define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF)) /* Address structure for vSockets. The address family should be set to * AF_VSOCK. The structure members should all align on their natural * boundaries without resorting to compiler packing directives. The total size * of this structure should be exactly the same as that of struct sockaddr. */ struct sockaddr_vm { __kernel_sa_family_t svm_family; unsigned short svm_reserved1; unsigned int svm_port; unsigned int svm_cid; __u8 svm_flags; unsigned char svm_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - sizeof(unsigned short) - sizeof(unsigned int) - sizeof(unsigned int) - sizeof(__u8)]; }; #define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9) #endif /* _VM_SOCKETS_H */ linux/vm_sockets_diag.h 0000644 00000001703 15063602057 0011222 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* AF_VSOCK sock_diag(7) interface for querying open sockets */ #ifndef __VM_SOCKETS_DIAG_H__ #define __VM_SOCKETS_DIAG_H__ #include <linux/types.h> /* Request */ struct vsock_diag_req { __u8 sdiag_family; /* must be AF_VSOCK */ __u8 sdiag_protocol; /* must be 0 */ __u16 pad; /* must be 0 */ __u32 vdiag_states; /* query bitmap (e.g. 1 << TCP_LISTEN) */ __u32 vdiag_ino; /* must be 0 (reserved) */ __u32 vdiag_show; /* must be 0 (reserved) */ __u32 vdiag_cookie[2]; }; /* Response */ struct vsock_diag_msg { __u8 vdiag_family; /* AF_VSOCK */ __u8 vdiag_type; /* SOCK_STREAM or SOCK_DGRAM */ __u8 vdiag_state; /* sk_state (e.g. TCP_LISTEN) */ __u8 vdiag_shutdown; /* local RCV_SHUTDOWN | SEND_SHUTDOWN */ __u32 vdiag_src_cid; __u32 vdiag_src_port; __u32 vdiag_dst_cid; __u32 vdiag_dst_port; __u32 vdiag_ino; __u32 vdiag_cookie[2]; }; #endif /* __VM_SOCKETS_DIAG_H__ */ linux/vmcore.h 0000644 00000000657 15063602057 0007363 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VMCORE_H #define _VMCORE_H #include <linux/types.h> #define VMCOREDD_NOTE_NAME "LINUX" #define VMCOREDD_MAX_NAME_BYTES 44 struct vmcoredd_header { __u32 n_namesz; /* Name size */ __u32 n_descsz; /* Content size */ __u32 n_type; /* NT_VMCOREDD */ __u8 name[8]; /* LINUX\0\0\0 */ __u8 dump_name[VMCOREDD_MAX_NAME_BYTES]; /* Device dump's name */ }; #endif /* _VMCORE_H */ linux/vsockmon.h 0000644 00000003535 15063602057 0007725 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _VSOCKMON_H #define _VSOCKMON_H #include <linux/virtio_vsock.h> /* * vsockmon is the AF_VSOCK packet capture device. Packets captured have the * following layout: * * +-----------------------------------+ * | vsockmon header | * | (struct af_vsockmon_hdr) | * +-----------------------------------+ * | transport header | * | (af_vsockmon_hdr->len bytes long) | * +-----------------------------------+ * | payload | * | (until end of packet) | * +-----------------------------------+ * * The vsockmon header is a transport-independent description of the packet. * It duplicates some of the information from the transport header so that * no transport-specific knowledge is necessary to process packets. * * The transport header is useful for low-level transport-specific packet * analysis. Transport type is given in af_vsockmon_hdr->transport and * transport header length is given in af_vsockmon_hdr->len. * * If af_vsockmon_hdr->op is AF_VSOCK_OP_PAYLOAD then the payload follows the * transport header. Other ops do not have a payload. */ struct af_vsockmon_hdr { __le64 src_cid; __le64 dst_cid; __le32 src_port; __le32 dst_port; __le16 op; /* enum af_vsockmon_op */ __le16 transport; /* enum af_vsockmon_transport */ __le16 len; /* Transport header length */ __u8 reserved[2]; }; enum af_vsockmon_op { AF_VSOCK_OP_UNKNOWN = 0, AF_VSOCK_OP_CONNECT = 1, AF_VSOCK_OP_DISCONNECT = 2, AF_VSOCK_OP_CONTROL = 3, AF_VSOCK_OP_PAYLOAD = 4, }; enum af_vsockmon_transport { AF_VSOCK_TRANSPORT_UNKNOWN = 0, AF_VSOCK_TRANSPORT_NO_INFO = 1, /* No transport information */ /* Transport header type: struct virtio_vsock_hdr */ AF_VSOCK_TRANSPORT_VIRTIO = 2, }; #endif linux/vt.h 0000644 00000005763 15063602057 0006524 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_VT_H #define _LINUX_VT_H /* * These constants are also useful for user-level apps (e.g., VC * resizing). */ #define MIN_NR_CONSOLES 1 /* must be at least 1 */ #define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ /* Note: the ioctl VT_GETSTATE does not work for consoles 16 and higher (since it returns a short) */ /* 0x56 is 'V', to avoid collision with termios and kd */ #define VT_OPENQRY 0x5600 /* find available vt */ struct vt_mode { char mode; /* vt mode */ char waitv; /* if set, hang on writes if not active */ short relsig; /* signal to raise on release req */ short acqsig; /* signal to raise on acquisition */ short frsig; /* unused (set to 0) */ }; #define VT_GETMODE 0x5601 /* get mode of active vt */ #define VT_SETMODE 0x5602 /* set mode of active vt */ #define VT_AUTO 0x00 /* auto vt switching */ #define VT_PROCESS 0x01 /* process controls switching */ #define VT_ACKACQ 0x02 /* acknowledge switch */ struct vt_stat { unsigned short v_active; /* active vt */ unsigned short v_signal; /* signal to send */ unsigned short v_state; /* vt bitmask */ }; #define VT_GETSTATE 0x5603 /* get global vt state info */ #define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ #define VT_RELDISP 0x5605 /* release display */ #define VT_ACTIVATE 0x5606 /* make vt active */ #define VT_WAITACTIVE 0x5607 /* wait for vt active */ #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ struct vt_sizes { unsigned short v_rows; /* number of rows */ unsigned short v_cols; /* number of columns */ unsigned short v_scrollsize; /* number of lines of scrollback */ }; #define VT_RESIZE 0x5609 /* set kernel's idea of screensize */ struct vt_consize { unsigned short v_rows; /* number of rows */ unsigned short v_cols; /* number of columns */ unsigned short v_vlin; /* number of pixel rows on screen */ unsigned short v_clin; /* number of pixel rows per character */ unsigned short v_vcol; /* number of pixel columns on screen */ unsigned short v_ccol; /* number of pixel columns per character */ }; #define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */ #define VT_LOCKSWITCH 0x560B /* disallow vt switching */ #define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ #define VT_GETHIFONTMASK 0x560D /* return hi font mask */ struct vt_event { unsigned int event; #define VT_EVENT_SWITCH 0x0001 /* Console switch */ #define VT_EVENT_BLANK 0x0002 /* Screen blank */ #define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */ #define VT_EVENT_RESIZE 0x0008 /* Resize display */ #define VT_MAX_EVENT 0x000F unsigned int oldev; /* Old console */ unsigned int newev; /* New console (if changing) */ unsigned int pad[4]; /* Padding for expansion */ }; #define VT_WAITEVENT 0x560E /* Wait for an event */ struct vt_setactivate { unsigned int console; struct vt_mode mode; }; #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ #endif /* _LINUX_VT_H */ linux/vtpm_proxy.h 0000644 00000003267 15063602057 0010317 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for the VTPM proxy driver * Copyright (c) 2015, 2016, IBM Corporation * Copyright (C) 2016 Intel Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #ifndef _LINUX_VTPM_PROXY_H #define _LINUX_VTPM_PROXY_H #include <linux/types.h> #include <linux/ioctl.h> /** * enum vtpm_proxy_flags - flags for the proxy TPM * @VTPM_PROXY_FLAG_TPM2: the proxy TPM uses TPM 2.0 protocol */ enum vtpm_proxy_flags { VTPM_PROXY_FLAG_TPM2 = 1, }; /** * struct vtpm_proxy_new_dev - parameter structure for the * %VTPM_PROXY_IOC_NEW_DEV ioctl * @flags: flags for the proxy TPM * @tpm_num: index of the TPM device * @fd: the file descriptor used by the proxy TPM * @major: the major number of the TPM device * @minor: the minor number of the TPM device */ struct vtpm_proxy_new_dev { __u32 flags; /* input */ __u32 tpm_num; /* output */ __u32 fd; /* output */ __u32 major; /* output */ __u32 minor; /* output */ }; #define VTPM_PROXY_IOC_NEW_DEV _IOWR(0xa1, 0x00, struct vtpm_proxy_new_dev) /* vendor specific commands to set locality */ #define TPM2_CC_SET_LOCALITY 0x20001000 #define TPM_ORD_SET_LOCALITY 0x20001000 #endif /* _LINUX_VTPM_PROXY_H */ linux/wait.h 0000644 00000001252 15063602057 0007024 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_WAIT_H #define _LINUX_WAIT_H #define WNOHANG 0x00000001 #define WUNTRACED 0x00000002 #define WSTOPPED WUNTRACED #define WEXITED 0x00000004 #define WCONTINUED 0x00000008 #define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ #define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ #define __WALL 0x40000000 /* Wait on all children, regardless of type */ #define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */ /* First argument to waitid: */ #define P_ALL 0 #define P_PID 1 #define P_PGID 2 #define P_PIDFD 3 #endif /* _LINUX_WAIT_H */ linux/wanrouter.h 0000644 00000000705 15063602057 0010110 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * wanrouter.h Legacy declarations kept around until X25 is removed */ #ifndef _ROUTER_H #define _ROUTER_H /* 'state' defines */ enum wan_states { WAN_UNCONFIGURED, /* link/channel is not configured */ WAN_DISCONNECTED, /* link/channel is disconnected */ WAN_CONNECTING, /* connection is in progress */ WAN_CONNECTED /* link/channel is operational */ }; #endif /* _ROUTER_H */ linux/watchdog.h 0000644 00000004437 15063602057 0007670 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Generic watchdog defines. Derived from.. * * Berkshire PC Watchdog Defines * by Ken Hollis <khollis@bitgate.com> * */ #ifndef _LINUX_WATCHDOG_H #define _LINUX_WATCHDOG_H #include <linux/ioctl.h> #include <linux/types.h> #define WATCHDOG_IOCTL_BASE 'W' struct watchdog_info { __u32 options; /* Options the card/driver supports */ __u32 firmware_version; /* Firmware version of the card */ __u8 identity[32]; /* Identity of the board */ }; #define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info) #define WDIOC_GETSTATUS _IOR(WATCHDOG_IOCTL_BASE, 1, int) #define WDIOC_GETBOOTSTATUS _IOR(WATCHDOG_IOCTL_BASE, 2, int) #define WDIOC_GETTEMP _IOR(WATCHDOG_IOCTL_BASE, 3, int) #define WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int) #define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) #define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) #define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) #define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int) #define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int) #define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int) #define WDIOF_UNKNOWN -1 /* Unknown flag error */ #define WDIOS_UNKNOWN -1 /* Unknown status error */ #define WDIOF_OVERHEAT 0x0001 /* Reset due to CPU overheat */ #define WDIOF_FANFAULT 0x0002 /* Fan failed */ #define WDIOF_EXTERN1 0x0004 /* External relay 1 */ #define WDIOF_EXTERN2 0x0008 /* External relay 2 */ #define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ #define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ #define WDIOF_POWEROVER 0x0040 /* Power over voltage */ #define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ #define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ #define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */ #define WDIOF_ALARMONLY 0x0400 /* Watchdog triggers a management or other external alarm not a reboot */ #define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ #define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ #define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ #define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ #endif /* _LINUX_WATCHDOG_H */ linux/wimax.h 0000644 00000020263 15063602057 0007210 0 ustar 00 /* * Linux WiMax * API for user space * * * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * Intel Corporation <linux-wimax@intel.com> * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> * - Initial implementation * * * This file declares the user/kernel protocol that is spoken over * Generic Netlink, as well as any type declaration that is to be used * by kernel and user space. * * It is intended for user space to clone it verbatim to use it as a * primary reference for definitions. * * Stuff intended for kernel usage as well as full protocol and stack * documentation is rooted in include/net/wimax.h. */ #ifndef __LINUX__WIMAX_H__ #define __LINUX__WIMAX_H__ #include <linux/types.h> enum { /** * Version of the interface (unsigned decimal, MMm, max 25.5) * M - Major: change if removing or modifying an existing call. * m - minor: change when adding a new call */ WIMAX_GNL_VERSION = 01, /* Generic NetLink attributes */ WIMAX_GNL_ATTR_INVALID = 0x00, WIMAX_GNL_ATTR_MAX = 10, }; /* * Generic NetLink operations * * Most of these map to an API call; _OP_ stands for operation, _RP_ * for reply and _RE_ for report (aka: signal). */ enum { WIMAX_GNL_OP_MSG_FROM_USER, /* User to kernel message */ WIMAX_GNL_OP_MSG_TO_USER, /* Kernel to user message */ WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */ WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */ WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */ WIMAX_GNL_OP_STATE_GET, /* Request for current state */ }; /* Message from user / to user */ enum { WIMAX_GNL_MSG_IFIDX = 1, WIMAX_GNL_MSG_PIPE_NAME, WIMAX_GNL_MSG_DATA, }; /* * wimax_rfkill() * * The state of the radio (ON/OFF) is mapped to the rfkill subsystem's * switch state (DISABLED/ENABLED). */ enum wimax_rf_state { WIMAX_RF_OFF = 0, /* Radio is off, rfkill on/enabled */ WIMAX_RF_ON = 1, /* Radio is on, rfkill off/disabled */ WIMAX_RF_QUERY = 2, }; /* Attributes */ enum { WIMAX_GNL_RFKILL_IFIDX = 1, WIMAX_GNL_RFKILL_STATE, }; /* Attributes for wimax_reset() */ enum { WIMAX_GNL_RESET_IFIDX = 1, }; /* Attributes for wimax_state_get() */ enum { WIMAX_GNL_STGET_IFIDX = 1, }; /* * Attributes for the Report State Change * * For now we just have the old and new states; new attributes might * be added later on. */ enum { WIMAX_GNL_STCH_IFIDX = 1, WIMAX_GNL_STCH_STATE_OLD, WIMAX_GNL_STCH_STATE_NEW, }; /** * enum wimax_st - The different states of a WiMAX device * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed, * but still wimax_dev_add() hasn't been called. There is no state. * * @WIMAX_ST_DOWN: The device has been registered with the WiMAX and * networking stacks, but it is not initialized (normally that is * done with 'ifconfig DEV up' [or equivalent], which can upload * firmware and enable communications with the device). * In this state, the device is powered down and using as less * power as possible. * This state is the default after a call to wimax_dev_add(). It * is ok to have drivers move directly to %WIMAX_ST_UNINITIALIZED * or %WIMAX_ST_RADIO_OFF in _probe() after the call to * wimax_dev_add(). * It is recommended that the driver leaves this state when * calling 'ifconfig DEV up' and enters it back on 'ifconfig DEV * down'. * * @__WIMAX_ST_QUIESCING: The device is being torn down, so no API * operations are allowed to proceed except the ones needed to * complete the device clean up process. * * @WIMAX_ST_UNINITIALIZED: [optional] Communication with the device * is setup, but the device still requires some configuration * before being operational. * Some WiMAX API calls might work. * * @WIMAX_ST_RADIO_OFF: The device is fully up; radio is off (wether * by hardware or software switches). * It is recommended to always leave the device in this state * after initialization. * * @WIMAX_ST_READY: The device is fully up and radio is on. * * @WIMAX_ST_SCANNING: [optional] The device has been instructed to * scan. In this state, the device cannot be actively connected to * a network. * * @WIMAX_ST_CONNECTING: The device is connecting to a network. This * state exists because in some devices, the connect process can * include a number of negotiations between user space, kernel * space and the device. User space needs to know what the device * is doing. If the connect sequence in a device is atomic and * fast, the device can transition directly to CONNECTED * * @WIMAX_ST_CONNECTED: The device is connected to a network. * * @__WIMAX_ST_INVALID: This is an invalid state used to mark the * maximum numeric value of states. * * Description: * * Transitions from one state to another one are atomic and can only * be caused in kernel space with wimax_state_change(). To read the * state, use wimax_state_get(). * * States starting with __ are internal and shall not be used or * referred to by drivers or userspace. They look ugly, but that's the * point -- if any use is made non-internal to the stack, it is easier * to catch on review. * * All API operations [with well defined exceptions] will take the * device mutex before starting and then check the state. If the state * is %__WIMAX_ST_NULL, %WIMAX_ST_DOWN, %WIMAX_ST_UNINITIALIZED or * %__WIMAX_ST_QUIESCING, it will drop the lock and quit with * -%EINVAL, -%ENOMEDIUM, -%ENOTCONN or -%ESHUTDOWN. * * The order of the definitions is important, so we can do numerical * comparisons (eg: < %WIMAX_ST_RADIO_OFF means the device is not ready * to operate). */ /* * The allowed state transitions are described in the table below * (states in rows can go to states in columns where there is an X): * * UNINI RADIO READY SCAN CONNEC CONNEC * NULL DOWN QUIESCING TIALIZED OFF NING TING TED * NULL - x * DOWN - x x x * QUIESCING x - * UNINITIALIZED x - x * RADIO_OFF x - x * READY x x - x x x * SCANNING x x x - x x * CONNECTING x x x x - x * CONNECTED x x x - * * This table not available in kernel-doc because the formatting messes it up. */ enum wimax_st { __WIMAX_ST_NULL = 0, WIMAX_ST_DOWN, __WIMAX_ST_QUIESCING, WIMAX_ST_UNINITIALIZED, WIMAX_ST_RADIO_OFF, WIMAX_ST_READY, WIMAX_ST_SCANNING, WIMAX_ST_CONNECTING, WIMAX_ST_CONNECTED, __WIMAX_ST_INVALID /* Always keep last */ }; #endif /* #ifndef __LINUX__WIMAX_H__ */ linux/wireless.h 0000644 00000123317 15063602057 0007724 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file define a set of standard wireless extensions * * Version : 22 16.3.07 * * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. */ #ifndef _LINUX_WIRELESS_H #define _LINUX_WIRELESS_H /************************** DOCUMENTATION **************************/ /* * Initial APIs (1996 -> onward) : * ----------------------------- * Basically, the wireless extensions are for now a set of standard ioctl * call + /proc/net/wireless * * The entry /proc/net/wireless give statistics and information on the * driver. * This is better than having each driver having its entry because * its centralised and we may remove the driver module safely. * * Ioctl are used to configure the driver and issue commands. This is * better than command line options of insmod because we may want to * change dynamically (while the driver is running) some parameters. * * The ioctl mechanimsm are copied from standard devices ioctl. * We have the list of command plus a structure descibing the * data exchanged... * Note that to add these ioctl, I was obliged to modify : * # net/core/dev.c (two place + add include) * # net/ipv4/af_inet.c (one place + add include) * * /proc/net/wireless is a copy of /proc/net/dev. * We have a structure for data passed from the driver to /proc/net/wireless * Too add this, I've modified : * # net/core/dev.c (two other places) * # include/linux/netdevice.h (one place) * # include/linux/proc_fs.h (one place) * * New driver API (2002 -> onward) : * ------------------------------- * This file is only concerned with the user space API and common definitions. * The new driver API is defined and documented in : * # include/net/iw_handler.h * * Note as well that /proc/net/wireless implementation has now moved in : * # net/core/wireless.c * * Wireless Events (2002 -> onward) : * -------------------------------- * Events are defined at the end of this file, and implemented in : * # net/core/wireless.c * * Other comments : * -------------- * Do not add here things that are redundant with other mechanisms * (drivers init, ifconfig, /proc/net/dev, ...) and with are not * wireless specific. * * These wireless extensions are not magic : each driver has to provide * support for them... * * IMPORTANT NOTE : As everything in the kernel, this is very much a * work in progress. Contact me if you have ideas of improvements... */ /***************************** INCLUDES *****************************/ #include <linux/types.h> /* for __u* and __s* typedefs */ #include <linux/socket.h> /* for "struct sockaddr" et al */ #include <linux/if.h> /* for IFNAMSIZ and co... */ /***************************** VERSION *****************************/ /* * This constant is used to know the availability of the wireless * extensions and to know which version of wireless extensions it is * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */ #define WIRELESS_EXT 22 /* * Changes : * * V2 to V3 * -------- * Alan Cox start some incompatibles changes. I've integrated a bit more. * - Encryption renamed to Encode to avoid US regulation problems * - Frequency changed from float to struct to avoid problems on old 386 * * V3 to V4 * -------- * - Add sensitivity * * V4 to V5 * -------- * - Missing encoding definitions in range * - Access points stuff * * V5 to V6 * -------- * - 802.11 support (ESSID ioctls) * * V6 to V7 * -------- * - define IW_ESSID_MAX_SIZE and IW_MAX_AP * * V7 to V8 * -------- * - Changed my e-mail address * - More 802.11 support (nickname, rate, rts, frag) * - List index in frequencies * * V8 to V9 * -------- * - Support for 'mode of operation' (ad-hoc, managed...) * - Support for unicast and multicast power saving * - Change encoding to support larger tokens (>64 bits) * - Updated iw_params (disable, flags) and use it for NWID * - Extracted iw_point from iwreq for clarity * * V9 to V10 * --------- * - Add PM capability to range structure * - Add PM modifier : MAX/MIN/RELATIVE * - Add encoding option : IW_ENCODE_NOKEY * - Add TxPower ioctls (work like TxRate) * * V10 to V11 * ---------- * - Add WE version in range (help backward/forward compatibility) * - Add retry ioctls (work like PM) * * V11 to V12 * ---------- * - Add SIOCSIWSTATS to get /proc/net/wireless programatically * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space * - Add new statistics (frag, retry, beacon) * - Add average quality (for user space calibration) * * V12 to V13 * ---------- * - Document creation of new driver API. * - Extract union iwreq_data from struct iwreq (for new driver API). * - Rename SIOCSIWNAME as SIOCSIWCOMMIT * * V13 to V14 * ---------- * - Wireless Events support : define struct iw_event * - Define additional specific event numbers * - Add "addr" and "param" fields in union iwreq_data * - AP scanning stuff (SIOCSIWSCAN and friends) * * V14 to V15 * ---------- * - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg * - Make struct iw_freq signed (both m & e), add explicit padding * - Add IWEVCUSTOM for driver specific event/scanning token * - Add IW_MAX_GET_SPY for driver returning a lot of addresses * - Add IW_TXPOW_RANGE for range of Tx Powers * - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points * - Add IW_MODE_MONITOR for passive monitor * * V15 to V16 * ---------- * - Increase the number of bitrates in iw_range to 32 (for 802.11g) * - Increase the number of frequencies in iw_range to 32 (for 802.11b+a) * - Reshuffle struct iw_range for increases, add filler * - Increase IW_MAX_AP to 64 for driver returning a lot of addresses * - Remove IW_MAX_GET_SPY because conflict with enhanced spy support * - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy" * - Add IW_ENCODE_TEMP and iw_range->encoding_login_index * * V16 to V17 * ---------- * - Add flags to frequency -> auto/fixed * - Document (struct iw_quality *)->updated, add new flags (INVALID) * - Wireless Event capability in struct iw_range * - Add support for relative TxPower (yick !) * * V17 to V18 (From Jouni Malinen <j@w1.fi>) * ---------- * - Add support for WPA/WPA2 * - Add extended encoding configuration (SIOCSIWENCODEEXT and * SIOCGIWENCODEEXT) * - Add SIOCSIWGENIE/SIOCGIWGENIE * - Add SIOCSIWMLME * - Add SIOCSIWPMKSA * - Add struct iw_range bit field for supported encoding capabilities * - Add optional scan request parameters for SIOCSIWSCAN * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA * related parameters (extensible up to 4096 parameter values) * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE, * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND * * V18 to V19 * ---------- * - Remove (struct iw_point *)->pointer from events and streams * - Remove header includes to help user space * - Increase IW_ENCODING_TOKEN_MAX from 32 to 64 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros * * V19 to V20 * ---------- * - RtNetlink requests support (SET/GET) * * V20 to V21 * ---------- * - Remove (struct net_device *)->get_wireless_stats() * - Change length in ESSID and NICK to strlen() instead of strlen()+1 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers * - Power/Retry relative values no longer * 100000 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI * * V21 to V22 * ---------- * - Prevent leaking of kernel space in stream on 64 bits. */ /**************************** CONSTANTS ****************************/ /* -------------------------- IOCTL LIST -------------------------- */ /* Wireless Identification */ #define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ #define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ /* SIOCGIWNAME is used to verify the presence of Wireless Extensions. * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"... * Don't put the name of your driver there, it's useless. */ /* Basic operations */ #define SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */ #define SIOCGIWNWID 0x8B03 /* get network id (the cell) */ #define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */ #define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */ #define SIOCSIWMODE 0x8B06 /* set operation mode */ #define SIOCGIWMODE 0x8B07 /* get operation mode */ #define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */ #define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */ /* Informative stuff */ #define SIOCSIWRANGE 0x8B0A /* Unused */ #define SIOCGIWRANGE 0x8B0B /* Get range of parameters */ #define SIOCSIWPRIV 0x8B0C /* Unused */ #define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ #define SIOCSIWSTATS 0x8B0E /* Unused */ #define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */ /* SIOCGIWSTATS is strictly used between user space and the kernel, and * is never passed to the driver (i.e. the driver will never see it). */ /* Spy support (statistics per MAC address - used for Mobile IP support) */ #define SIOCSIWSPY 0x8B10 /* set spy addresses */ #define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */ #define SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */ #define SIOCGIWTHRSPY 0x8B13 /* get spy threshold */ /* Access Point manipulation */ #define SIOCSIWAP 0x8B14 /* set access point MAC addresses */ #define SIOCGIWAP 0x8B15 /* get access point MAC addresses */ #define SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */ #define SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */ #define SIOCGIWSCAN 0x8B19 /* get scanning results */ /* 802.11 specific support */ #define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */ #define SIOCGIWESSID 0x8B1B /* get ESSID */ #define SIOCSIWNICKN 0x8B1C /* set node name/nickname */ #define SIOCGIWNICKN 0x8B1D /* get node name/nickname */ /* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit * within the 'iwreq' structure, so we need to use the 'data' member to * point to a string in user space, like it is done for RANGE... */ /* Other parameters useful in 802.11 and some other devices */ #define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */ #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ #define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */ #define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */ #define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ #define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ #define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */ #define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */ #define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */ #define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */ /* Encoding stuff (scrambling, hardware security, WEP...) */ #define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ #define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ /* Power saving stuff (power management, unicast and multicast) */ #define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ #define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). * This ioctl uses struct iw_point and data buffer that includes IE id and len * fields. More than one IE may be included in the request. Setting the generic * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers * are required to report the used IE as a wireless event, e.g., when * associating with an AP. */ #define SIOCSIWGENIE 0x8B30 /* set generic IE */ #define SIOCGIWGENIE 0x8B31 /* get generic IE */ /* WPA : IEEE 802.11 MLME requests */ #define SIOCSIWMLME 0x8B16 /* request MLME operation; uses * struct iw_mlme */ /* WPA : Authentication mode parameters */ #define SIOCSIWAUTH 0x8B32 /* set authentication mode params */ #define SIOCGIWAUTH 0x8B33 /* get authentication mode params */ /* WPA : Extended version of encoding configuration */ #define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ #define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ /* WPA2 : PMKSA cache management */ #define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ /* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ /* These 32 ioctl are wireless device private, for 16 commands. * Each driver is free to use them for whatever purpose it chooses, * however the driver *must* export the description of those ioctls * with SIOCGIWPRIV and *must* use arguments as defined below. * If you don't follow those rules, DaveM is going to hate you (reason : * it make mixed 32/64bit operation impossible). */ #define SIOCIWFIRSTPRIV 0x8BE0 #define SIOCIWLASTPRIV 0x8BFF /* Previously, we were using SIOCDEVPRIVATE, but we now have our * separate range because of collisions with other tools such as * 'mii-tool'. * We now have 32 commands, so a bit more space ;-). * Also, all 'even' commands are only usable by root and don't return the * content of ifr/iwr to user (but you are not obliged to use the set/get * convention, just use every other two command). More details in iwpriv.c. * And I repeat : you are not forced to use them with iwpriv, but you * must be compliant with it. */ /* ------------------------- IOCTL STUFF ------------------------- */ /* The first and the last (range) */ #define SIOCIWFIRST 0x8B00 #define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ #define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) #define IW_HANDLER(id, func) \ [IW_IOCTL_IDX(id)] = func /* Odd : get (world access), even : set (root access) */ #define IW_IS_SET(cmd) (!((cmd) & 0x1)) #define IW_IS_GET(cmd) ((cmd) & 0x1) /* ----------------------- WIRELESS EVENTS ----------------------- */ /* Those are *NOT* ioctls, do not issue request on them !!! */ /* Most events use the same identifier as ioctl requests */ #define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */ #define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */ #define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ #define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ #define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ #define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..) * (scan results); This includes id and * length fields. One IWEVGENIE may * contain more than one IE. Scan * results may contain one or more * IWEVGENIE events. */ #define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure * (struct iw_michaelmicfailure) */ #define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request. * The data includes id and length * fields and may contain more than one * IE. This event is required in * Managed mode if the driver * generates its own WPA/RSN IE. This * should be sent just before * IWEVREGISTERED event for the * association. */ #define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association * Response. The data includes id and * length fields and may contain more * than one IE. This may be sent * between IWEVASSOCREQIE and * IWEVREGISTERED events for the * association. */ #define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN * pre-authentication * (struct iw_pmkid_cand) */ #define IWEVFIRST 0x8C00 #define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST) /* ------------------------- PRIVATE INFO ------------------------- */ /* * The following is used with SIOCGIWPRIV. It allow a driver to define * the interface (name, type of data) for its private ioctl. * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV */ #define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */ #define IW_PRIV_TYPE_NONE 0x0000 #define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */ #define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */ #define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */ #define IW_PRIV_TYPE_FLOAT 0x5000 /* struct iw_freq */ #define IW_PRIV_TYPE_ADDR 0x6000 /* struct sockaddr */ #define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed number of args */ #define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */ /* * Note : if the number of args is fixed and the size < 16 octets, * instead of passing a pointer we will put args in the iwreq struct... */ /* ----------------------- OTHER CONSTANTS ----------------------- */ /* Maximum frequencies in the range struct */ #define IW_MAX_FREQUENCIES 32 /* Note : if you have something like 80 frequencies, * don't increase this constant and don't fill the frequency list. * The user will be able to set by channel anyway... */ /* Maximum bit rates in the range struct */ #define IW_MAX_BITRATES 32 /* Maximum tx powers in the range struct */ #define IW_MAX_TXPOWER 8 /* Note : if you more than 8 TXPowers, just set the max and min or * a few of them in the struct iw_range. */ /* Maximum of address that you may set with SPY */ #define IW_MAX_SPY 8 /* Maximum of address that you may get in the list of access points in range */ #define IW_MAX_AP 64 /* Maximum size of the ESSID and NICKN strings */ #define IW_ESSID_MAX_SIZE 32 /* Modes of operation */ #define IW_MODE_AUTO 0 /* Let the driver decides */ #define IW_MODE_ADHOC 1 /* Single cell network */ #define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ #define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ #define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ #define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ #define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ /* Statistics flags (bitmask in updated) */ #define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ #define IW_QUAL_LEVEL_UPDATED 0x02 #define IW_QUAL_NOISE_UPDATED 0x04 #define IW_QUAL_ALL_UPDATED 0x07 #define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */ #define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ #define IW_QUAL_LEVEL_INVALID 0x20 #define IW_QUAL_NOISE_INVALID 0x40 #define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */ #define IW_QUAL_ALL_INVALID 0x70 /* Frequency flags */ #define IW_FREQ_AUTO 0x00 /* Let the driver decides */ #define IW_FREQ_FIXED 0x01 /* Force a specific value */ /* Maximum number of size of encoding token available * they are listed in the range structure */ #define IW_MAX_ENCODING_SIZES 8 /* Maximum size of the encoding token in bytes */ #define IW_ENCODING_TOKEN_MAX 64 /* 512 bits (for now) */ /* Flags for encoding (along with the token) */ #define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ #define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */ #define IW_ENCODE_MODE 0xF000 /* Modes defined below */ #define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ #define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ #define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ #define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ #define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */ #define IW_ENCODE_TEMP 0x0400 /* Temporary key */ /* Power management flags available (along with the value, if any) */ #define IW_POWER_ON 0x0000 /* No details... */ #define IW_POWER_TYPE 0xF000 /* Type of parameter */ #define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ #define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ #define IW_POWER_MODE 0x0F00 /* Power Management mode */ #define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */ #define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */ #define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ #define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ #define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ #define IW_POWER_MODIFIER 0x000F /* Modify a parameter */ #define IW_POWER_MIN 0x0001 /* Value is a minimum */ #define IW_POWER_MAX 0x0002 /* Value is a maximum */ #define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ /* Transmit Power flags available */ #define IW_TXPOW_TYPE 0x00FF /* Type of value */ #define IW_TXPOW_DBM 0x0000 /* Value is in dBm */ #define IW_TXPOW_MWATT 0x0001 /* Value is in mW */ #define IW_TXPOW_RELATIVE 0x0002 /* Value is in arbitrary units */ #define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */ /* Retry limits and lifetime flags available */ #define IW_RETRY_ON 0x0000 /* No details... */ #define IW_RETRY_TYPE 0xF000 /* Type of parameter */ #define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ #define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ #define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */ #define IW_RETRY_MIN 0x0001 /* Value is a minimum */ #define IW_RETRY_MAX 0x0002 /* Value is a maximum */ #define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ #define IW_RETRY_SHORT 0x0010 /* Value is for short packets */ #define IW_RETRY_LONG 0x0020 /* Value is for long packets */ /* Scanning request flags */ #define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ #define IW_SCAN_ALL_ESSID 0x0001 /* Scan all ESSIDs */ #define IW_SCAN_THIS_ESSID 0x0002 /* Scan only this ESSID */ #define IW_SCAN_ALL_FREQ 0x0004 /* Scan all Frequencies */ #define IW_SCAN_THIS_FREQ 0x0008 /* Scan only this Frequency */ #define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */ #define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ #define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ #define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ /* struct iw_scan_req scan_type */ #define IW_SCAN_TYPE_ACTIVE 0 #define IW_SCAN_TYPE_PASSIVE 1 /* Maximum size of returned data */ #define IW_SCAN_MAX_DATA 4096 /* In bytes */ /* Scan capability flags - in (struct iw_range *)->scan_capa */ #define IW_SCAN_CAPA_NONE 0x00 #define IW_SCAN_CAPA_ESSID 0x01 #define IW_SCAN_CAPA_BSSID 0x02 #define IW_SCAN_CAPA_CHANNEL 0x04 #define IW_SCAN_CAPA_MODE 0x08 #define IW_SCAN_CAPA_RATE 0x10 #define IW_SCAN_CAPA_TYPE 0x20 #define IW_SCAN_CAPA_TIME 0x40 /* Max number of char in custom event - use multiple of them if needed */ #define IW_CUSTOM_MAX 256 /* In bytes */ /* Generic information element */ #define IW_GENERIC_IE_MAX 1024 /* MLME requests (SIOCSIWMLME / struct iw_mlme) */ #define IW_MLME_DEAUTH 0 #define IW_MLME_DISASSOC 1 #define IW_MLME_AUTH 2 #define IW_MLME_ASSOC 3 /* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ #define IW_AUTH_INDEX 0x0FFF #define IW_AUTH_FLAGS 0xF000 /* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the * parameter that is being set/get to; value will be read/written to * struct iw_param value field) */ #define IW_AUTH_WPA_VERSION 0 #define IW_AUTH_CIPHER_PAIRWISE 1 #define IW_AUTH_CIPHER_GROUP 2 #define IW_AUTH_KEY_MGMT 3 #define IW_AUTH_TKIP_COUNTERMEASURES 4 #define IW_AUTH_DROP_UNENCRYPTED 5 #define IW_AUTH_80211_AUTH_ALG 6 #define IW_AUTH_WPA_ENABLED 7 #define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 #define IW_AUTH_ROAMING_CONTROL 9 #define IW_AUTH_PRIVACY_INVOKED 10 #define IW_AUTH_CIPHER_GROUP_MGMT 11 #define IW_AUTH_MFP 12 /* IW_AUTH_WPA_VERSION values (bit field) */ #define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 #define IW_AUTH_WPA_VERSION_WPA 0x00000002 #define IW_AUTH_WPA_VERSION_WPA2 0x00000004 /* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT * values (bit field) */ #define IW_AUTH_CIPHER_NONE 0x00000001 #define IW_AUTH_CIPHER_WEP40 0x00000002 #define IW_AUTH_CIPHER_TKIP 0x00000004 #define IW_AUTH_CIPHER_CCMP 0x00000008 #define IW_AUTH_CIPHER_WEP104 0x00000010 #define IW_AUTH_CIPHER_AES_CMAC 0x00000020 /* IW_AUTH_KEY_MGMT values (bit field) */ #define IW_AUTH_KEY_MGMT_802_1X 1 #define IW_AUTH_KEY_MGMT_PSK 2 /* IW_AUTH_80211_AUTH_ALG values (bit field) */ #define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 #define IW_AUTH_ALG_SHARED_KEY 0x00000002 #define IW_AUTH_ALG_LEAP 0x00000004 /* IW_AUTH_ROAMING_CONTROL values */ #define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */ #define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming * control */ /* IW_AUTH_MFP (management frame protection) values */ #define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */ #define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */ #define IW_AUTH_MFP_REQUIRED 2 /* MFP required */ /* SIOCSIWENCODEEXT definitions */ #define IW_ENCODE_SEQ_MAX_SIZE 8 /* struct iw_encode_ext ->alg */ #define IW_ENCODE_ALG_NONE 0 #define IW_ENCODE_ALG_WEP 1 #define IW_ENCODE_ALG_TKIP 2 #define IW_ENCODE_ALG_CCMP 3 #define IW_ENCODE_ALG_PMK 4 #define IW_ENCODE_ALG_AES_CMAC 5 /* struct iw_encode_ext ->ext_flags */ #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 #define IW_ENCODE_EXT_GROUP_KEY 0x00000004 #define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 /* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */ #define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */ #define IW_MICFAILURE_GROUP 0x00000004 #define IW_MICFAILURE_PAIRWISE 0x00000008 #define IW_MICFAILURE_STAKEY 0x00000010 #define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported) */ /* Bit field values for enc_capa in struct iw_range */ #define IW_ENC_CAPA_WPA 0x00000001 #define IW_ENC_CAPA_WPA2 0x00000002 #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 #define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010 /* Event capability macros - in (struct iw_range *)->event_capa * Because we have more than 32 possible events, we use an array of * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ #define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ (cmd - SIOCIWFIRSTPRIV + 0x60) : \ (cmd - SIOCIWFIRST)) #define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) #define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) /* Event capability constants - event autogenerated by the kernel * This list is valid for most 802.11 devices, customise as needed... */ #define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | \ IW_EVENT_CAPA_MASK(0x8B06) | \ IW_EVENT_CAPA_MASK(0x8B1A)) #define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A)) /* "Easy" macro to set events in iw_range (less efficient) */ #define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd)) #define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; } /****************************** TYPES ******************************/ /* --------------------------- SUBTYPES --------------------------- */ /* * Generic format for most parameters that fit in an int */ struct iw_param { __s32 value; /* The value of the parameter itself */ __u8 fixed; /* Hardware should not use auto select */ __u8 disabled; /* Disable the feature */ __u16 flags; /* Various specifc flags (if any) */ }; /* * For all data larger than 16 octets, we need to use a * pointer to memory allocated in user space. */ struct iw_point { void *pointer; /* Pointer to the data (in user space) */ __u16 length; /* number of fields or size in bytes */ __u16 flags; /* Optional params */ }; /* * A frequency * For numbers lower than 10^9, we encode the number in 'm' and * set 'e' to 0 * For number greater than 10^9, we divide it by the lowest power * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')... * The power of 10 is in 'e', the result of the division is in 'm'. */ struct iw_freq { __s32 m; /* Mantissa */ __s16 e; /* Exponent */ __u8 i; /* List index (when in range struct) */ __u8 flags; /* Flags (fixed/auto) */ }; /* * Quality of the link */ struct iw_quality { __u8 qual; /* link quality (%retries, SNR, %missed beacons or better...) */ __u8 level; /* signal level (dBm) */ __u8 noise; /* noise level (dBm) */ __u8 updated; /* Flags to know if updated */ }; /* * Packet discarded in the wireless adapter due to * "wireless" specific problems... * Note : the list of counter and statistics in net_device_stats * is already pretty exhaustive, and you should use that first. * This is only additional stats... */ struct iw_discarded { __u32 nwid; /* Rx : Wrong nwid/essid */ __u32 code; /* Rx : Unable to code/decode (WEP) */ __u32 fragment; /* Rx : Can't perform MAC reassembly */ __u32 retries; /* Tx : Max MAC retries num reached */ __u32 misc; /* Others cases */ }; /* * Packet/Time period missed in the wireless adapter due to * "wireless" specific problems... */ struct iw_missed { __u32 beacon; /* Missed beacons/superframe */ }; /* * Quality range (for spy threshold) */ struct iw_thrspy { struct sockaddr addr; /* Source address (hw/mac) */ struct iw_quality qual; /* Quality of the link */ struct iw_quality low; /* Low threshold */ struct iw_quality high; /* High threshold */ }; /* * Optional data for scan request * * Note: these optional parameters are controlling parameters for the * scanning behavior, these do not apply to getting scan results * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and * provide a merged results with all BSSes even if the previous scan * request limited scanning to a subset, e.g., by specifying an SSID. * Especially, scan results are required to include an entry for the * current BSS if the driver is in Managed mode and associated with an AP. */ struct iw_scan_req { __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */ __u8 essid_len; __u8 num_channels; /* num entries in channel_list; * 0 = scan all allowed channels */ __u8 flags; /* reserved as padding; use zero, this may * be used in the future for adding flags * to request different scan behavior */ struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or * individual address of a specific BSS */ /* * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using * the current ESSID. This allows scan requests for specific ESSID * without having to change the current ESSID and potentially breaking * the current association. */ __u8 essid[IW_ESSID_MAX_SIZE]; /* * Optional parameters for changing the default scanning behavior. * These are based on the MLME-SCAN.request from IEEE Std 802.11. * TU is 1.024 ms. If these are set to 0, driver is expected to use * reasonable default values. min_channel_time defines the time that * will be used to wait for the first reply on each channel. If no * replies are received, next channel will be scanned after this. If * replies are received, total time waited on the channel is defined by * max_channel_time. */ __u32 min_channel_time; /* in TU */ __u32 max_channel_time; /* in TU */ struct iw_freq channel_list[IW_MAX_FREQUENCIES]; }; /* ------------------------- WPA SUPPORT ------------------------- */ /* * Extended data structure for get/set encoding (this is used with * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_* * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and * only the data contents changes (key data -> this structure, including * key data). * * If the new key is the first group key, it will be set as the default * TX key. Otherwise, default TX key index is only changed if * IW_ENCODE_EXT_SET_TX_KEY flag is set. * * Key will be changed with SIOCSIWENCODEEXT in all cases except for * special "change TX key index" operation which is indicated by setting * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY. * * tx_seq/rx_seq are only used when respective * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally * used only by an Authenticator (AP or an IBSS station) to get the * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for * debugging/testing. */ struct iw_encode_ext { __u32 ext_flags; /* IW_ENCODE_EXT_* */ __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast * (group) keys or unicast address for * individual keys */ __u16 alg; /* IW_ENCODE_ALG_* */ __u16 key_len; __u8 key[0]; }; /* SIOCSIWMLME data */ struct iw_mlme { __u16 cmd; /* IW_MLME_* */ __u16 reason_code; struct sockaddr addr; }; /* SIOCSIWPMKSA data */ #define IW_PMKSA_ADD 1 #define IW_PMKSA_REMOVE 2 #define IW_PMKSA_FLUSH 3 #define IW_PMKID_LEN 16 struct iw_pmksa { __u32 cmd; /* IW_PMKSA_* */ struct sockaddr bssid; __u8 pmkid[IW_PMKID_LEN]; }; /* IWEVMICHAELMICFAILURE data */ struct iw_michaelmicfailure { __u32 flags; struct sockaddr src_addr; __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ }; /* IWEVPMKIDCAND data */ #define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */ struct iw_pmkid_cand { __u32 flags; /* IW_PMKID_CAND_* */ __u32 index; /* the smaller the index, the higher the * priority */ struct sockaddr bssid; }; /* ------------------------ WIRELESS STATS ------------------------ */ /* * Wireless statistics (used for /proc/net/wireless) */ struct iw_statistics { __u16 status; /* Status * - device dependent for now */ struct iw_quality qual; /* Quality of the link * (instant/mean/max) */ struct iw_discarded discard; /* Packet discarded counts */ struct iw_missed miss; /* Packet missed counts */ }; /* ------------------------ IOCTL REQUEST ------------------------ */ /* * This structure defines the payload of an ioctl, and is used * below. * * Note that this structure should fit on the memory footprint * of iwreq (which is the same as ifreq), which mean a max size of * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... * You should check this when increasing the structures defined * above in this file... */ union iwreq_data { /* Config - generic */ char name[IFNAMSIZ]; /* Name : used to verify the presence of wireless extensions. * Name of the protocol/provider... */ struct iw_point essid; /* Extended network name */ struct iw_param nwid; /* network id (or domain - the cell) */ struct iw_freq freq; /* frequency or channel : * 0-1000 = channel * > 1000 = frequency in Hz */ struct iw_param sens; /* signal level threshold */ struct iw_param bitrate; /* default bit rate */ struct iw_param txpower; /* default transmit power */ struct iw_param rts; /* RTS threshold */ struct iw_param frag; /* Fragmentation threshold */ __u32 mode; /* Operation mode */ struct iw_param retry; /* Retry limits & lifetime */ struct iw_point encoding; /* Encoding stuff : tokens */ struct iw_param power; /* PM duration/timeout */ struct iw_quality qual; /* Quality part of statistics */ struct sockaddr ap_addr; /* Access point address */ struct sockaddr addr; /* Destination address (hw/mac) */ struct iw_param param; /* Other small parameters */ struct iw_point data; /* Other large parameters */ }; /* * The structure to exchange data for ioctl. * This structure is the same as 'struct ifreq', but (re)defined for * convenience... * Do I need to remind you about structure size (32 octets) ? */ struct iwreq { union { char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ } ifr_ifrn; /* Data part (defined just above) */ union iwreq_data u; }; /* -------------------------- IOCTL DATA -------------------------- */ /* * For those ioctl which want to exchange mode data that what could * fit in the above structure... */ /* * Range of parameters */ struct iw_range { /* Informative stuff (to choose between different interface) */ __u32 throughput; /* To give an idea... */ /* In theory this value should be the maximum benchmarked * TCP/IP throughput, because with most of these devices the * bit rate is meaningless (overhead an co) to estimate how * fast the connection will go and pick the fastest one. * I suggest people to play with Netperf or any benchmark... */ /* NWID (or domain id) */ __u32 min_nwid; /* Minimal NWID we are able to set */ __u32 max_nwid; /* Maximal NWID we are able to set */ /* Old Frequency (backward compat - moved lower ) */ __u16 old_num_channels; __u8 old_num_frequency; /* Scan capabilities */ __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */ /* Wireless event capability bitmasks */ __u32 event_capa[6]; /* signal level threshold range */ __s32 sensitivity; /* Quality of link & SNR stuff */ /* Quality range (link, level, noise) * If the quality is absolute, it will be in the range [0 ; max_qual], * if the quality is dBm, it will be in the range [max_qual ; 0]. * Don't forget that we use 8 bit arithmetics... */ struct iw_quality max_qual; /* Quality of the link */ /* This should contain the average/typical values of the quality * indicator. This should be the threshold between a "good" and * a "bad" link (example : monitor going from green to orange). * Currently, user space apps like quality monitors don't have any * way to calibrate the measurement. With this, they can split * the range between 0 and max_qual in different quality level * (using a geometric subdivision centered on the average). * I expect that people doing the user space apps will feedback * us on which value we need to put in each driver... */ struct iw_quality avg_qual; /* Quality of the link */ /* Rates */ __u8 num_bitrates; /* Number of entries in the list */ __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */ /* RTS threshold */ __s32 min_rts; /* Minimal RTS threshold */ __s32 max_rts; /* Maximal RTS threshold */ /* Frag threshold */ __s32 min_frag; /* Minimal frag threshold */ __s32 max_frag; /* Maximal frag threshold */ /* Power Management duration & timeout */ __s32 min_pmp; /* Minimal PM period */ __s32 max_pmp; /* Maximal PM period */ __s32 min_pmt; /* Minimal PM timeout */ __s32 max_pmt; /* Maximal PM timeout */ __u16 pmp_flags; /* How to decode max/min PM period */ __u16 pmt_flags; /* How to decode max/min PM timeout */ __u16 pm_capa; /* What PM options are supported */ /* Encoder stuff */ __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ __u8 num_encoding_sizes; /* Number of entry in the list */ __u8 max_encoding_tokens; /* Max number of tokens */ /* For drivers that need a "login/passwd" form */ __u8 encoding_login_index; /* token index for login token */ /* Transmit power */ __u16 txpower_capa; /* What options are supported */ __u8 num_txpower; /* Number of entries in the list */ __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */ /* Wireless Extension version info */ __u8 we_version_compiled; /* Must be WIRELESS_EXT */ __u8 we_version_source; /* Last update of source */ /* Retry limits and lifetime */ __u16 retry_capa; /* What retry options are supported */ __u16 retry_flags; /* How to decode max/min retry limit */ __u16 r_time_flags; /* How to decode max/min retry life */ __s32 min_retry; /* Minimal number of retries */ __s32 max_retry; /* Maximal number of retries */ __s32 min_r_time; /* Minimal retry lifetime */ __s32 max_r_time; /* Maximal retry lifetime */ /* Frequency */ __u16 num_channels; /* Number of channels [0; num - 1] */ __u8 num_frequency; /* Number of entry in the list */ struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ /* Note : this frequency list doesn't need to fit channel numbers, * because each entry contain its channel index */ __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ }; /* * Private ioctl interface information */ struct iw_priv_args { __u32 cmd; /* Number of the ioctl to issue */ __u16 set_args; /* Type and number of args */ __u16 get_args; /* Type and number of args */ char name[IFNAMSIZ]; /* Name of the extension */ }; /* ----------------------- WIRELESS EVENTS ----------------------- */ /* * Wireless events are carried through the rtnetlink socket to user * space. They are encapsulated in the IFLA_WIRELESS field of * a RTM_NEWLINK message. */ /* * A Wireless Event. Contains basically the same data as the ioctl... */ struct iw_event { __u16 len; /* Real length of this stuff */ __u16 cmd; /* Wireless IOCTL */ union iwreq_data u; /* IOCTL fixed payload */ }; /* Size of the Event prefix (including padding and alignement junk) */ #define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data)) /* Size of the various events */ #define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ) #define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32)) #define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq)) #define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param)) #define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr)) #define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) /* iw_point events are special. First, the payload (extra data) come at * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second, * we omit the pointer, so start at an offset. */ #define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \ (char *) NULL) #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ IW_EV_POINT_OFF) /* Size of the Event prefix when packed in stream */ #define IW_EV_LCP_PK_LEN (4) /* Size of the various events when packed in stream */ #define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ) #define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32)) #define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq)) #define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param)) #define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr)) #define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality)) #define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4) #endif /* _LINUX_WIRELESS_H */ linux/wmi.h 0000644 00000003536 15063602057 0006663 0 ustar 00 /* * User API methods for ACPI-WMI mapping driver * * Copyright (C) 2017 Dell, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _LINUX_WMI_H #define _LINUX_WMI_H #include <linux/ioctl.h> #include <linux/types.h> /* WMI bus will filter all WMI vendor driver requests through this IOC */ #define WMI_IOC 'W' /* All ioctl requests through WMI should declare their size followed by * relevant data objects */ struct wmi_ioctl_buffer { __u64 length; __u8 data[]; }; /* This structure may be modified by the firmware when we enter * system management mode through SMM, hence the volatiles */ struct calling_interface_buffer { __u16 cmd_class; __u16 cmd_select; __volatile__ __u32 input[4]; __volatile__ __u32 output[4]; } __attribute__((packed)); struct dell_wmi_extensions { __u32 argattrib; __u32 blength; __u8 data[]; } __attribute__((packed)); struct dell_wmi_smbios_buffer { __u64 length; struct calling_interface_buffer std; struct dell_wmi_extensions ext; } __attribute__((packed)); /* Whitelisted smbios class/select commands */ #define CLASS_TOKEN_READ 0 #define CLASS_TOKEN_WRITE 1 #define SELECT_TOKEN_STD 0 #define SELECT_TOKEN_BAT 1 #define SELECT_TOKEN_AC 2 #define CLASS_FLASH_INTERFACE 7 #define SELECT_FLASH_INTERFACE 3 #define CLASS_ADMIN_PROP 10 #define SELECT_ADMIN_PROP 3 #define CLASS_INFO 17 #define SELECT_RFKILL 11 #define SELECT_APP_REGISTRATION 3 #define SELECT_DOCK 22 /* whitelisted tokens */ #define CAPSULE_EN_TOKEN 0x0461 #define CAPSULE_DIS_TOKEN 0x0462 #define WSMT_EN_TOKEN 0x04EC #define WSMT_DIS_TOKEN 0x04ED /* Dell SMBIOS calling IOCTL command used by dell-smbios-wmi */ #define DELL_WMI_SMBIOS_CMD _IOWR(WMI_IOC, 0, struct dell_wmi_smbios_buffer) #endif linux/x25.h 0000644 00000006752 15063602057 0006510 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel X.25 implementation. * * History * mar/20/00 Daniela Squassoni Disabling/enabling of facilities * negotiation. * apr/02/05 Shaun Pereira Selective sub address matching with * call user data */ #ifndef X25_KERNEL_H #define X25_KERNEL_H #include <linux/types.h> #include <linux/socket.h> #define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0) #define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1) #define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2) #define SIOCX25SFACILITIES (SIOCPROTOPRIVATE + 3) #define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) #define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) #define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6) #define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7) #define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8) #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) #define SIOCX25SCAUSEDIAG (SIOCPROTOPRIVATE + 12) /* * Values for {get,set}sockopt. */ #define X25_QBITINCL 1 /* * X.25 Packet Size values. */ #define X25_PS16 4 #define X25_PS32 5 #define X25_PS64 6 #define X25_PS128 7 #define X25_PS256 8 #define X25_PS512 9 #define X25_PS1024 10 #define X25_PS2048 11 #define X25_PS4096 12 /* * An X.121 address, it is held as ASCII text, null terminated, up to 15 * digits and a null terminator. */ struct x25_address { char x25_addr[16]; }; /* * Linux X.25 Address structure, used for bind, and connect mostly. */ struct sockaddr_x25 { __kernel_sa_family_t sx25_family; /* Must be AF_X25 */ struct x25_address sx25_addr; /* X.121 Address */ }; /* * DTE/DCE subscription options. * * As this is missing lots of options, user should expect major * changes of this structure in 2.5.x which might break compatibilty. * The somewhat ugly dimension 200-sizeof() is needed to maintain * backward compatibility. */ struct x25_subscrip_struct { char device[200-sizeof(unsigned long)]; unsigned long global_facil_mask; /* 0 to disable negotiation */ unsigned int extended; }; /* values for above global_facil_mask */ #define X25_MASK_REVERSE 0x01 #define X25_MASK_THROUGHPUT 0x02 #define X25_MASK_PACKET_SIZE 0x04 #define X25_MASK_WINDOW_SIZE 0x08 #define X25_MASK_CALLING_AE 0x10 #define X25_MASK_CALLED_AE 0x20 /* * Routing table control structure. */ struct x25_route_struct { struct x25_address address; unsigned int sigdigits; char device[200]; }; /* * Facilities structure. */ struct x25_facilities { unsigned int winsize_in, winsize_out; unsigned int pacsize_in, pacsize_out; unsigned int throughput; unsigned int reverse; }; /* * ITU DTE facilities * Only the called and calling address * extension are currently implemented. * The rest are in place to avoid the struct * changing size if someone needs them later */ struct x25_dte_facilities { __u16 delay_cumul; __u16 delay_target; __u16 delay_max; __u8 min_throughput; __u8 expedited; __u8 calling_len; __u8 called_len; __u8 calling_ae[20]; __u8 called_ae[20]; }; /* * Call User Data structure. */ struct x25_calluserdata { unsigned int cudlength; unsigned char cuddata[128]; }; /* * Call clearing Cause and Diagnostic structure. */ struct x25_causediag { unsigned char cause; unsigned char diagnostic; }; /* * Further optional call user data match length selection */ struct x25_subaddr { unsigned int cudmatchlength; }; #endif linux/xattr.h 0000644 00000005454 15063602057 0007232 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* File: linux/xattr.h Extended attributes handling. Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org> Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved. Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> */ #include <linux/libc-compat.h> #ifndef _LINUX_XATTR_H #define _LINUX_XATTR_H #if __UAPI_DEF_XATTR #define __USE_KERNEL_XATTR_DEFS #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ #endif /* Namespaces */ #define XATTR_OS2_PREFIX "os2." #define XATTR_OS2_PREFIX_LEN (sizeof(XATTR_OS2_PREFIX) - 1) #define XATTR_MAC_OSX_PREFIX "osx." #define XATTR_MAC_OSX_PREFIX_LEN (sizeof(XATTR_MAC_OSX_PREFIX) - 1) #define XATTR_BTRFS_PREFIX "btrfs." #define XATTR_BTRFS_PREFIX_LEN (sizeof(XATTR_BTRFS_PREFIX) - 1) #define XATTR_SECURITY_PREFIX "security." #define XATTR_SECURITY_PREFIX_LEN (sizeof(XATTR_SECURITY_PREFIX) - 1) #define XATTR_SYSTEM_PREFIX "system." #define XATTR_SYSTEM_PREFIX_LEN (sizeof(XATTR_SYSTEM_PREFIX) - 1) #define XATTR_TRUSTED_PREFIX "trusted." #define XATTR_TRUSTED_PREFIX_LEN (sizeof(XATTR_TRUSTED_PREFIX) - 1) #define XATTR_USER_PREFIX "user." #define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1) /* Security namespace */ #define XATTR_EVM_SUFFIX "evm" #define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX #define XATTR_IMA_SUFFIX "ima" #define XATTR_NAME_IMA XATTR_SECURITY_PREFIX XATTR_IMA_SUFFIX #define XATTR_SELINUX_SUFFIX "selinux" #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX #define XATTR_SMACK_SUFFIX "SMACK64" #define XATTR_SMACK_IPIN "SMACK64IPIN" #define XATTR_SMACK_IPOUT "SMACK64IPOUT" #define XATTR_SMACK_EXEC "SMACK64EXEC" #define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE" #define XATTR_SMACK_MMAP "SMACK64MMAP" #define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX #define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN #define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT #define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC #define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE #define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP #define XATTR_APPARMOR_SUFFIX "apparmor" #define XATTR_NAME_APPARMOR XATTR_SECURITY_PREFIX XATTR_APPARMOR_SUFFIX #define XATTR_CAPS_SUFFIX "capability" #define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX #define XATTR_POSIX_ACL_ACCESS "posix_acl_access" #define XATTR_NAME_POSIX_ACL_ACCESS XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_ACCESS #define XATTR_POSIX_ACL_DEFAULT "posix_acl_default" #define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT #endif /* _LINUX_XATTR_H */ linux/xdp_diag.h 0000644 00000002674 15063602057 0007650 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * xdp_diag: interface for query/monitor XDP sockets * Copyright(c) 2019 Intel Corporation. */ #ifndef _LINUX_XDP_DIAG_H #define _LINUX_XDP_DIAG_H #include <linux/types.h> struct xdp_diag_req { __u8 sdiag_family; __u8 sdiag_protocol; __u16 pad; __u32 xdiag_ino; __u32 xdiag_show; __u32 xdiag_cookie[2]; }; struct xdp_diag_msg { __u8 xdiag_family; __u8 xdiag_type; __u16 pad; __u32 xdiag_ino; __u32 xdiag_cookie[2]; }; #define XDP_SHOW_INFO (1 << 0) /* Basic information */ #define XDP_SHOW_RING_CFG (1 << 1) #define XDP_SHOW_UMEM (1 << 2) #define XDP_SHOW_MEMINFO (1 << 3) #define XDP_SHOW_STATS (1 << 4) enum { XDP_DIAG_NONE, XDP_DIAG_INFO, XDP_DIAG_UID, XDP_DIAG_RX_RING, XDP_DIAG_TX_RING, XDP_DIAG_UMEM, XDP_DIAG_UMEM_FILL_RING, XDP_DIAG_UMEM_COMPLETION_RING, XDP_DIAG_MEMINFO, XDP_DIAG_STATS, __XDP_DIAG_MAX, }; #define XDP_DIAG_MAX (__XDP_DIAG_MAX - 1) struct xdp_diag_info { __u32 ifindex; __u32 queue_id; }; struct xdp_diag_ring { __u32 entries; /*num descs */ }; #define XDP_DU_F_ZEROCOPY (1 << 0) struct xdp_diag_umem { __u64 size; __u32 id; __u32 num_pages; __u32 chunk_size; __u32 headroom; __u32 ifindex; __u32 queue_id; __u32 flags; __u32 refs; }; struct xdp_diag_stats { __u64 n_rx_dropped; __u64 n_rx_invalid; __u64 n_rx_full; __u64 n_fill_ring_empty; __u64 n_tx_invalid; __u64 n_tx_ring_empty; }; #endif /* _LINUX_XDP_DIAG_H */ linux/xfrm.h 0000644 00000027332 15063602057 0007043 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_XFRM_H #define _LINUX_XFRM_H #include <linux/in6.h> #include <linux/types.h> /* All of the structures in this file may not change size as they are * passed into the kernel from userspace via netlink sockets. */ /* Structure to encapsulate addresses. I do not want to use * "standard" structure. My apologies. */ typedef union { __be32 a4; __be32 a6[4]; struct in6_addr in6; } xfrm_address_t; /* Ident of a specific xfrm_state. It is used on input to lookup * the state by (spi,daddr,ah/esp) or to store information about * spi, protocol and tunnel address on output. */ struct xfrm_id { xfrm_address_t daddr; __be32 spi; __u8 proto; }; struct xfrm_sec_ctx { __u8 ctx_doi; __u8 ctx_alg; __u16 ctx_len; __u32 ctx_sid; char ctx_str[0]; }; /* Security Context Domains of Interpretation */ #define XFRM_SC_DOI_RESERVED 0 #define XFRM_SC_DOI_LSM 1 /* Security Context Algorithms */ #define XFRM_SC_ALG_RESERVED 0 #define XFRM_SC_ALG_SELINUX 1 /* Selector, used as selector both on policy rules (SPD) and SAs. */ struct xfrm_selector { xfrm_address_t daddr; xfrm_address_t saddr; __be16 dport; __be16 dport_mask; __be16 sport; __be16 sport_mask; __u16 family; __u8 prefixlen_d; __u8 prefixlen_s; __u8 proto; int ifindex; __kernel_uid32_t user; }; #define XFRM_INF (~(__u64)0) struct xfrm_lifetime_cfg { __u64 soft_byte_limit; __u64 hard_byte_limit; __u64 soft_packet_limit; __u64 hard_packet_limit; __u64 soft_add_expires_seconds; __u64 hard_add_expires_seconds; __u64 soft_use_expires_seconds; __u64 hard_use_expires_seconds; }; struct xfrm_lifetime_cur { __u64 bytes; __u64 packets; __u64 add_time; __u64 use_time; }; struct xfrm_replay_state { __u32 oseq; __u32 seq; __u32 bitmap; }; #define XFRMA_REPLAY_ESN_MAX 4096 struct xfrm_replay_state_esn { unsigned int bmp_len; __u32 oseq; __u32 seq; __u32 oseq_hi; __u32 seq_hi; __u32 replay_window; __u32 bmp[0]; }; struct xfrm_algo { char alg_name[64]; unsigned int alg_key_len; /* in bits */ char alg_key[0]; }; struct xfrm_algo_auth { char alg_name[64]; unsigned int alg_key_len; /* in bits */ unsigned int alg_trunc_len; /* in bits */ char alg_key[0]; }; struct xfrm_algo_aead { char alg_name[64]; unsigned int alg_key_len; /* in bits */ unsigned int alg_icv_len; /* in bits */ char alg_key[0]; }; struct xfrm_stats { __u32 replay_window; __u32 replay; __u32 integrity_failed; }; enum { XFRM_POLICY_TYPE_MAIN = 0, XFRM_POLICY_TYPE_SUB = 1, XFRM_POLICY_TYPE_MAX = 2, XFRM_POLICY_TYPE_ANY = 255 }; enum { XFRM_POLICY_IN = 0, XFRM_POLICY_OUT = 1, XFRM_POLICY_FWD = 2, XFRM_POLICY_MASK = 3, XFRM_POLICY_MAX = 3 }; enum { XFRM_SHARE_ANY, /* No limitations */ XFRM_SHARE_SESSION, /* For this session only */ XFRM_SHARE_USER, /* For this user only */ XFRM_SHARE_UNIQUE /* Use once */ }; #define XFRM_MODE_TRANSPORT 0 #define XFRM_MODE_TUNNEL 1 #define XFRM_MODE_ROUTEOPTIMIZATION 2 #define XFRM_MODE_IN_TRIGGER 3 #define XFRM_MODE_BEET 4 #define XFRM_MODE_MAX 5 /* Netlink configuration messages. */ enum { XFRM_MSG_BASE = 0x10, XFRM_MSG_NEWSA = 0x10, #define XFRM_MSG_NEWSA XFRM_MSG_NEWSA XFRM_MSG_DELSA, #define XFRM_MSG_DELSA XFRM_MSG_DELSA XFRM_MSG_GETSA, #define XFRM_MSG_GETSA XFRM_MSG_GETSA XFRM_MSG_NEWPOLICY, #define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY XFRM_MSG_DELPOLICY, #define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY XFRM_MSG_GETPOLICY, #define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY XFRM_MSG_ALLOCSPI, #define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI XFRM_MSG_ACQUIRE, #define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE XFRM_MSG_EXPIRE, #define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE XFRM_MSG_UPDPOLICY, #define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY XFRM_MSG_UPDSA, #define XFRM_MSG_UPDSA XFRM_MSG_UPDSA XFRM_MSG_POLEXPIRE, #define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE XFRM_MSG_FLUSHSA, #define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHPOLICY, #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY XFRM_MSG_NEWAE, #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE XFRM_MSG_GETAE, #define XFRM_MSG_GETAE XFRM_MSG_GETAE XFRM_MSG_REPORT, #define XFRM_MSG_REPORT XFRM_MSG_REPORT XFRM_MSG_MIGRATE, #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE XFRM_MSG_NEWSADINFO, #define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO XFRM_MSG_GETSADINFO, #define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO XFRM_MSG_NEWSPDINFO, #define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO XFRM_MSG_GETSPDINFO, #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO XFRM_MSG_MAPPING, #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING __XFRM_MSG_MAX }; #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) /* * Generic LSM security context for comunicating to user space * NOTE: Same format as sadb_x_sec_ctx */ struct xfrm_user_sec_ctx { __u16 len; __u16 exttype; __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ __u8 ctx_doi; __u16 ctx_len; }; struct xfrm_user_tmpl { struct xfrm_id id; __u16 family; xfrm_address_t saddr; __u32 reqid; __u8 mode; __u8 share; __u8 optional; __u32 aalgos; __u32 ealgos; __u32 calgos; }; struct xfrm_encap_tmpl { __u16 encap_type; __be16 encap_sport; __be16 encap_dport; xfrm_address_t encap_oa; }; /* AEVENT flags */ enum xfrm_ae_ftype_t { XFRM_AE_UNSPEC, XFRM_AE_RTHR=1, /* replay threshold*/ XFRM_AE_RVAL=2, /* replay value */ XFRM_AE_LVAL=4, /* lifetime value */ XFRM_AE_ETHR=8, /* expiry timer threshold */ XFRM_AE_CR=16, /* Event cause is replay update */ XFRM_AE_CE=32, /* Event cause is timer expiry */ XFRM_AE_CU=64, /* Event cause is policy update */ __XFRM_AE_MAX #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) }; struct xfrm_userpolicy_type { __u8 type; __u16 reserved1; __u8 reserved2; }; /* Netlink message attributes. */ enum xfrm_attr_type_t { XFRMA_UNSPEC, XFRMA_ALG_AUTH, /* struct xfrm_algo */ XFRMA_ALG_CRYPT, /* struct xfrm_algo */ XFRMA_ALG_COMP, /* struct xfrm_algo */ XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ XFRMA_SA, /* struct xfrm_usersa_info */ XFRMA_POLICY, /*struct xfrm_userpolicy_info */ XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ XFRMA_LTIME_VAL, XFRMA_REPLAY_VAL, XFRMA_REPLAY_THRESH, XFRMA_ETIMER_THRESH, XFRMA_SRCADDR, /* xfrm_address_t */ XFRMA_COADDR, /* xfrm_address_t */ XFRMA_LASTUSED, /* unsigned long */ XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ XFRMA_MIGRATE, XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ XFRMA_MARK, /* struct xfrm_mark */ XFRMA_TFCPAD, /* __u32 */ XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_state_esn */ XFRMA_SA_EXTRA_FLAGS, /* __u32 */ XFRMA_PROTO, /* __u8 */ XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ XFRMA_PAD, XFRMA_OFFLOAD_DEV, /* struct xfrm_user_offload */ XFRMA_SET_MARK, /* __u32 */ XFRMA_SET_MARK_MASK, /* __u32 */ XFRMA_IF_ID, /* __u32 */ __XFRMA_MAX #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */ #define XFRMA_MAX (__XFRMA_MAX - 1) }; struct xfrm_mark { __u32 v; /* value */ __u32 m; /* mask */ }; enum xfrm_sadattr_type_t { XFRMA_SAD_UNSPEC, XFRMA_SAD_CNT, XFRMA_SAD_HINFO, __XFRMA_SAD_MAX #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) }; struct xfrmu_sadhinfo { __u32 sadhcnt; /* current hash bkts */ __u32 sadhmcnt; /* max allowed hash bkts */ }; enum xfrm_spdattr_type_t { XFRMA_SPD_UNSPEC, XFRMA_SPD_INFO, XFRMA_SPD_HINFO, XFRMA_SPD_IPV4_HTHRESH, XFRMA_SPD_IPV6_HTHRESH, __XFRMA_SPD_MAX #define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) }; struct xfrmu_spdinfo { __u32 incnt; __u32 outcnt; __u32 fwdcnt; __u32 inscnt; __u32 outscnt; __u32 fwdscnt; }; struct xfrmu_spdhinfo { __u32 spdhcnt; __u32 spdhmcnt; }; struct xfrmu_spdhthresh { __u8 lbits; __u8 rbits; }; struct xfrm_usersa_info { struct xfrm_selector sel; struct xfrm_id id; xfrm_address_t saddr; struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cur curlft; struct xfrm_stats stats; __u32 seq; __u32 reqid; __u16 family; __u8 mode; /* XFRM_MODE_xxx */ __u8 replay_window; __u8 flags; #define XFRM_STATE_NOECN 1 #define XFRM_STATE_DECAP_DSCP 2 #define XFRM_STATE_NOPMTUDISC 4 #define XFRM_STATE_WILDRECV 8 #define XFRM_STATE_ICMP 16 #define XFRM_STATE_AF_UNSPEC 32 #define XFRM_STATE_ALIGN4 64 #define XFRM_STATE_ESN 128 }; #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 struct xfrm_usersa_id { xfrm_address_t daddr; __be32 spi; __u16 family; __u8 proto; }; struct xfrm_aevent_id { struct xfrm_usersa_id sa_id; xfrm_address_t saddr; __u32 flags; __u32 reqid; }; struct xfrm_userspi_info { struct xfrm_usersa_info info; __u32 min; __u32 max; }; struct xfrm_userpolicy_info { struct xfrm_selector sel; struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cur curlft; __u32 priority; __u32 index; __u8 dir; __u8 action; #define XFRM_POLICY_ALLOW 0 #define XFRM_POLICY_BLOCK 1 __u8 flags; #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ /* Automatically expand selector to include matching ICMP payloads. */ #define XFRM_POLICY_ICMP 2 __u8 share; }; struct xfrm_userpolicy_id { struct xfrm_selector sel; __u32 index; __u8 dir; }; struct xfrm_user_acquire { struct xfrm_id id; xfrm_address_t saddr; struct xfrm_selector sel; struct xfrm_userpolicy_info policy; __u32 aalgos; __u32 ealgos; __u32 calgos; __u32 seq; }; struct xfrm_user_expire { struct xfrm_usersa_info state; __u8 hard; }; struct xfrm_user_polexpire { struct xfrm_userpolicy_info pol; __u8 hard; }; struct xfrm_usersa_flush { __u8 proto; }; struct xfrm_user_report { __u8 proto; struct xfrm_selector sel; }; /* Used by MIGRATE to pass addresses IKE should use to perform * SA negotiation with the peer */ struct xfrm_user_kmaddress { xfrm_address_t local; xfrm_address_t remote; __u32 reserved; __u16 family; }; struct xfrm_user_migrate { xfrm_address_t old_daddr; xfrm_address_t old_saddr; xfrm_address_t new_daddr; xfrm_address_t new_saddr; __u8 proto; __u8 mode; __u16 reserved; __u32 reqid; __u16 old_family; __u16 new_family; }; struct xfrm_user_mapping { struct xfrm_usersa_id id; __u32 reqid; xfrm_address_t old_saddr; xfrm_address_t new_saddr; __be16 old_sport; __be16 new_sport; }; struct xfrm_address_filter { xfrm_address_t saddr; xfrm_address_t daddr; __u16 family; __u8 splen; __u8 dplen; }; struct xfrm_user_offload { int ifindex; __u8 flags; }; /* This flag was exposed without any kernel code that supporting it. * Unfortunately, strongswan has the code that uses sets this flag, * which makes impossible to reuse this bit. * * So leave it here to make sure that it won't be reused by mistake. */ #define XFRM_OFFLOAD_IPV6 1 #define XFRM_OFFLOAD_INBOUND 2 /* backwards compatibility for userspace */ #define XFRMGRP_ACQUIRE 1 #define XFRMGRP_EXPIRE 2 #define XFRMGRP_SA 4 #define XFRMGRP_POLICY 8 #define XFRMGRP_REPORT 0x20 enum xfrm_nlgroups { XFRMNLGRP_NONE, #define XFRMNLGRP_NONE XFRMNLGRP_NONE XFRMNLGRP_ACQUIRE, #define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE XFRMNLGRP_EXPIRE, #define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE XFRMNLGRP_SA, #define XFRMNLGRP_SA XFRMNLGRP_SA XFRMNLGRP_POLICY, #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY XFRMNLGRP_AEVENTS, #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS XFRMNLGRP_REPORT, #define XFRMNLGRP_REPORT XFRMNLGRP_REPORT XFRMNLGRP_MIGRATE, #define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE XFRMNLGRP_MAPPING, #define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING __XFRMNLGRP_MAX }; #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) #endif /* _LINUX_XFRM_H */ linux/xilinx-v4l2-controls.h 0000644 00000005640 15063602057 0012026 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Xilinx Controls Header * * Copyright (C) 2013-2015 Ideas on Board * Copyright (C) 2013-2015 Xilinx, Inc. * * Contacts: Hyun Kwon <hyun.kwon@xilinx.com> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __UAPI_XILINX_V4L2_CONTROLS_H__ #define __UAPI_XILINX_V4L2_CONTROLS_H__ #include <linux/v4l2-controls.h> #define V4L2_CID_XILINX_OFFSET 0xc000 #define V4L2_CID_XILINX_BASE (V4L2_CID_USER_BASE + V4L2_CID_XILINX_OFFSET) /* * Private Controls for Xilinx Video IPs */ /* * Xilinx TPG Video IP */ #define V4L2_CID_XILINX_TPG (V4L2_CID_USER_BASE + 0xc000) /* Draw cross hairs */ #define V4L2_CID_XILINX_TPG_CROSS_HAIRS (V4L2_CID_XILINX_TPG + 1) /* Enable a moving box */ #define V4L2_CID_XILINX_TPG_MOVING_BOX (V4L2_CID_XILINX_TPG + 2) /* Mask out a color component */ #define V4L2_CID_XILINX_TPG_COLOR_MASK (V4L2_CID_XILINX_TPG + 3) /* Enable a stuck pixel feature */ #define V4L2_CID_XILINX_TPG_STUCK_PIXEL (V4L2_CID_XILINX_TPG + 4) /* Enable a noisy output */ #define V4L2_CID_XILINX_TPG_NOISE (V4L2_CID_XILINX_TPG + 5) /* Enable the motion feature */ #define V4L2_CID_XILINX_TPG_MOTION (V4L2_CID_XILINX_TPG + 6) /* Configure the motion speed of moving patterns */ #define V4L2_CID_XILINX_TPG_MOTION_SPEED (V4L2_CID_XILINX_TPG + 7) /* The row of horizontal cross hair location */ #define V4L2_CID_XILINX_TPG_CROSS_HAIR_ROW (V4L2_CID_XILINX_TPG + 8) /* The colum of vertical cross hair location */ #define V4L2_CID_XILINX_TPG_CROSS_HAIR_COLUMN (V4L2_CID_XILINX_TPG + 9) /* Set starting point of sine wave for horizontal component */ #define V4L2_CID_XILINX_TPG_ZPLATE_HOR_START (V4L2_CID_XILINX_TPG + 10) /* Set speed of the horizontal component */ #define V4L2_CID_XILINX_TPG_ZPLATE_HOR_SPEED (V4L2_CID_XILINX_TPG + 11) /* Set starting point of sine wave for vertical component */ #define V4L2_CID_XILINX_TPG_ZPLATE_VER_START (V4L2_CID_XILINX_TPG + 12) /* Set speed of the vertical component */ #define V4L2_CID_XILINX_TPG_ZPLATE_VER_SPEED (V4L2_CID_XILINX_TPG + 13) /* Moving box size */ #define V4L2_CID_XILINX_TPG_BOX_SIZE (V4L2_CID_XILINX_TPG + 14) /* Moving box color */ #define V4L2_CID_XILINX_TPG_BOX_COLOR (V4L2_CID_XILINX_TPG + 15) /* Upper limit count of generated stuck pixels */ #define V4L2_CID_XILINX_TPG_STUCK_PIXEL_THRESH (V4L2_CID_XILINX_TPG + 16) /* Noise level */ #define V4L2_CID_XILINX_TPG_NOISE_GAIN (V4L2_CID_XILINX_TPG + 17) #endif /* __UAPI_XILINX_V4L2_CONTROLS_H__ */ linux/zorro.h 0000644 00000006340 15063602057 0007236 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions * * Copyright (C) 1995--2003 Geert Uytterhoeven * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */ #ifndef _LINUX_ZORRO_H #define _LINUX_ZORRO_H #include <linux/types.h> /* * Each Zorro board has a 32-bit ID of the form * * mmmmmmmmmmmmmmmmppppppppeeeeeeee * * with * * mmmmmmmmmmmmmmmm 16-bit Manufacturer ID (assigned by CBM (sigh)) * pppppppp 8-bit Product ID (assigned by manufacturer) * eeeeeeee 8-bit Extended Product ID (currently only used * for some GVP boards) */ #define ZORRO_MANUF(id) ((id) >> 16) #define ZORRO_PROD(id) (((id) >> 8) & 0xff) #define ZORRO_EPC(id) ((id) & 0xff) #define ZORRO_ID(manuf, prod, epc) \ ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc)) typedef __u32 zorro_id; /* Include the ID list */ #include <linux/zorro_ids.h> /* * GVP identifies most of its products through the 'extended product code' * (epc). The epc has to be ANDed with the GVP_PRODMASK before the * identification. */ #define GVP_PRODMASK (0xf8) #define GVP_SCSICLKMASK (0x01) enum GVP_flags { GVP_IO = 0x01, GVP_ACCEL = 0x02, GVP_SCSI = 0x04, GVP_24BITDMA = 0x08, GVP_25BITDMA = 0x10, GVP_NOBANK = 0x20, GVP_14MHZ = 0x40, }; struct Node { __be32 ln_Succ; /* Pointer to next (successor) */ __be32 ln_Pred; /* Pointer to previous (predecessor) */ __u8 ln_Type; __s8 ln_Pri; /* Priority, for sorting */ __be32 ln_Name; /* ID string, null terminated */ } __attribute__((packed)); struct ExpansionRom { /* -First 16 bytes of the expansion ROM */ __u8 er_Type; /* Board type, size and flags */ __u8 er_Product; /* Product number, assigned by manufacturer */ __u8 er_Flags; /* Flags */ __u8 er_Reserved03; /* Must be zero ($ff inverted) */ __be16 er_Manufacturer; /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */ __be32 er_SerialNumber; /* Available for use by manufacturer */ __be16 er_InitDiagVec; /* Offset to optional "DiagArea" structure */ __u8 er_Reserved0c; __u8 er_Reserved0d; __u8 er_Reserved0e; __u8 er_Reserved0f; } __attribute__((packed)); /* er_Type board type bits */ #define ERT_TYPEMASK 0xc0 #define ERT_ZORROII 0xc0 #define ERT_ZORROIII 0x80 /* other bits defined in er_Type */ #define ERTB_MEMLIST 5 /* Link RAM into free memory list */ #define ERTF_MEMLIST (1<<5) struct ConfigDev { struct Node cd_Node; __u8 cd_Flags; /* (read/write) */ __u8 cd_Pad; /* reserved */ struct ExpansionRom cd_Rom; /* copy of board's expansion ROM */ __be32 cd_BoardAddr; /* where in memory the board was placed */ __be32 cd_BoardSize; /* size of board in bytes */ __be16 cd_SlotAddr; /* which slot number (PRIVATE) */ __be16 cd_SlotSize; /* number of slots (PRIVATE) */ __be32 cd_Driver; /* pointer to node of driver */ __be32 cd_NextCD; /* linked list of drivers to config */ __be32 cd_Unused[4]; /* for whatever the driver wants */ } __attribute__((packed)); #define ZORRO_NUM_AUTO 16 #endif /* _LINUX_ZORRO_H */ linux/zorro_ids.h 0000644 00000072413 15063602057 0010101 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Zorro board IDs * * Please keep sorted. */ #define ZORRO_MANUF_PACIFIC_PERIPHERALS 0x00D3 #define ZORRO_PROD_PACIFIC_PERIPHERALS_SE_2000_A500 ZORRO_ID(PACIFIC_PERIPHERALS, 0x00, 0) #define ZORRO_PROD_PACIFIC_PERIPHERALS_SCSI ZORRO_ID(PACIFIC_PERIPHERALS, 0x0A, 0) #define ZORRO_MANUF_MACROSYSTEMS_USA_2 0x0100 #define ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE ZORRO_ID(MACROSYSTEMS_USA_2, 0x13, 0) #define ZORRO_MANUF_KUPKE_1 0x00DD #define ZORRO_PROD_KUPKE_GOLEM_RAM_BOX_2MB ZORRO_ID(KUPKE_1, 0x00, 0) #define ZORRO_MANUF_MEMPHIS 0x0100 #define ZORRO_PROD_MEMPHIS_STORMBRINGER ZORRO_ID(MEMPHIS, 0x00, 0) #define ZORRO_MANUF_3_STATE 0x0200 #define ZORRO_PROD_3_STATE_MEGAMIX_2000 ZORRO_ID(3_STATE, 0x02, 0) #define ZORRO_MANUF_COMMODORE_BRAUNSCHWEIG 0x0201 #define ZORRO_PROD_CBM_A2088_A2286 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x01, 0) #define ZORRO_PROD_CBM_A2286 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x02, 0) #define ZORRO_PROD_CBM_A4091_1 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x54, 0) #define ZORRO_PROD_CBM_A2386SX_1 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x67, 0) #define ZORRO_MANUF_COMMODORE_WEST_CHESTER_1 0x0202 #define ZORRO_PROD_CBM_A2090A ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x01, 0) #define ZORRO_PROD_CBM_A590_A2091_1 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x02, 0) #define ZORRO_PROD_CBM_A590_A2091_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x03, 0) #define ZORRO_PROD_CBM_A2090B ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x04, 0) #define ZORRO_PROD_CBM_A2060 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x09, 0) #define ZORRO_PROD_CBM_A590_A2052_A2058_A2091 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x0A, 0) #define ZORRO_PROD_CBM_A560_RAM ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x20, 0) #define ZORRO_PROD_CBM_A2232_PROTOTYPE ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x45, 0) #define ZORRO_PROD_CBM_A2232 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x46, 0) #define ZORRO_PROD_CBM_A2620 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x50, 0) #define ZORRO_PROD_CBM_A2630 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x51, 0) #define ZORRO_PROD_CBM_A4091_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x54, 0) #define ZORRO_PROD_CBM_A2065_1 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x5A, 0) #define ZORRO_PROD_CBM_ROMULATOR ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x60, 0) #define ZORRO_PROD_CBM_A3000_TEST_FIXTURE ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x61, 0) #define ZORRO_PROD_CBM_A2386SX_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x67, 0) #define ZORRO_PROD_CBM_A2065_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x70, 0) #define ZORRO_MANUF_COMMODORE_WEST_CHESTER_2 0x0203 #define ZORRO_PROD_CBM_A2090A_CM ZORRO_ID(COMMODORE_WEST_CHESTER_2, 0x03, 0) #define ZORRO_MANUF_PROGRESSIVE_PERIPHERALS_AND_SYSTEMS_2 0x02F4 #define ZORRO_PROD_PPS_EXP8000 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS_2, 0x02, 0) #define ZORRO_MANUF_KOLFF_COMPUTER_SUPPLIES 0x02FF #define ZORRO_PROD_KCS_POWER_PC_BOARD ZORRO_ID(KOLFF_COMPUTER_SUPPLIES, 0x00, 0) #define ZORRO_MANUF_CARDCO_1 0x03EC #define ZORRO_PROD_CARDCO_KRONOS_2000_1 ZORRO_ID(CARDCO_1, 0x04, 0) #define ZORRO_PROD_CARDCO_A1000_1 ZORRO_ID(CARDCO_1, 0x0C, 0) #define ZORRO_PROD_CARDCO_ESCORT ZORRO_ID(CARDCO_1, 0x0E, 0) #define ZORRO_PROD_CARDCO_A2410 ZORRO_ID(CARDCO_1, 0xF5, 0) #define ZORRO_MANUF_A_SQUARED 0x03ED #define ZORRO_PROD_A_SQUARED_LIVE_2000 ZORRO_ID(A_SQUARED, 0x01, 0) #define ZORRO_MANUF_COMSPEC_COMMUNICATIONS 0x03EE #define ZORRO_PROD_COMSPEC_COMMUNICATIONS_AX2000 ZORRO_ID(COMSPEC_COMMUNICATIONS, 0x01, 0) #define ZORRO_MANUF_ANAKIN_RESEARCH 0x03F1 #define ZORRO_PROD_ANAKIN_RESEARCH_EASYL ZORRO_ID(ANAKIN_RESEARCH, 0x01, 0) #define ZORRO_MANUF_MICROBOTICS 0x03F2 #define ZORRO_PROD_MICROBOTICS_STARBOARD_II ZORRO_ID(MICROBOTICS, 0x00, 0) #define ZORRO_PROD_MICROBOTICS_STARDRIVE ZORRO_ID(MICROBOTICS, 0x02, 0) #define ZORRO_PROD_MICROBOTICS_8_UP_A ZORRO_ID(MICROBOTICS, 0x03, 0) #define ZORRO_PROD_MICROBOTICS_8_UP_Z ZORRO_ID(MICROBOTICS, 0x04, 0) #define ZORRO_PROD_MICROBOTICS_DELTA_RAM ZORRO_ID(MICROBOTICS, 0x20, 0) #define ZORRO_PROD_MICROBOTICS_8_STAR_RAM ZORRO_ID(MICROBOTICS, 0x40, 0) #define ZORRO_PROD_MICROBOTICS_8_STAR ZORRO_ID(MICROBOTICS, 0x41, 0) #define ZORRO_PROD_MICROBOTICS_VXL_RAM_32 ZORRO_ID(MICROBOTICS, 0x44, 0) #define ZORRO_PROD_MICROBOTICS_VXL_68030 ZORRO_ID(MICROBOTICS, 0x45, 0) #define ZORRO_PROD_MICROBOTICS_DELTA ZORRO_ID(MICROBOTICS, 0x60, 0) #define ZORRO_PROD_MICROBOTICS_MBX_1200_1200Z_RAM ZORRO_ID(MICROBOTICS, 0x81, 0) #define ZORRO_PROD_MICROBOTICS_HARDFRAME_2000_1 ZORRO_ID(MICROBOTICS, 0x96, 0) #define ZORRO_PROD_MICROBOTICS_HARDFRAME_2000_2 ZORRO_ID(MICROBOTICS, 0x9E, 0) #define ZORRO_PROD_MICROBOTICS_MBX_1200_1200Z ZORRO_ID(MICROBOTICS, 0xC1, 0) #define ZORRO_MANUF_ACCESS_ASSOCIATES_ALEGRA 0x03F4 #define ZORRO_MANUF_EXPANSION_TECHNOLOGIES 0x03F6 #define ZORRO_MANUF_ASDG 0x03FF #define ZORRO_PROD_ASDG_MEMORY_1 ZORRO_ID(ASDG, 0x01, 0) #define ZORRO_PROD_ASDG_MEMORY_2 ZORRO_ID(ASDG, 0x02, 0) #define ZORRO_PROD_ASDG_EB920_LAN_ROVER ZORRO_ID(ASDG, 0xFE, 0) #define ZORRO_PROD_ASDG_GPIB_DUALIEEE488_TWIN_X ZORRO_ID(ASDG, 0xFF, 0) #define ZORRO_MANUF_IMTRONICS_1 0x0404 #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_1 ZORRO_ID(IMTRONICS_1, 0x39, 0) #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_2 ZORRO_ID(IMTRONICS_1, 0x57, 0) #define ZORRO_MANUF_CBM_UNIVERSITY_OF_LOWELL 0x0406 #define ZORRO_PROD_CBM_A2410 ZORRO_ID(CBM_UNIVERSITY_OF_LOWELL, 0x00, 0) #define ZORRO_MANUF_AMERISTAR 0x041D #define ZORRO_PROD_AMERISTAR_A2065 ZORRO_ID(AMERISTAR, 0x01, 0) #define ZORRO_PROD_AMERISTAR_A560 ZORRO_ID(AMERISTAR, 0x09, 0) #define ZORRO_PROD_AMERISTAR_A4066 ZORRO_ID(AMERISTAR, 0x0A, 0) #define ZORRO_MANUF_SUPRA 0x0420 #define ZORRO_PROD_SUPRA_SUPRADRIVE_4x4 ZORRO_ID(SUPRA, 0x01, 0) #define ZORRO_PROD_SUPRA_1000_RAM ZORRO_ID(SUPRA, 0x02, 0) #define ZORRO_PROD_SUPRA_2000_DMA ZORRO_ID(SUPRA, 0x03, 0) #define ZORRO_PROD_SUPRA_500 ZORRO_ID(SUPRA, 0x05, 0) #define ZORRO_PROD_SUPRA_500_SCSI ZORRO_ID(SUPRA, 0x08, 0) #define ZORRO_PROD_SUPRA_500XP_2000_RAM ZORRO_ID(SUPRA, 0x09, 0) #define ZORRO_PROD_SUPRA_500RX_2000_RAM ZORRO_ID(SUPRA, 0x0A, 0) #define ZORRO_PROD_SUPRA_2400ZI ZORRO_ID(SUPRA, 0x0B, 0) #define ZORRO_PROD_SUPRA_500XP_SUPRADRIVE_WORDSYNC ZORRO_ID(SUPRA, 0x0C, 0) #define ZORRO_PROD_SUPRA_SUPRADRIVE_WORDSYNC_II ZORRO_ID(SUPRA, 0x0D, 0) #define ZORRO_PROD_SUPRA_2400ZIPLUS ZORRO_ID(SUPRA, 0x10, 0) #define ZORRO_MANUF_COMPUTER_SYSTEMS_ASSOCIATES 0x0422 #define ZORRO_PROD_CSA_MAGNUM ZORRO_ID(COMPUTER_SYSTEMS_ASSOCIATES, 0x11, 0) #define ZORRO_PROD_CSA_12_GAUGE ZORRO_ID(COMPUTER_SYSTEMS_ASSOCIATES, 0x15, 0) #define ZORRO_MANUF_MARC_MICHAEL_GROTH 0x0439 #define ZORRO_MANUF_M_TECH 0x0502 #define ZORRO_PROD_MTEC_AT500_1 ZORRO_ID(M_TECH, 0x03, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_1 0x06E1 #define ZORRO_PROD_GVP_IMPACT_SERIES_I ZORRO_ID(GREAT_VALLEY_PRODUCTS_1, 0x08, 0) #define ZORRO_MANUF_BYTEBOX 0x07DA #define ZORRO_PROD_BYTEBOX_A500 ZORRO_ID(BYTEBOX, 0x00, 0) #define ZORRO_MANUF_DKB_POWER_COMPUTING 0x07DC #define ZORRO_PROD_DKB_POWER_COMPUTING_SECUREKEY ZORRO_ID(DKB_POWER_COMPUTING, 0x09, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_DKM_3128 ZORRO_ID(DKB_POWER_COMPUTING, 0x0E, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_RAPID_FIRE ZORRO_ID(DKB_POWER_COMPUTING, 0x0F, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_DKM_1202 ZORRO_ID(DKB_POWER_COMPUTING, 0x10, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_COBRA_VIPER_II_68EC030 ZORRO_ID(DKB_POWER_COMPUTING, 0x12, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_WILDFIRE_060_1 ZORRO_ID(DKB_POWER_COMPUTING, 0x17, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_WILDFIRE_060_2 ZORRO_ID(DKB_POWER_COMPUTING, 0xFF, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_2 0x07E1 #define ZORRO_PROD_GVP_IMPACT_SERIES_I_4K ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x01, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_I_16K_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x02, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_I_16K_3 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x03, 0) #define ZORRO_PROD_GVP_IMPACT_3001_IDE_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x08, 0) #define ZORRO_PROD_GVP_IMPACT_3001_RAM ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x09, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_II_RAM_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0A, 0) #define ZORRO_PROD_GVP_EPC_BASE ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0) #define ZORRO_PROD_GVP_GFORCE_040_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x20) #define ZORRO_PROD_GVP_GFORCE_040_SCSI_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x30) #define ZORRO_PROD_GVP_A1291 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x40) #define ZORRO_PROD_GVP_COMBO_030_R4 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x60) #define ZORRO_PROD_GVP_COMBO_030_R4_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x70) #define ZORRO_PROD_GVP_PHONEPAK ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x78) #define ZORRO_PROD_GVP_IO_EXTENDER ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x98) #define ZORRO_PROD_GVP_GFORCE_030 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xa0) #define ZORRO_PROD_GVP_GFORCE_030_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xb0) #define ZORRO_PROD_GVP_A530 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xc0) #define ZORRO_PROD_GVP_A530_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xd0) #define ZORRO_PROD_GVP_COMBO_030_R3 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xe0) #define ZORRO_PROD_GVP_COMBO_030_R3_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xf0) #define ZORRO_PROD_GVP_SERIES_II ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xf8) #define ZORRO_PROD_GVP_IMPACT_3001_IDE_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0D, 0) /*#define ZORRO_PROD_GVP_A2000_030 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0D, 0)*/ /*#define ZORRO_PROD_GVP_GFORCE_040_SCSI_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0D, 0)*/ #define ZORRO_PROD_GVP_GFORCE_040_060 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x16, 0) #define ZORRO_PROD_GVP_IMPACT_VISION_24 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x20, 0) #define ZORRO_PROD_GVP_GFORCE_040_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0xFF, 0) #define ZORRO_MANUF_CALIFORNIA_ACCESS_SYNERGY 0x07E5 #define ZORRO_PROD_CALIFORNIA_ACCESS_SYNERGY_MALIBU ZORRO_ID(CALIFORNIA_ACCESS_SYNERGY, 0x01, 0) #define ZORRO_MANUF_XETEC 0x07E6 #define ZORRO_PROD_XETEC_FASTCARD ZORRO_ID(XETEC, 0x01, 0) #define ZORRO_PROD_XETEC_FASTCARD_RAM ZORRO_ID(XETEC, 0x02, 0) #define ZORRO_PROD_XETEC_FASTCARD_PLUS ZORRO_ID(XETEC, 0x03, 0) #define ZORRO_MANUF_PROGRESSIVE_PERIPHERALS_AND_SYSTEMS 0x07EA #define ZORRO_PROD_PPS_MERCURY ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x00, 0) #define ZORRO_PROD_PPS_A3000_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x01, 0) #define ZORRO_PROD_PPS_A2000_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x69, 0) #define ZORRO_PROD_PPS_ZEUS ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x96, 0) #define ZORRO_PROD_PPS_A500_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0xBB, 0) #define ZORRO_MANUF_XEBEC 0x07EC #define ZORRO_MANUF_SPIRIT_TECHNOLOGY 0x07F2 #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INSIDER_IN1000 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x01, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INSIDER_IN500 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x02, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_SIN500 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x03, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_HDA_506 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x04, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_AX_S ZORRO_ID(SPIRIT_TECHNOLOGY, 0x05, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_OCTABYTE ZORRO_ID(SPIRIT_TECHNOLOGY, 0x06, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INMATE ZORRO_ID(SPIRIT_TECHNOLOGY, 0x08, 0) #define ZORRO_MANUF_SPIRIT_TECHNOLOGY_2 0x07F3 #define ZORRO_MANUF_BSC_ALFADATA_1 0x07FE #define ZORRO_PROD_BSC_ALF_3_1 ZORRO_ID(BSC_ALFADATA_1, 0x03, 0) #define ZORRO_MANUF_BSC_ALFADATA_2 0x0801 #define ZORRO_PROD_BSC_ALF_2_1 ZORRO_ID(BSC_ALFADATA_2, 0x01, 0) #define ZORRO_PROD_BSC_ALF_2_2 ZORRO_ID(BSC_ALFADATA_2, 0x02, 0) #define ZORRO_PROD_BSC_ALF_3_2 ZORRO_ID(BSC_ALFADATA_2, 0x03, 0) #define ZORRO_MANUF_CARDCO_2 0x0802 #define ZORRO_PROD_CARDCO_KRONOS_2000_2 ZORRO_ID(CARDCO_2, 0x04, 0) #define ZORRO_PROD_CARDCO_A1000_2 ZORRO_ID(CARDCO_2, 0x0C, 0) #define ZORRO_MANUF_JOCHHEIM 0x0804 #define ZORRO_PROD_JOCHHEIM_RAM ZORRO_ID(JOCHHEIM, 0x01, 0) #define ZORRO_MANUF_CHECKPOINT_TECHNOLOGIES 0x0807 #define ZORRO_PROD_CHECKPOINT_TECHNOLOGIES_SERIAL_SOLUTION ZORRO_ID(CHECKPOINT_TECHNOLOGIES, 0x00, 0) #define ZORRO_MANUF_EDOTRONIK 0x0810 #define ZORRO_PROD_EDOTRONIK_IEEE_488 ZORRO_ID(EDOTRONIK, 0x01, 0) #define ZORRO_PROD_EDOTRONIK_8032 ZORRO_ID(EDOTRONIK, 0x02, 0) #define ZORRO_PROD_EDOTRONIK_MULTISERIAL ZORRO_ID(EDOTRONIK, 0x03, 0) #define ZORRO_PROD_EDOTRONIK_VIDEODIGITIZER ZORRO_ID(EDOTRONIK, 0x04, 0) #define ZORRO_PROD_EDOTRONIK_PARALLEL_IO ZORRO_ID(EDOTRONIK, 0x05, 0) #define ZORRO_PROD_EDOTRONIK_PIC_PROTOYPING ZORRO_ID(EDOTRONIK, 0x06, 0) #define ZORRO_PROD_EDOTRONIK_ADC ZORRO_ID(EDOTRONIK, 0x07, 0) #define ZORRO_PROD_EDOTRONIK_VME ZORRO_ID(EDOTRONIK, 0x08, 0) #define ZORRO_PROD_EDOTRONIK_DSP96000 ZORRO_ID(EDOTRONIK, 0x09, 0) #define ZORRO_MANUF_NES_INC 0x0813 #define ZORRO_PROD_NES_INC_RAM ZORRO_ID(NES_INC, 0x00, 0) #define ZORRO_MANUF_ICD 0x0817 #define ZORRO_PROD_ICD_ADVANTAGE_2000_SCSI ZORRO_ID(ICD, 0x01, 0) #define ZORRO_PROD_ICD_ADVANTAGE_IDE ZORRO_ID(ICD, 0x03, 0) #define ZORRO_PROD_ICD_ADVANTAGE_2080_RAM ZORRO_ID(ICD, 0x04, 0) #define ZORRO_MANUF_KUPKE_2 0x0819 #define ZORRO_PROD_KUPKE_OMTI ZORRO_ID(KUPKE_2, 0x01, 0) #define ZORRO_PROD_KUPKE_SCSI_II ZORRO_ID(KUPKE_2, 0x02, 0) #define ZORRO_PROD_KUPKE_GOLEM_BOX ZORRO_ID(KUPKE_2, 0x03, 0) #define ZORRO_PROD_KUPKE_030_882 ZORRO_ID(KUPKE_2, 0x04, 0) #define ZORRO_PROD_KUPKE_SCSI_AT ZORRO_ID(KUPKE_2, 0x05, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_3 0x081D #define ZORRO_PROD_GVP_A2000_RAM8 ZORRO_ID(GREAT_VALLEY_PRODUCTS_3, 0x09, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_II_RAM_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_3, 0x0A, 0) #define ZORRO_MANUF_INTERWORKS_NETWORK 0x081E #define ZORRO_MANUF_HARDITAL_SYNTHESIS 0x0820 #define ZORRO_PROD_HARDITAL_SYNTHESIS_TQM_68030_68882 ZORRO_ID(HARDITAL_SYNTHESIS, 0x14, 0) #define ZORRO_MANUF_APPLIED_ENGINEERING 0x0828 #define ZORRO_PROD_APPLIED_ENGINEERING_DL2000 ZORRO_ID(APPLIED_ENGINEERING, 0x10, 0) #define ZORRO_PROD_APPLIED_ENGINEERING_RAM_WORKS ZORRO_ID(APPLIED_ENGINEERING, 0xE0, 0) #define ZORRO_MANUF_BSC_ALFADATA_3 0x082C #define ZORRO_PROD_BSC_OKTAGON_2008 ZORRO_ID(BSC_ALFADATA_3, 0x05, 0) #define ZORRO_PROD_BSC_TANDEM_AT_2008_508 ZORRO_ID(BSC_ALFADATA_3, 0x06, 0) #define ZORRO_PROD_BSC_ALFA_RAM_1200 ZORRO_ID(BSC_ALFADATA_3, 0x07, 0) #define ZORRO_PROD_BSC_OKTAGON_2008_RAM ZORRO_ID(BSC_ALFADATA_3, 0x08, 0) #define ZORRO_PROD_BSC_MULTIFACE_I ZORRO_ID(BSC_ALFADATA_3, 0x10, 0) #define ZORRO_PROD_BSC_MULTIFACE_II ZORRO_ID(BSC_ALFADATA_3, 0x11, 0) #define ZORRO_PROD_BSC_MULTIFACE_III ZORRO_ID(BSC_ALFADATA_3, 0x12, 0) #define ZORRO_PROD_BSC_FRAMEMASTER_II ZORRO_ID(BSC_ALFADATA_3, 0x20, 0) #define ZORRO_PROD_BSC_GRAFFITI_RAM ZORRO_ID(BSC_ALFADATA_3, 0x21, 0) #define ZORRO_PROD_BSC_GRAFFITI_REG ZORRO_ID(BSC_ALFADATA_3, 0x22, 0) #define ZORRO_PROD_BSC_ISDN_MASTERCARD ZORRO_ID(BSC_ALFADATA_3, 0x40, 0) #define ZORRO_PROD_BSC_ISDN_MASTERCARD_II ZORRO_ID(BSC_ALFADATA_3, 0x41, 0) #define ZORRO_MANUF_PHOENIX 0x0835 #define ZORRO_PROD_PHOENIX_ST506 ZORRO_ID(PHOENIX, 0x21, 0) #define ZORRO_PROD_PHOENIX_SCSI ZORRO_ID(PHOENIX, 0x22, 0) #define ZORRO_PROD_PHOENIX_RAM ZORRO_ID(PHOENIX, 0xBE, 0) #define ZORRO_MANUF_ADVANCED_STORAGE_SYSTEMS 0x0836 #define ZORRO_PROD_ADVANCED_STORAGE_SYSTEMS_NEXUS ZORRO_ID(ADVANCED_STORAGE_SYSTEMS, 0x01, 0) #define ZORRO_PROD_ADVANCED_STORAGE_SYSTEMS_NEXUS_RAM ZORRO_ID(ADVANCED_STORAGE_SYSTEMS, 0x08, 0) #define ZORRO_MANUF_IMPULSE 0x0838 #define ZORRO_PROD_IMPULSE_FIRECRACKER_24 ZORRO_ID(IMPULSE, 0x00, 0) #define ZORRO_MANUF_IVS 0x0840 #define ZORRO_PROD_IVS_GRANDSLAM_PIC_2 ZORRO_ID(IVS, 0x02, 0) #define ZORRO_PROD_IVS_GRANDSLAM_PIC_1 ZORRO_ID(IVS, 0x04, 0) #define ZORRO_PROD_IVS_OVERDRIVE ZORRO_ID(IVS, 0x10, 0) #define ZORRO_PROD_IVS_TRUMPCARD_CLASSIC ZORRO_ID(IVS, 0x30, 0) #define ZORRO_PROD_IVS_TRUMPCARD_PRO_GRANDSLAM ZORRO_ID(IVS, 0x34, 0) #define ZORRO_PROD_IVS_META_4 ZORRO_ID(IVS, 0x40, 0) #define ZORRO_PROD_IVS_WAVETOOLS ZORRO_ID(IVS, 0xBF, 0) #define ZORRO_PROD_IVS_VECTOR_1 ZORRO_ID(IVS, 0xF3, 0) #define ZORRO_PROD_IVS_VECTOR_2 ZORRO_ID(IVS, 0xF4, 0) #define ZORRO_MANUF_VECTOR_1 0x0841 #define ZORRO_PROD_VECTOR_CONNECTION_1 ZORRO_ID(VECTOR_1, 0xE3, 0) #define ZORRO_MANUF_XPERT_PRODEV 0x0845 #define ZORRO_PROD_XPERT_PRODEV_VISIONA_RAM ZORRO_ID(XPERT_PRODEV, 0x01, 0) #define ZORRO_PROD_XPERT_PRODEV_VISIONA_REG ZORRO_ID(XPERT_PRODEV, 0x02, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_RAM ZORRO_ID(XPERT_PRODEV, 0x03, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_REG_1 ZORRO_ID(XPERT_PRODEV, 0x04, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_REG_2 ZORRO_ID(XPERT_PRODEV, 0xC9, 0) #define ZORRO_MANUF_HYDRA_SYSTEMS 0x0849 #define ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET ZORRO_ID(HYDRA_SYSTEMS, 0x01, 0) #define ZORRO_MANUF_SUNRIZE_INDUSTRIES 0x084F #define ZORRO_PROD_SUNRIZE_INDUSTRIES_AD1012 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x01, 0) #define ZORRO_PROD_SUNRIZE_INDUSTRIES_AD516 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x02, 0) #define ZORRO_PROD_SUNRIZE_INDUSTRIES_DD512 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x03, 0) #define ZORRO_MANUF_TRICERATOPS 0x0850 #define ZORRO_PROD_TRICERATOPS_MULTI_IO ZORRO_ID(TRICERATOPS, 0x01, 0) #define ZORRO_MANUF_APPLIED_MAGIC 0x0851 #define ZORRO_PROD_APPLIED_MAGIC_DMI_RESOLVER ZORRO_ID(APPLIED_MAGIC, 0x01, 0) #define ZORRO_PROD_APPLIED_MAGIC_DIGITAL_BROADCASTER ZORRO_ID(APPLIED_MAGIC, 0x06, 0) #define ZORRO_MANUF_GFX_BASE 0x085E #define ZORRO_PROD_GFX_BASE_GDA_1_VRAM ZORRO_ID(GFX_BASE, 0x00, 0) #define ZORRO_PROD_GFX_BASE_GDA_1 ZORRO_ID(GFX_BASE, 0x01, 0) #define ZORRO_MANUF_ROCTEC 0x0860 #define ZORRO_PROD_ROCTEC_RH_800C ZORRO_ID(ROCTEC, 0x01, 0) #define ZORRO_PROD_ROCTEC_RH_800C_RAM ZORRO_ID(ROCTEC, 0x01, 0) #define ZORRO_MANUF_KATO 0x0861 #define ZORRO_PROD_KATO_MELODY ZORRO_ID(KATO, 0x80, 0) /* ID clash!! */ #define ZORRO_MANUF_HELFRICH_1 0x0861 #define ZORRO_PROD_HELFRICH_RAINBOW_II ZORRO_ID(HELFRICH_1, 0x20, 0) #define ZORRO_PROD_HELFRICH_RAINBOW_III ZORRO_ID(HELFRICH_1, 0x21, 0) #define ZORRO_MANUF_ATLANTIS 0x0862 #define ZORRO_MANUF_PROTAR 0x0864 #define ZORRO_MANUF_ACS 0x0865 #define ZORRO_MANUF_SOFTWARE_RESULTS_ENTERPRISES 0x0866 #define ZORRO_PROD_SOFTWARE_RESULTS_ENTERPRISES_GOLDEN_GATE_2_BUS_PLUS ZORRO_ID(SOFTWARE_RESULTS_ENTERPRISES, 0x01, 0) #define ZORRO_MANUF_MASOBOSHI 0x086D #define ZORRO_PROD_MASOBOSHI_MASTER_CARD_SC201 ZORRO_ID(MASOBOSHI, 0x03, 0) #define ZORRO_PROD_MASOBOSHI_MASTER_CARD_MC702 ZORRO_ID(MASOBOSHI, 0x04, 0) #define ZORRO_PROD_MASOBOSHI_MVD_819 ZORRO_ID(MASOBOSHI, 0x07, 0) #define ZORRO_MANUF_MAINHATTAN_DATA 0x086F #define ZORRO_PROD_MAINHATTAN_DATA_IDE ZORRO_ID(MAINHATTAN_DATA, 0x01, 0) #define ZORRO_MANUF_VILLAGE_TRONIC 0x0877 #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_RAM ZORRO_ID(VILLAGE_TRONIC, 0x01, 0) #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_REG ZORRO_ID(VILLAGE_TRONIC, 0x02, 0) #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_16M_PROTOTYPE ZORRO_ID(VILLAGE_TRONIC, 0x03, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0) #define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0) #define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE2 ZORRO_ID(VILLAGE_TRONIC, 0xCA, 0) #define ZORRO_MANUF_UTILITIES_UNLIMITED 0x087B #define ZORRO_PROD_UTILITIES_UNLIMITED_EMPLANT_DELUXE ZORRO_ID(UTILITIES_UNLIMITED, 0x15, 0) #define ZORRO_PROD_UTILITIES_UNLIMITED_EMPLANT_DELUXE2 ZORRO_ID(UTILITIES_UNLIMITED, 0x20, 0) #define ZORRO_MANUF_AMITRIX 0x0880 #define ZORRO_PROD_AMITRIX_MULTI_IO ZORRO_ID(AMITRIX, 0x01, 0) #define ZORRO_PROD_AMITRIX_CD_RAM ZORRO_ID(AMITRIX, 0x02, 0) #define ZORRO_MANUF_ARMAX 0x0885 #define ZORRO_PROD_ARMAX_OMNIBUS ZORRO_ID(ARMAX, 0x00, 0) #define ZORRO_MANUF_ZEUS 0x088D #define ZORRO_PROD_ZEUS_SPIDER ZORRO_ID(ZEUS, 0x04, 0) #define ZORRO_MANUF_NEWTEK 0x088F #define ZORRO_PROD_NEWTEK_VIDEOTOASTER ZORRO_ID(NEWTEK, 0x00, 0) #define ZORRO_MANUF_M_TECH_GERMANY 0x0890 #define ZORRO_PROD_MTEC_AT500_2 ZORRO_ID(M_TECH_GERMANY, 0x01, 0) #define ZORRO_PROD_MTEC_68030 ZORRO_ID(M_TECH_GERMANY, 0x03, 0) #define ZORRO_PROD_MTEC_68020I ZORRO_ID(M_TECH_GERMANY, 0x06, 0) #define ZORRO_PROD_MTEC_A1200_T68030_RTC ZORRO_ID(M_TECH_GERMANY, 0x20, 0) #define ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530 ZORRO_ID(M_TECH_GERMANY, 0x21, 0) #define ZORRO_PROD_MTEC_8_MB_RAM ZORRO_ID(M_TECH_GERMANY, 0x22, 0) #define ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE ZORRO_ID(M_TECH_GERMANY, 0x24, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_4 0x0891 #define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM ZORRO_ID(GREAT_VALLEY_PRODUCTS_4, 0x01, 0) #define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG ZORRO_ID(GREAT_VALLEY_PRODUCTS_4, 0x02, 0) #define ZORRO_MANUF_APOLLO_1 0x0892 #define ZORRO_PROD_APOLLO_A1200 ZORRO_ID(APOLLO_1, 0x01, 0) #define ZORRO_MANUF_HELFRICH_2 0x0893 #define ZORRO_PROD_HELFRICH_PICCOLO_RAM ZORRO_ID(HELFRICH_2, 0x05, 0) #define ZORRO_PROD_HELFRICH_PICCOLO_REG ZORRO_ID(HELFRICH_2, 0x06, 0) #define ZORRO_PROD_HELFRICH_PEGGY_PLUS_MPEG ZORRO_ID(HELFRICH_2, 0x07, 0) #define ZORRO_PROD_HELFRICH_VIDEOCRUNCHER ZORRO_ID(HELFRICH_2, 0x08, 0) #define ZORRO_PROD_HELFRICH_SD64_RAM ZORRO_ID(HELFRICH_2, 0x0A, 0) #define ZORRO_PROD_HELFRICH_SD64_REG ZORRO_ID(HELFRICH_2, 0x0B, 0) #define ZORRO_MANUF_MACROSYSTEMS_USA 0x089B #define ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx ZORRO_ID(MACROSYSTEMS_USA, 0x13, 0) #define ZORRO_MANUF_ELBOX_COMPUTER 0x089E #define ZORRO_PROD_ELBOX_COMPUTER_1200_4 ZORRO_ID(ELBOX_COMPUTER, 0x06, 0) #define ZORRO_MANUF_HARMS_PROFESSIONAL 0x0A00 #define ZORRO_PROD_HARMS_PROFESSIONAL_030_PLUS ZORRO_ID(HARMS_PROFESSIONAL, 0x10, 0) #define ZORRO_PROD_HARMS_PROFESSIONAL_3500 ZORRO_ID(HARMS_PROFESSIONAL, 0xD0, 0) #define ZORRO_MANUF_MICRONIK 0x0A50 #define ZORRO_PROD_MICRONIK_RCA_120 ZORRO_ID(MICRONIK, 0x0A, 0) #define ZORRO_MANUF_MICRONIK2 0x0F0F #define ZORRO_PROD_MICRONIK2_Z3I ZORRO_ID(MICRONIK2, 0x01, 0) #define ZORRO_MANUF_MEGAMICRO 0x1000 #define ZORRO_PROD_MEGAMICRO_SCRAM_500 ZORRO_ID(MEGAMICRO, 0x03, 0) #define ZORRO_PROD_MEGAMICRO_SCRAM_500_RAM ZORRO_ID(MEGAMICRO, 0x04, 0) #define ZORRO_MANUF_IMTRONICS_2 0x1028 #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_3 ZORRO_ID(IMTRONICS_2, 0x39, 0) #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_4 ZORRO_ID(IMTRONICS_2, 0x57, 0) /* unofficial ID */ #define ZORRO_MANUF_INDIVIDUAL_COMPUTERS 0x1212 #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x00, 0) #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x17, 0) #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x2A, 0) #define ZORRO_MANUF_KUPKE_3 0x1248 #define ZORRO_PROD_KUPKE_GOLEM_HD_3000 ZORRO_ID(KUPKE_3, 0x01, 0) #define ZORRO_MANUF_ITH 0x1388 #define ZORRO_PROD_ITH_ISDN_MASTER_II ZORRO_ID(ITH, 0x01, 0) #define ZORRO_MANUF_VMC 0x1389 #define ZORRO_PROD_VMC_ISDN_BLASTER_Z2 ZORRO_ID(VMC, 0x01, 0) #define ZORRO_PROD_VMC_HYPERCOM_4 ZORRO_ID(VMC, 0x02, 0) #define ZORRO_MANUF_INFORMATION 0x157C #define ZORRO_PROD_INFORMATION_ISDN_ENGINE_I ZORRO_ID(INFORMATION, 0x64, 0) #define ZORRO_MANUF_VORTEX 0x2017 #define ZORRO_PROD_VORTEX_GOLDEN_GATE_80386SX ZORRO_ID(VORTEX, 0x07, 0) #define ZORRO_PROD_VORTEX_GOLDEN_GATE_RAM ZORRO_ID(VORTEX, 0x08, 0) #define ZORRO_PROD_VORTEX_GOLDEN_GATE_80486 ZORRO_ID(VORTEX, 0x09, 0) #define ZORRO_MANUF_EXPANSION_SYSTEMS 0x2062 #define ZORRO_PROD_EXPANSION_SYSTEMS_DATAFLYER_4000SX ZORRO_ID(EXPANSION_SYSTEMS, 0x01, 0) #define ZORRO_PROD_EXPANSION_SYSTEMS_DATAFLYER_4000SX_RAM ZORRO_ID(EXPANSION_SYSTEMS, 0x02, 0) #define ZORRO_MANUF_READYSOFT 0x2100 #define ZORRO_PROD_READYSOFT_AMAX_II_IV ZORRO_ID(READYSOFT, 0x01, 0) #define ZORRO_MANUF_PHASE5 0x2140 #define ZORRO_PROD_PHASE5_BLIZZARD_RAM ZORRO_ID(PHASE5, 0x01, 0) #define ZORRO_PROD_PHASE5_BLIZZARD ZORRO_ID(PHASE5, 0x02, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1220_IV ZORRO_ID(PHASE5, 0x06, 0) #define ZORRO_PROD_PHASE5_FASTLANE_Z3_RAM ZORRO_ID(PHASE5, 0x0A, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060 ZORRO_ID(PHASE5, 0x0B, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM ZORRO_ID(PHASE5, 0x0C, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230 ZORRO_ID(PHASE5, 0x0D, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230_IV_1260 ZORRO_ID(PHASE5, 0x11, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_2060 ZORRO_ID(PHASE5, 0x18, 0) #define ZORRO_PROD_PHASE5_CYBERSTORM_MK_II ZORRO_ID(PHASE5, 0x19, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64 ZORRO_ID(PHASE5, 0x22, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64_3D_PROTOTYPE ZORRO_ID(PHASE5, 0x32, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64_3D ZORRO_ID(PHASE5, 0x43, 0) #define ZORRO_PROD_PHASE5_CYBERSTORM_MK_III ZORRO_ID(PHASE5, 0x64, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS ZORRO_ID(PHASE5, 0x6e, 0) #define ZORRO_MANUF_DPS 0x2169 #define ZORRO_PROD_DPS_PERSONAL_ANIMATION_RECORDER ZORRO_ID(DPS, 0x01, 0) #define ZORRO_MANUF_APOLLO_2 0x2200 #define ZORRO_PROD_APOLLO_A620_68020_1 ZORRO_ID(APOLLO_2, 0x00, 0) #define ZORRO_PROD_APOLLO_A620_68020_2 ZORRO_ID(APOLLO_2, 0x01, 0) #define ZORRO_MANUF_APOLLO_3 0x2222 #define ZORRO_PROD_APOLLO_AT_APOLLO ZORRO_ID(APOLLO_3, 0x22, 0) #define ZORRO_PROD_APOLLO_1230_1240_1260_2030_4040_4060 ZORRO_ID(APOLLO_3, 0x23, 0) #define ZORRO_MANUF_PETSOFF_LP 0x38A5 #define ZORRO_PROD_PETSOFF_LP_DELFINA ZORRO_ID(PETSOFF_LP, 0x00, 0) #define ZORRO_PROD_PETSOFF_LP_DELFINA_LITE ZORRO_ID(PETSOFF_LP, 0x01, 0) #define ZORRO_MANUF_UWE_GERLACH 0x3FF7 #define ZORRO_PROD_UWE_GERLACH_RAM_ROM ZORRO_ID(UWE_GERLACH, 0xd4, 0) #define ZORRO_MANUF_ACT 0x4231 #define ZORRO_PROD_ACT_PRELUDE ZORRO_ID(ACT, 0x01, 0) #define ZORRO_MANUF_MACROSYSTEMS_GERMANY 0x4754 #define ZORRO_PROD_MACROSYSTEMS_MAESTRO ZORRO_ID(MACROSYSTEMS_GERMANY, 0x03, 0) #define ZORRO_PROD_MACROSYSTEMS_VLAB ZORRO_ID(MACROSYSTEMS_GERMANY, 0x04, 0) #define ZORRO_PROD_MACROSYSTEMS_MAESTRO_PRO ZORRO_ID(MACROSYSTEMS_GERMANY, 0x05, 0) #define ZORRO_PROD_MACROSYSTEMS_RETINA ZORRO_ID(MACROSYSTEMS_GERMANY, 0x06, 0) #define ZORRO_PROD_MACROSYSTEMS_MULTI_EVOLUTION ZORRO_ID(MACROSYSTEMS_GERMANY, 0x08, 0) #define ZORRO_PROD_MACROSYSTEMS_TOCCATA ZORRO_ID(MACROSYSTEMS_GERMANY, 0x0C, 0) #define ZORRO_PROD_MACROSYSTEMS_RETINA_Z3 ZORRO_ID(MACROSYSTEMS_GERMANY, 0x10, 0) #define ZORRO_PROD_MACROSYSTEMS_VLAB_MOTION ZORRO_ID(MACROSYSTEMS_GERMANY, 0x12, 0) #define ZORRO_PROD_MACROSYSTEMS_ALTAIS ZORRO_ID(MACROSYSTEMS_GERMANY, 0x13, 0) #define ZORRO_PROD_MACROSYSTEMS_FALCON_040 ZORRO_ID(MACROSYSTEMS_GERMANY, 0xFD, 0) #define ZORRO_MANUF_COMBITEC 0x6766 #define ZORRO_MANUF_SKI_PERIPHERALS 0x8000 #define ZORRO_PROD_SKI_PERIPHERALS_MAST_FIREBALL ZORRO_ID(SKI_PERIPHERALS, 0x08, 0) #define ZORRO_PROD_SKI_PERIPHERALS_SCSI_DUAL_SERIAL ZORRO_ID(SKI_PERIPHERALS, 0x80, 0) #define ZORRO_MANUF_REIS_WARE_2 0xA9AD #define ZORRO_PROD_REIS_WARE_SCAN_KING ZORRO_ID(REIS_WARE_2, 0x11, 0) #define ZORRO_MANUF_CAMERON 0xAA01 #define ZORRO_PROD_CAMERON_PERSONAL_A4 ZORRO_ID(CAMERON, 0x10, 0) #define ZORRO_MANUF_REIS_WARE 0xAA11 #define ZORRO_PROD_REIS_WARE_HANDYSCANNER ZORRO_ID(REIS_WARE, 0x11, 0) #define ZORRO_MANUF_PHOENIX_2 0xB5A8 #define ZORRO_PROD_PHOENIX_ST506_2 ZORRO_ID(PHOENIX_2, 0x21, 0) #define ZORRO_PROD_PHOENIX_SCSI_2 ZORRO_ID(PHOENIX_2, 0x22, 0) #define ZORRO_PROD_PHOENIX_RAM_2 ZORRO_ID(PHOENIX_2, 0xBE, 0) #define ZORRO_MANUF_COMBITEC_2 0xC008 #define ZORRO_PROD_COMBITEC_HD ZORRO_ID(COMBITEC_2, 0x2A, 0) #define ZORRO_PROD_COMBITEC_SRAM ZORRO_ID(COMBITEC_2, 0x2B, 0) /* * Test and illegal Manufacturer IDs. */ #define ZORRO_MANUF_HACKER 0x07DB #define ZORRO_PROD_GENERAL_PROTOTYPE ZORRO_ID(HACKER, 0x00, 0) #define ZORRO_PROD_HACKER_SCSI ZORRO_ID(HACKER, 0x01, 0) #define ZORRO_PROD_RESOURCE_MANAGEMENT_FORCE_QUICKNET_QN2000 ZORRO_ID(HACKER, 0x02, 0) #define ZORRO_PROD_VECTOR_CONNECTION_2 ZORRO_ID(HACKER, 0xE0, 0) #define ZORRO_PROD_VECTOR_CONNECTION_3 ZORRO_ID(HACKER, 0xE1, 0) #define ZORRO_PROD_VECTOR_CONNECTION_4 ZORRO_ID(HACKER, 0xE2, 0) #define ZORRO_PROD_VECTOR_CONNECTION_5 ZORRO_ID(HACKER, 0xE3, 0) linux/wimax/i2400m.h 0000644 00000037072 15063602057 0010131 0 ustar 00 /* * Intel Wireless WiMax Connection 2400m * Host-Device protocol interface definitions * * * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * Intel Corporation <linux-wimax@intel.com> * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> * - Initial implementation * * * This header defines the data structures and constants used to * communicate with the device. * * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL * * The firmware upload protocol is quite simple and only requires a * handful of commands. See drivers/net/wimax/i2400m/fw.c for more * details. * * The BCF data structure is for the firmware file header. * * * THE DATA / CONTROL PROTOCOL * * This is the normal protocol spoken with the device once the * firmware is uploaded. It transports data payloads and control * messages back and forth. * * It consists 'messages' that pack one or more payloads each. The * format is described in detail in drivers/net/wimax/i2400m/rx.c and * tx.c. * * * THE L3L4 PROTOCOL * * The term L3L4 refers to Layer 3 (the device), Layer 4 (the * driver/host software). * * This is the control protocol used by the host to control the i2400m * device (scan, connect, disconnect...). This is sent to / received * as control frames. These frames consist of a header and zero or * more TLVs with information. We call each control frame a "message". * * Each message is composed of: * * HEADER * [TLV0 + PAYLOAD0] * [TLV1 + PAYLOAD1] * [...] * [TLVN + PAYLOADN] * * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are * defined by a TLV structure (Type Length Value) which is a 'header' * (struct i2400m_tlv_hdr) and then the payload. * * All integers are represented as Little Endian. * * - REQUESTS AND EVENTS * * The requests can be clasified as follows: * * COMMAND: implies a request from the host to the device requesting * an action being performed. The device will reply with a * message (with the same type as the command), status and * no (TLV) payload. Execution of a command might cause * events (of different type) to be sent later on as * device's state changes. * * GET/SET: similar to COMMAND, but will not cause other * EVENTs. The reply, in the case of GET, will contain * TLVs with the requested information. * * EVENT: asynchronous messages sent from the device, maybe as a * consequence of previous COMMANDs but disassociated from * them. * * Only one request might be pending at the same time (ie: don't * parallelize nor post another GET request before the previous * COMMAND has been acknowledged with it's corresponding reply by the * device). * * The different requests and their formats are described below: * * I2400M_MT_* Message types * I2400M_MS_* Message status (for replies, events) * i2400m_tlv_* TLVs * * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the * operation. */ #ifndef __LINUX__WIMAX__I2400M_H__ #define __LINUX__WIMAX__I2400M_H__ #include <linux/types.h> #include <linux/if_ether.h> /* * Host Device Interface (HDI) common to all busses */ /* Boot-mode (firmware upload mode) commands */ /* Header for the firmware file */ struct i2400m_bcf_hdr { __le32 module_type; __le32 header_len; __le32 header_version; __le32 module_id; __le32 module_vendor; __le32 date; /* BCD YYYMMDD */ __le32 size; /* in dwords */ __le32 key_size; /* in dwords */ __le32 modulus_size; /* in dwords */ __le32 exponent_size; /* in dwords */ __u8 reserved[88]; } __attribute__ ((packed)); /* Boot mode opcodes */ enum i2400m_brh_opcode { I2400M_BRH_READ = 1, I2400M_BRH_WRITE = 2, I2400M_BRH_JUMP = 3, I2400M_BRH_SIGNED_JUMP = 8, I2400M_BRH_HASH_PAYLOAD_ONLY = 9, }; /* Boot mode command masks and stuff */ enum i2400m_brh { I2400M_BRH_SIGNATURE = 0xcbbc0000, I2400M_BRH_SIGNATURE_MASK = 0xffff0000, I2400M_BRH_SIGNATURE_SHIFT = 16, I2400M_BRH_OPCODE_MASK = 0x0000000f, I2400M_BRH_RESPONSE_MASK = 0x000000f0, I2400M_BRH_RESPONSE_SHIFT = 4, I2400M_BRH_DIRECT_ACCESS = 0x00000400, I2400M_BRH_RESPONSE_REQUIRED = 0x00000200, I2400M_BRH_USE_CHECKSUM = 0x00000100, }; /** * i2400m_bootrom_header - Header for a boot-mode command * * @cmd: the above command descriptor * @target_addr: where on the device memory should the action be performed. * @data_size: for read/write, amount of data to be read/written * @block_checksum: checksum value (if applicable) * @payload: the beginning of data attached to this header */ struct i2400m_bootrom_header { __le32 command; /* Compose with enum i2400_brh */ __le32 target_addr; __le32 data_size; __le32 block_checksum; char payload[0]; } __attribute__ ((packed)); /* * Data / control protocol */ /* Packet types for the host-device interface */ enum i2400m_pt { I2400M_PT_DATA = 0, I2400M_PT_CTRL, I2400M_PT_TRACE, /* For device debug */ I2400M_PT_RESET_WARM, /* device reset */ I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */ I2400M_PT_EDATA, /* Extended RX data */ I2400M_PT_ILLEGAL }; /* * Payload for a data packet * * This is prefixed to each and every outgoing DATA type. */ struct i2400m_pl_data_hdr { __le32 reserved; } __attribute__((packed)); /* * Payload for an extended data packet * * New in fw v1.4 * * @reorder: if this payload has to be reorder or not (and how) * @cs: the type of data in the packet, as defined per (802.16e * T11.13.19.1). Currently only 2 (IPv4 packet) supported. * * This is prefixed to each and every INCOMING DATA packet. */ struct i2400m_pl_edata_hdr { __le32 reorder; /* bits defined in i2400m_ro */ __u8 cs; __u8 reserved[11]; } __attribute__((packed)); enum i2400m_cs { I2400M_CS_IPV4_0 = 0, I2400M_CS_IPV4 = 2, }; enum i2400m_ro { I2400M_RO_NEEDED = 0x01, I2400M_RO_TYPE = 0x03, I2400M_RO_TYPE_SHIFT = 1, I2400M_RO_CIN = 0x0f, I2400M_RO_CIN_SHIFT = 4, I2400M_RO_FBN = 0x07ff, I2400M_RO_FBN_SHIFT = 8, I2400M_RO_SN = 0x07ff, I2400M_RO_SN_SHIFT = 21, }; enum i2400m_ro_type { I2400M_RO_TYPE_RESET = 0, I2400M_RO_TYPE_PACKET, I2400M_RO_TYPE_WS, I2400M_RO_TYPE_PACKET_WS, }; /* Misc constants */ enum { I2400M_PL_ALIGN = 16, /* Payload data size alignment */ I2400M_PL_SIZE_MAX = 0x3EFF, I2400M_MAX_PLS_IN_MSG = 60, /* protocol barkers: sync sequences; for notifications they * are sent in groups of four. */ I2400M_H2D_PREVIEW_BARKER = 0xcafe900d, I2400M_COLD_RESET_BARKER = 0xc01dc01d, I2400M_WARM_RESET_BARKER = 0x50f750f7, I2400M_NBOOT_BARKER = 0xdeadbeef, I2400M_SBOOT_BARKER = 0x0ff1c1a1, I2400M_SBOOT_BARKER_6050 = 0x80000001, I2400M_ACK_BARKER = 0xfeedbabe, I2400M_D2H_MSG_BARKER = 0xbeefbabe, }; /* * Hardware payload descriptor * * Bitfields encoded in a struct to enforce typing semantics. * * Look in rx.c and tx.c for a full description of the format. */ struct i2400m_pld { __le32 val; } __attribute__ ((packed)); #define I2400M_PLD_SIZE_MASK 0x00003fff #define I2400M_PLD_TYPE_SHIFT 16 #define I2400M_PLD_TYPE_MASK 0x000f0000 /* * Header for a TX message or RX message * * @barker: preamble * @size: used for management of the FIFO queue buffer; before * sending, this is converted to be a real preamble. This * indicates the real size of the TX message that starts at this * point. If the highest bit is set, then this message is to be * skipped. * @sequence: sequence number of this message * @offset: offset where the message itself starts -- see the comments * in the file header about message header and payload descriptor * alignment. * @num_pls: number of payloads in this message * @padding: amount of padding bytes at the end of the message to make * it be of block-size aligned * * Look in rx.c and tx.c for a full description of the format. */ struct i2400m_msg_hdr { union { __le32 barker; __u32 size; /* same size type as barker!! */ }; union { __le32 sequence; __u32 offset; /* same size type as barker!! */ }; __le16 num_pls; __le16 rsv1; __le16 padding; __le16 rsv2; struct i2400m_pld pld[0]; } __attribute__ ((packed)); /* * L3/L4 control protocol */ enum { /* Interface version */ I2400M_L3L4_VERSION = 0x0100, }; /* Message types */ enum i2400m_mt { I2400M_MT_RESERVED = 0x0000, I2400M_MT_INVALID = 0xffff, I2400M_MT_REPORT_MASK = 0x8000, I2400M_MT_GET_SCAN_RESULT = 0x4202, I2400M_MT_SET_SCAN_PARAM = 0x4402, I2400M_MT_CMD_RF_CONTROL = 0x4602, I2400M_MT_CMD_SCAN = 0x4603, I2400M_MT_CMD_CONNECT = 0x4604, I2400M_MT_CMD_DISCONNECT = 0x4605, I2400M_MT_CMD_EXIT_IDLE = 0x4606, I2400M_MT_GET_LM_VERSION = 0x5201, I2400M_MT_GET_DEVICE_INFO = 0x5202, I2400M_MT_GET_LINK_STATUS = 0x5203, I2400M_MT_GET_STATISTICS = 0x5204, I2400M_MT_GET_STATE = 0x5205, I2400M_MT_GET_MEDIA_STATUS = 0x5206, I2400M_MT_SET_INIT_CONFIG = 0x5404, I2400M_MT_CMD_INIT = 0x5601, I2400M_MT_CMD_TERMINATE = 0x5602, I2400M_MT_CMD_MODE_OF_OP = 0x5603, I2400M_MT_CMD_RESET_DEVICE = 0x5604, I2400M_MT_CMD_MONITOR_CONTROL = 0x5605, I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606, I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201, I2400M_MT_SET_EAP_SUCCESS = 0x6402, I2400M_MT_SET_EAP_FAIL = 0x6403, I2400M_MT_SET_EAP_KEY = 0x6404, I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602, I2400M_MT_REPORT_SCAN_RESULT = 0xc002, I2400M_MT_REPORT_STATE = 0xd002, I2400M_MT_REPORT_POWERSAVE_READY = 0xd005, I2400M_MT_REPORT_EAP_REQUEST = 0xe002, I2400M_MT_REPORT_EAP_RESTART = 0xe003, I2400M_MT_REPORT_ALT_ACCEPT = 0xe004, I2400M_MT_REPORT_KEY_REQUEST = 0xe005, }; /* * Message Ack Status codes * * When a message is replied-to, this status is reported. */ enum i2400m_ms { I2400M_MS_DONE_OK = 0, I2400M_MS_DONE_IN_PROGRESS = 1, I2400M_MS_INVALID_OP = 2, I2400M_MS_BAD_STATE = 3, I2400M_MS_ILLEGAL_VALUE = 4, I2400M_MS_MISSING_PARAMS = 5, I2400M_MS_VERSION_ERROR = 6, I2400M_MS_ACCESSIBILITY_ERROR = 7, I2400M_MS_BUSY = 8, I2400M_MS_CORRUPTED_TLV = 9, I2400M_MS_UNINITIALIZED = 10, I2400M_MS_UNKNOWN_ERROR = 11, I2400M_MS_PRODUCTION_ERROR = 12, I2400M_MS_NO_RF = 13, I2400M_MS_NOT_READY_FOR_POWERSAVE = 14, I2400M_MS_THERMAL_CRITICAL = 15, I2400M_MS_MAX }; /** * i2400m_tlv - enumeration of the different types of TLVs * * TLVs stand for type-length-value and are the header for a payload * composed of almost anything. Each payload has a type assigned * and a length. */ enum i2400m_tlv { I2400M_TLV_L4_MESSAGE_VERSIONS = 129, I2400M_TLV_SYSTEM_STATE = 141, I2400M_TLV_MEDIA_STATUS = 161, I2400M_TLV_RF_OPERATION = 162, I2400M_TLV_RF_STATUS = 163, I2400M_TLV_DEVICE_RESET_TYPE = 132, I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601, I2400M_TLV_CONFIG_IDLE_TIMEOUT = 611, I2400M_TLV_CONFIG_D2H_DATA_FORMAT = 614, I2400M_TLV_CONFIG_DL_HOST_REORDER = 615, }; struct i2400m_tlv_hdr { __le16 type; __le16 length; /* payload's */ __u8 pl[0]; } __attribute__((packed)); struct i2400m_l3l4_hdr { __le16 type; __le16 length; /* payload's */ __le16 version; __le16 resv1; __le16 status; __le16 resv2; struct i2400m_tlv_hdr pl[0]; } __attribute__((packed)); /** * i2400m_system_state - different states of the device */ enum i2400m_system_state { I2400M_SS_UNINITIALIZED = 1, I2400M_SS_INIT, I2400M_SS_READY, I2400M_SS_SCAN, I2400M_SS_STANDBY, I2400M_SS_CONNECTING, I2400M_SS_WIMAX_CONNECTED, I2400M_SS_DATA_PATH_CONNECTED, I2400M_SS_IDLE, I2400M_SS_DISCONNECTING, I2400M_SS_OUT_OF_ZONE, I2400M_SS_SLEEPACTIVE, I2400M_SS_PRODUCTION, I2400M_SS_CONFIG, I2400M_SS_RF_OFF, I2400M_SS_RF_SHUTDOWN, I2400M_SS_DEVICE_DISCONNECT, I2400M_SS_MAX, }; /** * i2400m_tlv_system_state - report on the state of the system * * @state: see enum i2400m_system_state */ struct i2400m_tlv_system_state { struct i2400m_tlv_hdr hdr; __le32 state; } __attribute__((packed)); struct i2400m_tlv_l4_message_versions { struct i2400m_tlv_hdr hdr; __le16 major; __le16 minor; __le16 branch; __le16 reserved; } __attribute__((packed)); struct i2400m_tlv_detailed_device_info { struct i2400m_tlv_hdr hdr; __u8 reserved1[400]; __u8 mac_address[ETH_ALEN]; __u8 reserved2[2]; } __attribute__((packed)); enum i2400m_rf_switch_status { I2400M_RF_SWITCH_ON = 1, I2400M_RF_SWITCH_OFF = 2, }; struct i2400m_tlv_rf_switches_status { struct i2400m_tlv_hdr hdr; __u8 sw_rf_switch; /* 1 ON, 2 OFF */ __u8 hw_rf_switch; /* 1 ON, 2 OFF */ __u8 reserved[2]; } __attribute__((packed)); enum { i2400m_rf_operation_on = 1, i2400m_rf_operation_off = 2 }; struct i2400m_tlv_rf_operation { struct i2400m_tlv_hdr hdr; __le32 status; /* 1 ON, 2 OFF */ } __attribute__((packed)); enum i2400m_tlv_reset_type { I2400M_RESET_TYPE_COLD = 1, I2400M_RESET_TYPE_WARM }; struct i2400m_tlv_device_reset_type { struct i2400m_tlv_hdr hdr; __le32 reset_type; } __attribute__((packed)); struct i2400m_tlv_config_idle_parameters { struct i2400m_tlv_hdr hdr; __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments * 0 disabled */ __le32 idle_paging_interval; /* frames */ } __attribute__((packed)); enum i2400m_media_status { I2400M_MEDIA_STATUS_LINK_UP = 1, I2400M_MEDIA_STATUS_LINK_DOWN, I2400M_MEDIA_STATUS_LINK_RENEW, }; struct i2400m_tlv_media_status { struct i2400m_tlv_hdr hdr; __le32 media_status; } __attribute__((packed)); /* New in v1.4 */ struct i2400m_tlv_config_idle_timeout { struct i2400m_tlv_hdr hdr; __le32 timeout; /* 100 to 300000 ms [5min], 100 increments * 0 disabled */ } __attribute__((packed)); /* New in v1.4 -- for backward compat, will be removed */ struct i2400m_tlv_config_d2h_data_format { struct i2400m_tlv_hdr hdr; __u8 format; /* 0 old format, 1 enhanced */ __u8 reserved[3]; } __attribute__((packed)); /* New in v1.4 */ struct i2400m_tlv_config_dl_host_reorder { struct i2400m_tlv_hdr hdr; __u8 reorder; /* 0 disabled, 1 enabled */ __u8 reserved[3]; } __attribute__((packed)); #endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */ linux/a.out.h 0000644 00000015354 15063602057 0007116 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __A_OUT_GNU_H__ #define __A_OUT_GNU_H__ #define __GNU_EXEC_MACROS__ #ifndef __STRUCT_EXEC_OVERRIDE__ #include <asm/a.out.h> #endif /* __STRUCT_EXEC_OVERRIDE__ */ #ifndef __ASSEMBLY__ /* these go in the N_MACHTYPE field */ enum machine_type { #if defined (M_OLDSUN2) M__OLDSUN2 = M_OLDSUN2, #else M_OLDSUN2 = 0, #endif #if defined (M_68010) M__68010 = M_68010, #else M_68010 = 1, #endif #if defined (M_68020) M__68020 = M_68020, #else M_68020 = 2, #endif #if defined (M_SPARC) M__SPARC = M_SPARC, #else M_SPARC = 3, #endif /* skip a bunch so we don't run into any of sun's numbers */ M_386 = 100, M_MIPS1 = 151, /* MIPS R3000/R3000 binary */ M_MIPS2 = 152 /* MIPS R6000/R4000 binary */ }; #if !defined (N_MAGIC) #define N_MAGIC(exec) ((exec).a_info & 0xffff) #endif #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) #define N_SET_INFO(exec, magic, type, flags) \ ((exec).a_info = ((magic) & 0xffff) \ | (((int)(type) & 0xff) << 16) \ | (((flags) & 0xff) << 24)) #define N_SET_MAGIC(exec, magic) \ ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) #define N_SET_MACHTYPE(exec, machtype) \ ((exec).a_info = \ ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) #define N_SET_FLAGS(exec, flags) \ ((exec).a_info = \ ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) /* Code indicating object file or impure executable. */ #define OMAGIC 0407 /* Code indicating pure executable. */ #define NMAGIC 0410 /* Code indicating demand-paged executable. */ #define ZMAGIC 0413 /* This indicates a demand-paged executable with the header in the text. The first page is unmapped to help trap NULL pointer references */ #define QMAGIC 0314 /* Code indicating core file. */ #define CMAGIC 0421 #if !defined (N_BADMAG) #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ && N_MAGIC(x) != NMAGIC \ && N_MAGIC(x) != ZMAGIC \ && N_MAGIC(x) != QMAGIC) #endif #define _N_HDROFF(x) (1024 - sizeof (struct exec)) #if !defined (N_TXTOFF) #define N_TXTOFF(x) \ (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \ (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec))) #endif #if !defined (N_DATOFF) #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) #endif #if !defined (N_TRELOFF) #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) #endif #if !defined (N_DRELOFF) #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) #endif #if !defined (N_SYMOFF) #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) #endif #if !defined (N_STROFF) #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) #endif /* Address of text segment in memory after it is loaded. */ #if !defined (N_TXTADDR) #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0) #endif /* Address of data segment in memory after it is loaded. */ #include <unistd.h> #if defined(__i386__) || defined(__mc68000__) #define SEGMENT_SIZE 1024 #else #ifndef SEGMENT_SIZE #define SEGMENT_SIZE getpagesize() #endif #endif #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) #ifndef N_DATADDR #define N_DATADDR(x) \ (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \ : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) #endif /* Address of bss segment in memory after it is loaded. */ #if !defined (N_BSSADDR) #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) #endif #if !defined (N_NLIST_DECLARED) struct nlist { union { char *n_name; struct nlist *n_next; long n_strx; } n_un; unsigned char n_type; char n_other; short n_desc; unsigned long n_value; }; #endif /* no N_NLIST_DECLARED. */ #if !defined (N_UNDF) #define N_UNDF 0 #endif #if !defined (N_ABS) #define N_ABS 2 #endif #if !defined (N_TEXT) #define N_TEXT 4 #endif #if !defined (N_DATA) #define N_DATA 6 #endif #if !defined (N_BSS) #define N_BSS 8 #endif #if !defined (N_FN) #define N_FN 15 #endif #if !defined (N_EXT) #define N_EXT 1 #endif #if !defined (N_TYPE) #define N_TYPE 036 #endif #if !defined (N_STAB) #define N_STAB 0340 #endif /* The following type indicates the definition of a symbol as being an indirect reference to another symbol. The other symbol appears as an undefined reference, immediately following this symbol. Indirection is asymmetrical. The other symbol's value will be used to satisfy requests for the indirect symbol, but not vice versa. If the other symbol does not have a definition, libraries will be searched to find a definition. */ #define N_INDR 0xa /* The following symbols refer to set elements. All the N_SET[ATDB] symbols with the same name form one set. Space is allocated for the set in the text section, and each set element's value is stored into one word of the space. The first word of the space is the length of the set (number of elements). The address of the set is made into an N_SETV symbol whose name is the same as the name of the set. This symbol acts like a N_DATA global symbol in that it can satisfy undefined external references. */ /* These appear as input to LD, in a .o file. */ #define N_SETA 0x14 /* Absolute set element symbol */ #define N_SETT 0x16 /* Text set element symbol */ #define N_SETD 0x18 /* Data set element symbol */ #define N_SETB 0x1A /* Bss set element symbol */ /* This is output from LD. */ #define N_SETV 0x1C /* Pointer to set vector in data area. */ #if !defined (N_RELOCATION_INFO_DECLARED) /* This structure describes a single relocation to be performed. The text-relocation section of the file is a vector of these structures, all of which apply to the text section. Likewise, the data-relocation section applies to the data section. */ struct relocation_info { /* Address (within segment) to be relocated. */ int r_address; /* The meaning of r_symbolnum depends on r_extern. */ unsigned int r_symbolnum:24; /* Nonzero means value is a pc-relative offset and it should be relocated for changes in its own address as well as for changes in the symbol or section specified. */ unsigned int r_pcrel:1; /* Length (as exponent of 2) of the field to be relocated. Thus, a value of 2 indicates 1<<2 bytes. */ unsigned int r_length:2; /* 1 => relocate with value of symbol. r_symbolnum is the index of the symbol in file's the symbol table. 0 => relocate with the address of a segment. r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS (the N_EXT bit may be set also, but signifies nothing). */ unsigned int r_extern:1; /* Four bits that aren't used, but when writing an object file it is desirable to clear them. */ unsigned int r_pad:4; }; #endif /* no N_RELOCATION_INFO_DECLARED. */ #endif /*__ASSEMBLY__ */ #endif /* __A_OUT_GNU_H__ */ linux/acct.h 0000644 00000007225 15063602057 0007000 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * BSD Process Accounting for Linux - Definitions * * Author: Marco van Wieringen (mvw@planets.elm.net) * * This header file contains the definitions needed to implement * BSD-style process accounting. The kernel accounting code and all * user-level programs that try to do something useful with the * process accounting log must include this file. * * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V. * */ #ifndef _LINUX_ACCT_H #define _LINUX_ACCT_H #include <linux/types.h> #include <asm/param.h> #include <asm/byteorder.h> /* * comp_t is a 16-bit "floating" point number with a 3-bit base 8 * exponent and a 13-bit fraction. * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction * (leading 1 not stored). * See linux/kernel/acct.c for the specific encoding systems used. */ typedef __u16 comp_t; typedef __u32 comp2_t; /* * accounting file record * * This structure contains all of the information written out to the * process accounting file whenever a process exits. */ #define ACCT_COMM 16 struct acct { char ac_flag; /* Flags */ char ac_version; /* Always set to ACCT_VERSION */ /* for binary compatibility back until 2.0 */ __u16 ac_uid16; /* LSB of Real User ID */ __u16 ac_gid16; /* LSB of Real Group ID */ __u16 ac_tty; /* Control Terminal */ __u32 ac_btime; /* Process Creation Time */ comp_t ac_utime; /* User Time */ comp_t ac_stime; /* System Time */ comp_t ac_etime; /* Elapsed Time */ comp_t ac_mem; /* Average Memory Usage */ comp_t ac_io; /* Chars Transferred */ comp_t ac_rw; /* Blocks Read or Written */ comp_t ac_minflt; /* Minor Pagefaults */ comp_t ac_majflt; /* Major Pagefaults */ comp_t ac_swaps; /* Number of Swaps */ /* m68k had no padding here. */ __u16 ac_ahz; /* AHZ */ __u32 ac_exitcode; /* Exitcode */ char ac_comm[ACCT_COMM + 1]; /* Command Name */ __u8 ac_etime_hi; /* Elapsed Time MSB */ __u16 ac_etime_lo; /* Elapsed Time LSB */ __u32 ac_uid; /* Real User ID */ __u32 ac_gid; /* Real Group ID */ }; struct acct_v3 { char ac_flag; /* Flags */ char ac_version; /* Always set to ACCT_VERSION */ __u16 ac_tty; /* Control Terminal */ __u32 ac_exitcode; /* Exitcode */ __u32 ac_uid; /* Real User ID */ __u32 ac_gid; /* Real Group ID */ __u32 ac_pid; /* Process ID */ __u32 ac_ppid; /* Parent Process ID */ __u32 ac_btime; /* Process Creation Time */ float ac_etime; /* Elapsed Time */ comp_t ac_utime; /* User Time */ comp_t ac_stime; /* System Time */ comp_t ac_mem; /* Average Memory Usage */ comp_t ac_io; /* Chars Transferred */ comp_t ac_rw; /* Blocks Read or Written */ comp_t ac_minflt; /* Minor Pagefaults */ comp_t ac_majflt; /* Major Pagefaults */ comp_t ac_swaps; /* Number of Swaps */ char ac_comm[ACCT_COMM]; /* Command Name */ }; /* * accounting flags */ /* bit set when the process ... */ #define AFORK 0x01 /* ... executed fork, but did not exec */ #define ASU 0x02 /* ... used super-user privileges */ #define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */ #define ACORE 0x08 /* ... dumped core */ #define AXSIG 0x10 /* ... was killed by a signal */ #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) #define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) #define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ #else #error unspecified endianness #endif #define ACCT_VERSION 2 #define AHZ (HZ) #endif /* _LINUX_ACCT_H */ linux/adb.h 0000644 00000002164 15063602057 0006611 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Definitions for ADB (Apple Desktop Bus) support. */ #ifndef __ADB_H #define __ADB_H /* ADB commands */ #define ADB_BUSRESET 0 #define ADB_FLUSH(id) (0x01 | ((id) << 4)) #define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4)) #define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4)) /* ADB default device IDs (upper 4 bits of ADB command byte) */ #define ADB_DONGLE 1 /* "software execution control" devices */ #define ADB_KEYBOARD 2 #define ADB_MOUSE 3 #define ADB_TABLET 4 #define ADB_MODEM 5 #define ADB_MISC 7 /* maybe a monitor */ #define ADB_RET_OK 0 #define ADB_RET_TIMEOUT 3 /* The kind of ADB request. The controller may emulate some or all of those CUDA/PMU packet kinds */ #define ADB_PACKET 0 #define CUDA_PACKET 1 #define ERROR_PACKET 2 #define TIMER_PACKET 3 #define POWER_PACKET 4 #define MACIIC_PACKET 5 #define PMU_PACKET 6 #define ADB_QUERY 7 /* ADB queries */ /* ADB_QUERY_GETDEVINFO * Query ADB slot for device presence * data[2] = id, rep[0] = orig addr, rep[1] = handler_id */ #define ADB_QUERY_GETDEVINFO 1 #endif /* __ADB_H */ linux/adfs_fs.h 0000644 00000001650 15063602057 0007467 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ADFS_FS_H #define _ADFS_FS_H #include <linux/types.h> #include <linux/magic.h> /* * Disc Record at disc address 0xc00 */ struct adfs_discrecord { __u8 log2secsize; __u8 secspertrack; __u8 heads; __u8 density; __u8 idlen; __u8 log2bpmb; __u8 skew; __u8 bootoption; __u8 lowsector; __u8 nzones; __le16 zone_spare; __le32 root; __le32 disc_size; __le16 disc_id; __u8 disc_name[10]; __le32 disc_type; __le32 disc_size_high; __u8 log2sharesize:4; __u8 unused40:4; __u8 big_flag:1; __u8 unused41:1; __u8 nzones_high; __le32 format_version; __le32 root_size; __u8 unused52[60 - 52]; }; #define ADFS_DISCRECORD (0xc00) #define ADFS_DR_OFFSET (0x1c0) #define ADFS_DR_SIZE 60 #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) #endif /* _ADFS_FS_H */ linux/affs_hardblocks.h 0000644 00000003010 15063602057 0011165 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef AFFS_HARDBLOCKS_H #define AFFS_HARDBLOCKS_H #include <linux/types.h> /* Just the needed definitions for the RDB of an Amiga HD. */ struct RigidDiskBlock { __u32 rdb_ID; __be32 rdb_SummedLongs; __s32 rdb_ChkSum; __u32 rdb_HostID; __be32 rdb_BlockBytes; __u32 rdb_Flags; __u32 rdb_BadBlockList; __be32 rdb_PartitionList; __u32 rdb_FileSysHeaderList; __u32 rdb_DriveInit; __u32 rdb_Reserved1[6]; __u32 rdb_Cylinders; __u32 rdb_Sectors; __u32 rdb_Heads; __u32 rdb_Interleave; __u32 rdb_Park; __u32 rdb_Reserved2[3]; __u32 rdb_WritePreComp; __u32 rdb_ReducedWrite; __u32 rdb_StepRate; __u32 rdb_Reserved3[5]; __u32 rdb_RDBBlocksLo; __u32 rdb_RDBBlocksHi; __u32 rdb_LoCylinder; __u32 rdb_HiCylinder; __u32 rdb_CylBlocks; __u32 rdb_AutoParkSeconds; __u32 rdb_HighRDSKBlock; __u32 rdb_Reserved4; char rdb_DiskVendor[8]; char rdb_DiskProduct[16]; char rdb_DiskRevision[4]; char rdb_ControllerVendor[8]; char rdb_ControllerProduct[16]; char rdb_ControllerRevision[4]; __u32 rdb_Reserved5[10]; }; #define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */ struct PartitionBlock { __be32 pb_ID; __be32 pb_SummedLongs; __s32 pb_ChkSum; __u32 pb_HostID; __be32 pb_Next; __u32 pb_Flags; __u32 pb_Reserved1[2]; __u32 pb_DevFlags; __u8 pb_DriveName[32]; __u32 pb_Reserved2[15]; __be32 pb_Environment[17]; __u32 pb_EReserved[15]; }; #define IDNAME_PARTITION 0x50415254 /* "PART" */ #define RDB_ALLOCATION_LIMIT 16 #endif /* AFFS_HARDBLOCKS_H */ linux/agpgart.h 0000644 00000007544 15063602057 0007517 0 ustar 00 /* * AGPGART module version 0.99 * Copyright (C) 1999 Jeff Hartmann * Copyright (C) 1999 Precision Insight, Inc. * Copyright (C) 1999 Xi Graphics, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _AGP_H #define _AGP_H #define AGPIOC_BASE 'A' #define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*) #define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) #define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) #define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*) #define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*) #define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*) #define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*) #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) #define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*) #define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*) #define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10) #define AGP_DEVICE "/dev/agpgart" #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #include <linux/types.h> #include <stdlib.h> struct agp_version { __u16 major; __u16 minor; }; typedef struct _agp_info { struct agp_version version; /* version of the driver */ __u32 bridge_id; /* bridge vendor/device */ __u32 agp_mode; /* mode info of bridge */ unsigned long aper_base;/* base of aperture */ size_t aper_size; /* size of aperture */ size_t pg_total; /* max pages (swap + system) */ size_t pg_system; /* max pages (system) */ size_t pg_used; /* current pages used */ } agp_info; typedef struct _agp_setup { __u32 agp_mode; /* mode info of bridge */ } agp_setup; /* * The "prot" down below needs still a "sleep" flag somehow ... */ typedef struct _agp_segment { __kernel_off_t pg_start; /* starting page to populate */ __kernel_size_t pg_count; /* number of pages */ int prot; /* prot flags for mmap */ } agp_segment; typedef struct _agp_region { __kernel_pid_t pid; /* pid of process */ __kernel_size_t seg_count; /* number of segments */ struct _agp_segment *seg_list; } agp_region; typedef struct _agp_allocate { int key; /* tag of allocation */ __kernel_size_t pg_count;/* number of pages */ __u32 type; /* 0 == normal, other devspec */ __u32 physical; /* device specific (some devices * need a phys address of the * actual page behind the gatt * table) */ } agp_allocate; typedef struct _agp_bind { int key; /* tag of allocation */ __kernel_off_t pg_start;/* starting page to populate */ } agp_bind; typedef struct _agp_unbind { int key; /* tag of allocation */ __u32 priority; /* priority for paging out */ } agp_unbind; #endif /* _AGP_H */ linux/aio_abi.h 0000644 00000006531 15063602057 0007450 0 ustar 00 /* include/linux/aio_abi.h * * Copyright 2000,2001,2002 Red Hat. * * Written by Benjamin LaHaise <bcrl@kvack.org> * * Distribute under the terms of the GPLv2 (see ../../COPYING) or under * the following terms. * * Permission to use, copy, modify, and distribute this software and its * documentation is hereby granted, provided that the above copyright * notice appears in all copies. This software is provided without any * warranty, express or implied. Red Hat makes no representations about * the suitability of this software for any purpose. * * IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND * RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, * ENHANCEMENTS, OR MODIFICATIONS. */ #ifndef __LINUX__AIO_ABI_H #define __LINUX__AIO_ABI_H #include <linux/types.h> #include <linux/fs.h> #include <asm/byteorder.h> typedef __kernel_ulong_t aio_context_t; enum { IOCB_CMD_PREAD = 0, IOCB_CMD_PWRITE = 1, IOCB_CMD_FSYNC = 2, IOCB_CMD_FDSYNC = 3, /* These two are experimental. * IOCB_CMD_PREADX = 4, * IOCB_CMD_POLL = 5, */ IOCB_CMD_NOOP = 6, IOCB_CMD_PREADV = 7, IOCB_CMD_PWRITEV = 8, }; /* * Valid flags for the "aio_flags" member of the "struct iocb". * * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb" * is valid. * IOCB_FLAG_IOPRIO - Set if the "aio_reqprio" member of the "struct iocb" * is valid. */ #define IOCB_FLAG_RESFD (1 << 0) #define IOCB_FLAG_IOPRIO (1 << 1) /* read() from /dev/aio returns these structures. */ struct io_event { __u64 data; /* the data field from the iocb */ __u64 obj; /* what iocb this event came from */ __s64 res; /* result code for this event */ __s64 res2; /* secondary result */ }; /* * we always use a 64bit off_t when communicating * with userland. its up to libraries to do the * proper padding and aio_error abstraction */ struct iocb { /* these are internal to the kernel/libc. */ __u64 aio_data; /* data to be returned in event's data */ #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) __u32 aio_key; /* the kernel sets aio_key to the req # */ __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ __u32 aio_key; /* the kernel sets aio_key to the req # */ #else #error edit for your odd byteorder. #endif /* common fields */ __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ __s16 aio_reqprio; __u32 aio_fildes; __u64 aio_buf; __u64 aio_nbytes; __s64 aio_offset; /* extra parameters */ __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ /* flags for the "struct iocb" */ __u32 aio_flags; /* * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an * eventfd to signal AIO readiness to */ __u32 aio_resfd; }; /* 64 bytes */ #undef IFBIG #undef IFLITTLE #endif /* __LINUX__AIO_ABI_H */ linux/am437x-vpfe.h 0000644 00000007141 15063602057 0010044 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2013 - 2014 Texas Instruments, Inc. * * Benoit Parrot <bparrot@ti.com> * Lad, Prabhakar <prabhakar.csengg@gmail.com> * * This program is free software; you may redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef AM437X_VPFE_USER_H #define AM437X_VPFE_USER_H #include <linux/videodev2.h> enum vpfe_ccdc_data_size { VPFE_CCDC_DATA_16BITS = 0, VPFE_CCDC_DATA_15BITS, VPFE_CCDC_DATA_14BITS, VPFE_CCDC_DATA_13BITS, VPFE_CCDC_DATA_12BITS, VPFE_CCDC_DATA_11BITS, VPFE_CCDC_DATA_10BITS, VPFE_CCDC_DATA_8BITS, }; /* enum for No of pixel per line to be avg. in Black Clamping*/ enum vpfe_ccdc_sample_length { VPFE_CCDC_SAMPLE_1PIXELS = 0, VPFE_CCDC_SAMPLE_2PIXELS, VPFE_CCDC_SAMPLE_4PIXELS, VPFE_CCDC_SAMPLE_8PIXELS, VPFE_CCDC_SAMPLE_16PIXELS, }; /* enum for No of lines in Black Clamping */ enum vpfe_ccdc_sample_line { VPFE_CCDC_SAMPLE_1LINES = 0, VPFE_CCDC_SAMPLE_2LINES, VPFE_CCDC_SAMPLE_4LINES, VPFE_CCDC_SAMPLE_8LINES, VPFE_CCDC_SAMPLE_16LINES, }; /* enum for Alaw gamma width */ enum vpfe_ccdc_gamma_width { VPFE_CCDC_GAMMA_BITS_15_6 = 0, /* use bits 15-6 for gamma */ VPFE_CCDC_GAMMA_BITS_14_5, VPFE_CCDC_GAMMA_BITS_13_4, VPFE_CCDC_GAMMA_BITS_12_3, VPFE_CCDC_GAMMA_BITS_11_2, VPFE_CCDC_GAMMA_BITS_10_1, VPFE_CCDC_GAMMA_BITS_09_0, /* use bits 9-0 for gamma */ }; /* structure for ALaw */ struct vpfe_ccdc_a_law { /* Enable/disable A-Law */ unsigned char enable; /* Gamma Width Input */ enum vpfe_ccdc_gamma_width gamma_wd; }; /* structure for Black Clamping */ struct vpfe_ccdc_black_clamp { unsigned char enable; /* only if bClampEnable is TRUE */ enum vpfe_ccdc_sample_length sample_pixel; /* only if bClampEnable is TRUE */ enum vpfe_ccdc_sample_line sample_ln; /* only if bClampEnable is TRUE */ unsigned short start_pixel; /* only if bClampEnable is TRUE */ unsigned short sgain; /* only if bClampEnable is FALSE */ unsigned short dc_sub; }; /* structure for Black Level Compensation */ struct vpfe_ccdc_black_compensation { /* Constant value to subtract from Red component */ char r; /* Constant value to subtract from Gr component */ char gr; /* Constant value to subtract from Blue component */ char b; /* Constant value to subtract from Gb component */ char gb; }; /* Structure for CCDC configuration parameters for raw capture mode passed * by application */ struct vpfe_ccdc_config_params_raw { /* data size value from 8 to 16 bits */ enum vpfe_ccdc_data_size data_sz; /* Structure for Optional A-Law */ struct vpfe_ccdc_a_law alaw; /* Structure for Optical Black Clamp */ struct vpfe_ccdc_black_clamp blk_clamp; /* Structure for Black Compensation */ struct vpfe_ccdc_black_compensation blk_comp; }; /* * Private IOCTL * VIDIOC_AM437X_CCDC_CFG - Set CCDC configuration for raw capture * This is an experimental ioctl that will change in future kernels. So use * this ioctl with care ! **/ #define VIDIOC_AM437X_CCDC_CFG \ _IOW('V', BASE_VIDIOC_PRIVATE + 1, void *) #endif /* AM437X_VPFE_USER_H */ linux/apm_bios.h 0000644 00000007143 15063602057 0007656 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Include file for the interface to an APM BIOS * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _LINUX_APM_H #define _LINUX_APM_H #include <linux/types.h> typedef unsigned short apm_event_t; typedef unsigned short apm_eventinfo_t; struct apm_bios_info { __u16 version; __u16 cseg; __u32 offset; __u16 cseg_16; __u16 dseg; __u16 flags; __u16 cseg_len; __u16 cseg_16_len; __u16 dseg_len; }; /* * Power states */ #define APM_STATE_READY 0x0000 #define APM_STATE_STANDBY 0x0001 #define APM_STATE_SUSPEND 0x0002 #define APM_STATE_OFF 0x0003 #define APM_STATE_BUSY 0x0004 #define APM_STATE_REJECT 0x0005 #define APM_STATE_OEM_SYS 0x0020 #define APM_STATE_OEM_DEV 0x0040 #define APM_STATE_DISABLE 0x0000 #define APM_STATE_ENABLE 0x0001 #define APM_STATE_DISENGAGE 0x0000 #define APM_STATE_ENGAGE 0x0001 /* * Events (results of Get PM Event) */ #define APM_SYS_STANDBY 0x0001 #define APM_SYS_SUSPEND 0x0002 #define APM_NORMAL_RESUME 0x0003 #define APM_CRITICAL_RESUME 0x0004 #define APM_LOW_BATTERY 0x0005 #define APM_POWER_STATUS_CHANGE 0x0006 #define APM_UPDATE_TIME 0x0007 #define APM_CRITICAL_SUSPEND 0x0008 #define APM_USER_STANDBY 0x0009 #define APM_USER_SUSPEND 0x000a #define APM_STANDBY_RESUME 0x000b #define APM_CAPABILITY_CHANGE 0x000c #define APM_USER_HIBERNATION 0x000d #define APM_HIBERNATION_RESUME 0x000e /* * Error codes */ #define APM_SUCCESS 0x00 #define APM_DISABLED 0x01 #define APM_CONNECTED 0x02 #define APM_NOT_CONNECTED 0x03 #define APM_16_CONNECTED 0x05 #define APM_16_UNSUPPORTED 0x06 #define APM_32_CONNECTED 0x07 #define APM_32_UNSUPPORTED 0x08 #define APM_BAD_DEVICE 0x09 #define APM_BAD_PARAM 0x0a #define APM_NOT_ENGAGED 0x0b #define APM_BAD_FUNCTION 0x0c #define APM_RESUME_DISABLED 0x0d #define APM_NO_ERROR 0x53 #define APM_BAD_STATE 0x60 #define APM_NO_EVENTS 0x80 #define APM_NOT_PRESENT 0x86 /* * APM Device IDs */ #define APM_DEVICE_BIOS 0x0000 #define APM_DEVICE_ALL 0x0001 #define APM_DEVICE_DISPLAY 0x0100 #define APM_DEVICE_STORAGE 0x0200 #define APM_DEVICE_PARALLEL 0x0300 #define APM_DEVICE_SERIAL 0x0400 #define APM_DEVICE_NETWORK 0x0500 #define APM_DEVICE_PCMCIA 0x0600 #define APM_DEVICE_BATTERY 0x8000 #define APM_DEVICE_OEM 0xe000 #define APM_DEVICE_OLD_ALL 0xffff #define APM_DEVICE_CLASS 0x00ff #define APM_DEVICE_MASK 0xff00 /* * Battery status */ #define APM_MAX_BATTERIES 2 /* * APM defined capability bit flags */ #define APM_CAP_GLOBAL_STANDBY 0x0001 #define APM_CAP_GLOBAL_SUSPEND 0x0002 #define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */ #define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */ #define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */ #define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */ #define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */ #define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */ /* * ioctl operations */ #include <linux/ioctl.h> #define APM_IOC_STANDBY _IO('A', 1) #define APM_IOC_SUSPEND _IO('A', 2) #endif /* _LINUX_APM_H */ linux/arcfb.h 0000644 00000000325 15063602057 0007135 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_ARCFB_H__ #define __LINUX_ARCFB_H__ #define FBIO_WAITEVENT _IO('F', 0x88) #define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t) #endif linux/arm_sdei.h 0000644 00000005277 15063602057 0007656 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (C) 2017 Arm Ltd. */ #ifndef _LINUX_ARM_SDEI_H #define _LINUX_ARM_SDEI_H #define SDEI_1_0_FN_BASE 0xC4000020 #define SDEI_1_0_MASK 0xFFFFFFE0 #define SDEI_1_0_FN(n) (SDEI_1_0_FN_BASE + (n)) #define SDEI_1_0_FN_SDEI_VERSION SDEI_1_0_FN(0x00) #define SDEI_1_0_FN_SDEI_EVENT_REGISTER SDEI_1_0_FN(0x01) #define SDEI_1_0_FN_SDEI_EVENT_ENABLE SDEI_1_0_FN(0x02) #define SDEI_1_0_FN_SDEI_EVENT_DISABLE SDEI_1_0_FN(0x03) #define SDEI_1_0_FN_SDEI_EVENT_CONTEXT SDEI_1_0_FN(0x04) #define SDEI_1_0_FN_SDEI_EVENT_COMPLETE SDEI_1_0_FN(0x05) #define SDEI_1_0_FN_SDEI_EVENT_COMPLETE_AND_RESUME SDEI_1_0_FN(0x06) #define SDEI_1_0_FN_SDEI_EVENT_UNREGISTER SDEI_1_0_FN(0x07) #define SDEI_1_0_FN_SDEI_EVENT_STATUS SDEI_1_0_FN(0x08) #define SDEI_1_0_FN_SDEI_EVENT_GET_INFO SDEI_1_0_FN(0x09) #define SDEI_1_0_FN_SDEI_EVENT_ROUTING_SET SDEI_1_0_FN(0x0A) #define SDEI_1_0_FN_SDEI_PE_MASK SDEI_1_0_FN(0x0B) #define SDEI_1_0_FN_SDEI_PE_UNMASK SDEI_1_0_FN(0x0C) #define SDEI_1_0_FN_SDEI_INTERRUPT_BIND SDEI_1_0_FN(0x0D) #define SDEI_1_0_FN_SDEI_INTERRUPT_RELEASE SDEI_1_0_FN(0x0E) #define SDEI_1_0_FN_SDEI_PRIVATE_RESET SDEI_1_0_FN(0x11) #define SDEI_1_0_FN_SDEI_SHARED_RESET SDEI_1_0_FN(0x12) #define SDEI_VERSION_MAJOR_SHIFT 48 #define SDEI_VERSION_MAJOR_MASK 0x7fff #define SDEI_VERSION_MINOR_SHIFT 32 #define SDEI_VERSION_MINOR_MASK 0xffff #define SDEI_VERSION_VENDOR_SHIFT 0 #define SDEI_VERSION_VENDOR_MASK 0xffffffff #define SDEI_VERSION_MAJOR(x) (x>>SDEI_VERSION_MAJOR_SHIFT & SDEI_VERSION_MAJOR_MASK) #define SDEI_VERSION_MINOR(x) (x>>SDEI_VERSION_MINOR_SHIFT & SDEI_VERSION_MINOR_MASK) #define SDEI_VERSION_VENDOR(x) (x>>SDEI_VERSION_VENDOR_SHIFT & SDEI_VERSION_VENDOR_MASK) /* SDEI return values */ #define SDEI_SUCCESS 0 #define SDEI_NOT_SUPPORTED -1 #define SDEI_INVALID_PARAMETERS -2 #define SDEI_DENIED -3 #define SDEI_PENDING -5 #define SDEI_OUT_OF_RESOURCE -10 /* EVENT_REGISTER flags */ #define SDEI_EVENT_REGISTER_RM_ANY 0 #define SDEI_EVENT_REGISTER_RM_PE 1 /* EVENT_STATUS return value bits */ #define SDEI_EVENT_STATUS_RUNNING 2 #define SDEI_EVENT_STATUS_ENABLED 1 #define SDEI_EVENT_STATUS_REGISTERED 0 /* EVENT_COMPLETE status values */ #define SDEI_EV_HANDLED 0 #define SDEI_EV_FAILED 1 /* GET_INFO values */ #define SDEI_EVENT_INFO_EV_TYPE 0 #define SDEI_EVENT_INFO_EV_SIGNALED 1 #define SDEI_EVENT_INFO_EV_PRIORITY 2 #define SDEI_EVENT_INFO_EV_ROUTING_MODE 3 #define SDEI_EVENT_INFO_EV_ROUTING_AFF 4 /* and their results */ #define SDEI_EVENT_TYPE_PRIVATE 0 #define SDEI_EVENT_TYPE_SHARED 1 #define SDEI_EVENT_PRIORITY_NORMAL 0 #define SDEI_EVENT_PRIORITY_CRITICAL 1 #endif /* _LINUX_ARM_SDEI_H */ linux/aspeed-lpc-ctrl.h 0000644 00000003364 15063602057 0011045 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2017 IBM Corp. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_ASPEED_LPC_CTRL_H #define _LINUX_ASPEED_LPC_CTRL_H #include <linux/ioctl.h> #include <linux/types.h> /* Window types */ #define ASPEED_LPC_CTRL_WINDOW_FLASH 1 #define ASPEED_LPC_CTRL_WINDOW_MEMORY 2 /* * This driver provides a window for the host to access a BMC resource * across the BMC <-> Host LPC bus. * * window_type: The BMC resource that the host will access through the * window. BMC flash and BMC RAM. * * window_id: For each window type there may be multiple windows, * these are referenced by ID. * * flags: Reserved for future use, this field is expected to be * zeroed. * * addr: Address on the host LPC bus that the specified window should * be mapped. This address must be power of two aligned. * * offset: Offset into the BMC window that should be mapped to the * host (at addr). This must be a multiple of size. * * size: The size of the mapping. The smallest possible size is 64K. * This must be power of two aligned. * */ struct aspeed_lpc_ctrl_mapping { __u8 window_type; __u8 window_id; __u16 flags; __u32 addr; __u32 offset; __u32 size; }; #define __ASPEED_LPC_CTRL_IOCTL_MAGIC 0xb2 #define ASPEED_LPC_CTRL_IOCTL_GET_SIZE _IOWR(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \ 0x00, struct aspeed_lpc_ctrl_mapping) #define ASPEED_LPC_CTRL_IOCTL_MAP _IOW(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \ 0x01, struct aspeed_lpc_ctrl_mapping) #endif /* _LINUX_ASPEED_LPC_CTRL_H */ linux/atalk.h 0000644 00000001777 15063602057 0007170 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_ATALK_H__ #define __LINUX_ATALK_H__ #include <linux/types.h> #include <asm/byteorder.h> #include <linux/socket.h> /* * AppleTalk networking structures * * The following are directly referenced from the University Of Michigan * netatalk for compatibility reasons. */ #define ATPORT_FIRST 1 #define ATPORT_RESERVED 128 #define ATPORT_LAST 254 /* 254 is only legal on localtalk */ #define ATADDR_ANYNET (__u16)0 #define ATADDR_ANYNODE (__u8)0 #define ATADDR_ANYPORT (__u8)0 #define ATADDR_BCAST (__u8)255 #define DDP_MAXSZ 587 #define DDP_MAXHOPS 15 /* 4 bits of hop counter */ #define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) struct atalk_addr { __be16 s_net; __u8 s_node; }; struct sockaddr_at { __kernel_sa_family_t sat_family; __u8 sat_port; struct atalk_addr sat_addr; char sat_zero[8]; }; struct atalk_netrange { __u8 nr_phase; __be16 nr_firstnet; __be16 nr_lastnet; }; #endif /* __LINUX_ATALK_H__ */ linux/atm.h 0000644 00000017320 15063602057 0006644 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm.h - general ATM declarations */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ /* * WARNING: User-space programs should not #include <linux/atm.h> directly. * Instead, #include <atm.h> */ #ifndef _LINUX_ATM_H #define _LINUX_ATM_H /* * BEGIN_xx and END_xx markers are used for automatic generation of * documentation. Do not change them. */ #include <linux/atmapi.h> #include <linux/atmsap.h> #include <linux/atmioc.h> #include <linux/types.h> /* general ATM constants */ #define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ #define ATM_CELL_PAYLOAD 48 /* ATM payload size */ #define ATM_AAL0_SDU 52 /* AAL0 SDU size */ #define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */ #define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */ #define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */ #define ATM_MAX_CDV 9999 /* maximum (default) CDV */ #define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */ #define ATM_MAX_VPI 255 /* maximum VPI at the UNI */ #define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */ #define ATM_MAX_VCI 65535 /* maximum VCI */ /* "protcol" values for the socket system call */ #define ATM_NO_AAL 0 /* AAL not specified */ #define ATM_AAL0 13 /* "raw" ATM cells */ #define ATM_AAL1 1 /* AAL1 (CBR) */ #define ATM_AAL2 2 /* AAL2 (VBR) */ #define ATM_AAL34 3 /* AAL3/4 (data) */ #define ATM_AAL5 5 /* AAL5 (data) */ /* * socket option name coding functions * * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the * << 22 only reserves 9 bits for the level. On some architectures * SOL_SOCKET is 0xFFFF, so that's a bit of a problem */ #define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \ sizeof(t)) #define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) #define __SO_NUMBER(c) (((c) >> 16) & 0x3f) #define __SO_SIZE(c) ((c) & 0x3fff) /* * ATM layer */ #define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) /* set CLP bit value - TODO */ #define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) /* connection identifier range; socket must be bound or connected */ #define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) /* Quality of Service setting */ #define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) /* Service Access Point */ #define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) /* "PVC" address (also for SVCs); get only */ #define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) /* make this vc a p2mp */ /* * Note @@@: since the socket layers don't really distinguish the control and * the data plane but generally seems to be data plane-centric, any layer is * about equally wrong for the SAP. If you have a better idea about this, * please speak up ... */ /* ATM cell header (for AAL0) */ /* BEGIN_CH */ #define ATM_HDR_GFC_MASK 0xf0000000 #define ATM_HDR_GFC_SHIFT 28 #define ATM_HDR_VPI_MASK 0x0ff00000 #define ATM_HDR_VPI_SHIFT 20 #define ATM_HDR_VCI_MASK 0x000ffff0 #define ATM_HDR_VCI_SHIFT 4 #define ATM_HDR_PTI_MASK 0x0000000e #define ATM_HDR_PTI_SHIFT 1 #define ATM_HDR_CLP 0x00000001 /* END_CH */ /* PTI codings */ /* BEGIN_PTI */ #define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */ #define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */ #define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */ #define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */ #define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */ #define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */ #define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */ #define ATM_PTI_RSV 7 /* reserved */ /* END_PTI */ /* * The following items should stay in linux/atm.h, which should be linked to * netatm/atm.h */ /* Traffic description */ #define ATM_NONE 0 /* no traffic */ #define ATM_UBR 1 #define ATM_CBR 2 #define ATM_VBR 3 #define ATM_ABR 4 #define ATM_ANYCLASS 5 /* compatible with everything */ #define ATM_MAX_PCR -1 /* maximum available PCR */ struct atm_trafprm { unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ int max_pcr; /* maximum PCR in cells per second */ int pcr; /* desired PCR in cells per second */ int min_pcr; /* minimum PCR in cells per second */ int max_cdv; /* maximum CDV in microseconds */ int max_sdu; /* maximum SDU in bytes */ /* extra params for ABR */ unsigned int icr; /* Initial Cell Rate (24-bit) */ unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */ unsigned int rif : 4; /* Rate Increment Factor (4-bit) */ unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */ unsigned int nrm_pres :1; /* nrm present bit */ unsigned int trm_pres :1; /* rm present bit */ unsigned int adtf_pres :1; /* adtf present bit */ unsigned int cdf_pres :1; /* cdf present bit*/ unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */ unsigned int trm :3; /* Time between forward RM cells (3-bit) */ unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ unsigned int spare :9; /* spare bits */ }; struct atm_qos { struct atm_trafprm txtp; /* parameters in TX direction */ struct atm_trafprm rxtp __ATM_API_ALIGN; /* parameters in RX direction */ unsigned char aal __ATM_API_ALIGN; }; /* PVC addressing */ #define ATM_ITF_ANY -1 /* "magic" PVC address values */ #define ATM_VPI_ANY -1 #define ATM_VCI_ANY -1 #define ATM_VPI_UNSPEC -2 #define ATM_VCI_UNSPEC -2 struct sockaddr_atmpvc { unsigned short sap_family; /* address family, AF_ATMPVC */ struct { /* PVC address */ short itf; /* ATM interface */ short vpi; /* VPI (only 8 bits at UNI) */ int vci; /* VCI (only 16 bits at UNI) */ } sap_addr __ATM_API_ALIGN; /* PVC address */ }; /* SVC addressing */ #define ATM_ESA_LEN 20 /* ATM End System Address length */ #define ATM_E164_LEN 12 /* maximum E.164 number length */ #define ATM_AFI_DCC 0x39 /* DCC ATM Format */ #define ATM_AFI_ICD 0x47 /* ICD ATM Format */ #define ATM_AFI_E164 0x45 /* E.164 ATM Format */ #define ATM_AFI_LOCAL 0x49 /* Local ATM Format */ #define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */ #define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */ #define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */ #define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */ #define ATM_LIJ_NONE 0 /* no leaf-initiated join */ #define ATM_LIJ 1 /* request joining */ #define ATM_LIJ_RPJ 2 /* set to root-prompted join */ #define ATM_LIJ_NJ 3 /* set to network join */ struct sockaddr_atmsvc { unsigned short sas_family; /* address family, AF_ATMSVC */ struct { /* SVC address */ unsigned char prv[ATM_ESA_LEN];/* private ATM address */ char pub[ATM_E164_LEN+1]; /* public address (E.164) */ /* unused addresses must be bzero'ed */ char lij_type; /* role in LIJ call; one of ATM_LIJ* */ __u32 lij_id; /* LIJ call identifier */ } sas_addr __ATM_API_ALIGN; /* SVC address */ }; static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr) { return *addr.sas_addr.prv || *addr.sas_addr.pub; } static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr) { return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci; } /* * Some stuff for linux/sockios.h */ struct atmif_sioc { int number; int length; void *arg; }; typedef unsigned short atm_backend_t; #endif /* _LINUX_ATM_H */ linux/atm_eni.h 0000644 00000001210 15063602057 0007466 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_eni.h - Driver-specific declarations of the ENI driver (for use by driver-specific utilities) */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATM_ENI_H #define LINUX_ATM_ENI_H #include <linux/atmioc.h> struct eni_multipliers { int tx,rx; /* values are in percent and must be > 100 */ }; #define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc) /* printk memory map */ #define ENI_SETMULT _IOW('a',ATMIOC_SARPRV+7,struct atmif_sioc) /* set buffer multipliers */ #endif linux/atm_he.h 0000644 00000000626 15063602057 0007321 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_he.h */ #ifndef LINUX_ATM_HE_H #define LINUX_ATM_HE_H #include <linux/atmioc.h> #define HE_GET_REG _IOW('a', ATMIOC_SARPRV, struct atmif_sioc) #define HE_REGTYPE_PCI 1 #define HE_REGTYPE_RCM 2 #define HE_REGTYPE_TCM 3 #define HE_REGTYPE_MBOX 4 struct he_ioctl_reg { unsigned addr, val; char type; }; #endif /* LINUX_ATM_HE_H */ linux/atm_idt77105.h 0000644 00000001673 15063602057 0010114 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for * use by driver-specific utilities) */ /* Written 1999 by Greg Banks <gnb@linuxfan.com>. Copied from atm_suni.h. */ #ifndef LINUX_ATM_IDT77105_H #define LINUX_ATM_IDT77105_H #include <linux/types.h> #include <linux/atmioc.h> #include <linux/atmdev.h> /* * Structure for IDT77105_GETSTAT and IDT77105_GETSTATZ ioctls. * Pointed to by `arg' in atmif_sioc. */ struct idt77105_stats { __u32 symbol_errors; /* wire symbol errors */ __u32 tx_cells; /* cells transmitted */ __u32 rx_cells; /* cells received */ __u32 rx_hec_errors; /* Header Error Check errors on receive */ }; #define IDT77105_GETSTAT _IOW('a',ATMIOC_PHYPRV+2,struct atmif_sioc) /* get stats */ #define IDT77105_GETSTATZ _IOW('a',ATMIOC_PHYPRV+3,struct atmif_sioc) /* get stats and zero */ #endif linux/atm_nicstar.h 0000644 00000002376 15063602057 0010374 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /****************************************************************************** * * atm_nicstar.h * * Driver-specific declarations for use by NICSTAR driver specific utils. * * Author: Rui Prior * * (C) INESC 1998 * ******************************************************************************/ #ifndef LINUX_ATM_NICSTAR_H #define LINUX_ATM_NICSTAR_H /* Note: non-kernel programs including this file must also include * sys/types.h for struct timeval */ #include <linux/atmapi.h> #include <linux/atmioc.h> #define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc) /* get pool statistics */ #define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) /* set buffer level markers */ #define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3) /* adjust buffer level */ typedef struct buf_nr { unsigned min; unsigned init; unsigned max; }buf_nr; typedef struct pool_levels { int buftype; int count; /* (At least for now) only used in NS_GETPSTAT */ buf_nr level; } pool_levels; /* type must be one of the following: */ #define NS_BUFTYPE_SMALL 1 #define NS_BUFTYPE_LARGE 2 #define NS_BUFTYPE_HUGE 3 #define NS_BUFTYPE_IOVEC 4 #endif /* LINUX_ATM_NICSTAR_H */ linux/atm_tcp.h 0000644 00000003126 15063602057 0007511 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by driver-specific utilities) */ /* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATM_TCP_H #define LINUX_ATM_TCP_H #include <linux/atmapi.h> #include <linux/atm.h> #include <linux/atmioc.h> #include <linux/types.h> /* * All values in struct atmtcp_hdr are in network byte order */ struct atmtcp_hdr { __u16 vpi; __u16 vci; __u32 length; /* ... of data part */ }; /* * All values in struct atmtcp_command are in host byte order */ #define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */ #define ATMTCP_CTRL_OPEN 1 /* request/reply */ #define ATMTCP_CTRL_CLOSE 2 /* request/reply */ struct atmtcp_control { struct atmtcp_hdr hdr; /* must be first */ int type; /* message type; both directions */ atm_kptr_t vcc; /* both directions */ struct sockaddr_atmpvc addr; /* suggested value from kernel */ struct atm_qos qos; /* both directions */ int result; /* to kernel only */ } __ATM_API_ALIGN; /* * Field usage: * Messge type dir. hdr.v?i type addr qos vcc result * ----------- ---- ------- ---- ---- --- --- ------ * OPEN K->D Y Y Y Y Y 0 * OPEN D->K - Y Y Y Y Y * CLOSE K->D - - Y - Y 0 * CLOSE D->K - - - - Y Y */ #define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */ #define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP interface */ #define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP interface */ #endif /* LINUX_ATM_TCP_H */ linux/atm_zatm.h 0000644 00000003004 15063602057 0007671 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by driver-specific utilities) */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATM_ZATM_H #define LINUX_ATM_ZATM_H /* * Note: non-kernel programs including this file must also include * sys/types.h for struct timeval */ #include <linux/atmapi.h> #include <linux/atmioc.h> #define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc) /* get pool statistics */ #define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) /* get statistics and zero */ #define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc) /* set pool parameters */ struct zatm_pool_info { int ref_count; /* free buffer pool usage counters */ int low_water,high_water; /* refill parameters */ int rqa_count,rqu_count; /* queue condition counters */ int offset,next_off; /* alignment optimizations: offset */ int next_cnt,next_thres; /* repetition counter and threshold */ }; struct zatm_pool_req { int pool_num; /* pool number */ struct zatm_pool_info info; /* actual information */ }; #define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */ #define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */ #define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */ #define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */ #define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to record; must be 2^n */ #endif linux/atmapi.h 0000644 00000001670 15063602057 0007337 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmapi.h - ATM API user space/kernel compatibility */ /* Written 1999,2000 by Werner Almesberger, EPFL ICA */ #ifndef _LINUX_ATMAPI_H #define _LINUX_ATMAPI_H #if defined(__sparc__) || defined(__ia64__) /* such alignment is not required on 32 bit sparcs, but we can't figure that we are on a sparc64 while compiling user-space programs. */ #define __ATM_API_ALIGN __attribute__((aligned(8))) #else #define __ATM_API_ALIGN #endif /* * Opaque type for kernel pointers. Note that _ is never accessed. We need * the struct in order hide the array, so that we can make simple assignments * instead of being forced to use memcpy. It also improves error reporting for * code that still assumes that we're passing unsigned longs. * * Convention: NULL pointers are passed as a field of all zeroes. */ typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; #endif linux/atmarp.h 0000644 00000002420 15063602057 0007342 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ #ifndef _LINUX_ATMARP_H #define _LINUX_ATMARP_H #include <linux/types.h> #include <linux/atmapi.h> #include <linux/atmioc.h> #define ATMARP_RETRY_DELAY 30 /* request next resolution or forget NAK after 30 sec - should go into atmclip.h */ #define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while waiting for the resolver */ #define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */ #define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */ #define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */ #define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */ enum atmarp_ctrl_type { act_invalid, /* catch uninitialized structures */ act_need, /* need address resolution */ act_up, /* interface is coming up */ act_down, /* interface is going down */ act_change /* interface configuration has changed */ }; struct atmarp_ctrl { enum atmarp_ctrl_type type; /* message type */ int itf_num;/* interface number (if present) */ __be32 ip; /* IP address (act_need only) */ }; #endif linux/atmbr2684.h 0000644 00000006307 15063602057 0007517 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_ATMBR2684_H #define _LINUX_ATMBR2684_H #include <linux/types.h> #include <linux/atm.h> #include <linux/if.h> /* For IFNAMSIZ */ /* * Type of media we're bridging (ethernet, token ring, etc) Currently only * ethernet is supported */ #define BR2684_MEDIA_ETHERNET (0) /* 802.3 */ #define BR2684_MEDIA_802_4 (1) /* 802.4 */ #define BR2684_MEDIA_TR (2) /* 802.5 - token ring */ #define BR2684_MEDIA_FDDI (3) #define BR2684_MEDIA_802_6 (4) /* 802.6 */ /* used only at device creation: */ #define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */ /* * Is there FCS inbound on this VC? This currently isn't supported. */ #define BR2684_FCSIN_NO (0) #define BR2684_FCSIN_IGNORE (1) #define BR2684_FCSIN_VERIFY (2) /* * Is there FCS outbound on this VC? This currently isn't supported. */ #define BR2684_FCSOUT_NO (0) #define BR2684_FCSOUT_SENDZERO (1) #define BR2684_FCSOUT_GENERATE (2) /* * Does this VC include LLC encapsulation? */ #define BR2684_ENCAPS_VC (0) /* VC-mux */ #define BR2684_ENCAPS_LLC (1) #define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ /* * Is this VC bridged or routed? */ #define BR2684_PAYLOAD_ROUTED (0) #define BR2684_PAYLOAD_BRIDGED (1) /* * This is for the ATM_NEWBACKENDIF call - these are like socket families: * the first element of the structure is the backend number and the rest * is per-backend specific */ struct atm_newif_br2684 { atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ int media; /* BR2684_MEDIA_*, flags in upper bits */ char ifname[IFNAMSIZ]; int mtu; }; /* * This structure is used to specify a br2684 interface - either by a * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name */ #define BR2684_FIND_BYNOTHING (0) #define BR2684_FIND_BYNUM (1) #define BR2684_FIND_BYIFNAME (2) struct br2684_if_spec { int method; /* BR2684_FIND_* */ union { char ifname[IFNAMSIZ]; int devnum; } spec; }; /* * This is for the ATM_SETBACKEND call - these are like socket families: * the first element of the structure is the backend number and the rest * is per-backend specific */ struct atm_backend_br2684 { atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ struct br2684_if_spec ifspec; int fcs_in; /* BR2684_FCSIN_* */ int fcs_out; /* BR2684_FCSOUT_* */ int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ int encaps; /* BR2684_ENCAPS_* */ int has_vpiid; /* 1: use vpn_id - Unsupported */ __u8 vpn_id[7]; int send_padding; /* unsupported */ int min_size; /* we will pad smaller packets than this */ }; /* * The BR2684_SETFILT ioctl is an experimental mechanism for folks * terminating a large number of IP-only vcc's. When netfilter allows * efficient per-if in/out filters, this support will be removed */ struct br2684_filter { __be32 prefix; /* network byte order */ __be32 netmask; /* 0 = disable filter */ }; struct br2684_filter_set { struct br2684_if_spec ifspec; struct br2684_filter filter; }; enum br2684_payload { p_routed = BR2684_PAYLOAD_ROUTED, p_bridged = BR2684_PAYLOAD_BRIDGED, }; #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ struct br2684_filter_set) #endif /* _LINUX_ATMBR2684_H */ linux/atmclip.h 0000644 00000001100 15063602057 0007501 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmclip.h - Classical IP over ATM */ /* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATMCLIP_H #define LINUX_ATMCLIP_H #include <linux/sockios.h> #include <linux/atmioc.h> #define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */ #define RFC1626_MTU 9180 /* RFC1626 default MTU */ #define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */ #define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */ #define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */ #endif linux/atmdev.h 0000644 00000016775 15063602057 0007360 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmdev.h - ATM device driver declarations and various related items */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef LINUX_ATMDEV_H #define LINUX_ATMDEV_H #include <linux/atmapi.h> #include <linux/atm.h> #include <linux/atmioc.h> #define ESI_LEN 6 #define ATM_OC3_PCR (155520000/270*260/8/53) /* OC3 link rate: 155520000 bps SONET overhead: /270*260 (9 section, 1 path) bits per cell: /8/53 max cell rate: 353207.547 cells/sec */ #define ATM_25_PCR ((25600000/8-8000)/54) /* 25 Mbps ATM cell rate (59111) */ #define ATM_OC12_PCR (622080000/1080*1040/8/53) /* OC12 link rate: 622080000 bps SONET overhead: /1080*1040 bits per cell: /8/53 max cell rate: 1412830.188 cells/sec */ #define ATM_DS3_PCR (8000*12) /* DS3: 12 cells in a 125 usec time slot */ #define __AAL_STAT_ITEMS \ __HANDLE_ITEM(tx); /* TX okay */ \ __HANDLE_ITEM(tx_err); /* TX errors */ \ __HANDLE_ITEM(rx); /* RX okay */ \ __HANDLE_ITEM(rx_err); /* RX errors */ \ __HANDLE_ITEM(rx_drop); /* RX out of memory */ struct atm_aal_stats { #define __HANDLE_ITEM(i) int i __AAL_STAT_ITEMS #undef __HANDLE_ITEM }; struct atm_dev_stats { struct atm_aal_stats aal0; struct atm_aal_stats aal34; struct atm_aal_stats aal5; } __ATM_API_ALIGN; #define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) /* get link rate */ #define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) /* get interface names (numbers) */ #define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) /* get interface type name */ #define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) /* get interface ESI */ #define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) /* get itf's local ATM addr. list */ #define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) /* reset itf's ATM address list */ #define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) /* add a local ATM address */ #define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) /* remove a local ATM address */ #define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) /* get connection identifier range */ #define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) /* set connection identifier range */ #define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) /* set interface ESI */ #define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) /* force interface ESI */ #define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) /* register a LECS address */ #define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) /* unregister a LECS address */ #define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) /* retrieve LECS address(es) */ #define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) /* get AAL layer statistics */ #define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) /* get AAL layer statistics and zero */ #define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) /* get loopback mode */ #define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) /* set loopback mode */ #define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) /* query supported loopback modes */ #define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) /* enable or disable single-copy */ #define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) /* set backend handler */ #define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) /* use backend to make new if */ #define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) /* add party to p2mp call */ #ifdef CONFIG_COMPAT /* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */ #define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf) #endif #define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) /* drop party from p2mp call */ /* * These are backend handkers that can be set via the ATM_SETBACKEND call * above. In the future we may support dynamic loading of these - for now, * they're just being used to share the ATMIOC_BACKEND ioctls */ #define ATM_BACKEND_RAW 0 #define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ #define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ /* for ATM_GETTYPE */ #define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ /* * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP */ /* Point of loopback CPU-->SAR-->PHY-->line--> ... */ #define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ #define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ #define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ /* RESERVED 4 loop back on PHY side ---' */ #define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ #define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ /* Direction of loopback */ #define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ #define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ #define __ATM_LM_XTLOC(n) ((n) & 0xff) #define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) #define ATM_LM_NONE 0 /* no loopback */ #define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) #define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) #define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) #define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) #define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) #define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) #define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) #define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) /* * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) */ struct atm_iobuf { int length; void *buffer; }; /* for ATM_GETCIRANGE / ATM_SETCIRANGE */ #define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ struct atm_cirange { signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ }; /* for ATM_SETSC; actually taken from the ATM_VF number space */ #define ATM_SC_RX 1024 /* enable RX single-copy */ #define ATM_SC_TX 2048 /* enable TX single-copy */ #define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out anyway */ /* MF: change_qos (Modify) flags */ #define ATM_MF_IMMED 1 /* Block until change is effective */ #define ATM_MF_INC_RSV 2 /* Change reservation on increase */ #define ATM_MF_INC_SHP 4 /* Change shaping on increase */ #define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ #define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ #define ATM_MF_BWD 32 /* Set the backward direction parameters */ #define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ ATM_MF_DEC_SHP | ATM_MF_BWD) /* * ATM_VS_* are used to express VC state in a human-friendly way. */ #define ATM_VS_IDLE 0 /* VC is not used */ #define ATM_VS_CONNECTED 1 /* VC is connected */ #define ATM_VS_CLOSING 2 /* VC is closing */ #define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ #define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ #define ATM_VS_BOUND 5 /* VC is bound */ #define ATM_VS2TXT_MAP \ "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" #define ATM_VF2TXT_MAP \ "ADDR", "READY", "PARTIAL", "REGIS", \ "RELEASED", "HASQOS", "LISTEN", "META", \ "256", "512", "1024", "2048", \ "SESSION", "HASSAP", "BOUND", "CLOSE" #endif /* LINUX_ATMDEV_H */ linux/atmioc.h 0000644 00000003156 15063602057 0007341 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmioc.h - ranges for ATM-related ioctl numbers */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ /* * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of * "magic" ioctl numbers. */ #ifndef _LINUX_ATMIOC_H #define _LINUX_ATMIOC_H #include <asm/ioctl.h> /* everybody including atmioc.h will also need _IO{,R,W,WR} */ #define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ #define ATMIOC_PHYCOM_END 0x0f #define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ #define ATMIOC_PHYTYP_END 0x2f #define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ #define ATMIOC_PHYPRV_END 0x4f #define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ #define ATMIOC_SARCOM_END 0x50 #define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ #define ATMIOC_SARPRV_END 0x7f #define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ #define ATMIOC_ITF_END 0x8f #define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ #define ATMIOC_BACKEND_END 0xaf /* 0xb0-0xbf: Reserved for future use */ #define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ #define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ #define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ #define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ #define ATMIOC_CLIP_END 0xef #define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ #define ATMIOC_SPECIAL_END 0xff #endif linux/atmlec.h 0000644 00000004515 15063602057 0007332 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * ATM Lan Emulation Daemon driver interface * * Marko Kiiskila <mkiiskila@yahoo.com> */ #ifndef _ATMLEC_H_ #define _ATMLEC_H_ #include <linux/atmapi.h> #include <linux/atmioc.h> #include <linux/atm.h> #include <linux/if_ether.h> #include <linux/types.h> /* ATM lec daemon control socket */ #define ATMLEC_CTRL _IO('a', ATMIOC_LANE) #define ATMLEC_DATA _IO('a', ATMIOC_LANE+1) #define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2) /* Maximum number of LEC interfaces (tweakable) */ #define MAX_LEC_ITF 48 typedef enum { l_set_mac_addr, l_del_mac_addr, l_svc_setup, l_addr_delete, l_topology_change, l_flush_complete, l_arp_update, l_narp_req, /* LANE2 mandates the use of this */ l_config, l_flush_tran_id, l_set_lecid, l_arp_xmt, l_rdesc_arp_xmt, l_associate_req, l_should_bridge /* should we bridge this MAC? */ } atmlec_msg_type; #define ATMLEC_MSG_TYPE_MAX l_should_bridge struct atmlec_config_msg { unsigned int maximum_unknown_frame_count; unsigned int max_unknown_frame_time; unsigned short max_retry_count; unsigned int aging_time; unsigned int forward_delay_time; unsigned int arp_response_time; unsigned int flush_timeout; unsigned int path_switching_delay; unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */ int mtu; int is_proxy; }; struct atmlec_msg { atmlec_msg_type type; int sizeoftlvs; /* LANE2: if != 0, tlvs follow */ union { struct { unsigned char mac_addr[ETH_ALEN]; unsigned char atm_addr[ATM_ESA_LEN]; unsigned int flag; /* * Topology_change flag, * remoteflag, permanent flag, * lecid, transaction id */ unsigned int targetless_le_arp; /* LANE2 */ unsigned int no_source_le_narp; /* LANE2 */ } normal; struct atmlec_config_msg config; struct { __u16 lec_id; /* requestor lec_id */ __u32 tran_id; /* transaction id */ unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ } proxy; /* * For mapping LE_ARP requests to responses. Filled by * zeppelin, returned by kernel. Used only when proxying */ } content; } __ATM_API_ALIGN; struct atmlec_ioc { int dev_num; unsigned char atm_addr[ATM_ESA_LEN]; unsigned char receive; /* 1= receive vcc, 0 = send vcc */ }; #endif /* _ATMLEC_H_ */ linux/atmmpc.h 0000644 00000010202 15063602057 0007334 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ATMMPC_H_ #define _ATMMPC_H_ #include <linux/atmapi.h> #include <linux/atmioc.h> #include <linux/atm.h> #include <linux/types.h> #define ATMMPC_CTRL _IO('a', ATMIOC_MPOA) #define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1) #define MPC_SOCKET_INGRESS 1 #define MPC_SOCKET_EGRESS 2 struct atmmpc_ioc { int dev_num; __be32 ipaddr; /* the IP address of the shortcut */ int type; /* ingress or egress */ }; typedef struct in_ctrl_info { __u8 Last_NHRP_CIE_code; __u8 Last_Q2931_cause_value; __u8 eg_MPC_ATM_addr[ATM_ESA_LEN]; __be32 tag; __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */ __u16 holding_time; __u32 request_id; } in_ctrl_info; typedef struct eg_ctrl_info { __u8 DLL_header[256]; __u8 DH_length; __be32 cache_id; __be32 tag; __be32 mps_ip; __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */ __u8 in_MPC_data_ATM_addr[ATM_ESA_LEN]; __u16 holding_time; } eg_ctrl_info; struct mpc_parameters { __u16 mpc_p1; /* Shortcut-Setup Frame Count */ __u16 mpc_p2; /* Shortcut-Setup Frame Time */ __u8 mpc_p3[8]; /* Flow-detection Protocols */ __u16 mpc_p4; /* MPC Initial Retry Time */ __u16 mpc_p5; /* MPC Retry Time Maximum */ __u16 mpc_p6; /* Hold Down Time */ } ; struct k_message { __u16 type; __be32 ip_mask; __u8 MPS_ctrl[ATM_ESA_LEN]; union { in_ctrl_info in_info; eg_ctrl_info eg_info; struct mpc_parameters params; } content; struct atm_qos qos; } __ATM_API_ALIGN; struct llc_snap_hdr { /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */ __u8 dsap; /* Destination Service Access Point (0xAA) */ __u8 ssap; /* Source Service Access Point (0xAA) */ __u8 ui; /* Unnumbered Information (0x03) */ __u8 org[3]; /* Organizational identification (0x000000) */ __u8 type[2]; /* Ether type (for IP) (0x0800) */ }; /* TLVs this MPC recognizes */ #define TLV_MPOA_DEVICE_TYPE 0x00a03e2a /* MPOA device types in MPOA Device Type TLV */ #define NON_MPOA 0 #define MPS 1 #define MPC 2 #define MPS_AND_MPC 3 /* MPC parameter defaults */ #define MPC_P1 10 /* Shortcut-Setup Frame Count */ #define MPC_P2 1 /* Shortcut-Setup Frame Time */ #define MPC_P3 0 /* Flow-detection Protocols */ #define MPC_P4 5 /* MPC Initial Retry Time */ #define MPC_P5 40 /* MPC Retry Time Maximum */ #define MPC_P6 160 /* Hold Down Time */ #define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */ /* MPC constants */ #define MPC_C1 2 /* Retry Time Multiplier */ #define MPC_C2 60 /* Initial Keep-Alive Lifetime */ /* Message types - to MPOA daemon */ #define SND_MPOA_RES_RQST 201 #define SET_MPS_CTRL_ADDR 202 #define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */ #define STOP_KEEP_ALIVE_SM 204 #define EGRESS_ENTRY_REMOVED 205 #define SND_EGRESS_PURGE 206 #define DIE 207 /* tell the daemon to exit() */ #define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */ #define OPEN_INGRESS_SVC 209 /* Message types - from MPOA daemon */ #define MPOA_TRIGGER_RCVD 101 #define MPOA_RES_REPLY_RCVD 102 #define INGRESS_PURGE_RCVD 103 #define EGRESS_PURGE_RCVD 104 #define MPS_DEATH 105 #define CACHE_IMPOS_RCVD 106 #define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */ #define SET_MPS_MAC_ADDR 108 #define CLEAN_UP_AND_EXIT 109 #define SET_MPC_PARAMS 110 /* MPC configuration parameters */ /* Message types - bidirectional */ #define RELOAD 301 /* kill -HUP the daemon for reload */ #endif /* _ATMMPC_H_ */ linux/atmppp.h 0000644 00000001177 15063602057 0007367 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmppp.h - RFC2364 PPPoATM */ /* Written 2000 by Mitchell Blank Jr */ #ifndef _LINUX_ATMPPP_H #define _LINUX_ATMPPP_H #include <linux/atm.h> #define PPPOATM_ENCAPS_AUTODETECT (0) #define PPPOATM_ENCAPS_VC (1) #define PPPOATM_ENCAPS_LLC (2) /* * This is for the ATM_SETBACKEND call - these are like socket families: * the first element of the structure is the backend number and the rest * is per-backend specific */ struct atm_backend_ppp { atm_backend_t backend_num; /* ATM_BACKEND_PPP */ int encaps; /* PPPOATM_ENCAPS_* */ }; #endif /* _LINUX_ATMPPP_H */ linux/atmsap.h 0000644 00000011552 15063602057 0007351 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmsap.h - ATM Service Access Point addressing definitions */ /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ #ifndef _LINUX_ATMSAP_H #define _LINUX_ATMSAP_H #include <linux/atmapi.h> /* * BEGIN_xx and END_xx markers are used for automatic generation of * documentation. Do not change them. */ /* * Layer 2 protocol identifiers */ /* BEGIN_L2 */ #define ATM_L2_NONE 0 /* L2 not specified */ #define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */ #define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */ #define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */ #define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */ #define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */ #define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */ #define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */ #define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */ #define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */ #define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */ #define ATM_L2_Q922 0x0e /* ITU-T Q.922 */ #define ATM_L2_USER 0x10 /* user-specified */ #define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */ /* END_L2 */ /* * Layer 3 protocol identifiers */ /* BEGIN_L3 */ #define ATM_L3_NONE 0 /* L3 not specified */ #define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */ #define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */ #define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */ #define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */ #define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */ #define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */ #define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */ #define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */ #define ATM_L3_USER 0x10 /* user-specified */ /* END_L3 */ /* * High layer identifiers */ /* BEGIN_HL */ #define ATM_HL_NONE 0 /* HL not specified */ #define ATM_HL_ISO 0x01 /* ISO */ #define ATM_HL_USER 0x02 /* user-specific */ #define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */ #define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */ /* END_HL */ /* * ITU-T coded mode of operation */ /* BEGIN_IMD */ #define ATM_IMD_NONE 0 /* mode not specified */ #define ATM_IMD_NORMAL 1 /* normal mode of operation */ #define ATM_IMD_EXTENDED 2 /* extended mode of operation */ /* END_IMD */ /* * H.310 code points */ #define ATM_TT_NONE 0 /* terminal type not specified */ #define ATM_TT_RX 1 /* receive only */ #define ATM_TT_TX 2 /* send only */ #define ATM_TT_RXTX 3 /* receive and send */ #define ATM_MC_NONE 0 /* no multiplexing */ #define ATM_MC_TS 1 /* transport stream (TS) */ #define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */ #define ATM_MC_PS 3 /* program stream (PS) */ #define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */ #define ATM_MC_H221 5 /* ITU-T Rec. H.221 */ /* * SAP structures */ #define ATM_MAX_HLI 8 /* maximum high-layer information length */ struct atm_blli { unsigned char l2_proto; /* layer 2 protocol */ union { struct { unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ /* absent */ unsigned char window; /* window size (k), 1-127 (0 to omit) */ } itu; /* ITU-T encoding */ unsigned char user; /* user-specified l2 information */ } l2; unsigned char l3_proto; /* layer 3 protocol */ union { struct { unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ /* absent */ unsigned char def_size; /* default packet size (log2), 4-12 (0 to */ /* omit) */ unsigned char window;/* packet window size, 1-127 (0 to omit) */ } itu; /* ITU-T encoding */ unsigned char user; /* user specified l3 information */ struct { /* if l3_proto = ATM_L3_H310 */ unsigned char term_type; /* terminal type */ unsigned char fw_mpx_cap; /* forward multiplexing capability */ /* only if term_type != ATM_TT_NONE */ unsigned char bw_mpx_cap; /* backward multiplexing capability */ /* only if term_type != ATM_TT_NONE */ } h310; struct { /* if l3_proto = ATM_L3_TR9577 */ unsigned char ipi; /* initial protocol id */ unsigned char snap[5];/* IEEE 802.1 SNAP identifier */ /* (only if ipi == NLPID_IEEE802_1_SNAP) */ } tr9577; } l3; } __ATM_API_ALIGN; struct atm_bhli { unsigned char hl_type; /* high layer information type */ unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */ /* hl_type == ATM_HL_ISO) */ unsigned char hl_info[ATM_MAX_HLI];/* high layer information */ }; #define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */ struct atm_sap { struct atm_bhli bhli; /* local SAP, high-layer information */ struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; /* local SAP, low-layer info */ }; static __inline__ int blli_in_use(struct atm_blli blli) { return blli.l2_proto || blli.l3_proto; } #endif linux/atmsvc.h 0000644 00000003475 15063602057 0007366 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* atmsvc.h - ATM signaling kernel-demon interface definitions */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ #ifndef _LINUX_ATMSVC_H #define _LINUX_ATMSVC_H #include <linux/atmapi.h> #include <linux/atm.h> #include <linux/atmioc.h> #define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL) /* become ATM signaling demon control socket */ enum atmsvc_msg_type { as_catch_null, as_bind, as_connect, as_accept, as_reject, as_listen, as_okay, as_error, as_indicate, as_close, as_itf_notify, as_modify, as_identify, as_terminate, as_addparty, as_dropparty }; struct atmsvc_msg { enum atmsvc_msg_type type; atm_kptr_t vcc; atm_kptr_t listen_vcc; /* indicate */ int reply; /* for okay and close: */ /* < 0: error before active */ /* (sigd has discarded ctx) */ /* ==0: success */ /* > 0: error when active (still */ /* need to close) */ struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */ struct sockaddr_atmsvc local; /* local SVC address */ struct atm_qos qos; /* QOS parameters */ struct atm_sap sap; /* SAP */ unsigned int session; /* for p2pm */ struct sockaddr_atmsvc svc; /* SVC address */ } __ATM_API_ALIGN; /* * Message contents: see ftp://icaftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz */ /* * Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on * what PCR is used to request bandwidth from the device driver. net/atm/svc.c * tries to do better than that, but only if there's no routing decision (i.e. * if signaling only uses one ATM interface). */ #define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \ (tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \ (tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR) #endif linux/audit.h 0000644 00000047652 15063602057 0007204 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* audit.h -- Auditing support * * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. * All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Written by Rickard E. (Rik) Faith <faith@redhat.com> * */ #ifndef _LINUX_AUDIT_H_ #define _LINUX_AUDIT_H_ #include <linux/types.h> #include <linux/elf-em.h> /* The netlink messages for the audit system is divided into blocks: * 1000 - 1099 are for commanding the audit system * 1100 - 1199 user space trusted application messages * 1200 - 1299 messages internal to the audit daemon * 1300 - 1399 audit event messages * 1400 - 1499 SE Linux use * 1500 - 1599 kernel LSPP events * 1600 - 1699 kernel crypto events * 1700 - 1799 kernel anomaly records * 1800 - 1899 kernel integrity events * 1900 - 1999 future kernel use * 2000 is for otherwise unclassified kernel audit messages (legacy) * 2001 - 2099 unused (kernel) * 2100 - 2199 user space anomaly records * 2200 - 2299 user space actions taken in response to anomalies * 2300 - 2399 user space generated LSPP events * 2400 - 2499 user space crypto events * 2500 - 2999 future user space (maybe integrity labels and related events) * * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are * exclusively user space. 1300-2099 is kernel --> user space * communication. */ #define AUDIT_GET 1000 /* Get status */ #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ #define AUDIT_LIST 1002 /* List syscall rules -- deprecated */ #define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */ #define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */ #define AUDIT_USER 1005 /* Message from userspace -- deprecated */ #define AUDIT_LOGIN 1006 /* Define the login id and information */ #define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ #define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ #define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ #define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ #define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */ #define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */ #define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */ #define AUDIT_TRIM 1014 /* Trim junk from watched tree */ #define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */ #define AUDIT_TTY_GET 1016 /* Get TTY auditing status */ #define AUDIT_TTY_SET 1017 /* Set TTY auditing status */ #define AUDIT_SET_FEATURE 1018 /* Turn an audit feature on or off */ #define AUDIT_GET_FEATURE 1019 /* Get which features are enabled */ #define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ #define AUDIT_USER_AVC 1107 /* We filter this differently */ #define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */ #define AUDIT_LAST_USER_MSG 1199 #define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */ #define AUDIT_LAST_USER_MSG2 2999 #define AUDIT_DAEMON_START 1200 /* Daemon startup record */ #define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ #define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */ #define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */ #define AUDIT_SYSCALL 1300 /* Syscall event */ /* #define AUDIT_FS_WATCH 1301 * Deprecated */ #define AUDIT_PATH 1302 /* Filename path information */ #define AUDIT_IPC 1303 /* IPC record */ #define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */ #define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */ #define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */ #define AUDIT_CWD 1307 /* Current working directory */ #define AUDIT_EXECVE 1309 /* execve arguments */ #define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */ #define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */ #define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */ #define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */ #define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */ #define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */ #define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */ #define AUDIT_OBJ_PID 1318 /* ptrace target */ #define AUDIT_TTY 1319 /* Input on an administrative TTY */ #define AUDIT_EOE 1320 /* End of multi-record event */ #define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ #define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ #define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ #define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ #define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ #define AUDIT_SECCOMP 1326 /* Secure Computing event */ #define AUDIT_PROCTITLE 1327 /* Proctitle emit event */ #define AUDIT_FEATURE_CHANGE 1328 /* audit log listing feature changes */ #define AUDIT_REPLACE 1329 /* Replace auditd if this packet unanswerd */ #define AUDIT_KERN_MODULE 1330 /* Kernel Module events */ #define AUDIT_FANOTIFY 1331 /* Fanotify access decision */ #define AUDIT_TIME_INJOFFSET 1332 /* Timekeeping offset injected */ #define AUDIT_TIME_ADJNTPVAL 1333 /* NTP value adjustment */ #define AUDIT_BPF 1334 /* BPF subsystem */ #define AUDIT_EVENT_LISTENER 1335 /* Task joined multicast read socket */ #define AUDIT_OPENAT2 1337 /* Record showing openat2 how args */ #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ #define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ #define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ #define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ #define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ #define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */ #define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */ #define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ #define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ #define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ #define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */ #define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */ #define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */ #define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */ #define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */ #define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */ #define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */ #define AUDIT_MAC_CALIPSO_ADD 1418 /* NetLabel: add CALIPSO DOI entry */ #define AUDIT_MAC_CALIPSO_DEL 1419 /* NetLabel: del CALIPSO DOI entry */ #define AUDIT_FIRST_KERN_ANOM_MSG 1700 #define AUDIT_LAST_KERN_ANOM_MSG 1799 #define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */ #define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */ #define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */ #define AUDIT_ANOM_CREAT 1703 /* Suspicious file creation */ #define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */ #define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */ #define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */ #define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */ #define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */ #define AUDIT_INTEGRITY_RULE 1805 /* policy rule */ #define AUDIT_INTEGRITY_EVM_XATTR 1806 /* New EVM-covered xattr */ #define AUDIT_INTEGRITY_POLICY_RULE 1807 /* IMA policy rules */ #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ /* Rule flags */ #define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */ #define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */ #define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */ #define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */ #define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */ #define AUDIT_FILTER_EXCLUDE 0x05 /* Apply rule before record creation */ #define AUDIT_FILTER_TYPE AUDIT_FILTER_EXCLUDE /* obsolete misleading naming */ #define AUDIT_FILTER_FS 0x06 /* Apply rule at __audit_inode_child */ #define AUDIT_NR_FILTERS 7 #define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */ /* Rule actions */ #define AUDIT_NEVER 0 /* Do not build context if rule matches */ #define AUDIT_POSSIBLE 1 /* Build context if rule matches */ #define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */ /* Rule structure sizes -- if these change, different AUDIT_ADD and * AUDIT_LIST commands must be implemented. */ #define AUDIT_MAX_FIELDS 64 #define AUDIT_MAX_KEY_LEN 256 #define AUDIT_BITMASK_SIZE 64 #define AUDIT_WORD(nr) ((__u32)((nr)/32)) #define AUDIT_BIT(nr) (1U << ((nr) - AUDIT_WORD(nr)*32)) #define AUDIT_SYSCALL_CLASSES 16 #define AUDIT_CLASS_DIR_WRITE 0 #define AUDIT_CLASS_DIR_WRITE_32 1 #define AUDIT_CLASS_CHATTR 2 #define AUDIT_CLASS_CHATTR_32 3 #define AUDIT_CLASS_READ 4 #define AUDIT_CLASS_READ_32 5 #define AUDIT_CLASS_WRITE 6 #define AUDIT_CLASS_WRITE_32 7 #define AUDIT_CLASS_SIGNAL 8 #define AUDIT_CLASS_SIGNAL_32 9 /* This bitmask is used to validate user input. It represents all bits that * are currently used in an audit field constant understood by the kernel. * If you are adding a new #define AUDIT_<whatever>, please ensure that * AUDIT_UNUSED_BITS is updated if need be. */ #define AUDIT_UNUSED_BITS 0x07FFFC00 /* AUDIT_FIELD_COMPARE rule list */ #define AUDIT_COMPARE_UID_TO_OBJ_UID 1 #define AUDIT_COMPARE_GID_TO_OBJ_GID 2 #define AUDIT_COMPARE_EUID_TO_OBJ_UID 3 #define AUDIT_COMPARE_EGID_TO_OBJ_GID 4 #define AUDIT_COMPARE_AUID_TO_OBJ_UID 5 #define AUDIT_COMPARE_SUID_TO_OBJ_UID 6 #define AUDIT_COMPARE_SGID_TO_OBJ_GID 7 #define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8 #define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9 #define AUDIT_COMPARE_UID_TO_AUID 10 #define AUDIT_COMPARE_UID_TO_EUID 11 #define AUDIT_COMPARE_UID_TO_FSUID 12 #define AUDIT_COMPARE_UID_TO_SUID 13 #define AUDIT_COMPARE_AUID_TO_FSUID 14 #define AUDIT_COMPARE_AUID_TO_SUID 15 #define AUDIT_COMPARE_AUID_TO_EUID 16 #define AUDIT_COMPARE_EUID_TO_SUID 17 #define AUDIT_COMPARE_EUID_TO_FSUID 18 #define AUDIT_COMPARE_SUID_TO_FSUID 19 #define AUDIT_COMPARE_GID_TO_EGID 20 #define AUDIT_COMPARE_GID_TO_FSGID 21 #define AUDIT_COMPARE_GID_TO_SGID 22 #define AUDIT_COMPARE_EGID_TO_FSGID 23 #define AUDIT_COMPARE_EGID_TO_SGID 24 #define AUDIT_COMPARE_SGID_TO_FSGID 25 #define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID /* Rule fields */ /* These are useful when checking the * task structure at task creation time * (AUDIT_PER_TASK). */ #define AUDIT_PID 0 #define AUDIT_UID 1 #define AUDIT_EUID 2 #define AUDIT_SUID 3 #define AUDIT_FSUID 4 #define AUDIT_GID 5 #define AUDIT_EGID 6 #define AUDIT_SGID 7 #define AUDIT_FSGID 8 #define AUDIT_LOGINUID 9 #define AUDIT_PERS 10 #define AUDIT_ARCH 11 #define AUDIT_MSGTYPE 12 #define AUDIT_SUBJ_USER 13 /* security label user */ #define AUDIT_SUBJ_ROLE 14 /* security label role */ #define AUDIT_SUBJ_TYPE 15 /* security label type */ #define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */ #define AUDIT_SUBJ_CLR 17 /* security label clearance label */ #define AUDIT_PPID 18 #define AUDIT_OBJ_USER 19 #define AUDIT_OBJ_ROLE 20 #define AUDIT_OBJ_TYPE 21 #define AUDIT_OBJ_LEV_LOW 22 #define AUDIT_OBJ_LEV_HIGH 23 #define AUDIT_LOGINUID_SET 24 #define AUDIT_SESSIONID 25 /* Session ID */ #define AUDIT_FSTYPE 26 /* FileSystem Type */ /* These are ONLY useful when checking * at syscall exit time (AUDIT_AT_EXIT). */ #define AUDIT_DEVMAJOR 100 #define AUDIT_DEVMINOR 101 #define AUDIT_INODE 102 #define AUDIT_EXIT 103 #define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ #define AUDIT_WATCH 105 #define AUDIT_PERM 106 #define AUDIT_DIR 107 #define AUDIT_FILETYPE 108 #define AUDIT_OBJ_UID 109 #define AUDIT_OBJ_GID 110 #define AUDIT_FIELD_COMPARE 111 #define AUDIT_EXE 112 #define AUDIT_SADDR_FAM 113 #define AUDIT_ARG0 200 #define AUDIT_ARG1 (AUDIT_ARG0+1) #define AUDIT_ARG2 (AUDIT_ARG0+2) #define AUDIT_ARG3 (AUDIT_ARG0+3) #define AUDIT_FILTERKEY 210 #define AUDIT_NEGATE 0x80000000 /* These are the supported operators. * 4 2 1 8 * = > < ? * ---------- * 0 0 0 0 00 nonsense * 0 0 0 1 08 & bit mask * 0 0 1 0 10 < * 0 1 0 0 20 > * 0 1 1 0 30 != * 1 0 0 0 40 = * 1 0 0 1 48 &= bit test * 1 0 1 0 50 <= * 1 1 0 0 60 >= * 1 1 1 1 78 all operators */ #define AUDIT_BIT_MASK 0x08000000 #define AUDIT_LESS_THAN 0x10000000 #define AUDIT_GREATER_THAN 0x20000000 #define AUDIT_NOT_EQUAL 0x30000000 #define AUDIT_EQUAL 0x40000000 #define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL) #define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL) #define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) #define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK) enum { Audit_equal, Audit_not_equal, Audit_bitmask, Audit_bittest, Audit_lt, Audit_gt, Audit_le, Audit_ge, Audit_bad }; /* Status symbols */ /* Mask values */ #define AUDIT_STATUS_ENABLED 0x0001 #define AUDIT_STATUS_FAILURE 0x0002 #define AUDIT_STATUS_PID 0x0004 #define AUDIT_STATUS_RATE_LIMIT 0x0008 #define AUDIT_STATUS_BACKLOG_LIMIT 0x0010 #define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020 #define AUDIT_STATUS_LOST 0x0040 #define AUDIT_STATUS_BACKLOG_WAIT_TIME_ACTUAL 0x0080 #define AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT 0x00000001 #define AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME 0x00000002 #define AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH 0x00000004 #define AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND 0x00000008 #define AUDIT_FEATURE_BITMAP_SESSIONID_FILTER 0x00000010 #define AUDIT_FEATURE_BITMAP_LOST_RESET 0x00000020 #define AUDIT_FEATURE_BITMAP_FILTER_FS 0x00000040 #define AUDIT_FEATURE_BITMAP_ALL (AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT | \ AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME | \ AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH | \ AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND | \ AUDIT_FEATURE_BITMAP_SESSIONID_FILTER | \ AUDIT_FEATURE_BITMAP_LOST_RESET | \ AUDIT_FEATURE_BITMAP_FILTER_FS) /* deprecated: AUDIT_VERSION_* */ #define AUDIT_VERSION_LATEST AUDIT_FEATURE_BITMAP_ALL #define AUDIT_VERSION_BACKLOG_LIMIT AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT #define AUDIT_VERSION_BACKLOG_WAIT_TIME AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME /* Failure-to-log actions */ #define AUDIT_FAIL_SILENT 0 #define AUDIT_FAIL_PRINTK 1 #define AUDIT_FAIL_PANIC 2 /* * These bits disambiguate different calling conventions that share an * ELF machine type, bitness, and endianness */ #define __AUDIT_ARCH_CONVENTION_MASK 0x30000000 #define __AUDIT_ARCH_CONVENTION_MIPS64_N32 0x20000000 /* distinguish syscall tables */ #define __AUDIT_ARCH_64BIT 0x80000000 #define __AUDIT_ARCH_LE 0x40000000 #define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) #define AUDIT_ARCH_ARMEB (EM_ARM) #define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) #define AUDIT_ARCH_FRV (EM_FRV) #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) #define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_M32R (EM_M32R) #define AUDIT_ARCH_M68K (EM_68K) #define AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE) #define AUDIT_ARCH_MIPS (EM_MIPS) #define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) #define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\ __AUDIT_ARCH_CONVENTION_MIPS64_N32) #define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\ __AUDIT_ARCH_CONVENTION_MIPS64_N32) #define AUDIT_ARCH_OPENRISC (EM_OPENRISC) #define AUDIT_ARCH_PARISC (EM_PARISC) #define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_PPC (EM_PPC) /* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */ #define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_S390 (EM_S390) #define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_SH (EM_SH) #define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE) #define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_SPARC (EM_SPARC) #define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_TILEGX (EM_TILEGX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_TILEGX32 (EM_TILEGX|__AUDIT_ARCH_LE) #define AUDIT_ARCH_TILEPRO (EM_TILEPRO|__AUDIT_ARCH_LE) #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_PERM_EXEC 1 #define AUDIT_PERM_WRITE 2 #define AUDIT_PERM_READ 4 #define AUDIT_PERM_ATTR 8 /* MAX_AUDIT_MESSAGE_LENGTH is set in audit:lib/libaudit.h as: * 8970 // PATH_MAX*2+CONTEXT_SIZE*2+11+256+1 * max header+body+tailer: 44 + 29 + 32 + 262 + 7 + pad */ #define AUDIT_MESSAGE_TEXT_MAX 8560 /* Multicast Netlink socket groups (default up to 32) */ enum audit_nlgrps { AUDIT_NLGRP_NONE, /* Group 0 not used */ AUDIT_NLGRP_READLOG, /* "best effort" read only socket */ __AUDIT_NLGRP_MAX }; #define AUDIT_NLGRP_MAX (__AUDIT_NLGRP_MAX - 1) struct audit_status { __u32 mask; /* Bit mask for valid entries */ __u32 enabled; /* 1 = enabled, 0 = disabled */ __u32 failure; /* Failure-to-log action */ __u32 pid; /* pid of auditd process */ __u32 rate_limit; /* messages rate limit (per second) */ __u32 backlog_limit; /* waiting messages limit */ __u32 lost; /* messages lost */ __u32 backlog; /* messages waiting in queue */ union { __u32 version; /* deprecated: audit api version num */ __u32 feature_bitmap; /* bitmap of kernel audit features */ }; __u32 backlog_wait_time;/* message queue wait timeout */ __u32 backlog_wait_time_actual;/* time spent waiting while * message limit exceeded */ }; struct audit_features { #define AUDIT_FEATURE_VERSION 1 __u32 vers; __u32 mask; /* which bits we are dealing with */ __u32 features; /* which feature to enable/disable */ __u32 lock; /* which features to lock */ }; #define AUDIT_FEATURE_ONLY_UNSET_LOGINUID 0 #define AUDIT_FEATURE_LOGINUID_IMMUTABLE 1 #define AUDIT_LAST_FEATURE AUDIT_FEATURE_LOGINUID_IMMUTABLE #define audit_feature_valid(x) ((x) >= 0 && (x) <= AUDIT_LAST_FEATURE) #define AUDIT_FEATURE_TO_MASK(x) (1 << ((x) & 31)) /* mask for __u32 */ struct audit_tty_status { __u32 enabled; /* 1 = enabled, 0 = disabled */ __u32 log_passwd; /* 1 = enabled, 0 = disabled */ }; #define AUDIT_UID_UNSET (unsigned int)-1 #define AUDIT_SID_UNSET ((unsigned int)-1) /* audit_rule_data supports filter rules with both integer and string * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and * AUDIT_LIST_RULES requests. */ struct audit_rule_data { __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ __u32 field_count; __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */ __u32 fields[AUDIT_MAX_FIELDS]; __u32 values[AUDIT_MAX_FIELDS]; __u32 fieldflags[AUDIT_MAX_FIELDS]; __u32 buflen; /* total length of string fields */ char buf[]; /* string fields buffer */ }; #endif /* _LINUX_AUDIT_H_ */ linux/auto_dev-ioctl.h 0000644 00000011572 15063602057 0011004 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2008 Red Hat, Inc. All rights reserved. * Copyright 2008 Ian Kent <raven@themaw.net> * * This file is part of the Linux kernel and is made available under * the terms of the GNU General Public License, version 2, or at your * option, any later version, incorporated herein by reference. */ #ifndef _LINUX_AUTO_DEV_IOCTL_H #define _LINUX_AUTO_DEV_IOCTL_H #include <linux/auto_fs.h> #include <linux/string.h> #define AUTOFS_DEVICE_NAME "autofs" #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1 #define AUTOFS_DEV_IOCTL_VERSION_MINOR 1 #define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl) /* * An ioctl interface for autofs mount point control. */ struct args_protover { __u32 version; }; struct args_protosubver { __u32 sub_version; }; struct args_openmount { __u32 devid; }; struct args_ready { __u32 token; }; struct args_fail { __u32 token; __s32 status; }; struct args_setpipefd { __s32 pipefd; }; struct args_timeout { __u64 timeout; }; struct args_requester { __u32 uid; __u32 gid; }; struct args_expire { __u32 how; }; struct args_askumount { __u32 may_umount; }; struct args_ismountpoint { union { struct args_in { __u32 type; } in; struct args_out { __u32 devid; __u32 magic; } out; }; }; /* * All the ioctls use this structure. * When sending a path size must account for the total length * of the chunk of memory otherwise is is the size of the * structure. */ struct autofs_dev_ioctl { __u32 ver_major; __u32 ver_minor; __u32 size; /* total size of data passed in * including this struct */ __s32 ioctlfd; /* automount command fd */ /* Command parameters */ union { struct args_protover protover; struct args_protosubver protosubver; struct args_openmount openmount; struct args_ready ready; struct args_fail fail; struct args_setpipefd setpipefd; struct args_timeout timeout; struct args_requester requester; struct args_expire expire; struct args_askumount askumount; struct args_ismountpoint ismountpoint; }; char path[0]; }; static __inline__ void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in) { memset(in, 0, AUTOFS_DEV_IOCTL_SIZE); in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; in->size = AUTOFS_DEV_IOCTL_SIZE; in->ioctlfd = -1; } enum { /* Get various version info */ AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71, AUTOFS_DEV_IOCTL_PROTOVER_CMD, AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, /* Open mount ioctl fd */ AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, /* Close mount ioctl fd */ AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, /* Mount/expire status returns */ AUTOFS_DEV_IOCTL_READY_CMD, AUTOFS_DEV_IOCTL_FAIL_CMD, /* Activate/deactivate autofs mount */ AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, AUTOFS_DEV_IOCTL_CATATONIC_CMD, /* Expiry timeout */ AUTOFS_DEV_IOCTL_TIMEOUT_CMD, /* Get mount last requesting uid and gid */ AUTOFS_DEV_IOCTL_REQUESTER_CMD, /* Check for eligible expire candidates */ AUTOFS_DEV_IOCTL_EXPIRE_CMD, /* Request busy status */ AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, /* Check if path is a mountpoint */ AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, }; #define AUTOFS_DEV_IOCTL_VERSION \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_PROTOVER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_PROTOSUBVER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_OPENMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_READY \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_FAIL \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_SETPIPEFD \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_CATATONIC \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_TIMEOUT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_REQUESTER \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_EXPIRE \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_ASKUMOUNT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \ _IOWR(AUTOFS_IOCTL, \ AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl) #endif /* _LINUX_AUTO_DEV_IOCTL_H */ linux/auto_fs.h 0000644 00000014434 15063602057 0007526 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 1997 Transmeta Corporation - All Rights Reserved * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> * Copyright 2005-2006,2013,2017-2018 Ian Kent <raven@themaw.net> * * This file is part of the Linux kernel and is made available under * the terms of the GNU General Public License, version 2, or at your * option, any later version, incorporated herein by reference. * * ----------------------------------------------------------------------- */ #ifndef _LINUX_AUTO_FS_H #define _LINUX_AUTO_FS_H #include <linux/types.h> #include <linux/limits.h> #include <sys/ioctl.h> #define AUTOFS_PROTO_VERSION 5 #define AUTOFS_MIN_PROTO_VERSION 3 #define AUTOFS_MAX_PROTO_VERSION 5 #define AUTOFS_PROTO_SUBVERSION 6 /* * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed * back to the kernel via ioctl from userspace. On architectures where 32- and * 64-bit userspace binaries can be executed it's important that the size of * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we * do not break the binary ABI interface by changing the structure size. */ #if defined(__ia64__) || defined(__alpha__) /* pure 64bit architectures */ typedef unsigned long autofs_wqt_t; #else typedef unsigned int autofs_wqt_t; #endif /* Packet types */ #define autofs_ptype_missing 0 /* Missing entry (mount request) */ #define autofs_ptype_expire 1 /* Expire entry (umount request) */ struct autofs_packet_hdr { int proto_version; /* Protocol version */ int type; /* Type of packet */ }; struct autofs_packet_missing { struct autofs_packet_hdr hdr; autofs_wqt_t wait_queue_token; int len; char name[NAME_MAX+1]; }; /* v3 expire (via ioctl) */ struct autofs_packet_expire { struct autofs_packet_hdr hdr; int len; char name[NAME_MAX+1]; }; #define AUTOFS_IOCTL 0x93 enum { AUTOFS_IOC_READY_CMD = 0x60, AUTOFS_IOC_FAIL_CMD, AUTOFS_IOC_CATATONIC_CMD, AUTOFS_IOC_PROTOVER_CMD, AUTOFS_IOC_SETTIMEOUT_CMD, AUTOFS_IOC_EXPIRE_CMD, }; #define AUTOFS_IOC_READY _IO(AUTOFS_IOCTL, AUTOFS_IOC_READY_CMD) #define AUTOFS_IOC_FAIL _IO(AUTOFS_IOCTL, AUTOFS_IOC_FAIL_CMD) #define AUTOFS_IOC_CATATONIC _IO(AUTOFS_IOCTL, AUTOFS_IOC_CATATONIC_CMD) #define AUTOFS_IOC_PROTOVER _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_PROTOVER_CMD, int) #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(AUTOFS_IOCTL, \ AUTOFS_IOC_SETTIMEOUT_CMD, \ compat_ulong_t) #define AUTOFS_IOC_SETTIMEOUT _IOWR(AUTOFS_IOCTL, \ AUTOFS_IOC_SETTIMEOUT_CMD, \ unsigned long) #define AUTOFS_IOC_EXPIRE _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_EXPIRE_CMD, \ struct autofs_packet_expire) /* autofs version 4 and later definitions */ /* Mask for expire behaviour */ #define AUTOFS_EXP_NORMAL 0x00 #define AUTOFS_EXP_IMMEDIATE 0x01 #define AUTOFS_EXP_LEAVES 0x02 #define AUTOFS_EXP_FORCED 0x04 #define AUTOFS_TYPE_ANY 0U #define AUTOFS_TYPE_INDIRECT 1U #define AUTOFS_TYPE_DIRECT 2U #define AUTOFS_TYPE_OFFSET 4U static __inline__ void set_autofs_type_indirect(unsigned int *type) { *type = AUTOFS_TYPE_INDIRECT; } static __inline__ unsigned int autofs_type_indirect(unsigned int type) { return (type == AUTOFS_TYPE_INDIRECT); } static __inline__ void set_autofs_type_direct(unsigned int *type) { *type = AUTOFS_TYPE_DIRECT; } static __inline__ unsigned int autofs_type_direct(unsigned int type) { return (type == AUTOFS_TYPE_DIRECT); } static __inline__ void set_autofs_type_offset(unsigned int *type) { *type = AUTOFS_TYPE_OFFSET; } static __inline__ unsigned int autofs_type_offset(unsigned int type) { return (type == AUTOFS_TYPE_OFFSET); } static __inline__ unsigned int autofs_type_trigger(unsigned int type) { return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET); } /* * This isn't really a type as we use it to say "no type set" to * indicate we want to search for "any" mount in the * autofs_dev_ioctl_ismountpoint() device ioctl function. */ static __inline__ void set_autofs_type_any(unsigned int *type) { *type = AUTOFS_TYPE_ANY; } static __inline__ unsigned int autofs_type_any(unsigned int type) { return (type == AUTOFS_TYPE_ANY); } /* Daemon notification packet types */ enum autofs_notify { NFY_NONE, NFY_MOUNT, NFY_EXPIRE }; /* Kernel protocol version 4 packet types */ /* Expire entry (umount request) */ #define autofs_ptype_expire_multi 2 /* Kernel protocol version 5 packet types */ /* Indirect mount missing and expire requests. */ #define autofs_ptype_missing_indirect 3 #define autofs_ptype_expire_indirect 4 /* Direct mount missing and expire requests */ #define autofs_ptype_missing_direct 5 #define autofs_ptype_expire_direct 6 /* v4 multi expire (via pipe) */ struct autofs_packet_expire_multi { struct autofs_packet_hdr hdr; autofs_wqt_t wait_queue_token; int len; char name[NAME_MAX+1]; }; union autofs_packet_union { struct autofs_packet_hdr hdr; struct autofs_packet_missing missing; struct autofs_packet_expire expire; struct autofs_packet_expire_multi expire_multi; }; /* autofs v5 common packet struct */ struct autofs_v5_packet { struct autofs_packet_hdr hdr; autofs_wqt_t wait_queue_token; __u32 dev; __u64 ino; __u32 uid; __u32 gid; __u32 pid; __u32 tgid; __u32 len; char name[NAME_MAX+1]; }; typedef struct autofs_v5_packet autofs_packet_missing_indirect_t; typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; typedef struct autofs_v5_packet autofs_packet_missing_direct_t; typedef struct autofs_v5_packet autofs_packet_expire_direct_t; union autofs_v5_packet_union { struct autofs_packet_hdr hdr; struct autofs_v5_packet v5_packet; autofs_packet_missing_indirect_t missing_indirect; autofs_packet_expire_indirect_t expire_indirect; autofs_packet_missing_direct_t missing_direct; autofs_packet_expire_direct_t expire_direct; }; enum { AUTOFS_IOC_EXPIRE_MULTI_CMD = 0x66, /* AUTOFS_IOC_EXPIRE_CMD + 1 */ AUTOFS_IOC_PROTOSUBVER_CMD, AUTOFS_IOC_ASKUMOUNT_CMD = 0x70, /* AUTOFS_DEV_IOCTL_VERSION_CMD - 1 */ }; #define AUTOFS_IOC_EXPIRE_MULTI _IOW(AUTOFS_IOCTL, \ AUTOFS_IOC_EXPIRE_MULTI_CMD, int) #define AUTOFS_IOC_PROTOSUBVER _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_PROTOSUBVER_CMD, int) #define AUTOFS_IOC_ASKUMOUNT _IOR(AUTOFS_IOCTL, \ AUTOFS_IOC_ASKUMOUNT_CMD, int) #endif /* _LINUX_AUTO_FS_H */ linux/auto_fs4.h 0000644 00000000703 15063602057 0007604 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> * * This file is part of the Linux kernel and is made available under * the terms of the GNU General Public License, version 2, or at your * option, any later version, incorporated herein by reference. */ #ifndef _LINUX_AUTO_FS4_H #define _LINUX_AUTO_FS4_H #include <linux/auto_fs.h> #endif /* _LINUX_AUTO_FS4_H */ linux/auxvec.h 0000644 00000003075 15063602057 0007360 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_AUXVEC_H #define _LINUX_AUXVEC_H #include <asm/auxvec.h> /* Symbolic values for the entries in the auxiliary table put on the initial stack */ #define AT_NULL 0 /* end of vector */ #define AT_IGNORE 1 /* entry should be ignored */ #define AT_EXECFD 2 /* file descriptor of program */ #define AT_PHDR 3 /* program headers for program */ #define AT_PHENT 4 /* size of program header entry */ #define AT_PHNUM 5 /* number of program headers */ #define AT_PAGESZ 6 /* system page size */ #define AT_BASE 7 /* base address of interpreter */ #define AT_FLAGS 8 /* flags */ #define AT_ENTRY 9 /* entry point of program */ #define AT_NOTELF 10 /* program is not ELF */ #define AT_UID 11 /* real uid */ #define AT_EUID 12 /* effective uid */ #define AT_GID 13 /* real gid */ #define AT_EGID 14 /* effective gid */ #define AT_PLATFORM 15 /* string identifying CPU for optimizations */ #define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ #define AT_CLKTCK 17 /* frequency at which times() increments */ /* AT_* values 18 through 22 are reserved */ #define AT_SECURE 23 /* secure mode boolean */ #define AT_BASE_PLATFORM 24 /* string identifying real platform, may * differ from AT_PLATFORM. */ #define AT_RANDOM 25 /* address of 16 random bytes */ #define AT_HWCAP2 26 /* extension of AT_HWCAP */ #define AT_EXECFN 31 /* filename of program */ #ifndef AT_MINSIGSTKSZ #define AT_MINSIGSTKSZ 51 /* minimal stack size for signal delivery */ #endif #endif /* _LINUX_AUXVEC_H */ linux/ax25.h 0000644 00000005410 15063602057 0006637 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * These are the public elements of the Linux kernel AX.25 code. A similar * file netrom.h exists for the NET/ROM protocol. */ #ifndef AX25_KERNEL_H #define AX25_KERNEL_H #include <linux/socket.h> #define AX25_MTU 256 #define AX25_MAX_DIGIS 8 #define AX25_WINDOW 1 #define AX25_T1 2 #define AX25_N2 3 #define AX25_T3 4 #define AX25_T2 5 #define AX25_BACKOFF 6 #define AX25_EXTSEQ 7 #define AX25_PIDINCL 8 #define AX25_IDLE 9 #define AX25_PACLEN 10 #define AX25_IAMDIGI 12 #define AX25_KILL 99 #define SIOCAX25GETUID (SIOCPROTOPRIVATE+0) #define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) #define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) #define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) #define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) #define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) #define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9) #define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) #define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) #define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12) #define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13) #define AX25_SET_RT_IPMODE 2 #define AX25_NOUID_DEFAULT 0 #define AX25_NOUID_BLOCK 1 typedef struct { char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ } ax25_address; struct sockaddr_ax25 { __kernel_sa_family_t sax25_family; ax25_address sax25_call; int sax25_ndigis; /* Digipeater ax25_address sets follow */ }; #define sax25_uid sax25_ndigis struct full_sockaddr_ax25 { struct sockaddr_ax25 fsa_ax25; ax25_address fsa_digipeater[AX25_MAX_DIGIS]; }; struct ax25_routes_struct { ax25_address port_addr; ax25_address dest_addr; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; struct ax25_route_opt_struct { ax25_address port_addr; ax25_address dest_addr; int cmd; int arg; }; struct ax25_ctl_struct { ax25_address port_addr; ax25_address source_addr; ax25_address dest_addr; unsigned int cmd; unsigned long arg; unsigned char digi_count; ax25_address digi_addr[AX25_MAX_DIGIS]; }; /* this will go away. Please do not export to user land */ struct ax25_info_struct_deprecated { unsigned int n2, n2count; unsigned int t1, t1timer; unsigned int t2, t2timer; unsigned int t3, t3timer; unsigned int idle, idletimer; unsigned int state; unsigned int rcv_q, snd_q; }; struct ax25_info_struct { unsigned int n2, n2count; unsigned int t1, t1timer; unsigned int t2, t2timer; unsigned int t3, t3timer; unsigned int idle, idletimer; unsigned int state; unsigned int rcv_q, snd_q; unsigned int vs, vr, va, vs_max; unsigned int paclen; unsigned int window; }; struct ax25_fwd_struct { ax25_address port_from; ax25_address port_to; }; #endif linux/b1lli.h 0000644 00000003265 15063602057 0007071 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $ * * ISDN lowlevel-module for AVM B1-card. * * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef _B1LLI_H_ #define _B1LLI_H_ /* * struct for loading t4 file */ typedef struct avmb1_t4file { int len; unsigned char *data; } avmb1_t4file; typedef struct avmb1_loaddef { int contr; avmb1_t4file t4file; } avmb1_loaddef; typedef struct avmb1_loadandconfigdef { int contr; avmb1_t4file t4file; avmb1_t4file t4config; } avmb1_loadandconfigdef; typedef struct avmb1_resetdef { int contr; } avmb1_resetdef; typedef struct avmb1_getdef { int contr; int cardtype; int cardstate; } avmb1_getdef; /* * struct for adding new cards */ typedef struct avmb1_carddef { int port; int irq; } avmb1_carddef; #define AVM_CARDTYPE_B1 0 #define AVM_CARDTYPE_T1 1 #define AVM_CARDTYPE_M1 2 #define AVM_CARDTYPE_M2 3 typedef struct avmb1_extcarddef { int port; int irq; int cardtype; int cardnr; /* for HEMA/T1 */ } avmb1_extcarddef; #define AVMB1_LOAD 0 /* load image to card */ #define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */ #define AVMB1_RESETCARD 2 /* reset a card */ #define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */ #define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */ #define AVMB1_GET_CARDINFO 5 /* get cardtype */ #define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */ #define AVMB1_REGISTERCARD_IS_OBSOLETE #endif /* _B1LLI_H_ */ linux/batadv_packet.h 0000644 00000050017 15063602057 0010653 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */ /* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINUX_BATADV_PACKET_H_ #define _LINUX_BATADV_PACKET_H_ #include <asm/byteorder.h> #include <linux/if_ether.h> #include <linux/types.h> /** * batadv_tp_is_error() - Check throughput meter return code for error * @n: throughput meter return code * * Return: 0 when not error was detected, != 0 otherwise */ #define batadv_tp_is_error(n) ((__u8)(n) > 127 ? 1 : 0) /** * enum batadv_packettype - types for batman-adv encapsulated packets * @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV * @BATADV_BCAST: broadcast packets carrying broadcast payload * @BATADV_CODED: network coded packets * @BATADV_ELP: echo location packets for B.A.T.M.A.N. V * @BATADV_OGM2: originator messages for B.A.T.M.A.N. V * * @BATADV_UNICAST: unicast packets carrying unicast payload traffic * @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original * payload packet * @BATADV_UNICAST_4ADDR: unicast packet including the originator address of * the sender * @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers */ enum batadv_packettype { /* 0x00 - 0x3f: local packets or special rules for handling */ BATADV_IV_OGM = 0x00, BATADV_BCAST = 0x01, BATADV_CODED = 0x02, BATADV_ELP = 0x03, BATADV_OGM2 = 0x04, /* 0x40 - 0x7f: unicast */ #define BATADV_UNICAST_MIN 0x40 BATADV_UNICAST = 0x40, BATADV_UNICAST_FRAG = 0x41, BATADV_UNICAST_4ADDR = 0x42, BATADV_ICMP = 0x43, BATADV_UNICAST_TVLV = 0x44, #define BATADV_UNICAST_MAX 0x7f /* 0x80 - 0xff: reserved */ }; /** * enum batadv_subtype - packet subtype for unicast4addr * @BATADV_P_DATA: user payload * @BATADV_P_DAT_DHT_GET: DHT request message * @BATADV_P_DAT_DHT_PUT: DHT store message * @BATADV_P_DAT_CACHE_REPLY: ARP reply generated by DAT */ enum batadv_subtype { BATADV_P_DATA = 0x01, BATADV_P_DAT_DHT_GET = 0x02, BATADV_P_DAT_DHT_PUT = 0x03, BATADV_P_DAT_CACHE_REPLY = 0x04, }; /* this file is included by batctl which needs these defines */ #define BATADV_COMPAT_VERSION 15 /** * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets * @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was * previously received from someone else than the best neighbor. * @BATADV_PRIMARIES_FIRST_HOP: flag unused. * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a * one hop neighbor on the interface where it was originally received. */ enum batadv_iv_flags { BATADV_NOT_BEST_NEXT_HOP = 1UL << 0, BATADV_PRIMARIES_FIRST_HOP = 1UL << 1, BATADV_DIRECTLINK = 1UL << 2, }; /** * enum batadv_icmp_packettype - ICMP message types * @BATADV_ECHO_REPLY: success reply to BATADV_ECHO_REQUEST * @BATADV_DESTINATION_UNREACHABLE: failure when route to destination not found * @BATADV_ECHO_REQUEST: request BATADV_ECHO_REPLY from destination * @BATADV_TTL_EXCEEDED: error after BATADV_ECHO_REQUEST traversed too many hops * @BATADV_PARAMETER_PROBLEM: return code for malformed messages * @BATADV_TP: throughput meter packet */ enum batadv_icmp_packettype { BATADV_ECHO_REPLY = 0, BATADV_DESTINATION_UNREACHABLE = 3, BATADV_ECHO_REQUEST = 8, BATADV_TTL_EXCEEDED = 11, BATADV_PARAMETER_PROBLEM = 12, BATADV_TP = 15, }; /** * enum batadv_mcast_flags - flags for multicast capabilities and settings * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for * 224.0.0.0/24 or ff02::1 * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets */ enum batadv_mcast_flags { BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0, BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1, BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2, }; /* tt data subtypes */ #define BATADV_TT_DATA_TYPE_MASK 0x0F /** * enum batadv_tt_data_flags - flags for tt data tvlv * @BATADV_TT_OGM_DIFF: TT diff propagated through OGM * @BATADV_TT_REQUEST: TT request message * @BATADV_TT_RESPONSE: TT response message * @BATADV_TT_FULL_TABLE: contains full table to replace existing table */ enum batadv_tt_data_flags { BATADV_TT_OGM_DIFF = 1UL << 0, BATADV_TT_REQUEST = 1UL << 1, BATADV_TT_RESPONSE = 1UL << 2, BATADV_TT_FULL_TABLE = 1UL << 4, }; /** * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not */ enum batadv_vlan_flags { BATADV_VLAN_HAS_TAG = 1UL << 15, }; /** * enum batadv_bla_claimframe - claim frame types for the bridge loop avoidance * @BATADV_CLAIM_TYPE_CLAIM: claim of a client mac address * @BATADV_CLAIM_TYPE_UNCLAIM: unclaim of a client mac address * @BATADV_CLAIM_TYPE_ANNOUNCE: announcement of backbone with current crc * @BATADV_CLAIM_TYPE_REQUEST: request of full claim table * @BATADV_CLAIM_TYPE_LOOPDETECT: mesh-traversing loop detect packet */ enum batadv_bla_claimframe { BATADV_CLAIM_TYPE_CLAIM = 0x00, BATADV_CLAIM_TYPE_UNCLAIM = 0x01, BATADV_CLAIM_TYPE_ANNOUNCE = 0x02, BATADV_CLAIM_TYPE_REQUEST = 0x03, BATADV_CLAIM_TYPE_LOOPDETECT = 0x04, }; /** * enum batadv_tvlv_type - tvlv type definitions * @BATADV_TVLV_GW: gateway tvlv * @BATADV_TVLV_DAT: distributed arp table tvlv * @BATADV_TVLV_NC: network coding tvlv * @BATADV_TVLV_TT: translation table tvlv * @BATADV_TVLV_ROAM: roaming advertisement tvlv * @BATADV_TVLV_MCAST: multicast capability tvlv */ enum batadv_tvlv_type { BATADV_TVLV_GW = 0x01, BATADV_TVLV_DAT = 0x02, BATADV_TVLV_NC = 0x03, BATADV_TVLV_TT = 0x04, BATADV_TVLV_ROAM = 0x05, BATADV_TVLV_MCAST = 0x06, }; #pragma pack(2) /* the destination hardware field in the ARP frame is used to * transport the claim type and the group id */ struct batadv_bla_claim_dst { __u8 magic[3]; /* FF:43:05 */ __u8 type; /* bla_claimframe */ __be16 group; /* group id */ }; /** * struct batadv_ogm_packet - ogm (routing protocol) packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @flags: contains routing relevant flags - see enum batadv_iv_flags * @seqno: sequence identification * @orig: address of the source node * @prev_sender: address of the previous sender * @reserved: reserved byte for alignment * @tq: transmission quality * @tvlv_len: length of tvlv data following the ogm header */ struct batadv_ogm_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 flags; __be32 seqno; __u8 orig[ETH_ALEN]; __u8 prev_sender[ETH_ALEN]; __u8 reserved; __u8 tq; __be16 tvlv_len; }; #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet) /** * struct batadv_ogm2_packet - ogm2 (routing protocol) packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the general header * @ttl: time to live for this packet, part of the general header * @flags: reseved for routing relevant flags - currently always 0 * @seqno: sequence number * @orig: originator mac address * @tvlv_len: length of the appended tvlv buffer (in bytes) * @throughput: the currently flooded path throughput */ struct batadv_ogm2_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 flags; __be32 seqno; __u8 orig[ETH_ALEN]; __be16 tvlv_len; __be32 throughput; }; #define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet) /** * struct batadv_elp_packet - elp (neighbor discovery) packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @orig: originator mac address * @seqno: sequence number * @elp_interval: currently used ELP sending interval in ms */ struct batadv_elp_packet { __u8 packet_type; __u8 version; __u8 orig[ETH_ALEN]; __be32 seqno; __be32 elp_interval; }; #define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet) /** * struct batadv_icmp_header - common members among all the ICMP packets * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @align: not used - useful for alignment purposes only * * This structure is used for ICMP packets parsing only and it is never sent * over the wire. The alignment field at the end is there to ensure that * members are padded the same way as they are in real packets. */ struct batadv_icmp_header { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 align[3]; }; /** * struct batadv_icmp_packet - ICMP packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @reserved: not used - useful for alignment * @seqno: ICMP sequence number */ struct batadv_icmp_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 reserved; __be16 seqno; }; /** * struct batadv_icmp_tp_packet - ICMP TP Meter packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @subtype: TP packet subtype (see batadv_icmp_tp_subtype) * @session: TP session identifier * @seqno: the TP sequence number * @timestamp: time when the packet has been sent. This value is filled in a * TP_MSG and echoed back in the next TP_ACK so that the sender can compute the * RTT. Since it is read only by the host which wrote it, there is no need to * store it using network order */ struct batadv_icmp_tp_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 subtype; __u8 session[2]; __be32 seqno; __be32 timestamp; }; /** * enum batadv_icmp_tp_subtype - ICMP TP Meter packet subtypes * @BATADV_TP_MSG: Msg from sender to receiver * @BATADV_TP_ACK: acknowledgment from receiver to sender */ enum batadv_icmp_tp_subtype { BATADV_TP_MSG = 0, BATADV_TP_ACK, }; #define BATADV_RR_LEN 16 /** * struct batadv_icmp_packet_rr - ICMP RouteRecord packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @msg_type: ICMP packet type * @dst: address of the destination node * @orig: address of the source node * @uid: local ICMP socket identifier * @rr_cur: number of entries the rr array * @seqno: ICMP sequence number * @rr: route record array */ struct batadv_icmp_packet_rr { __u8 packet_type; __u8 version; __u8 ttl; __u8 msg_type; /* see ICMP message types above */ __u8 dst[ETH_ALEN]; __u8 orig[ETH_ALEN]; __u8 uid; __u8 rr_cur; __be16 seqno; __u8 rr[BATADV_RR_LEN][ETH_ALEN]; }; #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr) /* All packet headers in front of an ethernet header have to be completely * divisible by 2 but not by 4 to make the payload after the ethernet * header again 4 bytes boundary aligned. * * A packing of 2 is necessary to avoid extra padding at the end of the struct * caused by a structure member which is larger than two bytes. Otherwise * the structure would not fulfill the previously mentioned rule to avoid the * misalignment of the payload after the ethernet header. It may also lead to * leakage of information when the padding it not initialized before sending. */ /** * struct batadv_unicast_packet - unicast packet for network payload * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @ttvn: translation table version number * @dest: originator destination of the unicast packet */ struct batadv_unicast_packet { __u8 packet_type; __u8 version; __u8 ttl; __u8 ttvn; /* destination translation table version number */ __u8 dest[ETH_ALEN]; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ }; /** * struct batadv_unicast_4addr_packet - extended unicast packet * @u: common unicast packet header * @src: address of the source * @subtype: packet subtype * @reserved: reserved byte for alignment */ struct batadv_unicast_4addr_packet { struct batadv_unicast_packet u; __u8 src[ETH_ALEN]; __u8 subtype; __u8 reserved; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ }; /** * struct batadv_frag_packet - fragmented packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @dest: final destination used when routing fragments * @orig: originator of the fragment used when merging the packet * @no: fragment number within this sequence * @priority: priority of frame, from ToS IP precedence or 802.1p * @reserved: reserved byte for alignment * @seqno: sequence identification * @total_size: size of the merged packet */ struct batadv_frag_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; #if defined(__BIG_ENDIAN_BITFIELD) __u8 no:4; __u8 priority:3; __u8 reserved:1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved:1; __u8 priority:3; __u8 no:4; #else #error "unknown bitfield endianness" #endif __u8 dest[ETH_ALEN]; __u8 orig[ETH_ALEN]; __be16 seqno; __be16 total_size; }; /** * struct batadv_bcast_packet - broadcast packet for network payload * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @reserved: reserved byte for alignment * @seqno: sequence identification * @orig: originator of the broadcast packet */ struct batadv_bcast_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; __u8 reserved; __be32 seqno; __u8 orig[ETH_ALEN]; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ }; /** * struct batadv_coded_packet - network coded packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @first_source: original source of first included packet * @first_orig_dest: original destinal of first included packet * @first_crc: checksum of first included packet * @first_ttvn: tt-version number of first included packet * @second_ttl: ttl of second packet * @second_dest: second receiver of this coded packet * @second_source: original source of second included packet * @second_orig_dest: original destination of second included packet * @second_crc: checksum of second included packet * @second_ttvn: tt version number of second included packet * @coded_len: length of network coded part of the payload */ struct batadv_coded_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; __u8 first_ttvn; /* __u8 first_dest[ETH_ALEN]; - saved in mac header destination */ __u8 first_source[ETH_ALEN]; __u8 first_orig_dest[ETH_ALEN]; __be32 first_crc; __u8 second_ttl; __u8 second_ttvn; __u8 second_dest[ETH_ALEN]; __u8 second_source[ETH_ALEN]; __u8 second_orig_dest[ETH_ALEN]; __be32 second_crc; __be16 coded_len; }; /** * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @reserved: reserved field (for packet alignment) * @src: address of the source * @dst: address of the destination * @tvlv_len: length of tvlv data following the unicast tvlv header * @align: 2 bytes to align the header to a 4 byte boundary */ struct batadv_unicast_tvlv_packet { __u8 packet_type; __u8 version; /* batman version field */ __u8 ttl; __u8 reserved; __u8 dst[ETH_ALEN]; __u8 src[ETH_ALEN]; __be16 tvlv_len; __u16 align; }; /** * struct batadv_tvlv_hdr - base tvlv header struct * @type: tvlv container type (see batadv_tvlv_type) * @version: tvlv container version * @len: tvlv container length */ struct batadv_tvlv_hdr { __u8 type; __u8 version; __be16 len; }; /** * struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv * container * @bandwidth_down: advertised uplink download bandwidth * @bandwidth_up: advertised uplink upload bandwidth */ struct batadv_tvlv_gateway_data { __be32 bandwidth_down; __be32 bandwidth_up; }; /** * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container * @flags: translation table flags (see batadv_tt_data_flags) * @ttvn: translation table version number * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by * one batadv_tvlv_tt_vlan_data object per announced vlan */ struct batadv_tvlv_tt_data { __u8 flags; __u8 ttvn; __be16 num_vlan; }; /** * struct batadv_tvlv_tt_vlan_data - vlan specific tt data propagated through * the tt tvlv container * @crc: crc32 checksum of the entries belonging to this vlan * @vid: vlan identifier * @reserved: unused, useful for alignment purposes */ struct batadv_tvlv_tt_vlan_data { __be32 crc; __be16 vid; __u16 reserved; }; /** * struct batadv_tvlv_tt_change - translation table diff data * @flags: status indicators concerning the non-mesh client (see * batadv_tt_client_flags) * @reserved: reserved field - useful for alignment purposes only * @addr: mac address of non-mesh client that triggered this tt change * @vid: VLAN identifier */ struct batadv_tvlv_tt_change { __u8 flags; __u8 reserved[3]; __u8 addr[ETH_ALEN]; __be16 vid; }; /** * struct batadv_tvlv_roam_adv - roaming advertisement * @client: mac address of roaming client * @vid: VLAN identifier */ struct batadv_tvlv_roam_adv { __u8 client[ETH_ALEN]; __be16 vid; }; /** * struct batadv_tvlv_mcast_data - payload of a multicast tvlv * @flags: multicast flags announced by the orig node * @reserved: reserved field */ struct batadv_tvlv_mcast_data { __u8 flags; __u8 reserved[3]; }; #pragma pack() #endif /* _LINUX_BATADV_PACKET_H_ */ linux/batman_adv.h 0000644 00000027311 15063602057 0010160 0 ustar 00 /* SPDX-License-Identifier: MIT */ /* Copyright (C) 2016-2018 B.A.T.M.A.N. contributors: * * Matthias Schiffer * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef _LINUX_BATMAN_ADV_H_ #define _LINUX_BATMAN_ADV_H_ #define BATADV_NL_NAME "batadv" #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter" /** * enum batadv_tt_client_flags - TT client specific flags * * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire. * Bits from 8 to 15 are called _local flags_ because they are used for local * computations only. * * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with * the other nodes in the network. To achieve this goal these flags are included * in the TT CRC computation. */ enum batadv_tt_client_flags { /** * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table */ BATADV_TT_CLIENT_DEL = (1 << 0), /** * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and * the new update telling its new real location has not been * received/sent yet */ BATADV_TT_CLIENT_ROAM = (1 << 1), /** * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi * interface. This information is used by the "AP Isolation" feature */ BATADV_TT_CLIENT_WIFI = (1 << 4), /** * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This * information is used by the Extended Isolation feature */ BATADV_TT_CLIENT_ISOLA = (1 << 5), /** * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from * the table */ BATADV_TT_CLIENT_NOPURGE = (1 << 8), /** * @BATADV_TT_CLIENT_NEW: this client has been added to the local table * but has not been announced yet */ BATADV_TT_CLIENT_NEW = (1 << 9), /** * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it * is kept in the table for one more originator interval for consistency * purposes */ BATADV_TT_CLIENT_PENDING = (1 << 10), /** * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be * part of the network but no nnode has already announced it */ BATADV_TT_CLIENT_TEMP = (1 << 11), }; /** * enum batadv_mcast_flags_priv - Private, own multicast flags * * These are internal, multicast related flags. Currently they describe certain * multicast related attributes of the segment this originator bridges into the * mesh. * * Those attributes are used to determine the public multicast flags this * originator is going to announce via TT. * * For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier * related flags are undefined. */ enum batadv_mcast_flags_priv { /** * @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh * interface. */ BATADV_MCAST_FLAGS_BRIDGED = (1 << 0), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier * exists in the mesh */ BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 << 1), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier * exists in the mesh */ BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 << 2), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING: If an IGMP querier * exists, whether it is potentially shadowing multicast listeners * (i.e. querier is behind our own bridge segment) */ BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 << 3), /** * @BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING: If an MLD querier * exists, whether it is potentially shadowing multicast listeners * (i.e. querier is behind our own bridge segment) */ BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 << 4), }; /** * enum batadv_nl_attrs - batman-adv netlink attributes */ enum batadv_nl_attrs { /** * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors */ BATADV_ATTR_UNSPEC, /** * @BATADV_ATTR_VERSION: batman-adv version string */ BATADV_ATTR_VERSION, /** * @BATADV_ATTR_ALGO_NAME: name of routing algorithm */ BATADV_ATTR_ALGO_NAME, /** * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface */ BATADV_ATTR_MESH_IFINDEX, /** * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface */ BATADV_ATTR_MESH_IFNAME, /** * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface */ BATADV_ATTR_MESH_ADDRESS, /** * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface */ BATADV_ATTR_HARD_IFINDEX, /** * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface */ BATADV_ATTR_HARD_IFNAME, /** * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv * interface */ BATADV_ATTR_HARD_ADDRESS, /** * @BATADV_ATTR_ORIG_ADDRESS: originator mac address */ BATADV_ATTR_ORIG_ADDRESS, /** * @BATADV_ATTR_TPMETER_RESULT: result of run (see * batadv_tp_meter_status) */ BATADV_ATTR_TPMETER_RESULT, /** * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took */ BATADV_ATTR_TPMETER_TEST_TIME, /** * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run */ BATADV_ATTR_TPMETER_BYTES, /** * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session */ BATADV_ATTR_TPMETER_COOKIE, /** * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment */ BATADV_ATTR_PAD, /** * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active */ BATADV_ATTR_ACTIVE, /** * @BATADV_ATTR_TT_ADDRESS: Client MAC address */ BATADV_ATTR_TT_ADDRESS, /** * @BATADV_ATTR_TT_TTVN: Translation table version */ BATADV_ATTR_TT_TTVN, /** * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version */ BATADV_ATTR_TT_LAST_TTVN, /** * @BATADV_ATTR_TT_CRC32: CRC32 over translation table */ BATADV_ATTR_TT_CRC32, /** * @BATADV_ATTR_TT_VID: VLAN ID */ BATADV_ATTR_TT_VID, /** * @BATADV_ATTR_TT_FLAGS: Translation table client flags */ BATADV_ATTR_TT_FLAGS, /** * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best */ BATADV_ATTR_FLAG_BEST, /** * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen */ BATADV_ATTR_LAST_SEEN_MSECS, /** * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address */ BATADV_ATTR_NEIGH_ADDRESS, /** * @BATADV_ATTR_TQ: TQ to neighbour */ BATADV_ATTR_TQ, /** * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour */ BATADV_ATTR_THROUGHPUT, /** * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth */ BATADV_ATTR_BANDWIDTH_UP, /** * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth */ BATADV_ATTR_BANDWIDTH_DOWN, /** * @BATADV_ATTR_ROUTER: Gateway router MAC address */ BATADV_ATTR_ROUTER, /** * @BATADV_ATTR_BLA_OWN: Flag indicating own originator */ BATADV_ATTR_BLA_OWN, /** * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address */ BATADV_ATTR_BLA_ADDRESS, /** * @BATADV_ATTR_BLA_VID: BLA VLAN ID */ BATADV_ATTR_BLA_VID, /** * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address */ BATADV_ATTR_BLA_BACKBONE, /** * @BATADV_ATTR_BLA_CRC: BLA CRC */ BATADV_ATTR_BLA_CRC, /** * @BATADV_ATTR_DAT_CACHE_IP4ADDRESS: Client IPv4 address */ BATADV_ATTR_DAT_CACHE_IP4ADDRESS, /** * @BATADV_ATTR_DAT_CACHE_HWADDRESS: Client MAC address */ BATADV_ATTR_DAT_CACHE_HWADDRESS, /** * @BATADV_ATTR_DAT_CACHE_VID: VLAN ID */ BATADV_ATTR_DAT_CACHE_VID, /** * @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags */ BATADV_ATTR_MCAST_FLAGS, /** * @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags */ BATADV_ATTR_MCAST_FLAGS_PRIV, /* add attributes above here, update the policy in netlink.c */ /** * @__BATADV_ATTR_AFTER_LAST: internal use */ __BATADV_ATTR_AFTER_LAST, /** * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available */ NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST, /** * @BATADV_ATTR_MAX: highest attribute number currently defined */ BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1 }; /** * enum batadv_nl_commands - supported batman-adv netlink commands */ enum batadv_nl_commands { /** * @BATADV_CMD_UNSPEC: unspecified command to catch errors */ BATADV_CMD_UNSPEC, /** * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv * device */ BATADV_CMD_GET_MESH_INFO, /** * @BATADV_CMD_TP_METER: Start a tp meter session */ BATADV_CMD_TP_METER, /** * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session */ BATADV_CMD_TP_METER_CANCEL, /** * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms. */ BATADV_CMD_GET_ROUTING_ALGOS, /** * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces */ BATADV_CMD_GET_HARDIFS, /** * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations */ BATADV_CMD_GET_TRANSTABLE_LOCAL, /** * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations */ BATADV_CMD_GET_TRANSTABLE_GLOBAL, /** * @BATADV_CMD_GET_ORIGINATORS: Query list of originators */ BATADV_CMD_GET_ORIGINATORS, /** * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours */ BATADV_CMD_GET_NEIGHBORS, /** * @BATADV_CMD_GET_GATEWAYS: Query list of gateways */ BATADV_CMD_GET_GATEWAYS, /** * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims */ BATADV_CMD_GET_BLA_CLAIM, /** * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance * backbones */ BATADV_CMD_GET_BLA_BACKBONE, /** * @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries */ BATADV_CMD_GET_DAT_CACHE, /** * @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags */ BATADV_CMD_GET_MCAST_FLAGS, /* add new commands above here */ /** * @__BATADV_CMD_AFTER_LAST: internal use */ __BATADV_CMD_AFTER_LAST, /** * @BATADV_CMD_MAX: highest used command number */ BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1 }; /** * enum batadv_tp_meter_reason - reason of a tp meter test run stop */ enum batadv_tp_meter_reason { /** * @BATADV_TP_REASON_COMPLETE: sender finished tp run */ BATADV_TP_REASON_COMPLETE = 3, /** * @BATADV_TP_REASON_CANCEL: sender was stopped during run */ BATADV_TP_REASON_CANCEL = 4, /* error status >= 128 */ /** * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or * didn't answer */ BATADV_TP_REASON_DST_UNREACHABLE = 128, /** * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit */ BATADV_TP_REASON_RESEND_LIMIT = 129, /** * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node * already ongoing */ BATADV_TP_REASON_ALREADY_ONGOING = 130, /** * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory */ BATADV_TP_REASON_MEMORY_ERROR = 131, /** * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface */ BATADV_TP_REASON_CANT_SEND = 132, /** * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions */ BATADV_TP_REASON_TOO_MANY = 133, }; #endif /* _LINUX_BATMAN_ADV_H_ */ linux/baycom.h 0000644 00000001563 15063602057 0007337 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * The Linux BAYCOM driver for the Baycom serial 1200 baud modem * and the parallel 9600 baud modem * (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA */ #ifndef _BAYCOM_H #define _BAYCOM_H /* -------------------------------------------------------------------- */ /* * structs for the IOCTL commands */ struct baycom_debug_data { unsigned long debug1; unsigned long debug2; long debug3; }; struct baycom_ioctl { int cmd; union { struct baycom_debug_data dbg; } data; }; /* -------------------------------------------------------------------- */ /* * ioctl values change for baycom */ #define BAYCOMCTL_GETDEBUG 0x92 /* -------------------------------------------------------------------- */ #endif /* _BAYCOM_H */ /* --------------------------------------------------------------------- */ linux/bcache.h 0000644 00000020256 15063602057 0007272 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BCACHE_H #define _LINUX_BCACHE_H /* * Bcache on disk data structures */ #include <linux/types.h> #define BITMASK(name, type, field, offset, size) \ static __inline__ __u64 name(const type *k) \ { return (k->field >> offset) & ~(~0ULL << size); } \ \ static __inline__ void SET_##name(type *k, __u64 v) \ { \ k->field &= ~(~(~0ULL << size) << offset); \ k->field |= (v & ~(~0ULL << size)) << offset; \ } /* Btree keys - all units are in sectors */ struct bkey { __u64 high; __u64 low; __u64 ptr[]; }; #define KEY_FIELD(name, field, offset, size) \ BITMASK(name, struct bkey, field, offset, size) #define PTR_FIELD(name, offset, size) \ static __inline__ __u64 name(const struct bkey *k, unsigned i) \ { return (k->ptr[i] >> offset) & ~(~0ULL << size); } \ \ static __inline__ void SET_##name(struct bkey *k, unsigned i, __u64 v) \ { \ k->ptr[i] &= ~(~(~0ULL << size) << offset); \ k->ptr[i] |= (v & ~(~0ULL << size)) << offset; \ } #define KEY_SIZE_BITS 16 #define KEY_MAX_U64S 8 KEY_FIELD(KEY_PTRS, high, 60, 3) KEY_FIELD(HEADER_SIZE, high, 58, 2) KEY_FIELD(KEY_CSUM, high, 56, 2) KEY_FIELD(KEY_PINNED, high, 55, 1) KEY_FIELD(KEY_DIRTY, high, 36, 1) KEY_FIELD(KEY_SIZE, high, 20, KEY_SIZE_BITS) KEY_FIELD(KEY_INODE, high, 0, 20) /* Next time I change the on disk format, KEY_OFFSET() won't be 64 bits */ static __inline__ __u64 KEY_OFFSET(const struct bkey *k) { return k->low; } static __inline__ void SET_KEY_OFFSET(struct bkey *k, __u64 v) { k->low = v; } /* * The high bit being set is a relic from when we used it to do binary * searches - it told you where a key started. It's not used anymore, * and can probably be safely dropped. */ #define KEY(inode, offset, size) \ ((struct bkey) { \ .high = (1ULL << 63) | ((__u64) (size) << 20) | (inode), \ .low = (offset) \ }) #define ZERO_KEY KEY(0, 0, 0) #define MAX_KEY_INODE (~(~0 << 20)) #define MAX_KEY_OFFSET (~0ULL >> 1) #define MAX_KEY KEY(MAX_KEY_INODE, MAX_KEY_OFFSET, 0) #define KEY_START(k) (KEY_OFFSET(k) - KEY_SIZE(k)) #define START_KEY(k) KEY(KEY_INODE(k), KEY_START(k), 0) #define PTR_DEV_BITS 12 PTR_FIELD(PTR_DEV, 51, PTR_DEV_BITS) PTR_FIELD(PTR_OFFSET, 8, 43) PTR_FIELD(PTR_GEN, 0, 8) #define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1) #define MAKE_PTR(gen, offset, dev) \ ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen) /* Bkey utility code */ static __inline__ unsigned long bkey_u64s(const struct bkey *k) { return (sizeof(struct bkey) / sizeof(__u64)) + KEY_PTRS(k); } static __inline__ unsigned long bkey_bytes(const struct bkey *k) { return bkey_u64s(k) * sizeof(__u64); } #define bkey_copy(_dest, _src) memcpy(_dest, _src, bkey_bytes(_src)) static __inline__ void bkey_copy_key(struct bkey *dest, const struct bkey *src) { SET_KEY_INODE(dest, KEY_INODE(src)); SET_KEY_OFFSET(dest, KEY_OFFSET(src)); } static __inline__ struct bkey *bkey_next(const struct bkey *k) { __u64 *d = (void *) k; return (struct bkey *) (d + bkey_u64s(k)); } static __inline__ struct bkey *bkey_idx(const struct bkey *k, unsigned nr_keys) { __u64 *d = (void *) k; return (struct bkey *) (d + nr_keys); } /* Enough for a key with 6 pointers */ #define BKEY_PAD 8 #define BKEY_PADDED(key) \ union { struct bkey key; __u64 key ## _pad[BKEY_PAD]; } /* Superblock */ /* Version 0: Cache device * Version 1: Backing device * Version 2: Seed pointer into btree node checksum * Version 3: Cache device with new UUID format * Version 4: Backing device with data offset */ #define BCACHE_SB_VERSION_CDEV 0 #define BCACHE_SB_VERSION_BDEV 1 #define BCACHE_SB_VERSION_CDEV_WITH_UUID 3 #define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4 #define BCACHE_SB_MAX_VERSION 4 #define SB_SECTOR 8 #define SB_SIZE 4096 #define SB_LABEL_SIZE 32 #define SB_JOURNAL_BUCKETS 256U /* SB_JOURNAL_BUCKETS must be divisible by BITS_PER_LONG */ #define MAX_CACHES_PER_SET 8 #define BDEV_DATA_START_DEFAULT 16 /* sectors */ struct cache_sb { __u64 csum; __u64 offset; /* sector where this sb was written */ __u64 version; __u8 magic[16]; __u8 uuid[16]; union { __u8 set_uuid[16]; __u64 set_magic; }; __u8 label[SB_LABEL_SIZE]; __u64 flags; __u64 seq; __u64 pad[8]; union { struct { /* Cache devices */ __u64 nbuckets; /* device size */ __u16 block_size; /* sectors */ __u16 bucket_size; /* sectors */ __u16 nr_in_set; __u16 nr_this_dev; }; struct { /* Backing devices */ __u64 data_offset; /* * block_size from the cache device section is still used by * backing devices, so don't add anything here until we fix * things to not need it for backing devices anymore */ }; }; __u32 last_mount; /* time_t */ __u16 first_bucket; union { __u16 njournal_buckets; __u16 keys; }; __u64 d[SB_JOURNAL_BUCKETS]; /* journal buckets */ }; static __inline__ _Bool SB_IS_BDEV(const struct cache_sb *sb) { return sb->version == BCACHE_SB_VERSION_BDEV || sb->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET; } BITMASK(CACHE_SYNC, struct cache_sb, flags, 0, 1); BITMASK(CACHE_DISCARD, struct cache_sb, flags, 1, 1); BITMASK(CACHE_REPLACEMENT, struct cache_sb, flags, 2, 3); #define CACHE_REPLACEMENT_LRU 0U #define CACHE_REPLACEMENT_FIFO 1U #define CACHE_REPLACEMENT_RANDOM 2U BITMASK(BDEV_CACHE_MODE, struct cache_sb, flags, 0, 4); #define CACHE_MODE_WRITETHROUGH 0U #define CACHE_MODE_WRITEBACK 1U #define CACHE_MODE_WRITEAROUND 2U #define CACHE_MODE_NONE 3U BITMASK(BDEV_STATE, struct cache_sb, flags, 61, 2); #define BDEV_STATE_NONE 0U #define BDEV_STATE_CLEAN 1U #define BDEV_STATE_DIRTY 2U #define BDEV_STATE_STALE 3U /* * Magic numbers * * The various other data structures have their own magic numbers, which are * xored with the first part of the cache set's UUID */ #define JSET_MAGIC 0x245235c1a3625032ULL #define PSET_MAGIC 0x6750e15f87337f91ULL #define BSET_MAGIC 0x90135c78b99e07f5ULL static __inline__ __u64 jset_magic(struct cache_sb *sb) { return sb->set_magic ^ JSET_MAGIC; } static __inline__ __u64 pset_magic(struct cache_sb *sb) { return sb->set_magic ^ PSET_MAGIC; } static __inline__ __u64 bset_magic(struct cache_sb *sb) { return sb->set_magic ^ BSET_MAGIC; } /* * Journal * * On disk format for a journal entry: * seq is monotonically increasing; every journal entry has its own unique * sequence number. * * last_seq is the oldest journal entry that still has keys the btree hasn't * flushed to disk yet. * * version is for on disk format changes. */ #define BCACHE_JSET_VERSION_UUIDv1 1 #define BCACHE_JSET_VERSION_UUID 1 /* Always latest UUID format */ #define BCACHE_JSET_VERSION 1 struct jset { __u64 csum; __u64 magic; __u64 seq; __u32 version; __u32 keys; __u64 last_seq; BKEY_PADDED(uuid_bucket); BKEY_PADDED(btree_root); __u16 btree_level; __u16 pad[3]; __u64 prio_bucket[MAX_CACHES_PER_SET]; union { struct bkey start[0]; __u64 d[0]; }; }; /* Bucket prios/gens */ struct prio_set { __u64 csum; __u64 magic; __u64 seq; __u32 version; __u32 pad; __u64 next_bucket; struct bucket_disk { __u16 prio; __u8 gen; } __attribute((packed)) data[]; }; /* UUIDS - per backing device/flash only volume metadata */ struct uuid_entry { union { struct { __u8 uuid[16]; __u8 label[32]; __u32 first_reg; __u32 last_reg; __u32 invalidated; __u32 flags; /* Size of flash only volumes */ __u64 sectors; }; __u8 pad[128]; }; }; BITMASK(UUID_FLASH_ONLY, struct uuid_entry, flags, 0, 1); /* Btree nodes */ /* Version 1: Seed pointer into btree node checksum */ #define BCACHE_BSET_CSUM 1 #define BCACHE_BSET_VERSION 1 /* * Btree nodes * * On disk a btree node is a list/log of these; within each set the keys are * sorted */ struct bset { __u64 csum; __u64 magic; __u64 seq; __u32 version; __u32 keys; union { struct bkey start[0]; __u64 d[0]; }; }; /* OBSOLETE */ /* UUIDS - per backing device/flash only volume metadata */ struct uuid_entry_v0 { __u8 uuid[16]; __u8 label[32]; __u32 first_reg; __u32 last_reg; __u32 invalidated; __u32 pad; }; #endif /* _LINUX_BCACHE_H */ linux/bcm933xx_hcs.h 0000644 00000000643 15063602057 0010300 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Broadcom Cable Modem firmware format */ #ifndef __BCM933XX_HCS_H #define __BCM933XX_HCS_H #include <linux/types.h> struct bcm_hcs { __u16 magic; __u16 control; __u16 rev_maj; __u16 rev_min; __u32 build_date; __u32 filelen; __u32 ldaddress; char filename[64]; __u16 hcs; __u16 her_znaet_chto; __u32 crc; }; #endif /* __BCM933XX_HCS */ linux/bfs_fs.h 0000644 00000003545 15063602057 0007331 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/linux/bfs_fs.h - BFS data structures on disk. * Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> */ #ifndef _LINUX_BFS_FS_H #define _LINUX_BFS_FS_H #include <linux/types.h> #define BFS_BSIZE_BITS 9 #define BFS_BSIZE (1<<BFS_BSIZE_BITS) #define BFS_MAGIC 0x1BADFACE #define BFS_ROOT_INO 2 #define BFS_INODES_PER_BLOCK 8 /* SVR4 vnode type values (bfs_inode->i_vtype) */ #define BFS_VDIR 2L #define BFS_VREG 1L /* BFS inode layout on disk */ struct bfs_inode { __le16 i_ino; __u16 i_unused; __le32 i_sblock; __le32 i_eblock; __le32 i_eoffset; __le32 i_vtype; __le32 i_mode; __le32 i_uid; __le32 i_gid; __le32 i_nlink; __le32 i_atime; __le32 i_mtime; __le32 i_ctime; __u32 i_padding[4]; }; #define BFS_NAMELEN 14 #define BFS_DIRENT_SIZE 16 #define BFS_DIRS_PER_BLOCK 32 struct bfs_dirent { __le16 ino; char name[BFS_NAMELEN]; }; /* BFS superblock layout on disk */ struct bfs_super_block { __le32 s_magic; __le32 s_start; __le32 s_end; __le32 s_from; __le32 s_to; __s32 s_bfrom; __s32 s_bto; char s_fsname[6]; char s_volume[6]; __u32 s_padding[118]; }; #define BFS_OFF2INO(offset) \ ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) #define BFS_INO2OFF(ino) \ ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) #define BFS_NZFILESIZE(ip) \ ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) #define BFS_FILESIZE(ip) \ ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) #define BFS_FILEBLOCKS(ip) \ ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) #define BFS_UNCLEAN(bfs_sb, sb) \ ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & SB_RDONLY)) #endif /* _LINUX_BFS_FS_H */ linux/binfmts.h 0000644 00000001164 15063602057 0007524 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BINFMTS_H #define _LINUX_BINFMTS_H #include <linux/capability.h> struct pt_regs; /* * These are the maximum length and maximum number of strings passed to the * execve() system call. MAX_ARG_STRLEN is essentially random but serves to * prevent the kernel from being unduly impacted by misaddressed pointers. * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer. */ #define MAX_ARG_STRLEN (PAGE_SIZE * 32) #define MAX_ARG_STRINGS 0x7FFFFFFF /* sizeof(linux_binprm->buf) */ #define BINPRM_BUF_SIZE 256 #endif /* _LINUX_BINFMTS_H */ linux/blkpg.h 0000644 00000001610 15063602057 0007155 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BLKPG_H #define __LINUX_BLKPG_H #include <linux/ioctl.h> #define BLKPG _IO(0x12,105) /* The argument structure */ struct blkpg_ioctl_arg { int op; int flags; int datalen; void *data; }; /* The subfunctions (for the op field) */ #define BLKPG_ADD_PARTITION 1 #define BLKPG_DEL_PARTITION 2 #define BLKPG_RESIZE_PARTITION 3 /* Sizes of name fields. Unused at present. */ #define BLKPG_DEVNAMELTH 64 #define BLKPG_VOLNAMELTH 64 /* The data structure for ADD_PARTITION and DEL_PARTITION */ struct blkpg_partition { long long start; /* starting offset in bytes */ long long length; /* length in bytes */ int pno; /* partition number */ char devname[BLKPG_DEVNAMELTH]; /* unused / ignored */ char volname[BLKPG_VOLNAMELTH]; /* unused / ignore */ }; #endif /* __LINUX_BLKPG_H */ linux/blktrace_api.h 0000644 00000011135 15063602057 0010501 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef BLKTRACE_H #define BLKTRACE_H #include <linux/types.h> /* * Trace categories */ enum blktrace_cat { BLK_TC_READ = 1 << 0, /* reads */ BLK_TC_WRITE = 1 << 1, /* writes */ BLK_TC_FLUSH = 1 << 2, /* flush */ BLK_TC_SYNC = 1 << 3, /* sync IO */ BLK_TC_SYNCIO = BLK_TC_SYNC, BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ BLK_TC_REQUEUE = 1 << 5, /* requeueing */ BLK_TC_ISSUE = 1 << 6, /* issue */ BLK_TC_COMPLETE = 1 << 7, /* completions */ BLK_TC_FS = 1 << 8, /* fs requests */ BLK_TC_PC = 1 << 9, /* pc requests */ BLK_TC_NOTIFY = 1 << 10, /* special message */ BLK_TC_AHEAD = 1 << 11, /* readahead */ BLK_TC_META = 1 << 12, /* metadata */ BLK_TC_DISCARD = 1 << 13, /* discard requests */ BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ BLK_TC_FUA = 1 << 15, /* fua requests */ BLK_TC_END = 1 << 15, /* we've run out of bits! */ }; #define BLK_TC_SHIFT (16) #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) /* * Basic trace actions */ enum blktrace_act { __BLK_TA_QUEUE = 1, /* queued */ __BLK_TA_BACKMERGE, /* back merged to existing rq */ __BLK_TA_FRONTMERGE, /* front merge to existing rq */ __BLK_TA_GETRQ, /* allocated new request */ __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */ __BLK_TA_REQUEUE, /* request requeued */ __BLK_TA_ISSUE, /* sent to driver */ __BLK_TA_COMPLETE, /* completed by driver */ __BLK_TA_PLUG, /* queue was plugged */ __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */ __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */ __BLK_TA_INSERT, /* insert request */ __BLK_TA_SPLIT, /* bio was split */ __BLK_TA_BOUNCE, /* bio was bounced */ __BLK_TA_REMAP, /* bio was remapped */ __BLK_TA_ABORT, /* request aborted */ __BLK_TA_DRV_DATA, /* driver-specific binary data */ __BLK_TA_CGROUP = 1 << 8, /* from a cgroup*/ }; /* * Notify events. */ enum blktrace_notify { __BLK_TN_PROCESS = 0, /* establish pid/name mapping */ __BLK_TN_TIMESTAMP, /* include system clock */ __BLK_TN_MESSAGE, /* Character string message */ __BLK_TN_CGROUP = __BLK_TA_CGROUP, /* from a cgroup */ }; /* * Trace actions in full. Additionally, read or write is masked */ #define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE)) #define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE)) #define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE)) #define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_SPLIT (__BLK_TA_SPLIT) #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA)) #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_IO_TRACE_MAGIC 0x65617400 #define BLK_IO_TRACE_VERSION 0x07 /* * The trace itself */ struct blk_io_trace { __u32 magic; /* MAGIC << 8 | version */ __u32 sequence; /* event number */ __u64 time; /* in nanoseconds */ __u64 sector; /* disk offset */ __u32 bytes; /* transfer length */ __u32 action; /* what happened */ __u32 pid; /* who did it */ __u32 device; /* device number */ __u32 cpu; /* on what cpu did it happen */ __u16 error; /* completion error */ __u16 pdu_len; /* length of data after this trace */ /* cgroup id will be stored here if exists */ }; /* * The remap event */ struct blk_io_trace_remap { __be32 device_from; __be32 device_to; __be64 sector_from; }; enum { Blktrace_setup = 1, Blktrace_running, Blktrace_stopped, }; #define BLKTRACE_BDEV_SIZE 32 /* * User setup structure passed with BLKTRACESETUP */ struct blk_user_trace_setup { char name[BLKTRACE_BDEV_SIZE]; /* output */ __u16 act_mask; /* input */ __u32 buf_size; /* input */ __u32 buf_nr; /* input */ __u64 start_lba; __u64 end_lba; __u32 pid; }; #endif /* BLKTRACE_H */ linux/blkzoned.h 0000644 00000014720 15063602057 0007674 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Zoned block devices handling. * * Copyright (C) 2015 Seagate Technology PLC * * Written by: Shaun Tancheff <shaun.tancheff@seagate.com> * * Modified by: Damien Le Moal <damien.lemoal@hgst.com> * Copyright (C) 2016 Western Digital * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #ifndef _BLKZONED_H #define _BLKZONED_H #include <linux/types.h> #include <linux/ioctl.h> /** * enum blk_zone_type - Types of zones allowed in a zoned device. * * @BLK_ZONE_TYPE_CONVENTIONAL: The zone has no write pointer and can be writen * randomly. Zone reset has no effect on the zone. * @BLK_ZONE_TYPE_SEQWRITE_REQ: The zone must be written sequentially * @BLK_ZONE_TYPE_SEQWRITE_PREF: The zone can be written non-sequentially * * Any other value not defined is reserved and must be considered as invalid. */ enum blk_zone_type { BLK_ZONE_TYPE_CONVENTIONAL = 0x1, BLK_ZONE_TYPE_SEQWRITE_REQ = 0x2, BLK_ZONE_TYPE_SEQWRITE_PREF = 0x3, }; /** * enum blk_zone_cond - Condition [state] of a zone in a zoned device. * * @BLK_ZONE_COND_NOT_WP: The zone has no write pointer, it is conventional. * @BLK_ZONE_COND_EMPTY: The zone is empty. * @BLK_ZONE_COND_IMP_OPEN: The zone is open, but not explicitly opened. * @BLK_ZONE_COND_EXP_OPEN: The zones was explicitly opened by an * OPEN ZONE command. * @BLK_ZONE_COND_CLOSED: The zone was [explicitly] closed after writing. * @BLK_ZONE_COND_FULL: The zone is marked as full, possibly by a zone * FINISH ZONE command. * @BLK_ZONE_COND_READONLY: The zone is read-only. * @BLK_ZONE_COND_OFFLINE: The zone is offline (sectors cannot be read/written). * * The Zone Condition state machine in the ZBC/ZAC standards maps the above * deinitions as: * - ZC1: Empty | BLK_ZONE_EMPTY * - ZC2: Implicit Open | BLK_ZONE_COND_IMP_OPEN * - ZC3: Explicit Open | BLK_ZONE_COND_EXP_OPEN * - ZC4: Closed | BLK_ZONE_CLOSED * - ZC5: Full | BLK_ZONE_FULL * - ZC6: Read Only | BLK_ZONE_READONLY * - ZC7: Offline | BLK_ZONE_OFFLINE * * Conditions 0x5 to 0xC are reserved by the current ZBC/ZAC spec and should * be considered invalid. */ enum blk_zone_cond { BLK_ZONE_COND_NOT_WP = 0x0, BLK_ZONE_COND_EMPTY = 0x1, BLK_ZONE_COND_IMP_OPEN = 0x2, BLK_ZONE_COND_EXP_OPEN = 0x3, BLK_ZONE_COND_CLOSED = 0x4, BLK_ZONE_COND_READONLY = 0xD, BLK_ZONE_COND_FULL = 0xE, BLK_ZONE_COND_OFFLINE = 0xF, }; /** * enum blk_zone_report_flags - Feature flags of reported zone descriptors. * * @BLK_ZONE_REP_CAPACITY: Zone descriptor has capacity field. */ enum blk_zone_report_flags { BLK_ZONE_REP_CAPACITY = (1 << 0), }; /** * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl. * * @start: Zone start in 512 B sector units * @len: Zone length in 512 B sector units * @wp: Zone write pointer location in 512 B sector units * @type: see enum blk_zone_type for possible values * @cond: see enum blk_zone_cond for possible values * @non_seq: Flag indicating that the zone is using non-sequential resources * (for host-aware zoned block devices only). * @reset: Flag indicating that a zone reset is recommended. * @resv: Padding for 8B alignment. * @capacity: Zone usable capacity in 512 B sector units * @reserved: Padding to 64 B to match the ZBC, ZAC and ZNS defined zone * descriptor size. * * start, len, capacity and wp use the regular 512 B sector unit, regardless * of the device logical block size. The overall structure size is 64 B to * match the ZBC, ZAC and ZNS defined zone descriptor and allow support for * future additional zone information. */ struct blk_zone { __u64 start; /* Zone start sector */ __u64 len; /* Zone length in number of sectors */ __u64 wp; /* Zone write pointer position */ __u8 type; /* Zone type */ __u8 cond; /* Zone condition */ __u8 non_seq; /* Non-sequential write resources active */ __u8 reset; /* Reset write pointer recommended */ #ifdef __GENKSYMS__ __u8 reserved[36]; #else __u8 resv[4]; __u64 capacity; /* Zone capacity in number of sectors */ __u8 reserved[24]; #endif }; /** * struct blk_zone_report - BLKREPORTZONE ioctl request/reply * * @sector: starting sector of report * @nr_zones: IN maximum / OUT actual * @flags: one or more flags as defined by enum blk_zone_report_flags. * @zones: Space to hold @nr_zones @zones entries on reply. * * The array of at most @nr_zones must follow this structure in memory. */ struct blk_zone_report { __u64 sector; __u32 nr_zones; #ifdef __GENKSYMS__ __u8 reserved[4]; #else __u32 flags; #endif struct blk_zone zones[0]; }; /** * struct blk_zone_range - BLKRESETZONE/BLKOPENZONE/ * BLKCLOSEZONE/BLKFINISHZONE ioctl * requests * @sector: Starting sector of the first zone to operate on. * @nr_sectors: Total number of sectors of all zones to operate on. */ struct blk_zone_range { __u64 sector; __u64 nr_sectors; }; /** * Zoned block device ioctl's: * * @BLKREPORTZONE: Get zone information. Takes a zone report as argument. * The zone report will start from the zone containing the * sector specified in the report request structure. * @BLKRESETZONE: Reset the write pointer of the zones in the specified * sector range. The sector range must be zone aligned. * @BLKGETZONESZ: Get the device zone size in number of 512 B sectors. * @BLKGETNRZONES: Get the total number of zones of the device. * @BLKOPENZONE: Open the zones in the specified sector range. * The 512 B sector range must be zone aligned. * @BLKCLOSEZONE: Close the zones in the specified sector range. * The 512 B sector range must be zone aligned. * @BLKFINISHZONE: Mark the zones as full in the specified sector range. * The 512 B sector range must be zone aligned. */ #define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report) #define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range) #define BLKGETZONESZ _IOR(0x12, 132, __u32) #define BLKGETNRZONES _IOR(0x12, 133, __u32) #define BLKOPENZONE _IOW(0x12, 134, struct blk_zone_range) #define BLKCLOSEZONE _IOW(0x12, 135, struct blk_zone_range) #define BLKFINISHZONE _IOW(0x12, 136, struct blk_zone_range) #endif /* _BLKZONED_H */ linux/bpf.h 0000644 00000676464 15063602057 0006656 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #ifndef __LINUX_BPF_H__ #define __LINUX_BPF_H__ #include <linux/types.h> #include <linux/bpf_common.h> /* Extended instruction set based on top of classic BPF */ /* instruction classes */ #define BPF_JMP32 0x06 /* jmp mode in word width */ #define BPF_ALU64 0x07 /* alu mode in double word width */ /* ld/ldx fields */ #define BPF_DW 0x18 /* double word (64-bit) */ #define BPF_ATOMIC 0xc0 /* atomic memory ops - op type in immediate */ #define BPF_XADD 0xc0 /* exclusive add - legacy name */ /* alu/jmp fields */ #define BPF_MOV 0xb0 /* mov reg to reg */ #define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */ /* change endianness of a register */ #define BPF_END 0xd0 /* flags for endianness conversion: */ #define BPF_TO_LE 0x00 /* convert to little-endian */ #define BPF_TO_BE 0x08 /* convert to big-endian */ #define BPF_FROM_LE BPF_TO_LE #define BPF_FROM_BE BPF_TO_BE /* jmp encodings */ #define BPF_JNE 0x50 /* jump != */ #define BPF_JLT 0xa0 /* LT is unsigned, '<' */ #define BPF_JLE 0xb0 /* LE is unsigned, '<=' */ #define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */ #define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */ #define BPF_JSLT 0xc0 /* SLT is signed, '<' */ #define BPF_JSLE 0xd0 /* SLE is signed, '<=' */ #define BPF_CALL 0x80 /* function call */ #define BPF_EXIT 0x90 /* function return */ /* atomic op type fields (stored in immediate) */ #define BPF_FETCH 0x01 /* not an opcode on its own, used to build others */ #define BPF_XCHG (0xe0 | BPF_FETCH) /* atomic exchange */ #define BPF_CMPXCHG (0xf0 | BPF_FETCH) /* atomic compare-and-write */ /* Register numbers */ enum { BPF_REG_0 = 0, BPF_REG_1, BPF_REG_2, BPF_REG_3, BPF_REG_4, BPF_REG_5, BPF_REG_6, BPF_REG_7, BPF_REG_8, BPF_REG_9, BPF_REG_10, __MAX_BPF_REG, }; /* BPF has 10 general purpose 64-bit registers and stack frame. */ #define MAX_BPF_REG __MAX_BPF_REG struct bpf_insn { __u8 code; /* opcode */ __u8 dst_reg:4; /* dest register */ __u8 src_reg:4; /* source register */ __s16 off; /* signed offset */ __s32 imm; /* signed immediate constant */ }; /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ struct bpf_lpm_trie_key { __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */ __u8 data[0]; /* Arbitrary size */ }; struct bpf_cgroup_storage_key { __u64 cgroup_inode_id; /* cgroup inode id */ __u32 attach_type; /* program attach type */ }; union bpf_iter_link_info { struct { __u32 map_fd; } map; }; /* BPF syscall commands, see bpf(2) man-page for more details. */ /** * DOC: eBPF Syscall Preamble * * The operation to be performed by the **bpf**\ () system call is determined * by the *cmd* argument. Each operation takes an accompanying argument, * provided via *attr*, which is a pointer to a union of type *bpf_attr* (see * below). The size argument is the size of the union pointed to by *attr*. */ /** * DOC: eBPF Syscall Commands * * BPF_MAP_CREATE * Description * Create a map and return a file descriptor that refers to the * map. The close-on-exec file descriptor flag (see **fcntl**\ (2)) * is automatically enabled for the new file descriptor. * * Applying **close**\ (2) to the file descriptor returned by * **BPF_MAP_CREATE** will delete the map (but see NOTES). * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_MAP_LOOKUP_ELEM * Description * Look up an element with a given *key* in the map referred to * by the file descriptor *map_fd*. * * The *flags* argument may be specified as one of the * following: * * **BPF_F_LOCK** * Look up the value of a spin-locked map without * returning the lock. This must be specified if the * elements contain a spinlock. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_MAP_UPDATE_ELEM * Description * Create or update an element (key/value pair) in a specified map. * * The *flags* argument should be specified as one of the * following: * * **BPF_ANY** * Create a new element or update an existing element. * **BPF_NOEXIST** * Create a new element only if it did not exist. * **BPF_EXIST** * Update an existing element. * **BPF_F_LOCK** * Update a spin_lock-ed map element. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * May set *errno* to **EINVAL**, **EPERM**, **ENOMEM**, * **E2BIG**, **EEXIST**, or **ENOENT**. * * **E2BIG** * The number of elements in the map reached the * *max_entries* limit specified at map creation time. * **EEXIST** * If *flags* specifies **BPF_NOEXIST** and the element * with *key* already exists in the map. * **ENOENT** * If *flags* specifies **BPF_EXIST** and the element with * *key* does not exist in the map. * * BPF_MAP_DELETE_ELEM * Description * Look up and delete an element by key in a specified map. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_MAP_GET_NEXT_KEY * Description * Look up an element by key in a specified map and return the key * of the next element. Can be used to iterate over all elements * in the map. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * The following cases can be used to iterate over all elements of * the map: * * * If *key* is not found, the operation returns zero and sets * the *next_key* pointer to the key of the first element. * * If *key* is found, the operation returns zero and sets the * *next_key* pointer to the key of the next element. * * If *key* is the last element, returns -1 and *errno* is set * to **ENOENT**. * * May set *errno* to **ENOMEM**, **EFAULT**, **EPERM**, or * **EINVAL** on error. * * BPF_PROG_LOAD * Description * Verify and load an eBPF program, returning a new file * descriptor associated with the program. * * Applying **close**\ (2) to the file descriptor returned by * **BPF_PROG_LOAD** will unload the eBPF program (but see NOTES). * * The close-on-exec file descriptor flag (see **fcntl**\ (2)) is * automatically enabled for the new file descriptor. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_OBJ_PIN * Description * Pin an eBPF program or map referred by the specified *bpf_fd* * to the provided *pathname* on the filesystem. * * The *pathname* argument must not contain a dot ("."). * * On success, *pathname* retains a reference to the eBPF object, * preventing deallocation of the object when the original * *bpf_fd* is closed. This allow the eBPF object to live beyond * **close**\ (\ *bpf_fd*\ ), and hence the lifetime of the parent * process. * * Applying **unlink**\ (2) or similar calls to the *pathname* * unpins the object from the filesystem, removing the reference. * If no other file descriptors or filesystem nodes refer to the * same object, it will be deallocated (see NOTES). * * The filesystem type for the parent directory of *pathname* must * be **BPF_FS_MAGIC**. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_OBJ_GET * Description * Open a file descriptor for the eBPF object pinned to the * specified *pathname*. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_PROG_ATTACH * Description * Attach an eBPF program to a *target_fd* at the specified * *attach_type* hook. * * The *attach_type* specifies the eBPF attachment point to * attach the program to, and must be one of *bpf_attach_type* * (see below). * * The *attach_bpf_fd* must be a valid file descriptor for a * loaded eBPF program of a cgroup, flow dissector, LIRC, sockmap * or sock_ops type corresponding to the specified *attach_type*. * * The *target_fd* must be a valid file descriptor for a kernel * object which depends on the attach type of *attach_bpf_fd*: * * **BPF_PROG_TYPE_CGROUP_DEVICE**, * **BPF_PROG_TYPE_CGROUP_SKB**, * **BPF_PROG_TYPE_CGROUP_SOCK**, * **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**, * **BPF_PROG_TYPE_CGROUP_SOCKOPT**, * **BPF_PROG_TYPE_CGROUP_SYSCTL**, * **BPF_PROG_TYPE_SOCK_OPS** * * Control Group v2 hierarchy with the eBPF controller * enabled. Requires the kernel to be compiled with * **CONFIG_CGROUP_BPF**. * * **BPF_PROG_TYPE_FLOW_DISSECTOR** * * Network namespace (eg /proc/self/ns/net). * * **BPF_PROG_TYPE_LIRC_MODE2** * * LIRC device path (eg /dev/lircN). Requires the kernel * to be compiled with **CONFIG_BPF_LIRC_MODE2**. * * **BPF_PROG_TYPE_SK_SKB**, * **BPF_PROG_TYPE_SK_MSG** * * eBPF map of socket type (eg **BPF_MAP_TYPE_SOCKHASH**). * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_PROG_DETACH * Description * Detach the eBPF program associated with the *target_fd* at the * hook specified by *attach_type*. The program must have been * previously attached using **BPF_PROG_ATTACH**. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_PROG_TEST_RUN * Description * Run the eBPF program associated with the *prog_fd* a *repeat* * number of times against a provided program context *ctx_in* and * data *data_in*, and return the modified program context * *ctx_out*, *data_out* (for example, packet data), result of the * execution *retval*, and *duration* of the test run. * * The sizes of the buffers provided as input and output * parameters *ctx_in*, *ctx_out*, *data_in*, and *data_out* must * be provided in the corresponding variables *ctx_size_in*, * *ctx_size_out*, *data_size_in*, and/or *data_size_out*. If any * of these parameters are not provided (ie set to NULL), the * corresponding size field must be zero. * * Some program types have particular requirements: * * **BPF_PROG_TYPE_SK_LOOKUP** * *data_in* and *data_out* must be NULL. * * **BPF_PROG_TYPE_XDP** * *ctx_in* and *ctx_out* must be NULL. * * **BPF_PROG_TYPE_RAW_TRACEPOINT**, * **BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE** * * *ctx_out*, *data_in* and *data_out* must be NULL. * *repeat* must be zero. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * **ENOSPC** * Either *data_size_out* or *ctx_size_out* is too small. * **ENOTSUPP** * This command is not supported by the program type of * the program referred to by *prog_fd*. * * BPF_PROG_GET_NEXT_ID * Description * Fetch the next eBPF program currently loaded into the kernel. * * Looks for the eBPF program with an id greater than *start_id* * and updates *next_id* on success. If no other eBPF programs * remain with ids higher than *start_id*, returns -1 and sets * *errno* to **ENOENT**. * * Return * Returns zero on success. On error, or when no id remains, -1 * is returned and *errno* is set appropriately. * * BPF_MAP_GET_NEXT_ID * Description * Fetch the next eBPF map currently loaded into the kernel. * * Looks for the eBPF map with an id greater than *start_id* * and updates *next_id* on success. If no other eBPF maps * remain with ids higher than *start_id*, returns -1 and sets * *errno* to **ENOENT**. * * Return * Returns zero on success. On error, or when no id remains, -1 * is returned and *errno* is set appropriately. * * BPF_PROG_GET_FD_BY_ID * Description * Open a file descriptor for the eBPF program corresponding to * *prog_id*. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_MAP_GET_FD_BY_ID * Description * Open a file descriptor for the eBPF map corresponding to * *map_id*. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_OBJ_GET_INFO_BY_FD * Description * Obtain information about the eBPF object corresponding to * *bpf_fd*. * * Populates up to *info_len* bytes of *info*, which will be in * one of the following formats depending on the eBPF object type * of *bpf_fd*: * * * **struct bpf_prog_info** * * **struct bpf_map_info** * * **struct bpf_btf_info** * * **struct bpf_link_info** * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_PROG_QUERY * Description * Obtain information about eBPF programs associated with the * specified *attach_type* hook. * * The *target_fd* must be a valid file descriptor for a kernel * object which depends on the attach type of *attach_bpf_fd*: * * **BPF_PROG_TYPE_CGROUP_DEVICE**, * **BPF_PROG_TYPE_CGROUP_SKB**, * **BPF_PROG_TYPE_CGROUP_SOCK**, * **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**, * **BPF_PROG_TYPE_CGROUP_SOCKOPT**, * **BPF_PROG_TYPE_CGROUP_SYSCTL**, * **BPF_PROG_TYPE_SOCK_OPS** * * Control Group v2 hierarchy with the eBPF controller * enabled. Requires the kernel to be compiled with * **CONFIG_CGROUP_BPF**. * * **BPF_PROG_TYPE_FLOW_DISSECTOR** * * Network namespace (eg /proc/self/ns/net). * * **BPF_PROG_TYPE_LIRC_MODE2** * * LIRC device path (eg /dev/lircN). Requires the kernel * to be compiled with **CONFIG_BPF_LIRC_MODE2**. * * **BPF_PROG_QUERY** always fetches the number of programs * attached and the *attach_flags* which were used to attach those * programs. Additionally, if *prog_ids* is nonzero and the number * of attached programs is less than *prog_cnt*, populates * *prog_ids* with the eBPF program ids of the programs attached * at *target_fd*. * * The following flags may alter the result: * * **BPF_F_QUERY_EFFECTIVE** * Only return information regarding programs which are * currently effective at the specified *target_fd*. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_RAW_TRACEPOINT_OPEN * Description * Attach an eBPF program to a tracepoint *name* to access kernel * internal arguments of the tracepoint in their raw form. * * The *prog_fd* must be a valid file descriptor associated with * a loaded eBPF program of type **BPF_PROG_TYPE_RAW_TRACEPOINT**. * * No ABI guarantees are made about the content of tracepoint * arguments exposed to the corresponding eBPF program. * * Applying **close**\ (2) to the file descriptor returned by * **BPF_RAW_TRACEPOINT_OPEN** will delete the map (but see NOTES). * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_BTF_LOAD * Description * Verify and load BPF Type Format (BTF) metadata into the kernel, * returning a new file descriptor associated with the metadata. * BTF is described in more detail at * https://www.kernel.org/doc/html/latest/bpf/btf.html. * * The *btf* parameter must point to valid memory providing * *btf_size* bytes of BTF binary metadata. * * The returned file descriptor can be passed to other **bpf**\ () * subcommands such as **BPF_PROG_LOAD** or **BPF_MAP_CREATE** to * associate the BTF with those objects. * * Similar to **BPF_PROG_LOAD**, **BPF_BTF_LOAD** has optional * parameters to specify a *btf_log_buf*, *btf_log_size* and * *btf_log_level* which allow the kernel to return freeform log * output regarding the BTF verification process. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_BTF_GET_FD_BY_ID * Description * Open a file descriptor for the BPF Type Format (BTF) * corresponding to *btf_id*. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_TASK_FD_QUERY * Description * Obtain information about eBPF programs associated with the * target process identified by *pid* and *fd*. * * If the *pid* and *fd* are associated with a tracepoint, kprobe * or uprobe perf event, then the *prog_id* and *fd_type* will * be populated with the eBPF program id and file descriptor type * of type **bpf_task_fd_type**. If associated with a kprobe or * uprobe, the *probe_offset* and *probe_addr* will also be * populated. Optionally, if *buf* is provided, then up to * *buf_len* bytes of *buf* will be populated with the name of * the tracepoint, kprobe or uprobe. * * The resulting *prog_id* may be introspected in deeper detail * using **BPF_PROG_GET_FD_BY_ID** and **BPF_OBJ_GET_INFO_BY_FD**. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_MAP_LOOKUP_AND_DELETE_ELEM * Description * Look up an element with the given *key* in the map referred to * by the file descriptor *fd*, and if found, delete the element. * * For **BPF_MAP_TYPE_QUEUE** and **BPF_MAP_TYPE_STACK** map * types, the *flags* argument needs to be set to 0, but for other * map types, it may be specified as: * * **BPF_F_LOCK** * Look up and delete the value of a spin-locked map * without returning the lock. This must be specified if * the elements contain a spinlock. * * The **BPF_MAP_TYPE_QUEUE** and **BPF_MAP_TYPE_STACK** map types * implement this command as a "pop" operation, deleting the top * element rather than one corresponding to *key*. * The *key* and *key_len* parameters should be zeroed when * issuing this operation for these map types. * * This command is only valid for the following map types: * * **BPF_MAP_TYPE_QUEUE** * * **BPF_MAP_TYPE_STACK** * * **BPF_MAP_TYPE_HASH** * * **BPF_MAP_TYPE_PERCPU_HASH** * * **BPF_MAP_TYPE_LRU_HASH** * * **BPF_MAP_TYPE_LRU_PERCPU_HASH** * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_MAP_FREEZE * Description * Freeze the permissions of the specified map. * * Write permissions may be frozen by passing zero *flags*. * Upon success, no future syscall invocations may alter the * map state of *map_fd*. Write operations from eBPF programs * are still possible for a frozen map. * * Not supported for maps of type **BPF_MAP_TYPE_STRUCT_OPS**. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_BTF_GET_NEXT_ID * Description * Fetch the next BPF Type Format (BTF) object currently loaded * into the kernel. * * Looks for the BTF object with an id greater than *start_id* * and updates *next_id* on success. If no other BTF objects * remain with ids higher than *start_id*, returns -1 and sets * *errno* to **ENOENT**. * * Return * Returns zero on success. On error, or when no id remains, -1 * is returned and *errno* is set appropriately. * * BPF_MAP_LOOKUP_BATCH * Description * Iterate and fetch multiple elements in a map. * * Two opaque values are used to manage batch operations, * *in_batch* and *out_batch*. Initially, *in_batch* must be set * to NULL to begin the batched operation. After each subsequent * **BPF_MAP_LOOKUP_BATCH**, the caller should pass the resultant * *out_batch* as the *in_batch* for the next operation to * continue iteration from the current point. * * The *keys* and *values* are output parameters which must point * to memory large enough to hold *count* items based on the key * and value size of the map *map_fd*. The *keys* buffer must be * of *key_size* * *count*. The *values* buffer must be of * *value_size* * *count*. * * The *elem_flags* argument may be specified as one of the * following: * * **BPF_F_LOCK** * Look up the value of a spin-locked map without * returning the lock. This must be specified if the * elements contain a spinlock. * * On success, *count* elements from the map are copied into the * user buffer, with the keys copied into *keys* and the values * copied into the corresponding indices in *values*. * * If an error is returned and *errno* is not **EFAULT**, *count* * is set to the number of successfully processed elements. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * May set *errno* to **ENOSPC** to indicate that *keys* or * *values* is too small to dump an entire bucket during * iteration of a hash-based map type. * * BPF_MAP_LOOKUP_AND_DELETE_BATCH * Description * Iterate and delete all elements in a map. * * This operation has the same behavior as * **BPF_MAP_LOOKUP_BATCH** with two exceptions: * * * Every element that is successfully returned is also deleted * from the map. This is at least *count* elements. Note that * *count* is both an input and an output parameter. * * Upon returning with *errno* set to **EFAULT**, up to * *count* elements may be deleted without returning the keys * and values of the deleted elements. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_MAP_UPDATE_BATCH * Description * Update multiple elements in a map by *key*. * * The *keys* and *values* are input parameters which must point * to memory large enough to hold *count* items based on the key * and value size of the map *map_fd*. The *keys* buffer must be * of *key_size* * *count*. The *values* buffer must be of * *value_size* * *count*. * * Each element specified in *keys* is sequentially updated to the * value in the corresponding index in *values*. The *in_batch* * and *out_batch* parameters are ignored and should be zeroed. * * The *elem_flags* argument should be specified as one of the * following: * * **BPF_ANY** * Create new elements or update a existing elements. * **BPF_NOEXIST** * Create new elements only if they do not exist. * **BPF_EXIST** * Update existing elements. * **BPF_F_LOCK** * Update spin_lock-ed map elements. This must be * specified if the map value contains a spinlock. * * On success, *count* elements from the map are updated. * * If an error is returned and *errno* is not **EFAULT**, *count* * is set to the number of successfully processed elements. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * May set *errno* to **EINVAL**, **EPERM**, **ENOMEM**, or * **E2BIG**. **E2BIG** indicates that the number of elements in * the map reached the *max_entries* limit specified at map * creation time. * * May set *errno* to one of the following error codes under * specific circumstances: * * **EEXIST** * If *flags* specifies **BPF_NOEXIST** and the element * with *key* already exists in the map. * **ENOENT** * If *flags* specifies **BPF_EXIST** and the element with * *key* does not exist in the map. * * BPF_MAP_DELETE_BATCH * Description * Delete multiple elements in a map by *key*. * * The *keys* parameter is an input parameter which must point * to memory large enough to hold *count* items based on the key * size of the map *map_fd*, that is, *key_size* * *count*. * * Each element specified in *keys* is sequentially deleted. The * *in_batch*, *out_batch*, and *values* parameters are ignored * and should be zeroed. * * The *elem_flags* argument may be specified as one of the * following: * * **BPF_F_LOCK** * Look up the value of a spin-locked map without * returning the lock. This must be specified if the * elements contain a spinlock. * * On success, *count* elements from the map are updated. * * If an error is returned and *errno* is not **EFAULT**, *count* * is set to the number of successfully processed elements. If * *errno* is **EFAULT**, up to *count* elements may be been * deleted. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_LINK_CREATE * Description * Attach an eBPF program to a *target_fd* at the specified * *attach_type* hook and return a file descriptor handle for * managing the link. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_LINK_UPDATE * Description * Update the eBPF program in the specified *link_fd* to * *new_prog_fd*. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_LINK_GET_FD_BY_ID * Description * Open a file descriptor for the eBPF Link corresponding to * *link_id*. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_LINK_GET_NEXT_ID * Description * Fetch the next eBPF link currently loaded into the kernel. * * Looks for the eBPF link with an id greater than *start_id* * and updates *next_id* on success. If no other eBPF links * remain with ids higher than *start_id*, returns -1 and sets * *errno* to **ENOENT**. * * Return * Returns zero on success. On error, or when no id remains, -1 * is returned and *errno* is set appropriately. * * BPF_ENABLE_STATS * Description * Enable eBPF runtime statistics gathering. * * Runtime statistics gathering for the eBPF runtime is disabled * by default to minimize the corresponding performance overhead. * This command enables statistics globally. * * Multiple programs may independently enable statistics. * After gathering the desired statistics, eBPF runtime statistics * may be disabled again by calling **close**\ (2) for the file * descriptor returned by this function. Statistics will only be * disabled system-wide when all outstanding file descriptors * returned by prior calls for this subcommand are closed. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_ITER_CREATE * Description * Create an iterator on top of the specified *link_fd* (as * previously created using **BPF_LINK_CREATE**) and return a * file descriptor that can be used to trigger the iteration. * * If the resulting file descriptor is pinned to the filesystem * using **BPF_OBJ_PIN**, then subsequent **read**\ (2) syscalls * for that path will trigger the iterator to read kernel state * using the eBPF program attached to *link_fd*. * * Return * A new file descriptor (a nonnegative integer), or -1 if an * error occurred (in which case, *errno* is set appropriately). * * BPF_LINK_DETACH * Description * Forcefully detach the specified *link_fd* from its * corresponding attachment point. * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * BPF_PROG_BIND_MAP * Description * Bind a map to the lifetime of an eBPF program. * * The map identified by *map_fd* is bound to the program * identified by *prog_fd* and only released when *prog_fd* is * released. This may be used in cases where metadata should be * associated with a program which otherwise does not contain any * references to the map (for example, embedded in the eBPF * program instructions). * * Return * Returns zero on success. On error, -1 is returned and *errno* * is set appropriately. * * NOTES * eBPF objects (maps and programs) can be shared between processes. * * * After **fork**\ (2), the child inherits file descriptors * referring to the same eBPF objects. * * File descriptors referring to eBPF objects can be transferred over * **unix**\ (7) domain sockets. * * File descriptors referring to eBPF objects can be duplicated in the * usual way, using **dup**\ (2) and similar calls. * * File descriptors referring to eBPF objects can be pinned to the * filesystem using the **BPF_OBJ_PIN** command of **bpf**\ (2). * * An eBPF object is deallocated only after all file descriptors referring * to the object have been closed and no references remain pinned to the * filesystem or attached (for example, bound to a program or device). */ enum bpf_cmd { BPF_MAP_CREATE, BPF_MAP_LOOKUP_ELEM, BPF_MAP_UPDATE_ELEM, BPF_MAP_DELETE_ELEM, BPF_MAP_GET_NEXT_KEY, BPF_PROG_LOAD, BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH, BPF_PROG_DETACH, BPF_PROG_TEST_RUN, BPF_PROG_RUN = BPF_PROG_TEST_RUN, BPF_PROG_GET_NEXT_ID, BPF_MAP_GET_NEXT_ID, BPF_PROG_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID, BPF_OBJ_GET_INFO_BY_FD, BPF_PROG_QUERY, BPF_RAW_TRACEPOINT_OPEN, BPF_BTF_LOAD, BPF_BTF_GET_FD_BY_ID, BPF_TASK_FD_QUERY, BPF_MAP_LOOKUP_AND_DELETE_ELEM, BPF_MAP_FREEZE, BPF_BTF_GET_NEXT_ID, BPF_MAP_LOOKUP_BATCH, BPF_MAP_LOOKUP_AND_DELETE_BATCH, BPF_MAP_UPDATE_BATCH, BPF_MAP_DELETE_BATCH, BPF_LINK_CREATE, BPF_LINK_UPDATE, BPF_LINK_GET_FD_BY_ID, BPF_LINK_GET_NEXT_ID, BPF_ENABLE_STATS, BPF_ITER_CREATE, BPF_LINK_DETACH, BPF_PROG_BIND_MAP, }; enum bpf_map_type { BPF_MAP_TYPE_UNSPEC, BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_MAP_TYPE_PERCPU_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, BPF_MAP_TYPE_STACK_TRACE, BPF_MAP_TYPE_CGROUP_ARRAY, BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH, BPF_MAP_TYPE_LPM_TRIE, BPF_MAP_TYPE_ARRAY_OF_MAPS, BPF_MAP_TYPE_HASH_OF_MAPS, BPF_MAP_TYPE_DEVMAP, BPF_MAP_TYPE_SOCKMAP, BPF_MAP_TYPE_CPUMAP, BPF_MAP_TYPE_XSKMAP, BPF_MAP_TYPE_SOCKHASH, #ifndef __GENKSYMS__ BPF_MAP_TYPE_CGROUP_STORAGE, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK, BPF_MAP_TYPE_SK_STORAGE, BPF_MAP_TYPE_DEVMAP_HASH, BPF_MAP_TYPE_STRUCT_OPS, BPF_MAP_TYPE_RINGBUF, BPF_MAP_TYPE_INODE_STORAGE, BPF_MAP_TYPE_TASK_STORAGE, #endif /* __GENKSYMS__ */ }; /* Note that tracing related programs such as * BPF_PROG_TYPE_{KPROBE,TRACEPOINT,PERF_EVENT,RAW_TRACEPOINT} * are not subject to a stable API since kernel internal data * structures can change from release to release and may * therefore break existing tracing BPF programs. Tracing BPF * programs correspond to /a/ specific kernel which is to be * analyzed, and not /a/ specific kernel /and/ all future ones. */ enum bpf_prog_type { BPF_PROG_TYPE_UNSPEC, BPF_PROG_TYPE_SOCKET_FILTER, BPF_PROG_TYPE_KPROBE, BPF_PROG_TYPE_SCHED_CLS, BPF_PROG_TYPE_SCHED_ACT, BPF_PROG_TYPE_TRACEPOINT, BPF_PROG_TYPE_XDP, BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_CGROUP_SKB, BPF_PROG_TYPE_CGROUP_SOCK, BPF_PROG_TYPE_LWT_IN, BPF_PROG_TYPE_LWT_OUT, BPF_PROG_TYPE_LWT_XMIT, BPF_PROG_TYPE_SOCK_OPS, BPF_PROG_TYPE_SK_SKB, BPF_PROG_TYPE_CGROUP_DEVICE, BPF_PROG_TYPE_SK_MSG, BPF_PROG_TYPE_RAW_TRACEPOINT, BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_PROG_TYPE_LWT_SEG6LOCAL, BPF_PROG_TYPE_LIRC_MODE2, #ifndef __GENKSYMS__ BPF_PROG_TYPE_SK_REUSEPORT, BPF_PROG_TYPE_FLOW_DISSECTOR, BPF_PROG_TYPE_CGROUP_SYSCTL, BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, BPF_PROG_TYPE_CGROUP_SOCKOPT, BPF_PROG_TYPE_TRACING, BPF_PROG_TYPE_STRUCT_OPS, BPF_PROG_TYPE_EXT, BPF_PROG_TYPE_LSM, BPF_PROG_TYPE_SK_LOOKUP, BPF_PROG_TYPE_SYSCALL, /* a program that can execute syscalls */ #endif /* __GENKSYMS__ */ }; enum bpf_attach_type { BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS, BPF_CGROUP_INET_SOCK_CREATE, BPF_CGROUP_SOCK_OPS, BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT, BPF_CGROUP_DEVICE, BPF_SK_MSG_VERDICT, BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET6_BIND, BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT, BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_POST_BIND, BPF_CGROUP_UDP4_SENDMSG, BPF_CGROUP_UDP6_SENDMSG, BPF_LIRC_MODE2, #ifndef __GENKSYMS__ BPF_FLOW_DISSECTOR, BPF_CGROUP_SYSCTL, BPF_CGROUP_UDP4_RECVMSG, BPF_CGROUP_UDP6_RECVMSG, BPF_CGROUP_GETSOCKOPT, BPF_CGROUP_SETSOCKOPT, BPF_TRACE_RAW_TP, BPF_TRACE_FENTRY, BPF_TRACE_FEXIT, BPF_MODIFY_RETURN, BPF_LSM_MAC, BPF_TRACE_ITER, BPF_CGROUP_INET4_GETPEERNAME, BPF_CGROUP_INET6_GETPEERNAME, BPF_CGROUP_INET4_GETSOCKNAME, BPF_CGROUP_INET6_GETSOCKNAME, BPF_XDP_DEVMAP, BPF_CGROUP_INET_SOCK_RELEASE, BPF_XDP_CPUMAP, BPF_SK_LOOKUP, BPF_XDP, BPF_SK_SKB_VERDICT, #endif /* __GENKSYMS__ */ __MAX_BPF_ATTACH_TYPE }; #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE enum bpf_link_type { BPF_LINK_TYPE_UNSPEC = 0, BPF_LINK_TYPE_RAW_TRACEPOINT = 1, BPF_LINK_TYPE_TRACING = 2, BPF_LINK_TYPE_CGROUP = 3, BPF_LINK_TYPE_ITER = 4, BPF_LINK_TYPE_NETNS = 5, BPF_LINK_TYPE_XDP = 6, MAX_BPF_LINK_TYPE, }; /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command * * NONE(default): No further bpf programs allowed in the subtree. * * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program, * the program in this cgroup yields to sub-cgroup program. * * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program, * that cgroup program gets run in addition to the program in this cgroup. * * Only one program is allowed to be attached to a cgroup with * NONE or BPF_F_ALLOW_OVERRIDE flag. * Attaching another program on top of NONE or BPF_F_ALLOW_OVERRIDE will * release old program and attach the new one. Attach flags has to match. * * Multiple programs are allowed to be attached to a cgroup with * BPF_F_ALLOW_MULTI flag. They are executed in FIFO order * (those that were attached first, run first) * The programs of sub-cgroup are executed first, then programs of * this cgroup and then programs of parent cgroup. * When children program makes decision (like picking TCP CA or sock bind) * parent program has a chance to override it. * * With BPF_F_ALLOW_MULTI a new program is added to the end of the list of * programs for a cgroup. Though it's possible to replace an old program at * any position by also specifying BPF_F_REPLACE flag and position itself in * replace_bpf_fd attribute. Old program at this position will be released. * * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups. * A cgroup with NONE doesn't allow any programs in sub-cgroups. * Ex1: * cgrp1 (MULTI progs A, B) -> * cgrp2 (OVERRIDE prog C) -> * cgrp3 (MULTI prog D) -> * cgrp4 (OVERRIDE prog E) -> * cgrp5 (NONE prog F) * the event in cgrp5 triggers execution of F,D,A,B in that order. * if prog F is detached, the execution is E,D,A,B * if prog F and D are detached, the execution is E,A,B * if prog F, E and D are detached, the execution is C,A,B * * All eligible programs are executed regardless of return code from * earlier programs. */ #define BPF_F_ALLOW_OVERRIDE (1U << 0) #define BPF_F_ALLOW_MULTI (1U << 1) #define BPF_F_REPLACE (1U << 2) /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the * verifier will perform strict alignment checking as if the kernel * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, * and NET_IP_ALIGN defined to 2. */ #define BPF_F_STRICT_ALIGNMENT (1U << 0) /* If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the * verifier will allow any alignment whatsoever. On platforms * with strict alignment requirements for loads ands stores (such * as sparc and mips) the verifier validates that all loads and * stores provably follow this requirement. This flag turns that * checking and enforcement off. * * It is mostly used for testing when we want to validate the * context and memory access aspects of the verifier, but because * of an unaligned access the alignment check would trigger before * the one we are interested in. */ #define BPF_F_ANY_ALIGNMENT (1U << 1) /* BPF_F_TEST_RND_HI32 is used in BPF_PROG_LOAD command for testing purpose. * Verifier does sub-register def/use analysis and identifies instructions whose * def only matters for low 32-bit, high 32-bit is never referenced later * through implicit zero extension. Therefore verifier notifies JIT back-ends * that it is safe to ignore clearing high 32-bit for these instructions. This * saves some back-ends a lot of code-gen. However such optimization is not * necessary on some arches, for example x86_64, arm64 etc, whose JIT back-ends * hence hasn't used verifier's analysis result. But, we really want to have a * way to be able to verify the correctness of the described optimization on * x86_64 on which testsuites are frequently exercised. * * So, this flag is introduced. Once it is set, verifier will randomize high * 32-bit for those instructions who has been identified as safe to ignore them. * Then, if verifier is not doing correct analysis, such randomization will * regress tests to expose bugs. */ #define BPF_F_TEST_RND_HI32 (1U << 2) /* The verifier internal test flag. Behavior is undefined */ #define BPF_F_TEST_STATE_FREQ (1U << 3) /* If BPF_F_SLEEPABLE is used in BPF_PROG_LOAD command, the verifier will * restrict map and helper usage for such programs. Sleepable BPF programs can * only be attached to hooks where kernel execution context allows sleeping. * Such programs are allowed to use helpers that may sleep like * bpf_copy_from_user(). */ #define BPF_F_SLEEPABLE (1U << 4) /* When BPF ldimm64's insn[0].src_reg != 0 then this can have * the following extensions: * * insn[0].src_reg: BPF_PSEUDO_MAP_[FD|IDX] * insn[0].imm: map fd or fd_idx * insn[1].imm: 0 * insn[0].off: 0 * insn[1].off: 0 * ldimm64 rewrite: address of map * verifier type: CONST_PTR_TO_MAP */ #define BPF_PSEUDO_MAP_FD 1 #define BPF_PSEUDO_MAP_IDX 5 /* insn[0].src_reg: BPF_PSEUDO_MAP_[IDX_]VALUE * insn[0].imm: map fd or fd_idx * insn[1].imm: offset into value * insn[0].off: 0 * insn[1].off: 0 * ldimm64 rewrite: address of map[0]+offset * verifier type: PTR_TO_MAP_VALUE */ #define BPF_PSEUDO_MAP_VALUE 2 #define BPF_PSEUDO_MAP_IDX_VALUE 6 /* insn[0].src_reg: BPF_PSEUDO_BTF_ID * insn[0].imm: kernel btd id of VAR * insn[1].imm: 0 * insn[0].off: 0 * insn[1].off: 0 * ldimm64 rewrite: address of the kernel variable * verifier type: PTR_TO_BTF_ID or PTR_TO_MEM, depending on whether the var * is struct/union. */ #define BPF_PSEUDO_BTF_ID 3 /* insn[0].src_reg: BPF_PSEUDO_FUNC * insn[0].imm: insn offset to the func * insn[1].imm: 0 * insn[0].off: 0 * insn[1].off: 0 * ldimm64 rewrite: address of the function * verifier type: PTR_TO_FUNC. */ #define BPF_PSEUDO_FUNC 4 /* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative * offset to another bpf function */ #define BPF_PSEUDO_CALL 1 /* when bpf_call->src_reg == BPF_PSEUDO_KFUNC_CALL, * bpf_call->imm == btf_id of a BTF_KIND_FUNC in the running kernel */ #define BPF_PSEUDO_KFUNC_CALL 2 /* flags for BPF_MAP_UPDATE_ELEM command */ enum { BPF_ANY = 0, /* create new element or update existing */ BPF_NOEXIST = 1, /* create new element if it didn't exist */ BPF_EXIST = 2, /* update existing element */ BPF_F_LOCK = 4, /* spin_lock-ed map_lookup/map_update */ }; /* flags for BPF_MAP_CREATE command */ enum { BPF_F_NO_PREALLOC = (1U << 0), /* Instead of having one common LRU list in the * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list * which can scale and perform better. * Note, the LRU nodes (including free nodes) cannot be moved * across different LRU lists. */ BPF_F_NO_COMMON_LRU = (1U << 1), /* Specify numa node during map creation */ BPF_F_NUMA_NODE = (1U << 2), /* Flags for accessing BPF object from syscall side. */ BPF_F_RDONLY = (1U << 3), BPF_F_WRONLY = (1U << 4), /* Flag for stack_map, store build_id+offset instead of pointer */ BPF_F_STACK_BUILD_ID = (1U << 5), /* Zero-initialize hash function seed. This should only be used for testing. */ BPF_F_ZERO_SEED = (1U << 6), /* Flags for accessing BPF object from program side. */ BPF_F_RDONLY_PROG = (1U << 7), BPF_F_WRONLY_PROG = (1U << 8), /* Clone map from listener for newly accepted socket */ BPF_F_CLONE = (1U << 9), /* Enable memory-mapping BPF map */ BPF_F_MMAPABLE = (1U << 10), /* Share perf_event among processes */ BPF_F_PRESERVE_ELEMS = (1U << 11), /* Create a map that is suitable to be an inner map with dynamic max entries */ BPF_F_INNER_MAP = (1U << 12), }; /* Flags for BPF_PROG_QUERY. */ /* Query effective (directly attached + inherited from ancestor cgroups) * programs that will be executed for events within a cgroup. * attach_flags with this flag are returned only for directly attached programs. */ #define BPF_F_QUERY_EFFECTIVE (1U << 0) /* Flags for BPF_PROG_TEST_RUN */ /* If set, run the test on the cpu specified by bpf_attr.test.cpu */ #define BPF_F_TEST_RUN_ON_CPU (1U << 0) /* type for BPF_ENABLE_STATS */ enum bpf_stats_type { /* enabled run_time_ns and run_cnt */ BPF_STATS_RUN_TIME = 0, }; enum bpf_stack_build_id_status { /* user space need an empty entry to identify end of a trace */ BPF_STACK_BUILD_ID_EMPTY = 0, /* with valid build_id and offset */ BPF_STACK_BUILD_ID_VALID = 1, /* couldn't get build_id, fallback to ip */ BPF_STACK_BUILD_ID_IP = 2, }; #define BPF_BUILD_ID_SIZE 20 struct bpf_stack_build_id { __s32 status; unsigned char build_id[BPF_BUILD_ID_SIZE]; union { __u64 offset; __u64 ip; }; }; #define BPF_OBJ_NAME_LEN 16U union bpf_attr { struct { /* anonymous struct used by BPF_MAP_CREATE command */ __u32 map_type; /* one of enum bpf_map_type */ __u32 key_size; /* size of key in bytes */ __u32 value_size; /* size of value in bytes */ __u32 max_entries; /* max number of entries in a map */ __u32 map_flags; /* BPF_MAP_CREATE related * flags defined above. */ __u32 inner_map_fd; /* fd pointing to the inner map */ __u32 numa_node; /* numa node (effective only if * BPF_F_NUMA_NODE is set). */ char map_name[BPF_OBJ_NAME_LEN]; __u32 map_ifindex; /* ifindex of netdev to create on */ __u32 btf_fd; /* fd pointing to a BTF type data */ __u32 btf_key_type_id; /* BTF type_id of the key */ __u32 btf_value_type_id; /* BTF type_id of the value */ #ifndef __GENKSYMS__ __u32 btf_vmlinux_value_type_id;/* BTF type_id of a kernel- * struct stored as the * map value */ #endif /* __GENKSYMS__ */ }; struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ __u32 map_fd; __aligned_u64 key; union { __aligned_u64 value; __aligned_u64 next_key; }; __u64 flags; }; #ifndef __GENKSYMS__ struct { /* struct used by BPF_MAP_*_BATCH commands */ __aligned_u64 in_batch; /* start batch, * NULL to start from beginning */ __aligned_u64 out_batch; /* output: next start batch */ __aligned_u64 keys; __aligned_u64 values; __u32 count; /* input/output: * input: # of key/value * elements * output: # of filled elements */ __u32 map_fd; __u64 elem_flags; __u64 flags; } batch; #endif /* __GENKSYMS__ */ struct { /* anonymous struct used by BPF_PROG_LOAD command */ __u32 prog_type; /* one of enum bpf_prog_type */ __u32 insn_cnt; __aligned_u64 insns; __aligned_u64 license; __u32 log_level; /* verbosity level of verifier */ __u32 log_size; /* size of user buffer */ __aligned_u64 log_buf; /* user supplied buffer */ __u32 kern_version; /* not used */ __u32 prog_flags; char prog_name[BPF_OBJ_NAME_LEN]; __u32 prog_ifindex; /* ifindex of netdev to prep for */ /* For some prog types expected attach type must be known at * load time to verify attach type specific parts of prog * (context accesses, allowed helpers, etc). */ __u32 expected_attach_type; #ifndef __GENKSYMS__ __u32 prog_btf_fd; /* fd pointing to BTF type data */ __u32 func_info_rec_size; /* userspace bpf_func_info size */ __aligned_u64 func_info; /* func info */ __u32 func_info_cnt; /* number of bpf_func_info records */ __u32 line_info_rec_size; /* userspace bpf_line_info size */ __aligned_u64 line_info; /* line info */ __u32 line_info_cnt; /* number of bpf_line_info records */ __u32 attach_btf_id; /* in-kernel BTF type id to attach to */ union { /* valid prog_fd to attach to bpf prog */ __u32 attach_prog_fd; /* or valid module BTF object fd or 0 to attach to vmlinux */ __u32 attach_btf_obj_fd; }; __u32 :32; /* pad */ __aligned_u64 fd_array; /* array of FDs */ #endif /* __GENKSYMS__ */ }; struct { /* anonymous struct used by BPF_OBJ_* commands */ __aligned_u64 pathname; __u32 bpf_fd; __u32 file_flags; }; struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ __u32 target_fd; /* container object to attach to */ __u32 attach_bpf_fd; /* eBPF program to attach */ __u32 attach_type; __u32 attach_flags; #ifndef __GENKSYMS__ __u32 replace_bpf_fd; /* previously attached eBPF * program to replace if * BPF_F_REPLACE is used */ #endif /* __GENKSYMS__ */ }; struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ __u32 prog_fd; __u32 retval; __u32 data_size_in; /* input: len of data_in */ __u32 data_size_out; /* input/output: len of data_out * returns ENOSPC if data_out * is too small. */ __aligned_u64 data_in; __aligned_u64 data_out; __u32 repeat; __u32 duration; #ifndef __GENKSYMS__ __u32 ctx_size_in; /* input: len of ctx_in */ __u32 ctx_size_out; /* input/output: len of ctx_out * returns ENOSPC if ctx_out * is too small. */ __aligned_u64 ctx_in; __aligned_u64 ctx_out; __u32 flags; __u32 cpu; #endif /* __GENKSYMS__ */ } test; struct { /* anonymous struct used by BPF_*_GET_*_ID */ union { __u32 start_id; __u32 prog_id; __u32 map_id; __u32 btf_id; #ifndef __GENKSYMS__ __u32 link_id; #endif /* __GENKSYMS__ */ }; __u32 next_id; __u32 open_flags; }; struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ __u32 bpf_fd; __u32 info_len; __aligned_u64 info; } info; struct { /* anonymous struct used by BPF_PROG_QUERY command */ __u32 target_fd; /* container object to query */ __u32 attach_type; __u32 query_flags; __u32 attach_flags; __aligned_u64 prog_ids; __u32 prog_cnt; } query; struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */ __u64 name; __u32 prog_fd; } raw_tracepoint; struct { /* anonymous struct for BPF_BTF_LOAD */ __aligned_u64 btf; __aligned_u64 btf_log_buf; __u32 btf_size; __u32 btf_log_size; __u32 btf_log_level; }; struct { __u32 pid; /* input: pid */ __u32 fd; /* input: fd */ __u32 flags; /* input: flags */ __u32 buf_len; /* input/output: buf len */ __aligned_u64 buf; /* input/output: * tp_name for tracepoint * symbol for kprobe * filename for uprobe */ __u32 prog_id; /* output: prod_id */ __u32 fd_type; /* output: BPF_FD_TYPE_* */ __u64 probe_offset; /* output: probe_offset */ __u64 probe_addr; /* output: probe_addr */ } task_fd_query; #ifndef __GENKSYMS__ struct { /* struct used by BPF_LINK_CREATE command */ __u32 prog_fd; /* eBPF program to attach */ union { __u32 target_fd; /* object to attach to */ __u32 target_ifindex; /* target ifindex */ }; __u32 attach_type; /* attach type */ __u32 flags; /* extra flags */ union { __u32 target_btf_id; /* btf_id of target to attach to */ struct { __aligned_u64 iter_info; /* extra bpf_iter_link_info */ __u32 iter_info_len; /* iter_info length */ }; }; } link_create; struct { /* struct used by BPF_LINK_UPDATE command */ __u32 link_fd; /* link fd */ /* new program fd to update link with */ __u32 new_prog_fd; __u32 flags; /* extra flags */ /* expected link's program fd; is specified only if * BPF_F_REPLACE flag is set in flags */ __u32 old_prog_fd; } link_update; struct { __u32 link_fd; } link_detach; struct { /* struct used by BPF_ENABLE_STATS command */ __u32 type; } enable_stats; struct { /* struct used by BPF_ITER_CREATE command */ __u32 link_fd; __u32 flags; } iter_create; struct { /* struct used by BPF_PROG_BIND_MAP command */ __u32 prog_fd; __u32 map_fd; __u32 flags; /* extra flags */ } prog_bind_map; #endif /* __GENKSYMS__ */ } __attribute__((aligned(8))); /* The description below is an attempt at providing documentation to eBPF * developers about the multiple available eBPF helper functions. It can be * parsed and used to produce a manual page. The workflow is the following, * and requires the rst2man utility: * * $ ./scripts/bpf_doc.py \ * --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst * $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7 * $ man /tmp/bpf-helpers.7 * * Note that in order to produce this external documentation, some RST * formatting is used in the descriptions to get "bold" and "italics" in * manual pages. Also note that the few trailing white spaces are * intentional, removing them would break paragraphs for rst2man. * * Start of BPF helper function descriptions: * * void *bpf_map_lookup_elem(struct bpf_map *map, const void *key) * Description * Perform a lookup in *map* for an entry associated to *key*. * Return * Map value associated to *key*, or **NULL** if no entry was * found. * * long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags) * Description * Add or update the value of the entry associated to *key* in * *map* with *value*. *flags* is one of: * * **BPF_NOEXIST** * The entry for *key* must not exist in the map. * **BPF_EXIST** * The entry for *key* must already exist in the map. * **BPF_ANY** * No condition on the existence of the entry for *key*. * * Flag value **BPF_NOEXIST** cannot be used for maps of types * **BPF_MAP_TYPE_ARRAY** or **BPF_MAP_TYPE_PERCPU_ARRAY** (all * elements always exist), the helper would return an error. * Return * 0 on success, or a negative error in case of failure. * * long bpf_map_delete_elem(struct bpf_map *map, const void *key) * Description * Delete entry with *key* from *map*. * Return * 0 on success, or a negative error in case of failure. * * long bpf_probe_read(void *dst, u32 size, const void *unsafe_ptr) * Description * For tracing programs, safely attempt to read *size* bytes from * kernel space address *unsafe_ptr* and store the data in *dst*. * * Generally, use **bpf_probe_read_user**\ () or * **bpf_probe_read_kernel**\ () instead. * Return * 0 on success, or a negative error in case of failure. * * u64 bpf_ktime_get_ns(void) * Description * Return the time elapsed since system boot, in nanoseconds. * Does not include time the system was suspended. * See: **clock_gettime**\ (**CLOCK_MONOTONIC**) * Return * Current *ktime*. * * long bpf_trace_printk(const char *fmt, u32 fmt_size, ...) * Description * This helper is a "printk()-like" facility for debugging. It * prints a message defined by format *fmt* (of size *fmt_size*) * to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if * available. It can take up to three additional **u64** * arguments (as an eBPF helpers, the total number of arguments is * limited to five). * * Each time the helper is called, it appends a line to the trace. * Lines are discarded while *\/sys/kernel/debug/tracing/trace* is * open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this. * The format of the trace is customizable, and the exact output * one will get depends on the options set in * *\/sys/kernel/debug/tracing/trace_options* (see also the * *README* file under the same directory). However, it usually * defaults to something like: * * :: * * telnet-470 [001] .N.. 419421.045894: 0x00000001: <formatted msg> * * In the above: * * * ``telnet`` is the name of the current task. * * ``470`` is the PID of the current task. * * ``001`` is the CPU number on which the task is * running. * * In ``.N..``, each character refers to a set of * options (whether irqs are enabled, scheduling * options, whether hard/softirqs are running, level of * preempt_disabled respectively). **N** means that * **TIF_NEED_RESCHED** and **PREEMPT_NEED_RESCHED** * are set. * * ``419421.045894`` is a timestamp. * * ``0x00000001`` is a fake value used by BPF for the * instruction pointer register. * * ``<formatted msg>`` is the message formatted with * *fmt*. * * The conversion specifiers supported by *fmt* are similar, but * more limited than for printk(). They are **%d**, **%i**, * **%u**, **%x**, **%ld**, **%li**, **%lu**, **%lx**, **%lld**, * **%lli**, **%llu**, **%llx**, **%p**, **%s**. No modifier (size * of field, padding with zeroes, etc.) is available, and the * helper will return **-EINVAL** (but print nothing) if it * encounters an unknown specifier. * * Also, note that **bpf_trace_printk**\ () is slow, and should * only be used for debugging purposes. For this reason, a notice * block (spanning several lines) is printed to kernel logs and * states that the helper should not be used "for production use" * the first time this helper is used (or more precisely, when * **trace_printk**\ () buffers are allocated). For passing values * to user space, perf events should be preferred. * Return * The number of bytes written to the buffer, or a negative error * in case of failure. * * u32 bpf_get_prandom_u32(void) * Description * Get a pseudo-random number. * * From a security point of view, this helper uses its own * pseudo-random internal state, and cannot be used to infer the * seed of other random functions in the kernel. However, it is * essential to note that the generator used by the helper is not * cryptographically secure. * Return * A random 32-bit unsigned value. * * u32 bpf_get_smp_processor_id(void) * Description * Get the SMP (symmetric multiprocessing) processor id. Note that * all programs run with preemption disabled, which means that the * SMP processor id is stable during all the execution of the * program. * Return * The SMP id of the processor running the program. * * long bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags) * Description * Store *len* bytes from address *from* into the packet * associated to *skb*, at *offset*. *flags* are a combination of * **BPF_F_RECOMPUTE_CSUM** (automatically recompute the * checksum for the packet after storing the bytes) and * **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\ * **->swhash** and *skb*\ **->l4hash** to 0). * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_l3_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 size) * Description * Recompute the layer 3 (e.g. IP) checksum for the packet * associated to *skb*. Computation is incremental, so the helper * must know the former value of the header field that was * modified (*from*), the new value of this field (*to*), and the * number of bytes (2 or 4) for this field, stored in *size*. * Alternatively, it is possible to store the difference between * the previous and the new values of the header field in *to*, by * setting *from* and *size* to 0. For both methods, *offset* * indicates the location of the IP checksum within the packet. * * This helper works in combination with **bpf_csum_diff**\ (), * which does not update the checksum in-place, but offers more * flexibility and can handle sizes larger than 2 or 4 for the * checksum to update. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_l4_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 flags) * Description * Recompute the layer 4 (e.g. TCP, UDP or ICMP) checksum for the * packet associated to *skb*. Computation is incremental, so the * helper must know the former value of the header field that was * modified (*from*), the new value of this field (*to*), and the * number of bytes (2 or 4) for this field, stored on the lowest * four bits of *flags*. Alternatively, it is possible to store * the difference between the previous and the new values of the * header field in *to*, by setting *from* and the four lowest * bits of *flags* to 0. For both methods, *offset* indicates the * location of the IP checksum within the packet. In addition to * the size of the field, *flags* can be added (bitwise OR) actual * flags. With **BPF_F_MARK_MANGLED_0**, a null checksum is left * untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and * for updates resulting in a null checksum the value is set to * **CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates * the checksum is to be computed against a pseudo-header. * * This helper works in combination with **bpf_csum_diff**\ (), * which does not update the checksum in-place, but offers more * flexibility and can handle sizes larger than 2 or 4 for the * checksum to update. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_tail_call(void *ctx, struct bpf_map *prog_array_map, u32 index) * Description * This special helper is used to trigger a "tail call", or in * other words, to jump into another eBPF program. The same stack * frame is used (but values on stack and in registers for the * caller are not accessible to the callee). This mechanism allows * for program chaining, either for raising the maximum number of * available eBPF instructions, or to execute given programs in * conditional blocks. For security reasons, there is an upper * limit to the number of successive tail calls that can be * performed. * * Upon call of this helper, the program attempts to jump into a * program referenced at index *index* in *prog_array_map*, a * special map of type **BPF_MAP_TYPE_PROG_ARRAY**, and passes * *ctx*, a pointer to the context. * * If the call succeeds, the kernel immediately runs the first * instruction of the new program. This is not a function call, * and it never returns to the previous program. If the call * fails, then the helper has no effect, and the caller continues * to run its subsequent instructions. A call can fail if the * destination program for the jump does not exist (i.e. *index* * is superior to the number of entries in *prog_array_map*), or * if the maximum number of tail calls has been reached for this * chain of programs. This limit is defined in the kernel by the * macro **MAX_TAIL_CALL_CNT** (not accessible to user space), * which is currently set to 32. * Return * 0 on success, or a negative error in case of failure. * * long bpf_clone_redirect(struct sk_buff *skb, u32 ifindex, u64 flags) * Description * Clone and redirect the packet associated to *skb* to another * net device of index *ifindex*. Both ingress and egress * interfaces can be used for redirection. The **BPF_F_INGRESS** * value in *flags* is used to make the distinction (ingress path * is selected if the flag is present, egress path otherwise). * This is the only flag supported for now. * * In comparison with **bpf_redirect**\ () helper, * **bpf_clone_redirect**\ () has the associated cost of * duplicating the packet buffer, but this can be executed out of * the eBPF program. Conversely, **bpf_redirect**\ () is more * efficient, but it is handled through an action code where the * redirection happens only after the eBPF program has returned. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. Positive * error indicates a potential drop or congestion in the target * device. The particular positive error codes are not defined. * * u64 bpf_get_current_pid_tgid(void) * Return * A 64-bit integer containing the current tgid and pid, and * created as such: * *current_task*\ **->tgid << 32 \|** * *current_task*\ **->pid**. * * u64 bpf_get_current_uid_gid(void) * Return * A 64-bit integer containing the current GID and UID, and * created as such: *current_gid* **<< 32 \|** *current_uid*. * * long bpf_get_current_comm(void *buf, u32 size_of_buf) * Description * Copy the **comm** attribute of the current task into *buf* of * *size_of_buf*. The **comm** attribute contains the name of * the executable (excluding the path) for the current task. The * *size_of_buf* must be strictly positive. On success, the * helper makes sure that the *buf* is NUL-terminated. On failure, * it is filled with zeroes. * Return * 0 on success, or a negative error in case of failure. * * u32 bpf_get_cgroup_classid(struct sk_buff *skb) * Description * Retrieve the classid for the current task, i.e. for the net_cls * cgroup to which *skb* belongs. * * This helper can be used on TC egress path, but not on ingress. * * The net_cls cgroup provides an interface to tag network packets * based on a user-provided identifier for all traffic coming from * the tasks belonging to the related cgroup. See also the related * kernel documentation, available from the Linux sources in file * *Documentation/cgroup-v1/net_cls.txt*. * * The Linux kernel has two versions for cgroups: there are * cgroups v1 and cgroups v2. Both are available to users, who can * use a mixture of them, but note that the net_cls cgroup is for * cgroup v1 only. This makes it incompatible with BPF programs * run on cgroups, which is a cgroup-v2-only feature (a socket can * only hold data for one version of cgroups at a time). * * This helper is only available is the kernel was compiled with * the **CONFIG_CGROUP_NET_CLASSID** configuration option set to * "**y**" or to "**m**". * Return * The classid, or 0 for the default unconfigured classid. * * long bpf_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci) * Description * Push a *vlan_tci* (VLAN tag control information) of protocol * *vlan_proto* to the packet associated to *skb*, then update * the checksum. Note that if *vlan_proto* is different from * **ETH_P_8021Q** and **ETH_P_8021AD**, it is considered to * be **ETH_P_8021Q**. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_vlan_pop(struct sk_buff *skb) * Description * Pop a VLAN header from the packet associated to *skb*. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_get_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags) * Description * Get tunnel metadata. This helper takes a pointer *key* to an * empty **struct bpf_tunnel_key** of **size**, that will be * filled with tunnel metadata for the packet associated to *skb*. * The *flags* can be set to **BPF_F_TUNINFO_IPV6**, which * indicates that the tunnel is based on IPv6 protocol instead of * IPv4. * * The **struct bpf_tunnel_key** is an object that generalizes the * principal parameters used by various tunneling protocols into a * single struct. This way, it can be used to easily make a * decision based on the contents of the encapsulation header, * "summarized" in this struct. In particular, it holds the IP * address of the remote end (IPv4 or IPv6, depending on the case) * in *key*\ **->remote_ipv4** or *key*\ **->remote_ipv6**. Also, * this struct exposes the *key*\ **->tunnel_id**, which is * generally mapped to a VNI (Virtual Network Identifier), making * it programmable together with the **bpf_skb_set_tunnel_key**\ * () helper. * * Let's imagine that the following code is part of a program * attached to the TC ingress interface, on one end of a GRE * tunnel, and is supposed to filter out all messages coming from * remote ends with IPv4 address other than 10.0.0.1: * * :: * * int ret; * struct bpf_tunnel_key key = {}; * * ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); * if (ret < 0) * return TC_ACT_SHOT; // drop packet * * if (key.remote_ipv4 != 0x0a000001) * return TC_ACT_SHOT; // drop packet * * return TC_ACT_OK; // accept packet * * This interface can also be used with all encapsulation devices * that can operate in "collect metadata" mode: instead of having * one network device per specific configuration, the "collect * metadata" mode only requires a single device where the * configuration can be extracted from this helper. * * This can be used together with various tunnels such as VXLan, * Geneve, GRE or IP in IP (IPIP). * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_set_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags) * Description * Populate tunnel metadata for packet associated to *skb.* The * tunnel metadata is set to the contents of *key*, of *size*. The * *flags* can be set to a combination of the following values: * * **BPF_F_TUNINFO_IPV6** * Indicate that the tunnel is based on IPv6 protocol * instead of IPv4. * **BPF_F_ZERO_CSUM_TX** * For IPv4 packets, add a flag to tunnel metadata * indicating that checksum computation should be skipped * and checksum set to zeroes. * **BPF_F_DONT_FRAGMENT** * Add a flag to tunnel metadata indicating that the * packet should not be fragmented. * **BPF_F_SEQ_NUMBER** * Add a flag to tunnel metadata indicating that a * sequence number should be added to tunnel header before * sending the packet. This flag was added for GRE * encapsulation, but might be used with other protocols * as well in the future. * * Here is a typical usage on the transmit path: * * :: * * struct bpf_tunnel_key key; * populate key ... * bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0); * bpf_clone_redirect(skb, vxlan_dev_ifindex, 0); * * See also the description of the **bpf_skb_get_tunnel_key**\ () * helper for additional information. * Return * 0 on success, or a negative error in case of failure. * * u64 bpf_perf_event_read(struct bpf_map *map, u64 flags) * Description * Read the value of a perf event counter. This helper relies on a * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of * the perf event counter is selected when *map* is updated with * perf event file descriptors. The *map* is an array whose size * is the number of available CPUs, and each cell contains a value * relative to one CPU. The value to retrieve is indicated by * *flags*, that contains the index of the CPU to look up, masked * with **BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to * **BPF_F_CURRENT_CPU** to indicate that the value for the * current CPU should be retrieved. * * Note that before Linux 4.13, only hardware perf event can be * retrieved. * * Also, be aware that the newer helper * **bpf_perf_event_read_value**\ () is recommended over * **bpf_perf_event_read**\ () in general. The latter has some ABI * quirks where error and counter value are used as a return code * (which is wrong to do since ranges may overlap). This issue is * fixed with **bpf_perf_event_read_value**\ (), which at the same * time provides more features over the **bpf_perf_event_read**\ * () interface. Please refer to the description of * **bpf_perf_event_read_value**\ () for details. * Return * The value of the perf event counter read from the map, or a * negative error code in case of failure. * * long bpf_redirect(u32 ifindex, u64 flags) * Description * Redirect the packet to another net device of index *ifindex*. * This helper is somewhat similar to **bpf_clone_redirect**\ * (), except that the packet is not cloned, which provides * increased performance. * * Except for XDP, both ingress and egress interfaces can be used * for redirection. The **BPF_F_INGRESS** value in *flags* is used * to make the distinction (ingress path is selected if the flag * is present, egress path otherwise). Currently, XDP only * supports redirection to the egress interface, and accepts no * flag at all. * * The same effect can also be attained with the more generic * **bpf_redirect_map**\ (), which uses a BPF map to store the * redirect target instead of providing it directly to the helper. * Return * For XDP, the helper returns **XDP_REDIRECT** on success or * **XDP_ABORTED** on error. For other program types, the values * are **TC_ACT_REDIRECT** on success or **TC_ACT_SHOT** on * error. * * u32 bpf_get_route_realm(struct sk_buff *skb) * Description * Retrieve the realm or the route, that is to say the * **tclassid** field of the destination for the *skb*. The * identifier retrieved is a user-provided tag, similar to the * one used with the net_cls cgroup (see description for * **bpf_get_cgroup_classid**\ () helper), but here this tag is * held by a route (a destination entry), not by a task. * * Retrieving this identifier works with the clsact TC egress hook * (see also **tc-bpf(8)**), or alternatively on conventional * classful egress qdiscs, but not on TC ingress path. In case of * clsact TC egress hook, this has the advantage that, internally, * the destination entry has not been dropped yet in the transmit * path. Therefore, the destination entry does not need to be * artificially held via **netif_keep_dst**\ () for a classful * qdisc until the *skb* is freed. * * This helper is available only if the kernel was compiled with * **CONFIG_IP_ROUTE_CLASSID** configuration option. * Return * The realm of the route for the packet associated to *skb*, or 0 * if none was found. * * long bpf_perf_event_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size) * Description * Write raw *data* blob into a special BPF perf event held by * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf * event must have the following attributes: **PERF_SAMPLE_RAW** * as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and * **PERF_COUNT_SW_BPF_OUTPUT** as **config**. * * The *flags* are used to indicate the index in *map* for which * the value must be put, masked with **BPF_F_INDEX_MASK**. * Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU** * to indicate that the index of the current CPU core should be * used. * * The value to write, of *size*, is passed through eBPF stack and * pointed by *data*. * * The context of the program *ctx* needs also be passed to the * helper. * * On user space, a program willing to read the values needs to * call **perf_event_open**\ () on the perf event (either for * one or for all CPUs) and to store the file descriptor into the * *map*. This must be done before the eBPF program can send data * into it. An example is available in file * *samples/bpf/trace_output_user.c* in the Linux kernel source * tree (the eBPF program counterpart is in * *samples/bpf/trace_output_kern.c*). * * **bpf_perf_event_output**\ () achieves better performance * than **bpf_trace_printk**\ () for sharing data with user * space, and is much better suitable for streaming data from eBPF * programs. * * Note that this helper is not restricted to tracing use cases * and can be used with programs attached to TC or XDP as well, * where it allows for passing data to user space listeners. Data * can be: * * * Only custom structs, * * Only the packet payload, or * * A combination of both. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_load_bytes(const void *skb, u32 offset, void *to, u32 len) * Description * This helper was provided as an easy way to load data from a * packet. It can be used to load *len* bytes from *offset* from * the packet associated to *skb*, into the buffer pointed by * *to*. * * Since Linux 4.7, usage of this helper has mostly been replaced * by "direct packet access", enabling packet data to be * manipulated with *skb*\ **->data** and *skb*\ **->data_end** * pointing respectively to the first byte of packet data and to * the byte after the last byte of packet data. However, it * remains useful if one wishes to read large quantities of data * at once from a packet into the eBPF stack. * Return * 0 on success, or a negative error in case of failure. * * long bpf_get_stackid(void *ctx, struct bpf_map *map, u64 flags) * Description * Walk a user or a kernel stack and return its id. To achieve * this, the helper needs *ctx*, which is a pointer to the context * on which the tracing program is executed, and a pointer to a * *map* of type **BPF_MAP_TYPE_STACK_TRACE**. * * The last argument, *flags*, holds the number of stack frames to * skip (from 0 to 255), masked with * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set * a combination of the following flags: * * **BPF_F_USER_STACK** * Collect a user space stack instead of a kernel stack. * **BPF_F_FAST_STACK_CMP** * Compare stacks by hash only. * **BPF_F_REUSE_STACKID** * If two different stacks hash into the same *stackid*, * discard the old one. * * The stack id retrieved is a 32 bit long integer handle which * can be further combined with other data (including other stack * ids) and used as a key into maps. This can be useful for * generating a variety of graphs (such as flame graphs or off-cpu * graphs). * * For walking a stack, this helper is an improvement over * **bpf_probe_read**\ (), which can be used with unrolled loops * but is not efficient and consumes a lot of eBPF instructions. * Instead, **bpf_get_stackid**\ () can collect up to * **PERF_MAX_STACK_DEPTH** both kernel and user frames. Note that * this limit can be controlled with the **sysctl** program, and * that it should be manually increased in order to profile long * user stacks (such as stacks for Java programs). To do so, use: * * :: * * # sysctl kernel.perf_event_max_stack=<new value> * Return * The positive or null stack id on success, or a negative error * in case of failure. * * s64 bpf_csum_diff(__be32 *from, u32 from_size, __be32 *to, u32 to_size, __wsum seed) * Description * Compute a checksum difference, from the raw buffer pointed by * *from*, of length *from_size* (that must be a multiple of 4), * towards the raw buffer pointed by *to*, of size *to_size* * (same remark). An optional *seed* can be added to the value * (this can be cascaded, the seed may come from a previous call * to the helper). * * This is flexible enough to be used in several ways: * * * With *from_size* == 0, *to_size* > 0 and *seed* set to * checksum, it can be used when pushing new data. * * With *from_size* > 0, *to_size* == 0 and *seed* set to * checksum, it can be used when removing data from a packet. * * With *from_size* > 0, *to_size* > 0 and *seed* set to 0, it * can be used to compute a diff. Note that *from_size* and * *to_size* do not need to be equal. * * This helper can be used in combination with * **bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\ (), to * which one can feed in the difference computed with * **bpf_csum_diff**\ (). * Return * The checksum result, or a negative error code in case of * failure. * * long bpf_skb_get_tunnel_opt(struct sk_buff *skb, void *opt, u32 size) * Description * Retrieve tunnel options metadata for the packet associated to * *skb*, and store the raw tunnel option data to the buffer *opt* * of *size*. * * This helper can be used with encapsulation devices that can * operate in "collect metadata" mode (please refer to the related * note in the description of **bpf_skb_get_tunnel_key**\ () for * more details). A particular example where this can be used is * in combination with the Geneve encapsulation protocol, where it * allows for pushing (with **bpf_skb_get_tunnel_opt**\ () helper) * and retrieving arbitrary TLVs (Type-Length-Value headers) from * the eBPF program. This allows for full customization of these * headers. * Return * The size of the option data retrieved. * * long bpf_skb_set_tunnel_opt(struct sk_buff *skb, void *opt, u32 size) * Description * Set tunnel options metadata for the packet associated to *skb* * to the option data contained in the raw buffer *opt* of *size*. * * See also the description of the **bpf_skb_get_tunnel_opt**\ () * helper for additional information. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_change_proto(struct sk_buff *skb, __be16 proto, u64 flags) * Description * Change the protocol of the *skb* to *proto*. Currently * supported are transition from IPv4 to IPv6, and from IPv6 to * IPv4. The helper takes care of the groundwork for the * transition, including resizing the socket buffer. The eBPF * program is expected to fill the new headers, if any, via * **skb_store_bytes**\ () and to recompute the checksums with * **bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\ * (). The main case for this helper is to perform NAT64 * operations out of an eBPF program. * * Internally, the GSO type is marked as dodgy so that headers are * checked and segments are recalculated by the GSO/GRO engine. * The size for GSO target is adapted as well. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_change_type(struct sk_buff *skb, u32 type) * Description * Change the packet type for the packet associated to *skb*. This * comes down to setting *skb*\ **->pkt_type** to *type*, except * the eBPF program does not have a write access to *skb*\ * **->pkt_type** beside this helper. Using a helper here allows * for graceful handling of errors. * * The major use case is to change incoming *skb*s to * **PACKET_HOST** in a programmatic way instead of having to * recirculate via **redirect**\ (..., **BPF_F_INGRESS**), for * example. * * Note that *type* only allows certain values. At this time, they * are: * * **PACKET_HOST** * Packet is for us. * **PACKET_BROADCAST** * Send packet to all. * **PACKET_MULTICAST** * Send packet to group. * **PACKET_OTHERHOST** * Send packet to someone else. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_under_cgroup(struct sk_buff *skb, struct bpf_map *map, u32 index) * Description * Check whether *skb* is a descendant of the cgroup2 held by * *map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*. * Return * The return value depends on the result of the test, and can be: * * * 0, if the *skb* failed the cgroup2 descendant test. * * 1, if the *skb* succeeded the cgroup2 descendant test. * * A negative error code, if an error occurred. * * u32 bpf_get_hash_recalc(struct sk_buff *skb) * Description * Retrieve the hash of the packet, *skb*\ **->hash**. If it is * not set, in particular if the hash was cleared due to mangling, * recompute this hash. Later accesses to the hash can be done * directly with *skb*\ **->hash**. * * Calling **bpf_set_hash_invalid**\ (), changing a packet * prototype with **bpf_skb_change_proto**\ (), or calling * **bpf_skb_store_bytes**\ () with the * **BPF_F_INVALIDATE_HASH** are actions susceptible to clear * the hash and to trigger a new computation for the next call to * **bpf_get_hash_recalc**\ (). * Return * The 32-bit hash. * * u64 bpf_get_current_task(void) * Return * A pointer to the current task struct. * * long bpf_probe_write_user(void *dst, const void *src, u32 len) * Description * Attempt in a safe way to write *len* bytes from the buffer * *src* to *dst* in memory. It only works for threads that are in * user context, and *dst* must be a valid user space address. * * This helper should not be used to implement any kind of * security mechanism because of TOC-TOU attacks, but rather to * debug, divert, and manipulate execution of semi-cooperative * processes. * * Keep in mind that this feature is meant for experiments, and it * has a risk of crashing the system and running programs. * Therefore, when an eBPF program using this helper is attached, * a warning including PID and process name is printed to kernel * logs. * Return * 0 on success, or a negative error in case of failure. * * long bpf_current_task_under_cgroup(struct bpf_map *map, u32 index) * Description * Check whether the probe is being run is the context of a given * subset of the cgroup2 hierarchy. The cgroup2 to test is held by * *map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*. * Return * The return value depends on the result of the test, and can be: * * * 0, if current task belongs to the cgroup2. * * 1, if current task does not belong to the cgroup2. * * A negative error code, if an error occurred. * * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) * Description * Resize (trim or grow) the packet associated to *skb* to the * new *len*. The *flags* are reserved for future usage, and must * be left at zero. * * The basic idea is that the helper performs the needed work to * change the size of the packet, then the eBPF program rewrites * the rest via helpers like **bpf_skb_store_bytes**\ (), * **bpf_l3_csum_replace**\ (), **bpf_l3_csum_replace**\ () * and others. This helper is a slow path utility intended for * replies with control messages. And because it is targeted for * slow path, the helper itself can afford to be slow: it * implicitly linearizes, unclones and drops offloads from the * *skb*. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_pull_data(struct sk_buff *skb, u32 len) * Description * Pull in non-linear data in case the *skb* is non-linear and not * all of *len* are part of the linear section. Make *len* bytes * from *skb* readable and writable. If a zero value is passed for * *len*, then the whole length of the *skb* is pulled. * * This helper is only needed for reading and writing with direct * packet access. * * For direct packet access, testing that offsets to access * are within packet boundaries (test on *skb*\ **->data_end**) is * susceptible to fail if offsets are invalid, or if the requested * data is in non-linear parts of the *skb*. On failure the * program can just bail out, or in the case of a non-linear * buffer, use a helper to make the data available. The * **bpf_skb_load_bytes**\ () helper is a first solution to access * the data. Another one consists in using **bpf_skb_pull_data** * to pull in once the non-linear parts, then retesting and * eventually access the data. * * At the same time, this also makes sure the *skb* is uncloned, * which is a necessary condition for direct write. As this needs * to be an invariant for the write part only, the verifier * detects writes and adds a prologue that is calling * **bpf_skb_pull_data()** to effectively unclone the *skb* from * the very beginning in case it is indeed cloned. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * s64 bpf_csum_update(struct sk_buff *skb, __wsum csum) * Description * Add the checksum *csum* into *skb*\ **->csum** in case the * driver has supplied a checksum for the entire packet into that * field. Return an error otherwise. This helper is intended to be * used in combination with **bpf_csum_diff**\ (), in particular * when the checksum needs to be updated after data has been * written into the packet through direct packet access. * Return * The checksum on success, or a negative error code in case of * failure. * * void bpf_set_hash_invalid(struct sk_buff *skb) * Description * Invalidate the current *skb*\ **->hash**. It can be used after * mangling on headers through direct packet access, in order to * indicate that the hash is outdated and to trigger a * recalculation the next time the kernel tries to access this * hash or when the **bpf_get_hash_recalc**\ () helper is called. * * long bpf_get_numa_node_id(void) * Description * Return the id of the current NUMA node. The primary use case * for this helper is the selection of sockets for the local NUMA * node, when the program is attached to sockets using the * **SO_ATTACH_REUSEPORT_EBPF** option (see also **socket(7)**), * but the helper is also available to other eBPF program types, * similarly to **bpf_get_smp_processor_id**\ (). * Return * The id of current NUMA node. * * long bpf_skb_change_head(struct sk_buff *skb, u32 len, u64 flags) * Description * Grows headroom of packet associated to *skb* and adjusts the * offset of the MAC header accordingly, adding *len* bytes of * space. It automatically extends and reallocates memory as * required. * * This helper can be used on a layer 3 *skb* to push a MAC header * for redirection into a layer 2 device. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta) * Description * Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that * it is possible to use a negative value for *delta*. This helper * can be used to prepare the packet for pushing or popping * headers. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_probe_read_str(void *dst, u32 size, const void *unsafe_ptr) * Description * Copy a NUL terminated string from an unsafe kernel address * *unsafe_ptr* to *dst*. See **bpf_probe_read_kernel_str**\ () for * more details. * * Generally, use **bpf_probe_read_user_str**\ () or * **bpf_probe_read_kernel_str**\ () instead. * Return * On success, the strictly positive length of the string, * including the trailing NUL character. On error, a negative * value. * * u64 bpf_get_socket_cookie(struct sk_buff *skb) * Description * If the **struct sk_buff** pointed by *skb* has a known socket, * retrieve the cookie (generated by the kernel) of this socket. * If no cookie has been set yet, generate a new cookie. Once * generated, the socket cookie remains stable for the life of the * socket. This helper can be useful for monitoring per socket * networking traffic statistics as it provides a global socket * identifier that can be assumed unique. * Return * A 8-byte long unique number on success, or 0 if the socket * field is missing inside *skb*. * * u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx) * Description * Equivalent to bpf_get_socket_cookie() helper that accepts * *skb*, but gets socket from **struct bpf_sock_addr** context. * Return * A 8-byte long unique number. * * u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx) * Description * Equivalent to **bpf_get_socket_cookie**\ () helper that accepts * *skb*, but gets socket from **struct bpf_sock_ops** context. * Return * A 8-byte long unique number. * * u64 bpf_get_socket_cookie(struct sock *sk) * Description * Equivalent to **bpf_get_socket_cookie**\ () helper that accepts * *sk*, but gets socket from a BTF **struct sock**. This helper * also works for sleepable programs. * Return * A 8-byte long unique number or 0 if *sk* is NULL. * * u32 bpf_get_socket_uid(struct sk_buff *skb) * Return * The owner UID of the socket associated to *skb*. If the socket * is **NULL**, or if it is not a full socket (i.e. if it is a * time-wait or a request socket instead), **overflowuid** value * is returned (note that **overflowuid** might also be the actual * UID value for the socket). * * long bpf_set_hash(struct sk_buff *skb, u32 hash) * Description * Set the full hash for *skb* (set the field *skb*\ **->hash**) * to value *hash*. * Return * 0 * * long bpf_setsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen) * Description * Emulate a call to **setsockopt()** on the socket associated to * *bpf_socket*, which must be a full socket. The *level* at * which the option resides and the name *optname* of the option * must be specified, see **setsockopt(2)** for more information. * The option value of length *optlen* is pointed by *optval*. * * *bpf_socket* should be one of the following: * * * **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**. * * **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT** * and **BPF_CGROUP_INET6_CONNECT**. * * This helper actually implements a subset of **setsockopt()**. * It supports the following *level*\ s: * * * **SOL_SOCKET**, which supports the following *optname*\ s: * **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**, * **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**, * **SO_BINDTODEVICE**, **SO_KEEPALIVE**. * * **IPPROTO_TCP**, which supports the following *optname*\ s: * **TCP_CONGESTION**, **TCP_BPF_IW**, * **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**, * **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**, * **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**. * * **IPPROTO_IP**, which supports *optname* **IP_TOS**. * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_adjust_room(struct sk_buff *skb, s32 len_diff, u32 mode, u64 flags) * Description * Grow or shrink the room for data in the packet associated to * *skb* by *len_diff*, and according to the selected *mode*. * * By default, the helper will reset any offloaded checksum * indicator of the skb to CHECKSUM_NONE. This can be avoided * by the following flag: * * * **BPF_F_ADJ_ROOM_NO_CSUM_RESET**: Do not reset offloaded * checksum data of the skb to CHECKSUM_NONE. * * There are two supported modes at this time: * * * **BPF_ADJ_ROOM_MAC**: Adjust room at the mac layer * (room space is added or removed below the layer 2 header). * * * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer * (room space is added or removed below the layer 3 header). * * The following flags are supported at this time: * * * **BPF_F_ADJ_ROOM_FIXED_GSO**: Do not adjust gso_size. * Adjusting mss in this way is not allowed for datagrams. * * * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV4**, * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV6**: * Any new space is reserved to hold a tunnel header. * Configure skb offsets and other fields accordingly. * * * **BPF_F_ADJ_ROOM_ENCAP_L4_GRE**, * **BPF_F_ADJ_ROOM_ENCAP_L4_UDP**: * Use with ENCAP_L3 flags to further specify the tunnel type. * * * **BPF_F_ADJ_ROOM_ENCAP_L2**\ (*len*): * Use with ENCAP_L3/L4 flags to further specify the tunnel * type; *len* is the length of the inner MAC header. * * * **BPF_F_ADJ_ROOM_ENCAP_L2_ETH**: * Use with BPF_F_ADJ_ROOM_ENCAP_L2 flag to further specify the * L2 type as Ethernet. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags) * Description * Redirect the packet to the endpoint referenced by *map* at * index *key*. Depending on its type, this *map* can contain * references to net devices (for forwarding packets through other * ports), or to CPUs (for redirecting XDP frames to another CPU; * but this is only implemented for native XDP (with driver * support) as of this writing). * * The lower two bits of *flags* are used as the return code if * the map lookup fails. This is so that the return value can be * one of the XDP program return codes up to **XDP_TX**, as chosen * by the caller. The higher bits of *flags* can be set to * BPF_F_BROADCAST or BPF_F_EXCLUDE_INGRESS as defined below. * * With BPF_F_BROADCAST the packet will be broadcasted to all the * interfaces in the map, with BPF_F_EXCLUDE_INGRESS the ingress * interface will be excluded when do broadcasting. * * See also **bpf_redirect**\ (), which only supports redirecting * to an ifindex, but doesn't require a map to do so. * Return * **XDP_REDIRECT** on success, or the value of the two lower bits * of the *flags* argument on error. * * long bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags) * Description * Redirect the packet to the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress path otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * long bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags) * Description * Add an entry to, or update a *map* referencing sockets. The * *skops* is used as a new value for the entry associated to * *key*. *flags* is one of: * * **BPF_NOEXIST** * The entry for *key* must not exist in the map. * **BPF_EXIST** * The entry for *key* must already exist in the map. * **BPF_ANY** * No condition on the existence of the entry for *key*. * * If the *map* has eBPF programs (parser and verdict), those will * be inherited by the socket being added. If the socket is * already attached to eBPF programs, this results in an error. * Return * 0 on success, or a negative error in case of failure. * * long bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta) * Description * Adjust the address pointed by *xdp_md*\ **->data_meta** by * *delta* (which can be positive or negative). Note that this * operation modifies the address stored in *xdp_md*\ **->data**, * so the latter must be loaded only after the helper has been * called. * * The use of *xdp_md*\ **->data_meta** is optional and programs * are not required to use it. The rationale is that when the * packet is processed with XDP (e.g. as DoS filter), it is * possible to push further meta data along with it before passing * to the stack, and to give the guarantee that an ingress eBPF * program attached as a TC classifier on the same device can pick * this up for further post-processing. Since TC works with socket * buffers, it remains possible to set from XDP the **mark** or * **priority** pointers, or other pointers for the socket buffer. * Having this scratch space generic and programmable allows for * more flexibility as the user is free to store whatever meta * data they need. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_perf_event_read_value(struct bpf_map *map, u64 flags, struct bpf_perf_event_value *buf, u32 buf_size) * Description * Read the value of a perf event counter, and store it into *buf* * of size *buf_size*. This helper relies on a *map* of type * **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of the perf event * counter is selected when *map* is updated with perf event file * descriptors. The *map* is an array whose size is the number of * available CPUs, and each cell contains a value relative to one * CPU. The value to retrieve is indicated by *flags*, that * contains the index of the CPU to look up, masked with * **BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to * **BPF_F_CURRENT_CPU** to indicate that the value for the * current CPU should be retrieved. * * This helper behaves in a way close to * **bpf_perf_event_read**\ () helper, save that instead of * just returning the value observed, it fills the *buf* * structure. This allows for additional data to be retrieved: in * particular, the enabled and running times (in *buf*\ * **->enabled** and *buf*\ **->running**, respectively) are * copied. In general, **bpf_perf_event_read_value**\ () is * recommended over **bpf_perf_event_read**\ (), which has some * ABI issues and provides fewer functionalities. * * These values are interesting, because hardware PMU (Performance * Monitoring Unit) counters are limited resources. When there are * more PMU based perf events opened than available counters, * kernel will multiplex these events so each event gets certain * percentage (but not all) of the PMU time. In case that * multiplexing happens, the number of samples or counter value * will not reflect the case compared to when no multiplexing * occurs. This makes comparison between different runs difficult. * Typically, the counter value should be normalized before * comparing to other experiments. The usual normalization is done * as follows. * * :: * * normalized_counter = counter * t_enabled / t_running * * Where t_enabled is the time enabled for event and t_running is * the time running for event since last normalization. The * enabled and running times are accumulated since the perf event * open. To achieve scaling factor between two invocations of an * eBPF program, users can use CPU id as the key (which is * typical for perf array usage model) to remember the previous * value and do the calculation inside the eBPF program. * Return * 0 on success, or a negative error in case of failure. * * long bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size) * Description * For en eBPF program attached to a perf event, retrieve the * value of the event counter associated to *ctx* and store it in * the structure pointed by *buf* and of size *buf_size*. Enabled * and running times are also stored in the structure (see * description of helper **bpf_perf_event_read_value**\ () for * more details). * Return * 0 on success, or a negative error in case of failure. * * long bpf_getsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen) * Description * Emulate a call to **getsockopt()** on the socket associated to * *bpf_socket*, which must be a full socket. The *level* at * which the option resides and the name *optname* of the option * must be specified, see **getsockopt(2)** for more information. * The retrieved value is stored in the structure pointed by * *opval* and of length *optlen*. * * *bpf_socket* should be one of the following: * * * **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**. * * **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT** * and **BPF_CGROUP_INET6_CONNECT**. * * This helper actually implements a subset of **getsockopt()**. * It supports the following *level*\ s: * * * **IPPROTO_TCP**, which supports *optname* * **TCP_CONGESTION**. * * **IPPROTO_IP**, which supports *optname* **IP_TOS**. * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**. * Return * 0 on success, or a negative error in case of failure. * * long bpf_override_return(struct pt_regs *regs, u64 rc) * Description * Used for error injection, this helper uses kprobes to override * the return value of the probed function, and to set it to *rc*. * The first argument is the context *regs* on which the kprobe * works. * * This helper works by setting the PC (program counter) * to an override function which is run in place of the original * probed function. This means the probed function is not run at * all. The replacement function just returns with the required * value. * * This helper has security implications, and thus is subject to * restrictions. It is only available if the kernel was compiled * with the **CONFIG_BPF_KPROBE_OVERRIDE** configuration * option, and in this case it only works on functions tagged with * **ALLOW_ERROR_INJECTION** in the kernel code. * * Also, the helper is only available for the architectures having * the CONFIG_FUNCTION_ERROR_INJECTION option. As of this writing, * x86 architecture is the only one to support this feature. * Return * 0 * * long bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval) * Description * Attempt to set the value of the **bpf_sock_ops_cb_flags** field * for the full TCP socket associated to *bpf_sock_ops* to * *argval*. * * The primary use of this field is to determine if there should * be calls to eBPF programs of type * **BPF_PROG_TYPE_SOCK_OPS** at various points in the TCP * code. A program of the same type can change its value, per * connection and as necessary, when the connection is * established. This field is directly accessible for reading, but * this helper must be used for updates in order to return an * error if an eBPF program tries to set a callback that is not * supported in the current kernel. * * *argval* is a flag array which can combine these flags: * * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out) * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission) * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change) * * **BPF_SOCK_OPS_RTT_CB_FLAG** (every RTT) * * Therefore, this function can be used to clear a callback flag by * setting the appropriate bit to zero. e.g. to disable the RTO * callback: * * **bpf_sock_ops_cb_flags_set(bpf_sock,** * **bpf_sock->bpf_sock_ops_cb_flags & ~BPF_SOCK_OPS_RTO_CB_FLAG)** * * Here are some examples of where one could call such eBPF * program: * * * When RTO fires. * * When a packet is retransmitted. * * When the connection terminates. * * When a packet is sent. * * When a packet is received. * Return * Code **-EINVAL** if the socket is not a full TCP socket; * otherwise, a positive number containing the bits that could not * be set is returned (which comes down to 0 if all bits were set * as required). * * long bpf_msg_redirect_map(struct sk_msg_buff *msg, struct bpf_map *map, u32 key, u64 flags) * Description * This helper is used in programs implementing policies at the * socket level. If the message *msg* is allowed to pass (i.e. if * the verdict eBPF program returns **SK_PASS**), redirect it to * the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress path otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * long bpf_msg_apply_bytes(struct sk_msg_buff *msg, u32 bytes) * Description * For socket policies, apply the verdict of the eBPF program to * the next *bytes* (number of bytes) of message *msg*. * * For example, this helper can be used in the following cases: * * * A single **sendmsg**\ () or **sendfile**\ () system call * contains multiple logical messages that the eBPF program is * supposed to read and for which it should apply a verdict. * * An eBPF program only cares to read the first *bytes* of a * *msg*. If the message has a large payload, then setting up * and calling the eBPF program repeatedly for all bytes, even * though the verdict is already known, would create unnecessary * overhead. * * When called from within an eBPF program, the helper sets a * counter internal to the BPF infrastructure, that is used to * apply the last verdict to the next *bytes*. If *bytes* is * smaller than the current data being processed from a * **sendmsg**\ () or **sendfile**\ () system call, the first * *bytes* will be sent and the eBPF program will be re-run with * the pointer for start of data pointing to byte number *bytes* * **+ 1**. If *bytes* is larger than the current data being * processed, then the eBPF verdict will be applied to multiple * **sendmsg**\ () or **sendfile**\ () calls until *bytes* are * consumed. * * Note that if a socket closes with the internal counter holding * a non-zero value, this is not a problem because data is not * being buffered for *bytes* and is sent as it is received. * Return * 0 * * long bpf_msg_cork_bytes(struct sk_msg_buff *msg, u32 bytes) * Description * For socket policies, prevent the execution of the verdict eBPF * program for message *msg* until *bytes* (byte number) have been * accumulated. * * This can be used when one needs a specific number of bytes * before a verdict can be assigned, even if the data spans * multiple **sendmsg**\ () or **sendfile**\ () calls. The extreme * case would be a user calling **sendmsg**\ () repeatedly with * 1-byte long message segments. Obviously, this is bad for * performance, but it is still valid. If the eBPF program needs * *bytes* bytes to validate a header, this helper can be used to * prevent the eBPF program to be called again until *bytes* have * been accumulated. * Return * 0 * * long bpf_msg_pull_data(struct sk_msg_buff *msg, u32 start, u32 end, u64 flags) * Description * For socket policies, pull in non-linear data from user space * for *msg* and set pointers *msg*\ **->data** and *msg*\ * **->data_end** to *start* and *end* bytes offsets into *msg*, * respectively. * * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a * *msg* it can only parse data that the (**data**, **data_end**) * pointers have already consumed. For **sendmsg**\ () hooks this * is likely the first scatterlist element. But for calls relying * on the **sendpage** handler (e.g. **sendfile**\ ()) this will * be the range (**0**, **0**) because the data is shared with * user space and by default the objective is to avoid allowing * user space to modify data while (or after) eBPF verdict is * being decided. This helper can be used to pull in data and to * set the start and end pointer to given values. Data will be * copied if necessary (i.e. if data was not linear and if start * and end pointers do not point to the same chunk). * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * * All values for *flags* are reserved for future usage, and must * be left at zero. * Return * 0 on success, or a negative error in case of failure. * * long bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len) * Description * Bind the socket associated to *ctx* to the address pointed by * *addr*, of length *addr_len*. This allows for making outgoing * connection from the desired IP address, which can be useful for * example when all processes inside a cgroup should use one * single IP address on a host that has multiple IP configured. * * This helper works for IPv4 and IPv6, TCP and UDP sockets. The * domain (*addr*\ **->sa_family**) must be **AF_INET** (or * **AF_INET6**). It's advised to pass zero port (**sin_port** * or **sin6_port**) which triggers IP_BIND_ADDRESS_NO_PORT-like * behavior and lets the kernel efficiently pick up an unused * port as long as 4-tuple is unique. Passing non-zero port might * lead to degraded performance. * Return * 0 on success, or a negative error in case of failure. * * long bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta) * Description * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is * possible to both shrink and grow the packet tail. * Shrink done via *delta* being a negative integer. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_skb_get_xfrm_state(struct sk_buff *skb, u32 index, struct bpf_xfrm_state *xfrm_state, u32 size, u64 flags) * Description * Retrieve the XFRM state (IP transform framework, see also * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*. * * The retrieved value is stored in the **struct bpf_xfrm_state** * pointed by *xfrm_state* and of length *size*. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * This helper is available only if the kernel was compiled with * **CONFIG_XFRM** configuration option. * Return * 0 on success, or a negative error in case of failure. * * long bpf_get_stack(void *ctx, void *buf, u32 size, u64 flags) * Description * Return a user or a kernel stack in bpf program provided buffer. * To achieve this, the helper needs *ctx*, which is a pointer * to the context on which the tracing program is executed. * To store the stacktrace, the bpf program provides *buf* with * a nonnegative *size*. * * The last argument, *flags*, holds the number of stack frames to * skip (from 0 to 255), masked with * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set * the following flags: * * **BPF_F_USER_STACK** * Collect a user space stack instead of a kernel stack. * **BPF_F_USER_BUILD_ID** * Collect buildid+offset instead of ips for user stack, * only valid if **BPF_F_USER_STACK** is also specified. * * **bpf_get_stack**\ () can collect up to * **PERF_MAX_STACK_DEPTH** both kernel and user frames, subject * to sufficient large buffer size. Note that * this limit can be controlled with the **sysctl** program, and * that it should be manually increased in order to profile long * user stacks (such as stacks for Java programs). To do so, use: * * :: * * # sysctl kernel.perf_event_max_stack=<new value> * Return * A non-negative value equal to or less than *size* on success, * or a negative error in case of failure. * * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header) * Description * This helper is similar to **bpf_skb_load_bytes**\ () in that * it provides an easy way to load *len* bytes from *offset* * from the packet associated to *skb*, into the buffer pointed * by *to*. The difference to **bpf_skb_load_bytes**\ () is that * a fifth argument *start_header* exists in order to select a * base offset to start from. *start_header* can be one of: * * **BPF_HDR_START_MAC** * Base offset to load data from is *skb*'s mac header. * **BPF_HDR_START_NET** * Base offset to load data from is *skb*'s network header. * * In general, "direct packet access" is the preferred method to * access packet data, however, this helper is in particular useful * in socket filters where *skb*\ **->data** does not always point * to the start of the mac header and where "direct packet access" * is not available. * Return * 0 on success, or a negative error in case of failure. * * long bpf_fib_lookup(void *ctx, struct bpf_fib_lookup *params, int plen, u32 flags) * Description * Do FIB lookup in kernel tables using parameters in *params*. * If lookup is successful and result shows packet is to be * forwarded, the neighbor tables are searched for the nexthop. * If successful (ie., FIB lookup shows forwarding and nexthop * is resolved), the nexthop address is returned in ipv4_dst * or ipv6_dst based on family, smac is set to mac address of * egress device, dmac is set to nexthop mac address, rt_metric * is set to metric from route (IPv4/IPv6 only), and ifindex * is set to the device index of the nexthop from the FIB lookup. * * *plen* argument is the size of the passed in struct. * *flags* argument can be a combination of one or more of the * following values: * * **BPF_FIB_LOOKUP_DIRECT** * Do a direct table lookup vs full lookup using FIB * rules. * **BPF_FIB_LOOKUP_OUTPUT** * Perform lookup from an egress perspective (default is * ingress). * * *ctx* is either **struct xdp_md** for XDP programs or * **struct sk_buff** tc cls_act programs. * Return * * < 0 if any input argument is invalid * * 0 on success (packet is forwarded, nexthop neighbor exists) * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the * packet is not forwarded or needs assist from full stack * * If lookup fails with BPF_FIB_LKUP_RET_FRAG_NEEDED, then the MTU * was exceeded and output params->mtu_result contains the MTU. * * long bpf_sock_hash_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags) * Description * Add an entry to, or update a sockhash *map* referencing sockets. * The *skops* is used as a new value for the entry associated to * *key*. *flags* is one of: * * **BPF_NOEXIST** * The entry for *key* must not exist in the map. * **BPF_EXIST** * The entry for *key* must already exist in the map. * **BPF_ANY** * No condition on the existence of the entry for *key*. * * If the *map* has eBPF programs (parser and verdict), those will * be inherited by the socket being added. If the socket is * already attached to eBPF programs, this results in an error. * Return * 0 on success, or a negative error in case of failure. * * long bpf_msg_redirect_hash(struct sk_msg_buff *msg, struct bpf_map *map, void *key, u64 flags) * Description * This helper is used in programs implementing policies at the * socket level. If the message *msg* is allowed to pass (i.e. if * the verdict eBPF program returns **SK_PASS**), redirect it to * the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress path otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * long bpf_sk_redirect_hash(struct sk_buff *skb, struct bpf_map *map, void *key, u64 flags) * Description * This helper is used in programs implementing policies at the * skb socket level. If the sk_buff *skb* is allowed to pass (i.e. * if the verdict eBPF program returns **SK_PASS**), redirect it * to the socket referenced by *map* (of type * **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and * egress interfaces can be used for redirection. The * **BPF_F_INGRESS** value in *flags* is used to make the * distinction (ingress path is selected if the flag is present, * egress otherwise). This is the only flag supported for now. * Return * **SK_PASS** on success, or **SK_DROP** on error. * * long bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len) * Description * Encapsulate the packet associated to *skb* within a Layer 3 * protocol header. This header is provided in the buffer at * address *hdr*, with *len* its size in bytes. *type* indicates * the protocol of the header and can be one of: * * **BPF_LWT_ENCAP_SEG6** * IPv6 encapsulation with Segment Routing Header * (**struct ipv6_sr_hdr**). *hdr* only contains the SRH, * the IPv6 header is computed by the kernel. * **BPF_LWT_ENCAP_SEG6_INLINE** * Only works if *skb* contains an IPv6 packet. Insert a * Segment Routing Header (**struct ipv6_sr_hdr**) inside * the IPv6 header. * **BPF_LWT_ENCAP_IP** * IP encapsulation (GRE/GUE/IPIP/etc). The outer header * must be IPv4 or IPv6, followed by zero or more * additional headers, up to **LWT_BPF_MAX_HEADROOM** * total bytes in all prepended headers. Please note that * if **skb_is_gso**\ (*skb*) is true, no more than two * headers can be prepended, and the inner header, if * present, should be either GRE or UDP/GUE. * * **BPF_LWT_ENCAP_SEG6**\ \* types can be called by BPF programs * of type **BPF_PROG_TYPE_LWT_IN**; **BPF_LWT_ENCAP_IP** type can * be called by bpf programs of types **BPF_PROG_TYPE_LWT_IN** and * **BPF_PROG_TYPE_LWT_XMIT**. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len) * Description * Store *len* bytes from address *from* into the packet * associated to *skb*, at *offset*. Only the flags, tag and TLVs * inside the outermost IPv6 Segment Routing Header can be * modified through this helper. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta) * Description * Adjust the size allocated to TLVs in the outermost IPv6 * Segment Routing Header contained in the packet associated to * *skb*, at position *offset* by *delta* bytes. Only offsets * after the segments are accepted. *delta* can be as well * positive (growing) as negative (shrinking). * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len) * Description * Apply an IPv6 Segment Routing action of type *action* to the * packet associated to *skb*. Each action takes a parameter * contained at address *param*, and of length *param_len* bytes. * *action* can be one of: * * **SEG6_LOCAL_ACTION_END_X** * End.X action: Endpoint with Layer-3 cross-connect. * Type of *param*: **struct in6_addr**. * **SEG6_LOCAL_ACTION_END_T** * End.T action: Endpoint with specific IPv6 table lookup. * Type of *param*: **int**. * **SEG6_LOCAL_ACTION_END_B6** * End.B6 action: Endpoint bound to an SRv6 policy. * Type of *param*: **struct ipv6_sr_hdr**. * **SEG6_LOCAL_ACTION_END_B6_ENCAP** * End.B6.Encap action: Endpoint bound to an SRv6 * encapsulation policy. * Type of *param*: **struct ipv6_sr_hdr**. * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be * performed again, if the helper is used in combination with * direct packet access. * Return * 0 on success, or a negative error in case of failure. * * long bpf_rc_repeat(void *ctx) * Description * This helper is used in programs implementing IR decoding, to * report a successfully decoded repeat key message. This delays * the generation of a key up event for previously generated * key down event. * * Some IR protocols like NEC have a special IR message for * repeating last button, for when a button is held down. * * The *ctx* should point to the lirc sample as passed into * the program. * * This helper is only available is the kernel was compiled with * the **CONFIG_BPF_LIRC_MODE2** configuration option set to * "**y**". * Return * 0 * * long bpf_rc_keydown(void *ctx, u32 protocol, u64 scancode, u32 toggle) * Description * This helper is used in programs implementing IR decoding, to * report a successfully decoded key press with *scancode*, * *toggle* value in the given *protocol*. The scancode will be * translated to a keycode using the rc keymap, and reported as * an input key down event. After a period a key up event is * generated. This period can be extended by calling either * **bpf_rc_keydown**\ () again with the same values, or calling * **bpf_rc_repeat**\ (). * * Some protocols include a toggle bit, in case the button was * released and pressed again between consecutive scancodes. * * The *ctx* should point to the lirc sample as passed into * the program. * * The *protocol* is the decoded protocol number (see * **enum rc_proto** for some predefined values). * * This helper is only available is the kernel was compiled with * the **CONFIG_BPF_LIRC_MODE2** configuration option set to * "**y**". * Return * 0 * * u64 bpf_skb_cgroup_id(struct sk_buff *skb) * Description * Return the cgroup v2 id of the socket associated with the *skb*. * This is roughly similar to the **bpf_get_cgroup_classid**\ () * helper for cgroup v1 by providing a tag resp. identifier that * can be matched on or used for map lookups e.g. to implement * policy. The cgroup v2 id of a given path in the hierarchy is * exposed in user space through the f_handle API in order to get * to the same 64-bit id. * * This helper can be used on TC egress path, but not on ingress, * and is available only if the kernel was compiled with the * **CONFIG_SOCK_CGROUP_DATA** configuration option. * Return * The id is returned or 0 in case the id could not be retrieved. * * u64 bpf_get_current_cgroup_id(void) * Return * A 64-bit integer containing the current cgroup id based * on the cgroup within which the current task is running. * * void *bpf_get_local_storage(void *map, u64 flags) * Description * Get the pointer to the local storage area. * The type and the size of the local storage is defined * by the *map* argument. * The *flags* meaning is specific for each map type, * and has to be 0 for cgroup local storage. * * Depending on the BPF program type, a local storage area * can be shared between multiple instances of the BPF program, * running simultaneously. * * A user should care about the synchronization by himself. * For example, by using the **BPF_ATOMIC** instructions to alter * the shared data. * Return * A pointer to the local storage area. * * long bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags) * Description * Select a **SO_REUSEPORT** socket from a * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*. * It checks the selected socket is matching the incoming * request in the socket buffer. * Return * 0 on success, or a negative error in case of failure. * * u64 bpf_skb_ancestor_cgroup_id(struct sk_buff *skb, int ancestor_level) * Description * Return id of cgroup v2 that is ancestor of cgroup associated * with the *skb* at the *ancestor_level*. The root cgroup is at * *ancestor_level* zero and each step down the hierarchy * increments the level. If *ancestor_level* == level of cgroup * associated with *skb*, then return value will be same as that * of **bpf_skb_cgroup_id**\ (). * * The helper is useful to implement policies based on cgroups * that are upper in hierarchy than immediate cgroup associated * with *skb*. * * The format of returned id and helper limitations are same as in * **bpf_skb_cgroup_id**\ (). * Return * The id is returned or 0 in case the id could not be retrieved. * * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) * Description * Look for TCP socket matching *tuple*, optionally in a child * network namespace *netns*. The return value must be checked, * and if non-**NULL**, released via **bpf_sk_release**\ (). * * The *ctx* should point to the context of the program, such as * the skb or socket (depending on the hook in use). This is used * to determine the base network namespace for the lookup. * * *tuple_size* must be one of: * * **sizeof**\ (*tuple*\ **->ipv4**) * Look for an IPv4 socket. * **sizeof**\ (*tuple*\ **->ipv6**) * Look for an IPv6 socket. * * If the *netns* is a negative signed 32-bit integer, then the * socket lookup table in the netns associated with the *ctx* * will be used. For the TC hooks, this is the netns of the device * in the skb. For socket hooks, this is the netns of the socket. * If *netns* is any other signed 32-bit value greater than or * equal to zero then it specifies the ID of the netns relative to * the netns associated with the *ctx*. *netns* values beyond the * range of 32-bit integers are reserved for future use. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * This helper is available only if the kernel was compiled with * **CONFIG_NET** configuration option. * Return * Pointer to **struct bpf_sock**, or **NULL** in case of failure. * For sockets with reuseport option, the **struct bpf_sock** * result is from *reuse*\ **->socks**\ [] using the hash of the * tuple. * * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) * Description * Look for UDP socket matching *tuple*, optionally in a child * network namespace *netns*. The return value must be checked, * and if non-**NULL**, released via **bpf_sk_release**\ (). * * The *ctx* should point to the context of the program, such as * the skb or socket (depending on the hook in use). This is used * to determine the base network namespace for the lookup. * * *tuple_size* must be one of: * * **sizeof**\ (*tuple*\ **->ipv4**) * Look for an IPv4 socket. * **sizeof**\ (*tuple*\ **->ipv6**) * Look for an IPv6 socket. * * If the *netns* is a negative signed 32-bit integer, then the * socket lookup table in the netns associated with the *ctx* * will be used. For the TC hooks, this is the netns of the device * in the skb. For socket hooks, this is the netns of the socket. * If *netns* is any other signed 32-bit value greater than or * equal to zero then it specifies the ID of the netns relative to * the netns associated with the *ctx*. *netns* values beyond the * range of 32-bit integers are reserved for future use. * * All values for *flags* are reserved for future usage, and must * be left at zero. * * This helper is available only if the kernel was compiled with * **CONFIG_NET** configuration option. * Return * Pointer to **struct bpf_sock**, or **NULL** in case of failure. * For sockets with reuseport option, the **struct bpf_sock** * result is from *reuse*\ **->socks**\ [] using the hash of the * tuple. * * long bpf_sk_release(void *sock) * Description * Release the reference held by *sock*. *sock* must be a * non-**NULL** pointer that was returned from * **bpf_sk_lookup_xxx**\ (). * Return * 0 on success, or a negative error in case of failure. * * long bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags) * Description * Push an element *value* in *map*. *flags* is one of: * * **BPF_EXIST** * If the queue/stack is full, the oldest element is * removed to make room for this. * Return * 0 on success, or a negative error in case of failure. * * long bpf_map_pop_elem(struct bpf_map *map, void *value) * Description * Pop an element from *map*. * Return * 0 on success, or a negative error in case of failure. * * long bpf_map_peek_elem(struct bpf_map *map, void *value) * Description * Get an element from *map* without removing it. * Return * 0 on success, or a negative error in case of failure. * * long bpf_msg_push_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags) * Description * For socket policies, insert *len* bytes into *msg* at offset * *start*. * * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a * *msg* it may want to insert metadata or options into the *msg*. * This can later be read and used by any of the lower layer BPF * hooks. * * This helper may fail if under memory pressure (a malloc * fails) in these cases BPF programs will get an appropriate * error and BPF programs will need to handle them. * Return * 0 on success, or a negative error in case of failure. * * long bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags) * Description * Will remove *len* bytes from a *msg* starting at byte *start*. * This may result in **ENOMEM** errors under certain situations if * an allocation and copy are required due to a full ring buffer. * However, the helper will try to avoid doing the allocation * if possible. Other errors can occur if input parameters are * invalid either due to *start* byte not being valid part of *msg* * payload and/or *pop* value being to large. * Return * 0 on success, or a negative error in case of failure. * * long bpf_rc_pointer_rel(void *ctx, s32 rel_x, s32 rel_y) * Description * This helper is used in programs implementing IR decoding, to * report a successfully decoded pointer movement. * * The *ctx* should point to the lirc sample as passed into * the program. * * This helper is only available is the kernel was compiled with * the **CONFIG_BPF_LIRC_MODE2** configuration option set to * "**y**". * Return * 0 * * long bpf_spin_lock(struct bpf_spin_lock *lock) * Description * Acquire a spinlock represented by the pointer *lock*, which is * stored as part of a value of a map. Taking the lock allows to * safely update the rest of the fields in that value. The * spinlock can (and must) later be released with a call to * **bpf_spin_unlock**\ (\ *lock*\ ). * * Spinlocks in BPF programs come with a number of restrictions * and constraints: * * * **bpf_spin_lock** objects are only allowed inside maps of * types **BPF_MAP_TYPE_HASH** and **BPF_MAP_TYPE_ARRAY** (this * list could be extended in the future). * * BTF description of the map is mandatory. * * The BPF program can take ONE lock at a time, since taking two * or more could cause dead locks. * * Only one **struct bpf_spin_lock** is allowed per map element. * * When the lock is taken, calls (either BPF to BPF or helpers) * are not allowed. * * The **BPF_LD_ABS** and **BPF_LD_IND** instructions are not * allowed inside a spinlock-ed region. * * The BPF program MUST call **bpf_spin_unlock**\ () to release * the lock, on all execution paths, before it returns. * * The BPF program can access **struct bpf_spin_lock** only via * the **bpf_spin_lock**\ () and **bpf_spin_unlock**\ () * helpers. Loading or storing data into the **struct * bpf_spin_lock** *lock*\ **;** field of a map is not allowed. * * To use the **bpf_spin_lock**\ () helper, the BTF description * of the map value must be a struct and have **struct * bpf_spin_lock** *anyname*\ **;** field at the top level. * Nested lock inside another struct is not allowed. * * The **struct bpf_spin_lock** *lock* field in a map value must * be aligned on a multiple of 4 bytes in that value. * * Syscall with command **BPF_MAP_LOOKUP_ELEM** does not copy * the **bpf_spin_lock** field to user space. * * Syscall with command **BPF_MAP_UPDATE_ELEM**, or update from * a BPF program, do not update the **bpf_spin_lock** field. * * **bpf_spin_lock** cannot be on the stack or inside a * networking packet (it can only be inside of a map values). * * **bpf_spin_lock** is available to root only. * * Tracing programs and socket filter programs cannot use * **bpf_spin_lock**\ () due to insufficient preemption checks * (but this may change in the future). * * **bpf_spin_lock** is not allowed in inner maps of map-in-map. * Return * 0 * * long bpf_spin_unlock(struct bpf_spin_lock *lock) * Description * Release the *lock* previously locked by a call to * **bpf_spin_lock**\ (\ *lock*\ ). * Return * 0 * * struct bpf_sock *bpf_sk_fullsock(struct bpf_sock *sk) * Description * This helper gets a **struct bpf_sock** pointer such * that all the fields in this **bpf_sock** can be accessed. * Return * A **struct bpf_sock** pointer on success, or **NULL** in * case of failure. * * struct bpf_tcp_sock *bpf_tcp_sock(struct bpf_sock *sk) * Description * This helper gets a **struct bpf_tcp_sock** pointer from a * **struct bpf_sock** pointer. * Return * A **struct bpf_tcp_sock** pointer on success, or **NULL** in * case of failure. * * long bpf_skb_ecn_set_ce(struct sk_buff *skb) * Description * Set ECN (Explicit Congestion Notification) field of IP header * to **CE** (Congestion Encountered) if current value is **ECT** * (ECN Capable Transport). Otherwise, do nothing. Works with IPv6 * and IPv4. * Return * 1 if the **CE** flag is set (either by the current helper call * or because it was already present), 0 if it is not set. * * struct bpf_sock *bpf_get_listener_sock(struct bpf_sock *sk) * Description * Return a **struct bpf_sock** pointer in **TCP_LISTEN** state. * **bpf_sk_release**\ () is unnecessary and not allowed. * Return * A **struct bpf_sock** pointer on success, or **NULL** in * case of failure. * * struct bpf_sock *bpf_skc_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags) * Description * Look for TCP socket matching *tuple*, optionally in a child * network namespace *netns*. The return value must be checked, * and if non-**NULL**, released via **bpf_sk_release**\ (). * * This function is identical to **bpf_sk_lookup_tcp**\ (), except * that it also returns timewait or request sockets. Use * **bpf_sk_fullsock**\ () or **bpf_tcp_sock**\ () to access the * full structure. * * This helper is available only if the kernel was compiled with * **CONFIG_NET** configuration option. * Return * Pointer to **struct bpf_sock**, or **NULL** in case of failure. * For sockets with reuseport option, the **struct bpf_sock** * result is from *reuse*\ **->socks**\ [] using the hash of the * tuple. * * long bpf_tcp_check_syncookie(void *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len) * Description * Check whether *iph* and *th* contain a valid SYN cookie ACK for * the listening socket in *sk*. * * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or * **sizeof**\ (**struct ip6hdr**). * * *th* points to the start of the TCP header, while *th_len* * contains **sizeof**\ (**struct tcphdr**). * Return * 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative * error otherwise. * * long bpf_sysctl_get_name(struct bpf_sysctl *ctx, char *buf, size_t buf_len, u64 flags) * Description * Get name of sysctl in /proc/sys/ and copy it into provided by * program buffer *buf* of size *buf_len*. * * The buffer is always NUL terminated, unless it's zero-sized. * * If *flags* is zero, full name (e.g. "net/ipv4/tcp_mem") is * copied. Use **BPF_F_SYSCTL_BASE_NAME** flag to copy base name * only (e.g. "tcp_mem"). * Return * Number of character copied (not including the trailing NUL). * * **-E2BIG** if the buffer wasn't big enough (*buf* will contain * truncated name in this case). * * long bpf_sysctl_get_current_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len) * Description * Get current value of sysctl as it is presented in /proc/sys * (incl. newline, etc), and copy it as a string into provided * by program buffer *buf* of size *buf_len*. * * The whole value is copied, no matter what file position user * space issued e.g. sys_read at. * * The buffer is always NUL terminated, unless it's zero-sized. * Return * Number of character copied (not including the trailing NUL). * * **-E2BIG** if the buffer wasn't big enough (*buf* will contain * truncated name in this case). * * **-EINVAL** if current value was unavailable, e.g. because * sysctl is uninitialized and read returns -EIO for it. * * long bpf_sysctl_get_new_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len) * Description * Get new value being written by user space to sysctl (before * the actual write happens) and copy it as a string into * provided by program buffer *buf* of size *buf_len*. * * User space may write new value at file position > 0. * * The buffer is always NUL terminated, unless it's zero-sized. * Return * Number of character copied (not including the trailing NUL). * * **-E2BIG** if the buffer wasn't big enough (*buf* will contain * truncated name in this case). * * **-EINVAL** if sysctl is being read. * * long bpf_sysctl_set_new_value(struct bpf_sysctl *ctx, const char *buf, size_t buf_len) * Description * Override new value being written by user space to sysctl with * value provided by program in buffer *buf* of size *buf_len*. * * *buf* should contain a string in same form as provided by user * space on sysctl write. * * User space may write new value at file position > 0. To override * the whole sysctl value file position should be set to zero. * Return * 0 on success. * * **-E2BIG** if the *buf_len* is too big. * * **-EINVAL** if sysctl is being read. * * long bpf_strtol(const char *buf, size_t buf_len, u64 flags, long *res) * Description * Convert the initial part of the string from buffer *buf* of * size *buf_len* to a long integer according to the given base * and save the result in *res*. * * The string may begin with an arbitrary amount of white space * (as determined by **isspace**\ (3)) followed by a single * optional '**-**' sign. * * Five least significant bits of *flags* encode base, other bits * are currently unused. * * Base must be either 8, 10, 16 or 0 to detect it automatically * similar to user space **strtol**\ (3). * Return * Number of characters consumed on success. Must be positive but * no more than *buf_len*. * * **-EINVAL** if no valid digits were found or unsupported base * was provided. * * **-ERANGE** if resulting value was out of range. * * long bpf_strtoul(const char *buf, size_t buf_len, u64 flags, unsigned long *res) * Description * Convert the initial part of the string from buffer *buf* of * size *buf_len* to an unsigned long integer according to the * given base and save the result in *res*. * * The string may begin with an arbitrary amount of white space * (as determined by **isspace**\ (3)). * * Five least significant bits of *flags* encode base, other bits * are currently unused. * * Base must be either 8, 10, 16 or 0 to detect it automatically * similar to user space **strtoul**\ (3). * Return * Number of characters consumed on success. Must be positive but * no more than *buf_len*. * * **-EINVAL** if no valid digits were found or unsupported base * was provided. * * **-ERANGE** if resulting value was out of range. * * void *bpf_sk_storage_get(struct bpf_map *map, void *sk, void *value, u64 flags) * Description * Get a bpf-local-storage from a *sk*. * * Logically, it could be thought of getting the value from * a *map* with *sk* as the **key**. From this * perspective, the usage is not much different from * **bpf_map_lookup_elem**\ (*map*, **&**\ *sk*) except this * helper enforces the key must be a full socket and the map must * be a **BPF_MAP_TYPE_SK_STORAGE** also. * * Underneath, the value is stored locally at *sk* instead of * the *map*. The *map* is used as the bpf-local-storage * "type". The bpf-local-storage "type" (i.e. the *map*) is * searched against all bpf-local-storages residing at *sk*. * * *sk* is a kernel **struct sock** pointer for LSM program. * *sk* is a **struct bpf_sock** pointer for other program types. * * An optional *flags* (**BPF_SK_STORAGE_GET_F_CREATE**) can be * used such that a new bpf-local-storage will be * created if one does not exist. *value* can be used * together with **BPF_SK_STORAGE_GET_F_CREATE** to specify * the initial value of a bpf-local-storage. If *value* is * **NULL**, the new bpf-local-storage will be zero initialized. * Return * A bpf-local-storage pointer is returned on success. * * **NULL** if not found or there was an error in adding * a new bpf-local-storage. * * long bpf_sk_storage_delete(struct bpf_map *map, void *sk) * Description * Delete a bpf-local-storage from a *sk*. * Return * 0 on success. * * **-ENOENT** if the bpf-local-storage cannot be found. * **-EINVAL** if sk is not a fullsock (e.g. a request_sock). * * long bpf_send_signal(u32 sig) * Description * Send signal *sig* to the process of the current task. * The signal may be delivered to any of this process's threads. * Return * 0 on success or successfully queued. * * **-EBUSY** if work queue under nmi is full. * * **-EINVAL** if *sig* is invalid. * * **-EPERM** if no permission to send the *sig*. * * **-EAGAIN** if bpf program can try again. * * s64 bpf_tcp_gen_syncookie(void *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len) * Description * Try to issue a SYN cookie for the packet with corresponding * IP/TCP headers, *iph* and *th*, on the listening socket in *sk*. * * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or * **sizeof**\ (**struct ip6hdr**). * * *th* points to the start of the TCP header, while *th_len* * contains the length of the TCP header. * Return * On success, lower 32 bits hold the generated SYN cookie in * followed by 16 bits which hold the MSS value for that cookie, * and the top 16 bits are unused. * * On failure, the returned value is one of the following: * * **-EINVAL** SYN cookie cannot be issued due to error * * **-ENOENT** SYN cookie should not be issued (no SYN flood) * * **-EOPNOTSUPP** kernel configuration does not enable SYN cookies * * **-EPROTONOSUPPORT** IP packet version is not 4 or 6 * * long bpf_skb_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size) * Description * Write raw *data* blob into a special BPF perf event held by * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf * event must have the following attributes: **PERF_SAMPLE_RAW** * as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and * **PERF_COUNT_SW_BPF_OUTPUT** as **config**. * * The *flags* are used to indicate the index in *map* for which * the value must be put, masked with **BPF_F_INDEX_MASK**. * Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU** * to indicate that the index of the current CPU core should be * used. * * The value to write, of *size*, is passed through eBPF stack and * pointed by *data*. * * *ctx* is a pointer to in-kernel struct sk_buff. * * This helper is similar to **bpf_perf_event_output**\ () but * restricted to raw_tracepoint bpf programs. * Return * 0 on success, or a negative error in case of failure. * * long bpf_probe_read_user(void *dst, u32 size, const void *unsafe_ptr) * Description * Safely attempt to read *size* bytes from user space address * *unsafe_ptr* and store the data in *dst*. * Return * 0 on success, or a negative error in case of failure. * * long bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr) * Description * Safely attempt to read *size* bytes from kernel space address * *unsafe_ptr* and store the data in *dst*. * Return * 0 on success, or a negative error in case of failure. * * long bpf_probe_read_user_str(void *dst, u32 size, const void *unsafe_ptr) * Description * Copy a NUL terminated string from an unsafe user address * *unsafe_ptr* to *dst*. The *size* should include the * terminating NUL byte. In case the string length is smaller than * *size*, the target is not padded with further NUL bytes. If the * string length is larger than *size*, just *size*-1 bytes are * copied and the last byte is set to NUL. * * On success, returns the number of bytes that were written, * including the terminal NUL. This makes this helper useful in * tracing programs for reading strings, and more importantly to * get its length at runtime. See the following snippet: * * :: * * SEC("kprobe/sys_open") * void bpf_sys_open(struct pt_regs *ctx) * { * char buf[PATHLEN]; // PATHLEN is defined to 256 * int res = bpf_probe_read_user_str(buf, sizeof(buf), * ctx->di); * * // Consume buf, for example push it to * // userspace via bpf_perf_event_output(); we * // can use res (the string length) as event * // size, after checking its boundaries. * } * * In comparison, using **bpf_probe_read_user**\ () helper here * instead to read the string would require to estimate the length * at compile time, and would often result in copying more memory * than necessary. * * Another useful use case is when parsing individual process * arguments or individual environment variables navigating * *current*\ **->mm->arg_start** and *current*\ * **->mm->env_start**: using this helper and the return value, * one can quickly iterate at the right offset of the memory area. * Return * On success, the strictly positive length of the output string, * including the trailing NUL character. On error, a negative * value. * * long bpf_probe_read_kernel_str(void *dst, u32 size, const void *unsafe_ptr) * Description * Copy a NUL terminated string from an unsafe kernel address *unsafe_ptr* * to *dst*. Same semantics as with **bpf_probe_read_user_str**\ () apply. * Return * On success, the strictly positive length of the string, including * the trailing NUL character. On error, a negative value. * * long bpf_tcp_send_ack(void *tp, u32 rcv_nxt) * Description * Send out a tcp-ack. *tp* is the in-kernel struct **tcp_sock**. * *rcv_nxt* is the ack_seq to be sent out. * Return * 0 on success, or a negative error in case of failure. * * long bpf_send_signal_thread(u32 sig) * Description * Send signal *sig* to the thread corresponding to the current task. * Return * 0 on success or successfully queued. * * **-EBUSY** if work queue under nmi is full. * * **-EINVAL** if *sig* is invalid. * * **-EPERM** if no permission to send the *sig*. * * **-EAGAIN** if bpf program can try again. * * u64 bpf_jiffies64(void) * Description * Obtain the 64bit jiffies * Return * The 64 bit jiffies * * long bpf_read_branch_records(struct bpf_perf_event_data *ctx, void *buf, u32 size, u64 flags) * Description * For an eBPF program attached to a perf event, retrieve the * branch records (**struct perf_branch_entry**) associated to *ctx* * and store it in the buffer pointed by *buf* up to size * *size* bytes. * Return * On success, number of bytes written to *buf*. On error, a * negative value. * * The *flags* can be set to **BPF_F_GET_BRANCH_RECORDS_SIZE** to * instead return the number of bytes required to store all the * branch entries. If this flag is set, *buf* may be NULL. * * **-EINVAL** if arguments invalid or **size** not a multiple * of **sizeof**\ (**struct perf_branch_entry**\ ). * * **-ENOENT** if architecture does not support branch records. * * long bpf_get_ns_current_pid_tgid(u64 dev, u64 ino, struct bpf_pidns_info *nsdata, u32 size) * Description * Returns 0 on success, values for *pid* and *tgid* as seen from the current * *namespace* will be returned in *nsdata*. * Return * 0 on success, or one of the following in case of failure: * * **-EINVAL** if dev and inum supplied don't match dev_t and inode number * with nsfs of current task, or if dev conversion to dev_t lost high bits. * * **-ENOENT** if pidns does not exists for the current task. * * long bpf_xdp_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size) * Description * Write raw *data* blob into a special BPF perf event held by * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf * event must have the following attributes: **PERF_SAMPLE_RAW** * as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and * **PERF_COUNT_SW_BPF_OUTPUT** as **config**. * * The *flags* are used to indicate the index in *map* for which * the value must be put, masked with **BPF_F_INDEX_MASK**. * Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU** * to indicate that the index of the current CPU core should be * used. * * The value to write, of *size*, is passed through eBPF stack and * pointed by *data*. * * *ctx* is a pointer to in-kernel struct xdp_buff. * * This helper is similar to **bpf_perf_eventoutput**\ () but * restricted to raw_tracepoint bpf programs. * Return * 0 on success, or a negative error in case of failure. * * u64 bpf_get_netns_cookie(void *ctx) * Description * Retrieve the cookie (generated by the kernel) of the network * namespace the input *ctx* is associated with. The network * namespace cookie remains stable for its lifetime and provides * a global identifier that can be assumed unique. If *ctx* is * NULL, then the helper returns the cookie for the initial * network namespace. The cookie itself is very similar to that * of **bpf_get_socket_cookie**\ () helper, but for network * namespaces instead of sockets. * Return * A 8-byte long opaque number. * * u64 bpf_get_current_ancestor_cgroup_id(int ancestor_level) * Description * Return id of cgroup v2 that is ancestor of the cgroup associated * with the current task at the *ancestor_level*. The root cgroup * is at *ancestor_level* zero and each step down the hierarchy * increments the level. If *ancestor_level* == level of cgroup * associated with the current task, then return value will be the * same as that of **bpf_get_current_cgroup_id**\ (). * * The helper is useful to implement policies based on cgroups * that are upper in hierarchy than immediate cgroup associated * with the current task. * * The format of returned id and helper limitations are same as in * **bpf_get_current_cgroup_id**\ (). * Return * The id is returned or 0 in case the id could not be retrieved. * * long bpf_sk_assign(struct sk_buff *skb, void *sk, u64 flags) * Description * Helper is overloaded depending on BPF program type. This * description applies to **BPF_PROG_TYPE_SCHED_CLS** and * **BPF_PROG_TYPE_SCHED_ACT** programs. * * Assign the *sk* to the *skb*. When combined with appropriate * routing configuration to receive the packet towards the socket, * will cause *skb* to be delivered to the specified socket. * Subsequent redirection of *skb* via **bpf_redirect**\ (), * **bpf_clone_redirect**\ () or other methods outside of BPF may * interfere with successful delivery to the socket. * * This operation is only valid from TC ingress path. * * The *flags* argument must be zero. * Return * 0 on success, or a negative error in case of failure: * * **-EINVAL** if specified *flags* are not supported. * * **-ENOENT** if the socket is unavailable for assignment. * * **-ENETUNREACH** if the socket is unreachable (wrong netns). * * **-EOPNOTSUPP** if the operation is not supported, for example * a call from outside of TC ingress. * * **-ESOCKTNOSUPPORT** if the socket type is not supported * (reuseport). * * long bpf_sk_assign(struct bpf_sk_lookup *ctx, struct bpf_sock *sk, u64 flags) * Description * Helper is overloaded depending on BPF program type. This * description applies to **BPF_PROG_TYPE_SK_LOOKUP** programs. * * Select the *sk* as a result of a socket lookup. * * For the operation to succeed passed socket must be compatible * with the packet description provided by the *ctx* object. * * L4 protocol (**IPPROTO_TCP** or **IPPROTO_UDP**) must * be an exact match. While IP family (**AF_INET** or * **AF_INET6**) must be compatible, that is IPv6 sockets * that are not v6-only can be selected for IPv4 packets. * * Only TCP listeners and UDP unconnected sockets can be * selected. *sk* can also be NULL to reset any previous * selection. * * *flags* argument can combination of following values: * * * **BPF_SK_LOOKUP_F_REPLACE** to override the previous * socket selection, potentially done by a BPF program * that ran before us. * * * **BPF_SK_LOOKUP_F_NO_REUSEPORT** to skip * load-balancing within reuseport group for the socket * being selected. * * On success *ctx->sk* will point to the selected socket. * * Return * 0 on success, or a negative errno in case of failure. * * * **-EAFNOSUPPORT** if socket family (*sk->family*) is * not compatible with packet family (*ctx->family*). * * * **-EEXIST** if socket has been already selected, * potentially by another program, and * **BPF_SK_LOOKUP_F_REPLACE** flag was not specified. * * * **-EINVAL** if unsupported flags were specified. * * * **-EPROTOTYPE** if socket L4 protocol * (*sk->protocol*) doesn't match packet protocol * (*ctx->protocol*). * * * **-ESOCKTNOSUPPORT** if socket is not in allowed * state (TCP listening or UDP unconnected). * * u64 bpf_ktime_get_boot_ns(void) * Description * Return the time elapsed since system boot, in nanoseconds. * Does include the time the system was suspended. * See: **clock_gettime**\ (**CLOCK_BOOTTIME**) * Return * Current *ktime*. * * long bpf_seq_printf(struct seq_file *m, const char *fmt, u32 fmt_size, const void *data, u32 data_len) * Description * **bpf_seq_printf**\ () uses seq_file **seq_printf**\ () to print * out the format string. * The *m* represents the seq_file. The *fmt* and *fmt_size* are for * the format string itself. The *data* and *data_len* are format string * arguments. The *data* are a **u64** array and corresponding format string * values are stored in the array. For strings and pointers where pointees * are accessed, only the pointer values are stored in the *data* array. * The *data_len* is the size of *data* in bytes. * * Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory. * Reading kernel memory may fail due to either invalid address or * valid address but requiring a major memory fault. If reading kernel memory * fails, the string for **%s** will be an empty string, and the ip * address for **%p{i,I}{4,6}** will be 0. Not returning error to * bpf program is consistent with what **bpf_trace_printk**\ () does for now. * Return * 0 on success, or a negative error in case of failure: * * **-EBUSY** if per-CPU memory copy buffer is busy, can try again * by returning 1 from bpf program. * * **-EINVAL** if arguments are invalid, or if *fmt* is invalid/unsupported. * * **-E2BIG** if *fmt* contains too many format specifiers. * * **-EOVERFLOW** if an overflow happened: The same object will be tried again. * * long bpf_seq_write(struct seq_file *m, const void *data, u32 len) * Description * **bpf_seq_write**\ () uses seq_file **seq_write**\ () to write the data. * The *m* represents the seq_file. The *data* and *len* represent the * data to write in bytes. * Return * 0 on success, or a negative error in case of failure: * * **-EOVERFLOW** if an overflow happened: The same object will be tried again. * * u64 bpf_sk_cgroup_id(void *sk) * Description * Return the cgroup v2 id of the socket *sk*. * * *sk* must be a non-**NULL** pointer to a socket, e.g. one * returned from **bpf_sk_lookup_xxx**\ (), * **bpf_sk_fullsock**\ (), etc. The format of returned id is * same as in **bpf_skb_cgroup_id**\ (). * * This helper is available only if the kernel was compiled with * the **CONFIG_SOCK_CGROUP_DATA** configuration option. * Return * The id is returned or 0 in case the id could not be retrieved. * * u64 bpf_sk_ancestor_cgroup_id(void *sk, int ancestor_level) * Description * Return id of cgroup v2 that is ancestor of cgroup associated * with the *sk* at the *ancestor_level*. The root cgroup is at * *ancestor_level* zero and each step down the hierarchy * increments the level. If *ancestor_level* == level of cgroup * associated with *sk*, then return value will be same as that * of **bpf_sk_cgroup_id**\ (). * * The helper is useful to implement policies based on cgroups * that are upper in hierarchy than immediate cgroup associated * with *sk*. * * The format of returned id and helper limitations are same as in * **bpf_sk_cgroup_id**\ (). * Return * The id is returned or 0 in case the id could not be retrieved. * * long bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) * Description * Copy *size* bytes from *data* into a ring buffer *ringbuf*. * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification * of new data availability is sent. * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification * of new data availability is sent unconditionally. * If **0** is specified in *flags*, an adaptive notification * of new data availability is sent. * * An adaptive notification is a notification sent whenever the user-space * process has caught up and consumed all available payloads. In case the user-space * process is still processing a previous payload, then no notification is needed * as it will process the newly added payload automatically. * Return * 0 on success, or a negative error in case of failure. * * void *bpf_ringbuf_reserve(void *ringbuf, u64 size, u64 flags) * Description * Reserve *size* bytes of payload in a ring buffer *ringbuf*. * *flags* must be 0. * Return * Valid pointer with *size* bytes of memory available; NULL, * otherwise. * * void bpf_ringbuf_submit(void *data, u64 flags) * Description * Submit reserved ring buffer sample, pointed to by *data*. * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification * of new data availability is sent. * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification * of new data availability is sent unconditionally. * If **0** is specified in *flags*, an adaptive notification * of new data availability is sent. * * See 'bpf_ringbuf_output()' for the definition of adaptive notification. * Return * Nothing. Always succeeds. * * void bpf_ringbuf_discard(void *data, u64 flags) * Description * Discard reserved ring buffer sample, pointed to by *data*. * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification * of new data availability is sent. * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification * of new data availability is sent unconditionally. * If **0** is specified in *flags*, an adaptive notification * of new data availability is sent. * * See 'bpf_ringbuf_output()' for the definition of adaptive notification. * Return * Nothing. Always succeeds. * * u64 bpf_ringbuf_query(void *ringbuf, u64 flags) * Description * Query various characteristics of provided ring buffer. What * exactly is queries is determined by *flags*: * * * **BPF_RB_AVAIL_DATA**: Amount of data not yet consumed. * * **BPF_RB_RING_SIZE**: The size of ring buffer. * * **BPF_RB_CONS_POS**: Consumer position (can wrap around). * * **BPF_RB_PROD_POS**: Producer(s) position (can wrap around). * * Data returned is just a momentary snapshot of actual values * and could be inaccurate, so this facility should be used to * power heuristics and for reporting, not to make 100% correct * calculation. * Return * Requested value, or 0, if *flags* are not recognized. * * long bpf_csum_level(struct sk_buff *skb, u64 level) * Description * Change the skbs checksum level by one layer up or down, or * reset it entirely to none in order to have the stack perform * checksum validation. The level is applicable to the following * protocols: TCP, UDP, GRE, SCTP, FCOE. For example, a decap of * | ETH | IP | UDP | GUE | IP | TCP | into | ETH | IP | TCP | * through **bpf_skb_adjust_room**\ () helper with passing in * **BPF_F_ADJ_ROOM_NO_CSUM_RESET** flag would require one call * to **bpf_csum_level**\ () with **BPF_CSUM_LEVEL_DEC** since * the UDP header is removed. Similarly, an encap of the latter * into the former could be accompanied by a helper call to * **bpf_csum_level**\ () with **BPF_CSUM_LEVEL_INC** if the * skb is still intended to be processed in higher layers of the * stack instead of just egressing at tc. * * There are three supported level settings at this time: * * * **BPF_CSUM_LEVEL_INC**: Increases skb->csum_level for skbs * with CHECKSUM_UNNECESSARY. * * **BPF_CSUM_LEVEL_DEC**: Decreases skb->csum_level for skbs * with CHECKSUM_UNNECESSARY. * * **BPF_CSUM_LEVEL_RESET**: Resets skb->csum_level to 0 and * sets CHECKSUM_NONE to force checksum validation by the stack. * * **BPF_CSUM_LEVEL_QUERY**: No-op, returns the current * skb->csum_level. * Return * 0 on success, or a negative error in case of failure. In the * case of **BPF_CSUM_LEVEL_QUERY**, the current skb->csum_level * is returned or the error code -EACCES in case the skb is not * subject to CHECKSUM_UNNECESSARY. * * struct tcp6_sock *bpf_skc_to_tcp6_sock(void *sk) * Description * Dynamically cast a *sk* pointer to a *tcp6_sock* pointer. * Return * *sk* if casting is valid, or **NULL** otherwise. * * struct tcp_sock *bpf_skc_to_tcp_sock(void *sk) * Description * Dynamically cast a *sk* pointer to a *tcp_sock* pointer. * Return * *sk* if casting is valid, or **NULL** otherwise. * * struct tcp_timewait_sock *bpf_skc_to_tcp_timewait_sock(void *sk) * Description * Dynamically cast a *sk* pointer to a *tcp_timewait_sock* pointer. * Return * *sk* if casting is valid, or **NULL** otherwise. * * struct tcp_request_sock *bpf_skc_to_tcp_request_sock(void *sk) * Description * Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer. * Return * *sk* if casting is valid, or **NULL** otherwise. * * struct udp6_sock *bpf_skc_to_udp6_sock(void *sk) * Description * Dynamically cast a *sk* pointer to a *udp6_sock* pointer. * Return * *sk* if casting is valid, or **NULL** otherwise. * * long bpf_get_task_stack(struct task_struct *task, void *buf, u32 size, u64 flags) * Description * Return a user or a kernel stack in bpf program provided buffer. * To achieve this, the helper needs *task*, which is a valid * pointer to **struct task_struct**. To store the stacktrace, the * bpf program provides *buf* with a nonnegative *size*. * * The last argument, *flags*, holds the number of stack frames to * skip (from 0 to 255), masked with * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set * the following flags: * * **BPF_F_USER_STACK** * Collect a user space stack instead of a kernel stack. * **BPF_F_USER_BUILD_ID** * Collect buildid+offset instead of ips for user stack, * only valid if **BPF_F_USER_STACK** is also specified. * * **bpf_get_task_stack**\ () can collect up to * **PERF_MAX_STACK_DEPTH** both kernel and user frames, subject * to sufficient large buffer size. Note that * this limit can be controlled with the **sysctl** program, and * that it should be manually increased in order to profile long * user stacks (such as stacks for Java programs). To do so, use: * * :: * * # sysctl kernel.perf_event_max_stack=<new value> * Return * A non-negative value equal to or less than *size* on success, * or a negative error in case of failure. * * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags) * Description * Load header option. Support reading a particular TCP header * option for bpf program (**BPF_PROG_TYPE_SOCK_OPS**). * * If *flags* is 0, it will search the option from the * *skops*\ **->skb_data**. The comment in **struct bpf_sock_ops** * has details on what skb_data contains under different * *skops*\ **->op**. * * The first byte of the *searchby_res* specifies the * kind that it wants to search. * * If the searching kind is an experimental kind * (i.e. 253 or 254 according to RFC6994). It also * needs to specify the "magic" which is either * 2 bytes or 4 bytes. It then also needs to * specify the size of the magic by using * the 2nd byte which is "kind-length" of a TCP * header option and the "kind-length" also * includes the first 2 bytes "kind" and "kind-length" * itself as a normal TCP header option also does. * * For example, to search experimental kind 254 with * 2 byte magic 0xeB9F, the searchby_res should be * [ 254, 4, 0xeB, 0x9F, 0, 0, .... 0 ]. * * To search for the standard window scale option (3), * the *searchby_res* should be [ 3, 0, 0, .... 0 ]. * Note, kind-length must be 0 for regular option. * * Searching for No-Op (0) and End-of-Option-List (1) are * not supported. * * *len* must be at least 2 bytes which is the minimal size * of a header option. * * Supported flags: * * * **BPF_LOAD_HDR_OPT_TCP_SYN** to search from the * saved_syn packet or the just-received syn packet. * * Return * > 0 when found, the header option is copied to *searchby_res*. * The return value is the total length copied. On failure, a * negative error code is returned: * * **-EINVAL** if a parameter is invalid. * * **-ENOMSG** if the option is not found. * * **-ENOENT** if no syn packet is available when * **BPF_LOAD_HDR_OPT_TCP_SYN** is used. * * **-ENOSPC** if there is not enough space. Only *len* number of * bytes are copied. * * **-EFAULT** on failure to parse the header options in the * packet. * * **-EPERM** if the helper cannot be used under the current * *skops*\ **->op**. * * long bpf_store_hdr_opt(struct bpf_sock_ops *skops, const void *from, u32 len, u64 flags) * Description * Store header option. The data will be copied * from buffer *from* with length *len* to the TCP header. * * The buffer *from* should have the whole option that * includes the kind, kind-length, and the actual * option data. The *len* must be at least kind-length * long. The kind-length does not have to be 4 byte * aligned. The kernel will take care of the padding * and setting the 4 bytes aligned value to th->doff. * * This helper will check for duplicated option * by searching the same option in the outgoing skb. * * This helper can only be called during * **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**. * * Return * 0 on success, or negative error in case of failure: * * **-EINVAL** If param is invalid. * * **-ENOSPC** if there is not enough space in the header. * Nothing has been written * * **-EEXIST** if the option already exists. * * **-EFAULT** on failrue to parse the existing header options. * * **-EPERM** if the helper cannot be used under the current * *skops*\ **->op**. * * long bpf_reserve_hdr_opt(struct bpf_sock_ops *skops, u32 len, u64 flags) * Description * Reserve *len* bytes for the bpf header option. The * space will be used by **bpf_store_hdr_opt**\ () later in * **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**. * * If **bpf_reserve_hdr_opt**\ () is called multiple times, * the total number of bytes will be reserved. * * This helper can only be called during * **BPF_SOCK_OPS_HDR_OPT_LEN_CB**. * * Return * 0 on success, or negative error in case of failure: * * **-EINVAL** if a parameter is invalid. * * **-ENOSPC** if there is not enough space in the header. * * **-EPERM** if the helper cannot be used under the current * *skops*\ **->op**. * * void *bpf_inode_storage_get(struct bpf_map *map, void *inode, void *value, u64 flags) * Description * Get a bpf_local_storage from an *inode*. * * Logically, it could be thought of as getting the value from * a *map* with *inode* as the **key**. From this * perspective, the usage is not much different from * **bpf_map_lookup_elem**\ (*map*, **&**\ *inode*) except this * helper enforces the key must be an inode and the map must also * be a **BPF_MAP_TYPE_INODE_STORAGE**. * * Underneath, the value is stored locally at *inode* instead of * the *map*. The *map* is used as the bpf-local-storage * "type". The bpf-local-storage "type" (i.e. the *map*) is * searched against all bpf_local_storage residing at *inode*. * * An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be * used such that a new bpf_local_storage will be * created if one does not exist. *value* can be used * together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify * the initial value of a bpf_local_storage. If *value* is * **NULL**, the new bpf_local_storage will be zero initialized. * Return * A bpf_local_storage pointer is returned on success. * * **NULL** if not found or there was an error in adding * a new bpf_local_storage. * * int bpf_inode_storage_delete(struct bpf_map *map, void *inode) * Description * Delete a bpf_local_storage from an *inode*. * Return * 0 on success. * * **-ENOENT** if the bpf_local_storage cannot be found. * * long bpf_d_path(struct path *path, char *buf, u32 sz) * Description * Return full path for given **struct path** object, which * needs to be the kernel BTF *path* object. The path is * returned in the provided buffer *buf* of size *sz* and * is zero terminated. * * Return * On success, the strictly positive length of the string, * including the trailing NUL character. On error, a negative * value. * * long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr) * Description * Read *size* bytes from user space address *user_ptr* and store * the data in *dst*. This is a wrapper of **copy_from_user**\ (). * Return * 0 on success, or a negative error in case of failure. * * long bpf_snprintf_btf(char *str, u32 str_size, struct btf_ptr *ptr, u32 btf_ptr_size, u64 flags) * Description * Use BTF to store a string representation of *ptr*->ptr in *str*, * using *ptr*->type_id. This value should specify the type * that *ptr*->ptr points to. LLVM __builtin_btf_type_id(type, 1) * can be used to look up vmlinux BTF type ids. Traversing the * data structure using BTF, the type information and values are * stored in the first *str_size* - 1 bytes of *str*. Safe copy of * the pointer data is carried out to avoid kernel crashes during * operation. Smaller types can use string space on the stack; * larger programs can use map data to store the string * representation. * * The string can be subsequently shared with userspace via * bpf_perf_event_output() or ring buffer interfaces. * bpf_trace_printk() is to be avoided as it places too small * a limit on string size to be useful. * * *flags* is a combination of * * **BTF_F_COMPACT** * no formatting around type information * **BTF_F_NONAME** * no struct/union member names/types * **BTF_F_PTR_RAW** * show raw (unobfuscated) pointer values; * equivalent to printk specifier %px. * **BTF_F_ZERO** * show zero-valued struct/union members; they * are not displayed by default * * Return * The number of bytes that were written (or would have been * written if output had to be truncated due to string size), * or a negative error in cases of failure. * * long bpf_seq_printf_btf(struct seq_file *m, struct btf_ptr *ptr, u32 ptr_size, u64 flags) * Description * Use BTF to write to seq_write a string representation of * *ptr*->ptr, using *ptr*->type_id as per bpf_snprintf_btf(). * *flags* are identical to those used for bpf_snprintf_btf. * Return * 0 on success or a negative error in case of failure. * * u64 bpf_skb_cgroup_classid(struct sk_buff *skb) * Description * See **bpf_get_cgroup_classid**\ () for the main description. * This helper differs from **bpf_get_cgroup_classid**\ () in that * the cgroup v1 net_cls class is retrieved only from the *skb*'s * associated socket instead of the current process. * Return * The id is returned or 0 in case the id could not be retrieved. * * long bpf_redirect_neigh(u32 ifindex, struct bpf_redir_neigh *params, int plen, u64 flags) * Description * Redirect the packet to another net device of index *ifindex* * and fill in L2 addresses from neighboring subsystem. This helper * is somewhat similar to **bpf_redirect**\ (), except that it * populates L2 addresses as well, meaning, internally, the helper * relies on the neighbor lookup for the L2 address of the nexthop. * * The helper will perform a FIB lookup based on the skb's * networking header to get the address of the next hop, unless * this is supplied by the caller in the *params* argument. The * *plen* argument indicates the len of *params* and should be set * to 0 if *params* is NULL. * * The *flags* argument is reserved and must be 0. The helper is * currently only supported for tc BPF program types, and enabled * for IPv4 and IPv6 protocols. * Return * The helper returns **TC_ACT_REDIRECT** on success or * **TC_ACT_SHOT** on error. * * void *bpf_per_cpu_ptr(const void *percpu_ptr, u32 cpu) * Description * Take a pointer to a percpu ksym, *percpu_ptr*, and return a * pointer to the percpu kernel variable on *cpu*. A ksym is an * extern variable decorated with '__ksym'. For ksym, there is a * global var (either static or global) defined of the same name * in the kernel. The ksym is percpu if the global var is percpu. * The returned pointer points to the global percpu var on *cpu*. * * bpf_per_cpu_ptr() has the same semantic as per_cpu_ptr() in the * kernel, except that bpf_per_cpu_ptr() may return NULL. This * happens if *cpu* is larger than nr_cpu_ids. The caller of * bpf_per_cpu_ptr() must check the returned value. * Return * A pointer pointing to the kernel percpu variable on *cpu*, or * NULL, if *cpu* is invalid. * * void *bpf_this_cpu_ptr(const void *percpu_ptr) * Description * Take a pointer to a percpu ksym, *percpu_ptr*, and return a * pointer to the percpu kernel variable on this cpu. See the * description of 'ksym' in **bpf_per_cpu_ptr**\ (). * * bpf_this_cpu_ptr() has the same semantic as this_cpu_ptr() in * the kernel. Different from **bpf_per_cpu_ptr**\ (), it would * never return NULL. * Return * A pointer pointing to the kernel percpu variable on this cpu. * * long bpf_redirect_peer(u32 ifindex, u64 flags) * Description * Redirect the packet to another net device of index *ifindex*. * This helper is somewhat similar to **bpf_redirect**\ (), except * that the redirection happens to the *ifindex*' peer device and * the netns switch takes place from ingress to ingress without * going through the CPU's backlog queue. * * The *flags* argument is reserved and must be 0. The helper is * currently only supported for tc BPF program types at the ingress * hook and for veth device types. The peer device must reside in a * different network namespace. * Return * The helper returns **TC_ACT_REDIRECT** on success or * **TC_ACT_SHOT** on error. * * void *bpf_task_storage_get(struct bpf_map *map, struct task_struct *task, void *value, u64 flags) * Description * Get a bpf_local_storage from the *task*. * * Logically, it could be thought of as getting the value from * a *map* with *task* as the **key**. From this * perspective, the usage is not much different from * **bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this * helper enforces the key must be an task_struct and the map must also * be a **BPF_MAP_TYPE_TASK_STORAGE**. * * Underneath, the value is stored locally at *task* instead of * the *map*. The *map* is used as the bpf-local-storage * "type". The bpf-local-storage "type" (i.e. the *map*) is * searched against all bpf_local_storage residing at *task*. * * An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be * used such that a new bpf_local_storage will be * created if one does not exist. *value* can be used * together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify * the initial value of a bpf_local_storage. If *value* is * **NULL**, the new bpf_local_storage will be zero initialized. * Return * A bpf_local_storage pointer is returned on success. * * **NULL** if not found or there was an error in adding * a new bpf_local_storage. * * long bpf_task_storage_delete(struct bpf_map *map, struct task_struct *task) * Description * Delete a bpf_local_storage from a *task*. * Return * 0 on success. * * **-ENOENT** if the bpf_local_storage cannot be found. * * struct task_struct *bpf_get_current_task_btf(void) * Description * Return a BTF pointer to the "current" task. * This pointer can also be used in helpers that accept an * *ARG_PTR_TO_BTF_ID* of type *task_struct*. * Return * Pointer to the current task. * * long bpf_bprm_opts_set(struct linux_binprm *bprm, u64 flags) * Description * Set or clear certain options on *bprm*: * * **BPF_F_BPRM_SECUREEXEC** Set the secureexec bit * which sets the **AT_SECURE** auxv for glibc. The bit * is cleared if the flag is not specified. * Return * **-EINVAL** if invalid *flags* are passed, zero otherwise. * * u64 bpf_ktime_get_coarse_ns(void) * Description * Return a coarse-grained version of the time elapsed since * system boot, in nanoseconds. Does not include time the system * was suspended. * * See: **clock_gettime**\ (**CLOCK_MONOTONIC_COARSE**) * Return * Current *ktime*. * * long bpf_ima_inode_hash(struct inode *inode, void *dst, u32 size) * Description * Returns the stored IMA hash of the *inode* (if it's avaialable). * If the hash is larger than *size*, then only *size* * bytes will be copied to *dst* * Return * The **hash_algo** is returned on success, * **-EOPNOTSUP** if IMA is disabled or **-EINVAL** if * invalid arguments are passed. * * struct socket *bpf_sock_from_file(struct file *file) * Description * If the given file represents a socket, returns the associated * socket. * Return * A pointer to a struct socket on success or NULL if the file is * not a socket. * * long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags) * Description * Check packet size against exceeding MTU of net device (based * on *ifindex*). This helper will likely be used in combination * with helpers that adjust/change the packet size. * * The argument *len_diff* can be used for querying with a planned * size change. This allows to check MTU prior to changing packet * ctx. Providing an *len_diff* adjustment that is larger than the * actual packet size (resulting in negative packet size) will in * principle not exceed the MTU, why it is not considered a * failure. Other BPF-helpers are needed for performing the * planned size change, why the responsability for catch a negative * packet size belong in those helpers. * * Specifying *ifindex* zero means the MTU check is performed * against the current net device. This is practical if this isn't * used prior to redirect. * * On input *mtu_len* must be a valid pointer, else verifier will * reject BPF program. If the value *mtu_len* is initialized to * zero then the ctx packet size is use. When value *mtu_len* is * provided as input this specify the L3 length that the MTU check * is done against. Remember XDP and TC length operate at L2, but * this value is L3 as this correlate to MTU and IP-header tot_len * values which are L3 (similar behavior as bpf_fib_lookup). * * The Linux kernel route table can configure MTUs on a more * specific per route level, which is not provided by this helper. * For route level MTU checks use the **bpf_fib_lookup**\ () * helper. * * *ctx* is either **struct xdp_md** for XDP programs or * **struct sk_buff** for tc cls_act programs. * * The *flags* argument can be a combination of one or more of the * following values: * * **BPF_MTU_CHK_SEGS** * This flag will only works for *ctx* **struct sk_buff**. * If packet context contains extra packet segment buffers * (often knows as GSO skb), then MTU check is harder to * check at this point, because in transmit path it is * possible for the skb packet to get re-segmented * (depending on net device features). This could still be * a MTU violation, so this flag enables performing MTU * check against segments, with a different violation * return code to tell it apart. Check cannot use len_diff. * * On return *mtu_len* pointer contains the MTU value of the net * device. Remember the net device configured MTU is the L3 size, * which is returned here and XDP and TC length operate at L2. * Helper take this into account for you, but remember when using * MTU value in your BPF-code. * * Return * * 0 on success, and populate MTU value in *mtu_len* pointer. * * * < 0 if any input argument is invalid (*mtu_len* not updated) * * MTU violations return positive values, but also populate MTU * value in *mtu_len* pointer, as this can be needed for * implementing PMTU handing: * * * **BPF_MTU_CHK_RET_FRAG_NEEDED** * * **BPF_MTU_CHK_RET_SEGS_TOOBIG** * * long bpf_for_each_map_elem(struct bpf_map *map, void *callback_fn, void *callback_ctx, u64 flags) * Description * For each element in **map**, call **callback_fn** function with * **map**, **callback_ctx** and other map-specific parameters. * The **callback_fn** should be a static function and * the **callback_ctx** should be a pointer to the stack. * The **flags** is used to control certain aspects of the helper. * Currently, the **flags** must be 0. * * The following are a list of supported map types and their * respective expected callback signatures: * * BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_PERCPU_HASH, * BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH, * BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PERCPU_ARRAY * * long (\*callback_fn)(struct bpf_map \*map, const void \*key, void \*value, void \*ctx); * * For per_cpu maps, the map_value is the value on the cpu where the * bpf_prog is running. * * If **callback_fn** return 0, the helper will continue to the next * element. If return value is 1, the helper will skip the rest of * elements and return. Other return values are not used now. * * Return * The number of traversed map elements for success, **-EINVAL** for * invalid **flags**. * * long bpf_snprintf(char *str, u32 str_size, const char *fmt, u64 *data, u32 data_len) * Description * Outputs a string into the **str** buffer of size **str_size** * based on a format string stored in a read-only map pointed by * **fmt**. * * Each format specifier in **fmt** corresponds to one u64 element * in the **data** array. For strings and pointers where pointees * are accessed, only the pointer values are stored in the *data* * array. The *data_len* is the size of *data* in bytes. * * Formats **%s** and **%p{i,I}{4,6}** require to read kernel * memory. Reading kernel memory may fail due to either invalid * address or valid address but requiring a major memory fault. If * reading kernel memory fails, the string for **%s** will be an * empty string, and the ip address for **%p{i,I}{4,6}** will be 0. * Not returning error to bpf program is consistent with what * **bpf_trace_printk**\ () does for now. * * Return * The strictly positive length of the formatted string, including * the trailing zero character. If the return value is greater than * **str_size**, **str** contains a truncated string, guaranteed to * be zero-terminated except when **str_size** is 0. * * Or **-EBUSY** if the per-CPU memory copy buffer is busy. * * long bpf_sys_bpf(u32 cmd, void *attr, u32 attr_size) * Description * Execute bpf syscall with given arguments. * Return * A syscall result. * * long bpf_btf_find_by_name_kind(char *name, int name_sz, u32 kind, int flags) * Description * Find BTF type with given name and kind in vmlinux BTF or in module's BTFs. * Return * Returns btf_id and btf_obj_fd in lower and upper 32 bits. * * long bpf_sys_close(u32 fd) * Description * Execute close syscall for given FD. * Return * A syscall result. */ #define __BPF_FUNC_MAPPER(FN) \ FN(unspec), \ FN(map_lookup_elem), \ FN(map_update_elem), \ FN(map_delete_elem), \ FN(probe_read), \ FN(ktime_get_ns), \ FN(trace_printk), \ FN(get_prandom_u32), \ FN(get_smp_processor_id), \ FN(skb_store_bytes), \ FN(l3_csum_replace), \ FN(l4_csum_replace), \ FN(tail_call), \ FN(clone_redirect), \ FN(get_current_pid_tgid), \ FN(get_current_uid_gid), \ FN(get_current_comm), \ FN(get_cgroup_classid), \ FN(skb_vlan_push), \ FN(skb_vlan_pop), \ FN(skb_get_tunnel_key), \ FN(skb_set_tunnel_key), \ FN(perf_event_read), \ FN(redirect), \ FN(get_route_realm), \ FN(perf_event_output), \ FN(skb_load_bytes), \ FN(get_stackid), \ FN(csum_diff), \ FN(skb_get_tunnel_opt), \ FN(skb_set_tunnel_opt), \ FN(skb_change_proto), \ FN(skb_change_type), \ FN(skb_under_cgroup), \ FN(get_hash_recalc), \ FN(get_current_task), \ FN(probe_write_user), \ FN(current_task_under_cgroup), \ FN(skb_change_tail), \ FN(skb_pull_data), \ FN(csum_update), \ FN(set_hash_invalid), \ FN(get_numa_node_id), \ FN(skb_change_head), \ FN(xdp_adjust_head), \ FN(probe_read_str), \ FN(get_socket_cookie), \ FN(get_socket_uid), \ FN(set_hash), \ FN(setsockopt), \ FN(skb_adjust_room), \ FN(redirect_map), \ FN(sk_redirect_map), \ FN(sock_map_update), \ FN(xdp_adjust_meta), \ FN(perf_event_read_value), \ FN(perf_prog_read_value), \ FN(getsockopt), \ FN(override_return), \ FN(sock_ops_cb_flags_set), \ FN(msg_redirect_map), \ FN(msg_apply_bytes), \ FN(msg_cork_bytes), \ FN(msg_pull_data), \ FN(bind), \ FN(xdp_adjust_tail), \ FN(skb_get_xfrm_state), \ FN(get_stack), \ FN(skb_load_bytes_relative), \ FN(fib_lookup), \ FN(sock_hash_update), \ FN(msg_redirect_hash), \ FN(sk_redirect_hash), \ FN(lwt_push_encap), \ FN(lwt_seg6_store_bytes), \ FN(lwt_seg6_adjust_srh), \ FN(lwt_seg6_action), \ FN(rc_repeat), \ FN(rc_keydown), \ FN(skb_cgroup_id), \ FN(get_current_cgroup_id), \ FN(get_local_storage), \ FN(sk_select_reuseport), \ FN(skb_ancestor_cgroup_id), \ FN(sk_lookup_tcp), \ FN(sk_lookup_udp), \ FN(sk_release), \ FN(map_push_elem), \ FN(map_pop_elem), \ FN(map_peek_elem), \ FN(msg_push_data), \ FN(msg_pop_data), \ FN(rc_pointer_rel), \ FN(spin_lock), \ FN(spin_unlock), \ FN(sk_fullsock), \ FN(tcp_sock), \ FN(skb_ecn_set_ce), \ FN(get_listener_sock), \ FN(skc_lookup_tcp), \ FN(tcp_check_syncookie), \ FN(sysctl_get_name), \ FN(sysctl_get_current_value), \ FN(sysctl_get_new_value), \ FN(sysctl_set_new_value), \ FN(strtol), \ FN(strtoul), \ FN(sk_storage_get), \ FN(sk_storage_delete), \ FN(send_signal), \ FN(tcp_gen_syncookie), \ FN(skb_output), \ FN(probe_read_user), \ FN(probe_read_kernel), \ FN(probe_read_user_str), \ FN(probe_read_kernel_str), \ FN(tcp_send_ack), \ FN(send_signal_thread), \ FN(jiffies64), \ FN(read_branch_records), \ FN(get_ns_current_pid_tgid), \ FN(xdp_output), \ FN(get_netns_cookie), \ FN(get_current_ancestor_cgroup_id), \ FN(sk_assign), \ FN(ktime_get_boot_ns), \ FN(seq_printf), \ FN(seq_write), \ FN(sk_cgroup_id), \ FN(sk_ancestor_cgroup_id), \ FN(ringbuf_output), \ FN(ringbuf_reserve), \ FN(ringbuf_submit), \ FN(ringbuf_discard), \ FN(ringbuf_query), \ FN(csum_level), \ FN(skc_to_tcp6_sock), \ FN(skc_to_tcp_sock), \ FN(skc_to_tcp_timewait_sock), \ FN(skc_to_tcp_request_sock), \ FN(skc_to_udp6_sock), \ FN(get_task_stack), \ FN(load_hdr_opt), \ FN(store_hdr_opt), \ FN(reserve_hdr_opt), \ FN(inode_storage_get), \ FN(inode_storage_delete), \ FN(d_path), \ FN(copy_from_user), \ FN(snprintf_btf), \ FN(seq_printf_btf), \ FN(skb_cgroup_classid), \ FN(redirect_neigh), \ FN(per_cpu_ptr), \ FN(this_cpu_ptr), \ FN(redirect_peer), \ FN(task_storage_get), \ FN(task_storage_delete), \ FN(get_current_task_btf), \ FN(bprm_opts_set), \ FN(ktime_get_coarse_ns), \ FN(ima_inode_hash), \ FN(sock_from_file), \ FN(check_mtu), \ FN(for_each_map_elem), \ FN(snprintf), \ FN(sys_bpf), \ FN(btf_find_by_name_kind), \ FN(sys_close), \ /* */ /* integer value in 'imm' field of BPF_CALL instruction selects which helper * function eBPF program intends to call */ #define __BPF_ENUM_FN(x) BPF_FUNC_ ## x enum bpf_func_id { __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, }; #undef __BPF_ENUM_FN /* All flags used by eBPF helper functions, placed here. */ /* BPF_FUNC_skb_store_bytes flags. */ enum { BPF_F_RECOMPUTE_CSUM = (1ULL << 0), BPF_F_INVALIDATE_HASH = (1ULL << 1), }; /* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags. * First 4 bits are for passing the header field size. */ enum { BPF_F_HDR_FIELD_MASK = 0xfULL, }; /* BPF_FUNC_l4_csum_replace flags. */ enum { BPF_F_PSEUDO_HDR = (1ULL << 4), BPF_F_MARK_MANGLED_0 = (1ULL << 5), BPF_F_MARK_ENFORCE = (1ULL << 6), }; /* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */ enum { BPF_F_INGRESS = (1ULL << 0), }; /* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ enum { BPF_F_TUNINFO_IPV6 = (1ULL << 0), }; /* flags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack. */ enum { BPF_F_SKIP_FIELD_MASK = 0xffULL, BPF_F_USER_STACK = (1ULL << 8), /* flags used by BPF_FUNC_get_stackid only. */ BPF_F_FAST_STACK_CMP = (1ULL << 9), BPF_F_REUSE_STACKID = (1ULL << 10), /* flags used by BPF_FUNC_get_stack only. */ BPF_F_USER_BUILD_ID = (1ULL << 11), }; /* BPF_FUNC_skb_set_tunnel_key flags. */ enum { BPF_F_ZERO_CSUM_TX = (1ULL << 1), BPF_F_DONT_FRAGMENT = (1ULL << 2), BPF_F_SEQ_NUMBER = (1ULL << 3), }; /* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and * BPF_FUNC_perf_event_read_value flags. */ enum { BPF_F_INDEX_MASK = 0xffffffffULL, BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK, /* BPF_FUNC_perf_event_output for sk_buff input context. */ BPF_F_CTXLEN_MASK = (0xfffffULL << 32), }; /* Current network namespace */ enum { BPF_F_CURRENT_NETNS = (-1L), }; /* BPF_FUNC_csum_level level values. */ enum { BPF_CSUM_LEVEL_QUERY, BPF_CSUM_LEVEL_INC, BPF_CSUM_LEVEL_DEC, BPF_CSUM_LEVEL_RESET, }; /* BPF_FUNC_skb_adjust_room flags. */ enum { BPF_F_ADJ_ROOM_FIXED_GSO = (1ULL << 0), BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = (1ULL << 1), BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = (1ULL << 2), BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3), BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4), BPF_F_ADJ_ROOM_NO_CSUM_RESET = (1ULL << 5), BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6), }; enum { BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff, BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 56, }; #define BPF_F_ADJ_ROOM_ENCAP_L2(len) (((__u64)len & \ BPF_ADJ_ROOM_ENCAP_L2_MASK) \ << BPF_ADJ_ROOM_ENCAP_L2_SHIFT) /* BPF_FUNC_sysctl_get_name flags. */ enum { BPF_F_SYSCTL_BASE_NAME = (1ULL << 0), }; /* BPF_FUNC_<kernel_obj>_storage_get flags */ enum { BPF_LOCAL_STORAGE_GET_F_CREATE = (1ULL << 0), /* BPF_SK_STORAGE_GET_F_CREATE is only kept for backward compatibility * and BPF_LOCAL_STORAGE_GET_F_CREATE must be used instead. */ BPF_SK_STORAGE_GET_F_CREATE = BPF_LOCAL_STORAGE_GET_F_CREATE, }; /* BPF_FUNC_read_branch_records flags. */ enum { BPF_F_GET_BRANCH_RECORDS_SIZE = (1ULL << 0), }; /* BPF_FUNC_bpf_ringbuf_commit, BPF_FUNC_bpf_ringbuf_discard, and * BPF_FUNC_bpf_ringbuf_output flags. */ enum { BPF_RB_NO_WAKEUP = (1ULL << 0), BPF_RB_FORCE_WAKEUP = (1ULL << 1), }; /* BPF_FUNC_bpf_ringbuf_query flags */ enum { BPF_RB_AVAIL_DATA = 0, BPF_RB_RING_SIZE = 1, BPF_RB_CONS_POS = 2, BPF_RB_PROD_POS = 3, }; /* BPF ring buffer constants */ enum { BPF_RINGBUF_BUSY_BIT = (1U << 31), BPF_RINGBUF_DISCARD_BIT = (1U << 30), BPF_RINGBUF_HDR_SZ = 8, }; /* BPF_FUNC_sk_assign flags in bpf_sk_lookup context. */ enum { BPF_SK_LOOKUP_F_REPLACE = (1ULL << 0), BPF_SK_LOOKUP_F_NO_REUSEPORT = (1ULL << 1), }; /* Mode for BPF_FUNC_skb_adjust_room helper. */ enum bpf_adj_room_mode { BPF_ADJ_ROOM_NET, BPF_ADJ_ROOM_MAC, }; /* Mode for BPF_FUNC_skb_load_bytes_relative helper. */ enum bpf_hdr_start_off { BPF_HDR_START_MAC, BPF_HDR_START_NET, }; /* Encapsulation type for BPF_FUNC_lwt_push_encap helper. */ enum bpf_lwt_encap_mode { BPF_LWT_ENCAP_SEG6, BPF_LWT_ENCAP_SEG6_INLINE, BPF_LWT_ENCAP_IP, }; /* Flags for bpf_bprm_opts_set helper */ enum { BPF_F_BPRM_SECUREEXEC = (1ULL << 0), }; /* Flags for bpf_redirect_map helper */ enum { BPF_F_BROADCAST = (1ULL << 3), BPF_F_EXCLUDE_INGRESS = (1ULL << 4), }; #define __bpf_md_ptr(type, name) \ union { \ type name; \ __u64 :64; \ } __attribute__((aligned(8))) /* user accessible mirror of in-kernel sk_buff. * new fields can only be added to the end of this structure */ struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 queue_mapping; __u32 protocol; __u32 vlan_present; __u32 vlan_tci; __u32 vlan_proto; __u32 priority; __u32 ingress_ifindex; __u32 ifindex; __u32 tc_index; __u32 cb[5]; __u32 hash; __u32 tc_classid; __u32 data; __u32 data_end; __u32 napi_id; /* Accessed by BPF_PROG_TYPE_sk_skb types from here to ... */ __u32 family; __u32 remote_ip4; /* Stored in network byte order */ __u32 local_ip4; /* Stored in network byte order */ __u32 remote_ip6[4]; /* Stored in network byte order */ __u32 local_ip6[4]; /* Stored in network byte order */ __u32 remote_port; /* Stored in network byte order */ __u32 local_port; /* stored in host byte order */ /* ... here. */ __u32 data_meta; __bpf_md_ptr(struct bpf_flow_keys *, flow_keys); __u64 tstamp; __u32 wire_len; __u32 gso_segs; __bpf_md_ptr(struct bpf_sock *, sk); __u32 gso_size; }; struct bpf_tunnel_key { __u32 tunnel_id; union { __u32 remote_ipv4; __u32 remote_ipv6[4]; }; __u8 tunnel_tos; __u8 tunnel_ttl; __u16 tunnel_ext; /* Padding, future use. */ __u32 tunnel_label; }; /* user accessible mirror of in-kernel xfrm_state. * new fields can only be added to the end of this structure */ struct bpf_xfrm_state { __u32 reqid; __u32 spi; /* Stored in network byte order */ __u16 family; __u16 ext; /* Padding, future use. */ union { __u32 remote_ipv4; /* Stored in network byte order */ __u32 remote_ipv6[4]; /* Stored in network byte order */ }; }; /* Generic BPF return codes which all BPF program types may support. * The values are binary compatible with their TC_ACT_* counter-part to * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT * programs. * * XDP is handled seprately, see XDP_*. */ enum bpf_ret_code { BPF_OK = 0, /* 1 reserved */ BPF_DROP = 2, /* 3-6 reserved */ BPF_REDIRECT = 7, /* >127 are reserved for prog type specific return codes. * * BPF_LWT_REROUTE: used by BPF_PROG_TYPE_LWT_IN and * BPF_PROG_TYPE_LWT_XMIT to indicate that skb had been * changed and should be routed based on its new L3 header. * (This is an L3 redirect, as opposed to L2 redirect * represented by BPF_REDIRECT above). */ BPF_LWT_REROUTE = 128, }; struct bpf_sock { __u32 bound_dev_if; __u32 family; __u32 type; __u32 protocol; __u32 mark; __u32 priority; /* IP address also allows 1 and 2 bytes access */ __u32 src_ip4; __u32 src_ip6[4]; __u32 src_port; /* host byte order */ __u32 dst_port; /* network byte order */ __u32 dst_ip4; __u32 dst_ip6[4]; __u32 state; __s32 rx_queue_mapping; }; struct bpf_tcp_sock { __u32 snd_cwnd; /* Sending congestion window */ __u32 srtt_us; /* smoothed round trip time << 3 in usecs */ __u32 rtt_min; __u32 snd_ssthresh; /* Slow start size threshold */ __u32 rcv_nxt; /* What we want to receive next */ __u32 snd_nxt; /* Next sequence we send */ __u32 snd_una; /* First byte we want an ack for */ __u32 mss_cache; /* Cached effective mss, not including SACKS */ __u32 ecn_flags; /* ECN status bits. */ __u32 rate_delivered; /* saved rate sample: packets delivered */ __u32 rate_interval_us; /* saved rate sample: time elapsed */ __u32 packets_out; /* Packets which are "in flight" */ __u32 retrans_out; /* Retransmitted packets out */ __u32 total_retrans; /* Total retransmits for entire connection */ __u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn * total number of segments in. */ __u32 data_segs_in; /* RFC4898 tcpEStatsPerfDataSegsIn * total number of data segments in. */ __u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut * The total number of segments sent. */ __u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut * total number of data segments sent. */ __u32 lost_out; /* Lost packets */ __u32 sacked_out; /* SACK'd packets */ __u64 bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived * sum(delta(rcv_nxt)), or how many bytes * were acked. */ __u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked * sum(delta(snd_una)), or how many bytes * were acked. */ __u32 dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups * total number of DSACK blocks received */ __u32 delivered; /* Total data packets delivered incl. rexmits */ __u32 delivered_ce; /* Like the above but only ECE marked packets */ __u32 icsk_retransmits; /* Number of unrecovered [RTO] timeouts */ }; struct bpf_sock_tuple { union { struct { __be32 saddr; __be32 daddr; __be16 sport; __be16 dport; } ipv4; struct { __be32 saddr[4]; __be32 daddr[4]; __be16 sport; __be16 dport; } ipv6; }; }; struct bpf_xdp_sock { __u32 queue_id; }; #define XDP_PACKET_HEADROOM 256 /* User return codes for XDP prog type. * A valid XDP program must return one of these defined values. All other * return codes are reserved for future use. Unknown return codes will * result in packet drops and a warning via bpf_warn_invalid_xdp_action(). */ enum xdp_action { XDP_ABORTED = 0, XDP_DROP, XDP_PASS, XDP_TX, XDP_REDIRECT, }; /* user accessible metadata for XDP packet hook * new fields must be added to the end of this structure */ struct xdp_md { __u32 data; __u32 data_end; __u32 data_meta; /* Below access go through struct xdp_rxq_info */ __u32 ingress_ifindex; /* rxq->dev->ifindex */ __u32 rx_queue_index; /* rxq->queue_index */ __u32 egress_ifindex; /* txq->dev->ifindex */ }; /* DEVMAP map-value layout * * The struct data-layout of map-value is a configuration interface. * New members can only be added to the end of this structure. */ struct bpf_devmap_val { __u32 ifindex; /* device index */ union { int fd; /* prog fd on map write */ __u32 id; /* prog id on map read */ } bpf_prog; }; /* CPUMAP map-value layout * * The struct data-layout of map-value is a configuration interface. * New members can only be added to the end of this structure. */ struct bpf_cpumap_val { __u32 qsize; /* queue size to remote target CPU */ union { int fd; /* prog fd on map write */ __u32 id; /* prog id on map read */ } bpf_prog; }; enum sk_action { SK_DROP = 0, SK_PASS, }; /* user accessible metadata for SK_MSG packet hook, new fields must * be added to the end of this structure */ struct sk_msg_md { __bpf_md_ptr(void *, data); __bpf_md_ptr(void *, data_end); __u32 family; __u32 remote_ip4; /* Stored in network byte order */ __u32 local_ip4; /* Stored in network byte order */ __u32 remote_ip6[4]; /* Stored in network byte order */ __u32 local_ip6[4]; /* Stored in network byte order */ __u32 remote_port; /* Stored in network byte order */ __u32 local_port; /* stored in host byte order */ __u32 size; /* Total size of sk_msg */ __bpf_md_ptr(struct bpf_sock *, sk); /* current socket */ }; struct sk_reuseport_md { /* * Start of directly accessible data. It begins from * the tcp/udp header. */ __bpf_md_ptr(void *, data); /* End of directly accessible data */ __bpf_md_ptr(void *, data_end); /* * Total length of packet (starting from the tcp/udp header). * Note that the directly accessible bytes (data_end - data) * could be less than this "len". Those bytes could be * indirectly read by a helper "bpf_skb_load_bytes()". */ __u32 len; /* * Eth protocol in the mac header (network byte order). e.g. * ETH_P_IP(0x0800) and ETH_P_IPV6(0x86DD) */ __u32 eth_protocol; __u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */ __u32 bind_inany; /* Is sock bound to an INANY address? */ __u32 hash; /* A hash of the packet 4 tuples */ __bpf_md_ptr(struct bpf_sock *, sk); }; #define BPF_TAG_SIZE 8 struct bpf_prog_info { __u32 type; __u32 id; __u8 tag[BPF_TAG_SIZE]; __u32 jited_prog_len; __u32 xlated_prog_len; __aligned_u64 jited_prog_insns; __aligned_u64 xlated_prog_insns; __u64 load_time; /* ns since boottime */ __u32 created_by_uid; __u32 nr_map_ids; __aligned_u64 map_ids; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; __u32 gpl_compatible:1; __u32 :31; /* alignment pad */ __u64 netns_dev; __u64 netns_ino; __u32 nr_jited_ksyms; __u32 nr_jited_func_lens; __aligned_u64 jited_ksyms; __aligned_u64 jited_func_lens; __u32 btf_id; __u32 func_info_rec_size; __aligned_u64 func_info; __u32 nr_func_info; __u32 nr_line_info; __aligned_u64 line_info; __aligned_u64 jited_line_info; __u32 nr_jited_line_info; __u32 line_info_rec_size; __u32 jited_line_info_rec_size; __u32 nr_prog_tags; __aligned_u64 prog_tags; __u64 run_time_ns; __u64 run_cnt; __u64 recursion_misses; } __attribute__((aligned(8))); struct bpf_map_info { __u32 type; __u32 id; __u32 key_size; __u32 value_size; __u32 max_entries; __u32 map_flags; char name[BPF_OBJ_NAME_LEN]; __u32 ifindex; __u32 btf_vmlinux_value_type_id; __u64 netns_dev; __u64 netns_ino; __u32 btf_id; __u32 btf_key_type_id; __u32 btf_value_type_id; } __attribute__((aligned(8))); struct bpf_btf_info { __aligned_u64 btf; __u32 btf_size; __u32 id; __aligned_u64 name; __u32 name_len; __u32 kernel_btf; } __attribute__((aligned(8))); struct bpf_link_info { __u32 type; __u32 id; __u32 prog_id; union { struct { __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */ __u32 tp_name_len; /* in/out: tp_name buffer len */ } raw_tracepoint; struct { __u32 attach_type; __u32 target_obj_id; /* prog_id for PROG_EXT, otherwise btf object id */ __u32 target_btf_id; /* BTF type id inside the object */ } tracing; struct { __u64 cgroup_id; __u32 attach_type; } cgroup; struct { __aligned_u64 target_name; /* in/out: target_name buffer ptr */ __u32 target_name_len; /* in/out: target_name buffer len */ union { struct { __u32 map_id; } map; }; } iter; struct { __u32 netns_ino; __u32 attach_type; } netns; struct { __u32 ifindex; } xdp; }; } __attribute__((aligned(8))); /* User bpf_sock_addr struct to access socket fields and sockaddr struct passed * by user and intended to be used by socket (e.g. to bind to, depends on * attach type). */ struct bpf_sock_addr { __u32 user_family; /* Allows 4-byte read, but no write. */ __u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write. * Stored in network byte order. */ __u32 user_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write. * Stored in network byte order. */ __u32 user_port; /* Allows 1,2,4-byte read and 4-byte write. * Stored in network byte order */ __u32 family; /* Allows 4-byte read, but no write */ __u32 type; /* Allows 4-byte read, but no write */ __u32 protocol; /* Allows 4-byte read, but no write */ __u32 msg_src_ip4; /* Allows 1,2,4-byte read and 4-byte write. * Stored in network byte order. */ __u32 msg_src_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write. * Stored in network byte order. */ __bpf_md_ptr(struct bpf_sock *, sk); }; /* User bpf_sock_ops struct to access socket values and specify request ops * and their replies. * Some of this fields are in network (bigendian) byte order and may need * to be converted before use (bpf_ntohl() defined in samples/bpf/bpf_endian.h). * New fields can only be added at the end of this structure */ struct bpf_sock_ops { __u32 op; union { __u32 args[4]; /* Optionally passed to bpf program */ __u32 reply; /* Returned by bpf program */ __u32 replylong[4]; /* Optionally returned by bpf prog */ }; __u32 family; __u32 remote_ip4; /* Stored in network byte order */ __u32 local_ip4; /* Stored in network byte order */ __u32 remote_ip6[4]; /* Stored in network byte order */ __u32 local_ip6[4]; /* Stored in network byte order */ __u32 remote_port; /* Stored in network byte order */ __u32 local_port; /* stored in host byte order */ __u32 is_fullsock; /* Some TCP fields are only valid if * there is a full socket. If not, the * fields read as zero. */ __u32 snd_cwnd; __u32 srtt_us; /* Averaged RTT << 3 in usecs */ __u32 bpf_sock_ops_cb_flags; /* flags defined in uapi/linux/tcp.h */ __u32 state; __u32 rtt_min; __u32 snd_ssthresh; __u32 rcv_nxt; __u32 snd_nxt; __u32 snd_una; __u32 mss_cache; __u32 ecn_flags; __u32 rate_delivered; __u32 rate_interval_us; __u32 packets_out; __u32 retrans_out; __u32 total_retrans; __u32 segs_in; __u32 data_segs_in; __u32 segs_out; __u32 data_segs_out; __u32 lost_out; __u32 sacked_out; __u32 sk_txhash; __u64 bytes_received; __u64 bytes_acked; __bpf_md_ptr(struct bpf_sock *, sk); /* [skb_data, skb_data_end) covers the whole TCP header. * * BPF_SOCK_OPS_PARSE_HDR_OPT_CB: The packet received * BPF_SOCK_OPS_HDR_OPT_LEN_CB: Not useful because the * header has not been written. * BPF_SOCK_OPS_WRITE_HDR_OPT_CB: The header and options have * been written so far. * BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB: The SYNACK that concludes * the 3WHS. * BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB: The ACK that concludes * the 3WHS. * * bpf_load_hdr_opt() can also be used to read a particular option. */ __bpf_md_ptr(void *, skb_data); __bpf_md_ptr(void *, skb_data_end); __u32 skb_len; /* The total length of a packet. * It includes the header, options, * and payload. */ __u32 skb_tcp_flags; /* tcp_flags of the header. It provides * an easy way to check for tcp_flags * without parsing skb_data. * * In particular, the skb_tcp_flags * will still be available in * BPF_SOCK_OPS_HDR_OPT_LEN even though * the outgoing header has not * been written yet. */ }; /* Definitions for bpf_sock_ops_cb_flags */ enum { BPF_SOCK_OPS_RTO_CB_FLAG = (1<<0), BPF_SOCK_OPS_RETRANS_CB_FLAG = (1<<1), BPF_SOCK_OPS_STATE_CB_FLAG = (1<<2), BPF_SOCK_OPS_RTT_CB_FLAG = (1<<3), /* Call bpf for all received TCP headers. The bpf prog will be * called under sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB * * Please refer to the comment in BPF_SOCK_OPS_PARSE_HDR_OPT_CB * for the header option related helpers that will be useful * to the bpf programs. * * It could be used at the client/active side (i.e. connect() side) * when the server told it that the server was in syncookie * mode and required the active side to resend the bpf-written * options. The active side can keep writing the bpf-options until * it received a valid packet from the server side to confirm * the earlier packet (and options) has been received. The later * example patch is using it like this at the active side when the * server is in syncookie mode. * * The bpf prog will usually turn this off in the common cases. */ BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG = (1<<4), /* Call bpf when kernel has received a header option that * the kernel cannot handle. The bpf prog will be called under * sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB. * * Please refer to the comment in BPF_SOCK_OPS_PARSE_HDR_OPT_CB * for the header option related helpers that will be useful * to the bpf programs. */ BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG = (1<<5), /* Call bpf when the kernel is writing header options for the * outgoing packet. The bpf prog will first be called * to reserve space in a skb under * sock_ops->op == BPF_SOCK_OPS_HDR_OPT_LEN_CB. Then * the bpf prog will be called to write the header option(s) * under sock_ops->op == BPF_SOCK_OPS_WRITE_HDR_OPT_CB. * * Please refer to the comment in BPF_SOCK_OPS_HDR_OPT_LEN_CB * and BPF_SOCK_OPS_WRITE_HDR_OPT_CB for the header option * related helpers that will be useful to the bpf programs. * * The kernel gets its chance to reserve space and write * options first before the BPF program does. */ BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = (1<<6), /* Mask of all currently supported cb flags */ BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F, }; /* List of known BPF sock_ops operators. * New entries can only be added at the end */ enum { BPF_SOCK_OPS_VOID, BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or * -1 if default value should be used */ BPF_SOCK_OPS_RWND_INIT, /* Should return initial advertized * window (in packets) or -1 if default * value should be used */ BPF_SOCK_OPS_TCP_CONNECT_CB, /* Calls BPF program right before an * active connection is initialized */ BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, /* Calls BPF program when an * active connection is * established */ BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, /* Calls BPF program when a * passive connection is * established */ BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control * needs ECN */ BPF_SOCK_OPS_BASE_RTT, /* Get base RTT. The correct value is * based on the path and may be * dependent on the congestion control * algorithm. In general it indicates * a congestion threshold. RTTs above * this indicate congestion */ BPF_SOCK_OPS_RTO_CB, /* Called when an RTO has triggered. * Arg1: value of icsk_retransmits * Arg2: value of icsk_rto * Arg3: whether RTO has expired */ BPF_SOCK_OPS_RETRANS_CB, /* Called when skb is retransmitted. * Arg1: sequence number of 1st byte * Arg2: # segments * Arg3: return value of * tcp_transmit_skb (0 => success) */ BPF_SOCK_OPS_STATE_CB, /* Called when TCP changes state. * Arg1: old_state * Arg2: new_state */ BPF_SOCK_OPS_TCP_LISTEN_CB, /* Called on listen(2), right after * socket transition to LISTEN state. */ BPF_SOCK_OPS_RTT_CB, /* Called on every RTT. */ BPF_SOCK_OPS_PARSE_HDR_OPT_CB, /* Parse the header option. * It will be called to handle * the packets received at * an already established * connection. * * sock_ops->skb_data: * Referring to the received skb. * It covers the TCP header only. * * bpf_load_hdr_opt() can also * be used to search for a * particular option. */ BPF_SOCK_OPS_HDR_OPT_LEN_CB, /* Reserve space for writing the * header option later in * BPF_SOCK_OPS_WRITE_HDR_OPT_CB. * Arg1: bool want_cookie. (in * writing SYNACK only) * * sock_ops->skb_data: * Not available because no header has * been written yet. * * sock_ops->skb_tcp_flags: * The tcp_flags of the * outgoing skb. (e.g. SYN, ACK, FIN). * * bpf_reserve_hdr_opt() should * be used to reserve space. */ BPF_SOCK_OPS_WRITE_HDR_OPT_CB, /* Write the header options * Arg1: bool want_cookie. (in * writing SYNACK only) * * sock_ops->skb_data: * Referring to the outgoing skb. * It covers the TCP header * that has already been written * by the kernel and the * earlier bpf-progs. * * sock_ops->skb_tcp_flags: * The tcp_flags of the outgoing * skb. (e.g. SYN, ACK, FIN). * * bpf_store_hdr_opt() should * be used to write the * option. * * bpf_load_hdr_opt() can also * be used to search for a * particular option that * has already been written * by the kernel or the * earlier bpf-progs. */ }; /* List of TCP states. There is a build check in net/ipv4/tcp.c to detect * changes between the TCP and BPF versions. Ideally this should never happen. * If it does, we need to add code to convert them before calling * the BPF sock_ops function. */ enum { BPF_TCP_ESTABLISHED = 1, BPF_TCP_SYN_SENT, BPF_TCP_SYN_RECV, BPF_TCP_FIN_WAIT1, BPF_TCP_FIN_WAIT2, BPF_TCP_TIME_WAIT, BPF_TCP_CLOSE, BPF_TCP_CLOSE_WAIT, BPF_TCP_LAST_ACK, BPF_TCP_LISTEN, BPF_TCP_CLOSING, /* Now a valid state */ BPF_TCP_NEW_SYN_RECV, BPF_TCP_BOUND_INACTIVE, BPF_TCP_MAX_STATES /* Leave at the end! */ }; enum { TCP_BPF_IW = 1001, /* Set TCP initial congestion window */ TCP_BPF_SNDCWND_CLAMP = 1002, /* Set sndcwnd_clamp */ TCP_BPF_DELACK_MAX = 1003, /* Max delay ack in usecs */ TCP_BPF_RTO_MIN = 1004, /* Min delay ack in usecs */ /* Copy the SYN pkt to optval * * BPF_PROG_TYPE_SOCK_OPS only. It is similar to the * bpf_getsockopt(TCP_SAVED_SYN) but it does not limit * to only getting from the saved_syn. It can either get the * syn packet from: * * 1. the just-received SYN packet (only available when writing the * SYNACK). It will be useful when it is not necessary to * save the SYN packet for latter use. It is also the only way * to get the SYN during syncookie mode because the syn * packet cannot be saved during syncookie. * * OR * * 2. the earlier saved syn which was done by * bpf_setsockopt(TCP_SAVE_SYN). * * The bpf_getsockopt(TCP_BPF_SYN*) option will hide where the * SYN packet is obtained. * * If the bpf-prog does not need the IP[46] header, the * bpf-prog can avoid parsing the IP header by using * TCP_BPF_SYN. Otherwise, the bpf-prog can get both * IP[46] and TCP header by using TCP_BPF_SYN_IP. * * >0: Total number of bytes copied * -ENOSPC: Not enough space in optval. Only optlen number of * bytes is copied. * -ENOENT: The SYN skb is not available now and the earlier SYN pkt * is not saved by setsockopt(TCP_SAVE_SYN). */ TCP_BPF_SYN = 1005, /* Copy the TCP header */ TCP_BPF_SYN_IP = 1006, /* Copy the IP[46] and TCP header */ TCP_BPF_SYN_MAC = 1007, /* Copy the MAC, IP[46], and TCP header */ }; enum { BPF_LOAD_HDR_OPT_TCP_SYN = (1ULL << 0), }; /* args[0] value during BPF_SOCK_OPS_HDR_OPT_LEN_CB and * BPF_SOCK_OPS_WRITE_HDR_OPT_CB. */ enum { BPF_WRITE_HDR_TCP_CURRENT_MSS = 1, /* Kernel is finding the * total option spaces * required for an established * sk in order to calculate the * MSS. No skb is actually * sent. */ BPF_WRITE_HDR_TCP_SYNACK_COOKIE = 2, /* Kernel is in syncookie mode * when sending a SYN. */ }; struct bpf_perf_event_value { __u64 counter; __u64 enabled; __u64 running; }; enum { BPF_DEVCG_ACC_MKNOD = (1ULL << 0), BPF_DEVCG_ACC_READ = (1ULL << 1), BPF_DEVCG_ACC_WRITE = (1ULL << 2), }; enum { BPF_DEVCG_DEV_BLOCK = (1ULL << 0), BPF_DEVCG_DEV_CHAR = (1ULL << 1), }; struct bpf_cgroup_dev_ctx { /* access_type encoded as (BPF_DEVCG_ACC_* << 16) | BPF_DEVCG_DEV_* */ __u32 access_type; __u32 major; __u32 minor; }; struct bpf_raw_tracepoint_args { __u64 args[0]; }; /* DIRECT: Skip the FIB rules and go to FIB table associated with device * OUTPUT: Do lookup from egress perspective; default is ingress */ enum { BPF_FIB_LOOKUP_DIRECT = (1U << 0), BPF_FIB_LOOKUP_OUTPUT = (1U << 1), }; enum { BPF_FIB_LKUP_RET_SUCCESS, /* lookup successful */ BPF_FIB_LKUP_RET_BLACKHOLE, /* dest is blackholed; can be dropped */ BPF_FIB_LKUP_RET_UNREACHABLE, /* dest is unreachable; can be dropped */ BPF_FIB_LKUP_RET_PROHIBIT, /* dest not allowed; can be dropped */ BPF_FIB_LKUP_RET_NOT_FWDED, /* packet is not forwarded */ BPF_FIB_LKUP_RET_FWD_DISABLED, /* fwding is not enabled on ingress */ BPF_FIB_LKUP_RET_UNSUPP_LWT, /* fwd requires encapsulation */ BPF_FIB_LKUP_RET_NO_NEIGH, /* no neighbor entry for nh */ BPF_FIB_LKUP_RET_FRAG_NEEDED, /* fragmentation required to fwd */ }; struct bpf_fib_lookup { /* input: network family for lookup (AF_INET, AF_INET6) * output: network family of egress nexthop */ __u8 family; /* set if lookup is to consider L4 data - e.g., FIB rules */ __u8 l4_protocol; __be16 sport; __be16 dport; union { /* used for MTU check */ /* input to lookup */ __u16 tot_len; /* L3 length from network hdr (iph->tot_len) */ /* output: MTU value */ __u16 mtu_result; }; /* input: L3 device index for lookup * output: device index from FIB lookup */ __u32 ifindex; union { /* inputs to lookup */ __u8 tos; /* AF_INET */ __be32 flowinfo; /* AF_INET6, flow_label + priority */ /* output: metric of fib result (IPv4/IPv6 only) */ __u32 rt_metric; }; union { __be32 ipv4_src; __u32 ipv6_src[4]; /* in6_addr; network order */ }; /* input to bpf_fib_lookup, ipv{4,6}_dst is destination address in * network header. output: bpf_fib_lookup sets to gateway address * if FIB lookup returns gateway route */ union { __be32 ipv4_dst; __u32 ipv6_dst[4]; /* in6_addr; network order */ }; /* output */ __be16 h_vlan_proto; __be16 h_vlan_TCI; __u8 smac[6]; /* ETH_ALEN */ __u8 dmac[6]; /* ETH_ALEN */ }; struct bpf_redir_neigh { /* network family for lookup (AF_INET, AF_INET6) */ __u32 nh_family; /* network address of nexthop; skips fib lookup to find gateway */ union { __be32 ipv4_nh; __u32 ipv6_nh[4]; /* in6_addr; network order */ }; }; /* bpf_check_mtu flags*/ enum bpf_check_mtu_flags { BPF_MTU_CHK_SEGS = (1U << 0), }; enum bpf_check_mtu_ret { BPF_MTU_CHK_RET_SUCCESS, /* check and lookup successful */ BPF_MTU_CHK_RET_FRAG_NEEDED, /* fragmentation required to fwd */ BPF_MTU_CHK_RET_SEGS_TOOBIG, /* GSO re-segmentation needed to fwd */ }; enum bpf_task_fd_type { BPF_FD_TYPE_RAW_TRACEPOINT, /* tp name */ BPF_FD_TYPE_TRACEPOINT, /* tp name */ BPF_FD_TYPE_KPROBE, /* (symbol + offset) or addr */ BPF_FD_TYPE_KRETPROBE, /* (symbol + offset) or addr */ BPF_FD_TYPE_UPROBE, /* filename + offset */ BPF_FD_TYPE_URETPROBE, /* filename + offset */ }; enum { BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = (1U << 0), BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = (1U << 1), BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = (1U << 2), }; struct bpf_flow_keys { __u16 nhoff; __u16 thoff; __u16 addr_proto; /* ETH_P_* of valid addrs */ __u8 is_frag; __u8 is_first_frag; __u8 is_encap; __u8 ip_proto; __be16 n_proto; __be16 sport; __be16 dport; union { struct { __be32 ipv4_src; __be32 ipv4_dst; }; struct { __u32 ipv6_src[4]; /* in6_addr; network order */ __u32 ipv6_dst[4]; /* in6_addr; network order */ }; }; __u32 flags; __be32 flow_label; }; struct bpf_func_info { __u32 insn_off; __u32 type_id; }; #define BPF_LINE_INFO_LINE_NUM(line_col) ((line_col) >> 10) #define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff) struct bpf_line_info { __u32 insn_off; __u32 file_name_off; __u32 line_off; __u32 line_col; }; struct bpf_spin_lock { __u32 val; }; struct bpf_sysctl { __u32 write; /* Sysctl is being read (= 0) or written (= 1). * Allows 1,2,4-byte read, but no write. */ __u32 file_pos; /* Sysctl file position to read from, write to. * Allows 1,2,4-byte read an 4-byte write. */ }; struct bpf_sockopt { __bpf_md_ptr(struct bpf_sock *, sk); __bpf_md_ptr(void *, optval); __bpf_md_ptr(void *, optval_end); __s32 level; __s32 optname; __s32 optlen; __s32 retval; }; struct bpf_pidns_info { __u32 pid; __u32 tgid; }; /* User accessible data for SK_LOOKUP programs. Add new fields at the end. */ struct bpf_sk_lookup { union { __bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */ __u64 cookie; /* Non-zero if socket was selected in PROG_TEST_RUN */ }; __u32 family; /* Protocol family (AF_INET, AF_INET6) */ __u32 protocol; /* IP protocol (IPPROTO_TCP, IPPROTO_UDP) */ __u32 remote_ip4; /* Network byte order */ __u32 remote_ip6[4]; /* Network byte order */ __u32 remote_port; /* Network byte order */ __u32 local_ip4; /* Network byte order */ __u32 local_ip6[4]; /* Network byte order */ __u32 local_port; /* Host byte order */ }; /* * struct btf_ptr is used for typed pointer representation; the * type id is used to render the pointer data as the appropriate type * via the bpf_snprintf_btf() helper described above. A flags field - * potentially to specify additional details about the BTF pointer * (rather than its mode of display) - is included for future use. * Display flags - BTF_F_* - are passed to bpf_snprintf_btf separately. */ struct btf_ptr { void *ptr; __u32 type_id; __u32 flags; /* BTF ptr flags; unused at present. */ }; /* * Flags to control bpf_snprintf_btf() behaviour. * - BTF_F_COMPACT: no formatting around type information * - BTF_F_NONAME: no struct/union member names/types * - BTF_F_PTR_RAW: show raw (unobfuscated) pointer values; * equivalent to %px. * - BTF_F_ZERO: show zero-valued struct/union members; they * are not displayed by default */ enum { BTF_F_COMPACT = (1ULL << 0), BTF_F_NONAME = (1ULL << 1), BTF_F_PTR_RAW = (1ULL << 2), BTF_F_ZERO = (1ULL << 3), }; #endif /* __LINUX_BPF_H__ */ linux/bpf_common.h 0000644 00000002527 15063602060 0010177 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __LINUX_BPF_COMMON_H__ #define __LINUX_BPF_COMMON_H__ /* Instruction classes */ #define BPF_CLASS(code) ((code) & 0x07) #define BPF_LD 0x00 #define BPF_LDX 0x01 #define BPF_ST 0x02 #define BPF_STX 0x03 #define BPF_ALU 0x04 #define BPF_JMP 0x05 #define BPF_RET 0x06 #define BPF_MISC 0x07 /* ld/ldx fields */ #define BPF_SIZE(code) ((code) & 0x18) #define BPF_W 0x00 /* 32-bit */ #define BPF_H 0x08 /* 16-bit */ #define BPF_B 0x10 /* 8-bit */ /* eBPF BPF_DW 0x18 64-bit */ #define BPF_MODE(code) ((code) & 0xe0) #define BPF_IMM 0x00 #define BPF_ABS 0x20 #define BPF_IND 0x40 #define BPF_MEM 0x60 #define BPF_LEN 0x80 #define BPF_MSH 0xa0 /* alu/jmp fields */ #define BPF_OP(code) ((code) & 0xf0) #define BPF_ADD 0x00 #define BPF_SUB 0x10 #define BPF_MUL 0x20 #define BPF_DIV 0x30 #define BPF_OR 0x40 #define BPF_AND 0x50 #define BPF_LSH 0x60 #define BPF_RSH 0x70 #define BPF_NEG 0x80 #define BPF_MOD 0x90 #define BPF_XOR 0xa0 #define BPF_JA 0x00 #define BPF_JEQ 0x10 #define BPF_JGT 0x20 #define BPF_JGE 0x30 #define BPF_JSET 0x40 #define BPF_SRC(code) ((code) & 0x08) #define BPF_K 0x00 #define BPF_X 0x08 #ifndef BPF_MAXINSNS #define BPF_MAXINSNS 4096 #endif #endif /* __LINUX_BPF_COMMON_H__ */ linux/bpf_perf_event.h 0000644 00000001021 15063602060 0011030 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2016 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #ifndef __LINUX_BPF_PERF_EVENT_H__ #define __LINUX_BPF_PERF_EVENT_H__ #include <asm/bpf_perf_event.h> struct bpf_perf_event_data { bpf_user_pt_regs_t regs; __u64 sample_period; __u64 addr; }; #endif /* __LINUX_BPF_PERF_EVENT_H__ */ linux/bpfilter.h 0000644 00000000721 15063602060 0007661 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_BPFILTER_H #define _LINUX_BPFILTER_H #include <linux/if.h> enum { BPFILTER_IPT_SO_SET_REPLACE = 64, BPFILTER_IPT_SO_SET_ADD_COUNTERS = 65, BPFILTER_IPT_SET_MAX, }; enum { BPFILTER_IPT_SO_GET_INFO = 64, BPFILTER_IPT_SO_GET_ENTRIES = 65, BPFILTER_IPT_SO_GET_REVISION_MATCH = 66, BPFILTER_IPT_SO_GET_REVISION_TARGET = 67, BPFILTER_IPT_GET_MAX, }; #endif /* _LINUX_BPFILTER_H */ linux/bpqether.h 0000644 00000001725 15063602060 0007671 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __BPQETHER_H #define __BPQETHER_H /* * Defines for the BPQETHER pseudo device driver */ #include <linux/if_ether.h> #define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */ #define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1) struct bpq_ethaddr { unsigned char destination[ETH_ALEN]; unsigned char accept[ETH_ALEN]; }; /* * For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers, * currently not implemented, though. If someone wants to hook a radio * to his Ethernet card he may find this useful. ;-) */ #define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */ #define SIOCSBPQETHPARAM 0x5001 /* set */ struct bpq_req { int cmd; int speed; /* unused */ int clockmode; /* unused */ int txdelay; unsigned char persist; /* unused */ int slotime; /* unused */ int squeldelay; int dmachan; /* unused */ int irq; /* unused */ }; #endif linux/bsg.h 0000644 00000004676 15063602060 0006642 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef BSG_H #define BSG_H #include <linux/types.h> #define BSG_PROTOCOL_SCSI 0 #define BSG_SUB_PROTOCOL_SCSI_CMD 0 #define BSG_SUB_PROTOCOL_SCSI_TMF 1 #define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 /* * For flag constants below: * sg.h sg_io_hdr also has bits defined for it's flags member. These * two flag values (0x10 and 0x20) have the same meaning in sg.h . For * bsg the BSG_FLAG_Q_AT_HEAD flag is ignored since it is the deafult. */ #define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ #define BSG_FLAG_Q_AT_HEAD 0x20 struct sg_io_v4 { __s32 guard; /* [i] 'Q' to differentiate from v3 */ __u32 protocol; /* [i] 0 -> SCSI , .... */ __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task management function, .... */ __u32 request_len; /* [i] in bytes */ __u64 request; /* [i], [*i] {SCSI: cdb} */ __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ __u32 request_attr; /* [i] {SCSI: task attribute} */ __u32 request_priority; /* [i] {SCSI: task priority} */ __u32 request_extra; /* [i] {spare, for padding} */ __u32 max_response_len; /* [i] in bytes */ __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ /* "dout_": data out (to device); "din_": data in (from device) */ __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else dout_xfer points to array of iovec */ __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ __u32 din_xfer_len; /* [i] bytes to be transferred from device */ __u64 dout_xferp; /* [i], [*i] */ __u64 din_xferp; /* [i], [*o] */ __u32 timeout; /* [i] units: millisecond */ __u32 flags; /* [i] bit mask */ __u64 usr_ptr; /* [i->o] unused internally */ __u32 spare_in; /* [i] */ __u32 driver_status; /* [o] 0 -> ok */ __u32 transport_status; /* [o] 0 -> ok */ __u32 device_status; /* [o] {SCSI: command completion status} */ __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ __u32 info; /* [o] additional information */ __u32 duration; /* [o] time to complete, in milliseconds */ __u32 response_len; /* [o] bytes of response actually written */ __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ __u32 spare_out; /* [o] */ __u32 padding; }; #endif /* BSG_H */ linux/bt-bmc.h 0000644 00000001074 15063602060 0007220 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 2015-2016, IBM Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_BT_BMC_H #define _LINUX_BT_BMC_H #include <linux/ioctl.h> #define __BT_BMC_IOCTL_MAGIC 0xb1 #define BT_BMC_IOCTL_SMS_ATN _IO(__BT_BMC_IOCTL_MAGIC, 0x00) #endif /* _LINUX_BT_BMC_H */ linux/btf.h 0000644 00000011274 15063602060 0006632 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* Copyright (c) 2018 Facebook */ #ifndef __LINUX_BTF_H__ #define __LINUX_BTF_H__ #include <linux/types.h> #define BTF_MAGIC 0xeB9F #define BTF_VERSION 1 struct btf_header { __u16 magic; __u8 version; __u8 flags; __u32 hdr_len; /* All offsets are in bytes relative to the end of this header */ __u32 type_off; /* offset of type section */ __u32 type_len; /* length of type section */ __u32 str_off; /* offset of string section */ __u32 str_len; /* length of string section */ }; /* Max # of type identifier */ #define BTF_MAX_TYPE 0x000fffff /* Max offset into the string section */ #define BTF_MAX_NAME_OFFSET 0x00ffffff /* Max # of struct/union/enum members or func args */ #define BTF_MAX_VLEN 0xffff struct btf_type { __u32 name_off; /* "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd */ __u32 info; /* "size" is used by INT, ENUM, STRUCT, UNION and DATASEC. * "size" tells the size of the type it is describing. * * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT, * FUNC, FUNC_PROTO and VAR. * "type" is a type_id referring to another type. */ union { __u32 size; __u32 type; }; }; #define BTF_INFO_KIND(info) (((info) >> 24) & 0x1f) #define BTF_INFO_VLEN(info) ((info) & 0xffff) #define BTF_INFO_KFLAG(info) ((info) >> 31) #define BTF_KIND_UNKN 0 /* Unknown */ #define BTF_KIND_INT 1 /* Integer */ #define BTF_KIND_PTR 2 /* Pointer */ #define BTF_KIND_ARRAY 3 /* Array */ #define BTF_KIND_STRUCT 4 /* Struct */ #define BTF_KIND_UNION 5 /* Union */ #define BTF_KIND_ENUM 6 /* Enumeration */ #define BTF_KIND_FWD 7 /* Forward */ #define BTF_KIND_TYPEDEF 8 /* Typedef */ #define BTF_KIND_VOLATILE 9 /* Volatile */ #define BTF_KIND_CONST 10 /* Const */ #define BTF_KIND_RESTRICT 11 /* Restrict */ #define BTF_KIND_FUNC 12 /* Function */ #define BTF_KIND_FUNC_PROTO 13 /* Function Proto */ #define BTF_KIND_VAR 14 /* Variable */ #define BTF_KIND_DATASEC 15 /* Section */ #define BTF_KIND_FLOAT 16 /* Floating point */ #define BTF_KIND_MAX BTF_KIND_FLOAT #define NR_BTF_KINDS (BTF_KIND_MAX + 1) /* For some specific BTF_KIND, "struct btf_type" is immediately * followed by extra data. */ /* BTF_KIND_INT is followed by a u32 and the following * is the 32 bits arrangement: */ #define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24) #define BTF_INT_OFFSET(VAL) (((VAL) & 0x00ff0000) >> 16) #define BTF_INT_BITS(VAL) ((VAL) & 0x000000ff) /* Attributes stored in the BTF_INT_ENCODING */ #define BTF_INT_SIGNED (1 << 0) #define BTF_INT_CHAR (1 << 1) #define BTF_INT_BOOL (1 << 2) /* BTF_KIND_ENUM is followed by multiple "struct btf_enum". * The exact number of btf_enum is stored in the vlen (of the * info in "struct btf_type"). */ struct btf_enum { __u32 name_off; __s32 val; }; /* BTF_KIND_ARRAY is followed by one "struct btf_array" */ struct btf_array { __u32 type; __u32 index_type; __u32 nelems; }; /* BTF_KIND_STRUCT and BTF_KIND_UNION are followed * by multiple "struct btf_member". The exact number * of btf_member is stored in the vlen (of the info in * "struct btf_type"). */ struct btf_member { __u32 name_off; __u32 type; /* If the type info kind_flag is set, the btf_member offset * contains both member bitfield size and bit offset. The * bitfield size is set for bitfield members. If the type * info kind_flag is not set, the offset contains only bit * offset. */ __u32 offset; }; /* If the struct/union type info kind_flag is set, the * following two macros are used to access bitfield_size * and bit_offset from btf_member.offset. */ #define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24) #define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff) /* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param". * The exact number of btf_param is stored in the vlen (of the * info in "struct btf_type"). */ struct btf_param { __u32 name_off; __u32 type; }; enum { BTF_VAR_STATIC = 0, BTF_VAR_GLOBAL_ALLOCATED = 1, BTF_VAR_GLOBAL_EXTERN = 2, }; enum btf_func_linkage { BTF_FUNC_STATIC = 0, BTF_FUNC_GLOBAL = 1, BTF_FUNC_EXTERN = 2, }; /* BTF_KIND_VAR is followed by a single "struct btf_var" to describe * additional information related to the variable such as its linkage. */ struct btf_var { __u32 linkage; }; /* BTF_KIND_DATASEC is followed by multiple "struct btf_var_secinfo" * to describe all BTF_KIND_VAR types it contains along with it's * in-section offset as well as size. */ struct btf_var_secinfo { __u32 type; __u32 offset; __u32 size; }; #endif /* __LINUX_BTF_H__ */ linux/btrfs.h 0000644 00000070361 15063602060 0007201 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (C) 2007 Oracle. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #ifndef _LINUX_BTRFS_H #define _LINUX_BTRFS_H #include <linux/types.h> #include <linux/ioctl.h> #define BTRFS_IOCTL_MAGIC 0x94 #define BTRFS_VOL_NAME_MAX 255 #define BTRFS_LABEL_SIZE 256 /* this should be 4k */ #define BTRFS_PATH_NAME_MAX 4087 struct btrfs_ioctl_vol_args { __s64 fd; char name[BTRFS_PATH_NAME_MAX + 1]; }; #define BTRFS_DEVICE_PATH_NAME_MAX 1024 #define BTRFS_SUBVOL_NAME_MAX 4039 #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) #define BTRFS_SUBVOL_RDONLY (1ULL << 1) #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) #define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3) #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \ (BTRFS_SUBVOL_CREATE_ASYNC | \ BTRFS_SUBVOL_RDONLY | \ BTRFS_SUBVOL_QGROUP_INHERIT | \ BTRFS_DEVICE_SPEC_BY_ID) #define BTRFS_FSID_SIZE 16 #define BTRFS_UUID_SIZE 16 #define BTRFS_UUID_UNPARSED_SIZE 37 /* * flags definition for qgroup limits * * Used by: * struct btrfs_qgroup_limit.flags * struct btrfs_qgroup_limit_item.flags */ #define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0) #define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1) #define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2) #define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3) #define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4) #define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5) struct btrfs_qgroup_limit { __u64 flags; __u64 max_rfer; __u64 max_excl; __u64 rsv_rfer; __u64 rsv_excl; }; /* * flags definition for qgroup inheritance * * Used by: * struct btrfs_qgroup_inherit.flags */ #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) struct btrfs_qgroup_inherit { __u64 flags; __u64 num_qgroups; __u64 num_ref_copies; __u64 num_excl_copies; struct btrfs_qgroup_limit lim; __u64 qgroups[0]; }; struct btrfs_ioctl_qgroup_limit_args { __u64 qgroupid; struct btrfs_qgroup_limit lim; }; /* * flags for subvolumes * * Used by: * struct btrfs_ioctl_vol_args_v2.flags * * BTRFS_SUBVOL_RDONLY is also provided/consumed by the following ioctls: * - BTRFS_IOC_SUBVOL_GETFLAGS * - BTRFS_IOC_SUBVOL_SETFLAGS */ struct btrfs_ioctl_vol_args_v2 { __s64 fd; __u64 transid; __u64 flags; union { struct { __u64 size; struct btrfs_qgroup_inherit *qgroup_inherit; }; __u64 unused[4]; }; union { char name[BTRFS_SUBVOL_NAME_MAX + 1]; __u64 devid; }; }; /* * structure to report errors and progress to userspace, either as a * result of a finished scrub, a canceled scrub or a progress inquiry */ struct btrfs_scrub_progress { __u64 data_extents_scrubbed; /* # of data extents scrubbed */ __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */ __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */ __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */ __u64 read_errors; /* # of read errors encountered (EIO) */ __u64 csum_errors; /* # of failed csum checks */ __u64 verify_errors; /* # of occurences, where the metadata * of a tree block did not match the * expected values, like generation or * logical */ __u64 no_csum; /* # of 4k data block for which no csum * is present, probably the result of * data written with nodatasum */ __u64 csum_discards; /* # of csum for which no data was found * in the extent tree. */ __u64 super_errors; /* # of bad super blocks encountered */ __u64 malloc_errors; /* # of internal kmalloc errors. These * will likely cause an incomplete * scrub */ __u64 uncorrectable_errors; /* # of errors where either no intact * copy was found or the writeback * failed */ __u64 corrected_errors; /* # of errors corrected */ __u64 last_physical; /* last physical address scrubbed. In * case a scrub was aborted, this can * be used to restart the scrub */ __u64 unverified_errors; /* # of occurences where a read for a * full (64k) bio failed, but the re- * check succeeded for each 4k piece. * Intermittent error. */ }; #define BTRFS_SCRUB_READONLY 1 struct btrfs_ioctl_scrub_args { __u64 devid; /* in */ __u64 start; /* in */ __u64 end; /* in */ __u64 flags; /* in */ struct btrfs_scrub_progress progress; /* out */ /* pad to 1k */ __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8]; }; #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1 struct btrfs_ioctl_dev_replace_start_params { __u64 srcdevid; /* in, if 0, use srcdev_name instead */ __u64 cont_reading_from_srcdev_mode; /* in, see #define * above */ __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */ __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */ }; #define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0 #define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1 #define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2 #define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3 #define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4 struct btrfs_ioctl_dev_replace_status_params { __u64 replace_state; /* out, see #define above */ __u64 progress_1000; /* out, 0 <= x <= 1000 */ __u64 time_started; /* out, seconds since 1-Jan-1970 */ __u64 time_stopped; /* out, seconds since 1-Jan-1970 */ __u64 num_write_errors; /* out */ __u64 num_uncorrectable_read_errors; /* out */ }; #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0 #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1 #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3 struct btrfs_ioctl_dev_replace_args { __u64 cmd; /* in */ __u64 result; /* out */ union { struct btrfs_ioctl_dev_replace_start_params start; struct btrfs_ioctl_dev_replace_status_params status; }; /* in/out */ __u64 spare[64]; }; struct btrfs_ioctl_dev_info_args { __u64 devid; /* in/out */ __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */ __u64 bytes_used; /* out */ __u64 total_bytes; /* out */ __u64 unused[379]; /* pad to 4k */ __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ }; struct btrfs_ioctl_fs_info_args { __u64 max_id; /* out */ __u64 num_devices; /* out */ __u8 fsid[BTRFS_FSID_SIZE]; /* out */ __u32 nodesize; /* out */ __u32 sectorsize; /* out */ __u32 clone_alignment; /* out */ __u32 reserved32; __u64 reserved[122]; /* pad to 1k */ }; /* * feature flags * * Used by: * struct btrfs_ioctl_feature_flags */ #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0) /* * Older kernels (< 4.9) on big-endian systems produced broken free space tree * bitmaps, and btrfs-progs also used to corrupt the free space tree (versions * < 4.7.3). If this bit is clear, then the free space tree cannot be trusted. * btrfs-progs can also intentionally clear this bit to ask the kernel to * rebuild the free space tree, however this might not work on older kernels * that do not know about this bit. If not sure, clear the cache manually on * first mount when booting older kernel versions. */ #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1) #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3) #define BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD (1ULL << 4) /* * older kernels tried to do bigger metadata blocks, but the * code was pretty buggy. Lets not let them try anymore. */ #define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5) #define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6) #define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7) #define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8) #define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9) struct btrfs_ioctl_feature_flags { __u64 compat_flags; __u64 compat_ro_flags; __u64 incompat_flags; }; /* balance control ioctl modes */ #define BTRFS_BALANCE_CTL_PAUSE 1 #define BTRFS_BALANCE_CTL_CANCEL 2 /* * this is packed, because it should be exactly the same as its disk * byte order counterpart (struct btrfs_disk_balance_args) */ struct btrfs_balance_args { __u64 profiles; union { __u64 usage; struct { __u32 usage_min; __u32 usage_max; }; }; __u64 devid; __u64 pstart; __u64 pend; __u64 vstart; __u64 vend; __u64 target; __u64 flags; /* * BTRFS_BALANCE_ARGS_LIMIT with value 'limit' * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum * and maximum */ union { __u64 limit; /* limit number of processed chunks */ struct { __u32 limit_min; __u32 limit_max; }; }; /* * Process chunks that cross stripes_min..stripes_max devices, * BTRFS_BALANCE_ARGS_STRIPES_RANGE */ __u32 stripes_min; __u32 stripes_max; __u64 unused[6]; } __attribute__ ((__packed__)); /* report balance progress to userspace */ struct btrfs_balance_progress { __u64 expected; /* estimated # of chunks that will be * relocated to fulfill the request */ __u64 considered; /* # of chunks we have considered so far */ __u64 completed; /* # of chunks relocated so far */ }; /* * flags definition for balance * * Restriper's general type filter * * Used by: * btrfs_ioctl_balance_args.flags * btrfs_balance_control.flags (internal) */ #define BTRFS_BALANCE_DATA (1ULL << 0) #define BTRFS_BALANCE_SYSTEM (1ULL << 1) #define BTRFS_BALANCE_METADATA (1ULL << 2) #define BTRFS_BALANCE_TYPE_MASK (BTRFS_BALANCE_DATA | \ BTRFS_BALANCE_SYSTEM | \ BTRFS_BALANCE_METADATA) #define BTRFS_BALANCE_FORCE (1ULL << 3) #define BTRFS_BALANCE_RESUME (1ULL << 4) /* * flags definitions for per-type balance args * * Balance filters * * Used by: * struct btrfs_balance_args */ #define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0) #define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1) #define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2) #define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3) #define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4) #define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5) #define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6) #define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7) #define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10) #define BTRFS_BALANCE_ARGS_MASK \ (BTRFS_BALANCE_ARGS_PROFILES | \ BTRFS_BALANCE_ARGS_USAGE | \ BTRFS_BALANCE_ARGS_DEVID | \ BTRFS_BALANCE_ARGS_DRANGE | \ BTRFS_BALANCE_ARGS_VRANGE | \ BTRFS_BALANCE_ARGS_LIMIT | \ BTRFS_BALANCE_ARGS_LIMIT_RANGE | \ BTRFS_BALANCE_ARGS_STRIPES_RANGE | \ BTRFS_BALANCE_ARGS_USAGE_RANGE) /* * Profile changing flags. When SOFT is set we won't relocate chunk if * it already has the target profile (even though it may be * half-filled). */ #define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8) #define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9) /* * flags definition for balance state * * Used by: * struct btrfs_ioctl_balance_args.state */ #define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0) #define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1) #define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2) struct btrfs_ioctl_balance_args { __u64 flags; /* in/out */ __u64 state; /* out */ struct btrfs_balance_args data; /* in/out */ struct btrfs_balance_args meta; /* in/out */ struct btrfs_balance_args sys; /* in/out */ struct btrfs_balance_progress stat; /* out */ __u64 unused[72]; /* pad to 1k */ }; #define BTRFS_INO_LOOKUP_PATH_MAX 4080 struct btrfs_ioctl_ino_lookup_args { __u64 treeid; __u64 objectid; char name[BTRFS_INO_LOOKUP_PATH_MAX]; }; #define BTRFS_INO_LOOKUP_USER_PATH_MAX (4080 - BTRFS_VOL_NAME_MAX - 1) struct btrfs_ioctl_ino_lookup_user_args { /* in, inode number containing the subvolume of 'subvolid' */ __u64 dirid; /* in */ __u64 treeid; /* out, name of the subvolume of 'treeid' */ char name[BTRFS_VOL_NAME_MAX + 1]; /* * out, constructed path from the directory with which the ioctl is * called to dirid */ char path[BTRFS_INO_LOOKUP_USER_PATH_MAX]; }; /* Search criteria for the btrfs SEARCH ioctl family. */ struct btrfs_ioctl_search_key { /* * The tree we're searching in. 1 is the tree of tree roots, 2 is the * extent tree, etc... * * A special tree_id value of 0 will cause a search in the subvolume * tree that the inode which is passed to the ioctl is part of. */ __u64 tree_id; /* in */ /* * When doing a tree search, we're actually taking a slice from a * linear search space of 136-bit keys. * * A full 136-bit tree key is composed as: * (objectid << 72) + (type << 64) + offset * * The individual min and max values for objectid, type and offset * define the min_key and max_key values for the search range. All * metadata items with a key in the interval [min_key, max_key] will be * returned. * * Additionally, we can filter the items returned on transaction id of * the metadata block they're stored in by specifying a transid range. * Be aware that this transaction id only denotes when the metadata * page that currently contains the item got written the last time as * result of a COW operation. The number does not have any meaning * related to the transaction in which an individual item that is being * returned was created or changed. */ __u64 min_objectid; /* in */ __u64 max_objectid; /* in */ __u64 min_offset; /* in */ __u64 max_offset; /* in */ __u64 min_transid; /* in */ __u64 max_transid; /* in */ __u32 min_type; /* in */ __u32 max_type; /* in */ /* * input: The maximum amount of results desired. * output: The actual amount of items returned, restricted by any of: * - reaching the upper bound of the search range * - reaching the input nr_items amount of items * - completely filling the supplied memory buffer */ __u32 nr_items; /* in/out */ /* align to 64 bits */ __u32 unused; /* some extra for later */ __u64 unused1; __u64 unused2; __u64 unused3; __u64 unused4; }; struct btrfs_ioctl_search_header { __u64 transid; __u64 objectid; __u64 offset; __u32 type; __u32 len; }; #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) /* * the buf is an array of search headers where * each header is followed by the actual item * the type field is expanded to 32 bits for alignment */ struct btrfs_ioctl_search_args { struct btrfs_ioctl_search_key key; char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; }; struct btrfs_ioctl_search_args_v2 { struct btrfs_ioctl_search_key key; /* in/out - search parameters */ __u64 buf_size; /* in - size of buffer * out - on EOVERFLOW: needed size * to store item */ __u64 buf[0]; /* out - found items */ }; struct btrfs_ioctl_clone_range_args { __s64 src_fd; __u64 src_offset, src_length; __u64 dest_offset; }; /* * flags definition for the defrag range ioctl * * Used by: * struct btrfs_ioctl_defrag_range_args.flags */ #define BTRFS_DEFRAG_RANGE_COMPRESS 1 #define BTRFS_DEFRAG_RANGE_START_IO 2 struct btrfs_ioctl_defrag_range_args { /* start of the defrag operation */ __u64 start; /* number of bytes to defrag, use (u64)-1 to say all */ __u64 len; /* * flags for the operation, which can include turning * on compression for this one defrag */ __u64 flags; /* * any extent bigger than this will be considered * already defragged. Use 0 to take the kernel default * Use 1 to say every single extent must be rewritten */ __u32 extent_thresh; /* * which compression method to use if turning on compression * for this defrag operation. If unspecified, zlib will * be used */ __u32 compress_type; /* spare for later */ __u32 unused[4]; }; #define BTRFS_SAME_DATA_DIFFERS 1 /* For extent-same ioctl */ struct btrfs_ioctl_same_extent_info { __s64 fd; /* in - destination file */ __u64 logical_offset; /* in - start of extent in destination */ __u64 bytes_deduped; /* out - total # of bytes we were able * to dedupe from this file */ /* status of this dedupe operation: * 0 if dedup succeeds * < 0 for error * == BTRFS_SAME_DATA_DIFFERS if data differs */ __s32 status; /* out - see above description */ __u32 reserved; }; struct btrfs_ioctl_same_args { __u64 logical_offset; /* in - start of extent in source */ __u64 length; /* in - length of extent */ __u16 dest_count; /* in - total elements in info array */ __u16 reserved1; __u32 reserved2; struct btrfs_ioctl_same_extent_info info[0]; }; struct btrfs_ioctl_space_info { __u64 flags; __u64 total_bytes; __u64 used_bytes; }; struct btrfs_ioctl_space_args { __u64 space_slots; __u64 total_spaces; struct btrfs_ioctl_space_info spaces[0]; }; struct btrfs_data_container { __u32 bytes_left; /* out -- bytes not needed to deliver output */ __u32 bytes_missing; /* out -- additional bytes needed for result */ __u32 elem_cnt; /* out */ __u32 elem_missed; /* out */ __u64 val[0]; /* out */ }; struct btrfs_ioctl_ino_path_args { __u64 inum; /* in */ __u64 size; /* in */ __u64 reserved[4]; /* struct btrfs_data_container *fspath; out */ __u64 fspath; /* out */ }; struct btrfs_ioctl_logical_ino_args { __u64 logical; /* in */ __u64 size; /* in */ __u64 reserved[3]; /* must be 0 for now */ __u64 flags; /* in, v2 only */ /* struct btrfs_data_container *inodes; out */ __u64 inodes; }; /* Return every ref to the extent, not just those containing logical block. * Requires logical == extent bytenr. */ #define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0) enum btrfs_dev_stat_values { /* disk I/O failure stats */ BTRFS_DEV_STAT_WRITE_ERRS, /* EIO or EREMOTEIO from lower layers */ BTRFS_DEV_STAT_READ_ERRS, /* EIO or EREMOTEIO from lower layers */ BTRFS_DEV_STAT_FLUSH_ERRS, /* EIO or EREMOTEIO from lower layers */ /* stats for indirect indications for I/O failures */ BTRFS_DEV_STAT_CORRUPTION_ERRS, /* checksum error, bytenr error or * contents is illegal: this is an * indication that the block was damaged * during read or write, or written to * wrong location or read from wrong * location */ BTRFS_DEV_STAT_GENERATION_ERRS, /* an indication that blocks have not * been written */ BTRFS_DEV_STAT_VALUES_MAX }; /* Reset statistics after reading; needs SYS_ADMIN capability */ #define BTRFS_DEV_STATS_RESET (1ULL << 0) struct btrfs_ioctl_get_dev_stats { __u64 devid; /* in */ __u64 nr_items; /* in/out */ __u64 flags; /* in/out */ /* out values: */ __u64 values[BTRFS_DEV_STAT_VALUES_MAX]; __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */ }; #define BTRFS_QUOTA_CTL_ENABLE 1 #define BTRFS_QUOTA_CTL_DISABLE 2 #define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3 struct btrfs_ioctl_quota_ctl_args { __u64 cmd; __u64 status; }; struct btrfs_ioctl_quota_rescan_args { __u64 flags; __u64 progress; __u64 reserved[6]; }; struct btrfs_ioctl_qgroup_assign_args { __u64 assign; __u64 src; __u64 dst; }; struct btrfs_ioctl_qgroup_create_args { __u64 create; __u64 qgroupid; }; struct btrfs_ioctl_timespec { __u64 sec; __u32 nsec; }; struct btrfs_ioctl_received_subvol_args { char uuid[BTRFS_UUID_SIZE]; /* in */ __u64 stransid; /* in */ __u64 rtransid; /* out */ struct btrfs_ioctl_timespec stime; /* in */ struct btrfs_ioctl_timespec rtime; /* out */ __u64 flags; /* in */ __u64 reserved[16]; /* in */ }; /* * Caller doesn't want file data in the send stream, even if the * search of clone sources doesn't find an extent. UPDATE_EXTENT * commands will be sent instead of WRITE commands. */ #define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1 /* * Do not add the leading stream header. Used when multiple snapshots * are sent back to back. */ #define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2 /* * Omit the command at the end of the stream that indicated the end * of the stream. This option is used when multiple snapshots are * sent back to back. */ #define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4 #define BTRFS_SEND_FLAG_MASK \ (BTRFS_SEND_FLAG_NO_FILE_DATA | \ BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \ BTRFS_SEND_FLAG_OMIT_END_CMD) struct btrfs_ioctl_send_args { __s64 send_fd; /* in */ __u64 clone_sources_count; /* in */ __u64 *clone_sources; /* in */ __u64 parent_root; /* in */ __u64 flags; /* in */ __u64 reserved[4]; /* in */ }; /* * Information about a fs tree root. * * All items are filled by the ioctl */ struct btrfs_ioctl_get_subvol_info_args { /* Id of this subvolume */ __u64 treeid; /* Name of this subvolume, used to get the real name at mount point */ char name[BTRFS_VOL_NAME_MAX + 1]; /* * Id of the subvolume which contains this subvolume. * Zero for top-level subvolume or a deleted subvolume. */ __u64 parent_id; /* * Inode number of the directory which contains this subvolume. * Zero for top-level subvolume or a deleted subvolume */ __u64 dirid; /* Latest transaction id of this subvolume */ __u64 generation; /* Flags of this subvolume */ __u64 flags; /* UUID of this subvolume */ __u8 uuid[BTRFS_UUID_SIZE]; /* * UUID of the subvolume of which this subvolume is a snapshot. * All zero for a non-snapshot subvolume. */ __u8 parent_uuid[BTRFS_UUID_SIZE]; /* * UUID of the subvolume from which this subvolume was received. * All zero for non-received subvolume. */ __u8 received_uuid[BTRFS_UUID_SIZE]; /* Transaction id indicating when change/create/send/receive happened */ __u64 ctransid; __u64 otransid; __u64 stransid; __u64 rtransid; /* Time corresponding to c/o/s/rtransid */ struct btrfs_ioctl_timespec ctime; struct btrfs_ioctl_timespec otime; struct btrfs_ioctl_timespec stime; struct btrfs_ioctl_timespec rtime; /* Must be zero */ __u64 reserved[8]; }; #define BTRFS_MAX_ROOTREF_BUFFER_NUM 255 struct btrfs_ioctl_get_subvol_rootref_args { /* in/out, minimum id of rootref's treeid to be searched */ __u64 min_treeid; /* out */ struct { __u64 treeid; __u64 dirid; } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM]; /* out, number of found items */ __u8 num_items; __u8 align[7]; }; /* Error codes as returned by the kernel */ enum btrfs_err_code { BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1, BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET, BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET, BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET, BTRFS_ERROR_DEV_TGT_REPLACE, BTRFS_ERROR_DEV_MISSING_NOT_FOUND, BTRFS_ERROR_DEV_ONLY_WRITABLE, BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS }; #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \ struct btrfs_ioctl_vol_args) /* trans start and trans end are dangerous, and only for * use by applications that know how to avoid the * resulting deadlocks */ #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6) #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7) #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8) #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ struct btrfs_ioctl_clone_range_args) #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \ struct btrfs_ioctl_defrag_range_args) #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ struct btrfs_ioctl_search_args) #define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \ struct btrfs_ioctl_search_args_v2) #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ struct btrfs_ioctl_ino_lookup_args) #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64) #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \ struct btrfs_ioctl_space_args) #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64) #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64) #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ struct btrfs_ioctl_vol_args_v2) #define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, \ struct btrfs_ioctl_vol_args_v2) #define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64) #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64) #define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \ struct btrfs_ioctl_scrub_args) #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28) #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \ struct btrfs_ioctl_scrub_args) #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \ struct btrfs_ioctl_dev_info_args) #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \ struct btrfs_ioctl_fs_info_args) #define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, \ struct btrfs_ioctl_balance_args) #define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int) #define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, \ struct btrfs_ioctl_balance_args) #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \ struct btrfs_ioctl_ino_path_args) #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \ struct btrfs_ioctl_logical_ino_args) #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \ struct btrfs_ioctl_received_subvol_args) #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args) #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \ struct btrfs_ioctl_vol_args) #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \ struct btrfs_ioctl_quota_ctl_args) #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \ struct btrfs_ioctl_qgroup_assign_args) #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \ struct btrfs_ioctl_qgroup_create_args) #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \ struct btrfs_ioctl_qgroup_limit_args) #define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \ struct btrfs_ioctl_quota_rescan_args) #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ struct btrfs_ioctl_quota_rescan_args) #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46) #define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \ char[BTRFS_LABEL_SIZE]) #define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \ char[BTRFS_LABEL_SIZE]) #define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \ struct btrfs_ioctl_get_dev_stats) #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \ struct btrfs_ioctl_dev_replace_args) #define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \ struct btrfs_ioctl_same_args) #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags) #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags[2]) #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags[3]) #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \ struct btrfs_ioctl_vol_args_v2) #define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, \ struct btrfs_ioctl_logical_ino_args) #define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, \ struct btrfs_ioctl_get_subvol_info_args) #define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, \ struct btrfs_ioctl_get_subvol_rootref_args) #define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, \ struct btrfs_ioctl_ino_lookup_user_args) #endif /* _LINUX_BTRFS_H */ linux/btrfs_tree.h 0000644 00000061305 15063602060 0010216 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _BTRFS_CTREE_H_ #define _BTRFS_CTREE_H_ #include <linux/btrfs.h> #include <linux/types.h> /* * This header contains the structure definitions and constants used * by file system objects that can be retrieved using * the BTRFS_IOC_SEARCH_TREE ioctl. That means basically anything that * is needed to describe a leaf node's key or item contents. */ /* holds pointers to all of the tree roots */ #define BTRFS_ROOT_TREE_OBJECTID 1ULL /* stores information about which extents are in use, and reference counts */ #define BTRFS_EXTENT_TREE_OBJECTID 2ULL /* * chunk tree stores translations from logical -> physical block numbering * the super block points to the chunk tree */ #define BTRFS_CHUNK_TREE_OBJECTID 3ULL /* * stores information about which areas of a given device are in use. * one per device. The tree of tree roots points to the device tree */ #define BTRFS_DEV_TREE_OBJECTID 4ULL /* one per subvolume, storing files and directories */ #define BTRFS_FS_TREE_OBJECTID 5ULL /* directory objectid inside the root tree */ #define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL /* holds checksums of all the data extents */ #define BTRFS_CSUM_TREE_OBJECTID 7ULL /* holds quota configuration and tracking */ #define BTRFS_QUOTA_TREE_OBJECTID 8ULL /* for storing items that use the BTRFS_UUID_KEY* types */ #define BTRFS_UUID_TREE_OBJECTID 9ULL /* tracks free space in block groups. */ #define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL /* device stats in the device tree */ #define BTRFS_DEV_STATS_OBJECTID 0ULL /* for storing balance parameters in the root tree */ #define BTRFS_BALANCE_OBJECTID -4ULL /* orhpan objectid for tracking unlinked/truncated files */ #define BTRFS_ORPHAN_OBJECTID -5ULL /* does write ahead logging to speed up fsyncs */ #define BTRFS_TREE_LOG_OBJECTID -6ULL #define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL /* for space balancing */ #define BTRFS_TREE_RELOC_OBJECTID -8ULL #define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL /* * extent checksums all have this objectid * this allows them to share the logging tree * for fsyncs */ #define BTRFS_EXTENT_CSUM_OBJECTID -10ULL /* For storing free space cache */ #define BTRFS_FREE_SPACE_OBJECTID -11ULL /* * The inode number assigned to the special inode for storing * free ino cache */ #define BTRFS_FREE_INO_OBJECTID -12ULL /* dummy objectid represents multiple objectids */ #define BTRFS_MULTIPLE_OBJECTIDS -255ULL /* * All files have objectids in this range. */ #define BTRFS_FIRST_FREE_OBJECTID 256ULL #define BTRFS_LAST_FREE_OBJECTID -256ULL #define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL /* * the device items go into the chunk tree. The key is in the form * [ 1 BTRFS_DEV_ITEM_KEY device_id ] */ #define BTRFS_DEV_ITEMS_OBJECTID 1ULL #define BTRFS_BTREE_INODE_OBJECTID 1 #define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2 #define BTRFS_DEV_REPLACE_DEVID 0ULL /* * inode items have the data typically returned from stat and store other * info about object characteristics. There is one for every file and dir in * the FS */ #define BTRFS_INODE_ITEM_KEY 1 #define BTRFS_INODE_REF_KEY 12 #define BTRFS_INODE_EXTREF_KEY 13 #define BTRFS_XATTR_ITEM_KEY 24 #define BTRFS_ORPHAN_ITEM_KEY 48 /* reserve 2-15 close to the inode for later flexibility */ /* * dir items are the name -> inode pointers in a directory. There is one * for every name in a directory. */ #define BTRFS_DIR_LOG_ITEM_KEY 60 #define BTRFS_DIR_LOG_INDEX_KEY 72 #define BTRFS_DIR_ITEM_KEY 84 #define BTRFS_DIR_INDEX_KEY 96 /* * extent data is for file data */ #define BTRFS_EXTENT_DATA_KEY 108 /* * extent csums are stored in a separate tree and hold csums for * an entire extent on disk. */ #define BTRFS_EXTENT_CSUM_KEY 128 /* * root items point to tree roots. They are typically in the root * tree used by the super block to find all the other trees */ #define BTRFS_ROOT_ITEM_KEY 132 /* * root backrefs tie subvols and snapshots to the directory entries that * reference them */ #define BTRFS_ROOT_BACKREF_KEY 144 /* * root refs make a fast index for listing all of the snapshots and * subvolumes referenced by a given root. They point directly to the * directory item in the root that references the subvol */ #define BTRFS_ROOT_REF_KEY 156 /* * extent items are in the extent map tree. These record which blocks * are used, and how many references there are to each block */ #define BTRFS_EXTENT_ITEM_KEY 168 /* * The same as the BTRFS_EXTENT_ITEM_KEY, except it's metadata we already know * the length, so we save the level in key->offset instead of the length. */ #define BTRFS_METADATA_ITEM_KEY 169 #define BTRFS_TREE_BLOCK_REF_KEY 176 #define BTRFS_EXTENT_DATA_REF_KEY 178 #define BTRFS_EXTENT_REF_V0_KEY 180 #define BTRFS_SHARED_BLOCK_REF_KEY 182 #define BTRFS_SHARED_DATA_REF_KEY 184 /* * block groups give us hints into the extent allocation trees. Which * blocks are free etc etc */ #define BTRFS_BLOCK_GROUP_ITEM_KEY 192 /* * Every block group is represented in the free space tree by a free space info * item, which stores some accounting information. It is keyed on * (block_group_start, FREE_SPACE_INFO, block_group_length). */ #define BTRFS_FREE_SPACE_INFO_KEY 198 /* * A free space extent tracks an extent of space that is free in a block group. * It is keyed on (start, FREE_SPACE_EXTENT, length). */ #define BTRFS_FREE_SPACE_EXTENT_KEY 199 /* * When a block group becomes very fragmented, we convert it to use bitmaps * instead of extents. A free space bitmap is keyed on * (start, FREE_SPACE_BITMAP, length); the corresponding item is a bitmap with * (length / sectorsize) bits. */ #define BTRFS_FREE_SPACE_BITMAP_KEY 200 #define BTRFS_DEV_EXTENT_KEY 204 #define BTRFS_DEV_ITEM_KEY 216 #define BTRFS_CHUNK_ITEM_KEY 228 /* * Records the overall state of the qgroups. * There's only one instance of this key present, * (0, BTRFS_QGROUP_STATUS_KEY, 0) */ #define BTRFS_QGROUP_STATUS_KEY 240 /* * Records the currently used space of the qgroup. * One key per qgroup, (0, BTRFS_QGROUP_INFO_KEY, qgroupid). */ #define BTRFS_QGROUP_INFO_KEY 242 /* * Contains the user configured limits for the qgroup. * One key per qgroup, (0, BTRFS_QGROUP_LIMIT_KEY, qgroupid). */ #define BTRFS_QGROUP_LIMIT_KEY 244 /* * Records the child-parent relationship of qgroups. For * each relation, 2 keys are present: * (childid, BTRFS_QGROUP_RELATION_KEY, parentid) * (parentid, BTRFS_QGROUP_RELATION_KEY, childid) */ #define BTRFS_QGROUP_RELATION_KEY 246 /* * Obsolete name, see BTRFS_TEMPORARY_ITEM_KEY. */ #define BTRFS_BALANCE_ITEM_KEY 248 /* * The key type for tree items that are stored persistently, but do not need to * exist for extended period of time. The items can exist in any tree. * * [subtype, BTRFS_TEMPORARY_ITEM_KEY, data] * * Existing items: * * - balance status item * (BTRFS_BALANCE_OBJECTID, BTRFS_TEMPORARY_ITEM_KEY, 0) */ #define BTRFS_TEMPORARY_ITEM_KEY 248 /* * Obsolete name, see BTRFS_PERSISTENT_ITEM_KEY */ #define BTRFS_DEV_STATS_KEY 249 /* * The key type for tree items that are stored persistently and usually exist * for a long period, eg. filesystem lifetime. The item kinds can be status * information, stats or preference values. The item can exist in any tree. * * [subtype, BTRFS_PERSISTENT_ITEM_KEY, data] * * Existing items: * * - device statistics, store IO stats in the device tree, one key for all * stats * (BTRFS_DEV_STATS_OBJECTID, BTRFS_DEV_STATS_KEY, 0) */ #define BTRFS_PERSISTENT_ITEM_KEY 249 /* * Persistantly stores the device replace state in the device tree. * The key is built like this: (0, BTRFS_DEV_REPLACE_KEY, 0). */ #define BTRFS_DEV_REPLACE_KEY 250 /* * Stores items that allow to quickly map UUIDs to something else. * These items are part of the filesystem UUID tree. * The key is built like this: * (UUID_upper_64_bits, BTRFS_UUID_KEY*, UUID_lower_64_bits). */ #if BTRFS_UUID_SIZE != 16 #error "UUID items require BTRFS_UUID_SIZE == 16!" #endif #define BTRFS_UUID_KEY_SUBVOL 251 /* for UUIDs assigned to subvols */ #define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252 /* for UUIDs assigned to * received subvols */ /* * string items are for debugging. They just store a short string of * data in the FS */ #define BTRFS_STRING_ITEM_KEY 253 /* 32 bytes in various csum fields */ #define BTRFS_CSUM_SIZE 32 /* csum types */ #define BTRFS_CSUM_TYPE_CRC32 0 /* * flags definitions for directory entry item type * * Used by: * struct btrfs_dir_item.type */ #define BTRFS_FT_UNKNOWN 0 #define BTRFS_FT_REG_FILE 1 #define BTRFS_FT_DIR 2 #define BTRFS_FT_CHRDEV 3 #define BTRFS_FT_BLKDEV 4 #define BTRFS_FT_FIFO 5 #define BTRFS_FT_SOCK 6 #define BTRFS_FT_SYMLINK 7 #define BTRFS_FT_XATTR 8 #define BTRFS_FT_MAX 9 /* * The key defines the order in the tree, and so it also defines (optimal) * block layout. * * objectid corresponds to the inode number. * * type tells us things about the object, and is a kind of stream selector. * so for a given inode, keys with type of 1 might refer to the inode data, * type of 2 may point to file data in the btree and type == 3 may point to * extents. * * offset is the starting byte offset for this key in the stream. * * btrfs_disk_key is in disk byte order. struct btrfs_key is always * in cpu native order. Otherwise they are identical and their sizes * should be the same (ie both packed) */ struct btrfs_disk_key { __le64 objectid; __u8 type; __le64 offset; } __attribute__ ((__packed__)); struct btrfs_key { __u64 objectid; __u8 type; __u64 offset; } __attribute__ ((__packed__)); struct btrfs_dev_item { /* the internal btrfs device id */ __le64 devid; /* size of the device */ __le64 total_bytes; /* bytes used */ __le64 bytes_used; /* optimal io alignment for this device */ __le32 io_align; /* optimal io width for this device */ __le32 io_width; /* minimal io size for this device */ __le32 sector_size; /* type and info about this device */ __le64 type; /* expected generation for this device */ __le64 generation; /* * starting byte of this partition on the device, * to allow for stripe alignment in the future */ __le64 start_offset; /* grouping information for allocation decisions */ __le32 dev_group; /* seek speed 0-100 where 100 is fastest */ __u8 seek_speed; /* bandwidth 0-100 where 100 is fastest */ __u8 bandwidth; /* btrfs generated uuid for this device */ __u8 uuid[BTRFS_UUID_SIZE]; /* uuid of FS who owns this device */ __u8 fsid[BTRFS_UUID_SIZE]; } __attribute__ ((__packed__)); struct btrfs_stripe { __le64 devid; __le64 offset; __u8 dev_uuid[BTRFS_UUID_SIZE]; } __attribute__ ((__packed__)); struct btrfs_chunk { /* size of this chunk in bytes */ __le64 length; /* objectid of the root referencing this chunk */ __le64 owner; __le64 stripe_len; __le64 type; /* optimal io alignment for this chunk */ __le32 io_align; /* optimal io width for this chunk */ __le32 io_width; /* minimal io size for this chunk */ __le32 sector_size; /* 2^16 stripes is quite a lot, a second limit is the size of a single * item in the btree */ __le16 num_stripes; /* sub stripes only matter for raid10 */ __le16 sub_stripes; struct btrfs_stripe stripe; /* additional stripes go here */ } __attribute__ ((__packed__)); #define BTRFS_FREE_SPACE_EXTENT 1 #define BTRFS_FREE_SPACE_BITMAP 2 struct btrfs_free_space_entry { __le64 offset; __le64 bytes; __u8 type; } __attribute__ ((__packed__)); struct btrfs_free_space_header { struct btrfs_disk_key location; __le64 generation; __le64 num_entries; __le64 num_bitmaps; } __attribute__ ((__packed__)); #define BTRFS_HEADER_FLAG_WRITTEN (1ULL << 0) #define BTRFS_HEADER_FLAG_RELOC (1ULL << 1) /* Super block flags */ /* Errors detected */ #define BTRFS_SUPER_FLAG_ERROR (1ULL << 2) #define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32) #define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33) #define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34) #define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35) /* * items in the extent btree are used to record the objectid of the * owner of the block and the number of references */ struct btrfs_extent_item { __le64 refs; __le64 generation; __le64 flags; } __attribute__ ((__packed__)); struct btrfs_extent_item_v0 { __le32 refs; } __attribute__ ((__packed__)); #define BTRFS_EXTENT_FLAG_DATA (1ULL << 0) #define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1) /* following flags only apply to tree blocks */ /* use full backrefs for extent pointers in the block */ #define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8) /* * this flag is only used internally by scrub and may be changed at any time * it is only declared here to avoid collisions */ #define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48) struct btrfs_tree_block_info { struct btrfs_disk_key key; __u8 level; } __attribute__ ((__packed__)); struct btrfs_extent_data_ref { __le64 root; __le64 objectid; __le64 offset; __le32 count; } __attribute__ ((__packed__)); struct btrfs_shared_data_ref { __le32 count; } __attribute__ ((__packed__)); struct btrfs_extent_inline_ref { __u8 type; __le64 offset; } __attribute__ ((__packed__)); /* old style backrefs item */ struct btrfs_extent_ref_v0 { __le64 root; __le64 generation; __le64 objectid; __le32 count; } __attribute__ ((__packed__)); /* dev extents record free space on individual devices. The owner * field points back to the chunk allocation mapping tree that allocated * the extent. The chunk tree uuid field is a way to double check the owner */ struct btrfs_dev_extent { __le64 chunk_tree; __le64 chunk_objectid; __le64 chunk_offset; __le64 length; __u8 chunk_tree_uuid[BTRFS_UUID_SIZE]; } __attribute__ ((__packed__)); struct btrfs_inode_ref { __le64 index; __le16 name_len; /* name goes here */ } __attribute__ ((__packed__)); struct btrfs_inode_extref { __le64 parent_objectid; __le64 index; __le16 name_len; __u8 name[0]; /* name goes here */ } __attribute__ ((__packed__)); struct btrfs_timespec { __le64 sec; __le32 nsec; } __attribute__ ((__packed__)); struct btrfs_inode_item { /* nfs style generation number */ __le64 generation; /* transid that last touched this inode */ __le64 transid; __le64 size; __le64 nbytes; __le64 block_group; __le32 nlink; __le32 uid; __le32 gid; __le32 mode; __le64 rdev; __le64 flags; /* modification sequence number for NFS */ __le64 sequence; /* * a little future expansion, for more than this we can * just grow the inode item and version it */ __le64 reserved[4]; struct btrfs_timespec atime; struct btrfs_timespec ctime; struct btrfs_timespec mtime; struct btrfs_timespec otime; } __attribute__ ((__packed__)); struct btrfs_dir_log_item { __le64 end; } __attribute__ ((__packed__)); struct btrfs_dir_item { struct btrfs_disk_key location; __le64 transid; __le16 data_len; __le16 name_len; __u8 type; } __attribute__ ((__packed__)); #define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0) /* * Internal in-memory flag that a subvolume has been marked for deletion but * still visible as a directory */ #define BTRFS_ROOT_SUBVOL_DEAD (1ULL << 48) struct btrfs_root_item { struct btrfs_inode_item inode; __le64 generation; __le64 root_dirid; __le64 bytenr; __le64 byte_limit; __le64 bytes_used; __le64 last_snapshot; __le64 flags; __le32 refs; struct btrfs_disk_key drop_progress; __u8 drop_level; __u8 level; /* * The following fields appear after subvol_uuids+subvol_times * were introduced. */ /* * This generation number is used to test if the new fields are valid * and up to date while reading the root item. Every time the root item * is written out, the "generation" field is copied into this field. If * anyone ever mounted the fs with an older kernel, we will have * mismatching generation values here and thus must invalidate the * new fields. See btrfs_update_root and btrfs_find_last_root for * details. * the offset of generation_v2 is also used as the start for the memset * when invalidating the fields. */ __le64 generation_v2; __u8 uuid[BTRFS_UUID_SIZE]; __u8 parent_uuid[BTRFS_UUID_SIZE]; __u8 received_uuid[BTRFS_UUID_SIZE]; __le64 ctransid; /* updated when an inode changes */ __le64 otransid; /* trans when created */ __le64 stransid; /* trans when sent. non-zero for received subvol */ __le64 rtransid; /* trans when received. non-zero for received subvol */ struct btrfs_timespec ctime; struct btrfs_timespec otime; struct btrfs_timespec stime; struct btrfs_timespec rtime; __le64 reserved[8]; /* for future */ } __attribute__ ((__packed__)); /* * this is used for both forward and backward root refs */ struct btrfs_root_ref { __le64 dirid; __le64 sequence; __le16 name_len; } __attribute__ ((__packed__)); struct btrfs_disk_balance_args { /* * profiles to operate on, single is denoted by * BTRFS_AVAIL_ALLOC_BIT_SINGLE */ __le64 profiles; /* * usage filter * BTRFS_BALANCE_ARGS_USAGE with a single value means '0..N' * BTRFS_BALANCE_ARGS_USAGE_RANGE - range syntax, min..max */ union { __le64 usage; struct { __le32 usage_min; __le32 usage_max; }; }; /* devid filter */ __le64 devid; /* devid subset filter [pstart..pend) */ __le64 pstart; __le64 pend; /* btrfs virtual address space subset filter [vstart..vend) */ __le64 vstart; __le64 vend; /* * profile to convert to, single is denoted by * BTRFS_AVAIL_ALLOC_BIT_SINGLE */ __le64 target; /* BTRFS_BALANCE_ARGS_* */ __le64 flags; /* * BTRFS_BALANCE_ARGS_LIMIT with value 'limit' * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum * and maximum */ union { __le64 limit; struct { __le32 limit_min; __le32 limit_max; }; }; /* * Process chunks that cross stripes_min..stripes_max devices, * BTRFS_BALANCE_ARGS_STRIPES_RANGE */ __le32 stripes_min; __le32 stripes_max; __le64 unused[6]; } __attribute__ ((__packed__)); /* * store balance parameters to disk so that balance can be properly * resumed after crash or unmount */ struct btrfs_balance_item { /* BTRFS_BALANCE_* */ __le64 flags; struct btrfs_disk_balance_args data; struct btrfs_disk_balance_args meta; struct btrfs_disk_balance_args sys; __le64 unused[4]; } __attribute__ ((__packed__)); #define BTRFS_FILE_EXTENT_INLINE 0 #define BTRFS_FILE_EXTENT_REG 1 #define BTRFS_FILE_EXTENT_PREALLOC 2 #define BTRFS_FILE_EXTENT_TYPES 2 struct btrfs_file_extent_item { /* * transaction id that created this extent */ __le64 generation; /* * max number of bytes to hold this extent in ram * when we split a compressed extent we can't know how big * each of the resulting pieces will be. So, this is * an upper limit on the size of the extent in ram instead of * an exact limit. */ __le64 ram_bytes; /* * 32 bits for the various ways we might encode the data, * including compression and encryption. If any of these * are set to something a given disk format doesn't understand * it is treated like an incompat flag for reading and writing, * but not for stat. */ __u8 compression; __u8 encryption; __le16 other_encoding; /* spare for later use */ /* are we __inline__ data or a real extent? */ __u8 type; /* * disk space consumed by the extent, checksum blocks are included * in these numbers * * At this offset in the structure, the __inline__ extent data start. */ __le64 disk_bytenr; __le64 disk_num_bytes; /* * the logical offset in file blocks (no csums) * this extent record is for. This allows a file extent to point * into the middle of an existing extent on disk, sharing it * between two snapshots (useful if some bytes in the middle of the * extent have changed */ __le64 offset; /* * the logical number of file blocks (no csums included). This * always reflects the size uncompressed and without encoding. */ __le64 num_bytes; } __attribute__ ((__packed__)); struct btrfs_csum_item { __u8 csum; } __attribute__ ((__packed__)); struct btrfs_dev_stats_item { /* * grow this item struct at the end for future enhancements and keep * the existing values unchanged */ __le64 values[BTRFS_DEV_STAT_VALUES_MAX]; } __attribute__ ((__packed__)); #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0 #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID 1 #define BTRFS_DEV_REPLACE_ITEM_STATE_NEVER_STARTED 0 #define BTRFS_DEV_REPLACE_ITEM_STATE_STARTED 1 #define BTRFS_DEV_REPLACE_ITEM_STATE_SUSPENDED 2 #define BTRFS_DEV_REPLACE_ITEM_STATE_FINISHED 3 #define BTRFS_DEV_REPLACE_ITEM_STATE_CANCELED 4 struct btrfs_dev_replace_item { /* * grow this item struct at the end for future enhancements and keep * the existing values unchanged */ __le64 src_devid; __le64 cursor_left; __le64 cursor_right; __le64 cont_reading_from_srcdev_mode; __le64 replace_state; __le64 time_started; __le64 time_stopped; __le64 num_write_errors; __le64 num_uncorrectable_read_errors; } __attribute__ ((__packed__)); /* different types of block groups (and chunks) */ #define BTRFS_BLOCK_GROUP_DATA (1ULL << 0) #define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1) #define BTRFS_BLOCK_GROUP_METADATA (1ULL << 2) #define BTRFS_BLOCK_GROUP_RAID0 (1ULL << 3) #define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4) #define BTRFS_BLOCK_GROUP_DUP (1ULL << 5) #define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6) #define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7) #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8) #define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \ BTRFS_SPACE_INFO_GLOBAL_RSV) enum btrfs_raid_types { BTRFS_RAID_RAID10, BTRFS_RAID_RAID1, BTRFS_RAID_DUP, BTRFS_RAID_RAID0, BTRFS_RAID_SINGLE, BTRFS_RAID_RAID5, BTRFS_RAID_RAID6, BTRFS_NR_RAID_TYPES }; #define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | \ BTRFS_BLOCK_GROUP_SYSTEM | \ BTRFS_BLOCK_GROUP_METADATA) #define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \ BTRFS_BLOCK_GROUP_RAID1 | \ BTRFS_BLOCK_GROUP_RAID5 | \ BTRFS_BLOCK_GROUP_RAID6 | \ BTRFS_BLOCK_GROUP_DUP | \ BTRFS_BLOCK_GROUP_RAID10) #define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | \ BTRFS_BLOCK_GROUP_RAID6) /* * We need a bit for restriper to be able to tell when chunks of type * SINGLE are available. This "extended" profile format is used in * fs_info->avail_*_alloc_bits (in-memory) and balance item fields * (on-disk). The corresponding on-disk bit in chunk.type is reserved * to avoid remappings between two formats in future. */ #define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48) /* * A fake block group type that is used to communicate global block reserve * size to userspace via the SPACE_INFO ioctl. */ #define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49) #define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | \ BTRFS_AVAIL_ALLOC_BIT_SINGLE) static __inline__ __u64 chunk_to_extended(__u64 flags) { if ((flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0) flags |= BTRFS_AVAIL_ALLOC_BIT_SINGLE; return flags; } static __inline__ __u64 extended_to_chunk(__u64 flags) { return flags & ~BTRFS_AVAIL_ALLOC_BIT_SINGLE; } struct btrfs_block_group_item { __le64 used; __le64 chunk_objectid; __le64 flags; } __attribute__ ((__packed__)); struct btrfs_free_space_info { __le32 extent_count; __le32 flags; } __attribute__ ((__packed__)); #define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0) #define BTRFS_QGROUP_LEVEL_SHIFT 48 static __inline__ __u64 btrfs_qgroup_level(__u64 qgroupid) { return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT; } /* * is subvolume quota turned on? */ #define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0) /* * RESCAN is set during the initialization phase */ #define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1) /* * Some qgroup entries are known to be out of date, * either because the configuration has changed in a way that * makes a rescan necessary, or because the fs has been mounted * with a non-qgroup-aware version. * Turning qouta off and on again makes it inconsistent, too. */ #define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2) #define BTRFS_QGROUP_STATUS_VERSION 1 struct btrfs_qgroup_status_item { __le64 version; /* * the generation is updated during every commit. As older * versions of btrfs are not aware of qgroups, it will be * possible to detect inconsistencies by checking the * generation on mount time */ __le64 generation; /* flag definitions see above */ __le64 flags; /* * only used during scanning to record the progress * of the scan. It contains a logical address */ __le64 rescan; } __attribute__ ((__packed__)); struct btrfs_qgroup_info_item { __le64 generation; __le64 rfer; __le64 rfer_cmpr; __le64 excl; __le64 excl_cmpr; } __attribute__ ((__packed__)); struct btrfs_qgroup_limit_item { /* * only updated when any of the other values change */ __le64 flags; __le64 max_rfer; __le64 max_excl; __le64 rsv_rfer; __le64 rsv_excl; } __attribute__ ((__packed__)); #endif /* _BTRFS_CTREE_H_ */ linux/can.h 0000644 00000017311 15063602060 0006616 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * linux/can.h * * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) * * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> * Urs Thuermann <urs.thuermann@volkswagen.de> * Copyright (c) 2002-2007 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef _CAN_H #define _CAN_H #include <linux/types.h> #include <linux/socket.h> /* controller area network (CAN) kernel definitions */ /* special address description flags for the CAN_ID */ #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ #define CAN_ERR_FLAG 0x20000000U /* error message frame */ /* valid bits in CAN ID for frame formats */ #define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ #define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ #define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ /* * Controller Area Network Identifier structure * * bit 0-28 : CAN identifier (11/29 bit) * bit 29 : error message frame flag (0 = data frame, 1 = error message) * bit 30 : remote transmission request flag (1 = rtr frame) * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) */ typedef __u32 canid_t; #define CAN_SFF_ID_BITS 11 #define CAN_EFF_ID_BITS 29 /* * Controller Area Network Error Message Frame Mask structure * * bit 0-28 : error class mask (see include/linux/can/error.h) * bit 29-31 : set to zero */ typedef __u32 can_err_mask_t; /* CAN payload length and DLC definitions according to ISO 11898-1 */ #define CAN_MAX_DLC 8 #define CAN_MAX_DLEN 8 /* CAN FD payload length and DLC definitions according to ISO 11898-7 */ #define CANFD_MAX_DLC 15 #define CANFD_MAX_DLEN 64 /** * struct can_frame - basic CAN frame structure * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition * @can_dlc: frame payload length in byte (0 .. 8) aka data length code * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 * mapping of the 'data length code' to the real payload length * @__pad: padding * @__res0: reserved / padding * @__res1: reserved / padding * @data: CAN frame payload (up to 8 byte) */ struct can_frame { canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ __u8 __pad; /* padding */ __u8 __res0; /* reserved / padding */ __u8 __res1; /* reserved / padding */ __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); }; /* * defined bits for canfd_frame.flags * * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to * be set in the CAN frame bitstream on the wire. The EDL bit switch turns * the CAN controllers bitstream processor into the CAN FD mode which creates * two new options within the CAN FD frame specification: * * Bit Rate Switch - to indicate a second bitrate is/was used for the payload * Error State Indicator - represents the error state of the transmitting node * * As the CANFD_ESI bit is internally generated by the transmitting CAN * controller only the CANFD_BRS bit is relevant for real CAN controllers when * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make * sense for virtual CAN interfaces to test applications with echoed frames. */ #define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */ #define CANFD_ESI 0x02 /* error state indicator of the transmitting node */ /** * struct canfd_frame - CAN flexible data rate frame structure * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition * @len: frame payload length in byte (0 .. CANFD_MAX_DLEN) * @flags: additional flags for CAN FD * @__res0: reserved / padding * @__res1: reserved / padding * @data: CAN FD frame payload (up to CANFD_MAX_DLEN byte) */ struct canfd_frame { canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ __u8 len; /* frame payload length in byte */ __u8 flags; /* additional flags for CAN FD */ __u8 __res0; /* reserved / padding */ __u8 __res1; /* reserved / padding */ __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); }; #define CAN_MTU (sizeof(struct can_frame)) #define CANFD_MTU (sizeof(struct canfd_frame)) /* particular protocols of the protocol family PF_CAN */ #define CAN_RAW 1 /* RAW sockets */ #define CAN_BCM 2 /* Broadcast Manager */ #define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ #define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ #define CAN_MCNET 5 /* Bosch MCNet */ #define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ #define CAN_NPROTO 7 #define SOL_CAN_BASE 100 /** * struct sockaddr_can - the sockaddr structure for CAN sockets * @can_family: address family number AF_CAN. * @can_ifindex: CAN network interface index. * @can_addr: protocol specific address information */ struct sockaddr_can { __kernel_sa_family_t can_family; int can_ifindex; union { /* transport protocol class address information (e.g. ISOTP) */ struct { canid_t rx_id, tx_id; } tp; /* reserved for future CAN protocols address information */ } can_addr; }; /** * struct can_filter - CAN ID based filter in can_register(). * @can_id: relevant bits of CAN ID which are not masked out. * @can_mask: CAN mask (see description) * * Description: * A filter matches, when * * <received_can_id> & mask == can_id & mask * * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can * filter for error message frames (CAN_ERR_FLAG bit set in mask). */ struct can_filter { canid_t can_id; canid_t can_mask; }; #define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ #define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */ #endif /* !_UAPI_CAN_H */ linux/capability.h 0000644 00000032321 15063602060 0010174 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This is <linux/capability.h> * * Andrew G. Morgan <morgan@kernel.org> * Alexander Kjeldaas <astor@guardian.no> * with help from Aleph1, Roland Buresund and Andrew Main. * * See here for the libcap library ("POSIX draft" compliance): * * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ */ #ifndef _LINUX_CAPABILITY_H #define _LINUX_CAPABILITY_H #include <linux/types.h> /* User-level do most of the mapping between kernel and user capabilities based on the version tag given by the kernel. The kernel might be somewhat backwards compatible, but don't bet on it. */ /* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to a set of three capability sets. The transposition of 3*the following structure to such a composite is better handled in a user library since the draft standard requires the use of malloc/free etc.. */ #define _LINUX_CAPABILITY_VERSION_1 0x19980330 #define _LINUX_CAPABILITY_U32S_1 1 #define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */ #define _LINUX_CAPABILITY_U32S_2 2 #define _LINUX_CAPABILITY_VERSION_3 0x20080522 #define _LINUX_CAPABILITY_U32S_3 2 typedef struct __user_cap_header_struct { __u32 version; int pid; } *cap_user_header_t; typedef struct __user_cap_data_struct { __u32 effective; __u32 permitted; __u32 inheritable; } *cap_user_data_t; #define VFS_CAP_REVISION_MASK 0xFF000000 #define VFS_CAP_REVISION_SHIFT 24 #define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK #define VFS_CAP_FLAGS_EFFECTIVE 0x000001 #define VFS_CAP_REVISION_1 0x01000000 #define VFS_CAP_U32_1 1 #define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1)) #define VFS_CAP_REVISION_2 0x02000000 #define VFS_CAP_U32_2 2 #define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2)) #define VFS_CAP_REVISION_3 0x03000000 #define VFS_CAP_U32_3 2 #define XATTR_CAPS_SZ_3 (sizeof(__le32)*(2 + 2*VFS_CAP_U32_3)) #define XATTR_CAPS_SZ XATTR_CAPS_SZ_3 #define VFS_CAP_U32 VFS_CAP_U32_3 #define VFS_CAP_REVISION VFS_CAP_REVISION_3 struct vfs_cap_data { __le32 magic_etc; /* Little endian */ struct { __le32 permitted; /* Little endian */ __le32 inheritable; /* Little endian */ } data[VFS_CAP_U32]; }; /* * same as vfs_cap_data but with a rootid at the end */ struct vfs_ns_cap_data { __le32 magic_etc; struct { __le32 permitted; /* Little endian */ __le32 inheritable; /* Little endian */ } data[VFS_CAP_U32]; __le32 rootid; }; /* * Backwardly compatible definition for source code - trapped in a * 32-bit world. If you find you need this, please consider using * libcap to untrap yourself... */ #define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1 #define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1 /** ** POSIX-draft defined capabilities. **/ /* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this overrides the restriction of changing file ownership and group ownership. */ #define CAP_CHOWN 0 /* Override all DAC access, including ACL execute access if [_POSIX_ACL] is defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ #define CAP_DAC_OVERRIDE 1 /* Overrides all DAC restrictions regarding read and search on files and directories, including ACL restrictions if [_POSIX_ACL] is defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ #define CAP_DAC_READ_SEARCH 2 /* Overrides all restrictions about allowed operations on files, where file owner ID must be equal to the user ID, except where CAP_FSETID is applicable. It doesn't override MAC and DAC restrictions. */ #define CAP_FOWNER 3 /* Overrides the following restrictions that the effective user ID shall match the file owner ID when setting the S_ISUID and S_ISGID bits on that file; that the effective group ID (or one of the supplementary group IDs) shall match the file owner ID when setting the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are cleared on successful return from chown(2) (not implemented). */ #define CAP_FSETID 4 /* Overrides the restriction that the real or effective user ID of a process sending a signal must match the real or effective user ID of the process receiving the signal. */ #define CAP_KILL 5 /* Allows setgid(2) manipulation */ /* Allows setgroups(2) */ /* Allows forged gids on socket credentials passing. */ #define CAP_SETGID 6 /* Allows set*uid(2) manipulation (including fsuid). */ /* Allows forged pids on socket credentials passing. */ #define CAP_SETUID 7 /** ** Linux-specific capabilities **/ /* Without VFS support for capabilities: * Transfer any capability in your permitted set to any pid, * remove any capability in your permitted set from any pid * With VFS support for capabilities (neither of above, but) * Add any capability from current's capability bounding set * to the current process' inheritable set * Allow taking bits out of capability bounding set * Allow modification of the securebits for a process */ #define CAP_SETPCAP 8 /* Allow modification of S_IMMUTABLE and S_APPEND file attributes */ #define CAP_LINUX_IMMUTABLE 9 /* Allows binding to TCP/UDP sockets below 1024 */ /* Allows binding to ATM VCIs below 32 */ #define CAP_NET_BIND_SERVICE 10 /* Allow broadcasting, listen to multicast */ #define CAP_NET_BROADCAST 11 /* Allow interface configuration */ /* Allow administration of IP firewall, masquerading and accounting */ /* Allow setting debug option on sockets */ /* Allow modification of routing tables */ /* Allow setting arbitrary process / process group ownership on sockets */ /* Allow binding to any address for transparent proxying (also via NET_RAW) */ /* Allow setting TOS (type of service) */ /* Allow setting promiscuous mode */ /* Allow clearing driver statistics */ /* Allow multicasting */ /* Allow read/write of device-specific registers */ /* Allow activation of ATM control sockets */ #define CAP_NET_ADMIN 12 /* Allow use of RAW sockets */ /* Allow use of PACKET sockets */ /* Allow binding to any address for transparent proxying (also via NET_ADMIN) */ #define CAP_NET_RAW 13 /* Allow locking of shared memory segments */ /* Allow mlock and mlockall (which doesn't really have anything to do with IPC) */ #define CAP_IPC_LOCK 14 /* Override IPC ownership checks */ #define CAP_IPC_OWNER 15 /* Insert and remove kernel modules - modify kernel without limit */ #define CAP_SYS_MODULE 16 /* Allow ioperm/iopl access */ /* Allow sending USB messages to any device via /dev/bus/usb */ #define CAP_SYS_RAWIO 17 /* Allow use of chroot() */ #define CAP_SYS_CHROOT 18 /* Allow ptrace() of any process */ #define CAP_SYS_PTRACE 19 /* Allow configuration of process accounting */ #define CAP_SYS_PACCT 20 /* Allow configuration of the secure attention key */ /* Allow administration of the random device */ /* Allow examination and configuration of disk quotas */ /* Allow setting the domainname */ /* Allow setting the hostname */ /* Allow calling bdflush() */ /* Allow mount() and umount(), setting up new smb connection */ /* Allow some autofs root ioctls */ /* Allow nfsservctl */ /* Allow VM86_REQUEST_IRQ */ /* Allow to read/write pci config on alpha */ /* Allow irix_prctl on mips (setstacksize) */ /* Allow flushing all cache on m68k (sys_cacheflush) */ /* Allow removing semaphores */ /* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores and shared memory */ /* Allow locking/unlocking of shared memory segment */ /* Allow turning swap on/off */ /* Allow forged pids on socket credentials passing */ /* Allow setting readahead and flushing buffers on block devices */ /* Allow setting geometry in floppy driver */ /* Allow turning DMA on/off in xd driver */ /* Allow administration of md devices (mostly the above, but some extra ioctls) */ /* Allow tuning the ide driver */ /* Allow access to the nvram device */ /* Allow administration of apm_bios, serial and bttv (TV) device */ /* Allow manufacturer commands in isdn CAPI support driver */ /* Allow reading non-standardized portions of pci configuration space */ /* Allow DDI debug ioctl on sbpcd driver */ /* Allow setting up serial ports */ /* Allow sending raw qic-117 commands */ /* Allow enabling/disabling tagged queuing on SCSI controllers and sending arbitrary SCSI commands */ /* Allow setting encryption key on loopback filesystem */ /* Allow setting zone reclaim policy */ /* Allow everything under CAP_BPF and CAP_PERFMON for backward compatibility */ #define CAP_SYS_ADMIN 21 /* Allow use of reboot() */ #define CAP_SYS_BOOT 22 /* Allow raising priority and setting priority on other (different UID) processes */ /* Allow use of FIFO and round-robin (realtime) scheduling on own processes and setting the scheduling algorithm used by another process. */ /* Allow setting cpu affinity on other processes */ /* Allow setting realtime ioprio class */ /* Allow setting ioprio class on other processes */ #define CAP_SYS_NICE 23 /* Override resource limits. Set resource limits. */ /* Override quota limits. */ /* Override reserved space on ext2 filesystem */ /* Modify data journaling mode on ext3 filesystem (uses journaling resources) */ /* NOTE: ext2 honors fsuid when checking for resource overrides, so you can override using fsuid too */ /* Override size restrictions on IPC message queues */ /* Allow more than 64hz interrupts from the real-time clock */ /* Override max number of consoles on console allocation */ /* Override max number of keymaps */ /* Control memory reclaim behavior */ #define CAP_SYS_RESOURCE 24 /* Allow manipulation of system clock */ /* Allow irix_stime on mips */ /* Allow setting the real-time clock */ #define CAP_SYS_TIME 25 /* Allow configuration of tty devices */ /* Allow vhangup() of tty */ #define CAP_SYS_TTY_CONFIG 26 /* Allow the privileged aspects of mknod() */ #define CAP_MKNOD 27 /* Allow taking of leases on files */ #define CAP_LEASE 28 /* Allow writing the audit log via unicast netlink socket */ #define CAP_AUDIT_WRITE 29 /* Allow configuration of audit via unicast netlink socket */ #define CAP_AUDIT_CONTROL 30 /* Set or remove capabilities on files. Map uid=0 into a child user namespace. */ #define CAP_SETFCAP 31 /* Override MAC access. The base kernel enforces no MAC policy. An LSM may enforce a MAC policy, and if it does and it chooses to implement capability based overrides of that policy, this is the capability it should use to do so. */ #define CAP_MAC_OVERRIDE 32 /* Allow MAC configuration or state changes. The base kernel requires no MAC configuration. An LSM may enforce a MAC policy, and if it does and it chooses to implement capability based checks on modifications to that policy or the data required to maintain it, this is the capability it should use to do so. */ #define CAP_MAC_ADMIN 33 /* Allow configuring the kernel's syslog (printk behaviour) */ #define CAP_SYSLOG 34 /* Allow triggering something that will wake the system */ #define CAP_WAKE_ALARM 35 /* Allow preventing system suspends */ #define CAP_BLOCK_SUSPEND 36 /* Allow reading the audit log via multicast netlink socket */ #define CAP_AUDIT_READ 37 /* * Allow system performance and observability privileged operations * using perf_events, i915_perf and other kernel subsystems */ #define CAP_PERFMON 38 /* * CAP_BPF allows the following BPF operations: * - Creating all types of BPF maps * - Advanced verifier features * - Indirect variable access * - Bounded loops * - BPF to BPF function calls * - Scalar precision tracking * - Larger complexity limits * - Dead code elimination * - And potentially other features * - Loading BPF Type Format (BTF) data * - Retrieve xlated and JITed code of BPF programs * - Use bpf_spin_lock() helper * * CAP_PERFMON relaxes the verifier checks further: * - BPF progs can use of pointer-to-integer conversions * - speculation attack hardening measures are bypassed * - bpf_probe_read to read arbitrary kernel memory is allowed * - bpf_trace_printk to print kernel memory is allowed * * CAP_SYS_ADMIN is required to use bpf_probe_write_user. * * CAP_SYS_ADMIN is required to iterate system wide loaded * programs, maps, links, BTFs and convert their IDs to file descriptors. * * CAP_PERFMON and CAP_BPF are required to load tracing programs. * CAP_NET_ADMIN and CAP_BPF are required to load networking programs. */ #define CAP_BPF 39 /* Allow checkpoint/restore related operations */ /* Allow PID selection during clone3() */ /* Allow writing to ns_last_pid */ #define CAP_CHECKPOINT_RESTORE 40 #define CAP_LAST_CAP CAP_CHECKPOINT_RESTORE #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) /* * Bit location of each capability (used by user-space library and kernel) */ #define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */ #define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */ #endif /* _LINUX_CAPABILITY_H */ linux/capi.h 0000644 00000006064 15063602060 0006774 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* $Id: capi.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ * * CAPI 2.0 Interface for Linux * * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __LINUX_CAPI_H__ #define __LINUX_CAPI_H__ #include <linux/types.h> #include <linux/ioctl.h> #include <linux/kernelcapi.h> /* * CAPI_REGISTER */ typedef struct capi_register_params { /* CAPI_REGISTER */ __u32 level3cnt; /* No. of simulatneous user data connections */ __u32 datablkcnt; /* No. of buffered data messages */ __u32 datablklen; /* Size of buffered data messages */ } capi_register_params; #define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params) /* * CAPI_GET_MANUFACTURER */ #define CAPI_MANUFACTURER_LEN 64 #define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */ /* * CAPI_GET_VERSION */ typedef struct capi_version { __u32 majorversion; __u32 minorversion; __u32 majormanuversion; __u32 minormanuversion; } capi_version; #define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version) /* * CAPI_GET_SERIAL */ #define CAPI_SERIAL_LEN 8 #define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */ /* * CAPI_GET_PROFILE */ typedef struct capi_profile { __u16 ncontroller; /* number of installed controller */ __u16 nbchannel; /* number of B-Channels */ __u32 goptions; /* global options */ __u32 support1; /* B1 protocols support */ __u32 support2; /* B2 protocols support */ __u32 support3; /* B3 protocols support */ __u32 reserved[6]; /* reserved */ __u32 manu[5]; /* manufacturer specific information */ } capi_profile; #define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile) typedef struct capi_manufacturer_cmd { unsigned long cmd; void *data; } capi_manufacturer_cmd; /* * CAPI_MANUFACTURER_CMD */ #define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd) /* * CAPI_GET_ERRCODE * capi errcode is set, * if read, write, or ioctl returns EIO, * ioctl returns errcode directly, and in arg, if != 0 */ #define CAPI_GET_ERRCODE _IOR('C',0x21, __u16) /* * CAPI_INSTALLED */ #define CAPI_INSTALLED _IOR('C',0x22, __u16) /* * member contr is input for * CAPI_GET_MANUFACTURER, CAPI_GET_VERSION, CAPI_GET_SERIAL * and CAPI_GET_PROFILE */ typedef union capi_ioctl_struct { __u32 contr; capi_register_params rparams; __u8 manufacturer[CAPI_MANUFACTURER_LEN]; capi_version version; __u8 serial[CAPI_SERIAL_LEN]; capi_profile profile; capi_manufacturer_cmd cmd; __u16 errcode; } capi_ioctl_struct; /* * Middleware extension */ #define CAPIFLAG_HIGHJACKING 0x0001 #define CAPI_GET_FLAGS _IOR('C',0x23, unsigned) #define CAPI_SET_FLAGS _IOR('C',0x24, unsigned) #define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned) #define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned) #define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned) #endif /* __LINUX_CAPI_H__ */ linux/cciss_defs.h 0000644 00000006321 15063602060 0010161 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef CCISS_DEFS_H #define CCISS_DEFS_H #include <linux/types.h> /* general boundary definitions */ #define SENSEINFOBYTES 32 /* note that this value may vary between host implementations */ /* Command Status value */ #define CMD_SUCCESS 0x0000 #define CMD_TARGET_STATUS 0x0001 #define CMD_DATA_UNDERRUN 0x0002 #define CMD_DATA_OVERRUN 0x0003 #define CMD_INVALID 0x0004 #define CMD_PROTOCOL_ERR 0x0005 #define CMD_HARDWARE_ERR 0x0006 #define CMD_CONNECTION_LOST 0x0007 #define CMD_ABORTED 0x0008 #define CMD_ABORT_FAILED 0x0009 #define CMD_UNSOLICITED_ABORT 0x000A #define CMD_TIMEOUT 0x000B #define CMD_UNABORTABLE 0x000C /* transfer direction */ #define XFER_NONE 0x00 #define XFER_WRITE 0x01 #define XFER_READ 0x02 #define XFER_RSVD 0x03 /* task attribute */ #define ATTR_UNTAGGED 0x00 #define ATTR_SIMPLE 0x04 #define ATTR_HEADOFQUEUE 0x05 #define ATTR_ORDERED 0x06 #define ATTR_ACA 0x07 /* cdb type */ #define TYPE_CMD 0x00 #define TYPE_MSG 0x01 /* Type defs used in the following structs */ #define BYTE __u8 #define WORD __u16 #define HWORD __u16 #define DWORD __u32 #define CISS_MAX_LUN 1024 #define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */ #define LEVEL3LUN 0 #pragma pack(1) /* Command List Structure */ typedef union _SCSI3Addr_struct { struct { BYTE Dev; BYTE Bus:6; BYTE Mode:2; /* b00 */ } PeripDev; struct { BYTE DevLSB; BYTE DevMSB:6; BYTE Mode:2; /* b01 */ } LogDev; struct { BYTE Dev:5; BYTE Bus:3; BYTE Targ:6; BYTE Mode:2; /* b10 */ } LogUnit; } SCSI3Addr_struct; typedef struct _PhysDevAddr_struct { DWORD TargetId:24; DWORD Bus:6; DWORD Mode:2; SCSI3Addr_struct Target[2]; /* 2 level target device addr */ } PhysDevAddr_struct; typedef struct _LogDevAddr_struct { DWORD VolId:30; DWORD Mode:2; BYTE reserved[4]; } LogDevAddr_struct; typedef union _LUNAddr_struct { BYTE LunAddrBytes[8]; SCSI3Addr_struct SCSI3Lun[4]; PhysDevAddr_struct PhysDev; LogDevAddr_struct LogDev; } LUNAddr_struct; typedef struct _RequestBlock_struct { BYTE CDBLen; struct { BYTE Type:3; BYTE Attribute:3; BYTE Direction:2; } Type; HWORD Timeout; BYTE CDB[16]; } RequestBlock_struct; typedef union _MoreErrInfo_struct{ struct { BYTE Reserved[3]; BYTE Type; DWORD ErrorInfo; } Common_Info; struct{ BYTE Reserved[2]; BYTE offense_size; /* size of offending entry */ BYTE offense_num; /* byte # of offense 0-base */ DWORD offense_value; } Invalid_Cmd; } MoreErrInfo_struct; typedef struct _ErrorInfo_struct { BYTE ScsiStatus; BYTE SenseLen; HWORD CommandStatus; DWORD ResidualCnt; MoreErrInfo_struct MoreErrInfo; BYTE SenseInfo[SENSEINFOBYTES]; } ErrorInfo_struct; #pragma pack() #endif /* CCISS_DEFS_H */ linux/cciss_ioctl.h 0000644 00000005311 15063602060 0010350 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef CCISS_IOCTLH #define CCISS_IOCTLH #include <linux/types.h> #include <linux/ioctl.h> #include <linux/cciss_defs.h> #define CCISS_IOC_MAGIC 'B' typedef struct _cciss_pci_info_struct { unsigned char bus; unsigned char dev_fn; unsigned short domain; __u32 board_id; } cciss_pci_info_struct; typedef struct _cciss_coalint_struct { __u32 delay; __u32 count; } cciss_coalint_struct; typedef char NodeName_type[16]; typedef __u32 Heartbeat_type; #define CISS_PARSCSIU2 0x0001 #define CISS_PARCSCIU3 0x0002 #define CISS_FIBRE1G 0x0100 #define CISS_FIBRE2G 0x0200 typedef __u32 BusTypes_type; typedef char FirmwareVer_type[4]; typedef __u32 DriverVer_type; #define MAX_KMALLOC_SIZE 128000 typedef struct _IOCTL_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; WORD buf_size; /* size in bytes of the buf */ BYTE *buf; } IOCTL_Command_struct; typedef struct _BIG_IOCTL_Command_struct { LUNAddr_struct LUN_info; RequestBlock_struct Request; ErrorInfo_struct error_info; DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ DWORD buf_size; /* size in bytes of the buf */ /* < malloc_size * MAXSGENTRIES */ BYTE *buf; } BIG_IOCTL_Command_struct; typedef struct _LogvolInfo_struct{ __u32 LunID; int num_opens; /* number of opens on the logical volume */ int num_parts; /* number of partitions configured on logvol */ } LogvolInfo_struct; #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct) #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct) #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct) #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type) #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type) #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type) #define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type) #define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type) #define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type) #define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10) #define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct) #define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12) /* no longer used... use REGNEWD instead */ #define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int) #define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14) #define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16) #define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct) #define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct) #endif /* CCISS_IOCTLH */ linux/cdrom.h 0000644 00000070273 15063602060 0007167 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * -- <linux/cdrom.h> * General header file for linux CD-ROM drivers * Copyright (C) 1992 David Giller, rafetmad@oxy.edu * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de * 1996 David van Leeuwen, david@tm.tno.nl * 1997, 1998 Erik Andersen, andersee@debian.org * 1998-2002 Jens Axboe, axboe@suse.de */ #ifndef _LINUX_CDROM_H #define _LINUX_CDROM_H #include <linux/types.h> #include <asm/byteorder.h> /******************************************************* * As of Linux 2.1.x, all Linux CD-ROM application programs will use this * (and only this) include file. It is my hope to provide Linux with * a uniform interface between software accessing CD-ROMs and the various * device drivers that actually talk to the drives. There may still be * 23 different kinds of strange CD-ROM drives, but at least there will * now be one, and only one, Linux CD-ROM interface. * * Additionally, as of Linux 2.1.x, all Linux application programs * should use the O_NONBLOCK option when opening a CD-ROM device * for subsequent ioctl commands. This allows for neat system errors * like "No medium found" or "Wrong medium type" upon attempting to * mount or play an empty slot, mount an audio disc, or play a data disc. * Generally, changing an application program to support O_NONBLOCK * is as easy as the following: * - drive = open("/dev/cdrom", O_RDONLY); * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); * It is worth the small change. * * Patches for many common CD programs (provided by David A. van Leeuwen) * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ * *******************************************************/ /* When a driver supports a certain function, but the cdrom drive we are * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will * borrow the "Operation not supported" error from the network folks to * accomplish this. Maybe someday we will get a more targeted error code, * but this will do for now... */ #define EDRIVE_CANT_DO_THIS EOPNOTSUPP /******************************************************* * The CD-ROM IOCTL commands -- these should be supported by * all the various cdrom drivers. For the CD-ROM ioctls, we * will commandeer byte 0x53, or 'S'. *******************************************************/ #define CDROMPAUSE 0x5301 /* Pause Audio Operation */ #define CDROMRESUME 0x5302 /* Resume paused Audio Operation */ #define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ #define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index (struct cdrom_ti) */ #define CDROMREADTOCHDR 0x5305 /* Read TOC header (struct cdrom_tochdr) */ #define CDROMREADTOCENTRY 0x5306 /* Read TOC entry (struct cdrom_tocentry) */ #define CDROMSTOP 0x5307 /* Stop the cdrom drive */ #define CDROMSTART 0x5308 /* Start the cdrom drive */ #define CDROMEJECT 0x5309 /* Ejects the cdrom media */ #define CDROMVOLCTRL 0x530a /* Control output volume (struct cdrom_volctrl) */ #define CDROMSUBCHNL 0x530b /* Read subchannel data (struct cdrom_subchnl) */ #define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) (struct cdrom_read) */ #define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) (struct cdrom_read) */ #define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ #define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ #define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session address of multi session disks (struct cdrom_multisession) */ #define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" if available (struct cdrom_mcn) */ #define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated, but here anyway for compatibility */ #define CDROMRESET 0x5312 /* hard-reset the drive */ #define CDROMVOLREAD 0x5313 /* Get the drive's volume setting (struct cdrom_volctrl) */ #define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) (struct cdrom_read) */ /* * These ioctls are used only used in aztcd.c and optcd.c */ #define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ #define CDROMSEEK 0x5316 /* seek msf address */ /* * This ioctl is only used by the scsi-cd driver. It is for playing audio in logical block addressing mode. */ #define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ /* * These ioctls are only used in optcd.c */ #define CDROMREADALL 0x5318 /* read all 2646 bytes */ /* * These ioctls are (now) only in ide-cd.c for controlling * drive spindown time. They should be implemented in the * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... * -Erik */ #define CDROMGETSPINDOWN 0x531d #define CDROMSETSPINDOWN 0x531e /* * These ioctls are implemented through the uniform CD-ROM driver * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM * drivers are eventually ported to the uniform CD-ROM driver interface. */ #define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ #define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ #define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ #define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ #define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ #define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ #define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ #define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ #define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ #define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ #define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ #define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. * Future CDROM ioctls should be kept below 0x537F */ /* This ioctl is only used by sbpcd at the moment */ #define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ /* conflict with SCSI_IOCTL_GET_IDLUN */ /* DVD-ROM Specific ioctls */ #define DVD_READ_STRUCT 0x5390 /* Read structure */ #define DVD_WRITE_STRUCT 0x5391 /* Write structure */ #define DVD_AUTH 0x5392 /* Authentication */ #define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ #define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ #define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ /******************************************************* * CDROM IOCTL structures *******************************************************/ /* Address in MSF format */ struct cdrom_msf0 { __u8 minute; __u8 second; __u8 frame; }; /* Address in either MSF or logical format */ union cdrom_addr { struct cdrom_msf0 msf; int lba; }; /* This struct is used by the CDROMPLAYMSF ioctl */ struct cdrom_msf { __u8 cdmsf_min0; /* start minute */ __u8 cdmsf_sec0; /* start second */ __u8 cdmsf_frame0; /* start frame */ __u8 cdmsf_min1; /* end minute */ __u8 cdmsf_sec1; /* end second */ __u8 cdmsf_frame1; /* end frame */ }; /* This struct is used by the CDROMPLAYTRKIND ioctl */ struct cdrom_ti { __u8 cdti_trk0; /* start track */ __u8 cdti_ind0; /* start index */ __u8 cdti_trk1; /* end track */ __u8 cdti_ind1; /* end index */ }; /* This struct is used by the CDROMREADTOCHDR ioctl */ struct cdrom_tochdr { __u8 cdth_trk0; /* start track */ __u8 cdth_trk1; /* end track */ }; /* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ struct cdrom_volctrl { __u8 channel0; __u8 channel1; __u8 channel2; __u8 channel3; }; /* This struct is used by the CDROMSUBCHNL ioctl */ struct cdrom_subchnl { __u8 cdsc_format; __u8 cdsc_audiostatus; __u8 cdsc_adr: 4; __u8 cdsc_ctrl: 4; __u8 cdsc_trk; __u8 cdsc_ind; union cdrom_addr cdsc_absaddr; union cdrom_addr cdsc_reladdr; }; /* This struct is used by the CDROMREADTOCENTRY ioctl */ struct cdrom_tocentry { __u8 cdte_track; __u8 cdte_adr :4; __u8 cdte_ctrl :4; __u8 cdte_format; union cdrom_addr cdte_addr; __u8 cdte_datamode; }; /* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ struct cdrom_read { int cdread_lba; char *cdread_bufaddr; int cdread_buflen; }; /* This struct is used by the CDROMREADAUDIO ioctl */ struct cdrom_read_audio { union cdrom_addr addr; /* frame address */ __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ int nframes; /* number of 2352-byte-frames to read at once */ __u8 *buf; /* frame buffer (size: nframes*2352 bytes) */ }; /* This struct is used with the CDROMMULTISESSION ioctl */ struct cdrom_multisession { union cdrom_addr addr; /* frame address: start-of-last-session (not the new "frame 16"!). Only valid if the "xa_flag" is true. */ __u8 xa_flag; /* 1: "is XA disk" */ __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ }; /* This struct is used with the CDROM_GET_MCN ioctl. * Very few audio discs actually have Universal Product Code information, * which should just be the Medium Catalog Number on the box. Also note * that the way the codeis written on CD is _not_ uniform across all discs! */ struct cdrom_mcn { __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ }; /* This is used by the CDROMPLAYBLK ioctl */ struct cdrom_blk { unsigned from; unsigned short len; }; #define CDROM_PACKET_SIZE 12 #define CGC_DATA_UNKNOWN 0 #define CGC_DATA_WRITE 1 #define CGC_DATA_READ 2 #define CGC_DATA_NONE 3 /* for CDROM_PACKET_COMMAND ioctl */ struct cdrom_generic_command { unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char *buffer; unsigned int buflen; int stat; struct request_sense *sense; unsigned char data_direction; int quiet; int timeout; void *reserved[1]; /* unused, actually */ }; /* * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, * 2340, or 2352 bytes long. * Sector types of the standard CD-ROM data formats: * * format sector type user data size (bytes) * ----------------------------------------------------------------------------- * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) * * * The layout of the standard CD-ROM data formats: * ----------------------------------------------------------------------------- * - audio (red): | audio_sample_bytes | * | 2352 | * * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | * | 12 - 4 - 2048 - 4 - 8 - 276 | * * - data (yellow, mode2): | sync - head - data | * | 12 - 4 - 2336 | * * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | * | 12 - 4 - 8 - 2048 - 4 - 276 | * * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | * | 12 - 4 - 8 - 2324 - 4 | * */ /* Some generally useful CD-ROM information -- mostly based on the above */ #define CD_MINS 74 /* max. minutes per CD, not really a limit */ #define CD_SECS 60 /* seconds per minute */ #define CD_FRAMES 75 /* frames per second */ #define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ #define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ #define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ #define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ #define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ #define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ #define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ #define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ #define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ #define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ #define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ #define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ /* most drives don't deliver everything: */ #define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ #define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ #define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ #define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ #define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */ /* CD-ROM address types (cdrom_tocentry.cdte_format) */ #define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ #define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ /* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ #define CDROM_DATA_TRACK 0x04 /* The leadout track is always 0xAA, regardless of # of tracks on disc */ #define CDROM_LEADOUT 0xAA /* audio states (from SCSI-2, but seen with other drives, too) */ #define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ #define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ #define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ #define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ #define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ #define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ /* capability flags used with the uniform CD-ROM driver */ #define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ #define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ #define CDC_LOCK 0x4 /* disable manual eject */ #define CDC_SELECT_SPEED 0x8 /* programmable speed */ #define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ #define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ #define CDC_MCN 0x40 /* Medium Catalog Number */ #define CDC_MEDIA_CHANGED 0x80 /* media changed */ #define CDC_PLAY_AUDIO 0x100 /* audio functions */ #define CDC_RESET 0x200 /* hard reset device */ #define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ #define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ #define CDC_CD_R 0x2000 /* drive is a CD-R */ #define CDC_CD_RW 0x4000 /* drive is a CD-RW */ #define CDC_DVD 0x8000 /* drive is a DVD */ #define CDC_DVD_R 0x10000 /* drive can write DVD-R */ #define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ #define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ #define CDC_MRW 0x80000 /* drive can read MRW */ #define CDC_MRW_W 0x100000 /* drive can write MRW */ #define CDC_RAM 0x200000 /* ok to open for WRITE */ /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ #define CDS_NO_INFO 0 /* if not implemented */ #define CDS_NO_DISC 1 #define CDS_TRAY_OPEN 2 #define CDS_DRIVE_NOT_READY 3 #define CDS_DISC_OK 4 /* return values for the CDROM_DISC_STATUS ioctl */ /* can also return CDS_NO_[INFO|DISC], from above */ #define CDS_AUDIO 100 #define CDS_DATA_1 101 #define CDS_DATA_2 102 #define CDS_XA_2_1 103 #define CDS_XA_2_2 104 #define CDS_MIXED 105 /* User-configurable behavior options for the uniform CD-ROM driver */ #define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ #define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ #define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ #define CDO_LOCK 0x8 /* lock tray on open files */ #define CDO_CHECK_TYPE 0x10 /* check type on open for data */ /* Special codes used when specifying changer slots. */ #define CDSL_NONE (INT_MAX-1) #define CDSL_CURRENT INT_MAX /* For partition based multisession access. IDE can handle 64 partitions * per drive - SCSI CD-ROM's use minors to differentiate between the * various drives, so we can't do multisessions the same way there. * Use the -o session=x option to mount on them. */ #define CD_PART_MAX 64 #define CD_PART_MASK (CD_PART_MAX - 1) /********************************************************************* * Generic Packet commands, MMC commands, and such *********************************************************************/ /* The generic packet command opcodes for CD/DVD Logical Units, * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ #define GPCMD_BLANK 0xa1 #define GPCMD_CLOSE_TRACK 0x5b #define GPCMD_FLUSH_CACHE 0x35 #define GPCMD_FORMAT_UNIT 0x04 #define GPCMD_GET_CONFIGURATION 0x46 #define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a #define GPCMD_GET_PERFORMANCE 0xac #define GPCMD_INQUIRY 0x12 #define GPCMD_LOAD_UNLOAD 0xa6 #define GPCMD_MECHANISM_STATUS 0xbd #define GPCMD_MODE_SELECT_10 0x55 #define GPCMD_MODE_SENSE_10 0x5a #define GPCMD_PAUSE_RESUME 0x4b #define GPCMD_PLAY_AUDIO_10 0x45 #define GPCMD_PLAY_AUDIO_MSF 0x47 #define GPCMD_PLAY_AUDIO_TI 0x48 #define GPCMD_PLAY_CD 0xbc #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e #define GPCMD_READ_10 0x28 #define GPCMD_READ_12 0xa8 #define GPCMD_READ_BUFFER 0x3c #define GPCMD_READ_BUFFER_CAPACITY 0x5c #define GPCMD_READ_CDVD_CAPACITY 0x25 #define GPCMD_READ_CD 0xbe #define GPCMD_READ_CD_MSF 0xb9 #define GPCMD_READ_DISC_INFO 0x51 #define GPCMD_READ_DVD_STRUCTURE 0xad #define GPCMD_READ_FORMAT_CAPACITIES 0x23 #define GPCMD_READ_HEADER 0x44 #define GPCMD_READ_TRACK_RZONE_INFO 0x52 #define GPCMD_READ_SUBCHANNEL 0x42 #define GPCMD_READ_TOC_PMA_ATIP 0x43 #define GPCMD_REPAIR_RZONE_TRACK 0x58 #define GPCMD_REPORT_KEY 0xa4 #define GPCMD_REQUEST_SENSE 0x03 #define GPCMD_RESERVE_RZONE_TRACK 0x53 #define GPCMD_SEND_CUE_SHEET 0x5d #define GPCMD_SCAN 0xba #define GPCMD_SEEK 0x2b #define GPCMD_SEND_DVD_STRUCTURE 0xbf #define GPCMD_SEND_EVENT 0xa2 #define GPCMD_SEND_KEY 0xa3 #define GPCMD_SEND_OPC 0x54 #define GPCMD_SET_READ_AHEAD 0xa7 #define GPCMD_SET_STREAMING 0xb6 #define GPCMD_START_STOP_UNIT 0x1b #define GPCMD_STOP_PLAY_SCAN 0x4e #define GPCMD_TEST_UNIT_READY 0x00 #define GPCMD_VERIFY_10 0x2f #define GPCMD_WRITE_10 0x2a #define GPCMD_WRITE_12 0xaa #define GPCMD_WRITE_AND_VERIFY_10 0x2e #define GPCMD_WRITE_BUFFER 0x3b /* This is listed as optional in ATAPI 2.6, but is (curiously) * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji * Table 377 as an MMC command for SCSi devices though... Most ATAPI * drives support it. */ #define GPCMD_SET_SPEED 0xbb /* This seems to be a SCSI specific CD-ROM opcode * to play data at track/index */ #define GPCMD_PLAYAUDIO_TI 0x48 /* * From MS Media Status Notification Support Specification. For * older drives only. */ #define GPCMD_GET_MEDIA_STATUS 0xda /* Mode page codes for mode sense/set */ #define GPMODE_VENDOR_PAGE 0x00 #define GPMODE_R_W_ERROR_PAGE 0x01 #define GPMODE_WRITE_PARMS_PAGE 0x05 #define GPMODE_WCACHING_PAGE 0x08 #define GPMODE_AUDIO_CTL_PAGE 0x0e #define GPMODE_POWER_PAGE 0x1a #define GPMODE_FAULT_FAIL_PAGE 0x1c #define GPMODE_TO_PROTECT_PAGE 0x1d #define GPMODE_CAPABILITIES_PAGE 0x2a #define GPMODE_ALL_PAGES 0x3f /* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor * of MODE_SENSE_POWER_PAGE */ #define GPMODE_CDROM_PAGE 0x0d /* DVD struct types */ #define DVD_STRUCT_PHYSICAL 0x00 #define DVD_STRUCT_COPYRIGHT 0x01 #define DVD_STRUCT_DISCKEY 0x02 #define DVD_STRUCT_BCA 0x03 #define DVD_STRUCT_MANUFACT 0x04 struct dvd_layer { __u8 book_version : 4; __u8 book_type : 4; __u8 min_rate : 4; __u8 disc_size : 4; __u8 layer_type : 4; __u8 track_path : 1; __u8 nlayers : 2; __u8 track_density : 4; __u8 linear_density : 4; __u8 bca : 1; __u32 start_sector; __u32 end_sector; __u32 end_sector_l0; }; #define DVD_LAYERS 4 struct dvd_physical { __u8 type; __u8 layer_num; struct dvd_layer layer[DVD_LAYERS]; }; struct dvd_copyright { __u8 type; __u8 layer_num; __u8 cpst; __u8 rmi; }; struct dvd_disckey { __u8 type; unsigned agid : 2; __u8 value[2048]; }; struct dvd_bca { __u8 type; int len; __u8 value[188]; }; struct dvd_manufact { __u8 type; __u8 layer_num; int len; __u8 value[2048]; }; typedef union { __u8 type; struct dvd_physical physical; struct dvd_copyright copyright; struct dvd_disckey disckey; struct dvd_bca bca; struct dvd_manufact manufact; } dvd_struct; /* * DVD authentication ioctl */ /* Authentication states */ #define DVD_LU_SEND_AGID 0 #define DVD_HOST_SEND_CHALLENGE 1 #define DVD_LU_SEND_KEY1 2 #define DVD_LU_SEND_CHALLENGE 3 #define DVD_HOST_SEND_KEY2 4 /* Termination states */ #define DVD_AUTH_ESTABLISHED 5 #define DVD_AUTH_FAILURE 6 /* Other functions */ #define DVD_LU_SEND_TITLE_KEY 7 #define DVD_LU_SEND_ASF 8 #define DVD_INVALIDATE_AGID 9 #define DVD_LU_SEND_RPC_STATE 10 #define DVD_HOST_SEND_RPC_STATE 11 /* State data */ typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ struct dvd_lu_send_agid { __u8 type; unsigned agid : 2; }; struct dvd_host_send_challenge { __u8 type; unsigned agid : 2; dvd_challenge chal; }; struct dvd_send_key { __u8 type; unsigned agid : 2; dvd_key key; }; struct dvd_lu_send_challenge { __u8 type; unsigned agid : 2; dvd_challenge chal; }; #define DVD_CPM_NO_COPYRIGHT 0 #define DVD_CPM_COPYRIGHTED 1 #define DVD_CP_SEC_NONE 0 #define DVD_CP_SEC_EXIST 1 #define DVD_CGMS_UNRESTRICTED 0 #define DVD_CGMS_SINGLE 2 #define DVD_CGMS_RESTRICTED 3 struct dvd_lu_send_title_key { __u8 type; unsigned agid : 2; dvd_key title_key; int lba; unsigned cpm : 1; unsigned cp_sec : 1; unsigned cgms : 2; }; struct dvd_lu_send_asf { __u8 type; unsigned agid : 2; unsigned asf : 1; }; struct dvd_host_send_rpcstate { __u8 type; __u8 pdrc; }; struct dvd_lu_send_rpcstate { __u8 type : 2; __u8 vra : 3; __u8 ucca : 3; __u8 region_mask; __u8 rpc_scheme; }; typedef union { __u8 type; struct dvd_lu_send_agid lsa; struct dvd_host_send_challenge hsc; struct dvd_send_key lsk; struct dvd_lu_send_challenge lsc; struct dvd_send_key hsk; struct dvd_lu_send_title_key lstk; struct dvd_lu_send_asf lsasf; struct dvd_host_send_rpcstate hrpcs; struct dvd_lu_send_rpcstate lrpcs; } dvd_authinfo; struct request_sense { #if defined(__BIG_ENDIAN_BITFIELD) __u8 valid : 1; __u8 error_code : 7; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 error_code : 7; __u8 valid : 1; #endif __u8 segment_number; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 2; __u8 ili : 1; __u8 reserved2 : 1; __u8 sense_key : 4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 sense_key : 4; __u8 reserved2 : 1; __u8 ili : 1; __u8 reserved1 : 2; #endif __u8 information[4]; __u8 add_sense_len; __u8 command_info[4]; __u8 asc; __u8 ascq; __u8 fruc; __u8 sks[3]; __u8 asb[46]; }; /* * feature profile */ #define CDF_RWRT 0x0020 /* "Random Writable" */ #define CDF_HWDM 0x0024 /* "Hardware Defect Management" */ #define CDF_MRW 0x0028 /* * media status bits */ #define CDM_MRW_NOTMRW 0 #define CDM_MRW_BGFORMAT_INACTIVE 1 #define CDM_MRW_BGFORMAT_ACTIVE 2 #define CDM_MRW_BGFORMAT_COMPLETE 3 /* * mrw address spaces */ #define MRW_LBA_DMA 0 #define MRW_LBA_GAA 1 /* * mrw mode pages (first is deprecated) -- probed at init time and * cdi->mrw_mode_page is set */ #define MRW_MODE_PC_PRE1 0x2c #define MRW_MODE_PC 0x03 struct mrw_feature_desc { __be16 feature_code; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 2; __u8 feature_version : 4; __u8 persistent : 1; __u8 curr : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr : 1; __u8 persistent : 1; __u8 feature_version : 4; __u8 reserved1 : 2; #endif __u8 add_len; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 7; __u8 write : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 write : 1; __u8 reserved2 : 7; #endif __u8 reserved3; __u8 reserved4; __u8 reserved5; }; /* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ struct rwrt_feature_desc { __be16 feature_code; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 2; __u8 feature_version : 4; __u8 persistent : 1; __u8 curr : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr : 1; __u8 persistent : 1; __u8 feature_version : 4; __u8 reserved1 : 2; #endif __u8 add_len; __u32 last_lba; __u32 block_size; __u16 blocking; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 7; __u8 page_present : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 page_present : 1; __u8 reserved2 : 7; #endif __u8 reserved3; }; typedef struct { __be16 disc_information_length; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1 : 3; __u8 erasable : 1; __u8 border_status : 2; __u8 disc_status : 2; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 disc_status : 2; __u8 border_status : 2; __u8 erasable : 1; __u8 reserved1 : 3; #else #error "Please fix <asm/byteorder.h>" #endif __u8 n_first_track; __u8 n_sessions_lsb; __u8 first_track_lsb; __u8 last_track_lsb; #if defined(__BIG_ENDIAN_BITFIELD) __u8 did_v : 1; __u8 dbc_v : 1; __u8 uru : 1; __u8 reserved2 : 2; __u8 dbit : 1; __u8 mrw_status : 2; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 mrw_status : 2; __u8 dbit : 1; __u8 reserved2 : 2; __u8 uru : 1; __u8 dbc_v : 1; __u8 did_v : 1; #endif __u8 disc_type; __u8 n_sessions_msb; __u8 first_track_msb; __u8 last_track_msb; __u32 disc_id; __u32 lead_in; __u32 lead_out; __u8 disc_bar_code[8]; __u8 reserved3; __u8 n_opc; } disc_information; typedef struct { __be16 track_information_length; __u8 track_lsb; __u8 session_lsb; __u8 reserved1; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved2 : 2; __u8 damage : 1; __u8 copy : 1; __u8 track_mode : 4; __u8 rt : 1; __u8 blank : 1; __u8 packet : 1; __u8 fp : 1; __u8 data_mode : 4; __u8 reserved3 : 6; __u8 lra_v : 1; __u8 nwa_v : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 track_mode : 4; __u8 copy : 1; __u8 damage : 1; __u8 reserved2 : 2; __u8 data_mode : 4; __u8 fp : 1; __u8 packet : 1; __u8 blank : 1; __u8 rt : 1; __u8 nwa_v : 1; __u8 lra_v : 1; __u8 reserved3 : 6; #endif __be32 track_start; __be32 next_writable; __be32 free_blocks; __be32 fixed_packet_size; __be32 track_size; __be32 last_rec_address; } track_information; struct feature_header { __u32 data_len; __u8 reserved1; __u8 reserved2; __u16 curr_profile; }; struct mode_page_header { __be16 mode_data_length; __u8 medium_type; __u8 reserved1; __u8 reserved2; __u8 reserved3; __be16 desc_length; }; /* removable medium feature descriptor */ struct rm_feature_desc { __be16 feature_code; #if defined(__BIG_ENDIAN_BITFIELD) __u8 reserved1:2; __u8 feature_version:4; __u8 persistent:1; __u8 curr:1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr:1; __u8 persistent:1; __u8 feature_version:4; __u8 reserved1:2; #endif __u8 add_len; #if defined(__BIG_ENDIAN_BITFIELD) __u8 mech_type:3; __u8 load:1; __u8 eject:1; __u8 pvnt_jmpr:1; __u8 dbml:1; __u8 lock:1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 lock:1; __u8 dbml:1; __u8 pvnt_jmpr:1; __u8 eject:1; __u8 load:1; __u8 mech_type:3; #endif __u8 reserved2; __u8 reserved3; __u8 reserved4; }; #endif /* _LINUX_CDROM_H */ linux/cec-funcs.h 0000644 00000151215 15063602060 0007725 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * cec - HDMI Consumer Electronics Control message functions * * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ #ifndef _CEC_UAPI_FUNCS_H #define _CEC_UAPI_FUNCS_H #include <linux/cec.h> /* One Touch Play Feature */ static __inline__ void cec_msg_active_source(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_ACTIVE_SOURCE; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_active_source(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_image_view_on(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_IMAGE_VIEW_ON; } static __inline__ void cec_msg_text_view_on(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_TEXT_VIEW_ON; } /* Routing Control Feature */ static __inline__ void cec_msg_inactive_source(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[1] = CEC_MSG_INACTIVE_SOURCE; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_inactive_source(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_request_active_source(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REQUEST_ACTIVE_SOURCE; msg->reply = reply ? CEC_MSG_ACTIVE_SOURCE : 0; } static __inline__ void cec_msg_routing_information(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_ROUTING_INFORMATION; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_routing_information(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_routing_change(struct cec_msg *msg, int reply, __u16 orig_phys_addr, __u16 new_phys_addr) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_ROUTING_CHANGE; msg->msg[2] = orig_phys_addr >> 8; msg->msg[3] = orig_phys_addr & 0xff; msg->msg[4] = new_phys_addr >> 8; msg->msg[5] = new_phys_addr & 0xff; msg->reply = reply ? CEC_MSG_ROUTING_INFORMATION : 0; } static __inline__ void cec_ops_routing_change(const struct cec_msg *msg, __u16 *orig_phys_addr, __u16 *new_phys_addr) { *orig_phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *new_phys_addr = (msg->msg[4] << 8) | msg->msg[5]; } static __inline__ void cec_msg_set_stream_path(struct cec_msg *msg, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_SET_STREAM_PATH; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; } static __inline__ void cec_ops_set_stream_path(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } /* Standby Feature */ static __inline__ void cec_msg_standby(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_STANDBY; } /* One Touch Record Feature */ static __inline__ void cec_msg_record_off(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_RECORD_OFF; msg->reply = reply ? CEC_MSG_RECORD_STATUS : 0; } struct cec_op_arib_data { __u16 transport_id; __u16 service_id; __u16 orig_network_id; }; struct cec_op_atsc_data { __u16 transport_id; __u16 program_number; }; struct cec_op_dvb_data { __u16 transport_id; __u16 service_id; __u16 orig_network_id; }; struct cec_op_channel_data { __u8 channel_number_fmt; __u16 major; __u16 minor; }; struct cec_op_digital_service_id { __u8 service_id_method; __u8 dig_bcast_system; union { struct cec_op_arib_data arib; struct cec_op_atsc_data atsc; struct cec_op_dvb_data dvb; struct cec_op_channel_data channel; }; }; struct cec_op_record_src { __u8 type; union { struct cec_op_digital_service_id digital; struct { __u8 ana_bcast_type; __u16 ana_freq; __u8 bcast_system; } analog; struct { __u8 plug; } ext_plug; struct { __u16 phys_addr; } ext_phys_addr; }; }; static __inline__ void cec_set_digital_service_id(__u8 *msg, const struct cec_op_digital_service_id *digital) { *msg++ = (digital->service_id_method << 7) | digital->dig_bcast_system; if (digital->service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL) { *msg++ = (digital->channel.channel_number_fmt << 2) | (digital->channel.major >> 8); *msg++ = digital->channel.major & 0xff; *msg++ = digital->channel.minor >> 8; *msg++ = digital->channel.minor & 0xff; *msg++ = 0; *msg++ = 0; return; } switch (digital->dig_bcast_system) { case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_GEN: case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_CABLE: case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT: case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T: *msg++ = digital->atsc.transport_id >> 8; *msg++ = digital->atsc.transport_id & 0xff; *msg++ = digital->atsc.program_number >> 8; *msg++ = digital->atsc.program_number & 0xff; *msg++ = 0; *msg++ = 0; break; default: *msg++ = digital->dvb.transport_id >> 8; *msg++ = digital->dvb.transport_id & 0xff; *msg++ = digital->dvb.service_id >> 8; *msg++ = digital->dvb.service_id & 0xff; *msg++ = digital->dvb.orig_network_id >> 8; *msg++ = digital->dvb.orig_network_id & 0xff; break; } } static __inline__ void cec_get_digital_service_id(const __u8 *msg, struct cec_op_digital_service_id *digital) { digital->service_id_method = msg[0] >> 7; digital->dig_bcast_system = msg[0] & 0x7f; if (digital->service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL) { digital->channel.channel_number_fmt = msg[1] >> 2; digital->channel.major = ((msg[1] & 3) << 6) | msg[2]; digital->channel.minor = (msg[3] << 8) | msg[4]; return; } digital->dvb.transport_id = (msg[1] << 8) | msg[2]; digital->dvb.service_id = (msg[3] << 8) | msg[4]; digital->dvb.orig_network_id = (msg[5] << 8) | msg[6]; } static __inline__ void cec_msg_record_on_own(struct cec_msg *msg) { msg->len = 3; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_OWN; } static __inline__ void cec_msg_record_on_digital(struct cec_msg *msg, const struct cec_op_digital_service_id *digital) { msg->len = 10; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_DIGITAL; cec_set_digital_service_id(msg->msg + 3, digital); } static __inline__ void cec_msg_record_on_analog(struct cec_msg *msg, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 7; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_ANALOG; msg->msg[3] = ana_bcast_type; msg->msg[4] = ana_freq >> 8; msg->msg[5] = ana_freq & 0xff; msg->msg[6] = bcast_system; } static __inline__ void cec_msg_record_on_plug(struct cec_msg *msg, __u8 plug) { msg->len = 4; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_EXT_PLUG; msg->msg[3] = plug; } static __inline__ void cec_msg_record_on_phys_addr(struct cec_msg *msg, __u16 phys_addr) { msg->len = 5; msg->msg[1] = CEC_MSG_RECORD_ON; msg->msg[2] = CEC_OP_RECORD_SRC_EXT_PHYS_ADDR; msg->msg[3] = phys_addr >> 8; msg->msg[4] = phys_addr & 0xff; } static __inline__ void cec_msg_record_on(struct cec_msg *msg, int reply, const struct cec_op_record_src *rec_src) { switch (rec_src->type) { case CEC_OP_RECORD_SRC_OWN: cec_msg_record_on_own(msg); break; case CEC_OP_RECORD_SRC_DIGITAL: cec_msg_record_on_digital(msg, &rec_src->digital); break; case CEC_OP_RECORD_SRC_ANALOG: cec_msg_record_on_analog(msg, rec_src->analog.ana_bcast_type, rec_src->analog.ana_freq, rec_src->analog.bcast_system); break; case CEC_OP_RECORD_SRC_EXT_PLUG: cec_msg_record_on_plug(msg, rec_src->ext_plug.plug); break; case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR: cec_msg_record_on_phys_addr(msg, rec_src->ext_phys_addr.phys_addr); break; } msg->reply = reply ? CEC_MSG_RECORD_STATUS : 0; } static __inline__ void cec_ops_record_on(const struct cec_msg *msg, struct cec_op_record_src *rec_src) { rec_src->type = msg->msg[2]; switch (rec_src->type) { case CEC_OP_RECORD_SRC_OWN: break; case CEC_OP_RECORD_SRC_DIGITAL: cec_get_digital_service_id(msg->msg + 3, &rec_src->digital); break; case CEC_OP_RECORD_SRC_ANALOG: rec_src->analog.ana_bcast_type = msg->msg[3]; rec_src->analog.ana_freq = (msg->msg[4] << 8) | msg->msg[5]; rec_src->analog.bcast_system = msg->msg[6]; break; case CEC_OP_RECORD_SRC_EXT_PLUG: rec_src->ext_plug.plug = msg->msg[3]; break; case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR: rec_src->ext_phys_addr.phys_addr = (msg->msg[3] << 8) | msg->msg[4]; break; } } static __inline__ void cec_msg_record_status(struct cec_msg *msg, __u8 rec_status) { msg->len = 3; msg->msg[1] = CEC_MSG_RECORD_STATUS; msg->msg[2] = rec_status; } static __inline__ void cec_ops_record_status(const struct cec_msg *msg, __u8 *rec_status) { *rec_status = msg->msg[2]; } static __inline__ void cec_msg_record_tv_screen(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_RECORD_TV_SCREEN; msg->reply = reply ? CEC_MSG_RECORD_ON : 0; } /* Timer Programming Feature */ static __inline__ void cec_msg_timer_status(struct cec_msg *msg, __u8 timer_overlap_warning, __u8 media_info, __u8 prog_info, __u8 prog_error, __u8 duration_hr, __u8 duration_min) { msg->len = 3; msg->msg[1] = CEC_MSG_TIMER_STATUS; msg->msg[2] = (timer_overlap_warning << 7) | (media_info << 5) | (prog_info ? 0x10 : 0) | (prog_info ? prog_info : prog_error); if (prog_info == CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE || prog_info == CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE || prog_error == CEC_OP_PROG_ERROR_DUPLICATE) { msg->len += 2; msg->msg[3] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[4] = ((duration_min / 10) << 4) | (duration_min % 10); } } static __inline__ void cec_ops_timer_status(const struct cec_msg *msg, __u8 *timer_overlap_warning, __u8 *media_info, __u8 *prog_info, __u8 *prog_error, __u8 *duration_hr, __u8 *duration_min) { *timer_overlap_warning = msg->msg[2] >> 7; *media_info = (msg->msg[2] >> 5) & 3; if (msg->msg[2] & 0x10) { *prog_info = msg->msg[2] & 0xf; *prog_error = 0; } else { *prog_info = 0; *prog_error = msg->msg[2] & 0xf; } if (*prog_info == CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE || *prog_info == CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE || *prog_error == CEC_OP_PROG_ERROR_DUPLICATE) { *duration_hr = (msg->msg[3] >> 4) * 10 + (msg->msg[3] & 0xf); *duration_min = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); } else { *duration_hr = *duration_min = 0; } } static __inline__ void cec_msg_timer_cleared_status(struct cec_msg *msg, __u8 timer_cleared_status) { msg->len = 3; msg->msg[1] = CEC_MSG_TIMER_CLEARED_STATUS; msg->msg[2] = timer_cleared_status; } static __inline__ void cec_ops_timer_cleared_status(const struct cec_msg *msg, __u8 *timer_cleared_status) { *timer_cleared_status = msg->msg[2]; } static __inline__ void cec_msg_clear_analogue_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 13; msg->msg[1] = CEC_MSG_CLEAR_ANALOGUE_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ana_bcast_type; msg->msg[10] = ana_freq >> 8; msg->msg[11] = ana_freq & 0xff; msg->msg[12] = bcast_system; msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0; } static __inline__ void cec_ops_clear_analogue_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ana_bcast_type, __u16 *ana_freq, __u8 *bcast_system) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ana_bcast_type = msg->msg[9]; *ana_freq = (msg->msg[10] << 8) | msg->msg[11]; *bcast_system = msg->msg[12]; } static __inline__ void cec_msg_clear_digital_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, const struct cec_op_digital_service_id *digital) { msg->len = 16; msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0; msg->msg[1] = CEC_MSG_CLEAR_DIGITAL_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; cec_set_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_ops_clear_digital_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, struct cec_op_digital_service_id *digital) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; cec_get_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_msg_clear_ext_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ext_src_spec, __u8 plug, __u16 phys_addr) { msg->len = 13; msg->msg[1] = CEC_MSG_CLEAR_EXT_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ext_src_spec; msg->msg[10] = plug; msg->msg[11] = phys_addr >> 8; msg->msg[12] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_TIMER_CLEARED_STATUS : 0; } static __inline__ void cec_ops_clear_ext_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ext_src_spec, __u8 *plug, __u16 *phys_addr) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ext_src_spec = msg->msg[9]; *plug = msg->msg[10]; *phys_addr = (msg->msg[11] << 8) | msg->msg[12]; } static __inline__ void cec_msg_set_analogue_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 13; msg->msg[1] = CEC_MSG_SET_ANALOGUE_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ana_bcast_type; msg->msg[10] = ana_freq >> 8; msg->msg[11] = ana_freq & 0xff; msg->msg[12] = bcast_system; msg->reply = reply ? CEC_MSG_TIMER_STATUS : 0; } static __inline__ void cec_ops_set_analogue_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ana_bcast_type, __u16 *ana_freq, __u8 *bcast_system) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ana_bcast_type = msg->msg[9]; *ana_freq = (msg->msg[10] << 8) | msg->msg[11]; *bcast_system = msg->msg[12]; } static __inline__ void cec_msg_set_digital_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, const struct cec_op_digital_service_id *digital) { msg->len = 16; msg->reply = reply ? CEC_MSG_TIMER_STATUS : 0; msg->msg[1] = CEC_MSG_SET_DIGITAL_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; cec_set_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_ops_set_digital_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, struct cec_op_digital_service_id *digital) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; cec_get_digital_service_id(msg->msg + 9, digital); } static __inline__ void cec_msg_set_ext_timer(struct cec_msg *msg, int reply, __u8 day, __u8 month, __u8 start_hr, __u8 start_min, __u8 duration_hr, __u8 duration_min, __u8 recording_seq, __u8 ext_src_spec, __u8 plug, __u16 phys_addr) { msg->len = 13; msg->msg[1] = CEC_MSG_SET_EXT_TIMER; msg->msg[2] = day; msg->msg[3] = month; /* Hours and minutes are in BCD format */ msg->msg[4] = ((start_hr / 10) << 4) | (start_hr % 10); msg->msg[5] = ((start_min / 10) << 4) | (start_min % 10); msg->msg[6] = ((duration_hr / 10) << 4) | (duration_hr % 10); msg->msg[7] = ((duration_min / 10) << 4) | (duration_min % 10); msg->msg[8] = recording_seq; msg->msg[9] = ext_src_spec; msg->msg[10] = plug; msg->msg[11] = phys_addr >> 8; msg->msg[12] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_TIMER_STATUS : 0; } static __inline__ void cec_ops_set_ext_timer(const struct cec_msg *msg, __u8 *day, __u8 *month, __u8 *start_hr, __u8 *start_min, __u8 *duration_hr, __u8 *duration_min, __u8 *recording_seq, __u8 *ext_src_spec, __u8 *plug, __u16 *phys_addr) { *day = msg->msg[2]; *month = msg->msg[3]; /* Hours and minutes are in BCD format */ *start_hr = (msg->msg[4] >> 4) * 10 + (msg->msg[4] & 0xf); *start_min = (msg->msg[5] >> 4) * 10 + (msg->msg[5] & 0xf); *duration_hr = (msg->msg[6] >> 4) * 10 + (msg->msg[6] & 0xf); *duration_min = (msg->msg[7] >> 4) * 10 + (msg->msg[7] & 0xf); *recording_seq = msg->msg[8]; *ext_src_spec = msg->msg[9]; *plug = msg->msg[10]; *phys_addr = (msg->msg[11] << 8) | msg->msg[12]; } static __inline__ void cec_msg_set_timer_program_title(struct cec_msg *msg, const char *prog_title) { unsigned int len = strlen(prog_title); if (len > 14) len = 14; msg->len = 2 + len; msg->msg[1] = CEC_MSG_SET_TIMER_PROGRAM_TITLE; memcpy(msg->msg + 2, prog_title, len); } static __inline__ void cec_ops_set_timer_program_title(const struct cec_msg *msg, char *prog_title) { unsigned int len = msg->len > 2 ? msg->len - 2 : 0; if (len > 14) len = 14; memcpy(prog_title, msg->msg + 2, len); prog_title[len] = '\0'; } /* System Information Feature */ static __inline__ void cec_msg_cec_version(struct cec_msg *msg, __u8 cec_version) { msg->len = 3; msg->msg[1] = CEC_MSG_CEC_VERSION; msg->msg[2] = cec_version; } static __inline__ void cec_ops_cec_version(const struct cec_msg *msg, __u8 *cec_version) { *cec_version = msg->msg[2]; } static __inline__ void cec_msg_get_cec_version(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GET_CEC_VERSION; msg->reply = reply ? CEC_MSG_CEC_VERSION : 0; } static __inline__ void cec_msg_report_physical_addr(struct cec_msg *msg, __u16 phys_addr, __u8 prim_devtype) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REPORT_PHYSICAL_ADDR; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->msg[4] = prim_devtype; } static __inline__ void cec_ops_report_physical_addr(const struct cec_msg *msg, __u16 *phys_addr, __u8 *prim_devtype) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *prim_devtype = msg->msg[4]; } static __inline__ void cec_msg_give_physical_addr(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_PHYSICAL_ADDR; msg->reply = reply ? CEC_MSG_REPORT_PHYSICAL_ADDR : 0; } static __inline__ void cec_msg_set_menu_language(struct cec_msg *msg, const char *language) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_SET_MENU_LANGUAGE; memcpy(msg->msg + 2, language, 3); } static __inline__ void cec_ops_set_menu_language(const struct cec_msg *msg, char *language) { memcpy(language, msg->msg + 2, 3); language[3] = '\0'; } static __inline__ void cec_msg_get_menu_language(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GET_MENU_LANGUAGE; msg->reply = reply ? CEC_MSG_SET_MENU_LANGUAGE : 0; } /* * Assumes a single RC Profile byte and a single Device Features byte, * i.e. no extended features are supported by this helper function. * * As of CEC 2.0 no extended features are defined, should those be added * in the future, then this function needs to be adapted or a new function * should be added. */ static __inline__ void cec_msg_report_features(struct cec_msg *msg, __u8 cec_version, __u8 all_device_types, __u8 rc_profile, __u8 dev_features) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REPORT_FEATURES; msg->msg[2] = cec_version; msg->msg[3] = all_device_types; msg->msg[4] = rc_profile; msg->msg[5] = dev_features; } static __inline__ void cec_ops_report_features(const struct cec_msg *msg, __u8 *cec_version, __u8 *all_device_types, const __u8 **rc_profile, const __u8 **dev_features) { const __u8 *p = &msg->msg[4]; *cec_version = msg->msg[2]; *all_device_types = msg->msg[3]; *rc_profile = p; *dev_features = NULL; while (p < &msg->msg[14] && (*p & CEC_OP_FEAT_EXT)) p++; if (!(*p & CEC_OP_FEAT_EXT)) { *dev_features = p + 1; while (p < &msg->msg[15] && (*p & CEC_OP_FEAT_EXT)) p++; } if (*p & CEC_OP_FEAT_EXT) *rc_profile = *dev_features = NULL; } static __inline__ void cec_msg_give_features(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_FEATURES; msg->reply = reply ? CEC_MSG_REPORT_FEATURES : 0; } /* Deck Control Feature */ static __inline__ void cec_msg_deck_control(struct cec_msg *msg, __u8 deck_control_mode) { msg->len = 3; msg->msg[1] = CEC_MSG_DECK_CONTROL; msg->msg[2] = deck_control_mode; } static __inline__ void cec_ops_deck_control(const struct cec_msg *msg, __u8 *deck_control_mode) { *deck_control_mode = msg->msg[2]; } static __inline__ void cec_msg_deck_status(struct cec_msg *msg, __u8 deck_info) { msg->len = 3; msg->msg[1] = CEC_MSG_DECK_STATUS; msg->msg[2] = deck_info; } static __inline__ void cec_ops_deck_status(const struct cec_msg *msg, __u8 *deck_info) { *deck_info = msg->msg[2]; } static __inline__ void cec_msg_give_deck_status(struct cec_msg *msg, int reply, __u8 status_req) { msg->len = 3; msg->msg[1] = CEC_MSG_GIVE_DECK_STATUS; msg->msg[2] = status_req; msg->reply = reply ? CEC_MSG_DECK_STATUS : 0; } static __inline__ void cec_ops_give_deck_status(const struct cec_msg *msg, __u8 *status_req) { *status_req = msg->msg[2]; } static __inline__ void cec_msg_play(struct cec_msg *msg, __u8 play_mode) { msg->len = 3; msg->msg[1] = CEC_MSG_PLAY; msg->msg[2] = play_mode; } static __inline__ void cec_ops_play(const struct cec_msg *msg, __u8 *play_mode) { *play_mode = msg->msg[2]; } /* Tuner Control Feature */ struct cec_op_tuner_device_info { __u8 rec_flag; __u8 tuner_display_info; __u8 is_analog; union { struct cec_op_digital_service_id digital; struct { __u8 ana_bcast_type; __u16 ana_freq; __u8 bcast_system; } analog; }; }; static __inline__ void cec_msg_tuner_device_status_analog(struct cec_msg *msg, __u8 rec_flag, __u8 tuner_display_info, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 7; msg->msg[1] = CEC_MSG_TUNER_DEVICE_STATUS; msg->msg[2] = (rec_flag << 7) | tuner_display_info; msg->msg[3] = ana_bcast_type; msg->msg[4] = ana_freq >> 8; msg->msg[5] = ana_freq & 0xff; msg->msg[6] = bcast_system; } static __inline__ void cec_msg_tuner_device_status_digital(struct cec_msg *msg, __u8 rec_flag, __u8 tuner_display_info, const struct cec_op_digital_service_id *digital) { msg->len = 10; msg->msg[1] = CEC_MSG_TUNER_DEVICE_STATUS; msg->msg[2] = (rec_flag << 7) | tuner_display_info; cec_set_digital_service_id(msg->msg + 3, digital); } static __inline__ void cec_msg_tuner_device_status(struct cec_msg *msg, const struct cec_op_tuner_device_info *tuner_dev_info) { if (tuner_dev_info->is_analog) cec_msg_tuner_device_status_analog(msg, tuner_dev_info->rec_flag, tuner_dev_info->tuner_display_info, tuner_dev_info->analog.ana_bcast_type, tuner_dev_info->analog.ana_freq, tuner_dev_info->analog.bcast_system); else cec_msg_tuner_device_status_digital(msg, tuner_dev_info->rec_flag, tuner_dev_info->tuner_display_info, &tuner_dev_info->digital); } static __inline__ void cec_ops_tuner_device_status(const struct cec_msg *msg, struct cec_op_tuner_device_info *tuner_dev_info) { tuner_dev_info->is_analog = msg->len < 10; tuner_dev_info->rec_flag = msg->msg[2] >> 7; tuner_dev_info->tuner_display_info = msg->msg[2] & 0x7f; if (tuner_dev_info->is_analog) { tuner_dev_info->analog.ana_bcast_type = msg->msg[3]; tuner_dev_info->analog.ana_freq = (msg->msg[4] << 8) | msg->msg[5]; tuner_dev_info->analog.bcast_system = msg->msg[6]; return; } cec_get_digital_service_id(msg->msg + 3, &tuner_dev_info->digital); } static __inline__ void cec_msg_give_tuner_device_status(struct cec_msg *msg, int reply, __u8 status_req) { msg->len = 3; msg->msg[1] = CEC_MSG_GIVE_TUNER_DEVICE_STATUS; msg->msg[2] = status_req; msg->reply = reply ? CEC_MSG_TUNER_DEVICE_STATUS : 0; } static __inline__ void cec_ops_give_tuner_device_status(const struct cec_msg *msg, __u8 *status_req) { *status_req = msg->msg[2]; } static __inline__ void cec_msg_select_analogue_service(struct cec_msg *msg, __u8 ana_bcast_type, __u16 ana_freq, __u8 bcast_system) { msg->len = 6; msg->msg[1] = CEC_MSG_SELECT_ANALOGUE_SERVICE; msg->msg[2] = ana_bcast_type; msg->msg[3] = ana_freq >> 8; msg->msg[4] = ana_freq & 0xff; msg->msg[5] = bcast_system; } static __inline__ void cec_ops_select_analogue_service(const struct cec_msg *msg, __u8 *ana_bcast_type, __u16 *ana_freq, __u8 *bcast_system) { *ana_bcast_type = msg->msg[2]; *ana_freq = (msg->msg[3] << 8) | msg->msg[4]; *bcast_system = msg->msg[5]; } static __inline__ void cec_msg_select_digital_service(struct cec_msg *msg, const struct cec_op_digital_service_id *digital) { msg->len = 9; msg->msg[1] = CEC_MSG_SELECT_DIGITAL_SERVICE; cec_set_digital_service_id(msg->msg + 2, digital); } static __inline__ void cec_ops_select_digital_service(const struct cec_msg *msg, struct cec_op_digital_service_id *digital) { cec_get_digital_service_id(msg->msg + 2, digital); } static __inline__ void cec_msg_tuner_step_decrement(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_TUNER_STEP_DECREMENT; } static __inline__ void cec_msg_tuner_step_increment(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_TUNER_STEP_INCREMENT; } /* Vendor Specific Commands Feature */ static __inline__ void cec_msg_device_vendor_id(struct cec_msg *msg, __u32 vendor_id) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_DEVICE_VENDOR_ID; msg->msg[2] = vendor_id >> 16; msg->msg[3] = (vendor_id >> 8) & 0xff; msg->msg[4] = vendor_id & 0xff; } static __inline__ void cec_ops_device_vendor_id(const struct cec_msg *msg, __u32 *vendor_id) { *vendor_id = (msg->msg[2] << 16) | (msg->msg[3] << 8) | msg->msg[4]; } static __inline__ void cec_msg_give_device_vendor_id(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_DEVICE_VENDOR_ID; msg->reply = reply ? CEC_MSG_DEVICE_VENDOR_ID : 0; } static __inline__ void cec_msg_vendor_command(struct cec_msg *msg, __u8 size, const __u8 *vendor_cmd) { if (size > 14) size = 14; msg->len = 2 + size; msg->msg[1] = CEC_MSG_VENDOR_COMMAND; memcpy(msg->msg + 2, vendor_cmd, size); } static __inline__ void cec_ops_vendor_command(const struct cec_msg *msg, __u8 *size, const __u8 **vendor_cmd) { *size = msg->len - 2; if (*size > 14) *size = 14; *vendor_cmd = msg->msg + 2; } static __inline__ void cec_msg_vendor_command_with_id(struct cec_msg *msg, __u32 vendor_id, __u8 size, const __u8 *vendor_cmd) { if (size > 11) size = 11; msg->len = 5 + size; msg->msg[1] = CEC_MSG_VENDOR_COMMAND_WITH_ID; msg->msg[2] = vendor_id >> 16; msg->msg[3] = (vendor_id >> 8) & 0xff; msg->msg[4] = vendor_id & 0xff; memcpy(msg->msg + 5, vendor_cmd, size); } static __inline__ void cec_ops_vendor_command_with_id(const struct cec_msg *msg, __u32 *vendor_id, __u8 *size, const __u8 **vendor_cmd) { *size = msg->len - 5; if (*size > 11) *size = 11; *vendor_id = (msg->msg[2] << 16) | (msg->msg[3] << 8) | msg->msg[4]; *vendor_cmd = msg->msg + 5; } static __inline__ void cec_msg_vendor_remote_button_down(struct cec_msg *msg, __u8 size, const __u8 *rc_code) { if (size > 14) size = 14; msg->len = 2 + size; msg->msg[1] = CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN; memcpy(msg->msg + 2, rc_code, size); } static __inline__ void cec_ops_vendor_remote_button_down(const struct cec_msg *msg, __u8 *size, const __u8 **rc_code) { *size = msg->len - 2; if (*size > 14) *size = 14; *rc_code = msg->msg + 2; } static __inline__ void cec_msg_vendor_remote_button_up(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_VENDOR_REMOTE_BUTTON_UP; } /* OSD Display Feature */ static __inline__ void cec_msg_set_osd_string(struct cec_msg *msg, __u8 disp_ctl, const char *osd) { unsigned int len = strlen(osd); if (len > 13) len = 13; msg->len = 3 + len; msg->msg[1] = CEC_MSG_SET_OSD_STRING; msg->msg[2] = disp_ctl; memcpy(msg->msg + 3, osd, len); } static __inline__ void cec_ops_set_osd_string(const struct cec_msg *msg, __u8 *disp_ctl, char *osd) { unsigned int len = msg->len > 3 ? msg->len - 3 : 0; *disp_ctl = msg->msg[2]; if (len > 13) len = 13; memcpy(osd, msg->msg + 3, len); osd[len] = '\0'; } /* Device OSD Transfer Feature */ static __inline__ void cec_msg_set_osd_name(struct cec_msg *msg, const char *name) { unsigned int len = strlen(name); if (len > 14) len = 14; msg->len = 2 + len; msg->msg[1] = CEC_MSG_SET_OSD_NAME; memcpy(msg->msg + 2, name, len); } static __inline__ void cec_ops_set_osd_name(const struct cec_msg *msg, char *name) { unsigned int len = msg->len > 2 ? msg->len - 2 : 0; if (len > 14) len = 14; memcpy(name, msg->msg + 2, len); name[len] = '\0'; } static __inline__ void cec_msg_give_osd_name(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_OSD_NAME; msg->reply = reply ? CEC_MSG_SET_OSD_NAME : 0; } /* Device Menu Control Feature */ static __inline__ void cec_msg_menu_status(struct cec_msg *msg, __u8 menu_state) { msg->len = 3; msg->msg[1] = CEC_MSG_MENU_STATUS; msg->msg[2] = menu_state; } static __inline__ void cec_ops_menu_status(const struct cec_msg *msg, __u8 *menu_state) { *menu_state = msg->msg[2]; } static __inline__ void cec_msg_menu_request(struct cec_msg *msg, int reply, __u8 menu_req) { msg->len = 3; msg->msg[1] = CEC_MSG_MENU_REQUEST; msg->msg[2] = menu_req; msg->reply = reply ? CEC_MSG_MENU_STATUS : 0; } static __inline__ void cec_ops_menu_request(const struct cec_msg *msg, __u8 *menu_req) { *menu_req = msg->msg[2]; } struct cec_op_ui_command { __u8 ui_cmd; __u8 has_opt_arg; union { struct cec_op_channel_data channel_identifier; __u8 ui_broadcast_type; __u8 ui_sound_presentation_control; __u8 play_mode; __u8 ui_function_media; __u8 ui_function_select_av_input; __u8 ui_function_select_audio_input; }; }; static __inline__ void cec_msg_user_control_pressed(struct cec_msg *msg, const struct cec_op_ui_command *ui_cmd) { msg->len = 3; msg->msg[1] = CEC_MSG_USER_CONTROL_PRESSED; msg->msg[2] = ui_cmd->ui_cmd; if (!ui_cmd->has_opt_arg) return; switch (ui_cmd->ui_cmd) { case 0x56: case 0x57: case 0x60: case 0x68: case 0x69: case 0x6a: /* The optional operand is one byte for all these ui commands */ msg->len++; msg->msg[3] = ui_cmd->play_mode; break; case 0x67: msg->len += 4; msg->msg[3] = (ui_cmd->channel_identifier.channel_number_fmt << 2) | (ui_cmd->channel_identifier.major >> 8); msg->msg[4] = ui_cmd->channel_identifier.major & 0xff; msg->msg[5] = ui_cmd->channel_identifier.minor >> 8; msg->msg[6] = ui_cmd->channel_identifier.minor & 0xff; break; } } static __inline__ void cec_ops_user_control_pressed(const struct cec_msg *msg, struct cec_op_ui_command *ui_cmd) { ui_cmd->ui_cmd = msg->msg[2]; ui_cmd->has_opt_arg = 0; if (msg->len == 3) return; switch (ui_cmd->ui_cmd) { case 0x56: case 0x57: case 0x60: case 0x68: case 0x69: case 0x6a: /* The optional operand is one byte for all these ui commands */ ui_cmd->play_mode = msg->msg[3]; ui_cmd->has_opt_arg = 1; break; case 0x67: if (msg->len < 7) break; ui_cmd->has_opt_arg = 1; ui_cmd->channel_identifier.channel_number_fmt = msg->msg[3] >> 2; ui_cmd->channel_identifier.major = ((msg->msg[3] & 3) << 6) | msg->msg[4]; ui_cmd->channel_identifier.minor = (msg->msg[5] << 8) | msg->msg[6]; break; } } static __inline__ void cec_msg_user_control_released(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_USER_CONTROL_RELEASED; } /* Remote Control Passthrough Feature */ /* Power Status Feature */ static __inline__ void cec_msg_report_power_status(struct cec_msg *msg, __u8 pwr_state) { msg->len = 3; msg->msg[1] = CEC_MSG_REPORT_POWER_STATUS; msg->msg[2] = pwr_state; } static __inline__ void cec_ops_report_power_status(const struct cec_msg *msg, __u8 *pwr_state) { *pwr_state = msg->msg[2]; } static __inline__ void cec_msg_give_device_power_status(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_DEVICE_POWER_STATUS; msg->reply = reply ? CEC_MSG_REPORT_POWER_STATUS : 0; } /* General Protocol Messages */ static __inline__ void cec_msg_feature_abort(struct cec_msg *msg, __u8 abort_msg, __u8 reason) { msg->len = 4; msg->msg[1] = CEC_MSG_FEATURE_ABORT; msg->msg[2] = abort_msg; msg->msg[3] = reason; } static __inline__ void cec_ops_feature_abort(const struct cec_msg *msg, __u8 *abort_msg, __u8 *reason) { *abort_msg = msg->msg[2]; *reason = msg->msg[3]; } /* This changes the current message into a feature abort message */ static __inline__ void cec_msg_reply_feature_abort(struct cec_msg *msg, __u8 reason) { cec_msg_set_reply_to(msg, msg); msg->len = 4; msg->msg[2] = msg->msg[1]; msg->msg[3] = reason; msg->msg[1] = CEC_MSG_FEATURE_ABORT; } static __inline__ void cec_msg_abort(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_ABORT; } /* System Audio Control Feature */ static __inline__ void cec_msg_report_audio_status(struct cec_msg *msg, __u8 aud_mute_status, __u8 aud_vol_status) { msg->len = 3; msg->msg[1] = CEC_MSG_REPORT_AUDIO_STATUS; msg->msg[2] = (aud_mute_status << 7) | (aud_vol_status & 0x7f); } static __inline__ void cec_ops_report_audio_status(const struct cec_msg *msg, __u8 *aud_mute_status, __u8 *aud_vol_status) { *aud_mute_status = msg->msg[2] >> 7; *aud_vol_status = msg->msg[2] & 0x7f; } static __inline__ void cec_msg_give_audio_status(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_AUDIO_STATUS; msg->reply = reply ? CEC_MSG_REPORT_AUDIO_STATUS : 0; } static __inline__ void cec_msg_set_system_audio_mode(struct cec_msg *msg, __u8 sys_aud_status) { msg->len = 3; msg->msg[1] = CEC_MSG_SET_SYSTEM_AUDIO_MODE; msg->msg[2] = sys_aud_status; } static __inline__ void cec_ops_set_system_audio_mode(const struct cec_msg *msg, __u8 *sys_aud_status) { *sys_aud_status = msg->msg[2]; } static __inline__ void cec_msg_system_audio_mode_request(struct cec_msg *msg, int reply, __u16 phys_addr) { msg->len = phys_addr == 0xffff ? 2 : 4; msg->msg[1] = CEC_MSG_SYSTEM_AUDIO_MODE_REQUEST; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_SET_SYSTEM_AUDIO_MODE : 0; } static __inline__ void cec_ops_system_audio_mode_request(const struct cec_msg *msg, __u16 *phys_addr) { if (msg->len < 4) *phys_addr = 0xffff; else *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_system_audio_mode_status(struct cec_msg *msg, __u8 sys_aud_status) { msg->len = 3; msg->msg[1] = CEC_MSG_SYSTEM_AUDIO_MODE_STATUS; msg->msg[2] = sys_aud_status; } static __inline__ void cec_ops_system_audio_mode_status(const struct cec_msg *msg, __u8 *sys_aud_status) { *sys_aud_status = msg->msg[2]; } static __inline__ void cec_msg_give_system_audio_mode_status(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_GIVE_SYSTEM_AUDIO_MODE_STATUS; msg->reply = reply ? CEC_MSG_SYSTEM_AUDIO_MODE_STATUS : 0; } static __inline__ void cec_msg_report_short_audio_descriptor(struct cec_msg *msg, __u8 num_descriptors, const __u32 *descriptors) { unsigned int i; if (num_descriptors > 4) num_descriptors = 4; msg->len = 2 + num_descriptors * 3; msg->msg[1] = CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR; for (i = 0; i < num_descriptors; i++) { msg->msg[2 + i * 3] = (descriptors[i] >> 16) & 0xff; msg->msg[3 + i * 3] = (descriptors[i] >> 8) & 0xff; msg->msg[4 + i * 3] = descriptors[i] & 0xff; } } static __inline__ void cec_ops_report_short_audio_descriptor(const struct cec_msg *msg, __u8 *num_descriptors, __u32 *descriptors) { unsigned int i; *num_descriptors = (msg->len - 2) / 3; if (*num_descriptors > 4) *num_descriptors = 4; for (i = 0; i < *num_descriptors; i++) descriptors[i] = (msg->msg[2 + i * 3] << 16) | (msg->msg[3 + i * 3] << 8) | msg->msg[4 + i * 3]; } static __inline__ void cec_msg_request_short_audio_descriptor(struct cec_msg *msg, int reply, __u8 num_descriptors, const __u8 *audio_format_id, const __u8 *audio_format_code) { unsigned int i; if (num_descriptors > 4) num_descriptors = 4; msg->len = 2 + num_descriptors; msg->msg[1] = CEC_MSG_REQUEST_SHORT_AUDIO_DESCRIPTOR; msg->reply = reply ? CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR : 0; for (i = 0; i < num_descriptors; i++) msg->msg[2 + i] = (audio_format_id[i] << 6) | (audio_format_code[i] & 0x3f); } static __inline__ void cec_ops_request_short_audio_descriptor(const struct cec_msg *msg, __u8 *num_descriptors, __u8 *audio_format_id, __u8 *audio_format_code) { unsigned int i; *num_descriptors = msg->len - 2; if (*num_descriptors > 4) *num_descriptors = 4; for (i = 0; i < *num_descriptors; i++) { audio_format_id[i] = msg->msg[2 + i] >> 6; audio_format_code[i] = msg->msg[2 + i] & 0x3f; } } static __inline__ void cec_msg_set_audio_volume_level(struct cec_msg *msg, __u8 audio_volume_level) { msg->len = 3; msg->msg[1] = CEC_MSG_SET_AUDIO_VOLUME_LEVEL; msg->msg[2] = audio_volume_level; } static __inline__ void cec_ops_set_audio_volume_level(const struct cec_msg *msg, __u8 *audio_volume_level) { *audio_volume_level = msg->msg[2]; } /* Audio Rate Control Feature */ static __inline__ void cec_msg_set_audio_rate(struct cec_msg *msg, __u8 audio_rate) { msg->len = 3; msg->msg[1] = CEC_MSG_SET_AUDIO_RATE; msg->msg[2] = audio_rate; } static __inline__ void cec_ops_set_audio_rate(const struct cec_msg *msg, __u8 *audio_rate) { *audio_rate = msg->msg[2]; } /* Audio Return Channel Control Feature */ static __inline__ void cec_msg_report_arc_initiated(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_REPORT_ARC_INITIATED; } static __inline__ void cec_msg_initiate_arc(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_INITIATE_ARC; msg->reply = reply ? CEC_MSG_REPORT_ARC_INITIATED : 0; } static __inline__ void cec_msg_request_arc_initiation(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_REQUEST_ARC_INITIATION; msg->reply = reply ? CEC_MSG_INITIATE_ARC : 0; } static __inline__ void cec_msg_report_arc_terminated(struct cec_msg *msg) { msg->len = 2; msg->msg[1] = CEC_MSG_REPORT_ARC_TERMINATED; } static __inline__ void cec_msg_terminate_arc(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_TERMINATE_ARC; msg->reply = reply ? CEC_MSG_REPORT_ARC_TERMINATED : 0; } static __inline__ void cec_msg_request_arc_termination(struct cec_msg *msg, int reply) { msg->len = 2; msg->msg[1] = CEC_MSG_REQUEST_ARC_TERMINATION; msg->reply = reply ? CEC_MSG_TERMINATE_ARC : 0; } /* Dynamic Audio Lipsync Feature */ /* Only for CEC 2.0 and up */ static __inline__ void cec_msg_report_current_latency(struct cec_msg *msg, __u16 phys_addr, __u8 video_latency, __u8 low_latency_mode, __u8 audio_out_compensated, __u8 audio_out_delay) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REPORT_CURRENT_LATENCY; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->msg[4] = video_latency; msg->msg[5] = (low_latency_mode << 2) | audio_out_compensated; if (audio_out_compensated == 3) msg->msg[msg->len++] = audio_out_delay; } static __inline__ void cec_ops_report_current_latency(const struct cec_msg *msg, __u16 *phys_addr, __u8 *video_latency, __u8 *low_latency_mode, __u8 *audio_out_compensated, __u8 *audio_out_delay) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *video_latency = msg->msg[4]; *low_latency_mode = (msg->msg[5] >> 2) & 1; *audio_out_compensated = msg->msg[5] & 3; if (*audio_out_compensated == 3 && msg->len >= 7) *audio_out_delay = msg->msg[6]; else *audio_out_delay = 0; } static __inline__ void cec_msg_request_current_latency(struct cec_msg *msg, int reply, __u16 phys_addr) { msg->len = 4; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_REQUEST_CURRENT_LATENCY; msg->msg[2] = phys_addr >> 8; msg->msg[3] = phys_addr & 0xff; msg->reply = reply ? CEC_MSG_REPORT_CURRENT_LATENCY : 0; } static __inline__ void cec_ops_request_current_latency(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } /* Capability Discovery and Control Feature */ static __inline__ void cec_msg_cdc_hec_inquire_state(struct cec_msg *msg, __u16 phys_addr1, __u16 phys_addr2) { msg->len = 9; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_INQUIRE_STATE; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = phys_addr2 >> 8; msg->msg[8] = phys_addr2 & 0xff; } static __inline__ void cec_ops_cdc_hec_inquire_state(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u16 *phys_addr2) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *phys_addr2 = (msg->msg[7] << 8) | msg->msg[8]; } static __inline__ void cec_msg_cdc_hec_report_state(struct cec_msg *msg, __u16 target_phys_addr, __u8 hec_func_state, __u8 host_func_state, __u8 enc_func_state, __u8 cdc_errcode, __u8 has_field, __u16 hec_field) { msg->len = has_field ? 10 : 8; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_REPORT_STATE; msg->msg[5] = target_phys_addr >> 8; msg->msg[6] = target_phys_addr & 0xff; msg->msg[7] = (hec_func_state << 6) | (host_func_state << 4) | (enc_func_state << 2) | cdc_errcode; if (has_field) { msg->msg[8] = hec_field >> 8; msg->msg[9] = hec_field & 0xff; } } static __inline__ void cec_ops_cdc_hec_report_state(const struct cec_msg *msg, __u16 *phys_addr, __u16 *target_phys_addr, __u8 *hec_func_state, __u8 *host_func_state, __u8 *enc_func_state, __u8 *cdc_errcode, __u8 *has_field, __u16 *hec_field) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *target_phys_addr = (msg->msg[5] << 8) | msg->msg[6]; *hec_func_state = msg->msg[7] >> 6; *host_func_state = (msg->msg[7] >> 4) & 3; *enc_func_state = (msg->msg[7] >> 4) & 3; *cdc_errcode = msg->msg[7] & 3; *has_field = msg->len >= 10; *hec_field = *has_field ? ((msg->msg[8] << 8) | msg->msg[9]) : 0; } static __inline__ void cec_msg_cdc_hec_set_state(struct cec_msg *msg, __u16 phys_addr1, __u16 phys_addr2, __u8 hec_set_state, __u16 phys_addr3, __u16 phys_addr4, __u16 phys_addr5) { msg->len = 10; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_INQUIRE_STATE; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = phys_addr2 >> 8; msg->msg[8] = phys_addr2 & 0xff; msg->msg[9] = hec_set_state; if (phys_addr3 != CEC_PHYS_ADDR_INVALID) { msg->msg[msg->len++] = phys_addr3 >> 8; msg->msg[msg->len++] = phys_addr3 & 0xff; if (phys_addr4 != CEC_PHYS_ADDR_INVALID) { msg->msg[msg->len++] = phys_addr4 >> 8; msg->msg[msg->len++] = phys_addr4 & 0xff; if (phys_addr5 != CEC_PHYS_ADDR_INVALID) { msg->msg[msg->len++] = phys_addr5 >> 8; msg->msg[msg->len++] = phys_addr5 & 0xff; } } } } static __inline__ void cec_ops_cdc_hec_set_state(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u16 *phys_addr2, __u8 *hec_set_state, __u16 *phys_addr3, __u16 *phys_addr4, __u16 *phys_addr5) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *phys_addr2 = (msg->msg[7] << 8) | msg->msg[8]; *hec_set_state = msg->msg[9]; *phys_addr3 = *phys_addr4 = *phys_addr5 = CEC_PHYS_ADDR_INVALID; if (msg->len >= 12) *phys_addr3 = (msg->msg[10] << 8) | msg->msg[11]; if (msg->len >= 14) *phys_addr4 = (msg->msg[12] << 8) | msg->msg[13]; if (msg->len >= 16) *phys_addr5 = (msg->msg[14] << 8) | msg->msg[15]; } static __inline__ void cec_msg_cdc_hec_set_state_adjacent(struct cec_msg *msg, __u16 phys_addr1, __u8 hec_set_state) { msg->len = 8; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_SET_STATE_ADJACENT; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = hec_set_state; } static __inline__ void cec_ops_cdc_hec_set_state_adjacent(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u8 *hec_set_state) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *hec_set_state = msg->msg[7]; } static __inline__ void cec_msg_cdc_hec_request_deactivation(struct cec_msg *msg, __u16 phys_addr1, __u16 phys_addr2, __u16 phys_addr3) { msg->len = 11; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_REQUEST_DEACTIVATION; msg->msg[5] = phys_addr1 >> 8; msg->msg[6] = phys_addr1 & 0xff; msg->msg[7] = phys_addr2 >> 8; msg->msg[8] = phys_addr2 & 0xff; msg->msg[9] = phys_addr3 >> 8; msg->msg[10] = phys_addr3 & 0xff; } static __inline__ void cec_ops_cdc_hec_request_deactivation(const struct cec_msg *msg, __u16 *phys_addr, __u16 *phys_addr1, __u16 *phys_addr2, __u16 *phys_addr3) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6]; *phys_addr2 = (msg->msg[7] << 8) | msg->msg[8]; *phys_addr3 = (msg->msg[9] << 8) | msg->msg[10]; } static __inline__ void cec_msg_cdc_hec_notify_alive(struct cec_msg *msg) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_NOTIFY_ALIVE; } static __inline__ void cec_ops_cdc_hec_notify_alive(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_cdc_hec_discover(struct cec_msg *msg) { msg->len = 5; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HEC_DISCOVER; } static __inline__ void cec_ops_cdc_hec_discover(const struct cec_msg *msg, __u16 *phys_addr) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; } static __inline__ void cec_msg_cdc_hpd_set_state(struct cec_msg *msg, __u8 input_port, __u8 hpd_state) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HPD_SET_STATE; msg->msg[5] = (input_port << 4) | hpd_state; } static __inline__ void cec_ops_cdc_hpd_set_state(const struct cec_msg *msg, __u16 *phys_addr, __u8 *input_port, __u8 *hpd_state) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *input_port = msg->msg[5] >> 4; *hpd_state = msg->msg[5] & 0xf; } static __inline__ void cec_msg_cdc_hpd_report_state(struct cec_msg *msg, __u8 hpd_state, __u8 hpd_error) { msg->len = 6; msg->msg[0] |= 0xf; /* broadcast */ msg->msg[1] = CEC_MSG_CDC_MESSAGE; /* msg[2] and msg[3] (phys_addr) are filled in by the CEC framework */ msg->msg[4] = CEC_MSG_CDC_HPD_REPORT_STATE; msg->msg[5] = (hpd_state << 4) | hpd_error; } static __inline__ void cec_ops_cdc_hpd_report_state(const struct cec_msg *msg, __u16 *phys_addr, __u8 *hpd_state, __u8 *hpd_error) { *phys_addr = (msg->msg[2] << 8) | msg->msg[3]; *hpd_state = msg->msg[5] >> 4; *hpd_error = msg->msg[5] & 0xf; } #endif linux/cec.h 0000644 00000111473 15063602060 0006613 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * cec - HDMI Consumer Electronics Control public header * * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ #ifndef _CEC_UAPI_H #define _CEC_UAPI_H #include <linux/types.h> #include <linux/string.h> #define CEC_MAX_MSG_SIZE 16 /** * struct cec_msg - CEC message structure. * @tx_ts: Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the * driver when the message transmission has finished. * @rx_ts: Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the * driver when the message was received. * @len: Length in bytes of the message. * @timeout: The timeout (in ms) that is used to timeout CEC_RECEIVE. * Set to 0 if you want to wait forever. This timeout can also be * used with CEC_TRANSMIT as the timeout for waiting for a reply. * If 0, then it will use a 1 second timeout instead of waiting * forever as is done with CEC_RECEIVE. * @sequence: The framework assigns a sequence number to messages that are * sent. This can be used to track replies to previously sent * messages. * @flags: Set to 0. * @msg: The message payload. * @reply: This field is ignored with CEC_RECEIVE and is only used by * CEC_TRANSMIT. If non-zero, then wait for a reply with this * opcode. Set to CEC_MSG_FEATURE_ABORT if you want to wait for * a possible ABORT reply. If there was an error when sending the * msg or FeatureAbort was returned, then reply is set to 0. * If reply is non-zero upon return, then len/msg are set to * the received message. * If reply is zero upon return and status has the * CEC_TX_STATUS_FEATURE_ABORT bit set, then len/msg are set to * the received feature abort message. * If reply is zero upon return and status has the * CEC_TX_STATUS_MAX_RETRIES bit set, then no reply was seen at * all. If reply is non-zero for CEC_TRANSMIT and the message is a * broadcast, then -EINVAL is returned. * if reply is non-zero, then timeout is set to 1000 (the required * maximum response time). * @rx_status: The message receive status bits. Set by the driver. * @tx_status: The message transmit status bits. Set by the driver. * @tx_arb_lost_cnt: The number of 'Arbitration Lost' events. Set by the driver. * @tx_nack_cnt: The number of 'Not Acknowledged' events. Set by the driver. * @tx_low_drive_cnt: The number of 'Low Drive Detected' events. Set by the * driver. * @tx_error_cnt: The number of 'Error' events. Set by the driver. */ struct cec_msg { __u64 tx_ts; __u64 rx_ts; __u32 len; __u32 timeout; __u32 sequence; __u32 flags; __u8 msg[CEC_MAX_MSG_SIZE]; __u8 reply; __u8 rx_status; __u8 tx_status; __u8 tx_arb_lost_cnt; __u8 tx_nack_cnt; __u8 tx_low_drive_cnt; __u8 tx_error_cnt; }; /** * cec_msg_initiator - return the initiator's logical address. * @msg: the message structure */ static __inline__ __u8 cec_msg_initiator(const struct cec_msg *msg) { return msg->msg[0] >> 4; } /** * cec_msg_destination - return the destination's logical address. * @msg: the message structure */ static __inline__ __u8 cec_msg_destination(const struct cec_msg *msg) { return msg->msg[0] & 0xf; } /** * cec_msg_opcode - return the opcode of the message, -1 for poll * @msg: the message structure */ static __inline__ int cec_msg_opcode(const struct cec_msg *msg) { return msg->len > 1 ? msg->msg[1] : -1; } /** * cec_msg_is_broadcast - return true if this is a broadcast message. * @msg: the message structure */ static __inline__ int cec_msg_is_broadcast(const struct cec_msg *msg) { return (msg->msg[0] & 0xf) == 0xf; } /** * cec_msg_init - initialize the message structure. * @msg: the message structure * @initiator: the logical address of the initiator * @destination:the logical address of the destination (0xf for broadcast) * * The whole structure is zeroed, the len field is set to 1 (i.e. a poll * message) and the initiator and destination are filled in. */ static __inline__ void cec_msg_init(struct cec_msg *msg, __u8 initiator, __u8 destination) { memset(msg, 0, sizeof(*msg)); msg->msg[0] = (initiator << 4) | destination; msg->len = 1; } /** * cec_msg_set_reply_to - fill in destination/initiator in a reply message. * @msg: the message structure for the reply * @orig: the original message structure * * Set the msg destination to the orig initiator and the msg initiator to the * orig destination. Note that msg and orig may be the same pointer, in which * case the change is done in place. */ static __inline__ void cec_msg_set_reply_to(struct cec_msg *msg, struct cec_msg *orig) { /* The destination becomes the initiator and vice versa */ msg->msg[0] = (cec_msg_destination(orig) << 4) | cec_msg_initiator(orig); msg->reply = msg->timeout = 0; } /* cec_msg flags field */ #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0) #define CEC_MSG_FL_RAW (1 << 1) /* cec_msg tx/rx_status field */ #define CEC_TX_STATUS_OK (1 << 0) #define CEC_TX_STATUS_ARB_LOST (1 << 1) #define CEC_TX_STATUS_NACK (1 << 2) #define CEC_TX_STATUS_LOW_DRIVE (1 << 3) #define CEC_TX_STATUS_ERROR (1 << 4) #define CEC_TX_STATUS_MAX_RETRIES (1 << 5) #define CEC_TX_STATUS_ABORTED (1 << 6) #define CEC_TX_STATUS_TIMEOUT (1 << 7) #define CEC_RX_STATUS_OK (1 << 0) #define CEC_RX_STATUS_TIMEOUT (1 << 1) #define CEC_RX_STATUS_FEATURE_ABORT (1 << 2) #define CEC_RX_STATUS_ABORTED (1 << 3) static __inline__ int cec_msg_status_is_ok(const struct cec_msg *msg) { if (msg->tx_status && !(msg->tx_status & CEC_TX_STATUS_OK)) return 0; if (msg->rx_status && !(msg->rx_status & CEC_RX_STATUS_OK)) return 0; if (!msg->tx_status && !msg->rx_status) return 0; return !(msg->rx_status & CEC_RX_STATUS_FEATURE_ABORT); } #define CEC_LOG_ADDR_INVALID 0xff #define CEC_PHYS_ADDR_INVALID 0xffff /* * The maximum number of logical addresses one device can be assigned to. * The CEC 2.0 spec allows for only 2 logical addresses at the moment. The * Analog Devices CEC hardware supports 3. So let's go wild and go for 4. */ #define CEC_MAX_LOG_ADDRS 4 /* The logical addresses defined by CEC 2.0 */ #define CEC_LOG_ADDR_TV 0 #define CEC_LOG_ADDR_RECORD_1 1 #define CEC_LOG_ADDR_RECORD_2 2 #define CEC_LOG_ADDR_TUNER_1 3 #define CEC_LOG_ADDR_PLAYBACK_1 4 #define CEC_LOG_ADDR_AUDIOSYSTEM 5 #define CEC_LOG_ADDR_TUNER_2 6 #define CEC_LOG_ADDR_TUNER_3 7 #define CEC_LOG_ADDR_PLAYBACK_2 8 #define CEC_LOG_ADDR_RECORD_3 9 #define CEC_LOG_ADDR_TUNER_4 10 #define CEC_LOG_ADDR_PLAYBACK_3 11 #define CEC_LOG_ADDR_BACKUP_1 12 #define CEC_LOG_ADDR_BACKUP_2 13 #define CEC_LOG_ADDR_SPECIFIC 14 #define CEC_LOG_ADDR_UNREGISTERED 15 /* as initiator address */ #define CEC_LOG_ADDR_BROADCAST 15 /* as destination address */ /* The logical address types that the CEC device wants to claim */ #define CEC_LOG_ADDR_TYPE_TV 0 #define CEC_LOG_ADDR_TYPE_RECORD 1 #define CEC_LOG_ADDR_TYPE_TUNER 2 #define CEC_LOG_ADDR_TYPE_PLAYBACK 3 #define CEC_LOG_ADDR_TYPE_AUDIOSYSTEM 4 #define CEC_LOG_ADDR_TYPE_SPECIFIC 5 #define CEC_LOG_ADDR_TYPE_UNREGISTERED 6 /* * Switches should use UNREGISTERED. * Processors should use SPECIFIC. */ #define CEC_LOG_ADDR_MASK_TV (1 << CEC_LOG_ADDR_TV) #define CEC_LOG_ADDR_MASK_RECORD ((1 << CEC_LOG_ADDR_RECORD_1) | \ (1 << CEC_LOG_ADDR_RECORD_2) | \ (1 << CEC_LOG_ADDR_RECORD_3)) #define CEC_LOG_ADDR_MASK_TUNER ((1 << CEC_LOG_ADDR_TUNER_1) | \ (1 << CEC_LOG_ADDR_TUNER_2) | \ (1 << CEC_LOG_ADDR_TUNER_3) | \ (1 << CEC_LOG_ADDR_TUNER_4)) #define CEC_LOG_ADDR_MASK_PLAYBACK ((1 << CEC_LOG_ADDR_PLAYBACK_1) | \ (1 << CEC_LOG_ADDR_PLAYBACK_2) | \ (1 << CEC_LOG_ADDR_PLAYBACK_3)) #define CEC_LOG_ADDR_MASK_AUDIOSYSTEM (1 << CEC_LOG_ADDR_AUDIOSYSTEM) #define CEC_LOG_ADDR_MASK_BACKUP ((1 << CEC_LOG_ADDR_BACKUP_1) | \ (1 << CEC_LOG_ADDR_BACKUP_2)) #define CEC_LOG_ADDR_MASK_SPECIFIC (1 << CEC_LOG_ADDR_SPECIFIC) #define CEC_LOG_ADDR_MASK_UNREGISTERED (1 << CEC_LOG_ADDR_UNREGISTERED) static __inline__ int cec_has_tv(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_TV; } static __inline__ int cec_has_record(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_RECORD; } static __inline__ int cec_has_tuner(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_TUNER; } static __inline__ int cec_has_playback(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_PLAYBACK; } static __inline__ int cec_has_audiosystem(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_AUDIOSYSTEM; } static __inline__ int cec_has_backup(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_BACKUP; } static __inline__ int cec_has_specific(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_SPECIFIC; } static __inline__ int cec_is_unregistered(__u16 log_addr_mask) { return log_addr_mask & CEC_LOG_ADDR_MASK_UNREGISTERED; } static __inline__ int cec_is_unconfigured(__u16 log_addr_mask) { return log_addr_mask == 0; } /* * Use this if there is no vendor ID (CEC_G_VENDOR_ID) or if the vendor ID * should be disabled (CEC_S_VENDOR_ID) */ #define CEC_VENDOR_ID_NONE 0xffffffff /* The message handling modes */ /* Modes for initiator */ #define CEC_MODE_NO_INITIATOR (0x0 << 0) #define CEC_MODE_INITIATOR (0x1 << 0) #define CEC_MODE_EXCL_INITIATOR (0x2 << 0) #define CEC_MODE_INITIATOR_MSK 0x0f /* Modes for follower */ #define CEC_MODE_NO_FOLLOWER (0x0 << 4) #define CEC_MODE_FOLLOWER (0x1 << 4) #define CEC_MODE_EXCL_FOLLOWER (0x2 << 4) #define CEC_MODE_EXCL_FOLLOWER_PASSTHRU (0x3 << 4) #define CEC_MODE_MONITOR_PIN (0xd << 4) #define CEC_MODE_MONITOR (0xe << 4) #define CEC_MODE_MONITOR_ALL (0xf << 4) #define CEC_MODE_FOLLOWER_MSK 0xf0 /* Userspace has to configure the physical address */ #define CEC_CAP_PHYS_ADDR (1 << 0) /* Userspace has to configure the logical addresses */ #define CEC_CAP_LOG_ADDRS (1 << 1) /* Userspace can transmit messages (and thus become follower as well) */ #define CEC_CAP_TRANSMIT (1 << 2) /* * Passthrough all messages instead of processing them. */ #define CEC_CAP_PASSTHROUGH (1 << 3) /* Supports remote control */ #define CEC_CAP_RC (1 << 4) /* Hardware can monitor all messages, not just directed and broadcast. */ #define CEC_CAP_MONITOR_ALL (1 << 5) /* Hardware can use CEC only if the HDMI HPD pin is high. */ #define CEC_CAP_NEEDS_HPD (1 << 6) /* Hardware can monitor CEC pin transitions */ #define CEC_CAP_MONITOR_PIN (1 << 7) /* CEC_ADAP_G_CONNECTOR_INFO is available */ #define CEC_CAP_CONNECTOR_INFO (1 << 8) /** * struct cec_caps - CEC capabilities structure. * @driver: name of the CEC device driver. * @name: name of the CEC device. @driver + @name must be unique. * @available_log_addrs: number of available logical addresses. * @capabilities: capabilities of the CEC adapter. * @version: version of the CEC adapter framework. */ struct cec_caps { char driver[32]; char name[32]; __u32 available_log_addrs; __u32 capabilities; __u32 version; }; /** * struct cec_log_addrs - CEC logical addresses structure. * @log_addr: the claimed logical addresses. Set by the driver. * @log_addr_mask: current logical address mask. Set by the driver. * @cec_version: the CEC version that the adapter should implement. Set by the * caller. * @num_log_addrs: how many logical addresses should be claimed. Set by the * caller. * @vendor_id: the vendor ID of the device. Set by the caller. * @flags: flags. * @osd_name: the OSD name of the device. Set by the caller. * @primary_device_type: the primary device type for each logical address. * Set by the caller. * @log_addr_type: the logical address types. Set by the caller. * @all_device_types: CEC 2.0: all device types represented by the logical * address. Set by the caller. * @features: CEC 2.0: The logical address features. Set by the caller. */ struct cec_log_addrs { __u8 log_addr[CEC_MAX_LOG_ADDRS]; __u16 log_addr_mask; __u8 cec_version; __u8 num_log_addrs; __u32 vendor_id; __u32 flags; char osd_name[15]; __u8 primary_device_type[CEC_MAX_LOG_ADDRS]; __u8 log_addr_type[CEC_MAX_LOG_ADDRS]; /* CEC 2.0 */ __u8 all_device_types[CEC_MAX_LOG_ADDRS]; __u8 features[CEC_MAX_LOG_ADDRS][12]; }; /* Allow a fallback to unregistered */ #define CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK (1 << 0) /* Passthrough RC messages to the input subsystem */ #define CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU (1 << 1) /* CDC-Only device: supports only CDC messages */ #define CEC_LOG_ADDRS_FL_CDC_ONLY (1 << 2) /** * struct cec_drm_connector_info - tells which drm connector is * associated with the CEC adapter. * @card_no: drm card number * @connector_id: drm connector ID */ struct cec_drm_connector_info { __u32 card_no; __u32 connector_id; }; #define CEC_CONNECTOR_TYPE_NO_CONNECTOR 0 #define CEC_CONNECTOR_TYPE_DRM 1 /** * struct cec_connector_info - tells if and which connector is * associated with the CEC adapter. * @type: connector type (if any) * @drm: drm connector info */ struct cec_connector_info { __u32 type; union { struct cec_drm_connector_info drm; __u32 raw[16]; }; }; /* Events */ /* Event that occurs when the adapter state changes */ #define CEC_EVENT_STATE_CHANGE 1 /* * This event is sent when messages are lost because the application * didn't empty the message queue in time */ #define CEC_EVENT_LOST_MSGS 2 #define CEC_EVENT_PIN_CEC_LOW 3 #define CEC_EVENT_PIN_CEC_HIGH 4 #define CEC_EVENT_PIN_HPD_LOW 5 #define CEC_EVENT_PIN_HPD_HIGH 6 #define CEC_EVENT_PIN_5V_LOW 7 #define CEC_EVENT_PIN_5V_HIGH 8 #define CEC_EVENT_FL_INITIAL_STATE (1 << 0) #define CEC_EVENT_FL_DROPPED_EVENTS (1 << 1) /** * struct cec_event_state_change - used when the CEC adapter changes state. * @phys_addr: the current physical address * @log_addr_mask: the current logical address mask * @have_conn_info: if non-zero, then HDMI connector information is available. * This field is only valid if CEC_CAP_CONNECTOR_INFO is set. If that * capability is set and @have_conn_info is zero, then that indicates * that the HDMI connector device is not instantiated, either because * the HDMI driver is still configuring the device or because the HDMI * device was unbound. */ struct cec_event_state_change { __u16 phys_addr; __u16 log_addr_mask; __u16 have_conn_info; }; /** * struct cec_event_lost_msgs - tells you how many messages were lost. * @lost_msgs: how many messages were lost. */ struct cec_event_lost_msgs { __u32 lost_msgs; }; /** * struct cec_event - CEC event structure * @ts: the timestamp of when the event was sent. * @event: the event. * array. * @state_change: the event payload for CEC_EVENT_STATE_CHANGE. * @lost_msgs: the event payload for CEC_EVENT_LOST_MSGS. * @raw: array to pad the union. */ struct cec_event { __u64 ts; __u32 event; __u32 flags; union { struct cec_event_state_change state_change; struct cec_event_lost_msgs lost_msgs; __u32 raw[16]; }; }; /* ioctls */ /* Adapter capabilities */ #define CEC_ADAP_G_CAPS _IOWR('a', 0, struct cec_caps) /* * phys_addr is either 0 (if this is the CEC root device) * or a valid physical address obtained from the sink's EDID * as read by this CEC device (if this is a source device) * or a physical address obtained and modified from a sink * EDID and used for a sink CEC device. * If nothing is connected, then phys_addr is 0xffff. * See HDMI 1.4b, section 8.7 (Physical Address). * * The CEC_ADAP_S_PHYS_ADDR ioctl may not be available if that is handled * internally. */ #define CEC_ADAP_G_PHYS_ADDR _IOR('a', 1, __u16) #define CEC_ADAP_S_PHYS_ADDR _IOW('a', 2, __u16) /* * Configure the CEC adapter. It sets the device type and which * logical types it will try to claim. It will return which * logical addresses it could actually claim. * An error is returned if the adapter is disabled or if there * is no physical address assigned. */ #define CEC_ADAP_G_LOG_ADDRS _IOR('a', 3, struct cec_log_addrs) #define CEC_ADAP_S_LOG_ADDRS _IOWR('a', 4, struct cec_log_addrs) /* Transmit/receive a CEC command */ #define CEC_TRANSMIT _IOWR('a', 5, struct cec_msg) #define CEC_RECEIVE _IOWR('a', 6, struct cec_msg) /* Dequeue CEC events */ #define CEC_DQEVENT _IOWR('a', 7, struct cec_event) /* * Get and set the message handling mode for this filehandle. */ #define CEC_G_MODE _IOR('a', 8, __u32) #define CEC_S_MODE _IOW('a', 9, __u32) /* Get the connector info */ #define CEC_ADAP_G_CONNECTOR_INFO _IOR('a', 10, struct cec_connector_info) /* * The remainder of this header defines all CEC messages and operands. * The format matters since it the cec-ctl utility parses it to generate * code for implementing all these messages. * * Comments ending with 'Feature' group messages for each feature. * If messages are part of multiple features, then the "Has also" * comment is used to list the previously defined messages that are * supported by the feature. * * Before operands are defined a comment is added that gives the * name of the operand and in brackets the variable name of the * corresponding argument in the cec-funcs.h function. */ /* Messages */ /* One Touch Play Feature */ #define CEC_MSG_ACTIVE_SOURCE 0x82 #define CEC_MSG_IMAGE_VIEW_ON 0x04 #define CEC_MSG_TEXT_VIEW_ON 0x0d /* Routing Control Feature */ /* * Has also: * CEC_MSG_ACTIVE_SOURCE */ #define CEC_MSG_INACTIVE_SOURCE 0x9d #define CEC_MSG_REQUEST_ACTIVE_SOURCE 0x85 #define CEC_MSG_ROUTING_CHANGE 0x80 #define CEC_MSG_ROUTING_INFORMATION 0x81 #define CEC_MSG_SET_STREAM_PATH 0x86 /* Standby Feature */ #define CEC_MSG_STANDBY 0x36 /* One Touch Record Feature */ #define CEC_MSG_RECORD_OFF 0x0b #define CEC_MSG_RECORD_ON 0x09 /* Record Source Type Operand (rec_src_type) */ #define CEC_OP_RECORD_SRC_OWN 1 #define CEC_OP_RECORD_SRC_DIGITAL 2 #define CEC_OP_RECORD_SRC_ANALOG 3 #define CEC_OP_RECORD_SRC_EXT_PLUG 4 #define CEC_OP_RECORD_SRC_EXT_PHYS_ADDR 5 /* Service Identification Method Operand (service_id_method) */ #define CEC_OP_SERVICE_ID_METHOD_BY_DIG_ID 0 #define CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL 1 /* Digital Service Broadcast System Operand (dig_bcast_system) */ #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_GEN 0x00 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_GEN 0x01 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_GEN 0x02 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_BS 0x08 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_CS 0x09 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_T 0x0a #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_CABLE 0x10 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT 0x11 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T 0x12 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_C 0x18 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S 0x19 #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S2 0x1a #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_T 0x1b /* Analogue Broadcast Type Operand (ana_bcast_type) */ #define CEC_OP_ANA_BCAST_TYPE_CABLE 0 #define CEC_OP_ANA_BCAST_TYPE_SATELLITE 1 #define CEC_OP_ANA_BCAST_TYPE_TERRESTRIAL 2 /* Broadcast System Operand (bcast_system) */ #define CEC_OP_BCAST_SYSTEM_PAL_BG 0x00 #define CEC_OP_BCAST_SYSTEM_SECAM_LQ 0x01 /* SECAM L' */ #define CEC_OP_BCAST_SYSTEM_PAL_M 0x02 #define CEC_OP_BCAST_SYSTEM_NTSC_M 0x03 #define CEC_OP_BCAST_SYSTEM_PAL_I 0x04 #define CEC_OP_BCAST_SYSTEM_SECAM_DK 0x05 #define CEC_OP_BCAST_SYSTEM_SECAM_BG 0x06 #define CEC_OP_BCAST_SYSTEM_SECAM_L 0x07 #define CEC_OP_BCAST_SYSTEM_PAL_DK 0x08 #define CEC_OP_BCAST_SYSTEM_OTHER 0x1f /* Channel Number Format Operand (channel_number_fmt) */ #define CEC_OP_CHANNEL_NUMBER_FMT_1_PART 0x01 #define CEC_OP_CHANNEL_NUMBER_FMT_2_PART 0x02 #define CEC_MSG_RECORD_STATUS 0x0a /* Record Status Operand (rec_status) */ #define CEC_OP_RECORD_STATUS_CUR_SRC 0x01 #define CEC_OP_RECORD_STATUS_DIG_SERVICE 0x02 #define CEC_OP_RECORD_STATUS_ANA_SERVICE 0x03 #define CEC_OP_RECORD_STATUS_EXT_INPUT 0x04 #define CEC_OP_RECORD_STATUS_NO_DIG_SERVICE 0x05 #define CEC_OP_RECORD_STATUS_NO_ANA_SERVICE 0x06 #define CEC_OP_RECORD_STATUS_NO_SERVICE 0x07 #define CEC_OP_RECORD_STATUS_INVALID_EXT_PLUG 0x09 #define CEC_OP_RECORD_STATUS_INVALID_EXT_PHYS_ADDR 0x0a #define CEC_OP_RECORD_STATUS_UNSUP_CA 0x0b #define CEC_OP_RECORD_STATUS_NO_CA_ENTITLEMENTS 0x0c #define CEC_OP_RECORD_STATUS_CANT_COPY_SRC 0x0d #define CEC_OP_RECORD_STATUS_NO_MORE_COPIES 0x0e #define CEC_OP_RECORD_STATUS_NO_MEDIA 0x10 #define CEC_OP_RECORD_STATUS_PLAYING 0x11 #define CEC_OP_RECORD_STATUS_ALREADY_RECORDING 0x12 #define CEC_OP_RECORD_STATUS_MEDIA_PROT 0x13 #define CEC_OP_RECORD_STATUS_NO_SIGNAL 0x14 #define CEC_OP_RECORD_STATUS_MEDIA_PROBLEM 0x15 #define CEC_OP_RECORD_STATUS_NO_SPACE 0x16 #define CEC_OP_RECORD_STATUS_PARENTAL_LOCK 0x17 #define CEC_OP_RECORD_STATUS_TERMINATED_OK 0x1a #define CEC_OP_RECORD_STATUS_ALREADY_TERM 0x1b #define CEC_OP_RECORD_STATUS_OTHER 0x1f #define CEC_MSG_RECORD_TV_SCREEN 0x0f /* Timer Programming Feature */ #define CEC_MSG_CLEAR_ANALOGUE_TIMER 0x33 /* Recording Sequence Operand (recording_seq) */ #define CEC_OP_REC_SEQ_SUNDAY 0x01 #define CEC_OP_REC_SEQ_MONDAY 0x02 #define CEC_OP_REC_SEQ_TUESDAY 0x04 #define CEC_OP_REC_SEQ_WEDNESDAY 0x08 #define CEC_OP_REC_SEQ_THURSDAY 0x10 #define CEC_OP_REC_SEQ_FRIDAY 0x20 #define CEC_OP_REC_SEQ_SATERDAY 0x40 #define CEC_OP_REC_SEQ_ONCE_ONLY 0x00 #define CEC_MSG_CLEAR_DIGITAL_TIMER 0x99 #define CEC_MSG_CLEAR_EXT_TIMER 0xa1 /* External Source Specifier Operand (ext_src_spec) */ #define CEC_OP_EXT_SRC_PLUG 0x04 #define CEC_OP_EXT_SRC_PHYS_ADDR 0x05 #define CEC_MSG_SET_ANALOGUE_TIMER 0x34 #define CEC_MSG_SET_DIGITAL_TIMER 0x97 #define CEC_MSG_SET_EXT_TIMER 0xa2 #define CEC_MSG_SET_TIMER_PROGRAM_TITLE 0x67 #define CEC_MSG_TIMER_CLEARED_STATUS 0x43 /* Timer Cleared Status Data Operand (timer_cleared_status) */ #define CEC_OP_TIMER_CLR_STAT_RECORDING 0x00 #define CEC_OP_TIMER_CLR_STAT_NO_MATCHING 0x01 #define CEC_OP_TIMER_CLR_STAT_NO_INFO 0x02 #define CEC_OP_TIMER_CLR_STAT_CLEARED 0x80 #define CEC_MSG_TIMER_STATUS 0x35 /* Timer Overlap Warning Operand (timer_overlap_warning) */ #define CEC_OP_TIMER_OVERLAP_WARNING_NO_OVERLAP 0 #define CEC_OP_TIMER_OVERLAP_WARNING_OVERLAP 1 /* Media Info Operand (media_info) */ #define CEC_OP_MEDIA_INFO_UNPROT_MEDIA 0 #define CEC_OP_MEDIA_INFO_PROT_MEDIA 1 #define CEC_OP_MEDIA_INFO_NO_MEDIA 2 /* Programmed Indicator Operand (prog_indicator) */ #define CEC_OP_PROG_IND_NOT_PROGRAMMED 0 #define CEC_OP_PROG_IND_PROGRAMMED 1 /* Programmed Info Operand (prog_info) */ #define CEC_OP_PROG_INFO_ENOUGH_SPACE 0x08 #define CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE 0x09 #define CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE 0x0b #define CEC_OP_PROG_INFO_NONE_AVAILABLE 0x0a /* Not Programmed Error Info Operand (prog_error) */ #define CEC_OP_PROG_ERROR_NO_FREE_TIMER 0x01 #define CEC_OP_PROG_ERROR_DATE_OUT_OF_RANGE 0x02 #define CEC_OP_PROG_ERROR_REC_SEQ_ERROR 0x03 #define CEC_OP_PROG_ERROR_INV_EXT_PLUG 0x04 #define CEC_OP_PROG_ERROR_INV_EXT_PHYS_ADDR 0x05 #define CEC_OP_PROG_ERROR_CA_UNSUPP 0x06 #define CEC_OP_PROG_ERROR_INSUF_CA_ENTITLEMENTS 0x07 #define CEC_OP_PROG_ERROR_RESOLUTION_UNSUPP 0x08 #define CEC_OP_PROG_ERROR_PARENTAL_LOCK 0x09 #define CEC_OP_PROG_ERROR_CLOCK_FAILURE 0x0a #define CEC_OP_PROG_ERROR_DUPLICATE 0x0e /* System Information Feature */ #define CEC_MSG_CEC_VERSION 0x9e /* CEC Version Operand (cec_version) */ #define CEC_OP_CEC_VERSION_1_3A 4 #define CEC_OP_CEC_VERSION_1_4 5 #define CEC_OP_CEC_VERSION_2_0 6 #define CEC_MSG_GET_CEC_VERSION 0x9f #define CEC_MSG_GIVE_PHYSICAL_ADDR 0x83 #define CEC_MSG_GET_MENU_LANGUAGE 0x91 #define CEC_MSG_REPORT_PHYSICAL_ADDR 0x84 /* Primary Device Type Operand (prim_devtype) */ #define CEC_OP_PRIM_DEVTYPE_TV 0 #define CEC_OP_PRIM_DEVTYPE_RECORD 1 #define CEC_OP_PRIM_DEVTYPE_TUNER 3 #define CEC_OP_PRIM_DEVTYPE_PLAYBACK 4 #define CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM 5 #define CEC_OP_PRIM_DEVTYPE_SWITCH 6 #define CEC_OP_PRIM_DEVTYPE_PROCESSOR 7 #define CEC_MSG_SET_MENU_LANGUAGE 0x32 #define CEC_MSG_REPORT_FEATURES 0xa6 /* HDMI 2.0 */ /* All Device Types Operand (all_device_types) */ #define CEC_OP_ALL_DEVTYPE_TV 0x80 #define CEC_OP_ALL_DEVTYPE_RECORD 0x40 #define CEC_OP_ALL_DEVTYPE_TUNER 0x20 #define CEC_OP_ALL_DEVTYPE_PLAYBACK 0x10 #define CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM 0x08 #define CEC_OP_ALL_DEVTYPE_SWITCH 0x04 /* * And if you wondering what happened to PROCESSOR devices: those should * be mapped to a SWITCH. */ /* Valid for RC Profile and Device Feature operands */ #define CEC_OP_FEAT_EXT 0x80 /* Extension bit */ /* RC Profile Operand (rc_profile) */ #define CEC_OP_FEAT_RC_TV_PROFILE_NONE 0x00 #define CEC_OP_FEAT_RC_TV_PROFILE_1 0x02 #define CEC_OP_FEAT_RC_TV_PROFILE_2 0x06 #define CEC_OP_FEAT_RC_TV_PROFILE_3 0x0a #define CEC_OP_FEAT_RC_TV_PROFILE_4 0x0e #define CEC_OP_FEAT_RC_SRC_HAS_DEV_ROOT_MENU 0x50 #define CEC_OP_FEAT_RC_SRC_HAS_DEV_SETUP_MENU 0x48 #define CEC_OP_FEAT_RC_SRC_HAS_CONTENTS_MENU 0x44 #define CEC_OP_FEAT_RC_SRC_HAS_MEDIA_TOP_MENU 0x42 #define CEC_OP_FEAT_RC_SRC_HAS_MEDIA_CONTEXT_MENU 0x41 /* Device Feature Operand (dev_features) */ #define CEC_OP_FEAT_DEV_HAS_RECORD_TV_SCREEN 0x40 #define CEC_OP_FEAT_DEV_HAS_SET_OSD_STRING 0x20 #define CEC_OP_FEAT_DEV_HAS_DECK_CONTROL 0x10 #define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_RATE 0x08 #define CEC_OP_FEAT_DEV_SINK_HAS_ARC_TX 0x04 #define CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX 0x02 #define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_VOLUME_LEVEL 0x01 #define CEC_MSG_GIVE_FEATURES 0xa5 /* HDMI 2.0 */ /* Deck Control Feature */ #define CEC_MSG_DECK_CONTROL 0x42 /* Deck Control Mode Operand (deck_control_mode) */ #define CEC_OP_DECK_CTL_MODE_SKIP_FWD 1 #define CEC_OP_DECK_CTL_MODE_SKIP_REV 2 #define CEC_OP_DECK_CTL_MODE_STOP 3 #define CEC_OP_DECK_CTL_MODE_EJECT 4 #define CEC_MSG_DECK_STATUS 0x1b /* Deck Info Operand (deck_info) */ #define CEC_OP_DECK_INFO_PLAY 0x11 #define CEC_OP_DECK_INFO_RECORD 0x12 #define CEC_OP_DECK_INFO_PLAY_REV 0x13 #define CEC_OP_DECK_INFO_STILL 0x14 #define CEC_OP_DECK_INFO_SLOW 0x15 #define CEC_OP_DECK_INFO_SLOW_REV 0x16 #define CEC_OP_DECK_INFO_FAST_FWD 0x17 #define CEC_OP_DECK_INFO_FAST_REV 0x18 #define CEC_OP_DECK_INFO_NO_MEDIA 0x19 #define CEC_OP_DECK_INFO_STOP 0x1a #define CEC_OP_DECK_INFO_SKIP_FWD 0x1b #define CEC_OP_DECK_INFO_SKIP_REV 0x1c #define CEC_OP_DECK_INFO_INDEX_SEARCH_FWD 0x1d #define CEC_OP_DECK_INFO_INDEX_SEARCH_REV 0x1e #define CEC_OP_DECK_INFO_OTHER 0x1f #define CEC_MSG_GIVE_DECK_STATUS 0x1a /* Status Request Operand (status_req) */ #define CEC_OP_STATUS_REQ_ON 1 #define CEC_OP_STATUS_REQ_OFF 2 #define CEC_OP_STATUS_REQ_ONCE 3 #define CEC_MSG_PLAY 0x41 /* Play Mode Operand (play_mode) */ #define CEC_OP_PLAY_MODE_PLAY_FWD 0x24 #define CEC_OP_PLAY_MODE_PLAY_REV 0x20 #define CEC_OP_PLAY_MODE_PLAY_STILL 0x25 #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MIN 0x05 #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MED 0x06 #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MAX 0x07 #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MIN 0x09 #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MED 0x0a #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MAX 0x0b #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MIN 0x15 #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MED 0x16 #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MAX 0x17 #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MIN 0x19 #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MED 0x1a #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MAX 0x1b /* Tuner Control Feature */ #define CEC_MSG_GIVE_TUNER_DEVICE_STATUS 0x08 #define CEC_MSG_SELECT_ANALOGUE_SERVICE 0x92 #define CEC_MSG_SELECT_DIGITAL_SERVICE 0x93 #define CEC_MSG_TUNER_DEVICE_STATUS 0x07 /* Recording Flag Operand (rec_flag) */ #define CEC_OP_REC_FLAG_USED 0 #define CEC_OP_REC_FLAG_NOT_USED 1 /* Tuner Display Info Operand (tuner_display_info) */ #define CEC_OP_TUNER_DISPLAY_INFO_DIGITAL 0 #define CEC_OP_TUNER_DISPLAY_INFO_NONE 1 #define CEC_OP_TUNER_DISPLAY_INFO_ANALOGUE 2 #define CEC_MSG_TUNER_STEP_DECREMENT 0x06 #define CEC_MSG_TUNER_STEP_INCREMENT 0x05 /* Vendor Specific Commands Feature */ /* * Has also: * CEC_MSG_CEC_VERSION * CEC_MSG_GET_CEC_VERSION */ #define CEC_MSG_DEVICE_VENDOR_ID 0x87 #define CEC_MSG_GIVE_DEVICE_VENDOR_ID 0x8c #define CEC_MSG_VENDOR_COMMAND 0x89 #define CEC_MSG_VENDOR_COMMAND_WITH_ID 0xa0 #define CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN 0x8a #define CEC_MSG_VENDOR_REMOTE_BUTTON_UP 0x8b /* OSD Display Feature */ #define CEC_MSG_SET_OSD_STRING 0x64 /* Display Control Operand (disp_ctl) */ #define CEC_OP_DISP_CTL_DEFAULT 0x00 #define CEC_OP_DISP_CTL_UNTIL_CLEARED 0x40 #define CEC_OP_DISP_CTL_CLEAR 0x80 /* Device OSD Transfer Feature */ #define CEC_MSG_GIVE_OSD_NAME 0x46 #define CEC_MSG_SET_OSD_NAME 0x47 /* Device Menu Control Feature */ #define CEC_MSG_MENU_REQUEST 0x8d /* Menu Request Type Operand (menu_req) */ #define CEC_OP_MENU_REQUEST_ACTIVATE 0x00 #define CEC_OP_MENU_REQUEST_DEACTIVATE 0x01 #define CEC_OP_MENU_REQUEST_QUERY 0x02 #define CEC_MSG_MENU_STATUS 0x8e /* Menu State Operand (menu_state) */ #define CEC_OP_MENU_STATE_ACTIVATED 0x00 #define CEC_OP_MENU_STATE_DEACTIVATED 0x01 #define CEC_MSG_USER_CONTROL_PRESSED 0x44 /* UI Broadcast Type Operand (ui_bcast_type) */ #define CEC_OP_UI_BCAST_TYPE_TOGGLE_ALL 0x00 #define CEC_OP_UI_BCAST_TYPE_TOGGLE_DIG_ANA 0x01 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE 0x10 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_T 0x20 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_CABLE 0x30 #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_SAT 0x40 #define CEC_OP_UI_BCAST_TYPE_DIGITAL 0x50 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_T 0x60 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_CABLE 0x70 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_SAT 0x80 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_COM_SAT 0x90 #define CEC_OP_UI_BCAST_TYPE_DIGITAL_COM_SAT2 0x91 #define CEC_OP_UI_BCAST_TYPE_IP 0xa0 /* UI Sound Presentation Control Operand (ui_snd_pres_ctl) */ #define CEC_OP_UI_SND_PRES_CTL_DUAL_MONO 0x10 #define CEC_OP_UI_SND_PRES_CTL_KARAOKE 0x20 #define CEC_OP_UI_SND_PRES_CTL_DOWNMIX 0x80 #define CEC_OP_UI_SND_PRES_CTL_REVERB 0x90 #define CEC_OP_UI_SND_PRES_CTL_EQUALIZER 0xa0 #define CEC_OP_UI_SND_PRES_CTL_BASS_UP 0xb1 #define CEC_OP_UI_SND_PRES_CTL_BASS_NEUTRAL 0xb2 #define CEC_OP_UI_SND_PRES_CTL_BASS_DOWN 0xb3 #define CEC_OP_UI_SND_PRES_CTL_TREBLE_UP 0xc1 #define CEC_OP_UI_SND_PRES_CTL_TREBLE_NEUTRAL 0xc2 #define CEC_OP_UI_SND_PRES_CTL_TREBLE_DOWN 0xc3 #define CEC_MSG_USER_CONTROL_RELEASED 0x45 /* Remote Control Passthrough Feature */ /* * Has also: * CEC_MSG_USER_CONTROL_PRESSED * CEC_MSG_USER_CONTROL_RELEASED */ /* Power Status Feature */ #define CEC_MSG_GIVE_DEVICE_POWER_STATUS 0x8f #define CEC_MSG_REPORT_POWER_STATUS 0x90 /* Power Status Operand (pwr_state) */ #define CEC_OP_POWER_STATUS_ON 0 #define CEC_OP_POWER_STATUS_STANDBY 1 #define CEC_OP_POWER_STATUS_TO_ON 2 #define CEC_OP_POWER_STATUS_TO_STANDBY 3 /* General Protocol Messages */ #define CEC_MSG_FEATURE_ABORT 0x00 /* Abort Reason Operand (reason) */ #define CEC_OP_ABORT_UNRECOGNIZED_OP 0 #define CEC_OP_ABORT_INCORRECT_MODE 1 #define CEC_OP_ABORT_NO_SOURCE 2 #define CEC_OP_ABORT_INVALID_OP 3 #define CEC_OP_ABORT_REFUSED 4 #define CEC_OP_ABORT_UNDETERMINED 5 #define CEC_MSG_ABORT 0xff /* System Audio Control Feature */ /* * Has also: * CEC_MSG_USER_CONTROL_PRESSED * CEC_MSG_USER_CONTROL_RELEASED */ #define CEC_MSG_GIVE_AUDIO_STATUS 0x71 #define CEC_MSG_GIVE_SYSTEM_AUDIO_MODE_STATUS 0x7d #define CEC_MSG_REPORT_AUDIO_STATUS 0x7a /* Audio Mute Status Operand (aud_mute_status) */ #define CEC_OP_AUD_MUTE_STATUS_OFF 0 #define CEC_OP_AUD_MUTE_STATUS_ON 1 #define CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR 0xa3 #define CEC_MSG_REQUEST_SHORT_AUDIO_DESCRIPTOR 0xa4 #define CEC_MSG_SET_SYSTEM_AUDIO_MODE 0x72 /* System Audio Status Operand (sys_aud_status) */ #define CEC_OP_SYS_AUD_STATUS_OFF 0 #define CEC_OP_SYS_AUD_STATUS_ON 1 #define CEC_MSG_SYSTEM_AUDIO_MODE_REQUEST 0x70 #define CEC_MSG_SYSTEM_AUDIO_MODE_STATUS 0x7e /* Audio Format ID Operand (audio_format_id) */ #define CEC_OP_AUD_FMT_ID_CEA861 0 #define CEC_OP_AUD_FMT_ID_CEA861_CXT 1 #define CEC_MSG_SET_AUDIO_VOLUME_LEVEL 0x73 /* Audio Rate Control Feature */ #define CEC_MSG_SET_AUDIO_RATE 0x9a /* Audio Rate Operand (audio_rate) */ #define CEC_OP_AUD_RATE_OFF 0 #define CEC_OP_AUD_RATE_WIDE_STD 1 #define CEC_OP_AUD_RATE_WIDE_FAST 2 #define CEC_OP_AUD_RATE_WIDE_SLOW 3 #define CEC_OP_AUD_RATE_NARROW_STD 4 #define CEC_OP_AUD_RATE_NARROW_FAST 5 #define CEC_OP_AUD_RATE_NARROW_SLOW 6 /* Audio Return Channel Control Feature */ #define CEC_MSG_INITIATE_ARC 0xc0 #define CEC_MSG_REPORT_ARC_INITIATED 0xc1 #define CEC_MSG_REPORT_ARC_TERMINATED 0xc2 #define CEC_MSG_REQUEST_ARC_INITIATION 0xc3 #define CEC_MSG_REQUEST_ARC_TERMINATION 0xc4 #define CEC_MSG_TERMINATE_ARC 0xc5 /* Dynamic Audio Lipsync Feature */ /* Only for CEC 2.0 and up */ #define CEC_MSG_REQUEST_CURRENT_LATENCY 0xa7 #define CEC_MSG_REPORT_CURRENT_LATENCY 0xa8 /* Low Latency Mode Operand (low_latency_mode) */ #define CEC_OP_LOW_LATENCY_MODE_OFF 0 #define CEC_OP_LOW_LATENCY_MODE_ON 1 /* Audio Output Compensated Operand (audio_out_compensated) */ #define CEC_OP_AUD_OUT_COMPENSATED_NA 0 #define CEC_OP_AUD_OUT_COMPENSATED_DELAY 1 #define CEC_OP_AUD_OUT_COMPENSATED_NO_DELAY 2 #define CEC_OP_AUD_OUT_COMPENSATED_PARTIAL_DELAY 3 /* Capability Discovery and Control Feature */ #define CEC_MSG_CDC_MESSAGE 0xf8 /* Ethernet-over-HDMI: nobody ever does this... */ #define CEC_MSG_CDC_HEC_INQUIRE_STATE 0x00 #define CEC_MSG_CDC_HEC_REPORT_STATE 0x01 /* HEC Functionality State Operand (hec_func_state) */ #define CEC_OP_HEC_FUNC_STATE_NOT_SUPPORTED 0 #define CEC_OP_HEC_FUNC_STATE_INACTIVE 1 #define CEC_OP_HEC_FUNC_STATE_ACTIVE 2 #define CEC_OP_HEC_FUNC_STATE_ACTIVATION_FIELD 3 /* Host Functionality State Operand (host_func_state) */ #define CEC_OP_HOST_FUNC_STATE_NOT_SUPPORTED 0 #define CEC_OP_HOST_FUNC_STATE_INACTIVE 1 #define CEC_OP_HOST_FUNC_STATE_ACTIVE 2 /* ENC Functionality State Operand (enc_func_state) */ #define CEC_OP_ENC_FUNC_STATE_EXT_CON_NOT_SUPPORTED 0 #define CEC_OP_ENC_FUNC_STATE_EXT_CON_INACTIVE 1 #define CEC_OP_ENC_FUNC_STATE_EXT_CON_ACTIVE 2 /* CDC Error Code Operand (cdc_errcode) */ #define CEC_OP_CDC_ERROR_CODE_NONE 0 #define CEC_OP_CDC_ERROR_CODE_CAP_UNSUPPORTED 1 #define CEC_OP_CDC_ERROR_CODE_WRONG_STATE 2 #define CEC_OP_CDC_ERROR_CODE_OTHER 3 /* HEC Support Operand (hec_support) */ #define CEC_OP_HEC_SUPPORT_NO 0 #define CEC_OP_HEC_SUPPORT_YES 1 /* HEC Activation Operand (hec_activation) */ #define CEC_OP_HEC_ACTIVATION_ON 0 #define CEC_OP_HEC_ACTIVATION_OFF 1 #define CEC_MSG_CDC_HEC_SET_STATE_ADJACENT 0x02 #define CEC_MSG_CDC_HEC_SET_STATE 0x03 /* HEC Set State Operand (hec_set_state) */ #define CEC_OP_HEC_SET_STATE_DEACTIVATE 0 #define CEC_OP_HEC_SET_STATE_ACTIVATE 1 #define CEC_MSG_CDC_HEC_REQUEST_DEACTIVATION 0x04 #define CEC_MSG_CDC_HEC_NOTIFY_ALIVE 0x05 #define CEC_MSG_CDC_HEC_DISCOVER 0x06 /* Hotplug Detect messages */ #define CEC_MSG_CDC_HPD_SET_STATE 0x10 /* HPD State Operand (hpd_state) */ #define CEC_OP_HPD_STATE_CP_EDID_DISABLE 0 #define CEC_OP_HPD_STATE_CP_EDID_ENABLE 1 #define CEC_OP_HPD_STATE_CP_EDID_DISABLE_ENABLE 2 #define CEC_OP_HPD_STATE_EDID_DISABLE 3 #define CEC_OP_HPD_STATE_EDID_ENABLE 4 #define CEC_OP_HPD_STATE_EDID_DISABLE_ENABLE 5 #define CEC_MSG_CDC_HPD_REPORT_STATE 0x11 /* HPD Error Code Operand (hpd_error) */ #define CEC_OP_HPD_ERROR_NONE 0 #define CEC_OP_HPD_ERROR_INITIATOR_NOT_CAPABLE 1 #define CEC_OP_HPD_ERROR_INITIATOR_WRONG_STATE 2 #define CEC_OP_HPD_ERROR_OTHER 3 #define CEC_OP_HPD_ERROR_NONE_NO_VIDEO 4 /* End of Messages */ /* Helper functions to identify the 'special' CEC devices */ static __inline__ int cec_is_2nd_tv(const struct cec_log_addrs *las) { /* * It is a second TV if the logical address is 14 or 15 and the * primary device type is a TV. */ return las->num_log_addrs && las->log_addr[0] >= CEC_LOG_ADDR_SPECIFIC && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_TV; } static __inline__ int cec_is_processor(const struct cec_log_addrs *las) { /* * It is a processor if the logical address is 12-15 and the * primary device type is a Processor. */ return las->num_log_addrs && las->log_addr[0] >= CEC_LOG_ADDR_BACKUP_1 && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_PROCESSOR; } static __inline__ int cec_is_switch(const struct cec_log_addrs *las) { /* * It is a switch if the logical address is 15 and the * primary device type is a Switch and the CDC-Only flag is not set. */ return las->num_log_addrs == 1 && las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH && !(las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY); } static __inline__ int cec_is_cdc_only(const struct cec_log_addrs *las) { /* * It is a CDC-only device if the logical address is 15 and the * primary device type is a Switch and the CDC-Only flag is set. */ return las->num_log_addrs == 1 && las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED && las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH && (las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY); } #endif misc/cxl.h 0000644 00000007540 15063602060 0006442 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2014 IBM Corp. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _MISC_CXL_H #define _MISC_CXL_H #include <linux/types.h> #include <linux/ioctl.h> struct cxl_ioctl_start_work { __u64 flags; __u64 work_element_descriptor; __u64 amr; __s16 num_interrupts; __u16 tid; __s32 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; __u64 reserved5; }; #define CXL_START_WORK_AMR 0x0000000000000001ULL #define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL #define CXL_START_WORK_ERR_FF 0x0000000000000004ULL #define CXL_START_WORK_TID 0x0000000000000008ULL #define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\ CXL_START_WORK_NUM_IRQS |\ CXL_START_WORK_ERR_FF |\ CXL_START_WORK_TID) /* Possible modes that an afu can be in */ #define CXL_MODE_DEDICATED 0x1 #define CXL_MODE_DIRECTED 0x2 /* possible flags for the cxl_afu_id flags field */ #define CXL_AFUID_FLAG_SLAVE 0x1 /* In directed-mode afu is in slave mode */ struct cxl_afu_id { __u64 flags; /* One of CXL_AFUID_FLAG_X */ __u32 card_id; __u32 afu_offset; __u32 afu_mode; /* one of the CXL_MODE_X */ __u32 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; __u64 reserved5; __u64 reserved6; }; /* base adapter image header is included in the image */ #define CXL_AI_NEED_HEADER 0x0000000000000001ULL #define CXL_AI_ALL CXL_AI_NEED_HEADER #define CXL_AI_HEADER_SIZE 128 #define CXL_AI_BUFFER_SIZE 4096 #define CXL_AI_MAX_ENTRIES 256 #define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES) struct cxl_adapter_image { __u64 flags; __u64 data; __u64 len_data; __u64 len_image; __u64 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; }; /* ioctl numbers */ #define CXL_MAGIC 0xCA /* AFU devices */ #define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work) #define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32) #define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id) /* adapter devices */ #define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image) #define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image) #define CXL_READ_MIN_SIZE 0x1000 /* 4K */ /* Events from read() */ enum cxl_event_type { CXL_EVENT_RESERVED = 0, CXL_EVENT_AFU_INTERRUPT = 1, CXL_EVENT_DATA_STORAGE = 2, CXL_EVENT_AFU_ERROR = 3, CXL_EVENT_AFU_DRIVER = 4, }; struct cxl_event_header { __u16 type; __u16 size; __u16 process_element; __u16 reserved1; }; struct cxl_event_afu_interrupt { __u16 flags; __u16 irq; /* Raised AFU interrupt number */ __u32 reserved1; }; struct cxl_event_data_storage { __u16 flags; __u16 reserved1; __u32 reserved2; __u64 addr; __u64 dsisr; __u64 reserved3; }; struct cxl_event_afu_error { __u16 flags; __u16 reserved1; __u32 reserved2; __u64 error; }; struct cxl_event_afu_driver_reserved { /* * Defines the buffer passed to the cxl driver by the AFU driver. * * This is not ABI since the event header.size passed to the user for * existing events is set in the read call to sizeof(cxl_event_header) * + sizeof(whatever event is being dispatched) and the user is already * required to use a 4K buffer on the read call. * * Of course the contents will be ABI, but that's up the AFU driver. */ __u32 data_size; __u8 data[]; }; struct cxl_event { struct cxl_event_header header; union { struct cxl_event_afu_interrupt irq; struct cxl_event_data_storage fault; struct cxl_event_afu_error afu_error; struct cxl_event_afu_driver_reserved afu_driver_event; }; }; #endif /* _MISC_CXL_H */ misc/ocxl.h 0000644 00000003633 15063602060 0006620 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* Copyright 2017 IBM Corp. */ #ifndef _MISC_OCXL_H #define _MISC_OCXL_H #include <linux/types.h> #include <linux/ioctl.h> enum ocxl_event_type { OCXL_AFU_EVENT_XSL_FAULT_ERROR = 0, }; #define OCXL_KERNEL_EVENT_FLAG_LAST 0x0001 /* This is the last event pending */ struct ocxl_kernel_event_header { __u16 type; __u16 flags; __u32 reserved; }; struct ocxl_kernel_event_xsl_fault_error { __u64 addr; __u64 dsisr; __u64 count; __u64 reserved; }; struct ocxl_ioctl_attach { __u64 amr; __u64 reserved1; __u64 reserved2; __u64 reserved3; }; struct ocxl_ioctl_metadata { __u16 version; /* struct version, always backwards compatible */ /* Version 0 fields */ __u8 afu_version_major; __u8 afu_version_minor; __u32 pasid; /* PASID assigned to the current context */ __u64 pp_mmio_size; /* Per PASID MMIO size */ __u64 global_mmio_size; /* End version 0 fields */ __u64 reserved[13]; /* Total of 16*u64 */ }; struct ocxl_ioctl_p9_wait { __u16 thread_id; /* The thread ID required to wake this thread */ __u16 reserved1; __u32 reserved2; __u64 reserved3[3]; }; #define OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT 0x01 struct ocxl_ioctl_features { __u64 flags[4]; }; struct ocxl_ioctl_irq_fd { __u64 irq_offset; __s32 eventfd; __u32 reserved; }; /* ioctl numbers */ #define OCXL_MAGIC 0xCA /* AFU devices */ #define OCXL_IOCTL_ATTACH _IOW(OCXL_MAGIC, 0x10, struct ocxl_ioctl_attach) #define OCXL_IOCTL_IRQ_ALLOC _IOR(OCXL_MAGIC, 0x11, __u64) #define OCXL_IOCTL_IRQ_FREE _IOW(OCXL_MAGIC, 0x12, __u64) #define OCXL_IOCTL_IRQ_SET_FD _IOW(OCXL_MAGIC, 0x13, struct ocxl_ioctl_irq_fd) #define OCXL_IOCTL_GET_METADATA _IOR(OCXL_MAGIC, 0x14, struct ocxl_ioctl_metadata) #define OCXL_IOCTL_ENABLE_P9_WAIT _IOR(OCXL_MAGIC, 0x15, struct ocxl_ioctl_p9_wait) #define OCXL_IOCTL_GET_FEATURES _IOR(OCXL_MAGIC, 0x16, struct ocxl_ioctl_features) #endif /* _MISC_OCXL_H */ misc/pvpanic.h 0000644 00000000321 15063602060 0007302 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __PVPANIC_H__ #define __PVPANIC_H__ #define PVPANIC_PANICKED (1 << 0) #define PVPANIC_CRASH_LOADED (1 << 1) #endif /* __PVPANIC_H__ */ mtd/inftl-user.h 0000644 00000003154 15063602060 0007572 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Parts of INFTL headers shared with userspace * */ #ifndef __MTD_INFTL_USER_H__ #define __MTD_INFTL_USER_H__ #include <linux/types.h> #define OSAK_VERSION 0x5120 #define PERCENTUSED 98 #define SECTORSIZE 512 /* Block Control Information */ struct inftl_bci { __u8 ECCsig[6]; __u8 Status; __u8 Status1; } __attribute__((packed)); struct inftl_unithead1 { __u16 virtualUnitNo; __u16 prevUnitNo; __u8 ANAC; __u8 NACs; __u8 parityPerField; __u8 discarded; } __attribute__((packed)); struct inftl_unithead2 { __u8 parityPerField; __u8 ANAC; __u16 prevUnitNo; __u16 virtualUnitNo; __u8 NACs; __u8 discarded; } __attribute__((packed)); struct inftl_unittail { __u8 Reserved[4]; __u16 EraseMark; __u16 EraseMark1; } __attribute__((packed)); union inftl_uci { struct inftl_unithead1 a; struct inftl_unithead2 b; struct inftl_unittail c; }; struct inftl_oob { struct inftl_bci b; union inftl_uci u; }; /* INFTL Media Header */ struct INFTLPartition { __u32 virtualUnits; __u32 firstUnit; __u32 lastUnit; __u32 flags; __u32 spareUnits; __u32 Reserved0; __u32 Reserved1; } __attribute__((packed)); struct INFTLMediaHeader { char bootRecordID[8]; __u32 NoOfBootImageBlocks; __u32 NoOfBinaryPartitions; __u32 NoOfBDTLPartitions; __u32 BlockMultiplierBits; __u32 FormatFlags; __u32 OsakVersion; __u32 PercentUsed; struct INFTLPartition Partitions[4]; } __attribute__((packed)); /* Partition flag types */ #define INFTL_BINARY 0x20000000 #define INFTL_BDTL 0x40000000 #define INFTL_LAST 0x80000000 #endif /* __MTD_INFTL_USER_H__ */ mtd/mtd-abi.h 0000644 00000022765 15063602060 0007030 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __MTD_ABI_H__ #define __MTD_ABI_H__ #include <linux/types.h> struct erase_info_user { __u32 start; __u32 length; }; struct erase_info_user64 { __u64 start; __u64 length; }; struct mtd_oob_buf { __u32 start; __u32 length; unsigned char *ptr; }; struct mtd_oob_buf64 { __u64 start; __u32 pad; __u32 length; __u64 usr_ptr; }; /** * MTD operation modes * * @MTD_OPS_PLACE_OOB: OOB data are placed at the given offset (default) * @MTD_OPS_AUTO_OOB: OOB data are automatically placed at the free areas * which are defined by the internal ecclayout * @MTD_OPS_RAW: data are transferred as-is, with no error correction; * this mode implies %MTD_OPS_PLACE_OOB * * These modes can be passed to ioctl(MEMWRITE) and are also used internally. * See notes on "MTD file modes" for discussion on %MTD_OPS_RAW vs. * %MTD_FILE_MODE_RAW. */ enum { MTD_OPS_PLACE_OOB = 0, MTD_OPS_AUTO_OOB = 1, MTD_OPS_RAW = 2, }; /** * struct mtd_write_req - data structure for requesting a write operation * * @start: start address * @len: length of data buffer * @ooblen: length of OOB buffer * @usr_data: user-provided data buffer * @usr_oob: user-provided OOB buffer * @mode: MTD mode (see "MTD operation modes") * @padding: reserved, must be set to 0 * * This structure supports ioctl(MEMWRITE) operations, allowing data and/or OOB * writes in various modes. To write to OOB-only, set @usr_data == NULL, and to * write data-only, set @usr_oob == NULL. However, setting both @usr_data and * @usr_oob to NULL is not allowed. */ struct mtd_write_req { __u64 start; __u64 len; __u64 ooblen; __u64 usr_data; __u64 usr_oob; __u8 mode; __u8 padding[7]; }; #define MTD_ABSENT 0 #define MTD_RAM 1 #define MTD_ROM 2 #define MTD_NORFLASH 3 #define MTD_NANDFLASH 4 /* SLC NAND */ #define MTD_DATAFLASH 6 #define MTD_UBIVOLUME 7 #define MTD_MLCNANDFLASH 8 /* MLC NAND (including TLC) */ #define MTD_WRITEABLE 0x400 /* Device is writeable */ #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ #define MTD_NO_ERASE 0x1000 /* No erase necessary */ #define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */ /* Some common devices / combinations of capabilities */ #define MTD_CAP_ROM 0 #define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) #define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) #define MTD_CAP_NANDFLASH (MTD_WRITEABLE) #define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) /* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */ #define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) #define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) #define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme #define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read) #define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default /* OTP mode selection */ #define MTD_OTP_OFF 0 #define MTD_OTP_FACTORY 1 #define MTD_OTP_USER 2 struct mtd_info_user { __u8 type; __u32 flags; __u32 size; /* Total size of the MTD */ __u32 erasesize; __u32 writesize; __u32 oobsize; /* Amount of OOB data per block (e.g. 16) */ __u64 padding; /* Old obsolete field; do not use */ }; struct region_info_user { __u32 offset; /* At which this region starts, * from the beginning of the MTD */ __u32 erasesize; /* For this region */ __u32 numblocks; /* Number of blocks in this region */ __u32 regionindex; }; struct otp_info { __u32 start; __u32 length; __u32 locked; }; /* * Note, the following ioctl existed in the past and was removed: * #define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) * Try to avoid adding a new ioctl with the same ioctl number. */ /* Get basic MTD characteristics info (better to use sysfs) */ #define MEMGETINFO _IOR('M', 1, struct mtd_info_user) /* Erase segment of MTD */ #define MEMERASE _IOW('M', 2, struct erase_info_user) /* Write out-of-band data from MTD */ #define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) /* Read out-of-band data from MTD */ #define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) /* Lock a chip (for MTD that supports it) */ #define MEMLOCK _IOW('M', 5, struct erase_info_user) /* Unlock a chip (for MTD that supports it) */ #define MEMUNLOCK _IOW('M', 6, struct erase_info_user) /* Get the number of different erase regions */ #define MEMGETREGIONCOUNT _IOR('M', 7, int) /* Get information about the erase region for a specific index */ #define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) /* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */ #define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) /* Check if an eraseblock is bad */ #define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) /* Mark an eraseblock as bad */ #define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t) /* Set OTP (One-Time Programmable) mode (factory vs. user) */ #define OTPSELECT _IOR('M', 13, int) /* Get number of OTP (One-Time Programmable) regions */ #define OTPGETREGIONCOUNT _IOW('M', 14, int) /* Get all OTP (One-Time Programmable) info about MTD */ #define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) /* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */ #define OTPLOCK _IOR('M', 16, struct otp_info) /* Get ECC layout (deprecated) */ #define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user) /* Get statistics about corrected/uncorrected errors */ #define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) /* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */ #define MTDFILEMODE _IO('M', 19) /* Erase segment of MTD (supports 64-bit address) */ #define MEMERASE64 _IOW('M', 20, struct erase_info_user64) /* Write data to OOB (64-bit version) */ #define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) /* Read data from OOB (64-bit version) */ #define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) /* Check if chip is locked (for MTD that supports it) */ #define MEMISLOCKED _IOR('M', 23, struct erase_info_user) /* * Most generic write interface; can write in-band and/or out-of-band in various * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes * without OOB, e.g., NOR flash. */ #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) /* * Obsolete legacy interface. Keep it in order not to break userspace * interfaces */ struct nand_oobinfo { __u32 useecc; __u32 eccbytes; __u32 oobfree[8][2]; __u32 eccpos[32]; }; struct nand_oobfree { __u32 offset; __u32 length; }; #define MTD_MAX_OOBFREE_ENTRIES 8 #define MTD_MAX_ECCPOS_ENTRIES 64 /* * OBSOLETE: ECC layout control structure. Exported to user-space via ioctl * ECCGETLAYOUT for backwards compatbility and should not be mistaken as a * complete set of ECC information. The ioctl truncates the larger internal * structure to retain binary compatibility with the static declaration of the * ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of * the user struct, not the MAX size of the internal OOB layout representation. */ struct nand_ecclayout_user { __u32 eccbytes; __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES]; __u32 oobavail; struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; }; /** * struct mtd_ecc_stats - error correction stats * * @corrected: number of corrected bits * @failed: number of uncorrectable errors * @badblocks: number of bad blocks in this partition * @bbtblocks: number of blocks reserved for bad block tables */ struct mtd_ecc_stats { __u32 corrected; __u32 failed; __u32 badblocks; __u32 bbtblocks; }; /* * MTD file modes - for read/write access to MTD * * @MTD_FILE_MODE_NORMAL: OTP disabled, ECC enabled * @MTD_FILE_MODE_OTP_FACTORY: OTP enabled in factory mode * @MTD_FILE_MODE_OTP_USER: OTP enabled in user mode * @MTD_FILE_MODE_RAW: OTP disabled, ECC disabled * * These modes can be set via ioctl(MTDFILEMODE). The mode mode will be retained * separately for each open file descriptor. * * Note: %MTD_FILE_MODE_RAW provides the same functionality as %MTD_OPS_RAW - * raw access to the flash, without error correction or autoplacement schemes. * Wherever possible, the MTD_OPS_* mode will override the MTD_FILE_MODE_* mode * (e.g., when using ioctl(MEMWRITE)), but in some cases, the MTD_FILE_MODE is * used out of necessity (e.g., `write()', ioctl(MEMWRITEOOB64)). */ enum mtd_file_modes { MTD_FILE_MODE_NORMAL = MTD_OTP_OFF, MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY, MTD_FILE_MODE_OTP_USER = MTD_OTP_USER, MTD_FILE_MODE_RAW, }; static __inline__ int mtd_type_is_nand_user(const struct mtd_info_user *mtd) { return mtd->type == MTD_NANDFLASH || mtd->type == MTD_MLCNANDFLASH; } #endif /* __MTD_ABI_H__ */ mtd/mtd-user.h 0000644 00000002332 15063602060 0007237 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __MTD_USER_H__ #define __MTD_USER_H__ /* This file is blessed for inclusion by userspace */ #include <mtd/mtd-abi.h> typedef struct mtd_info_user mtd_info_t; typedef struct erase_info_user erase_info_t; typedef struct region_info_user region_info_t; typedef struct nand_oobinfo nand_oobinfo_t; typedef struct nand_ecclayout_user nand_ecclayout_t; #endif /* __MTD_USER_H__ */ mtd/nftl-user.h 0000644 00000004104 15063602060 0007415 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __MTD_NFTL_USER_H__ #define __MTD_NFTL_USER_H__ #include <linux/types.h> /* Block Control Information */ struct nftl_bci { unsigned char ECCSig[6]; __u8 Status; __u8 Status1; }__attribute__((packed)); /* Unit Control Information */ struct nftl_uci0 { __u16 VirtUnitNum; __u16 ReplUnitNum; __u16 SpareVirtUnitNum; __u16 SpareReplUnitNum; } __attribute__((packed)); struct nftl_uci1 { __u32 WearInfo; __u16 EraseMark; __u16 EraseMark1; } __attribute__((packed)); struct nftl_uci2 { __u16 FoldMark; __u16 FoldMark1; __u32 unused; } __attribute__((packed)); union nftl_uci { struct nftl_uci0 a; struct nftl_uci1 b; struct nftl_uci2 c; }; struct nftl_oob { struct nftl_bci b; union nftl_uci u; }; /* NFTL Media Header */ struct NFTLMediaHeader { char DataOrgID[6]; __u16 NumEraseUnits; __u16 FirstPhysicalEUN; __u32 FormattedSize; unsigned char UnitSizeFactor; } __attribute__((packed)); #define MAX_ERASE_ZONES (8192 - 512) #define ERASE_MARK 0x3c69 #define SECTOR_FREE 0xff #define SECTOR_USED 0x55 #define SECTOR_IGNORE 0x11 #define SECTOR_DELETED 0x00 #define FOLD_MARK_IN_PROGRESS 0x5555 #define ZONE_GOOD 0xff #define ZONE_BAD_ORIGINAL 0 #define ZONE_BAD_MARKED 7 #endif /* __MTD_NFTL_USER_H__ */ mtd/ubi-user.h 0000644 00000042412 15063602060 0007235 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © International Business Machines Corp., 2006 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Artem Bityutskiy (Битюцкий Артём) */ #ifndef __UBI_USER_H__ #define __UBI_USER_H__ #include <linux/types.h> /* * UBI device creation (the same as MTD device attachment) * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * MTD devices may be attached using %UBI_IOCATT ioctl command of the UBI * control device. The caller has to properly fill and pass * &struct ubi_attach_req object - UBI will attach the MTD device specified in * the request and return the newly created UBI device number as the ioctl * return value. * * UBI device deletion (the same as MTD device detachment) * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * An UBI device maybe deleted with %UBI_IOCDET ioctl command of the UBI * control device. * * UBI volume creation * ~~~~~~~~~~~~~~~~~~~ * * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character * device. A &struct ubi_mkvol_req object has to be properly filled and a * pointer to it has to be passed to the ioctl. * * UBI volume deletion * ~~~~~~~~~~~~~~~~~~~ * * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character * device should be used. A pointer to the 32-bit volume ID hast to be passed * to the ioctl. * * UBI volume re-size * ~~~~~~~~~~~~~~~~~~ * * To re-size a volume, the %UBI_IOCRSVOL ioctl command of the UBI character * device should be used. A &struct ubi_rsvol_req object has to be properly * filled and a pointer to it has to be passed to the ioctl. * * UBI volumes re-name * ~~~~~~~~~~~~~~~~~~~ * * To re-name several volumes atomically at one go, the %UBI_IOCRNVOL command * of the UBI character device should be used. A &struct ubi_rnvol_req object * has to be properly filled and a pointer to it has to be passed to the ioctl. * * UBI volume update * ~~~~~~~~~~~~~~~~~ * * Volume update should be done via the %UBI_IOCVOLUP ioctl command of the * corresponding UBI volume character device. A pointer to a 64-bit update * size should be passed to the ioctl. After this, UBI expects user to write * this number of bytes to the volume character device. The update is finished * when the claimed number of bytes is passed. So, the volume update sequence * is something like: * * fd = open("/dev/my_volume"); * ioctl(fd, UBI_IOCVOLUP, &image_size); * write(fd, buf, image_size); * close(fd); * * Logical eraseblock erase * ~~~~~~~~~~~~~~~~~~~~~~~~ * * To erase a logical eraseblock, the %UBI_IOCEBER ioctl command of the * corresponding UBI volume character device should be used. This command * unmaps the requested logical eraseblock, makes sure the corresponding * physical eraseblock is successfully erased, and returns. * * Atomic logical eraseblock change * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH * ioctl command of the corresponding UBI volume character device. A pointer to * a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the * user is expected to write the requested amount of bytes (similarly to what * should be done in case of the "volume update" ioctl). * * Logical eraseblock map * ~~~~~~~~~~~~~~~~~~~~~ * * To map a logical eraseblock to a physical eraseblock, the %UBI_IOCEBMAP * ioctl command should be used. A pointer to a &struct ubi_map_req object is * expected to be passed. The ioctl maps the requested logical eraseblock to * a physical eraseblock and returns. Only non-mapped logical eraseblocks can * be mapped. If the logical eraseblock specified in the request is already * mapped to a physical eraseblock, the ioctl fails and returns error. * * Logical eraseblock unmap * ~~~~~~~~~~~~~~~~~~~~~~~~ * * To unmap a logical eraseblock to a physical eraseblock, the %UBI_IOCEBUNMAP * ioctl command should be used. The ioctl unmaps the logical eraseblocks, * schedules corresponding physical eraseblock for erasure, and returns. Unlike * the "LEB erase" command, it does not wait for the physical eraseblock being * erased. Note, the side effect of this is that if an unclean reboot happens * after the unmap ioctl returns, you may find the LEB mapped again to the same * physical eraseblock after the UBI is run again. * * Check if logical eraseblock is mapped * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * To check if a logical eraseblock is mapped to a physical eraseblock, the * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is * not mapped, and %1 if it is mapped. * * Set an UBI volume property * ~~~~~~~~~~~~~~~~~~~~~~~~~ * * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be * passed. The object describes which property should be set, and to which value * it should be set. * * Block devices on UBI volumes * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * To create a R/O block device on top of an UBI volume the %UBI_IOCVOLCRBLK * should be used. A pointer to a &struct ubi_blkcreate_req object is expected * to be passed, which is not used and reserved for future usage. * * Conversely, to remove a block device the %UBI_IOCVOLRMBLK should be used, * which takes no arguments. */ /* * When a new UBI volume or UBI device is created, users may either specify the * volume/device number they want to create or to let UBI automatically assign * the number using these constants. */ #define UBI_VOL_NUM_AUTO (-1) #define UBI_DEV_NUM_AUTO (-1) /* Maximum volume name length */ #define UBI_MAX_VOLUME_NAME 127 /* ioctl commands of UBI character devices */ #define UBI_IOC_MAGIC 'o' /* Create an UBI volume */ #define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) /* Remove an UBI volume */ #define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32) /* Re-size an UBI volume */ #define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) /* Re-name volumes */ #define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req) /* ioctl commands of the UBI control character device */ #define UBI_CTRL_IOC_MAGIC 'o' /* Attach an MTD device */ #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) /* Detach an MTD device */ #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32) /* ioctl commands of UBI volume character devices */ #define UBI_VOL_IOC_MAGIC 'O' /* Start UBI volume update * Note: This actually takes a pointer (__s64*), but we can't change * that without breaking the ABI on 32bit systems */ #define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64) /* LEB erasure command, used for debugging, disabled by default */ #define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32) /* Atomic LEB change command */ #define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32) /* Map LEB command */ #define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) /* Unmap LEB command */ #define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32) /* Check if LEB is mapped command */ #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32) /* Set an UBI volume property */ #define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ struct ubi_set_vol_prop_req) /* Create a R/O block device on top of an UBI volume */ #define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req) /* Remove the R/O block device */ #define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8) /* Maximum MTD device name length supported by UBI */ #define MAX_UBI_MTD_NAME_LEN 127 /* Maximum amount of UBI volumes that can be re-named at one go */ #define UBI_MAX_RNVOL 32 /* * UBI volume type constants. * * @UBI_DYNAMIC_VOLUME: dynamic volume * @UBI_STATIC_VOLUME: static volume */ enum { UBI_DYNAMIC_VOLUME = 3, UBI_STATIC_VOLUME = 4, }; /* * UBI set volume property ioctl constants. * * @UBI_VOL_PROP_DIRECT_WRITE: allow (any non-zero value) or disallow (value 0) * user to directly write and erase individual * eraseblocks on dynamic volumes */ enum { UBI_VOL_PROP_DIRECT_WRITE = 1, }; /** * struct ubi_attach_req - attach MTD device request. * @ubi_num: UBI device number to create * @mtd_num: MTD device number to attach * @vid_hdr_offset: VID header offset (use defaults if %0) * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs * @padding: reserved for future, not used, has to be zeroed * * This data structure is used to specify MTD device UBI has to attach and the * parameters it has to use. The number which should be assigned to the new UBI * device is passed in @ubi_num. UBI may automatically assign the number if * @UBI_DEV_NUM_AUTO is passed. In this case, the device number is returned in * @ubi_num. * * Most applications should pass %0 in @vid_hdr_offset to make UBI use default * offset of the VID header within physical eraseblocks. The default offset is * the next min. I/O unit after the EC header. For example, it will be offset * 512 in case of a 512 bytes page NAND flash with no sub-page support. Or * it will be 512 in case of a 2KiB page NAND flash with 4 512-byte sub-pages. * * But in rare cases, if this optimizes things, the VID header may be placed to * a different offset. For example, the boot-loader might do things faster if * the VID header sits at the end of the first 2KiB NAND page with 4 sub-pages. * As the boot-loader would not normally need to read EC headers (unless it * needs UBI in RW mode), it might be faster to calculate ECC. This is weird * example, but it real-life example. So, in this example, @vid_hdr_offer would * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes * aligned, which is OK, as UBI is clever enough to realize this is 4th * sub-page of the first page and add needed padding. * * The @max_beb_per1024 is the maximum amount of bad PEBs UBI expects on the * UBI device per 1024 eraseblocks. This value is often given in an other form * in the NAND datasheet (min NVB i.e. minimal number of valid blocks). The * maximum expected bad eraseblocks per 1024 is then: * 1024 * (1 - MinNVB / MaxNVB) * Which gives 20 for most NAND devices. This limit is used in order to derive * amount of eraseblock UBI reserves for handling new bad blocks. If the device * has more bad eraseblocks than this limit, UBI does not reserve any physical * eraseblocks for new bad eraseblocks, but attempts to use available * eraseblocks (if any). The accepted range is 0-768. If 0 is given, the * default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used. */ struct ubi_attach_req { __s32 ubi_num; __s32 mtd_num; __s32 vid_hdr_offset; __s16 max_beb_per1024; __s8 padding[10]; }; /** * struct ubi_mkvol_req - volume description data structure used in * volume creation requests. * @vol_id: volume number * @alignment: volume alignment * @bytes: volume size in bytes * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) * @padding1: reserved for future, not used, has to be zeroed * @name_len: volume name length * @padding2: reserved for future, not used, has to be zeroed * @name: volume name * * This structure is used by user-space programs when creating new volumes. The * @used_bytes field is only necessary when creating static volumes. * * The @alignment field specifies the required alignment of the volume logical * eraseblock. This means, that the size of logical eraseblocks will be aligned * to this number, i.e., * (UBI device logical eraseblock size) mod (@alignment) = 0. * * To put it differently, the logical eraseblock of this volume may be slightly * shortened in order to make it properly aligned. The alignment has to be * multiple of the flash minimal input/output unit, or %1 to utilize the entire * available space of logical eraseblocks. * * The @alignment field may be useful, for example, when one wants to maintain * a block device on top of an UBI volume. In this case, it is desirable to fit * an integer number of blocks in logical eraseblocks of this UBI volume. With * alignment it is possible to update this volume using plane UBI volume image * BLOBs, without caring about how to properly align them. */ struct ubi_mkvol_req { __s32 vol_id; __s32 alignment; __s64 bytes; __s8 vol_type; __s8 padding1; __s16 name_len; __s8 padding2[4]; char name[UBI_MAX_VOLUME_NAME + 1]; } __attribute__((packed)); /** * struct ubi_rsvol_req - a data structure used in volume re-size requests. * @vol_id: ID of the volume to re-size * @bytes: new size of the volume in bytes * * Re-sizing is possible for both dynamic and static volumes. But while dynamic * volumes may be re-sized arbitrarily, static volumes cannot be made to be * smaller than the number of bytes they bear. To arbitrarily shrink a static * volume, it must be wiped out first (by means of volume update operation with * zero number of bytes). */ struct ubi_rsvol_req { __s64 bytes; __s32 vol_id; } __attribute__((packed)); /** * struct ubi_rnvol_req - volumes re-name request. * @count: count of volumes to re-name * @padding1: reserved for future, not used, has to be zeroed * @vol_id: ID of the volume to re-name * @name_len: name length * @padding2: reserved for future, not used, has to be zeroed * @name: new volume name * * UBI allows to re-name up to %32 volumes at one go. The count of volumes to * re-name is specified in the @count field. The ID of the volumes to re-name * and the new names are specified in the @vol_id and @name fields. * * The UBI volume re-name operation is atomic, which means that should power cut * happen, the volumes will have either old name or new name. So the possible * use-cases of this command is atomic upgrade. Indeed, to upgrade, say, volumes * A and B one may create temporary volumes %A1 and %B1 with the new contents, * then atomically re-name A1->A and B1->B, in which case old %A and %B will * be removed. * * If it is not desirable to remove old A and B, the re-name request has to * contain 4 entries: A1->A, A->A1, B1->B, B->B1, in which case old A1 and B1 * become A and B, and old A and B will become A1 and B1. * * It is also OK to request: A1->A, A1->X, B1->B, B->Y, in which case old A1 * and B1 become A and B, and old A and B become X and Y. * * In other words, in case of re-naming into an existing volume name, the * existing volume is removed, unless it is re-named as well at the same * re-name request. */ struct ubi_rnvol_req { __s32 count; __s8 padding1[12]; struct { __s32 vol_id; __s16 name_len; __s8 padding2[2]; char name[UBI_MAX_VOLUME_NAME + 1]; } ents[UBI_MAX_RNVOL]; } __attribute__((packed)); /** * struct ubi_leb_change_req - a data structure used in atomic LEB change * requests. * @lnum: logical eraseblock number to change * @bytes: how many bytes will be written to the logical eraseblock * @dtype: pass "3" for better compatibility with old kernels * @padding: reserved for future, not used, has to be zeroed * * The @dtype field used to inform UBI about what kind of data will be written * to the LEB: long term (value 1), short term (value 2), unknown (value 3). * UBI tried to pick a PEB with lower erase counter for short term data and a * PEB with higher erase counter for long term data. But this was not really * used because users usually do not know this and could easily mislead UBI. We * removed this feature in May 2012. UBI currently just ignores the @dtype * field. But for better compatibility with older kernels it is recommended to * set @dtype to 3 (unknown). */ struct ubi_leb_change_req { __s32 lnum; __s32 bytes; __s8 dtype; /* obsolete, do not use! */ __s8 padding[7]; } __attribute__((packed)); /** * struct ubi_map_req - a data structure used in map LEB requests. * @dtype: pass "3" for better compatibility with old kernels * @lnum: logical eraseblock number to unmap * @padding: reserved for future, not used, has to be zeroed */ struct ubi_map_req { __s32 lnum; __s8 dtype; /* obsolete, do not use! */ __s8 padding[3]; } __attribute__((packed)); /** * struct ubi_set_vol_prop_req - a data structure used to set an UBI volume * property. * @property: property to set (%UBI_VOL_PROP_DIRECT_WRITE) * @padding: reserved for future, not used, has to be zeroed * @value: value to set */ struct ubi_set_vol_prop_req { __u8 property; __u8 padding[7]; __u64 value; } __attribute__((packed)); /** * struct ubi_blkcreate_req - a data structure used in block creation requests. * @padding: reserved for future, not used, has to be zeroed */ struct ubi_blkcreate_req { __s8 padding[128]; } __attribute__((packed)); #endif /* __UBI_USER_H__ */ perf/perf_dlfilter.h 0000644 00000013152 15063602060 0010472 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ /* * perf_dlfilter.h: API for perf --dlfilter shared object * Copyright (c) 2021, Intel Corporation. */ #ifndef _LINUX_PERF_DLFILTER_H #define _LINUX_PERF_DLFILTER_H #include <linux/perf_event.h> #include <linux/types.h> /* Definitions for perf_dlfilter_sample flags */ enum { PERF_DLFILTER_FLAG_BRANCH = 1ULL << 0, PERF_DLFILTER_FLAG_CALL = 1ULL << 1, PERF_DLFILTER_FLAG_RETURN = 1ULL << 2, PERF_DLFILTER_FLAG_CONDITIONAL = 1ULL << 3, PERF_DLFILTER_FLAG_SYSCALLRET = 1ULL << 4, PERF_DLFILTER_FLAG_ASYNC = 1ULL << 5, PERF_DLFILTER_FLAG_INTERRUPT = 1ULL << 6, PERF_DLFILTER_FLAG_TX_ABORT = 1ULL << 7, PERF_DLFILTER_FLAG_TRACE_BEGIN = 1ULL << 8, PERF_DLFILTER_FLAG_TRACE_END = 1ULL << 9, PERF_DLFILTER_FLAG_IN_TX = 1ULL << 10, PERF_DLFILTER_FLAG_VMENTRY = 1ULL << 11, PERF_DLFILTER_FLAG_VMEXIT = 1ULL << 12, }; /* * perf sample event information (as per perf script and <linux/perf_event.h>) */ struct perf_dlfilter_sample { __u32 size; /* Size of this structure (for compatibility checking) */ __u16 ins_lat; /* Refer PERF_SAMPLE_WEIGHT_TYPE in <linux/perf_event.h> */ __u16 p_stage_cyc; /* Refer PERF_SAMPLE_WEIGHT_TYPE in <linux/perf_event.h> */ __u64 ip; __s32 pid; __s32 tid; __u64 time; __u64 addr; __u64 id; __u64 stream_id; __u64 period; __u64 weight; /* Refer PERF_SAMPLE_WEIGHT_TYPE in <linux/perf_event.h> */ __u64 transaction; /* Refer PERF_SAMPLE_TRANSACTION in <linux/perf_event.h> */ __u64 insn_cnt; /* For instructions-per-cycle (IPC) */ __u64 cyc_cnt; /* For instructions-per-cycle (IPC) */ __s32 cpu; __u32 flags; /* Refer PERF_DLFILTER_FLAG_* above */ __u64 data_src; /* Refer PERF_SAMPLE_DATA_SRC in <linux/perf_event.h> */ __u64 phys_addr; /* Refer PERF_SAMPLE_PHYS_ADDR in <linux/perf_event.h> */ __u64 data_page_size; /* Refer PERF_SAMPLE_DATA_PAGE_SIZE in <linux/perf_event.h> */ __u64 code_page_size; /* Refer PERF_SAMPLE_CODE_PAGE_SIZE in <linux/perf_event.h> */ __u64 cgroup; /* Refer PERF_SAMPLE_CGROUP in <linux/perf_event.h> */ __u8 cpumode; /* Refer CPUMODE_MASK etc in <linux/perf_event.h> */ __u8 addr_correlates_sym; /* True => resolve_addr() can be called */ __u16 misc; /* Refer perf_event_header in <linux/perf_event.h> */ __u32 raw_size; /* Refer PERF_SAMPLE_RAW in <linux/perf_event.h> */ const void *raw_data; /* Refer PERF_SAMPLE_RAW in <linux/perf_event.h> */ __u64 brstack_nr; /* Number of brstack entries */ const struct perf_branch_entry *brstack; /* Refer <linux/perf_event.h> */ __u64 raw_callchain_nr; /* Number of raw_callchain entries */ const __u64 *raw_callchain; /* Refer <linux/perf_event.h> */ const char *event; }; /* * Address location (as per perf script) */ struct perf_dlfilter_al { __u32 size; /* Size of this structure (for compatibility checking) */ __u32 symoff; const char *sym; __u64 addr; /* Mapped address (from dso) */ __u64 sym_start; __u64 sym_end; const char *dso; __u8 sym_binding; /* STB_LOCAL, STB_GLOBAL or STB_WEAK, refer <elf.h> */ __u8 is_64_bit; /* Only valid if dso is not NULL */ __u8 is_kernel_ip; /* True if in kernel space */ __u32 buildid_size; __u8 *buildid; /* Below members are only populated by resolve_ip() */ __u8 filtered; /* True if this sample event will be filtered out */ const char *comm; }; struct perf_dlfilter_fns { /* Return information about ip */ const struct perf_dlfilter_al *(*resolve_ip)(void *ctx); /* Return information about addr (if addr_correlates_sym) */ const struct perf_dlfilter_al *(*resolve_addr)(void *ctx); /* Return arguments from --dlarg option */ char **(*args)(void *ctx, int *dlargc); /* * Return information about address (al->size must be set before * calling). Returns 0 on success, -1 otherwise. */ __s32 (*resolve_address)(void *ctx, __u64 address, struct perf_dlfilter_al *al); /* Return instruction bytes and length */ const __u8 *(*insn)(void *ctx, __u32 *length); /* Return source file name and line number */ const char *(*srcline)(void *ctx, __u32 *line_number); /* Return perf_event_attr, refer <linux/perf_event.h> */ struct perf_event_attr *(*attr)(void *ctx); /* Read object code, return numbers of bytes read */ __s32 (*object_code)(void *ctx, __u64 ip, void *buf, __u32 len); /* Reserved */ void *(*reserved[120])(void *); }; /* * If implemented, 'start' will be called at the beginning, * before any calls to 'filter_event'. Return 0 to indicate success, * or return a negative error code. '*data' can be assigned for use * by other functions. 'ctx' is needed for calls to perf_dlfilter_fns, * but most perf_dlfilter_fns are not valid when called from 'start'. */ int start(void **data, void *ctx); /* * If implemented, 'stop' will be called at the end, * after any calls to 'filter_event'. Return 0 to indicate success, or * return a negative error code. 'data' is set by start(). 'ctx' is * needed for calls to perf_dlfilter_fns, but most perf_dlfilter_fns * are not valid when called from 'stop'. */ int stop(void *data, void *ctx); /* * If implemented, 'filter_event' will be called for each sample * event. Return 0 to keep the sample event, 1 to filter it out, or * return a negative error code. 'data' is set by start(). 'ctx' is * needed for calls to perf_dlfilter_fns. */ int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx); /* * The same as 'filter_event' except it is called before internal * filtering. */ int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, void *ctx); /* * If implemented, return a one-line description of the filter, and optionally * a longer description. */ const char *filter_description(const char **long_description); #endif rdma/hfi/hfi1_ioctl.h 0000644 00000014732 15063602060 0010434 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2015 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * BSD LICENSE * * Copyright(c) 2015 Intel Corporation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * - Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef _LINUX__HFI1_IOCTL_H #define _LINUX__HFI1_IOCTL_H #include <linux/types.h> /* * This structure is passed to the driver to tell it where * user code buffers are, sizes, etc. The offsets and sizes of the * fields must remain unchanged, for binary compatibility. It can * be extended, if userversion is changed so user code can tell, if needed */ struct hfi1_user_info { /* * version of user software, to detect compatibility issues. * Should be set to HFI1_USER_SWVERSION. */ __u32 userversion; __u32 pad; /* * If two or more processes wish to share a context, each process * must set the subcontext_cnt and subcontext_id to the same * values. The only restriction on the subcontext_id is that * it be unique for a given node. */ __u16 subctxt_cnt; __u16 subctxt_id; /* 128bit UUID passed in by PSM. */ __u8 uuid[16]; }; struct hfi1_ctxt_info { __aligned_u64 runtime_flags; /* chip/drv runtime flags (HFI1_CAP_*) */ __u32 rcvegr_size; /* size of each eager buffer */ __u16 num_active; /* number of active units */ __u16 unit; /* unit (chip) assigned to caller */ __u16 ctxt; /* ctxt on unit assigned to caller */ __u16 subctxt; /* subctxt on unit assigned to caller */ __u16 rcvtids; /* number of Rcv TIDs for this context */ __u16 credits; /* number of PIO credits for this context */ __u16 numa_node; /* NUMA node of the assigned device */ __u16 rec_cpu; /* cpu # for affinity (0xffff if none) */ __u16 send_ctxt; /* send context in use by this user context */ __u16 egrtids; /* number of RcvArray entries for Eager Rcvs */ __u16 rcvhdrq_cnt; /* number of RcvHdrQ entries */ __u16 rcvhdrq_entsize; /* size (in bytes) for each RcvHdrQ entry */ __u16 sdma_ring_size; /* number of entries in SDMA request ring */ }; struct hfi1_tid_info { /* virtual address of first page in transfer */ __aligned_u64 vaddr; /* pointer to tid array. this array is big enough */ __aligned_u64 tidlist; /* number of tids programmed by this request */ __u32 tidcnt; /* length of transfer buffer programmed by this request */ __u32 length; }; /* * This structure is returned by the driver immediately after * open to get implementation-specific info, and info specific to this * instance. * * This struct must have explicit pad fields where type sizes * may result in different alignments between 32 and 64 bit * programs, since the 64 bit * bit kernel requires the user code * to have matching offsets */ struct hfi1_base_info { /* version of hardware, for feature checking. */ __u32 hw_version; /* version of software, for feature checking. */ __u32 sw_version; /* Job key */ __u16 jkey; __u16 padding1; /* * The special QP (queue pair) value that identifies PSM * protocol packet from standard IB packets. */ __u32 bthqp; /* PIO credit return address, */ __aligned_u64 sc_credits_addr; /* * Base address of write-only pio buffers for this process. * Each buffer has sendpio_credits*64 bytes. */ __aligned_u64 pio_bufbase_sop; /* * Base address of write-only pio buffers for this process. * Each buffer has sendpio_credits*64 bytes. */ __aligned_u64 pio_bufbase; /* address where receive buffer queue is mapped into */ __aligned_u64 rcvhdr_bufbase; /* base address of Eager receive buffers. */ __aligned_u64 rcvegr_bufbase; /* base address of SDMA completion ring */ __aligned_u64 sdma_comp_bufbase; /* * User register base for init code, not to be used directly by * protocol or applications. Always maps real chip register space. * the register addresses are: * ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail, * ur_rcvtidflow */ __aligned_u64 user_regbase; /* notification events */ __aligned_u64 events_bufbase; /* status page */ __aligned_u64 status_bufbase; /* rcvhdrtail update */ __aligned_u64 rcvhdrtail_base; /* * shared memory pages for subctxts if ctxt is shared; these cover * all the processes in the group sharing a single context. * all have enough space for the num_subcontexts value on this job. */ __aligned_u64 subctxt_uregbase; __aligned_u64 subctxt_rcvegrbuf; __aligned_u64 subctxt_rcvhdrbuf; }; #endif /* _LINIUX__HFI1_IOCTL_H */ rdma/hfi/hfi1_user.h 0000644 00000022122 15063602060 0010270 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2015 - 2020 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * BSD LICENSE * * Copyright(c) 2015 Intel Corporation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * - Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * This file contains defines, structures, etc. that are used * to communicate between kernel and user code. */ #ifndef _LINUX__HFI1_USER_H #define _LINUX__HFI1_USER_H #include <linux/types.h> #include <rdma/rdma_user_ioctl.h> /* * This version number is given to the driver by the user code during * initialization in the spu_userversion field of hfi1_user_info, so * the driver can check for compatibility with user code. * * The major version changes when data structures change in an incompatible * way. The driver must be the same for initialization to succeed. */ #define HFI1_USER_SWMAJOR 6 /* * Minor version differences are always compatible * a within a major version, however if user software is larger * than driver software, some new features and/or structure fields * may not be implemented; the user code must deal with this if it * cares, or it must abort after initialization reports the difference. */ #define HFI1_USER_SWMINOR 3 /* * We will encode the major/minor inside a single 32bit version number. */ #define HFI1_SWMAJOR_SHIFT 16 /* * Set of HW and driver capability/feature bits. * These bit values are used to configure enabled/disabled HW and * driver features. The same set of bits are communicated to user * space. */ #define HFI1_CAP_DMA_RTAIL (1UL << 0) /* Use DMA'ed RTail value */ #define HFI1_CAP_SDMA (1UL << 1) /* Enable SDMA support */ #define HFI1_CAP_SDMA_AHG (1UL << 2) /* Enable SDMA AHG support */ #define HFI1_CAP_EXTENDED_PSN (1UL << 3) /* Enable Extended PSN support */ #define HFI1_CAP_HDRSUPP (1UL << 4) /* Enable Header Suppression */ #define HFI1_CAP_TID_RDMA (1UL << 5) /* Enable TID RDMA operations */ #define HFI1_CAP_USE_SDMA_HEAD (1UL << 6) /* DMA Hdr Q tail vs. use CSR */ #define HFI1_CAP_MULTI_PKT_EGR (1UL << 7) /* Enable multi-packet Egr buffs*/ #define HFI1_CAP_NODROP_RHQ_FULL (1UL << 8) /* Don't drop on Hdr Q full */ #define HFI1_CAP_NODROP_EGR_FULL (1UL << 9) /* Don't drop on EGR buffs full */ #define HFI1_CAP_TID_UNMAP (1UL << 10) /* Disable Expected TID caching */ #define HFI1_CAP_PRINT_UNIMPL (1UL << 11) /* Show for unimplemented feats */ #define HFI1_CAP_ALLOW_PERM_JKEY (1UL << 12) /* Allow use of permissive JKEY */ #define HFI1_CAP_NO_INTEGRITY (1UL << 13) /* Enable ctxt integrity checks */ #define HFI1_CAP_PKEY_CHECK (1UL << 14) /* Enable ctxt PKey checking */ #define HFI1_CAP_STATIC_RATE_CTRL (1UL << 15) /* Allow PBC.StaticRateControl */ #define HFI1_CAP_OPFN (1UL << 16) /* Enable the OPFN protocol */ #define HFI1_CAP_SDMA_HEAD_CHECK (1UL << 17) /* SDMA head checking */ #define HFI1_CAP_EARLY_CREDIT_RETURN (1UL << 18) /* early credit return */ #define HFI1_CAP_AIP (1UL << 19) /* Enable accelerated IP */ #define HFI1_RCVHDR_ENTSIZE_2 (1UL << 0) #define HFI1_RCVHDR_ENTSIZE_16 (1UL << 1) #define HFI1_RCVDHR_ENTSIZE_32 (1UL << 2) #define _HFI1_EVENT_FROZEN_BIT 0 #define _HFI1_EVENT_LINKDOWN_BIT 1 #define _HFI1_EVENT_LID_CHANGE_BIT 2 #define _HFI1_EVENT_LMC_CHANGE_BIT 3 #define _HFI1_EVENT_SL2VL_CHANGE_BIT 4 #define _HFI1_EVENT_TID_MMU_NOTIFY_BIT 5 #define _HFI1_MAX_EVENT_BIT _HFI1_EVENT_TID_MMU_NOTIFY_BIT #define HFI1_EVENT_FROZEN (1UL << _HFI1_EVENT_FROZEN_BIT) #define HFI1_EVENT_LINKDOWN (1UL << _HFI1_EVENT_LINKDOWN_BIT) #define HFI1_EVENT_LID_CHANGE (1UL << _HFI1_EVENT_LID_CHANGE_BIT) #define HFI1_EVENT_LMC_CHANGE (1UL << _HFI1_EVENT_LMC_CHANGE_BIT) #define HFI1_EVENT_SL2VL_CHANGE (1UL << _HFI1_EVENT_SL2VL_CHANGE_BIT) #define HFI1_EVENT_TID_MMU_NOTIFY (1UL << _HFI1_EVENT_TID_MMU_NOTIFY_BIT) /* * These are the status bits readable (in ASCII form, 64bit value) * from the "status" sysfs file. For binary compatibility, values * must remain as is; removed states can be reused for different * purposes. */ #define HFI1_STATUS_INITTED 0x1 /* basic initialization done */ /* Chip has been found and initialized */ #define HFI1_STATUS_CHIP_PRESENT 0x20 /* IB link is at ACTIVE, usable for data traffic */ #define HFI1_STATUS_IB_READY 0x40 /* link is configured, LID, MTU, etc. have been set */ #define HFI1_STATUS_IB_CONF 0x80 /* A Fatal hardware error has occurred. */ #define HFI1_STATUS_HWERROR 0x200 /* * Number of supported shared contexts. * This is the maximum number of software contexts that can share * a hardware send/receive context. */ #define HFI1_MAX_SHARED_CTXTS 8 /* * Poll types */ #define HFI1_POLL_TYPE_ANYRCV 0x0 #define HFI1_POLL_TYPE_URGENT 0x1 enum hfi1_sdma_comp_state { FREE = 0, QUEUED, COMPLETE, ERROR }; /* * SDMA completion ring entry */ struct hfi1_sdma_comp_entry { __u32 status; __u32 errcode; }; /* * Device status and notifications from driver to user-space. */ struct hfi1_status { __aligned_u64 dev; /* device/hw status bits */ __aligned_u64 port; /* port state and status bits */ char freezemsg[]; }; enum sdma_req_opcode { EXPECTED = 0, EAGER }; #define HFI1_SDMA_REQ_VERSION_MASK 0xF #define HFI1_SDMA_REQ_VERSION_SHIFT 0x0 #define HFI1_SDMA_REQ_OPCODE_MASK 0xF #define HFI1_SDMA_REQ_OPCODE_SHIFT 0x4 #define HFI1_SDMA_REQ_IOVCNT_MASK 0xFF #define HFI1_SDMA_REQ_IOVCNT_SHIFT 0x8 struct sdma_req_info { /* * bits 0-3 - version (currently unused) * bits 4-7 - opcode (enum sdma_req_opcode) * bits 8-15 - io vector count */ __u16 ctrl; /* * Number of fragments contained in this request. * User-space has already computed how many * fragment-sized packet the user buffer will be * split into. */ __u16 npkts; /* * Size of each fragment the user buffer will be * split into. */ __u16 fragsize; /* * Index of the slot in the SDMA completion ring * this request should be using. User-space is * in charge of managing its own ring. */ __u16 comp_idx; } __attribute__((__packed__)); /* * SW KDETH header. * swdata is SW defined portion. */ struct hfi1_kdeth_header { __le32 ver_tid_offset; __le16 jkey; __le16 hcrc; __le32 swdata[7]; } __attribute__((__packed__)); /* * Structure describing the headers that User space uses. The * structure above is a subset of this one. */ struct hfi1_pkt_header { __le16 pbc[4]; __be16 lrh[4]; __be32 bth[3]; struct hfi1_kdeth_header kdeth; } __attribute__((__packed__)); /* * The list of usermode accessible registers. */ enum hfi1_ureg { /* (RO) DMA RcvHdr to be used next. */ ur_rcvhdrtail = 0, /* (RW) RcvHdr entry to be processed next by host. */ ur_rcvhdrhead = 1, /* (RO) Index of next Eager index to use. */ ur_rcvegrindextail = 2, /* (RW) Eager TID to be processed next */ ur_rcvegrindexhead = 3, /* (RO) Receive Eager Offset Tail */ ur_rcvegroffsettail = 4, /* For internal use only; max register number. */ ur_maxreg, /* (RW) Receive TID flow table */ ur_rcvtidflowtable = 256 }; #endif /* _LINIUX__HFI1_USER_H */ rdma/bnxt_re-abi.h 0000644 00000006672 15063602060 0010043 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* * Broadcom NetXtreme-E RoCE driver. * * Copyright (c) 2016 - 2017, Broadcom. All rights reserved. The term * Broadcom refers to Broadcom Limited and/or its subsidiaries. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * BSD license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Description: Uverbs ABI header file */ #ifndef __BNXT_RE_UVERBS_ABI_H__ #define __BNXT_RE_UVERBS_ABI_H__ #include <linux/types.h> #define BNXT_RE_ABI_VERSION 1 #define BNXT_RE_CHIP_ID0_CHIP_NUM_SFT 0x00 #define BNXT_RE_CHIP_ID0_CHIP_REV_SFT 0x10 #define BNXT_RE_CHIP_ID0_CHIP_MET_SFT 0x18 enum { BNXT_RE_UCNTX_CMASK_HAVE_CCTX = 0x1ULL, BNXT_RE_UCNTX_CMASK_HAVE_MODE = 0x02ULL, }; enum bnxt_re_wqe_mode { BNXT_QPLIB_WQE_MODE_STATIC = 0x00, BNXT_QPLIB_WQE_MODE_VARIABLE = 0x01, BNXT_QPLIB_WQE_MODE_INVALID = 0x02, }; struct bnxt_re_uctx_resp { __u32 dev_id; __u32 max_qp; __u32 pg_size; __u32 cqe_sz; __u32 max_cqd; __u32 rsvd; __aligned_u64 comp_mask; __u32 chip_id0; __u32 chip_id1; __u32 mode; __u32 rsvd1; /* padding */ }; /* * This struct is placed after the ib_uverbs_alloc_pd_resp struct, which is * not 8 byted aligned. To avoid undesired padding in various cases we have to * set this struct to packed. */ struct bnxt_re_pd_resp { __u32 pdid; __u32 dpi; __u64 dbr; } __attribute__((packed, aligned(4))); struct bnxt_re_cq_req { __aligned_u64 cq_va; __aligned_u64 cq_handle; }; struct bnxt_re_cq_resp { __u32 cqid; __u32 tail; __u32 phase; __u32 rsvd; }; struct bnxt_re_qp_req { __aligned_u64 qpsva; __aligned_u64 qprva; __aligned_u64 qp_handle; }; struct bnxt_re_qp_resp { __u32 qpid; __u32 rsvd; }; struct bnxt_re_srq_req { __aligned_u64 srqva; __aligned_u64 srq_handle; }; struct bnxt_re_srq_resp { __u32 srqid; }; enum bnxt_re_shpg_offt { BNXT_RE_BEG_RESV_OFFT = 0x00, BNXT_RE_AVID_OFFT = 0x10, BNXT_RE_AVID_SIZE = 0x04, BNXT_RE_END_RESV_OFFT = 0xFF0 }; #endif /* __BNXT_RE_UVERBS_ABI_H__*/ rdma/cxgb4-abi.h 0000644 00000006062 15063602060 0007402 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef CXGB4_ABI_USER_H #define CXGB4_ABI_USER_H #include <linux/types.h> #define C4IW_UVERBS_ABI_VERSION 3 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __aligned_u64 * instead. */ enum { C4IW_64B_CQE = (1 << 0) }; struct c4iw_create_cq { __u32 flags; __u32 reserved; }; struct c4iw_create_cq_resp { __aligned_u64 key; __aligned_u64 gts_key; __aligned_u64 memsize; __u32 cqid; __u32 size; __u32 qid_mask; __u32 flags; }; enum { C4IW_QPF_ONCHIP = (1 << 0), C4IW_QPF_WRITE_W_IMM = (1 << 1) }; struct c4iw_create_qp_resp { __aligned_u64 ma_sync_key; __aligned_u64 sq_key; __aligned_u64 rq_key; __aligned_u64 sq_db_gts_key; __aligned_u64 rq_db_gts_key; __aligned_u64 sq_memsize; __aligned_u64 rq_memsize; __u32 sqid; __u32 rqid; __u32 sq_size; __u32 rq_size; __u32 qid_mask; __u32 flags; }; struct c4iw_create_srq_resp { __aligned_u64 srq_key; __aligned_u64 srq_db_gts_key; __aligned_u64 srq_memsize; __u32 srqid; __u32 srq_size; __u32 rqt_abs_idx; __u32 qid_mask; __u32 flags; __u32 reserved; /* explicit padding */ }; enum { /* HW supports SRQ_LIMIT_REACHED event */ T4_SRQ_LIMIT_SUPPORT = 1 << 0, }; struct c4iw_alloc_ucontext_resp { __aligned_u64 status_page_key; __u32 status_page_size; __u32 reserved; /* explicit padding (optional for i386) */ }; struct c4iw_alloc_pd_resp { __u32 pdid; }; #endif /* CXGB4_ABI_USER_H */ rdma/efa-abi.h 0000644 00000005621 15063602060 0007126 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved. */ #ifndef EFA_ABI_USER_H #define EFA_ABI_USER_H #include <linux/types.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define EFA_UVERBS_ABI_VERSION 1 /* * Keep structs aligned to 8 bytes. * Keep reserved fields as arrays of __u8 named reserved_XXX where XXX is the * hex bit offset of the field. */ enum { EFA_ALLOC_UCONTEXT_CMD_COMP_TX_BATCH = 1 << 0, EFA_ALLOC_UCONTEXT_CMD_COMP_MIN_SQ_WR = 1 << 1, }; struct efa_ibv_alloc_ucontext_cmd { __u32 comp_mask; __u8 reserved_20[4]; }; enum efa_ibv_user_cmds_supp_udata { EFA_USER_CMDS_SUPP_UDATA_QUERY_DEVICE = 1 << 0, EFA_USER_CMDS_SUPP_UDATA_CREATE_AH = 1 << 1, }; struct efa_ibv_alloc_ucontext_resp { __u32 comp_mask; __u32 cmds_supp_udata_mask; __u16 sub_cqs_per_cq; __u16 inline_buf_size; __u32 max_llq_size; /* bytes */ __u16 max_tx_batch; /* units of 64 bytes */ __u16 min_sq_wr; __u8 reserved_a0[4]; }; struct efa_ibv_alloc_pd_resp { __u32 comp_mask; __u16 pdn; __u8 reserved_30[2]; }; enum { EFA_CREATE_CQ_WITH_COMPLETION_CHANNEL = 1 << 0, EFA_CREATE_CQ_WITH_SGID = 1 << 1, }; struct efa_ibv_create_cq { __u32 comp_mask; __u32 cq_entry_size; __u16 num_sub_cqs; __u8 flags; __u8 reserved_58[5]; }; enum { EFA_CREATE_CQ_RESP_DB_OFF = 1 << 0, }; struct efa_ibv_create_cq_resp { __u32 comp_mask; __u8 reserved_20[4]; __aligned_u64 q_mmap_key; __aligned_u64 q_mmap_size; __u16 cq_idx; __u8 reserved_d0[2]; __u32 db_off; __aligned_u64 db_mmap_key; }; enum { EFA_QP_DRIVER_TYPE_SRD = 0, }; struct efa_ibv_create_qp { __u32 comp_mask; __u32 rq_ring_size; /* bytes */ __u32 sq_ring_size; /* bytes */ __u32 driver_qp_type; }; struct efa_ibv_create_qp_resp { __u32 comp_mask; /* the offset inside the page of the rq db */ __u32 rq_db_offset; /* the offset inside the page of the sq db */ __u32 sq_db_offset; /* the offset inside the page of descriptors buffer */ __u32 llq_desc_offset; __aligned_u64 rq_mmap_key; __aligned_u64 rq_mmap_size; __aligned_u64 rq_db_mmap_key; __aligned_u64 sq_db_mmap_key; __aligned_u64 llq_desc_mmap_key; __u16 send_sub_cq_idx; __u16 recv_sub_cq_idx; __u8 reserved_1e0[4]; }; struct efa_ibv_create_ah_resp { __u32 comp_mask; __u16 efa_address_handle; __u8 reserved_30[2]; }; enum { EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0, EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1, EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS = 1 << 2, EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID = 1 << 3, EFA_QUERY_DEVICE_CAPS_DATA_POLLING_128 = 1 << 4, EFA_QUERY_DEVICE_CAPS_RDMA_WRITE = 1 << 5, }; struct efa_ibv_ex_query_device_resp { __u32 comp_mask; __u32 max_sq_wr; __u32 max_rq_wr; __u16 max_sq_sge; __u16 max_rq_sge; __u32 max_rdma_size; __u32 device_caps; }; #endif /* EFA_ABI_USER_H */ rdma/hns-abi.h 0000644 00000004237 15063602060 0007165 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016 Hisilicon Limited. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef HNS_ABI_USER_H #define HNS_ABI_USER_H #include <linux/types.h> struct hns_roce_ib_create_cq { __aligned_u64 buf_addr; __aligned_u64 db_addr; }; struct hns_roce_ib_create_cq_resp { __aligned_u64 cqn; /* Only 32 bits used, 64 for compat */ __aligned_u64 cap_flags; }; struct hns_roce_ib_create_qp { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u8 log_sq_bb_count; __u8 log_sq_stride; __u8 sq_no_prefetch; __u8 reserved[5]; __aligned_u64 sdb_addr; }; struct hns_roce_ib_create_qp_resp { __aligned_u64 cap_flags; }; struct hns_roce_ib_alloc_ucontext_resp { __u32 qp_tab_size; __u32 reserved; }; struct hns_roce_ib_alloc_pd_resp { __u32 pdn; }; #endif /* HNS_ABI_USER_H */ rdma/ib_user_ioctl_cmds.h 0000644 00000022326 15063602060 0011473 0 ustar 00 /* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_IOCTL_CMDS_H #define IB_USER_IOCTL_CMDS_H #define UVERBS_ID_NS_MASK 0xF000 #define UVERBS_ID_NS_SHIFT 12 #define UVERBS_UDATA_DRIVER_DATA_NS 1 #define UVERBS_UDATA_DRIVER_DATA_FLAG (1UL << UVERBS_ID_NS_SHIFT) enum uverbs_default_objects { UVERBS_OBJECT_DEVICE, /* No instances of DEVICE are allowed */ UVERBS_OBJECT_PD, UVERBS_OBJECT_COMP_CHANNEL, UVERBS_OBJECT_CQ, UVERBS_OBJECT_QP, UVERBS_OBJECT_SRQ, UVERBS_OBJECT_AH, UVERBS_OBJECT_MR, UVERBS_OBJECT_MW, UVERBS_OBJECT_FLOW, UVERBS_OBJECT_XRCD, UVERBS_OBJECT_RWQ_IND_TBL, UVERBS_OBJECT_WQ, UVERBS_OBJECT_FLOW_ACTION, UVERBS_OBJECT_DM, UVERBS_OBJECT_COUNTERS, UVERBS_OBJECT_ASYNC_EVENT, }; enum { UVERBS_ATTR_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG, UVERBS_ATTR_UHW_OUT, }; enum uverbs_methods_device { UVERBS_METHOD_INVOKE_WRITE, UVERBS_METHOD_INFO_HANDLES, UVERBS_METHOD_QUERY_PORT, UVERBS_METHOD_GET_CONTEXT, UVERBS_METHOD_QUERY_CONTEXT, UVERBS_METHOD_QUERY_GID_TABLE, UVERBS_METHOD_QUERY_GID_ENTRY, }; enum uverbs_attrs_invoke_write_cmd_attr_ids { UVERBS_ATTR_CORE_IN, UVERBS_ATTR_CORE_OUT, UVERBS_ATTR_WRITE_CMD, }; enum uverbs_attrs_query_port_cmd_attr_ids { UVERBS_ATTR_QUERY_PORT_PORT_NUM, UVERBS_ATTR_QUERY_PORT_RESP, }; enum uverbs_attrs_get_context_attr_ids { UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS, UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT, }; enum uverbs_attrs_query_context_attr_ids { UVERBS_ATTR_QUERY_CONTEXT_NUM_COMP_VECTORS, UVERBS_ATTR_QUERY_CONTEXT_CORE_SUPPORT, }; enum uverbs_attrs_create_cq_cmd_attr_ids { UVERBS_ATTR_CREATE_CQ_HANDLE, UVERBS_ATTR_CREATE_CQ_CQE, UVERBS_ATTR_CREATE_CQ_USER_HANDLE, UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL, UVERBS_ATTR_CREATE_CQ_COMP_VECTOR, UVERBS_ATTR_CREATE_CQ_FLAGS, UVERBS_ATTR_CREATE_CQ_RESP_CQE, UVERBS_ATTR_CREATE_CQ_EVENT_FD, }; enum uverbs_attrs_destroy_cq_cmd_attr_ids { UVERBS_ATTR_DESTROY_CQ_HANDLE, UVERBS_ATTR_DESTROY_CQ_RESP, }; enum uverbs_attrs_create_flow_action_esp { UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE, UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS, UVERBS_ATTR_FLOW_ACTION_ESP_ESN, UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT, UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY, UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP, }; enum uverbs_attrs_modify_flow_action_esp { UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_HANDLE = UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE, }; enum uverbs_attrs_destroy_flow_action_esp { UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE, }; enum uverbs_attrs_create_qp_cmd_attr_ids { UVERBS_ATTR_CREATE_QP_HANDLE, UVERBS_ATTR_CREATE_QP_XRCD_HANDLE, UVERBS_ATTR_CREATE_QP_PD_HANDLE, UVERBS_ATTR_CREATE_QP_SRQ_HANDLE, UVERBS_ATTR_CREATE_QP_SEND_CQ_HANDLE, UVERBS_ATTR_CREATE_QP_RECV_CQ_HANDLE, UVERBS_ATTR_CREATE_QP_IND_TABLE_HANDLE, UVERBS_ATTR_CREATE_QP_USER_HANDLE, UVERBS_ATTR_CREATE_QP_CAP, UVERBS_ATTR_CREATE_QP_TYPE, UVERBS_ATTR_CREATE_QP_FLAGS, UVERBS_ATTR_CREATE_QP_SOURCE_QPN, UVERBS_ATTR_CREATE_QP_EVENT_FD, UVERBS_ATTR_CREATE_QP_RESP_CAP, UVERBS_ATTR_CREATE_QP_RESP_QP_NUM, }; enum uverbs_attrs_destroy_qp_cmd_attr_ids { UVERBS_ATTR_DESTROY_QP_HANDLE, UVERBS_ATTR_DESTROY_QP_RESP, }; enum uverbs_methods_qp { UVERBS_METHOD_QP_CREATE, UVERBS_METHOD_QP_DESTROY, }; enum uverbs_attrs_create_srq_cmd_attr_ids { UVERBS_ATTR_CREATE_SRQ_HANDLE, UVERBS_ATTR_CREATE_SRQ_PD_HANDLE, UVERBS_ATTR_CREATE_SRQ_XRCD_HANDLE, UVERBS_ATTR_CREATE_SRQ_CQ_HANDLE, UVERBS_ATTR_CREATE_SRQ_USER_HANDLE, UVERBS_ATTR_CREATE_SRQ_MAX_WR, UVERBS_ATTR_CREATE_SRQ_MAX_SGE, UVERBS_ATTR_CREATE_SRQ_LIMIT, UVERBS_ATTR_CREATE_SRQ_MAX_NUM_TAGS, UVERBS_ATTR_CREATE_SRQ_TYPE, UVERBS_ATTR_CREATE_SRQ_EVENT_FD, UVERBS_ATTR_CREATE_SRQ_RESP_MAX_WR, UVERBS_ATTR_CREATE_SRQ_RESP_MAX_SGE, UVERBS_ATTR_CREATE_SRQ_RESP_SRQ_NUM, }; enum uverbs_attrs_destroy_srq_cmd_attr_ids { UVERBS_ATTR_DESTROY_SRQ_HANDLE, UVERBS_ATTR_DESTROY_SRQ_RESP, }; enum uverbs_methods_srq { UVERBS_METHOD_SRQ_CREATE, UVERBS_METHOD_SRQ_DESTROY, }; enum uverbs_methods_cq { UVERBS_METHOD_CQ_CREATE, UVERBS_METHOD_CQ_DESTROY, }; enum uverbs_attrs_create_wq_cmd_attr_ids { UVERBS_ATTR_CREATE_WQ_HANDLE, UVERBS_ATTR_CREATE_WQ_PD_HANDLE, UVERBS_ATTR_CREATE_WQ_CQ_HANDLE, UVERBS_ATTR_CREATE_WQ_USER_HANDLE, UVERBS_ATTR_CREATE_WQ_TYPE, UVERBS_ATTR_CREATE_WQ_EVENT_FD, UVERBS_ATTR_CREATE_WQ_MAX_WR, UVERBS_ATTR_CREATE_WQ_MAX_SGE, UVERBS_ATTR_CREATE_WQ_FLAGS, UVERBS_ATTR_CREATE_WQ_RESP_MAX_WR, UVERBS_ATTR_CREATE_WQ_RESP_MAX_SGE, UVERBS_ATTR_CREATE_WQ_RESP_WQ_NUM, }; enum uverbs_attrs_destroy_wq_cmd_attr_ids { UVERBS_ATTR_DESTROY_WQ_HANDLE, UVERBS_ATTR_DESTROY_WQ_RESP, }; enum uverbs_methods_wq { UVERBS_METHOD_WQ_CREATE, UVERBS_METHOD_WQ_DESTROY, }; enum uverbs_methods_actions_flow_action_ops { UVERBS_METHOD_FLOW_ACTION_ESP_CREATE, UVERBS_METHOD_FLOW_ACTION_DESTROY, UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY, }; enum uverbs_attrs_alloc_dm_cmd_attr_ids { UVERBS_ATTR_ALLOC_DM_HANDLE, UVERBS_ATTR_ALLOC_DM_LENGTH, UVERBS_ATTR_ALLOC_DM_ALIGNMENT, }; enum uverbs_attrs_free_dm_cmd_attr_ids { UVERBS_ATTR_FREE_DM_HANDLE, }; enum uverbs_methods_dm { UVERBS_METHOD_DM_ALLOC, UVERBS_METHOD_DM_FREE, }; enum uverbs_attrs_reg_dm_mr_cmd_attr_ids { UVERBS_ATTR_REG_DM_MR_HANDLE, UVERBS_ATTR_REG_DM_MR_OFFSET, UVERBS_ATTR_REG_DM_MR_LENGTH, UVERBS_ATTR_REG_DM_MR_PD_HANDLE, UVERBS_ATTR_REG_DM_MR_ACCESS_FLAGS, UVERBS_ATTR_REG_DM_MR_DM_HANDLE, UVERBS_ATTR_REG_DM_MR_RESP_LKEY, UVERBS_ATTR_REG_DM_MR_RESP_RKEY, }; enum uverbs_methods_mr { UVERBS_METHOD_DM_MR_REG, UVERBS_METHOD_MR_DESTROY, UVERBS_METHOD_ADVISE_MR, UVERBS_METHOD_QUERY_MR, }; enum uverbs_attrs_mr_destroy_ids { UVERBS_ATTR_DESTROY_MR_HANDLE, }; enum uverbs_attrs_advise_mr_cmd_attr_ids { UVERBS_ATTR_ADVISE_MR_PD_HANDLE, UVERBS_ATTR_ADVISE_MR_ADVICE, UVERBS_ATTR_ADVISE_MR_FLAGS, UVERBS_ATTR_ADVISE_MR_SGE_LIST, }; enum uverbs_attrs_query_mr_cmd_attr_ids { UVERBS_ATTR_QUERY_MR_HANDLE, UVERBS_ATTR_QUERY_MR_RESP_LKEY, UVERBS_ATTR_QUERY_MR_RESP_RKEY, UVERBS_ATTR_QUERY_MR_RESP_LENGTH, UVERBS_ATTR_QUERY_MR_RESP_IOVA, }; enum uverbs_attrs_create_counters_cmd_attr_ids { UVERBS_ATTR_CREATE_COUNTERS_HANDLE, }; enum uverbs_attrs_destroy_counters_cmd_attr_ids { UVERBS_ATTR_DESTROY_COUNTERS_HANDLE, }; enum uverbs_attrs_read_counters_cmd_attr_ids { UVERBS_ATTR_READ_COUNTERS_HANDLE, UVERBS_ATTR_READ_COUNTERS_BUFF, UVERBS_ATTR_READ_COUNTERS_FLAGS, }; enum uverbs_methods_actions_counters_ops { UVERBS_METHOD_COUNTERS_CREATE, UVERBS_METHOD_COUNTERS_DESTROY, UVERBS_METHOD_COUNTERS_READ, }; enum uverbs_attrs_info_handles_id { UVERBS_ATTR_INFO_OBJECT_ID, UVERBS_ATTR_INFO_TOTAL_HANDLES, UVERBS_ATTR_INFO_HANDLES_LIST, }; enum uverbs_methods_pd { UVERBS_METHOD_PD_DESTROY, }; enum uverbs_attrs_pd_destroy_ids { UVERBS_ATTR_DESTROY_PD_HANDLE, }; enum uverbs_methods_mw { UVERBS_METHOD_MW_DESTROY, }; enum uverbs_attrs_mw_destroy_ids { UVERBS_ATTR_DESTROY_MW_HANDLE, }; enum uverbs_methods_xrcd { UVERBS_METHOD_XRCD_DESTROY, }; enum uverbs_attrs_xrcd_destroy_ids { UVERBS_ATTR_DESTROY_XRCD_HANDLE, }; enum uverbs_methods_ah { UVERBS_METHOD_AH_DESTROY, }; enum uverbs_attrs_ah_destroy_ids { UVERBS_ATTR_DESTROY_AH_HANDLE, }; enum uverbs_methods_rwq_ind_tbl { UVERBS_METHOD_RWQ_IND_TBL_DESTROY, }; enum uverbs_attrs_rwq_ind_tbl_destroy_ids { UVERBS_ATTR_DESTROY_RWQ_IND_TBL_HANDLE, }; enum uverbs_methods_flow { UVERBS_METHOD_FLOW_DESTROY, }; enum uverbs_attrs_flow_destroy_ids { UVERBS_ATTR_DESTROY_FLOW_HANDLE, }; enum uverbs_method_async_event { UVERBS_METHOD_ASYNC_EVENT_ALLOC, }; enum uverbs_attrs_async_event_create { UVERBS_ATTR_ASYNC_EVENT_ALLOC_FD_HANDLE, }; enum uverbs_attrs_query_gid_table_cmd_attr_ids { UVERBS_ATTR_QUERY_GID_TABLE_ENTRY_SIZE, UVERBS_ATTR_QUERY_GID_TABLE_FLAGS, UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES, UVERBS_ATTR_QUERY_GID_TABLE_RESP_NUM_ENTRIES, }; enum uverbs_attrs_query_gid_entry_cmd_attr_ids { UVERBS_ATTR_QUERY_GID_ENTRY_PORT, UVERBS_ATTR_QUERY_GID_ENTRY_GID_INDEX, UVERBS_ATTR_QUERY_GID_ENTRY_FLAGS, UVERBS_ATTR_QUERY_GID_ENTRY_RESP_ENTRY, }; #endif rdma/ib_user_ioctl_verbs.h 0000644 00000017312 15063602060 0011665 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2017-2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_IOCTL_VERBS_H #define IB_USER_IOCTL_VERBS_H #include <linux/types.h> #include <rdma/ib_user_verbs.h> #ifndef RDMA_UAPI_PTR #define RDMA_UAPI_PTR(_type, _name) __aligned_u64 _name #endif #define IB_UVERBS_ACCESS_OPTIONAL_FIRST (1 << 20) #define IB_UVERBS_ACCESS_OPTIONAL_LAST (1 << 29) enum ib_uverbs_core_support { IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0, }; enum ib_uverbs_access_flags { IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0, IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1, IB_UVERBS_ACCESS_REMOTE_READ = 1 << 2, IB_UVERBS_ACCESS_REMOTE_ATOMIC = 1 << 3, IB_UVERBS_ACCESS_MW_BIND = 1 << 4, IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5, IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6, IB_UVERBS_ACCESS_HUGETLB = 1 << 7, IB_UVERBS_ACCESS_FLUSH_GLOBAL = 1 << 8, IB_UVERBS_ACCESS_FLUSH_PERSISTENT = 1 << 9, IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST, IB_UVERBS_ACCESS_OPTIONAL_RANGE = ((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) & ~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1) }; enum ib_uverbs_srq_type { IB_UVERBS_SRQT_BASIC, IB_UVERBS_SRQT_XRC, IB_UVERBS_SRQT_TM, }; enum ib_uverbs_wq_type { IB_UVERBS_WQT_RQ, }; enum ib_uverbs_wq_flags { IB_UVERBS_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0, IB_UVERBS_WQ_FLAGS_SCATTER_FCS = 1 << 1, IB_UVERBS_WQ_FLAGS_DELAY_DROP = 1 << 2, IB_UVERBS_WQ_FLAGS_PCI_WRITE_END_PADDING = 1 << 3, }; enum ib_uverbs_qp_type { IB_UVERBS_QPT_RC = 2, IB_UVERBS_QPT_UC, IB_UVERBS_QPT_UD, IB_UVERBS_QPT_RAW_PACKET = 8, IB_UVERBS_QPT_XRC_INI, IB_UVERBS_QPT_XRC_TGT, IB_UVERBS_QPT_DRIVER = 0xFF, }; enum ib_uverbs_qp_create_flags { IB_UVERBS_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, IB_UVERBS_QP_CREATE_SCATTER_FCS = 1 << 8, IB_UVERBS_QP_CREATE_CVLAN_STRIPPING = 1 << 9, IB_UVERBS_QP_CREATE_PCI_WRITE_END_PADDING = 1 << 11, IB_UVERBS_QP_CREATE_SQ_SIG_ALL = 1 << 12, }; enum ib_uverbs_query_port_cap_flags { IB_UVERBS_PCF_SM = 1 << 1, IB_UVERBS_PCF_NOTICE_SUP = 1 << 2, IB_UVERBS_PCF_TRAP_SUP = 1 << 3, IB_UVERBS_PCF_OPT_IPD_SUP = 1 << 4, IB_UVERBS_PCF_AUTO_MIGR_SUP = 1 << 5, IB_UVERBS_PCF_SL_MAP_SUP = 1 << 6, IB_UVERBS_PCF_MKEY_NVRAM = 1 << 7, IB_UVERBS_PCF_PKEY_NVRAM = 1 << 8, IB_UVERBS_PCF_LED_INFO_SUP = 1 << 9, IB_UVERBS_PCF_SM_DISABLED = 1 << 10, IB_UVERBS_PCF_SYS_IMAGE_GUID_SUP = 1 << 11, IB_UVERBS_PCF_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12, IB_UVERBS_PCF_EXTENDED_SPEEDS_SUP = 1 << 14, IB_UVERBS_PCF_CM_SUP = 1 << 16, IB_UVERBS_PCF_SNMP_TUNNEL_SUP = 1 << 17, IB_UVERBS_PCF_REINIT_SUP = 1 << 18, IB_UVERBS_PCF_DEVICE_MGMT_SUP = 1 << 19, IB_UVERBS_PCF_VENDOR_CLASS_SUP = 1 << 20, IB_UVERBS_PCF_DR_NOTICE_SUP = 1 << 21, IB_UVERBS_PCF_CAP_MASK_NOTICE_SUP = 1 << 22, IB_UVERBS_PCF_BOOT_MGMT_SUP = 1 << 23, IB_UVERBS_PCF_LINK_LATENCY_SUP = 1 << 24, IB_UVERBS_PCF_CLIENT_REG_SUP = 1 << 25, /* * IsOtherLocalChangesNoticeSupported is aliased by IP_BASED_GIDS and * is inaccessible */ IB_UVERBS_PCF_LINK_SPEED_WIDTH_TABLE_SUP = 1 << 27, IB_UVERBS_PCF_VENDOR_SPECIFIC_MADS_TABLE_SUP = 1 << 28, IB_UVERBS_PCF_MCAST_PKEY_TRAP_SUPPRESSION_SUP = 1 << 29, IB_UVERBS_PCF_MCAST_FDB_TOP_SUP = 1 << 30, IB_UVERBS_PCF_HIERARCHY_INFO_SUP = 1ULL << 31, /* NOTE this is an internal flag, not an IBA flag */ IB_UVERBS_PCF_IP_BASED_GIDS = 1 << 26, }; enum ib_uverbs_query_port_flags { IB_UVERBS_QPF_GRH_REQUIRED = 1 << 0, }; enum ib_uverbs_flow_action_esp_keymat { IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM, }; enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo { IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ, }; struct ib_uverbs_flow_action_esp_keymat_aes_gcm { __aligned_u64 iv; __u32 iv_algo; /* Use enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo */ __u32 salt; __u32 icv_len; __u32 key_len; __u32 aes_key[256 / 32]; }; enum ib_uverbs_flow_action_esp_replay { IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE, IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP, }; struct ib_uverbs_flow_action_esp_replay_bmp { __u32 size; }; enum ib_uverbs_flow_action_esp_flags { IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO = 0UL << 0, /* Default */ IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD = 1UL << 0, IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL = 0UL << 1, /* Default */ IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT = 1UL << 1, IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT = 0UL << 2, /* Default */ IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT = 1UL << 2, IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW = 1UL << 3, }; struct ib_uverbs_flow_action_esp_encap { /* This struct represents a list of pointers to flow_xxxx_filter that * encapsulates the payload in ESP tunnel mode. */ RDMA_UAPI_PTR(void *, val_ptr); /* pointer to a flow_xxxx_filter */ RDMA_UAPI_PTR(struct ib_uverbs_flow_action_esp_encap *, next_ptr); __u16 len; /* Len of the filter struct val_ptr points to */ __u16 type; /* Use flow_spec_type enum */ }; struct ib_uverbs_flow_action_esp { __u32 spi; __u32 seq; __u32 tfc_pad; __u32 flags; __aligned_u64 hard_limit_pkts; }; enum ib_uverbs_read_counters_flags { /* prefer read values from driver cache */ IB_UVERBS_READ_COUNTERS_PREFER_CACHED = 1 << 0, }; enum ib_uverbs_advise_mr_advice { IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH, IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE, }; enum ib_uverbs_advise_mr_flag { IB_UVERBS_ADVISE_MR_FLAG_FLUSH = 1 << 0, }; struct ib_uverbs_query_port_resp_ex { struct ib_uverbs_query_port_resp legacy_resp; __u16 port_cap_flags2; __u8 reserved[6]; }; struct ib_uverbs_qp_cap { __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; }; enum rdma_driver_id { RDMA_DRIVER_UNKNOWN, RDMA_DRIVER_MLX5, RDMA_DRIVER_MLX4, RDMA_DRIVER_CXGB3, RDMA_DRIVER_CXGB4, RDMA_DRIVER_MTHCA, RDMA_DRIVER_BNXT_RE, RDMA_DRIVER_OCRDMA, RDMA_DRIVER_NES, RDMA_DRIVER_I40IW, RDMA_DRIVER_IRDMA = RDMA_DRIVER_I40IW, RDMA_DRIVER_VMW_PVRDMA, RDMA_DRIVER_QEDR, RDMA_DRIVER_HNS, RDMA_DRIVER_USNIC, RDMA_DRIVER_RXE, RDMA_DRIVER_HFI1, RDMA_DRIVER_QIB, RDMA_DRIVER_EFA, RDMA_DRIVER_SIW, __RH_RESERVED_RDMA_DRIVER_ERDMA, RDMA_DRIVER_MANA, }; enum ib_uverbs_gid_type { IB_UVERBS_GID_TYPE_IB, IB_UVERBS_GID_TYPE_ROCE_V1, IB_UVERBS_GID_TYPE_ROCE_V2, }; struct ib_uverbs_gid_entry { __aligned_u64 gid[2]; __u32 gid_index; __u32 port_num; __u32 gid_type; __u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */ }; #endif rdma/ib_user_mad.h 0000644 00000020522 15063602060 0010110 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2004 Topspin Communications. All rights reserved. * Copyright (c) 2005 Voltaire, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_MAD_H #define IB_USER_MAD_H #include <linux/types.h> #include <rdma/rdma_user_ioctl.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define IB_USER_MAD_ABI_VERSION 5 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). */ /** * ib_user_mad_hdr_old - Old version of MAD packet header without pkey_index * @id - ID of agent MAD received with/to be sent with * @status - 0 on successful receive, ETIMEDOUT if no response * received (transaction ID in data[] will be set to TID of original * request) (ignored on send) * @timeout_ms - Milliseconds to wait for response (unset on receive) * @retries - Number of automatic retries to attempt * @qpn - Remote QP number received from/to be sent to * @qkey - Remote Q_Key to be sent with (unset on receive) * @lid - Remote lid received from/to be sent to * @sl - Service level received with/to be sent with * @path_bits - Local path bits received with/to be sent with * @grh_present - If set, GRH was received/should be sent * @gid_index - Local GID index to send with (unset on receive) * @hop_limit - Hop limit in GRH * @traffic_class - Traffic class in GRH * @gid - Remote GID in GRH * @flow_label - Flow label in GRH */ struct ib_user_mad_hdr_old { __u32 id; __u32 status; __u32 timeout_ms; __u32 retries; __u32 length; __be32 qpn; __be32 qkey; __be16 lid; __u8 sl; __u8 path_bits; __u8 grh_present; __u8 gid_index; __u8 hop_limit; __u8 traffic_class; __u8 gid[16]; __be32 flow_label; }; /** * ib_user_mad_hdr - MAD packet header * This layout allows specifying/receiving the P_Key index. To use * this capability, an application must call the * IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before * any other actions with the file handle. * @id - ID of agent MAD received with/to be sent with * @status - 0 on successful receive, ETIMEDOUT if no response * received (transaction ID in data[] will be set to TID of original * request) (ignored on send) * @timeout_ms - Milliseconds to wait for response (unset on receive) * @retries - Number of automatic retries to attempt * @qpn - Remote QP number received from/to be sent to * @qkey - Remote Q_Key to be sent with (unset on receive) * @lid - Remote lid received from/to be sent to * @sl - Service level received with/to be sent with * @path_bits - Local path bits received with/to be sent with * @grh_present - If set, GRH was received/should be sent * @gid_index - Local GID index to send with (unset on receive) * @hop_limit - Hop limit in GRH * @traffic_class - Traffic class in GRH * @gid - Remote GID in GRH * @flow_label - Flow label in GRH * @pkey_index - P_Key index */ struct ib_user_mad_hdr { __u32 id; __u32 status; __u32 timeout_ms; __u32 retries; __u32 length; __be32 qpn; __be32 qkey; __be16 lid; __u8 sl; __u8 path_bits; __u8 grh_present; __u8 gid_index; __u8 hop_limit; __u8 traffic_class; __u8 gid[16]; __be32 flow_label; __u16 pkey_index; __u8 reserved[6]; }; /** * ib_user_mad - MAD packet * @hdr - MAD packet header * @data - Contents of MAD * */ struct ib_user_mad { struct ib_user_mad_hdr hdr; __aligned_u64 data[]; }; /* * Earlier versions of this interface definition declared the * method_mask[] member as an array of __u32 but treated it as a * bitmap made up of longs in the kernel. This ambiguity meant that * 32-bit big-endian applications that can run on both 32-bit and * 64-bit kernels had no consistent ABI to rely on, and 64-bit * big-endian applications that treated method_mask as being made up * of 32-bit words would have their bitmap misinterpreted. * * To clear up this confusion, we change the declaration of * method_mask[] to use unsigned long and handle the conversion from * 32-bit userspace to 64-bit kernel for big-endian systems in the * compat_ioctl method. Unfortunately, to keep the structure layout * the same, we need the method_mask[] array to be aligned only to 4 * bytes even when long is 64 bits, which forces us into this ugly * typedef. */ typedef unsigned long __attribute__((aligned(4))) packed_ulong; #define IB_USER_MAD_LONGS_PER_METHOD_MASK (128 / (8 * sizeof (long))) /** * ib_user_mad_reg_req - MAD registration request * @id - Set by the kernel; used to identify agent in future requests. * @qpn - Queue pair number; must be 0 or 1. * @method_mask - The caller will receive unsolicited MADs for any method * where @method_mask = 1. * @mgmt_class - Indicates which management class of MADs should be receive * by the caller. This field is only required if the user wishes to * receive unsolicited MADs, otherwise it should be 0. * @mgmt_class_version - Indicates which version of MADs for the given * management class to receive. * @oui: Indicates IEEE OUI when mgmt_class is a vendor class * in the range from 0x30 to 0x4f. Otherwise not used. * @rmpp_version: If set, indicates the RMPP version used. * */ struct ib_user_mad_reg_req { __u32 id; packed_ulong method_mask[IB_USER_MAD_LONGS_PER_METHOD_MASK]; __u8 qpn; __u8 mgmt_class; __u8 mgmt_class_version; __u8 oui[3]; __u8 rmpp_version; }; /** * ib_user_mad_reg_req2 - MAD registration request * * @id - Set by the _kernel_; used by userspace to identify the * registered agent in future requests. * @qpn - Queue pair number; must be 0 or 1. * @mgmt_class - Indicates which management class of MADs should be * receive by the caller. This field is only required if * the user wishes to receive unsolicited MADs, otherwise * it should be 0. * @mgmt_class_version - Indicates which version of MADs for the given * management class to receive. * @res - Ignored. * @flags - additional registration flags; Must be in the set of * flags defined in IB_USER_MAD_REG_FLAGS_CAP * @method_mask - The caller wishes to receive unsolicited MADs for the * methods whose bit(s) is(are) set. * @oui - Indicates IEEE OUI to use when mgmt_class is a vendor * class in the range from 0x30 to 0x4f. Otherwise not * used. * @rmpp_version - If set, indicates the RMPP version to use. */ enum { IB_USER_MAD_USER_RMPP = (1 << 0), }; #define IB_USER_MAD_REG_FLAGS_CAP (IB_USER_MAD_USER_RMPP) struct ib_user_mad_reg_req2 { __u32 id; __u32 qpn; __u8 mgmt_class; __u8 mgmt_class_version; __u16 res; __u32 flags; __aligned_u64 method_mask[2]; __u32 oui; __u8 rmpp_version; __u8 reserved[3]; }; #endif /* IB_USER_MAD_H */ rdma/ib_user_sa.h 0000644 00000004401 15063602061 0007751 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_SA_H #define IB_USER_SA_H #include <linux/types.h> enum { IB_PATH_GMP = 1, IB_PATH_PRIMARY = (1<<1), IB_PATH_ALTERNATE = (1<<2), IB_PATH_OUTBOUND = (1<<3), IB_PATH_INBOUND = (1<<4), IB_PATH_INBOUND_REVERSE = (1<<5), IB_PATH_BIDIRECTIONAL = IB_PATH_OUTBOUND | IB_PATH_INBOUND_REVERSE }; struct ib_path_rec_data { __u32 flags; __u32 reserved; __u32 path_rec[16]; }; struct ib_user_path_rec { __u8 dgid[16]; __u8 sgid[16]; __be16 dlid; __be16 slid; __u32 raw_traffic; __be32 flow_label; __u32 reversible; __u32 mtu; __be16 pkey; __u8 hop_limit; __u8 traffic_class; __u8 numb_path; __u8 sl; __u8 mtu_selector; __u8 rate_selector; __u8 rate; __u8 packet_life_time_selector; __u8 packet_life_time; __u8 preference; }; #endif /* IB_USER_SA_H */ rdma/ib_user_verbs.h 0000644 00000070445 15063602061 0010502 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * Copyright (c) 2005 PathScale, Inc. All rights reserved. * Copyright (c) 2006 Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IB_USER_VERBS_H #define IB_USER_VERBS_H #include <linux/types.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define IB_USER_VERBS_ABI_VERSION 6 #define IB_USER_VERBS_CMD_THRESHOLD 50 enum ib_uverbs_write_cmds { IB_USER_VERBS_CMD_GET_CONTEXT, IB_USER_VERBS_CMD_QUERY_DEVICE, IB_USER_VERBS_CMD_QUERY_PORT, IB_USER_VERBS_CMD_ALLOC_PD, IB_USER_VERBS_CMD_DEALLOC_PD, IB_USER_VERBS_CMD_CREATE_AH, IB_USER_VERBS_CMD_MODIFY_AH, IB_USER_VERBS_CMD_QUERY_AH, IB_USER_VERBS_CMD_DESTROY_AH, IB_USER_VERBS_CMD_REG_MR, IB_USER_VERBS_CMD_REG_SMR, IB_USER_VERBS_CMD_REREG_MR, IB_USER_VERBS_CMD_QUERY_MR, IB_USER_VERBS_CMD_DEREG_MR, IB_USER_VERBS_CMD_ALLOC_MW, IB_USER_VERBS_CMD_BIND_MW, IB_USER_VERBS_CMD_DEALLOC_MW, IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, IB_USER_VERBS_CMD_CREATE_CQ, IB_USER_VERBS_CMD_RESIZE_CQ, IB_USER_VERBS_CMD_DESTROY_CQ, IB_USER_VERBS_CMD_POLL_CQ, IB_USER_VERBS_CMD_PEEK_CQ, IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, IB_USER_VERBS_CMD_CREATE_QP, IB_USER_VERBS_CMD_QUERY_QP, IB_USER_VERBS_CMD_MODIFY_QP, IB_USER_VERBS_CMD_DESTROY_QP, IB_USER_VERBS_CMD_POST_SEND, IB_USER_VERBS_CMD_POST_RECV, IB_USER_VERBS_CMD_ATTACH_MCAST, IB_USER_VERBS_CMD_DETACH_MCAST, IB_USER_VERBS_CMD_CREATE_SRQ, IB_USER_VERBS_CMD_MODIFY_SRQ, IB_USER_VERBS_CMD_QUERY_SRQ, IB_USER_VERBS_CMD_DESTROY_SRQ, IB_USER_VERBS_CMD_POST_SRQ_RECV, IB_USER_VERBS_CMD_OPEN_XRCD, IB_USER_VERBS_CMD_CLOSE_XRCD, IB_USER_VERBS_CMD_CREATE_XSRQ, IB_USER_VERBS_CMD_OPEN_QP, }; enum { IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE, IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ, IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP, IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP, IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, IB_USER_VERBS_EX_CMD_DESTROY_FLOW, IB_USER_VERBS_EX_CMD_CREATE_WQ, IB_USER_VERBS_EX_CMD_MODIFY_WQ, IB_USER_VERBS_EX_CMD_DESTROY_WQ, IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL, IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, IB_USER_VERBS_EX_CMD_MODIFY_CQ }; /* see IBA A19.4.1.1 Placement Types */ enum ib_placement_type { IB_FLUSH_GLOBAL = 1U << 0, IB_FLUSH_PERSISTENT = 1U << 1, }; /* see IBA A19.4.1.2 Selectivity Level */ enum ib_selectivity_level { IB_FLUSH_RANGE = 0, IB_FLUSH_MR, }; /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * Specifically: * - Do not use pointer types -- pass pointers in __u64 instead. * - Make sure that any structure larger than 4 bytes is padded to a * multiple of 8 bytes. Otherwise the structure size will be * different between 32-bit and 64-bit architectures. */ struct ib_uverbs_async_event_desc { __aligned_u64 element; __u32 event_type; /* enum ib_event_type */ __u32 reserved; }; struct ib_uverbs_comp_event_desc { __aligned_u64 cq_handle; }; struct ib_uverbs_cq_moderation_caps { __u16 max_cq_moderation_count; __u16 max_cq_moderation_period; __u32 reserved; }; /* * All commands from userspace should start with a __u32 command field * followed by __u16 in_words and out_words fields (which give the * length of the command block and response buffer if any in 32-bit * words). The kernel driver will read these fields first and read * the rest of the command struct based on these value. */ #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u struct ib_uverbs_cmd_hdr { __u32 command; __u16 in_words; __u16 out_words; }; struct ib_uverbs_ex_cmd_hdr { __aligned_u64 response; __u16 provider_in_words; __u16 provider_out_words; __u32 cmd_hdr_reserved; }; struct ib_uverbs_get_context { __aligned_u64 response; __aligned_u64 driver_data[]; }; struct ib_uverbs_get_context_resp { __u32 async_fd; __u32 num_comp_vectors; __aligned_u64 driver_data[]; }; struct ib_uverbs_query_device { __aligned_u64 response; __aligned_u64 driver_data[]; }; struct ib_uverbs_query_device_resp { __aligned_u64 fw_ver; __be64 node_guid; __be64 sys_image_guid; __aligned_u64 max_mr_size; __aligned_u64 page_size_cap; __u32 vendor_id; __u32 vendor_part_id; __u32 hw_ver; __u32 max_qp; __u32 max_qp_wr; __u32 device_cap_flags; __u32 max_sge; __u32 max_sge_rd; __u32 max_cq; __u32 max_cqe; __u32 max_mr; __u32 max_pd; __u32 max_qp_rd_atom; __u32 max_ee_rd_atom; __u32 max_res_rd_atom; __u32 max_qp_init_rd_atom; __u32 max_ee_init_rd_atom; __u32 atomic_cap; __u32 max_ee; __u32 max_rdd; __u32 max_mw; __u32 max_raw_ipv6_qp; __u32 max_raw_ethy_qp; __u32 max_mcast_grp; __u32 max_mcast_qp_attach; __u32 max_total_mcast_qp_attach; __u32 max_ah; __u32 max_fmr; __u32 max_map_per_fmr; __u32 max_srq; __u32 max_srq_wr; __u32 max_srq_sge; __u16 max_pkeys; __u8 local_ca_ack_delay; __u8 phys_port_cnt; __u8 reserved[4]; }; struct ib_uverbs_ex_query_device { __u32 comp_mask; __u32 reserved; }; struct ib_uverbs_odp_caps { __aligned_u64 general_caps; struct { __u32 rc_odp_caps; __u32 uc_odp_caps; __u32 ud_odp_caps; } per_transport_caps; __u32 reserved; }; struct ib_uverbs_rss_caps { /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_UD */ __u32 supported_qpts; __u32 max_rwq_indirection_tables; __u32 max_rwq_indirection_table_size; __u32 reserved; }; struct ib_uverbs_tm_caps { /* Max size of rendezvous request message */ __u32 max_rndv_hdr_size; /* Max number of entries in tag matching list */ __u32 max_num_tags; /* TM flags */ __u32 flags; /* Max number of outstanding list operations */ __u32 max_ops; /* Max number of SGE in tag matching entry */ __u32 max_sge; __u32 reserved; }; struct ib_uverbs_ex_query_device_resp { struct ib_uverbs_query_device_resp base; __u32 comp_mask; __u32 response_length; struct ib_uverbs_odp_caps odp_caps; __aligned_u64 timestamp_mask; __aligned_u64 hca_core_clock; /* in KHZ */ __aligned_u64 device_cap_flags_ex; struct ib_uverbs_rss_caps rss_caps; __u32 max_wq_type_rq; __u32 raw_packet_caps; struct ib_uverbs_tm_caps tm_caps; struct ib_uverbs_cq_moderation_caps cq_moderation_caps; __aligned_u64 max_dm_size; __u32 xrc_odp_caps; __u32 reserved; }; struct ib_uverbs_query_port { __aligned_u64 response; __u8 port_num; __u8 reserved[7]; __aligned_u64 driver_data[]; }; struct ib_uverbs_query_port_resp { __u32 port_cap_flags; /* see ib_uverbs_query_port_cap_flags */ __u32 max_msg_sz; __u32 bad_pkey_cntr; __u32 qkey_viol_cntr; __u32 gid_tbl_len; __u16 pkey_tbl_len; __u16 lid; __u16 sm_lid; __u8 state; __u8 max_mtu; __u8 active_mtu; __u8 lmc; __u8 max_vl_num; __u8 sm_sl; __u8 subnet_timeout; __u8 init_type_reply; __u8 active_width; __u8 active_speed; __u8 phys_state; __u8 link_layer; __u8 flags; /* see ib_uverbs_query_port_flags */ __u8 reserved; }; struct ib_uverbs_alloc_pd { __aligned_u64 response; __aligned_u64 driver_data[]; }; struct ib_uverbs_alloc_pd_resp { __u32 pd_handle; __u32 driver_data[]; }; struct ib_uverbs_dealloc_pd { __u32 pd_handle; }; struct ib_uverbs_open_xrcd { __aligned_u64 response; __u32 fd; __u32 oflags; __aligned_u64 driver_data[]; }; struct ib_uverbs_open_xrcd_resp { __u32 xrcd_handle; __u32 driver_data[]; }; struct ib_uverbs_close_xrcd { __u32 xrcd_handle; }; struct ib_uverbs_reg_mr { __aligned_u64 response; __aligned_u64 start; __aligned_u64 length; __aligned_u64 hca_va; __u32 pd_handle; __u32 access_flags; __aligned_u64 driver_data[]; }; struct ib_uverbs_reg_mr_resp { __u32 mr_handle; __u32 lkey; __u32 rkey; __u32 driver_data[]; }; struct ib_uverbs_rereg_mr { __aligned_u64 response; __u32 mr_handle; __u32 flags; __aligned_u64 start; __aligned_u64 length; __aligned_u64 hca_va; __u32 pd_handle; __u32 access_flags; __aligned_u64 driver_data[]; }; struct ib_uverbs_rereg_mr_resp { __u32 lkey; __u32 rkey; __aligned_u64 driver_data[]; }; struct ib_uverbs_dereg_mr { __u32 mr_handle; }; struct ib_uverbs_alloc_mw { __aligned_u64 response; __u32 pd_handle; __u8 mw_type; __u8 reserved[3]; __aligned_u64 driver_data[]; }; struct ib_uverbs_alloc_mw_resp { __u32 mw_handle; __u32 rkey; __aligned_u64 driver_data[]; }; struct ib_uverbs_dealloc_mw { __u32 mw_handle; }; struct ib_uverbs_create_comp_channel { __aligned_u64 response; }; struct ib_uverbs_create_comp_channel_resp { __u32 fd; }; struct ib_uverbs_create_cq { __aligned_u64 response; __aligned_u64 user_handle; __u32 cqe; __u32 comp_vector; __s32 comp_channel; __u32 reserved; __aligned_u64 driver_data[]; }; enum ib_uverbs_ex_create_cq_flags { IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0, IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1, }; struct ib_uverbs_ex_create_cq { __aligned_u64 user_handle; __u32 cqe; __u32 comp_vector; __s32 comp_channel; __u32 comp_mask; __u32 flags; /* bitmask of ib_uverbs_ex_create_cq_flags */ __u32 reserved; }; struct ib_uverbs_create_cq_resp { __u32 cq_handle; __u32 cqe; __aligned_u64 driver_data[0]; }; struct ib_uverbs_ex_create_cq_resp { struct ib_uverbs_create_cq_resp base; __u32 comp_mask; __u32 response_length; }; struct ib_uverbs_resize_cq { __aligned_u64 response; __u32 cq_handle; __u32 cqe; __aligned_u64 driver_data[]; }; struct ib_uverbs_resize_cq_resp { __u32 cqe; __u32 reserved; __aligned_u64 driver_data[]; }; struct ib_uverbs_poll_cq { __aligned_u64 response; __u32 cq_handle; __u32 ne; }; enum ib_uverbs_wc_opcode { IB_UVERBS_WC_SEND = 0, IB_UVERBS_WC_RDMA_WRITE = 1, IB_UVERBS_WC_RDMA_READ = 2, IB_UVERBS_WC_COMP_SWAP = 3, IB_UVERBS_WC_FETCH_ADD = 4, IB_UVERBS_WC_BIND_MW = 5, IB_UVERBS_WC_LOCAL_INV = 6, IB_UVERBS_WC_TSO = 7, IB_UVERBS_WC_FLUSH = 8, IB_UVERBS_WC_ATOMIC_WRITE = 9, }; struct ib_uverbs_wc { __aligned_u64 wr_id; __u32 status; __u32 opcode; __u32 vendor_err; __u32 byte_len; union { __be32 imm_data; __u32 invalidate_rkey; } ex; __u32 qp_num; __u32 src_qp; __u32 wc_flags; __u16 pkey_index; __u16 slid; __u8 sl; __u8 dlid_path_bits; __u8 port_num; __u8 reserved; }; struct ib_uverbs_poll_cq_resp { __u32 count; __u32 reserved; struct ib_uverbs_wc wc[]; }; struct ib_uverbs_req_notify_cq { __u32 cq_handle; __u32 solicited_only; }; struct ib_uverbs_destroy_cq { __aligned_u64 response; __u32 cq_handle; __u32 reserved; }; struct ib_uverbs_destroy_cq_resp { __u32 comp_events_reported; __u32 async_events_reported; }; struct ib_uverbs_global_route { __u8 dgid[16]; __u32 flow_label; __u8 sgid_index; __u8 hop_limit; __u8 traffic_class; __u8 reserved; }; struct ib_uverbs_ah_attr { struct ib_uverbs_global_route grh; __u16 dlid; __u8 sl; __u8 src_path_bits; __u8 static_rate; __u8 is_global; __u8 port_num; __u8 reserved; }; struct ib_uverbs_qp_attr { __u32 qp_attr_mask; __u32 qp_state; __u32 cur_qp_state; __u32 path_mtu; __u32 path_mig_state; __u32 qkey; __u32 rq_psn; __u32 sq_psn; __u32 dest_qp_num; __u32 qp_access_flags; struct ib_uverbs_ah_attr ah_attr; struct ib_uverbs_ah_attr alt_ah_attr; /* ib_qp_cap */ __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u16 pkey_index; __u16 alt_pkey_index; __u8 en_sqd_async_notify; __u8 sq_draining; __u8 max_rd_atomic; __u8 max_dest_rd_atomic; __u8 min_rnr_timer; __u8 port_num; __u8 timeout; __u8 retry_cnt; __u8 rnr_retry; __u8 alt_port_num; __u8 alt_timeout; __u8 reserved[5]; }; struct ib_uverbs_create_qp { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 send_cq_handle; __u32 recv_cq_handle; __u32 srq_handle; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u8 sq_sig_all; __u8 qp_type; __u8 is_srq; __u8 reserved; __aligned_u64 driver_data[]; }; enum ib_uverbs_create_qp_mask { IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0, }; enum { IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE, }; struct ib_uverbs_ex_create_qp { __aligned_u64 user_handle; __u32 pd_handle; __u32 send_cq_handle; __u32 recv_cq_handle; __u32 srq_handle; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u8 sq_sig_all; __u8 qp_type; __u8 is_srq; __u8 reserved; __u32 comp_mask; __u32 create_flags; __u32 rwq_ind_tbl_handle; __u32 source_qpn; }; struct ib_uverbs_open_qp { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 qpn; __u8 qp_type; __u8 reserved[7]; __aligned_u64 driver_data[]; }; /* also used for open response */ struct ib_uverbs_create_qp_resp { __u32 qp_handle; __u32 qpn; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u32 reserved; __u32 driver_data[0]; }; struct ib_uverbs_ex_create_qp_resp { struct ib_uverbs_create_qp_resp base; __u32 comp_mask; __u32 response_length; }; /* * This struct needs to remain a multiple of 8 bytes to keep the * alignment of the modify QP parameters. */ struct ib_uverbs_qp_dest { __u8 dgid[16]; __u32 flow_label; __u16 dlid; __u16 reserved; __u8 sgid_index; __u8 hop_limit; __u8 traffic_class; __u8 sl; __u8 src_path_bits; __u8 static_rate; __u8 is_global; __u8 port_num; }; struct ib_uverbs_query_qp { __aligned_u64 response; __u32 qp_handle; __u32 attr_mask; __aligned_u64 driver_data[]; }; struct ib_uverbs_query_qp_resp { struct ib_uverbs_qp_dest dest; struct ib_uverbs_qp_dest alt_dest; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; __u32 qkey; __u32 rq_psn; __u32 sq_psn; __u32 dest_qp_num; __u32 qp_access_flags; __u16 pkey_index; __u16 alt_pkey_index; __u8 qp_state; __u8 cur_qp_state; __u8 path_mtu; __u8 path_mig_state; __u8 sq_draining; __u8 max_rd_atomic; __u8 max_dest_rd_atomic; __u8 min_rnr_timer; __u8 port_num; __u8 timeout; __u8 retry_cnt; __u8 rnr_retry; __u8 alt_port_num; __u8 alt_timeout; __u8 sq_sig_all; __u8 reserved[5]; __aligned_u64 driver_data[]; }; struct ib_uverbs_modify_qp { struct ib_uverbs_qp_dest dest; struct ib_uverbs_qp_dest alt_dest; __u32 qp_handle; __u32 attr_mask; __u32 qkey; __u32 rq_psn; __u32 sq_psn; __u32 dest_qp_num; __u32 qp_access_flags; __u16 pkey_index; __u16 alt_pkey_index; __u8 qp_state; __u8 cur_qp_state; __u8 path_mtu; __u8 path_mig_state; __u8 en_sqd_async_notify; __u8 max_rd_atomic; __u8 max_dest_rd_atomic; __u8 min_rnr_timer; __u8 port_num; __u8 timeout; __u8 retry_cnt; __u8 rnr_retry; __u8 alt_port_num; __u8 alt_timeout; __u8 reserved[2]; __aligned_u64 driver_data[0]; }; struct ib_uverbs_ex_modify_qp { struct ib_uverbs_modify_qp base; __u32 rate_limit; __u32 reserved; }; struct ib_uverbs_ex_modify_qp_resp { __u32 comp_mask; __u32 response_length; }; struct ib_uverbs_destroy_qp { __aligned_u64 response; __u32 qp_handle; __u32 reserved; }; struct ib_uverbs_destroy_qp_resp { __u32 events_reported; }; /* * The ib_uverbs_sge structure isn't used anywhere, since we assume * the ib_sge structure is packed the same way on 32-bit and 64-bit * architectures in both kernel and user space. It's just here to * document the ABI. */ struct ib_uverbs_sge { __aligned_u64 addr; __u32 length; __u32 lkey; }; enum ib_uverbs_wr_opcode { IB_UVERBS_WR_RDMA_WRITE = 0, IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1, IB_UVERBS_WR_SEND = 2, IB_UVERBS_WR_SEND_WITH_IMM = 3, IB_UVERBS_WR_RDMA_READ = 4, IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5, IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6, IB_UVERBS_WR_LOCAL_INV = 7, IB_UVERBS_WR_BIND_MW = 8, IB_UVERBS_WR_SEND_WITH_INV = 9, IB_UVERBS_WR_TSO = 10, IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, IB_UVERBS_WR_FLUSH = 14, IB_UVERBS_WR_ATOMIC_WRITE = 15, /* Review enum ib_wr_opcode before modifying this */ }; struct ib_uverbs_send_wr { __aligned_u64 wr_id; __u32 num_sge; __u32 opcode; /* see enum ib_uverbs_wr_opcode */ __u32 send_flags; union { __be32 imm_data; __u32 invalidate_rkey; } ex; union { struct { __aligned_u64 remote_addr; __u32 rkey; __u32 reserved; } rdma; struct { __aligned_u64 remote_addr; __aligned_u64 compare_add; __aligned_u64 swap; __u32 rkey; __u32 reserved; } atomic; struct { __u32 ah; __u32 remote_qpn; __u32 remote_qkey; __u32 reserved; } ud; } wr; }; struct ib_uverbs_post_send { __aligned_u64 response; __u32 qp_handle; __u32 wr_count; __u32 sge_count; __u32 wqe_size; struct ib_uverbs_send_wr send_wr[]; }; struct ib_uverbs_post_send_resp { __u32 bad_wr; }; struct ib_uverbs_recv_wr { __aligned_u64 wr_id; __u32 num_sge; __u32 reserved; }; struct ib_uverbs_post_recv { __aligned_u64 response; __u32 qp_handle; __u32 wr_count; __u32 sge_count; __u32 wqe_size; struct ib_uverbs_recv_wr recv_wr[]; }; struct ib_uverbs_post_recv_resp { __u32 bad_wr; }; struct ib_uverbs_post_srq_recv { __aligned_u64 response; __u32 srq_handle; __u32 wr_count; __u32 sge_count; __u32 wqe_size; struct ib_uverbs_recv_wr recv[]; }; struct ib_uverbs_post_srq_recv_resp { __u32 bad_wr; }; struct ib_uverbs_create_ah { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 reserved; struct ib_uverbs_ah_attr attr; __aligned_u64 driver_data[]; }; struct ib_uverbs_create_ah_resp { __u32 ah_handle; __u32 driver_data[]; }; struct ib_uverbs_destroy_ah { __u32 ah_handle; }; struct ib_uverbs_attach_mcast { __u8 gid[16]; __u32 qp_handle; __u16 mlid; __u16 reserved; __aligned_u64 driver_data[]; }; struct ib_uverbs_detach_mcast { __u8 gid[16]; __u32 qp_handle; __u16 mlid; __u16 reserved; __aligned_u64 driver_data[]; }; struct ib_uverbs_flow_spec_hdr { __u32 type; __u16 size; __u16 reserved; /* followed by flow_spec */ __aligned_u64 flow_spec_data[0]; }; struct ib_uverbs_flow_eth_filter { __u8 dst_mac[6]; __u8 src_mac[6]; __be16 ether_type; __be16 vlan_tag; }; struct ib_uverbs_flow_spec_eth { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_eth_filter val; struct ib_uverbs_flow_eth_filter mask; }; struct ib_uverbs_flow_ipv4_filter { __be32 src_ip; __be32 dst_ip; __u8 proto; __u8 tos; __u8 ttl; __u8 flags; }; struct ib_uverbs_flow_spec_ipv4 { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_ipv4_filter val; struct ib_uverbs_flow_ipv4_filter mask; }; struct ib_uverbs_flow_tcp_udp_filter { __be16 dst_port; __be16 src_port; }; struct ib_uverbs_flow_spec_tcp_udp { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_tcp_udp_filter val; struct ib_uverbs_flow_tcp_udp_filter mask; }; struct ib_uverbs_flow_ipv6_filter { __u8 src_ip[16]; __u8 dst_ip[16]; __be32 flow_label; __u8 next_hdr; __u8 traffic_class; __u8 hop_limit; __u8 reserved; }; struct ib_uverbs_flow_spec_ipv6 { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_ipv6_filter val; struct ib_uverbs_flow_ipv6_filter mask; }; struct ib_uverbs_flow_spec_action_tag { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; __u32 tag_id; __u32 reserved1; }; struct ib_uverbs_flow_spec_action_drop { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; }; struct ib_uverbs_flow_spec_action_handle { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; __u32 handle; __u32 reserved1; }; struct ib_uverbs_flow_spec_action_count { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; __u32 handle; __u32 reserved1; }; struct ib_uverbs_flow_tunnel_filter { __be32 tunnel_id; }; struct ib_uverbs_flow_spec_tunnel { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_tunnel_filter val; struct ib_uverbs_flow_tunnel_filter mask; }; struct ib_uverbs_flow_spec_esp_filter { __u32 spi; __u32 seq; }; struct ib_uverbs_flow_spec_esp { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_spec_esp_filter val; struct ib_uverbs_flow_spec_esp_filter mask; }; struct ib_uverbs_flow_gre_filter { /* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header: * bit 0 - C - checksum bit. * bit 1 - reserved. set to 0. * bit 2 - key bit. * bit 3 - sequence number bit. * bits 4:12 - reserved. set to 0. * bits 13:15 - GRE version. */ __be16 c_ks_res0_ver; __be16 protocol; __be32 key; }; struct ib_uverbs_flow_spec_gre { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_gre_filter val; struct ib_uverbs_flow_gre_filter mask; }; struct ib_uverbs_flow_mpls_filter { /* The field includes the entire MPLS label: * bits 0:19 - label field. * bits 20:22 - traffic class field. * bits 23 - bottom of stack bit. * bits 24:31 - ttl field. */ __be32 label; }; struct ib_uverbs_flow_spec_mpls { union { struct ib_uverbs_flow_spec_hdr hdr; struct { __u32 type; __u16 size; __u16 reserved; }; }; struct ib_uverbs_flow_mpls_filter val; struct ib_uverbs_flow_mpls_filter mask; }; struct ib_uverbs_flow_attr { __u32 type; __u16 size; __u16 priority; __u8 num_of_specs; __u8 reserved[2]; __u8 port; __u32 flags; /* Following are the optional layers according to user request * struct ib_flow_spec_xxx * struct ib_flow_spec_yyy */ struct ib_uverbs_flow_spec_hdr flow_specs[]; }; struct ib_uverbs_create_flow { __u32 comp_mask; __u32 qp_handle; struct ib_uverbs_flow_attr flow_attr; }; struct ib_uverbs_create_flow_resp { __u32 comp_mask; __u32 flow_handle; }; struct ib_uverbs_destroy_flow { __u32 comp_mask; __u32 flow_handle; }; struct ib_uverbs_create_srq { __aligned_u64 response; __aligned_u64 user_handle; __u32 pd_handle; __u32 max_wr; __u32 max_sge; __u32 srq_limit; __aligned_u64 driver_data[]; }; struct ib_uverbs_create_xsrq { __aligned_u64 response; __aligned_u64 user_handle; __u32 srq_type; __u32 pd_handle; __u32 max_wr; __u32 max_sge; __u32 srq_limit; __u32 max_num_tags; __u32 xrcd_handle; __u32 cq_handle; __aligned_u64 driver_data[]; }; struct ib_uverbs_create_srq_resp { __u32 srq_handle; __u32 max_wr; __u32 max_sge; __u32 srqn; __u32 driver_data[]; }; struct ib_uverbs_modify_srq { __u32 srq_handle; __u32 attr_mask; __u32 max_wr; __u32 srq_limit; __aligned_u64 driver_data[]; }; struct ib_uverbs_query_srq { __aligned_u64 response; __u32 srq_handle; __u32 reserved; __aligned_u64 driver_data[]; }; struct ib_uverbs_query_srq_resp { __u32 max_wr; __u32 max_sge; __u32 srq_limit; __u32 reserved; }; struct ib_uverbs_destroy_srq { __aligned_u64 response; __u32 srq_handle; __u32 reserved; }; struct ib_uverbs_destroy_srq_resp { __u32 events_reported; }; struct ib_uverbs_ex_create_wq { __u32 comp_mask; __u32 wq_type; __aligned_u64 user_handle; __u32 pd_handle; __u32 cq_handle; __u32 max_wr; __u32 max_sge; __u32 create_flags; /* Use enum ib_wq_flags */ __u32 reserved; }; struct ib_uverbs_ex_create_wq_resp { __u32 comp_mask; __u32 response_length; __u32 wq_handle; __u32 max_wr; __u32 max_sge; __u32 wqn; }; struct ib_uverbs_ex_destroy_wq { __u32 comp_mask; __u32 wq_handle; }; struct ib_uverbs_ex_destroy_wq_resp { __u32 comp_mask; __u32 response_length; __u32 events_reported; __u32 reserved; }; struct ib_uverbs_ex_modify_wq { __u32 attr_mask; __u32 wq_handle; __u32 wq_state; __u32 curr_wq_state; __u32 flags; /* Use enum ib_wq_flags */ __u32 flags_mask; /* Use enum ib_wq_flags */ }; /* Prevent memory allocation rather than max expected size */ #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d struct ib_uverbs_ex_create_rwq_ind_table { __u32 comp_mask; __u32 log_ind_tbl_size; /* Following are the wq handles according to log_ind_tbl_size * wq_handle1 * wq_handle2 */ __u32 wq_handles[]; }; struct ib_uverbs_ex_create_rwq_ind_table_resp { __u32 comp_mask; __u32 response_length; __u32 ind_tbl_handle; __u32 ind_tbl_num; }; struct ib_uverbs_ex_destroy_rwq_ind_table { __u32 comp_mask; __u32 ind_tbl_handle; }; struct ib_uverbs_cq_moderation { __u16 cq_count; __u16 cq_period; }; struct ib_uverbs_ex_modify_cq { __u32 cq_handle; __u32 attr_mask; struct ib_uverbs_cq_moderation attr; __u32 reserved; }; #define IB_DEVICE_NAME_MAX 64 /* * bits 9, 15, 16, 19, 22, 27, 30, 31, 32, 33, 35 and 37 may be set by old * kernels and should not be used. */ enum ib_uverbs_device_cap_flags { IB_UVERBS_DEVICE_RESIZE_MAX_WR = 1 << 0, IB_UVERBS_DEVICE_BAD_PKEY_CNTR = 1 << 1, IB_UVERBS_DEVICE_BAD_QKEY_CNTR = 1 << 2, IB_UVERBS_DEVICE_RAW_MULTI = 1 << 3, IB_UVERBS_DEVICE_AUTO_PATH_MIG = 1 << 4, IB_UVERBS_DEVICE_CHANGE_PHY_PORT = 1 << 5, IB_UVERBS_DEVICE_UD_AV_PORT_ENFORCE = 1 << 6, IB_UVERBS_DEVICE_CURR_QP_STATE_MOD = 1 << 7, IB_UVERBS_DEVICE_SHUTDOWN_PORT = 1 << 8, /* IB_UVERBS_DEVICE_INIT_TYPE = 1 << 9, (not in use) */ IB_UVERBS_DEVICE_PORT_ACTIVE_EVENT = 1 << 10, IB_UVERBS_DEVICE_SYS_IMAGE_GUID = 1 << 11, IB_UVERBS_DEVICE_RC_RNR_NAK_GEN = 1 << 12, IB_UVERBS_DEVICE_SRQ_RESIZE = 1 << 13, IB_UVERBS_DEVICE_N_NOTIFY_CQ = 1 << 14, IB_UVERBS_DEVICE_MEM_WINDOW = 1 << 17, IB_UVERBS_DEVICE_UD_IP_CSUM = 1 << 18, IB_UVERBS_DEVICE_XRC = 1 << 20, IB_UVERBS_DEVICE_MEM_MGT_EXTENSIONS = 1 << 21, IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2A = 1 << 23, IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2B = 1 << 24, IB_UVERBS_DEVICE_RC_IP_CSUM = 1 << 25, /* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_IP_CSUM. */ IB_UVERBS_DEVICE_RAW_IP_CSUM = 1 << 26, IB_UVERBS_DEVICE_MANAGED_FLOW_STEERING = 1 << 29, /* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS. */ IB_UVERBS_DEVICE_RAW_SCATTER_FCS = 1ULL << 34, IB_UVERBS_DEVICE_PCI_WRITE_END_PADDING = 1ULL << 36, /* Flush placement types */ IB_UVERBS_DEVICE_FLUSH_GLOBAL = 1ULL << 38, IB_UVERBS_DEVICE_FLUSH_PERSISTENT = 1ULL << 39, /* Atomic write attributes */ IB_UVERBS_DEVICE_ATOMIC_WRITE = 1ULL << 40, }; enum ib_uverbs_raw_packet_caps { IB_UVERBS_RAW_PACKET_CAP_CVLAN_STRIPPING = 1 << 0, IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS = 1 << 1, IB_UVERBS_RAW_PACKET_CAP_IP_CSUM = 1 << 2, IB_UVERBS_RAW_PACKET_CAP_DELAY_DROP = 1 << 3, }; #endif /* IB_USER_VERBS_H */ rdma/irdma-abi.h 0000644 00000004220 15063602061 0007462 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB */ /* * Copyright (c) 2006 - 2021 Intel Corporation. All rights reserved. * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005 Cisco Systems. All rights reserved. * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. */ #ifndef IRDMA_ABI_H #define IRDMA_ABI_H #include <linux/types.h> /* irdma must support legacy GEN_1 i40iw kernel * and user-space whose last ABI ver is 5 */ #define IRDMA_ABI_VER 5 enum irdma_memreg_type { IRDMA_MEMREG_TYPE_MEM = 0, IRDMA_MEMREG_TYPE_QP = 1, IRDMA_MEMREG_TYPE_CQ = 2, }; struct irdma_alloc_ucontext_req { __u32 rsvd32; __u8 userspace_ver; __u8 rsvd8[3]; }; struct irdma_alloc_ucontext_resp { __u32 max_pds; __u32 max_qps; __u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */ __u8 kernel_ver; __u8 rsvd[3]; __aligned_u64 feature_flags; __aligned_u64 db_mmap_key; __u32 max_hw_wq_frags; __u32 max_hw_read_sges; __u32 max_hw_inline; __u32 max_hw_rq_quanta; __u32 max_hw_wq_quanta; __u32 min_hw_cq_size; __u32 max_hw_cq_size; __u16 max_hw_sq_chunk; __u8 hw_rev; __u8 rsvd2; }; struct irdma_alloc_pd_resp { __u32 pd_id; __u8 rsvd[4]; }; struct irdma_resize_cq_req { __aligned_u64 user_cq_buffer; }; struct irdma_create_cq_req { __aligned_u64 user_cq_buf; __aligned_u64 user_shadow_area; }; struct irdma_create_qp_req { __aligned_u64 user_wqe_bufs; __aligned_u64 user_compl_ctx; }; struct irdma_mem_reg_req { __u16 reg_type; /* enum irdma_memreg_type */ __u16 cq_pages; __u16 rq_pages; __u16 sq_pages; }; struct irdma_modify_qp_req { __u8 sq_flush; __u8 rq_flush; __u8 rsvd[6]; }; struct irdma_create_cq_resp { __u32 cq_id; __u32 cq_size; }; struct irdma_create_qp_resp { __u32 qp_id; __u32 actual_sq_size; __u32 actual_rq_size; __u32 irdma_drv_opt; __u16 push_idx; __u8 lsmm; __u8 rsvd; __u32 qp_caps; }; struct irdma_modify_qp_resp { __aligned_u64 push_wqe_mmap_key; __aligned_u64 push_db_mmap_key; __u16 push_offset; __u8 push_valid; __u8 rsvd[5]; }; struct irdma_create_ah_resp { __u32 ah_id; __u8 rsvd[4]; }; #endif /* IRDMA_ABI_H */ rdma/mana-abi.h 0000644 00000002241 15063602061 0007303 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */ /* * Copyright (c) 2022, Microsoft Corporation. All rights reserved. */ #ifndef MANA_ABI_USER_H #define MANA_ABI_USER_H #include <linux/types.h> #include <rdma/ib_user_ioctl_verbs.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define MANA_IB_UVERBS_ABI_VERSION 1 struct mana_ib_create_cq { __aligned_u64 buf_addr; }; struct mana_ib_create_qp { __aligned_u64 sq_buf_addr; __u32 sq_buf_size; __u32 port; }; struct mana_ib_create_qp_resp { __u32 sqid; __u32 cqid; __u32 tx_vp_offset; __u32 reserved; }; struct mana_ib_create_wq { __aligned_u64 wq_buf_addr; __u32 wq_buf_size; __u32 reserved; }; /* RX Hash function flags */ enum mana_ib_rx_hash_function_flags { MANA_IB_RX_HASH_FUNC_TOEPLITZ = 1 << 0, }; struct mana_ib_create_qp_rss { __aligned_u64 rx_hash_fields_mask; __u8 rx_hash_function; __u8 reserved[7]; __u32 rx_hash_key_len; __u8 rx_hash_key[40]; __u32 port; }; struct rss_resp_entry { __u32 cqid; __u32 wqid; }; struct mana_ib_create_qp_rss_resp { __aligned_u64 num_entries; struct rss_resp_entry entries[64]; }; #endif rdma/mlx4-abi.h 0000644 00000011775 15063602061 0007267 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX4_ABI_USER_H #define MLX4_ABI_USER_H #include <linux/types.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define MLX4_IB_UVERBS_NO_DEV_CAPS_ABI_VERSION 3 #define MLX4_IB_UVERBS_ABI_VERSION 4 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __u64 * instead. */ struct mlx4_ib_alloc_ucontext_resp_v3 { __u32 qp_tab_size; __u16 bf_reg_size; __u16 bf_regs_per_page; }; enum { MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0, }; struct mlx4_ib_alloc_ucontext_resp { __u32 dev_caps; __u32 qp_tab_size; __u16 bf_reg_size; __u16 bf_regs_per_page; __u32 cqe_size; }; struct mlx4_ib_alloc_pd_resp { __u32 pdn; __u32 reserved; }; struct mlx4_ib_create_cq { __aligned_u64 buf_addr; __aligned_u64 db_addr; }; struct mlx4_ib_create_cq_resp { __u32 cqn; __u32 reserved; }; struct mlx4_ib_resize_cq { __aligned_u64 buf_addr; }; struct mlx4_ib_create_srq { __aligned_u64 buf_addr; __aligned_u64 db_addr; }; struct mlx4_ib_create_srq_resp { __u32 srqn; __u32 reserved; }; struct mlx4_ib_create_qp_rss { __aligned_u64 rx_hash_fields_mask; /* Use enum mlx4_ib_rx_hash_fields */ __u8 rx_hash_function; /* Use enum mlx4_ib_rx_hash_function_flags */ __u8 reserved[7]; __u8 rx_hash_key[40]; __u32 comp_mask; __u32 reserved1; }; struct mlx4_ib_create_qp { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u8 log_sq_bb_count; __u8 log_sq_stride; __u8 sq_no_prefetch; __u8 reserved; __u32 inl_recv_sz; }; struct mlx4_ib_create_wq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u8 log_range_size; __u8 reserved[3]; __u32 comp_mask; }; struct mlx4_ib_modify_wq { __u32 comp_mask; __u32 reserved; }; struct mlx4_ib_create_rwq_ind_tbl_resp { __u32 response_length; __u32 reserved; }; /* RX Hash function flags */ enum mlx4_ib_rx_hash_function_flags { MLX4_IB_RX_HASH_FUNC_TOEPLITZ = 1 << 0, }; /* * RX Hash flags, these flags allows to set which incoming packet's field should * participates in RX Hash. Each flag represent certain packet's field, * when the flag is set the field that is represented by the flag will * participate in RX Hash calculation. */ enum mlx4_ib_rx_hash_fields { MLX4_IB_RX_HASH_SRC_IPV4 = 1 << 0, MLX4_IB_RX_HASH_DST_IPV4 = 1 << 1, MLX4_IB_RX_HASH_SRC_IPV6 = 1 << 2, MLX4_IB_RX_HASH_DST_IPV6 = 1 << 3, MLX4_IB_RX_HASH_SRC_PORT_TCP = 1 << 4, MLX4_IB_RX_HASH_DST_PORT_TCP = 1 << 5, MLX4_IB_RX_HASH_SRC_PORT_UDP = 1 << 6, MLX4_IB_RX_HASH_DST_PORT_UDP = 1 << 7, MLX4_IB_RX_HASH_INNER = 1ULL << 31, }; struct mlx4_ib_rss_caps { __aligned_u64 rx_hash_fields_mask; /* enum mlx4_ib_rx_hash_fields */ __u8 rx_hash_function; /* enum mlx4_ib_rx_hash_function_flags */ __u8 reserved[7]; }; enum query_device_resp_mask { MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0, }; struct mlx4_ib_tso_caps { __u32 max_tso; /* Maximum tso payload size in bytes */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported. */ __u32 supported_qpts; }; struct mlx4_uverbs_ex_query_device_resp { __u32 comp_mask; __u32 response_length; __aligned_u64 hca_core_clock_offset; __u32 max_inl_recv_sz; __u32 reserved; struct mlx4_ib_rss_caps rss_caps; struct mlx4_ib_tso_caps tso_caps; }; #endif /* MLX4_ABI_USER_H */ rdma/mlx5-abi.h 0000644 00000033055 15063602061 0007263 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX5_ABI_USER_H #define MLX5_ABI_USER_H #include <linux/types.h> #include <linux/if_ether.h> /* For ETH_ALEN. */ #include <rdma/ib_user_ioctl_verbs.h> enum { MLX5_QP_FLAG_SIGNATURE = 1 << 0, MLX5_QP_FLAG_SCATTER_CQE = 1 << 1, MLX5_QP_FLAG_TUNNEL_OFFLOADS = 1 << 2, MLX5_QP_FLAG_BFREG_INDEX = 1 << 3, MLX5_QP_FLAG_TYPE_DCT = 1 << 4, MLX5_QP_FLAG_TYPE_DCI = 1 << 5, MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_UC = 1 << 6, MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC = 1 << 7, MLX5_QP_FLAG_ALLOW_SCATTER_CQE = 1 << 8, MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE = 1 << 9, MLX5_QP_FLAG_UAR_PAGE_INDEX = 1 << 10, MLX5_QP_FLAG_DCI_STREAM = 1 << 11, }; enum { MLX5_SRQ_FLAG_SIGNATURE = 1 << 0, }; enum { MLX5_WQ_FLAG_SIGNATURE = 1 << 0, }; /* Increment this value if any changes that break userspace ABI * compatibility are made. */ #define MLX5_IB_UVERBS_ABI_VERSION 1 /* Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __u64 * instead. */ struct mlx5_ib_alloc_ucontext_req { __u32 total_num_bfregs; __u32 num_low_latency_bfregs; }; enum mlx5_lib_caps { MLX5_LIB_CAP_4K_UAR = (__u64)1 << 0, MLX5_LIB_CAP_DYN_UAR = (__u64)1 << 1, }; enum mlx5_ib_alloc_uctx_v2_flags { MLX5_IB_ALLOC_UCTX_DEVX = 1 << 0, }; struct mlx5_ib_alloc_ucontext_req_v2 { __u32 total_num_bfregs; __u32 num_low_latency_bfregs; __u32 flags; __u32 comp_mask; __u8 max_cqe_version; __u8 reserved0; __u16 reserved1; __u32 reserved2; __aligned_u64 lib_caps; }; enum mlx5_ib_alloc_ucontext_resp_mask { MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DUMP_FILL_MKEY = 1UL << 1, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE = 1UL << 2, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS = 1UL << 3, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS = 1UL << 4, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG = 1UL << 5, }; enum mlx5_user_cmds_supp_uhw { MLX5_USER_CMDS_SUPP_UHW_QUERY_DEVICE = 1 << 0, MLX5_USER_CMDS_SUPP_UHW_CREATE_AH = 1 << 1, }; /* The eth_min_inline response value is set to off-by-one vs the FW * returned value to allow user-space to deal with older kernels. */ enum mlx5_user_inline_mode { MLX5_USER_INLINE_MODE_NA, MLX5_USER_INLINE_MODE_NONE, MLX5_USER_INLINE_MODE_L2, MLX5_USER_INLINE_MODE_IP, MLX5_USER_INLINE_MODE_TCP_UDP, }; enum { MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM = 1 << 0, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_REQ_METADATA = 1 << 1, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_SPI_STEERING = 1 << 2, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_FULL_OFFLOAD = 1 << 3, MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_TX_IV_IS_ESN = 1 << 4, }; struct mlx5_ib_alloc_ucontext_resp { __u32 qp_tab_size; __u32 bf_reg_size; __u32 tot_bfregs; __u32 cache_line_size; __u16 max_sq_desc_sz; __u16 max_rq_desc_sz; __u32 max_send_wqebb; __u32 max_recv_wr; __u32 max_srq_recv_wr; __u16 num_ports; __u16 flow_action_flags; __u32 comp_mask; __u32 response_length; __u8 cqe_version; __u8 cmds_supp_uhw; __u8 eth_min_inline; __u8 clock_info_versions; __aligned_u64 hca_core_clock_offset; __u32 log_uar_size; __u32 num_uars_per_page; __u32 num_dyn_bfregs; __u32 dump_fill_mkey; }; struct mlx5_ib_alloc_pd_resp { __u32 pdn; }; struct mlx5_ib_tso_caps { __u32 max_tso; /* Maximum tso payload size in bytes */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_UD */ __u32 supported_qpts; }; struct mlx5_ib_rss_caps { __aligned_u64 rx_hash_fields_mask; /* enum mlx5_rx_hash_fields */ __u8 rx_hash_function; /* enum mlx5_rx_hash_function_flags */ __u8 reserved[7]; }; enum mlx5_ib_cqe_comp_res_format { MLX5_IB_CQE_RES_FORMAT_HASH = 1 << 0, MLX5_IB_CQE_RES_FORMAT_CSUM = 1 << 1, MLX5_IB_CQE_RES_FORMAT_CSUM_STRIDX = 1 << 2, }; struct mlx5_ib_cqe_comp_caps { __u32 max_num; __u32 supported_format; /* enum mlx5_ib_cqe_comp_res_format */ }; enum mlx5_ib_packet_pacing_cap_flags { MLX5_IB_PP_SUPPORT_BURST = 1 << 0, }; struct mlx5_packet_pacing_caps { __u32 qp_rate_limit_min; __u32 qp_rate_limit_max; /* In kpbs */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_RAW_PACKET */ __u32 supported_qpts; __u8 cap_flags; /* enum mlx5_ib_packet_pacing_cap_flags */ __u8 reserved[3]; }; enum mlx5_ib_mpw_caps { MPW_RESERVED = 1 << 0, MLX5_IB_ALLOW_MPW = 1 << 1, MLX5_IB_SUPPORT_EMPW = 1 << 2, }; enum mlx5_ib_sw_parsing_offloads { MLX5_IB_SW_PARSING = 1 << 0, MLX5_IB_SW_PARSING_CSUM = 1 << 1, MLX5_IB_SW_PARSING_LSO = 1 << 2, }; struct mlx5_ib_sw_parsing_caps { __u32 sw_parsing_offloads; /* enum mlx5_ib_sw_parsing_offloads */ /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_RAW_PACKET */ __u32 supported_qpts; }; struct mlx5_ib_striding_rq_caps { __u32 min_single_stride_log_num_of_bytes; __u32 max_single_stride_log_num_of_bytes; __u32 min_single_wqe_log_num_of_strides; __u32 max_single_wqe_log_num_of_strides; /* Corresponding bit will be set if qp type from * 'enum ib_qp_type' is supported, e.g. * supported_qpts |= 1 << IB_QPT_RAW_PACKET */ __u32 supported_qpts; __u32 reserved; }; struct mlx5_ib_dci_streams_caps { __u8 max_log_num_concurent; __u8 max_log_num_errored; }; enum mlx5_ib_query_dev_resp_flags { /* Support 128B CQE compression */ MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0, MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD = 1 << 1, MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE = 1 << 2, MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT = 1 << 3, }; enum mlx5_ib_tunnel_offloads { MLX5_IB_TUNNELED_OFFLOADS_VXLAN = 1 << 0, MLX5_IB_TUNNELED_OFFLOADS_GRE = 1 << 1, MLX5_IB_TUNNELED_OFFLOADS_GENEVE = 1 << 2, MLX5_IB_TUNNELED_OFFLOADS_MPLS_GRE = 1 << 3, MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP = 1 << 4, }; struct mlx5_ib_query_device_resp { __u32 comp_mask; __u32 response_length; struct mlx5_ib_tso_caps tso_caps; struct mlx5_ib_rss_caps rss_caps; struct mlx5_ib_cqe_comp_caps cqe_comp_caps; struct mlx5_packet_pacing_caps packet_pacing_caps; __u32 mlx5_ib_support_multi_pkt_send_wqes; __u32 flags; /* Use enum mlx5_ib_query_dev_resp_flags */ struct mlx5_ib_sw_parsing_caps sw_parsing_caps; struct mlx5_ib_striding_rq_caps striding_rq_caps; __u32 tunnel_offloads_caps; /* enum mlx5_ib_tunnel_offloads */ struct mlx5_ib_dci_streams_caps dci_streams_caps; __u16 reserved; }; enum mlx5_ib_create_cq_flags { MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0, MLX5_IB_CREATE_CQ_FLAGS_UAR_PAGE_INDEX = 1 << 1, MLX5_IB_CREATE_CQ_FLAGS_REAL_TIME_TS = 1 << 2, }; struct mlx5_ib_create_cq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 cqe_size; __u8 cqe_comp_en; __u8 cqe_comp_res_format; __u16 flags; __u16 uar_page_index; __u16 reserved0; __u32 reserved1; }; struct mlx5_ib_create_cq_resp { __u32 cqn; __u32 reserved; }; struct mlx5_ib_resize_cq { __aligned_u64 buf_addr; __u16 cqe_size; __u16 reserved0; __u32 reserved1; }; struct mlx5_ib_create_srq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 flags; __u32 reserved0; /* explicit padding (optional on i386) */ __u32 uidx; __u32 reserved1; }; struct mlx5_ib_create_srq_resp { __u32 srqn; __u32 reserved; }; struct mlx5_ib_create_qp_dci_streams { __u8 log_num_concurent; __u8 log_num_errored; }; struct mlx5_ib_create_qp { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 sq_wqe_count; __u32 rq_wqe_count; __u32 rq_wqe_shift; __u32 flags; __u32 uidx; __u32 bfreg_index; union { __aligned_u64 sq_buf_addr; __aligned_u64 access_key; }; __u32 ece_options; struct mlx5_ib_create_qp_dci_streams dci_streams; __u16 reserved; }; /* RX Hash function flags */ enum mlx5_rx_hash_function_flags { MLX5_RX_HASH_FUNC_TOEPLITZ = 1 << 0, }; /* * RX Hash flags, these flags allows to set which incoming packet's field should * participates in RX Hash. Each flag represent certain packet's field, * when the flag is set the field that is represented by the flag will * participate in RX Hash calculation. * Note: *IPV4 and *IPV6 flags can't be enabled together on the same QP * and *TCP and *UDP flags can't be enabled together on the same QP. */ enum mlx5_rx_hash_fields { MLX5_RX_HASH_SRC_IPV4 = 1 << 0, MLX5_RX_HASH_DST_IPV4 = 1 << 1, MLX5_RX_HASH_SRC_IPV6 = 1 << 2, MLX5_RX_HASH_DST_IPV6 = 1 << 3, MLX5_RX_HASH_SRC_PORT_TCP = 1 << 4, MLX5_RX_HASH_DST_PORT_TCP = 1 << 5, MLX5_RX_HASH_SRC_PORT_UDP = 1 << 6, MLX5_RX_HASH_DST_PORT_UDP = 1 << 7, MLX5_RX_HASH_IPSEC_SPI = 1 << 8, /* Save bits for future fields */ MLX5_RX_HASH_INNER = (1UL << 31), }; struct mlx5_ib_create_qp_rss { __aligned_u64 rx_hash_fields_mask; /* enum mlx5_rx_hash_fields */ __u8 rx_hash_function; /* enum mlx5_rx_hash_function_flags */ __u8 rx_key_len; /* valid only for Toeplitz */ __u8 reserved[6]; __u8 rx_hash_key[128]; /* valid only for Toeplitz */ __u32 comp_mask; __u32 flags; }; enum mlx5_ib_create_qp_resp_mask { MLX5_IB_CREATE_QP_RESP_MASK_TIRN = 1UL << 0, MLX5_IB_CREATE_QP_RESP_MASK_TISN = 1UL << 1, MLX5_IB_CREATE_QP_RESP_MASK_RQN = 1UL << 2, MLX5_IB_CREATE_QP_RESP_MASK_SQN = 1UL << 3, MLX5_IB_CREATE_QP_RESP_MASK_TIR_ICM_ADDR = 1UL << 4, }; struct mlx5_ib_create_qp_resp { __u32 bfreg_index; __u32 ece_options; __u32 comp_mask; __u32 tirn; __u32 tisn; __u32 rqn; __u32 sqn; __u32 reserved1; __u64 tir_icm_addr; }; struct mlx5_ib_alloc_mw { __u32 comp_mask; __u8 num_klms; __u8 reserved1; __u16 reserved2; }; enum mlx5_ib_create_wq_mask { MLX5_IB_CREATE_WQ_STRIDING_RQ = (1 << 0), }; struct mlx5_ib_create_wq { __aligned_u64 buf_addr; __aligned_u64 db_addr; __u32 rq_wqe_count; __u32 rq_wqe_shift; __u32 user_index; __u32 flags; __u32 comp_mask; __u32 single_stride_log_num_of_bytes; __u32 single_wqe_log_num_of_strides; __u32 two_byte_shift_en; }; struct mlx5_ib_create_ah_resp { __u32 response_length; __u8 dmac[ETH_ALEN]; __u8 reserved[6]; }; struct mlx5_ib_burst_info { __u32 max_burst_sz; __u16 typical_pkt_sz; __u16 reserved; }; struct mlx5_ib_modify_qp { __u32 comp_mask; struct mlx5_ib_burst_info burst_info; __u32 ece_options; }; struct mlx5_ib_modify_qp_resp { __u32 response_length; __u32 dctn; __u32 ece_options; __u32 reserved; }; struct mlx5_ib_create_wq_resp { __u32 response_length; __u32 reserved; }; struct mlx5_ib_create_rwq_ind_tbl_resp { __u32 response_length; __u32 reserved; }; struct mlx5_ib_modify_wq { __u32 comp_mask; __u32 reserved; }; struct mlx5_ib_clock_info { __u32 sign; __u32 resv; __aligned_u64 nsec; __aligned_u64 cycles; __aligned_u64 frac; __u32 mult; __u32 shift; __aligned_u64 mask; __aligned_u64 overflow_period; }; enum mlx5_ib_mmap_cmd { MLX5_IB_MMAP_REGULAR_PAGE = 0, MLX5_IB_MMAP_GET_CONTIGUOUS_PAGES = 1, MLX5_IB_MMAP_WC_PAGE = 2, MLX5_IB_MMAP_NC_PAGE = 3, /* 5 is chosen in order to be compatible with old versions of libmlx5 */ MLX5_IB_MMAP_CORE_CLOCK = 5, MLX5_IB_MMAP_ALLOC_WC = 6, MLX5_IB_MMAP_CLOCK_INFO = 7, MLX5_IB_MMAP_DEVICE_MEM = 8, }; enum { MLX5_IB_CLOCK_INFO_KERNEL_UPDATING = 1, }; /* Bit indexes for the mlx5_alloc_ucontext_resp.clock_info_versions bitmap */ enum { MLX5_IB_CLOCK_INFO_V1 = 0, }; struct mlx5_ib_flow_counters_desc { __u32 description; __u32 index; }; struct mlx5_ib_flow_counters_data { RDMA_UAPI_PTR(struct mlx5_ib_flow_counters_desc *, counters_data); __u32 ncounters; __u32 reserved; }; struct mlx5_ib_create_flow { __u32 ncounters_data; __u32 reserved; /* * Following are counters data based on ncounters_data, each * entry in the data[] should match a corresponding counter object * that was pointed by a counters spec upon the flow creation */ struct mlx5_ib_flow_counters_data data[]; }; #endif /* MLX5_ABI_USER_H */ rdma/mlx5_user_ioctl_cmds.h 0000644 00000024771 15063602061 0011775 0 ustar 00 /* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX5_USER_IOCTL_CMDS_H #define MLX5_USER_IOCTL_CMDS_H #include <linux/types.h> #include <rdma/ib_user_ioctl_cmds.h> enum mlx5_ib_create_flow_action_attrs { /* This attribute belong to the driver namespace */ MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_dm_methods { MLX5_IB_METHOD_DM_MAP_OP_ADDR = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DM_QUERY, }; enum mlx5_ib_dm_map_op_addr_attrs { MLX5_IB_ATTR_DM_MAP_OP_ADDR_REQ_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DM_MAP_OP_ADDR_REQ_OP, MLX5_IB_ATTR_DM_MAP_OP_ADDR_RESP_START_OFFSET, MLX5_IB_ATTR_DM_MAP_OP_ADDR_RESP_PAGE_INDEX, }; enum mlx5_ib_query_dm_attrs { MLX5_IB_ATTR_QUERY_DM_REQ_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_QUERY_DM_RESP_START_OFFSET, MLX5_IB_ATTR_QUERY_DM_RESP_PAGE_INDEX, MLX5_IB_ATTR_QUERY_DM_RESP_LENGTH, }; enum mlx5_ib_alloc_dm_attrs { MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX, MLX5_IB_ATTR_ALLOC_DM_REQ_TYPE, }; enum mlx5_ib_devx_methods { MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DEVX_QUERY_UAR, MLX5_IB_METHOD_DEVX_QUERY_EQN, MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT, }; enum mlx5_ib_devx_other_attrs { MLX5_IB_ATTR_DEVX_OTHER_CMD_IN = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OTHER_CMD_OUT, }; enum mlx5_ib_devx_obj_create_attrs { MLX5_IB_ATTR_DEVX_OBJ_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_IN, MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT, }; enum mlx5_ib_devx_query_uar_attrs { MLX5_IB_ATTR_DEVX_QUERY_UAR_USER_IDX = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_QUERY_UAR_DEV_IDX, }; enum mlx5_ib_devx_obj_destroy_attrs { MLX5_IB_ATTR_DEVX_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_devx_obj_modify_attrs { MLX5_IB_ATTR_DEVX_OBJ_MODIFY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_IN, MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_OUT, }; enum mlx5_ib_devx_obj_query_attrs { MLX5_IB_ATTR_DEVX_OBJ_QUERY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_IN, MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_OUT, }; enum mlx5_ib_devx_obj_query_async_attrs { MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_CMD_IN, MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_FD, MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_WR_ID, MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_OUT_LEN, }; enum mlx5_ib_devx_subscribe_event_attrs { MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_OBJ_HANDLE, MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_TYPE_NUM_LIST, MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_NUM, MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_COOKIE, }; enum mlx5_ib_devx_query_eqn_attrs { MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN, }; enum mlx5_ib_devx_obj_methods { MLX5_IB_METHOD_DEVX_OBJ_CREATE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DEVX_OBJ_DESTROY, MLX5_IB_METHOD_DEVX_OBJ_MODIFY, MLX5_IB_METHOD_DEVX_OBJ_QUERY, MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY, }; enum mlx5_ib_var_alloc_attrs { MLX5_IB_ATTR_VAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_OFFSET, MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_LENGTH, MLX5_IB_ATTR_VAR_OBJ_ALLOC_PAGE_ID, }; enum mlx5_ib_var_obj_destroy_attrs { MLX5_IB_ATTR_VAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_var_obj_methods { MLX5_IB_METHOD_VAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_VAR_OBJ_DESTROY, }; enum mlx5_ib_uar_alloc_attrs { MLX5_IB_ATTR_UAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_UAR_OBJ_ALLOC_TYPE, MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET, MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_LENGTH, MLX5_IB_ATTR_UAR_OBJ_ALLOC_PAGE_ID, }; enum mlx5_ib_uar_obj_destroy_attrs { MLX5_IB_ATTR_UAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_uar_obj_methods { MLX5_IB_METHOD_UAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_UAR_OBJ_DESTROY, }; enum mlx5_ib_devx_umem_reg_attrs { MLX5_IB_ATTR_DEVX_UMEM_REG_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_UMEM_REG_ADDR, MLX5_IB_ATTR_DEVX_UMEM_REG_LEN, MLX5_IB_ATTR_DEVX_UMEM_REG_ACCESS, MLX5_IB_ATTR_DEVX_UMEM_REG_OUT_ID, MLX5_IB_ATTR_DEVX_UMEM_REG_PGSZ_BITMAP, }; enum mlx5_ib_devx_umem_dereg_attrs { MLX5_IB_ATTR_DEVX_UMEM_DEREG_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_pp_obj_methods { MLX5_IB_METHOD_PP_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_PP_OBJ_DESTROY, }; enum mlx5_ib_pp_alloc_attrs { MLX5_IB_ATTR_PP_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_PP_OBJ_ALLOC_CTX, MLX5_IB_ATTR_PP_OBJ_ALLOC_FLAGS, MLX5_IB_ATTR_PP_OBJ_ALLOC_INDEX, }; enum mlx5_ib_pp_obj_destroy_attrs { MLX5_IB_ATTR_PP_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_devx_umem_methods { MLX5_IB_METHOD_DEVX_UMEM_REG = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DEVX_UMEM_DEREG, }; enum mlx5_ib_devx_async_cmd_fd_alloc_attrs { MLX5_IB_ATTR_DEVX_ASYNC_CMD_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_devx_async_event_fd_alloc_attrs { MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_FLAGS, }; enum mlx5_ib_devx_async_cmd_fd_methods { MLX5_IB_METHOD_DEVX_ASYNC_CMD_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_devx_async_event_fd_methods { MLX5_IB_METHOD_DEVX_ASYNC_EVENT_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_objects { MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_OBJECT_DEVX_OBJ, MLX5_IB_OBJECT_DEVX_UMEM, MLX5_IB_OBJECT_FLOW_MATCHER, MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD, MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD, MLX5_IB_OBJECT_VAR, MLX5_IB_OBJECT_PP, MLX5_IB_OBJECT_UAR, MLX5_IB_OBJECT_STEERING_ANCHOR, }; enum mlx5_ib_flow_matcher_create_attrs { MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_FLOW_MATCHER_MATCH_MASK, MLX5_IB_ATTR_FLOW_MATCHER_FLOW_TYPE, MLX5_IB_ATTR_FLOW_MATCHER_MATCH_CRITERIA, MLX5_IB_ATTR_FLOW_MATCHER_FLOW_FLAGS, MLX5_IB_ATTR_FLOW_MATCHER_FT_TYPE, }; enum mlx5_ib_flow_matcher_destroy_attrs { MLX5_IB_ATTR_FLOW_MATCHER_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_flow_matcher_methods { MLX5_IB_METHOD_FLOW_MATCHER_CREATE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_FLOW_MATCHER_DESTROY, }; enum mlx5_ib_flow_steering_anchor_create_attrs { MLX5_IB_ATTR_STEERING_ANCHOR_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_STEERING_ANCHOR_FT_TYPE, MLX5_IB_ATTR_STEERING_ANCHOR_PRIORITY, MLX5_IB_ATTR_STEERING_ANCHOR_FT_ID, }; enum mlx5_ib_flow_steering_anchor_destroy_attrs { MLX5_IB_ATTR_STEERING_ANCHOR_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_steering_anchor_methods { MLX5_IB_METHOD_STEERING_ANCHOR_CREATE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_STEERING_ANCHOR_DESTROY, }; enum mlx5_ib_device_query_context_attrs { MLX5_IB_ATTR_QUERY_CONTEXT_RESP_UCTX = (1U << UVERBS_ID_NS_SHIFT), }; #define MLX5_IB_DW_MATCH_PARAM 0xA0 struct mlx5_ib_match_params { __u32 match_params[MLX5_IB_DW_MATCH_PARAM]; }; enum mlx5_ib_flow_type { MLX5_IB_FLOW_TYPE_NORMAL, MLX5_IB_FLOW_TYPE_SNIFFER, MLX5_IB_FLOW_TYPE_ALL_DEFAULT, MLX5_IB_FLOW_TYPE_MC_DEFAULT, }; enum mlx5_ib_create_flow_flags { MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DEFAULT_MISS = 1 << 0, MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP = 1 << 1, }; enum mlx5_ib_create_flow_attrs { MLX5_IB_ATTR_CREATE_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE, MLX5_IB_ATTR_CREATE_FLOW_DEST_QP, MLX5_IB_ATTR_CREATE_FLOW_DEST_DEVX, MLX5_IB_ATTR_CREATE_FLOW_MATCHER, MLX5_IB_ATTR_CREATE_FLOW_ARR_FLOW_ACTIONS, MLX5_IB_ATTR_CREATE_FLOW_TAG, MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX, MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET, MLX5_IB_ATTR_CREATE_FLOW_FLAGS, }; enum mlx5_ib_destoy_flow_attrs { MLX5_IB_ATTR_DESTROY_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_flow_methods { MLX5_IB_METHOD_CREATE_FLOW = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_DESTROY_FLOW, }; enum mlx5_ib_flow_action_methods { MLX5_IB_METHOD_FLOW_ACTION_CREATE_MODIFY_HEADER = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_METHOD_FLOW_ACTION_CREATE_PACKET_REFORMAT, }; enum mlx5_ib_create_flow_action_create_modify_header_attrs { MLX5_IB_ATTR_CREATE_MODIFY_HEADER_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_CREATE_MODIFY_HEADER_ACTIONS_PRM, MLX5_IB_ATTR_CREATE_MODIFY_HEADER_FT_TYPE, }; enum mlx5_ib_create_flow_action_create_packet_reformat_attrs { MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_TYPE, MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_FT_TYPE, MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_DATA_BUF, }; enum mlx5_ib_query_pd_attrs { MLX5_IB_ATTR_QUERY_PD_HANDLE = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_QUERY_PD_RESP_PDN, }; enum mlx5_ib_pd_methods { MLX5_IB_METHOD_PD_QUERY = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_device_methods { MLX5_IB_METHOD_QUERY_PORT = (1U << UVERBS_ID_NS_SHIFT), }; enum mlx5_ib_query_port_attrs { MLX5_IB_ATTR_QUERY_PORT_PORT_NUM = (1U << UVERBS_ID_NS_SHIFT), MLX5_IB_ATTR_QUERY_PORT, }; #endif rdma/mlx5_user_ioctl_verbs.h 0000644 00000006777 15063602061 0012176 0 ustar 00 /* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX5_USER_IOCTL_VERBS_H #define MLX5_USER_IOCTL_VERBS_H #include <linux/types.h> enum mlx5_ib_uapi_flow_action_flags { MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA = 1 << 0, }; enum mlx5_ib_uapi_flow_table_type { MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_RX = 0x0, MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX = 0x1, MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB = 0x2, MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX = 0x3, MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX = 0x4, }; enum mlx5_ib_uapi_flow_action_packet_reformat_type { MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 = 0x0, MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL = 0x1, MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2 = 0x2, MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL = 0x3, }; struct mlx5_ib_uapi_devx_async_cmd_hdr { __aligned_u64 wr_id; __u8 out_data[]; }; enum mlx5_ib_uapi_dm_type { MLX5_IB_UAPI_DM_TYPE_MEMIC, MLX5_IB_UAPI_DM_TYPE_STEERING_SW_ICM, MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM, MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_PATTERN_SW_ICM, }; enum mlx5_ib_uapi_devx_create_event_channel_flags { MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0, }; struct mlx5_ib_uapi_devx_async_event_hdr { __aligned_u64 cookie; __u8 out_data[]; }; enum mlx5_ib_uapi_pp_alloc_flags { MLX5_IB_UAPI_PP_ALLOC_FLAGS_DEDICATED_INDEX = 1 << 0, }; enum mlx5_ib_uapi_uar_alloc_type { MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF = 0x0, MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC = 0x1, }; enum mlx5_ib_uapi_query_port_flags { MLX5_IB_UAPI_QUERY_PORT_VPORT = 1 << 0, MLX5_IB_UAPI_QUERY_PORT_VPORT_VHCA_ID = 1 << 1, MLX5_IB_UAPI_QUERY_PORT_VPORT_STEERING_ICM_RX = 1 << 2, MLX5_IB_UAPI_QUERY_PORT_VPORT_STEERING_ICM_TX = 1 << 3, MLX5_IB_UAPI_QUERY_PORT_VPORT_REG_C0 = 1 << 4, MLX5_IB_UAPI_QUERY_PORT_ESW_OWNER_VHCA_ID = 1 << 5, }; struct mlx5_ib_uapi_reg { __u32 value; __u32 mask; }; struct mlx5_ib_uapi_query_port { __aligned_u64 flags; __u16 vport; __u16 vport_vhca_id; __u16 esw_owner_vhca_id; __u16 rsvd0; __aligned_u64 vport_steering_icm_rx; __aligned_u64 vport_steering_icm_tx; struct mlx5_ib_uapi_reg reg_c0; }; #endif rdma/mthca-abi.h 0000644 00000005757 15063602061 0007502 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MTHCA_ABI_USER_H #define MTHCA_ABI_USER_H #include <linux/types.h> /* * Increment this value if any changes that break userspace ABI * compatibility are made. */ #define MTHCA_UVERBS_ABI_VERSION 1 /* * Make sure that all structs defined in this file remain laid out so * that they pack the same way on 32-bit and 64-bit architectures (to * avoid incompatibility between 32-bit userspace and 64-bit kernels). * In particular do not use pointer types -- pass pointers in __u64 * instead. */ struct mthca_alloc_ucontext_resp { __u32 qp_tab_size; __u32 uarc_size; }; struct mthca_alloc_pd_resp { __u32 pdn; __u32 reserved; }; /* * Mark the memory region with a DMA attribute that causes * in-flight DMA to be flushed when the region is written to: */ #define MTHCA_MR_DMASYNC 0x1 struct mthca_reg_mr { __u32 mr_attrs; __u32 reserved; }; struct mthca_create_cq { __u32 lkey; __u32 pdn; __aligned_u64 arm_db_page; __aligned_u64 set_db_page; __u32 arm_db_index; __u32 set_db_index; }; struct mthca_create_cq_resp { __u32 cqn; __u32 reserved; }; struct mthca_resize_cq { __u32 lkey; __u32 reserved; }; struct mthca_create_srq { __u32 lkey; __u32 db_index; __aligned_u64 db_page; }; struct mthca_create_srq_resp { __u32 srqn; __u32 reserved; }; struct mthca_create_qp { __u32 lkey; __u32 reserved; __aligned_u64 sq_db_page; __aligned_u64 rq_db_page; __u32 sq_db_index; __u32 rq_db_index; }; #endif /* MTHCA_ABI_USER_H */ rdma/ocrdma-abi.h 0000644 00000010024 15063602061 0007632 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* This file is part of the Emulex RoCE Device Driver for * RoCE (RDMA over Converged Ethernet) adapters. * Copyright (C) 2012-2015 Emulex. All rights reserved. * EMULEX and SLI are trademarks of Emulex. * www.emulex.com * * This software is available to you under a choice of one of two licenses. * You may choose to be licensed under the terms of the GNU General Public * License (GPL) Version 2, available from the file COPYING in the main * directory of this source tree, or the BSD license below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Contact Information: * linux-drivers@emulex.com * * Emulex * 3333 Susan Street * Costa Mesa, CA 92626 */ #ifndef OCRDMA_ABI_USER_H #define OCRDMA_ABI_USER_H #include <linux/types.h> #define OCRDMA_ABI_VERSION 2 #define OCRDMA_BE_ROCE_ABI_VERSION 1 /* user kernel communication data structures. */ struct ocrdma_alloc_ucontext_resp { __u32 dev_id; __u32 wqe_size; __u32 max_inline_data; __u32 dpp_wqe_size; __aligned_u64 ah_tbl_page; __u32 ah_tbl_len; __u32 rqe_size; __u8 fw_ver[32]; /* for future use/new features in progress */ __aligned_u64 rsvd1; __aligned_u64 rsvd2; }; struct ocrdma_alloc_pd_ureq { __u32 rsvd[2]; }; struct ocrdma_alloc_pd_uresp { __u32 id; __u32 dpp_enabled; __u32 dpp_page_addr_hi; __u32 dpp_page_addr_lo; __u32 rsvd[2]; }; struct ocrdma_create_cq_ureq { __u32 dpp_cq; __u32 rsvd; /* pad */ }; #define MAX_CQ_PAGES 8 struct ocrdma_create_cq_uresp { __u32 cq_id; __u32 page_size; __u32 num_pages; __u32 max_hw_cqe; __aligned_u64 page_addr[MAX_CQ_PAGES]; __aligned_u64 db_page_addr; __u32 db_page_size; __u32 phase_change; /* for future use/new features in progress */ __aligned_u64 rsvd1; __aligned_u64 rsvd2; }; #define MAX_QP_PAGES 8 #define MAX_UD_AV_PAGES 8 struct ocrdma_create_qp_ureq { __u8 enable_dpp_cq; __u8 rsvd; __u16 dpp_cq_id; __u32 rsvd1; /* pad */ }; struct ocrdma_create_qp_uresp { __u16 qp_id; __u16 sq_dbid; __u16 rq_dbid; __u16 resv0; /* pad */ __u32 sq_page_size; __u32 rq_page_size; __u32 num_sq_pages; __u32 num_rq_pages; __aligned_u64 sq_page_addr[MAX_QP_PAGES]; __aligned_u64 rq_page_addr[MAX_QP_PAGES]; __aligned_u64 db_page_addr; __u32 db_page_size; __u32 dpp_credit; __u32 dpp_offset; __u32 num_wqe_allocated; __u32 num_rqe_allocated; __u32 db_sq_offset; __u32 db_rq_offset; __u32 db_shift; __aligned_u64 rsvd[11]; }; struct ocrdma_create_srq_uresp { __u16 rq_dbid; __u16 resv0; /* pad */ __u32 resv1; __u32 rq_page_size; __u32 num_rq_pages; __aligned_u64 rq_page_addr[MAX_QP_PAGES]; __aligned_u64 db_page_addr; __u32 db_page_size; __u32 num_rqe_allocated; __u32 db_rq_offset; __u32 db_shift; __aligned_u64 rsvd2; __aligned_u64 rsvd3; }; #endif /* OCRDMA_ABI_USER_H */ rdma/qedr-abi.h 0000644 00000010323 15063602061 0007322 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* QLogic qedr NIC Driver * Copyright (c) 2015-2016 QLogic Corporation * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and /or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef __QEDR_USER_H__ #define __QEDR_USER_H__ #include <linux/types.h> #define QEDR_ABI_VERSION (8) /* user kernel communication data structures. */ enum qedr_alloc_ucontext_flags { QEDR_ALLOC_UCTX_EDPM_MODE = 1 << 0, QEDR_ALLOC_UCTX_DB_REC = 1 << 1, QEDR_SUPPORT_DPM_SIZES = 1 << 2, }; struct qedr_alloc_ucontext_req { __u32 context_flags; __u32 reserved; }; #define QEDR_LDPM_MAX_SIZE (8192) #define QEDR_EDPM_TRANS_SIZE (64) #define QEDR_EDPM_MAX_SIZE (ROCE_REQ_MAX_INLINE_DATA_SIZE) enum qedr_rdma_dpm_type { QEDR_DPM_TYPE_NONE = 0, QEDR_DPM_TYPE_ROCE_ENHANCED = 1 << 0, QEDR_DPM_TYPE_ROCE_LEGACY = 1 << 1, QEDR_DPM_TYPE_IWARP_LEGACY = 1 << 2, QEDR_DPM_TYPE_ROCE_EDPM_MODE = 1 << 3, QEDR_DPM_SIZES_SET = 1 << 4, }; struct qedr_alloc_ucontext_resp { __aligned_u64 db_pa; __u32 db_size; __u32 max_send_wr; __u32 max_recv_wr; __u32 max_srq_wr; __u32 sges_per_send_wr; __u32 sges_per_recv_wr; __u32 sges_per_srq_wr; __u32 max_cqes; __u8 dpm_flags; __u8 wids_enabled; __u16 wid_count; __u16 ldpm_limit_size; __u8 edpm_trans_size; __u8 reserved; __u16 edpm_limit_size; __u8 padding[6]; }; struct qedr_alloc_pd_ureq { __aligned_u64 rsvd1; }; struct qedr_alloc_pd_uresp { __u32 pd_id; __u32 reserved; }; struct qedr_create_cq_ureq { __aligned_u64 addr; __aligned_u64 len; }; struct qedr_create_cq_uresp { __u32 db_offset; __u16 icid; __u16 reserved; __aligned_u64 db_rec_addr; }; struct qedr_create_qp_ureq { __u32 qp_handle_hi; __u32 qp_handle_lo; /* SQ */ /* user space virtual address of SQ buffer */ __aligned_u64 sq_addr; /* length of SQ buffer */ __aligned_u64 sq_len; /* RQ */ /* user space virtual address of RQ buffer */ __aligned_u64 rq_addr; /* length of RQ buffer */ __aligned_u64 rq_len; }; struct qedr_create_qp_uresp { __u32 qp_id; __u32 atomic_supported; /* SQ */ __u32 sq_db_offset; __u16 sq_icid; /* RQ */ __u32 rq_db_offset; __u16 rq_icid; __u32 rq_db2_offset; __u32 reserved; /* address of SQ doorbell recovery user entry */ __aligned_u64 sq_db_rec_addr; /* address of RQ doorbell recovery user entry */ __aligned_u64 rq_db_rec_addr; }; struct qedr_create_srq_ureq { /* user space virtual address of producer pair */ __aligned_u64 prod_pair_addr; /* user space virtual address of SRQ buffer */ __aligned_u64 srq_addr; /* length of SRQ buffer */ __aligned_u64 srq_len; }; struct qedr_create_srq_uresp { __u16 srq_id; __u16 reserved0; __u32 reserved1; }; /* doorbell recovery entry allocated and populated by userspace doorbelling * entities and mapped to kernel. Kernel uses this to register doorbell * information with doorbell drop recovery mechanism. */ struct qedr_user_db_rec { __aligned_u64 db_data; /* doorbell data */ }; #endif /* __QEDR_USER_H__ */ rdma/rdma_netlink.h 0000644 00000035213 15063602061 0010312 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _RDMA_NETLINK_H #define _RDMA_NETLINK_H #include <linux/types.h> enum { RDMA_NL_IWCM = 2, RDMA_NL_RSVD, RDMA_NL_LS, /* RDMA Local Services */ RDMA_NL_NLDEV, /* RDMA device interface */ RDMA_NL_NUM_CLIENTS }; enum { RDMA_NL_GROUP_IWPM = 2, RDMA_NL_GROUP_LS, RDMA_NL_NUM_GROUPS }; #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op) /* The minimum version that the iwpm kernel supports */ #define IWPM_UABI_VERSION_MIN 3 /* The latest version that the iwpm kernel supports */ #define IWPM_UABI_VERSION 4 /* iwarp port mapper message flags */ enum { /* Do not map the port for this IWPM request */ IWPM_FLAGS_NO_PORT_MAP = (1 << 0), }; /* iwarp port mapper op-codes */ enum { RDMA_NL_IWPM_REG_PID = 0, RDMA_NL_IWPM_ADD_MAPPING, RDMA_NL_IWPM_QUERY_MAPPING, RDMA_NL_IWPM_REMOVE_MAPPING, RDMA_NL_IWPM_REMOTE_INFO, RDMA_NL_IWPM_HANDLE_ERR, RDMA_NL_IWPM_MAPINFO, RDMA_NL_IWPM_MAPINFO_NUM, RDMA_NL_IWPM_HELLO, RDMA_NL_IWPM_NUM_OPS }; enum { IWPM_NLA_REG_PID_UNSPEC = 0, IWPM_NLA_REG_PID_SEQ, IWPM_NLA_REG_IF_NAME, IWPM_NLA_REG_IBDEV_NAME, IWPM_NLA_REG_ULIB_NAME, IWPM_NLA_REG_PID_MAX }; enum { IWPM_NLA_RREG_PID_UNSPEC = 0, IWPM_NLA_RREG_PID_SEQ, IWPM_NLA_RREG_IBDEV_NAME, IWPM_NLA_RREG_ULIB_NAME, IWPM_NLA_RREG_ULIB_VER, IWPM_NLA_RREG_PID_ERR, IWPM_NLA_RREG_PID_MAX }; enum { IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0, IWPM_NLA_MANAGE_MAPPING_SEQ, IWPM_NLA_MANAGE_ADDR, IWPM_NLA_MANAGE_FLAGS, IWPM_NLA_MANAGE_MAPPING_MAX }; enum { IWPM_NLA_RMANAGE_MAPPING_UNSPEC = 0, IWPM_NLA_RMANAGE_MAPPING_SEQ, IWPM_NLA_RMANAGE_ADDR, IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR, /* The following maintains bisectability of rdma-core */ IWPM_NLA_MANAGE_MAPPED_LOC_ADDR = IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR, IWPM_NLA_RMANAGE_MAPPING_ERR, IWPM_NLA_RMANAGE_MAPPING_MAX }; #define IWPM_NLA_MAPINFO_SEND_MAX 3 #define IWPM_NLA_REMOVE_MAPPING_MAX 3 enum { IWPM_NLA_QUERY_MAPPING_UNSPEC = 0, IWPM_NLA_QUERY_MAPPING_SEQ, IWPM_NLA_QUERY_LOCAL_ADDR, IWPM_NLA_QUERY_REMOTE_ADDR, IWPM_NLA_QUERY_FLAGS, IWPM_NLA_QUERY_MAPPING_MAX, }; enum { IWPM_NLA_RQUERY_MAPPING_UNSPEC = 0, IWPM_NLA_RQUERY_MAPPING_SEQ, IWPM_NLA_RQUERY_LOCAL_ADDR, IWPM_NLA_RQUERY_REMOTE_ADDR, IWPM_NLA_RQUERY_MAPPED_LOC_ADDR, IWPM_NLA_RQUERY_MAPPED_REM_ADDR, IWPM_NLA_RQUERY_MAPPING_ERR, IWPM_NLA_RQUERY_MAPPING_MAX }; enum { IWPM_NLA_MAPINFO_REQ_UNSPEC = 0, IWPM_NLA_MAPINFO_ULIB_NAME, IWPM_NLA_MAPINFO_ULIB_VER, IWPM_NLA_MAPINFO_REQ_MAX }; enum { IWPM_NLA_MAPINFO_UNSPEC = 0, IWPM_NLA_MAPINFO_LOCAL_ADDR, IWPM_NLA_MAPINFO_MAPPED_ADDR, IWPM_NLA_MAPINFO_FLAGS, IWPM_NLA_MAPINFO_MAX }; enum { IWPM_NLA_MAPINFO_NUM_UNSPEC = 0, IWPM_NLA_MAPINFO_SEQ, IWPM_NLA_MAPINFO_SEND_NUM, IWPM_NLA_MAPINFO_ACK_NUM, IWPM_NLA_MAPINFO_NUM_MAX }; enum { IWPM_NLA_ERR_UNSPEC = 0, IWPM_NLA_ERR_SEQ, IWPM_NLA_ERR_CODE, IWPM_NLA_ERR_MAX }; enum { IWPM_NLA_HELLO_UNSPEC = 0, IWPM_NLA_HELLO_ABI_VERSION, IWPM_NLA_HELLO_MAX }; /* For RDMA_NLDEV_ATTR_DEV_NODE_TYPE */ enum { /* IB values map to NodeInfo:NodeType. */ RDMA_NODE_IB_CA = 1, RDMA_NODE_IB_SWITCH, RDMA_NODE_IB_ROUTER, RDMA_NODE_RNIC, RDMA_NODE_USNIC, RDMA_NODE_USNIC_UDP, RDMA_NODE_UNSPECIFIED, }; /* * Local service operations: * RESOLVE - The client requests the local service to resolve a path. * SET_TIMEOUT - The local service requests the client to set the timeout. * IP_RESOLVE - The client requests the local service to resolve an IP to GID. */ enum { RDMA_NL_LS_OP_RESOLVE = 0, RDMA_NL_LS_OP_SET_TIMEOUT, RDMA_NL_LS_OP_IP_RESOLVE, RDMA_NL_LS_NUM_OPS }; /* Local service netlink message flags */ #define RDMA_NL_LS_F_ERR 0x0100 /* Failed response */ /* * Local service resolve operation family header. * The layout for the resolve operation: * nlmsg header * family header * attributes */ /* * Local service path use: * Specify how the path(s) will be used. * ALL - For connected CM operation (6 pathrecords) * UNIDIRECTIONAL - For unidirectional UD (1 pathrecord) * GMP - For miscellaneous GMP like operation (at least 1 reversible * pathrecord) */ enum { LS_RESOLVE_PATH_USE_ALL = 0, LS_RESOLVE_PATH_USE_UNIDIRECTIONAL, LS_RESOLVE_PATH_USE_GMP, LS_RESOLVE_PATH_USE_MAX }; #define LS_DEVICE_NAME_MAX 64 struct rdma_ls_resolve_header { __u8 device_name[LS_DEVICE_NAME_MAX]; __u8 port_num; __u8 path_use; }; struct rdma_ls_ip_resolve_header { __u32 ifindex; }; /* Local service attribute type */ #define RDMA_NLA_F_MANDATORY (1 << 13) #define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \ RDMA_NLA_F_MANDATORY)) /* * Local service attributes: * Attr Name Size Byte order * ----------------------------------------------------- * PATH_RECORD struct ib_path_rec_data * TIMEOUT u32 cpu * SERVICE_ID u64 cpu * DGID u8[16] BE * SGID u8[16] BE * TCLASS u8 * PKEY u16 cpu * QOS_CLASS u16 cpu * IPV4 u32 BE * IPV6 u8[16] BE */ enum { LS_NLA_TYPE_UNSPEC = 0, LS_NLA_TYPE_PATH_RECORD, LS_NLA_TYPE_TIMEOUT, LS_NLA_TYPE_SERVICE_ID, LS_NLA_TYPE_DGID, LS_NLA_TYPE_SGID, LS_NLA_TYPE_TCLASS, LS_NLA_TYPE_PKEY, LS_NLA_TYPE_QOS_CLASS, LS_NLA_TYPE_IPV4, LS_NLA_TYPE_IPV6, LS_NLA_TYPE_MAX }; /* Local service DGID/SGID attribute: big endian */ struct rdma_nla_ls_gid { __u8 gid[16]; }; enum rdma_nldev_command { RDMA_NLDEV_CMD_UNSPEC, RDMA_NLDEV_CMD_GET, /* can dump */ RDMA_NLDEV_CMD_SET, RDMA_NLDEV_CMD_NEWLINK, RDMA_NLDEV_CMD_DELLINK, RDMA_NLDEV_CMD_PORT_GET, /* can dump */ RDMA_NLDEV_CMD_SYS_GET, RDMA_NLDEV_CMD_SYS_SET, /* 8 is free to use */ RDMA_NLDEV_CMD_RES_GET = 9, /* can dump */ RDMA_NLDEV_CMD_RES_QP_GET, /* can dump */ RDMA_NLDEV_CMD_RES_CM_ID_GET, /* can dump */ RDMA_NLDEV_CMD_RES_CQ_GET, /* can dump */ RDMA_NLDEV_CMD_RES_MR_GET, /* can dump */ RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */ RDMA_NLDEV_CMD_GET_CHARDEV, RDMA_NLDEV_CMD_STAT_SET, RDMA_NLDEV_CMD_STAT_GET, /* can dump */ RDMA_NLDEV_CMD_STAT_DEL, RDMA_NLDEV_CMD_RES_QP_GET_RAW, RDMA_NLDEV_CMD_RES_CQ_GET_RAW, RDMA_NLDEV_CMD_RES_MR_GET_RAW, RDMA_NLDEV_CMD_RES_CTX_GET, /* can dump */ RDMA_NLDEV_CMD_RES_SRQ_GET, /* can dump */ RDMA_NLDEV_CMD_STAT_GET_STATUS, RDMA_NLDEV_NUM_OPS }; enum rdma_nldev_print_type { RDMA_NLDEV_PRINT_TYPE_UNSPEC, RDMA_NLDEV_PRINT_TYPE_HEX, }; enum rdma_nldev_attr { /* don't change the order or add anything between, this is ABI! */ RDMA_NLDEV_ATTR_UNSPEC, /* Pad attribute for 64b alignment */ RDMA_NLDEV_ATTR_PAD = RDMA_NLDEV_ATTR_UNSPEC, /* Identifier for ib_device */ RDMA_NLDEV_ATTR_DEV_INDEX, /* u32 */ RDMA_NLDEV_ATTR_DEV_NAME, /* string */ /* * Device index together with port index are identifiers * for port/link properties. * * For RDMA_NLDEV_CMD_GET commamnd, port index will return number * of available ports in ib_device, while for port specific operations, * it will be real port index as it appears in sysfs. Port index follows * sysfs notation and starts from 1 for the first port. */ RDMA_NLDEV_ATTR_PORT_INDEX, /* u32 */ /* * Device and port capabilities * * When used for port info, first 32-bits are CapabilityMask followed by * 16-bit CapabilityMask2. */ RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */ /* * FW version */ RDMA_NLDEV_ATTR_FW_VERSION, /* string */ /* * Node GUID (in host byte order) associated with the RDMA device. */ RDMA_NLDEV_ATTR_NODE_GUID, /* u64 */ /* * System image GUID (in host byte order) associated with * this RDMA device and other devices which are part of a * single system. */ RDMA_NLDEV_ATTR_SYS_IMAGE_GUID, /* u64 */ /* * Subnet prefix (in host byte order) */ RDMA_NLDEV_ATTR_SUBNET_PREFIX, /* u64 */ /* * Local Identifier (LID), * According to IB specification, It is 16-bit address assigned * by the Subnet Manager. Extended to be 32-bit for OmniPath users. */ RDMA_NLDEV_ATTR_LID, /* u32 */ RDMA_NLDEV_ATTR_SM_LID, /* u32 */ /* * LID mask control (LMC) */ RDMA_NLDEV_ATTR_LMC, /* u8 */ RDMA_NLDEV_ATTR_PORT_STATE, /* u8 */ RDMA_NLDEV_ATTR_PORT_PHYS_STATE, /* u8 */ RDMA_NLDEV_ATTR_DEV_NODE_TYPE, /* u8 */ RDMA_NLDEV_ATTR_RES_SUMMARY, /* nested table */ RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME, /* string */ RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR, /* u64 */ RDMA_NLDEV_ATTR_RES_QP, /* nested table */ RDMA_NLDEV_ATTR_RES_QP_ENTRY, /* nested table */ /* * Local QPN */ RDMA_NLDEV_ATTR_RES_LQPN, /* u32 */ /* * Remote QPN, * Applicable for RC and UC only IBTA 11.2.5.3 QUERY QUEUE PAIR */ RDMA_NLDEV_ATTR_RES_RQPN, /* u32 */ /* * Receive Queue PSN, * Applicable for RC and UC only 11.2.5.3 QUERY QUEUE PAIR */ RDMA_NLDEV_ATTR_RES_RQ_PSN, /* u32 */ /* * Send Queue PSN */ RDMA_NLDEV_ATTR_RES_SQ_PSN, /* u32 */ RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE, /* u8 */ /* * QP types as visible to RDMA/core, the reserved QPT * are not exported through this interface. */ RDMA_NLDEV_ATTR_RES_TYPE, /* u8 */ RDMA_NLDEV_ATTR_RES_STATE, /* u8 */ /* * Process ID which created object, * in case of kernel origin, PID won't exist. */ RDMA_NLDEV_ATTR_RES_PID, /* u32 */ /* * The name of process created following resource. * It will exist only for kernel objects. * For user created objects, the user is supposed * to read /proc/PID/comm file. */ RDMA_NLDEV_ATTR_RES_KERN_NAME, /* string */ RDMA_NLDEV_ATTR_RES_CM_ID, /* nested table */ RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY, /* nested table */ /* * rdma_cm_id port space. */ RDMA_NLDEV_ATTR_RES_PS, /* u32 */ /* * Source and destination socket addresses */ RDMA_NLDEV_ATTR_RES_SRC_ADDR, /* __kernel_sockaddr_storage */ RDMA_NLDEV_ATTR_RES_DST_ADDR, /* __kernel_sockaddr_storage */ RDMA_NLDEV_ATTR_RES_CQ, /* nested table */ RDMA_NLDEV_ATTR_RES_CQ_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_CQE, /* u32 */ RDMA_NLDEV_ATTR_RES_USECNT, /* u64 */ RDMA_NLDEV_ATTR_RES_POLL_CTX, /* u8 */ RDMA_NLDEV_ATTR_RES_MR, /* nested table */ RDMA_NLDEV_ATTR_RES_MR_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_RKEY, /* u32 */ RDMA_NLDEV_ATTR_RES_LKEY, /* u32 */ RDMA_NLDEV_ATTR_RES_IOVA, /* u64 */ RDMA_NLDEV_ATTR_RES_MRLEN, /* u64 */ RDMA_NLDEV_ATTR_RES_PD, /* nested table */ RDMA_NLDEV_ATTR_RES_PD_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY, /* u32 */ RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, /* u32 */ /* * Provides logical name and index of netdevice which is * connected to physical port. This information is relevant * for RoCE and iWARP. * * The netdevices which are associated with containers are * supposed to be exported together with GID table once it * will be exposed through the netlink. Because the * associated netdevices are properties of GIDs. */ RDMA_NLDEV_ATTR_NDEV_INDEX, /* u32 */ RDMA_NLDEV_ATTR_NDEV_NAME, /* string */ /* * driver-specific attributes. */ RDMA_NLDEV_ATTR_DRIVER, /* nested table */ RDMA_NLDEV_ATTR_DRIVER_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_DRIVER_STRING, /* string */ /* * u8 values from enum rdma_nldev_print_type */ RDMA_NLDEV_ATTR_DRIVER_PRINT_TYPE, /* u8 */ RDMA_NLDEV_ATTR_DRIVER_S32, /* s32 */ RDMA_NLDEV_ATTR_DRIVER_U32, /* u32 */ RDMA_NLDEV_ATTR_DRIVER_S64, /* s64 */ RDMA_NLDEV_ATTR_DRIVER_U64, /* u64 */ /* * Indexes to get/set secific entry, * for QP use RDMA_NLDEV_ATTR_RES_LQPN */ RDMA_NLDEV_ATTR_RES_PDN, /* u32 */ RDMA_NLDEV_ATTR_RES_CQN, /* u32 */ RDMA_NLDEV_ATTR_RES_MRN, /* u32 */ RDMA_NLDEV_ATTR_RES_CM_IDN, /* u32 */ RDMA_NLDEV_ATTR_RES_CTXN, /* u32 */ /* * Identifies the rdma driver. eg: "rxe" or "siw" */ RDMA_NLDEV_ATTR_LINK_TYPE, /* string */ /* * net namespace mode for rdma subsystem: * either shared or exclusive among multiple net namespaces. */ RDMA_NLDEV_SYS_ATTR_NETNS_MODE, /* u8 */ /* * Device protocol, e.g. ib, iw, usnic, roce and opa */ RDMA_NLDEV_ATTR_DEV_PROTOCOL, /* string */ /* * File descriptor handle of the net namespace object */ RDMA_NLDEV_NET_NS_FD, /* u32 */ /* * Information about a chardev. * CHARDEV_TYPE is the name of the chardev ABI (ie uverbs, umad, etc) * CHARDEV_ABI signals the ABI revision (historical) * CHARDEV_NAME is the kernel name for the /dev/ file (no directory) * CHARDEV is the 64 bit dev_t for the inode */ RDMA_NLDEV_ATTR_CHARDEV_TYPE, /* string */ RDMA_NLDEV_ATTR_CHARDEV_NAME, /* string */ RDMA_NLDEV_ATTR_CHARDEV_ABI, /* u64 */ RDMA_NLDEV_ATTR_CHARDEV, /* u64 */ RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID, /* u64 */ /* * Counter-specific attributes. */ RDMA_NLDEV_ATTR_STAT_MODE, /* u32 */ RDMA_NLDEV_ATTR_STAT_RES, /* u32 */ RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK, /* u32 */ RDMA_NLDEV_ATTR_STAT_COUNTER, /* nested table */ RDMA_NLDEV_ATTR_STAT_COUNTER_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_STAT_COUNTER_ID, /* u32 */ RDMA_NLDEV_ATTR_STAT_HWCOUNTERS, /* nested table */ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME, /* string */ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE, /* u64 */ /* * CQ adaptive moderatio (DIM) */ RDMA_NLDEV_ATTR_DEV_DIM, /* u8 */ RDMA_NLDEV_ATTR_RES_RAW, /* binary */ RDMA_NLDEV_ATTR_RES_CTX, /* nested table */ RDMA_NLDEV_ATTR_RES_CTX_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_SRQ, /* nested table */ RDMA_NLDEV_ATTR_RES_SRQ_ENTRY, /* nested table */ RDMA_NLDEV_ATTR_RES_SRQN, /* u32 */ RDMA_NLDEV_ATTR_MIN_RANGE, /* u32 */ RDMA_NLDEV_ATTR_MAX_RANGE, /* u32 */ RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, /* u8 */ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX, /* u32 */ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC, /* u8 */ /* * Always the end */ RDMA_NLDEV_ATTR_MAX }; /* * Supported counter bind modes. All modes are mutual-exclusive. */ enum rdma_nl_counter_mode { RDMA_COUNTER_MODE_NONE, /* * A qp is bound with a counter automatically during initialization * based on the auto mode (e.g., qp type, ...) */ RDMA_COUNTER_MODE_AUTO, /* * Which qp are bound with which counter is explicitly specified * by the user */ RDMA_COUNTER_MODE_MANUAL, /* * Always the end */ RDMA_COUNTER_MODE_MAX, }; /* * Supported criteria in counter auto mode. * Currently only "qp type" is supported */ enum rdma_nl_counter_mask { RDMA_COUNTER_MASK_QP_TYPE = 1, RDMA_COUNTER_MASK_PID = 1 << 1, }; #endif /* _RDMA_NETLINK_H */ rdma/rdma_user_cm.h 0000644 00000015734 15063602061 0010311 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2005-2006 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_CM_H #define RDMA_USER_CM_H #include <linux/types.h> #include <linux/socket.h> #include <linux/in6.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_user_sa.h> #define RDMA_USER_CM_ABI_VERSION 4 #define RDMA_MAX_PRIVATE_DATA 256 enum { RDMA_USER_CM_CMD_CREATE_ID, RDMA_USER_CM_CMD_DESTROY_ID, RDMA_USER_CM_CMD_BIND_IP, RDMA_USER_CM_CMD_RESOLVE_IP, RDMA_USER_CM_CMD_RESOLVE_ROUTE, RDMA_USER_CM_CMD_QUERY_ROUTE, RDMA_USER_CM_CMD_CONNECT, RDMA_USER_CM_CMD_LISTEN, RDMA_USER_CM_CMD_ACCEPT, RDMA_USER_CM_CMD_REJECT, RDMA_USER_CM_CMD_DISCONNECT, RDMA_USER_CM_CMD_INIT_QP_ATTR, RDMA_USER_CM_CMD_GET_EVENT, RDMA_USER_CM_CMD_GET_OPTION, RDMA_USER_CM_CMD_SET_OPTION, RDMA_USER_CM_CMD_NOTIFY, RDMA_USER_CM_CMD_JOIN_IP_MCAST, RDMA_USER_CM_CMD_LEAVE_MCAST, RDMA_USER_CM_CMD_MIGRATE_ID, RDMA_USER_CM_CMD_QUERY, RDMA_USER_CM_CMD_BIND, RDMA_USER_CM_CMD_RESOLVE_ADDR, RDMA_USER_CM_CMD_JOIN_MCAST }; /* See IBTA Annex A11, servies ID bytes 4 & 5 */ enum rdma_ucm_port_space { RDMA_PS_IPOIB = 0x0002, RDMA_PS_IB = 0x013F, RDMA_PS_TCP = 0x0106, RDMA_PS_UDP = 0x0111, }; /* * command ABI structures. */ struct rdma_ucm_cmd_hdr { __u32 cmd; __u16 in; __u16 out; }; struct rdma_ucm_create_id { __aligned_u64 uid; __aligned_u64 response; __u16 ps; /* use enum rdma_ucm_port_space */ __u8 qp_type; __u8 reserved[5]; }; struct rdma_ucm_create_id_resp { __u32 id; }; struct rdma_ucm_destroy_id { __aligned_u64 response; __u32 id; __u32 reserved; }; struct rdma_ucm_destroy_id_resp { __u32 events_reported; }; struct rdma_ucm_bind_ip { __aligned_u64 response; struct sockaddr_in6 addr; __u32 id; }; struct rdma_ucm_bind { __u32 id; __u16 addr_size; __u16 reserved; struct __kernel_sockaddr_storage addr; }; struct rdma_ucm_resolve_ip { struct sockaddr_in6 src_addr; struct sockaddr_in6 dst_addr; __u32 id; __u32 timeout_ms; }; struct rdma_ucm_resolve_addr { __u32 id; __u32 timeout_ms; __u16 src_size; __u16 dst_size; __u32 reserved; struct __kernel_sockaddr_storage src_addr; struct __kernel_sockaddr_storage dst_addr; }; struct rdma_ucm_resolve_route { __u32 id; __u32 timeout_ms; }; enum { RDMA_USER_CM_QUERY_ADDR, RDMA_USER_CM_QUERY_PATH, RDMA_USER_CM_QUERY_GID }; struct rdma_ucm_query { __aligned_u64 response; __u32 id; __u32 option; }; struct rdma_ucm_query_route_resp { __aligned_u64 node_guid; struct ib_user_path_rec ib_route[2]; struct sockaddr_in6 src_addr; struct sockaddr_in6 dst_addr; __u32 num_paths; __u8 port_num; __u8 reserved[3]; __u32 ibdev_index; __u32 reserved1; }; struct rdma_ucm_query_addr_resp { __aligned_u64 node_guid; __u8 port_num; __u8 reserved; __u16 pkey; __u16 src_size; __u16 dst_size; struct __kernel_sockaddr_storage src_addr; struct __kernel_sockaddr_storage dst_addr; __u32 ibdev_index; __u32 reserved1; }; struct rdma_ucm_query_path_resp { __u32 num_paths; __u32 reserved; struct ib_path_rec_data path_data[]; }; struct rdma_ucm_conn_param { __u32 qp_num; __u32 qkey; __u8 private_data[RDMA_MAX_PRIVATE_DATA]; __u8 private_data_len; __u8 srq; __u8 responder_resources; __u8 initiator_depth; __u8 flow_control; __u8 retry_count; __u8 rnr_retry_count; __u8 valid; }; struct rdma_ucm_ud_param { __u32 qp_num; __u32 qkey; struct ib_uverbs_ah_attr ah_attr; __u8 private_data[RDMA_MAX_PRIVATE_DATA]; __u8 private_data_len; __u8 reserved[7]; }; struct rdma_ucm_ece { __u32 vendor_id; __u32 attr_mod; }; struct rdma_ucm_connect { struct rdma_ucm_conn_param conn_param; __u32 id; __u32 reserved; struct rdma_ucm_ece ece; }; struct rdma_ucm_listen { __u32 id; __u32 backlog; }; struct rdma_ucm_accept { __aligned_u64 uid; struct rdma_ucm_conn_param conn_param; __u32 id; __u32 reserved; struct rdma_ucm_ece ece; }; struct rdma_ucm_reject { __u32 id; __u8 private_data_len; __u8 reason; __u8 reserved[2]; __u8 private_data[RDMA_MAX_PRIVATE_DATA]; }; struct rdma_ucm_disconnect { __u32 id; }; struct rdma_ucm_init_qp_attr { __aligned_u64 response; __u32 id; __u32 qp_state; }; struct rdma_ucm_notify { __u32 id; __u32 event; }; struct rdma_ucm_join_ip_mcast { __aligned_u64 response; /* rdma_ucm_create_id_resp */ __aligned_u64 uid; struct sockaddr_in6 addr; __u32 id; }; /* Multicast join flags */ enum { RDMA_MC_JOIN_FLAG_FULLMEMBER, RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER, RDMA_MC_JOIN_FLAG_RESERVED, }; struct rdma_ucm_join_mcast { __aligned_u64 response; /* rdma_ucma_create_id_resp */ __aligned_u64 uid; __u32 id; __u16 addr_size; __u16 join_flags; struct __kernel_sockaddr_storage addr; }; struct rdma_ucm_get_event { __aligned_u64 response; }; struct rdma_ucm_event_resp { __aligned_u64 uid; __u32 id; __u32 event; __u32 status; /* * NOTE: This union is not aligned to 8 bytes so none of the union * members may contain a u64 or anything with higher alignment than 4. */ union { struct rdma_ucm_conn_param conn; struct rdma_ucm_ud_param ud; } param; __u32 reserved; struct rdma_ucm_ece ece; }; /* Option levels */ enum { RDMA_OPTION_ID = 0, RDMA_OPTION_IB = 1 }; /* Option details */ enum { RDMA_OPTION_ID_TOS = 0, RDMA_OPTION_ID_REUSEADDR = 1, RDMA_OPTION_ID_AFONLY = 2, RDMA_OPTION_ID_ACK_TIMEOUT = 3 }; enum { RDMA_OPTION_IB_PATH = 1 }; struct rdma_ucm_set_option { __aligned_u64 optval; __u32 id; __u32 level; __u32 optname; __u32 optlen; }; struct rdma_ucm_migrate_id { __aligned_u64 response; __u32 id; __u32 fd; }; struct rdma_ucm_migrate_resp { __u32 events_reported; }; #endif /* RDMA_USER_CM_H */ rdma/rdma_user_ioctl.h 0000644 00000007247 15063602061 0011024 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_IOCTL_H #define RDMA_USER_IOCTL_H #include <rdma/ib_user_mad.h> #include <rdma/hfi/hfi1_ioctl.h> #include <rdma/rdma_user_ioctl_cmds.h> /* Legacy name, for user space application which already use it */ #define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC /* * General blocks assignments * It is closed on purpose - do not expose it to user space * #define MAD_CMD_BASE 0x00 * #define HFI1_CMD_BAS 0xE0 */ /* MAD specific section */ #define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 0x01, struct ib_user_mad_reg_req) #define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 0x02, __u32) #define IB_USER_MAD_ENABLE_PKEY _IO(RDMA_IOCTL_MAGIC, 0x03) #define IB_USER_MAD_REGISTER_AGENT2 _IOWR(RDMA_IOCTL_MAGIC, 0x04, struct ib_user_mad_reg_req2) /* HFI specific section */ /* allocate HFI and context */ #define HFI1_IOCTL_ASSIGN_CTXT _IOWR(RDMA_IOCTL_MAGIC, 0xE1, struct hfi1_user_info) /* find out what resources we got */ #define HFI1_IOCTL_CTXT_INFO _IOW(RDMA_IOCTL_MAGIC, 0xE2, struct hfi1_ctxt_info) /* set up userspace */ #define HFI1_IOCTL_USER_INFO _IOW(RDMA_IOCTL_MAGIC, 0xE3, struct hfi1_base_info) /* update expected TID entries */ #define HFI1_IOCTL_TID_UPDATE _IOWR(RDMA_IOCTL_MAGIC, 0xE4, struct hfi1_tid_info) /* free expected TID entries */ #define HFI1_IOCTL_TID_FREE _IOWR(RDMA_IOCTL_MAGIC, 0xE5, struct hfi1_tid_info) /* force an update of PIO credit */ #define HFI1_IOCTL_CREDIT_UPD _IO(RDMA_IOCTL_MAGIC, 0xE6) /* control receipt of packets */ #define HFI1_IOCTL_RECV_CTRL _IOW(RDMA_IOCTL_MAGIC, 0xE8, int) /* set the kind of polling we want */ #define HFI1_IOCTL_POLL_TYPE _IOW(RDMA_IOCTL_MAGIC, 0xE9, int) /* ack & clear user status bits */ #define HFI1_IOCTL_ACK_EVENT _IOW(RDMA_IOCTL_MAGIC, 0xEA, unsigned long) /* set context's pkey */ #define HFI1_IOCTL_SET_PKEY _IOW(RDMA_IOCTL_MAGIC, 0xEB, __u16) /* reset context's HW send context */ #define HFI1_IOCTL_CTXT_RESET _IO(RDMA_IOCTL_MAGIC, 0xEC) /* read TID cache invalidations */ #define HFI1_IOCTL_TID_INVAL_READ _IOWR(RDMA_IOCTL_MAGIC, 0xED, struct hfi1_tid_info) /* get the version of the user cdev */ #define HFI1_IOCTL_GET_VERS _IOR(RDMA_IOCTL_MAGIC, 0xEE, int) #endif /* RDMA_USER_IOCTL_H */ rdma/rdma_user_ioctl_cmds.h 0000644 00000005057 15063602061 0012027 0 ustar 00 /* * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_IOCTL_CMDS_H #define RDMA_USER_IOCTL_CMDS_H #include <linux/types.h> #include <linux/ioctl.h> /* Documentation/ioctl/ioctl-number.txt */ #define RDMA_IOCTL_MAGIC 0x1b #define RDMA_VERBS_IOCTL \ _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr) enum { /* User input */ UVERBS_ATTR_F_MANDATORY = 1U << 0, /* * Valid output bit should be ignored and considered set in * mandatory fields. This bit is kernel output. */ UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1, }; struct ib_uverbs_attr { __u16 attr_id; /* command specific type attribute */ __u16 len; /* only for pointers and IDRs array */ __u16 flags; /* combination of UVERBS_ATTR_F_XXXX */ union { struct { __u8 elem_id; __u8 reserved; } enum_data; __u16 reserved; } attr_data; union { /* * ptr to command, __inline__ data, idr/fd or * ptr to __u32 array of IDRs */ __aligned_u64 data; /* Used by FD_IN and FD_OUT */ __s64 data_s64; }; }; struct ib_uverbs_ioctl_hdr { __u16 length; __u16 object_id; __u16 method_id; __u16 num_attrs; __aligned_u64 reserved1; __u32 driver_id; __u32 reserved2; struct ib_uverbs_attr attrs[]; }; #endif rdma/rdma_user_rxe.h 0000644 00000011253 15063602061 0010500 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ /* * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef RDMA_USER_RXE_H #define RDMA_USER_RXE_H #include <linux/types.h> #include <linux/socket.h> #include <linux/in.h> #include <linux/in6.h> enum { RXE_NETWORK_TYPE_IPV4 = 1, RXE_NETWORK_TYPE_IPV6 = 2, }; union rxe_gid { __u8 raw[16]; struct { __be64 subnet_prefix; __be64 interface_id; } global; }; struct rxe_global_route { union rxe_gid dgid; __u32 flow_label; __u8 sgid_index; __u8 hop_limit; __u8 traffic_class; }; struct rxe_av { __u8 port_num; /* From RXE_NETWORK_TYPE_* */ __u8 network_type; __u8 dmac[6]; struct rxe_global_route grh; union { struct sockaddr_in _sockaddr_in; struct sockaddr_in6 _sockaddr_in6; } sgid_addr, dgid_addr; }; struct rxe_send_wr { __aligned_u64 wr_id; __u32 num_sge; __u32 opcode; __u32 send_flags; union { __be32 imm_data; __u32 invalidate_rkey; } ex; union { struct { __aligned_u64 remote_addr; __u32 rkey; __u32 reserved; } rdma; struct { __aligned_u64 remote_addr; __aligned_u64 compare_add; __aligned_u64 swap; __u32 rkey; __u32 reserved; } atomic; struct { __u32 remote_qpn; __u32 remote_qkey; __u16 pkey_index; __u16 reserved; __u32 ah_num; __u32 pad[4]; struct rxe_av av; } ud; struct { __aligned_u64 addr; __aligned_u64 length; __u32 mr_lkey; __u32 mw_rkey; __u32 rkey; __u32 access; } mw; /* reg is only used by the kernel and is not part of the uapi */ } wr; }; struct rxe_sge { __aligned_u64 addr; __u32 length; __u32 lkey; }; struct mminfo { __aligned_u64 offset; __u32 size; __u32 pad; }; struct rxe_dma_info { __u32 length; __u32 resid; __u32 cur_sge; __u32 num_sge; __u32 sge_offset; __u32 reserved; union { __u8 inline_data[0]; struct rxe_sge sge[0]; }; }; struct rxe_send_wqe { struct rxe_send_wr wr; __u32 status; __u32 state; __aligned_u64 iova; __u32 mask; __u32 first_psn; __u32 last_psn; __u32 ack_length; __u32 ssn; __u32 has_rd_atomic; struct rxe_dma_info dma; }; struct rxe_recv_wqe { __aligned_u64 wr_id; __u32 num_sge; __u32 padding; struct rxe_dma_info dma; }; struct rxe_create_ah_resp { __u32 ah_num; __u32 reserved; }; struct rxe_create_cq_resp { struct mminfo mi; }; struct rxe_resize_cq_resp { struct mminfo mi; }; struct rxe_create_qp_resp { struct mminfo rq_mi; struct mminfo sq_mi; }; struct rxe_create_srq_resp { struct mminfo mi; __u32 srq_num; __u32 reserved; }; struct rxe_modify_srq_cmd { __aligned_u64 mmap_info_addr; }; /* This data structure is stored at the base of work and * completion queues shared between user space and kernel space. * It contains the producer and consumer indices. Is also * contains a copy of the queue size parameters for user space * to use but the kernel must use the parameters in the * rxe_queue struct. For performance reasons arrange to have * producer and consumer indices in separate cache lines * the kernel should always mask the indices to avoid accessing * memory outside of the data area */ struct rxe_queue_buf { __u32 log2_elem_size; __u32 index_mask; __u32 pad_1[30]; __u32 producer_index; __u32 pad_2[31]; __u32 consumer_index; __u32 pad_3[31]; __u8 data[]; }; #endif /* RDMA_USER_RXE_H */ rdma/rvt-abi.h 0000644 00000003321 15063602061 0007202 0 ustar 00 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ /* * This file contains defines, structures, etc. that are used * to communicate between kernel and user code. */ #ifndef RVT_ABI_USER_H #define RVT_ABI_USER_H #include <linux/types.h> #include <rdma/ib_user_verbs.h> #ifndef RDMA_ATOMIC_UAPI #define RDMA_ATOMIC_UAPI(_type, _name) struct{ _type val; } _name #endif struct rvt_wqe_sge { __aligned_u64 addr; __u32 length; __u32 lkey; }; /* * This structure is used to contain the head pointer, tail pointer, * and completion queue entries as a single memory allocation so * it can be mmap'ed into user space. */ struct rvt_cq_wc { /* index of next entry to fill */ RDMA_ATOMIC_UAPI(__u32, head); /* index of next ib_poll_cq() entry */ RDMA_ATOMIC_UAPI(__u32, tail); /* these are actually size ibcq.cqe + 1 */ struct ib_uverbs_wc uqueue[]; }; /* * Receive work request queue entry. * The size of the sg_list is determined when the QP (or SRQ) is created * and stored in qp->r_rq.max_sge (or srq->rq.max_sge). */ struct rvt_rwqe { __u64 wr_id; __u8 num_sge; __u8 padding[7]; struct rvt_wqe_sge sg_list[]; }; /* * This structure is used to contain the head pointer, tail pointer, * and receive work queue entries as a single memory allocation so * it can be mmap'ed into user space. * Note that the wq array elements are variable size so you can't * just index into the array to get the N'th element; * use get_rwqe_ptr() for user space and rvt_get_rwqe_ptr() * for kernel space. */ struct rvt_rwq { /* new work requests posted to the head */ RDMA_ATOMIC_UAPI(__u32, head); /* receives pull requests from here. */ RDMA_ATOMIC_UAPI(__u32, tail); struct rvt_rwqe wq[]; }; #endif /* RVT_ABI_USER_H */ rdma/siw-abi.h 0000644 00000006514 15063602061 0007200 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ /* Authors: Bernard Metzler <bmt@zurich.ibm.com> */ /* Copyright (c) 2008-2019, IBM Corporation */ #ifndef _SIW_USER_H #define _SIW_USER_H #include <linux/types.h> #define SIW_NODE_DESC_COMMON "Software iWARP stack" #define SIW_ABI_VERSION 1 #define SIW_MAX_SGE 6 #define SIW_UOBJ_MAX_KEY 0x08FFFF #define SIW_INVAL_UOBJ_KEY (SIW_UOBJ_MAX_KEY + 1) struct siw_uresp_create_cq { __u32 cq_id; __u32 num_cqe; __aligned_u64 cq_key; }; struct siw_uresp_create_qp { __u32 qp_id; __u32 num_sqe; __u32 num_rqe; __u32 pad; __aligned_u64 sq_key; __aligned_u64 rq_key; }; struct siw_ureq_reg_mr { __u8 stag_key; __u8 reserved[3]; __u32 pad; }; struct siw_uresp_reg_mr { __u32 stag; __u32 pad; }; struct siw_uresp_create_srq { __u32 num_rqe; __u32 pad; __aligned_u64 srq_key; }; struct siw_uresp_alloc_ctx { __u32 dev_id; __u32 pad; }; enum siw_opcode { SIW_OP_WRITE, SIW_OP_READ, SIW_OP_READ_LOCAL_INV, SIW_OP_SEND, SIW_OP_SEND_WITH_IMM, SIW_OP_SEND_REMOTE_INV, /* Unsupported */ SIW_OP_FETCH_AND_ADD, SIW_OP_COMP_AND_SWAP, SIW_OP_RECEIVE, /* provider internal SQE */ SIW_OP_READ_RESPONSE, /* * below opcodes valid for * in-kernel clients only */ SIW_OP_INVAL_STAG, SIW_OP_REG_MR, SIW_NUM_OPCODES }; /* Keep it same as ibv_sge to allow for memcpy */ struct siw_sge { __aligned_u64 laddr; __u32 length; __u32 lkey; }; /* * Inline data are kept within the work request itself occupying * the space of sge[1] .. sge[n]. Therefore, __inline__ data cannot be * supported if SIW_MAX_SGE is below 2 elements. */ #define SIW_MAX_INLINE (sizeof(struct siw_sge) * (SIW_MAX_SGE - 1)) #if SIW_MAX_SGE < 2 #error "SIW_MAX_SGE must be at least 2" #endif enum siw_wqe_flags { SIW_WQE_VALID = 1, SIW_WQE_INLINE = (1 << 1), SIW_WQE_SIGNALLED = (1 << 2), SIW_WQE_SOLICITED = (1 << 3), SIW_WQE_READ_FENCE = (1 << 4), SIW_WQE_REM_INVAL = (1 << 5), SIW_WQE_COMPLETED = (1 << 6) }; /* Send Queue Element */ struct siw_sqe { __aligned_u64 id; __u16 flags; __u8 num_sge; /* Contains enum siw_opcode values */ __u8 opcode; __u32 rkey; union { __aligned_u64 raddr; __aligned_u64 base_mr; }; union { struct siw_sge sge[SIW_MAX_SGE]; __aligned_u64 access; }; }; /* Receive Queue Element */ struct siw_rqe { __aligned_u64 id; __u16 flags; __u8 num_sge; /* * only used by kernel driver, * ignored if set by user */ __u8 opcode; __u32 unused; struct siw_sge sge[SIW_MAX_SGE]; }; enum siw_notify_flags { SIW_NOTIFY_NOT = (0), SIW_NOTIFY_SOLICITED = (1 << 0), SIW_NOTIFY_NEXT_COMPLETION = (1 << 1), SIW_NOTIFY_MISSED_EVENTS = (1 << 2), SIW_NOTIFY_ALL = SIW_NOTIFY_SOLICITED | SIW_NOTIFY_NEXT_COMPLETION | SIW_NOTIFY_MISSED_EVENTS }; enum siw_wc_status { SIW_WC_SUCCESS, SIW_WC_LOC_LEN_ERR, SIW_WC_LOC_PROT_ERR, SIW_WC_LOC_QP_OP_ERR, SIW_WC_WR_FLUSH_ERR, SIW_WC_BAD_RESP_ERR, SIW_WC_LOC_ACCESS_ERR, SIW_WC_REM_ACCESS_ERR, SIW_WC_REM_INV_REQ_ERR, SIW_WC_GENERAL_ERR, SIW_NUM_WC_STATUS }; struct siw_cqe { __aligned_u64 id; __u8 flags; __u8 opcode; __u16 status; __u32 bytes; union { __aligned_u64 imm_data; __u32 inval_stag; }; /* QP number or QP pointer */ union { struct ib_qp *base_qp; __aligned_u64 qp_id; }; }; /* * Shared structure between user and kernel * to control CQ arming. */ struct siw_cq_ctrl { __u32 flags; __u32 pad; }; #endif rdma/vmw_pvrdma-abi.h 0000644 00000017513 15063602061 0010561 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ /* * Copyright (c) 2012-2016 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of EITHER the GNU General Public License * version 2 as published by the Free Software Foundation or the BSD * 2-Clause License. This program is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License version 2 for more details at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html. * * You should have received a copy of the GNU General Public License * along with this program available in the file COPYING in the main * directory of this source tree. * * The BSD 2-Clause License * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __VMW_PVRDMA_ABI_H__ #define __VMW_PVRDMA_ABI_H__ #include <linux/types.h> #define PVRDMA_UVERBS_ABI_VERSION 3 /* ABI Version. */ #define PVRDMA_UAR_HANDLE_MASK 0x00FFFFFF /* Bottom 24 bits. */ #define PVRDMA_UAR_QP_OFFSET 0 /* QP doorbell. */ #define PVRDMA_UAR_QP_SEND (1 << 30) /* Send bit. */ #define PVRDMA_UAR_QP_RECV (1 << 31) /* Recv bit. */ #define PVRDMA_UAR_CQ_OFFSET 4 /* CQ doorbell. */ #define PVRDMA_UAR_CQ_ARM_SOL (1 << 29) /* Arm solicited bit. */ #define PVRDMA_UAR_CQ_ARM (1 << 30) /* Arm bit. */ #define PVRDMA_UAR_CQ_POLL (1 << 31) /* Poll bit. */ #define PVRDMA_UAR_SRQ_OFFSET 8 /* SRQ doorbell. */ #define PVRDMA_UAR_SRQ_RECV (1 << 30) /* Recv bit. */ enum pvrdma_wr_opcode { PVRDMA_WR_RDMA_WRITE, PVRDMA_WR_RDMA_WRITE_WITH_IMM, PVRDMA_WR_SEND, PVRDMA_WR_SEND_WITH_IMM, PVRDMA_WR_RDMA_READ, PVRDMA_WR_ATOMIC_CMP_AND_SWP, PVRDMA_WR_ATOMIC_FETCH_AND_ADD, PVRDMA_WR_LSO, PVRDMA_WR_SEND_WITH_INV, PVRDMA_WR_RDMA_READ_WITH_INV, PVRDMA_WR_LOCAL_INV, PVRDMA_WR_FAST_REG_MR, PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP, PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD, PVRDMA_WR_BIND_MW, PVRDMA_WR_REG_SIG_MR, PVRDMA_WR_ERROR, }; enum pvrdma_wc_status { PVRDMA_WC_SUCCESS, PVRDMA_WC_LOC_LEN_ERR, PVRDMA_WC_LOC_QP_OP_ERR, PVRDMA_WC_LOC_EEC_OP_ERR, PVRDMA_WC_LOC_PROT_ERR, PVRDMA_WC_WR_FLUSH_ERR, PVRDMA_WC_MW_BIND_ERR, PVRDMA_WC_BAD_RESP_ERR, PVRDMA_WC_LOC_ACCESS_ERR, PVRDMA_WC_REM_INV_REQ_ERR, PVRDMA_WC_REM_ACCESS_ERR, PVRDMA_WC_REM_OP_ERR, PVRDMA_WC_RETRY_EXC_ERR, PVRDMA_WC_RNR_RETRY_EXC_ERR, PVRDMA_WC_LOC_RDD_VIOL_ERR, PVRDMA_WC_REM_INV_RD_REQ_ERR, PVRDMA_WC_REM_ABORT_ERR, PVRDMA_WC_INV_EECN_ERR, PVRDMA_WC_INV_EEC_STATE_ERR, PVRDMA_WC_FATAL_ERR, PVRDMA_WC_RESP_TIMEOUT_ERR, PVRDMA_WC_GENERAL_ERR, }; enum pvrdma_wc_opcode { PVRDMA_WC_SEND, PVRDMA_WC_RDMA_WRITE, PVRDMA_WC_RDMA_READ, PVRDMA_WC_COMP_SWAP, PVRDMA_WC_FETCH_ADD, PVRDMA_WC_BIND_MW, PVRDMA_WC_LSO, PVRDMA_WC_LOCAL_INV, PVRDMA_WC_FAST_REG_MR, PVRDMA_WC_MASKED_COMP_SWAP, PVRDMA_WC_MASKED_FETCH_ADD, PVRDMA_WC_RECV = 1 << 7, PVRDMA_WC_RECV_RDMA_WITH_IMM, }; enum pvrdma_wc_flags { PVRDMA_WC_GRH = 1 << 0, PVRDMA_WC_WITH_IMM = 1 << 1, PVRDMA_WC_WITH_INVALIDATE = 1 << 2, PVRDMA_WC_IP_CSUM_OK = 1 << 3, PVRDMA_WC_WITH_SMAC = 1 << 4, PVRDMA_WC_WITH_VLAN = 1 << 5, PVRDMA_WC_WITH_NETWORK_HDR_TYPE = 1 << 6, PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE, }; enum pvrdma_network_type { PVRDMA_NETWORK_IB, PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB, PVRDMA_NETWORK_IPV4, PVRDMA_NETWORK_IPV6 }; struct pvrdma_alloc_ucontext_resp { __u32 qp_tab_size; __u32 reserved; }; struct pvrdma_alloc_pd_resp { __u32 pdn; __u32 reserved; }; struct pvrdma_create_cq { __aligned_u64 buf_addr; __u32 buf_size; __u32 reserved; }; struct pvrdma_create_cq_resp { __u32 cqn; __u32 reserved; }; struct pvrdma_resize_cq { __aligned_u64 buf_addr; __u32 buf_size; __u32 reserved; }; struct pvrdma_create_srq { __aligned_u64 buf_addr; __u32 buf_size; __u32 reserved; }; struct pvrdma_create_srq_resp { __u32 srqn; __u32 reserved; }; struct pvrdma_create_qp { __aligned_u64 rbuf_addr; __aligned_u64 sbuf_addr; __u32 rbuf_size; __u32 sbuf_size; __aligned_u64 qp_addr; }; struct pvrdma_create_qp_resp { __u32 qpn; __u32 qp_handle; }; /* PVRDMA masked atomic compare and swap */ struct pvrdma_ex_cmp_swap { __aligned_u64 swap_val; __aligned_u64 compare_val; __aligned_u64 swap_mask; __aligned_u64 compare_mask; }; /* PVRDMA masked atomic fetch and add */ struct pvrdma_ex_fetch_add { __aligned_u64 add_val; __aligned_u64 field_boundary; }; /* PVRDMA address vector. */ struct pvrdma_av { __u32 port_pd; __u32 sl_tclass_flowlabel; __u8 dgid[16]; __u8 src_path_bits; __u8 gid_index; __u8 stat_rate; __u8 hop_limit; __u8 dmac[6]; __u8 reserved[6]; }; /* PVRDMA scatter/gather entry */ struct pvrdma_sge { __aligned_u64 addr; __u32 length; __u32 lkey; }; /* PVRDMA receive queue work request */ struct pvrdma_rq_wqe_hdr { __aligned_u64 wr_id; /* wr id */ __u32 num_sge; /* size of s/g array */ __u32 total_len; /* reserved */ }; /* Use pvrdma_sge (ib_sge) for receive queue s/g array elements. */ /* PVRDMA send queue work request */ struct pvrdma_sq_wqe_hdr { __aligned_u64 wr_id; /* wr id */ __u32 num_sge; /* size of s/g array */ __u32 total_len; /* reserved */ __u32 opcode; /* operation type */ __u32 send_flags; /* wr flags */ union { __be32 imm_data; __u32 invalidate_rkey; } ex; __u32 reserved; union { struct { __aligned_u64 remote_addr; __u32 rkey; __u8 reserved[4]; } rdma; struct { __aligned_u64 remote_addr; __aligned_u64 compare_add; __aligned_u64 swap; __u32 rkey; __u32 reserved; } atomic; struct { __aligned_u64 remote_addr; __u32 log_arg_sz; __u32 rkey; union { struct pvrdma_ex_cmp_swap cmp_swap; struct pvrdma_ex_fetch_add fetch_add; } wr_data; } masked_atomics; struct { __aligned_u64 iova_start; __aligned_u64 pl_pdir_dma; __u32 page_shift; __u32 page_list_len; __u32 length; __u32 access_flags; __u32 rkey; __u32 reserved; } fast_reg; struct { __u32 remote_qpn; __u32 remote_qkey; struct pvrdma_av av; } ud; } wr; }; /* Use pvrdma_sge (ib_sge) for send queue s/g array elements. */ /* Completion queue element. */ struct pvrdma_cqe { __aligned_u64 wr_id; __aligned_u64 qp; __u32 opcode; __u32 status; __u32 byte_len; __be32 imm_data; __u32 src_qp; __u32 wc_flags; __u32 vendor_err; __u16 pkey_index; __u16 slid; __u8 sl; __u8 dlid_path_bits; __u8 port_num; __u8 smac[6]; __u8 network_hdr_type; __u8 reserved2[6]; /* Pad to next power of 2 (64). */ }; #endif /* __VMW_PVRDMA_ABI_H__ */ scsi/fc/fc_els.h 0000644 00000115256 15063602061 0007512 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_ELS_H_ #define _FC_ELS_H_ #include <linux/types.h> #include <asm/byteorder.h> /* * Fibre Channel Switch - Enhanced Link Services definitions. * From T11 FC-LS Rev 1.2 June 7, 2005. */ /* * ELS Command codes - byte 0 of the frame payload */ enum fc_els_cmd { ELS_LS_RJT = 0x01, /* ESL reject */ ELS_LS_ACC = 0x02, /* ESL Accept */ ELS_PLOGI = 0x03, /* N_Port login */ ELS_FLOGI = 0x04, /* F_Port login */ ELS_LOGO = 0x05, /* Logout */ ELS_ABTX = 0x06, /* Abort exchange - obsolete */ ELS_RCS = 0x07, /* read connection status */ ELS_RES = 0x08, /* read exchange status block */ ELS_RSS = 0x09, /* read sequence status block */ ELS_RSI = 0x0a, /* read sequence initiative */ ELS_ESTS = 0x0b, /* establish streaming */ ELS_ESTC = 0x0c, /* estimate credit */ ELS_ADVC = 0x0d, /* advise credit */ ELS_RTV = 0x0e, /* read timeout value */ ELS_RLS = 0x0f, /* read link error status block */ ELS_ECHO = 0x10, /* echo */ ELS_TEST = 0x11, /* test */ ELS_RRQ = 0x12, /* reinstate recovery qualifier */ ELS_REC = 0x13, /* read exchange concise */ ELS_SRR = 0x14, /* sequence retransmission request */ ELS_FPIN = 0x16, /* Fabric Performance Impact Notification */ ELS_EDC = 0x17, /* Exchange Diagnostic Capabilities */ ELS_RDP = 0x18, /* Read Diagnostic Parameters */ ELS_RDF = 0x19, /* Register Diagnostic Functions */ ELS_PRLI = 0x20, /* process login */ ELS_PRLO = 0x21, /* process logout */ ELS_SCN = 0x22, /* state change notification */ ELS_TPLS = 0x23, /* test process login state */ ELS_TPRLO = 0x24, /* third party process logout */ ELS_LCLM = 0x25, /* login control list mgmt (obs) */ ELS_GAID = 0x30, /* get alias_ID */ ELS_FACT = 0x31, /* fabric activate alias_id */ ELS_FDACDT = 0x32, /* fabric deactivate alias_id */ ELS_NACT = 0x33, /* N-port activate alias_id */ ELS_NDACT = 0x34, /* N-port deactivate alias_id */ ELS_QOSR = 0x40, /* quality of service request */ ELS_RVCS = 0x41, /* read virtual circuit status */ ELS_PDISC = 0x50, /* discover N_port service params */ ELS_FDISC = 0x51, /* discover F_port service params */ ELS_ADISC = 0x52, /* discover address */ ELS_RNC = 0x53, /* report node cap (obs) */ ELS_FARP_REQ = 0x54, /* FC ARP request */ ELS_FARP_REPL = 0x55, /* FC ARP reply */ ELS_RPS = 0x56, /* read port status block */ ELS_RPL = 0x57, /* read port list */ ELS_RPBC = 0x58, /* read port buffer condition */ ELS_FAN = 0x60, /* fabric address notification */ ELS_RSCN = 0x61, /* registered state change notification */ ELS_SCR = 0x62, /* state change registration */ ELS_RNFT = 0x63, /* report node FC-4 types */ ELS_CSR = 0x68, /* clock synch. request */ ELS_CSU = 0x69, /* clock synch. update */ ELS_LINIT = 0x70, /* loop initialize */ ELS_LSTS = 0x72, /* loop status */ ELS_RNID = 0x78, /* request node ID data */ ELS_RLIR = 0x79, /* registered link incident report */ ELS_LIRR = 0x7a, /* link incident record registration */ ELS_SRL = 0x7b, /* scan remote loop */ ELS_SBRP = 0x7c, /* set bit-error reporting params */ ELS_RPSC = 0x7d, /* report speed capabilities */ ELS_QSA = 0x7e, /* query security attributes */ ELS_EVFP = 0x7f, /* exchange virt. fabrics params */ ELS_LKA = 0x80, /* link keep-alive */ ELS_AUTH_ELS = 0x90, /* authentication ELS */ }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_ELS_CMDS_INIT { \ [ELS_LS_RJT] = "LS_RJT", \ [ELS_LS_ACC] = "LS_ACC", \ [ELS_PLOGI] = "PLOGI", \ [ELS_FLOGI] = "FLOGI", \ [ELS_LOGO] = "LOGO", \ [ELS_ABTX] = "ABTX", \ [ELS_RCS] = "RCS", \ [ELS_RES] = "RES", \ [ELS_RSS] = "RSS", \ [ELS_RSI] = "RSI", \ [ELS_ESTS] = "ESTS", \ [ELS_ESTC] = "ESTC", \ [ELS_ADVC] = "ADVC", \ [ELS_RTV] = "RTV", \ [ELS_RLS] = "RLS", \ [ELS_ECHO] = "ECHO", \ [ELS_TEST] = "TEST", \ [ELS_RRQ] = "RRQ", \ [ELS_REC] = "REC", \ [ELS_SRR] = "SRR", \ [ELS_FPIN] = "FPIN", \ [ELS_EDC] = "EDC", \ [ELS_RDP] = "RDP", \ [ELS_RDF] = "RDF", \ [ELS_PRLI] = "PRLI", \ [ELS_PRLO] = "PRLO", \ [ELS_SCN] = "SCN", \ [ELS_TPLS] = "TPLS", \ [ELS_TPRLO] = "TPRLO", \ [ELS_LCLM] = "LCLM", \ [ELS_GAID] = "GAID", \ [ELS_FACT] = "FACT", \ [ELS_FDACDT] = "FDACDT", \ [ELS_NACT] = "NACT", \ [ELS_NDACT] = "NDACT", \ [ELS_QOSR] = "QOSR", \ [ELS_RVCS] = "RVCS", \ [ELS_PDISC] = "PDISC", \ [ELS_FDISC] = "FDISC", \ [ELS_ADISC] = "ADISC", \ [ELS_RNC] = "RNC", \ [ELS_FARP_REQ] = "FARP_REQ", \ [ELS_FARP_REPL] = "FARP_REPL", \ [ELS_RPS] = "RPS", \ [ELS_RPL] = "RPL", \ [ELS_RPBC] = "RPBC", \ [ELS_FAN] = "FAN", \ [ELS_RSCN] = "RSCN", \ [ELS_SCR] = "SCR", \ [ELS_RNFT] = "RNFT", \ [ELS_CSR] = "CSR", \ [ELS_CSU] = "CSU", \ [ELS_LINIT] = "LINIT", \ [ELS_LSTS] = "LSTS", \ [ELS_RNID] = "RNID", \ [ELS_RLIR] = "RLIR", \ [ELS_LIRR] = "LIRR", \ [ELS_SRL] = "SRL", \ [ELS_SBRP] = "SBRP", \ [ELS_RPSC] = "RPSC", \ [ELS_QSA] = "QSA", \ [ELS_EVFP] = "EVFP", \ [ELS_LKA] = "LKA", \ [ELS_AUTH_ELS] = "AUTH_ELS", \ } /* * LS_ACC payload. */ struct fc_els_ls_acc { __u8 la_cmd; /* command code ELS_LS_ACC */ __u8 la_resv[3]; /* reserved */ }; /* * ELS reject payload. */ struct fc_els_ls_rjt { __u8 er_cmd; /* command code ELS_LS_RJT */ __u8 er_resv[4]; /* reserved must be zero */ __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */ __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */ __u8 er_vendor; /* vendor specific code */ }; /* * ELS reject reason codes (er_reason). */ enum fc_els_rjt_reason { ELS_RJT_NONE = 0, /* no reject - not to be sent */ ELS_RJT_INVAL = 0x01, /* invalid ELS command code */ ELS_RJT_LOGIC = 0x03, /* logical error */ ELS_RJT_BUSY = 0x05, /* logical busy */ ELS_RJT_PROT = 0x07, /* protocol error */ ELS_RJT_UNAB = 0x09, /* unable to perform command request */ ELS_RJT_UNSUP = 0x0b, /* command not supported */ ELS_RJT_INPROG = 0x0e, /* command already in progress */ ELS_RJT_FIP = 0x20, /* FIP error */ ELS_RJT_VENDOR = 0xff, /* vendor specific error */ }; /* * reason code explanation (er_explan). */ enum fc_els_rjt_explan { ELS_EXPL_NONE = 0x00, /* No additional explanation */ ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */ ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */ ELS_EXPL_AH = 0x11, /* invalid association header */ ELS_EXPL_AH_REQ = 0x13, /* association_header required */ ELS_EXPL_SID = 0x15, /* invalid originator S_ID */ ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */ ELS_EXPL_INPROG = 0x19, /* Request already in progress */ ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */ ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */ ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */ ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */ ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */ ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */ /* TBD - above definitions incomplete */ }; /* * Link Service TLV Descriptor Tag Values */ enum fc_ls_tlv_dtag { ELS_DTAG_LS_REQ_INFO = 0x00000001, /* Link Service Request Information Descriptor */ ELS_DTAG_LNK_FAULT_CAP = 0x0001000D, /* Link Fault Capability Descriptor */ ELS_DTAG_CG_SIGNAL_CAP = 0x0001000F, /* Congestion Signaling Capability Descriptor */ ELS_DTAG_LNK_INTEGRITY = 0x00020001, /* Link Integrity Notification Descriptor */ ELS_DTAG_DELIVERY = 0x00020002, /* Delivery Notification Descriptor */ ELS_DTAG_PEER_CONGEST = 0x00020003, /* Peer Congestion Notification Descriptor */ ELS_DTAG_CONGESTION = 0x00020004, /* Congestion Notification Descriptor */ ELS_DTAG_FPIN_REGISTER = 0x00030001, /* FPIN Registration Descriptor */ }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_LS_TLV_DTAG_INIT { \ { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, \ { ELS_DTAG_LNK_FAULT_CAP, "Link Fault Capability" }, \ { ELS_DTAG_CG_SIGNAL_CAP, "Congestion Signaling Capability" }, \ { ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, \ { ELS_DTAG_DELIVERY, "Delivery Notification Present" }, \ { ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, \ { ELS_DTAG_CONGESTION, "Congestion Notification" }, \ { ELS_DTAG_FPIN_REGISTER, "FPIN Registration" }, \ } /* * Generic Link Service TLV Descriptor format * * This structure, as it defines no payload, will also be referred to * as the "tlv header" - which contains the tag and len fields. */ struct fc_tlv_desc { __be32 desc_tag; /* Notification Descriptor Tag */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. */ __u8 desc_value[0]; /* Descriptor Value */ }; /* Descriptor tag and len fields are considered the mandatory header * for a descriptor */ #define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc) /* * Macro, used when initializing payloads, to return the descriptor length. * Length is size of descriptor minus the tag and len fields. */ #define FC_TLV_DESC_LENGTH_FROM_SZ(desc) \ (sizeof(desc) - FC_TLV_DESC_HDR_SZ) /* Macro, used on received payloads, to return the descriptor length */ #define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) \ (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ) /* * This helper is used to walk descriptors in a descriptor list. * Given the address of the current descriptor, which minimally contains a * tag and len field, calculate the address of the next descriptor based * on the len field. */ static __inline__ void *fc_tlv_next_desc(void *desc) { struct fc_tlv_desc *tlv = desc; return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv)); } /* * Link Service Request Information Descriptor */ struct fc_els_lsri_desc { __be32 desc_tag; /* descriptor tag (0x0000 0001) */ __be32 desc_len; /* Length of Descriptor (in bytes) (4). * Size of descriptor excluding * desc_tag and desc_len fields. */ struct { __u8 cmd; /* ELS cmd byte */ __u8 bytes[3]; /* bytes 1..3 */ } rqst_w0; /* Request word 0 */ }; /* * Common service parameters (N ports). */ struct fc_els_csp { __u8 sp_hi_ver; /* highest version supported (obs.) */ __u8 sp_lo_ver; /* highest version supported (obs.) */ __be16 sp_bb_cred; /* buffer-to-buffer credits */ __be16 sp_features; /* common feature flags */ __be16 sp_bb_data; /* b-b state number and data field sz */ union { struct { __be16 _sp_tot_seq; /* total concurrent sequences */ __be16 _sp_rel_off; /* rel. offset by info cat */ } sp_plogi; struct { __be32 _sp_r_a_tov; /* resource alloc. timeout msec */ } sp_flogi_acc; } sp_u; __be32 sp_e_d_tov; /* error detect timeout value */ }; #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq #define sp_rel_off sp_u.sp_plogi._sp_rel_off #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */ /* * Minimum and maximum values for max data field size in service parameters. */ #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD /* * sp_features */ #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */ #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */ #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ #define FC_SP_FT_RAND 0x4000 /* random relative offset */ #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */ #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ #define FC_SP_FT_MCAST 0x0200 /* multicast */ #define FC_SP_FT_BCAST 0x0100 /* broadcast */ #define FC_SP_FT_HUNT 0x0080 /* hunt group */ #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */ #define FC_SP_FT_SEC 0x0020 /* reserved for security */ #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */ #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */ #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */ #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */ #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */ /* * Class-specific service parameters. */ struct fc_els_cssp { __be16 cp_class; /* class flags */ __be16 cp_init; /* initiator flags */ __be16 cp_recip; /* recipient flags */ __be16 cp_rdfs; /* receive data field size */ __be16 cp_con_seq; /* concurrent sequences */ __be16 cp_ee_cred; /* N-port end-to-end credit */ __u8 cp_resv1; /* reserved */ __u8 cp_open_seq; /* open sequences per exchange */ __u8 _cp_resv2[2]; /* reserved */ }; /* * cp_class flags. */ #define FC_CPC_VALID 0x8000 /* class valid */ #define FC_CPC_IMIX 0x4000 /* intermix mode */ #define FC_CPC_SEQ 0x0800 /* sequential delivery */ #define FC_CPC_CAMP 0x0200 /* camp-on */ #define FC_CPC_PRI 0x0080 /* priority */ /* * cp_init flags. * (TBD: not all flags defined here). */ #define FC_CPI_CSYN 0x0010 /* clock synch. capable */ /* * cp_recip flags. */ #define FC_CPR_CSYN 0x0008 /* clock synch. capable */ /* * NFC_ELS_FLOGI: Fabric login request. * NFC_ELS_PLOGI: Port login request (same format). */ struct fc_els_flogi { __u8 fl_cmd; /* command */ __u8 _fl_resvd[3]; /* must be zero */ struct fc_els_csp fl_csp; /* common service parameters */ __be64 fl_wwpn; /* port name */ __be64 fl_wwnn; /* node name */ struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */ __u8 fl_vend[16]; /* vendor version level */ } __attribute__((__packed__)); /* * Process login service parameter page. */ struct fc_els_spp { __u8 spp_type; /* type code or common service params */ __u8 spp_type_ext; /* type code extension */ __u8 spp_flags; __u8 _spp_resvd; __be32 spp_orig_pa; /* originator process associator */ __be32 spp_resp_pa; /* responder process associator */ __be32 spp_params; /* service parameters */ }; /* * spp_flags. */ #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */ #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */ #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */ #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */ /* * SPP response code in spp_flags - lower 4 bits. */ enum fc_els_spp_resp { FC_SPP_RESP_ACK = 1, /* request executed */ FC_SPP_RESP_RES = 2, /* unable due to lack of resources */ FC_SPP_RESP_INIT = 3, /* initialization not complete */ FC_SPP_RESP_NO_PA = 4, /* unknown process associator */ FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */ FC_SPP_RESP_COND = 6, /* request completed conditionally */ FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */ FC_SPP_RESP_INVL = 8, /* SPP is invalid */ }; /* * ELS_RRQ - Reinstate Recovery Qualifier */ struct fc_els_rrq { __u8 rrq_cmd; /* command (0x12) */ __u8 rrq_zero[3]; /* specified as zero - part of cmd */ __u8 rrq_resvd; /* reserved */ __u8 rrq_s_id[3]; /* originator FID */ __be16 rrq_ox_id; /* originator exchange ID */ __be16 rrq_rx_id; /* responders exchange ID */ }; /* * ELS_REC - Read exchange concise. */ struct fc_els_rec { __u8 rec_cmd; /* command (0x13) */ __u8 rec_zero[3]; /* specified as zero - part of cmd */ __u8 rec_resvd; /* reserved */ __u8 rec_s_id[3]; /* originator FID */ __be16 rec_ox_id; /* originator exchange ID */ __be16 rec_rx_id; /* responders exchange ID */ }; /* * ELS_REC LS_ACC payload. */ struct fc_els_rec_acc { __u8 reca_cmd; /* accept (0x02) */ __u8 reca_zero[3]; /* specified as zero - part of cmd */ __be16 reca_ox_id; /* originator exchange ID */ __be16 reca_rx_id; /* responders exchange ID */ __u8 reca_resvd1; /* reserved */ __u8 reca_ofid[3]; /* originator FID */ __u8 reca_resvd2; /* reserved */ __u8 reca_rfid[3]; /* responder FID */ __be32 reca_fc4value; /* FC4 value */ __be32 reca_e_stat; /* ESB (exchange status block) status */ }; /* * ELS_PRLI - Process login request and response. */ struct fc_els_prli { __u8 prli_cmd; /* command */ __u8 prli_spp_len; /* length of each serv. parm. page */ __be16 prli_len; /* length of entire payload */ /* service parameter pages follow */ }; /* * ELS_PRLO - Process logout request and response. */ struct fc_els_prlo { __u8 prlo_cmd; /* command */ __u8 prlo_obs; /* obsolete, but shall be set to 10h */ __be16 prlo_len; /* payload length */ }; /* * ELS_ADISC payload */ struct fc_els_adisc { __u8 adisc_cmd; __u8 adisc_resv[3]; __u8 adisc_resv1; __u8 adisc_hard_addr[3]; __be64 adisc_wwpn; __be64 adisc_wwnn; __u8 adisc_resv2; __u8 adisc_port_id[3]; } __attribute__((__packed__)); /* * ELS_LOGO - process or fabric logout. */ struct fc_els_logo { __u8 fl_cmd; /* command code */ __u8 fl_zero[3]; /* specified as zero - part of cmd */ __u8 fl_resvd; /* reserved */ __u8 fl_n_port_id[3];/* N port ID */ __be64 fl_n_port_wwn; /* port name */ }; /* * ELS_RTV - read timeout value. */ struct fc_els_rtv { __u8 rtv_cmd; /* command code 0x0e */ __u8 rtv_zero[3]; /* specified as zero - part of cmd */ }; /* * LS_ACC for ELS_RTV - read timeout value. */ struct fc_els_rtv_acc { __u8 rtv_cmd; /* command code 0x02 */ __u8 rtv_zero[3]; /* specified as zero - part of cmd */ __be32 rtv_r_a_tov; /* resource allocation timeout value */ __be32 rtv_e_d_tov; /* error detection timeout value */ __be32 rtv_toq; /* timeout qualifier (see below) */ }; /* * rtv_toq bits. */ #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */ #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */ /* * ELS_SCR - state change registration payload. */ struct fc_els_scr { __u8 scr_cmd; /* command code */ __u8 scr_resv[6]; /* reserved */ __u8 scr_reg_func; /* registration function (see below) */ }; enum fc_els_scr_func { ELS_SCRF_FAB = 1, /* fabric-detected registration */ ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */ ELS_SCRF_FULL = 3, /* full registration */ ELS_SCRF_CLEAR = 255, /* remove any current registrations */ }; /* * ELS_RSCN - registered state change notification payload. */ struct fc_els_rscn { __u8 rscn_cmd; /* RSCN opcode (0x61) */ __u8 rscn_page_len; /* page length (4) */ __be16 rscn_plen; /* payload length including this word */ /* followed by 4-byte generic affected Port_ID pages */ }; struct fc_els_rscn_page { __u8 rscn_page_flags; /* event and address format */ __u8 rscn_fid[3]; /* fabric ID */ }; #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */ #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */ #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */ #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */ enum fc_els_rscn_ev_qual { ELS_EV_QUAL_NONE = 0, /* unspecified */ ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */ ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */ ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */ ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */ ELS_EV_QUAL_REM_OBJ = 5, /* removed object */ }; enum fc_els_rscn_addr_fmt { ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */ ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */ ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */ ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */ }; /* * ELS_RNID - request Node ID. */ struct fc_els_rnid { __u8 rnid_cmd; /* RNID opcode (0x78) */ __u8 rnid_resv[3]; /* reserved */ __u8 rnid_fmt; /* data format */ __u8 rnid_resv2[3]; /* reserved */ }; /* * Node Identification Data formats (rnid_fmt) */ enum fc_els_rnid_fmt { ELS_RNIDF_NONE = 0, /* no specific identification data */ ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */ }; /* * ELS_RNID response. */ struct fc_els_rnid_resp { __u8 rnid_cmd; /* response code (LS_ACC) */ __u8 rnid_resv[3]; /* reserved */ __u8 rnid_fmt; /* data format */ __u8 rnid_cid_len; /* common ID data length */ __u8 rnid_resv2; /* reserved */ __u8 rnid_sid_len; /* specific ID data length */ }; struct fc_els_rnid_cid { __be64 rnid_wwpn; /* N port name */ __be64 rnid_wwnn; /* node name */ }; struct fc_els_rnid_gen { __u8 rnid_vend_id[16]; /* vendor-unique ID */ __be32 rnid_atype; /* associated type (see below) */ __be32 rnid_phys_port; /* physical port number */ __be32 rnid_att_nodes; /* number of attached nodes */ __u8 rnid_node_mgmt; /* node management (see below) */ __u8 rnid_ip_ver; /* IP version (see below) */ __be16 rnid_prot_port; /* UDP / TCP port number */ __be32 rnid_ip_addr[4]; /* IP address */ __u8 rnid_resvd[2]; /* reserved */ __be16 rnid_vend_spec; /* vendor-specific field */ }; enum fc_els_rnid_atype { ELS_RNIDA_UNK = 0x01, /* unknown */ ELS_RNIDA_OTHER = 0x02, /* none of the following */ ELS_RNIDA_HUB = 0x03, ELS_RNIDA_SWITCH = 0x04, ELS_RNIDA_GATEWAY = 0x05, ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */ ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */ ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */ ELS_RNIDA_STORAGE = 0x09, ELS_RNIDA_HOST = 0x0a, ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */ ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */ ELS_RNIDA_NAS = 0x11, /* NAS server */ ELS_RNIDA_BRIDGE = 0x12, /* bridge */ ELS_RNIDA_VIRT = 0x13, /* virtualization device */ ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */ ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */ ELS_RNIDA_MF_SW = 1UL << 30, /* switch */ ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */ ELS_RNIDA_MF_ST = 1UL << 28, /* storage */ ELS_RNIDA_MF_HOST = 1UL << 27, /* host */ ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */ ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */ ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */ ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */ ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */ ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */ }; enum fc_els_rnid_mgmt { ELS_RNIDM_SNMP = 0, ELS_RNIDM_TELNET = 1, ELS_RNIDM_HTTP = 2, ELS_RNIDM_HTTPS = 3, ELS_RNIDM_XML = 4, /* HTTP + XML */ }; enum fc_els_rnid_ipver { ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */ ELS_RNIDIP_V4 = 1, /* IPv4 */ ELS_RNIDIP_V6 = 2, /* IPv6 */ }; /* * ELS RPL - Read Port List. */ struct fc_els_rpl { __u8 rpl_cmd; /* command */ __u8 rpl_resv[5]; /* reserved - must be zero */ __be16 rpl_max_size; /* maximum response size or zero */ __u8 rpl_resv1; /* reserved - must be zero */ __u8 rpl_index[3]; /* starting index */ }; /* * Port number block in RPL response. */ struct fc_els_pnb { __be32 pnb_phys_pn; /* physical port number */ __u8 pnb_resv; /* reserved */ __u8 pnb_port_id[3]; /* port ID */ __be64 pnb_wwpn; /* port name */ }; /* * RPL LS_ACC response. */ struct fc_els_rpl_resp { __u8 rpl_cmd; /* ELS_LS_ACC */ __u8 rpl_resv1; /* reserved - must be zero */ __be16 rpl_plen; /* payload length */ __u8 rpl_resv2; /* reserved - must be zero */ __u8 rpl_llen[3]; /* list length */ __u8 rpl_resv3; /* reserved - must be zero */ __u8 rpl_index[3]; /* starting index */ struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */ }; /* * Link Error Status Block. */ struct fc_els_lesb { __be32 lesb_link_fail; /* link failure count */ __be32 lesb_sync_loss; /* loss of synchronization count */ __be32 lesb_sig_loss; /* loss of signal count */ __be32 lesb_prim_err; /* primitive sequence error count */ __be32 lesb_inv_word; /* invalid transmission word count */ __be32 lesb_inv_crc; /* invalid CRC count */ }; /* * ELS RPS - Read Port Status Block request. */ struct fc_els_rps { __u8 rps_cmd; /* command */ __u8 rps_resv[2]; /* reserved - must be zero */ __u8 rps_flag; /* flag - see below */ __be64 rps_port_spec; /* port selection */ }; enum fc_els_rps_flag { FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */ FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */ FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */ }; /* * ELS RPS LS_ACC response. */ struct fc_els_rps_resp { __u8 rps_cmd; /* command - LS_ACC */ __u8 rps_resv[2]; /* reserved - must be zero */ __u8 rps_flag; /* flag - see below */ __u8 rps_resv2[2]; /* reserved */ __be16 rps_status; /* port status - see below */ struct fc_els_lesb rps_lesb; /* link error status block */ }; enum fc_els_rps_resp_flag { FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */ }; enum fc_els_rps_resp_status { FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */ FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */ FC_ELS_RPS_FAB = 1 << 3, /* fabric present */ FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */ FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */ FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */ }; /* * ELS LIRR - Link Incident Record Registration request. */ struct fc_els_lirr { __u8 lirr_cmd; /* command */ __u8 lirr_resv[3]; /* reserved - must be zero */ __u8 lirr_func; /* registration function */ __u8 lirr_fmt; /* FC-4 type of RLIR requested */ __u8 lirr_resv2[2]; /* reserved - must be zero */ }; enum fc_els_lirr_func { ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */ ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */ ELS_LIRR_CLEAR = 0xff /* clear registration */ }; /* * ELS SRL - Scan Remote Loop request. */ struct fc_els_srl { __u8 srl_cmd; /* command */ __u8 srl_resv[3]; /* reserved - must be zero */ __u8 srl_flag; /* flag - see below */ __u8 srl_flag_param[3]; /* flag parameter */ }; enum fc_els_srl_flag { FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */ FC_ELS_SRL_ONE = 0x01, /* scan specified loop */ FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */ FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */ }; /* * ELS RLS - Read Link Error Status Block request. */ struct fc_els_rls { __u8 rls_cmd; /* command */ __u8 rls_resv[4]; /* reserved - must be zero */ __u8 rls_port_id[3]; /* port ID */ }; /* * ELS RLS LS_ACC Response. */ struct fc_els_rls_resp { __u8 rls_cmd; /* ELS_LS_ACC */ __u8 rls_resv[3]; /* reserved - must be zero */ struct fc_els_lesb rls_lesb; /* link error status block */ }; /* * ELS RLIR - Registered Link Incident Report. * This is followed by the CLIR and the CLID, described below. */ struct fc_els_rlir { __u8 rlir_cmd; /* command */ __u8 rlir_resv[3]; /* reserved - must be zero */ __u8 rlir_fmt; /* format (FC4-type if type specific) */ __u8 rlir_clr_len; /* common link incident record length */ __u8 rlir_cld_len; /* common link incident desc. length */ __u8 rlir_slr_len; /* spec. link incident record length */ }; /* * CLIR - Common Link Incident Record Data. - Sent via RLIR. */ struct fc_els_clir { __be64 clir_wwpn; /* incident port name */ __be64 clir_wwnn; /* incident port node name */ __u8 clir_port_type; /* incident port type */ __u8 clir_port_id[3]; /* incident port ID */ __be64 clir_conn_wwpn; /* connected port name */ __be64 clir_conn_wwnn; /* connected node name */ __be64 clir_fab_name; /* fabric name */ __be32 clir_phys_port; /* physical port number */ __be32 clir_trans_id; /* transaction ID */ __u8 clir_resv[3]; /* reserved */ __u8 clir_ts_fmt; /* time stamp format */ __be64 clir_timestamp; /* time stamp */ }; /* * CLIR clir_ts_fmt - time stamp format values. */ enum fc_els_clir_ts_fmt { ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */ ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */ ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */ }; /* * Common Link Incident Descriptor - sent via RLIR. */ struct fc_els_clid { __u8 clid_iq; /* incident qualifier flags */ __u8 clid_ic; /* incident code */ __be16 clid_epai; /* domain/area of ISL */ }; /* * CLID incident qualifier flags. */ enum fc_els_clid_iq { ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */ ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */ ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */ ELS_CLID_SEV_INFO = 0x00, /* report is informational */ ELS_CLID_SEV_INOP = 0x08, /* link not operational */ ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */ ELS_CLID_LASER = 0x02, /* subassembly is a laser */ ELS_CLID_FRU = 0x01, /* format can identify a FRU */ }; /* * CLID incident code. */ enum fc_els_clid_ic { ELS_CLID_IC_IMPL = 1, /* implicit incident */ ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */ ELS_CLID_IC_LOS = 3, /* loss of synch or signal */ ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */ ELS_CLID_IC_PST = 5, /* primitive sequence timeout */ ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */ ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */ ELS_CLID_IC_LIP = 8, /* receiving LIP */ }; /* * Link Integrity event types */ enum fc_fpin_li_event_types { FPIN_LI_UNKNOWN = 0x0, FPIN_LI_LINK_FAILURE = 0x1, FPIN_LI_LOSS_OF_SYNC = 0x2, FPIN_LI_LOSS_OF_SIG = 0x3, FPIN_LI_PRIM_SEQ_ERR = 0x4, FPIN_LI_INVALID_TX_WD = 0x5, FPIN_LI_INVALID_CRC = 0x6, FPIN_LI_DEVICE_SPEC = 0xF, }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_FPIN_LI_EVT_TYPES_INIT { \ { FPIN_LI_UNKNOWN, "Unknown" }, \ { FPIN_LI_LINK_FAILURE, "Link Failure" }, \ { FPIN_LI_LOSS_OF_SYNC, "Loss of Synchronization" }, \ { FPIN_LI_LOSS_OF_SIG, "Loss of Signal" }, \ { FPIN_LI_PRIM_SEQ_ERR, "Primitive Sequence Protocol Error" }, \ { FPIN_LI_INVALID_TX_WD, "Invalid Transmission Word" }, \ { FPIN_LI_INVALID_CRC, "Invalid CRC" }, \ { FPIN_LI_DEVICE_SPEC, "Device Specific" }, \ } /* * Delivery event types */ enum fc_fpin_deli_event_types { FPIN_DELI_UNKNOWN = 0x0, FPIN_DELI_TIMEOUT = 0x1, FPIN_DELI_UNABLE_TO_ROUTE = 0x2, FPIN_DELI_DEVICE_SPEC = 0xF, }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_FPIN_DELI_EVT_TYPES_INIT { \ { FPIN_DELI_UNKNOWN, "Unknown" }, \ { FPIN_DELI_TIMEOUT, "Timeout" }, \ { FPIN_DELI_UNABLE_TO_ROUTE, "Unable to Route" }, \ { FPIN_DELI_DEVICE_SPEC, "Device Specific" }, \ } /* * Congestion event types */ enum fc_fpin_congn_event_types { FPIN_CONGN_CLEAR = 0x0, FPIN_CONGN_LOST_CREDIT = 0x1, FPIN_CONGN_CREDIT_STALL = 0x2, FPIN_CONGN_OVERSUBSCRIPTION = 0x3, FPIN_CONGN_DEVICE_SPEC = 0xF, }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_FPIN_CONGN_EVT_TYPES_INIT { \ { FPIN_CONGN_CLEAR, "Clear" }, \ { FPIN_CONGN_LOST_CREDIT, "Lost Credit" }, \ { FPIN_CONGN_CREDIT_STALL, "Credit Stall" }, \ { FPIN_CONGN_OVERSUBSCRIPTION, "Oversubscription" }, \ { FPIN_CONGN_DEVICE_SPEC, "Device Specific" }, \ } enum fc_fpin_congn_severity_types { FPIN_CONGN_SEVERITY_WARNING = 0xF1, FPIN_CONGN_SEVERITY_ERROR = 0xF7, }; /* * Link Integrity Notification Descriptor */ struct fc_fn_li_desc { __be32 desc_tag; /* Descriptor Tag (0x00020001) */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. */ __be64 detecting_wwpn; /* Port Name that detected event */ __be64 attached_wwpn; /* Port Name of device attached to * detecting Port Name */ __be16 event_type; /* see enum fc_fpin_li_event_types */ __be16 event_modifier; /* Implementation specific value * describing the event type */ __be32 event_threshold;/* duration in ms of the link * integrity detection cycle */ __be32 event_count; /* minimum number of event * occurrences during the event * threshold to caause the LI event */ __be32 pname_count; /* number of portname_list elements */ __be64 pname_list[0]; /* list of N_Port_Names accessible * through the attached port */ }; /* * Delivery Notification Descriptor */ struct fc_fn_deli_desc { __be32 desc_tag; /* Descriptor Tag (0x00020002) */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. */ __be64 detecting_wwpn; /* Port Name that detected event */ __be64 attached_wwpn; /* Port Name of device attached to * detecting Port Name */ __be32 deli_reason_code;/* see enum fc_fpin_deli_event_types */ }; /* * Peer Congestion Notification Descriptor */ struct fc_fn_peer_congn_desc { __be32 desc_tag; /* Descriptor Tag (0x00020003) */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. */ __be64 detecting_wwpn; /* Port Name that detected event */ __be64 attached_wwpn; /* Port Name of device attached to * detecting Port Name */ __be16 event_type; /* see enum fc_fpin_congn_event_types */ __be16 event_modifier; /* Implementation specific value * describing the event type */ __be32 event_period; /* duration (ms) of the detected * congestion event */ __be32 pname_count; /* number of portname_list elements */ __be64 pname_list[0]; /* list of N_Port_Names accessible * through the attached port */ }; /* * Congestion Notification Descriptor */ struct fc_fn_congn_desc { __be32 desc_tag; /* Descriptor Tag (0x00020004) */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. */ __be16 event_type; /* see enum fc_fpin_congn_event_types */ __be16 event_modifier; /* Implementation specific value * describing the event type */ __be32 event_period; /* duration (ms) of the detected * congestion event */ __u8 severity; /* command */ __u8 resv[3]; /* reserved - must be zero */ }; /* * ELS_FPIN - Fabric Performance Impact Notification */ struct fc_els_fpin { __u8 fpin_cmd; /* command (0x16) */ __u8 fpin_zero[3]; /* specified as zero - part of cmd */ __be32 desc_len; /* Length of Descriptor List (in bytes). * Size of ELS excluding fpin_cmd, * fpin_zero and desc_len fields. */ struct fc_tlv_desc fpin_desc[0]; /* Descriptor list */ }; /* Diagnostic Function Descriptor - FPIN Registration */ struct fc_df_desc_fpin_reg { __be32 desc_tag; /* FPIN Registration (0x00030001) */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. */ __be32 count; /* Number of desc_tags elements */ __be32 desc_tags[0]; /* Array of Descriptor Tags. * Each tag indicates a function * supported by the N_Port (request) * or by the N_Port and Fabric * Controller (reply; may be a subset * of the request). * See ELS_FN_DTAG_xxx for tag values. */ }; /* * ELS_RDF - Register Diagnostic Functions */ struct fc_els_rdf { __u8 fpin_cmd; /* command (0x19) */ __u8 fpin_zero[3]; /* specified as zero - part of cmd */ __be32 desc_len; /* Length of Descriptor List (in bytes). * Size of ELS excluding fpin_cmd, * fpin_zero and desc_len fields. */ struct fc_tlv_desc desc[0]; /* Descriptor list */ }; /* * ELS RDF LS_ACC Response. */ struct fc_els_rdf_resp { struct fc_els_ls_acc acc_hdr; __be32 desc_list_len; /* Length of response (in * bytes). Excludes acc_hdr * and desc_list_len fields. */ struct fc_els_lsri_desc lsri; struct fc_tlv_desc desc[0]; /* Supported Descriptor list */ }; /* * Diagnostic Capability Descriptors for EDC ELS */ /* * Diagnostic: Link Fault Capability Descriptor */ struct fc_diag_lnkflt_desc { __be32 desc_tag; /* Descriptor Tag (0x0001000D) */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. * 12 bytes */ __be32 degrade_activate_threshold; __be32 degrade_deactivate_threshold; __be32 fec_degrade_interval; }; enum fc_edc_cg_signal_cap_types { /* Note: Capability: bits 31:4 Rsvd; bits 3:0 are capabilities */ EDC_CG_SIG_NOTSUPPORTED = 0x00, /* neither supported */ EDC_CG_SIG_WARN_ONLY = 0x01, EDC_CG_SIG_WARN_ALARM = 0x02, /* both supported */ }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT { \ { EDC_CG_SIG_NOTSUPPORTED, "Signaling Not Supported" }, \ { EDC_CG_SIG_WARN_ONLY, "Warning Signal" }, \ { EDC_CG_SIG_WARN_ALARM, "Warning and Alarm Signals" }, \ } enum fc_diag_cg_sig_freq_types { EDC_CG_SIGFREQ_CNT_MIN = 1, /* Min Frequency Count */ EDC_CG_SIGFREQ_CNT_MAX = 999, /* Max Frequency Count */ EDC_CG_SIGFREQ_SEC = 0x1, /* Units: seconds */ EDC_CG_SIGFREQ_MSEC = 0x2, /* Units: milliseconds */ }; struct fc_diag_cg_sig_freq { __be16 count; /* Time between signals * note: upper 6 bits rsvd */ __be16 units; /* Time unit for count * note: upper 12 bits rsvd */ }; /* * Diagnostic: Congestion Signaling Capability Descriptor */ struct fc_diag_cg_sig_desc { __be32 desc_tag; /* Descriptor Tag (0x0001000F) */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding * desc_tag and desc_len fields. * 16 bytes */ __be32 xmt_signal_capability; struct fc_diag_cg_sig_freq xmt_signal_frequency; __be32 rcv_signal_capability; struct fc_diag_cg_sig_freq rcv_signal_frequency; }; /* * ELS_EDC - Exchange Diagnostic Capabilities */ struct fc_els_edc { __u8 edc_cmd; /* command (0x17) */ __u8 edc_zero[3]; /* specified as zero - part of cmd */ __be32 desc_len; /* Length of Descriptor List (in bytes). * Size of ELS excluding edc_cmd, * edc_zero and desc_len fields. */ struct fc_tlv_desc desc[0]; /* Diagnostic Descriptor list */ }; /* * ELS EDC LS_ACC Response. */ struct fc_els_edc_resp { struct fc_els_ls_acc acc_hdr; __be32 desc_list_len; /* Length of response (in * bytes). Excludes acc_hdr * and desc_list_len fields. */ struct fc_els_lsri_desc lsri; struct fc_tlv_desc desc[0]; /* Supported Diagnostic Descriptor list */ }; #endif /* _FC_ELS_H_ */ scsi/fc/fc_fs.h 0000644 00000030117 15063602061 0007327 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_FS_H_ #define _FC_FS_H_ #include <linux/types.h> /* * Fibre Channel Framing and Signalling definitions. * From T11 FC-FS-2 Rev 0.90 - 9 August 2005. */ /* * Frame header */ struct fc_frame_header { __u8 fh_r_ctl; /* routing control */ __u8 fh_d_id[3]; /* Destination ID */ __u8 fh_cs_ctl; /* class of service control / pri */ __u8 fh_s_id[3]; /* Source ID */ __u8 fh_type; /* see enum fc_fh_type below */ __u8 fh_f_ctl[3]; /* frame control */ __u8 fh_seq_id; /* sequence ID */ __u8 fh_df_ctl; /* data field control */ __be16 fh_seq_cnt; /* sequence count */ __be16 fh_ox_id; /* originator exchange ID */ __be16 fh_rx_id; /* responder exchange ID */ __be32 fh_parm_offset; /* parameter or relative offset */ }; #define FC_FRAME_HEADER_LEN 24 /* expected length of structure */ #define FC_MAX_PAYLOAD 2112U /* max payload length in bytes */ #define FC_MIN_MAX_PAYLOAD 256U /* lower limit on max payload */ #define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN) #define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN) /* * fh_r_ctl - Routing control definitions. */ /* * FC-4 device_data. */ enum fc_rctl { FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */ FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */ FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */ FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */ FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */ FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */ FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */ FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */ #define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL /* ILS request */ #define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL /* ILS reply */ /* * Extended Link_Data */ FC_RCTL_ELS_REQ = 0x22, /* extended link services request */ FC_RCTL_ELS_REP = 0x23, /* extended link services reply */ FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */ FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */ /* * Optional Extended Headers */ FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */ FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */ FC_RCTL_ENCH = 0x52, /* encapsulation header */ /* * Basic Link Services fh_r_ctl values. */ FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */ FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */ FC_RCTL_BA_RMC = 0x82, /* remove connection */ FC_RCTL_BA_ACC = 0x84, /* basic accept */ FC_RCTL_BA_RJT = 0x85, /* basic reject */ FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */ /* * Link Control Information. */ FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */ FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */ FC_RCTL_P_RJT = 0xc2, /* port reject */ FC_RCTL_F_RJT = 0xc3, /* fabric reject */ FC_RCTL_P_BSY = 0xc4, /* port busy */ FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */ FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */ FC_RCTL_LCR = 0xc7, /* link credit reset */ FC_RCTL_END = 0xc9, /* end */ }; /* incomplete list of definitions */ /* * R_CTL names initializer. * Please keep this matching the above definitions. */ #define FC_RCTL_NAMES_INIT { \ [FC_RCTL_DD_UNCAT] = "uncat", \ [FC_RCTL_DD_SOL_DATA] = "sol data", \ [FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \ [FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \ [FC_RCTL_DD_UNSOL_DATA] = "unsol data", \ [FC_RCTL_DD_DATA_DESC] = "data desc", \ [FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \ [FC_RCTL_DD_CMD_STATUS] = "cmd status", \ [FC_RCTL_ELS_REQ] = "ELS req", \ [FC_RCTL_ELS_REP] = "ELS rep", \ [FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \ [FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \ [FC_RCTL_BA_NOP] = "BLS NOP", \ [FC_RCTL_BA_ABTS] = "BLS abort", \ [FC_RCTL_BA_RMC] = "BLS remove connection", \ [FC_RCTL_BA_ACC] = "BLS accept", \ [FC_RCTL_BA_RJT] = "BLS reject", \ [FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \ [FC_RCTL_ACK_1] = "LC ACK_1", \ [FC_RCTL_ACK_0] = "LC ACK_0", \ [FC_RCTL_P_RJT] = "LC port reject", \ [FC_RCTL_F_RJT] = "LC fabric reject", \ [FC_RCTL_P_BSY] = "LC port busy", \ [FC_RCTL_F_BSY] = "LC fabric busy to data frame", \ [FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\ [FC_RCTL_LCR] = "LC link credit reset", \ [FC_RCTL_END] = "LC end", \ } /* * Well-known fabric addresses. */ enum fc_well_known_fid { FC_FID_NONE = 0x000000, /* No destination */ FC_FID_BCAST = 0xffffff, /* broadcast */ FC_FID_FLOGI = 0xfffffe, /* fabric login */ FC_FID_FCTRL = 0xfffffd, /* fabric controller */ FC_FID_DIR_SERV = 0xfffffc, /* directory server */ FC_FID_TIME_SERV = 0xfffffb, /* time server */ FC_FID_MGMT_SERV = 0xfffffa, /* management server */ FC_FID_QOS = 0xfffff9, /* QoS Facilitator */ FC_FID_ALIASES = 0xfffff8, /* alias server (FC-PH2) */ FC_FID_SEC_KEY = 0xfffff7, /* Security key dist. server */ FC_FID_CLOCK = 0xfffff6, /* clock synch server */ FC_FID_MCAST_SERV = 0xfffff5, /* multicast server */ }; #define FC_FID_WELL_KNOWN_MAX 0xffffff /* highest well-known fabric ID */ #define FC_FID_WELL_KNOWN_BASE 0xfffff5 /* start of well-known fabric ID */ /* * Other well-known addresses, outside the above contiguous range. */ #define FC_FID_DOM_MGR 0xfffc00 /* domain manager base */ /* * Fabric ID bytes. */ #define FC_FID_DOMAIN 0 #define FC_FID_PORT 1 #define FC_FID_LINK 2 /* * fh_type codes */ enum fc_fh_type { FC_TYPE_BLS = 0x00, /* basic link service */ FC_TYPE_ELS = 0x01, /* extended link service */ FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */ FC_TYPE_FCP = 0x08, /* SCSI FCP */ FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */ FC_TYPE_ILS = 0x22, /* internal link service */ FC_TYPE_NVME = 0x28, /* FC-NVME */ }; /* * FC_TYPE names initializer. * Please keep this matching the above definitions. */ #define FC_TYPE_NAMES_INIT { \ [FC_TYPE_BLS] = "BLS", \ [FC_TYPE_ELS] = "ELS", \ [FC_TYPE_IP] = "IP", \ [FC_TYPE_FCP] = "FCP", \ [FC_TYPE_CT] = "CT", \ [FC_TYPE_ILS] = "ILS", \ [FC_TYPE_NVME] = "NVME", \ } /* * Exchange IDs. */ #define FC_XID_UNKNOWN 0xffff /* unknown exchange ID */ #define FC_XID_MIN 0x0 /* supported min exchange ID */ #define FC_XID_MAX 0xfffe /* supported max exchange ID */ /* * fh_f_ctl - Frame control flags. */ #define FC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */ #define FC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */ #define FC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */ #define FC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */ #define FC_FC_END_SEQ (1 << 19) /* last frame of sequence */ #define FC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */ #define FC_FC_RES_B17 (1 << 17) /* reserved */ #define FC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */ #define FC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */ #define FC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */ #define FC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */ #define FC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */ #define FC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */ #define FC_FC_RES_B11 (1 << 11) /* reserved */ #define FC_FC_RES_B10 (1 << 10) /* reserved */ #define FC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */ #define FC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */ #define FC_FC_CONT_SEQ(i) ((i) << 6) #define FC_FC_ABT_SEQ(i) ((i) << 4) #define FC_FC_REL_OFF (1 << 3) /* parameter is relative offset */ #define FC_FC_RES2 (1 << 2) /* reserved */ #define FC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */ /* * BA_ACC payload. */ struct fc_ba_acc { __u8 ba_seq_id_val; /* SEQ_ID validity */ #define FC_BA_SEQ_ID_VAL 0x80 __u8 ba_seq_id; /* SEQ_ID of seq last deliverable */ __u8 ba_resvd[2]; /* reserved */ __be16 ba_ox_id; /* OX_ID for aborted seq or exch */ __be16 ba_rx_id; /* RX_ID for aborted seq or exch */ __be16 ba_low_seq_cnt; /* low SEQ_CNT of aborted seq */ __be16 ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */ }; /* * BA_RJT: Basic Reject payload. */ struct fc_ba_rjt { __u8 br_resvd; /* reserved */ __u8 br_reason; /* reason code */ __u8 br_explan; /* reason explanation */ __u8 br_vendor; /* vendor unique code */ }; /* * BA_RJT reason codes. * From FS-2. */ enum fc_ba_rjt_reason { FC_BA_RJT_NONE = 0, /* in software this means no reject */ FC_BA_RJT_INVL_CMD = 0x01, /* invalid command code */ FC_BA_RJT_LOG_ERR = 0x03, /* logical error */ FC_BA_RJT_LOG_BUSY = 0x05, /* logical busy */ FC_BA_RJT_PROTO_ERR = 0x07, /* protocol error */ FC_BA_RJT_UNABLE = 0x09, /* unable to perform request */ FC_BA_RJT_VENDOR = 0xff, /* vendor-specific (see br_vendor) */ }; /* * BA_RJT reason code explanations. */ enum fc_ba_rjt_explan { FC_BA_RJT_EXP_NONE = 0x00, /* no additional expanation */ FC_BA_RJT_INV_XID = 0x03, /* invalid OX_ID-RX_ID combination */ FC_BA_RJT_ABT = 0x05, /* sequence aborted, no seq info */ }; /* * P_RJT or F_RJT: Port Reject or Fabric Reject parameter field. */ struct fc_pf_rjt { __u8 rj_action; /* reserved */ __u8 rj_reason; /* reason code */ __u8 rj_resvd; /* reserved */ __u8 rj_vendor; /* vendor unique code */ }; /* * P_RJT and F_RJT reject reason codes. */ enum fc_pf_rjt_reason { FC_RJT_NONE = 0, /* non-reject (reserved by standard) */ FC_RJT_INVL_DID = 0x01, /* invalid destination ID */ FC_RJT_INVL_SID = 0x02, /* invalid source ID */ FC_RJT_P_UNAV_T = 0x03, /* port unavailable, temporary */ FC_RJT_P_UNAV = 0x04, /* port unavailable, permanent */ FC_RJT_CLS_UNSUP = 0x05, /* class not supported */ FC_RJT_DEL_USAGE = 0x06, /* delimiter usage error */ FC_RJT_TYPE_UNSUP = 0x07, /* type not supported */ FC_RJT_LINK_CTL = 0x08, /* invalid link control */ FC_RJT_R_CTL = 0x09, /* invalid R_CTL field */ FC_RJT_F_CTL = 0x0a, /* invalid F_CTL field */ FC_RJT_OX_ID = 0x0b, /* invalid originator exchange ID */ FC_RJT_RX_ID = 0x0c, /* invalid responder exchange ID */ FC_RJT_SEQ_ID = 0x0d, /* invalid sequence ID */ FC_RJT_DF_CTL = 0x0e, /* invalid DF_CTL field */ FC_RJT_SEQ_CNT = 0x0f, /* invalid SEQ_CNT field */ FC_RJT_PARAM = 0x10, /* invalid parameter field */ FC_RJT_EXCH_ERR = 0x11, /* exchange error */ FC_RJT_PROTO = 0x12, /* protocol error */ FC_RJT_LEN = 0x13, /* incorrect length */ FC_RJT_UNEXP_ACK = 0x14, /* unexpected ACK */ FC_RJT_FAB_CLASS = 0x15, /* class unsupported by fabric entity */ FC_RJT_LOGI_REQ = 0x16, /* login required */ FC_RJT_SEQ_XS = 0x17, /* excessive sequences attempted */ FC_RJT_EXCH_EST = 0x18, /* unable to establish exchange */ FC_RJT_FAB_UNAV = 0x1a, /* fabric unavailable */ FC_RJT_VC_ID = 0x1b, /* invalid VC_ID (class 4) */ FC_RJT_CS_CTL = 0x1c, /* invalid CS_CTL field */ FC_RJT_INSUF_RES = 0x1d, /* insuff. resources for VC (Class 4) */ FC_RJT_INVL_CLS = 0x1f, /* invalid class of service */ FC_RJT_PREEMT_RJT = 0x20, /* preemption request rejected */ FC_RJT_PREEMT_DIS = 0x21, /* preemption not enabled */ FC_RJT_MCAST_ERR = 0x22, /* multicast error */ FC_RJT_MCAST_ET = 0x23, /* multicast error terminate */ FC_RJT_PRLI_REQ = 0x24, /* process login required */ FC_RJT_INVL_ATT = 0x25, /* invalid attachment */ FC_RJT_VENDOR = 0xff, /* vendor specific reject */ }; /* default timeout values */ #define FC_DEF_E_D_TOV 2000UL #define FC_DEF_R_A_TOV 10000UL #endif /* _FC_FS_H_ */ scsi/fc/fc_gs.h 0000644 00000005517 15063602061 0007336 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_GS_H_ #define _FC_GS_H_ #include <linux/types.h> /* * Fibre Channel Services - Common Transport. * From T11.org FC-GS-2 Rev 5.3 November 1998. */ struct fc_ct_hdr { __u8 ct_rev; /* revision */ __u8 ct_in_id[3]; /* N_Port ID of original requestor */ __u8 ct_fs_type; /* type of fibre channel service */ __u8 ct_fs_subtype; /* subtype */ __u8 ct_options; __u8 _ct_resvd1; __be16 ct_cmd; /* command / response code */ __be16 ct_mr_size; /* maximum / residual size */ __u8 _ct_resvd2; __u8 ct_reason; /* reject reason */ __u8 ct_explan; /* reason code explanation */ __u8 ct_vendor; /* vendor unique data */ }; #define FC_CT_HDR_LEN 16 /* expected sizeof (struct fc_ct_hdr) */ enum fc_ct_rev { FC_CT_REV = 1 /* common transport revision */ }; /* * ct_fs_type values. */ enum fc_ct_fs_type { FC_FST_ALIAS = 0xf8, /* alias service */ FC_FST_MGMT = 0xfa, /* management service */ FC_FST_TIME = 0xfb, /* time service */ FC_FST_DIR = 0xfc, /* directory service */ }; /* * ct_cmd: Command / response codes */ enum fc_ct_cmd { FC_FS_RJT = 0x8001, /* reject */ FC_FS_ACC = 0x8002, /* accept */ }; /* * FS_RJT reason codes. */ enum fc_ct_reason { FC_FS_RJT_CMD = 0x01, /* invalid command code */ FC_FS_RJT_VER = 0x02, /* invalid version level */ FC_FS_RJT_LOG = 0x03, /* logical error */ FC_FS_RJT_IUSIZ = 0x04, /* invalid IU size */ FC_FS_RJT_BSY = 0x05, /* logical busy */ FC_FS_RJT_PROTO = 0x07, /* protocol error */ FC_FS_RJT_UNABL = 0x09, /* unable to perform command request */ FC_FS_RJT_UNSUP = 0x0b, /* command not supported */ }; /* * FS_RJT reason code explanations. */ enum fc_ct_explan { FC_FS_EXP_NONE = 0x00, /* no additional explanation */ FC_FS_EXP_PID = 0x01, /* port ID not registered */ FC_FS_EXP_PNAM = 0x02, /* port name not registered */ FC_FS_EXP_NNAM = 0x03, /* node name not registered */ FC_FS_EXP_COS = 0x04, /* class of service not registered */ FC_FS_EXP_FTNR = 0x07, /* FC-4 types not registered */ /* definitions not complete */ }; #endif /* _FC_GS_H_ */ scsi/fc/fc_ns.h 0000644 00000011565 15063602061 0007345 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_NS_H_ #define _FC_NS_H_ #include <linux/types.h> /* * Fibre Channel Services - Name Service (dNS) * From T11.org FC-GS-2 Rev 5.3 November 1998. */ /* * Common-transport sub-type for Name Server. */ #define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */ /* * Name server Requests. * Note: this is an incomplete list, some unused requests are omitted. */ enum fc_ns_req { FC_NS_GA_NXT = 0x0100, /* get all next */ FC_NS_GI_A = 0x0101, /* get identifiers - scope */ FC_NS_GPN_ID = 0x0112, /* get port name by ID */ FC_NS_GNN_ID = 0x0113, /* get node name by ID */ FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */ FC_NS_GID_PN = 0x0121, /* get ID for port name */ FC_NS_GID_NN = 0x0131, /* get IDs for node name */ FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */ FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */ FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */ }; /* * Port type values. */ enum fc_ns_pt { FC_NS_UNID_PORT = 0x00, /* unidentified */ FC_NS_N_PORT = 0x01, /* N port */ FC_NS_NL_PORT = 0x02, /* NL port */ FC_NS_FNL_PORT = 0x03, /* F/NL port */ FC_NS_NX_PORT = 0x7f, /* Nx port */ FC_NS_F_PORT = 0x81, /* F port */ FC_NS_FL_PORT = 0x82, /* FL port */ FC_NS_E_PORT = 0x84, /* E port */ FC_NS_B_PORT = 0x85, /* B port */ }; /* * Port type object. */ struct fc_ns_pt_obj { __u8 pt_type; }; /* * Port ID object */ struct fc_ns_fid { __u8 fp_flags; /* flags for responses only */ __u8 fp_fid[3]; }; /* * fp_flags in port ID object, for responses only. */ #define FC_NS_FID_LAST 0x80 /* last object */ /* * FC4-types object. */ #define FC_NS_TYPES 256 /* number of possible FC-4 types */ #define FC_NS_BPW 32 /* bits per word in bitmap */ struct fc_ns_fts { __be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */ }; /* * FC4-features object. */ struct fc_ns_ff { __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */ }; /* * GID_PT request. */ struct fc_ns_gid_pt { __u8 fn_pt_type; __u8 fn_domain_id_scope; __u8 fn_area_id_scope; __u8 fn_resvd; }; /* * GID_FT or GPN_FT request. */ struct fc_ns_gid_ft { __u8 fn_resvd; __u8 fn_domain_id_scope; __u8 fn_area_id_scope; __u8 fn_fc4_type; }; /* * GPN_FT response. */ struct fc_gpn_ft_resp { __u8 fp_flags; /* see fp_flags definitions above */ __u8 fp_fid[3]; /* port ID */ __be32 fp_resvd; __be64 fp_wwpn; /* port name */ }; /* * GID_PN request */ struct fc_ns_gid_pn { __be64 fn_wwpn; /* port name */ }; /* * GID_PN response or GSPN_ID request */ struct fc_gid_pn_resp { __u8 fp_resvd; __u8 fp_fid[3]; /* port ID */ }; /* * GSPN_ID response */ struct fc_gspn_resp { __u8 fp_name_len; char fp_name[]; }; /* * RFT_ID request - register FC-4 types for ID. */ struct fc_ns_rft_id { struct fc_ns_fid fr_fid; /* port ID object */ struct fc_ns_fts fr_fts; /* FC-4 types object */ }; /* * RPN_ID request - register port name for ID. * RNN_ID request - register node name for ID. */ struct fc_ns_rn_id { struct fc_ns_fid fr_fid; /* port ID object */ __be64 fr_wwn; /* node name or port name */ } __attribute__((__packed__)); /* * RSNN_NN request - register symbolic node name */ struct fc_ns_rsnn { __be64 fr_wwn; /* node name */ __u8 fr_name_len; char fr_name[]; } __attribute__((__packed__)); /* * RSPN_ID request - register symbolic port name */ struct fc_ns_rspn { struct fc_ns_fid fr_fid; /* port ID object */ __u8 fr_name_len; char fr_name[]; } __attribute__((__packed__)); /* * RFF_ID request - register FC-4 Features for ID. */ struct fc_ns_rff_id { struct fc_ns_fid fr_fid; /* port ID object */ __u8 fr_resvd[2]; __u8 fr_feat; /* FC-4 Feature bits */ __u8 fr_type; /* FC-4 type */ } __attribute__((__packed__)); #endif /* _FC_NS_H_ */ scsi/cxlflash_ioctl.h 0000644 00000023670 15063602061 0010663 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * CXL Flash Device Driver * * Written by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>, IBM Corporation * Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation * * Copyright (C) 2015 IBM Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _CXLFLASH_IOCTL_H #define _CXLFLASH_IOCTL_H #include <linux/types.h> /* * Structure and definitions for all CXL Flash ioctls */ #define CXLFLASH_WWID_LEN 16 /* * Structure and flag definitions CXL Flash superpipe ioctls */ #define DK_CXLFLASH_VERSION_0 0 struct dk_cxlflash_hdr { __u16 version; /* Version data */ __u16 rsvd[3]; /* Reserved for future use */ __u64 flags; /* Input flags */ __u64 return_flags; /* Returned flags */ }; /* * Return flag definitions available to all superpipe ioctls * * Similar to the input flags, these are grown from the bottom-up with the * intention that ioctl-specific return flag definitions would grow from the * top-down, allowing the two sets to co-exist. While not required/enforced * at this time, this provides future flexibility. */ #define DK_CXLFLASH_ALL_PORTS_ACTIVE 0x0000000000000001ULL #define DK_CXLFLASH_APP_CLOSE_ADAP_FD 0x0000000000000002ULL #define DK_CXLFLASH_CONTEXT_SQ_CMD_MODE 0x0000000000000004ULL /* * General Notes: * ------------- * The 'context_id' field of all ioctl structures contains the context * identifier for a context in the lower 32-bits (upper 32-bits are not * to be used when identifying a context to the AFU). That said, the value * in its entirety (all 64-bits) is to be treated as an opaque cookie and * should be presented as such when issuing ioctls. */ /* * DK_CXLFLASH_ATTACH Notes: * ------------------------ * Read/write access permissions are specified via the O_RDONLY, O_WRONLY, * and O_RDWR flags defined in the fcntl.h header file. * * A valid adapter file descriptor (fd >= 0) is only returned on the initial * attach (successful) of a context. When a context is shared(reused), the user * is expected to already 'know' the adapter file descriptor associated with the * context. */ #define DK_CXLFLASH_ATTACH_REUSE_CONTEXT 0x8000000000000000ULL struct dk_cxlflash_attach { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 num_interrupts; /* Requested number of interrupts */ __u64 context_id; /* Returned context */ __u64 mmio_size; /* Returned size of MMIO area */ __u64 block_size; /* Returned block size, in bytes */ __u64 adap_fd; /* Returned adapter file descriptor */ __u64 last_lba; /* Returned last LBA on the device */ __u64 max_xfer; /* Returned max transfer size, blocks */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_detach { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context to detach */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_udirect { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context to own physical resources */ __u64 rsrc_handle; /* Returned resource handle */ __u64 last_lba; /* Returned last LBA on the device */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_UVIRTUAL_NEED_WRITE_SAME 0x8000000000000000ULL struct dk_cxlflash_uvirtual { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context to own virtual resources */ __u64 lun_size; /* Requested size, in 4K blocks */ __u64 rsrc_handle; /* Returned resource handle */ __u64 last_lba; /* Returned last LBA of LUN */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_release { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context owning resources */ __u64 rsrc_handle; /* Resource handle to release */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_resize { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context owning resources */ __u64 rsrc_handle; /* Resource handle of LUN to resize */ __u64 req_size; /* New requested size, in 4K blocks */ __u64 last_lba; /* Returned last LBA of LUN */ __u64 reserved[8]; /* Reserved for future use */ }; struct dk_cxlflash_clone { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id_src; /* Context to clone from */ __u64 context_id_dst; /* Context to clone to */ __u64 adap_fd_src; /* Source context adapter fd */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_VERIFY_SENSE_LEN 18 #define DK_CXLFLASH_VERIFY_HINT_SENSE 0x8000000000000000ULL struct dk_cxlflash_verify { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 context_id; /* Context owning resources to verify */ __u64 rsrc_handle; /* Resource handle of LUN */ __u64 hint; /* Reasons for verify */ __u64 last_lba; /* Returned last LBA of device */ __u8 sense_data[DK_CXLFLASH_VERIFY_SENSE_LEN]; /* SCSI sense data */ __u8 pad[6]; /* Pad to next 8-byte boundary */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_RECOVER_AFU_CONTEXT_RESET 0x8000000000000000ULL struct dk_cxlflash_recover_afu { struct dk_cxlflash_hdr hdr; /* Common fields */ __u64 reason; /* Reason for recovery request */ __u64 context_id; /* Context to recover / updated ID */ __u64 mmio_size; /* Returned size of MMIO area */ __u64 adap_fd; /* Returned adapter file descriptor */ __u64 reserved[8]; /* Reserved for future use */ }; #define DK_CXLFLASH_MANAGE_LUN_WWID_LEN CXLFLASH_WWID_LEN #define DK_CXLFLASH_MANAGE_LUN_ENABLE_SUPERPIPE 0x8000000000000000ULL #define DK_CXLFLASH_MANAGE_LUN_DISABLE_SUPERPIPE 0x4000000000000000ULL #define DK_CXLFLASH_MANAGE_LUN_ALL_PORTS_ACCESSIBLE 0x2000000000000000ULL struct dk_cxlflash_manage_lun { struct dk_cxlflash_hdr hdr; /* Common fields */ __u8 wwid[DK_CXLFLASH_MANAGE_LUN_WWID_LEN]; /* Page83 WWID, NAA-6 */ __u64 reserved[8]; /* Rsvd, future use */ }; union cxlflash_ioctls { struct dk_cxlflash_attach attach; struct dk_cxlflash_detach detach; struct dk_cxlflash_udirect udirect; struct dk_cxlflash_uvirtual uvirtual; struct dk_cxlflash_release release; struct dk_cxlflash_resize resize; struct dk_cxlflash_clone clone; struct dk_cxlflash_verify verify; struct dk_cxlflash_recover_afu recover_afu; struct dk_cxlflash_manage_lun manage_lun; }; #define MAX_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ioctls)) #define CXL_MAGIC 0xCA #define CXL_IOWR(_n, _s) _IOWR(CXL_MAGIC, _n, struct _s) /* * CXL Flash superpipe ioctls start at base of the reserved CXL_MAGIC * region (0x80) and grow upwards. */ #define DK_CXLFLASH_ATTACH CXL_IOWR(0x80, dk_cxlflash_attach) #define DK_CXLFLASH_USER_DIRECT CXL_IOWR(0x81, dk_cxlflash_udirect) #define DK_CXLFLASH_RELEASE CXL_IOWR(0x82, dk_cxlflash_release) #define DK_CXLFLASH_DETACH CXL_IOWR(0x83, dk_cxlflash_detach) #define DK_CXLFLASH_VERIFY CXL_IOWR(0x84, dk_cxlflash_verify) #define DK_CXLFLASH_RECOVER_AFU CXL_IOWR(0x85, dk_cxlflash_recover_afu) #define DK_CXLFLASH_MANAGE_LUN CXL_IOWR(0x86, dk_cxlflash_manage_lun) #define DK_CXLFLASH_USER_VIRTUAL CXL_IOWR(0x87, dk_cxlflash_uvirtual) #define DK_CXLFLASH_VLUN_RESIZE CXL_IOWR(0x88, dk_cxlflash_resize) #define DK_CXLFLASH_VLUN_CLONE CXL_IOWR(0x89, dk_cxlflash_clone) /* * Structure and flag definitions CXL Flash host ioctls */ #define HT_CXLFLASH_VERSION_0 0 struct ht_cxlflash_hdr { __u16 version; /* Version data */ __u16 subcmd; /* Sub-command */ __u16 rsvd[2]; /* Reserved for future use */ __u64 flags; /* Input flags */ __u64 return_flags; /* Returned flags */ }; /* * Input flag definitions available to all host ioctls * * These are grown from the bottom-up with the intention that ioctl-specific * input flag definitions would grow from the top-down, allowing the two sets * to co-exist. While not required/enforced at this time, this provides future * flexibility. */ #define HT_CXLFLASH_HOST_READ 0x0000000000000000ULL #define HT_CXLFLASH_HOST_WRITE 0x0000000000000001ULL #define HT_CXLFLASH_LUN_PROVISION_SUBCMD_CREATE_LUN 0x0001 #define HT_CXLFLASH_LUN_PROVISION_SUBCMD_DELETE_LUN 0x0002 #define HT_CXLFLASH_LUN_PROVISION_SUBCMD_QUERY_PORT 0x0003 struct ht_cxlflash_lun_provision { struct ht_cxlflash_hdr hdr; /* Common fields */ __u16 port; /* Target port for provision request */ __u16 reserved16[3]; /* Reserved for future use */ __u64 size; /* Size of LUN (4K blocks) */ __u64 lun_id; /* SCSI LUN ID */ __u8 wwid[CXLFLASH_WWID_LEN];/* Page83 WWID, NAA-6 */ __u64 max_num_luns; /* Maximum number of LUNs provisioned */ __u64 cur_num_luns; /* Current number of LUNs provisioned */ __u64 max_cap_port; /* Total capacity for port (4K blocks) */ __u64 cur_cap_port; /* Current capacity for port (4K blocks) */ __u64 reserved[8]; /* Reserved for future use */ }; #define HT_CXLFLASH_AFU_DEBUG_MAX_DATA_LEN 262144 /* 256K */ #define HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN 12 struct ht_cxlflash_afu_debug { struct ht_cxlflash_hdr hdr; /* Common fields */ __u8 reserved8[4]; /* Reserved for future use */ __u8 afu_subcmd[HT_CXLFLASH_AFU_DEBUG_SUBCMD_LEN]; /* AFU subcommand, * (pass through) */ __u64 data_ea; /* Data buffer effective address */ __u32 data_len; /* Data buffer length */ __u32 reserved32; /* Reserved for future use */ __u64 reserved[8]; /* Reserved for future use */ }; union cxlflash_ht_ioctls { struct ht_cxlflash_lun_provision lun_provision; struct ht_cxlflash_afu_debug afu_debug; }; #define MAX_HT_CXLFLASH_IOCTL_SZ (sizeof(union cxlflash_ht_ioctls)) /* * CXL Flash host ioctls start at the top of the reserved CXL_MAGIC * region (0xBF) and grow downwards. */ #define HT_CXLFLASH_LUN_PROVISION CXL_IOWR(0xBF, ht_cxlflash_lun_provision) #define HT_CXLFLASH_AFU_DEBUG CXL_IOWR(0xBE, ht_cxlflash_afu_debug) #endif /* ifndef _CXLFLASH_IOCTL_H */ scsi/scsi_bsg_fc.h 0000644 00000021161 15063602061 0010122 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * FC Transport BSG Interface * * Copyright (C) 2008 James Smart, Emulex Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_BSG_FC_H #define SCSI_BSG_FC_H /* * This file intended to be included by both kernel and user space */ /* * FC Transport SGIO v4 BSG Message Support */ /* Default BSG request timeout (in seconds) */ #define FC_DEFAULT_BSG_TIMEOUT (10 * HZ) /* * Request Message Codes supported by the FC Transport */ /* define the class masks for the message codes */ #define FC_BSG_CLS_MASK 0xF0000000 /* find object class */ #define FC_BSG_HST_MASK 0x80000000 /* fc host class */ #define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */ /* fc_host Message Codes */ #define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001) #define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002) #define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003) #define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004) #define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF) /* fc_rport Message Codes */ #define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001) #define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002) /* * FC Address Identifiers in Message Structures : * * Whenever a command payload contains a FC Address Identifier * (aka port_id), the value is effectively in big-endian * order, thus the array elements are decoded as follows: * element [0] is bits 23:16 of the FC Address Identifier * element [1] is bits 15:8 of the FC Address Identifier * element [2] is bits 7:0 of the FC Address Identifier */ /* * FC Host Messages */ /* FC_BSG_HST_ADDR_PORT : */ /* Request: * This message requests the FC host to login to the remote port * at the specified N_Port_Id. The remote port is to be enumerated * with the transport upon completion of the login. */ struct fc_bsg_host_add_rport { uint8_t reserved; /* FC Address Identier of the remote port to login to */ uint8_t port_id[3]; }; /* Response: * There is no additional response data - fc_bsg_reply->result is sufficient */ /* FC_BSG_HST_DEL_RPORT : */ /* Request: * This message requests the FC host to remove an enumerated * remote port and to terminate the login to it. * * Note: The driver is free to reject this request if it desires to * remain logged in with the remote port. */ struct fc_bsg_host_del_rport { uint8_t reserved; /* FC Address Identier of the remote port to logout of */ uint8_t port_id[3]; }; /* Response: * There is no additional response data - fc_bsg_reply->result is sufficient */ /* FC_BSG_HST_ELS_NOLOGIN : */ /* Request: * This message requests the FC_Host to send an ELS to a specific * N_Port_ID. The host does not need to log into the remote port, * nor does it need to enumerate the rport for further traffic * (although, the FC host is free to do so if it desires). */ struct fc_bsg_host_els { /* * ELS Command Code being sent (must be the same as byte 0 * of the payload) */ uint8_t command_code; /* FC Address Identier of the remote port to send the ELS to */ uint8_t port_id[3]; }; /* Response: */ /* fc_bsg_ctels_reply->status values */ #define FC_CTELS_STATUS_OK 0x00000000 #define FC_CTELS_STATUS_REJECT 0x00000001 #define FC_CTELS_STATUS_P_RJT 0x00000002 #define FC_CTELS_STATUS_F_RJT 0x00000003 #define FC_CTELS_STATUS_P_BSY 0x00000004 #define FC_CTELS_STATUS_F_BSY 0x00000006 struct fc_bsg_ctels_reply { /* * Note: An ELS LS_RJT may be reported in 2 ways: * a) A status of FC_CTELS_STATUS_OK is returned. The caller * is to look into the ELS receive payload to determine * LS_ACC or LS_RJT (by contents of word 0). The reject * data will be in word 1. * b) A status of FC_CTELS_STATUS_REJECT is returned, The * rjt_data field will contain valid data. * * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and * the receive payload word 0 indicates LS_ACC * (e.g. value is 0x02xxxxxx). * * Note: Similarly, a CT Reject may be reported in 2 ways: * a) A status of FC_CTELS_STATUS_OK is returned. The caller * is to look into the CT receive payload to determine * Accept or Reject (by contents of word 2). The reject * data will be in word 3. * b) A status of FC_CTELS_STATUS_REJECT is returned, The * rjt_data field will contain valid data. * * Note: x_RJT/BSY status will indicae that the rjt_data field * is valid and contains the reason/explanation values. */ uint32_t status; /* See FC_CTELS_STATUS_xxx */ /* valid if status is not FC_CTELS_STATUS_OK */ struct { uint8_t action; /* fragment_id for CT REJECT */ uint8_t reason_code; uint8_t reason_explanation; uint8_t vendor_unique; } rjt_data; }; /* FC_BSG_HST_CT : */ /* Request: * This message requests that a CT Request be performed with the * indicated N_Port_ID. The driver is responsible for logging in with * the fabric and/or N_Port_ID, etc as per FC rules. This request does * not mandate that the driver must enumerate the destination in the * transport. The driver is allowed to decide whether to enumerate it, * and whether to tear it down after the request. */ struct fc_bsg_host_ct { uint8_t reserved; /* FC Address Identier of the remote port to send the ELS to */ uint8_t port_id[3]; /* * We need words 0-2 of the generic preamble for the LLD's */ uint32_t preamble_word0; /* revision & IN_ID */ uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ uint32_t preamble_word2; /* Cmd Code, Max Size */ }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* FC_BSG_HST_VENDOR : */ /* Request: * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified in scsi_netlink.h */ struct fc_bsg_host_vendor { /* * Identifies the vendor that the message is formatted for. This * should be the recipient of the message. */ uint64_t vendor_id; /* start of vendor command area */ uint32_t vendor_cmd[0]; }; /* Response: */ struct fc_bsg_host_vendor_reply { /* start of vendor response area */ uint32_t vendor_rsp[0]; }; /* * FC Remote Port Messages */ /* FC_BSG_RPT_ELS : */ /* Request: * This message requests that an ELS be performed with the rport. */ struct fc_bsg_rport_els { /* * ELS Command Code being sent (must be the same as * byte 0 of the payload) */ uint8_t els_code; }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* FC_BSG_RPT_CT : */ /* Request: * This message requests that a CT Request be performed with the rport. */ struct fc_bsg_rport_ct { /* * We need words 0-2 of the generic preamble for the LLD's */ uint32_t preamble_word0; /* revision & IN_ID */ uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ uint32_t preamble_word2; /* Cmd Code, Max Size */ }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* request (CDB) structure of the sg_io_v4 */ struct fc_bsg_request { uint32_t msgcode; union { struct fc_bsg_host_add_rport h_addrport; struct fc_bsg_host_del_rport h_delrport; struct fc_bsg_host_els h_els; struct fc_bsg_host_ct h_ct; struct fc_bsg_host_vendor h_vendor; struct fc_bsg_rport_els r_els; struct fc_bsg_rport_ct r_ct; } rqst_data; } __attribute__((packed)); /* response (request sense data) structure of the sg_io_v4 */ struct fc_bsg_reply { /* * The completion result. Result exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, * msg and status fields. The per-msgcode reply structure * will contain valid data. */ uint32_t result; /* If there was reply_payload, how much was recevied ? */ uint32_t reply_payload_rcv_len; union { struct fc_bsg_host_vendor_reply vendor_reply; struct fc_bsg_ctels_reply ctels_reply; } reply_data; }; #endif /* SCSI_BSG_FC_H */ scsi/scsi_bsg_mpi3mr.h 0000644 00000036247 15063602061 0010754 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */ /* * Driver for Broadcom MPI3 Storage Controllers * * Copyright (C) 2017-2022 Broadcom Inc. * (mailto: mpi3mr-linuxdrv.pdl@broadcom.com) * */ #ifndef SCSI_BSG_MPI3MR_H_INCLUDED #define SCSI_BSG_MPI3MR_H_INCLUDED #include <linux/types.h> /* Definitions for BSG commands */ #define MPI3MR_IOCTL_VERSION 0x06 #define MPI3MR_APP_DEFAULT_TIMEOUT (60) /*seconds*/ #define MPI3MR_BSG_ADPTYPE_UNKNOWN 0 #define MPI3MR_BSG_ADPTYPE_AVGFAMILY 1 #define MPI3MR_BSG_ADPSTATE_UNKNOWN 0 #define MPI3MR_BSG_ADPSTATE_OPERATIONAL 1 #define MPI3MR_BSG_ADPSTATE_FAULT 2 #define MPI3MR_BSG_ADPSTATE_IN_RESET 3 #define MPI3MR_BSG_ADPSTATE_UNRECOVERABLE 4 #define MPI3MR_BSG_ADPRESET_UNKNOWN 0 #define MPI3MR_BSG_ADPRESET_SOFT 1 #define MPI3MR_BSG_ADPRESET_DIAG_FAULT 2 #define MPI3MR_BSG_LOGDATA_MAX_ENTRIES 400 #define MPI3MR_BSG_LOGDATA_ENTRY_HEADER_SZ 4 #define MPI3MR_DRVBSG_OPCODE_UNKNOWN 0 #define MPI3MR_DRVBSG_OPCODE_ADPINFO 1 #define MPI3MR_DRVBSG_OPCODE_ADPRESET 2 #define MPI3MR_DRVBSG_OPCODE_ALLTGTDEVINFO 4 #define MPI3MR_DRVBSG_OPCODE_GETCHGCNT 5 #define MPI3MR_DRVBSG_OPCODE_LOGDATAENABLE 6 #define MPI3MR_DRVBSG_OPCODE_PELENABLE 7 #define MPI3MR_DRVBSG_OPCODE_GETLOGDATA 8 #define MPI3MR_DRVBSG_OPCODE_QUERY_HDB 9 #define MPI3MR_DRVBSG_OPCODE_REPOST_HDB 10 #define MPI3MR_DRVBSG_OPCODE_UPLOAD_HDB 11 #define MPI3MR_DRVBSG_OPCODE_REFRESH_HDB_TRIGGERS 12 #define MPI3MR_BSG_BUFTYPE_UNKNOWN 0 #define MPI3MR_BSG_BUFTYPE_RAIDMGMT_CMD 1 #define MPI3MR_BSG_BUFTYPE_RAIDMGMT_RESP 2 #define MPI3MR_BSG_BUFTYPE_DATA_IN 3 #define MPI3MR_BSG_BUFTYPE_DATA_OUT 4 #define MPI3MR_BSG_BUFTYPE_MPI_REPLY 5 #define MPI3MR_BSG_BUFTYPE_ERR_RESPONSE 6 #define MPI3MR_BSG_BUFTYPE_MPI_REQUEST 0xFE #define MPI3MR_BSG_MPI_REPLY_BUFTYPE_UNKNOWN 0 #define MPI3MR_BSG_MPI_REPLY_BUFTYPE_STATUS 1 #define MPI3MR_BSG_MPI_REPLY_BUFTYPE_ADDRESS 2 #define MPI3MR_HDB_BUFTYPE_UNKNOWN 0 #define MPI3MR_HDB_BUFTYPE_TRACE 1 #define MPI3MR_HDB_BUFTYPE_FIRMWARE 2 #define MPI3MR_HDB_BUFTYPE_RESERVED 3 #define MPI3MR_HDB_BUFSTATUS_UNKNOWN 0 #define MPI3MR_HDB_BUFSTATUS_NOT_ALLOCATED 1 #define MPI3MR_HDB_BUFSTATUS_POSTED_UNPAUSED 2 #define MPI3MR_HDB_BUFSTATUS_POSTED_PAUSED 3 #define MPI3MR_HDB_BUFSTATUS_RELEASED 4 #define MPI3MR_HDB_TRIGGER_TYPE_UNKNOWN 0 #define MPI3MR_HDB_TRIGGER_TYPE_DIAGFAULT 1 #define MPI3MR_HDB_TRIGGER_TYPE_ELEMENT 2 #define MPI3MR_HDB_TRIGGER_TYPE_MASTER 3 /* Supported BSG commands */ enum command { MPI3MR_DRV_CMD = 1, MPI3MR_MPT_CMD = 2, }; /** * struct mpi3_driver_info_layout - Information about driver * * @information_length: Length of this structure in bytes * @driver_signature: Driver Vendor name * @os_name: Operating System Name * @driver_name: Driver name * @driver_version: Driver version * @driver_release_date: Driver release date * @driver_capabilities: Driver capabilities */ struct mpi3_driver_info_layout { __le32 information_length; __u8 driver_signature[12]; __u8 os_name[16]; __u8 os_version[12]; __u8 driver_name[20]; __u8 driver_version[32]; __u8 driver_release_date[20]; __le32 driver_capabilities; }; /** * struct mpi3mr_bsg_in_adpinfo - Adapter information request * data returned by the driver. * * @adp_type: Adapter type * @rsvd1: Reserved * @pci_dev_id: PCI device ID of the adapter * @pci_dev_hw_rev: PCI revision of the adapter * @pci_subsys_dev_id: PCI subsystem device ID of the adapter * @pci_subsys_ven_id: PCI subsystem vendor ID of the adapter * @pci_dev: PCI device * @pci_func: PCI function * @pci_bus: PCI bus * @rsvd2: Reserved * @pci_seg_id: PCI segment ID * @app_intfc_ver: version of the application interface definition * @rsvd3: Reserved * @rsvd4: Reserved * @rsvd5: Reserved * @driver_info: Driver Information (Version/Name) */ struct mpi3mr_bsg_in_adpinfo { __u32 adp_type; __u32 rsvd1; __u32 pci_dev_id; __u32 pci_dev_hw_rev; __u32 pci_subsys_dev_id; __u32 pci_subsys_ven_id; __u32 pci_dev:5; __u32 pci_func:3; __u32 pci_bus:8; __u16 rsvd2; __u32 pci_seg_id; __u32 app_intfc_ver; __u8 adp_state; __u8 rsvd3; __u16 rsvd4; __u32 rsvd5[2]; struct mpi3_driver_info_layout driver_info; }; /** * struct mpi3mr_bsg_adp_reset - Adapter reset request * payload data to the driver. * * @reset_type: Reset type * @rsvd1: Reserved * @rsvd2: Reserved */ struct mpi3mr_bsg_adp_reset { __u8 reset_type; __u8 rsvd1; __u16 rsvd2; }; /** * struct mpi3mr_change_count - Topology change count * returned by the driver. * * @change_count: Topology change count * @rsvd: Reserved */ struct mpi3mr_change_count { __u16 change_count; __u16 rsvd; }; /** * struct mpi3mr_device_map_info - Target device mapping * information * * @handle: Firmware device handle * @perst_id: Persistent ID assigned by the firmware * @target_id: Target ID assigned by the driver * @bus_id: Bus ID assigned by the driver * @rsvd1: Reserved * @rsvd2: Reserved */ struct mpi3mr_device_map_info { __u16 handle; __u16 perst_id; __u32 target_id; __u8 bus_id; __u8 rsvd1; __u16 rsvd2; }; /** * struct mpi3mr_all_tgt_info - Target device mapping * information returned by the driver * * @num_devices: The number of devices in driver's inventory * @rsvd1: Reserved * @rsvd2: Reserved * @dmi: Variable length array of mapping information of targets */ struct mpi3mr_all_tgt_info { __u16 num_devices; __u16 rsvd1; __u32 rsvd2; struct mpi3mr_device_map_info dmi[1]; }; /** * struct mpi3mr_logdata_enable - Number of log data * entries saved by the driver returned as payload data for * enable logdata BSG request by the driver. * * @max_entries: Number of log data entries cached by the driver * @rsvd: Reserved */ struct mpi3mr_logdata_enable { __u16 max_entries; __u16 rsvd; }; /** * struct mpi3mr_bsg_out_pel_enable - PEL enable request payload * data to the driver. * * @pel_locale: PEL locale to the firmware * @pel_class: PEL class to the firmware * @rsvd: Reserved */ struct mpi3mr_bsg_out_pel_enable { __u16 pel_locale; __u8 pel_class; __u8 rsvd; }; /** * struct mpi3mr_logdata_entry - Log data entry cached by the * driver. * * @valid_entry: Is the entry valid * @rsvd1: Reserved * @rsvd2: Reserved * @data: Variable length Log entry data */ struct mpi3mr_logdata_entry { __u8 valid_entry; __u8 rsvd1; __u16 rsvd2; __u8 data[1]; /* Variable length Array */ }; /** * struct mpi3mr_bsg_in_log_data - Log data entries saved by * the driver returned as payload data for Get logdata request * by the driver. * * @entry: Variable length Log data entry array */ struct mpi3mr_bsg_in_log_data { struct mpi3mr_logdata_entry entry[1]; }; /** * struct mpi3mr_hdb_entry - host diag buffer entry. * * @buf_type: Buffer type * @status: Buffer status * @trigger_type: Trigger type * @rsvd1: Reserved * @size: Buffer size * @rsvd2: Reserved * @trigger_data: Trigger specific data * @rsvd3: Reserved * @rsvd4: Reserved */ struct mpi3mr_hdb_entry { __u8 buf_type; __u8 status; __u8 trigger_type; __u8 rsvd1; __u16 size; __u16 rsvd2; __u64 trigger_data; __u32 rsvd3; __u32 rsvd4; }; /** * struct mpi3mr_bsg_in_hdb_status - This structure contains * return data for the BSG request to retrieve the number of host * diagnostic buffers supported by the driver and their current * status and additional status specific data if any in forms of * multiple hdb entries. * * @num_hdb_types: Number of host diag buffer types supported * @rsvd1: Reserved * @rsvd2: Reserved * @rsvd3: Reserved * @entry: Variable length Diag buffer status entry array */ struct mpi3mr_bsg_in_hdb_status { __u8 num_hdb_types; __u8 rsvd1; __u16 rsvd2; __u32 rsvd3; struct mpi3mr_hdb_entry entry[1]; }; /** * struct mpi3mr_bsg_out_repost_hdb - Repost host diagnostic * buffer request payload data to the driver. * * @buf_type: Buffer type * @rsvd1: Reserved * @rsvd2: Reserved */ struct mpi3mr_bsg_out_repost_hdb { __u8 buf_type; __u8 rsvd1; __u16 rsvd2; }; /** * struct mpi3mr_bsg_out_upload_hdb - Upload host diagnostic * buffer request payload data to the driver. * * @buf_type: Buffer type * @rsvd1: Reserved * @rsvd2: Reserved * @start_offset: Start offset of the buffer from where to copy * @length: Length of the buffer to copy */ struct mpi3mr_bsg_out_upload_hdb { __u8 buf_type; __u8 rsvd1; __u16 rsvd2; __u32 start_offset; __u32 length; }; /** * struct mpi3mr_bsg_out_refresh_hdb_triggers - Refresh host * diagnostic buffer triggers request payload data to the driver. * * @page_type: Page type * @rsvd1: Reserved * @rsvd2: Reserved */ struct mpi3mr_bsg_out_refresh_hdb_triggers { __u8 page_type; __u8 rsvd1; __u16 rsvd2; }; /** * struct mpi3mr_bsg_drv_cmd - Generic bsg data * structure for all driver specific requests. * * @mrioc_id: Controller ID * @opcode: Driver specific opcode * @rsvd1: Reserved * @rsvd2: Reserved */ struct mpi3mr_bsg_drv_cmd { __u8 mrioc_id; __u8 opcode; __u16 rsvd1; __u32 rsvd2[4]; }; /** * struct mpi3mr_bsg_in_reply_buf - MPI reply buffer returned * for MPI Passthrough request . * * @mpi_reply_type: Type of MPI reply * @rsvd1: Reserved * @rsvd2: Reserved * @reply_buf: Variable Length buffer based on mpirep type */ struct mpi3mr_bsg_in_reply_buf { __u8 mpi_reply_type; __u8 rsvd1; __u16 rsvd2; __u8 reply_buf[]; }; /** * struct mpi3mr_buf_entry - User buffer descriptor for MPI * Passthrough requests. * * @buf_type: Buffer type * @rsvd1: Reserved * @rsvd2: Reserved * @buf_len: Buffer length */ struct mpi3mr_buf_entry { __u8 buf_type; __u8 rsvd1; __u16 rsvd2; __u32 buf_len; }; /** * struct mpi3mr_bsg_buf_entry_list - list of user buffer * descriptor for MPI Passthrough requests. * * @num_of_entries: Number of buffer descriptors * @rsvd1: Reserved * @rsvd2: Reserved * @rsvd3: Reserved * @buf_entry: Variable length array of buffer descriptors */ struct mpi3mr_buf_entry_list { __u8 num_of_entries; __u8 rsvd1; __u16 rsvd2; __u32 rsvd3; struct mpi3mr_buf_entry buf_entry[1]; }; /** * struct mpi3mr_bsg_mptcmd - Generic bsg data * structure for all MPI Passthrough requests . * * @mrioc_id: Controller ID * @rsvd1: Reserved * @timeout: MPI request timeout * @buf_entry_list: Buffer descriptor list */ struct mpi3mr_bsg_mptcmd { __u8 mrioc_id; __u8 rsvd1; __u16 timeout; __u32 rsvd2; struct mpi3mr_buf_entry_list buf_entry_list; }; /** * struct mpi3mr_bsg_packet - Generic bsg data * structure for all supported requests . * * @cmd_type: represents drvrcmd or mptcmd * @rsvd1: Reserved * @rsvd2: Reserved * @drvrcmd: driver request structure * @mptcmd: mpt request structure */ struct mpi3mr_bsg_packet { __u8 cmd_type; __u8 rsvd1; __u16 rsvd2; __u32 rsvd3; union { struct mpi3mr_bsg_drv_cmd drvrcmd; struct mpi3mr_bsg_mptcmd mptcmd; } cmd; }; /* MPI3: NVMe Encasulation related definitions */ #ifndef MPI3_NVME_ENCAP_CMD_MAX #define MPI3_NVME_ENCAP_CMD_MAX (1) #endif struct mpi3_nvme_encapsulated_request { __le16 host_tag; __u8 ioc_use_only02; __u8 function; __le16 ioc_use_only04; __u8 ioc_use_only06; __u8 msg_flags; __le16 change_count; __le16 dev_handle; __le16 encapsulated_command_length; __le16 flags; __le32 data_length; __le32 reserved14[3]; __le32 command[MPI3_NVME_ENCAP_CMD_MAX]; }; struct mpi3_nvme_encapsulated_error_reply { __le16 host_tag; __u8 ioc_use_only02; __u8 function; __le16 ioc_use_only04; __u8 ioc_use_only06; __u8 msg_flags; __le16 ioc_use_only08; __le16 ioc_status; __le32 ioc_log_info; __le32 nvme_completion_entry[4]; }; #define MPI3MR_NVME_PRP_SIZE 8 /* PRP size */ #define MPI3MR_NVME_CMD_PRP1_OFFSET 24 /* PRP1 offset in NVMe cmd */ #define MPI3MR_NVME_CMD_PRP2_OFFSET 32 /* PRP2 offset in NVMe cmd */ #define MPI3MR_NVME_CMD_SGL_OFFSET 24 /* SGL offset in NVMe cmd */ #define MPI3MR_NVME_DATA_FORMAT_PRP 0 #define MPI3MR_NVME_DATA_FORMAT_SGL1 1 #define MPI3MR_NVME_DATA_FORMAT_SGL2 2 /* MPI3: task management related definitions */ struct mpi3_scsi_task_mgmt_request { __le16 host_tag; __u8 ioc_use_only02; __u8 function; __le16 ioc_use_only04; __u8 ioc_use_only06; __u8 msg_flags; __le16 change_count; __le16 dev_handle; __le16 task_host_tag; __u8 task_type; __u8 reserved0f; __le16 task_request_queue_id; __le16 reserved12; __le32 reserved14; __u8 lun[8]; }; #define MPI3_SCSITASKMGMT_MSGFLAGS_DO_NOT_SEND_TASK_IU (0x08) #define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01) #define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK_SET (0x02) #define MPI3_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03) #define MPI3_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05) #define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06) #define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07) #define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_ACA (0x08) #define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK_SET (0x09) #define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_ASYNC_EVENT (0x0a) #define MPI3_SCSITASKMGMT_TASKTYPE_I_T_NEXUS_RESET (0x0b) struct mpi3_scsi_task_mgmt_reply { __le16 host_tag; __u8 ioc_use_only02; __u8 function; __le16 ioc_use_only04; __u8 ioc_use_only06; __u8 msg_flags; __le16 ioc_use_only08; __le16 ioc_status; __le32 ioc_log_info; __le32 termination_count; __le32 response_data; __le32 reserved18; }; #define MPI3_SCSITASKMGMT_RSPCODE_TM_COMPLETE (0x00) #define MPI3_SCSITASKMGMT_RSPCODE_INVALID_FRAME (0x02) #define MPI3_SCSITASKMGMT_RSPCODE_TM_FUNCTION_NOT_SUPPORTED (0x04) #define MPI3_SCSITASKMGMT_RSPCODE_TM_FAILED (0x05) #define MPI3_SCSITASKMGMT_RSPCODE_TM_SUCCEEDED (0x08) #define MPI3_SCSITASKMGMT_RSPCODE_TM_INVALID_LUN (0x09) #define MPI3_SCSITASKMGMT_RSPCODE_TM_OVERLAPPED_TAG (0x0a) #define MPI3_SCSITASKMGMT_RSPCODE_IO_QUEUED_ON_IOC (0x80) #define MPI3_SCSITASKMGMT_RSPCODE_TM_NVME_DENIED (0x81) /* MPI3: PEL related definitions */ #define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT (0x0200) #define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT (0x0100) #define MPI3_PEL_LOCALE_FLAGS_PCIE (0x0080) #define MPI3_PEL_LOCALE_FLAGS_CONFIGURATION (0x0040) #define MPI3_PEL_LOCALE_FLAGS_CONTROLER (0x0020) #define MPI3_PEL_LOCALE_FLAGS_SAS (0x0010) #define MPI3_PEL_LOCALE_FLAGS_EPACK (0x0008) #define MPI3_PEL_LOCALE_FLAGS_ENCLOSURE (0x0004) #define MPI3_PEL_LOCALE_FLAGS_PD (0x0002) #define MPI3_PEL_LOCALE_FLAGS_VD (0x0001) #define MPI3_PEL_CLASS_DEBUG (0x00) #define MPI3_PEL_CLASS_PROGRESS (0x01) #define MPI3_PEL_CLASS_INFORMATIONAL (0x02) #define MPI3_PEL_CLASS_WARNING (0x03) #define MPI3_PEL_CLASS_CRITICAL (0x04) #define MPI3_PEL_CLASS_FATAL (0x05) #define MPI3_PEL_CLASS_FAULT (0x06) /* MPI3: Function definitions */ #define MPI3_BSG_FUNCTION_MGMT_PASSTHROUGH (0x0a) #define MPI3_BSG_FUNCTION_SCSI_IO (0x20) #define MPI3_BSG_FUNCTION_SCSI_TASK_MGMT (0x21) #define MPI3_BSG_FUNCTION_SMP_PASSTHROUGH (0x22) #define MPI3_BSG_FUNCTION_NVME_ENCAPSULATED (0x24) #endif scsi/scsi_netlink.h 0000644 00000007122 15063602061 0010344 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * SCSI Transport Netlink Interface * Used for the posting of outbound SCSI transport events * * Copyright (C) 2006 James Smart, Emulex Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_NETLINK_H #define SCSI_NETLINK_H #include <linux/netlink.h> #include <linux/types.h> /* * This file intended to be included by both kernel and user space */ /* Single Netlink Message type to send all SCSI Transport messages */ #define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1 /* SCSI Transport Broadcast Groups */ /* leaving groups 0 and 1 unassigned */ #define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */ #define SCSI_NL_GRP_CNT 3 /* SCSI_TRANSPORT_MSG event message header */ struct scsi_nl_hdr { uint8_t version; uint8_t transport; uint16_t magic; uint16_t msgtype; uint16_t msglen; } __attribute__((aligned(sizeof(uint64_t)))); /* scsi_nl_hdr->version value */ #define SCSI_NL_VERSION 1 /* scsi_nl_hdr->magic value */ #define SCSI_NL_MAGIC 0xA1B2 /* scsi_nl_hdr->transport value */ #define SCSI_NL_TRANSPORT 0 #define SCSI_NL_TRANSPORT_FC 1 #define SCSI_NL_MAX_TRANSPORTS 2 /* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */ /* * GENERIC SCSI scsi_nl_hdr->msgtype Values */ /* kernel -> user */ #define SCSI_NL_SHOST_VENDOR 0x0001 /* user -> kernel */ /* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */ /* * Message Structures : */ /* macro to round up message lengths to 8byte boundary */ #define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7) /* * SCSI HOST Vendor Unique messages : * SCSI_NL_SHOST_VENDOR * * Note: The Vendor Unique message payload will begin directly after * this structure, with the length of the payload per vmsg_datalen. * * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified below */ struct scsi_nl_host_vendor_msg { struct scsi_nl_hdr snlh; /* must be 1st element ! */ uint64_t vendor_id; uint16_t host_no; uint16_t vmsg_datalen; } __attribute__((aligned(sizeof(uint64_t)))); /* * Vendor ID: * If transports post vendor-unique events, they must pass a well-known * 32-bit vendor identifier. This identifier consists of 8 bits indicating * the "type" of identifier contained, and 24 bits of id data. * * Identifiers for each type: * PCI : ID data is the 16 bit PCI Registered Vendor ID */ #define SCSI_NL_VID_TYPE_SHIFT 56 #define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) #define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) #define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \ { \ (hdr)->version = SCSI_NL_VERSION; \ (hdr)->transport = t; \ (hdr)->magic = SCSI_NL_MAGIC; \ (hdr)->msgtype = mtype; \ (hdr)->msglen = mlen; \ } #endif /* SCSI_NETLINK_H */ scsi/scsi_netlink_fc.h 0000644 00000003711 15063602061 0011014 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * FC Transport Netlink Interface * * Copyright (C) 2006 James Smart, Emulex Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_NETLINK_FC_H #define SCSI_NETLINK_FC_H #include <scsi/scsi_netlink.h> /* * This file intended to be included by both kernel and user space */ /* * FC Transport Message Types */ /* kernel -> user */ #define FC_NL_ASYNC_EVENT 0x0100 /* user -> kernel */ /* none */ /* * Message Structures : */ /* macro to round up message lengths to 8byte boundary */ #define FC_NL_MSGALIGN(len) (((len) + 7) & ~7) /* * FC Transport Broadcast Event Message : * FC_NL_ASYNC_EVENT * * Note: if Vendor Unique message, &event_data will be start of * vendor unique payload, and the length of the payload is * per event_datalen * * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified in scsi_netlink.h */ struct fc_nl_event { struct scsi_nl_hdr snlh; /* must be 1st element ! */ uint64_t seconds; uint64_t vendor_id; uint16_t host_no; uint16_t event_datalen; uint32_t event_num; uint32_t event_code; uint32_t event_data; } __attribute__((aligned(sizeof(uint64_t)))); #endif /* SCSI_NETLINK_FC_H */ scsi/scsi.h 0000644 00000015471 15063602061 0006626 0 ustar 00 /* Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * This header file contains public constants and structures used by * the scsi code for linux. */ #ifndef _SCSI_SCSI_H #define _SCSI_SCSI_H 1 #include <features.h> /* * SCSI opcodes */ #define TEST_UNIT_READY 0x00 #define REZERO_UNIT 0x01 #define REQUEST_SENSE 0x03 #define FORMAT_UNIT 0x04 #define READ_BLOCK_LIMITS 0x05 #define REASSIGN_BLOCKS 0x07 #define READ_6 0x08 #define WRITE_6 0x0a #define SEEK_6 0x0b #define READ_REVERSE 0x0f #define WRITE_FILEMARKS 0x10 #define SPACE 0x11 #define INQUIRY 0x12 #define RECOVER_BUFFERED_DATA 0x14 #define MODE_SELECT 0x15 #define RESERVE 0x16 #define RELEASE 0x17 #define COPY 0x18 #define ERASE 0x19 #define MODE_SENSE 0x1a #define START_STOP 0x1b #define RECEIVE_DIAGNOSTIC 0x1c #define SEND_DIAGNOSTIC 0x1d #define ALLOW_MEDIUM_REMOVAL 0x1e #define SET_WINDOW 0x24 #define READ_CAPACITY 0x25 #define READ_10 0x28 #define WRITE_10 0x2a #define SEEK_10 0x2b #define WRITE_VERIFY 0x2e #define VERIFY 0x2f #define SEARCH_HIGH 0x30 #define SEARCH_EQUAL 0x31 #define SEARCH_LOW 0x32 #define SET_LIMITS 0x33 #define PRE_FETCH 0x34 #define READ_POSITION 0x34 #define SYNCHRONIZE_CACHE 0x35 #define LOCK_UNLOCK_CACHE 0x36 #define READ_DEFECT_DATA 0x37 #define MEDIUM_SCAN 0x38 #define COMPARE 0x39 #define COPY_VERIFY 0x3a #define WRITE_BUFFER 0x3b #define READ_BUFFER 0x3c #define UPDATE_BLOCK 0x3d #define READ_LONG 0x3e #define WRITE_LONG 0x3f #define CHANGE_DEFINITION 0x40 #define WRITE_SAME 0x41 #define READ_TOC 0x43 #define LOG_SELECT 0x4c #define LOG_SENSE 0x4d #define MODE_SELECT_10 0x55 #define RESERVE_10 0x56 #define RELEASE_10 0x57 #define MODE_SENSE_10 0x5a #define PERSISTENT_RESERVE_IN 0x5e #define PERSISTENT_RESERVE_OUT 0x5f #define MOVE_MEDIUM 0xa5 #define READ_12 0xa8 #define WRITE_12 0xaa #define WRITE_VERIFY_12 0xae #define SEARCH_HIGH_12 0xb0 #define SEARCH_EQUAL_12 0xb1 #define SEARCH_LOW_12 0xb2 #define READ_ELEMENT_STATUS 0xb8 #define SEND_VOLUME_TAG 0xb6 #define WRITE_LONG_2 0xea /* * Status codes */ #define GOOD 0x00 #define CHECK_CONDITION 0x01 #define CONDITION_GOOD 0x02 #define BUSY 0x04 #define INTERMEDIATE_GOOD 0x08 #define INTERMEDIATE_C_GOOD 0x0a #define RESERVATION_CONFLICT 0x0c #define COMMAND_TERMINATED 0x11 #define QUEUE_FULL 0x14 #define STATUS_MASK 0x3e /* * SENSE KEYS */ #define NO_SENSE 0x00 #define RECOVERED_ERROR 0x01 #define NOT_READY 0x02 #define MEDIUM_ERROR 0x03 #define HARDWARE_ERROR 0x04 #define ILLEGAL_REQUEST 0x05 #define UNIT_ATTENTION 0x06 #define DATA_PROTECT 0x07 #define BLANK_CHECK 0x08 #define COPY_ABORTED 0x0a #define ABORTED_COMMAND 0x0b #define VOLUME_OVERFLOW 0x0d #define MISCOMPARE 0x0e /* * DEVICE TYPES */ #define TYPE_DISK 0x00 #define TYPE_TAPE 0x01 #define TYPE_PROCESSOR 0x03 /* HP scanners use this */ #define TYPE_WORM 0x04 /* Treated as ROM by our system */ #define TYPE_ROM 0x05 #define TYPE_SCANNER 0x06 #define TYPE_MOD 0x07 /* Magneto-optical disk - * - treated as TYPE_DISK */ #define TYPE_MEDIUM_CHANGER 0x08 #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ #define TYPE_NO_LUN 0x7f /* * standard mode-select header prepended to all mode-select commands * * moved here from cdrom.h -- kraxel */ struct ccs_modesel_head { unsigned char _r1; /* reserved. */ unsigned char medium; /* device-specific medium type. */ unsigned char _r2; /* reserved. */ unsigned char block_desc_length; /* block descriptor length. */ unsigned char density; /* device-specific density code. */ unsigned char number_blocks_hi; /* number of blocks in this block desc. */ unsigned char number_blocks_med; unsigned char number_blocks_lo; unsigned char _r3; unsigned char block_length_hi; /* block length for blocks in this desc. */ unsigned char block_length_med; unsigned char block_length_lo; }; /* * MESSAGE CODES */ #define COMMAND_COMPLETE 0x00 #define EXTENDED_MESSAGE 0x01 #define EXTENDED_MODIFY_DATA_POINTER 0x00 #define EXTENDED_SDTR 0x01 #define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ #define EXTENDED_WDTR 0x03 #define SAVE_POINTERS 0x02 #define RESTORE_POINTERS 0x03 #define DISCONNECT 0x04 #define INITIATOR_ERROR 0x05 #define ABORT 0x06 #define MESSAGE_REJECT 0x07 #define NOP 0x08 #define MSG_PARITY_ERROR 0x09 #define LINKED_CMD_COMPLETE 0x0a #define LINKED_FLG_CMD_COMPLETE 0x0b #define BUS_DEVICE_RESET 0x0c #define INITIATE_RECOVERY 0x0f /* SCSI-II only */ #define RELEASE_RECOVERY 0x10 /* SCSI-II only */ #define SIMPLE_QUEUE_TAG 0x20 #define HEAD_OF_QUEUE_TAG 0x21 #define ORDERED_QUEUE_TAG 0x22 /* * Here are some scsi specific ioctl commands which are sometimes useful. */ /* These are a few other constants only used by scsi devices. */ #define SCSI_IOCTL_GET_IDLUN 0x5382 /* Used to turn on and off tagged queuing for scsi devices. */ #define SCSI_IOCTL_TAGGED_ENABLE 0x5383 #define SCSI_IOCTL_TAGGED_DISABLE 0x5384 /* Used to obtain the host number of a device. */ #define SCSI_IOCTL_PROBE_HOST 0x5385 /* Used to get the bus number for a device. */ #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 #endif /* scsi/scsi.h */ scsi/scsi_ioctl.h 0000644 00000002443 15063602061 0010013 0 ustar 00 /* Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SCSI_IOCTL_H #define _SCSI_IOCTL_H /* IOCTLs for SCSI. */ #define SCSI_IOCTL_SEND_COMMAND 1 /* Send a command to the SCSI host. */ #define SCSI_IOCTL_TEST_UNIT_READY 2 /* Test if unit is ready. */ #define SCSI_IOCTL_BENCHMARK_COMMAND 3 #define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters. */ #define SCSI_IOCTL_START_UNIT 5 #define SCSI_IOCTL_STOP_UNIT 6 #define SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */ #define SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */ #endif scsi/sg.h 0000644 00000026615 15063602061 0006300 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* History: Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user process control of SCSI devices. Development Sponsored by Killy Corp. NY NY */ #ifndef _SCSI_SG_H #define _SCSI_SG_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* New interface introduced in the 3.x SG drivers follows */ /* Same structure as used by readv() Linux system call. It defines one scatter-gather element. */ typedef struct sg_iovec { void * iov_base; /* Starting address */ size_t iov_len; /* Length in bytes */ } sg_iovec_t; typedef struct sg_io_hdr { int interface_id; /* [i] 'S' for SCSI generic (required) */ int dxfer_direction; /* [i] data transfer direction */ unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ unsigned char mx_sb_len; /* [i] max length to write to sbp */ unsigned short int iovec_count; /* [i] 0 implies no scatter gather */ unsigned int dxfer_len; /* [i] byte count of data transfer */ void * dxferp; /* [i], [*io] points to data transfer memory or scatter gather list */ unsigned char * cmdp; /* [i], [*i] points to command to perform */ unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */ unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */ int pack_id; /* [i->o] unused internally (normally) */ void * usr_ptr; /* [i->o] unused internally */ unsigned char status; /* [o] scsi status */ unsigned char masked_status;/* [o] shifted, masked scsi status */ unsigned char msg_status; /* [o] messaging level data (optional) */ unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ unsigned short int host_status; /* [o] errors from host adapter */ unsigned short int driver_status;/* [o] errors from software driver */ int resid; /* [o] dxfer_len - actual_transferred */ unsigned int duration; /* [o] time taken by cmd (unit: millisec) */ unsigned int info; /* [o] auxiliary information */ } sg_io_hdr_t; /* Use negative values to flag difference from original sg_header structure. */ #define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */ #define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */ #define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */ #define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the additional property than during indirect IO the user buffer is copied into the kernel buffers before the transfer */ /* following flag values can be "or"-ed together */ #define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */ #define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */ /* the 2nd byte of SCSI command */ #define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ /* user space (debug indirect IO) */ /* The following 'info' values are "or"-ed together. */ #define SG_INFO_OK_MASK 0x1 #define SG_INFO_OK 0x0 /* no sense, host nor driver "noise" */ #define SG_INFO_CHECK 0x1 /* something abnormal happened */ #define SG_INFO_DIRECT_IO_MASK 0x6 #define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */ #define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */ #define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */ /* Request information about a specific SG device, used by SG_GET_SCSI_ID ioctl (). */ struct sg_scsi_id { /* Host number as in "scsi<n>" where 'n' is one of 0, 1, 2 etc. */ int host_no; int channel; /* SCSI id of target device. */ int scsi_id; int lun; /* TYPE_... defined in <scsi/scsi.h>. */ int scsi_type; /* Host (adapter) maximum commands per lun. */ short int h_cmd_per_lun; /* Device (or adapter) maximum queue length. */ short int d_queue_depth; /* Unused, set to 0 for now. */ int unused[2]; }; /* Used by SG_GET_REQUEST_TABLE ioctl(). */ typedef struct sg_req_info { char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */ char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */ char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */ char problem; /* 0 -> no problem detected, 1 -> error to report */ int pack_id; /* pack_id associated with request */ void * usr_ptr; /* user provided pointer (in new interface) */ unsigned int duration; /* millisecs elapsed since written (req_state==1) or request duration (req_state==2) */ int unused; } sg_req_info_t; /* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow. [Those that only apply to the SG 2.x drivers are at the end of the file.] (_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */ #define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ /* Used to configure SCSI command transformation layer for ATAPI devices */ /* Only supported by the ide-scsi driver */ #define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */ /* 3rd arg = 0 to disable transform, 1 to enable it */ #define SG_GET_TRANSFORM 0x2205 #define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */ #define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */ /* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */ #define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */ /* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */ /* Override host setting and always DMA using low memory ( <16MB on i386) */ #define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */ #define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */ /* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN. If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0 then pack_id ignored by read() and oldest readable fetched. */ #define SG_SET_FORCE_PACK_ID 0x227b #define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */ #define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */ /* Yields max scatter gather tablesize allowed by current host adapter */ #define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ #define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ /* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ #define SG_SCSI_RESET 0x2284 /* Associated values that can be given to SG_SCSI_RESET follow */ #define SG_SCSI_RESET_NOTHING 0 #define SG_SCSI_RESET_DEVICE 1 #define SG_SCSI_RESET_BUS 2 #define SG_SCSI_RESET_HOST 3 /* synchronous SCSI command ioctl, (only in version 3 interface) */ #define SG_IO 0x2285 /* similar effect as write() followed by read() */ #define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */ /* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */ #define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */ #define SG_GET_KEEP_ORPHAN 0x2288 #define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ /* Largest size (in bytes) a single scatter-gather list element can have. The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported by adapter then this value is the largest data block that can be read/written by a single scsi command. The user can find the value of PAGE_SIZE by calling getpagesize() defined in unistd.h . */ #define SG_DEFAULT_RETRIES 1 /* Defaults, commented if they differ from original sg driver */ #define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */ #define SG_DEF_FORCE_PACK_ID 0 #define SG_DEF_KEEP_ORPHAN 0 #define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */ /* maximum outstanding requests, write() yields EDOM if exceeded */ #define SG_MAX_QUEUE 16 #define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */ /* Alternate style type names, "..._t" variants preferred */ typedef struct sg_io_hdr Sg_io_hdr; typedef struct sg_io_vec Sg_io_vec; typedef struct sg_scsi_id Sg_scsi_id; typedef struct sg_req_info Sg_req_info; /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ /* The older SG interface based on the 'sg_header' structure follows. */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ #define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */ struct sg_header { /* Length of incoming packet (including header). */ int pack_len; /* Maximal length of expected reply. */ int reply_len; /* Id number of packet. */ int pack_id; /* 0==ok, otherwise error number. */ int result; /* Force 12 byte command length for group 6 & 7 commands. */ unsigned int twelve_byte:1; /* SCSI status from target. */ unsigned int target_status:5; /* Host status (see "DID" codes). */ unsigned int host_status:8; /* Driver status+suggestion. */ unsigned int driver_status:8; /* Unused. */ unsigned int other_flags:10; /* Output in 3 cases: when target_status is CHECK_CONDITION or when target_status is COMMAND_TERMINATED or when (driver_status & DRIVER_SENSE) is true. */ unsigned char sense_buffer[SG_MAX_SENSE]; }; /* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t interface is used. They are kept for backward compatibility with the original and version 2 drivers. */ #define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)arg==timeout. */ #define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */ /* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */ #define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */ #define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */ /* Turn on error sense trace (1..8), dump this device to log/console (9) or dump all sg device states ( >9 ) to log/console. */ #define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */ #define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given number on the next write() on this file descriptor. */ /* Defaults, commented if they differ from original sg driver */ #define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ #define SG_DEF_COMMAND_Q 0 /* command queuing is always on when the new interface is used */ #define SG_DEF_UNDERRUN_FLAG 0 #endif /* scsi/sg.h */ sound/intel/avs/tokens.h 0000644 00000010605 15063602061 0011255 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright(c) 2021 Intel Corporation. All rights reserved. * * Authors: Cezary Rojewski <cezary.rojewski@intel.com> * Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com> */ #ifndef __UAPI_SOUND_INTEL_AVS_TOKENS_H #define __UAPI_SOUND_INTEL_AVS_TOKENS_H enum avs_tplg_token { /* struct avs_tplg */ AVS_TKN_MANIFEST_NAME_STRING = 1, AVS_TKN_MANIFEST_VERSION_U32 = 2, AVS_TKN_MANIFEST_NUM_LIBRARIES_U32 = 3, AVS_TKN_MANIFEST_NUM_AFMTS_U32 = 4, AVS_TKN_MANIFEST_NUM_MODCFGS_BASE_U32 = 5, AVS_TKN_MANIFEST_NUM_MODCFGS_EXT_U32 = 6, AVS_TKN_MANIFEST_NUM_PPLCFGS_U32 = 7, AVS_TKN_MANIFEST_NUM_BINDINGS_U32 = 8, /* struct avs_tplg_library */ AVS_TKN_LIBRARY_ID_U32 = 101, AVS_TKN_LIBRARY_NAME_STRING = 102, /* struct avs_audio_format */ AVS_TKN_AFMT_ID_U32 = 201, AVS_TKN_AFMT_SAMPLE_RATE_U32 = 202, AVS_TKN_AFMT_BIT_DEPTH_U32 = 203, AVS_TKN_AFMT_CHANNEL_MAP_U32 = 204, AVS_TKN_AFMT_CHANNEL_CFG_U32 = 205, AVS_TKN_AFMT_INTERLEAVING_U32 = 206, AVS_TKN_AFMT_NUM_CHANNELS_U32 = 207, AVS_TKN_AFMT_VALID_BIT_DEPTH_U32 = 208, AVS_TKN_AFMT_SAMPLE_TYPE_U32 = 209, /* struct avs_tplg_modcfg_base */ AVS_TKN_MODCFG_BASE_ID_U32 = 301, AVS_TKN_MODCFG_BASE_CPC_U32 = 302, AVS_TKN_MODCFG_BASE_IBS_U32 = 303, AVS_TKN_MODCFG_BASE_OBS_U32 = 304, AVS_TKN_MODCFG_BASE_PAGES_U32 = 305, /* struct avs_tplg_modcfg_ext */ AVS_TKN_MODCFG_EXT_ID_U32 = 401, AVS_TKN_MODCFG_EXT_TYPE_UUID = 402, AVS_TKN_MODCFG_CPR_OUT_AFMT_ID_U32 = 403, AVS_TKN_MODCFG_CPR_FEATURE_MASK_U32 = 404, AVS_TKN_MODCFG_CPR_DMA_TYPE_U32 = 405, AVS_TKN_MODCFG_CPR_DMABUFF_SIZE_U32 = 406, AVS_TKN_MODCFG_CPR_VINDEX_U8 = 407, AVS_TKN_MODCFG_CPR_BLOB_FMT_ID_U32 = 408, AVS_TKN_MODCFG_MICSEL_OUT_AFMT_ID_U32 = 409, AVS_TKN_MODCFG_INTELWOV_CPC_LP_MODE_U32 = 410, AVS_TKN_MODCFG_SRC_OUT_FREQ_U32 = 411, AVS_TKN_MODCFG_MUX_REF_AFMT_ID_U32 = 412, AVS_TKN_MODCFG_MUX_OUT_AFMT_ID_U32 = 413, AVS_TKN_MODCFG_AEC_REF_AFMT_ID_U32 = 414, AVS_TKN_MODCFG_AEC_OUT_AFMT_ID_U32 = 415, AVS_TKN_MODCFG_AEC_CPC_LP_MODE_U32 = 416, AVS_TKN_MODCFG_ASRC_OUT_FREQ_U32 = 417, AVS_TKN_MODCFG_ASRC_MODE_U8 = 418, AVS_TKN_MODCFG_ASRC_DISABLE_JITTER_U8 = 419, AVS_TKN_MODCFG_UPDOWN_MIX_OUT_CHAN_CFG_U32 = 420, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_SELECT_U32 = 421, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_0_S32 = 422, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_1_S32 = 423, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_2_S32 = 424, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_3_S32 = 425, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_4_S32 = 426, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_5_S32 = 427, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_6_S32 = 428, AVS_TKN_MODCFG_UPDOWN_MIX_COEFF_7_S32 = 429, AVS_TKN_MODCFG_UPDOWN_MIX_CHAN_MAP_U32 = 430, AVS_TKN_MODCFG_EXT_NUM_INPUT_PINS_U16 = 431, AVS_TKN_MODCFG_EXT_NUM_OUTPUT_PINS_U16 = 432, /* struct avs_tplg_pplcfg */ AVS_TKN_PPLCFG_ID_U32 = 1401, AVS_TKN_PPLCFG_REQ_SIZE_U16 = 1402, AVS_TKN_PPLCFG_PRIORITY_U8 = 1403, AVS_TKN_PPLCFG_LOW_POWER_BOOL = 1404, AVS_TKN_PPLCFG_ATTRIBUTES_U16 = 1405, AVS_TKN_PPLCFG_TRIGGER_U32 = 1406, /* struct avs_tplg_binding */ AVS_TKN_BINDING_ID_U32 = 1501, AVS_TKN_BINDING_TARGET_TPLG_NAME_STRING = 1502, AVS_TKN_BINDING_TARGET_PATH_TMPL_ID_U32 = 1503, AVS_TKN_BINDING_TARGET_PPL_ID_U32 = 1504, AVS_TKN_BINDING_TARGET_MOD_ID_U32 = 1505, AVS_TKN_BINDING_TARGET_MOD_PIN_U8 = 1506, AVS_TKN_BINDING_MOD_ID_U32 = 1507, AVS_TKN_BINDING_MOD_PIN_U8 = 1508, AVS_TKN_BINDING_IS_SINK_U8 = 1509, /* struct avs_tplg_pipeline */ AVS_TKN_PPL_ID_U32 = 1601, AVS_TKN_PPL_PPLCFG_ID_U32 = 1602, AVS_TKN_PPL_NUM_BINDING_IDS_U32 = 1603, AVS_TKN_PPL_BINDING_ID_U32 = 1604, /* struct avs_tplg_module */ AVS_TKN_MOD_ID_U32 = 1701, AVS_TKN_MOD_MODCFG_BASE_ID_U32 = 1702, AVS_TKN_MOD_IN_AFMT_ID_U32 = 1703, AVS_TKN_MOD_CORE_ID_U8 = 1704, AVS_TKN_MOD_PROC_DOMAIN_U8 = 1705, AVS_TKN_MOD_MODCFG_EXT_ID_U32 = 1706, AVS_TKN_MOD_KCONTROL_ID_U32 = 1707, /* struct avs_tplg_path_template */ AVS_TKN_PATH_TMPL_ID_U32 = 1801, /* struct avs_tplg_path */ AVS_TKN_PATH_ID_U32 = 1901, AVS_TKN_PATH_FE_FMT_ID_U32 = 1902, AVS_TKN_PATH_BE_FMT_ID_U32 = 1903, /* struct avs_tplg_pin_format */ AVS_TKN_PIN_FMT_INDEX_U32 = 2201, AVS_TKN_PIN_FMT_IOBS_U32 = 2202, AVS_TKN_PIN_FMT_AFMT_ID_U32 = 2203, /* struct avs_tplg_kcontrol */ AVS_TKN_KCONTROL_ID_U32 = 2301, }; #endif sound/sof/abi.h 0000644 00000004134 15063602061 0007370 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * Copyright(c) 2018 Intel Corporation. All rights reserved. */ /** * SOF ABI versioning is based on Semantic Versioning where we have a given * MAJOR.MINOR.PATCH version number. See https://semver.org/ * * Rules for incrementing or changing version :- * * 1) Increment MAJOR version if you make incompatible API changes. MINOR and * PATCH should be reset to 0. * * 2) Increment MINOR version if you add backwards compatible features or * changes. PATCH should be reset to 0. * * 3) Increment PATCH version if you add backwards compatible bug fixes. */ #ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__ #define __INCLUDE_UAPI_SOUND_SOF_ABI_H__ #include <linux/types.h> /* SOF ABI version major, minor and patch numbers */ #define SOF_ABI_MAJOR 3 #define SOF_ABI_MINOR 23 #define SOF_ABI_PATCH 0 /* SOF ABI version number. Format within 32bit word is MMmmmppp */ #define SOF_ABI_MAJOR_SHIFT 24 #define SOF_ABI_MAJOR_MASK 0xff #define SOF_ABI_MINOR_SHIFT 12 #define SOF_ABI_MINOR_MASK 0xfff #define SOF_ABI_PATCH_SHIFT 0 #define SOF_ABI_PATCH_MASK 0xfff #define SOF_ABI_VER(major, minor, patch) \ (((major) << SOF_ABI_MAJOR_SHIFT) | \ ((minor) << SOF_ABI_MINOR_SHIFT) | \ ((patch) << SOF_ABI_PATCH_SHIFT)) #define SOF_ABI_VERSION_MAJOR(version) \ (((version) >> SOF_ABI_MAJOR_SHIFT) & SOF_ABI_MAJOR_MASK) #define SOF_ABI_VERSION_MINOR(version) \ (((version) >> SOF_ABI_MINOR_SHIFT) & SOF_ABI_MINOR_MASK) #define SOF_ABI_VERSION_PATCH(version) \ (((version) >> SOF_ABI_PATCH_SHIFT) & SOF_ABI_PATCH_MASK) #define SOF_ABI_VERSION_INCOMPATIBLE(sof_ver, client_ver) \ (SOF_ABI_VERSION_MAJOR((sof_ver)) != \ SOF_ABI_VERSION_MAJOR((client_ver)) \ ) #define SOF_ABI_VERSION SOF_ABI_VER(SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH) /* SOF ABI magic number "SOF\0". */ #define SOF_ABI_MAGIC 0x00464F53 /* SOF IPC4 ABI magic number "SOF4". */ #define SOF_IPC4_ABI_MAGIC 0x34464F53 #endif sound/sof/fw.h 0000644 00000004333 15063602061 0007252 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * Copyright(c) 2018 Intel Corporation. All rights reserved. */ /* * Firmware file format . */ #ifndef __INCLUDE_UAPI_SOF_FW_H__ #define __INCLUDE_UAPI_SOF_FW_H__ #include <linux/types.h> #define SND_SOF_FW_SIG_SIZE 4 #define SND_SOF_FW_ABI 1 #define SND_SOF_FW_SIG "Reef" /* * Firmware module is made up of 1 . N blocks of different types. The * Block header is used to determine where and how block is to be copied in the * DSP/host memory space. */ enum snd_sof_fw_blk_type { SOF_FW_BLK_TYPE_INVALID = -1, SOF_FW_BLK_TYPE_START = 0, SOF_FW_BLK_TYPE_RSRVD0 = SOF_FW_BLK_TYPE_START, SOF_FW_BLK_TYPE_IRAM = 1, /* local instruction RAM */ SOF_FW_BLK_TYPE_DRAM = 2, /* local data RAM */ SOF_FW_BLK_TYPE_SRAM = 3, /* system RAM */ SOF_FW_BLK_TYPE_ROM = 4, SOF_FW_BLK_TYPE_IMR = 5, SOF_FW_BLK_TYPE_RSRVD6 = 6, SOF_FW_BLK_TYPE_RSRVD7 = 7, SOF_FW_BLK_TYPE_RSRVD8 = 8, SOF_FW_BLK_TYPE_RSRVD9 = 9, SOF_FW_BLK_TYPE_RSRVD10 = 10, SOF_FW_BLK_TYPE_RSRVD11 = 11, SOF_FW_BLK_TYPE_RSRVD12 = 12, SOF_FW_BLK_TYPE_RSRVD13 = 13, SOF_FW_BLK_TYPE_RSRVD14 = 14, /* use SOF_FW_BLK_TYPE_RSVRDX for new block types */ SOF_FW_BLK_TYPE_NUM }; struct snd_sof_blk_hdr { enum snd_sof_fw_blk_type type; __u32 size; /* bytes minus this header */ __u32 offset; /* offset from base */ } __attribute__((packed)); /* * Firmware file is made up of 1 .. N different modules types. The module * type is used to determine how to load and parse the module. */ enum snd_sof_fw_mod_type { SOF_FW_BASE = 0, /* base firmware image */ SOF_FW_MODULE = 1, /* firmware module */ }; struct snd_sof_mod_hdr { enum snd_sof_fw_mod_type type; __u32 size; /* bytes minus this header */ __u32 num_blocks; /* number of blocks */ } __attribute__((packed)); /* * Firmware file header. */ struct snd_sof_fw_header { unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */ __u32 file_size; /* size of file minus this header */ __u32 num_modules; /* number of modules */ __u32 abi; /* version of header format */ } __attribute__((packed)); #endif sound/sof/header.h 0000644 00000003571 15063602061 0010071 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * Copyright(c) 2018 Intel Corporation. All rights reserved. */ #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ #define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ #include <linux/types.h> /** * struct sof_abi_hdr - Header for all non IPC ABI data. * @magic: Magic number for validation * for IPC3 data: 0x00464F53 ('S', 'O', 'F', '\0') * for IPC4 data: 0x34464F53 ('S', 'O', 'F', '4') * @type: module specific parameter * for IPC3: Component specific type * for IPC4: parameter ID (param_id) of the data * @size: The size in bytes of the data, excluding this struct * @abi: SOF ABI version. The version is valid in scope of the 'magic', IPC3 and * IPC4 ABI version numbers have no relationship. * @reserved: Reserved for future use * @data: Component data - opaque to core * * Identifies data type, size and ABI. * Used by any bespoke component data structures or binary blobs. */ struct sof_abi_hdr { __u32 magic; __u32 type; __u32 size; __u32 abi; __u32 reserved[4]; __u32 data[0]; } __attribute__((packed)); #define SOF_MANIFEST_DATA_TYPE_NHLT 1 /** * struct sof_manifest_tlv - SOF manifest TLV data * @type: type of data * @size: data size (not including the size of this struct) * @data: payload data */ struct sof_manifest_tlv { __le32 type; __le32 size; __u8 data[]; }; /** * struct sof_manifest - SOF topology manifest * @abi_major: Major ABI version * @abi_minor: Minor ABI version * @abi_patch: ABI patch * @count: count of tlv items * @items: consecutive variable size tlv items */ struct sof_manifest { __le16 abi_major; __le16 abi_minor; __le16 abi_patch; __le16 count; struct sof_manifest_tlv items[]; }; #endif sound/sof/tokens.h 0000644 00000015231 15063602061 0010140 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * Copyright(c) 2018 Intel Corporation. All rights reserved. * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com> * Keyon Jie <yang.jie@linux.intel.com> */ /* * Topology IDs and tokens. * * ** MUST BE ALIGNED WITH TOPOLOGY CONFIGURATION TOKEN VALUES ** */ #ifndef __INCLUDE_UAPI_SOF_TOPOLOGY_H__ #define __INCLUDE_UAPI_SOF_TOPOLOGY_H__ /* * Kcontrol IDs */ #define SOF_TPLG_KCTL_VOL_ID 256 #define SOF_TPLG_KCTL_ENUM_ID 257 #define SOF_TPLG_KCTL_BYTES_ID 258 #define SOF_TPLG_KCTL_SWITCH_ID 259 #define SOF_TPLG_KCTL_BYTES_VOLATILE_RO 260 #define SOF_TPLG_KCTL_BYTES_VOLATILE_RW 261 #define SOF_TPLG_KCTL_BYTES_WO_ID 262 /* * Tokens - must match values in topology configurations */ /* buffers */ #define SOF_TKN_BUF_SIZE 100 #define SOF_TKN_BUF_CAPS 101 /* DAI */ /* Token retired with ABI 3.2, do not use for new capabilities * #define SOF_TKN_DAI_DMAC_CONFIG 153 */ #define SOF_TKN_DAI_TYPE 154 #define SOF_TKN_DAI_INDEX 155 #define SOF_TKN_DAI_DIRECTION 156 /* scheduling */ #define SOF_TKN_SCHED_PERIOD 200 #define SOF_TKN_SCHED_PRIORITY 201 #define SOF_TKN_SCHED_MIPS 202 #define SOF_TKN_SCHED_CORE 203 #define SOF_TKN_SCHED_FRAMES 204 #define SOF_TKN_SCHED_TIME_DOMAIN 205 #define SOF_TKN_SCHED_DYNAMIC_PIPELINE 206 #define SOF_TKN_SCHED_LP_MODE 207 #define SOF_TKN_SCHED_MEM_USAGE 208 #define SOF_TKN_SCHED_USE_CHAIN_DMA 209 /* volume */ #define SOF_TKN_VOLUME_RAMP_STEP_TYPE 250 #define SOF_TKN_VOLUME_RAMP_STEP_MS 251 #define SOF_TKN_GAIN_RAMP_TYPE 260 #define SOF_TKN_GAIN_RAMP_DURATION 261 #define SOF_TKN_GAIN_VAL 262 /* SRC */ #define SOF_TKN_SRC_RATE_IN 300 #define SOF_TKN_SRC_RATE_OUT 301 /* ASRC */ #define SOF_TKN_ASRC_RATE_IN 320 #define SOF_TKN_ASRC_RATE_OUT 321 #define SOF_TKN_ASRC_ASYNCHRONOUS_MODE 322 #define SOF_TKN_ASRC_OPERATION_MODE 323 /* PCM */ #define SOF_TKN_PCM_DMAC_CONFIG 353 /* Generic components */ #define SOF_TKN_COMP_PERIOD_SINK_COUNT 400 #define SOF_TKN_COMP_PERIOD_SOURCE_COUNT 401 #define SOF_TKN_COMP_FORMAT 402 /* Token retired with ABI 3.2, do not use for new capabilities * #define SOF_TKN_COMP_PRELOAD_COUNT 403 */ #define SOF_TKN_COMP_CORE_ID 404 #define SOF_TKN_COMP_UUID 405 #define SOF_TKN_COMP_CPC 406 #define SOF_TKN_COMP_IS_PAGES 409 #define SOF_TKN_COMP_NUM_AUDIO_FORMATS 410 #define SOF_TKN_COMP_NUM_INPUT_PINS 411 #define SOF_TKN_COMP_NUM_OUTPUT_PINS 412 /* * The token for input/output pin binding, it specifies the widget * name that the input/output pin is connected from/to. */ #define SOF_TKN_COMP_INPUT_PIN_BINDING_WNAME 413 #define SOF_TKN_COMP_OUTPUT_PIN_BINDING_WNAME 414 #define SOF_TKN_COMP_NUM_INPUT_AUDIO_FORMATS 415 #define SOF_TKN_COMP_NUM_OUTPUT_AUDIO_FORMATS 416 /* * The token value is copied to the dapm_widget's * no_wname_in_kcontrol_name. */ #define SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME 417 /* SSP */ #define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500 #define SOF_TKN_INTEL_SSP_MCLK_ID 501 #define SOF_TKN_INTEL_SSP_SAMPLE_BITS 502 #define SOF_TKN_INTEL_SSP_FRAME_PULSE_WIDTH 503 #define SOF_TKN_INTEL_SSP_QUIRKS 504 #define SOF_TKN_INTEL_SSP_TDM_PADDING_PER_SLOT 505 #define SOF_TKN_INTEL_SSP_BCLK_DELAY 506 /* DMIC */ #define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600 #define SOF_TKN_INTEL_DMIC_CLK_MIN 601 #define SOF_TKN_INTEL_DMIC_CLK_MAX 602 #define SOF_TKN_INTEL_DMIC_DUTY_MIN 603 #define SOF_TKN_INTEL_DMIC_DUTY_MAX 604 #define SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE 605 #define SOF_TKN_INTEL_DMIC_SAMPLE_RATE 608 #define SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH 609 #define SOF_TKN_INTEL_DMIC_UNMUTE_RAMP_TIME_MS 610 /* DMIC PDM */ #define SOF_TKN_INTEL_DMIC_PDM_CTRL_ID 700 #define SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable 701 #define SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable 702 #define SOF_TKN_INTEL_DMIC_PDM_POLARITY_A 703 #define SOF_TKN_INTEL_DMIC_PDM_POLARITY_B 704 #define SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE 705 #define SOF_TKN_INTEL_DMIC_PDM_SKEW 706 /* Tone */ #define SOF_TKN_TONE_SAMPLE_RATE 800 /* Processing Components */ #define SOF_TKN_PROCESS_TYPE 900 /* for backward compatibility */ #define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE /* SAI */ #define SOF_TKN_IMX_SAI_MCLK_ID 1000 /* ESAI */ #define SOF_TKN_IMX_ESAI_MCLK_ID 1100 /* Stream */ #define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 1200 #define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 1201 /* Led control for mute switches */ #define SOF_TKN_MUTE_LED_USE 1300 #define SOF_TKN_MUTE_LED_DIRECTION 1301 /* ALH */ #define SOF_TKN_INTEL_ALH_RATE 1400 #define SOF_TKN_INTEL_ALH_CH 1401 /* HDA */ #define SOF_TKN_INTEL_HDA_RATE 1500 #define SOF_TKN_INTEL_HDA_CH 1501 /* AFE */ #define SOF_TKN_MEDIATEK_AFE_RATE 1600 #define SOF_TKN_MEDIATEK_AFE_CH 1601 #define SOF_TKN_MEDIATEK_AFE_FORMAT 1602 /* MIXER */ #define SOF_TKN_MIXER_TYPE 1700 /* ACPDMIC */ #define SOF_TKN_AMD_ACPDMIC_RATE 1800 #define SOF_TKN_AMD_ACPDMIC_CH 1801 /* CAVS AUDIO FORMAT */ #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_RATE 1900 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_BIT_DEPTH 1901 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_VALID_BIT_DEPTH 1902 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CHANNELS 1903 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_MAP 1904 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_CFG 1905 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_INTERLEAVING_STYLE 1906 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_FMT_CFG 1907 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_SAMPLE_TYPE 1908 #define SOF_TKN_CAVS_AUDIO_FORMAT_INPUT_PIN_INDEX 1909 /* intentional token numbering discontinuity, reserved for future use */ #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_RATE 1930 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_BIT_DEPTH 1931 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_VALID_BIT_DEPTH 1932 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CHANNELS 1933 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_MAP 1934 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_CFG 1935 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_INTERLEAVING_STYLE 1936 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_FMT_CFG 1937 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_SAMPLE_TYPE 1938 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUTPUT_PIN_INDEX 1939 /* intentional token numbering discontinuity, reserved for future use */ #define SOF_TKN_CAVS_AUDIO_FORMAT_IBS 1970 #define SOF_TKN_CAVS_AUDIO_FORMAT_OBS 1971 #define SOF_TKN_CAVS_AUDIO_FORMAT_DMA_BUFFER_SIZE 1972 /* COPIER */ #define SOF_TKN_INTEL_COPIER_NODE_TYPE 1980 #define SOF_TKN_INTEL_COPIER_DEEP_BUFFER_DMA_MS 1981 /* ACP I2S */ #define SOF_TKN_AMD_ACPI2S_RATE 1700 #define SOF_TKN_AMD_ACPI2S_CH 1701 #define SOF_TKN_AMD_ACPI2S_TDM_MODE 1702 #endif sound/asequencer.h 0000644 00000051160 15063602061 0010202 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Main header file for the ALSA sequencer * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl> * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz> */ #ifndef __SOUND_ASEQUENCER_H #define __SOUND_ASEQUENCER_H #include <sound/asound.h> /** version of the sequencer */ #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2) /** * definition of sequencer event types */ /** system messages * event data type = #snd_seq_result */ #define SNDRV_SEQ_EVENT_SYSTEM 0 #define SNDRV_SEQ_EVENT_RESULT 1 /** note messages (channel specific) * event data type = #snd_seq_ev_note */ #define SNDRV_SEQ_EVENT_NOTE 5 #define SNDRV_SEQ_EVENT_NOTEON 6 #define SNDRV_SEQ_EVENT_NOTEOFF 7 #define SNDRV_SEQ_EVENT_KEYPRESS 8 /** control messages (channel specific) * event data type = #snd_seq_ev_ctrl */ #define SNDRV_SEQ_EVENT_CONTROLLER 10 #define SNDRV_SEQ_EVENT_PGMCHANGE 11 #define SNDRV_SEQ_EVENT_CHANPRESS 12 #define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ #define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ #define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ #define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ /** synchronisation messages * event data type = #snd_seq_ev_ctrl */ #define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ #define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ #define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ #define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ /** timer messages * event data type = snd_seq_ev_queue_control */ #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ #define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ #define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ #define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ #define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ #define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ #define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ #define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ /** others * event data type = none */ #define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ #define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ #define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ /** echo back, kernel private messages * event data type = any type */ #define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ #define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ /** system status messages (broadcast for subscribers) * event data type = snd_seq_addr */ #define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ #define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ #define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ #define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ #define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ /** port connection changes * event data type = snd_seq_connect */ #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ /* 70-89: synthesizer events - obsoleted */ /** user-defined events with fixed length * event data type = any */ #define SNDRV_SEQ_EVENT_USR0 90 #define SNDRV_SEQ_EVENT_USR1 91 #define SNDRV_SEQ_EVENT_USR2 92 #define SNDRV_SEQ_EVENT_USR3 93 #define SNDRV_SEQ_EVENT_USR4 94 #define SNDRV_SEQ_EVENT_USR5 95 #define SNDRV_SEQ_EVENT_USR6 96 #define SNDRV_SEQ_EVENT_USR7 97 #define SNDRV_SEQ_EVENT_USR8 98 #define SNDRV_SEQ_EVENT_USR9 99 /* 100-118: instrument layer - obsoleted */ /* 119-129: reserved */ /* 130-139: variable length events * event data type = snd_seq_ev_ext * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) */ #define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ #define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ /* 132-134: reserved */ #define SNDRV_SEQ_EVENT_USR_VAR0 135 #define SNDRV_SEQ_EVENT_USR_VAR1 136 #define SNDRV_SEQ_EVENT_USR_VAR2 137 #define SNDRV_SEQ_EVENT_USR_VAR3 138 #define SNDRV_SEQ_EVENT_USR_VAR4 139 /* 150-151: kernel events with quote - DO NOT use in user clients */ #define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 #define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ /* 152-191: reserved */ /* 192-254: hardware specific events */ /* 255: special event */ #define SNDRV_SEQ_EVENT_NONE 255 typedef unsigned char snd_seq_event_type_t; /** event address */ struct snd_seq_addr { unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ }; /** port connection */ struct snd_seq_connect { struct snd_seq_addr sender; struct snd_seq_addr dest; }; #define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ #define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ #define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ #define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ /* event mode flag - NOTE: only 8 bits available! */ #define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ #define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ #define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) #define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ #define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ #define SNDRV_SEQ_TIME_MODE_MASK (1<<1) #define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ #define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ #define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ #define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) #define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ #define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ #define SNDRV_SEQ_PRIORITY_MASK (1<<4) /* note event */ struct snd_seq_ev_note { unsigned char channel; unsigned char note; unsigned char velocity; unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ }; /* controller event */ struct snd_seq_ev_ctrl { unsigned char channel; unsigned char unused1, unused2, unused3; /* pad */ unsigned int param; signed int value; }; /* generic set of bytes (12x8 bit) */ struct snd_seq_ev_raw8 { unsigned char d[12]; /* 8 bit value */ }; /* generic set of integers (3x32 bit) */ struct snd_seq_ev_raw32 { unsigned int d[3]; /* 32 bit value */ }; /* external stored data */ struct snd_seq_ev_ext { unsigned int len; /* length of data */ void *ptr; /* pointer to data (note: maybe 64-bit) */ } __attribute__((packed)); struct snd_seq_result { int event; /* processed event type */ int result; }; struct snd_seq_real_time { unsigned int tv_sec; /* seconds */ unsigned int tv_nsec; /* nanoseconds */ }; typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ union snd_seq_timestamp { snd_seq_tick_time_t tick; struct snd_seq_real_time time; }; struct snd_seq_queue_skew { unsigned int value; unsigned int base; }; /* queue timer control */ struct snd_seq_ev_queue_control { unsigned char queue; /* affected queue */ unsigned char pad[3]; /* reserved */ union { signed int value; /* affected value (e.g. tempo) */ union snd_seq_timestamp time; /* time */ unsigned int position; /* sync position */ struct snd_seq_queue_skew skew; unsigned int d32[2]; unsigned char d8[8]; } param; }; /* quoted event - inside the kernel only */ struct snd_seq_ev_quote { struct snd_seq_addr origin; /* original sender */ unsigned short value; /* optional data */ struct snd_seq_event *event; /* quoted event */ } __attribute__((packed)); /* sequencer event */ struct snd_seq_event { snd_seq_event_type_t type; /* event type */ unsigned char flags; /* event flags */ char tag; unsigned char queue; /* schedule queue */ union snd_seq_timestamp time; /* schedule time */ struct snd_seq_addr source; /* source address */ struct snd_seq_addr dest; /* destination address */ union { /* event data... */ struct snd_seq_ev_note note; struct snd_seq_ev_ctrl control; struct snd_seq_ev_raw8 raw8; struct snd_seq_ev_raw32 raw32; struct snd_seq_ev_ext ext; struct snd_seq_ev_queue_control queue; union snd_seq_timestamp time; struct snd_seq_addr addr; struct snd_seq_connect connect; struct snd_seq_result result; struct snd_seq_ev_quote quote; } data; }; /* * bounce event - stored as variable size data */ struct snd_seq_event_bounce { int err; struct snd_seq_event event; /* external data follows here. */ }; /* system information */ struct snd_seq_system_info { int queues; /* maximum queues count */ int clients; /* maximum clients count */ int ports; /* maximum ports per client */ int channels; /* maximum channels per port */ int cur_clients; /* current clients */ int cur_queues; /* current queues */ char reserved[24]; }; /* system running information */ struct snd_seq_running_info { unsigned char client; /* client id */ unsigned char big_endian; /* 1 = big-endian */ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ unsigned char pad; /* reserved */ unsigned char reserved[12]; }; /* known client numbers */ #define SNDRV_SEQ_CLIENT_SYSTEM 0 /* internal client numbers */ #define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */ #define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */ /* client types */ typedef int __bitwise snd_seq_client_type_t; #define NO_CLIENT ((snd_seq_client_type_t) 0) #define USER_CLIENT ((snd_seq_client_type_t) 1) #define KERNEL_CLIENT ((snd_seq_client_type_t) 2) /* event filter flags */ #define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ #define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */ #define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ #define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ struct snd_seq_client_info { int client; /* client number to inquire */ snd_seq_client_type_t type; /* client type */ char name[64]; /* client name */ unsigned int filter; /* filter flags */ unsigned char multicast_filter[8]; /* multicast filter bitmap */ unsigned char event_filter[32]; /* event filter bitmap */ int num_ports; /* RO: number of ports */ int event_lost; /* number of lost events */ int card; /* RO: card number[kernel] */ int pid; /* RO: pid[user] */ char reserved[56]; /* for future use */ }; /* client pool size */ struct snd_seq_client_pool { int client; /* client number to inquire */ int output_pool; /* outgoing (write) pool size */ int input_pool; /* incoming (read) pool size */ int output_room; /* minimum free pool size for select/blocking mode */ int output_free; /* unused size */ int input_free; /* unused size */ char reserved[64]; }; /* Remove events by specified criteria */ #define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */ #define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */ #define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */ #define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */ #define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */ #define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */ #define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */ #define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */ #define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ #define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ struct snd_seq_remove_events { unsigned int remove_mode; /* Flags that determine what gets removed */ union snd_seq_timestamp time; unsigned char queue; /* Queue for REMOVE_DEST */ struct snd_seq_addr dest; /* Address for REMOVE_DEST */ unsigned char channel; /* Channel for REMOVE_DEST */ int type; /* For REMOVE_EVENT_TYPE */ char tag; /* Tag for REMOVE_TAG */ int reserved[10]; /* To allow for future binary compatibility */ }; /* known port numbers */ #define SNDRV_SEQ_PORT_SYSTEM_TIMER 0 #define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1 /* port capabilities (32 bits) */ #define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */ #define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */ #define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2) #define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3) #define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4) #define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ #define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ #define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ /* port type */ #define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */ #define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */ /* other standards...*/ #define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */ #define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */ #define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */ /*...*/ #define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */ #define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */ #define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */ #define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */ #define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */ /* misc. conditioning flags */ #define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0) #define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) struct snd_seq_port_info { struct snd_seq_addr addr; /* client/port numbers */ char name[64]; /* port name */ unsigned int capability; /* port capability bits */ unsigned int type; /* port type bits */ int midi_channels; /* channels per MIDI port */ int midi_voices; /* voices per MIDI port */ int synth_voices; /* voices per SYNTH port */ int read_use; /* R/O: subscribers for output (from this port) */ int write_use; /* R/O: subscribers for input (to this port) */ void *kernel; /* reserved for kernel use (must be NULL) */ unsigned int flags; /* misc. conditioning */ unsigned char time_queue; /* queue # for timestamping */ char reserved[59]; /* for future use */ }; /* queue flags */ #define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ /* queue information */ struct snd_seq_queue_info { int queue; /* queue id */ /* * security settings, only owner of this queue can start/stop timer * etc. if the queue is locked for other clients */ int owner; /* client id for owner of the queue */ unsigned locked:1; /* timing queue locked for other queues */ char name[64]; /* name of this queue */ unsigned int flags; /* flags */ char reserved[60]; /* for future use */ }; /* queue info/status */ struct snd_seq_queue_status { int queue; /* queue id */ int events; /* read-only - queue size */ snd_seq_tick_time_t tick; /* current tick */ struct snd_seq_real_time time; /* current time */ int running; /* running state of queue */ int flags; /* various flags */ char reserved[64]; /* for the future */ }; /* queue tempo */ struct snd_seq_queue_tempo { int queue; /* sequencer queue */ unsigned int tempo; /* current tempo, us/tick */ int ppq; /* time resolution, ticks/quarter */ unsigned int skew_value; /* queue skew */ unsigned int skew_base; /* queue skew base */ char reserved[24]; /* for the future */ }; /* sequencer timer sources */ #define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */ #define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */ #define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ /* queue timer info */ struct snd_seq_queue_timer { int queue; /* sequencer queue */ int type; /* source timer type */ union { struct { struct snd_timer_id id; /* ALSA's timer ID */ unsigned int resolution; /* resolution in Hz */ } alsa; } u; char reserved[64]; /* for the future use */ }; struct snd_seq_queue_client { int queue; /* sequencer queue */ int client; /* sequencer client */ int used; /* queue is used with this client (must be set for accepting events) */ /* per client watermarks */ char reserved[64]; /* for future use */ }; #define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */ #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) #define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) struct snd_seq_port_subscribe { struct snd_seq_addr sender; /* sender address */ struct snd_seq_addr dest; /* destination address */ unsigned int voices; /* number of voices to be allocated (0 = don't care) */ unsigned int flags; /* modes */ unsigned char queue; /* input time-stamp queue (optional) */ unsigned char pad[3]; /* reserved */ char reserved[64]; }; /* type of query subscription */ #define SNDRV_SEQ_QUERY_SUBS_READ 0 #define SNDRV_SEQ_QUERY_SUBS_WRITE 1 struct snd_seq_query_subs { struct snd_seq_addr root; /* client/port id to be searched */ int type; /* READ or WRITE */ int index; /* 0..N-1 */ int num_subs; /* R/O: number of subscriptions on this port */ struct snd_seq_addr addr; /* R/O: result */ unsigned char queue; /* R/O: result */ unsigned int flags; /* R/O: result */ char reserved[64]; /* for future use */ }; /* * IOCTL commands */ #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info) #define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info) #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info) #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info) #define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info) #define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info) #define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status) #define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo) #define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo) #define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer) #define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer) #define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client) #define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client) #define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool) #define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool) #define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events) #define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs) #define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe) #define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info) #define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info) #endif /* __SOUND_ASEQUENCER_H */ sound/asoc.h 0000644 00000053726 15063602061 0007006 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM * * Copyright (C) 2012 Texas Instruments Inc. * Copyright (C) 2015 Intel Corporation. * * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, * algorithms, equalisers, DAIs, widgets etc. */ #ifndef __LINUX_UAPI_SND_ASOC_H #define __LINUX_UAPI_SND_ASOC_H #include <linux/types.h> #include <sound/asound.h> /* * Maximum number of channels topology kcontrol can represent. */ #define SND_SOC_TPLG_MAX_CHAN 8 /* * Maximum number of PCM formats capability */ #define SND_SOC_TPLG_MAX_FORMATS 16 /* * Maximum number of PCM stream configs */ #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 /* * Maximum number of physical link's hardware configs */ #define SND_SOC_TPLG_HW_CONFIG_MAX 8 /* individual kcontrol info types - can be mixed with other types */ #define SND_SOC_TPLG_CTL_VOLSW 1 #define SND_SOC_TPLG_CTL_VOLSW_SX 2 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 #define SND_SOC_TPLG_CTL_ENUM 4 #define SND_SOC_TPLG_CTL_BYTES 5 #define SND_SOC_TPLG_CTL_ENUM_VALUE 6 #define SND_SOC_TPLG_CTL_RANGE 7 #define SND_SOC_TPLG_CTL_STROBE 8 /* individual widget kcontrol info types - can be mixed with other types */ #define SND_SOC_TPLG_DAPM_CTL_VOLSW 64 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67 #define SND_SOC_TPLG_DAPM_CTL_PIN 68 /* DAPM widget types - add new items to the end */ #define SND_SOC_TPLG_DAPM_INPUT 0 #define SND_SOC_TPLG_DAPM_OUTPUT 1 #define SND_SOC_TPLG_DAPM_MUX 2 #define SND_SOC_TPLG_DAPM_MIXER 3 #define SND_SOC_TPLG_DAPM_PGA 4 #define SND_SOC_TPLG_DAPM_OUT_DRV 5 #define SND_SOC_TPLG_DAPM_ADC 6 #define SND_SOC_TPLG_DAPM_DAC 7 #define SND_SOC_TPLG_DAPM_SWITCH 8 #define SND_SOC_TPLG_DAPM_PRE 9 #define SND_SOC_TPLG_DAPM_POST 10 #define SND_SOC_TPLG_DAPM_AIF_IN 11 #define SND_SOC_TPLG_DAPM_AIF_OUT 12 #define SND_SOC_TPLG_DAPM_DAI_IN 13 #define SND_SOC_TPLG_DAPM_DAI_OUT 14 #define SND_SOC_TPLG_DAPM_DAI_LINK 15 #define SND_SOC_TPLG_DAPM_BUFFER 16 #define SND_SOC_TPLG_DAPM_SCHEDULER 17 #define SND_SOC_TPLG_DAPM_EFFECT 18 #define SND_SOC_TPLG_DAPM_SIGGEN 19 #define SND_SOC_TPLG_DAPM_SRC 20 #define SND_SOC_TPLG_DAPM_ASRC 21 #define SND_SOC_TPLG_DAPM_ENCODER 22 #define SND_SOC_TPLG_DAPM_DECODER 23 #define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER /* Header magic number and string sizes */ #define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ /* string sizes */ #define SND_SOC_TPLG_NUM_TEXTS 16 /* ABI version */ #define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ #define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ /* Max size of TLV data */ #define SND_SOC_TPLG_TLV_SIZE 32 /* * File and Block header data types. * Add new generic and vendor types to end of list. * Generic types are handled by the core whilst vendors types are passed * to the component drivers for handling. */ #define SND_SOC_TPLG_TYPE_MIXER 1 #define SND_SOC_TPLG_TYPE_BYTES 2 #define SND_SOC_TPLG_TYPE_ENUM 3 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 #define SND_SOC_TPLG_TYPE_DAI_LINK 6 #define SND_SOC_TPLG_TYPE_PCM 7 #define SND_SOC_TPLG_TYPE_MANIFEST 8 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9 #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 #define SND_SOC_TPLG_TYPE_PDATA 11 #define SND_SOC_TPLG_TYPE_DAI 12 #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI /* vendor block IDs - please add new vendor types to end */ #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 #define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 #define SND_SOC_TPLG_STREAM_PLAYBACK 0 #define SND_SOC_TPLG_STREAM_CAPTURE 1 /* vendor tuple types */ #define SND_SOC_TPLG_TUPLE_TYPE_UUID 0 #define SND_SOC_TPLG_TUPLE_TYPE_STRING 1 #define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2 #define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3 #define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5 /* DAI flags */ #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0) #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) /* DAI clock gating */ #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 /* DAI mclk_direction */ #define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ #define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ /* DAI physical PCM data formats. * Add new formats to the end of the list. */ #define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */ #define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ #define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ #define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ #define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ #define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ #define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ /* left and right justified also known as MSB and LSB respectively */ #define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J #define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J /* DAI link flags */ #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) /* DAI topology BCLK parameter * For the backwards capability, by default codec is bclk provider */ #define SND_SOC_TPLG_BCLK_CP 0 /* codec is bclk provider */ #define SND_SOC_TPLG_BCLK_CC 1 /* codec is bclk consumer */ /* keep previous definitions for compatibility */ #define SND_SOC_TPLG_BCLK_CM SND_SOC_TPLG_BCLK_CP #define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC /* DAI topology FSYNC parameter * For the backwards capability, by default codec is fsync provider */ #define SND_SOC_TPLG_FSYNC_CP 0 /* codec is fsync provider */ #define SND_SOC_TPLG_FSYNC_CC 1 /* codec is fsync consumer */ /* keep previous definitions for compatibility */ #define SND_SOC_TPLG_FSYNC_CM SND_SOC_TPLG_FSYNC_CP #define SND_SOC_TPLG_FSYNC_CS SND_SOC_TPLG_FSYNC_CC /* * Block Header. * This header precedes all object and object arrays below. */ struct snd_soc_tplg_hdr { __le32 magic; /* magic number */ __le32 abi; /* ABI version */ __le32 version; /* optional vendor specific version details */ __le32 type; /* SND_SOC_TPLG_TYPE_ */ __le32 size; /* size of this structure */ __le32 vendor_type; /* optional vendor specific type info */ __le32 payload_size; /* data bytes, excluding this header */ __le32 index; /* identifier for block */ __le32 count; /* number of elements in block */ } __attribute__((packed)); /* vendor tuple for uuid */ struct snd_soc_tplg_vendor_uuid_elem { __le32 token; char uuid[16]; } __attribute__((packed)); /* vendor tuple for a bool/byte/short/word value */ struct snd_soc_tplg_vendor_value_elem { __le32 token; __le32 value; } __attribute__((packed)); /* vendor tuple for string */ struct snd_soc_tplg_vendor_string_elem { __le32 token; char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; } __attribute__((packed)); struct snd_soc_tplg_vendor_array { __le32 size; /* size in bytes of the array, including all elements */ __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ __le32 num_elems; /* number of elements in array */ union { __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_uuid_elem, uuid); __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_value_elem, value); __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_string_elem, string); }; } __attribute__((packed)); /* * Private data. * All topology objects may have private data that can be used by the driver or * firmware. Core will ignore this data. */ struct snd_soc_tplg_private { __le32 size; /* in bytes of private data */ union { __DECLARE_FLEX_ARRAY(char, data); __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_array, array); }; } __attribute__((packed)); /* * Kcontrol TLV data. */ struct snd_soc_tplg_tlv_dbscale { __le32 min; __le32 step; __le32 mute; } __attribute__((packed)); struct snd_soc_tplg_ctl_tlv { __le32 size; /* in bytes of this structure */ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ union { __le32 data[SND_SOC_TPLG_TLV_SIZE]; struct snd_soc_tplg_tlv_dbscale scale; }; } __attribute__((packed)); /* * Kcontrol channel data */ struct snd_soc_tplg_channel { __le32 size; /* in bytes of this structure */ __le32 reg; __le32 shift; __le32 id; /* ID maps to Left, Right, LFE etc */ } __attribute__((packed)); /* * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops * Kcontrol ops need get/put/info. * Bytes ext ops need get/put. */ struct snd_soc_tplg_io_ops { __le32 get; __le32 put; __le32 info; } __attribute__((packed)); /* * kcontrol header */ struct snd_soc_tplg_ctl_hdr { __le32 size; /* in bytes of this structure */ __le32 type; char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 access; struct snd_soc_tplg_io_ops ops; struct snd_soc_tplg_ctl_tlv tlv; } __attribute__((packed)); /* * Stream Capabilities */ struct snd_soc_tplg_stream_caps { __le32 size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ __le32 rate_min; /* min rate */ __le32 rate_max; /* max rate */ __le32 channels_min; /* min channels */ __le32 channels_max; /* max channels */ __le32 periods_min; /* min number of periods */ __le32 periods_max; /* max number of periods */ __le32 period_size_min; /* min period size bytes */ __le32 period_size_max; /* max period size bytes */ __le32 buffer_size_min; /* min buffer size bytes */ __le32 buffer_size_max; /* max buffer size bytes */ __le32 sig_bits; /* number of bits of content */ } __attribute__((packed)); /* * FE or BE Stream configuration supported by SW/FW */ struct snd_soc_tplg_stream { __le32 size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ __le64 format; /* SNDRV_PCM_FMTBIT_* */ __le32 rate; /* SNDRV_PCM_RATE_* */ __le32 period_bytes; /* size of period in bytes */ __le32 buffer_bytes; /* size of buffer in bytes */ __le32 channels; /* channels */ } __attribute__((packed)); /* * Describes a physical link's runtime supported hardware config, * i.e. hardware audio formats. */ struct snd_soc_tplg_hw_config { __le32 size; /* in bytes of this structure */ __le32 id; /* unique ID - - used to match */ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ __u8 bclk_provider; /* SND_SOC_TPLG_BCLK_ value */ __u8 fsync_provider; /* SND_SOC_TPLG_FSYNC_ value */ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ __le16 reserved; /* for 32bit alignment */ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ __le32 bclk_rate; /* BCLK freqency in Hz */ __le32 fsync_rate; /* frame clock in Hz */ __le32 tdm_slots; /* number of TDM slots in use */ __le32 tdm_slot_width; /* width in bits for each slot */ __le32 tx_slots; /* bit mask for active Tx slots */ __le32 rx_slots; /* bit mask for active Rx slots */ __le32 tx_channels; /* number of Tx channels */ __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ __le32 rx_channels; /* number of Rx channels */ __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ } __attribute__((packed)); /* * Manifest. List totals for each payload type. Not used in parsing, but will * be passed to the component driver before any other objects in order for any * global component resource allocations. * * File block representation for manifest :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_manifest | 1 | * +-----------------------------------+----+ */ struct snd_soc_tplg_manifest { __le32 size; /* in bytes of this structure */ __le32 control_elems; /* number of control elements */ __le32 widget_elems; /* number of widget elements */ __le32 graph_elems; /* number of graph elements */ __le32 pcm_elems; /* number of PCM elements */ __le32 dai_link_elems; /* number of DAI link elements */ __le32 dai_elems; /* number of physical DAI elements */ __le32 reserved[20]; /* reserved for new ABI element types */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Mixer kcontrol. * * File block representation for mixer kcontrol :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_mixer_control | N | * +-----------------------------------+----+ */ struct snd_soc_tplg_mixer_control { struct snd_soc_tplg_ctl_hdr hdr; __le32 size; /* in bytes of this structure */ __le32 min; __le32 max; __le32 platform_max; __le32 invert; __le32 num_channels; struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Enumerated kcontrol * * File block representation for enum kcontrol :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_enum_control | N | * +-----------------------------------+----+ */ struct snd_soc_tplg_enum_control { struct snd_soc_tplg_ctl_hdr hdr; __le32 size; /* in bytes of this structure */ __le32 num_channels; struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; __le32 items; __le32 mask; __le32 count; char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Bytes kcontrol * * File block representation for bytes kcontrol :- * +-----------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+----+ * | struct snd_soc_tplg_bytes_control | N | * +-----------------------------------+----+ */ struct snd_soc_tplg_bytes_control { struct snd_soc_tplg_ctl_hdr hdr; __le32 size; /* in bytes of this structure */ __le32 max; __le32 mask; __le32 base; __le32 num_regs; struct snd_soc_tplg_io_ops ext_ops; struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * DAPM Graph Element * * File block representation for DAPM graph elements :- * +-------------------------------------+----+ * | struct snd_soc_tplg_hdr | 1 | * +-------------------------------------+----+ * | struct snd_soc_tplg_dapm_graph_elem | N | * +-------------------------------------+----+ */ struct snd_soc_tplg_dapm_graph_elem { char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; } __attribute__((packed)); /* * DAPM Widget. * * File block representation for DAPM widget :- * +-------------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-------------------------------------+-----+ * | struct snd_soc_tplg_dapm_widget | N | * +-------------------------------------+-----+ * | struct snd_soc_tplg_enum_control | 0|1 | * | struct snd_soc_tplg_mixer_control | 0|N | * +-------------------------------------+-----+ * * Optional enum or mixer control can be appended to the end of each widget * in the block. */ struct snd_soc_tplg_dapm_widget { __le32 size; /* in bytes of this structure */ __le32 id; /* SND_SOC_DAPM_CTL */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 reg; /* negative reg = no direct dapm */ __le32 shift; /* bits to shift */ __le32 mask; /* non-shifted mask */ __le32 subseq; /* sort within widget type */ __le32 invert; /* invert the power bit */ __le32 ignore_suspend; /* kept enabled over suspend */ __le16 event_flags; __le16 event_type; __le32 num_kcontrols; struct snd_soc_tplg_private priv; /* * kcontrols that relate to this widget * follow here after widget private data */ } __attribute__((packed)); /* * Describes SW/FW specific features of PCM (FE DAI & DAI link). * * File block representation for PCM :- * +-----------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+-----+ * | struct snd_soc_tplg_pcm | N | * +-----------------------------------+-----+ */ struct snd_soc_tplg_pcm { __le32 size; /* in bytes of this structure */ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 pcm_id; /* unique ID - used to match with DAI link */ __le32 dai_id; /* unique ID - used to match */ __le32 playback; /* supports playback mode */ __le32 capture; /* supports capture mode */ __le32 compress; /* 1 = compressed; 0 = PCM */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ __le32 num_streams; /* number of streams */ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ __le32 flag_mask; /* bitmask of flags to configure */ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Describes the physical link runtime supported configs or params * * File block representation for physical link config :- * +-----------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+-----+ * | struct snd_soc_tplg_link_config | N | * +-----------------------------------+-----+ */ struct snd_soc_tplg_link_config { __le32 size; /* in bytes of this structure */ __le32 id; /* unique ID - used to match */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ __le32 num_streams; /* number of streams */ struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ __le32 num_hw_configs; /* number of hw configs */ __le32 default_hw_config_id; /* default hw config ID for init */ __le32 flag_mask; /* bitmask of flags to configure */ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Describes SW/FW specific features of physical DAI. * It can be used to configure backend DAIs for DPCM. * * File block representation for physical DAI :- * +-----------------------------------+-----+ * | struct snd_soc_tplg_hdr | 1 | * +-----------------------------------+-----+ * | struct snd_soc_tplg_dai | N | * +-----------------------------------+-----+ */ struct snd_soc_tplg_dai { __le32 size; /* in bytes of this structure */ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ __le32 dai_id; /* unique ID - used to match */ __le32 playback; /* supports playback mode */ __le32 capture; /* supports capture mode */ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ __le32 flag_mask; /* bitmask of flags to configure */ __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* * Old version of ABI structs, supported for backward compatibility. */ /* Manifest v4 */ struct snd_soc_tplg_manifest_v4 { __le32 size; /* in bytes of this structure */ __le32 control_elems; /* number of control elements */ __le32 widget_elems; /* number of widget elements */ __le32 graph_elems; /* number of graph elements */ __le32 pcm_elems; /* number of PCM elements */ __le32 dai_link_elems; /* number of DAI link elements */ struct snd_soc_tplg_private priv; } __attribute__((packed)); /* Stream Capabilities v4 */ struct snd_soc_tplg_stream_caps_v4 { __le32 size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ __le32 rate_min; /* min rate */ __le32 rate_max; /* max rate */ __le32 channels_min; /* min channels */ __le32 channels_max; /* max channels */ __le32 periods_min; /* min number of periods */ __le32 periods_max; /* max number of periods */ __le32 period_size_min; /* min period size bytes */ __le32 period_size_max; /* max period size bytes */ __le32 buffer_size_min; /* min buffer size bytes */ __le32 buffer_size_max; /* max buffer size bytes */ } __attribute__((packed)); /* PCM v4 */ struct snd_soc_tplg_pcm_v4 { __le32 size; /* in bytes of this structure */ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; __le32 pcm_id; /* unique ID - used to match with DAI link */ __le32 dai_id; /* unique ID - used to match */ __le32 playback; /* supports playback mode */ __le32 capture; /* supports capture mode */ __le32 compress; /* 1 = compressed; 0 = PCM */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ __le32 num_streams; /* number of streams */ struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ } __attribute__((packed)); /* Physical link config v4 */ struct snd_soc_tplg_link_config_v4 { __le32 size; /* in bytes of this structure */ __le32 id; /* unique ID - used to match */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ __le32 num_streams; /* number of streams */ } __attribute__((packed)); #endif sound/asound.h 0000644 00000144024 15063602061 0007342 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Advanced Linux Sound Architecture - ALSA - Driver * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>, * Abramo Bagnara <abramo@alsa-project.org> */ #ifndef __SOUND_ASOUND_H #define __SOUND_ASOUND_H #if defined(__KERNEL__) || defined(__linux__) #include <linux/types.h> #include <asm/byteorder.h> #else #include <endian.h> #include <sys/ioctl.h> #endif #include <stdlib.h> #include <time.h> /* * protocol version */ #define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) #define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) #define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) #define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) #define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) /**************************************************************************** * * * Digital audio interface * * * ****************************************************************************/ #define AES_IEC958_STATUS_SIZE 24 struct snd_aes_iec958 { unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */ unsigned char subcode[147]; /* AES/IEC958 subcode bits */ unsigned char pad; /* nothing */ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ }; /**************************************************************************** * * * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort * * * ****************************************************************************/ struct snd_cea_861_aud_if { unsigned char db1_ct_cc; /* coding type and channel count */ unsigned char db2_sf_ss; /* sample frequency and size */ unsigned char db3; /* not used, all zeros */ unsigned char db4_ca; /* channel allocation code */ unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */ }; /**************************************************************************** * * * Section for driver hardware dependent interface - /dev/snd/hw? * * * ****************************************************************************/ #define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) enum { SNDRV_HWDEP_IFACE_OPL2 = 0, SNDRV_HWDEP_IFACE_OPL3, SNDRV_HWDEP_IFACE_OPL4, SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */ SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */ SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */ SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */ SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */ SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */ /* Don't forget to change the following: */ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE }; struct snd_hwdep_info { unsigned int device; /* WR: device number */ int card; /* R: card number */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* hwdep name */ int iface; /* hwdep interface */ unsigned char reserved[64]; /* reserved for future */ }; /* generic DSP loader */ struct snd_hwdep_dsp_status { unsigned int version; /* R: driver-specific version */ unsigned char id[32]; /* R: driver-specific ID string */ unsigned int num_dsps; /* R: number of DSP images to transfer */ unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ unsigned int chip_ready; /* R: 1 = initialization finished */ unsigned char reserved[16]; /* reserved for future use */ }; struct snd_hwdep_dsp_image { unsigned int index; /* W: DSP index */ unsigned char name[64]; /* W: ID (e.g. file name) */ unsigned char *image; /* W: binary image */ size_t length; /* W: size of image in bytes */ unsigned long driver_data; /* W: driver-specific data */ }; #define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) #define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) #define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) #define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) /***************************************************************************** * * * Digital Audio (PCM) interface - /dev/snd/pcm?? * * * *****************************************************************************/ #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15) typedef unsigned long snd_pcm_uframes_t; typedef signed long snd_pcm_sframes_t; enum { SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ SNDRV_PCM_CLASS_MULTI, /* multichannel device */ SNDRV_PCM_CLASS_MODEM, /* software modem class */ SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ /* Don't forget to change the following: */ SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, }; enum { SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ /* Don't forget to change the following: */ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, }; enum { SNDRV_PCM_STREAM_PLAYBACK = 0, SNDRV_PCM_STREAM_CAPTURE, SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, }; typedef int __bitwise snd_pcm_access_t; #define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((snd_pcm_access_t) 0) /* interleaved mmap */ #define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((snd_pcm_access_t) 1) /* noninterleaved mmap */ #define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((snd_pcm_access_t) 2) /* complex mmap */ #define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((snd_pcm_access_t) 3) /* readi/writei */ #define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((snd_pcm_access_t) 4) /* readn/writen */ #define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED typedef int __bitwise snd_pcm_format_t; #define SNDRV_PCM_FORMAT_S8 ((snd_pcm_format_t) 0) #define SNDRV_PCM_FORMAT_U8 ((snd_pcm_format_t) 1) #define SNDRV_PCM_FORMAT_S16_LE ((snd_pcm_format_t) 2) #define SNDRV_PCM_FORMAT_S16_BE ((snd_pcm_format_t) 3) #define SNDRV_PCM_FORMAT_U16_LE ((snd_pcm_format_t) 4) #define SNDRV_PCM_FORMAT_U16_BE ((snd_pcm_format_t) 5) #define SNDRV_PCM_FORMAT_S24_LE ((snd_pcm_format_t) 6) /* low three bytes */ #define SNDRV_PCM_FORMAT_S24_BE ((snd_pcm_format_t) 7) /* low three bytes */ #define SNDRV_PCM_FORMAT_U24_LE ((snd_pcm_format_t) 8) /* low three bytes */ #define SNDRV_PCM_FORMAT_U24_BE ((snd_pcm_format_t) 9) /* low three bytes */ /* * For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the * available bit count in most significant bit. It's for the case of so-called 'left-justified' or * `right-padding` sample which has less width than 32 bit. */ #define SNDRV_PCM_FORMAT_S32_LE ((snd_pcm_format_t) 10) #define SNDRV_PCM_FORMAT_S32_BE ((snd_pcm_format_t) 11) #define SNDRV_PCM_FORMAT_U32_LE ((snd_pcm_format_t) 12) #define SNDRV_PCM_FORMAT_U32_BE ((snd_pcm_format_t) 13) #define SNDRV_PCM_FORMAT_FLOAT_LE ((snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_FLOAT_BE ((snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_FLOAT64_LE ((snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_FLOAT64_BE ((snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ #define SNDRV_PCM_FORMAT_MU_LAW ((snd_pcm_format_t) 20) #define SNDRV_PCM_FORMAT_A_LAW ((snd_pcm_format_t) 21) #define SNDRV_PCM_FORMAT_IMA_ADPCM ((snd_pcm_format_t) 22) #define SNDRV_PCM_FORMAT_MPEG ((snd_pcm_format_t) 23) #define SNDRV_PCM_FORMAT_GSM ((snd_pcm_format_t) 24) #define SNDRV_PCM_FORMAT_S20_LE ((snd_pcm_format_t) 25) /* in four bytes, LSB justified */ #define SNDRV_PCM_FORMAT_S20_BE ((snd_pcm_format_t) 26) /* in four bytes, LSB justified */ #define SNDRV_PCM_FORMAT_U20_LE ((snd_pcm_format_t) 27) /* in four bytes, LSB justified */ #define SNDRV_PCM_FORMAT_U20_BE ((snd_pcm_format_t) 28) /* in four bytes, LSB justified */ /* gap in the numbering for a future standard linear format */ #define SNDRV_PCM_FORMAT_SPECIAL ((snd_pcm_format_t) 31) #define SNDRV_PCM_FORMAT_S24_3LE ((snd_pcm_format_t) 32) /* in three bytes */ #define SNDRV_PCM_FORMAT_S24_3BE ((snd_pcm_format_t) 33) /* in three bytes */ #define SNDRV_PCM_FORMAT_U24_3LE ((snd_pcm_format_t) 34) /* in three bytes */ #define SNDRV_PCM_FORMAT_U24_3BE ((snd_pcm_format_t) 35) /* in three bytes */ #define SNDRV_PCM_FORMAT_S20_3LE ((snd_pcm_format_t) 36) /* in three bytes */ #define SNDRV_PCM_FORMAT_S20_3BE ((snd_pcm_format_t) 37) /* in three bytes */ #define SNDRV_PCM_FORMAT_U20_3LE ((snd_pcm_format_t) 38) /* in three bytes */ #define SNDRV_PCM_FORMAT_U20_3BE ((snd_pcm_format_t) 39) /* in three bytes */ #define SNDRV_PCM_FORMAT_S18_3LE ((snd_pcm_format_t) 40) /* in three bytes */ #define SNDRV_PCM_FORMAT_S18_3BE ((snd_pcm_format_t) 41) /* in three bytes */ #define SNDRV_PCM_FORMAT_U18_3LE ((snd_pcm_format_t) 42) /* in three bytes */ #define SNDRV_PCM_FORMAT_U18_3BE ((snd_pcm_format_t) 43) /* in three bytes */ #define SNDRV_PCM_FORMAT_G723_24 ((snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ #define SNDRV_PCM_FORMAT_G723_24_1B ((snd_pcm_format_t) 45) /* 1 sample in 1 byte */ #define SNDRV_PCM_FORMAT_G723_40 ((snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ #define SNDRV_PCM_FORMAT_G723_40_1B ((snd_pcm_format_t) 47) /* 1 sample in 1 byte */ #define SNDRV_PCM_FORMAT_DSD_U8 ((snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ #define SNDRV_PCM_FORMAT_DSD_U16_LE ((snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ #define SNDRV_PCM_FORMAT_DSD_U32_LE ((snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ #define SNDRV_PCM_FORMAT_DSD_U16_BE ((snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ #define SNDRV_PCM_FORMAT_DSD_U32_BE ((snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE #define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 #ifdef SNDRV_LITTLE_ENDIAN #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE #define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE #define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE #endif #ifdef SNDRV_BIG_ENDIAN #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE #define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE #define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE #endif typedef int __bitwise snd_pcm_subformat_t; #define SNDRV_PCM_SUBFORMAT_STD ((snd_pcm_subformat_t) 0) #define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD #define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ #define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ #define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ #define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ #define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */ #define SNDRV_PCM_INFO_PERFECT_DRAIN 0x00000040 /* silencing at the end of stream is not required */ #define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ #define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ #define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ #define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ #define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ #define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ #define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ #define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ #define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ #define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ #define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ #define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */ #define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */ #define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */ #define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */ #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */ #define SNDRV_PCM_INFO_EXPLICIT_SYNC 0x10000000 /* needs explicit sync of pointers and data */ #define SNDRV_PCM_INFO_NO_REWINDS 0x20000000 /* hardware can only support monotonic changes of appl_ptr */ #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ #if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__ #define __SND_STRUCT_TIME64 #endif typedef int __bitwise snd_pcm_state_t; #define SNDRV_PCM_STATE_OPEN ((snd_pcm_state_t) 0) /* stream is open */ #define SNDRV_PCM_STATE_SETUP ((snd_pcm_state_t) 1) /* stream has a setup */ #define SNDRV_PCM_STATE_PREPARED ((snd_pcm_state_t) 2) /* stream is ready to start */ #define SNDRV_PCM_STATE_RUNNING ((snd_pcm_state_t) 3) /* stream is running */ #define SNDRV_PCM_STATE_XRUN ((snd_pcm_state_t) 4) /* stream reached an xrun */ #define SNDRV_PCM_STATE_DRAINING ((snd_pcm_state_t) 5) /* stream is draining */ #define SNDRV_PCM_STATE_PAUSED ((snd_pcm_state_t) 6) /* stream is paused */ #define SNDRV_PCM_STATE_SUSPENDED ((snd_pcm_state_t) 7) /* hardware is suspended */ #define SNDRV_PCM_STATE_DISCONNECTED ((snd_pcm_state_t) 8) /* hardware is disconnected */ #define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED enum { SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000, SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000, SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000, SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000, #ifdef __SND_STRUCT_TIME64 SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW, SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW, #else SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD, SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD, #endif }; union snd_pcm_sync_id { unsigned char id[16]; unsigned short id16[8]; unsigned int id32[4]; }; struct snd_pcm_info { unsigned int device; /* RO/WR (control): device number */ unsigned int subdevice; /* RO/WR (control): subdevice number */ int stream; /* RO/WR (control): stream direction */ int card; /* R: card number */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* name of this device */ unsigned char subname[32]; /* subdevice name */ int dev_class; /* SNDRV_PCM_CLASS_* */ int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ unsigned int subdevices_count; unsigned int subdevices_avail; union snd_pcm_sync_id sync; /* hardware synchronization ID */ unsigned char reserved[64]; /* reserved for future... */ }; typedef int snd_pcm_hw_param_t; #define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ #define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */ #define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */ #define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS #define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT #define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ #define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ #define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ #define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ #define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between * interrupts in us */ #define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between * interrupts */ #define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between * interrupts */ #define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per * buffer */ #define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer * in us */ #define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ #define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ #define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ #define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS #define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ #define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ #define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ #define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress drain with the filling * of the silence samples */ struct snd_interval { unsigned int min, max; unsigned int openmin:1, openmax:1, integer:1, empty:1; }; #define SNDRV_MASK_MAX 256 struct snd_mask { __u32 bits[(SNDRV_MASK_MAX+31)/32]; }; struct snd_pcm_hw_params { unsigned int flags; struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; struct snd_mask mres[5]; /* reserved masks */ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; struct snd_interval ires[9]; /* reserved intervals */ unsigned int rmask; /* W: requested masks */ unsigned int cmask; /* R: changed masks */ unsigned int info; /* R: Info flags for returned setup */ unsigned int msbits; /* R: used most significant bits */ unsigned int rate_num; /* R: rate numerator */ unsigned int rate_den; /* R: rate denominator */ snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ unsigned char reserved[64]; /* reserved for future */ }; enum { SNDRV_PCM_TSTAMP_NONE = 0, SNDRV_PCM_TSTAMP_ENABLE, SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, }; struct snd_pcm_sw_params { int tstamp_mode; /* timestamp mode */ unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ /* * The following two thresholds alleviate playback buffer underruns; when * hw_avail drops below the threshold, the respective action is triggered: */ snd_pcm_uframes_t stop_threshold; /* - stop playback */ snd_pcm_uframes_t silence_threshold; /* - pre-fill buffer with silence */ snd_pcm_uframes_t silence_size; /* max size of silence pre-fill; when >= boundary, * fill played area with silence immediately */ snd_pcm_uframes_t boundary; /* pointers wrap point */ unsigned int proto; /* protocol version */ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ unsigned char reserved[56]; /* reserved for future */ }; struct snd_pcm_channel_info { unsigned int channel; __kernel_off_t offset; /* mmap offset */ unsigned int first; /* offset to first sample in bits */ unsigned int step; /* samples distance in bits */ }; enum { /* * first definition for backwards compatibility only, * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0, /* timestamp definitions */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED }; /* explicit padding avoids incompatibility between i386 and x86-64 */ typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad; struct snd_pcm_status { snd_pcm_state_t state; /* stream state */ __time_pad pad1; /* align to timespec */ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ struct timespec tstamp; /* reference timestamp */ snd_pcm_uframes_t appl_ptr; /* appl ptr */ snd_pcm_uframes_t hw_ptr; /* hw ptr */ snd_pcm_sframes_t delay; /* current delay in frames */ snd_pcm_uframes_t avail; /* number of frames available */ snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ snd_pcm_state_t suspended_state; /* suspended stream state */ __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */ struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */ __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ }; /* * For mmap operations, we need the 64-bit layout, both for compat mode, * and for y2038 compatibility. For 64-bit applications, the two definitions * are identical, so we keep the traditional version. */ #ifdef __SND_STRUCT_TIME64 #define __snd_pcm_mmap_status64 snd_pcm_mmap_status #define __snd_pcm_mmap_control64 snd_pcm_mmap_control #define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr #define __snd_timespec64 timespec struct __snd_timespec { __s32 tv_sec; __s32 tv_nsec; }; #else #define __snd_pcm_mmap_status snd_pcm_mmap_status #define __snd_pcm_mmap_control snd_pcm_mmap_control #define __snd_pcm_sync_ptr snd_pcm_sync_ptr #define __snd_timespec timespec struct __snd_timespec64 { __s64 tv_sec; __s64 tv_nsec; }; #endif struct __snd_pcm_mmap_status { snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ int pad1; /* Needed for 64 bit alignment */ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ struct __snd_timespec tstamp; /* Timestamp */ snd_pcm_state_t suspended_state; /* RO: suspended stream state */ struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */ }; struct __snd_pcm_mmap_control { snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ }; #define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ struct __snd_pcm_sync_ptr { unsigned int flags; union { struct __snd_pcm_mmap_status status; unsigned char reserved[64]; } s; union { struct __snd_pcm_mmap_control control; unsigned char reserved[64]; } c; }; #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)]; typedef char __pad_after_uframe[0]; #endif #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) typedef char __pad_before_uframe[0]; typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)]; #endif struct __snd_pcm_mmap_status64 { snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ __u32 pad1; /* Needed for 64 bit alignment */ __pad_before_uframe __pad1; snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ __pad_after_uframe __pad2; struct __snd_timespec64 tstamp; /* Timestamp */ snd_pcm_state_t suspended_state;/* RO: suspended stream state */ __u32 pad3; /* Needed for 64 bit alignment */ struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */ }; struct __snd_pcm_mmap_control64 { __pad_before_uframe __pad1; snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ __pad_before_uframe __pad2; // This should be __pad_after_uframe, but binary // backwards compatibility constraints prevent a fix. __pad_before_uframe __pad3; snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ __pad_after_uframe __pad4; }; struct __snd_pcm_sync_ptr64 { __u32 flags; __u32 pad1; union { struct __snd_pcm_mmap_status64 status; unsigned char reserved[64]; } s; union { struct __snd_pcm_mmap_control64 control; unsigned char reserved[64]; } c; }; struct snd_xferi { snd_pcm_sframes_t result; void *buf; snd_pcm_uframes_t frames; }; struct snd_xfern { snd_pcm_sframes_t result; void * *bufs; snd_pcm_uframes_t frames; }; enum { SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, }; /* channel positions */ enum { SNDRV_CHMAP_UNKNOWN = 0, SNDRV_CHMAP_NA, /* N/A, silent */ SNDRV_CHMAP_MONO, /* mono stream */ /* this follows the alsa-lib mixer channel value + 3 */ SNDRV_CHMAP_FL, /* front left */ SNDRV_CHMAP_FR, /* front right */ SNDRV_CHMAP_RL, /* rear left */ SNDRV_CHMAP_RR, /* rear right */ SNDRV_CHMAP_FC, /* front center */ SNDRV_CHMAP_LFE, /* LFE */ SNDRV_CHMAP_SL, /* side left */ SNDRV_CHMAP_SR, /* side right */ SNDRV_CHMAP_RC, /* rear center */ /* new definitions */ SNDRV_CHMAP_FLC, /* front left center */ SNDRV_CHMAP_FRC, /* front right center */ SNDRV_CHMAP_RLC, /* rear left center */ SNDRV_CHMAP_RRC, /* rear right center */ SNDRV_CHMAP_FLW, /* front left wide */ SNDRV_CHMAP_FRW, /* front right wide */ SNDRV_CHMAP_FLH, /* front left high */ SNDRV_CHMAP_FCH, /* front center high */ SNDRV_CHMAP_FRH, /* front right high */ SNDRV_CHMAP_TC, /* top center */ SNDRV_CHMAP_TFL, /* top front left */ SNDRV_CHMAP_TFR, /* top front right */ SNDRV_CHMAP_TFC, /* top front center */ SNDRV_CHMAP_TRL, /* top rear left */ SNDRV_CHMAP_TRR, /* top rear right */ SNDRV_CHMAP_TRC, /* top rear center */ /* new definitions for UAC2 */ SNDRV_CHMAP_TFLC, /* top front left center */ SNDRV_CHMAP_TFRC, /* top front right center */ SNDRV_CHMAP_TSL, /* top side left */ SNDRV_CHMAP_TSR, /* top side right */ SNDRV_CHMAP_LLFE, /* left LFE */ SNDRV_CHMAP_RLFE, /* right LFE */ SNDRV_CHMAP_BC, /* bottom center */ SNDRV_CHMAP_BLC, /* bottom left center */ SNDRV_CHMAP_BRC, /* bottom right center */ SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC, }; #define SNDRV_CHMAP_POSITION_MASK 0xffff #define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16) #define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16) #define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) #define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) #define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) #define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) #define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int) #define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) #define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) #define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) #define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) #define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr) #define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64) #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) #define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) #define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) #define SNDRV_PCM_IOCTL_START _IO('A', 0x42) #define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) #define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) #define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) #define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) #define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) #define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) #define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) #define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) #define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) #define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) #define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) #define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) #define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) /***************************************************************************** * * * MIDI v1.0 interface * * * *****************************************************************************/ /* * Raw MIDI section - /dev/snd/midi?? */ #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2) enum { SNDRV_RAWMIDI_STREAM_OUTPUT = 0, SNDRV_RAWMIDI_STREAM_INPUT, SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, }; #define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 #define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 #define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 struct snd_rawmidi_info { unsigned int device; /* RO/WR (control): device number */ unsigned int subdevice; /* RO/WR (control): subdevice number */ int stream; /* WR: stream */ int card; /* R: card number */ unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ unsigned char id[64]; /* ID (user selectable) */ unsigned char name[80]; /* name of device */ unsigned char subname[32]; /* name of active or selected subdevice */ unsigned int subdevices_count; unsigned int subdevices_avail; unsigned char reserved[64]; /* reserved for future use */ }; #define SNDRV_RAWMIDI_MODE_FRAMING_MASK (7<<0) #define SNDRV_RAWMIDI_MODE_FRAMING_SHIFT 0 #define SNDRV_RAWMIDI_MODE_FRAMING_NONE (0<<0) #define SNDRV_RAWMIDI_MODE_FRAMING_TSTAMP (1<<0) #define SNDRV_RAWMIDI_MODE_CLOCK_MASK (7<<3) #define SNDRV_RAWMIDI_MODE_CLOCK_SHIFT 3 #define SNDRV_RAWMIDI_MODE_CLOCK_NONE (0<<3) #define SNDRV_RAWMIDI_MODE_CLOCK_REALTIME (1<<3) #define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC (2<<3) #define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC_RAW (3<<3) #define SNDRV_RAWMIDI_FRAMING_DATA_LENGTH 16 struct snd_rawmidi_framing_tstamp { /* For now, frame_type is always 0. Midi 2.0 is expected to add new * types here. Applications are expected to skip unknown frame types. */ __u8 frame_type; __u8 length; /* number of valid bytes in data field */ __u8 reserved[2]; __u32 tv_nsec; /* nanoseconds */ __u64 tv_sec; /* seconds */ __u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH]; } __attribute__((packed)); struct snd_rawmidi_params { int stream; size_t buffer_size; /* queue size in bytes */ size_t avail_min; /* minimum avail bytes for wakeup */ unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ unsigned int mode; /* For input data only, frame incoming data */ unsigned char reserved[12]; /* reserved for future use */ }; struct snd_rawmidi_status { int stream; __time_pad pad1; struct timespec tstamp; /* Timestamp */ size_t avail; /* available bytes */ size_t xruns; /* count of overruns since last status (in bytes) */ unsigned char reserved[16]; /* reserved for future use */ }; #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) #define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int) #define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) #define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) #define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) #define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) /* * Timer section - /dev/snd/timer */ #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) enum { SNDRV_TIMER_CLASS_NONE = -1, SNDRV_TIMER_CLASS_SLAVE = 0, SNDRV_TIMER_CLASS_GLOBAL, SNDRV_TIMER_CLASS_CARD, SNDRV_TIMER_CLASS_PCM, SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, }; /* slave timer classes */ enum { SNDRV_TIMER_SCLASS_NONE = 0, SNDRV_TIMER_SCLASS_APPLICATION, SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, }; /* global timers (device member) */ #define SNDRV_TIMER_GLOBAL_SYSTEM 0 #define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ #define SNDRV_TIMER_GLOBAL_HPET 2 #define SNDRV_TIMER_GLOBAL_HRTIMER 3 /* info flags */ #define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ struct snd_timer_id { int dev_class; int dev_sclass; int card; int device; int subdevice; }; struct snd_timer_ginfo { struct snd_timer_id tid; /* requested timer ID */ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ int card; /* card number */ unsigned char id[64]; /* timer identification */ unsigned char name[80]; /* timer name */ unsigned long reserved0; /* reserved for future use */ unsigned long resolution; /* average period resolution in ns */ unsigned long resolution_min; /* minimal period resolution in ns */ unsigned long resolution_max; /* maximal period resolution in ns */ unsigned int clients; /* active timer clients */ unsigned char reserved[32]; }; struct snd_timer_gparams { struct snd_timer_id tid; /* requested timer ID */ unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ unsigned char reserved[32]; }; struct snd_timer_gstatus { struct snd_timer_id tid; /* requested timer ID */ unsigned long resolution; /* current period resolution in ns */ unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ unsigned char reserved[32]; }; struct snd_timer_select { struct snd_timer_id id; /* bind to timer ID */ unsigned char reserved[32]; /* reserved */ }; struct snd_timer_info { unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ int card; /* card number */ unsigned char id[64]; /* timer identificator */ unsigned char name[80]; /* timer name */ unsigned long reserved0; /* reserved for future use */ unsigned long resolution; /* average period resolution in ns */ unsigned char reserved[64]; /* reserved */ }; #define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ #define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ #define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ struct snd_timer_params { unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */ unsigned int ticks; /* requested resolution in ticks */ unsigned int queue_size; /* total size of queue (32-1024) */ unsigned int reserved0; /* reserved, was: failure locations */ unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ unsigned char reserved[60]; /* reserved */ }; struct snd_timer_status { struct timespec tstamp; /* Timestamp - last update */ unsigned int resolution; /* current period resolution in ns */ unsigned int lost; /* counter of master tick lost */ unsigned int overrun; /* count of read queue overruns */ unsigned int queue; /* used queue size */ unsigned char reserved[64]; /* reserved */ }; #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) #define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int) #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) #define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) #define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) #define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) #define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) /* The following four ioctls are changed since 1.0.9 due to confliction */ #define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) #define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int) #if __BITS_PER_LONG == 64 #define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD #else #define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \ SNDRV_TIMER_IOCTL_TREAD_OLD : \ SNDRV_TIMER_IOCTL_TREAD64) #endif struct snd_timer_read { unsigned int resolution; unsigned int ticks; }; enum { SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ SNDRV_TIMER_EVENT_TICK, /* val = ticks */ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ SNDRV_TIMER_EVENT_STOP, /* val = 0 */ SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ /* master timer events for slave timer instances */ SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, }; struct snd_timer_tread { int event; __time_pad pad1; struct timespec tstamp; unsigned int val; __time_pad pad2; }; /**************************************************************************** * * * Section for driver control interface - /dev/snd/control? * * * ****************************************************************************/ #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8) struct snd_ctl_card_info { int card; /* card number */ int pad; /* reserved for future (was type) */ unsigned char id[16]; /* ID of card (user selectable) */ unsigned char driver[16]; /* Driver name */ unsigned char name[32]; /* Short name of soundcard */ unsigned char longname[80]; /* name + info text about soundcard */ unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ unsigned char mixername[80]; /* visual mixer identification */ unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ }; typedef int __bitwise snd_ctl_elem_type_t; #define SNDRV_CTL_ELEM_TYPE_NONE ((snd_ctl_elem_type_t) 0) /* invalid */ #define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((snd_ctl_elem_type_t) 1) /* boolean type */ #define SNDRV_CTL_ELEM_TYPE_INTEGER ((snd_ctl_elem_type_t) 2) /* integer type */ #define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((snd_ctl_elem_type_t) 3) /* enumerated type */ #define SNDRV_CTL_ELEM_TYPE_BYTES ((snd_ctl_elem_type_t) 4) /* byte array */ #define SNDRV_CTL_ELEM_TYPE_IEC958 ((snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ #define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((snd_ctl_elem_type_t) 6) /* 64-bit integer type */ #define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_IFACE_CARD ((snd_ctl_elem_iface_t) 0) /* global control */ #define SNDRV_CTL_ELEM_IFACE_HWDEP ((snd_ctl_elem_iface_t) 1) /* hardware dependent device */ #define SNDRV_CTL_ELEM_IFACE_MIXER ((snd_ctl_elem_iface_t) 2) /* virtual mixer device */ #define SNDRV_CTL_ELEM_IFACE_PCM ((snd_ctl_elem_iface_t) 3) /* PCM device */ #define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((snd_ctl_elem_iface_t) 4) /* RawMidi device */ #define SNDRV_CTL_ELEM_IFACE_TIMER ((snd_ctl_elem_iface_t) 5) /* timer device */ #define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((snd_ctl_elem_iface_t) 6) /* sequencer client */ #define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER #define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ /* (1 << 3) is unused. */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) #define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ /* bits 30 and 31 are obsoleted (for indirect access) */ /* for further details see the ACPI and PCI power management specification */ #define SNDRV_CTL_POWER_D0 0x0000 /* full On */ #define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ #define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ #define SNDRV_CTL_POWER_D3 0x0300 /* Off */ #define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ #define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ #define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44 struct snd_ctl_elem_id { unsigned int numid; /* numeric identifier, zero = invalid */ snd_ctl_elem_iface_t iface; /* interface identifier */ unsigned int device; /* device/client number */ unsigned int subdevice; /* subdevice (substream) number */ unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */ unsigned int index; /* index of item */ }; struct snd_ctl_elem_list { unsigned int offset; /* W: first element ID to get */ unsigned int space; /* W: count of element IDs to get */ unsigned int used; /* R: count of element IDs set */ unsigned int count; /* R: count of all elements */ struct snd_ctl_elem_id *pids; /* R: IDs */ unsigned char reserved[50]; }; struct snd_ctl_elem_info { struct snd_ctl_elem_id id; /* W: element ID */ snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ unsigned int count; /* count of values */ __kernel_pid_t owner; /* owner's PID of this control */ union { struct { long min; /* R: minimum value */ long max; /* R: maximum value */ long step; /* R: step (0 variable) */ } integer; struct { long long min; /* R: minimum value */ long long max; /* R: maximum value */ long long step; /* R: step (0 variable) */ } integer64; struct { unsigned int items; /* R: number of items */ unsigned int item; /* W: item number */ char name[64]; /* R: value name */ __u64 names_ptr; /* W: names list (ELEM_ADD only) */ unsigned int names_length; } enumerated; unsigned char reserved[128]; } value; unsigned char reserved[64]; }; struct snd_ctl_elem_value { struct snd_ctl_elem_id id; /* W: element ID */ unsigned int indirect: 1; /* W: indirect access - obsoleted */ union { union { long value[128]; long *value_ptr; /* obsoleted */ } integer; union { long long value[64]; long long *value_ptr; /* obsoleted */ } integer64; union { unsigned int item[128]; unsigned int *item_ptr; /* obsoleted */ } enumerated; union { unsigned char data[512]; unsigned char *data_ptr; /* obsoleted */ } bytes; struct snd_aes_iec958 iec958; } value; /* RO */ unsigned char reserved[128]; }; struct snd_ctl_tlv { unsigned int numid; /* control element numeric identification */ unsigned int length; /* in bytes aligned to 4 */ unsigned int tlv[0]; /* first TLV */ }; #define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) #define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) #define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) #define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) #define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) #define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) #define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) #define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) #define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) #define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) #define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) #define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) #define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) #define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) #define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) #define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) #define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) #define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) #define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) #define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) #define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) #define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) #define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) #define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) #define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) /* * Read interface. */ enum sndrv_ctl_event_type { SNDRV_CTL_EVENT_ELEM = 0, SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, }; #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ #define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ struct snd_ctl_event { int type; /* event type - SNDRV_CTL_EVENT_* */ union { struct { unsigned int mask; struct snd_ctl_elem_id id; } elem; unsigned char data8[60]; } data; }; /* * Control names */ #define SNDRV_CTL_NAME_NONE "" #define SNDRV_CTL_NAME_PLAYBACK "Playback " #define SNDRV_CTL_NAME_CAPTURE "Capture " #define SNDRV_CTL_NAME_IEC958_NONE "" #define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" #define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" #define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" #define SNDRV_CTL_NAME_IEC958_MASK "Mask" #define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" #define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" #define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" #define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what #endif /* __SOUND_ASOUND_H */ sound/asound_fm.h 0000644 00000007065 15063602061 0010027 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_ASOUND_FM_H #define __SOUND_ASOUND_FM_H /* * Advanced Linux Sound Architecture - ALSA * * Interface file between ALSA driver & user space * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>, * 4Front Technologies * * Direct FM control */ #define SNDRV_DM_FM_MODE_OPL2 0x00 #define SNDRV_DM_FM_MODE_OPL3 0x01 struct snd_dm_fm_info { unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ unsigned char rhythm; /* percussion mode flag */ }; /* * Data structure composing an FM "note" or sound event. */ struct snd_dm_fm_voice { unsigned char op; /* operator cell (0 or 1) */ unsigned char voice; /* FM voice (0 to 17) */ unsigned char am; /* amplitude modulation */ unsigned char vibrato; /* vibrato effect */ unsigned char do_sustain; /* sustain phase */ unsigned char kbd_scale; /* keyboard scaling */ unsigned char harmonic; /* 4 bits: harmonic and multiplier */ unsigned char scale_level; /* 2 bits: decrease output freq rises */ unsigned char volume; /* 6 bits: volume */ unsigned char attack; /* 4 bits: attack rate */ unsigned char decay; /* 4 bits: decay rate */ unsigned char sustain; /* 4 bits: sustain level */ unsigned char release; /* 4 bits: release rate */ unsigned char feedback; /* 3 bits: feedback for op0 */ unsigned char connection; /* 0 for serial, 1 for parallel */ unsigned char left; /* stereo left */ unsigned char right; /* stereo right */ unsigned char waveform; /* 3 bits: waveform shape */ }; /* * This describes an FM note by its voice, octave, frequency number (10bit) * and key on/off. */ struct snd_dm_fm_note { unsigned char voice; /* 0-17 voice channel */ unsigned char octave; /* 3 bits: what octave to play */ unsigned int fnum; /* 10 bits: frequency number */ unsigned char key_on; /* set for active, clear for silent */ }; /* * FM parameters that apply globally to all voices, and thus are not "notes" */ struct snd_dm_fm_params { unsigned char am_depth; /* amplitude modulation depth (1=hi) */ unsigned char vib_depth; /* vibrato depth (1=hi) */ unsigned char kbd_split; /* keyboard split */ unsigned char rhythm; /* percussion mode select */ /* This block is the percussion instrument data */ unsigned char bass; unsigned char snare; unsigned char tomtom; unsigned char cymbal; unsigned char hihat; }; /* * FM mode ioctl settings */ #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info) #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note) #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice) #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params) #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) /* for OPL3 only */ #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) /* SBI patch management */ #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40) #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20 #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21 #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22 #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23 #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24 #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25 /* * Patch Record - fixed size for write */ #define FM_KEY_SBI "SBI\032" #define FM_KEY_2OP "2OP\032" #define FM_KEY_4OP "4OP\032" struct sbi_patch { unsigned char prog; unsigned char bank; char key[4]; char name[25]; char extension[7]; unsigned char data[32]; }; #endif /* __SOUND_ASOUND_FM_H */ sound/compress_offload.h 0000644 00000013446 15063602061 0011401 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * compress_offload.h - compress offload header definations * * Copyright (C) 2011 Intel Corporation * Authors: Vinod Koul <vinod.koul@linux.intel.com> * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> */ #ifndef __COMPRESS_OFFLOAD_H #define __COMPRESS_OFFLOAD_H #include <linux/types.h> #include <sound/asound.h> #include <sound/compress_params.h> #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 2, 0) /** * struct snd_compressed_buffer - compressed buffer * @fragment_size: size of buffer fragment in bytes * @fragments: number of such fragments */ struct snd_compressed_buffer { __u32 fragment_size; __u32 fragments; } __attribute__((packed, aligned(4))); /** * struct snd_compr_params - compressed stream params * @buffer: buffer description * @codec: codec parameters * @no_wake_mode: dont wake on fragment elapsed */ struct snd_compr_params { struct snd_compressed_buffer buffer; struct snd_codec codec; __u8 no_wake_mode; } __attribute__((packed, aligned(4))); /** * struct snd_compr_tstamp - timestamp descriptor * @byte_offset: Byte offset in ring buffer to DSP * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by * large steps and should only be used to monitor encoding/decoding * progress. It shall not be used for timing estimates. * @pcm_io_frames: Frames rendered or received by DSP into a mixer or an audio * output/input. This field should be used for A/V sync or time estimates. * @sampling_rate: sampling rate of audio */ struct snd_compr_tstamp { __u32 byte_offset; __u32 copied_total; __u32 pcm_frames; __u32 pcm_io_frames; __u32 sampling_rate; } __attribute__((packed, aligned(4))); /** * struct snd_compr_avail - avail descriptor * @avail: Number of bytes available in ring buffer for writing/reading * @tstamp: timestamp information */ struct snd_compr_avail { __u64 avail; struct snd_compr_tstamp tstamp; } __attribute__((packed, aligned(4))); enum snd_compr_direction { SND_COMPRESS_PLAYBACK = 0, SND_COMPRESS_CAPTURE }; /** * struct snd_compr_caps - caps descriptor * @codecs: pointer to array of codecs * @direction: direction supported. Of type snd_compr_direction * @min_fragment_size: minimum fragment supported by DSP * @max_fragment_size: maximum fragment supported by DSP * @min_fragments: min fragments supported by DSP * @max_fragments: max fragments supported by DSP * @num_codecs: number of codecs supported * @reserved: reserved field */ struct snd_compr_caps { __u32 num_codecs; __u32 direction; __u32 min_fragment_size; __u32 max_fragment_size; __u32 min_fragments; __u32 max_fragments; __u32 codecs[MAX_NUM_CODECS]; __u32 reserved[11]; } __attribute__((packed, aligned(4))); /** * struct snd_compr_codec_caps - query capability of codec * @codec: codec for which capability is queried * @num_descriptors: number of codec descriptors * @descriptor: array of codec capability descriptor */ struct snd_compr_codec_caps { __u32 codec; __u32 num_descriptors; struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; } __attribute__((packed, aligned(4))); /** * enum sndrv_compress_encoder - encoder metadata key * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the * end of the track * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the * beginning of the track */ enum sndrv_compress_encoder { SNDRV_COMPRESS_ENCODER_PADDING = 1, SNDRV_COMPRESS_ENCODER_DELAY = 2, }; /** * struct snd_compr_metadata - compressed stream metadata * @key: key id * @value: key value */ struct snd_compr_metadata { __u32 key; __u32 value[8]; } __attribute__((packed, aligned(4))); /* * compress path ioctl definitions * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters * Note: only codec params can be changed runtime and stream params cant be * SNDRV_COMPRESS_GET_PARAMS: Query codec params * SNDRV_COMPRESS_TSTAMP: get the current timestamp value * SNDRV_COMPRESS_AVAIL: get the current buffer avail value. * This also queries the tstamp properties * SNDRV_COMPRESS_PAUSE: Pause the running stream * SNDRV_COMPRESS_RESUME: resume a paused stream * SNDRV_COMPRESS_START: Start a stream * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content * and the buffers currently with DSP * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that * SNDRV_COMPRESS_IOCTL_VERSION: Query the API version */ #define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int) #define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps) #define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11,\ struct snd_compr_codec_caps) #define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params) #define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec) #define SNDRV_COMPRESS_SET_METADATA _IOW('C', 0x14,\ struct snd_compr_metadata) #define SNDRV_COMPRESS_GET_METADATA _IOWR('C', 0x15,\ struct snd_compr_metadata) #define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp) #define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail) #define SNDRV_COMPRESS_PAUSE _IO('C', 0x30) #define SNDRV_COMPRESS_RESUME _IO('C', 0x31) #define SNDRV_COMPRESS_START _IO('C', 0x32) #define SNDRV_COMPRESS_STOP _IO('C', 0x33) #define SNDRV_COMPRESS_DRAIN _IO('C', 0x34) #define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35) #define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36) /* * TODO * 1. add mmap support * */ #define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */ #define SND_COMPR_TRIGGER_NEXT_TRACK 8 #define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9 #endif sound/compress_params.h 0000644 00000040115 15063602061 0011243 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) AND MIT) */ /* * compress_params.h - codec types and parameters for compressed data * streaming interface * * Copyright (C) 2011 Intel Corporation * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> * Vinod Koul <vinod.koul@linux.intel.com> * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * The definitions in this file are derived from the OpenMAX AL version 1.1 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below * and are licensed under the MIT license. * * Copyright (c) 2007-2010 The Khronos Group Inc. */ #ifndef __SND_COMPRESS_PARAMS_H #define __SND_COMPRESS_PARAMS_H #include <linux/types.h> /* AUDIO CODECS SUPPORTED */ #define MAX_NUM_CODECS 32 #define MAX_NUM_CODEC_DESCRIPTORS 32 #define MAX_NUM_BITRATES 32 #define MAX_NUM_SAMPLE_RATES 32 /* Codecs are listed linearly to allow for extensibility */ #define SND_AUDIOCODEC_PCM ((__u32) 0x00000001) #define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002) #define SND_AUDIOCODEC_AMR ((__u32) 0x00000003) #define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004) #define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005) #define SND_AUDIOCODEC_AAC ((__u32) 0x00000006) #define SND_AUDIOCODEC_WMA ((__u32) 0x00000007) #define SND_AUDIOCODEC_REAL ((__u32) 0x00000008) #define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009) #define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A) #define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) #define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) #define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) #define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E) #define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F) #define SND_AUDIOCODEC_APE ((__u32) 0x00000010) #define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE /* * Profile and modes are listed with bit masks. This allows for a * more compact representation of fields that will not evolve * (in contrast to the list of codecs) */ #define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001) /* MP3 modes are only useful for encoders */ #define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001) #define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002) #define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004) #define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008) #define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001) /* AMR modes are only useful for encoders */ #define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001) #define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002) #define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004) #define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000) #define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001) #define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002) #define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004) #define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008) #define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010) #define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020) #define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001) /* AMRWB modes are only useful for encoders */ #define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001) #define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002) #define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004) #define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001) #define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001) /* AAC modes are required for encoders and decoders */ #define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001) #define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002) #define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004) #define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008) #define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010) #define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020) #define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040) #define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080) #define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100) #define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200) /* AAC formats are required for encoders and decoders */ #define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001) #define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002) #define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004) #define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008) #define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010) #define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020) #define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040) #define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001) #define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002) #define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004) #define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008) #define SND_AUDIOPROFILE_WMA9_PRO ((__u32) 0x00000010) #define SND_AUDIOPROFILE_WMA9_LOSSLESS ((__u32) 0x00000020) #define SND_AUDIOPROFILE_WMA10_LOSSLESS ((__u32) 0x00000040) #define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001) #define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002) #define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004) #define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008) #define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010) #define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020) #define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040) #define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080) #define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001) /* * Some implementations strip the ASF header and only send ASF packets * to the DSP */ #define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002) #define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001) #define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001) #define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002) #define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004) #define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008) #define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001) #define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001) #define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001) /* * Define quality levels for FLAC encoders, from LEVEL0 (fast) * to LEVEL8 (best) */ #define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001) #define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002) #define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004) #define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008) #define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010) #define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020) #define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040) #define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080) #define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100) #define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001) #define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002) /* IEC61937 payloads without CUVP and preambles */ #define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001) /* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */ #define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002) /* * IEC modes are mandatory for decoders. Format autodetection * will only happen on the DSP side with mode 0. The PCM mode should * not be used, the PCM codec should be used instead. */ #define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000) #define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001) #define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002) #define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004) #define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008) #define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010) #define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020) #define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040) #define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080) #define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100) #define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200) #define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400) #define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800) #define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000) #define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000) #define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000) #define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000) #define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000) #define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000) #define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001) #define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001) #define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002) #define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004) #define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001) #define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001) #define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002) /* <FIXME: multichannel encoders aren't supported for now. Would need an additional definition of channel arrangement> */ /* VBR/CBR definitions */ #define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001) #define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002) /* Encoder options */ struct snd_enc_wma { __u32 super_block_align; /* WMA Type-specific data */ }; /** * struct snd_enc_vorbis - Vorbis encoder parameters * @quality: Sets encoding quality to n, between -1 (low) and 10 (high). * In the default mode of operation, the quality level is 3. * Normal quality range is 0 - 10. * @managed: Boolean. Set bitrate management mode. This turns off the * normal VBR encoding, but allows hard or soft bitrate constraints to be * enforced by the encoder. This mode can be slower, and may also be * lower quality. It is primarily useful for streaming. * @max_bit_rate: Enabled only if managed is TRUE * @min_bit_rate: Enabled only if managed is TRUE * @downmix: Boolean. Downmix input from stereo to mono (has no effect on * non-stereo streams). Useful for lower-bitrate encoding. * * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc * properties * * For best quality users should specify VBR mode and set quality levels. */ struct snd_enc_vorbis { __s32 quality; __u32 managed; __u32 max_bit_rate; __u32 min_bit_rate; __u32 downmix; } __attribute__((packed, aligned(4))); /** * struct snd_enc_real - RealAudio encoder parameters * @quant_bits: number of coupling quantization bits in the stream * @start_region: coupling start region in the stream * @num_regions: number of regions value * * These options were extracted from the OpenMAX IL spec */ struct snd_enc_real { __u32 quant_bits; __u32 start_region; __u32 num_regions; } __attribute__((packed, aligned(4))); /** * struct snd_enc_flac - FLAC encoder parameters * @num: serial number, valid only for OGG formats * needs to be set by application * @gain: Add replay gain tags * * These options were extracted from the FLAC online documentation * at http://flac.sourceforge.net/documentation_tools_flac.html * * To make the API simpler, it is assumed that the user will select quality * profiles. Additional options that affect encoding quality and speed can * be added at a later stage if needed. * * By default the Subset format is used by encoders. * * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are * not supported in this API. */ struct snd_enc_flac { __u32 num; __u32 gain; } __attribute__((packed, aligned(4))); struct snd_enc_generic { __u32 bw; /* encoder bandwidth */ __s32 reserved[15]; /* Can be used for SND_AUDIOCODEC_BESPOKE */ } __attribute__((packed, aligned(4))); struct snd_dec_flac { __u16 sample_size; __u16 min_blk_size; __u16 max_blk_size; __u16 min_frame_size; __u16 max_frame_size; __u16 reserved; } __attribute__((packed, aligned(4))); struct snd_dec_wma { __u32 encoder_option; __u32 adv_encoder_option; __u32 adv_encoder_option2; __u32 reserved; } __attribute__((packed, aligned(4))); struct snd_dec_alac { __u32 frame_length; __u8 compatible_version; __u8 pb; __u8 mb; __u8 kb; __u32 max_run; __u32 max_frame_bytes; } __attribute__((packed, aligned(4))); struct snd_dec_ape { __u16 compatible_version; __u16 compression_level; __u32 format_flags; __u32 blocks_per_frame; __u32 final_frame_blocks; __u32 total_frames; __u32 seek_table_present; } __attribute__((packed, aligned(4))); union snd_codec_options { struct snd_enc_wma wma; struct snd_enc_vorbis vorbis; struct snd_enc_real real; struct snd_enc_flac flac; struct snd_enc_generic generic; struct snd_dec_flac flac_d; struct snd_dec_wma wma_d; struct snd_dec_alac alac_d; struct snd_dec_ape ape_d; } __attribute__((packed, aligned(4))); /** struct snd_codec_desc - description of codec capabilities * @max_ch: Maximum number of audio channels * @sample_rates: Sampling rates in Hz, use values like 48000 for this * @num_sample_rates: Number of valid values in sample_rates array * @bit_rate: Indexed array containing supported bit rates * @num_bitrates: Number of valid values in bit_rate array * @rate_control: value is specified by SND_RATECONTROLMODE defines. * @profiles: Supported profiles. See SND_AUDIOPROFILE defines. * @modes: Supported modes. See SND_AUDIOMODE defines * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines * @min_buffer: Minimum buffer size handled by codec implementation * @reserved: reserved for future use * * This structure provides a scalar value for profiles, modes and stream * format fields. * If an implementation supports multiple combinations, they will be listed as * codecs with different descriptors, for example there would be 2 descriptors * for AAC-RAW and AAC-ADTS. * This entails some redundancy but makes it easier to avoid invalid * configurations. * */ struct snd_codec_desc { __u32 max_ch; __u32 sample_rates[MAX_NUM_SAMPLE_RATES]; __u32 num_sample_rates; __u32 bit_rate[MAX_NUM_BITRATES]; __u32 num_bitrates; __u32 rate_control; __u32 profiles; __u32 modes; __u32 formats; __u32 min_buffer; __u32 reserved[15]; } __attribute__((packed, aligned(4))); /** struct snd_codec * @id: Identifies the supported audio encoder/decoder. * See SND_AUDIOCODEC macros. * @ch_in: Number of input audio channels * @ch_out: Number of output channels. In case of contradiction between * this field and the channelMode field, the channelMode field * overrides. * @sample_rate: Audio sample rate of input data in Hz, use values like 48000 * for this. * @bit_rate: Bitrate of encoded data. May be ignored by decoders * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines. * Encoders may rely on profiles for quality levels. * May be ignored by decoders. * @profile: Mandatory for encoders, can be mandatory for specific * decoders as well. See SND_AUDIOPROFILE defines. * @level: Supported level (Only used by WMA at the moment) * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines * @format: Format of encoded bistream. Mandatory when defined. * See SND_AUDIOSTREAMFORMAT defines. * @align: Block alignment in bytes of an audio sample. * Only required for PCM or IEC formats. * @options: encoder-specific settings * @reserved: reserved for future use */ struct snd_codec { __u32 id; __u32 ch_in; __u32 ch_out; __u32 sample_rate; __u32 bit_rate; __u32 rate_control; __u32 profile; __u32 level; __u32 ch_mode; __u32 format; __u32 align; union snd_codec_options options; __u32 reserved[3]; } __attribute__((packed, aligned(4))); #endif sound/emu10k1.h 0000644 00000044610 15063602061 0007234 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, * Creative Labs, Inc. * Definitions for EMU10K1 (SB Live!) chips */ #ifndef __SOUND_EMU10K1_H #define __SOUND_EMU10K1_H #ifdef __linux__ #include <linux/types.h> #endif /* * ---- FX8010 ---- */ #define EMU10K1_FX8010_PCM_COUNT 8 /* * Following definition is copied from linux/types.h to support compiling * this header file in userspace since they are not generally available for * uapi headers. */ #define __EMU10K1_DECLARE_BITMAP(name,bits) \ unsigned long name[(bits) / (sizeof(unsigned long) * 8)] /* instruction set */ #define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */ #define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */ #define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */ #define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */ #define iMACINT0 0x04 /* R = A + X * Y ; saturation */ #define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */ #define iACC3 0x06 /* R = A + X + Y ; saturation */ #define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */ #define iANDXOR 0x08 /* R = (A & X) ^ Y */ #define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */ #define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */ #define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */ #define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */ #define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */ #define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */ #define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */ #define LOWORD_OPX_MASK 0x000ffc00 /* Instruction operand X */ #define LOWORD_OPY_MASK 0x000003ff /* Instruction operand Y */ #define HIWORD_OPCODE_MASK 0x00f00000 /* Instruction opcode */ #define HIWORD_RESULT_MASK 0x000ffc00 /* Instruction result */ #define HIWORD_OPA_MASK 0x000003ff /* Instruction operand A */ /* Audigy Soundcards have a different instruction format */ #define A_LOWORD_OPX_MASK 0x007ff000 #define A_LOWORD_OPY_MASK 0x000007ff #define A_HIWORD_OPCODE_MASK 0x0f000000 #define A_HIWORD_RESULT_MASK 0x007ff000 #define A_HIWORD_OPA_MASK 0x000007ff /* GPRs */ #define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */ #define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */ #define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */ #define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */ /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */ #define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */ #define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */ #define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */ #define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */ #define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */ #define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" */ #define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_01 - _0F" */ #define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x1f "EMU32_IN_00 - _1F" - Only when .device = 0x0008 */ #define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x1f "EMU32_OUT_00 - _1F" - Only when .device = 0x0008 */ #define C_00000000 0x40 #define C_00000001 0x41 #define C_00000002 0x42 #define C_00000003 0x43 #define C_00000004 0x44 #define C_00000008 0x45 #define C_00000010 0x46 #define C_00000020 0x47 #define C_00000100 0x48 #define C_00010000 0x49 #define C_00080000 0x4a #define C_10000000 0x4b #define C_20000000 0x4c #define C_40000000 0x4d #define C_80000000 0x4e #define C_7fffffff 0x4f #define C_ffffffff 0x50 #define C_fffffffe 0x51 #define C_c0000000 0x52 #define C_4f1bbcdc 0x53 #define C_5a7ef9db 0x54 #define C_00100000 0x55 /* ?? */ #define GPR_ACCU 0x56 /* ACCUM, accumulator */ #define GPR_COND 0x57 /* CCR, condition register */ #define GPR_NOISE0 0x58 /* noise source */ #define GPR_NOISE1 0x59 /* noise source */ #define GPR_IRQ 0x5a /* IRQ register */ #define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ /* Audigy constants */ #define A_C_00000000 0xc0 #define A_C_00000001 0xc1 #define A_C_00000002 0xc2 #define A_C_00000003 0xc3 #define A_C_00000004 0xc4 #define A_C_00000008 0xc5 #define A_C_00000010 0xc6 #define A_C_00000020 0xc7 #define A_C_00000100 0xc8 #define A_C_00010000 0xc9 #define A_C_00000800 0xca #define A_C_10000000 0xcb #define A_C_20000000 0xcc #define A_C_40000000 0xcd #define A_C_80000000 0xce #define A_C_7fffffff 0xcf #define A_C_ffffffff 0xd0 #define A_C_fffffffe 0xd1 #define A_C_c0000000 0xd2 #define A_C_4f1bbcdc 0xd3 #define A_C_5a7ef9db 0xd4 #define A_C_00100000 0xd5 #define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */ #define A_GPR_COND 0xd7 /* CCR, condition register */ #define A_GPR_NOISE0 0xd8 /* noise source */ #define A_GPR_NOISE1 0xd9 /* noise source */ #define A_GPR_IRQ 0xda /* IRQ register */ #define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */ #define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */ /* Each FX general purpose register is 32 bits in length, all bits are used */ #define FXGPREGBASE 0x100 /* FX general purpose registers base */ #define A_FXGPREGBASE 0x400 /* Audigy GPRs, 0x400 to 0x5ff */ #define A_TANKMEMCTLREGBASE 0x100 /* Tank memory control registers base - only for Audigy */ #define A_TANKMEMCTLREG_MASK 0x1f /* only 5 bits used - only for Audigy */ /* Tank audio data is logarithmically compressed down to 16 bits before writing to TRAM and is */ /* decompressed back to 20 bits on a read. There are a total of 160 locations, the last 32 */ /* locations are for external TRAM. */ #define TANKMEMDATAREGBASE 0x200 /* Tank memory data registers base */ #define TANKMEMDATAREG_MASK 0x000fffff /* 20 bit tank audio data field */ /* Combined address field and memory opcode or flag field. 160 locations, last 32 are external */ #define TANKMEMADDRREGBASE 0x300 /* Tank memory address registers base */ #define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */ #define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */ #define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */ #define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */ #define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ #define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ #define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ #define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ #define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ #define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ #define A_GPR(x) (A_FXGPREGBASE + (x)) #define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ #define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ #define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ #define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ #define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */ #define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */ /* cc_reg constants */ #define CC_REG_NORMALIZED C_00000001 #define CC_REG_BORROW C_00000002 #define CC_REG_MINUS C_00000004 #define CC_REG_ZERO C_00000008 #define CC_REG_SATURATE C_00000010 #define CC_REG_NONZERO C_00000100 #define A_CC_REG_NORMALIZED A_C_00000001 #define A_CC_REG_BORROW A_C_00000002 #define A_CC_REG_MINUS A_C_00000004 #define A_CC_REG_ZERO A_C_00000008 #define A_CC_REG_SATURATE A_C_00000010 #define A_CC_REG_NONZERO A_C_00000100 /* FX buses */ // These are arbitrary mappings; our DSP code simply expects // the config files to route the channels this way. // The numbers are documented in {audigy,sb-live}-mixer.rst. #define FXBUS_PCM_LEFT 0x00 #define FXBUS_PCM_RIGHT 0x01 #define FXBUS_PCM_LEFT_REAR 0x02 #define FXBUS_PCM_RIGHT_REAR 0x03 #define FXBUS_MIDI_LEFT 0x04 #define FXBUS_MIDI_RIGHT 0x05 #define FXBUS_PCM_CENTER 0x06 #define FXBUS_PCM_LFE 0x07 #define FXBUS_PCM_LEFT_FRONT 0x08 #define FXBUS_PCM_RIGHT_FRONT 0x09 #define FXBUS_MIDI_REVERB 0x0c #define FXBUS_MIDI_CHORUS 0x0d #define FXBUS_PCM_LEFT_SIDE 0x0e #define FXBUS_PCM_RIGHT_SIDE 0x0f #define FXBUS_PT_LEFT 0x14 #define FXBUS_PT_RIGHT 0x15 /* Inputs */ #define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ #define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ #define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */ #define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */ #define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */ #define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */ #define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */ #define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */ #define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */ #define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */ #define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */ #define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */ #define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */ #define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */ /* Outputs */ #define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */ #define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */ #define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */ #define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */ #define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */ #define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */ #define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */ #define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */ #define EXTOUT_REAR_L 0x08 /* Rear channel - left */ #define EXTOUT_REAR_R 0x09 /* Rear channel - right */ #define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */ #define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */ #define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */ #define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */ #define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */ #define EXTOUT_ACENTER 0x11 /* Analog Center */ #define EXTOUT_ALFE 0x12 /* Analog LFE */ /* Audigy Inputs */ #define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */ #define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ #define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ #define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ #define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ #define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ #define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ #define A_EXTIN_LINE2_R 0x09 /* right */ #define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ #define A_EXTIN_ADC_R 0x0b /* right */ #define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ #define A_EXTIN_AUX2_R 0x0d /* - right */ /* Audigiy Outputs */ #define A_EXTOUT_FRONT_L 0x00 /* digital front left */ #define A_EXTOUT_FRONT_R 0x01 /* right */ #define A_EXTOUT_CENTER 0x02 /* digital front center */ #define A_EXTOUT_LFE 0x03 /* digital front lfe */ #define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */ #define A_EXTOUT_HEADPHONE_R 0x05 /* right */ #define A_EXTOUT_REAR_L 0x06 /* digital rear left */ #define A_EXTOUT_REAR_R 0x07 /* right */ #define A_EXTOUT_AFRONT_L 0x08 /* analog front left */ #define A_EXTOUT_AFRONT_R 0x09 /* right */ #define A_EXTOUT_ACENTER 0x0a /* analog center */ #define A_EXTOUT_ALFE 0x0b /* analog LFE */ #define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */ #define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */ #define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ #define A_EXTOUT_AREAR_R 0x0f /* right */ #define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ #define A_EXTOUT_AC97_R 0x11 /* right */ #define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ #define A_EXTOUT_ADC_CAP_R 0x17 /* right */ #define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */ /* Definitions for debug register. Note that these are for emu10k1 ONLY. */ #define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ #define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */ #define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */ #define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */ #define EMU10K1_DBG_STEP 0x00004000 /* start single step */ #define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */ #define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */ /* Definitions for emu10k2 debug register. */ #define A_DBG_ZC 0x40000000 /* zero tram counter */ #define A_DBG_SATURATION_OCCURED 0x20000000 #define A_DBG_SATURATION_ADDR 0x0ffc0000 #define A_DBG_SINGLE_STEP 0x00020000 /* Set to zero to start dsp */ #define A_DBG_STEP 0x00010000 #define A_DBG_CONDITION_CODE 0x0000f800 #define A_DBG_STEP_ADDR 0x000003ff struct snd_emu10k1_fx8010_info { unsigned int internal_tram_size; /* in samples */ unsigned int external_tram_size; /* in samples */ char fxbus_names[16][32]; /* names of FXBUSes */ char extin_names[16][32]; /* names of external inputs */ char extout_names[32][32]; /* names of external outputs */ unsigned int gpr_controls; /* count of GPR controls */ }; #define EMU10K1_GPR_TRANSLATION_NONE 0 #define EMU10K1_GPR_TRANSLATION_TABLE100 1 #define EMU10K1_GPR_TRANSLATION_BASS 2 #define EMU10K1_GPR_TRANSLATION_TREBLE 3 #define EMU10K1_GPR_TRANSLATION_ONOFF 4 enum emu10k1_ctl_elem_iface { EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */ EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */ }; struct emu10k1_ctl_elem_id { unsigned int pad; /* don't use */ int iface; /* interface identifier */ unsigned int device; /* device/client number */ unsigned int subdevice; /* subdevice (substream) number */ unsigned char name[44]; /* ASCII name of item */ unsigned int index; /* index of item */ }; struct snd_emu10k1_fx8010_control_gpr { struct emu10k1_ctl_elem_id id; /* full control ID definition */ unsigned int vcount; /* visible count */ unsigned int count; /* count of GPR (1..16) */ unsigned short gpr[32]; /* GPR number(s) */ unsigned int value[32]; /* initial values */ unsigned int min; /* minimum range */ unsigned int max; /* maximum range */ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ const unsigned int *tlv; }; /* old ABI without TLV support */ struct snd_emu10k1_fx8010_control_old_gpr { struct emu10k1_ctl_elem_id id; unsigned int vcount; unsigned int count; unsigned short gpr[32]; unsigned int value[32]; unsigned int min; unsigned int max; unsigned int translation; }; struct snd_emu10k1_fx8010_code { char name[128]; __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ __u32 *gpr_map; /* initializers */ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */ unsigned int gpr_del_control_count; /* count of GPR controls to remove */ struct emu10k1_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */ unsigned int gpr_list_control_count; /* count of GPR controls to list */ unsigned int gpr_list_control_total; /* total count of GPR controls */ struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */ __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ __u32 *tram_data_map; /* data initializers */ __u32 *tram_addr_map; /* map initializers */ __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ __u32 *code; /* one instruction - 64 bits */ }; struct snd_emu10k1_fx8010_tram { unsigned int address; /* 31.bit == 1 -> external TRAM */ unsigned int size; /* size in samples (4 bytes) */ unsigned int *samples; /* pointer to samples (20-bit) */ /* NULL->clear memory */ }; struct snd_emu10k1_fx8010_pcm_rec { unsigned int substream; /* substream number */ unsigned int res1; /* reserved */ unsigned int channels; /* 16-bit channels count, zero = remove this substream */ unsigned int tram_start; /* ring buffer position in TRAM (in samples) */ unsigned int buffer_size; /* count of buffered samples */ unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */ unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */ unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */ unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */ unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ unsigned char pad; /* reserved */ unsigned char etram[32]; /* external TRAM address & data (one per channel) */ unsigned int res2; /* reserved */ }; #define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) #define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) #define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) #define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) #define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) #define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram) #define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) #define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) #define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) #define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int) #define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) #define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) #define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) #endif /* __SOUND_EMU10K1_H */ sound/firewire.h 0000644 00000025413 15063602061 0007665 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _SOUND_FIREWIRE_H_INCLUDED #define _SOUND_FIREWIRE_H_INCLUDED #include <linux/ioctl.h> #include <linux/types.h> /* events can be read() from the hwdep device */ #define SNDRV_FIREWIRE_EVENT_LOCK_STATUS 0x000010cc #define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION 0xd1ce004e #define SNDRV_FIREWIRE_EVENT_EFW_RESPONSE 0x4e617475 #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x64776479 #define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d #define SNDRV_FIREWIRE_EVENT_MOTU_REGISTER_DSP_CHANGE 0x4d545244 #define SNDRV_FIREWIRE_EVENT_FF400_MESSAGE 0x4f6c6761 struct snd_firewire_event_common { unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */ }; struct snd_firewire_event_lock_status { unsigned int type; unsigned int status; /* 0/1 = unlocked/locked */ }; struct snd_firewire_event_dice_notification { unsigned int type; unsigned int notification; /* DICE-specific bits */ }; #define SND_EFW_TRANSACTION_USER_SEQNUM_MAX ((__u32)((__u16)~0) - 1) /* each field should be in big endian */ struct snd_efw_transaction { __be32 length; __be32 version; __be32 seqnum; __be32 category; __be32 command; __be32 status; __be32 params[0]; }; struct snd_firewire_event_efw_response { unsigned int type; __be32 response[0]; /* some responses */ }; struct snd_firewire_event_digi00x_message { unsigned int type; __u32 message; /* Digi00x-specific message */ }; struct snd_firewire_event_motu_notification { unsigned int type; __u32 message; /* MOTU-specific bits. */ }; struct snd_firewire_tascam_change { unsigned int index; __be32 before; __be32 after; }; struct snd_firewire_event_tascam_control { unsigned int type; struct snd_firewire_tascam_change changes[0]; }; struct snd_firewire_event_motu_register_dsp_change { unsigned int type; __u32 count; /* The number of changes. */ __u32 changes[]; /* Encoded event for change of register DSP. */ }; /** * struct snd_firewire_event_ff400_message - the container for message from Fireface 400 when * operating hardware knob. * * @type: Fixed to SNDRV_FIREWIRE_EVENT_FF400_MESSAGE. * @message_count: The number of messages. * @messages.message: The messages expressing hardware knob operation. * @messages.tstamp: The isochronous cycle at which the request subaction of asynchronous * transaction was sent to deliver the message. It has 16 bit unsigned integer * value. The higher 3 bits of value expresses the lower three bits of second * field in the format of CYCLE_TIME, up to 7. The rest 13 bits expresses cycle * field up to 7999. * * The structure expresses message transmitted by Fireface 400 when operating hardware knob. */ struct snd_firewire_event_ff400_message { unsigned int type; unsigned int message_count; struct { __u32 message; __u32 tstamp; } messages[]; }; union snd_firewire_event { struct snd_firewire_event_common common; struct snd_firewire_event_lock_status lock_status; struct snd_firewire_event_dice_notification dice_notification; struct snd_firewire_event_efw_response efw_response; struct snd_firewire_event_digi00x_message digi00x_message; struct snd_firewire_event_tascam_control tascam_control; struct snd_firewire_event_motu_notification motu_notification; struct snd_firewire_event_motu_register_dsp_change motu_register_dsp_change; struct snd_firewire_event_ff400_message ff400_message; }; #define SNDRV_FIREWIRE_IOCTL_GET_INFO _IOR('H', 0xf8, struct snd_firewire_get_info) #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9) #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) #define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state) #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_METER _IOR('H', 0xfc, struct snd_firewire_motu_register_dsp_meter) #define SNDRV_FIREWIRE_IOCTL_MOTU_COMMAND_DSP_METER _IOR('H', 0xfd, struct snd_firewire_motu_command_dsp_meter) #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_PARAMETER _IOR('H', 0xfe, struct snd_firewire_motu_register_dsp_parameter) #define SNDRV_FIREWIRE_TYPE_DICE 1 #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 #define SNDRV_FIREWIRE_TYPE_BEBOB 3 #define SNDRV_FIREWIRE_TYPE_OXFW 4 #define SNDRV_FIREWIRE_TYPE_DIGI00X 5 #define SNDRV_FIREWIRE_TYPE_TASCAM 6 #define SNDRV_FIREWIRE_TYPE_MOTU 7 #define SNDRV_FIREWIRE_TYPE_FIREFACE 8 struct snd_firewire_get_info { unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */ unsigned int card; /* same as fw_cdev_get_info.card */ unsigned char guid[8]; char device_name[16]; /* device node in /dev */ }; /* * SNDRV_FIREWIRE_IOCTL_LOCK prevents the driver from streaming. * Returns -EBUSY if the driver is already streaming. */ #define SNDRV_FIREWIRE_TASCAM_STATE_COUNT 64 struct snd_firewire_tascam_state { __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT]; }; /* * In below MOTU models, software is allowed to control their DSP by accessing to registers. * - 828mk2 * - 896hd * - Traveler * - 8 pre * - Ultralite * - 4 pre * - Audio Express * * On the other hand, the status of DSP is split into specific messages included in the sequence of * isochronous packet. ALSA firewire-motu driver gathers the messages and allow userspace applications * to read it via ioctl. In 828mk2, 896hd, and Traveler, hardware meter for all of physical inputs * are put into the message, while one pair of physical outputs is selected. The selection is done by * LSB one byte in asynchronous write quadlet transaction to 0x'ffff'f000'0b2c. * * I note that V3HD/V4HD uses asynchronous transaction for the purpose. The destination address is * registered to 0x'ffff'f000'0b38 and '0b3c by asynchronous write quadlet request. The size of * message differs between 23 and 51 quadlets. For the case, the number of mixer bus can be extended * up to 12. */ #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT 24 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT 24 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT \ (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT + SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT) /** * struct snd_firewire_motu_register_dsp_meter - the container for meter information in DSP * controlled by register access * @data: Signal level meters. The mapping between position and input/output channel is * model-dependent. * * The structure expresses the part of DSP status for hardware meter. The u8 storage includes linear * value for audio signal level between 0x00 and 0x7f. */ struct snd_firewire_motu_register_dsp_meter { __u8 data[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT]; }; #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT 4 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT 20 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT 10 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT + 2) /** * snd_firewire_motu_register_dsp_parameter - the container for parameters of DSP controlled * by register access. * @mixer.source.gain: The gain of source to mixer. * @mixer.source.pan: The L/R balance of source to mixer. * @mixer.source.flag: The flag of source to mixer, including mute, solo. * @mixer.source.paired_balance: The L/R balance of paired source to mixer, only for 4 pre and * Audio Express. * @mixer.source.paired_width: The width of paired source to mixer, only for 4 pre and * Audio Express. * @mixer.output.paired_volume: The volume of paired output from mixer. * @mixer.output.paired_flag: The flag of paired output from mixer. * @output.main_paired_volume: The volume of paired main output. * @output.hp_paired_volume: The volume of paired hp output. * @output.hp_paired_assignment: The source assigned to paired hp output. * @output.reserved: Padding for 32 bit alignment for future extension. * @line_input.boost_flag: The flags of boost for line inputs, only for 828mk2 and Traveler. * @line_input.nominal_level_flag: The flags of nominal level for line inputs, only for 828mk2 and * Traveler. * @line_input.reserved: Padding for 32 bit alignment for future extension. * @input.gain_and_invert: The value including gain and invert for input, only for Ultralite, 4 pre * and Audio Express. * @input.flag: The flag of input; e.g. jack detection, phantom power, and pad, only for Ultralite, * 4 pre and Audio express. * @reserved: Padding so that the size of structure is kept to 512 byte, but for future extension. * * The structure expresses the set of parameters for DSP controlled by register access. */ struct snd_firewire_motu_register_dsp_parameter { struct { struct { __u8 gain[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 pan[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 paired_balance[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 paired_width[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; } source[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; struct { __u8 paired_volume[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; __u8 paired_flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; } output; } mixer; struct { __u8 main_paired_volume; __u8 hp_paired_volume; __u8 hp_paired_assignment; __u8 reserved[5]; } output; struct { __u8 boost_flag; __u8 nominal_level_flag; __u8 reserved[6]; } line_input; struct { __u8 gain_and_invert[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT]; __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT]; } input; __u8 reserved[64]; }; /* * In below MOTU models, software is allowed to control their DSP by command in frame of * asynchronous transaction to 0x'ffff'0001'0000: * * - 828 mk3 (FireWire only and Hybrid) * - 896 mk3 (FireWire only and Hybrid) * - Ultralite mk3 (FireWire only and Hybrid) * - Traveler mk3 * - Track 16 * * On the other hand, the states of hardware meter is split into specific messages included in the * sequence of isochronous packet. ALSA firewire-motu driver gathers the message and allow userspace * application to read it via ioctl. */ #define SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT 400 /** * struct snd_firewire_motu_command_dsp_meter - the container for meter information in DSP * controlled by command * @data: Signal level meters. The mapping between position and signal channel is model-dependent. * * The structure expresses the part of DSP status for hardware meter. The 32 bit storage is * estimated to include IEEE 764 32 bit single precision floating point (binary32) value. It is * expected to be linear value (not logarithm) for audio signal level between 0.0 and +1.0. */ struct snd_firewire_motu_command_dsp_meter { float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; }; #endif /* _SOUND_FIREWIRE_H_INCLUDED */ sound/hdsp.h 0000644 00000004034 15063602061 0007003 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_HDSP_H #define __SOUND_HDSP_H /* * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) */ #ifdef __linux__ #include <linux/types.h> #endif #define HDSP_MATRIX_MIXER_SIZE 2048 enum HDSP_IO_Type { Digiface, Multiface, H9652, H9632, RPM, Undefined, }; struct hdsp_peak_rms { __u32 input_peaks[26]; __u32 playback_peaks[26]; __u32 output_peaks[28]; __u64 input_rms[26]; __u64 playback_rms[26]; /* These are only used for H96xx cards */ __u64 output_rms[26]; }; #define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms) struct hdsp_config_info { unsigned char pref_sync_ref; unsigned char wordclock_sync_check; unsigned char spdif_sync_check; unsigned char adatsync_sync_check; unsigned char adat_sync_check[3]; unsigned char spdif_in; unsigned char spdif_out; unsigned char spdif_professional; unsigned char spdif_emphasis; unsigned char spdif_nonaudio; unsigned int spdif_sample_rate; unsigned int system_sample_rate; unsigned int autosync_sample_rate; unsigned char system_clock_mode; unsigned char clock_source; unsigned char autosync_ref; unsigned char line_out; unsigned char passthru; unsigned char da_gain; unsigned char ad_gain; unsigned char phone_gain; unsigned char xlr_breakout_cable; unsigned char analog_extension_board; }; #define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info) struct hdsp_firmware { void *firmware_data; /* 24413 x 4 bytes */ }; #define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware) struct hdsp_version { enum HDSP_IO_Type io_type; unsigned short firmware_rev; }; #define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version) struct hdsp_mixer { unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; }; #define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer) struct hdsp_9632_aeb { int aebi; int aebo; }; #define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb) #endif /* __SOUND_HDSP_H */ sound/hdspm.h 0000644 00000010606 15063602061 0007162 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_HDSPM_H #define __SOUND_HDSPM_H /* * Copyright (C) 2003 Winfried Ritsch (IEM) * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) */ #ifdef __linux__ #include <linux/types.h> #endif /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ #define HDSPM_MAX_CHANNELS 64 enum hdspm_io_type { MADI, MADIface, AIO, AES32, RayDAT }; enum hdspm_speed { ss, ds, qs }; /* -------------------- IOCTL Peak/RMS Meters -------------------- */ struct hdspm_peak_rms { __u32 input_peaks[64]; __u32 playback_peaks[64]; __u32 output_peaks[64]; __u64 input_rms[64]; __u64 playback_rms[64]; __u64 output_rms[64]; __u8 speed; /* enum {ss, ds, qs} */ int status2; }; #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ _IOR('H', 0x42, struct hdspm_peak_rms) /* ------------ CONFIG block IOCTL ---------------------- */ struct hdspm_config { unsigned char pref_sync_ref; unsigned char wordclock_sync_check; unsigned char madi_sync_check; unsigned int system_sample_rate; unsigned int autosync_sample_rate; unsigned char system_clock_mode; unsigned char clock_source; unsigned char autosync_ref; unsigned char line_out; unsigned int passthru; unsigned int analog_out; }; #define SNDRV_HDSPM_IOCTL_GET_CONFIG \ _IOR('H', 0x41, struct hdspm_config) /* * If there's a TCO (TimeCode Option) board installed, * there are further options and status data available. * The hdspm_ltc structure contains the current SMPTE * timecode and some status information and can be * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the * hdspm_status struct. */ enum hdspm_ltc_format { format_invalid, fps_24, fps_25, fps_2997, fps_30 }; enum hdspm_ltc_frame { frame_invalid, drop_frame, full_frame }; enum hdspm_ltc_input_format { ntsc, pal, no_video }; struct hdspm_ltc { unsigned int ltc; enum hdspm_ltc_format format; enum hdspm_ltc_frame frame; enum hdspm_ltc_input_format input_format; }; #define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) /* * The status data reflects the device's current state * as determined by the card's configuration and * connection status. */ enum hdspm_sync { hdspm_sync_no_lock = 0, hdspm_sync_lock = 1, hdspm_sync_sync = 2 }; enum hdspm_madi_input { hdspm_input_optical = 0, hdspm_input_coax = 1 }; enum hdspm_madi_channel_format { hdspm_format_ch_64 = 0, hdspm_format_ch_56 = 1 }; enum hdspm_madi_frame_format { hdspm_frame_48 = 0, hdspm_frame_96 = 1 }; enum hdspm_syncsource { syncsource_wc = 0, syncsource_madi = 1, syncsource_tco = 2, syncsource_sync = 3, syncsource_none = 4 }; struct hdspm_status { __u8 card_type; /* enum hdspm_io_type */ enum hdspm_syncsource autosync_source; __u64 card_clock; __u32 master_period; union { struct { __u8 sync_wc; /* enum hdspm_sync */ __u8 sync_madi; /* enum hdspm_sync */ __u8 sync_tco; /* enum hdspm_sync */ __u8 sync_in; /* enum hdspm_sync */ __u8 madi_input; /* enum hdspm_madi_input */ __u8 channel_format; /* enum hdspm_madi_channel_format */ __u8 frame_format; /* enum hdspm_madi_frame_format */ } madi; } card_specific; }; #define SNDRV_HDSPM_IOCTL_GET_STATUS \ _IOR('H', 0x47, struct hdspm_status) /* * Get information about the card and its add-ons. */ #define HDSPM_ADDON_TCO 1 struct hdspm_version { __u8 card_type; /* enum hdspm_io_type */ char cardname[20]; unsigned int serial; unsigned short firmware_rev; int addons; }; #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) /* ------------- get Matrix Mixer IOCTL --------------- */ /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = * 32768 Bytes */ /* organisation is 64 channelfader in a continuous memory block */ /* equivalent to hardware definition, maybe for future feature of mmap of * them */ /* each of 64 outputs has 64 infader and 64 outfader: Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS struct hdspm_channelfader { unsigned int in[HDSPM_MIXER_CHANNELS]; unsigned int pb[HDSPM_MIXER_CHANNELS]; }; struct hdspm_mixer { struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; }; struct hdspm_mixer_ioctl { struct hdspm_mixer *mixer; }; /* use indirect access due to the limit of ioctl bit size */ #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) #endif sound/sb16_csp.h 0000644 00000006753 15063602061 0007477 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si> * Takashi Iwai <tiwai@suse.de> * * SB16ASP/AWE32 CSP control */ #ifndef __SOUND_SB16_CSP_H #define __SOUND_SB16_CSP_H /* CSP modes */ #define SNDRV_SB_CSP_MODE_NONE 0x00 #define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ #define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ #define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ /* CSP load flags */ #define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 #define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 /* CSP sample width */ #define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 #define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 /* CSP channels */ #define SNDRV_SB_CSP_MONO 0x01 #define SNDRV_SB_CSP_STEREO 0x02 /* CSP rates */ #define SNDRV_SB_CSP_RATE_8000 0x01 #define SNDRV_SB_CSP_RATE_11025 0x02 #define SNDRV_SB_CSP_RATE_22050 0x04 #define SNDRV_SB_CSP_RATE_44100 0x08 #define SNDRV_SB_CSP_RATE_ALL 0x0f /* CSP running state */ #define SNDRV_SB_CSP_ST_IDLE 0x00 #define SNDRV_SB_CSP_ST_LOADED 0x01 #define SNDRV_SB_CSP_ST_RUNNING 0x02 #define SNDRV_SB_CSP_ST_PAUSED 0x04 #define SNDRV_SB_CSP_ST_AUTO 0x08 #define SNDRV_SB_CSP_ST_QSOUND 0x10 /* maximum QSound value (180 degrees right) */ #define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 /* maximum microcode RIFF file size */ #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 /* microcode header */ struct snd_sb_csp_mc_header { char codec_name[16]; /* id name of codec */ unsigned short func_req; /* requested function */ }; /* microcode to be loaded */ struct snd_sb_csp_microcode { struct snd_sb_csp_mc_header info; unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; }; /* start CSP with sample_width in mono/stereo */ struct snd_sb_csp_start { int sample_width; /* sample width, look above */ int channels; /* channels, look above */ }; /* CSP information */ struct snd_sb_csp_info { char codec_name[16]; /* id name of codec */ unsigned short func_nr; /* function number */ unsigned int acc_format; /* accepted PCM formats */ unsigned short acc_channels; /* accepted channels */ unsigned short acc_width; /* accepted sample width */ unsigned short acc_rates; /* accepted sample rates */ unsigned short csp_mode; /* CSP mode, see above */ unsigned short run_channels; /* current channels */ unsigned short run_width; /* current sample width */ unsigned short version; /* version id: 0x10 - 0x1f */ unsigned short state; /* state bits */ }; /* HWDEP controls */ /* get CSP information */ #define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) /* load microcode to CSP */ /* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits) * defined for some architectures like MIPS, and it leads to build errors. * (x86 and co have 14-bit size, thus it's valid, though.) * As a workaround for skipping the size-limit check, here we don't use the * normal _IOW() macro but _IOC() with the manual argument. */ #define SNDRV_SB_CSP_IOCTL_LOAD_CODE \ _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode)) /* unload microcode from CSP */ #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) /* start CSP */ #define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) /* stop CSP */ #define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) /* pause CSP and DMA transfer */ #define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) /* restart CSP and DMA transfer */ #define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) #endif /* __SOUND_SB16_CSP_H */ sound/sfnt_info.h 0000644 00000015142 15063602061 0010034 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __SOUND_SFNT_INFO_H #define __SOUND_SFNT_INFO_H /* * Patch record compatible with AWE driver on OSS * * Copyright (C) 1999-2000 Takashi Iwai */ #include <sound/asound.h> /* * patch information record */ #ifdef SNDRV_BIG_ENDIAN #define SNDRV_OSS_PATCHKEY(id) (0xfd00|id) #else #define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd) #endif /* patch interface header: 16 bytes */ struct soundfont_patch_info { unsigned short key; /* use the key below */ #define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) short device_no; /* synthesizer number */ unsigned short sf_id; /* file id (should be zero) */ short optarg; /* optional argument */ int len; /* data length (without this header) */ short type; /* patch operation type */ #define SNDRV_SFNT_LOAD_INFO 0 /* awe_voice_rec */ #define SNDRV_SFNT_LOAD_DATA 1 /* awe_sample_info */ #define SNDRV_SFNT_OPEN_PATCH 2 /* awe_open_parm */ #define SNDRV_SFNT_CLOSE_PATCH 3 /* none */ /* 4 is obsolete */ #define SNDRV_SFNT_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/ #define SNDRV_SFNT_MAP_PRESET 6 /* awe_voice_map */ /* 7 is not used */ #define SNDRV_SFNT_PROBE_DATA 8 /* optarg=sample */ #define SNDRV_SFNT_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */ short reserved; /* word alignment data */ /* the actual patch data begins after this */ }; /* * open patch */ #define SNDRV_SFNT_PATCH_NAME_LEN 32 struct soundfont_open_parm { unsigned short type; /* sample type */ #define SNDRV_SFNT_PAT_TYPE_MISC 0 #define SNDRV_SFNT_PAT_TYPE_GUS 6 #define SNDRV_SFNT_PAT_TYPE_MAP 7 #define SNDRV_SFNT_PAT_LOCKED 0x100 /* lock the samples */ #define SNDRV_SFNT_PAT_SHARED 0x200 /* sample is shared */ short reserved; char name[SNDRV_SFNT_PATCH_NAME_LEN]; }; /* * raw voice information record */ /* wave table envelope & effect parameters to control EMU8000 */ struct soundfont_voice_parm { unsigned short moddelay; /* modulation delay (0x8000) */ unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ unsigned short modrelease; /* modulation release time (0x807f) */ short modkeyhold, modkeydecay; /* envelope change per key (not used) */ unsigned short voldelay; /* volume delay (0x8000) */ unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */ unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */ unsigned short volrelease; /* volume release time (0x807f) */ short volkeyhold, volkeydecay; /* envelope change per key (not used) */ unsigned short lfo1delay; /* LFO1 delay (0x8000) */ unsigned short lfo2delay; /* LFO2 delay (0x8000) */ unsigned short pefe; /* modulation pitch & cutoff (0x0000) */ unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */ unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */ unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */ unsigned char cutoff; /* initial cutoff (0xff) */ unsigned char filterQ; /* initial filter Q [0-15] (0x0) */ unsigned char chorus; /* chorus send (0x00) */ unsigned char reverb; /* reverb send (0x00) */ unsigned short reserved[4]; /* not used */ }; /* wave table parameters: 92 bytes */ struct soundfont_voice_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* sample offset correction */ int loopstart, loopend; /* loop offset correction */ short rate_offset; /* sample rate pitch offset */ unsigned short mode; /* sample mode */ #define SNDRV_SFNT_MODE_ROMSOUND 0x8000 #define SNDRV_SFNT_MODE_STEREO 1 #define SNDRV_SFNT_MODE_LOOPING 2 #define SNDRV_SFNT_MODE_NORELEASE 4 /* obsolete */ #define SNDRV_SFNT_MODE_INIT_PARM 8 short root; /* midi root key */ short tune; /* pitch tuning (in cents) */ unsigned char low, high; /* key note range */ unsigned char vellow, velhigh; /* velocity range */ signed char fixkey, fixvel; /* fixed key, velocity */ signed char pan, fixpan; /* panning, fixed panning */ short exclusiveClass; /* exclusive class (0 = none) */ unsigned char amplitude; /* sample volume (127 max) */ unsigned char attenuation; /* attenuation (0.375dB) */ short scaleTuning; /* pitch scale tuning(%), normally 100 */ struct soundfont_voice_parm parm; /* voice envelope parameters */ unsigned short sample_mode; /* sample mode_flag (set by driver) */ }; /* instrument info header: 4 bytes */ struct soundfont_voice_rec_hdr { unsigned char bank; /* midi bank number */ unsigned char instr; /* midi preset number */ char nvoices; /* number of voices */ char write_mode; /* write mode; normally 0 */ #define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ #define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ #define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ }; /* * sample wave information */ /* wave table sample header: 32 bytes */ struct soundfont_sample_info { unsigned short sf_id; /* file id (should be zero) */ unsigned short sample; /* sample id */ int start, end; /* start & end offset */ int loopstart, loopend; /* loop start & end offset */ int size; /* size (0 = ROM) */ short dummy; /* not used */ unsigned short mode_flags; /* mode flags */ #define SNDRV_SFNT_SAMPLE_8BITS 1 /* wave data is 8bits */ #define SNDRV_SFNT_SAMPLE_UNSIGNED 2 /* wave data is unsigned */ #define SNDRV_SFNT_SAMPLE_NO_BLANK 4 /* no blank loop is attached */ #define SNDRV_SFNT_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */ #define SNDRV_SFNT_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */ #define SNDRV_SFNT_SAMPLE_STEREO_LEFT 32 /* stereo left sound */ #define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ #define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ unsigned int truesize; /* used memory size (set by driver) */ }; /* * voice preset mapping (aliasing) */ struct soundfont_voice_map { int map_bank, map_instr, map_key; /* key = -1 means all keys */ int src_bank, src_instr, src_key; }; /* * ioctls for hwdep */ #define SNDRV_EMUX_HWDEP_NAME "Emux WaveTable" #define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ struct snd_emux_misc_mode { int port; /* -1 = all */ int mode; int value; int value2; /* reserved */ }; #define SNDRV_EMUX_IOCTL_VERSION _IOR('H', 0x80, unsigned int) #define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info) #define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82) #define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83) #define SNDRV_EMUX_IOCTL_MEM_AVAIL _IOW('H', 0x84, int) #define SNDRV_EMUX_IOCTL_MISC_MODE _IOWR('H', 0x84, struct snd_emux_misc_mode) #endif /* __SOUND_SFNT_INFO_H */ sound/skl-tplg-interface.h 0000644 00000012320 15063602061 0011535 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * skl-tplg-interface.h - Intel DSP FW private data interface * * Copyright (C) 2015 Intel Corp * Author: Jeeja KP <jeeja.kp@intel.com> * Nilofer, Samreen <samreen.nilofer@intel.com> */ #ifndef __HDA_TPLG_INTERFACE_H__ #define __HDA_TPLG_INTERFACE_H__ #include <linux/types.h> /* * Default types range from 0~12. type can range from 0 to 0xff * SST types start at higher to avoid any overlapping in future */ #define SKL_CONTROL_TYPE_BYTE_TLV 0x100 #define SKL_CONTROL_TYPE_MIC_SELECT 0x102 #define SKL_CONTROL_TYPE_MULTI_IO_SELECT 0x103 #define SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC 0x104 #define HDA_SST_CFG_MAX 900 /* size of copier cfg*/ #define MAX_IN_QUEUE 8 #define MAX_OUT_QUEUE 8 #define SKL_UUID_STR_SZ 40 /* Event types goes here */ /* Reserve event type 0 for no event handlers */ enum skl_event_types { SKL_EVENT_NONE = 0, SKL_MIXER_EVENT, SKL_MUX_EVENT, SKL_VMIXER_EVENT, SKL_PGA_EVENT }; /** * enum skl_ch_cfg - channel configuration * * @SKL_CH_CFG_MONO: One channel only * @SKL_CH_CFG_STEREO: L & R * @SKL_CH_CFG_2_1: L, R & LFE * @SKL_CH_CFG_3_0: L, C & R * @SKL_CH_CFG_3_1: L, C, R & LFE * @SKL_CH_CFG_QUATRO: L, R, Ls & Rs * @SKL_CH_CFG_4_0: L, C, R & Cs * @SKL_CH_CFG_5_0: L, C, R, Ls & Rs * @SKL_CH_CFG_5_1: L, C, R, Ls, Rs & LFE * @SKL_CH_CFG_DUAL_MONO: One channel replicated in two * @SKL_CH_CFG_I2S_DUAL_STEREO_0: Stereo(L,R) in 4 slots, 1st stream:[ L, R, -, - ] * @SKL_CH_CFG_I2S_DUAL_STEREO_1: Stereo(L,R) in 4 slots, 2nd stream:[ -, -, L, R ] * @SKL_CH_CFG_INVALID: Invalid */ enum skl_ch_cfg { SKL_CH_CFG_MONO = 0, SKL_CH_CFG_STEREO = 1, SKL_CH_CFG_2_1 = 2, SKL_CH_CFG_3_0 = 3, SKL_CH_CFG_3_1 = 4, SKL_CH_CFG_QUATRO = 5, SKL_CH_CFG_4_0 = 6, SKL_CH_CFG_5_0 = 7, SKL_CH_CFG_5_1 = 8, SKL_CH_CFG_DUAL_MONO = 9, SKL_CH_CFG_I2S_DUAL_STEREO_0 = 10, SKL_CH_CFG_I2S_DUAL_STEREO_1 = 11, SKL_CH_CFG_7_1 = 12, SKL_CH_CFG_4_CHANNEL = SKL_CH_CFG_7_1, SKL_CH_CFG_INVALID }; enum skl_module_type { SKL_MODULE_TYPE_MIXER = 0, SKL_MODULE_TYPE_COPIER, SKL_MODULE_TYPE_UPDWMIX, SKL_MODULE_TYPE_SRCINT, SKL_MODULE_TYPE_ALGO, SKL_MODULE_TYPE_BASE_OUTFMT, SKL_MODULE_TYPE_KPB, SKL_MODULE_TYPE_MIC_SELECT, }; enum skl_core_affinity { SKL_AFFINITY_CORE_0 = 0, SKL_AFFINITY_CORE_1, SKL_AFFINITY_CORE_MAX }; enum skl_pipe_conn_type { SKL_PIPE_CONN_TYPE_NONE = 0, SKL_PIPE_CONN_TYPE_FE, SKL_PIPE_CONN_TYPE_BE }; enum skl_hw_conn_type { SKL_CONN_NONE = 0, SKL_CONN_SOURCE = 1, SKL_CONN_SINK = 2 }; enum skl_dev_type { SKL_DEVICE_BT = 0x0, SKL_DEVICE_DMIC = 0x1, SKL_DEVICE_I2S = 0x2, SKL_DEVICE_SLIMBUS = 0x3, SKL_DEVICE_HDALINK = 0x4, SKL_DEVICE_HDAHOST = 0x5, SKL_DEVICE_NONE }; /** * enum skl_interleaving - interleaving style * * @SKL_INTERLEAVING_PER_CHANNEL: [s1_ch1...s1_chN,...,sM_ch1...sM_chN] * @SKL_INTERLEAVING_PER_SAMPLE: [s1_ch1...sM_ch1,...,s1_chN...sM_chN] */ enum skl_interleaving { SKL_INTERLEAVING_PER_CHANNEL = 0, SKL_INTERLEAVING_PER_SAMPLE = 1, }; enum skl_sample_type { SKL_SAMPLE_TYPE_INT_MSB = 0, SKL_SAMPLE_TYPE_INT_LSB = 1, SKL_SAMPLE_TYPE_INT_SIGNED = 2, SKL_SAMPLE_TYPE_INT_UNSIGNED = 3, SKL_SAMPLE_TYPE_FLOAT = 4 }; enum module_pin_type { /* All pins of the module takes same PCM inputs or outputs * e.g. mixout */ SKL_PIN_TYPE_HOMOGENEOUS, /* All pins of the module takes different PCM inputs or outputs * e.g mux */ SKL_PIN_TYPE_HETEROGENEOUS, }; enum skl_module_param_type { SKL_PARAM_DEFAULT = 0, SKL_PARAM_INIT, SKL_PARAM_SET, SKL_PARAM_BIND }; struct skl_dfw_algo_data { __u32 set_params:2; __u32 rsvd:30; __u32 param_id; __u32 max; char params[0]; } __attribute__((packed)); enum skl_tkn_dir { SKL_DIR_IN, SKL_DIR_OUT }; enum skl_tuple_type { SKL_TYPE_TUPLE, SKL_TYPE_DATA }; /* v4 configuration data */ struct skl_dfw_v4_module_pin { __u16 module_id; __u16 instance_id; } __attribute__((packed)); struct skl_dfw_v4_module_fmt { __u32 channels; __u32 freq; __u32 bit_depth; __u32 valid_bit_depth; __u32 ch_cfg; __u32 interleaving_style; __u32 sample_type; __u32 ch_map; } __attribute__((packed)); struct skl_dfw_v4_module_caps { __u32 set_params:2; __u32 rsvd:30; __u32 param_id; __u32 caps_size; __u32 caps[HDA_SST_CFG_MAX]; } __attribute__((packed)); struct skl_dfw_v4_pipe { __u8 pipe_id; __u8 pipe_priority; __u16 conn_type:4; __u16 rsvd:4; __u16 memory_pages:8; } __attribute__((packed)); struct skl_dfw_v4_module { char uuid[SKL_UUID_STR_SZ]; __u16 module_id; __u16 instance_id; __u32 max_mcps; __u32 mem_pages; __u32 obs; __u32 ibs; __u32 vbus_id; __u32 max_in_queue:8; __u32 max_out_queue:8; __u32 time_slot:8; __u32 core_id:4; __u32 rsvd1:4; __u32 module_type:8; __u32 conn_type:4; __u32 dev_type:4; __u32 hw_conn_type:4; __u32 rsvd2:12; __u32 params_fixup:8; __u32 converter:8; __u32 input_pin_type:1; __u32 output_pin_type:1; __u32 is_dynamic_in_pin:1; __u32 is_dynamic_out_pin:1; __u32 is_loadable:1; __u32 rsvd3:11; struct skl_dfw_v4_pipe pipe; struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE]; struct skl_dfw_v4_module_fmt out_fmt[MAX_OUT_QUEUE]; struct skl_dfw_v4_module_pin in_pin[MAX_IN_QUEUE]; struct skl_dfw_v4_module_pin out_pin[MAX_OUT_QUEUE]; struct skl_dfw_v4_module_caps caps; } __attribute__((packed)); #endif sound/snd_sst_tokens.h 0000644 00000026752 15063602061 0011120 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * snd_sst_tokens.h - Intel SST tokens definition * * Copyright (C) 2016 Intel Corp * Author: Shreyas NC <shreyas.nc@intel.com> */ #ifndef __SND_SST_TOKENS_H__ #define __SND_SST_TOKENS_H__ /** * %SKL_TKN_UUID: Module UUID * * %SKL_TKN_U8_BLOCK_TYPE: Type of the private data block.Can be: * tuples, bytes, short and words * * %SKL_TKN_U8_IN_PIN_TYPE: Input pin type, * homogenous=0, heterogenous=1 * * %SKL_TKN_U8_OUT_PIN_TYPE: Output pin type, * homogenous=0, heterogenous=1 * %SKL_TKN_U8_DYN_IN_PIN: Configure Input pin dynamically * if true * * %SKL_TKN_U8_DYN_OUT_PIN: Configure Output pin dynamically * if true * * %SKL_TKN_U8_IN_QUEUE_COUNT: Store the number of Input pins * * %SKL_TKN_U8_OUT_QUEUE_COUNT: Store the number of Output pins * * %SKL_TKN_U8_TIME_SLOT: TDM slot number * * %SKL_TKN_U8_CORE_ID: Stores module affinity value.Can take * the values: * SKL_AFFINITY_CORE_0 = 0, * SKL_AFFINITY_CORE_1, * SKL_AFFINITY_CORE_MAX * * %SKL_TKN_U8_MOD_TYPE: Module type value. * * %SKL_TKN_U8_CONN_TYPE: Module connection type can be a FE, * BE or NONE as defined : * SKL_PIPE_CONN_TYPE_NONE = 0, * SKL_PIPE_CONN_TYPE_FE = 1 (HOST_DMA) * SKL_PIPE_CONN_TYPE_BE = 2 (LINK_DMA) * * %SKL_TKN_U8_DEV_TYPE: Type of device to which the module is * connected * Can take the values: * SKL_DEVICE_BT = 0x0, * SKL_DEVICE_DMIC = 0x1, * SKL_DEVICE_I2S = 0x2, * SKL_DEVICE_SLIMBUS = 0x3, * SKL_DEVICE_HDALINK = 0x4, * SKL_DEVICE_HDAHOST = 0x5, * SKL_DEVICE_NONE * * %SKL_TKN_U8_HW_CONN_TYPE: Connection type of the HW to which the * module is connected * SKL_CONN_NONE = 0, * SKL_CONN_SOURCE = 1, * SKL_CONN_SINK = 2 * * %SKL_TKN_U16_PIN_INST_ID: Stores the pin instance id * * %SKL_TKN_U16_MOD_INST_ID: Stores the mdule instance id * * %SKL_TKN_U32_MAX_MCPS: Module max mcps value * * %SKL_TKN_U32_MEM_PAGES: Module resource pages * * %SKL_TKN_U32_OBS: Stores Output Buffer size * * %SKL_TKN_U32_IBS: Stores input buffer size * * %SKL_TKN_U32_VBUS_ID: Module VBUS_ID. PDM=0, SSP0=0, * SSP1=1,SSP2=2, * SSP3=3, SSP4=4, * SSP5=5, SSP6=6,INVALID * * %SKL_TKN_U32_PARAMS_FIXUP: Module Params fixup mask * %SKL_TKN_U32_CONVERTER: Module params converter mask * %SKL_TKN_U32_PIPE_ID: Stores the pipe id * * %SKL_TKN_U32_PIPE_CONN_TYPE: Type of the token to which the pipe is * connected to. It can be * SKL_PIPE_CONN_TYPE_NONE = 0, * SKL_PIPE_CONN_TYPE_FE = 1 (HOST_DMA), * SKL_PIPE_CONN_TYPE_BE = 2 (LINK_DMA), * * %SKL_TKN_U32_PIPE_PRIORITY: Pipe priority value * %SKL_TKN_U32_PIPE_MEM_PGS: Pipe resource pages * * %SKL_TKN_U32_DIR_PIN_COUNT: Value for the direction to set input/output * formats and the pin count. * The first 4 bits have the direction * value and the next 4 have * the pin count value. * SKL_DIR_IN = 0, SKL_DIR_OUT = 1. * The input and output formats * share the same set of tokens * with the distinction between input * and output made by reading direction * token. * * %SKL_TKN_U32_FMT_CH: Supported channel count * * %SKL_TKN_U32_FMT_FREQ: Supported frequency/sample rate * * %SKL_TKN_U32_FMT_BIT_DEPTH: Supported container size * * %SKL_TKN_U32_FMT_SAMPLE_SIZE:Number of samples in the container * * %SKL_TKN_U32_FMT_CH_CONFIG: Supported channel configurations for the * input/output. * * %SKL_TKN_U32_FMT_INTERLEAVE: Interleaving style which can be per * channel or per sample. The values can be : * SKL_INTERLEAVING_PER_CHANNEL = 0, * SKL_INTERLEAVING_PER_SAMPLE = 1, * * %SKL_TKN_U32_FMT_SAMPLE_TYPE: * Specifies the sample type. Can take the * values: SKL_SAMPLE_TYPE_INT_MSB = 0, * SKL_SAMPLE_TYPE_INT_LSB = 1, * SKL_SAMPLE_TYPE_INT_SIGNED = 2, * SKL_SAMPLE_TYPE_INT_UNSIGNED = 3, * SKL_SAMPLE_TYPE_FLOAT = 4 * * %SKL_TKN_U32_CH_MAP: Channel map values * %SKL_TKN_U32_MOD_SET_PARAMS: It can take these values: * SKL_PARAM_DEFAULT, SKL_PARAM_INIT, * SKL_PARAM_SET, SKL_PARAM_BIND * * %SKL_TKN_U32_MOD_PARAM_ID: ID of the module params * * %SKL_TKN_U32_CAPS_SET_PARAMS: * Set params value * * %SKL_TKN_U32_CAPS_PARAMS_ID: Params ID * * %SKL_TKN_U32_CAPS_SIZE: Caps size * * %SKL_TKN_U32_PROC_DOMAIN: Specify processing domain * * %SKL_TKN_U32_LIB_COUNT: Specifies the number of libraries * * %SKL_TKN_STR_LIB_NAME: Specifies the library name * * %SKL_TKN_U32_PMODE: Specifies the power mode for pipe * * %SKL_TKL_U32_D0I3_CAPS: Specifies the D0i3 capability for module * * %SKL_TKN_U32_DMA_BUF_SIZE: DMA buffer size in millisec * * %SKL_TKN_U32_PIPE_DIR: Specifies pipe direction. Can be * playback/capture. * * %SKL_TKN_U32_NUM_CONFIGS: Number of pipe configs * * %SKL_TKN_U32_PATH_MEM_PGS: Size of memory (in pages) required for pipeline * and its data * * %SKL_TKN_U32_PIPE_CONFIG_ID: Config id for the modules in the pipe * and PCM params supported by that pipe * config. This is used as index to fill * up the pipe config and module config * structure. * * %SKL_TKN_U32_CFG_FREQ: * %SKL_TKN_U8_CFG_CHAN: * %SKL_TKN_U8_CFG_BPS: PCM params (freq, channels, bits per sample) * supported for each of the pipe configs. * * %SKL_TKN_CFG_MOD_RES_ID: Module's resource index for each of the * pipe config * * %SKL_TKN_CFG_MOD_FMT_ID: Module's interface index for each of the * pipe config * * %SKL_TKN_U8_NUM_MOD: Number of modules in the manifest * * %SKL_TKN_MM_U8_MOD_IDX: Current index of the module in the manifest * * %SKL_TKN_MM_U8_NUM_RES: Number of resources for the module * * %SKL_TKN_MM_U8_NUM_INTF: Number of interfaces for the module * * %SKL_TKN_MM_U32_RES_ID: Resource index for the resource info to * be filled into. * A module can support multiple resource * configuration and is represnted as a * resource table. This index is used to * fill information into appropriate index. * * %SKL_TKN_MM_U32_CPS: DSP cycles per second * * %SKL_TKN_MM_U32_DMA_SIZE: Allocated buffer size for gateway DMA * * %SKL_TKN_MM_U32_CPC: DSP cycles allocated per frame * * %SKL_TKN_MM_U32_RES_PIN_ID: Resource pin index in the module * * %SKL_TKN_MM_U32_INTF_PIN_ID: Interface index in the module * * %SKL_TKN_MM_U32_PIN_BUF: Buffer size of the module pin * * %SKL_TKN_MM_U32_FMT_ID: Format index for each of the interface/ * format information to be filled into. * * %SKL_TKN_MM_U32_NUM_IN_FMT: Number of input formats * %SKL_TKN_MM_U32_NUM_OUT_FMT: Number of output formats * * %SKL_TKN_U32_ASTATE_IDX: Table Index for the A-State entry to be filled * with kcps and clock source * * %SKL_TKN_U32_ASTATE_COUNT: Number of valid entries in A-State table * * %SKL_TKN_U32_ASTATE_KCPS: Specifies the core load threshold (in kilo * cycles per second) below which DSP is clocked * from source specified by clock source. * * %SKL_TKN_U32_ASTATE_CLK_SRC: Clock source for A-State entry * * %SKL_TKN_U32_FMT_CFG_IDX: Format config index * * module_id and loadable flags dont have tokens as these values will be * read from the DSP FW manifest * * Tokens defined can be used either in the manifest or widget private data. * * SKL_TKN_MM is used as a suffix for all tokens that represent * module data in the manifest. */ enum SKL_TKNS { SKL_TKN_UUID = 1, SKL_TKN_U8_NUM_BLOCKS, SKL_TKN_U8_BLOCK_TYPE, SKL_TKN_U8_IN_PIN_TYPE, SKL_TKN_U8_OUT_PIN_TYPE, SKL_TKN_U8_DYN_IN_PIN, SKL_TKN_U8_DYN_OUT_PIN, SKL_TKN_U8_IN_QUEUE_COUNT, SKL_TKN_U8_OUT_QUEUE_COUNT, SKL_TKN_U8_TIME_SLOT, SKL_TKN_U8_CORE_ID, SKL_TKN_U8_MOD_TYPE, SKL_TKN_U8_CONN_TYPE, SKL_TKN_U8_DEV_TYPE, SKL_TKN_U8_HW_CONN_TYPE, SKL_TKN_U16_MOD_INST_ID, SKL_TKN_U16_BLOCK_SIZE, SKL_TKN_U32_MAX_MCPS, SKL_TKN_U32_MEM_PAGES, SKL_TKN_U32_OBS, SKL_TKN_U32_IBS, SKL_TKN_U32_VBUS_ID, SKL_TKN_U32_PARAMS_FIXUP, SKL_TKN_U32_CONVERTER, SKL_TKN_U32_PIPE_ID, SKL_TKN_U32_PIPE_CONN_TYPE, SKL_TKN_U32_PIPE_PRIORITY, SKL_TKN_U32_PIPE_MEM_PGS, SKL_TKN_U32_DIR_PIN_COUNT, SKL_TKN_U32_FMT_CH, SKL_TKN_U32_FMT_FREQ, SKL_TKN_U32_FMT_BIT_DEPTH, SKL_TKN_U32_FMT_SAMPLE_SIZE, SKL_TKN_U32_FMT_CH_CONFIG, SKL_TKN_U32_FMT_INTERLEAVE, SKL_TKN_U32_FMT_SAMPLE_TYPE, SKL_TKN_U32_FMT_CH_MAP, SKL_TKN_U32_PIN_MOD_ID, SKL_TKN_U32_PIN_INST_ID, SKL_TKN_U32_MOD_SET_PARAMS, SKL_TKN_U32_MOD_PARAM_ID, SKL_TKN_U32_CAPS_SET_PARAMS, SKL_TKN_U32_CAPS_PARAMS_ID, SKL_TKN_U32_CAPS_SIZE, SKL_TKN_U32_PROC_DOMAIN, SKL_TKN_U32_LIB_COUNT, SKL_TKN_STR_LIB_NAME, SKL_TKN_U32_PMODE, SKL_TKL_U32_D0I3_CAPS, /* Typo added at v4.10 */ SKL_TKN_U32_D0I3_CAPS = SKL_TKL_U32_D0I3_CAPS, SKL_TKN_U32_DMA_BUF_SIZE, SKL_TKN_U32_PIPE_DIRECTION, SKL_TKN_U32_PIPE_CONFIG_ID, SKL_TKN_U32_NUM_CONFIGS, SKL_TKN_U32_PATH_MEM_PGS, SKL_TKN_U32_CFG_FREQ, SKL_TKN_U8_CFG_CHAN, SKL_TKN_U8_CFG_BPS, SKL_TKN_CFG_MOD_RES_ID, SKL_TKN_CFG_MOD_FMT_ID, SKL_TKN_U8_NUM_MOD, SKL_TKN_MM_U8_MOD_IDX, SKL_TKN_MM_U8_NUM_RES, SKL_TKN_MM_U8_NUM_INTF, SKL_TKN_MM_U32_RES_ID, SKL_TKN_MM_U32_CPS, SKL_TKN_MM_U32_DMA_SIZE, SKL_TKN_MM_U32_CPC, SKL_TKN_MM_U32_RES_PIN_ID, SKL_TKN_MM_U32_INTF_PIN_ID, SKL_TKN_MM_U32_PIN_BUF, SKL_TKN_MM_U32_FMT_ID, SKL_TKN_MM_U32_NUM_IN_FMT, SKL_TKN_MM_U32_NUM_OUT_FMT, SKL_TKN_U32_ASTATE_IDX, SKL_TKN_U32_ASTATE_COUNT, SKL_TKN_U32_ASTATE_KCPS, SKL_TKN_U32_ASTATE_CLK_SRC, SKL_TKN_U32_FMT_CFG_IDX = 96, SKL_TKN_MAX = SKL_TKN_U32_FMT_CFG_IDX, }; #endif sound/tlv.h 0000644 00000007755 15063602062 0006670 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __UAPI_SOUND_TLV_H #define __UAPI_SOUND_TLV_H #define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ #define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ #define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ #define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ /* * channel-mapping TLV items * TLV length must match with num_channels */ #define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ #define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ #define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ /* * TLV structure is right behind the struct snd_ctl_tlv: * unsigned int type - see SNDRV_CTL_TLVT_* * unsigned int length * .... data aligned to sizeof(unsigned int), use * block_length = (length + (sizeof(unsigned int) - 1)) & * ~(sizeof(unsigned int) - 1)) .... */ #define SNDRV_CTL_TLVD_ITEM(type, ...) \ (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__ #define SNDRV_CTL_TLVD_LENGTH(...) \ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) /* Accessor offsets for TLV data items */ #define SNDRV_CTL_TLVO_TYPE 0 #define SNDRV_CTL_TLVO_LEN 1 #define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) #define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \ } #define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff #define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000 #define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \ (min), \ ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \ ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0)) #define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ } /* Accessor offsets for min, mute and step items in dB scale type TLV */ #define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 #define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 /* dB scale specified with min/max values instead of step */ #define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB)) #define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB)) #define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ } #define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ } /* Accessor offsets for min, max items in db-minmax types of TLV. */ #define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2 #define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3 /* linear volume between min_dB and max_dB (.01dB unit) */ #define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB)) #define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ } /* Accessor offsets for min, max items in db-linear type of TLV. */ #define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2 #define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3 /* dB range container: * Items in dB range container must be ordered by their values and by their * dB values. This implies that larger values must correspond with larger * dB values (which is also required for all other mixer controls). */ /* Each item is: <min> <max> <TLV> */ #define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) #define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \ } #define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999 #endif sound/usb_stream.h 0000644 00000002327 15063602062 0010215 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de> */ #ifndef __SOUND_USB_STREAM_H #define __SOUND_USB_STREAM_H #define USB_STREAM_INTERFACE_VERSION 2 #define SNDRV_USB_STREAM_IOCTL_SET_PARAMS \ _IOW('H', 0x90, struct usb_stream_config) struct usb_stream_packet { unsigned offset; unsigned length; }; struct usb_stream_config { unsigned version; unsigned sample_rate; unsigned period_frames; unsigned frame_size; }; struct usb_stream { struct usb_stream_config cfg; unsigned read_size; unsigned write_size; int period_size; unsigned state; int idle_insize; int idle_outsize; int sync_packet; unsigned insize_done; unsigned periods_done; unsigned periods_polled; struct usb_stream_packet outpacket[2]; unsigned inpackets; unsigned inpacket_head; unsigned inpacket_split; unsigned inpacket_split_at; unsigned next_inpacket_split; unsigned next_inpacket_split_at; struct usb_stream_packet inpacket[0]; }; enum usb_stream_state { usb_stream_invalid, usb_stream_stopped, usb_stream_sync0, usb_stream_sync1, usb_stream_ready, usb_stream_running, usb_stream_xrun, }; #endif /* __SOUND_USB_STREAM_H */ video/edid.h 0000644 00000000325 15063602062 0006730 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __linux_video_edid_h__ #define __linux_video_edid_h__ struct edid_info { unsigned char dummy[128]; }; #endif /* __linux_video_edid_h__ */ video/sisfb.h 0000644 00000016733 15063602062 0007143 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * sisfb.h - definitions for the SiS framebuffer driver * * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the named License, * or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA */ #ifndef _LINUX_SISFB_H_ #define _LINUX_SISFB_H_ #include <linux/types.h> #include <asm/ioctl.h> /**********************************************/ /* PUBLIC */ /**********************************************/ /* vbflags, public (others in sis.h) */ #define CRT2_DEFAULT 0x00000001 #define CRT2_LCD 0x00000002 #define CRT2_TV 0x00000004 #define CRT2_VGA 0x00000008 #define TV_NTSC 0x00000010 #define TV_PAL 0x00000020 #define TV_HIVISION 0x00000040 #define TV_YPBPR 0x00000080 #define TV_AVIDEO 0x00000100 #define TV_SVIDEO 0x00000200 #define TV_SCART 0x00000400 #define TV_PALM 0x00001000 #define TV_PALN 0x00002000 #define TV_NTSCJ 0x00001000 #define TV_CHSCART 0x00008000 #define TV_CHYPBPR525I 0x00010000 #define CRT1_VGA 0x00000000 #define CRT1_LCDA 0x00020000 #define VGA2_CONNECTED 0x00040000 #define VB_DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ #define VB_SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ #define VB_MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ #define VB_DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ /* Aliases: */ #define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) #define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) #define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I) /* Only if TV_YPBPR is set: */ #define TV_YPBPR525I TV_NTSC #define TV_YPBPR525P TV_PAL #define TV_YPBPR750P TV_PALM #define TV_YPBPR1080I TV_PALN #define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) #define VB_DISPTYPE_DISP2 CRT2_ENABLE #define VB_DISPTYPE_CRT2 CRT2_ENABLE #define VB_DISPTYPE_DISP1 VB_DISPTYPE_CRT1 #define VB_DISPMODE_SINGLE VB_SINGLE_MODE #define VB_DISPMODE_MIRROR VB_MIRROR_MODE #define VB_DISPMODE_DUAL VB_DUALVIEW_MODE #define VB_DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) /* Structure argument for SISFB_GET_INFO ioctl */ struct sisfb_info { __u32 sisfb_id; /* for identifying sisfb */ #ifndef SISFB_ID #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ #endif __u32 chip_id; /* PCI-ID of detected chip */ __u32 memory; /* total video memory in KB */ __u32 heapstart; /* heap start offset in KB */ __u8 fbvidmode; /* current sisfb mode */ __u8 sisfb_version; __u8 sisfb_revision; __u8 sisfb_patchlevel; __u8 sisfb_caps; /* sisfb capabilities */ __u32 sisfb_tqlen; /* turbo queue length (in KB) */ __u32 sisfb_pcibus; /* The card's PCI ID */ __u32 sisfb_pcislot; __u32 sisfb_pcifunc; __u8 sisfb_lcdpdc; /* PanelDelayCompensation */ __u8 sisfb_lcda; /* Detected status of LCDA for low res/text modes */ __u32 sisfb_vbflags; __u32 sisfb_currentvbflags; __u32 sisfb_scalelcd; __u32 sisfb_specialtiming; __u8 sisfb_haveemi; __u8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; __u8 sisfb_haveemilcd; __u8 sisfb_lcdpdca; /* PanelDelayCompensation for LCD-via-CRT1 */ __u16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */ __u32 sisfb_heapsize; /* heap size (in KB) */ __u32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */ __u32 sisfb_curfstn; /* currently running FSTN/DSTN mode */ __u32 sisfb_curdstn; __u16 sisfb_pci_vendor; /* PCI vendor (SiS or XGI) */ __u32 sisfb_vbflags2; /* ivideo->vbflags2 */ __u8 sisfb_can_post; /* sisfb can POST this card */ __u8 sisfb_card_posted; /* card is POSTED */ __u8 sisfb_was_boot_device; /* This card was the boot video device (ie is primary) */ __u8 reserved[183]; /* for future use */ }; #define SISFB_CMD_GETVBFLAGS 0x55AA0001 /* no arg; result[1] = vbflags */ #define SISFB_CMD_SWITCHCRT1 0x55AA0010 /* arg[0]: 99 = query, 0 = off, 1 = on */ /* more to come */ #define SISFB_CMD_ERR_OK 0x80000000 /* command succeeded */ #define SISFB_CMD_ERR_LOCKED 0x80000001 /* sisfb is locked */ #define SISFB_CMD_ERR_EARLY 0x80000002 /* request before sisfb took over gfx system */ #define SISFB_CMD_ERR_NOVB 0x80000003 /* No video bridge */ #define SISFB_CMD_ERR_NOCRT2 0x80000004 /* can't change CRT1 status, CRT2 disabled */ /* more to come */ #define SISFB_CMD_ERR_UNKNOWN 0x8000ffff /* Unknown command */ #define SISFB_CMD_ERR_OTHER 0x80010000 /* Other error */ /* Argument for SISFB_CMD ioctl */ struct sisfb_cmd { __u32 sisfb_cmd; __u32 sisfb_arg[16]; __u32 sisfb_result[4]; }; /* Additional IOCTLs for communication sisfb <> X driver */ /* If changing this, vgatypes.h must also be changed (for X driver) */ /* ioctl for identifying and giving some info (esp. memory heap start) */ #define SISFB_GET_INFO_SIZE _IOR(0xF3,0x00,__u32) #define SISFB_GET_INFO _IOR(0xF3,0x01,struct sisfb_info) /* ioctrl to get current vertical retrace status */ #define SISFB_GET_VBRSTATUS _IOR(0xF3,0x02,__u32) /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ #define SISFB_GET_AUTOMAXIMIZE _IOR(0xF3,0x03,__u32) #define SISFB_SET_AUTOMAXIMIZE _IOW(0xF3,0x03,__u32) /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/ #define SISFB_GET_TVPOSOFFSET _IOR(0xF3,0x04,__u32) #define SISFB_SET_TVPOSOFFSET _IOW(0xF3,0x04,__u32) /* ioctl for internal sisfb commands (sisfbctrl) */ #define SISFB_COMMAND _IOWR(0xF3,0x05,struct sisfb_cmd) /* ioctl for locking sisfb (no register access during lock) */ /* As of now, only used to avoid register access during * the ioctls listed above. */ #define SISFB_SET_LOCK _IOW(0xF3,0x06,__u32) /* ioctls 0xF3 up to 0x3F reserved for sisfb */ /****************************************************************/ /* The following are deprecated and should not be used anymore: */ /****************************************************************/ /* ioctl for identifying and giving some info (esp. memory heap start) */ #define SISFB_GET_INFO_OLD _IOR('n',0xF8,__u32) /* ioctrl to get current vertical retrace status */ #define SISFB_GET_VBRSTATUS_OLD _IOR('n',0xF9,__u32) /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */ #define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,__u32) #define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,__u32) /****************************************************************/ /* End of deprecated ioctl numbers */ /****************************************************************/ /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */ struct sis_memreq { __u32 offset; __u32 size; }; /**********************************************/ /* PRIVATE */ /* (for IN-KERNEL usage only) */ /**********************************************/ #endif /* _LINUX_SISFB_H_ */ video/uvesafb.h 0000644 00000002066 15063602062 0007462 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UVESAFB_H #define _UVESAFB_H #include <linux/types.h> struct v86_regs { __u32 ebx; __u32 ecx; __u32 edx; __u32 esi; __u32 edi; __u32 ebp; __u32 eax; __u32 eip; __u32 eflags; __u32 esp; __u16 cs; __u16 ss; __u16 es; __u16 ds; __u16 fs; __u16 gs; }; /* Task flags */ #define TF_VBEIB 0x01 #define TF_BUF_ESDI 0x02 #define TF_BUF_ESBX 0x04 #define TF_BUF_RET 0x08 #define TF_EXIT 0x10 struct uvesafb_task { __u8 flags; int buf_len; struct v86_regs regs; }; /* Constants for the capabilities field * in vbe_ib */ #define VBE_CAP_CAN_SWITCH_DAC 0x01 #define VBE_CAP_VGACOMPAT 0x02 /* The VBE Info Block */ struct vbe_ib { char vbe_signature[4]; __u16 vbe_version; __u32 oem_string_ptr; __u32 capabilities; __u32 mode_list_ptr; __u16 total_memory; __u16 oem_software_rev; __u32 oem_vendor_name_ptr; __u32 oem_product_name_ptr; __u32 oem_product_rev_ptr; __u8 reserved[222]; char oem_data[256]; char misc_data[512]; } __attribute__ ((packed)); #endif /* _UVESAFB_H */ xen/evtchn.h 0000644 00000006741 15063602062 0007006 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ /****************************************************************************** * evtchn.h * * Interface to /dev/xen/evtchn. * * Copyright (c) 2003-2005, K A Fraser * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef __LINUX_PUBLIC_EVTCHN_H__ #define __LINUX_PUBLIC_EVTCHN_H__ /* * Bind a fresh port to VIRQ @virq. * Return allocated port. */ #define IOCTL_EVTCHN_BIND_VIRQ \ _IOC(_IOC_NONE, 'E', 0, sizeof(struct ioctl_evtchn_bind_virq)) struct ioctl_evtchn_bind_virq { unsigned int virq; }; /* * Bind a fresh port to remote <@remote_domain, @remote_port>. * Return allocated port. */ #define IOCTL_EVTCHN_BIND_INTERDOMAIN \ _IOC(_IOC_NONE, 'E', 1, sizeof(struct ioctl_evtchn_bind_interdomain)) struct ioctl_evtchn_bind_interdomain { unsigned int remote_domain, remote_port; }; /* * Allocate a fresh port for binding to @remote_domain. * Return allocated port. */ #define IOCTL_EVTCHN_BIND_UNBOUND_PORT \ _IOC(_IOC_NONE, 'E', 2, sizeof(struct ioctl_evtchn_bind_unbound_port)) struct ioctl_evtchn_bind_unbound_port { unsigned int remote_domain; }; /* * Unbind previously allocated @port. */ #define IOCTL_EVTCHN_UNBIND \ _IOC(_IOC_NONE, 'E', 3, sizeof(struct ioctl_evtchn_unbind)) struct ioctl_evtchn_unbind { unsigned int port; }; /* * Unbind previously allocated @port. */ #define IOCTL_EVTCHN_NOTIFY \ _IOC(_IOC_NONE, 'E', 4, sizeof(struct ioctl_evtchn_notify)) struct ioctl_evtchn_notify { unsigned int port; }; /* Clear and reinitialise the event buffer. Clear error condition. */ #define IOCTL_EVTCHN_RESET \ _IOC(_IOC_NONE, 'E', 5, 0) /* * Restrict this file descriptor so that it can only be used to bind * new interdomain events from one domain. * * Once a file descriptor has been restricted it cannot be * de-restricted, and must be closed and re-opened. Event channels * which were bound before restricting remain bound afterwards, and * can be notified as usual. */ #define IOCTL_EVTCHN_RESTRICT_DOMID \ _IOC(_IOC_NONE, 'E', 6, sizeof(struct ioctl_evtchn_restrict_domid)) struct ioctl_evtchn_restrict_domid { domid_t domid; }; #endif /* __LINUX_PUBLIC_EVTCHN_H__ */ xen/gntalloc.h 0000644 00000005073 15063602062 0007317 0 ustar 00 /****************************************************************************** * gntalloc.h * * Interface to /dev/xen/gntalloc. * * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov> * * This file is in the public domain. */ #ifndef __LINUX_PUBLIC_GNTALLOC_H__ #define __LINUX_PUBLIC_GNTALLOC_H__ #include <linux/types.h> /* * Allocates a new page and creates a new grant reference. */ #define IOCTL_GNTALLOC_ALLOC_GREF \ _IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref)) struct ioctl_gntalloc_alloc_gref { /* IN parameters */ /* The ID of the domain to be given access to the grants. */ __u16 domid; /* Flags for this mapping */ __u16 flags; /* Number of pages to map */ __u32 count; /* OUT parameters */ /* The offset to be used on a subsequent call to mmap(). */ __u64 index; /* The grant references of the newly created grant, one per page */ /* Variable size, depending on count */ __u32 gref_ids[1]; }; #define GNTALLOC_FLAG_WRITABLE 1 /* * Deallocates the grant reference, allowing the associated page to be freed if * no other domains are using it. */ #define IOCTL_GNTALLOC_DEALLOC_GREF \ _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref)) struct ioctl_gntalloc_dealloc_gref { /* IN parameters */ /* The offset returned in the map operation */ __u64 index; /* Number of references to unmap */ __u32 count; }; /* * Sets up an unmap notification within the page, so that the other side can do * cleanup if this side crashes. Required to implement cross-domain robust * mutexes or close notification on communication channels. * * Each mapped page only supports one notification; multiple calls referring to * the same page overwrite the previous notification. You must clear the * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it * to occur. */ #define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \ _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify)) struct ioctl_gntalloc_unmap_notify { /* IN parameters */ /* Offset in the file descriptor for a byte within the page (same as * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to * be cleared. Otherwise, it can be any byte in the page whose * notification we are adjusting. */ __u64 index; /* Action(s) to take on unmap */ __u32 action; /* Event channel to notify */ __u32 event_channel_port; }; /* Clear (set to zero) the byte specified by index */ #define UNMAP_NOTIFY_CLEAR_BYTE 0x1 /* Send an interrupt on the indicated event channel */ #define UNMAP_NOTIFY_SEND_EVENT 0x2 #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */ xen/gntdev.h 0000644 00000016232 15063602062 0007002 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ /****************************************************************************** * gntdev.h * * Interface to /dev/xen/gntdev. * * Copyright (c) 2007, D G Murray * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef __LINUX_PUBLIC_GNTDEV_H__ #define __LINUX_PUBLIC_GNTDEV_H__ #include <linux/types.h> struct ioctl_gntdev_grant_ref { /* The domain ID of the grant to be mapped. */ __u32 domid; /* The grant reference of the grant to be mapped. */ __u32 ref; }; /* * Inserts the grant references into the mapping table of an instance * of gntdev. N.B. This does not perform the mapping, which is deferred * until mmap() is called with @index as the offset. */ #define IOCTL_GNTDEV_MAP_GRANT_REF \ _IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref)) struct ioctl_gntdev_map_grant_ref { /* IN parameters */ /* The number of grants to be mapped. */ __u32 count; __u32 pad; /* OUT parameters */ /* The offset to be used on a subsequent call to mmap(). */ __u64 index; /* Variable IN parameter. */ /* Array of grant references, of size @count. */ struct ioctl_gntdev_grant_ref refs[1]; }; /* * Removes the grant references from the mapping table of an instance of * of gntdev. N.B. munmap() must be called on the relevant virtual address(es) * before this ioctl is called, or an error will result. */ #define IOCTL_GNTDEV_UNMAP_GRANT_REF \ _IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref)) struct ioctl_gntdev_unmap_grant_ref { /* IN parameters */ /* The offset was returned by the corresponding map operation. */ __u64 index; /* The number of pages to be unmapped. */ __u32 count; __u32 pad; }; /* * Returns the offset in the driver's address space that corresponds * to @vaddr. This can be used to perform a munmap(), followed by an * UNMAP_GRANT_REF ioctl, where no state about the offset is retained by * the caller. The number of pages that were allocated at the same time as * @vaddr is returned in @count. * * N.B. Where more than one page has been mapped into a contiguous range, the * supplied @vaddr must correspond to the start of the range; otherwise * an error will result. It is only possible to munmap() the entire * contiguously-allocated range at once, and not any subrange thereof. */ #define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \ _IOC(_IOC_NONE, 'G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr)) struct ioctl_gntdev_get_offset_for_vaddr { /* IN parameters */ /* The virtual address of the first mapped page in a range. */ __u64 vaddr; /* OUT parameters */ /* The offset that was used in the initial mmap() operation. */ __u64 offset; /* The number of pages mapped in the VM area that begins at @vaddr. */ __u32 count; __u32 pad; }; /* * Sets the maximum number of grants that may mapped at once by this gntdev * instance. * * N.B. This must be called before any other ioctl is performed on the device. */ #define IOCTL_GNTDEV_SET_MAX_GRANTS \ _IOC(_IOC_NONE, 'G', 3, sizeof(struct ioctl_gntdev_set_max_grants)) struct ioctl_gntdev_set_max_grants { /* IN parameter */ /* The maximum number of grants that may be mapped at once. */ __u32 count; }; /* * Sets up an unmap notification within the page, so that the other side can do * cleanup if this side crashes. Required to implement cross-domain robust * mutexes or close notification on communication channels. * * Each mapped page only supports one notification; multiple calls referring to * the same page overwrite the previous notification. You must clear the * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it * to occur. */ #define IOCTL_GNTDEV_SET_UNMAP_NOTIFY \ _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntdev_unmap_notify)) struct ioctl_gntdev_unmap_notify { /* IN parameters */ /* Offset in the file descriptor for a byte within the page (same as * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to * be cleared. Otherwise, it can be any byte in the page whose * notification we are adjusting. */ __u64 index; /* Action(s) to take on unmap */ __u32 action; /* Event channel to notify */ __u32 event_channel_port; }; struct gntdev_grant_copy_segment { union { void *virt; struct { grant_ref_t ref; __u16 offset; domid_t domid; } foreign; } source, dest; __u16 len; __u16 flags; /* GNTCOPY_* */ __s16 status; /* GNTST_* */ }; /* * Copy between grant references and local buffers. * * The copy is split into @count @segments, each of which can copy * to/from one grant reference. * * Each segment is similar to struct gnttab_copy in the hypervisor ABI * except the local buffer is specified using a virtual address * (instead of a GFN and offset). * * The local buffer may cross a Xen page boundary -- the driver will * split segments into multiple ops if required. * * Returns 0 if all segments have been processed and @status in each * segment is valid. Note that one or more segments may have failed * (status != GNTST_okay). * * If the driver had to split a segment into two or more ops, @status * includes the status of the first failed op for that segment (or * GNTST_okay if all ops were successful). * * If -1 is returned, the status of all segments is undefined. * * EINVAL: A segment has local buffers for both source and * destination. * EINVAL: A segment crosses the boundary of a foreign page. * EFAULT: A segment's local buffer is not accessible. */ #define IOCTL_GNTDEV_GRANT_COPY \ _IOC(_IOC_NONE, 'G', 8, sizeof(struct ioctl_gntdev_grant_copy)) struct ioctl_gntdev_grant_copy { unsigned int count; struct gntdev_grant_copy_segment *segments; }; /* Clear (set to zero) the byte specified by index */ #define UNMAP_NOTIFY_CLEAR_BYTE 0x1 /* Send an interrupt on the indicated event channel */ #define UNMAP_NOTIFY_SEND_EVENT 0x2 #endif /* __LINUX_PUBLIC_GNTDEV_H__ */ xen/privcmd.h 0000644 00000010156 15063602062 0007156 0 ustar 00 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ /****************************************************************************** * privcmd.h * * Interface to /proc/xen/privcmd. * * Copyright (c) 2003-2005, K A Fraser * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef __LINUX_PUBLIC_PRIVCMD_H__ #define __LINUX_PUBLIC_PRIVCMD_H__ #include <linux/types.h> #include <xen/interface/xen.h> struct privcmd_hypercall { __u64 op; __u64 arg[5]; }; struct privcmd_mmap_entry { __u64 va; /* * This should be a GFN. It's not possible to change the name because * it's exposed to the user-space. */ __u64 mfn; __u64 npages; }; struct privcmd_mmap { int num; domid_t dom; /* target domain */ struct privcmd_mmap_entry *entry; }; struct privcmd_mmapbatch { int num; /* number of pages to populate */ domid_t dom; /* target domain */ __u64 addr; /* virtual address */ xen_pfn_t *arr; /* array of mfns - or'd with PRIVCMD_MMAPBATCH_*_ERROR on err */ }; #define PRIVCMD_MMAPBATCH_MFN_ERROR 0xf0000000U #define PRIVCMD_MMAPBATCH_PAGED_ERROR 0x80000000U struct privcmd_mmapbatch_v2 { unsigned int num; /* number of pages to populate */ domid_t dom; /* target domain */ __u64 addr; /* virtual address */ const xen_pfn_t *arr; /* array of mfns */ int *err; /* array of error codes */ }; struct privcmd_dm_op_buf { void *uptr; size_t size; }; struct privcmd_dm_op { domid_t dom; __u16 num; const struct privcmd_dm_op_buf *ubufs; }; struct privcmd_mmap_resource { domid_t dom; __u32 type; __u32 id; __u32 idx; __u64 num; __u64 addr; }; /* * @cmd: IOCTL_PRIVCMD_HYPERCALL * @arg: &privcmd_hypercall_t * Return: Value returned from execution of the specified hypercall. * * @cmd: IOCTL_PRIVCMD_MMAPBATCH_V2 * @arg: &struct privcmd_mmapbatch_v2 * Return: 0 on success (i.e., arg->err contains valid error codes for * each frame). On an error other than a failed frame remap, -1 is * returned and errno is set to EINVAL, EFAULT etc. As an exception, * if the operation was otherwise successful but any frame failed with * -ENOENT, then -1 is returned and errno is set to ENOENT. */ #define IOCTL_PRIVCMD_HYPERCALL \ _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall)) #define IOCTL_PRIVCMD_MMAP \ _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap)) #define IOCTL_PRIVCMD_MMAPBATCH \ _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch)) #define IOCTL_PRIVCMD_MMAPBATCH_V2 \ _IOC(_IOC_NONE, 'P', 4, sizeof(struct privcmd_mmapbatch_v2)) #define IOCTL_PRIVCMD_DM_OP \ _IOC(_IOC_NONE, 'P', 5, sizeof(struct privcmd_dm_op)) #define IOCTL_PRIVCMD_RESTRICT \ _IOC(_IOC_NONE, 'P', 6, sizeof(domid_t)) #define IOCTL_PRIVCMD_MMAP_RESOURCE \ _IOC(_IOC_NONE, 'P', 7, sizeof(struct privcmd_mmap_resource)) #endif /* __LINUX_PUBLIC_PRIVCMD_H__ */ cpuidle.h 0000644 00000001514 15063602062 0006343 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __CPUPOWER_CPUIDLE_H__ #define __CPUPOWER_CPUIDLE_H__ int cpuidle_is_state_disabled(unsigned int cpu, unsigned int idlestate); int cpuidle_state_disable(unsigned int cpu, unsigned int idlestate, unsigned int disable); unsigned long cpuidle_state_latency(unsigned int cpu, unsigned int idlestate); unsigned long cpuidle_state_usage(unsigned int cpu, unsigned int idlestate); unsigned long long cpuidle_state_time(unsigned int cpu, unsigned int idlestate); char *cpuidle_state_name(unsigned int cpu, unsigned int idlestate); char *cpuidle_state_desc(unsigned int cpu, unsigned int idlestate); unsigned int cpuidle_state_count(unsigned int cpu); char *cpuidle_get_governor(void); char *cpuidle_get_driver(void); #endif /* __CPUPOWER_HELPERS_SYSFS_H__ */ aio.h 0000644 00000016440 15063602062 0005472 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO/IEC 9945-1:1996 6.7: Asynchronous Input and Output */ #ifndef _AIO_H #define _AIO_H 1 #include <features.h> #include <sys/types.h> #include <bits/types/sigevent_t.h> #include <bits/sigevent-consts.h> #include <bits/types/struct_timespec.h> __BEGIN_DECLS /* Asynchronous I/O control block. */ struct aiocb { int aio_fildes; /* File desriptor. */ int aio_lio_opcode; /* Operation to be performed. */ int aio_reqprio; /* Request priority offset. */ volatile void *aio_buf; /* Location of buffer. */ size_t aio_nbytes; /* Length of transfer. */ struct sigevent aio_sigevent; /* Signal number and value. */ /* Internal members. */ struct aiocb *__next_prio; int __abs_prio; int __policy; int __error_code; __ssize_t __return_value; #ifndef __USE_FILE_OFFSET64 __off_t aio_offset; /* File offset. */ char __pad[sizeof (__off64_t) - sizeof (__off_t)]; #else __off64_t aio_offset; /* File offset. */ #endif char __glibc_reserved[32]; }; /* The same for the 64bit offsets. Please note that the members aio_fildes to __return_value have to be the same in aiocb and aiocb64. */ #ifdef __USE_LARGEFILE64 struct aiocb64 { int aio_fildes; /* File desriptor. */ int aio_lio_opcode; /* Operation to be performed. */ int aio_reqprio; /* Request priority offset. */ volatile void *aio_buf; /* Location of buffer. */ size_t aio_nbytes; /* Length of transfer. */ struct sigevent aio_sigevent; /* Signal number and value. */ /* Internal members. */ struct aiocb *__next_prio; int __abs_prio; int __policy; int __error_code; __ssize_t __return_value; __off64_t aio_offset; /* File offset. */ char __glibc_reserved[32]; }; #endif #ifdef __USE_GNU /* To customize the implementation one can use the following struct. This implementation follows the one in Irix. */ struct aioinit { int aio_threads; /* Maximal number of threads. */ int aio_num; /* Number of expected simultanious requests. */ int aio_locks; /* Not used. */ int aio_usedba; /* Not used. */ int aio_debug; /* Not used. */ int aio_numusers; /* Not used. */ int aio_idle_time; /* Number of seconds before idle thread terminates. */ int aio_reserved; }; #endif /* Return values of cancelation function. */ enum { AIO_CANCELED, #define AIO_CANCELED AIO_CANCELED AIO_NOTCANCELED, #define AIO_NOTCANCELED AIO_NOTCANCELED AIO_ALLDONE #define AIO_ALLDONE AIO_ALLDONE }; /* Operation codes for `aio_lio_opcode'. */ enum { LIO_READ, #define LIO_READ LIO_READ LIO_WRITE, #define LIO_WRITE LIO_WRITE LIO_NOP #define LIO_NOP LIO_NOP }; /* Synchronization options for `lio_listio' function. */ enum { LIO_WAIT, #define LIO_WAIT LIO_WAIT LIO_NOWAIT #define LIO_NOWAIT LIO_NOWAIT }; /* Allow user to specify optimization. */ #ifdef __USE_GNU extern void aio_init (const struct aioinit *__init) __THROW __nonnull ((1)); #endif #ifndef __USE_FILE_OFFSET64 /* Enqueue read request for given number of bytes and the given priority. */ extern int aio_read (struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Enqueue write request for given number of bytes and the given priority. */ extern int aio_write (struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Initiate list of I/O requests. */ extern int lio_listio (int __mode, struct aiocb *const __list[__restrict_arr], int __nent, struct sigevent *__restrict __sig) __THROW __nonnull ((2)); /* Retrieve error status associated with AIOCBP. */ extern int aio_error (const struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Return status associated with AIOCBP. */ extern __ssize_t aio_return (struct aiocb *__aiocbp) __THROW __nonnull ((1)); /* Try to cancel asynchronous I/O requests outstanding against file descriptor FILDES. */ extern int aio_cancel (int __fildes, struct aiocb *__aiocbp) __THROW; /* Suspend calling thread until at least one of the asynchronous I/O operations referenced by LIST has completed. This function is a cancellation point and therefore not marked with __THROW. */ extern int aio_suspend (const struct aiocb *const __list[], int __nent, const struct timespec *__restrict __timeout) __nonnull ((1)); /* Force all operations associated with file desriptor described by `aio_fildes' member of AIOCBP. */ extern int aio_fsync (int __operation, struct aiocb *__aiocbp) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (aio_read, (struct aiocb *__aiocbp), aio_read64) __nonnull ((1)); extern int __REDIRECT_NTH (aio_write, (struct aiocb *__aiocbp), aio_write64) __nonnull ((1)); extern int __REDIRECT_NTH (lio_listio, (int __mode, struct aiocb *const __list[__restrict_arr], int __nent, struct sigevent *__restrict __sig), lio_listio64) __nonnull ((2)); extern int __REDIRECT_NTH (aio_error, (const struct aiocb *__aiocbp), aio_error64) __nonnull ((1)); extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp), aio_return64) __nonnull ((1)); extern int __REDIRECT_NTH (aio_cancel, (int __fildes, struct aiocb *__aiocbp), aio_cancel64); extern int __REDIRECT_NTH (aio_suspend, (const struct aiocb *const __list[], int __nent, const struct timespec *__restrict __timeout), aio_suspend64) __nonnull ((1)); extern int __REDIRECT_NTH (aio_fsync, (int __operation, struct aiocb *__aiocbp), aio_fsync64) __nonnull ((2)); # else # define aio_read aio_read64 # define aio_write aio_write64 # define lio_listio lio_listio64 # define aio_error aio_error64 # define aio_return aio_return64 # define aio_cancel aio_cancel64 # define aio_suspend aio_suspend64 # define aio_fsync aio_fsync64 # endif #endif #ifdef __USE_LARGEFILE64 extern int aio_read64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern int aio_write64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern int lio_listio64 (int __mode, struct aiocb64 *const __list[__restrict_arr], int __nent, struct sigevent *__restrict __sig) __THROW __nonnull ((2)); extern int aio_error64 (const struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern __ssize_t aio_return64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1)); extern int aio_cancel64 (int __fildes, struct aiocb64 *__aiocbp) __THROW; extern int aio_suspend64 (const struct aiocb64 *const __list[], int __nent, const struct timespec *__restrict __timeout) __THROW __nonnull ((1)); extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp) __THROW __nonnull ((2)); #endif __END_DECLS #endif /* aio.h */ aliases.h 0000644 00000003757 15063602062 0006352 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ALIASES_H #define _ALIASES_H 1 #include <features.h> #include <sys/types.h> __BEGIN_DECLS /* Structure to represent one entry of the alias data base. */ struct aliasent { char *alias_name; size_t alias_members_len; char **alias_members; int alias_local; }; /* Open alias data base files. */ extern void setaliasent (void) __THROW; /* Close alias data base files. */ extern void endaliasent (void) __THROW; /* Get the next entry from the alias data base. */ extern struct aliasent *getaliasent (void) __THROW; /* Get the next entry from the alias data base and put it in RESULT_BUF. */ extern int getaliasent_r (struct aliasent *__restrict __result_buf, char *__restrict __buffer, size_t __buflen, struct aliasent **__restrict __result) __THROW; /* Get alias entry corresponding to NAME. */ extern struct aliasent *getaliasbyname (const char *__name) __THROW; /* Get alias entry corresponding to NAME and put it in RESULT_BUF. */ extern int getaliasbyname_r (const char *__restrict __name, struct aliasent *__restrict __result_buf, char *__restrict __buffer, size_t __buflen, struct aliasent **__restrict __result) __THROW; __END_DECLS #endif /* aliases.h */ alloca.h 0000644 00000002263 15063602062 0006153 0 ustar 00 /* Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ALLOCA_H #define _ALLOCA_H 1 #include <features.h> #define __need_size_t #include <stddef.h> __BEGIN_DECLS /* Remove any previous definitions. */ #undef alloca /* Allocate a block that will be freed when the calling function exits. */ extern void *alloca (size_t __size) __THROW; #ifdef __GNUC__ # define alloca(size) __builtin_alloca (size) #endif /* GCC. */ __END_DECLS #endif /* alloca.h */ ar.h 0000644 00000003302 15063602062 0005315 0 ustar 00 /* Header describing `ar' archive file format. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _AR_H #define _AR_H 1 #include <sys/cdefs.h> /* Archive files start with the ARMAG identifying string. Then follows a `struct ar_hdr', and as many bytes of member file data as its `ar_size' member indicates, for each member file. */ #define ARMAG "!<arch>\n" /* String that begins an archive file. */ #define SARMAG 8 /* Size of that string. */ #define ARFMAG "`\n" /* String in ar_fmag at end of each header. */ __BEGIN_DECLS struct ar_hdr { char ar_name[16]; /* Member file name, sometimes / terminated. */ char ar_date[12]; /* File date, decimal seconds since Epoch. */ char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */ char ar_mode[8]; /* File mode, in ASCII octal. */ char ar_size[10]; /* File size, in ASCII decimal. */ char ar_fmag[2]; /* Always contains ARFMAG. */ }; __END_DECLS #endif /* ar.h */ argp.h 0000644 00000061506 15063602062 0005656 0 ustar 00 /* Hierarchial argument parsing, layered over getopt. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader <miles@gnu.ai.mit.edu>. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ARGP_H #define _ARGP_H #include <stdio.h> #include <ctype.h> #include <getopt.h> #include <limits.h> #include <errno.h> __BEGIN_DECLS /* error_t may or may not be available from errno.h, depending on the operating system. */ #ifndef __error_t_defined # define __error_t_defined 1 typedef int error_t; #endif /* A description of a particular option. A pointer to an array of these is passed in the OPTIONS field of an argp structure. Each option entry can correspond to one long option and/or one short option; more names for the same option can be added by following an entry in an option array with options having the OPTION_ALIAS flag set. */ struct argp_option { /* The long option name. For more than one name for the same option, you can use following options with the OPTION_ALIAS flag set. */ const char *name; /* What key is returned for this option. If > 0 and printable, then it's also accepted as a short option. */ int key; /* If non-NULL, this is the name of the argument associated with this option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ const char *arg; /* OPTION_ flags. */ int flags; /* The doc string for this option. If both NAME and KEY are 0, This string will be printed outdented from the normal option column, making it useful as a group header (it will be the first thing printed in its group); in this usage, it's conventional to end the string with a `:'. */ const char *doc; /* The group this option is in. In a long help message, options are sorted alphabetically within each group, and the groups presented in the order 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with if this field 0 will inherit the group number of the previous entry, or zero if it's the first one, unless its a group header (NAME and KEY both 0), in which case, the previous entry + 1 is the default. Automagic options such as --help are put into group -1. */ int group; }; /* The argument associated with this option is optional. */ #define OPTION_ARG_OPTIONAL 0x1 /* This option isn't displayed in any help messages. */ #define OPTION_HIDDEN 0x2 /* This option is an alias for the closest previous non-alias option. This means that it will be displayed in the same help entry, and will inherit fields other than NAME and KEY from the aliased option. */ #define OPTION_ALIAS 0x4 /* This option isn't actually an option (and so should be ignored by the actual option parser), but rather an arbitrary piece of documentation that should be displayed in much the same manner as the options. If this flag is set, then the option NAME field is displayed unmodified (e.g., no `--' prefix is added) at the left-margin (where a *short* option would normally be displayed), and the documentation string in the normal place. For purposes of sorting, any leading whitespace and punctuation is ignored, except that if the first non-whitespace character is not `-', this entry is displayed after all options (and OPTION_DOC entries with a leading `-') in the same group. */ #define OPTION_DOC 0x8 /* This option shouldn't be included in `long' usage messages (but is still included in help messages). This is mainly intended for options that are completely documented in an argp's ARGS_DOC field, in which case including the option in the generic usage list would be redundant. For instance, if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to distinguish these two cases, -x should probably be marked OPTION_NO_USAGE. */ #define OPTION_NO_USAGE 0x10 struct argp; /* fwd declare this type */ struct argp_state; /* " */ struct argp_child; /* " */ /* The type of a pointer to an argp parsing function. */ typedef error_t (*argp_parser_t) (int __key, char *__arg, struct argp_state *__state); /* What to return for unrecognized keys. For special ARGP_KEY_ keys, such returns will simply be ignored. For user keys, this error will be turned into EINVAL (if the call to argp_parse is such that errors are propagated back to the user instead of exiting); returning EINVAL itself would result in an immediate stop to parsing in *all* cases. */ #define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ /* Special values for the KEY argument to an argument parsing function. ARGP_ERR_UNKNOWN should be returned if they aren't understood. The sequence of keys to a parsing function is either (where each uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized The third case is where every parser returned ARGP_KEY_UNKNOWN for an argument, in which case parsing stops at that argument (returning the unparsed arguments to the caller of argp_parse if requested, or stopping with an error message if not). If an error occurs (either detected by argp, or because the parsing function returned an error value), then the parser is called with ARGP_KEY_ERROR, and no further calls are made. */ /* This is not an option at all, but rather a command line argument. If a parser receiving this key returns success, the fact is recorded, and the ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the argument, a parser function decrements the NEXT field of the state it's passed, the option won't be considered processed; this is to allow you to actually modify the argument (perhaps into an option), and have it processed again. */ #define ARGP_KEY_ARG 0 /* There are remaining arguments not parsed by any parser, which may be found starting at (STATE->argv + STATE->next). If success is returned, but STATE->next left untouched, it's assumed that all arguments were consume, otherwise, the parser should adjust STATE->next to reflect any arguments consumed. */ #define ARGP_KEY_ARGS 0x1000006 /* There are no more command line arguments at all. */ #define ARGP_KEY_END 0x1000001 /* Because it's common to want to do some special processing if there aren't any non-option args, user parsers are called with this key if they didn't successfully process any non-option arguments. Called just before ARGP_KEY_END (where more general validity checks on previously parsed arguments can take place). */ #define ARGP_KEY_NO_ARGS 0x1000002 /* Passed in before any parsing is done. Afterwards, the values of each element of the CHILD_INPUT field, if any, in the state structure is copied to each child's state to be the initial value of the INPUT field. */ #define ARGP_KEY_INIT 0x1000003 /* Use after all other keys, including SUCCESS & END. */ #define ARGP_KEY_FINI 0x1000007 /* Passed in when parsing has successfully been completed (even if there are still arguments remaining). */ #define ARGP_KEY_SUCCESS 0x1000004 /* Passed in if an error occurs. */ #define ARGP_KEY_ERROR 0x1000005 /* An argp structure contains a set of options declarations, a function to deal with parsing one, documentation string, a possible vector of child argp's, and perhaps a function to filter help output. When actually parsing options, getopt is called with the union of all the argp structures chained together through their CHILD pointers, with conflicts being resolved in favor of the first occurrence in the chain. */ struct argp { /* An array of argp_option structures, terminated by an entry with both NAME and KEY having a value of 0. */ const struct argp_option *options; /* What to do with an option from this structure. KEY is the key associated with the option, and ARG is any associated argument (NULL if none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then parsing is stopped immediately, and that value is returned from argp_parse(). For special (non-user-supplied) values of KEY, see the ARGP_KEY_ definitions below. */ argp_parser_t parser; /* A string describing what other arguments are wanted by this program. It is only used by argp_usage to print the `Usage:' message. If it contains newlines, the strings separated by them are considered alternative usage patterns, and printed on separate lines (lines after the first are prefix by ` or: ' instead of `Usage:'). */ const char *args_doc; /* If non-NULL, a string containing extra text to be printed before and after the options in a long help message (separated by a vertical tab `\v' character). */ const char *doc; /* A vector of argp_children structures, terminated by a member with a 0 argp field, pointing to child argps should be parsed with this one. Any conflicts are resolved in favor of this argp, or early argps in the CHILDREN list. This field is useful if you use libraries that supply their own argp structure, which you want to use in conjunction with your own. */ const struct argp_child *children; /* If non-zero, this should be a function to filter the output of help messages. KEY is either a key from an option, in which case TEXT is that option's help text, or a special key from the ARGP_KEY_HELP_ defines, below, describing which other help text TEXT is. The function should return either TEXT, if it should be used as-is, a replacement string, which should be malloced, and will be freed by argp, or NULL, meaning `print nothing'. The value for TEXT is *after* any translation has been done, so if any of the replacement text also needs translation, that should be done by the filter function. INPUT is either the input supplied to argp_parse, or NULL, if argp_help was called directly. */ char *(*help_filter) (int __key, const char *__text, void *__input); /* If non-zero the strings used in the argp library are translated using the domain described by this string. Otherwise the currently installed default domain is used. */ const char *argp_domain; }; /* Possible KEY arguments to a help filter function. */ #define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ #define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ #define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ #define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; TEXT is NULL for this key. */ /* Explanatory note emitted when duplicate option arguments have been suppressed. */ #define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 #define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ /* When an argp has a non-zero CHILDREN field, it should point to a vector of argp_child structures, each of which describes a subsidiary argp. */ struct argp_child { /* The child parser. */ const struct argp *argp; /* Flags for this child. */ int flags; /* If non-zero, an optional header to be printed in help output before the child options. As a side-effect, a non-zero value forces the child options to be grouped together; to achieve this effect without actually printing a header string, use a value of "". */ const char *header; /* Where to group the child options relative to the other (`consolidated') options in the parent argp; the values are the same as the GROUP field in argp_option structs, but all child-groupings follow parent options at a particular group level. If both this field and HEADER are zero, then they aren't grouped at all, but rather merged with the parent options (merging the child's grouping levels with the parents). */ int group; }; /* Parsing state. This is provided to parsing functions called by argp, which may examine and, as noted, modify fields. */ struct argp_state { /* The top level ARGP being parsed. */ const struct argp *root_argp; /* The argument vector being parsed. May be modified. */ int argc; char **argv; /* The index in ARGV of the next arg that to be parsed. May be modified. */ int next; /* The flags supplied to argp_parse. May be modified. */ unsigned flags; /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the number of the current arg, starting at zero, and incremented after each such call returns. At all other times, this is the number of such arguments that have been processed. */ unsigned arg_num; /* If non-zero, the index in ARGV of the first argument following a special `--' argument (which prevents anything following being interpreted as an option). Only set once argument parsing has proceeded past this point. */ int quoted; /* An arbitrary pointer passed in from the user. */ void *input; /* Values to pass to child parsers. This vector will be the same length as the number of children for the current parser. */ void **child_inputs; /* For the parser's use. Initialized to 0. */ void *hook; /* The name used when printing messages. This is initialized to ARGV[0], or PROGRAM_INVOCATION_NAME if that is unavailable. */ char *name; /* Streams used when argp prints something. */ FILE *err_stream; /* For errors; initialized to stderr. */ FILE *out_stream; /* For information; initialized to stdout. */ void *pstate; /* Private, for use by argp. */ }; /* Flags for argp_parse (note that the defaults are those that are convenient for program command line parsing): */ /* Don't ignore the first element of ARGV. Normally (and always unless ARGP_NO_ERRS is set) the first element of the argument vector is skipped for option parsing purposes, as it corresponds to the program name in a command line. */ #define ARGP_PARSE_ARGV0 0x01 /* Don't print error messages for unknown options to stderr; unless this flag is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program name in the error messages. This flag implies ARGP_NO_EXIT (on the assumption that silent exiting upon errors is bad behaviour). */ #define ARGP_NO_ERRS 0x02 /* Don't parse any non-option args. Normally non-option args are parsed by calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg as the value. Since it's impossible to know which parse function wants to handle it, each one is called in turn, until one returns 0 or an error other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the argp_parse returns prematurely (but with a return value of 0). If all args have been parsed without error, all parsing functions are called one last time with a key of ARGP_KEY_END. This flag needn't normally be set, as the normal behavior is to stop parsing as soon as some argument can't be handled. */ #define ARGP_NO_ARGS 0x04 /* Parse options and arguments in the same order they occur on the command line -- normally they're rearranged so that all options come first. */ #define ARGP_IN_ORDER 0x08 /* Don't provide the standard long option --help, which causes usage and option help information to be output to stdout, and exit (0) called. */ #define ARGP_NO_HELP 0x10 /* Don't exit on errors (they may still result in error messages). */ #define ARGP_NO_EXIT 0x20 /* Use the gnu getopt `long-only' rules for parsing arguments. */ #define ARGP_LONG_ONLY 0x40 /* Turns off any message-printing/exiting options. */ #define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) /* Parse the options strings in ARGC & ARGV according to the options in ARGP. FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the index in ARGV of the first unparsed option is returned in it. If an unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser routine returned a non-zero value, it is returned; otherwise 0 is returned. This function may also call exit unless the ARGP_NO_HELP flag is set. INPUT is a pointer to a value to be passed in to the parser. */ extern error_t argp_parse (const struct argp *__restrict __argp, int __argc, char **__restrict __argv, unsigned __flags, int *__restrict __arg_index, void *__restrict __input); extern error_t __argp_parse (const struct argp *__restrict __argp, int __argc, char **__restrict __argv, unsigned __flags, int *__restrict __arg_index, void *__restrict __input); /* Global variables. */ /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which will print this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ extern const char *argp_program_version; /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which calls this function with a stream to print the version to and a pointer to the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ extern void (*argp_program_version_hook) (FILE *__restrict __stream, struct argp_state *__restrict __state); /* If defined or set by the user program, it should point to string that is the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like `Report bugs to ADDR.'. */ extern const char *argp_program_bug_address; /* The exit status that argp will use when exiting due to a parsing error. If not defined or set by the user program, this defaults to EX_USAGE from <sysexits.h>. */ extern error_t argp_err_exit_status; /* Flags for argp_help. */ #define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ #define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ #define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ #define ARGP_HELP_LONG 0x08 /* a long help message. */ #define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ #define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ #define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) #define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ #define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to reflect ARGP_LONG_ONLY mode. */ /* These ARGP_HELP flags are only understood by argp_state_help. */ #define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ #define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ /* The standard thing to do after a program command line parsing error, if an error message has already been printed. */ #define ARGP_HELP_STD_ERR \ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do after a program command line parsing error, if no more specific error message has been printed. */ #define ARGP_HELP_STD_USAGE \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do in response to a --help option. */ #define ARGP_HELP_STD_HELP \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) /* Output a usage message for ARGP to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_help (const struct argp *__restrict __argp, FILE *__restrict __stream, unsigned __flags, char *__restrict __name); extern void __argp_help (const struct argp *__restrict __argp, FILE *__restrict __stream, unsigned __flags, char *__name); /* The following routines are intended to be called from within an argp parsing routine (thus taking an argp_state structure as the first argument). They may or may not print an error message and exit, depending on the flags in STATE -- in any case, the caller should be prepared for them *not* to exit, and should return an appropiate error after calling them. [argp_usage & argp_error should probably be called argp_state_..., but they're used often enough that they should be short] */ /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_state_help (const struct argp_state *__restrict __state, FILE *__restrict __stream, unsigned int __flags); extern void __argp_state_help (const struct argp_state *__restrict __state, FILE *__restrict __stream, unsigned int __flags); /* Possibly output the standard usage message for ARGP to stderr and exit. */ extern void argp_usage (const struct argp_state *__state); extern void __argp_usage (const struct argp_state *__state); /* If appropriate, print the printf string FMT and following args, preceded by the program name and `:', to stderr, and followed by a `Try ... --help' message, then exit (1). */ extern void argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern void __argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); /* Similar to the standard gnu error-reporting function error(), but will respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print to STATE->err_stream. This is useful for argument parsing code that is shared between program startup (when exiting is desired) and runtime option parsing (when typically an error code is returned instead). The difference between this function and argp_error is that the latter is for *parsing errors*, and the former is for other problems that occur during parsing but don't reflect a (syntactic) problem with the input. */ extern void argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5))); extern void __argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5))); /* Returns true if the option OPT is a valid short option. */ extern int _option_is_short (const struct argp_option *__opt) __THROW; extern int __option_is_short (const struct argp_option *__opt) __THROW; /* Returns true if the option OPT is in fact the last (unused) entry in an options array. */ extern int _option_is_end (const struct argp_option *__opt) __THROW; extern int __option_is_end (const struct argp_option *__opt) __THROW; /* Return the input field for ARGP in the parser corresponding to STATE; used by the help routines. */ extern void *_argp_input (const struct argp *__restrict __argp, const struct argp_state *__restrict __state) __THROW; extern void *__argp_input (const struct argp *__restrict __argp, const struct argp_state *__restrict __state) __THROW; #ifdef __USE_EXTERN_INLINES # if !(defined _LIBC && _LIBC) # define __argp_usage argp_usage # define __argp_state_help argp_state_help # define __option_is_short _option_is_short # define __option_is_end _option_is_end # endif # ifndef ARGP_EI # define ARGP_EI __extern_inline # endif ARGP_EI void __argp_usage (const struct argp_state *__state) { __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); } ARGP_EI int __NTH (__option_is_short (const struct argp_option *__opt)) { if (__opt->flags & OPTION_DOC) return 0; else { int __key = __opt->key; return __key > 0 && __key <= UCHAR_MAX && isprint (__key); } } ARGP_EI int __NTH (__option_is_end (const struct argp_option *__opt)) { return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; } # if !(defined _LIBC && _LIBC) # undef __argp_usage # undef __argp_state_help # undef __option_is_short # undef __option_is_end # endif #endif /* Use extern inlines. */ __END_DECLS #endif /* argp.h */ argz.h 0000644 00000013642 15063602062 0005666 0 ustar 00 /* Routines for dealing with '\0' separated arg vectors. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ARGZ_H #define _ARGZ_H 1 #include <features.h> #include <errno.h> #include <string.h> /* Need size_t, and strchr is called below. */ __BEGIN_DECLS /* error_t may or may not be available from errno.h, depending on the operating system. */ #ifndef __error_t_defined # define __error_t_defined 1 typedef int error_t; #endif /* Make a '\0' separated arg vector from a unix argv vector, returning it in ARGZ, and the total length in LEN. If a memory allocation error occurs, ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ extern error_t __argz_create (char *const __argv[], char **__restrict __argz, size_t *__restrict __len) __THROW; extern error_t argz_create (char *const __argv[], char **__restrict __argz, size_t *__restrict __len) __THROW; /* Make a '\0' separated arg vector from a SEP separated list in STRING, returning it in ARGZ, and the total length in LEN. If a memory allocation error occurs, ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ extern error_t argz_create_sep (const char *__restrict __string, int __sep, char **__restrict __argz, size_t *__restrict __len) __THROW; /* Returns the number of strings in ARGZ. */ extern size_t __argz_count (const char *__argz, size_t __len) __THROW __attribute_pure__; extern size_t argz_count (const char *__argz, size_t __len) __THROW __attribute_pure__; /* Puts pointers to each string in ARGZ into ARGV, which must be large enough to hold them all. */ extern void __argz_extract (const char *__restrict __argz, size_t __len, char **__restrict __argv) __THROW; extern void argz_extract (const char *__restrict __argz, size_t __len, char **__restrict __argv) __THROW; /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's except the last into the character SEP. */ extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW; extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW; /* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t argz_append (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __buf, size_t __buf_len) __THROW; /* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t argz_add (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __str) __THROW; /* Append SEP separated list in STRING to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t argz_add_sep (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __string, int __delim) __THROW; /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ extern void argz_delete (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __entry) __THROW; /* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN, ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not in ARGZ, EINVAL is returned, else if memory can't be allocated for the new ARGZ, ENOMEM is returned, else 0. */ extern error_t argz_insert (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __before, const char *__restrict __entry) __THROW; /* Replace any occurrences of the string STR in ARGZ with WITH, reallocating ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be incremented by number of replacements performed. */ extern error_t argz_replace (char **__restrict __argz, size_t *__restrict __argz_len, const char *__restrict __str, const char *__restrict __with, unsigned int *__restrict __replace_count); /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there are no more. If entry is NULL, then the first entry is returned. This behavior allows two convenient iteration styles: char *entry = 0; while ((entry = argz_next (argz, argz_len, entry))) ...; or char *entry; for (entry = argz; entry; entry = argz_next (argz, argz_len, entry)) ...; */ extern char *__argz_next (const char *__restrict __argz, size_t __argz_len, const char *__restrict __entry) __THROW; extern char *argz_next (const char *__restrict __argz, size_t __argz_len, const char *__restrict __entry) __THROW; #ifdef __USE_EXTERN_INLINES __extern_inline char * __NTH (__argz_next (const char *__argz, size_t __argz_len, const char *__entry)) { if (__entry) { if (__entry < __argz + __argz_len) __entry = strchr (__entry, '\0') + 1; return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry; } else return __argz_len > 0 ? (char *) __argz : 0; } __extern_inline char * __NTH (argz_next (const char *__argz, size_t __argz_len, const char *__entry)) { return __argz_next (__argz, __argz_len, __entry); } #endif /* Use extern inlines. */ __END_DECLS #endif /* argz.h */ assert.h 0000644 00000010721 15063602062 0006217 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.2 Diagnostics <assert.h> */ #ifdef _ASSERT_H # undef _ASSERT_H # undef assert # undef __ASSERT_VOID_CAST # ifdef __USE_GNU # undef assert_perror # endif #endif /* assert.h */ #define _ASSERT_H 1 #include <features.h> #if defined __cplusplus && __GNUC_PREREQ (2,95) # define __ASSERT_VOID_CAST static_cast<void> #else # define __ASSERT_VOID_CAST (void) #endif /* void assert (int expression); If NDEBUG is defined, do nothing. If not, and EXPRESSION is zero, print an error message and abort. */ #ifdef NDEBUG # define assert(expr) (__ASSERT_VOID_CAST (0)) /* void assert_perror (int errnum); If NDEBUG is defined, do nothing. If not, and ERRNUM is not zero, print an error message with the error text for ERRNUM and abort. (This is a GNU extension.) */ # ifdef __USE_GNU # define assert_perror(errnum) (__ASSERT_VOID_CAST (0)) # endif #else /* Not NDEBUG. */ __BEGIN_DECLS /* This prints an "Assertion failed" message and aborts. */ extern void __assert_fail (const char *__assertion, const char *__file, unsigned int __line, const char *__function) __THROW __attribute__ ((__noreturn__)); /* Likewise, but prints the error text for ERRNUM. */ extern void __assert_perror_fail (int __errnum, const char *__file, unsigned int __line, const char *__function) __THROW __attribute__ ((__noreturn__)); /* The following is not at all used here but needed for standard compliance. */ extern void __assert (const char *__assertion, const char *__file, int __line) __THROW __attribute__ ((__noreturn__)); __END_DECLS /* When possible, define assert so that it does not add extra parentheses around EXPR. Otherwise, those added parentheses would suppress warnings we'd expect to be detected by gcc's -Wparentheses. */ # if defined __cplusplus # define assert(expr) \ (static_cast <bool> (expr) \ ? void (0) \ : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION)) # elif !defined __GNUC__ || defined __STRICT_ANSI__ # define assert(expr) \ ((expr) \ ? __ASSERT_VOID_CAST (0) \ : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION)) # else /* The first occurrence of EXPR is not evaluated due to the sizeof, but will trigger any pedantic warnings masked by the __extension__ for the second occurrence. The ternary operator is required to support function pointers and bit fields in this context, and to suppress the evaluation of variable length arrays. */ # define assert(expr) \ ((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \ if (expr) \ ; /* empty */ \ else \ __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \ })) # endif # ifdef __USE_GNU # define assert_perror(errnum) \ (!(errnum) \ ? __ASSERT_VOID_CAST (0) \ : __assert_perror_fail ((errnum), __FILE__, __LINE__, __ASSERT_FUNCTION)) # endif /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' which contains the name of the function currently being defined. This is broken in G++ before version 2.6. C9x has a similar variable called __func__, but prefer the GCC one since it demangles C++ function names. */ # if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4) # define __ASSERT_FUNCTION __extension__ __PRETTY_FUNCTION__ # else # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __ASSERT_FUNCTION __func__ # else # define __ASSERT_FUNCTION ((const char *) 0) # endif # endif #endif /* NDEBUG. */ #if defined __USE_ISOC11 && !defined __cplusplus # undef static_assert # define static_assert _Static_assert #endif byteswap.h 0000644 00000002574 15063602062 0006563 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BYTESWAP_H #define _BYTESWAP_H 1 #include <features.h> /* Get the machine specific, optimized definitions. */ #include <bits/byteswap.h> /* The following definitions must all be macros since otherwise some of the possible optimizations are not possible. */ /* Return a value with all bytes in the 16 bit argument swapped. */ #define bswap_16(x) __bswap_16 (x) /* Return a value with all bytes in the 32 bit argument swapped. */ #define bswap_32(x) __bswap_32 (x) /* Return a value with all bytes in the 64 bit argument swapped. */ #define bswap_64(x) __bswap_64 (x) #endif /* byteswap.h */ complex.h 0000644 00000015773 15063602062 0006401 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99: 7.3 Complex arithmetic <complex.h> */ #ifndef _COMPLEX_H #define _COMPLEX_H 1 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION #include <bits/libc-header-start.h> /* Get general and ISO C99 specific information. */ #include <bits/mathdef.h> /* Gather machine-dependent _FloatN type support. */ #include <bits/floatn.h> __BEGIN_DECLS /* We might need to add support for more compilers here. But since ISO C99 is out hopefully all maintained compilers will soon provide the data types `float complex' and `double complex'. */ #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) # define _Complex __complex__ #endif #define complex _Complex /* Narrowest imaginary unit. This depends on the floating-point evaluation method. XXX This probably has to go into a gcc related file. */ #define _Complex_I (__extension__ 1.0iF) /* Another more descriptive name is `I'. XXX Once we have the imaginary support switch this to _Imaginary_I. */ #undef I #define I _Complex_I #if defined __USE_ISOC11 && __GNUC_PREREQ (4, 7) /* Macros to expand into expression of specified complex type. */ # define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y)) # define CMPLXF(x, y) __builtin_complex ((float) (x), (float) (y)) # define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y)) #endif #if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define CMPLXF16(x, y) __builtin_complex ((_Float16) (x), (_Float16) (y)) #endif #if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define CMPLXF32(x, y) __builtin_complex ((_Float32) (x), (_Float32) (y)) #endif #if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define CMPLXF64(x, y) __builtin_complex ((_Float64) (x), (_Float64) (y)) #endif #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define CMPLXF128(x, y) __builtin_complex ((_Float128) (x), (_Float128) (y)) #endif #if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define CMPLXF32X(x, y) __builtin_complex ((_Float32x) (x), (_Float32x) (y)) #endif #if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define CMPLXF64X(x, y) __builtin_complex ((_Float64x) (x), (_Float64x) (y)) #endif #if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define CMPLXF128X(x, y) \ __builtin_complex ((_Float128x) (x), (_Float128x) (y)) #endif /* The file <bits/cmathcalls.h> contains the prototypes for all the actual math functions. These macros are used for those prototypes, so we can easily declare each function as both `name' and `__name', and can declare the float versions `namef' and `__namef'. */ #define __MATHCALL(function, args) \ __MATHDECL (_Mdouble_complex_,function, args) #define __MATHDECL(type, function, args) \ __MATHDECL_1(type, function, args); \ __MATHDECL_1(type, __CONCAT(__,function), args) #define __MATHDECL_1(type, function, args) \ extern type __MATH_PRECNAME(function) args __THROW #define _Mdouble_ double #define __MATH_PRECNAME(name) name #include <bits/cmathcalls.h> #undef _Mdouble_ #undef __MATH_PRECNAME /* Now the float versions. */ #define _Mdouble_ float #define __MATH_PRECNAME(name) name##f #include <bits/cmathcalls.h> #undef _Mdouble_ #undef __MATH_PRECNAME /* And the long double versions. It is non-critical to define them here unconditionally since `long double' is required in ISO C99. */ #if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \ || defined __LDBL_COMPAT # ifdef __LDBL_COMPAT # undef __MATHDECL_1 # define __MATHDECL_1(type, function, args) \ extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function) # endif # define _Mdouble_ long double # define __MATH_PRECNAME(name) name##l # include <bits/cmathcalls.h> #endif #undef _Mdouble_ #undef __MATH_PRECNAME #if (__HAVE_DISTINCT_FLOAT16 || (__HAVE_FLOAT16 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # undef _Mdouble_complex_ # define _Mdouble_complex_ __CFLOAT16 # define _Mdouble_ _Float16 # define __MATH_PRECNAME(name) name##f16 # include <bits/cmathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef _Mdouble_complex_ #endif #if (__HAVE_DISTINCT_FLOAT32 || (__HAVE_FLOAT32 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # undef _Mdouble_complex_ # define _Mdouble_complex_ __CFLOAT32 # define _Mdouble_ _Float32 # define __MATH_PRECNAME(name) name##f32 # include <bits/cmathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef _Mdouble_complex_ #endif #if (__HAVE_DISTINCT_FLOAT64 || (__HAVE_FLOAT64 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # undef _Mdouble_complex_ # define _Mdouble_complex_ __CFLOAT64 # define _Mdouble_ _Float64 # define __MATH_PRECNAME(name) name##f64 # include <bits/cmathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef _Mdouble_complex_ #endif #if (__HAVE_DISTINCT_FLOAT128 || (__HAVE_FLOAT128 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # undef _Mdouble_complex_ # define _Mdouble_complex_ __CFLOAT128 # define _Mdouble_ _Float128 # define __MATH_PRECNAME(name) name##f128 # include <bits/cmathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef _Mdouble_complex_ #endif #if (__HAVE_DISTINCT_FLOAT32X || (__HAVE_FLOAT32X && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # undef _Mdouble_complex_ # define _Mdouble_complex_ __CFLOAT32X # define _Mdouble_ _Float32x # define __MATH_PRECNAME(name) name##f32x # include <bits/cmathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef _Mdouble_complex_ #endif #if (__HAVE_DISTINCT_FLOAT64X || (__HAVE_FLOAT64X && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # undef _Mdouble_complex_ # define _Mdouble_complex_ __CFLOAT64X # define _Mdouble_ _Float64x # define __MATH_PRECNAME(name) name##f64x # include <bits/cmathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef _Mdouble_complex_ #endif #if (__HAVE_DISTINCT_FLOAT128X || (__HAVE_FLOAT128X && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # undef _Mdouble_complex_ # define _Mdouble_complex_ __CFLOAT128X # define _Mdouble_ _Float128x # define __MATH_PRECNAME(name) name##f128x # include <bits/cmathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef _Mdouble_complex_ #endif #undef __MATHDECL_1 #undef __MATHDECL #undef __MATHCALL __END_DECLS #endif /* complex.h */ lve/lve-ctl.h 0000644 00000030437 15063602062 0007060 0 ustar 00 #ifndef _LVE_CTL_H_ #define _LVE_CTL_H_ #include <stdlib.h> #include <stdint.h> #include <string.h> #ifndef _LVE_TYPE_H_ #include "lve-type.h" #endif #define LIBLVE_API_MAJOR 1 #define LIBLVE_API_MINOR 5 #define SIZEOF_LIBLVE (sizeof(void *) + sizeof(void *) + sizeof(int)) struct liblve; /** * initializes and create instance of LVE * args * allocator - pointer to function to allocate memory * returns * NULL on error, errno will be set. * errno will be EINVAL if wrong version of library is used * liblve otherwise */ struct liblve *init_lve(liblve_alloc alloc, liblve_free free); static inline struct liblve *init_lve_generic() { return init_lve(malloc, free); } /** * destroy lve library instance * args: * lve = instantiated liblive instance * return 0 on success * negative number on error. errno will be set */ int destroy_lve(struct liblve *lve); /** * enter a light virutal environment * args: * lve = fully initialized liblve instance * lve_id = id associated with LVE * cookie = pointer to cookie, which is returned if the task * is correctly migrated into LVE and used to exit from this LVE * return codes: * 0 = on success, negative number means error: * -EPERM - don't have permission to call, or called from outside root LVE * -ENOMEM - there's not enough memory to allocate a new LVE * -EFAULT - cookie is a bad pointer */ int lve_enter_flags(struct liblve *lve, uint32_t lve_id, uint32_t *cookie, enum liblve_enter_flags flags); /** * enter lve namespace and get a copy of the original fs * args: * lve = fully initialized liblve instance * return codes: * -EINVAL - the caller hasn't entered an lve */ int lve_enter_fs(struct liblve *lve); /** * exit from virtual environment, same as lve_leave * args: * lve = fully init liblve instance * cookie - pointer to cookie returned from lve_enter * return codes: * 0 = none error, all less zero is errors: * -ESRCH = task not in virutal environment * -EFAULT = bad cookie pointer * -EINVAL = cookie not match to stored in context */ int lve_exit(struct liblve *lve, uint32_t *cookie); int lve_setup_enter(struct liblve *lve, uint32_t ve_id, struct liblve_settings *set, uint32_t *cookie, enum liblve_enter_flags flags); /** * @brief Checks whether a current task has reached its limits. * * This call retrieve set of liblve_ve_fails flags, each of them * represents resource which allocation failed. This flags combined * via bitwise or returns through failmask parameter. Flags are * cleared after this call. * * @param lve - fully initialized liblve instance. * @param failmask - pointer to variable where fail mask will be stored. * @retval 0 success. * @retval -ESRCH task not in virutal environment. * @retval -EFAULT bad failmask pointer. */ int lve_check_fault(struct liblve *lve, uint32_t * failmask); #ifdef LVE_DEPRICATED #warning you need remove old functions static inline int lve_is_available(void) { struct liblve *lve; lve = init_lve(malloc, free); if (lve == NULL) return 0; destroy_lve(lve); return 1; } static inline int lve_instance_init(struct liblve *lve) { struct liblve *tmp; if (lve == NULL) return SIZEOF_LIBLVE; tmp = init_lve(malloc, NULL); if (tmp == NULL) return -1; memcpy(lve, tmp, SIZEOF_LIBLVE); free(tmp); return 0; } static inline int lve_instance_destroy(struct liblve *lve) { return destroy_lve(lve); } #define __unused __attribute__((unused)) static inline int lve_enter(struct liblve *lve, uint32_t ve_id, __unused int32_t uid, __unused int32_t gid, uint32_t *cookie) { return lve_enter_flags(lve, ve_id, cookie, 0); } static inline int lve_leave(struct liblve *lib, uint32_t *cookie) { return lve_exit(lib, cookie); } #endif /** * Return 1 if process in lve context * return * 1 - process is in lve context * 0 - process is not in lve context */ int is_in_lve(struct liblve *lve); /** * return actual api version used to communicate with kernel * in format major << 16 | minor */ uint32_t lve_kapi_ver(struct liblve *lve); /** * return actual liblve api version used to communicate with * userland application * return in format major << 16 | minor */ uint32_t lve_get_api_version(void); #ifdef LVE_ADMIN /** * create custom configured virtual enviroment * args: * ve_id = id associated with VE */ int lve_create(struct liblve *lve, uint32_t lve_id); /** * destroy configured virtual environment * args: * ve_id = id associated with VE */ int lve_destroy(struct liblve *lve, uint32_t lve_id); /** * adjust parameters for virtual environment * args: * ve_id = id associated with VE */ int lve_setup(struct liblve *lve, uint32_t lve_id, struct liblve_settings *set); /** * flush context's from kernel * args * all == true - is need all context flushed, or only default * configured * return * */ int lve_flush(struct liblve *lve, int all); /** * get info about context * args * ve_id = id associated with VE * cpu - pointer to return CPU power. * io - pointer to IO priority. * return * 0 - OK * any negative value say error is hit. */ int lve_info(struct liblve *lve, uint32_t ve_id, struct liblve_info *set); int lve_setup_flags(struct liblve *lve, uint32_t ve_id, enum liblve_ve_flags); /** * migrate existent process into container * * args * ve_id = container id to migrate * pid = process id to migrate * return * 0 - OK * any negative value say error is hit. */ int lve_enter_pid(struct liblve *lve, uint32_t ve_id, pid_t pid); /** * migrate existent process into container with flags * * args * ve_id = container id to migrate * pid = process id to migrate * flags = flag set, see lve_enter * return * 0 - OK * < 0 - for -errno. */ int lve_enter_pid_flags(struct liblve *lve, uint32_t ve_id, pid_t pid, uint32_t flags); /** * migrate existent process from container * * args * pid = process id to migrate * return * 0 - OK * any negative value say error is hit. */ int lve_leave_pid(struct liblve *lve, pid_t pid); /** * Set up the lve module * returns * 0 on success * -errno on error */ int lve_start(struct liblve *lve); /** * Set fail injection place */ int lve_set_fail_val(struct liblve *lve, uint32_t fail_val); /** * enter lve namespace and get the ORIGINAL fs * any changes to cwd/root will be applied to all * following namespace guests * args: * lve = fully initialized liblve instance * \retval * -EPERM - the call is not permitted * -EINVAL - the caller hasn't entered an lve */ int lve_setup_fs(struct liblve *lve); /** * set lve root mount tree. * args * lve = fully initialized liblve instance * lve_id = lve identiferer to be root changed * * \retval */ int lve_set_root(struct liblve *lve, uint32_t lve_id, const char *root); /** * take current NS and FS settrigs as default for lve. * args * lve = fully initialized liblve instance * lve_id = lve identifer to need assign an NS * \retval * */ int lve_assign_ns(struct liblve *lve, uint32_t lve_id); /** * set lve global parameter value * args * lve = fully initialized liblve instance * param parameter id * val = parameter value * \retval */ int lve_set_global_param(struct liblve *lve, enum liblve_global_params param, uint64_t val); /** * get lve global parameter value * args * lve = fully initialized liblve instance * param parameter id * val = parameter value * \retval */ int lve_get_global_param(struct liblve *lve, enum liblve_global_params param, uint64_t *val); /** * get lve info by task pid * args * lve = fully initialized liblve instance * pid = task PID * info = pointer where to put info * \retval */ int lve_get_pid_info(struct liblve *lve, pid_t pid, struct liblve_pid_info *info); /** * TCP port bind control * args * lve = fully initialized liblve instance * * \retval */ /* helpers */ int lve_net_port_add(struct liblve *lve, uint32_t lve_id, uint16_t port, bool policy); int lve_net_port_del(struct liblve *lve, uint32_t lve_id, uint16_t port); int lve_net_port_def(struct liblve *lve, uint32_t lve_id, bool policy); /** * set network limits * args * lve = fully initialized liblve instance * net_limits = uid/port pair * \retval */ int lve_set_net_limits(struct liblve *lve, uint32_t lve_id, struct liblve_net_limits *net_limits); /** * control freezer * args * lve = fully initialized liblve instance * fc = arguments passed to the freezer * \retval */ int lve_freezer_control(struct liblve *lve, uint32_t lve_id, struct liblve_freezer_control *fc); /** * create 2nd level lvp * args * lve = fully initialized liblve instance * lvp_id = lvp identifier */ int lve_lvp_create(struct liblve *lve, uint32_t lvp_id); /** * adjust parameters for virtual environment * args: * lve = initialized liblve entity * set = default parameters settings * lvp_id = id associated with resseler */ int lve_lvp_setup(struct liblve *lve, uint32_t lvp_id, enum lvp_set_type op, struct liblve_settings *set); /** * destroy 2nd level lvp * args * lve = fully initialized liblve instance * lvp_id - lvp identifier */ int lve_lvp_destroy(struct liblve *lve, uint32_t lvp_id); /* create a mapping between lve and lvp */ int lve_lvp_map(struct liblve *lve, uint32_t lve_id, uint32_t lvp_id); /** * move lvp to the different reseller */ int lve_lvp_move(struct liblve *lve, uint32_t lve_id, uint32_t lvp_id); /** * read lvp limits */ int lve_lvp_info(struct liblve *lve, uint32_t lvp_id, enum lvp_set_type op, struct liblve_info *set); #endif struct passwd; /** * CageFS definitions */ #include <sys/types.h> #include <pwd.h> #define SECURELVE_JAIL "/usr/share/cagefs-skeleton" #define SECURELVE_BASEDIR "/var/cagefs/" #define SECURELVE_SHELL "/usr/sbin/securelve_sh" /* deprecated */ #define SECURELVE_ETC_MP_FILE "/etc/cagefs/cagefs.mp" #define SECURELVE_MP_FILE "/usr/share/cagefs/cagefs.mp.work" /* deprecated */ #define SECURELVE_CONFIG_DIR "/etc/cagefs" #define SECURELVE_MIN_UID 500 #define SECURELVE_MIN_UID_FILENAME "/etc/cagefs/cagefs.min.uid" #define HOME_REGEX_FILE "/etc/cagefs/cagefs.base.home.dirs" #define DISABLE_HOME_DIRS_SEARCH "/etc/cagefs/disable.home.dirs.search" #define DEV_SHM_OPTIONS "/etc/cagefs/dev.shm.options" /* Max count of regular expressions */ #define MAX_REXPS 100 #define DISABLE_ETCFS "/etc/cagefs/etc.safe/disable.etcfs" #define PGSQL_SOCKET_CFG "/usr/share/cagefs/pgsql.socket.name" #define MYSQL_SOCKET_CFG "/usr/share/cagefs/mysql.socket.name" #define CL_SOLO "/etc/cloudlinux-edition-solo" #define CL_CONTAINER "/etc/cloudlinux-container" #define FEATURE_AVAIL_FLAG_DISABLE_RESTRICT_CAPS "/opt/cloudlinux/flags/available-flags.d/disable-cagefs-restricted-caps.flag" #define FEATURE_ENABLE_FLAG_DISABLE_RESTRICT_CAPS "/opt/cloudlinux/flags/enabled-flags.d/disable-cagefs-restricted-caps.flag" #define FEATURE_AVAIL_FLAG_DISABLE_NO_NEW_PRIVS "/opt/cloudlinux/flags/available-flags.d/disable-cagefs-no-new-privs.flag" #define FEATURE_ENABLE_FLAG_DISABLE_NO_NEW_PRIVS "/opt/cloudlinux/flags/enabled-flags.d/disable-cagefs-no-new-privs.flag" /* Function reads MIN UID value from file Returns -1 if error has occured */ int read_min_uid(unsigned int *min_uid, char *error_str); /** * puts user in CageFS (jail) * return 1 if succesful, -1 if error, 0 if CageFS is disabled */ int jail(struct passwd *pw, char * error_str); int lve_jail(struct passwd *pw, char * error_str); int lve_jail_uid(struct passwd *pw, unsigned int min_uid, char *error_str); /** * A variant of the 'jail' function, but with additional enhancements: * - allows LVE ID an to be passed as an argument, i.e. not be equal to user's UID. * - allows flags to be passed to modify the behavior of the jail. */ int jail_enhanced(struct passwd * pw, uint32_t lve_id, uint32_t flags, char *error_str); /** * setup namespace for CageFS (jail) * return 1 if succesful, -1 if error, 0 if CageFS is disabled */ int lve_namespace_setup(uint32_t lve_id); /* mount personal user's directories in CageFS */ int mount_jail(const char *homedir, const char *username, const char *basedir, const char *jaildir, char *error_str, uid_t uid, gid_t gid); /* helper function to strip slash in the end of path */ void strip_slash(char *str); // Returns zero on success, or -1 if an error occurred int make_dir(const char *target, mode_t mode, int make_parents, char *error_str); int print_error(char *str, int err, const char *format, ...); #endif lve/lve-type.h 0000644 00000004724 15063602062 0007257 0 ustar 00 #ifndef _LVE_TYPE_H_ #define _LVE_TYPE_H_ #include <unistd.h> #include <stdint.h> #include <stdbool.h> enum liblve_enter_flags { LVE_NO_UBC = 1 << 0, LVE_NO_NAMESPACE = 1 << 1, LVE_NO_MAXENTER = 1 << 2, LVE_SILENCE = 1 << 3, LVE_NO_KILLABLE = 1 << 4, LVE_NO_CPU = 1 << 5, LVE_NO_FREEZER = 1 << 6, }; enum liblve_ve_flags { LVE_VE_DISABLE = 1 << 0, /* disable to enter to that ve */ }; enum liblve_ve_fails { LVE_FAIL_MEM = 1 << 0, /**< memory limit reached */ LVE_FAIL_MEM_PHY = 1 << 1, /**< physical memory limit reached */ LVE_FAIL_NPROC = 1 << 2, /**< number of processes limit reached */ }; enum liblve_global_params { LVEGP_SYMLINK_PROTECTION = 1, LVEGP_HARDLINK_PROTECTION, LVEGP_HANDLE_SYMLINK_OWNER, LVEGP_SYMLINK_OWNER_GID, LVEGP_SYMLINK_PROT_ALLOW_GID, LVEGP_HARDLINK_PROT_ALLOW_GID, LVEGP_GLOBAL_NONROOT, LVEGP_XFS_QUOTA_CAP_RES_BYPASS, LVEGP_PROC_CAN_SEE_OTHER_UID, LVEGP_PROC_SUPER_GID, LVEGP_PTRACE_ENABLED, LVEGP_PTRACE_SELF_ENABLED, LVEGP_GRACE_PERIOD = 125, }; /** * Flag indicating that ls_cpu stores hi resolution limit, used only for * lve_setup_enter. */ #define LIBLVE_SETTINGS_LS_CPU_HIRES (1<<31) struct liblve_settings { int32_t ls_cpu; /** < cpu power aka rate */ int32_t ls_cpus; /** < number vcpus */ int32_t ls_io; /** < io limit */ int32_t ls_enters; /** < enter limit */ int32_t ls_memory; /** < mem limit */ int32_t ls_cpu_weight; int32_t ls_memory_phy; /** < phy mem limit */ int32_t ls_nproc; /* number processes */ int32_t ls_iops; /* number of iops */ }; struct liblve_info { struct liblve_settings li_set; /* if it's put on top we have binary compatible with old versions */ enum liblve_ve_flags li_flags; }; struct liblve_pid_info { uint32_t id; /* lve id of the task */ uint32_t flags; /* flags task entered lve with */ bool leader; /* is lve leader */ }; struct liblve_net_port { uint16_t port; /* port, 0 - change a lve policy itself */ bool permit; /* permit/forbid port binding */ }; struct liblve_net_limits { uint64_t in_lim; /* input trafic limit */ uint64_t out_lim; /* output trafic limit */ }; enum liblve_freezer_ops { LVE_FREEZER_FREEZE, LVE_FREEZER_THAW, }; struct liblve_freezer_control { uint16_t op; }; enum lvp_set_type { LVP_SETUP_SELF, LVP_SETUP_DEFAULT, }; typedef void *(*liblve_alloc)(size_t size); typedef void (*liblve_free)(void *ptr); enum jail_flags { JAIL_DROP_CAPS = 1 << 0, JAIL_NO_NEW_PRIVS = 1 << 1, }; #endif lve/secureio.h 0000644 00000004636 15063602062 0007332 0 ustar 00 // Secure I/O and filesystem operations #ifndef _SECUREIO_H_ #define _SECUREIO_H_ #include <sys/types.h> #define SECUREIO_BUFSIZE 8192 // Writes absolute path pointed by descriptor fd to buffer *buf // Returns buf if successful // Returns NULL if error has occured char *get_path_from_descriptor(int fd, char *buf); // Returns 1 if subdir is subdirectory of dir, 0 otherwise int is_subdir(const char *dir, const char *subdir); // Opens path for reading not following symlinks and verifies that opened path is inside parent_path // Returns: // descriptor if successful // -1 if path does not exist or is a symlink // -2 if opened path is NOT inside parent_path or cannot be determined int open_not_symlink(const char *path, const char *parent_path); // Closes descriptor (if it is > 0) void closefd(int fd); // Tries to read first directory entry in order to ensure that descriptor is valid // Returns 0 if reading succeeded or -1 if error has occured int check_dir(int fd); // Checks if path is a directory (in secure manner) // Also opens path (if descriptor fd == -1) and then checks that opened path is inside parent_path // Returns descriptor if path refers to directory // Returns -1 if path does not exist or is not a directory // Returns -2 if opened path is NOT inside parent_path or cannot be determined int isdir(const char *path, int fd, const char *parent_path); // Sets permissions to directory (in secure manner) // Returns descriptor if successful // Returns -1 if error has occured // Returns -2 if opened path is NOT inside parent_path or cannot be determined int set_perm_dir_secure(const char *path, mode_t perm, int fd, const char *parent_path); // Sets owner and group of directory (in secure manner) // Returns descriptor if successful // Returns -1 if error has occured // Returns -2 if opened path is NOT inside parent_path or cannot be determined int set_owner_dir_secure(const char *path, uid_t uid, gid_t gid, int fd, const char *parent_path); // Creates directory if it does not exist, sets permissions/owner otherwise // Returns descriptor if successful // Returns -1 if error has occured int create_dir_secure(const char *path, mode_t perm, uid_t uid, gid_t gid, int fd, const char *parent_path); // Recursive directory creation function // Returns 0 if successful // Returns -1 if error has occured int makedirs_secure(const char *path, mode_t perm, uid_t uid, gid_t gid, const char *parent_path); #endif lve/setcap.h 0000644 00000000740 15063602062 0006763 0 ustar 00 /* Library to set needed capabilities for current process */ #ifndef _SETCAP_H_ #define _SETCAP_H_ #include <sys/types.h> // Switch on CAP_SYS_RESOURCE capabality to switch off disk quotas checking // // Returns 0 if successful // Returns -1 if error has occured int enable_quota_capability(); // Switch off CAP_SYS_RESOURCE capabality to switch off disk quotas checking // // Returns 0 if successful // Returns -1 if error has occured int disable_quota_capability(); #endif arpa/ftp.h 0000644 00000006550 15063602062 0006437 0 ustar 00 /* * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ftp.h 8.1 (Berkeley) 6/2/93 */ #ifndef _ARPA_FTP_H #define _ARPA_FTP_H 1 /* Definitions for FTP; see RFC-765. */ /* * Reply codes. */ #define PRELIM 1 /* positive preliminary */ #define COMPLETE 2 /* positive completion */ #define CONTINUE 3 /* positive intermediate */ #define TRANSIENT 4 /* transient negative completion */ #define ERROR 5 /* permanent negative completion */ /* * Type codes */ #define TYPE_A 1 /* ASCII */ #define TYPE_E 2 /* EBCDIC */ #define TYPE_I 3 /* image */ #define TYPE_L 4 /* local byte size */ #ifdef FTP_NAMES char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; #endif /* * Form codes */ #define FORM_N 1 /* non-print */ #define FORM_T 2 /* telnet format effectors */ #define FORM_C 3 /* carriage control (ASA) */ #ifdef FTP_NAMES char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; #endif /* * Structure codes */ #define STRU_F 1 /* file (no record structure) */ #define STRU_R 2 /* record structure */ #define STRU_P 3 /* page structure */ #ifdef FTP_NAMES char *strunames[] = {"0", "File", "Record", "Page" }; #endif /* * Mode types */ #define MODE_S 1 /* stream */ #define MODE_B 2 /* block */ #define MODE_C 3 /* compressed */ #ifdef FTP_NAMES char *modenames[] = {"0", "Stream", "Block", "Compressed" }; #endif /* * Record Tokens */ #define REC_ESC '\377' /* Record-mode Escape */ #define REC_EOR '\001' /* Record-mode End-of-Record */ #define REC_EOF '\002' /* Record-mode End-of-File */ /* * Block Header */ #define BLK_EOR 0x80 /* Block is End-of-Record */ #define BLK_EOF 0x40 /* Block is End-of-File */ #define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ #define BLK_RESTART 0x10 /* Block is Restart Marker */ #define BLK_BYTECOUNT 2 /* Bytes in this block */ #endif /* arpa/ftp.h */ arpa/inet.h 0000644 00000010264 15063602062 0006602 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ARPA_INET_H #define _ARPA_INET_H 1 #include <features.h> #include <netinet/in.h> /* To define `struct in_addr'. */ /* Type for length arguments in socket calls. */ #ifndef __socklen_t_defined typedef __socklen_t socklen_t; # define __socklen_t_defined #endif __BEGIN_DECLS /* Convert Internet host address from numbers-and-dots notation in CP into binary data in network byte order. */ extern in_addr_t inet_addr (const char *__cp) __THROW; /* Return the local host address part of the Internet address in IN. */ extern in_addr_t inet_lnaof (struct in_addr __in) __THROW; /* Make Internet host address in network byte order by combining the network number NET with the local address HOST. */ extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host) __THROW; /* Return network number part of the Internet address IN. */ extern in_addr_t inet_netof (struct in_addr __in) __THROW; /* Extract the network number in network byte order from the address in numbers-and-dots natation starting at CP. */ extern in_addr_t inet_network (const char *__cp) __THROW; /* Convert Internet number in IN to ASCII representation. The return value is a pointer to an internal array containing the string. */ extern char *inet_ntoa (struct in_addr __in) __THROW; /* Convert from presentation format of an Internet number in buffer starting at CP to the binary network format and store result for interface type AF in buffer starting at BUF. */ extern int inet_pton (int __af, const char *__restrict __cp, void *__restrict __buf) __THROW; /* Convert a Internet address in binary network format for interface type AF in buffer starting at CP to presentation form and place result in buffer of length LEN astarting at BUF. */ extern const char *inet_ntop (int __af, const void *__restrict __cp, char *__restrict __buf, socklen_t __len) __THROW; /* The following functions are not part of XNS 5.2. */ #ifdef __USE_MISC /* Convert Internet host address from numbers-and-dots notation in CP into binary data and store the result in the structure INP. */ extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW; /* Format a network number NET into presentation format and place result in buffer starting at BUF with length of LEN bytes. */ extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW; /* Convert network number for interface type AF in buffer starting at CP to presentation format. The result will specifiy BITS bits of the number. */ extern char *inet_net_ntop (int __af, const void *__cp, int __bits, char *__buf, size_t __len) __THROW; /* Convert network number for interface type AF from presentation in buffer starting at CP to network format and store result int buffer starting at BUF of size LEN. */ extern int inet_net_pton (int __af, const char *__cp, void *__buf, size_t __len) __THROW; /* Convert ASCII representation in hexadecimal form of the Internet address to binary form and place result in buffer of length LEN starting at BUF. */ extern unsigned int inet_nsap_addr (const char *__cp, unsigned char *__buf, int __len) __THROW; /* Convert internet address in binary form in LEN bytes starting at CP a presentation form and place result in BUF. */ extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp, char *__buf) __THROW; #endif __END_DECLS #endif /* arpa/inet.h */ arpa/nameser.h 0000644 00000033563 15063602062 0007304 0 ustar 00 /* * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #ifndef _ARPA_NAMESER_H_ #define _ARPA_NAMESER_H_ #include <sys/param.h> #include <sys/types.h> #include <stdint.h> /* * Define constants based on RFC 883, RFC 1034, RFC 1035 */ #define NS_PACKETSZ 512 /*%< default UDP packet size */ #define NS_MAXDNAME 1025 /*%< maximum domain name */ #define NS_MAXMSG 65535 /*%< maximum message size */ #define NS_MAXCDNAME 255 /*%< maximum compressed domain name */ #define NS_MAXLABEL 63 /*%< maximum length of domain label */ #define NS_HFIXEDSZ 12 /*%< #/bytes of fixed data in header */ #define NS_QFIXEDSZ 4 /*%< #/bytes of fixed data in query */ #define NS_RRFIXEDSZ 10 /*%< #/bytes of fixed data in r record */ #define NS_INT32SZ 4 /*%< #/bytes of data in a uint32_t */ #define NS_INT16SZ 2 /*%< #/bytes of data in a uint16_t */ #define NS_INT8SZ 1 /*%< #/bytes of data in a uint8_t */ #define NS_INADDRSZ 4 /*%< IPv4 T_A */ #define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */ #define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */ #define NS_DEFAULTPORT 53 /*%< For both TCP and UDP. */ /* * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() * in synch with it. */ typedef enum __ns_sect { ns_s_qd = 0, /*%< Query: Question. */ ns_s_zn = 0, /*%< Update: Zone. */ ns_s_an = 1, /*%< Query: Answer. */ ns_s_pr = 1, /*%< Update: Prerequisites. */ ns_s_ns = 2, /*%< Query: Name servers. */ ns_s_ud = 2, /*%< Update: Update. */ ns_s_ar = 3, /*%< Query|Update: Additional records. */ ns_s_max = 4 } ns_sect; /*% * This is a message handle. It is caller allocated and has no dynamic data. * This structure is intended to be opaque to all but ns_parse.c, thus the * leading _'s on the member names. Use the accessor functions, not the _'s. */ typedef struct __ns_msg { const unsigned char *_msg, *_eom; uint16_t _id, _flags, _counts[ns_s_max]; const unsigned char *_sections[ns_s_max]; ns_sect _sect; int _rrnum; const unsigned char *_msg_ptr; } ns_msg; /* Private data structure - do not use from outside library. */ struct _ns_flagdata { int mask, shift; }; extern const struct _ns_flagdata _ns_flagdata[]; /* Accessor macros - this is part of the public interface. */ #define ns_msg_id(handle) ((handle)._id + 0) #define ns_msg_base(handle) ((handle)._msg + 0) #define ns_msg_end(handle) ((handle)._eom + 0) #define ns_msg_size(handle) ((handle)._eom - (handle)._msg) #define ns_msg_count(handle, section) ((handle)._counts[section] + 0) /*% * This is a parsed record. It is caller allocated and has no dynamic data. */ typedef struct __ns_rr { char name[NS_MAXDNAME]; uint16_t type; uint16_t rr_class; uint32_t ttl; uint16_t rdlength; const unsigned char * rdata; } ns_rr; /* Accessor macros - this is part of the public interface. */ #define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") #define ns_rr_type(rr) ((ns_type)((rr).type + 0)) #define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) #define ns_rr_ttl(rr) ((rr).ttl + 0) #define ns_rr_rdlen(rr) ((rr).rdlength + 0) #define ns_rr_rdata(rr) ((rr).rdata + 0) /*% * These don't have to be in the same order as in the packet flags word, * and they can even overlap in some cases, but they will need to be kept * in synch with ns_parse.c:ns_flagdata[]. */ typedef enum __ns_flag { ns_f_qr, /*%< Question/Response. */ ns_f_opcode, /*%< Operation code. */ ns_f_aa, /*%< Authoritative Answer. */ ns_f_tc, /*%< Truncation occurred. */ ns_f_rd, /*%< Recursion Desired. */ ns_f_ra, /*%< Recursion Available. */ ns_f_z, /*%< MBZ. */ ns_f_ad, /*%< Authentic Data (DNSSEC). */ ns_f_cd, /*%< Checking Disabled (DNSSEC). */ ns_f_rcode, /*%< Response code. */ ns_f_max } ns_flag; /*% * Currently defined opcodes. */ typedef enum __ns_opcode { ns_o_query = 0, /*%< Standard query. */ ns_o_iquery = 1, /*%< Inverse query (deprecated/unsupported). */ ns_o_status = 2, /*%< Name server status query (unsupported). */ /* Opcode 3 is undefined/reserved. */ ns_o_notify = 4, /*%< Zone change notification. */ ns_o_update = 5, /*%< Zone update message. */ ns_o_max = 6 } ns_opcode; /*% * Currently defined response codes. */ typedef enum __ns_rcode { ns_r_noerror = 0, /*%< No error occurred. */ ns_r_formerr = 1, /*%< Format error. */ ns_r_servfail = 2, /*%< Server failure. */ ns_r_nxdomain = 3, /*%< Name error. */ ns_r_notimpl = 4, /*%< Unimplemented. */ ns_r_refused = 5, /*%< Operation refused. */ /* these are for BIND_UPDATE */ ns_r_yxdomain = 6, /*%< Name exists */ ns_r_yxrrset = 7, /*%< RRset exists */ ns_r_nxrrset = 8, /*%< RRset does not exist */ ns_r_notauth = 9, /*%< Not authoritative for zone */ ns_r_notzone = 10, /*%< Zone of record different from zone section */ ns_r_max = 11, /* The following are EDNS extended rcodes */ ns_r_badvers = 16, /* The following are TSIG errors */ ns_r_badsig = 16, ns_r_badkey = 17, ns_r_badtime = 18 } ns_rcode; /* BIND_UPDATE */ typedef enum __ns_update_operation { ns_uop_delete = 0, ns_uop_add = 1, ns_uop_max = 2 } ns_update_operation; /*% * This structure is used for TSIG authenticated messages */ struct ns_tsig_key { char name[NS_MAXDNAME], alg[NS_MAXDNAME]; unsigned char *data; int len; }; typedef struct ns_tsig_key ns_tsig_key; /*% * This structure is used for TSIG authenticated TCP messages */ struct ns_tcp_tsig_state { int counter; struct dst_key *key; void *ctx; unsigned char sig[NS_PACKETSZ]; int siglen; }; typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; #define NS_TSIG_FUDGE 300 #define NS_TSIG_TCP_COUNT 100 #define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" #define NS_TSIG_ERROR_NO_TSIG -10 #define NS_TSIG_ERROR_NO_SPACE -11 #define NS_TSIG_ERROR_FORMERR -12 /*% * Currently defined type values for resources and queries. */ typedef enum __ns_type { ns_t_invalid = 0, ns_t_a = 1, ns_t_ns = 2, ns_t_md = 3, ns_t_mf = 4, ns_t_cname = 5, ns_t_soa = 6, ns_t_mb = 7, ns_t_mg = 8, ns_t_mr = 9, ns_t_null = 10, ns_t_wks = 11, ns_t_ptr = 12, ns_t_hinfo = 13, ns_t_minfo = 14, ns_t_mx = 15, ns_t_txt = 16, ns_t_rp = 17, ns_t_afsdb = 18, ns_t_x25 = 19, ns_t_isdn = 20, ns_t_rt = 21, ns_t_nsap = 22, ns_t_nsap_ptr = 23, ns_t_sig = 24, ns_t_key = 25, ns_t_px = 26, ns_t_gpos = 27, ns_t_aaaa = 28, ns_t_loc = 29, ns_t_nxt = 30, ns_t_eid = 31, ns_t_nimloc = 32, ns_t_srv = 33, ns_t_atma = 34, ns_t_naptr = 35, ns_t_kx = 36, ns_t_cert = 37, ns_t_a6 = 38, ns_t_dname = 39, ns_t_sink = 40, ns_t_opt = 41, ns_t_apl = 42, ns_t_ds = 43, ns_t_sshfp = 44, ns_t_ipseckey = 45, ns_t_rrsig = 46, ns_t_nsec = 47, ns_t_dnskey = 48, ns_t_dhcid = 49, ns_t_nsec3 = 50, ns_t_nsec3param = 51, ns_t_tlsa = 52, ns_t_smimea = 53, ns_t_hip = 55, ns_t_ninfo = 56, ns_t_rkey = 57, ns_t_talink = 58, ns_t_cds = 59, ns_t_cdnskey = 60, ns_t_openpgpkey = 61, ns_t_csync = 62, ns_t_spf = 99, ns_t_uinfo = 100, ns_t_uid = 101, ns_t_gid = 102, ns_t_unspec = 103, ns_t_nid = 104, ns_t_l32 = 105, ns_t_l64 = 106, ns_t_lp = 107, ns_t_eui48 = 108, ns_t_eui64 = 109, ns_t_tkey = 249, ns_t_tsig = 250, ns_t_ixfr = 251, ns_t_axfr = 252, ns_t_mailb = 253, ns_t_maila = 254, ns_t_any = 255, ns_t_uri = 256, ns_t_caa = 257, ns_t_avc = 258, ns_t_ta = 32768, ns_t_dlv = 32769, ns_t_max = 65536 } ns_type; /*% * Values for class field */ typedef enum __ns_class { ns_c_invalid = 0, /*%< Cookie. */ ns_c_in = 1, /*%< Internet. */ ns_c_2 = 2, /*%< unallocated/unsupported. */ ns_c_chaos = 3, /*%< MIT Chaos-net. */ ns_c_hs = 4, /*%< MIT Hesiod. */ /* Query class values which do not appear in resource records */ ns_c_none = 254, /*%< for prereq. sections in update requests */ ns_c_any = 255, /*%< Wildcard match. */ ns_c_max = 65536 } ns_class; /* Certificate type values in CERT resource records. */ typedef enum __ns_cert_types { cert_t_pkix = 1, /*%< PKIX (X.509v3) */ cert_t_spki = 2, /*%< SPKI */ cert_t_pgp = 3, /*%< PGP */ cert_t_url = 253, /*%< URL private type */ cert_t_oid = 254 /*%< OID private type */ } ns_cert_types; /*% * EDNS0 extended flags and option codes, host order. */ #define NS_OPT_DNSSEC_OK 0x8000U #define NS_OPT_NSID 3 /*% * Inline versions of get/put short/long. Pointer is advanced. */ #define NS_GET16(s, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ (s) = ((uint16_t)t_cp[0] << 8) \ | ((uint16_t)t_cp[1]) \ ; \ (cp) += NS_INT16SZ; \ } while (0) #define NS_GET32(l, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ (l) = ((uint32_t)t_cp[0] << 24) \ | ((uint32_t)t_cp[1] << 16) \ | ((uint32_t)t_cp[2] << 8) \ | ((uint32_t)t_cp[3]) \ ; \ (cp) += NS_INT32SZ; \ } while (0) #define NS_PUT16(s, cp) do { \ uint16_t t_s = (uint16_t)(s); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ (cp) += NS_INT16SZ; \ } while (0) #define NS_PUT32(l, cp) do { \ uint32_t t_l = (uint32_t)(l); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ *t_cp++ = t_l >> 8; \ *t_cp = t_l; \ (cp) += NS_INT32SZ; \ } while (0) __BEGIN_DECLS int ns_msg_getflag (ns_msg, int) __THROW; unsigned int ns_get16 (const unsigned char *) __THROW; unsigned long ns_get32 (const unsigned char *) __THROW; void ns_put16 (unsigned int, unsigned char *) __THROW; void ns_put32 (unsigned long, unsigned char *) __THROW; int ns_initparse (const unsigned char *, int, ns_msg *) __THROW; int ns_skiprr (const unsigned char *, const unsigned char *, ns_sect, int) __THROW; int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW; int ns_sprintrr (const ns_msg *, const ns_rr *, const char *, const char *, char *, size_t) __THROW; int ns_sprintrrf (const unsigned char *, size_t, const char *, ns_class, ns_type, unsigned long, const unsigned char *, size_t, const char *, const char *, char *, size_t) __THROW; int ns_format_ttl (unsigned long, char *, size_t) __THROW; int ns_parse_ttl (const char *, unsigned long *) __THROW; uint32_t ns_datetosecs (const char *, int *) __THROW; int ns_name_ntol (const unsigned char *, unsigned char *, size_t) __THROW; int ns_name_ntop (const unsigned char *, char *, size_t) __THROW; int ns_name_pton (const char *, unsigned char *, size_t) __THROW; int ns_name_unpack (const unsigned char *, const unsigned char *, const unsigned char *, unsigned char *, size_t) __THROW; int ns_name_pack (const unsigned char *, unsigned char *, int, const unsigned char **, const unsigned char **) __THROW; int ns_name_uncompress (const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t) __THROW; int ns_name_compress (const char *, unsigned char *, size_t, const unsigned char **, const unsigned char **) __THROW; int ns_name_skip (const unsigned char **, const unsigned char *) __THROW; void ns_name_rollback (const unsigned char *, const unsigned char **, const unsigned char **) __THROW; int ns_samedomain (const char *, const char *) __THROW; int ns_subdomain (const char *, const char *) __THROW; int ns_makecanon (const char *, char *, size_t) __THROW; int ns_samename (const char *, const char *) __THROW; __END_DECLS #include <arpa/nameser_compat.h> #endif /* !_ARPA_NAMESER_H_ */ /*! \file */ arpa/nameser_compat.h 0000644 00000015601 15063602062 0010640 0 ustar 00 /* Copyright (c) 1983, 1989 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _ARPA_NAMESER_COMPAT_ #define _ARPA_NAMESER_COMPAT_ #include <endian.h> /*% * Structure for query header. The order of the fields is machine- and * compiler-dependent, depending on the byte/bit order and the layout * of bit fields. We use bit fields only in int variables, as this * is all ANSI requires. This requires a somewhat confusing rearrangement. */ typedef struct { unsigned id :16; /*%< query identification number */ #if __BYTE_ORDER == __BIG_ENDIAN /* fields in third byte */ unsigned qr: 1; /*%< response flag */ unsigned opcode: 4; /*%< purpose of message */ unsigned aa: 1; /*%< authoritive answer */ unsigned tc: 1; /*%< truncated message */ unsigned rd: 1; /*%< recursion desired */ /* fields in fourth byte */ unsigned ra: 1; /*%< recursion available */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ad: 1; /*%< authentic data from named */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned rcode :4; /*%< response code */ #endif #if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN /* fields in third byte */ unsigned rd :1; /*%< recursion desired */ unsigned tc :1; /*%< truncated message */ unsigned aa :1; /*%< authoritive answer */ unsigned opcode :4; /*%< purpose of message */ unsigned qr :1; /*%< response flag */ /* fields in fourth byte */ unsigned rcode :4; /*%< response code */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned ad: 1; /*%< authentic data from named */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ra :1; /*%< recursion available */ #endif /* remaining bytes */ unsigned qdcount :16; /*%< number of question entries */ unsigned ancount :16; /*%< number of answer entries */ unsigned nscount :16; /*%< number of authority entries */ unsigned arcount :16; /*%< number of resource entries */ } HEADER; #define PACKETSZ NS_PACKETSZ #define MAXDNAME NS_MAXDNAME #define MAXCDNAME NS_MAXCDNAME #define MAXLABEL NS_MAXLABEL #define HFIXEDSZ NS_HFIXEDSZ #define QFIXEDSZ NS_QFIXEDSZ #define RRFIXEDSZ NS_RRFIXEDSZ #define INT32SZ NS_INT32SZ #define INT16SZ NS_INT16SZ #define INT8SZ NS_INT8SZ #define INADDRSZ NS_INADDRSZ #define IN6ADDRSZ NS_IN6ADDRSZ #define INDIR_MASK NS_CMPRSFLGS #define NAMESERVER_PORT NS_DEFAULTPORT #define S_ZONE ns_s_zn #define S_PREREQ ns_s_pr #define S_UPDATE ns_s_ud #define S_ADDT ns_s_ar #define QUERY ns_o_query #define IQUERY ns_o_iquery #define STATUS ns_o_status #define NS_NOTIFY_OP ns_o_notify #define NS_UPDATE_OP ns_o_update #define NOERROR ns_r_noerror #define FORMERR ns_r_formerr #define SERVFAIL ns_r_servfail #define NXDOMAIN ns_r_nxdomain #define NOTIMP ns_r_notimpl #define REFUSED ns_r_refused #define YXDOMAIN ns_r_yxdomain #define YXRRSET ns_r_yxrrset #define NXRRSET ns_r_nxrrset #define NOTAUTH ns_r_notauth #define NOTZONE ns_r_notzone /*#define BADSIG ns_r_badsig*/ /*#define BADKEY ns_r_badkey*/ /*#define BADTIME ns_r_badtime*/ #define DELETE ns_uop_delete #define ADD ns_uop_add #define T_A ns_t_a #define T_NS ns_t_ns #define T_MD ns_t_md #define T_MF ns_t_mf #define T_CNAME ns_t_cname #define T_SOA ns_t_soa #define T_MB ns_t_mb #define T_MG ns_t_mg #define T_MR ns_t_mr #define T_NULL ns_t_null #define T_WKS ns_t_wks #define T_PTR ns_t_ptr #define T_HINFO ns_t_hinfo #define T_MINFO ns_t_minfo #define T_MX ns_t_mx #define T_TXT ns_t_txt #define T_RP ns_t_rp #define T_AFSDB ns_t_afsdb #define T_X25 ns_t_x25 #define T_ISDN ns_t_isdn #define T_RT ns_t_rt #define T_NSAP ns_t_nsap #define T_NSAP_PTR ns_t_nsap_ptr #define T_SIG ns_t_sig #define T_KEY ns_t_key #define T_PX ns_t_px #define T_GPOS ns_t_gpos #define T_AAAA ns_t_aaaa #define T_LOC ns_t_loc #define T_NXT ns_t_nxt #define T_EID ns_t_eid #define T_NIMLOC ns_t_nimloc #define T_SRV ns_t_srv #define T_ATMA ns_t_atma #define T_NAPTR ns_t_naptr #define T_KX ns_t_kx #define T_CERT ns_t_cert #define T_A6 ns_t_a6 #define T_DNAME ns_t_dname #define T_SINK ns_t_sink #define T_OPT ns_t_opt #define T_APL ns_t_apl #define T_DS ns_t_ds #define T_SSHFP ns_t_sshfp #define T_IPSECKEY ns_t_ipseckey #define T_RRSIG ns_t_rrsig #define T_NSEC ns_t_nsec #define T_DNSKEY ns_t_dnskey #define T_DHCID ns_t_dhcid #define T_NSEC3 ns_t_nsec3 #define T_NSEC3PARAM ns_t_nsec3param #define T_TLSA ns_t_tlsa #define T_SMIMEA ns_t_smimea #define T_HIP ns_t_hip #define T_NINFO ns_t_ninfo #define T_RKEY ns_t_rkey #define T_TALINK ns_t_talink #define T_CDS ns_t_cds #define T_CDNSKEY ns_t_cdnskey #define T_OPENPGPKEY ns_t_openpgpkey #define T_CSYNC ns_t_csync #define T_SPF ns_t_spf #define T_UINFO ns_t_uinfo #define T_UID ns_t_uid #define T_GID ns_t_gid #define T_UNSPEC ns_t_unspec #define T_NID ns_t_nid #define T_L32 ns_t_l32 #define T_L64 ns_t_l64 #define T_LP ns_t_lp #define T_EUI48 ns_t_eui48 #define T_EUI64 ns_t_eui64 #define T_TKEY ns_t_tkey #define T_TSIG ns_t_tsig #define T_IXFR ns_t_ixfr #define T_AXFR ns_t_axfr #define T_MAILB ns_t_mailb #define T_MAILA ns_t_maila #define T_ANY ns_t_any #define T_URI ns_t_uri #define T_CAA ns_t_caa #define T_AVC ns_t_avc #define T_TA ns_t_ta #define T_DLV ns_t_dlv #define C_IN ns_c_in #define C_CHAOS ns_c_chaos #define C_HS ns_c_hs /* BIND_UPDATE */ #define C_NONE ns_c_none #define C_ANY ns_c_any #define GETSHORT NS_GET16 #define GETLONG NS_GET32 #define PUTSHORT NS_PUT16 #define PUTLONG NS_PUT32 #endif /* _ARPA_NAMESER_COMPAT_ */ /*! \file */ arpa/telnet.h 0000644 00000024027 15063602062 0007140 0 ustar 00 /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)telnet.h 8.2 (Berkeley) 12/15/93 */ #ifndef _ARPA_TELNET_H #define _ARPA_TELNET_H 1 /* * Definitions for the TELNET protocol. */ #define IAC 255 /* interpret as command: */ #define DONT 254 /* you are not to use option */ #define DO 253 /* please, you use option */ #define WONT 252 /* I won't use option */ #define WILL 251 /* I will use option */ #define SB 250 /* interpret as subnegotiation */ #define GA 249 /* you may reverse the line */ #define EL 248 /* erase the current line */ #define EC 247 /* erase the current character */ #define AYT 246 /* are you there */ #define AO 245 /* abort output--but let prog finish */ #define IP 244 /* interrupt process--permanently */ #define BREAK 243 /* break */ #define DM 242 /* data mark--for connect. cleaning */ #define NOP 241 /* nop */ #define SE 240 /* end sub negotiation */ #define EOR 239 /* end of record (transparent mode) */ #define ABORT 238 /* Abort process */ #define SUSP 237 /* Suspend process */ #define xEOF 236 /* End of file: EOF is already used... */ #define SYNCH 242 /* for telfunc calls */ #ifdef TELCMDS char *telcmds[] = { "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, }; #else extern char *telcmds[]; #endif #define TELCMD_FIRST xEOF #define TELCMD_LAST IAC #define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ (unsigned int)(x) >= TELCMD_FIRST) #define TELCMD(x) telcmds[(x)-TELCMD_FIRST] /* telnet options */ #define TELOPT_BINARY 0 /* 8-bit data path */ #define TELOPT_ECHO 1 /* echo */ #define TELOPT_RCP 2 /* prepare to reconnect */ #define TELOPT_SGA 3 /* suppress go ahead */ #define TELOPT_NAMS 4 /* approximate message size */ #define TELOPT_STATUS 5 /* give status */ #define TELOPT_TM 6 /* timing mark */ #define TELOPT_RCTE 7 /* remote controlled transmission and echo */ #define TELOPT_NAOL 8 /* negotiate about output line width */ #define TELOPT_NAOP 9 /* negotiate about output page size */ #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ #define TELOPT_XASCII 17 /* extended ascii character set */ #define TELOPT_LOGOUT 18 /* force logout */ #define TELOPT_BM 19 /* byte macro */ #define TELOPT_DET 20 /* data entry terminal */ #define TELOPT_SUPDUP 21 /* supdup protocol */ #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ #define TELOPT_SNDLOC 23 /* send location */ #define TELOPT_TTYPE 24 /* terminal type */ #define TELOPT_EOR 25 /* end or record */ #define TELOPT_TUID 26 /* TACACS user identification */ #define TELOPT_OUTMRK 27 /* output marking */ #define TELOPT_TTYLOC 28 /* terminal location number */ #define TELOPT_3270REGIME 29 /* 3270 regime */ #define TELOPT_X3PAD 30 /* X.3 PAD */ #define TELOPT_NAWS 31 /* window size */ #define TELOPT_TSPEED 32 /* terminal speed */ #define TELOPT_LFLOW 33 /* remote flow control */ #define TELOPT_LINEMODE 34 /* Linemode option */ #define TELOPT_XDISPLOC 35 /* X Display Location */ #define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ #define TELOPT_AUTHENTICATION 37/* Authenticate */ #define TELOPT_ENCRYPT 38 /* Encryption option */ #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ #define TELOPT_EXOPL 255 /* extended-options-list */ #define NTELOPTS (1+TELOPT_NEW_ENVIRON) #ifdef TELOPTS char *telopts[NTELOPTS+1] = { "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON", 0, }; #define TELOPT_FIRST TELOPT_BINARY #define TELOPT_LAST TELOPT_NEW_ENVIRON #define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) #define TELOPT(x) telopts[(x)-TELOPT_FIRST] #endif /* sub-option qualifiers */ #define TELQUAL_IS 0 /* option is... */ #define TELQUAL_SEND 1 /* send option */ #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ #define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ #define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ #define LFLOW_OFF 0 /* Disable remote flow control */ #define LFLOW_ON 1 /* Enable remote flow control */ #define LFLOW_RESTART_ANY 2 /* Restart output on any char */ #define LFLOW_RESTART_XON 3 /* Restart output only on XON */ /* * LINEMODE suboptions */ #define LM_MODE 1 #define LM_FORWARDMASK 2 #define LM_SLC 3 #define MODE_EDIT 0x01 #define MODE_TRAPSIG 0x02 #define MODE_ACK 0x04 #define MODE_SOFT_TAB 0x08 #define MODE_LIT_ECHO 0x10 #define MODE_MASK 0x1f /* Not part of protocol, but needed to simplify things... */ #define MODE_FLOW 0x0100 #define MODE_ECHO 0x0200 #define MODE_INBIN 0x0400 #define MODE_OUTBIN 0x0800 #define MODE_FORCE 0x1000 #define SLC_SYNCH 1 #define SLC_BRK 2 #define SLC_IP 3 #define SLC_AO 4 #define SLC_AYT 5 #define SLC_EOR 6 #define SLC_ABORT 7 #define SLC_EOF 8 #define SLC_SUSP 9 #define SLC_EC 10 #define SLC_EL 11 #define SLC_EW 12 #define SLC_RP 13 #define SLC_LNEXT 14 #define SLC_XON 15 #define SLC_XOFF 16 #define SLC_FORW1 17 #define SLC_FORW2 18 #define NSLC 18 /* * For backwards compatibility, we define SLC_NAMES to be the * list of names if SLC_NAMES is not defined. */ #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, #ifdef SLC_NAMES char *slc_names[] = { SLC_NAMELIST }; #else extern char *slc_names[]; #define SLC_NAMES SLC_NAMELIST #endif #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) #define SLC_NAME(x) slc_names[x] #define SLC_NOSUPPORT 0 #define SLC_CANTCHANGE 1 #define SLC_VARIABLE 2 #define SLC_DEFAULT 3 #define SLC_LEVELBITS 0x03 #define SLC_FUNC 0 #define SLC_FLAGS 1 #define SLC_VALUE 2 #define SLC_ACK 0x80 #define SLC_FLUSHIN 0x40 #define SLC_FLUSHOUT 0x20 #define OLD_ENV_VAR 1 #define OLD_ENV_VALUE 0 #define NEW_ENV_VAR 0 #define NEW_ENV_VALUE 1 #define ENV_ESC 2 #define ENV_USERVAR 3 /* * AUTHENTICATION suboptions */ /* * Who is authenticating who ... */ #define AUTH_WHO_CLIENT 0 /* Client authenticating server */ #define AUTH_WHO_SERVER 1 /* Server authenticating client */ #define AUTH_WHO_MASK 1 /* * amount of authentication done */ #define AUTH_HOW_ONE_WAY 0 #define AUTH_HOW_MUTUAL 2 #define AUTH_HOW_MASK 2 #define AUTHTYPE_NULL 0 #define AUTHTYPE_KERBEROS_V4 1 #define AUTHTYPE_KERBEROS_V5 2 #define AUTHTYPE_SPX 3 #define AUTHTYPE_MINK 4 #define AUTHTYPE_CNT 5 #define AUTHTYPE_TEST 99 #ifdef AUTH_NAMES char *authtype_names[] = { "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, }; #else extern char *authtype_names[]; #endif #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) #define AUTHTYPE_NAME(x) authtype_names[x] /* * ENCRYPTion suboptions */ #define ENCRYPT_IS 0 /* I pick encryption type ... */ #define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ #define ENCRYPT_REPLY 2 /* Initial setup response */ #define ENCRYPT_START 3 /* Am starting to send encrypted */ #define ENCRYPT_END 4 /* Am ending encrypted */ #define ENCRYPT_REQSTART 5 /* Request you start encrypting */ #define ENCRYPT_REQEND 6 /* Request you send encrypting */ #define ENCRYPT_ENC_KEYID 7 #define ENCRYPT_DEC_KEYID 8 #define ENCRYPT_CNT 9 #define ENCTYPE_ANY 0 #define ENCTYPE_DES_CFB64 1 #define ENCTYPE_DES_OFB64 2 #define ENCTYPE_CNT 3 #ifdef ENCRYPT_NAMES char *encrypt_names[] = { "IS", "SUPPORT", "REPLY", "START", "END", "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", 0, }; char *enctype_names[] = { "ANY", "DES_CFB64", "DES_OFB64", 0, }; #else extern char *encrypt_names[]; extern char *enctype_names[]; #endif #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) #define ENCRYPT_NAME(x) encrypt_names[x] #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) #define ENCTYPE_NAME(x) enctype_names[x] #endif /* arpa/telnet.h */ arpa/tftp.h 0000644 00000005753 15063602062 0006627 0 ustar 00 /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)tftp.h 8.1 (Berkeley) 6/2/93 */ #ifndef _ARPA_TFTP_H #define _ARPA_TFTP_H 1 /* * Trivial File Transfer Protocol (IEN-133) */ #define SEGSIZE 512 /* data segment size */ /* * Packet types. */ #define RRQ 01 /* read request */ #define WRQ 02 /* write request */ #define DATA 03 /* data packet */ #define ACK 04 /* acknowledgement */ #define ERROR 05 /* error code */ struct tftphdr { short th_opcode; /* packet type */ union { char tu_padding[3]; /* sizeof() compat */ struct { union { unsigned short tu_block; /* block # */ short tu_code; /* error code */ } __attribute__ ((__packed__)) th_u3; char tu_data[0]; /* data or error string */ } __attribute__ ((__packed__)) th_u2; char tu_stuff[0]; /* request packet stuff */ } __attribute__ ((__packed__)) th_u1; } __attribute__ ((__packed__)); #define th_block th_u1.th_u2.th_u3.tu_block #define th_code th_u1.th_u2.th_u3.tu_code #define th_stuff th_u1.tu_stuff #define th_data th_u1.th_u2.tu_data #define th_msg th_u1.th_u2.tu_data /* * Error codes. */ #define EUNDEF 0 /* not defined */ #define ENOTFOUND 1 /* file not found */ #define EACCESS 2 /* access violation */ #define ENOSPACE 3 /* disk full or allocation exceeded */ #define EBADOP 4 /* illegal TFTP operation */ #define EBADID 5 /* unknown transfer ID */ #define EEXISTS 6 /* file already exists */ #define ENOUSER 7 /* no such user */ #endif /* arpa/tftp.h */ sepol/cil/cil.h 0000644 00000006645 15063602062 0007370 0 ustar 00 /* * Copyright 2011 Tresys Technology, LLC. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL TRESYS TECHNOLOGY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those * of the authors and should not be interpreted as representing official policies, * either expressed or implied, of Tresys Technology, LLC. */ #ifndef CIL_H_ #define CIL_H_ #include <sepol/policydb/policydb.h> #ifdef __cplusplus extern "C" { #endif struct cil_db; typedef struct cil_db cil_db_t; extern void cil_db_init(cil_db_t **db); extern void cil_db_destroy(cil_db_t **db); extern int cil_add_file(cil_db_t *db, char *name, char *data, size_t size); extern int cil_compile(cil_db_t *db); extern int cil_build_policydb(cil_db_t *db, sepol_policydb_t **sepol_db); extern int cil_userprefixes_to_string(cil_db_t *db, char **out, size_t *size); extern int cil_selinuxusers_to_string(cil_db_t *db, char **out, size_t *size); extern int cil_filecons_to_string(cil_db_t *db, char **out, size_t *size); extern void cil_set_disable_dontaudit(cil_db_t *db, int disable_dontaudit); extern void cil_set_multiple_decls(cil_db_t *db, int multiple_decls); extern void cil_set_disable_neverallow(cil_db_t *db, int disable_neverallow); extern void cil_set_preserve_tunables(cil_db_t *db, int preserve_tunables); extern int cil_set_handle_unknown(cil_db_t *db, int handle_unknown); extern void cil_set_mls(cil_db_t *db, int mls); extern void cil_set_attrs_expand_generated(struct cil_db *db, int attrs_expand_generated); extern void cil_set_attrs_expand_size(struct cil_db *db, unsigned attrs_expand_size); extern void cil_set_target_platform(cil_db_t *db, int target_platform); extern void cil_set_policy_version(cil_db_t *db, int policy_version); extern void cil_write_policy_conf(FILE *out, struct cil_db *db); enum cil_log_level { CIL_ERR = 1, CIL_WARN, CIL_INFO }; extern void cil_set_log_level(enum cil_log_level lvl); extern void cil_set_log_handler(void (*handler)(int lvl, char *msg)); #ifdef __GNUC__ __attribute__ ((format(printf, 2, 3))) #endif extern void cil_log(enum cil_log_level lvl, const char *msg, ...); extern void cil_set_malloc_error_handler(void (*handler)(void)); #ifdef __cplusplus } #endif #endif sepol/policydb/avrule_block.h 0000644 00000003145 15063602062 0012317 0 ustar 00 /* Authors: Jason Tang <jtang@tresys.com> * * Copyright (C) 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_AVRULE_BLOCK_H_ #define _SEPOL_AVRULE_BLOCK_H_ #include <sepol/policydb/policydb.h> #ifdef __cplusplus extern "C" { #endif extern avrule_block_t *avrule_block_create(void); extern void avrule_block_destroy(avrule_block_t * x); extern avrule_decl_t *avrule_decl_create(uint32_t decl_id); extern void avrule_decl_destroy(avrule_decl_t * x); extern void avrule_block_list_destroy(avrule_block_t * x); extern avrule_decl_t *get_avrule_decl(policydb_t * p, uint32_t decl_id); extern cond_list_t *get_decl_cond_list(policydb_t * p, avrule_decl_t * decl, cond_list_t * cond); extern int is_id_enabled(char *id, policydb_t * p, int symbol_table); extern int is_perm_enabled(char *class_id, char *perm_id, policydb_t * p); #ifdef __cplusplus } #endif #endif sepol/policydb/avtab.h 0000644 00000011207 15063602062 0010742 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* * Updated: Yuichi Nakamura <ynakam@hitachisoft.jp> * Tuned number of hash slots for avtab to reduce memory usage */ /* Updated: Frank Mayer <mayerf@tresys.com> and Karl MacMillan <kmacmillan@tresys.com> * * Added conditional policy language extensions * * Copyright (C) 2003 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* FLASK */ /* * An access vector table (avtab) is a hash table * of access vectors and transition types indexed * by a type pair and a class. An access vector * table is used to represent the type enforcement * tables. */ #ifndef _SEPOL_POLICYDB_AVTAB_H_ #define _SEPOL_POLICYDB_AVTAB_H_ #include <sys/types.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif typedef struct avtab_key { uint16_t source_type; uint16_t target_type; uint16_t target_class; #define AVTAB_ALLOWED 0x0001 #define AVTAB_AUDITALLOW 0x0002 #define AVTAB_AUDITDENY 0x0004 #define AVTAB_NEVERALLOW 0x0080 #define AVTAB_AV (AVTAB_ALLOWED | AVTAB_AUDITALLOW | AVTAB_AUDITDENY) #define AVTAB_TRANSITION 0x0010 #define AVTAB_MEMBER 0x0020 #define AVTAB_CHANGE 0x0040 #define AVTAB_TYPE (AVTAB_TRANSITION | AVTAB_MEMBER | AVTAB_CHANGE) #define AVTAB_XPERMS_ALLOWED 0x0100 #define AVTAB_XPERMS_AUDITALLOW 0x0200 #define AVTAB_XPERMS_DONTAUDIT 0x0400 #define AVTAB_XPERMS_NEVERALLOW 0x0800 #define AVTAB_XPERMS (AVTAB_XPERMS_ALLOWED | AVTAB_XPERMS_AUDITALLOW | AVTAB_XPERMS_DONTAUDIT) #define AVTAB_ENABLED_OLD 0x80000000 #define AVTAB_ENABLED 0x8000 /* reserved for used in cond_avtab */ uint16_t specified; /* what fields are specified */ } avtab_key_t; typedef struct avtab_extended_perms { #define AVTAB_XPERMS_IOCTLFUNCTION 0x01 #define AVTAB_XPERMS_IOCTLDRIVER 0x02 /* extension of the avtab_key specified */ uint8_t specified; uint8_t driver; uint32_t perms[8]; } avtab_extended_perms_t; typedef struct avtab_datum { uint32_t data; /* access vector or type */ avtab_extended_perms_t *xperms; } avtab_datum_t; typedef struct avtab_node *avtab_ptr_t; struct avtab_node { avtab_key_t key; avtab_datum_t datum; avtab_ptr_t next; void *parse_context; /* generic context pointer used by parser; * not saved in binary policy */ unsigned merged; /* flag for avtab_write only; not saved in binary policy */ }; typedef struct avtab { avtab_ptr_t *htable; uint32_t nel; /* number of elements */ uint32_t nslot; /* number of hash slots */ uint32_t mask; /* mask to compute hash func */ } avtab_t; extern int avtab_init(avtab_t *); extern int avtab_alloc(avtab_t *, uint32_t); extern int avtab_insert(avtab_t * h, avtab_key_t * k, avtab_datum_t * d); extern avtab_datum_t *avtab_search(avtab_t * h, avtab_key_t * k); extern void avtab_destroy(avtab_t * h); extern int avtab_map(avtab_t * h, int (*apply) (avtab_key_t * k, avtab_datum_t * d, void *args), void *args); extern void avtab_hash_eval(avtab_t * h, char *tag); struct policy_file; extern int avtab_read_item(struct policy_file *fp, uint32_t vers, avtab_t * a, int (*insert) (avtab_t * a, avtab_key_t * k, avtab_datum_t * d, void *p), void *p); extern int avtab_read(avtab_t * a, struct policy_file *fp, uint32_t vers); extern avtab_ptr_t avtab_insert_nonunique(avtab_t * h, avtab_key_t * key, avtab_datum_t * datum); extern avtab_ptr_t avtab_insert_with_parse_context(avtab_t * h, avtab_key_t * key, avtab_datum_t * datum, void *parse_context); extern avtab_ptr_t avtab_search_node(avtab_t * h, avtab_key_t * key); extern avtab_ptr_t avtab_search_node_next(avtab_ptr_t node, int specified); #define MAX_AVTAB_HASH_BITS 20 #define MAX_AVTAB_HASH_BUCKETS (1 << MAX_AVTAB_HASH_BITS) #define MAX_AVTAB_HASH_MASK (MAX_AVTAB_HASH_BUCKETS-1) /* avtab_alloc uses one bucket per 2-4 elements, so adjust to get maximum buckets */ #define MAX_AVTAB_SIZE (MAX_AVTAB_HASH_BUCKETS << 1) #ifdef __cplusplus } #endif #endif /* _AVTAB_H_ */ /* FLASK */ sepol/policydb/conditional.h 0000644 00000011175 15063602062 0012154 0 ustar 00 /* Authors: Karl MacMillan <kmacmillan@tresys.com> * Frank Mayer <mayerf@tresys.com> * * Copyright (C) 2003 - 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_CONDITIONAL_H_ #define _SEPOL_POLICYDB_CONDITIONAL_H_ #include <sepol/policydb/flask_types.h> #include <sepol/policydb/avtab.h> #include <sepol/policydb/symtab.h> #include <sepol/policydb/policydb.h> #ifdef __cplusplus extern "C" { #endif #define COND_EXPR_MAXDEPTH 10 /* this is the max unique bools in a conditional expression * for which we precompute all outcomes for the expression. * * NOTE - do _NOT_ use value greater than 5 because * cond_node_t->expr_pre_comp can only hold at most 32 values */ #define COND_MAX_BOOLS 5 /* * A conditional expression is a list of operators and operands * in reverse polish notation. */ typedef struct cond_expr { #define COND_BOOL 1 /* plain bool */ #define COND_NOT 2 /* !bool */ #define COND_OR 3 /* bool || bool */ #define COND_AND 4 /* bool && bool */ #define COND_XOR 5 /* bool ^ bool */ #define COND_EQ 6 /* bool == bool */ #define COND_NEQ 7 /* bool != bool */ #define COND_LAST COND_NEQ uint32_t expr_type; uint32_t bool; struct cond_expr *next; } cond_expr_t; /* * Each cond_node_t contains a list of rules to be enabled/disabled * depending on the current value of the conditional expression. This * struct is for that list. */ typedef struct cond_av_list { avtab_ptr_t node; struct cond_av_list *next; } cond_av_list_t; /* * A cond node represents a conditional block in a policy. It * contains a conditional expression, the current state of the expression, * two lists of rules to enable/disable depending on the value of the * expression (the true list corresponds to if and the false list corresponds * to else).. */ typedef struct cond_node { int cur_state; cond_expr_t *expr; /* these true/false lists point into te_avtab when that is used */ cond_av_list_t *true_list; cond_av_list_t *false_list; /* and these are used during parsing and for modules */ avrule_t *avtrue_list; avrule_t *avfalse_list; /* these fields are not written to binary policy */ unsigned int nbools; uint32_t bool_ids[COND_MAX_BOOLS]; uint32_t expr_pre_comp; struct cond_node *next; /* a tunable conditional, calculated and used at expansion */ #define COND_NODE_FLAGS_TUNABLE 0x01 uint32_t flags; } cond_node_t; extern int cond_evaluate_expr(policydb_t * p, cond_expr_t * expr); extern cond_expr_t *cond_copy_expr(cond_expr_t * expr); extern int cond_expr_equal(cond_node_t * a, cond_node_t * b); extern int cond_normalize_expr(policydb_t * p, cond_node_t * cn); extern void cond_node_destroy(cond_node_t * node); extern void cond_expr_destroy(cond_expr_t * expr); extern cond_node_t *cond_node_find(policydb_t * p, cond_node_t * needle, cond_node_t * haystack, int *was_created); extern cond_node_t *cond_node_create(policydb_t * p, cond_node_t * node); extern cond_node_t *cond_node_search(policydb_t * p, cond_node_t * list, cond_node_t * cn); extern int evaluate_conds(policydb_t * p); extern avtab_datum_t *cond_av_list_search(avtab_key_t * key, cond_av_list_t * cond_list); extern void cond_av_list_destroy(cond_av_list_t * list); extern void cond_optimize_lists(cond_list_t * cl); extern int cond_policydb_init(policydb_t * p); extern void cond_policydb_destroy(policydb_t * p); extern void cond_list_destroy(cond_list_t * list); extern int cond_init_bool_indexes(policydb_t * p); extern int cond_destroy_bool(hashtab_key_t key, hashtab_datum_t datum, void *p); extern int cond_index_bool(hashtab_key_t key, hashtab_datum_t datum, void *datap); extern int cond_read_bool(policydb_t * p, hashtab_t h, struct policy_file *fp); extern int cond_read_list(policydb_t * p, cond_list_t ** list, void *fp); extern void cond_compute_av(avtab_t * ctab, avtab_key_t * key, struct sepol_av_decision *avd); #ifdef __cplusplus } #endif #endif /* _CONDITIONAL_H_ */ sepol/policydb/constraint.h 0000644 00000005013 15063602062 0012027 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* FLASK */ /* * A constraint is a condition that must be satisfied in * order for one or more permissions to be granted. * Constraints are used to impose additional restrictions * beyond the type-based rules in `te' or the role-based * transition rules in `rbac'. Constraints are typically * used to prevent a process from transitioning to a new user * identity or role unless it is in a privileged type. * Constraints are likewise typically used to prevent a * process from labeling an object with a different user * identity. */ #ifndef _SEPOL_POLICYDB_CONSTRAINT_H_ #define _SEPOL_POLICYDB_CONSTRAINT_H_ #include <sepol/policydb/policydb.h> #include <sepol/policydb/ebitmap.h> #include <sepol/policydb/flask_types.h> #ifdef __cplusplus extern "C" { #endif #define CEXPR_MAXDEPTH 5 struct type_set; typedef struct constraint_expr { #define CEXPR_NOT 1 /* not expr */ #define CEXPR_AND 2 /* expr and expr */ #define CEXPR_OR 3 /* expr or expr */ #define CEXPR_ATTR 4 /* attr op attr */ #define CEXPR_NAMES 5 /* attr op names */ uint32_t expr_type; /* expression type */ #define CEXPR_USER 1 /* user */ #define CEXPR_ROLE 2 /* role */ #define CEXPR_TYPE 4 /* type */ #define CEXPR_TARGET 8 /* target if set, source otherwise */ #define CEXPR_XTARGET 16 /* special 3rd target for validatetrans rule */ #define CEXPR_L1L2 32 /* low level 1 vs. low level 2 */ #define CEXPR_L1H2 64 /* low level 1 vs. high level 2 */ #define CEXPR_H1L2 128 /* high level 1 vs. low level 2 */ #define CEXPR_H1H2 256 /* high level 1 vs. high level 2 */ #define CEXPR_L1H1 512 /* low level 1 vs. high level 1 */ #define CEXPR_L2H2 1024 /* low level 2 vs. high level 2 */ uint32_t attr; /* attribute */ #define CEXPR_EQ 1 /* == or eq */ #define CEXPR_NEQ 2 /* != */ #define CEXPR_DOM 3 /* dom */ #define CEXPR_DOMBY 4 /* domby */ #define CEXPR_INCOMP 5 /* incomp */ uint32_t op; /* operator */ ebitmap_t names; /* names */ struct type_set *type_names; struct constraint_expr *next; /* next expression */ } constraint_expr_t; typedef struct constraint_node { sepol_access_vector_t permissions; /* constrained permissions */ constraint_expr_t *expr; /* constraint on permissions */ struct constraint_node *next; /* next constraint */ } constraint_node_t; struct policydb; extern int constraint_expr_init(constraint_expr_t * expr); extern void constraint_expr_destroy(constraint_expr_t * expr); #ifdef __cplusplus } #endif #endif /* _CONSTRAINT_H_ */ /* FLASK */ sepol/policydb/context.h 0000644 00000006404 15063602062 0011334 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* FLASK */ /* * A security context is a set of security attributes * associated with each subject and object controlled * by the security policy. Security contexts are * externally represented as variable-length strings * that can be interpreted by a user or application * with an understanding of the security policy. * Internally, the security server uses a simple * structure. This structure is private to the * security server and can be changed without affecting * clients of the security server. */ #ifndef _SEPOL_POLICYDB_CONTEXT_H_ #define _SEPOL_POLICYDB_CONTEXT_H_ #include <stddef.h> #include <sepol/policydb/ebitmap.h> #include <sepol/policydb/mls_types.h> #ifdef __cplusplus extern "C" { #endif /* * A security context consists of an authenticated user * identity, a role, a type and a MLS range. */ typedef struct context_struct { uint32_t user; uint32_t role; uint32_t type; mls_range_t range; } context_struct_t; static inline void mls_context_init(context_struct_t * c) { mls_range_init(&c->range); } static inline int mls_context_cpy(context_struct_t * dst, context_struct_t * src) { if (mls_range_cpy(&dst->range, &src->range) < 0) return -1; return 0; } /* * Sets both levels in the MLS range of 'dst' to the low level of 'src'. */ static inline int mls_context_cpy_low(context_struct_t *dst, context_struct_t *src) { int rc; dst->range.level[0].sens = src->range.level[0].sens; rc = ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[0].cat); if (rc) goto out; dst->range.level[1].sens = src->range.level[0].sens; rc = ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[0].cat); if (rc) ebitmap_destroy(&dst->range.level[0].cat); out: return rc; } /* * Sets both levels in the MLS range of 'dst' to the high level of 'src'. */ static inline int mls_context_cpy_high(context_struct_t *dst, context_struct_t *src) { int rc; dst->range.level[0].sens = src->range.level[1].sens; rc = ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[1].cat); if (rc) goto out; dst->range.level[1].sens = src->range.level[1].sens; rc = ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[1].cat); if (rc) ebitmap_destroy(&dst->range.level[0].cat); out: return rc; } static inline int mls_context_cmp(context_struct_t * c1, context_struct_t * c2) { return (mls_level_eq(&c1->range.level[0], &c2->range.level[0]) && mls_level_eq(&c1->range.level[1], &c2->range.level[1])); } static inline void mls_context_destroy(context_struct_t * c) { if (c == NULL) return; mls_range_destroy(&c->range); mls_context_init(c); } static inline void context_init(context_struct_t * c) { memset(c, 0, sizeof(*c)); } static inline int context_cpy(context_struct_t * dst, context_struct_t * src) { dst->user = src->user; dst->role = src->role; dst->type = src->type; return mls_context_cpy(dst, src); } static inline void context_destroy(context_struct_t * c) { if (c == NULL) return; c->user = c->role = c->type = 0; mls_context_destroy(c); } static inline int context_cmp(context_struct_t * c1, context_struct_t * c2) { return ((c1->user == c2->user) && (c1->role == c2->role) && (c1->type == c2->type) && mls_context_cmp(c1, c2)); } #ifdef __cplusplus } #endif #endif sepol/policydb/ebitmap.h 0000644 00000006150 15063602062 0011267 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* FLASK */ /* * An extensible bitmap is a bitmap that supports an * arbitrary number of bits. Extensible bitmaps are * used to represent sets of values, such as types, * roles, categories, and classes. * * Each extensible bitmap is implemented as a linked * list of bitmap nodes, where each bitmap node has * an explicitly specified starting bit position within * the total bitmap. */ #ifndef _SEPOL_POLICYDB_EBITMAP_H_ #define _SEPOL_POLICYDB_EBITMAP_H_ #include <stdint.h> #include <string.h> #ifdef __cplusplus extern "C" { #endif #define MAPTYPE uint64_t /* portion of bitmap in each node */ #define MAPSIZE (sizeof(MAPTYPE) * 8) /* number of bits in node bitmap */ #define MAPBIT 1ULL /* a bit in the node bitmap */ typedef struct ebitmap_node { uint32_t startbit; /* starting position in the total bitmap */ MAPTYPE map; /* this node's portion of the bitmap */ struct ebitmap_node *next; } ebitmap_node_t; typedef struct ebitmap { ebitmap_node_t *node; /* first node in the bitmap */ uint32_t highbit; /* highest position in the total bitmap */ } ebitmap_t; #define ebitmap_length(e) ((e)->highbit) #define ebitmap_startbit(e) ((e)->node ? (e)->node->startbit : 0) #define ebitmap_startnode(e) ((e)->node) static inline unsigned int ebitmap_start(const ebitmap_t * e, ebitmap_node_t ** n) { *n = e->node; return ebitmap_startbit(e); } static inline void ebitmap_init(ebitmap_t * e) { memset(e, 0, sizeof(*e)); } static inline unsigned int ebitmap_next(ebitmap_node_t ** n, unsigned int bit) { if ((bit == ((*n)->startbit + MAPSIZE - 1)) && (*n)->next) { *n = (*n)->next; return (*n)->startbit; } return (bit + 1); } static inline int ebitmap_node_get_bit(ebitmap_node_t * n, unsigned int bit) { if (n->map & (MAPBIT << (bit - n->startbit))) return 1; return 0; } #define ebitmap_for_each_bit(e, n, bit) \ for (bit = ebitmap_start(e, &n); bit < ebitmap_length(e); bit = ebitmap_next(&n, bit)) \ extern int ebitmap_cmp(const ebitmap_t * e1, const ebitmap_t * e2); extern int ebitmap_or(ebitmap_t * dst, const ebitmap_t * e1, const ebitmap_t * e2); extern int ebitmap_union(ebitmap_t * dst, const ebitmap_t * e1); extern int ebitmap_and(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2); extern int ebitmap_xor(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2); extern int ebitmap_not(ebitmap_t *dst, ebitmap_t *e1, unsigned int maxbit); extern int ebitmap_andnot(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2, unsigned int maxbit); extern unsigned int ebitmap_cardinality(ebitmap_t *e1); extern int ebitmap_hamming_distance(ebitmap_t * e1, ebitmap_t * e2); extern int ebitmap_cpy(ebitmap_t * dst, const ebitmap_t * src); extern int ebitmap_contains(const ebitmap_t * e1, const ebitmap_t * e2); extern int ebitmap_match_any(const ebitmap_t *e1, const ebitmap_t *e2); extern int ebitmap_get_bit(const ebitmap_t * e, unsigned int bit); extern int ebitmap_set_bit(ebitmap_t * e, unsigned int bit, int value); extern void ebitmap_destroy(ebitmap_t * e); extern int ebitmap_read(ebitmap_t * e, void *fp); #ifdef __cplusplus } #endif #endif /* _EBITMAP_H_ */ /* FLASK */ sepol/policydb/expand.h 0000644 00000007110 15063602062 0011122 0 ustar 00 /* Authors: Jason Tang <jtang@tresys.com> * Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@tresys.com> * * A set of utility functions that aid policy decision when dealing * with hierarchal items. * * Copyright (C) 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_EXPAND_H #define _SEPOL_POLICYDB_EXPAND_H #include <stddef.h> #include <sepol/handle.h> #include <sepol/policydb/conditional.h> #ifdef __cplusplus extern "C" { #endif /* * Expand only the avrules for a module. It is valid for this function * to expand base into itself (i.e. base == out); the typemap for * this special case should map type[i] to i+1. Likewise the boolmap * should map bool[i] to i + 1. This function optionally expands * neverallow rules. If neverallow rules are expanded, there is no * need to copy them and doing so could cause duplicate entries when * base == out. If the neverallow rules are not expanded, they are * just copied to the destination policy so that assertion checking * can be performed after expand. No assertion or hierarchy checking * is performed by this function. */ extern int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, policydb_t * out, uint32_t * typemap, uint32_t * boolmap, uint32_t * rolemap, uint32_t * usermap, int verbose, int expand_neverallow); /* * Expand all parts of a module. Neverallow rules are not expanded (only * copied). It is not valid to expand base into itself. If check is non-zero, * performs hierarchy and assertion checking. */ extern int expand_module(sepol_handle_t * handle, policydb_t * base, policydb_t * out, int verbose, int check); extern int convert_type_ebitmap(ebitmap_t * src, ebitmap_t * dst, uint32_t * typemap); extern int expand_convert_type_set(policydb_t * p, uint32_t * typemap, type_set_t * set, ebitmap_t * types, unsigned char alwaysexpand); extern int type_set_expand(type_set_t * set, ebitmap_t * t, policydb_t * p, unsigned char alwaysexpand); extern int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * out, policydb_t * base, uint32_t * rolemap); extern int mls_semantic_level_expand(mls_semantic_level_t *sl, mls_level_t *l, policydb_t *p, sepol_handle_t *h); extern int mls_semantic_range_expand(mls_semantic_range_t *sr, mls_range_t *r, policydb_t *p, sepol_handle_t *h); extern int expand_rule(sepol_handle_t * handle, policydb_t * source_pol, avrule_t * source_rule, avtab_t * dest_avtab, cond_av_list_t ** cond, cond_av_list_t ** other, int enabled); extern int expand_avtab(policydb_t * p, avtab_t * a, avtab_t * expa); extern int expand_cond_av_list(policydb_t * p, cond_av_list_t * l, cond_av_list_t ** newl, avtab_t * expa); #ifdef __cplusplus } #endif #endif sepol/policydb/flask.h 0000644 00000011600 15063602062 0010742 0 ustar 00 /* This file is automatically generated. Do not edit. */ #ifndef _SEPOL_POLICYDB_FLASK_H_ #define _SEPOL_POLICYDB_FLASK_H_ /* * Security object class definitions */ #define SECCLASS_SECURITY 1 #define SECCLASS_PROCESS 2 #define SECCLASS_SYSTEM 3 #define SECCLASS_CAPABILITY 4 #define SECCLASS_FILESYSTEM 5 #define SECCLASS_FILE 6 #define SECCLASS_DIR 7 #define SECCLASS_FD 8 #define SECCLASS_LNK_FILE 9 #define SECCLASS_CHR_FILE 10 #define SECCLASS_BLK_FILE 11 #define SECCLASS_SOCK_FILE 12 #define SECCLASS_FIFO_FILE 13 #define SECCLASS_SOCKET 14 #define SECCLASS_TCP_SOCKET 15 #define SECCLASS_UDP_SOCKET 16 #define SECCLASS_RAWIP_SOCKET 17 #define SECCLASS_NODE 18 #define SECCLASS_NETIF 19 #define SECCLASS_NETLINK_SOCKET 20 #define SECCLASS_PACKET_SOCKET 21 #define SECCLASS_KEY_SOCKET 22 #define SECCLASS_UNIX_STREAM_SOCKET 23 #define SECCLASS_UNIX_DGRAM_SOCKET 24 #define SECCLASS_SEM 25 #define SECCLASS_MSG 26 #define SECCLASS_MSGQ 27 #define SECCLASS_SHM 28 #define SECCLASS_IPC 29 #define SECCLASS_PASSWD 30 #define SECCLASS_DRAWABLE 31 #define SECCLASS_WINDOW 32 #define SECCLASS_GC 33 #define SECCLASS_FONT 34 #define SECCLASS_COLORMAP 35 #define SECCLASS_PROPERTY 36 #define SECCLASS_CURSOR 37 #define SECCLASS_XCLIENT 38 #define SECCLASS_XINPUT 39 #define SECCLASS_XSERVER 40 #define SECCLASS_XEXTENSION 41 #define SECCLASS_PAX 42 #define SECCLASS_NETLINK_ROUTE_SOCKET 43 #define SECCLASS_NETLINK_FIREWALL_SOCKET 44 #define SECCLASS_NETLINK_TCPDIAG_SOCKET 45 #define SECCLASS_NETLINK_NFLOG_SOCKET 46 #define SECCLASS_NETLINK_XFRM_SOCKET 47 #define SECCLASS_NETLINK_SELINUX_SOCKET 48 #define SECCLASS_NETLINK_AUDIT_SOCKET 49 #define SECCLASS_NETLINK_IP6FW_SOCKET 50 #define SECCLASS_NETLINK_DNRT_SOCKET 51 #define SECCLASS_DBUS 52 /* * Security identifier indices for initial entities */ #define SECINITSID_KERNEL 1 #define SECINITSID_SECURITY 2 #define SECINITSID_UNLABELED 3 #define SECINITSID_FS 4 #define SECINITSID_FILE 5 #define SECINITSID_FILE_LABELS 6 #define SECINITSID_INIT 7 #define SECINITSID_ANY_SOCKET 8 #define SECINITSID_PORT 9 #define SECINITSID_NETIF 10 #define SECINITSID_NETMSG 11 #define SECINITSID_NODE 12 #define SECINITSID_IGMP_PACKET 13 #define SECINITSID_ICMP_SOCKET 14 #define SECINITSID_TCP_SOCKET 15 #define SECINITSID_SYSCTL_MODPROBE 16 #define SECINITSID_SYSCTL 17 #define SECINITSID_SYSCTL_FS 18 #define SECINITSID_SYSCTL_KERNEL 19 #define SECINITSID_SYSCTL_NET 20 #define SECINITSID_SYSCTL_NET_UNIX 21 #define SECINITSID_SYSCTL_VM 22 #define SECINITSID_SYSCTL_DEV 23 #define SECINITSID_KMOD 24 #define SECINITSID_POLICY 25 #define SECINITSID_SCMP_PACKET 26 #define SECINITSID_DEVNULL 27 #define SECINITSID_NUM 27 #endif sepol/policydb/flask_types.h 0000644 00000003363 15063602062 0012175 0 ustar 00 /* -*- linux-c -*- */ /* * Author : Stephen Smalley, <sds@tycho.nsa.gov> */ #ifndef _SEPOL_POLICYDB_FLASK_TYPES_H_ #define _SEPOL_POLICYDB_FLASK_TYPES_H_ /* * The basic Flask types and constants. */ #include <sys/types.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif /* * A security context is a set of security attributes * associated with each subject and object controlled * by the security policy. The security context type * is defined as a variable-length string that can be * interpreted by any application or user with an * understanding of the security policy. */ typedef char *sepol_security_context_t; /* * An access vector (AV) is a collection of related permissions * for a pair of SIDs. The bits within an access vector * are interpreted differently depending on the class of * the object. The access vector interpretations are specified * in flask/access_vectors, and the corresponding constants * for permissions are defined in the automatically generated * header file av_permissions.h. */ typedef uint32_t sepol_access_vector_t; /* * Each object class is identified by a fixed-size value. * The set of security classes is specified in flask/security_classes, * with the corresponding constants defined in the automatically * generated header file flask.h. */ typedef uint16_t sepol_security_class_t; #define SEPOL_SECCLASS_NULL 0x0000 /* no class */ #define SELINUX_MAGIC 0xf97cff8c #define SELINUX_MOD_MAGIC 0xf97cff8d typedef uint32_t sepol_security_id_t; #define SEPOL_SECSID_NULL 0 struct sepol_av_decision { sepol_access_vector_t allowed; sepol_access_vector_t decided; sepol_access_vector_t auditallow; sepol_access_vector_t auditdeny; uint32_t seqno; }; #ifdef __cplusplus } #endif #endif sepol/policydb/hashtab.h 0000644 00000010450 15063602062 0011256 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* FLASK */ /* * A hash table (hashtab) maintains associations between * key values and datum values. The type of the key values * and the type of the datum values is arbitrary. The * functions for hash computation and key comparison are * provided by the creator of the table. */ #ifndef _SEPOL_POLICYDB_HASHTAB_H_ #define _SEPOL_POLICYDB_HASHTAB_H_ #include <sepol/errcodes.h> #include <stdint.h> #include <stdio.h> #ifdef __cplusplus extern "C" { #endif typedef char *hashtab_key_t; /* generic key type */ typedef const char *const_hashtab_key_t; /* constant generic key type */ typedef void *hashtab_datum_t; /* generic datum type */ typedef struct hashtab_node *hashtab_ptr_t; typedef struct hashtab_node { hashtab_key_t key; hashtab_datum_t datum; hashtab_ptr_t next; } hashtab_node_t; typedef struct hashtab_val { hashtab_ptr_t *htable; /* hash table */ unsigned int size; /* number of slots in hash table */ uint32_t nel; /* number of elements in hash table */ unsigned int (*hash_value) (struct hashtab_val * h, const_hashtab_key_t key); /* hash function */ int (*keycmp) (struct hashtab_val * h, const_hashtab_key_t key1, const_hashtab_key_t key2); /* key comparison function */ } hashtab_val_t; typedef hashtab_val_t *hashtab_t; /* Creates a new hash table with the specified characteristics. Returns NULL if insufficent space is available or the new hash table otherwise. */ extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h, const_hashtab_key_t key), int (*keycmp) (hashtab_t h, const_hashtab_key_t key1, const_hashtab_key_t key2), unsigned int size); /* Inserts the specified (key, datum) pair into the specified hash table. Returns SEPOL_ENOMEM if insufficient space is available or SEPOL_EEXIST if there is already an entry with the same key or SEPOL_OK otherwise. */ extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d); /* Removes the entry with the specified key from the hash table. Applies the specified destroy function to (key,datum,args) for the entry. Returns SEPOL_ENOENT if no entry has the specified key or SEPOL_OK otherwise. */ extern int hashtab_remove(hashtab_t h, hashtab_key_t k, void (*destroy) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); /* Insert or replace the specified (key, datum) pair in the specified hash table. If an entry for the specified key already exists, then the specified destroy function is applied to (key,datum,args) for the entry prior to replacing the entry's contents. Returns SEPOL_ENOMEM if insufficient space is available or SEPOL_OK otherwise. */ extern int hashtab_replace(hashtab_t h, hashtab_key_t k, hashtab_datum_t d, void (*destroy) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); /* Searches for the entry with the specified key in the hash table. Returns NULL if no entry has the specified key or the datum of the entry otherwise. */ extern hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t k); /* Destroys the specified hash table. */ extern void hashtab_destroy(hashtab_t h); /* Applies the specified apply function to (key,datum,args) for each entry in the specified hash table. The order in which the function is applied to the entries is dependent upon the internal structure of the hash table. If apply returns a non-zero status, then hashtab_map will cease iterating through the hash table and will propagate the error return to its caller. */ extern int hashtab_map(hashtab_t h, int (*apply) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); /* Same as hashtab_map, except that if apply returns a non-zero status, then the (key,datum) pair will be removed from the hashtab and the destroy function will be applied to (key,datum,args). */ extern void hashtab_map_remove_on_error(hashtab_t h, int (*apply) (hashtab_key_t k, hashtab_datum_t d, void *args), void (*destroy) (hashtab_key_t k, hashtab_datum_t d, void *args), void *args); extern void hashtab_hash_eval(hashtab_t h, char *tag); #ifdef __cplusplus } #endif #endif sepol/policydb/hierarchy.h 0000644 00000003432 15063602062 0011624 0 ustar 00 /* Authors: Jason Tang <jtang@tresys.com> * Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@tresys.com> * * A set of utility functions that aid policy decision when dealing * with hierarchal items. * * Copyright (C) 2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_HIERARCHY_H_ #define _SEPOL_POLICYDB_HIERARCHY_H_ #include <sepol/policydb/avtab.h> #include <sepol/policydb/policydb.h> #ifdef __cplusplus extern "C" { #endif extern int hierarchy_add_bounds(sepol_handle_t *handle, policydb_t *p); extern void bounds_destroy_bad(avtab_ptr_t cur); extern int bounds_check_type(sepol_handle_t *handle, policydb_t *p, uint32_t child, uint32_t parent, avtab_ptr_t *bad, int *numbad); extern int bounds_check_users(sepol_handle_t *handle, policydb_t *p); extern int bounds_check_roles(sepol_handle_t *handle, policydb_t *p); extern int bounds_check_types(sepol_handle_t *handle, policydb_t *p); extern int hierarchy_check_constraints(sepol_handle_t * handle, policydb_t * p); #ifdef __cplusplus } #endif #endif sepol/policydb/link.h 0000644 00000001005 15063602062 0010575 0 ustar 00 /* Authors: Jason Tang <jtang@tresys.com> * Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@mentalrootkit.com> */ #ifndef _SEPOL_POLICYDB_LINK_H #define _SEPOL_POLICYDB_LINK_H #include <sepol/handle.h> #include <sepol/errcodes.h> #include <sepol/policydb/policydb.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif extern int link_modules(sepol_handle_t * handle, policydb_t * b, policydb_t ** mods, int len, int verbose); #ifdef __cplusplus } #endif #endif sepol/policydb/mls_types.h 0000644 00000010430 15063602062 0011661 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com> * * Support for enhanced MLS infrastructure. * * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* FLASK */ /* * Type definitions for the multi-level security (MLS) policy. */ #ifndef _SEPOL_POLICYDB_MLS_TYPES_H_ #define _SEPOL_POLICYDB_MLS_TYPES_H_ #include <stdint.h> #include <stdlib.h> #include <sepol/policydb/ebitmap.h> #include <sepol/policydb/flask_types.h> #ifdef __cplusplus extern "C" { #endif typedef struct mls_level { uint32_t sens; /* sensitivity */ ebitmap_t cat; /* category set */ } mls_level_t; typedef struct mls_range { mls_level_t level[2]; /* low == level[0], high == level[1] */ } mls_range_t; static inline int mls_level_cpy(struct mls_level *dst, struct mls_level *src) { dst->sens = src->sens; if (ebitmap_cpy(&dst->cat, &src->cat) < 0) return -1; return 0; } static inline void mls_level_init(struct mls_level *level) { memset(level, 0, sizeof(mls_level_t)); } static inline void mls_level_destroy(struct mls_level *level) { if (level == NULL) return; ebitmap_destroy(&level->cat); mls_level_init(level); } static inline int mls_level_eq(const struct mls_level *l1, const struct mls_level *l2) { return ((l1->sens == l2->sens) && ebitmap_cmp(&l1->cat, &l2->cat)); } static inline int mls_level_dom(const struct mls_level *l1, const struct mls_level *l2) { return ((l1->sens >= l2->sens) && ebitmap_contains(&l1->cat, &l2->cat)); } #define mls_level_incomp(l1, l2) \ (!mls_level_dom((l1), (l2)) && !mls_level_dom((l2), (l1))) #define mls_level_between(l1, l2, l3) \ (mls_level_dom((l1), (l2)) && mls_level_dom((l3), (l1))) #define mls_range_contains(r1, r2) \ (mls_level_dom(&(r2).level[0], &(r1).level[0]) && \ mls_level_dom(&(r1).level[1], &(r2).level[1])) static inline int mls_range_cpy(mls_range_t * dst, mls_range_t * src) { if (mls_level_cpy(&dst->level[0], &src->level[0]) < 0) goto err; if (mls_level_cpy(&dst->level[1], &src->level[1]) < 0) goto err_destroy; return 0; err_destroy: mls_level_destroy(&dst->level[0]); err: return -1; } static inline void mls_range_init(struct mls_range *r) { mls_level_init(&r->level[0]); mls_level_init(&r->level[1]); } static inline void mls_range_destroy(struct mls_range *r) { mls_level_destroy(&r->level[0]); mls_level_destroy(&r->level[1]); } static inline int mls_range_eq(struct mls_range *r1, struct mls_range *r2) { return (mls_level_eq(&r1->level[0], &r2->level[0]) && mls_level_eq(&r1->level[1], &r2->level[1])); } typedef struct mls_semantic_cat { uint32_t low; /* first bit this struct represents */ uint32_t high; /* last bit represented - equals low for a single cat */ struct mls_semantic_cat *next; } mls_semantic_cat_t; typedef struct mls_semantic_level { uint32_t sens; mls_semantic_cat_t *cat; } mls_semantic_level_t; typedef struct mls_semantic_range { mls_semantic_level_t level[2]; } mls_semantic_range_t; extern void mls_semantic_cat_init(mls_semantic_cat_t *c); extern void mls_semantic_cat_destroy(mls_semantic_cat_t *c); extern void mls_semantic_level_init(mls_semantic_level_t *l); extern void mls_semantic_level_destroy(mls_semantic_level_t *l); extern int mls_semantic_level_cpy(mls_semantic_level_t *dst, mls_semantic_level_t *src); extern void mls_semantic_range_init(mls_semantic_range_t *r); extern void mls_semantic_range_destroy(mls_semantic_range_t *r); extern int mls_semantic_range_cpy(mls_semantic_range_t *dst, mls_semantic_range_t *src); #ifdef __cplusplus } #endif #endif sepol/policydb/module.h 0000644 00000002774 15063602062 0011143 0 ustar 00 /* Author: Karl MacMillan <kmacmillan@tresys.com> * * Copyright (C) 2004-2005 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _SEPOL_POLICYDB_MODULE_H_ #define _SEPOL_POLICYDB_MODULE_H_ #include <stdlib.h> #include <stddef.h> #include <sepol/module.h> #include <sepol/policydb/policydb.h> #include <sepol/policydb/conditional.h> #define SEPOL_MODULE_PACKAGE_MAGIC 0xf97cff8f #ifdef __cplusplus extern "C" { #endif struct sepol_module_package { sepol_policydb_t *policy; uint32_t version; char *file_contexts; size_t file_contexts_len; char *seusers; size_t seusers_len; char *user_extra; size_t user_extra_len; char *netfilter_contexts; size_t netfilter_contexts_len; }; extern int sepol_module_package_init(sepol_module_package_t * p); #ifdef __cplusplus } #endif #endif sepol/policydb/polcaps.h 0000644 00000001321 15063602062 0011302 0 ustar 00 #ifndef _SEPOL_POLICYDB_POLCAPS_H_ #define _SEPOL_POLICYDB_POLCAPS_H_ #ifdef __cplusplus extern "C" { #endif /* Policy capabilities */ enum { POLICYDB_CAPABILITY_NETPEER, POLICYDB_CAPABILITY_OPENPERM, POLICYDB_CAPABILITY_EXTSOCKCLASS, POLICYDB_CAPABILITY_ALWAYSNETWORK, POLICYDB_CAPABILITY_CGROUPSECLABEL, POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION, __POLICYDB_CAPABILITY_MAX }; #define POLICYDB_CAPABILITY_MAX (__POLICYDB_CAPABILITY_MAX - 1) /* Convert a capability name to number. */ extern int sepol_polcap_getnum(const char *name); /* Convert a capability number to name. */ extern const char *sepol_polcap_getname(unsigned int capnum); #ifdef __cplusplus } #endif #endif /* _SEPOL_POLICYDB_POLCAPS_H_ */ sepol/policydb/policydb.h 0000644 00000062570 15063602062 0011463 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* * Updated: Joshua Brindle <jbrindle@tresys.com> * Karl MacMillan <kmacmillan@tresys.com> * Jason Tang <jtang@tresys.com> * * Module support * * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com> * * Support for enhanced MLS infrastructure. * * Updated: Frank Mayer <mayerf@tresys.com> and Karl MacMillan <kmacmillan@tresys.com> * * Added conditional policy language extensions * * Updated: Red Hat, Inc. James Morris <jmorris@redhat.com> * * Fine-grained netlink support * IPv6 support * Code cleanup * * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc. * Copyright (C) 2003 - 2004 Tresys Technology, LLC * Copyright (C) 2003 - 2004 Red Hat, Inc. * Copyright (C) 2017 Mellanox Techonolgies Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* FLASK */ /* * A policy database (policydb) specifies the * configuration data for the security policy. */ #ifndef _SEPOL_POLICYDB_POLICYDB_H_ #define _SEPOL_POLICYDB_POLICYDB_H_ #include <stdio.h> #include <stddef.h> #include <sepol/policydb.h> #include <sepol/policydb/flask_types.h> #include <sepol/policydb/symtab.h> #include <sepol/policydb/avtab.h> #include <sepol/policydb/context.h> #include <sepol/policydb/constraint.h> #include <sepol/policydb/sidtab.h> #define ERRMSG_LEN 1024 #define POLICYDB_SUCCESS 0 #define POLICYDB_ERROR -1 #define POLICYDB_UNSUPPORTED -2 #ifdef __cplusplus extern "C" { #endif #define IB_DEVICE_NAME_MAX 64 /* * A datum type is defined for each kind of symbol * in the configuration data: individual permissions, * common prefixes for access vectors, classes, * users, roles, types, sensitivities, categories, etc. */ /* type set preserves data needed by modules such as *, ~ and attributes */ typedef struct type_set { ebitmap_t types; ebitmap_t negset; #define TYPE_STAR 1 #define TYPE_COMP 2 uint32_t flags; } type_set_t; typedef struct role_set { ebitmap_t roles; #define ROLE_STAR 1 #define ROLE_COMP 2 uint32_t flags; } role_set_t; /* Permission attributes */ typedef struct perm_datum { symtab_datum_t s; } perm_datum_t; /* Attributes of a common prefix for access vectors */ typedef struct common_datum { symtab_datum_t s; symtab_t permissions; /* common permissions */ } common_datum_t; /* Class attributes */ typedef struct class_datum { symtab_datum_t s; char *comkey; /* common name */ common_datum_t *comdatum; /* common datum */ symtab_t permissions; /* class-specific permission symbol table */ constraint_node_t *constraints; /* constraints on class permissions */ constraint_node_t *validatetrans; /* special transition rules */ /* Options how a new object user and role should be decided */ #define DEFAULT_SOURCE 1 #define DEFAULT_TARGET 2 char default_user; char default_role; char default_type; /* Options how a new object range should be decided */ #define DEFAULT_SOURCE_LOW 1 #define DEFAULT_SOURCE_HIGH 2 #define DEFAULT_SOURCE_LOW_HIGH 3 #define DEFAULT_TARGET_LOW 4 #define DEFAULT_TARGET_HIGH 5 #define DEFAULT_TARGET_LOW_HIGH 6 char default_range; } class_datum_t; /* Role attributes */ typedef struct role_datum { symtab_datum_t s; ebitmap_t dominates; /* set of roles dominated by this role */ type_set_t types; /* set of authorized types for role */ ebitmap_t cache; /* This is an expanded set used for context validation during parsing */ uint32_t bounds; /* bounds role, if exist */ #define ROLE_ROLE 0 /* regular role in kernel policies */ #define ROLE_ATTRIB 1 /* attribute */ uint32_t flavor; ebitmap_t roles; /* roles with this attribute */ } role_datum_t; typedef struct role_trans { uint32_t role; /* current role */ uint32_t type; /* program executable type, or new object type */ uint32_t tclass; /* process class, or new object class */ uint32_t new_role; /* new role */ struct role_trans *next; } role_trans_t; typedef struct role_allow { uint32_t role; /* current role */ uint32_t new_role; /* new role */ struct role_allow *next; } role_allow_t; /* filename_trans rules */ typedef struct filename_trans { uint32_t stype; uint32_t ttype; uint32_t tclass; char *name; } filename_trans_t; typedef struct filename_trans_datum { uint32_t otype; /* expected of new object */ } filename_trans_datum_t; /* Type attributes */ typedef struct type_datum { symtab_datum_t s; uint32_t primary; /* primary name? can be set to primary value if below is TYPE_ */ #define TYPE_TYPE 0 /* regular type or alias in kernel policies */ #define TYPE_ATTRIB 1 /* attribute */ #define TYPE_ALIAS 2 /* alias in modular policy */ uint32_t flavor; ebitmap_t types; /* types with this attribute */ #define TYPE_FLAGS_PERMISSIVE (1 << 0) #define TYPE_FLAGS_EXPAND_ATTR_TRUE (1 << 1) #define TYPE_FLAGS_EXPAND_ATTR_FALSE (1 << 2) #define TYPE_FLAGS_EXPAND_ATTR (TYPE_FLAGS_EXPAND_ATTR_TRUE | \ TYPE_FLAGS_EXPAND_ATTR_FALSE) uint32_t flags; uint32_t bounds; /* bounds type, if exist */ } type_datum_t; /* * Properties of type_datum * available on the policy version >= (MOD_)POLICYDB_VERSION_BOUNDARY */ #define TYPEDATUM_PROPERTY_PRIMARY 0x0001 #define TYPEDATUM_PROPERTY_ATTRIBUTE 0x0002 #define TYPEDATUM_PROPERTY_ALIAS 0x0004 /* userspace only */ #define TYPEDATUM_PROPERTY_PERMISSIVE 0x0008 /* userspace only */ /* User attributes */ typedef struct user_datum { symtab_datum_t s; role_set_t roles; /* set of authorized roles for user */ mls_semantic_range_t range; /* MLS range (min. - max.) for user */ mls_semantic_level_t dfltlevel; /* default login MLS level for user */ ebitmap_t cache; /* This is an expanded set used for context validation during parsing */ mls_range_t exp_range; /* expanded range used for validation */ mls_level_t exp_dfltlevel; /* expanded range used for validation */ uint32_t bounds; /* bounds user, if exist */ } user_datum_t; /* Sensitivity attributes */ typedef struct level_datum { mls_level_t *level; /* sensitivity and associated categories */ unsigned char isalias; /* is this sensitivity an alias for another? */ unsigned char defined; } level_datum_t; /* Category attributes */ typedef struct cat_datum { symtab_datum_t s; unsigned char isalias; /* is this category an alias for another? */ } cat_datum_t; typedef struct range_trans { uint32_t source_type; uint32_t target_type; uint32_t target_class; } range_trans_t; /* Boolean data type */ typedef struct cond_bool_datum { symtab_datum_t s; int state; #define COND_BOOL_FLAGS_TUNABLE 0x01 /* is this a tunable? */ uint32_t flags; } cond_bool_datum_t; struct cond_node; typedef struct cond_node cond_list_t; struct cond_av_list; typedef struct class_perm_node { uint32_t tclass; uint32_t data; /* permissions or new type */ struct class_perm_node *next; } class_perm_node_t; #define xperm_test(x, p) (1 & (p[x >> 5] >> (x & 0x1f))) #define xperm_set(x, p) (p[x >> 5] |= (1 << (x & 0x1f))) #define xperm_clear(x, p) (p[x >> 5] &= ~(1 << (x & 0x1f))) #define EXTENDED_PERMS_LEN 8 typedef struct av_extended_perms { #define AVRULE_XPERMS_IOCTLFUNCTION 0x01 #define AVRULE_XPERMS_IOCTLDRIVER 0x02 uint8_t specified; uint8_t driver; /* 256 bits of permissions */ uint32_t perms[EXTENDED_PERMS_LEN]; } av_extended_perms_t; typedef struct avrule { /* these typedefs are almost exactly the same as those in avtab.h - they are * here because of the need to include neverallow and dontaudit messages */ #define AVRULE_ALLOWED AVTAB_ALLOWED #define AVRULE_AUDITALLOW AVTAB_AUDITALLOW #define AVRULE_AUDITDENY AVTAB_AUDITDENY #define AVRULE_DONTAUDIT 0x0008 #define AVRULE_NEVERALLOW AVTAB_NEVERALLOW #define AVRULE_AV (AVRULE_ALLOWED | AVRULE_AUDITALLOW | AVRULE_AUDITDENY | AVRULE_DONTAUDIT | AVRULE_NEVERALLOW) #define AVRULE_TRANSITION AVTAB_TRANSITION #define AVRULE_MEMBER AVTAB_MEMBER #define AVRULE_CHANGE AVTAB_CHANGE #define AVRULE_TYPE (AVRULE_TRANSITION | AVRULE_MEMBER | AVRULE_CHANGE) #define AVRULE_XPERMS_ALLOWED AVTAB_XPERMS_ALLOWED #define AVRULE_XPERMS_AUDITALLOW AVTAB_XPERMS_AUDITALLOW #define AVRULE_XPERMS_DONTAUDIT AVTAB_XPERMS_DONTAUDIT #define AVRULE_XPERMS_NEVERALLOW AVTAB_XPERMS_NEVERALLOW #define AVRULE_XPERMS (AVRULE_XPERMS_ALLOWED | AVRULE_XPERMS_AUDITALLOW | \ AVRULE_XPERMS_DONTAUDIT | AVRULE_XPERMS_NEVERALLOW) uint32_t specified; #define RULE_SELF 1 uint32_t flags; type_set_t stypes; type_set_t ttypes; class_perm_node_t *perms; av_extended_perms_t *xperms; unsigned long line; /* line number from policy.conf where * this rule originated */ /* source file name and line number (e.g. .te file) */ char *source_filename; unsigned long source_line; struct avrule *next; } avrule_t; typedef struct role_trans_rule { role_set_t roles; /* current role */ type_set_t types; /* program executable type, or new object type */ ebitmap_t classes; /* process class, or new object class */ uint32_t new_role; /* new role */ struct role_trans_rule *next; } role_trans_rule_t; typedef struct role_allow_rule { role_set_t roles; /* current role */ role_set_t new_roles; /* new roles */ struct role_allow_rule *next; } role_allow_rule_t; typedef struct filename_trans_rule { type_set_t stypes; type_set_t ttypes; uint32_t tclass; char *name; uint32_t otype; /* new type */ struct filename_trans_rule *next; } filename_trans_rule_t; typedef struct range_trans_rule { type_set_t stypes; type_set_t ttypes; ebitmap_t tclasses; mls_semantic_range_t trange; struct range_trans_rule *next; } range_trans_rule_t; /* * The configuration data includes security contexts for * initial SIDs, unlabeled file systems, TCP and UDP port numbers, * network interfaces, and nodes. This structure stores the * relevant data for one such entry. Entries of the same kind * (e.g. all initial SIDs) are linked together into a list. */ typedef struct ocontext { union { char *name; /* name of initial SID, fs, netif, fstype, path */ struct { uint8_t protocol; uint16_t low_port; uint16_t high_port; } port; /* TCP or UDP port information */ struct { uint32_t addr; /* network order */ uint32_t mask; /* network order */ } node; /* node information */ struct { uint32_t addr[4]; /* network order */ uint32_t mask[4]; /* network order */ } node6; /* IPv6 node information */ uint32_t device; uint16_t pirq; struct { uint64_t low_iomem; uint64_t high_iomem; } iomem; struct { uint32_t low_ioport; uint32_t high_ioport; } ioport; struct { uint64_t subnet_prefix; uint16_t low_pkey; uint16_t high_pkey; } ibpkey; struct { char *dev_name; uint8_t port; } ibendport; } u; union { uint32_t sclass; /* security class for genfs */ uint32_t behavior; /* labeling behavior for fs_use */ } v; context_struct_t context[2]; /* security context(s) */ sepol_security_id_t sid[2]; /* SID(s) */ struct ocontext *next; } ocontext_t; typedef struct genfs { char *fstype; struct ocontext *head; struct genfs *next; } genfs_t; /* symbol table array indices */ #define SYM_COMMONS 0 #define SYM_CLASSES 1 #define SYM_ROLES 2 #define SYM_TYPES 3 #define SYM_USERS 4 #define SYM_BOOLS 5 #define SYM_LEVELS 6 #define SYM_CATS 7 #define SYM_NUM 8 /* object context array indices */ #define OCON_ISID 0 /* initial SIDs */ #define OCON_FS 1 /* unlabeled file systems */ #define OCON_PORT 2 /* TCP and UDP port numbers */ #define OCON_NETIF 3 /* network interfaces */ #define OCON_NODE 4 /* nodes */ #define OCON_FSUSE 5 /* fs_use */ #define OCON_NODE6 6 /* IPv6 nodes */ #define OCON_IBPKEY 7 /* Infiniband PKEY */ #define OCON_IBENDPORT 8 /* Infiniband End Port */ /* object context array indices for Xen */ #define OCON_XEN_ISID 0 /* initial SIDs */ #define OCON_XEN_PIRQ 1 /* physical irqs */ #define OCON_XEN_IOPORT 2 /* io ports */ #define OCON_XEN_IOMEM 3 /* io memory */ #define OCON_XEN_PCIDEVICE 4 /* pci devices */ #define OCON_XEN_DEVICETREE 5 /* device tree node */ /* OCON_NUM needs to be the largest index in any platform's ocontext array */ #define OCON_NUM 9 /* section: module information */ /* scope_index_t holds all of the symbols that are in scope in a * particular situation. The bitmaps are indices (and thus must * subtract one) into the global policydb->scope array. */ typedef struct scope_index { ebitmap_t scope[SYM_NUM]; #define p_classes_scope scope[SYM_CLASSES] #define p_roles_scope scope[SYM_ROLES] #define p_types_scope scope[SYM_TYPES] #define p_users_scope scope[SYM_USERS] #define p_bools_scope scope[SYM_BOOLS] #define p_sens_scope scope[SYM_LEVELS] #define p_cat_scope scope[SYM_CATS] /* this array maps from class->value to the permissions within * scope. if bit (perm->value - 1) is set in map * class_perms_map[class->value - 1] then that permission is * enabled for this class within this decl. */ ebitmap_t *class_perms_map; /* total number of classes in class_perms_map array */ uint32_t class_perms_len; } scope_index_t; /* a list of declarations for a particular avrule_decl */ /* These two structs declare a block of policy that has TE and RBAC * statements and declarations. The root block (the global policy) * can never have an ELSE branch. */ typedef struct avrule_decl { uint32_t decl_id; uint32_t enabled; /* whether this block is enabled */ cond_list_t *cond_list; avrule_t *avrules; role_trans_rule_t *role_tr_rules; role_allow_rule_t *role_allow_rules; range_trans_rule_t *range_tr_rules; scope_index_t required; /* symbols needed to activate this block */ scope_index_t declared; /* symbols declared within this block */ /* type transition rules with a 'name' component */ filename_trans_rule_t *filename_trans_rules; /* for additive statements (type attribute, roles, and users) */ symtab_t symtab[SYM_NUM]; /* In a linked module this will contain the name of the module * from which this avrule_decl originated. */ char *module_name; struct avrule_decl *next; } avrule_decl_t; typedef struct avrule_block { avrule_decl_t *branch_list; avrule_decl_t *enabled; /* pointer to which branch is enabled. this is used in linking and never written to disk */ #define AVRULE_OPTIONAL 1 uint32_t flags; /* any flags for this block, currently just optional */ struct avrule_block *next; } avrule_block_t; /* Every identifier has its own scope datum. The datum describes if * the item is to be included into the final policy during * expansion. */ typedef struct scope_datum { /* Required for this decl */ #define SCOPE_REQ 1 /* Declared in this decl */ #define SCOPE_DECL 2 uint32_t scope; uint32_t *decl_ids; uint32_t decl_ids_len; /* decl_ids is a list of avrule_decl's that declare/require * this symbol. If scope==SCOPE_DECL then this is a list of * declarations. If the symbol may only be declared once * (types, bools) then decl_ids_len will be exactly 1. For * implicitly declared things (roles, users) then decl_ids_len * will be at least 1. */ } scope_datum_t; /* The policy database */ typedef struct policydb { #define POLICY_KERN SEPOL_POLICY_KERN #define POLICY_BASE SEPOL_POLICY_BASE #define POLICY_MOD SEPOL_POLICY_MOD uint32_t policy_type; char *name; char *version; int target_platform; /* Set when the policydb is modified such that writing is unsupported */ int unsupported_format; /* Whether this policydb is mls, should always be set */ int mls; /* symbol tables */ symtab_t symtab[SYM_NUM]; #define p_commons symtab[SYM_COMMONS] #define p_classes symtab[SYM_CLASSES] #define p_roles symtab[SYM_ROLES] #define p_types symtab[SYM_TYPES] #define p_users symtab[SYM_USERS] #define p_bools symtab[SYM_BOOLS] #define p_levels symtab[SYM_LEVELS] #define p_cats symtab[SYM_CATS] /* symbol names indexed by (value - 1) */ char **sym_val_to_name[SYM_NUM]; #define p_common_val_to_name sym_val_to_name[SYM_COMMONS] #define p_class_val_to_name sym_val_to_name[SYM_CLASSES] #define p_role_val_to_name sym_val_to_name[SYM_ROLES] #define p_type_val_to_name sym_val_to_name[SYM_TYPES] #define p_user_val_to_name sym_val_to_name[SYM_USERS] #define p_bool_val_to_name sym_val_to_name[SYM_BOOLS] #define p_sens_val_to_name sym_val_to_name[SYM_LEVELS] #define p_cat_val_to_name sym_val_to_name[SYM_CATS] /* class, role, and user attributes indexed by (value - 1) */ class_datum_t **class_val_to_struct; role_datum_t **role_val_to_struct; user_datum_t **user_val_to_struct; type_datum_t **type_val_to_struct; /* module stuff section -- used in parsing and for modules */ /* keep track of the scope for every identifier. these are * hash tables, where the key is the identifier name and value * a scope_datum_t. as a convenience, one may use the * p_*_macros (cf. struct scope_index_t declaration). */ symtab_t scope[SYM_NUM]; /* module rule storage */ avrule_block_t *global; /* avrule_decl index used for link/expand */ avrule_decl_t **decl_val_to_struct; /* compiled storage of rules - use for the kernel policy */ /* type enforcement access vectors and transitions */ avtab_t te_avtab; /* bools indexed by (value - 1) */ cond_bool_datum_t **bool_val_to_struct; /* type enforcement conditional access vectors and transitions */ avtab_t te_cond_avtab; /* linked list indexing te_cond_avtab by conditional */ cond_list_t *cond_list; /* role transitions */ role_trans_t *role_tr; /* role allows */ role_allow_t *role_allow; /* security contexts of initial SIDs, unlabeled file systems, TCP or UDP port numbers, network interfaces and nodes */ ocontext_t *ocontexts[OCON_NUM]; /* security contexts for files in filesystems that cannot support a persistent label mapping or use another fixed labeling behavior. */ genfs_t *genfs; /* range transitions table (range_trans_key -> mls_range) */ hashtab_t range_tr; /* file transitions with the last path component */ hashtab_t filename_trans; ebitmap_t *type_attr_map; ebitmap_t *attr_type_map; /* not saved in the binary policy */ ebitmap_t policycaps; /* this bitmap is referenced by type NOT the typical type-1 used in other bitmaps. Someday the 0 bit may be used for global permissive */ ebitmap_t permissive_map; unsigned policyvers; unsigned handle_unknown; } policydb_t; struct sepol_policydb { struct policydb p; }; extern int policydb_init(policydb_t * p); extern int policydb_from_image(sepol_handle_t * handle, void *data, size_t len, policydb_t * policydb); extern int policydb_to_image(sepol_handle_t * handle, policydb_t * policydb, void **newdata, size_t * newlen); extern int policydb_index_classes(policydb_t * p); extern int policydb_index_bools(policydb_t * p); extern int policydb_index_others(sepol_handle_t * handle, policydb_t * p, unsigned int verbose); extern int policydb_role_cache(hashtab_key_t key, hashtab_datum_t datum, void *arg); extern int policydb_user_cache(hashtab_key_t key, hashtab_datum_t datum, void *arg); extern int policydb_reindex_users(policydb_t * p); extern void policydb_destroy(policydb_t * p); extern int policydb_load_isids(policydb_t * p, sidtab_t * s); extern int policydb_sort_ocontexts(policydb_t *p); /* Deprecated */ extern int policydb_context_isvalid(const policydb_t * p, const context_struct_t * c); extern void symtabs_destroy(symtab_t * symtab); extern int scope_destroy(hashtab_key_t key, hashtab_datum_t datum, void *p); extern void class_perm_node_init(class_perm_node_t * x); extern void type_set_init(type_set_t * x); extern void type_set_destroy(type_set_t * x); extern int type_set_cpy(type_set_t * dst, type_set_t * src); extern int type_set_or_eq(type_set_t * dst, type_set_t * other); extern void role_set_init(role_set_t * x); extern void role_set_destroy(role_set_t * x); extern void avrule_init(avrule_t * x); extern void avrule_destroy(avrule_t * x); extern void avrule_list_destroy(avrule_t * x); extern void role_trans_rule_init(role_trans_rule_t * x); extern void role_trans_rule_list_destroy(role_trans_rule_t * x); extern void filename_trans_rule_init(filename_trans_rule_t * x); extern void filename_trans_rule_list_destroy(filename_trans_rule_t * x); extern void role_datum_init(role_datum_t * x); extern void role_datum_destroy(role_datum_t * x); extern void role_allow_rule_init(role_allow_rule_t * x); extern void role_allow_rule_destroy(role_allow_rule_t * x); extern void role_allow_rule_list_destroy(role_allow_rule_t * x); extern void range_trans_rule_init(range_trans_rule_t *x); extern void range_trans_rule_destroy(range_trans_rule_t *x); extern void range_trans_rule_list_destroy(range_trans_rule_t *x); extern void type_datum_init(type_datum_t * x); extern void type_datum_destroy(type_datum_t * x); extern void user_datum_init(user_datum_t * x); extern void user_datum_destroy(user_datum_t * x); extern void level_datum_init(level_datum_t * x); extern void level_datum_destroy(level_datum_t * x); extern void cat_datum_init(cat_datum_t * x); extern void cat_datum_destroy(cat_datum_t * x); extern int check_assertion(policydb_t *p, avrule_t *avrule); extern int check_assertions(sepol_handle_t * handle, policydb_t * p, avrule_t * avrules); extern int symtab_insert(policydb_t * x, uint32_t sym, hashtab_key_t key, hashtab_datum_t datum, uint32_t scope, uint32_t avrule_decl_id, uint32_t * value); /* A policy "file" may be a memory region referenced by a (data, len) pair or a file referenced by a FILE pointer. */ typedef struct policy_file { #define PF_USE_MEMORY 0 #define PF_USE_STDIO 1 #define PF_LEN 2 /* total up length in len field */ unsigned type; char *data; size_t len; size_t size; FILE *fp; struct sepol_handle *handle; } policy_file_t; struct sepol_policy_file { struct policy_file pf; }; extern void policy_file_init(policy_file_t * x); extern int policydb_read(policydb_t * p, struct policy_file *fp, unsigned int verbose); extern int avrule_read_list(policydb_t * p, avrule_t ** avrules, struct policy_file *fp); extern int policydb_write(struct policydb *p, struct policy_file *pf); extern int policydb_set_target_platform(policydb_t *p, int platform); #define PERM_SYMTAB_SIZE 32 /* Identify specific policy version changes */ #define POLICYDB_VERSION_BASE 15 #define POLICYDB_VERSION_BOOL 16 #define POLICYDB_VERSION_IPV6 17 #define POLICYDB_VERSION_NLCLASS 18 #define POLICYDB_VERSION_VALIDATETRANS 19 #define POLICYDB_VERSION_MLS 19 #define POLICYDB_VERSION_AVTAB 20 #define POLICYDB_VERSION_RANGETRANS 21 #define POLICYDB_VERSION_POLCAP 22 #define POLICYDB_VERSION_PERMISSIVE 23 #define POLICYDB_VERSION_BOUNDARY 24 #define POLICYDB_VERSION_FILENAME_TRANS 25 #define POLICYDB_VERSION_ROLETRANS 26 #define POLICYDB_VERSION_NEW_OBJECT_DEFAULTS 27 #define POLICYDB_VERSION_DEFAULT_TYPE 28 #define POLICYDB_VERSION_CONSTRAINT_NAMES 29 #define POLICYDB_VERSION_XEN_DEVICETREE 30 /* Xen-specific */ #define POLICYDB_VERSION_XPERMS_IOCTL 30 /* Linux-specific */ #define POLICYDB_VERSION_INFINIBAND 31 /* Linux-specific */ /* Range of policy versions we understand*/ #define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE #define POLICYDB_VERSION_MAX POLICYDB_VERSION_INFINIBAND /* Module versions and specific changes*/ #define MOD_POLICYDB_VERSION_BASE 4 #define MOD_POLICYDB_VERSION_VALIDATETRANS 5 #define MOD_POLICYDB_VERSION_MLS 5 #define MOD_POLICYDB_VERSION_RANGETRANS 6 #define MOD_POLICYDB_VERSION_MLS_USERS 6 #define MOD_POLICYDB_VERSION_POLCAP 7 #define MOD_POLICYDB_VERSION_PERMISSIVE 8 #define MOD_POLICYDB_VERSION_BOUNDARY 9 #define MOD_POLICYDB_VERSION_BOUNDARY_ALIAS 10 #define MOD_POLICYDB_VERSION_FILENAME_TRANS 11 #define MOD_POLICYDB_VERSION_ROLETRANS 12 #define MOD_POLICYDB_VERSION_ROLEATTRIB 13 #define MOD_POLICYDB_VERSION_TUNABLE_SEP 14 #define MOD_POLICYDB_VERSION_NEW_OBJECT_DEFAULTS 15 #define MOD_POLICYDB_VERSION_DEFAULT_TYPE 16 #define MOD_POLICYDB_VERSION_CONSTRAINT_NAMES 17 #define MOD_POLICYDB_VERSION_XPERMS_IOCTL 18 #define MOD_POLICYDB_VERSION_INFINIBAND 19 #define MOD_POLICYDB_VERSION_MIN MOD_POLICYDB_VERSION_BASE #define MOD_POLICYDB_VERSION_MAX MOD_POLICYDB_VERSION_INFINIBAND #define POLICYDB_CONFIG_MLS 1 /* macros to check policy feature */ /* TODO: add other features here */ #define policydb_has_boundary_feature(p) \ (((p)->policy_type == POLICY_KERN \ && p->policyvers >= POLICYDB_VERSION_BOUNDARY) || \ ((p)->policy_type != POLICY_KERN \ && p->policyvers >= MOD_POLICYDB_VERSION_BOUNDARY)) /* the config flags related to unknown classes/perms are bits 2 and 3 */ #define DENY_UNKNOWN SEPOL_DENY_UNKNOWN #define REJECT_UNKNOWN SEPOL_REJECT_UNKNOWN #define ALLOW_UNKNOWN SEPOL_ALLOW_UNKNOWN #define POLICYDB_CONFIG_UNKNOWN_MASK (DENY_UNKNOWN | REJECT_UNKNOWN | ALLOW_UNKNOWN) #define OBJECT_R "object_r" #define OBJECT_R_VAL 1 #define POLICYDB_MAGIC SELINUX_MAGIC #define POLICYDB_STRING "SE Linux" #define POLICYDB_XEN_STRING "XenFlask" #define POLICYDB_STRING_MAX_LENGTH 32 #define POLICYDB_MOD_MAGIC SELINUX_MOD_MAGIC #define POLICYDB_MOD_STRING "SE Linux Module" #ifdef __cplusplus } #endif #endif /* _POLICYDB_H_ */ /* FLASK */ sepol/policydb/services.h 0000644 00000020607 15063602062 0011474 0 ustar 00 /* -*- linux-c -*- */ /* * Author : Stephen Smalley, <sds@tycho.nsa.gov> */ #ifndef _SEPOL_POLICYDB_SERVICES_H_ #define _SEPOL_POLICYDB_SERVICES_H_ /* * Security server interface. */ #include <sepol/policydb/flask_types.h> #include <sepol/policydb/policydb.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /* Set the policydb and sidtab structures to be used by the service functions. If not set, then these default to private structures within libsepol that can only be initialized and accessed via the service functions themselves. Setting the structures explicitly allows a program to directly manipulate them, e.g. checkpolicy populates the structures directly from a source policy rather than from a binary policy. */ extern int sepol_set_policydb(policydb_t * p); extern int sepol_set_sidtab(sidtab_t * s); /* Modify a policydb for boolean settings. */ int sepol_genbools_policydb(policydb_t * policydb, const char *booleans); /* Modify a policydb for user settings. */ int sepol_genusers_policydb(policydb_t * policydb, const char *usersdir); /* Load the security policy. This initializes the policydb and sidtab based on the provided binary policy. */ extern int sepol_load_policy(void *data, size_t len); /* * Compute access vectors based on a SID pair for * the permissions in a particular class. */ extern int sepol_compute_av(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_access_vector_t requested, /* IN */ struct sepol_av_decision *avd); /* OUT */ /* Same as above, but also return the reason(s) for any denials of the requested permissions. */ #define SEPOL_COMPUTEAV_TE 0x1U #define SEPOL_COMPUTEAV_CONS 0x2U #define SEPOL_COMPUTEAV_RBAC 0x4U #define SEPOL_COMPUTEAV_BOUNDS 0x8U extern int sepol_compute_av_reason(sepol_security_id_t ssid, sepol_security_id_t tsid, sepol_security_class_t tclass, sepol_access_vector_t requested, struct sepol_av_decision *avd, unsigned int *reason); /* * Same as above, but also returns the constraint expression calculations * whether allowed or denied in a buffer. This buffer is allocated by * this call and must be free'd by the caller using free(3). The contraint * buffer will contain any constraints in infix notation. * If the SHOW_GRANTED flag is set it will show granted and denied * constraints. The default is to show only denied constraints. */ #define SHOW_GRANTED 1 extern int sepol_compute_av_reason_buffer(sepol_security_id_t ssid, sepol_security_id_t tsid, sepol_security_class_t tclass, sepol_access_vector_t requested, struct sepol_av_decision *avd, unsigned int *reason, char **reason_buf, unsigned int flags); /* * Returns the mls/validatetrans constraint expression calculations in * a buffer that must be free'd by the caller using free(3). * If the SHOW_GRANTED flag is set it will show granted and denied * mls/validatetrans (the default is to show only those denied). */ extern int sepol_validate_transition_reason_buffer(sepol_security_id_t oldsid, sepol_security_id_t newsid, sepol_security_id_t tasksid, sepol_security_class_t tclass, char **reason_buf, unsigned int flags); /* * Return a class ID associated with the class string representation * specified by `class_name'. */ extern int sepol_string_to_security_class(const char *class_name, sepol_security_class_t *tclass); /* * Return a permission av bit associated with tclass and the string * representation of the `perm_name'. */ extern int sepol_string_to_av_perm(sepol_security_class_t tclass, const char *perm_name, sepol_access_vector_t *av); /* * Compute a SID to use for labeling a new object in the * class `tclass' based on a SID pair. */ extern int sepol_transition_sid(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Compute a SID to use when selecting a member of a * polyinstantiated object of class `tclass' based on * a SID pair. */ extern int sepol_member_sid(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Compute a SID to use for relabeling an object in the * class `tclass' based on a SID pair. */ extern int sepol_change_sid(sepol_security_id_t ssid, /* IN */ sepol_security_id_t tsid, /* IN */ sepol_security_class_t tclass, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Write the security context string representation of * the context associated with `sid' into a dynamically * allocated string of the correct size. Set `*scontext' * to point to this string and set `*scontext_len' to * the length of the string. */ extern int sepol_sid_to_context(sepol_security_id_t sid, /* IN */ sepol_security_context_t * scontext, /* OUT */ size_t * scontext_len); /* OUT */ /* * Return a SID associated with the security context that * has the string representation specified by `scontext'. */ extern int sepol_context_to_sid(const sepol_security_context_t scontext, /* IN */ size_t scontext_len, /* IN */ sepol_security_id_t * out_sid); /* OUT */ /* * Generate the set of SIDs for legal security contexts * for a given user that can be reached by `fromsid'. * Set `*sids' to point to a dynamically allocated * array containing the set of SIDs. Set `*nel' to the * number of elements in the array. */ extern int sepol_get_user_sids(sepol_security_id_t callsid, char *username, sepol_security_id_t ** sids, uint32_t * nel); /* * Return the SIDs to use for an unlabeled file system * that is being mounted from the device with the * the kdevname `name'. The `fs_sid' SID is returned for * the file system and the `file_sid' SID is returned * for all files within that file system. */ extern int sepol_fs_sid(char *dev, /* IN */ sepol_security_id_t * fs_sid, /* OUT */ sepol_security_id_t * file_sid); /* OUT */ /* * Return the SID of the port specified by * `domain', `type', `protocol', and `port'. */ extern int sepol_port_sid(uint16_t domain, uint16_t type, uint8_t protocol, uint16_t port, sepol_security_id_t * out_sid); /* * Return the SID of the ibpkey specified by * `subnet prefix', and `pkey'. */ extern int sepol_ibpkey_sid(uint64_t subnet_prefix_p, uint16_t pkey, sepol_security_id_t *out_sid); /* * Return the SID of the ibendport specified by * `dev_name', and `port'. */ extern int sepol_ibendport_sid(char *dev_name, uint8_t port, sepol_security_id_t *out_sid); /* * Return the SIDs to use for a network interface * with the name `name'. The `if_sid' SID is returned for * the interface and the `msg_sid' SID is returned as * the default SID for messages received on the * interface. */ extern int sepol_netif_sid(char *name, sepol_security_id_t * if_sid, sepol_security_id_t * msg_sid); /* * Return the SID of the node specified by the address * `addr' where `addrlen' is the length of the address * in bytes and `domain' is the communications domain or * address family in which the address should be interpreted. */ extern int sepol_node_sid(uint16_t domain, void *addr, size_t addrlen, sepol_security_id_t * out_sid); /* * Return a value indicating how to handle labeling for the * the specified filesystem type, and optionally return a SID * for the filesystem object. */ #define SECURITY_FS_USE_XATTR 1 /* use xattr */ #define SECURITY_FS_USE_TRANS 2 /* use transition SIDs, e.g. devpts/tmpfs */ #define SECURITY_FS_USE_TASK 3 /* use task SIDs, e.g. pipefs/sockfs */ #define SECURITY_FS_USE_GENFS 4 /* use the genfs support */ #define SECURITY_FS_USE_NONE 5 /* no labeling support */ extern int sepol_fs_use(const char *fstype, /* IN */ unsigned int *behavior, /* OUT */ sepol_security_id_t * sid); /* OUT */ /* * Return the SID to use for a file in a filesystem * that cannot support a persistent label mapping or use another * fixed labeling behavior like transition SIDs or task SIDs. */ extern int sepol_genfs_sid(const char *fstype, /* IN */ const char *name, /* IN */ sepol_security_class_t sclass, /* IN */ sepol_security_id_t * sid); /* OUT */ #ifdef __cplusplus } #endif #endif sepol/policydb/sidtab.h 0000644 00000003670 15063602062 0011120 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* FLASK */ /* * A security identifier table (sidtab) is a hash table * of security context structures indexed by SID value. */ #ifndef _SEPOL_POLICYDB_SIDTAB_H_ #define _SEPOL_POLICYDB_SIDTAB_H_ #include <sepol/policydb/context.h> #ifdef __cplusplus extern "C" { #endif typedef struct sidtab_node { sepol_security_id_t sid; /* security identifier */ context_struct_t context; /* security context structure */ struct sidtab_node *next; } sidtab_node_t; typedef struct sidtab_node *sidtab_ptr_t; #define SIDTAB_HASH_BITS 7 #define SIDTAB_HASH_BUCKETS (1 << SIDTAB_HASH_BITS) #define SIDTAB_HASH_MASK (SIDTAB_HASH_BUCKETS-1) #define SIDTAB_SIZE SIDTAB_HASH_BUCKETS typedef struct { sidtab_ptr_t *htable; unsigned int nel; /* number of elements */ unsigned int next_sid; /* next SID to allocate */ unsigned char shutdown; } sidtab_t; extern int sepol_sidtab_init(sidtab_t * s); extern int sepol_sidtab_insert(sidtab_t * s, sepol_security_id_t sid, context_struct_t * context); extern context_struct_t *sepol_sidtab_search(sidtab_t * s, sepol_security_id_t sid); extern int sepol_sidtab_map(sidtab_t * s, int (*apply) (sepol_security_id_t sid, context_struct_t * context, void *args), void *args); extern void sepol_sidtab_map_remove_on_error(sidtab_t * s, int (*apply) (sepol_security_id_t s, context_struct_t * context, void *args), void *args); extern int sepol_sidtab_context_to_sid(sidtab_t * s, /* IN */ context_struct_t * context, /* IN */ sepol_security_id_t * sid); /* OUT */ extern void sepol_sidtab_hash_eval(sidtab_t * h, char *tag); extern void sepol_sidtab_destroy(sidtab_t * s); extern void sepol_sidtab_set(sidtab_t * dst, sidtab_t * src); extern void sepol_sidtab_shutdown(sidtab_t * s); #ifdef __cplusplus } #endif #endif /* _SIDTAB_H_ */ /* FLASK */ sepol/policydb/symtab.h 0000644 00000002116 15063602062 0011143 0 ustar 00 /* Author : Stephen Smalley, <sds@tycho.nsa.gov> */ /* FLASK */ /* * A symbol table (symtab) maintains associations between symbol * strings and datum values. The type of the datum values * is arbitrary. The symbol table type is implemented * using the hash table type (hashtab). */ #ifndef _SEPOL_POLICYDB_SYMTAB_H_ #define _SEPOL_POLICYDB_SYMTAB_H_ #include <sepol/policydb/hashtab.h> #ifdef __cplusplus extern "C" { #endif /* The symtab_datum struct stores the common information for * all symtab datums. It should the first element in every * struct that will be used in a symtab to allow the specific * datum types to be freely cast to this type. * * The values start at 1 - 0 is never a valid value. */ typedef struct symtab_datum { uint32_t value; } symtab_datum_t; typedef struct { hashtab_t table; /* hash table (keyed on a string) */ uint32_t nprim; /* number of primary names in table */ } symtab_t; extern int symtab_init(symtab_t *, unsigned int size); extern void symtab_destroy(symtab_t *); #ifdef __cplusplus } #endif #endif /* _SYMTAB_H_ */ /* FLASK */ sepol/policydb/util.h 0000644 00000002665 15063602062 0010632 0 ustar 00 /* Authors: Karl MacMillan <kmacmillan@tresys.com> * * A set of utility functions that aid policy decision when dealing * with hierarchal namespaces. * * Copyright (C) 2006 Tresys Technology, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __SEPOL_UTIL_H__ #define __SEPOL_UTIL_H__ #ifdef __cplusplus extern "C" { #endif extern int add_i_to_a(uint32_t i, uint32_t * cnt, uint32_t ** a); extern char *sepol_av_to_string(policydb_t * policydbp, uint32_t tclass, sepol_access_vector_t av); char *sepol_extended_perms_to_string(avtab_extended_perms_t *xperms); /* * The tokenize function may be used to * replace sscanf */ extern int tokenize(char *line_buf, char delim, int num_args, ...); #ifdef __cplusplus } #endif #endif sepol/boolean_record.h 0000644 00000003017 15063602062 0011015 0 ustar 00 #ifndef _SEPOL_BOOLEAN_RECORD_H_ #define _SEPOL_BOOLEAN_RECORD_H_ #include <stddef.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif struct sepol_bool; struct sepol_bool_key; typedef struct sepol_bool sepol_bool_t; typedef struct sepol_bool_key sepol_bool_key_t; /* Key */ extern int sepol_bool_key_create(sepol_handle_t * handle, const char *name, sepol_bool_key_t ** key); extern void sepol_bool_key_unpack(const sepol_bool_key_t * key, const char **name); extern int sepol_bool_key_extract(sepol_handle_t * handle, const sepol_bool_t * boolean, sepol_bool_key_t ** key_ptr); extern void sepol_bool_key_free(sepol_bool_key_t * key); extern int sepol_bool_compare(const sepol_bool_t * boolean, const sepol_bool_key_t * key); extern int sepol_bool_compare2(const sepol_bool_t * boolean, const sepol_bool_t * boolean2); /* Name */ extern const char *sepol_bool_get_name(const sepol_bool_t * boolean); extern int sepol_bool_set_name(sepol_handle_t * handle, sepol_bool_t * boolean, const char *name); /* Value */ extern int sepol_bool_get_value(const sepol_bool_t * boolean); extern void sepol_bool_set_value(sepol_bool_t * boolean, int value); /* Create/Clone/Destroy */ extern int sepol_bool_create(sepol_handle_t * handle, sepol_bool_t ** bool_ptr); extern int sepol_bool_clone(sepol_handle_t * handle, const sepol_bool_t * boolean, sepol_bool_t ** bool_ptr); extern void sepol_bool_free(sepol_bool_t * boolean); #ifdef __cplusplus } #endif #endif sepol/booleans.h 0000644 00000004304 15063602062 0007642 0 ustar 00 #ifndef _SEPOL_BOOLEANS_H_ #define _SEPOL_BOOLEANS_H_ #include <stddef.h> #include <sepol/policydb.h> #include <sepol/boolean_record.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif /*--------------compatibility--------------*/ /* Given an existing binary policy (starting at 'data', with length 'len') and a boolean configuration file named by 'boolpath', rewrite the binary policy for the boolean settings in the boolean configuration file. The binary policy is rewritten in place in memory. Returns 0 upon success, or -1 otherwise. */ extern int sepol_genbools(void *data, size_t len, const char *boolpath); /* Given an existing binary policy (starting at 'data', with length 'len') and boolean settings specified by the parallel arrays ('names', 'values') with 'nel' elements, rewrite the binary policy for the boolean settings. The binary policy is rewritten in place in memory. Returns 0 upon success or -1 otherwise. */ extern int sepol_genbools_array(void *data, size_t len, char **names, int *values, int nel); /*---------------end compatbility------------*/ /* Set the specified boolean */ extern int sepol_bool_set(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_bool_key_t * key, const sepol_bool_t * data); /* Return the number of booleans */ extern int sepol_bool_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if the specified boolean exists */ extern int sepol_bool_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_bool_key_t * key, int *response); /* Query a boolean - returns the boolean, or NULL if not found */ extern int sepol_bool_query(sepol_handle_t * handle, const sepol_policydb_t * p, const sepol_bool_key_t * key, sepol_bool_t ** response); /* Iterate the booleans * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_bool_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_bool_t * boolean, void *fn_arg), void *arg); #ifdef __cplusplus } #endif #endif sepol/context.h 0000644 00000001360 15063602062 0007523 0 ustar 00 #ifndef _SEPOL_CONTEXT_H_ #define _SEPOL_CONTEXT_H_ #include <sepol/context_record.h> #include <sepol/policydb.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif /* -- Deprecated -- */ extern int sepol_check_context(const char *context); /* -- End deprecated -- */ extern int sepol_context_check(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_context_t * context); extern int sepol_mls_contains(sepol_handle_t * handle, const sepol_policydb_t * policydb, const char *mls1, const char *mls2, int *response); extern int sepol_mls_check(sepol_handle_t * handle, const sepol_policydb_t * policydb, const char *mls); #ifdef __cplusplus } #endif #endif sepol/context_record.h 0000644 00000003206 15063602062 0011062 0 ustar 00 #ifndef _SEPOL_CONTEXT_RECORD_H_ #define _SEPOL_CONTEXT_RECORD_H_ #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif struct sepol_context; typedef struct sepol_context sepol_context_t; /* We don't need a key, because the context is never stored * in a data collection by itself */ /* User */ extern const char *sepol_context_get_user(const sepol_context_t * con); extern int sepol_context_set_user(sepol_handle_t * handle, sepol_context_t * con, const char *user); /* Role */ extern const char *sepol_context_get_role(const sepol_context_t * con); extern int sepol_context_set_role(sepol_handle_t * handle, sepol_context_t * con, const char *role); /* Type */ extern const char *sepol_context_get_type(const sepol_context_t * con); extern int sepol_context_set_type(sepol_handle_t * handle, sepol_context_t * con, const char *type); /* MLS */ extern const char *sepol_context_get_mls(const sepol_context_t * con); extern int sepol_context_set_mls(sepol_handle_t * handle, sepol_context_t * con, const char *mls_range); /* Create/Clone/Destroy */ extern int sepol_context_create(sepol_handle_t * handle, sepol_context_t ** con_ptr); extern int sepol_context_clone(sepol_handle_t * handle, const sepol_context_t * con, sepol_context_t ** con_ptr); extern void sepol_context_free(sepol_context_t * con); /* Parse to/from string */ extern int sepol_context_from_string(sepol_handle_t * handle, const char *str, sepol_context_t ** con); extern int sepol_context_to_string(sepol_handle_t * handle, const sepol_context_t * con, char **str_ptr); #ifdef __cplusplus } #endif #endif sepol/debug.h 0000644 00000001717 15063602062 0007133 0 ustar 00 #ifndef _SEPOL_DEBUG_H_ #define _SEPOL_DEBUG_H_ #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif /* Deprecated */ extern void sepol_debug(int on); /* End deprecated */ #define SEPOL_MSG_ERR 1 #define SEPOL_MSG_WARN 2 #define SEPOL_MSG_INFO 3 extern int sepol_msg_get_level(sepol_handle_t * handle); extern const char *sepol_msg_get_channel(sepol_handle_t * handle); extern const char *sepol_msg_get_fname(sepol_handle_t * handle); /* Set the messaging callback. * By the default, the callback will print * the message on standard output, in a * particular format. Passing NULL here * indicates that messaging should be suppressed */ extern void sepol_msg_set_callback(sepol_handle_t * handle, #ifdef __GNUC__ __attribute__ ((format(printf, 3, 4))) #endif void (*msg_callback) (void *varg, sepol_handle_t * handle, const char *fmt, ...), void *msg_callback_arg); #ifdef __cplusplus } #endif #endif sepol/errcodes.h 0000644 00000001523 15063602062 0007646 0 ustar 00 /* Author: Karl MacMillan <kmacmillan@mentalrootkit.com> */ #ifndef __sepol_errno_h__ #define __sepol_errno_h__ #include <errno.h> #ifdef __cplusplus extern "C" { #endif #define SEPOL_OK 0 /* These first error codes are defined for compatibility with * previous version of libsepol. In the future, custom error * codes that don't map to system error codes should be defined * outside of the range of system error codes. */ #define SEPOL_ERR -1 #define SEPOL_ENOTSUP -2 /* feature not supported in module language */ #define SEPOL_EREQ -3 /* requirements not met */ /* Error codes that map to system error codes */ #define SEPOL_ENOMEM -ENOMEM #define SEPOL_ERANGE -ERANGE #define SEPOL_EEXIST -EEXIST #define SEPOL_ENOENT -ENOENT #ifdef __cplusplus } #endif #endif sepol/handle.h 0000644 00000002561 15063602062 0007276 0 ustar 00 #ifndef _SEPOL_HANDLE_H_ #define _SEPOL_HANDLE_H_ #ifdef __cplusplus extern "C" { #endif struct sepol_handle; typedef struct sepol_handle sepol_handle_t; /* Create and return a sepol handle. */ sepol_handle_t *sepol_handle_create(void); /* Get whether or not dontaudits will be disabled, same values as * specified by set_disable_dontaudit. This value reflects the state * your system will be set to upon commit, not necessarily its * current state.*/ int sepol_get_disable_dontaudit(sepol_handle_t * sh); /* Set whether or not to disable dontaudits, 0 is default and does * not disable dontaudits, 1 disables them */ void sepol_set_disable_dontaudit(sepol_handle_t * sh, int disable_dontaudit); /* Set whether module_expand() should consume the base policy passed in. * This should reduce the amount of memory required to expand the policy. */ void sepol_set_expand_consume_base(sepol_handle_t * sh, int consume_base); /* Destroy a sepol handle. */ void sepol_handle_destroy(sepol_handle_t *); /* Get whether or not needless unused branch of tunables would be preserved */ int sepol_get_preserve_tunables(sepol_handle_t * sh); /* Set whether or not to preserve the needless unused branch of tunables, * 0 is default and discard such branch, 1 preserves them */ void sepol_set_preserve_tunables(sepol_handle_t * sh, int preserve_tunables); #ifdef __cplusplus } #endif #endif sepol/ibendport_record.h 0000644 00000004206 15063602062 0011365 0 ustar 00 #ifndef _SEPOL_IBENDPORT_RECORD_H_ #define _SEPOL_IBENDPORT_RECORD_H_ #include <stddef.h> #include <sepol/context_record.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif struct sepol_ibendport; struct sepol_ibendport_key; typedef struct sepol_ibendport sepol_ibendport_t; typedef struct sepol_ibendport_key sepol_ibendport_key_t; extern int sepol_ibendport_compare(const sepol_ibendport_t *ibendport, const sepol_ibendport_key_t *key); extern int sepol_ibendport_compare2(const sepol_ibendport_t *ibendport, const sepol_ibendport_t *ibendport2); extern int sepol_ibendport_key_create(sepol_handle_t *handle, const char *ibdev_name, int port, sepol_ibendport_key_t **key_ptr); extern void sepol_ibendport_key_unpack(const sepol_ibendport_key_t *key, const char **ibdev_name, int *port); extern int sepol_ibendport_alloc_ibdev_name(sepol_handle_t *handle, char **ibdev_name); extern int sepol_ibendport_key_extract(sepol_handle_t *handle, const sepol_ibendport_t *ibendport, sepol_ibendport_key_t **key_ptr); extern void sepol_ibendport_key_free(sepol_ibendport_key_t *key); extern void sepol_ibendport_set_port(sepol_ibendport_t *ibendport, int port); extern int sepol_ibendport_get_port(const sepol_ibendport_t *ibendport); extern int sepol_ibendport_get_ibdev_name(sepol_handle_t *handle, const sepol_ibendport_t *ibendport, char **ibdev_name); extern int sepol_ibendport_set_ibdev_name(sepol_handle_t *handle, sepol_ibendport_t *ibendport, const char *ibdev_name); extern sepol_context_t *sepol_ibendport_get_con(const sepol_ibendport_t *ibendport); extern int sepol_ibendport_set_con(sepol_handle_t *handle, sepol_ibendport_t *ibendport, sepol_context_t *con); extern int sepol_ibendport_create(sepol_handle_t *handle, sepol_ibendport_t **ibendport_ptr); extern int sepol_ibendport_clone(sepol_handle_t *handle, const sepol_ibendport_t *ibendport, sepol_ibendport_t **ibendport_ptr); extern void sepol_ibendport_free(sepol_ibendport_t *ibendport); #ifdef __cplusplus } #endif #endif sepol/ibendports.h 0000644 00000002553 15063602062 0010215 0 ustar 00 #ifndef _SEPOL_IBENDPORTS_H_ #define _SEPOL_IBENDPORTS_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/ibendport_record.h> #ifdef __cplusplus extern "C" { #endif /* Return the number of ibendports */ extern int sepol_ibendport_count(sepol_handle_t *handle, const sepol_policydb_t *p, unsigned int *response); /* Check if a ibendport exists */ extern int sepol_ibendport_exists(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibendport_key_t *key, int *response); /* Query a ibendport - returns the ibendport, or NULL if not found */ extern int sepol_ibendport_query(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibendport_key_t *key, sepol_ibendport_t **response); /* Modify a ibendport, or add it, if the key is not found */ extern int sepol_ibendport_modify(sepol_handle_t *handle, sepol_policydb_t *policydb, const sepol_ibendport_key_t *key, const sepol_ibendport_t *data); /* Iterate the ibendports * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_ibendport_iterate(sepol_handle_t *handle, const sepol_policydb_t *policydb, int (*fn)(const sepol_ibendport_t *ibendport, void *fn_arg), void *arg); #ifdef __cplusplus } #endif #endif sepol/ibpkey_record.h 0000644 00000004375 15063602062 0010671 0 ustar 00 #ifndef _SEPOL_IBPKEY_RECORD_H_ #define _SEPOL_IBPKEY_RECORD_H_ #include <stddef.h> #include <stdint.h> #include <sepol/context_record.h> #include <sepol/handle.h> #define INET6_ADDRLEN 16 #ifdef __cplusplus extern "C" { #endif struct sepol_ibpkey; struct sepol_ibpkey_key; typedef struct sepol_ibpkey sepol_ibpkey_t; typedef struct sepol_ibpkey_key sepol_ibpkey_key_t; extern int sepol_ibpkey_compare(const sepol_ibpkey_t *ibpkey, const sepol_ibpkey_key_t *key); extern int sepol_ibpkey_compare2(const sepol_ibpkey_t *ibpkey, const sepol_ibpkey_t *ibpkey2); extern int sepol_ibpkey_key_create(sepol_handle_t *handle, const char *subnet_prefix, int low, int high, sepol_ibpkey_key_t **key_ptr); extern void sepol_ibpkey_key_unpack(const sepol_ibpkey_key_t *key, uint64_t *subnet_prefix, int *low, int *high); extern int sepol_ibpkey_key_extract(sepol_handle_t *handle, const sepol_ibpkey_t *ibpkey, sepol_ibpkey_key_t **key_ptr); extern void sepol_ibpkey_key_free(sepol_ibpkey_key_t *key); extern int sepol_ibpkey_get_low(const sepol_ibpkey_t *ibpkey); extern int sepol_ibpkey_get_high(const sepol_ibpkey_t *ibpkey); extern void sepol_ibpkey_set_pkey(sepol_ibpkey_t *ibpkey, int pkey_num); extern void sepol_ibpkey_set_range(sepol_ibpkey_t *ibpkey, int low, int high); extern int sepol_ibpkey_get_subnet_prefix(sepol_handle_t *handle, const sepol_ibpkey_t *ibpkey, char **subnet_prefix); extern uint64_t sepol_ibpkey_get_subnet_prefix_bytes(const sepol_ibpkey_t *ibpkey); extern int sepol_ibpkey_set_subnet_prefix(sepol_handle_t *handle, sepol_ibpkey_t *ibpkey, const char *subnet_prefix); extern void sepol_ibpkey_set_subnet_prefix_bytes(sepol_ibpkey_t *ibpkey, uint64_t subnet_prefix); extern sepol_context_t *sepol_ibpkey_get_con(const sepol_ibpkey_t *ibpkey); extern int sepol_ibpkey_set_con(sepol_handle_t *handle, sepol_ibpkey_t *ibpkey, sepol_context_t *con); extern int sepol_ibpkey_create(sepol_handle_t *handle, sepol_ibpkey_t **ibpkey_ptr); extern int sepol_ibpkey_clone(sepol_handle_t *handle, const sepol_ibpkey_t *ibpkey, sepol_ibpkey_t **ibpkey_ptr); extern void sepol_ibpkey_free(sepol_ibpkey_t *ibpkey); #ifdef __cplusplus } #endif #endif sepol/ibpkeys.h 0000644 00000002503 15063602062 0007505 0 ustar 00 #ifndef _SEPOL_IBPKEYS_H_ #define _SEPOL_IBPKEYS_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/ibpkey_record.h> #ifdef __cplusplus extern "C" { #endif /* Return the number of ibpkeys */ extern int sepol_ibpkey_count(sepol_handle_t *handle, const sepol_policydb_t *p, unsigned int *response); /* Check if a ibpkey exists */ extern int sepol_ibpkey_exists(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibpkey_key_t *key, int *response); /* Query a ibpkey - returns the ibpkey, or NULL if not found */ extern int sepol_ibpkey_query(sepol_handle_t *handle, const sepol_policydb_t *policydb, const sepol_ibpkey_key_t *key, sepol_ibpkey_t **response); /* Modify a ibpkey, or add it, if the key is not found */ extern int sepol_ibpkey_modify(sepol_handle_t *handle, sepol_policydb_t *policydb, const sepol_ibpkey_key_t *key, const sepol_ibpkey_t *data); /* Iterate the ibpkeys * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_ibpkey_iterate(sepol_handle_t *handle, const sepol_policydb_t *policydb, int (*fn)(const sepol_ibpkey_t *ibpkey, void *fn_arg), void *arg); #ifdef __cplusplus } #endif #endif sepol/iface_record.h 0000644 00000003460 15063602062 0010447 0 ustar 00 #ifndef _SEPOL_IFACE_RECORD_H_ #define _SEPOL_IFACE_RECORD_H_ #include <sepol/handle.h> #include <sepol/context_record.h> #ifdef __cplusplus extern "C" { #endif struct sepol_iface; struct sepol_iface_key; typedef struct sepol_iface sepol_iface_t; typedef struct sepol_iface_key sepol_iface_key_t; /* Key */ extern int sepol_iface_compare(const sepol_iface_t * iface, const sepol_iface_key_t * key); extern int sepol_iface_compare2(const sepol_iface_t * iface, const sepol_iface_t * iface2); extern void sepol_iface_key_unpack(const sepol_iface_key_t * key, const char **name); extern int sepol_iface_key_create(sepol_handle_t * handle, const char *name, sepol_iface_key_t ** key_ptr); extern int sepol_iface_key_extract(sepol_handle_t * handle, const sepol_iface_t * iface, sepol_iface_key_t ** key_ptr); extern void sepol_iface_key_free(sepol_iface_key_t * key); /* Name */ extern const char *sepol_iface_get_name(const sepol_iface_t * iface); extern int sepol_iface_set_name(sepol_handle_t * handle, sepol_iface_t * iface, const char *name); /* Context */ extern sepol_context_t *sepol_iface_get_ifcon(const sepol_iface_t * iface); extern int sepol_iface_set_ifcon(sepol_handle_t * handle, sepol_iface_t * iface, sepol_context_t * con); extern sepol_context_t *sepol_iface_get_msgcon(const sepol_iface_t * iface); extern int sepol_iface_set_msgcon(sepol_handle_t * handle, sepol_iface_t * iface, sepol_context_t * con); /* Create/Clone/Destroy */ extern int sepol_iface_create(sepol_handle_t * handle, sepol_iface_t ** iface_ptr); extern int sepol_iface_clone(sepol_handle_t * handle, const sepol_iface_t * iface, sepol_iface_t ** iface_ptr); extern void sepol_iface_free(sepol_iface_t * iface); #ifdef __cplusplus } #endif #endif sepol/interfaces.h 0000644 00000002573 15063602062 0010171 0 ustar 00 #ifndef __SEPOL_INTERFACES_H_ #define __SEPOL_INTERFACES_H_ #include <sepol/policydb.h> #include <sepol/iface_record.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif /* Return the number of interfaces */ extern int sepol_iface_count(sepol_handle_t * handle, const sepol_policydb_t * policydb, unsigned int *response); /* Check if an interface exists */ extern int sepol_iface_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_iface_key_t * key, int *response); /* Query an interface - returns the interface, * or NULL if not found */ extern int sepol_iface_query(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_iface_key_t * key, sepol_iface_t ** response); /* Modify an interface, or add it, if the key * is not found */ extern int sepol_iface_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_iface_key_t * key, const sepol_iface_t * data); /* Iterate the interfaces * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_iface_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_iface_t * iface, void *fn_arg), void *arg); #ifdef __cplusplus } #endif #endif sepol/kernel_to_cil.h 0000644 00000000175 15063602062 0010653 0 ustar 00 #include <stdlib.h> #include <sepol/policydb/policydb.h> int sepol_kernel_policydb_to_cil(FILE *fp, struct policydb *pdb); sepol/kernel_to_conf.h 0000644 00000000176 15063602062 0011032 0 ustar 00 #include <stdlib.h> #include <sepol/policydb/policydb.h> int sepol_kernel_policydb_to_conf(FILE *fp, struct policydb *pdb); sepol/module.h 0000644 00000005170 15063602062 0007327 0 ustar 00 #ifndef _SEPOL_MODULE_H_ #define _SEPOL_MODULE_H_ #include <stddef.h> #include <stdio.h> #include <stdint.h> #include <sepol/handle.h> #include <sepol/policydb.h> #ifdef __cplusplus extern "C" { #endif struct sepol_module_package; typedef struct sepol_module_package sepol_module_package_t; /* Module package public interfaces. */ extern int sepol_module_package_create(sepol_module_package_t ** p); extern void sepol_module_package_free(sepol_module_package_t * p); extern char *sepol_module_package_get_file_contexts(sepol_module_package_t * p); extern size_t sepol_module_package_get_file_contexts_len(sepol_module_package_t * p); extern int sepol_module_package_set_file_contexts(sepol_module_package_t * p, char *data, size_t len); extern char *sepol_module_package_get_seusers(sepol_module_package_t * p); extern size_t sepol_module_package_get_seusers_len(sepol_module_package_t * p); extern int sepol_module_package_set_seusers(sepol_module_package_t * p, char *data, size_t len); extern char *sepol_module_package_get_user_extra(sepol_module_package_t * p); extern size_t sepol_module_package_get_user_extra_len(sepol_module_package_t * p); extern int sepol_module_package_set_user_extra(sepol_module_package_t * p, char *data, size_t len); extern char *sepol_module_package_get_netfilter_contexts(sepol_module_package_t * p); extern size_t sepol_module_package_get_netfilter_contexts_len(sepol_module_package_t * p); extern int sepol_module_package_set_netfilter_contexts(sepol_module_package_t * p, char *data, size_t len); extern sepol_policydb_t *sepol_module_package_get_policy(sepol_module_package_t * p); extern int sepol_link_packages(sepol_handle_t * handle, sepol_module_package_t * base, sepol_module_package_t ** modules, int num_modules, int verbose); extern int sepol_module_package_read(sepol_module_package_t * mod, struct sepol_policy_file *file, int verbose); extern int sepol_module_package_info(struct sepol_policy_file *file, int *type, char **name, char **version); extern int sepol_module_package_write(sepol_module_package_t * p, struct sepol_policy_file *file); /* Module linking/expanding public interfaces. */ extern int sepol_link_modules(sepol_handle_t * handle, sepol_policydb_t * base, sepol_policydb_t ** modules, size_t len, int verbose); extern int sepol_expand_module(sepol_handle_t * handle, sepol_policydb_t * base, sepol_policydb_t * out, int verbose, int check); #ifdef __cplusplus } #endif #endif sepol/module_to_cil.h 0000644 00000000511 15063602062 0010652 0 ustar 00 #include <stdlib.h> #include <sepol/module.h> #include <sepol/policydb/policydb.h> int sepol_module_policydb_to_cil(FILE *fp, struct policydb *pdb, int linked); int sepol_module_package_to_cil(FILE *fp, struct sepol_module_package *mod_pkg); int sepol_ppfile_to_module_package(FILE *fp, struct sepol_module_package **mod_pkg); sepol/node_record.h 0000644 00000005366 15063602062 0010334 0 ustar 00 #ifndef _SEPOL_NODE_RECORD_H_ #define _SEPOL_NODE_RECORD_H_ #include <stddef.h> #include <sepol/context_record.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif struct sepol_node; struct sepol_node_key; typedef struct sepol_node sepol_node_t; typedef struct sepol_node_key sepol_node_key_t; #define SEPOL_PROTO_IP4 0 #define SEPOL_PROTO_IP6 1 /* Key */ extern int sepol_node_compare(const sepol_node_t * node, const sepol_node_key_t * key); extern int sepol_node_compare2(const sepol_node_t * node, const sepol_node_t * node2); extern int sepol_node_key_create(sepol_handle_t * handle, const char *addr, const char *mask, int proto, sepol_node_key_t ** key_ptr); extern void sepol_node_key_unpack(const sepol_node_key_t * key, const char **addr, const char **mask, int *proto); extern int sepol_node_key_extract(sepol_handle_t * handle, const sepol_node_t * node, sepol_node_key_t ** key_ptr); extern void sepol_node_key_free(sepol_node_key_t * key); /* Address */ extern int sepol_node_get_addr(sepol_handle_t * handle, const sepol_node_t * node, char **addr); extern int sepol_node_get_addr_bytes(sepol_handle_t * handle, const sepol_node_t * node, char **addr, size_t * addr_sz); extern int sepol_node_set_addr(sepol_handle_t * handle, sepol_node_t * node, int proto, const char *addr); extern int sepol_node_set_addr_bytes(sepol_handle_t * handle, sepol_node_t * node, const char *addr, size_t addr_sz); /* Netmask */ extern int sepol_node_get_mask(sepol_handle_t * handle, const sepol_node_t * node, char **mask); extern int sepol_node_get_mask_bytes(sepol_handle_t * handle, const sepol_node_t * node, char **mask, size_t * mask_sz); extern int sepol_node_set_mask(sepol_handle_t * handle, sepol_node_t * node, int proto, const char *mask); extern int sepol_node_set_mask_bytes(sepol_handle_t * handle, sepol_node_t * node, const char *mask, size_t mask_sz); /* Protocol */ extern int sepol_node_get_proto(const sepol_node_t * node); extern void sepol_node_set_proto(sepol_node_t * node, int proto); extern const char *sepol_node_get_proto_str(int proto); /* Context */ extern sepol_context_t *sepol_node_get_con(const sepol_node_t * node); extern int sepol_node_set_con(sepol_handle_t * handle, sepol_node_t * node, sepol_context_t * con); /* Create/Clone/Destroy */ extern int sepol_node_create(sepol_handle_t * handle, sepol_node_t ** node_ptr); extern int sepol_node_clone(sepol_handle_t * handle, const sepol_node_t * node, sepol_node_t ** node_ptr); extern void sepol_node_free(sepol_node_t * node); #ifdef __cplusplus } #endif #endif sepol/nodes.h 0000644 00000002440 15063602062 0007147 0 ustar 00 #ifndef _SEPOL_NODES_H_ #define _SEPOL_NODES_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/node_record.h> #ifdef __cplusplus extern "C" { #endif /* Return the number of nodes */ extern int sepol_node_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if a node exists */ extern int sepol_node_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_node_key_t * key, int *response); /* Query a node - returns the node, or NULL if not found */ extern int sepol_node_query(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_node_key_t * key, sepol_node_t ** response); /* Modify a node, or add it, if the key is not found */ extern int sepol_node_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_node_key_t * key, const sepol_node_t * data); /* Iterate the nodes * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_node_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_node_t * node, void *fn_arg), void *arg); #ifdef __cplusplus } #endif #endif sepol/policydb.h 0000644 00000011127 15063602062 0007646 0 ustar 00 #ifndef _SEPOL_POLICYDB_H_ #define _SEPOL_POLICYDB_H_ #include <stddef.h> #include <stdio.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif struct sepol_policy_file; typedef struct sepol_policy_file sepol_policy_file_t; struct sepol_policydb; typedef struct sepol_policydb sepol_policydb_t; /* Policy file public interfaces. */ /* Create and free memory associated with a policy file. */ extern int sepol_policy_file_create(sepol_policy_file_t ** pf); extern void sepol_policy_file_free(sepol_policy_file_t * pf); /* * Set the policy file to represent a binary policy memory image. * Subsequent operations using the policy file will read and write * the image located at the specified address with the specified length. * If 'len' is 0, then merely compute the necessary length upon * subsequent policydb write operations in order to determine the * necessary buffer size to allocate. */ extern void sepol_policy_file_set_mem(sepol_policy_file_t * pf, char *data, size_t len); /* * Get the size of the buffer needed to store a policydb write * previously done on this policy file. */ extern int sepol_policy_file_get_len(sepol_policy_file_t * pf, size_t * len); /* * Set the policy file to represent a FILE. * Subsequent operations using the policy file will read and write * to the FILE. */ extern void sepol_policy_file_set_fp(sepol_policy_file_t * pf, FILE * fp); /* * Associate a handle with a policy file, for use in * error reporting from subsequent calls that take the * policy file as an argument. */ extern void sepol_policy_file_set_handle(sepol_policy_file_t * pf, sepol_handle_t * handle); /* Policydb public interfaces. */ /* Create and free memory associated with a policydb. */ extern int sepol_policydb_create(sepol_policydb_t ** p); extern void sepol_policydb_free(sepol_policydb_t * p); /* Legal types of policies that the policydb can represent. */ #define SEPOL_POLICY_KERN 0 #define SEPOL_POLICY_BASE 1 #define SEPOL_POLICY_MOD 2 /* * Range of policy versions for the kernel policy type supported * by this library. */ extern int sepol_policy_kern_vers_min(void); extern int sepol_policy_kern_vers_max(void); /* * Set the policy type as specified, and automatically initialize the * policy version accordingly to the maximum version supported for the * policy type. * Returns -1 if the policy type is not legal. */ extern int sepol_policydb_set_typevers(sepol_policydb_t * p, unsigned int type); /* * Set the policy version to a different value. * Returns -1 if the policy version is not in the supported range for * the (previously set) policy type. */ extern int sepol_policydb_set_vers(sepol_policydb_t * p, unsigned int vers); /* Set how to handle unknown class/perms. */ #define SEPOL_DENY_UNKNOWN 0 #define SEPOL_REJECT_UNKNOWN 2 #define SEPOL_ALLOW_UNKNOWN 4 extern int sepol_policydb_set_handle_unknown(sepol_policydb_t * p, unsigned int handle_unknown); /* Set the target platform */ #define SEPOL_TARGET_SELINUX 0 #define SEPOL_TARGET_XEN 1 extern int sepol_policydb_set_target_platform(sepol_policydb_t * p, int target_platform); /* * Read a policydb from a policy file. * This automatically sets the type and version based on the * image contents. */ extern int sepol_policydb_read(sepol_policydb_t * p, sepol_policy_file_t * pf); /* * Write a policydb to a policy file. * The generated image will be in the binary format corresponding * to the policy version associated with the policydb. */ extern int sepol_policydb_write(sepol_policydb_t * p, sepol_policy_file_t * pf); /* * Extract a policydb from a binary policy memory image. * This is equivalent to sepol_policydb_read with a policy file * set to refer to memory. */ extern int sepol_policydb_from_image(sepol_handle_t * handle, void *data, size_t len, sepol_policydb_t * p); /* * Generate a binary policy memory image from a policydb. * This is equivalent to sepol_policydb_write with a policy file * set to refer to memory, but internally handles computing the * necessary length and allocating an appropriately sized memory * buffer for the caller. */ extern int sepol_policydb_to_image(sepol_handle_t * handle, sepol_policydb_t * p, void **newdata, size_t * newlen); /* * Check whether the policydb has MLS enabled. */ extern int sepol_policydb_mls_enabled(const sepol_policydb_t * p); /* * Check whether the compatibility mode for SELinux network * checks should be enabled when using this policy. */ extern int sepol_policydb_compat_net(const sepol_policydb_t * p); #ifdef __cplusplus } #endif #endif sepol/port_record.h 0000644 00000003737 15063602062 0010373 0 ustar 00 #ifndef _SEPOL_PORT_RECORD_H_ #define _SEPOL_PORT_RECORD_H_ #include <sepol/context_record.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif struct sepol_port; struct sepol_port_key; typedef struct sepol_port sepol_port_t; typedef struct sepol_port_key sepol_port_key_t; #define SEPOL_PROTO_UDP 0 #define SEPOL_PROTO_TCP 1 #define SEPOL_PROTO_DCCP 2 #define SEPOL_PROTO_SCTP 3 /* Key */ extern int sepol_port_compare(const sepol_port_t * port, const sepol_port_key_t * key); extern int sepol_port_compare2(const sepol_port_t * port, const sepol_port_t * port2); extern int sepol_port_key_create(sepol_handle_t * handle, int low, int high, int proto, sepol_port_key_t ** key_ptr); extern void sepol_port_key_unpack(const sepol_port_key_t * key, int *low, int *high, int *proto); extern int sepol_port_key_extract(sepol_handle_t * handle, const sepol_port_t * port, sepol_port_key_t ** key_ptr); extern void sepol_port_key_free(sepol_port_key_t * key); /* Protocol */ extern int sepol_port_get_proto(const sepol_port_t * port); extern void sepol_port_set_proto(sepol_port_t * port, int proto); extern const char *sepol_port_get_proto_str(int proto); /* Port */ extern int sepol_port_get_low(const sepol_port_t * port); extern int sepol_port_get_high(const sepol_port_t * port); extern void sepol_port_set_port(sepol_port_t * port, int port_num); extern void sepol_port_set_range(sepol_port_t * port, int low, int high); /* Context */ extern sepol_context_t *sepol_port_get_con(const sepol_port_t * port); extern int sepol_port_set_con(sepol_handle_t * handle, sepol_port_t * port, sepol_context_t * con); /* Create/Clone/Destroy */ extern int sepol_port_create(sepol_handle_t * handle, sepol_port_t ** port_ptr); extern int sepol_port_clone(sepol_handle_t * handle, const sepol_port_t * port, sepol_port_t ** port_ptr); extern void sepol_port_free(sepol_port_t * port); #ifdef __cplusplus } #endif #endif sepol/ports.h 0000644 00000002440 15063602062 0007206 0 ustar 00 #ifndef _SEPOL_PORTS_H_ #define _SEPOL_PORTS_H_ #include <sepol/handle.h> #include <sepol/policydb.h> #include <sepol/port_record.h> #ifdef __cplusplus extern "C" { #endif /* Return the number of ports */ extern int sepol_port_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if a port exists */ extern int sepol_port_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_port_key_t * key, int *response); /* Query a port - returns the port, or NULL if not found */ extern int sepol_port_query(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_port_key_t * key, sepol_port_t ** response); /* Modify a port, or add it, if the key is not found */ extern int sepol_port_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_port_key_t * key, const sepol_port_t * data); /* Iterate the ports * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_port_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_port_t * port, void *fn_arg), void *arg); #ifdef __cplusplus } #endif #endif sepol/roles.h 0000644 00000000523 15063602062 0007163 0 ustar 00 #ifndef _SEPOL_ROLES_H_ #define _SEPOL_ROLES_H_ #ifdef __cplusplus extern "C" { #endif extern int sepol_role_exists(const sepol_policydb_t * policydb, const char *role, int *response); extern int sepol_role_list(const sepol_policydb_t * policydb, char ***roles, unsigned int *nroles); #ifdef __cplusplus } #endif #endif sepol/sepol.h 0000644 00000001536 15063602062 0007166 0 ustar 00 #ifndef _SEPOL_H_ #define _SEPOL_H_ #include <stddef.h> #include <stdio.h> #ifdef __cplusplus extern "C" { #endif #include <sepol/user_record.h> #include <sepol/context_record.h> #include <sepol/iface_record.h> #include <sepol/ibpkey_record.h> #include <sepol/ibendport_record.h> #include <sepol/port_record.h> #include <sepol/boolean_record.h> #include <sepol/node_record.h> #include <sepol/booleans.h> #include <sepol/interfaces.h> #include <sepol/ibpkeys.h> #include <sepol/ibendports.h> #include <sepol/ports.h> #include <sepol/nodes.h> #include <sepol/users.h> #include <sepol/handle.h> #include <sepol/debug.h> #include <sepol/policydb.h> #include <sepol/module.h> #include <sepol/context.h> /* Set internal policydb from a file for subsequent service calls. */ extern int sepol_set_policydb_from_file(FILE * fp); #ifdef __cplusplus } #endif #endif sepol/user_record.h 0000644 00000004520 15063602062 0010354 0 ustar 00 #ifndef _SEPOL_USER_RECORD_H_ #define _SEPOL_USER_RECORD_H_ #include <stddef.h> #include <sepol/handle.h> #ifdef __cplusplus extern "C" { #endif struct sepol_user; struct sepol_user_key; typedef struct sepol_user sepol_user_t; typedef struct sepol_user_key sepol_user_key_t; /* Key */ extern int sepol_user_key_create(sepol_handle_t * handle, const char *name, sepol_user_key_t ** key); extern void sepol_user_key_unpack(const sepol_user_key_t * key, const char **name); extern int sepol_user_key_extract(sepol_handle_t * handle, const sepol_user_t * user, sepol_user_key_t ** key_ptr); extern void sepol_user_key_free(sepol_user_key_t * key); extern int sepol_user_compare(const sepol_user_t * user, const sepol_user_key_t * key); extern int sepol_user_compare2(const sepol_user_t * user, const sepol_user_t * user2); /* Name */ extern const char *sepol_user_get_name(const sepol_user_t * user); extern int sepol_user_set_name(sepol_handle_t * handle, sepol_user_t * user, const char *name); /* MLS */ extern const char *sepol_user_get_mlslevel(const sepol_user_t * user); extern int sepol_user_set_mlslevel(sepol_handle_t * handle, sepol_user_t * user, const char *mls_level); extern const char *sepol_user_get_mlsrange(const sepol_user_t * user); extern int sepol_user_set_mlsrange(sepol_handle_t * handle, sepol_user_t * user, const char *mls_range); /* Role management */ extern int sepol_user_get_num_roles(const sepol_user_t * user); extern int sepol_user_add_role(sepol_handle_t * handle, sepol_user_t * user, const char *role); extern void sepol_user_del_role(sepol_user_t * user, const char *role); extern int sepol_user_has_role(const sepol_user_t * user, const char *role); extern int sepol_user_get_roles(sepol_handle_t * handle, const sepol_user_t * user, const char ***roles_arr, unsigned int *num_roles); extern int sepol_user_set_roles(sepol_handle_t * handle, sepol_user_t * user, const char **roles_arr, unsigned int num_roles); /* Create/Clone/Destroy */ extern int sepol_user_create(sepol_handle_t * handle, sepol_user_t ** user_ptr); extern int sepol_user_clone(sepol_handle_t * handle, const sepol_user_t * user, sepol_user_t ** user_ptr); extern void sepol_user_free(sepol_user_t * user); #ifdef __cplusplus } #endif #endif sepol/users.h 0000644 00000003747 15063602062 0007213 0 ustar 00 #ifndef _SEPOL_USERS_H_ #define _SEPOL_USERS_H_ #include <sepol/policydb.h> #include <sepol/user_record.h> #include <sepol/handle.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /*---------compatibility------------*/ /* Given an existing binary policy (starting at 'data with length 'len') and user configurations living in 'usersdir', generate a new binary policy for the new user configurations. Sets '*newdata' and '*newlen' to refer to the new binary policy image. */ extern int sepol_genusers(void *data, size_t len, const char *usersdir, void **newdata, size_t * newlen); /* Enable or disable deletion of users by sepol_genusers(3) when a user in original binary policy image is not defined by the new user configurations. Defaults to disabled. */ extern void sepol_set_delusers(int on); /*--------end compatibility----------*/ /* Modify the user, or add it, if the key is not found */ extern int sepol_user_modify(sepol_handle_t * handle, sepol_policydb_t * policydb, const sepol_user_key_t * key, const sepol_user_t * data); /* Return the number of users */ extern int sepol_user_count(sepol_handle_t * handle, const sepol_policydb_t * p, unsigned int *response); /* Check if the specified user exists */ extern int sepol_user_exists(sepol_handle_t * handle, const sepol_policydb_t * policydb, const sepol_user_key_t * key, int *response); /* Query a user - returns the user or NULL if not found */ extern int sepol_user_query(sepol_handle_t * handle, const sepol_policydb_t * p, const sepol_user_key_t * key, sepol_user_t ** response); /* Iterate the users * The handler may return: * -1 to signal an error condition, * 1 to signal successful exit * 0 to signal continue */ extern int sepol_user_iterate(sepol_handle_t * handle, const sepol_policydb_t * policydb, int (*fn) (const sepol_user_t * user, void *fn_arg), void *arg); #ifdef __cplusplus } #endif #endif bits/byteswap.h 0000644 00000004621 15063602062 0007517 0 ustar 00 /* Macros and inline functions to swap the order of bytes in integer values. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H # error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." #endif #ifndef _BITS_BYTESWAP_H #define _BITS_BYTESWAP_H 1 #include <features.h> #include <bits/types.h> /* Swap bytes in 16-bit value. */ #define __bswap_constant_16(x) \ ((__uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) static __inline __uint16_t __bswap_16 (__uint16_t __bsx) { #if __GNUC_PREREQ (4, 8) return __builtin_bswap16 (__bsx); #else return __bswap_constant_16 (__bsx); #endif } /* Swap bytes in 32-bit value. */ #define __bswap_constant_32(x) \ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) \ | (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) static __inline __uint32_t __bswap_32 (__uint32_t __bsx) { #if __GNUC_PREREQ (4, 3) return __builtin_bswap32 (__bsx); #else return __bswap_constant_32 (__bsx); #endif } /* Swap bytes in 64-bit value. */ #define __bswap_constant_64(x) \ ((((x) & 0xff00000000000000ull) >> 56) \ | (((x) & 0x00ff000000000000ull) >> 40) \ | (((x) & 0x0000ff0000000000ull) >> 24) \ | (((x) & 0x000000ff00000000ull) >> 8) \ | (((x) & 0x00000000ff000000ull) << 8) \ | (((x) & 0x0000000000ff0000ull) << 24) \ | (((x) & 0x000000000000ff00ull) << 40) \ | (((x) & 0x00000000000000ffull) << 56)) __extension__ static __inline __uint64_t __bswap_64 (__uint64_t __bsx) { #if __GNUC_PREREQ (4, 3) return __builtin_bswap64 (__bsx); #else return __bswap_constant_64 (__bsx); #endif } #endif /* _BITS_BYTESWAP_H */ bits/cmathcalls.h 0000644 00000010052 15063602062 0007767 0 ustar 00 /* Prototype declarations for complex math functions; helper file for <complex.h>. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* NOTE: Because of the special way this file is used by <complex.h>, this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME, (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME, (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. */ #ifndef _COMPLEX_H #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead." #endif #ifndef _Mdouble_complex_ # define _Mdouble_complex_ _Mdouble_ _Complex #endif /* Trigonometric functions. */ /* Arc cosine of Z. */ __MATHCALL (cacos, (_Mdouble_complex_ __z)); /* Arc sine of Z. */ __MATHCALL (casin, (_Mdouble_complex_ __z)); /* Arc tangent of Z. */ __MATHCALL (catan, (_Mdouble_complex_ __z)); /* Cosine of Z. */ __MATHCALL (ccos, (_Mdouble_complex_ __z)); /* Sine of Z. */ __MATHCALL (csin, (_Mdouble_complex_ __z)); /* Tangent of Z. */ __MATHCALL (ctan, (_Mdouble_complex_ __z)); /* Hyperbolic functions. */ /* Hyperbolic arc cosine of Z. */ __MATHCALL (cacosh, (_Mdouble_complex_ __z)); /* Hyperbolic arc sine of Z. */ __MATHCALL (casinh, (_Mdouble_complex_ __z)); /* Hyperbolic arc tangent of Z. */ __MATHCALL (catanh, (_Mdouble_complex_ __z)); /* Hyperbolic cosine of Z. */ __MATHCALL (ccosh, (_Mdouble_complex_ __z)); /* Hyperbolic sine of Z. */ __MATHCALL (csinh, (_Mdouble_complex_ __z)); /* Hyperbolic tangent of Z. */ __MATHCALL (ctanh, (_Mdouble_complex_ __z)); /* Exponential and logarithmic functions. */ /* Exponential function of Z. */ __MATHCALL (cexp, (_Mdouble_complex_ __z)); /* Natural logarithm of Z. */ __MATHCALL (clog, (_Mdouble_complex_ __z)); #ifdef __USE_GNU /* The base 10 logarithm is not defined by the standard but to implement the standard C++ library it is handy. */ __MATHCALL (clog10, (_Mdouble_complex_ __z)); #endif /* Power functions. */ /* Return X to the Y power. */ __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); /* Return the square root of Z. */ __MATHCALL (csqrt, (_Mdouble_complex_ __z)); /* Absolute value, conjugates, and projection. */ /* Absolute value of Z. */ __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); /* Argument value of Z. */ __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); /* Complex conjugate of Z. */ __MATHCALL (conj, (_Mdouble_complex_ __z)); /* Projection of Z onto the Riemann sphere. */ __MATHCALL (cproj, (_Mdouble_complex_ __z)); /* Decomposing complex values. */ /* Imaginary part of Z. */ __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); /* Real part of Z. */ __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); bits/confname.h 0000644 00000056234 15063602062 0007456 0 ustar 00 /* `sysconf', `pathconf', and `confstr' NAME values. Generic version. Copyright (C) 1993-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never use <bits/confname.h> directly; include <unistd.h> instead." #endif /* Values for the NAME argument to `pathconf' and `fpathconf'. */ enum { _PC_LINK_MAX, #define _PC_LINK_MAX _PC_LINK_MAX _PC_MAX_CANON, #define _PC_MAX_CANON _PC_MAX_CANON _PC_MAX_INPUT, #define _PC_MAX_INPUT _PC_MAX_INPUT _PC_NAME_MAX, #define _PC_NAME_MAX _PC_NAME_MAX _PC_PATH_MAX, #define _PC_PATH_MAX _PC_PATH_MAX _PC_PIPE_BUF, #define _PC_PIPE_BUF _PC_PIPE_BUF _PC_CHOWN_RESTRICTED, #define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED _PC_NO_TRUNC, #define _PC_NO_TRUNC _PC_NO_TRUNC _PC_VDISABLE, #define _PC_VDISABLE _PC_VDISABLE _PC_SYNC_IO, #define _PC_SYNC_IO _PC_SYNC_IO _PC_ASYNC_IO, #define _PC_ASYNC_IO _PC_ASYNC_IO _PC_PRIO_IO, #define _PC_PRIO_IO _PC_PRIO_IO _PC_SOCK_MAXBUF, #define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF _PC_FILESIZEBITS, #define _PC_FILESIZEBITS _PC_FILESIZEBITS _PC_REC_INCR_XFER_SIZE, #define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE _PC_REC_MAX_XFER_SIZE, #define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE _PC_REC_MIN_XFER_SIZE, #define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE _PC_REC_XFER_ALIGN, #define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN _PC_ALLOC_SIZE_MIN, #define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN _PC_SYMLINK_MAX, #define _PC_SYMLINK_MAX _PC_SYMLINK_MAX _PC_2_SYMLINKS #define _PC_2_SYMLINKS _PC_2_SYMLINKS }; /* Values for the argument to `sysconf'. */ enum { _SC_ARG_MAX, #define _SC_ARG_MAX _SC_ARG_MAX _SC_CHILD_MAX, #define _SC_CHILD_MAX _SC_CHILD_MAX _SC_CLK_TCK, #define _SC_CLK_TCK _SC_CLK_TCK _SC_NGROUPS_MAX, #define _SC_NGROUPS_MAX _SC_NGROUPS_MAX _SC_OPEN_MAX, #define _SC_OPEN_MAX _SC_OPEN_MAX _SC_STREAM_MAX, #define _SC_STREAM_MAX _SC_STREAM_MAX _SC_TZNAME_MAX, #define _SC_TZNAME_MAX _SC_TZNAME_MAX _SC_JOB_CONTROL, #define _SC_JOB_CONTROL _SC_JOB_CONTROL _SC_SAVED_IDS, #define _SC_SAVED_IDS _SC_SAVED_IDS _SC_REALTIME_SIGNALS, #define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS _SC_PRIORITY_SCHEDULING, #define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING _SC_TIMERS, #define _SC_TIMERS _SC_TIMERS _SC_ASYNCHRONOUS_IO, #define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO _SC_PRIORITIZED_IO, #define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO _SC_SYNCHRONIZED_IO, #define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO _SC_FSYNC, #define _SC_FSYNC _SC_FSYNC _SC_MAPPED_FILES, #define _SC_MAPPED_FILES _SC_MAPPED_FILES _SC_MEMLOCK, #define _SC_MEMLOCK _SC_MEMLOCK _SC_MEMLOCK_RANGE, #define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE _SC_MEMORY_PROTECTION, #define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION _SC_MESSAGE_PASSING, #define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING _SC_SEMAPHORES, #define _SC_SEMAPHORES _SC_SEMAPHORES _SC_SHARED_MEMORY_OBJECTS, #define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS _SC_AIO_LISTIO_MAX, #define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX _SC_AIO_MAX, #define _SC_AIO_MAX _SC_AIO_MAX _SC_AIO_PRIO_DELTA_MAX, #define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX _SC_DELAYTIMER_MAX, #define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX _SC_MQ_OPEN_MAX, #define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX _SC_MQ_PRIO_MAX, #define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX _SC_VERSION, #define _SC_VERSION _SC_VERSION _SC_PAGESIZE, #define _SC_PAGESIZE _SC_PAGESIZE #define _SC_PAGE_SIZE _SC_PAGESIZE _SC_RTSIG_MAX, #define _SC_RTSIG_MAX _SC_RTSIG_MAX _SC_SEM_NSEMS_MAX, #define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX _SC_SEM_VALUE_MAX, #define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX _SC_SIGQUEUE_MAX, #define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX _SC_TIMER_MAX, #define _SC_TIMER_MAX _SC_TIMER_MAX /* Values for the argument to `sysconf' corresponding to _POSIX2_* symbols. */ _SC_BC_BASE_MAX, #define _SC_BC_BASE_MAX _SC_BC_BASE_MAX _SC_BC_DIM_MAX, #define _SC_BC_DIM_MAX _SC_BC_DIM_MAX _SC_BC_SCALE_MAX, #define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX _SC_BC_STRING_MAX, #define _SC_BC_STRING_MAX _SC_BC_STRING_MAX _SC_COLL_WEIGHTS_MAX, #define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX _SC_EQUIV_CLASS_MAX, #define _SC_EQUIV_CLASS_MAX _SC_EQUIV_CLASS_MAX _SC_EXPR_NEST_MAX, #define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX _SC_LINE_MAX, #define _SC_LINE_MAX _SC_LINE_MAX _SC_RE_DUP_MAX, #define _SC_RE_DUP_MAX _SC_RE_DUP_MAX _SC_CHARCLASS_NAME_MAX, #define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX _SC_2_VERSION, #define _SC_2_VERSION _SC_2_VERSION _SC_2_C_BIND, #define _SC_2_C_BIND _SC_2_C_BIND _SC_2_C_DEV, #define _SC_2_C_DEV _SC_2_C_DEV _SC_2_FORT_DEV, #define _SC_2_FORT_DEV _SC_2_FORT_DEV _SC_2_FORT_RUN, #define _SC_2_FORT_RUN _SC_2_FORT_RUN _SC_2_SW_DEV, #define _SC_2_SW_DEV _SC_2_SW_DEV _SC_2_LOCALEDEF, #define _SC_2_LOCALEDEF _SC_2_LOCALEDEF _SC_PII, #define _SC_PII _SC_PII _SC_PII_XTI, #define _SC_PII_XTI _SC_PII_XTI _SC_PII_SOCKET, #define _SC_PII_SOCKET _SC_PII_SOCKET _SC_PII_INTERNET, #define _SC_PII_INTERNET _SC_PII_INTERNET _SC_PII_OSI, #define _SC_PII_OSI _SC_PII_OSI _SC_POLL, #define _SC_POLL _SC_POLL _SC_SELECT, #define _SC_SELECT _SC_SELECT _SC_UIO_MAXIOV, #define _SC_UIO_MAXIOV _SC_UIO_MAXIOV _SC_IOV_MAX = _SC_UIO_MAXIOV, #define _SC_IOV_MAX _SC_IOV_MAX _SC_PII_INTERNET_STREAM, #define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_DGRAM, #define _SC_PII_INTERNET_DGRAM _SC_PII_INTERNET_DGRAM _SC_PII_OSI_COTS, #define _SC_PII_OSI_COTS _SC_PII_OSI_COTS _SC_PII_OSI_CLTS, #define _SC_PII_OSI_CLTS _SC_PII_OSI_CLTS _SC_PII_OSI_M, #define _SC_PII_OSI_M _SC_PII_OSI_M _SC_T_IOV_MAX, #define _SC_T_IOV_MAX _SC_T_IOV_MAX /* Values according to POSIX 1003.1c (POSIX threads). */ _SC_THREADS, #define _SC_THREADS _SC_THREADS _SC_THREAD_SAFE_FUNCTIONS, #define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS _SC_GETGR_R_SIZE_MAX, #define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX, #define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX _SC_LOGIN_NAME_MAX, #define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX _SC_TTY_NAME_MAX, #define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX _SC_THREAD_DESTRUCTOR_ITERATIONS, #define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_KEYS_MAX, #define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX _SC_THREAD_STACK_MIN, #define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN _SC_THREAD_THREADS_MAX, #define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX _SC_THREAD_ATTR_STACKADDR, #define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKSIZE, #define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_PRIORITY_SCHEDULING, #define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIO_INHERIT, #define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_PROTECT, #define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT _SC_THREAD_PROCESS_SHARED, #define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED _SC_NPROCESSORS_CONF, #define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF _SC_NPROCESSORS_ONLN, #define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN _SC_PHYS_PAGES, #define _SC_PHYS_PAGES _SC_PHYS_PAGES _SC_AVPHYS_PAGES, #define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES _SC_ATEXIT_MAX, #define _SC_ATEXIT_MAX _SC_ATEXIT_MAX _SC_PASS_MAX, #define _SC_PASS_MAX _SC_PASS_MAX _SC_XOPEN_VERSION, #define _SC_XOPEN_VERSION _SC_XOPEN_VERSION _SC_XOPEN_XCU_VERSION, #define _SC_XOPEN_XCU_VERSION _SC_XOPEN_XCU_VERSION _SC_XOPEN_UNIX, #define _SC_XOPEN_UNIX _SC_XOPEN_UNIX _SC_XOPEN_CRYPT, #define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT _SC_XOPEN_ENH_I18N, #define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N _SC_XOPEN_SHM, #define _SC_XOPEN_SHM _SC_XOPEN_SHM _SC_2_CHAR_TERM, #define _SC_2_CHAR_TERM _SC_2_CHAR_TERM _SC_2_C_VERSION, #define _SC_2_C_VERSION _SC_2_C_VERSION _SC_2_UPE, #define _SC_2_UPE _SC_2_UPE _SC_XOPEN_XPG2, #define _SC_XOPEN_XPG2 _SC_XOPEN_XPG2 _SC_XOPEN_XPG3, #define _SC_XOPEN_XPG3 _SC_XOPEN_XPG3 _SC_XOPEN_XPG4, #define _SC_XOPEN_XPG4 _SC_XOPEN_XPG4 _SC_CHAR_BIT, #define _SC_CHAR_BIT _SC_CHAR_BIT _SC_CHAR_MAX, #define _SC_CHAR_MAX _SC_CHAR_MAX _SC_CHAR_MIN, #define _SC_CHAR_MIN _SC_CHAR_MIN _SC_INT_MAX, #define _SC_INT_MAX _SC_INT_MAX _SC_INT_MIN, #define _SC_INT_MIN _SC_INT_MIN _SC_LONG_BIT, #define _SC_LONG_BIT _SC_LONG_BIT _SC_WORD_BIT, #define _SC_WORD_BIT _SC_WORD_BIT _SC_MB_LEN_MAX, #define _SC_MB_LEN_MAX _SC_MB_LEN_MAX _SC_NZERO, #define _SC_NZERO _SC_NZERO _SC_SSIZE_MAX, #define _SC_SSIZE_MAX _SC_SSIZE_MAX _SC_SCHAR_MAX, #define _SC_SCHAR_MAX _SC_SCHAR_MAX _SC_SCHAR_MIN, #define _SC_SCHAR_MIN _SC_SCHAR_MIN _SC_SHRT_MAX, #define _SC_SHRT_MAX _SC_SHRT_MAX _SC_SHRT_MIN, #define _SC_SHRT_MIN _SC_SHRT_MIN _SC_UCHAR_MAX, #define _SC_UCHAR_MAX _SC_UCHAR_MAX _SC_UINT_MAX, #define _SC_UINT_MAX _SC_UINT_MAX _SC_ULONG_MAX, #define _SC_ULONG_MAX _SC_ULONG_MAX _SC_USHRT_MAX, #define _SC_USHRT_MAX _SC_USHRT_MAX _SC_NL_ARGMAX, #define _SC_NL_ARGMAX _SC_NL_ARGMAX _SC_NL_LANGMAX, #define _SC_NL_LANGMAX _SC_NL_LANGMAX _SC_NL_MSGMAX, #define _SC_NL_MSGMAX _SC_NL_MSGMAX _SC_NL_NMAX, #define _SC_NL_NMAX _SC_NL_NMAX _SC_NL_SETMAX, #define _SC_NL_SETMAX _SC_NL_SETMAX _SC_NL_TEXTMAX, #define _SC_NL_TEXTMAX _SC_NL_TEXTMAX _SC_XBS5_ILP32_OFF32, #define _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFFBIG, #define _SC_XBS5_ILP32_OFFBIG _SC_XBS5_ILP32_OFFBIG _SC_XBS5_LP64_OFF64, #define _SC_XBS5_LP64_OFF64 _SC_XBS5_LP64_OFF64 _SC_XBS5_LPBIG_OFFBIG, #define _SC_XBS5_LPBIG_OFFBIG _SC_XBS5_LPBIG_OFFBIG _SC_XOPEN_LEGACY, #define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY _SC_XOPEN_REALTIME, #define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME_THREADS, #define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS _SC_ADVISORY_INFO, #define _SC_ADVISORY_INFO _SC_ADVISORY_INFO _SC_BARRIERS, #define _SC_BARRIERS _SC_BARRIERS _SC_BASE, #define _SC_BASE _SC_BASE _SC_C_LANG_SUPPORT, #define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT_R, #define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R _SC_CLOCK_SELECTION, #define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION _SC_CPUTIME, #define _SC_CPUTIME _SC_CPUTIME _SC_THREAD_CPUTIME, #define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME _SC_DEVICE_IO, #define _SC_DEVICE_IO _SC_DEVICE_IO _SC_DEVICE_SPECIFIC, #define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC_R, #define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R _SC_FD_MGMT, #define _SC_FD_MGMT _SC_FD_MGMT _SC_FIFO, #define _SC_FIFO _SC_FIFO _SC_PIPE, #define _SC_PIPE _SC_PIPE _SC_FILE_ATTRIBUTES, #define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES _SC_FILE_LOCKING, #define _SC_FILE_LOCKING _SC_FILE_LOCKING _SC_FILE_SYSTEM, #define _SC_FILE_SYSTEM _SC_FILE_SYSTEM _SC_MONOTONIC_CLOCK, #define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK _SC_MULTI_PROCESS, #define _SC_MULTI_PROCESS _SC_MULTI_PROCESS _SC_SINGLE_PROCESS, #define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS _SC_NETWORKING, #define _SC_NETWORKING _SC_NETWORKING _SC_READER_WRITER_LOCKS, #define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS _SC_SPIN_LOCKS, #define _SC_SPIN_LOCKS _SC_SPIN_LOCKS _SC_REGEXP, #define _SC_REGEXP _SC_REGEXP _SC_REGEX_VERSION, #define _SC_REGEX_VERSION _SC_REGEX_VERSION _SC_SHELL, #define _SC_SHELL _SC_SHELL _SC_SIGNALS, #define _SC_SIGNALS _SC_SIGNALS _SC_SPAWN, #define _SC_SPAWN _SC_SPAWN _SC_SPORADIC_SERVER, #define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER, #define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER _SC_SYSTEM_DATABASE, #define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE_R, #define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R _SC_TIMEOUTS, #define _SC_TIMEOUTS _SC_TIMEOUTS _SC_TYPED_MEMORY_OBJECTS, #define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS _SC_USER_GROUPS, #define _SC_USER_GROUPS _SC_USER_GROUPS _SC_USER_GROUPS_R, #define _SC_USER_GROUPS_R _SC_USER_GROUPS_R _SC_2_PBS, #define _SC_2_PBS _SC_2_PBS _SC_2_PBS_ACCOUNTING, #define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING _SC_2_PBS_LOCATE, #define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE _SC_2_PBS_MESSAGE, #define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE _SC_2_PBS_TRACK, #define _SC_2_PBS_TRACK _SC_2_PBS_TRACK _SC_SYMLOOP_MAX, #define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX _SC_STREAMS, #define _SC_STREAMS _SC_STREAMS _SC_2_PBS_CHECKPOINT, #define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT _SC_V6_ILP32_OFF32, #define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFFBIG, #define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG _SC_V6_LP64_OFF64, #define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64 _SC_V6_LPBIG_OFFBIG, #define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG _SC_HOST_NAME_MAX, #define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX _SC_TRACE, #define _SC_TRACE _SC_TRACE _SC_TRACE_EVENT_FILTER, #define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER _SC_TRACE_INHERIT, #define _SC_TRACE_INHERIT _SC_TRACE_INHERIT _SC_TRACE_LOG, #define _SC_TRACE_LOG _SC_TRACE_LOG _SC_LEVEL1_ICACHE_SIZE, #define _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_ASSOC, #define _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_LINESIZE, #define _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_DCACHE_SIZE, #define _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_ASSOC, #define _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_LINESIZE, #define _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL2_CACHE_SIZE, #define _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_ASSOC, #define _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_LINESIZE, #define _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL3_CACHE_SIZE, #define _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_ASSOC, #define _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_LINESIZE, #define _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL4_CACHE_SIZE, #define _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_ASSOC, #define _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_LINESIZE, #define _SC_LEVEL4_CACHE_LINESIZE _SC_LEVEL4_CACHE_LINESIZE /* Leave room here, maybe we need a few more cache levels some day. */ _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, #define _SC_IPV6 _SC_IPV6 _SC_RAW_SOCKETS, #define _SC_RAW_SOCKETS _SC_RAW_SOCKETS _SC_V7_ILP32_OFF32, #define _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFFBIG, #define _SC_V7_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG _SC_V7_LP64_OFF64, #define _SC_V7_LP64_OFF64 _SC_V7_LP64_OFF64 _SC_V7_LPBIG_OFFBIG, #define _SC_V7_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG _SC_SS_REPL_MAX, #define _SC_SS_REPL_MAX _SC_SS_REPL_MAX _SC_TRACE_EVENT_NAME_MAX, #define _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_NAME_MAX, #define _SC_TRACE_NAME_MAX _SC_TRACE_NAME_MAX _SC_TRACE_SYS_MAX, #define _SC_TRACE_SYS_MAX _SC_TRACE_SYS_MAX _SC_TRACE_USER_EVENT_MAX, #define _SC_TRACE_USER_EVENT_MAX _SC_TRACE_USER_EVENT_MAX _SC_XOPEN_STREAMS, #define _SC_XOPEN_STREAMS _SC_XOPEN_STREAMS _SC_THREAD_ROBUST_PRIO_INHERIT, #define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_PROTECT #define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT }; /* Values for the NAME argument to `confstr'. */ enum { _CS_PATH, /* The default search path. */ #define _CS_PATH _CS_PATH _CS_V6_WIDTH_RESTRICTED_ENVS, #define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS _CS_GNU_LIBC_VERSION, #define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION _CS_GNU_LIBPTHREAD_VERSION, #define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION _CS_V5_WIDTH_RESTRICTED_ENVS, #define _CS_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS #define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS _CS_V5_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS, #define _CS_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS #define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS _CS_V7_WIDTH_RESTRICTED_ENVS _CS_LFS_CFLAGS = 1000, #define _CS_LFS_CFLAGS _CS_LFS_CFLAGS _CS_LFS_LDFLAGS, #define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS _CS_LFS_LIBS, #define _CS_LFS_LIBS _CS_LFS_LIBS _CS_LFS_LINTFLAGS, #define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS _CS_LFS64_CFLAGS, #define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS _CS_LFS64_LDFLAGS, #define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS _CS_LFS64_LIBS, #define _CS_LFS64_LIBS _CS_LFS64_LIBS _CS_LFS64_LINTFLAGS, #define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, #define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS, #define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LIBS, #define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LINTFLAGS, #define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS, #define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS, #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LIBS, #define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_LP64_OFF64_CFLAGS, #define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS, #define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LIBS, #define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LINTFLAGS, #define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS, #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LIBS, #define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS, #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LIBS, #define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, #define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LIBS, #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, #define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS, #define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS, #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LIBS, #define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, #define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, #define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS, #define _CS_POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, #define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LIBS, #define _CS_POSIX_V7_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, #define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, #define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, #define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LIBS, #define _CS_POSIX_V7_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, #define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS, #define _CS_POSIX_V7_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS, #define _CS_POSIX_V7_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LIBS, #define _CS_POSIX_V7_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, #define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS _CS_POSIX_V7_LP64_OFF64_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, #define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, #define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, #define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, #define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_V6_ENV, #define _CS_V6_ENV _CS_V6_ENV _CS_V7_ENV #define _CS_V7_ENV _CS_V7_ENV }; bits/cpu-set.h 0000644 00000010643 15063602062 0007242 0 ustar 00 /* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 scheduling interface. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_CPU_SET_H #define _BITS_CPU_SET_H 1 #ifndef _SCHED_H # error "Never include <bits/cpu-set.h> directly; use <sched.h> instead." #endif /* Size definition for CPU sets. */ #define __CPU_SETSIZE 1024 #define __NCPUBITS (8 * sizeof (__cpu_mask)) /* Type for array elements in 'cpu_set_t'. */ typedef __CPU_MASK_TYPE __cpu_mask; /* Basic access functions. */ #define __CPUELT(cpu) ((cpu) / __NCPUBITS) #define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) /* Data structure to describe CPU mask. */ typedef struct { __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS]; } cpu_set_t; /* Access functions for CPU masks. */ #if __GNUC_PREREQ (2, 91) # define __CPU_ZERO_S(setsize, cpusetp) \ do __builtin_memset (cpusetp, '\0', setsize); while (0) #else # define __CPU_ZERO_S(setsize, cpusetp) \ do { \ size_t __i; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ __cpu_mask *__bits = (cpusetp)->__bits; \ for (__i = 0; __i < __imax; ++__i) \ __bits[__i] = 0; \ } while (0) #endif #define __CPU_SET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu / 8 < (setsize) \ ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ |= __CPUMASK (__cpu)) \ : 0; })) #define __CPU_CLR_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu / 8 < (setsize) \ ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ &= ~__CPUMASK (__cpu)) \ : 0; })) #define __CPU_ISSET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu / 8 < (setsize) \ ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ & __CPUMASK (__cpu))) != 0 \ : 0; })) #define __CPU_COUNT_S(setsize, cpusetp) \ __sched_cpucount (setsize, cpusetp) #if __GNUC_PREREQ (2, 91) # define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) #else # define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ (__extension__ \ ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ size_t __i; \ for (__i = 0; __i < __imax; ++__i) \ if (__arr1[__i] != __arr2[__i]) \ break; \ __i == __imax; })) #endif #define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ (__extension__ \ ({ cpu_set_t *__dest = (destset); \ const __cpu_mask *__arr1 = (srcset1)->__bits; \ const __cpu_mask *__arr2 = (srcset2)->__bits; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ size_t __i; \ for (__i = 0; __i < __imax; ++__i) \ ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ __dest; })) #define __CPU_ALLOC_SIZE(count) \ ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) #define __CPU_ALLOC(count) __sched_cpualloc (count) #define __CPU_FREE(cpuset) __sched_cpufree (cpuset) __BEGIN_DECLS extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) __THROW; extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; extern void __sched_cpufree (cpu_set_t *__set) __THROW; __END_DECLS #endif /* bits/cpu-set.h */ bits/dirent.h 0000644 00000003352 15063602062 0007146 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _DIRENT_H # error "Never use <bits/dirent.h> directly; include <dirent.h> instead." #endif struct dirent { #ifndef __USE_FILE_OFFSET64 __ino_t d_ino; __off_t d_off; #else __ino64_t d_ino; __off64_t d_off; #endif unsigned short int d_reclen; unsigned char d_type; char d_name[256]; /* We must not include limits.h! */ }; #ifdef __USE_LARGEFILE64 struct dirent64 { __ino64_t d_ino; __off64_t d_off; unsigned short int d_reclen; unsigned char d_type; char d_name[256]; /* We must not include limits.h! */ }; #endif #define d_fileno d_ino /* Backwards compatibility. */ #undef _DIRENT_HAVE_D_NAMLEN #define _DIRENT_HAVE_D_RECLEN #define _DIRENT_HAVE_D_OFF #define _DIRENT_HAVE_D_TYPE #if defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T /* Inform libc code that these two types are effectively identical. */ # define _DIRENT_MATCHES_DIRENT64 1 #else # define _DIRENT_MATCHES_DIRENT64 0 #endif bits/dlfcn.h 0000644 00000004730 15063602063 0006751 0 ustar 00 /* System dependent definitions for run-time dynamic loading. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _DLFCN_H # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead." #endif /* The MODE argument to `dlopen' contains one of the following: */ #define RTLD_LAZY 0x00001 /* Lazy function call binding. */ #define RTLD_NOW 0x00002 /* Immediate function call binding. */ #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #define RTLD_NOLOAD 0x00004 /* Do not load the object. */ #define RTLD_DEEPBIND 0x00008 /* Use deep binding. */ /* If the following bit is set in the MODE argument to `dlopen', the symbols of the loaded object and its dependencies are made visible as if the object were linked directly into the program. */ #define RTLD_GLOBAL 0x00100 /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. The implementation does this by default and so we can define the value to zero. */ #define RTLD_LOCAL 0 /* Do not delete object when closed. */ #define RTLD_NODELETE 0x01000 #ifdef __USE_GNU /* To support profiling of shared objects it is a good idea to call the function found using `dlsym' using the following macro since these calls do not use the PLT. But this would mean the dynamic loader has no chance to find out when the function is called. The macro applies the necessary magic so that profiling is possible. Rewrite foo = (*fctp) (arg1, arg2); into foo = DL_CALL_FCT (fctp, (arg1, arg2)); */ # define DL_CALL_FCT(fctp, args) \ (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args) __BEGIN_DECLS /* This function calls the profiling functions. */ extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW; __END_DECLS #endif bits/elfclass.h 0000644 00000000652 15063602063 0007456 0 ustar 00 /* This file specifies the native word size of the machine, which indicates the ELF file class used for executables and shared objects on this machine. */ #ifndef _LINK_H # error "Never use <bits/elfclass.h> directly; include <link.h> instead." #endif #include <bits/wordsize.h> #define __ELF_NATIVE_CLASS __WORDSIZE /* The entries in the .hash table always have a size of 32 bits. */ typedef uint32_t Elf_Symndx; bits/endian.h 0000644 00000000260 15063602063 0007113 0 ustar 00 /* i386/x86_64 are little-endian. */ #ifndef _ENDIAN_H # error "Never use <bits/endian.h> directly; include <endian.h> instead." #endif #define __BYTE_ORDER __LITTLE_ENDIAN bits/environments.h 0000644 00000007316 15063602063 0010415 0 ustar 00 /* Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never include this file directly. Use <unistd.h> instead" #endif #include <bits/wordsize.h> /* This header should define the following symbols under the described situations. A value `1' means that the model is always supported, `-1' means it is never supported. Undefined means it cannot be statically decided. _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard and are available only for compatibility. */ #if __WORDSIZE == 64 /* Environments with 32-bit wide pointers are optionally provided. Therefore following macros aren't defined: # undef _POSIX_V7_ILP32_OFF32 # undef _POSIX_V7_ILP32_OFFBIG # undef _POSIX_V6_ILP32_OFF32 # undef _POSIX_V6_ILP32_OFFBIG # undef _XBS5_ILP32_OFF32 # undef _XBS5_ILP32_OFFBIG and users need to check at runtime. */ /* We also have no use (for now) for an environment with bigger pointers and offsets. */ # define _POSIX_V7_LPBIG_OFFBIG -1 # define _POSIX_V6_LPBIG_OFFBIG -1 # define _XBS5_LPBIG_OFFBIG -1 /* By default we have 64-bit wide `long int', pointers and `off_t'. */ # define _POSIX_V7_LP64_OFF64 1 # define _POSIX_V6_LP64_OFF64 1 # define _XBS5_LP64_OFF64 1 #else /* __WORDSIZE == 32 */ /* We have 32-bit wide `int', `long int' and pointers and all platforms support LFS. -mx32 has 64-bit wide `off_t'. */ # define _POSIX_V7_ILP32_OFFBIG 1 # define _POSIX_V6_ILP32_OFFBIG 1 # define _XBS5_ILP32_OFFBIG 1 # ifndef __x86_64__ /* -m32 has 32-bit wide `off_t'. */ # define _POSIX_V7_ILP32_OFF32 1 # define _POSIX_V6_ILP32_OFF32 1 # define _XBS5_ILP32_OFF32 1 # endif /* We optionally provide an environment with the above size but an 64-bit side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ /* Environments with 64-bit wide pointers can be provided, so these macros aren't defined: # undef _POSIX_V7_LP64_OFF64 # undef _POSIX_V7_LPBIG_OFFBIG # undef _POSIX_V6_LP64_OFF64 # undef _POSIX_V6_LPBIG_OFFBIG # undef _XBS5_LP64_OFF64 # undef _XBS5_LPBIG_OFFBIG and sysconf tests for it at runtime. */ #endif /* __WORDSIZE == 32 */ #define __ILP32_OFF32_CFLAGS "-m32" #define __ILP32_OFF32_LDFLAGS "-m32" #if defined __x86_64__ && defined __ILP32__ # define __ILP32_OFFBIG_CFLAGS "-mx32" # define __ILP32_OFFBIG_LDFLAGS "-mx32" #else # define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" # define __ILP32_OFFBIG_LDFLAGS "-m32" #endif #define __LP64_OFF64_CFLAGS "-m64" #define __LP64_OFF64_LDFLAGS "-m64" bits/epoll.h 0000644 00000002056 15063602063 0006775 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EPOLL_H # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead." #endif /* Flags to be passed to epoll_create1. */ enum { EPOLL_CLOEXEC = 02000000 #define EPOLL_CLOEXEC EPOLL_CLOEXEC }; #define __EPOLL_PACKED __attribute__ ((__packed__)) bits/errno.h 0000644 00000002621 15063602063 0007005 0 ustar 00 /* Error constants. Linux specific version. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_ERRNO_H #define _BITS_ERRNO_H 1 #if !defined _ERRNO_H # error "Never include <bits/errno.h> directly; use <errno.h> instead." #endif # include <linux/errno.h> /* Older Linux headers do not define these constants. */ # ifndef ENOTSUP # define ENOTSUP EOPNOTSUPP # endif # ifndef ECANCELED # define ECANCELED 125 # endif # ifndef EOWNERDEAD # define EOWNERDEAD 130 # endif #ifndef ENOTRECOVERABLE # define ENOTRECOVERABLE 131 # endif # ifndef ERFKILL # define ERFKILL 132 # endif # ifndef EHWPOISON # define EHWPOISON 133 # endif #endif /* bits/errno.h. */ bits/error.h 0000644 00000005173 15063602063 0007016 0 ustar 00 /* Specializations for error functions. Copyright (C) 2007-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ERROR_H # error "Never include <bits/error.h> directly; use <error.h> instead." #endif extern void __REDIRECT (__error_alias, (int __status, int __errnum, const char *__format, ...), error) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __REDIRECT (__error_noreturn, (int __status, int __errnum, const char *__format, ...), error) __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4))); /* If we know the function will never return make sure the compiler realizes that, too. */ __extern_always_inline void error (int __status, int __errnum, const char *__format, ...) { if (__builtin_constant_p (__status) && __status != 0) __error_noreturn (__status, __errnum, __format, __va_arg_pack ()); else __error_alias (__status, __errnum, __format, __va_arg_pack ()); } extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...), error_at_line) __attribute__ ((__format__ (__printf__, 5, 6))); extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...), error_at_line) __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6))); /* If we know the function will never return make sure the compiler realizes that, too. */ __extern_always_inline void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __line, const char *__format, ...) { if (__builtin_constant_p (__status) && __status != 0) __error_at_line_noreturn (__status, __errnum, __fname, __line, __format, __va_arg_pack ()); else __error_at_line_alias (__status, __errnum, __fname, __line, __format, __va_arg_pack ()); } bits/eventfd.h 0000644 00000002150 15063602063 0007310 0 ustar 00 /* Copyright (C) 2007-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_EVENTFD_H # error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead." #endif /* Flags for eventfd. */ enum { EFD_SEMAPHORE = 00000001, #define EFD_SEMAPHORE EFD_SEMAPHORE EFD_CLOEXEC = 02000000, #define EFD_CLOEXEC EFD_CLOEXEC EFD_NONBLOCK = 00004000 #define EFD_NONBLOCK EFD_NONBLOCK }; bits/fcntl-linux.h 0000644 00000032620 15063602063 0010125 0 ustar 00 /* O_*, F_*, FD_* bit values for Linux. Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never use <bits/fcntl-linux.h> directly; include <fcntl.h> instead." #endif /* This file contains shared definitions between Linux architectures and is included by <bits/fcntl.h> to declare them. The various #ifndef cases allow the architecture specific file to define those values with different values. A minimal <bits/fcntl.h> contains just: struct flock {...} #ifdef __USE_LARGEFILE64 struct flock64 {...} #endif #include <bits/fcntl-linux.h> */ #ifdef __USE_GNU # include <bits/types/struct_iovec.h> #endif /* open/fcntl. */ #define O_ACCMODE 0003 #define O_RDONLY 00 #define O_WRONLY 01 #define O_RDWR 02 #ifndef O_CREAT # define O_CREAT 0100 /* Not fcntl. */ #endif #ifndef O_EXCL # define O_EXCL 0200 /* Not fcntl. */ #endif #ifndef O_NOCTTY # define O_NOCTTY 0400 /* Not fcntl. */ #endif #ifndef O_TRUNC # define O_TRUNC 01000 /* Not fcntl. */ #endif #ifndef O_APPEND # define O_APPEND 02000 #endif #ifndef O_NONBLOCK # define O_NONBLOCK 04000 #endif #ifndef O_NDELAY # define O_NDELAY O_NONBLOCK #endif #ifndef O_SYNC # define O_SYNC 04010000 #endif #define O_FSYNC O_SYNC #ifndef O_ASYNC # define O_ASYNC 020000 #endif #ifndef __O_LARGEFILE # define __O_LARGEFILE 0100000 #endif #ifndef __O_DIRECTORY # define __O_DIRECTORY 0200000 #endif #ifndef __O_NOFOLLOW # define __O_NOFOLLOW 0400000 #endif #ifndef __O_CLOEXEC # define __O_CLOEXEC 02000000 #endif #ifndef __O_DIRECT # define __O_DIRECT 040000 #endif #ifndef __O_NOATIME # define __O_NOATIME 01000000 #endif #ifndef __O_PATH # define __O_PATH 010000000 #endif #ifndef __O_DSYNC # define __O_DSYNC 010000 #endif #ifndef __O_TMPFILE # define __O_TMPFILE (020000000 | __O_DIRECTORY) #endif #ifndef F_GETLK # ifndef __USE_FILE_OFFSET64 # define F_GETLK 5 /* Get record locking info. */ # define F_SETLK 6 /* Set record locking info (non-blocking). */ # define F_SETLKW 7 /* Set record locking info (blocking). */ # else # define F_GETLK F_GETLK64 /* Get record locking info. */ # define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ # define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ # endif #endif #ifndef F_GETLK64 # define F_GETLK64 12 /* Get record locking info. */ # define F_SETLK64 13 /* Set record locking info (non-blocking). */ # define F_SETLKW64 14 /* Set record locking info (blocking). */ #endif /* open file description locks. Usually record locks held by a process are released on *any* close and are not inherited across a fork. These cmd values will set locks that conflict with process-associated record locks, but are "owned" by the opened file description, not the process. This means that they are inherited across fork or clone with CLONE_FILES like BSD (flock) locks, and they are only released automatically when the last reference to the the file description against which they were acquired is put. */ #ifdef __USE_GNU # define F_OFD_GETLK 36 # define F_OFD_SETLK 37 # define F_OFD_SETLKW 38 #endif #ifdef __USE_LARGEFILE64 # define O_LARGEFILE __O_LARGEFILE #endif #ifdef __USE_XOPEN2K8 # define O_DIRECTORY __O_DIRECTORY /* Must be a directory. */ # define O_NOFOLLOW __O_NOFOLLOW /* Do not follow links. */ # define O_CLOEXEC __O_CLOEXEC /* Set close_on_exec. */ #endif #ifdef __USE_GNU # define O_DIRECT __O_DIRECT /* Direct disk access. */ # define O_NOATIME __O_NOATIME /* Do not set atime. */ # define O_PATH __O_PATH /* Resolve pathname but do not open file. */ # define O_TMPFILE __O_TMPFILE /* Atomically create nameless file. */ #endif /* For now, Linux has no separate synchronicity options for read operations. We define O_RSYNC therefore as the same as O_SYNC since this is a superset. */ #if defined __USE_POSIX199309 || defined __USE_UNIX98 # define O_DSYNC __O_DSYNC /* Synchronize data. */ # if defined __O_RSYNC # define O_RSYNC __O_RSYNC /* Synchronize read operations. */ # else # define O_RSYNC O_SYNC /* Synchronize read operations. */ # endif #endif /* Values for the second argument to `fcntl'. */ #define F_DUPFD 0 /* Duplicate file descriptor. */ #define F_GETFD 1 /* Get file descriptor flags. */ #define F_SETFD 2 /* Set file descriptor flags. */ #define F_GETFL 3 /* Get file status flags. */ #define F_SETFL 4 /* Set file status flags. */ #ifndef __F_SETOWN # define __F_SETOWN 8 # define __F_GETOWN 9 #endif #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 # define F_SETOWN __F_SETOWN /* Get owner (process receiving SIGIO). */ # define F_GETOWN __F_GETOWN /* Set owner (process receiving SIGIO). */ #endif #ifndef __F_SETSIG # define __F_SETSIG 10 /* Set number of signal to be sent. */ # define __F_GETSIG 11 /* Get number of signal to be sent. */ #endif #ifndef __F_SETOWN_EX # define __F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */ # define __F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */ #endif #ifdef __USE_GNU # define F_SETSIG __F_SETSIG /* Set number of signal to be sent. */ # define F_GETSIG __F_GETSIG /* Get number of signal to be sent. */ # define F_SETOWN_EX __F_SETOWN_EX /* Get owner (thread receiving SIGIO). */ # define F_GETOWN_EX __F_GETOWN_EX /* Set owner (thread receiving SIGIO). */ #endif #ifdef __USE_GNU # define F_SETLEASE 1024 /* Set a lease. */ # define F_GETLEASE 1025 /* Enquire what lease is active. */ # define F_NOTIFY 1026 /* Request notifications on a directory. */ # define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ # define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ # define F_ADD_SEALS 1033 /* Add seals to file. */ # define F_GET_SEALS 1034 /* Get seals for file. */ /* Set / get write life time hints. */ # define F_GET_RW_HINT 1035 # define F_SET_RW_HINT 1036 # define F_GET_FILE_RW_HINT 1037 # define F_SET_FILE_RW_HINT 1038 #endif #ifdef __USE_XOPEN2K8 # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with close-on-exit set. */ #endif /* For F_[GET|SET]FD. */ #define FD_CLOEXEC 1 /* Actually anything with low bit set goes */ #ifndef F_RDLCK /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ # define F_RDLCK 0 /* Read lock. */ # define F_WRLCK 1 /* Write lock. */ # define F_UNLCK 2 /* Remove lock. */ #endif /* For old implementation of BSD flock. */ #ifndef F_EXLCK # define F_EXLCK 4 /* or 3 */ # define F_SHLCK 8 /* or 4 */ #endif #ifdef __USE_MISC /* Operations for BSD flock, also used by the kernel implementation. */ # define LOCK_SH 1 /* Shared lock. */ # define LOCK_EX 2 /* Exclusive lock. */ # define LOCK_NB 4 /* Or'd with one of the above to prevent blocking. */ # define LOCK_UN 8 /* Remove lock. */ #endif #ifdef __USE_GNU # define LOCK_MAND 32 /* This is a mandatory flock: */ # define LOCK_READ 64 /* ... which allows concurrent read operations. */ # define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ # define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ #endif #ifdef __USE_GNU /* Types of directory notifications that may be requested with F_NOTIFY. */ # define DN_ACCESS 0x00000001 /* File accessed. */ # define DN_MODIFY 0x00000002 /* File modified. */ # define DN_CREATE 0x00000004 /* File created. */ # define DN_DELETE 0x00000008 /* File removed. */ # define DN_RENAME 0x00000010 /* File renamed. */ # define DN_ATTRIB 0x00000020 /* File changed attributes. */ # define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ #endif #ifdef __USE_GNU /* Owner types. */ enum __pid_type { F_OWNER_TID = 0, /* Kernel thread. */ F_OWNER_PID, /* Process. */ F_OWNER_PGRP, /* Process group. */ F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */ }; /* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */ struct f_owner_ex { enum __pid_type type; /* Owner type of ID. */ __pid_t pid; /* ID of owner. */ }; #endif #ifdef __USE_GNU /* Types of seals. */ # define F_SEAL_SEAL 0x0001 /* Prevent further seals from being set. */ # define F_SEAL_SHRINK 0x0002 /* Prevent file from shrinking. */ # define F_SEAL_GROW 0x0004 /* Prevent file from growing. */ # define F_SEAL_WRITE 0x0008 /* Prevent writes. */ #endif #ifdef __USE_GNU /* Hint values for F_{GET,SET}_RW_HINT. */ # define RWH_WRITE_LIFE_NOT_SET 0 # define RWF_WRITE_LIFE_NOT_SET RWH_WRITE_LIFE_NOT_SET # define RWH_WRITE_LIFE_NONE 1 # define RWH_WRITE_LIFE_SHORT 2 # define RWH_WRITE_LIFE_MEDIUM 3 # define RWH_WRITE_LIFE_LONG 4 # define RWH_WRITE_LIFE_EXTREME 5 #endif /* Define some more compatibility macros to be backward compatible with BSD systems which did not managed to hide these kernel macros. */ #ifdef __USE_MISC # define FAPPEND O_APPEND # define FFSYNC O_FSYNC # define FASYNC O_ASYNC # define FNONBLOCK O_NONBLOCK # define FNDELAY O_NDELAY #endif /* Use misc. */ #ifndef __POSIX_FADV_DONTNEED # define __POSIX_FADV_DONTNEED 4 # define __POSIX_FADV_NOREUSE 5 #endif /* Advise to `posix_fadvise'. */ #ifdef __USE_XOPEN2K # define POSIX_FADV_NORMAL 0 /* No further special treatment. */ # define POSIX_FADV_RANDOM 1 /* Expect random page references. */ # define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ # define POSIX_FADV_DONTNEED __POSIX_FADV_DONTNEED /* Don't need these pages. */ # define POSIX_FADV_NOREUSE __POSIX_FADV_NOREUSE /* Data will be accessed once. */ #endif #ifdef __USE_GNU /* Flags for SYNC_FILE_RANGE. */ # define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages in the range before performing the write. */ # define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those dirty pages in the range which are not presently under writeback. */ # define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in the range after performing the write. */ /* Flags for SPLICE and VMSPLICE. */ # define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ # define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing (but we may still block on the fd we splice from/to). */ # define SPLICE_F_MORE 4 /* Expect more data. */ # define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ /* Flags for fallocate. */ # include <linux/falloc.h> /* File handle structure. */ struct file_handle { unsigned int handle_bytes; int handle_type; /* File identifier. */ unsigned char f_handle[0]; }; /* Maximum handle size (for now). */ # define MAX_HANDLE_SZ 128 #endif __BEGIN_DECLS #ifdef __USE_GNU /* Provide kernel hint to read ahead. */ extern __ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW; /* Selective file content synch'ing. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count, unsigned int __flags); /* Splice address range into a pipe. This function is a possible cancellation point and therefore not marked with __THROW. */ extern __ssize_t vmsplice (int __fdout, const struct iovec *__iov, size_t __count, unsigned int __flags); /* Splice two files together. This function is a possible cancellation point and therefore not marked with __THROW. */ extern __ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, __off64_t *__offout, size_t __len, unsigned int __flags); /* In-kernel implementation of tee for pipe buffers. This function is a possible cancellation point and therefore not marked with __THROW. */ extern __ssize_t tee (int __fdin, int __fdout, size_t __len, unsigned int __flags); /* Reserve storage for the data of the file associated with FD. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, __off64_t __len), fallocate64); # else # define fallocate fallocate64 # endif # endif # ifdef __USE_LARGEFILE64 extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len); # endif /* Map file name to file handle. */ extern int name_to_handle_at (int __dfd, const char *__name, struct file_handle *__handle, int *__mnt_id, int __flags) __THROW; /* Open file using the file handle. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle, int __flags); #endif /* use GNU */ __END_DECLS bits/fcntl.h 0000644 00000004305 15063602063 0006767 0 ustar 00 /* O_*, F_*, FD_* bit values for Linux/x86. Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." #endif #ifdef __x86_64__ # define __O_LARGEFILE 0 #endif #ifdef __x86_64__ /* Not necessary, we always have 64-bit offsets. */ # define F_GETLK64 5 /* Get record locking info. */ # define F_SETLK64 6 /* Set record locking info (non-blocking). */ # define F_SETLKW64 7 /* Set record locking info (blocking). */ #endif struct flock { short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ #ifndef __USE_FILE_OFFSET64 __off_t l_start; /* Offset where the lock begins. */ __off_t l_len; /* Size of the locked area; zero means until EOF. */ #else __off64_t l_start; /* Offset where the lock begins. */ __off64_t l_len; /* Size of the locked area; zero means until EOF. */ #endif __pid_t l_pid; /* Process holding the lock. */ }; #ifdef __USE_LARGEFILE64 struct flock64 { short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ __off64_t l_start; /* Offset where the lock begins. */ __off64_t l_len; /* Size of the locked area; zero means until EOF. */ __pid_t l_pid; /* Process holding the lock. */ }; #endif /* Include generic Linux declarations. */ #include <bits/fcntl-linux.h> bits/fcntl2.h 0000644 00000012706 15063602063 0007055 0 ustar 00 /* Checking macros for fcntl functions. Copyright (C) 2007-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never include <bits/fcntl2.h> directly; use <fcntl.h> instead." #endif /* Check that calls to open and openat with O_CREAT or O_TMPFILE set have an appropriate third/fourth parameter. */ #ifndef __USE_FILE_OFFSET64 extern int __open_2 (const char *__path, int __oflag) __nonnull ((1)); extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), open) __nonnull ((1)); #else extern int __REDIRECT (__open_2, (const char *__path, int __oflag), __open64_2) __nonnull ((1)); extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...), open64) __nonnull ((1)); #endif __errordecl (__open_too_many_args, "open can be called either with 2 or 3 arguments, not more"); __errordecl (__open_missing_mode, "open with O_CREAT or O_TMPFILE in second argument needs 3 arguments"); __fortify_function int open (const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __open_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __open_missing_mode (); return __open_2 (__path, __oflag); } return __open_alias (__path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __open_2 (__path, __oflag); return __open_alias (__path, __oflag, __va_arg_pack ()); } #ifdef __USE_LARGEFILE64 extern int __open64_2 (const char *__path, int __oflag) __nonnull ((1)); extern int __REDIRECT (__open64_alias, (const char *__path, int __oflag, ...), open64) __nonnull ((1)); __errordecl (__open64_too_many_args, "open64 can be called either with 2 or 3 arguments, not more"); __errordecl (__open64_missing_mode, "open64 with O_CREAT or O_TMPFILE in second argument needs 3 arguments"); __fortify_function int open64 (const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __open64_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __open64_missing_mode (); return __open64_2 (__path, __oflag); } return __open64_alias (__path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __open64_2 (__path, __oflag); return __open64_alias (__path, __oflag, __va_arg_pack ()); } #endif #ifdef __USE_ATFILE # ifndef __USE_FILE_OFFSET64 extern int __openat_2 (int __fd, const char *__path, int __oflag) __nonnull ((2)); extern int __REDIRECT (__openat_alias, (int __fd, const char *__path, int __oflag, ...), openat) __nonnull ((2)); # else extern int __REDIRECT (__openat_2, (int __fd, const char *__path, int __oflag), __openat64_2) __nonnull ((2)); extern int __REDIRECT (__openat_alias, (int __fd, const char *__path, int __oflag, ...), openat64) __nonnull ((2)); # endif __errordecl (__openat_too_many_args, "openat can be called either with 3 or 4 arguments, not more"); __errordecl (__openat_missing_mode, "openat with O_CREAT or O_TMPFILE in third argument needs 4 arguments"); __fortify_function int openat (int __fd, const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __openat_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __openat_missing_mode (); return __openat_2 (__fd, __path, __oflag); } return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __openat_2 (__fd, __path, __oflag); return __openat_alias (__fd, __path, __oflag, __va_arg_pack ()); } # ifdef __USE_LARGEFILE64 extern int __openat64_2 (int __fd, const char *__path, int __oflag) __nonnull ((2)); extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path, int __oflag, ...), openat64) __nonnull ((2)); __errordecl (__openat64_too_many_args, "openat64 can be called either with 3 or 4 arguments, not more"); __errordecl (__openat64_missing_mode, "openat64 with O_CREAT or O_TMPFILE in third argument needs 4 arguments"); __fortify_function int openat64 (int __fd, const char *__path, int __oflag, ...) { if (__va_arg_pack_len () > 1) __openat64_too_many_args (); if (__builtin_constant_p (__oflag)) { if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1) { __openat64_missing_mode (); return __openat64_2 (__fd, __path, __oflag); } return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () < 1) return __openat64_2 (__fd, __path, __oflag); return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ()); } # endif #endif bits/fenv.h 0000644 00000010775 15063602063 0006627 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FENV_H # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." #endif /* Define bits representing the exception. We use the bit positions of the appropriate bits in the FPU control word. */ enum { FE_INVALID = #define FE_INVALID 0x01 FE_INVALID, __FE_DENORM = 0x02, FE_DIVBYZERO = #define FE_DIVBYZERO 0x04 FE_DIVBYZERO, FE_OVERFLOW = #define FE_OVERFLOW 0x08 FE_OVERFLOW, FE_UNDERFLOW = #define FE_UNDERFLOW 0x10 FE_UNDERFLOW, FE_INEXACT = #define FE_INEXACT 0x20 FE_INEXACT }; #define FE_ALL_EXCEPT \ (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) /* The ix87 FPU supports all of the four defined rounding modes. We use again the bit positions in the FPU control word as the values for the appropriate macros. */ enum { FE_TONEAREST = #define FE_TONEAREST 0 FE_TONEAREST, FE_DOWNWARD = #define FE_DOWNWARD 0x400 FE_DOWNWARD, FE_UPWARD = #define FE_UPWARD 0x800 FE_UPWARD, FE_TOWARDZERO = #define FE_TOWARDZERO 0xc00 FE_TOWARDZERO }; /* Type representing exception flags. */ typedef unsigned short int fexcept_t; /* Type representing floating-point environment. This structure corresponds to the layout of the block written by the `fstenv' instruction and has additional fields for the contents of the MXCSR register as written by the `stmxcsr' instruction. */ typedef struct { unsigned short int __control_word; unsigned short int __glibc_reserved1; unsigned short int __status_word; unsigned short int __glibc_reserved2; unsigned short int __tags; unsigned short int __glibc_reserved3; unsigned int __eip; unsigned short int __cs_selector; unsigned int __opcode:11; unsigned int __glibc_reserved4:5; unsigned int __data_offset; unsigned short int __data_selector; unsigned short int __glibc_reserved5; #ifdef __x86_64__ unsigned int __mxcsr; #endif } fenv_t; /* If the default argument is used we use this value. */ #define FE_DFL_ENV ((const fenv_t *) -1) #ifdef __USE_GNU /* Floating-point environment where none of the exception is masked. */ # define FE_NOMASK_ENV ((const fenv_t *) -2) #endif #if __GLIBC_USE (IEC_60559_BFP_EXT) /* Type representing floating-point control modes. */ typedef struct { unsigned short int __control_word; unsigned short int __glibc_reserved; unsigned int __mxcsr; } femode_t; /* Default floating-point control modes. */ # define FE_DFL_MODE ((const femode_t *) -1L) #endif #ifdef __USE_EXTERN_INLINES __BEGIN_DECLS /* Optimized versions. */ #ifndef _LIBC extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept); #endif __extern_always_inline void __NTH (__feraiseexcept_invalid_divbyzero (int __excepts)) { if ((FE_INVALID & __excepts) != 0) { /* One example of an invalid operation is 0.0 / 0.0. */ float __f = 0.0; # ifdef __SSE_MATH__ __asm__ __volatile__ ("divss %0, %0 " : "+x" (__f)); # else __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait" : "=t" (__f) : "0" (__f)); # endif (void) &__f; } if ((FE_DIVBYZERO & __excepts) != 0) { float __f = 1.0; float __g = 0.0; # ifdef __SSE_MATH__ __asm__ __volatile__ ("divss %1, %0" : "+x" (__f) : "x" (__g)); # else __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait" : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)"); # endif (void) &__f; } } __extern_inline int __NTH (feraiseexcept (int __excepts)) { if (__builtin_constant_p (__excepts) && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0) { __feraiseexcept_invalid_divbyzero (__excepts); return 0; } return __feraiseexcept_renamed (__excepts); } __END_DECLS #endif bits/fenvinline.h 0000644 00000000276 15063602063 0010021 0 ustar 00 /* This file provides inline versions of floating-pint environment handling functions. If there were any. */ #ifndef __NO_MATH_INLINES /* Here is where the code would go. */ #endif bits/floatn-common.h 0000644 00000023044 15063602063 0010433 0 ustar 00 /* Macros to control TS 18661-3 glibc features where the same definitions are appropriate for all platforms. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_FLOATN_COMMON_H #define _BITS_FLOATN_COMMON_H #include <features.h> #include <bits/long-double.h> /* This header should be included at the bottom of each bits/floatn.h. It defines the following macros for each _FloatN and _FloatNx type, where the same definitions, or definitions based only on the macros in bits/floatn.h, are appropriate for all glibc configurations. */ /* Defined to 1 if the current compiler invocation provides a floating-point type with the right format for this type, and this glibc includes corresponding *fN or *fNx interfaces for it. */ #define __HAVE_FLOAT16 0 #define __HAVE_FLOAT32 1 #define __HAVE_FLOAT64 1 #define __HAVE_FLOAT32X 1 #define __HAVE_FLOAT128X 0 /* Defined to 1 if the corresponding __HAVE_<type> macro is 1 and the type is the first with its format in the sequence of (the default choices for) float, double, long double, _Float16, _Float32, _Float64, _Float128, _Float32x, _Float64x, _Float128x for this glibc; that is, if functions present once per floating-point format rather than once per type are present for this type. All configurations supported by glibc have _Float32 the same format as float, _Float64 and _Float32x the same format as double, the _Float64x the same format as either long double or _Float128. No configurations support _Float128x or, as of GCC 7, have compiler support for a type meeting the requirements for _Float128x. */ #define __HAVE_DISTINCT_FLOAT16 __HAVE_FLOAT16 #define __HAVE_DISTINCT_FLOAT32 0 #define __HAVE_DISTINCT_FLOAT64 0 #define __HAVE_DISTINCT_FLOAT32X 0 #define __HAVE_DISTINCT_FLOAT64X 0 #define __HAVE_DISTINCT_FLOAT128X __HAVE_FLOAT128X /* Defined to 1 if the corresponding _FloatN type is not binary compatible with the corresponding ISO C type in the current compilation unit as opposed to __HAVE_DISTINCT_FLOATN, which indicates the default types built in glibc. */ #define __HAVE_FLOAT128_UNLIKE_LDBL (__HAVE_DISTINCT_FLOAT128 \ && __LDBL_MANT_DIG__ != 113) /* Defined to 1 if any _FloatN or _FloatNx types that are not ABI-distinct are however distinct types at the C language level (so for the purposes of __builtin_types_compatible_p and _Generic). */ #if __GNUC_PREREQ (7, 0) && !defined __cplusplus # define __HAVE_FLOATN_NOT_TYPEDEF 1 #else # define __HAVE_FLOATN_NOT_TYPEDEF 0 #endif #ifndef __ASSEMBLER__ /* Defined to concatenate the literal suffix to be used with _FloatN or _FloatNx types, if __HAVE_<type> is 1. The corresponding literal suffixes exist since GCC 7, for C only. */ # if __HAVE_FLOAT16 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus /* No corresponding suffix available for this type. */ # define __f16(x) ((_Float16) x##f) # else # define __f16(x) x##f16 # endif # endif # if __HAVE_FLOAT32 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # define __f32(x) x##f # else # define __f32(x) x##f32 # endif # endif # if __HAVE_FLOAT64 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # ifdef __NO_LONG_DOUBLE_MATH # define __f64(x) x##l # else # define __f64(x) x # endif # else # define __f64(x) x##f64 # endif # endif # if __HAVE_FLOAT32X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # define __f32x(x) x # else # define __f32x(x) x##f32x # endif # endif # if __HAVE_FLOAT64X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if __HAVE_FLOAT64X_LONG_DOUBLE # define __f64x(x) x##l # else # define __f64x(x) __f128 (x) # endif # else # define __f64x(x) x##f64x # endif # endif # if __HAVE_FLOAT128X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # error "_Float128X supported but no constant suffix" # else # define __f128x(x) x##f128x # endif # endif /* Defined to a complex type if __HAVE_<type> is 1. */ # if __HAVE_FLOAT16 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__))); # define __CFLOAT16 __cfloat16 # else # define __CFLOAT16 _Complex _Float16 # endif # endif # if __HAVE_FLOAT32 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # define __CFLOAT32 _Complex float # else # define __CFLOAT32 _Complex _Float32 # endif # endif # if __HAVE_FLOAT64 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # ifdef __NO_LONG_DOUBLE_MATH # define __CFLOAT64 _Complex long double # else # define __CFLOAT64 _Complex double # endif # else # define __CFLOAT64 _Complex _Float64 # endif # endif # if __HAVE_FLOAT32X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # define __CFLOAT32X _Complex double # else # define __CFLOAT32X _Complex _Float32x # endif # endif # if __HAVE_FLOAT64X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if __HAVE_FLOAT64X_LONG_DOUBLE # define __CFLOAT64X _Complex long double # else # define __CFLOAT64X __CFLOAT128 # endif # else # define __CFLOAT64X _Complex _Float64x # endif # endif # if __HAVE_FLOAT128X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # error "_Float128X supported but no complex type" # else # define __CFLOAT128X _Complex _Float128x # endif # endif /* The remaining of this file provides support for older compilers. */ # if __HAVE_FLOAT16 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef float _Float16 __attribute__ ((__mode__ (__HF__))); # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf16() ((_Float16) __builtin_huge_val ()) # define __builtin_inff16() ((_Float16) __builtin_inf ()) # define __builtin_nanf16(x) ((_Float16) __builtin_nan (x)) # define __builtin_nansf16(x) ((_Float16) __builtin_nans (x)) # endif # endif # if __HAVE_FLOAT32 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef float _Float32; # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf32() (__builtin_huge_valf ()) # define __builtin_inff32() (__builtin_inff ()) # define __builtin_nanf32(x) (__builtin_nanf (x)) # define __builtin_nansf32(x) (__builtin_nansf (x)) # endif # endif # if __HAVE_FLOAT64 /* If double, long double and _Float64 all have the same set of values, TS 18661-3 requires the usual arithmetic conversions on long double and _Float64 to produce _Float64. For this to be the case when building with a compiler without a distinct _Float64 type, _Float64 must be a typedef for long double, not for double. */ # ifdef __NO_LONG_DOUBLE_MATH # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef long double _Float64; # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf64() (__builtin_huge_vall ()) # define __builtin_inff64() (__builtin_infl ()) # define __builtin_nanf64(x) (__builtin_nanl (x)) # define __builtin_nansf64(x) (__builtin_nansl (x)) # endif # else # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef double _Float64; # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf64() (__builtin_huge_val ()) # define __builtin_inff64() (__builtin_inf ()) # define __builtin_nanf64(x) (__builtin_nan (x)) # define __builtin_nansf64(x) (__builtin_nans (x)) # endif # endif # endif # if __HAVE_FLOAT32X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef double _Float32x; # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf32x() (__builtin_huge_val ()) # define __builtin_inff32x() (__builtin_inf ()) # define __builtin_nanf32x(x) (__builtin_nan (x)) # define __builtin_nansf32x(x) (__builtin_nans (x)) # endif # endif # if __HAVE_FLOAT64X # if __HAVE_FLOAT64X_LONG_DOUBLE # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef long double _Float64x; # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf64x() (__builtin_huge_vall ()) # define __builtin_inff64x() (__builtin_infl ()) # define __builtin_nanf64x(x) (__builtin_nanl (x)) # define __builtin_nansf64x(x) (__builtin_nansl (x)) # endif # else # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef _Float128 _Float64x; # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf64x() (__builtin_huge_valf128 ()) # define __builtin_inff64x() (__builtin_inff128 ()) # define __builtin_nanf64x(x) (__builtin_nanf128 (x)) # define __builtin_nansf64x(x) (__builtin_nansf128 (x)) # endif # endif # endif # if __HAVE_FLOAT128X # if !__GNUC_PREREQ (7, 0) || defined __cplusplus # error "_Float128x supported but no type" # endif # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf128x() ((_Float128x) __builtin_huge_val ()) # define __builtin_inff128x() ((_Float128x) __builtin_inf ()) # define __builtin_nanf128x(x) ((_Float128x) __builtin_nan (x)) # define __builtin_nansf128x(x) ((_Float128x) __builtin_nans (x)) # endif # endif #endif /* !__ASSEMBLER__. */ #endif /* _BITS_FLOATN_COMMON_H */ bits/floatn.h 0000644 00000010424 15063602063 0007143 0 ustar 00 /* Macros to control TS 18661-3 glibc features on x86. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_FLOATN_H #define _BITS_FLOATN_H #include <features.h> /* Defined to 1 if the current compiler invocation provides a floating-point type with the IEEE 754 binary128 format, and this glibc includes corresponding *f128 interfaces for it. The required libgcc support was added some time after the basic compiler support, for x86_64 and x86. */ #if (defined __x86_64__ \ ? __GNUC_PREREQ (4, 3) \ : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) # define __HAVE_FLOAT128 1 #else # define __HAVE_FLOAT128 0 #endif /* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct from the default float, double and long double types in this glibc. */ #if __HAVE_FLOAT128 # define __HAVE_DISTINCT_FLOAT128 1 #else # define __HAVE_DISTINCT_FLOAT128 0 #endif /* Defined to 1 if the current compiler invocation provides a floating-point type with the right format for _Float64x, and this glibc includes corresponding *f64x interfaces for it. */ #define __HAVE_FLOAT64X 1 /* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has the format of _Float128, which must be different from that of long double. */ #define __HAVE_FLOAT64X_LONG_DOUBLE 1 #ifndef __ASSEMBLER__ /* Defined to concatenate the literal suffix to be used with _Float128 types, if __HAVE_FLOAT128 is 1. */ # if __HAVE_FLOAT128 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus /* The literal suffix f128 exists only since GCC 7.0. */ # define __f128(x) x##q # else # define __f128(x) x##f128 # endif # endif /* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ # if __HAVE_FLOAT128 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus /* Add a typedef for older GCC compilers which don't natively support _Complex _Float128. */ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); # define __CFLOAT128 __cfloat128 # else # define __CFLOAT128 _Complex _Float128 # endif # endif /* The remaining of this file provides support for older compilers. */ # if __HAVE_FLOAT128 /* The type _Float128 exists only since GCC 7.0. */ # if !__GNUC_PREREQ (7, 0) || defined __cplusplus typedef __float128 _Float128; # endif /* __builtin_huge_valf128 doesn't exist before GCC 7.0. */ # if !__GNUC_PREREQ (7, 0) # define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ()) # endif /* Older GCC has only a subset of built-in functions for _Float128 on x86, and __builtin_infq is not usable in static initializers. Converting a narrower sNaN to _Float128 produces a quiet NaN, so attempts to use _Float128 sNaNs will not work properly with older compilers. */ # if !__GNUC_PREREQ (7, 0) # define __builtin_copysignf128 __builtin_copysignq # define __builtin_fabsf128 __builtin_fabsq # define __builtin_inff128() ((_Float128) __builtin_inf ()) # define __builtin_nanf128(x) ((_Float128) __builtin_nan (x)) # define __builtin_nansf128(x) ((_Float128) __builtin_nans (x)) # endif /* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, e.g.: __builtin_signbitf128, before GCC 6. However, there has never been a __builtin_signbitf128 in GCC and the type-generic builtin is only available since GCC 6. */ # if !__GNUC_PREREQ (6, 0) # define __builtin_signbitf128 __signbitf128 # endif # endif #endif /* !__ASSEMBLER__. */ #include <bits/floatn-common.h> #endif /* _BITS_FLOATN_H */ bits/flt-eval-method.h 0000644 00000002276 15063602063 0010656 0 ustar 00 /* Define __GLIBC_FLT_EVAL_METHOD. x86 version. Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/flt-eval-method.h> directly; include <math.h> instead." #endif #ifdef __FLT_EVAL_METHOD__ # if __FLT_EVAL_METHOD__ == -1 # define __GLIBC_FLT_EVAL_METHOD 2 # else # define __GLIBC_FLT_EVAL_METHOD __FLT_EVAL_METHOD__ # endif #elif defined __x86_64__ # define __GLIBC_FLT_EVAL_METHOD 0 #else # define __GLIBC_FLT_EVAL_METHOD 2 #endif bits/fp-fast.h 0000644 00000002277 15063602063 0007227 0 ustar 00 /* Define FP_FAST_* macros. Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/fp-fast.h> directly; include <math.h> instead." #endif #ifdef __USE_ISOC99 /* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l} builtins are supported. */ # ifdef __FP_FAST_FMA # define FP_FAST_FMA 1 # endif # ifdef __FP_FAST_FMAF # define FP_FAST_FMAF 1 # endif # ifdef __FP_FAST_FMAL # define FP_FAST_FMAL 1 # endif #endif bits/fp-logb.h 0000644 00000001763 15063602063 0007214 0 ustar 00 /* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version. Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/fp-logb.h> directly; include <math.h> instead." #endif #define __FP_LOGB0_IS_MIN 1 #define __FP_LOGBNAN_IS_MIN 1 bits/getopt_core.h 0000644 00000007122 15063602063 0010173 0 ustar 00 /* Declarations for getopt (basic, portable features only). Copyright (C) 1989-2018 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GETOPT_CORE_H #define _GETOPT_CORE_H 1 /* This header should not be used directly; include getopt.h or unistd.h instead. Unlike most bits headers, it does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ __BEGIN_DECLS /* For communication from 'getopt' to the caller. When 'getopt' finds an option that takes an argument, the argument value is returned here. Also, when 'ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to 'getopt'. On entry to 'getopt', zero means this is the first call; initialize. When 'getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, 'optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message 'getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, 'optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in 'optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU 'getopt'. The argument '--' causes premature termination of argument scanning, explicitly telling 'getopt' that there are no more options. If OPTS begins with '-', then non-option arguments are treated as arguments to the option '\1'. This behavior is specific to the GNU 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in the environment, then do not permute arguments. For standards compliance, the 'argv' argument has the type char *const *, but this is inaccurate; if argument permutation is enabled, the argv array (not the strings it points to) must be writable. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW __nonnull ((2, 3)); __END_DECLS #endif /* getopt_core.h */ bits/getopt_ext.h 0000644 00000005735 15063602063 0010053 0 ustar 00 /* Declarations for getopt (GNU extensions). Copyright (C) 1989-2018 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GETOPT_EXT_H #define _GETOPT_EXT_H 1 /* This header should not be used directly; include getopt.h instead. Unlike most bits headers, it does not have a protective #error, because the guard macro for getopt.h in gnulib is not fixed. */ __BEGIN_DECLS /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of 'struct option' terminated by an element containing a name which is zero. The field 'has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field 'flag' is not NULL, it points to a variable that is set to the value given in the field 'val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an 'int' to a compiled-in constant, such as set a value from 'optarg', set the option's 'flag' field to zero and its 'val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero 'flag' field, 'getopt' returns the contents of the 'val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the 'has_arg' field of 'struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW __nonnull ((2, 3)); extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW __nonnull ((2, 3)); __END_DECLS #endif /* getopt_ext.h */ bits/getopt_posix.h 0000644 00000003421 15063602063 0010403 0 ustar 00 /* Declarations for getopt (POSIX compatibility shim). Copyright (C) 1989-2018 Free Software Foundation, Inc. Unlike the bulk of the getopt implementation, this file is NOT part of gnulib. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GETOPT_POSIX_H #define _GETOPT_POSIX_H 1 #if !defined _UNISTD_H && !defined _STDIO_H #error "Never include getopt_posix.h directly; use unistd.h instead." #endif #include <bits/getopt_core.h> __BEGIN_DECLS #if defined __USE_POSIX2 && !defined __USE_POSIX_IMPLICITLY \ && !defined __USE_GNU && !defined _GETOPT_H /* GNU getopt has more functionality than POSIX getopt. When we are explicitly conforming to POSIX and not GNU, and getopt.h (which is not part of POSIX) has not been included, the extra functionality is disabled. */ # ifdef __REDIRECT extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv, const char *__shortopts), __posix_getopt); # else extern int __posix_getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW __nonnull ((2, 3)); # define getopt __posix_getopt # endif #endif __END_DECLS #endif /* getopt_posix.h */ bits/hwcap.h 0000644 00000001713 15063602063 0006763 0 ustar 00 /* Defines for bits in AT_HWCAP. Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_AUXV_H # error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead." #endif /* No bits defined for this architecture. */ bits/in.h 0000644 00000022372 15063602063 0006273 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Linux version. */ #ifndef _NETINET_IN_H # error "Never use <bits/in.h> directly; include <netinet/in.h> instead." #endif /* If the application has already included linux/in6.h from a linux-based kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the defines), sockaddr_in6, or ipv6_mreq. Same for in6_ptkinfo or ip6_mtuinfo in linux/ipv6.h. The ABI used by the linux-kernel and glibc match exactly. Neither the linux kernel nor glibc should break this ABI without coordination. In upstream kernel 56c176c9 the _UAPI prefix was stripped so we need to check for _LINUX_IN6_H and _IPV6_H now, and keep checking the old versions for maximum backwards compatibility. */ #if defined _UAPI_LINUX_IN6_H \ || defined _UAPI_IPV6_H \ || defined _LINUX_IN6_H \ || defined _IPV6_H /* This is not quite the same API since the kernel always defines s6_addr16 and s6_addr32. This is not a violation of POSIX since POSIX says "at least the following member" and that holds true. */ # define __USE_KERNEL_IPV6_DEFS 1 #else # define __USE_KERNEL_IPV6_DEFS 0 #endif /* Options for use with `getsockopt' and `setsockopt' at the IP level. The first word in the comment at the right is the data type used; "bool" means a boolean value stored in an `int'. */ #define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */ #define IP_HDRINCL 3 /* int; Header is included with data. */ #define IP_TOS 1 /* int; IP type of service and precedence. */ #define IP_TTL 2 /* int; IP time to live. */ #define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */ /* For BSD compatibility. */ #define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */ #define IP_RETOPTS 7 /* ip_opts; Set/get IP per-packet options. */ #define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */ #define IP_MULTICAST_TTL 33 /* unsigned char; set/get IP multicast ttl */ #define IP_MULTICAST_LOOP 34 /* bool; set/get IP multicast loopback */ #define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */ #define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */ #define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */ #define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */ #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */ #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */ #define IP_MSFILTER 41 #ifdef __USE_MISC # define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ # define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ # define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ # define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ # define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ # define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ # define MCAST_MSFILTER 48 # define IP_MULTICAST_ALL 49 # define IP_UNICAST_IF 50 # define MCAST_EXCLUDE 0 # define MCAST_INCLUDE 1 #endif #define IP_ROUTER_ALERT 5 /* bool */ #define IP_PKTINFO 8 /* bool */ #define IP_PKTOPTIONS 9 #define IP_PMTUDISC 10 /* obsolete name? */ #define IP_MTU_DISCOVER 10 /* int; see below */ #define IP_RECVERR 11 /* bool */ #define IP_RECVTTL 12 /* bool */ #define IP_RECVTOS 13 /* bool */ #define IP_MTU 14 /* int */ #define IP_FREEBIND 15 #define IP_IPSEC_POLICY 16 #define IP_XFRM_POLICY 17 #define IP_PASSSEC 18 #define IP_TRANSPARENT 19 #define IP_MULTICAST_ALL 49 /* bool */ /* TProxy original addresses */ #define IP_ORIGDSTADDR 20 #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR #define IP_MINTTL 21 #define IP_NODEFRAG 22 #define IP_CHECKSUM 23 #define IP_BIND_ADDRESS_NO_PORT 24 #define IP_RECVFRAGSIZE 25 /* IP_MTU_DISCOVER arguments. */ #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ #define IP_PMTUDISC_WANT 1 /* Use per route hints. */ #define IP_PMTUDISC_DO 2 /* Always DF. */ #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ /* Always use interface mtu (ignores dst pmtu) but don't set DF flag. Also incoming ICMP frag_needed notifications will be ignored on this socket to prevent accepting spoofed ones. */ #define IP_PMTUDISC_INTERFACE 4 /* Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. */ #define IP_PMTUDISC_OMIT 5 #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 #define IP_MULTICAST_LOOP 34 #define IP_ADD_MEMBERSHIP 35 #define IP_DROP_MEMBERSHIP 36 #define IP_UNBLOCK_SOURCE 37 #define IP_BLOCK_SOURCE 38 #define IP_ADD_SOURCE_MEMBERSHIP 39 #define IP_DROP_SOURCE_MEMBERSHIP 40 #define IP_MSFILTER 41 #define IP_MULTICAST_ALL 49 #define IP_UNICAST_IF 50 /* To select the IP level. */ #define SOL_IP 0 #define IP_DEFAULT_MULTICAST_TTL 1 #define IP_DEFAULT_MULTICAST_LOOP 1 #define IP_MAX_MEMBERSHIPS 20 #ifdef __USE_MISC /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. The `ip_dst' field is used for the first-hop gateway when using a source route (this gets put into the header proper). */ struct ip_opts { struct in_addr ip_dst; /* First hop; zero without source route. */ char ip_opts[40]; /* Actually variable in size. */ }; /* Like `struct ip_mreq' but including interface specification by index. */ struct ip_mreqn { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_address; /* local IP address of interface */ int imr_ifindex; /* Interface index */ }; /* Structure used for IP_PKTINFO. */ struct in_pktinfo { int ipi_ifindex; /* Interface index */ struct in_addr ipi_spec_dst; /* Routing destination address */ struct in_addr ipi_addr; /* Header destination address */ }; #endif /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level. The first word in the comment at the right is the data type used; "bool" means a boolean value stored in an `int'. */ #define IPV6_ADDRFORM 1 #define IPV6_2292PKTINFO 2 #define IPV6_2292HOPOPTS 3 #define IPV6_2292DSTOPTS 4 #define IPV6_2292RTHDR 5 #define IPV6_2292PKTOPTIONS 6 #define IPV6_CHECKSUM 7 #define IPV6_2292HOPLIMIT 8 #define SCM_SRCRT IPV6_RXSRCRT #define IPV6_NEXTHOP 9 #define IPV6_AUTHHDR 10 #define IPV6_UNICAST_HOPS 16 #define IPV6_MULTICAST_IF 17 #define IPV6_MULTICAST_HOPS 18 #define IPV6_MULTICAST_LOOP 19 #define IPV6_JOIN_GROUP 20 #define IPV6_LEAVE_GROUP 21 #define IPV6_ROUTER_ALERT 22 #define IPV6_MTU_DISCOVER 23 #define IPV6_MTU 24 #define IPV6_RECVERR 25 #define IPV6_V6ONLY 26 #define IPV6_JOIN_ANYCAST 27 #define IPV6_LEAVE_ANYCAST 28 #define IPV6_IPSEC_POLICY 34 #define IPV6_XFRM_POLICY 35 #define IPV6_HDRINCL 36 /* Advanced API (RFC3542) (1). */ #define IPV6_RECVPKTINFO 49 #define IPV6_PKTINFO 50 #define IPV6_RECVHOPLIMIT 51 #define IPV6_HOPLIMIT 52 #define IPV6_RECVHOPOPTS 53 #define IPV6_HOPOPTS 54 #define IPV6_RTHDRDSTOPTS 55 #define IPV6_RECVRTHDR 56 #define IPV6_RTHDR 57 #define IPV6_RECVDSTOPTS 58 #define IPV6_DSTOPTS 59 #define IPV6_RECVPATHMTU 60 #define IPV6_PATHMTU 61 #define IPV6_DONTFRAG 62 /* Advanced API (RFC3542) (2). */ #define IPV6_RECVTCLASS 66 #define IPV6_TCLASS 67 #define IPV6_AUTOFLOWLABEL 70 /* RFC5014. */ #define IPV6_ADDR_PREFERENCES 72 /* RFC5082. */ #define IPV6_MINHOPCOUNT 73 #define IPV6_ORIGDSTADDR 74 #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR #define IPV6_TRANSPARENT 75 #define IPV6_UNICAST_IF 76 #define IPV6_RECVFRAGSIZE 77 #define IPV6_FREEBIND 78 /* Obsolete synonyms for the above. */ #if !__USE_KERNEL_IPV6_DEFS # define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP # define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP #endif #define IPV6_RXHOPOPTS IPV6_HOPOPTS #define IPV6_RXDSTOPTS IPV6_DSTOPTS /* IPV6_MTU_DISCOVER values. */ #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */ #define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */ #define IPV6_PMTUDISC_DO 2 /* Always DF. */ #define IPV6_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */ #define IPV6_PMTUDISC_INTERFACE 4 /* See IP_PMTUDISC_INTERFACE. */ #define IPV6_PMTUDISC_OMIT 5 /* See IP_PMTUDISC_OMIT. */ /* Socket level values for IPv6. */ #define SOL_IPV6 41 #define SOL_ICMPV6 58 /* Routing header options for IPv6. */ #define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */ #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ bits/indirect-return.h 0000644 00000003061 15063602063 0010775 0 ustar 00 /* Definition of __INDIRECT_RETURN. x86 version. Copyright (C) 2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UCONTEXT_H # error "Never include <bits/indirect-return.h> directly; use <ucontext.h> instead." #endif /* On x86, swapcontext returns via indirect branch when the shadow stack is enabled. Define __INDIRECT_RETURN to indicate whether swapcontext returns via indirect branch. */ #if defined __CET__ && (__CET__ & 2) != 0 # if __glibc_has_attribute (__indirect_return__) # define __INDIRECT_RETURN __attribute__ ((__indirect_return__)) # else /* Newer compilers provide the indirect_return attribute, but without it we can use returns_twice to affect the optimizer in the same way and avoid unsafe optimizations. */ # define __INDIRECT_RETURN __attribute__ ((__returns_twice__)) # endif #else # define __INDIRECT_RETURN #endif bits/initspin.h 0000644 00000000031 15063602063 0007506 0 ustar 00 /* No thread support. */ bits/inotify.h 0000644 00000002067 15063602063 0007345 0 ustar 00 /* Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_INOTIFY_H # error "Never use <bits/inotify.h> directly; include <sys/inotify.h> instead." #endif /* Flags for the parameter of inotify_init1. */ enum { IN_CLOEXEC = 02000000, #define IN_CLOEXEC IN_CLOEXEC IN_NONBLOCK = 00004000 #define IN_NONBLOCK IN_NONBLOCK }; bits/ioctl-types.h 0000644 00000004627 15063602063 0010144 0 ustar 00 /* Structure types for pre-termios terminal ioctls. Linux version. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H # error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead." #endif /* Get definition of constants for use with `ioctl'. */ #include <asm/ioctls.h> struct winsize { unsigned short int ws_row; unsigned short int ws_col; unsigned short int ws_xpixel; unsigned short int ws_ypixel; }; #define NCC 8 struct termio { unsigned short int c_iflag; /* input mode flags */ unsigned short int c_oflag; /* output mode flags */ unsigned short int c_cflag; /* control mode flags */ unsigned short int c_lflag; /* local mode flags */ unsigned char c_line; /* line discipline */ unsigned char c_cc[NCC]; /* control characters */ }; /* modem lines */ #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 #define TIOCM_RTS 0x004 #define TIOCM_ST 0x008 #define TIOCM_SR 0x010 #define TIOCM_CTS 0x020 #define TIOCM_CAR 0x040 #define TIOCM_RNG 0x080 #define TIOCM_DSR 0x100 #define TIOCM_CD TIOCM_CAR #define TIOCM_RI TIOCM_RNG /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ /* line disciplines */ #define N_TTY 0 #define N_SLIP 1 #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 #define N_AX25 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Mobitex module */ #define N_R3964 9 /* Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Profibus */ #define N_IRDA 11 /* Linux IR */ #define N_SMSBLOCK 12 /* SMS block mode */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ #define N_HCI 15 /* Bluetooth HCI UART */ bits/ioctls.h 0000644 00000010575 15063602063 0007164 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IOCTL_H # error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead." #endif /* Use the definitions from the kernel header files. */ #include <asm/ioctls.h> /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ #define SIOCDELRT 0x890C /* delete routing table entry */ #define SIOCRTMSG 0x890D /* call to routing system */ /* Socket configuration controls. */ #define SIOCGIFNAME 0x8910 /* get iface name */ #define SIOCSIFLINK 0x8911 /* set iface channel */ #define SIOCGIFCONF 0x8912 /* get iface list */ #define SIOCGIFFLAGS 0x8913 /* get flags */ #define SIOCSIFFLAGS 0x8914 /* set flags */ #define SIOCGIFADDR 0x8915 /* get PA address */ #define SIOCSIFADDR 0x8916 /* set PA address */ #define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ #define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ #define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ #define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ #define SIOCGIFNETMASK 0x891b /* get network PA mask */ #define SIOCSIFNETMASK 0x891c /* set network PA mask */ #define SIOCGIFMETRIC 0x891d /* get metric */ #define SIOCSIFMETRIC 0x891e /* set metric */ #define SIOCGIFMEM 0x891f /* get memory address (BSD) */ #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ #define SIOCSIFNAME 0x8923 /* set interface name */ #define SIOCSIFHWADDR 0x8924 /* set hardware address */ #define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ #define SIOCSIFENCAP 0x8926 #define SIOCGIFHWADDR 0x8927 /* Get hardware address */ #define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ #define SIOCSIFSLAVE 0x8930 #define SIOCADDMULTI 0x8931 /* Multicast address lists */ #define SIOCDELMULTI 0x8932 #define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ #define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ #define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ #define SIOCGIFPFLAGS 0x8935 #define SIOCDIFADDR 0x8936 /* delete PA address */ #define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ #define SIOCGIFCOUNT 0x8938 /* get number of devices */ #define SIOCGIFBR 0x8940 /* Bridging support */ #define SIOCSIFBR 0x8941 /* Set bridging options */ #define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ #define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ /* ARP cache control calls. */ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ #define SIOCDARP 0x8953 /* delete ARP table entry */ #define SIOCGARP 0x8954 /* get ARP table entry */ #define SIOCSARP 0x8955 /* set ARP table entry */ /* RARP cache control calls. */ #define SIOCDRARP 0x8960 /* delete RARP table entry */ #define SIOCGRARP 0x8961 /* get RARP table entry */ #define SIOCSRARP 0x8962 /* set RARP table entry */ /* Driver configuration calls */ #define SIOCGIFMAP 0x8970 /* Get device parameters */ #define SIOCSIFMAP 0x8971 /* Set device parameters */ /* DLCI configuration calls */ #define SIOCADDDLCI 0x8980 /* Create new DLCI device */ #define SIOCDELDLCI 0x8981 /* Delete DLCI device */ /* Device private ioctl calls. */ /* These 16 ioctls are available to devices via the do_ioctl() device vector. Each device should include this file and redefine these names as their own. Because these are device dependent it is a good idea _NOT_ to issue them to random objects and hope. */ #define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ /* * These 16 ioctl calls are protocol private */ #define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ bits/ipc.h 0000644 00000004026 15063602063 0006434 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IPC_H # error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead." #endif #include <bits/types.h> /* Mode bits for `msgget', `semget', and `shmget'. */ #define IPC_CREAT 01000 /* Create key if key does not exist. */ #define IPC_EXCL 02000 /* Fail if key exists. */ #define IPC_NOWAIT 04000 /* Return error on wait. */ /* Control commands for `msgctl', `semctl', and `shmctl'. */ #define IPC_RMID 0 /* Remove identifier. */ #define IPC_SET 1 /* Set `ipc_perm' options. */ #define IPC_STAT 2 /* Get `ipc_perm' options. */ #ifdef __USE_GNU # define IPC_INFO 3 /* See ipcs. */ #endif /* Special key values. */ #define IPC_PRIVATE ((__key_t) 0) /* Private key. */ /* Data structure used to pass permission information to IPC operations. */ struct ipc_perm { __key_t __key; /* Key. */ __uid_t uid; /* Owner's user ID. */ __gid_t gid; /* Owner's group ID. */ __uid_t cuid; /* Creator's user ID. */ __gid_t cgid; /* Creator's group ID. */ unsigned short int mode; /* Read/write permission. */ unsigned short int __pad1; unsigned short int __seq; /* Sequence number. */ unsigned short int __pad2; __syscall_ulong_t __glibc_reserved1; __syscall_ulong_t __glibc_reserved2; }; bits/ipctypes.h 0000644 00000002227 15063602063 0007522 0 ustar 00 /* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_IPC_H # error "Never use <bits/ipctypes.h> directly; include <sys/ipc.h> instead." #endif #ifndef _BITS_IPCTYPES_H #define _BITS_IPCTYPES_H 1 /* Used in `struct shmid_ds'. */ # ifdef __x86_64__ typedef int __ipc_pid_t; # else typedef unsigned short int __ipc_pid_t; # endif #endif /* bits/ipctypes.h */ bits/iscanonical.h 0000644 00000004656 15063602063 0010155 0 ustar 00 /* Define iscanonical macro. ldbl-96 version. Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/iscanonical.h> directly; include <math.h> instead." #endif extern int __iscanonicall (long double __x) __THROW __attribute__ ((__const__)); #define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1) #define __iscanonical(x) ((void) (__typeof (x)) (x), 1) #if __HAVE_DISTINCT_FLOAT128 # define __iscanonicalf128(x) ((void) (__typeof (x)) (x), 1) #endif /* Return nonzero value if X is canonical. In IEEE interchange binary formats, all values are canonical, but the argument must still be converted to its semantic type for any exceptions arising from the conversion, before being discarded; in extended precision, there are encodings that are not consistently handled as corresponding to any particular value of the type, and we return 0 for those. */ #ifndef __cplusplus # define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) #else /* In C++ mode, __MATH_TG cannot be used, because it relies on __builtin_types_compatible_p, which is a C-only builtin. On the other hand, overloading provides the means to distinguish between the floating-point types. The overloading resolution will match the correct parameter (regardless of type qualifiers (i.e.: const and volatile)). */ extern "C++" { inline int iscanonical (float __val) { return __iscanonicalf (__val); } inline int iscanonical (double __val) { return __iscanonical (__val); } inline int iscanonical (long double __val) { return __iscanonicall (__val); } # if __HAVE_DISTINCT_FLOAT128 inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); } # endif } #endif /* __cplusplus */ bits/libc-header-start.h 0000644 00000005057 15063602063 0011160 0 ustar 00 /* Handle feature test macros at the start of a header. Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This header is internal to glibc and should not be included outside of glibc headers. Headers including it must define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION first. This header cannot have multiple include guards because ISO C feature test macros depend on the definition of the macro when an affected header is included, not when the first system header is included. */ #ifndef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION # error "Never include <bits/libc-header-start.h> directly." #endif #undef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION #include <features.h> /* ISO/IEC TR 24731-2:2010 defines the __STDC_WANT_LIB_EXT2__ macro. */ #undef __GLIBC_USE_LIB_EXT2 #if (defined __USE_GNU \ || (defined __STDC_WANT_LIB_EXT2__ && __STDC_WANT_LIB_EXT2__ > 0)) # define __GLIBC_USE_LIB_EXT2 1 #else # define __GLIBC_USE_LIB_EXT2 0 #endif /* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__ macro. */ #undef __GLIBC_USE_IEC_60559_BFP_EXT #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__ # define __GLIBC_USE_IEC_60559_BFP_EXT 1 #else # define __GLIBC_USE_IEC_60559_BFP_EXT 0 #endif /* ISO/IEC TS 18661-4:2015 defines the __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. */ #undef __GLIBC_USE_IEC_60559_FUNCS_EXT #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__ # define __GLIBC_USE_IEC_60559_FUNCS_EXT 1 #else # define __GLIBC_USE_IEC_60559_FUNCS_EXT 0 #endif /* ISO/IEC TS 18661-3:2015 defines the __STDC_WANT_IEC_60559_TYPES_EXT__ macro. */ #undef __GLIBC_USE_IEC_60559_TYPES_EXT #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_TYPES_EXT__ # define __GLIBC_USE_IEC_60559_TYPES_EXT 1 #else # define __GLIBC_USE_IEC_60559_TYPES_EXT 0 #endif bits/libm-simd-decl-stubs.h 0000644 00000005673 15063602063 0011612 0 ustar 00 /* Empty definitions required for __MATHCALL_VEC unfolding in mathcalls.h. Copyright (C) 2014-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never include <bits/libm-simd-decl-stubs.h> directly;\ include <math.h> instead." #endif /* Needed definitions could be generated with: for func in $(grep __MATHCALL_VEC math/bits/mathcalls.h |\ sed -r "s|__MATHCALL_VEC.?\(||; s|,.*||"); do echo "#define __DECL_SIMD_${func}"; echo "#define __DECL_SIMD_${func}f"; echo "#define __DECL_SIMD_${func}l"; done */ #ifndef _BITS_LIBM_SIMD_DECL_STUBS_H #define _BITS_LIBM_SIMD_DECL_STUBS_H 1 #define __DECL_SIMD_cos #define __DECL_SIMD_cosf #define __DECL_SIMD_cosl #define __DECL_SIMD_cosf16 #define __DECL_SIMD_cosf32 #define __DECL_SIMD_cosf64 #define __DECL_SIMD_cosf128 #define __DECL_SIMD_cosf32x #define __DECL_SIMD_cosf64x #define __DECL_SIMD_cosf128x #define __DECL_SIMD_sin #define __DECL_SIMD_sinf #define __DECL_SIMD_sinl #define __DECL_SIMD_sinf16 #define __DECL_SIMD_sinf32 #define __DECL_SIMD_sinf64 #define __DECL_SIMD_sinf128 #define __DECL_SIMD_sinf32x #define __DECL_SIMD_sinf64x #define __DECL_SIMD_sinf128x #define __DECL_SIMD_sincos #define __DECL_SIMD_sincosf #define __DECL_SIMD_sincosl #define __DECL_SIMD_sincosf16 #define __DECL_SIMD_sincosf32 #define __DECL_SIMD_sincosf64 #define __DECL_SIMD_sincosf128 #define __DECL_SIMD_sincosf32x #define __DECL_SIMD_sincosf64x #define __DECL_SIMD_sincosf128x #define __DECL_SIMD_log #define __DECL_SIMD_logf #define __DECL_SIMD_logl #define __DECL_SIMD_logf16 #define __DECL_SIMD_logf32 #define __DECL_SIMD_logf64 #define __DECL_SIMD_logf128 #define __DECL_SIMD_logf32x #define __DECL_SIMD_logf64x #define __DECL_SIMD_logf128x #define __DECL_SIMD_exp #define __DECL_SIMD_expf #define __DECL_SIMD_expl #define __DECL_SIMD_expf16 #define __DECL_SIMD_expf32 #define __DECL_SIMD_expf64 #define __DECL_SIMD_expf128 #define __DECL_SIMD_expf32x #define __DECL_SIMD_expf64x #define __DECL_SIMD_expf128x #define __DECL_SIMD_pow #define __DECL_SIMD_powf #define __DECL_SIMD_powl #define __DECL_SIMD_powf16 #define __DECL_SIMD_powf32 #define __DECL_SIMD_powf64 #define __DECL_SIMD_powf128 #define __DECL_SIMD_powf32x #define __DECL_SIMD_powf64x #define __DECL_SIMD_powf128x #endif bits/link.h 0000644 00000010275 15063602063 0006621 0 ustar 00 /* Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINK_H # error "Never include <bits/link.h> directly; use <link.h> instead." #endif #ifndef __x86_64__ /* Registers for entry into PLT on IA-32. */ typedef struct La_i86_regs { uint32_t lr_edx; uint32_t lr_ecx; uint32_t lr_eax; uint32_t lr_ebp; uint32_t lr_esp; } La_i86_regs; /* Return values for calls from PLT on IA-32. */ typedef struct La_i86_retval { uint32_t lrv_eax; uint32_t lrv_edx; long double lrv_st0; long double lrv_st1; uint64_t lrv_bnd0; uint64_t lrv_bnd1; } La_i86_retval; __BEGIN_DECLS extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, La_i86_regs *__regs, unsigned int *__flags, const char *__symname, long int *__framesizep); extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, const La_i86_regs *__inregs, La_i86_retval *__outregs, const char *symname); __END_DECLS #else /* Registers for entry into PLT on x86-64. */ # if __GNUC_PREREQ (4,0) typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); typedef float La_x86_64_ymm __attribute__ ((__vector_size__ (32), __aligned__ (16))); typedef double La_x86_64_zmm __attribute__ ((__vector_size__ (64), __aligned__ (16))); # else typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__))); # endif typedef union { # if __GNUC_PREREQ (4,0) La_x86_64_ymm ymm[2]; La_x86_64_zmm zmm[1]; # endif La_x86_64_xmm xmm[4]; } La_x86_64_vector __attribute__ ((__aligned__ (16))); typedef struct La_x86_64_regs { uint64_t lr_rdx; uint64_t lr_r8; uint64_t lr_r9; uint64_t lr_rcx; uint64_t lr_rsi; uint64_t lr_rdi; uint64_t lr_rbp; uint64_t lr_rsp; La_x86_64_xmm lr_xmm[8]; La_x86_64_vector lr_vector[8]; #ifndef __ILP32__ __int128_t lr_bnd[4]; #endif } La_x86_64_regs; /* Return values for calls from PLT on x86-64. */ typedef struct La_x86_64_retval { uint64_t lrv_rax; uint64_t lrv_rdx; La_x86_64_xmm lrv_xmm0; La_x86_64_xmm lrv_xmm1; long double lrv_st0; long double lrv_st1; La_x86_64_vector lrv_vector0; La_x86_64_vector lrv_vector1; #ifndef __ILP32__ __int128_t lrv_bnd0; __int128_t lrv_bnd1; #endif } La_x86_64_retval; #define La_x32_regs La_x86_64_regs #define La_x32_retval La_x86_64_retval __BEGIN_DECLS extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, La_x86_64_regs *__regs, unsigned int *__flags, const char *__symname, long int *__framesizep); extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, const La_x86_64_regs *__inregs, La_x86_64_retval *__outregs, const char *__symname); extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, La_x32_regs *__regs, unsigned int *__flags, const char *__symname, long int *__framesizep); extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, const La_x32_regs *__inregs, La_x32_retval *__outregs, const char *__symname); __END_DECLS #endif bits/link_lavcurrent.h 0000644 00000002113 15063602063 0011056 0 ustar 00 /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. LAV_CURRENT definition. Copyright (C) 2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _LINK_H # error "Never include <bits/link_lavcurrent.h> directly; use <link.h> instead." #endif /* Version numbers for la_version handshake interface. */ #define LAV_CURRENT 2 bits/local_lim.h 0000644 00000006160 15063602063 0007615 0 ustar 00 /* Minimum guaranteed maximum values for system limits. Linux version. Copyright (C) 1993-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ /* The kernel header pollutes the namespace with the NR_OPEN symbol and defines LINK_MAX although filesystems have different maxima. A similar thing is true for OPEN_MAX: the limit can be changed at runtime and therefore the macro must not be defined. Remove this after including the header if necessary. */ #ifndef NR_OPEN # define __undef_NR_OPEN #endif #ifndef LINK_MAX # define __undef_LINK_MAX #endif #ifndef OPEN_MAX # define __undef_OPEN_MAX #endif #ifndef ARG_MAX # define __undef_ARG_MAX #endif /* The kernel sources contain a file with all the needed information. */ #include <linux/limits.h> /* Have to remove NR_OPEN? */ #ifdef __undef_NR_OPEN # undef NR_OPEN # undef __undef_NR_OPEN #endif /* Have to remove LINK_MAX? */ #ifdef __undef_LINK_MAX # undef LINK_MAX # undef __undef_LINK_MAX #endif /* Have to remove OPEN_MAX? */ #ifdef __undef_OPEN_MAX # undef OPEN_MAX # undef __undef_OPEN_MAX #endif /* Have to remove ARG_MAX? */ #ifdef __undef_ARG_MAX # undef ARG_MAX # undef __undef_ARG_MAX #endif /* The number of data keys per process. */ #define _POSIX_THREAD_KEYS_MAX 128 /* This is the value this implementation supports. */ #define PTHREAD_KEYS_MAX 1024 /* Controlling the iterations of destructors for thread-specific data. */ #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 /* Number of iterations this implementation does. */ #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS /* The number of threads per process. */ #define _POSIX_THREAD_THREADS_MAX 64 /* We have no predefined limit on the number of threads. */ #undef PTHREAD_THREADS_MAX /* Maximum amount by which a process can descrease its asynchronous I/O priority level. */ #define AIO_PRIO_DELTA_MAX 20 /* Minimum size for a thread. We are free to choose a reasonable value. */ #define PTHREAD_STACK_MIN 16384 /* Maximum number of timer expiration overruns. */ #define DELAYTIMER_MAX 2147483647 /* Maximum tty name length. */ #define TTY_NAME_MAX 32 /* Maximum login name length. This is arbitrary. */ #define LOGIN_NAME_MAX 256 /* Maximum host name length. */ #define HOST_NAME_MAX 64 /* Maximum message queue priority level. */ #define MQ_PRIO_MAX 32768 /* Maximum value the semaphore can have. */ #define SEM_VALUE_MAX (2147483647) bits/locale.h 0000644 00000002527 15063602063 0007124 0 ustar 00 /* Definition of locale category symbol values. Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _LOCALE_H && !defined _LANGINFO_H # error "Never use <bits/locale.h> directly; include <locale.h> instead." #endif #ifndef _BITS_LOCALE_H #define _BITS_LOCALE_H 1 #define __LC_CTYPE 0 #define __LC_NUMERIC 1 #define __LC_TIME 2 #define __LC_COLLATE 3 #define __LC_MONETARY 4 #define __LC_MESSAGES 5 #define __LC_ALL 6 #define __LC_PAPER 7 #define __LC_NAME 8 #define __LC_ADDRESS 9 #define __LC_TELEPHONE 10 #define __LC_MEASUREMENT 11 #define __LC_IDENTIFICATION 12 #endif /* bits/locale.h */ bits/long-double.h 0000644 00000001633 15063602063 0010071 0 ustar 00 /* Properties of long double type. ldbl-96 version. Copyright (C) 2016-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* long double is distinct from double, so there is nothing to define here. */ bits/math-finite.h 0000644 00000012376 15063602063 0010075 0 ustar 00 /* Entry points to finite-math-only compiler runs. Copyright (C) 2011-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/math-finite.h> directly; include <math.h> instead." #endif #define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__) #define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__) #define __MATH_REDIRCALL_X(from, args, to) \ extern _Mdouble_ __REDIRECT_NTH (from, args, to) #define __MATH_REDIRCALL(function, reentrant, args) \ __MATH_REDIRCALL_X \ (__REDIRFROM (function, reentrant), args, \ __REDIRTO (function, reentrant)) #define __MATH_REDIRCALL_2(from, reentrant, args, to) \ __MATH_REDIRCALL_X \ (__REDIRFROM (from, reentrant), args, \ __REDIRTO (to, reentrant)) #define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \ __MATH_REDIRCALL_X \ (__REDIRFROM (__CONCAT (__, function), \ __CONCAT (reentrant, _finite)), \ args, __REDIRTO (function, _r)) /* acos. */ __MATH_REDIRCALL (acos, , (_Mdouble_)); #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* acosh. */ __MATH_REDIRCALL (acosh, , (_Mdouble_)); #endif /* asin. */ __MATH_REDIRCALL (asin, , (_Mdouble_)); /* atan2. */ __MATH_REDIRCALL (atan2, , (_Mdouble_, _Mdouble_)); #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* atanh. */ __MATH_REDIRCALL (atanh, , (_Mdouble_)); #endif /* cosh. */ __MATH_REDIRCALL (cosh, , (_Mdouble_)); /* exp. */ __MATH_REDIRCALL (exp, , (_Mdouble_)); #if __GLIBC_USE (IEC_60559_FUNCS_EXT) /* exp10. */ __MATH_REDIRCALL (exp10, , (_Mdouble_)); #endif #ifdef __USE_ISOC99 /* exp2. */ __MATH_REDIRCALL (exp2, , (_Mdouble_)); #endif /* fmod. */ __MATH_REDIRCALL (fmod, , (_Mdouble_, _Mdouble_)); #if defined __USE_XOPEN || defined __USE_ISOC99 /* hypot. */ __MATH_REDIRCALL (hypot, , (_Mdouble_, _Mdouble_)); #endif #if (__MATH_DECLARING_DOUBLE && (defined __USE_MISC || defined __USE_XOPEN)) \ || (!__MATH_DECLARING_DOUBLE && defined __USE_MISC) /* j0. */ __MATH_REDIRCALL (j0, , (_Mdouble_)); /* y0. */ __MATH_REDIRCALL (y0, , (_Mdouble_)); /* j1. */ __MATH_REDIRCALL (j1, , (_Mdouble_)); /* y1. */ __MATH_REDIRCALL (y1, , (_Mdouble_)); /* jn. */ __MATH_REDIRCALL (jn, , (int, _Mdouble_)); /* yn. */ __MATH_REDIRCALL (yn, , (int, _Mdouble_)); #endif #ifdef __USE_MISC /* lgamma_r. */ __MATH_REDIRCALL (lgamma, _r, (_Mdouble_, int *)); #endif /* Redirect __lgammal_r_finite to __lgamma_r_finite when __NO_LONG_DOUBLE_MATH is set and to itself otherwise. It also redirects __lgamma_r_finite and __lgammaf_r_finite to themselves. */ __MATH_REDIRCALL_INTERNAL (lgamma, _r, (_Mdouble_, int *)); #if ((defined __USE_XOPEN || defined __USE_ISOC99) \ && defined __extern_always_inline) /* lgamma. */ __extern_always_inline _Mdouble_ __NTH (__REDIRFROM (lgamma, ) (_Mdouble_ __d)) { # if defined __USE_MISC || defined __USE_XOPEN return __REDIRTO (lgamma, _r) (__d, &signgam); # else int __local_signgam = 0; return __REDIRTO (lgamma, _r) (__d, &__local_signgam); # endif } #endif #if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \ && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN /* gamma. */ __extern_always_inline _Mdouble_ __NTH (__REDIRFROM (gamma, ) (_Mdouble_ __d)) { return __REDIRTO (lgamma, _r) (__d, &signgam); } #endif /* log. */ __MATH_REDIRCALL (log, , (_Mdouble_)); /* log10. */ __MATH_REDIRCALL (log10, , (_Mdouble_)); #ifdef __USE_ISOC99 /* log2. */ __MATH_REDIRCALL (log2, , (_Mdouble_)); #endif /* pow. */ __MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_)); #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* remainder. */ __MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_)); #endif #if ((__MATH_DECLARING_DOUBLE \ && (defined __USE_MISC \ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))) \ || (!defined __MATH_DECLARE_LDOUBLE && defined __USE_MISC)) \ && !__MATH_DECLARING_FLOATN /* scalb. */ __MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_)); #endif /* sinh. */ __MATH_REDIRCALL (sinh, , (_Mdouble_)); /* sqrt. */ __MATH_REDIRCALL (sqrt, , (_Mdouble_)); #if defined __USE_ISOC99 && defined __extern_always_inline /* tgamma. */ extern _Mdouble_ __REDIRFROM (__gamma, _r_finite) (_Mdouble_, int *); __extern_always_inline _Mdouble_ __NTH (__REDIRFROM (tgamma, ) (_Mdouble_ __d)) { int __local_signgam = 0; _Mdouble_ __res = __REDIRTO (gamma, _r) (__d, &__local_signgam); return __local_signgam < 0 ? -__res : __res; } #endif #undef __REDIRFROM #undef __REDIRTO #undef __MATH_REDIRCALL #undef __MATH_REDIRCALL_2 #undef __MATH_REDIRCALL_INTERNAL #undef __MATH_REDIRCALL_X bits/math-vector.h 0000644 00000004403 15063602063 0010111 0 ustar 00 /* Platform-specific SIMD declarations of math functions. Copyright (C) 2014-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never include <bits/math-vector.h> directly;\ include <math.h> instead." #endif /* Get default empty definitions for simd declarations. */ #include <bits/libm-simd-decl-stubs.h> #if defined __x86_64__ && defined __FAST_MATH__ # if defined _OPENMP && _OPENMP >= 201307 /* OpenMP case. */ # define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch") # elif __GNUC_PREREQ (6,0) /* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */ # define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch"))) # endif # ifdef __DECL_SIMD_x86_64 # undef __DECL_SIMD_cos # define __DECL_SIMD_cos __DECL_SIMD_x86_64 # undef __DECL_SIMD_cosf # define __DECL_SIMD_cosf __DECL_SIMD_x86_64 # undef __DECL_SIMD_sin # define __DECL_SIMD_sin __DECL_SIMD_x86_64 # undef __DECL_SIMD_sinf # define __DECL_SIMD_sinf __DECL_SIMD_x86_64 # undef __DECL_SIMD_sincos # define __DECL_SIMD_sincos __DECL_SIMD_x86_64 # undef __DECL_SIMD_sincosf # define __DECL_SIMD_sincosf __DECL_SIMD_x86_64 # undef __DECL_SIMD_log # define __DECL_SIMD_log __DECL_SIMD_x86_64 # undef __DECL_SIMD_logf # define __DECL_SIMD_logf __DECL_SIMD_x86_64 # undef __DECL_SIMD_exp # define __DECL_SIMD_exp __DECL_SIMD_x86_64 # undef __DECL_SIMD_expf # define __DECL_SIMD_expf __DECL_SIMD_x86_64 # undef __DECL_SIMD_pow # define __DECL_SIMD_pow __DECL_SIMD_x86_64 # undef __DECL_SIMD_powf # define __DECL_SIMD_powf __DECL_SIMD_x86_64 # endif #endif bits/mathcalls-helper-functions.h 0000644 00000003344 15063602063 0013116 0 ustar 00 /* Prototype declarations for math classification macros helpers. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Classify given number. */ __MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Test for negative number. */ __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ __MATHDECL_1 (int, __isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Return nonzero if VALUE is finite and not NaN. Used by isfinite macro. */ __MATHDECL_1 (int, __finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Return nonzero if VALUE is not a number. */ __MATHDECL_1 (int, __isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Test equality. */ __MATHDECL_1 (int, __iseqsig,, (_Mdouble_ __x, _Mdouble_ __y)); /* Test for signaling NaN. */ __MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value)) __attribute__ ((__const__)); bits/mathcalls-narrow.h 0000644 00000002432 15063602063 0011136 0 ustar 00 /* Declare functions returning a narrower type. Copyright (C) 2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never include <bits/mathcalls-narrow.h> directly; include <math.h> instead." #endif /* Add. */ __MATHCALL_NARROW (__MATHCALL_NAME (add), __MATHCALL_REDIR_NAME (add), 2); /* Divide. */ __MATHCALL_NARROW (__MATHCALL_NAME (div), __MATHCALL_REDIR_NAME (div), 2); /* Multiply. */ __MATHCALL_NARROW (__MATHCALL_NAME (mul), __MATHCALL_REDIR_NAME (mul), 2); /* Subtract. */ __MATHCALL_NARROW (__MATHCALL_NAME (sub), __MATHCALL_REDIR_NAME (sub), 2); bits/mathcalls.h 0000644 00000031454 15063602063 0007636 0 ustar 00 /* Prototype declarations for math functions; helper file for <math.h>. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* NOTE: Because of the special way this file is used by <math.h>, this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME,[_r], (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME,[_r], (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. Note that there must be no whitespace before the argument passed for NAME, to make token pasting work with -traditional. */ #ifndef _MATH_H # error "Never include <bits/mathcalls.h> directly; include <math.h> instead." #endif /* Trigonometric functions. */ /* Arc cosine of X. */ __MATHCALL (acos,, (_Mdouble_ __x)); /* Arc sine of X. */ __MATHCALL (asin,, (_Mdouble_ __x)); /* Arc tangent of X. */ __MATHCALL (atan,, (_Mdouble_ __x)); /* Arc tangent of Y/X. */ __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); /* Cosine of X. */ __MATHCALL_VEC (cos,, (_Mdouble_ __x)); /* Sine of X. */ __MATHCALL_VEC (sin,, (_Mdouble_ __x)); /* Tangent of X. */ __MATHCALL (tan,, (_Mdouble_ __x)); /* Hyperbolic functions. */ /* Hyperbolic cosine of X. */ __MATHCALL (cosh,, (_Mdouble_ __x)); /* Hyperbolic sine of X. */ __MATHCALL (sinh,, (_Mdouble_ __x)); /* Hyperbolic tangent of X. */ __MATHCALL (tanh,, (_Mdouble_ __x)); #ifdef __USE_GNU /* Cosine and sine of X. */ __MATHDECL_VEC (void,sincos,, (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* Hyperbolic arc cosine of X. */ __MATHCALL (acosh,, (_Mdouble_ __x)); /* Hyperbolic arc sine of X. */ __MATHCALL (asinh,, (_Mdouble_ __x)); /* Hyperbolic arc tangent of X. */ __MATHCALL (atanh,, (_Mdouble_ __x)); #endif /* Exponential and logarithmic functions. */ /* Exponential function of X. */ __MATHCALL_VEC (exp,, (_Mdouble_ __x)); /* Break VALUE into a normalized fraction and an integral power of 2. */ __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); /* X times (two to the EXP power). */ __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); /* Natural logarithm of X. */ __MATHCALL_VEC (log,, (_Mdouble_ __x)); /* Base-ten logarithm of X. */ __MATHCALL (log10,, (_Mdouble_ __x)); /* Break VALUE into integral and fractional parts. */ __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2)); #if __GLIBC_USE (IEC_60559_FUNCS_EXT) /* Compute exponent to base ten. */ __MATHCALL (exp10,, (_Mdouble_ __x)); #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* Return exp(X) - 1. */ __MATHCALL (expm1,, (_Mdouble_ __x)); /* Return log(1 + X). */ __MATHCALL (log1p,, (_Mdouble_ __x)); /* Return the base 2 signed integral exponent of X. */ __MATHCALL (logb,, (_Mdouble_ __x)); #endif #ifdef __USE_ISOC99 /* Compute base-2 exponential of X. */ __MATHCALL (exp2,, (_Mdouble_ __x)); /* Compute base-2 logarithm of X. */ __MATHCALL (log2,, (_Mdouble_ __x)); #endif /* Power functions. */ /* Return X to the Y power. */ __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); /* Return the square root of X. */ __MATHCALL (sqrt,, (_Mdouble_ __x)); #if defined __USE_XOPEN || defined __USE_ISOC99 /* Return `sqrt(X*X + Y*Y)'. */ __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* Return the cube root of X. */ __MATHCALL (cbrt,, (_Mdouble_ __x)); #endif /* Nearest integer, absolute value, and remainder functions. */ /* Smallest integral value not less than X. */ __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); /* Absolute value of X. */ __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); /* Largest integer not greater than X. */ __MATHCALLX (floor,, (_Mdouble_ __x), (__const__)); /* Floating-point modulo remainder of X/Y. */ __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); #ifdef __USE_MISC # if ((!defined __cplusplus \ || __cplusplus < 201103L /* isinf conflicts with C++11. */ \ || __MATH_DECLARING_DOUBLE == 0)) /* isinff or isinfl don't. */ \ && !__MATH_DECLARING_FLOATN /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); # endif # if !__MATH_DECLARING_FLOATN /* Return nonzero if VALUE is finite and not NaN. */ __MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); /* Return the remainder of X/Y. */ __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); /* Return the fractional part of X after dividing out `ilogb (X)'. */ __MATHCALL (significand,, (_Mdouble_ __x)); # endif #endif /* Use misc. */ #ifdef __USE_ISOC99 /* Return X with its signed changed to Y's. */ __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); #endif #ifdef __USE_ISOC99 /* Return representation of qNaN for double type. */ __MATHCALL (nan,, (const char *__tagb)); #endif #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) # if ((!defined __cplusplus \ || __cplusplus < 201103L /* isnan conflicts with C++11. */ \ || __MATH_DECLARING_DOUBLE == 0)) /* isnanf or isnanl don't. */ \ && !__MATH_DECLARING_FLOATN /* Return nonzero if VALUE is not a number. */ __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); # endif #endif #if defined __USE_MISC || (defined __USE_XOPEN && __MATH_DECLARING_DOUBLE) /* Bessel functions. */ __MATHCALL (j0,, (_Mdouble_)); __MATHCALL (j1,, (_Mdouble_)); __MATHCALL (jn,, (int, _Mdouble_)); __MATHCALL (y0,, (_Mdouble_)); __MATHCALL (y1,, (_Mdouble_)); __MATHCALL (yn,, (int, _Mdouble_)); #endif #if defined __USE_XOPEN || defined __USE_ISOC99 /* Error and gamma functions. */ __MATHCALL (erf,, (_Mdouble_)); __MATHCALL (erfc,, (_Mdouble_)); __MATHCALL (lgamma,, (_Mdouble_)); #endif #ifdef __USE_ISOC99 /* True gamma function. */ __MATHCALL (tgamma,, (_Mdouble_)); #endif #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) # if !__MATH_DECLARING_FLOATN /* Obsolete alias for `lgamma'. */ __MATHCALL (gamma,, (_Mdouble_)); # endif #endif #ifdef __USE_MISC /* Reentrant version of lgamma. This function uses the global variable `signgam'. The reentrant version instead takes a pointer and stores the value through it. */ __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 /* Return the integer nearest X in the direction of the prevailing rounding mode. */ __MATHCALL (rint,, (_Mdouble_ __x)); /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ __MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y)); # if defined __USE_ISOC99 && !defined __LDBL_COMPAT && !__MATH_DECLARING_FLOATN __MATHCALL (nexttoward,, (_Mdouble_ __x, long double __y)); # endif # if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN /* Return X - epsilon. */ __MATHCALL (nextdown,, (_Mdouble_ __x)); /* Return X + epsilon. */ __MATHCALL (nextup,, (_Mdouble_ __x)); # endif /* Return the remainder of integer divison X / Y with infinite precision. */ __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); # ifdef __USE_ISOC99 /* Return X times (2 to the Nth power). */ __MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); # endif /* Return the binary exponent of X, which must be nonzero. */ __MATHDECL (int,ilogb,, (_Mdouble_ __x)); #endif #if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN /* Like ilogb, but returning long int. */ __MATHDECL (long int, llogb,, (_Mdouble_ __x)); #endif #ifdef __USE_ISOC99 /* Return X times (2 to the Nth power). */ __MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); /* Round X to integral value in floating-point format using current rounding direction, but do not raise inexact exception. */ __MATHCALL (nearbyint,, (_Mdouble_ __x)); /* Round X to nearest integral value, rounding halfway cases away from zero. */ __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); /* Round X to the integral value in floating-point format nearest but not larger in magnitude. */ __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); /* Compute remainder of X and Y and put in *QUO a value with sign of x/y and magnitude congruent `mod 2^n' to the magnitude of the integral quotient x/y, with n >= 3. */ __MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); /* Conversion functions. */ /* Round X to nearest integral value according to current rounding direction. */ __MATHDECL (long int,lrint,, (_Mdouble_ __x)); __extension__ __MATHDECL (long long int,llrint,, (_Mdouble_ __x)); /* Round X to nearest integral value, rounding halfway cases away from zero. */ __MATHDECL (long int,lround,, (_Mdouble_ __x)); __extension__ __MATHDECL (long long int,llround,, (_Mdouble_ __x)); /* Return positive difference between X and Y. */ __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); /* Return maximum numeric value from X and Y. */ __MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Return minimum numeric value from X and Y. */ __MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Multiply-add function computed as a ternary operation. */ __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); #endif /* Use ISO C99. */ #if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN /* Round X to nearest integer value, rounding halfway cases to even. */ __MATHCALLX (roundeven,, (_Mdouble_ __x), (__const__)); /* Round X to nearest signed integer value, not raising inexact, with control of rounding direction and width of result. */ __MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round, unsigned int __width)); /* Round X to nearest unsigned integer value, not raising inexact, with control of rounding direction and width of result. */ __MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round, unsigned int __width)); /* Round X to nearest signed integer value, raising inexact for non-integers, with control of rounding direction and width of result. */ __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round, unsigned int __width)); /* Round X to nearest unsigned integer value, raising inexact for non-integers, with control of rounding direction and width of result. */ __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round, unsigned int __width)); /* Return value with maximum magnitude. */ __MATHCALLX (fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Return value with minimum magnitude. */ __MATHCALLX (fminmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Total order operation. */ __MATHDECL_1 (int, totalorder,, (_Mdouble_ __x, _Mdouble_ __y)) __attribute__ ((__const__)); /* Total order operation on absolute values. */ __MATHDECL_1 (int, totalordermag,, (_Mdouble_ __x, _Mdouble_ __y)) __attribute__ ((__const__)); /* Canonicalize floating-point representation. */ __MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x)); /* Get NaN payload. */ __MATHCALL (getpayload,, (const _Mdouble_ *__x)); /* Set quiet NaN payload. */ __MATHDECL_1 (int, setpayload,, (_Mdouble_ *__x, _Mdouble_ __payload)); /* Set signaling NaN payload. */ __MATHDECL_1 (int, setpayloadsig,, (_Mdouble_ *__x, _Mdouble_ __payload)); #endif #if (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ && __MATH_DECLARING_DOUBLE \ && !defined __USE_XOPEN2K8)) \ && !__MATH_DECLARING_FLOATN /* Return X times (2 to the Nth power). */ __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); #endif bits/mathdef.h 0000644 00000001572 15063602063 0007274 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _COMPLEX_H # error "Never use <bits/mathdef.h> directly; include <complex.h> instead" #endif bits/mathinline.h 0000644 00000031327 15063602063 0010015 0 ustar 00 /* Inline math functions for i387 and SSE. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/mathinline.h> directly; include <math.h> instead." #endif #ifndef __extern_always_inline # define __MATH_INLINE __inline #else # define __MATH_INLINE __extern_always_inline #endif /* Disable x87 inlines when -fpmath=sse is passed and also when we're building on x86_64. Older gcc (gcc-3.2 for example) does not define __SSE2_MATH__ for x86_64. */ #if !defined __SSE2_MATH__ && !defined __x86_64__ # if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ && defined __OPTIMIZE__) /* The inline functions do not set errno or raise necessarily the correct exceptions. */ # undef math_errhandling /* A macro to define float, double, and long double versions of various math functions for the ix87 FPU. FUNC is the function name (which will be suffixed with f and l for the float and long double version, respectively). OP is the name of the FPU operation. We define two sets of macros. The set with the additional NP doesn't add a prototype declaration. */ # ifdef __USE_ISOC99 # define __inline_mathop(func, op) \ __inline_mathop_ (double, func, op) \ __inline_mathop_ (float, __CONCAT(func,f), op) \ __inline_mathop_ (long double, __CONCAT(func,l), op) # define __inline_mathopNP(func, op) \ __inline_mathopNP_ (double, func, op) \ __inline_mathopNP_ (float, __CONCAT(func,f), op) \ __inline_mathopNP_ (long double, __CONCAT(func,l), op) # else # define __inline_mathop(func, op) \ __inline_mathop_ (double, func, op) # define __inline_mathopNP(func, op) \ __inline_mathopNP_ (double, func, op) # endif # define __inline_mathop_(float_type, func, op) \ __inline_mathop_decl_ (float_type, func, op, "0" (__x)) # define __inline_mathopNP_(float_type, func, op) \ __inline_mathop_declNP_ (float_type, func, op, "0" (__x)) # ifdef __USE_ISOC99 # define __inline_mathop_decl(func, op, params...) \ __inline_mathop_decl_ (double, func, op, params) \ __inline_mathop_decl_ (float, __CONCAT(func,f), op, params) \ __inline_mathop_decl_ (long double, __CONCAT(func,l), op, params) # define __inline_mathop_declNP(func, op, params...) \ __inline_mathop_declNP_ (double, func, op, params) \ __inline_mathop_declNP_ (float, __CONCAT(func,f), op, params) \ __inline_mathop_declNP_ (long double, __CONCAT(func,l), op, params) # else # define __inline_mathop_decl(func, op, params...) \ __inline_mathop_decl_ (double, func, op, params) # define __inline_mathop_declNP(func, op, params...) \ __inline_mathop_declNP_ (double, func, op, params) # endif # define __inline_mathop_decl_(float_type, func, op, params...) \ __MATH_INLINE float_type func (float_type) __THROW; \ __inline_mathop_declNP_ (float_type, func, op, params) # define __inline_mathop_declNP_(float_type, func, op, params...) \ __MATH_INLINE float_type __NTH (func (float_type __x)) \ { \ register float_type __result; \ __asm __volatile__ (op : "=t" (__result) : params); \ return __result; \ } # ifdef __USE_ISOC99 # define __inline_mathcode(func, arg, code) \ __inline_mathcode_ (double, func, arg, code) \ __inline_mathcode_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcode_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcodeNP(func, arg, code) \ __inline_mathcodeNP_ (double, func, arg, code) \ __inline_mathcodeNP_ (float, __CONCAT(func,f), arg, code) \ __inline_mathcodeNP_ (long double, __CONCAT(func,l), arg, code) # define __inline_mathcode2(func, arg1, arg2, code) \ __inline_mathcode2_ (double, func, arg1, arg2, code) \ __inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcodeNP2(func, arg1, arg2, code) \ __inline_mathcodeNP2_ (double, func, arg1, arg2, code) \ __inline_mathcodeNP2_ (float, __CONCAT(func,f), arg1, arg2, code) \ __inline_mathcodeNP2_ (long double, __CONCAT(func,l), arg1, arg2, code) # define __inline_mathcode3(func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ __inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) # define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code) # else # define __inline_mathcode(func, arg, code) \ __inline_mathcode_ (double, func, (arg), code) # define __inline_mathcodeNP(func, arg, code) \ __inline_mathcodeNP_ (double, func, (arg), code) # define __inline_mathcode2(func, arg1, arg2, code) \ __inline_mathcode2_ (double, func, arg1, arg2, code) # define __inline_mathcodeNP2(func, arg1, arg2, code) \ __inline_mathcodeNP2_ (double, func, arg1, arg2, code) # define __inline_mathcode3(func, arg1, arg2, arg3, code) \ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code) # define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \ __inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) # endif # define __inline_mathcode_(float_type, func, arg, code) \ __MATH_INLINE float_type func (float_type) __THROW; \ __inline_mathcodeNP_(float_type, func, arg, code) # define __inline_mathcodeNP_(float_type, func, arg, code) \ __MATH_INLINE float_type __NTH (func (float_type arg)) \ { \ code; \ } # define __inline_mathcode2_(float_type, func, arg1, arg2, code) \ __MATH_INLINE float_type func (float_type, float_type) __THROW; \ __inline_mathcodeNP2_ (float_type, func, arg1, arg2, code) # define __inline_mathcodeNP2_(float_type, func, arg1, arg2, code) \ __MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2)) \ { \ code; \ } # define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \ __MATH_INLINE float_type func (float_type, float_type, float_type) __THROW; \ __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) # define __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) \ __MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2, \ float_type arg3)) \ { \ code; \ } # endif # if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ /* Miscellaneous functions */ /* __FAST_MATH__ is defined by gcc -ffast-math. */ # ifdef __FAST_MATH__ /* Optimized inline implementation, sometimes with reduced precision and/or argument range. */ # if __GNUC_PREREQ (3, 5) # define __expm1_code \ register long double __temp; \ __temp = __builtin_expm1l (__x); \ return __temp ? __temp : __x # else # define __expm1_code \ register long double __value; \ register long double __exponent; \ register long double __temp; \ __asm __volatile__ \ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" \ "fmul %%st(1) # x * log2(e)\n\t" \ "fst %%st(1)\n\t" \ "frndint # int(x * log2(e))\n\t" \ "fxch\n\t" \ "fsub %%st(1) # fract(x * log2(e))\n\t" \ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \ "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" \ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \ __asm __volatile__ \ ("fscale # 2^int(x * log2(e))\n\t" \ : "=t" (__temp) : "0" (1.0), "u" (__exponent)); \ __temp -= 1.0; \ __temp += __value; \ return __temp ? __temp : __x # endif __inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code) # if __GNUC_PREREQ (3, 4) __inline_mathcodeNP_ (long double, __expl, __x, return __builtin_expl (__x)) # else # define __exp_code \ register long double __value; \ register long double __exponent; \ __asm __volatile__ \ ("fldl2e # e^x = 2^(x * log2(e))\n\t" \ "fmul %%st(1) # x * log2(e)\n\t" \ "fst %%st(1)\n\t" \ "frndint # int(x * log2(e))\n\t" \ "fxch\n\t" \ "fsub %%st(1) # fract(x * log2(e))\n\t" \ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \ __value += 1.0; \ __asm __volatile__ \ ("fscale" \ : "=t" (__value) : "0" (__value), "u" (__exponent)); \ return __value __inline_mathcodeNP (exp, __x, __exp_code) __inline_mathcodeNP_ (long double, __expl, __x, __exp_code) # endif # endif /* __FAST_MATH__ */ # ifdef __FAST_MATH__ # if !__GNUC_PREREQ (3,3) __inline_mathopNP (sqrt, "fsqrt") __inline_mathopNP_ (long double, __sqrtl, "fsqrt") # define __libc_sqrtl(n) __sqrtl (n) # else # define __libc_sqrtl(n) __builtin_sqrtl (n) # endif # endif # if __GNUC_PREREQ (2, 8) __inline_mathcodeNP_ (double, fabs, __x, return __builtin_fabs (__x)) # ifdef __USE_ISOC99 __inline_mathcodeNP_ (float, fabsf, __x, return __builtin_fabsf (__x)) __inline_mathcodeNP_ (long double, fabsl, __x, return __builtin_fabsl (__x)) # endif __inline_mathcodeNP_ (long double, __fabsl, __x, return __builtin_fabsl (__x)) # else __inline_mathop (fabs, "fabs") __inline_mathop_ (long double, __fabsl, "fabs") # endif __inline_mathcode_ (long double, __sgn1l, __x, \ __extension__ union { long double __xld; unsigned int __xi[3]; } __n = \ { __xld: __x }; \ __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; \ __n.__xi[1] = 0x80000000; \ __n.__xi[0] = 0; \ return __n.__xld) # ifdef __FAST_MATH__ /* The argument range of the inline version of sinhl is slightly reduced. */ __inline_mathcodeNP (sinh, __x, \ register long double __exm1 = __expm1l (__fabsl (__x)); \ return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x)) __inline_mathcodeNP (cosh, __x, \ register long double __ex = __expl (__x); \ return 0.5 * (__ex + 1.0 / __ex)) __inline_mathcodeNP (tanh, __x, \ register long double __exm1 = __expm1l (-__fabsl (__x + __x)); \ return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x)) # endif /* Optimized versions for some non-standardized functions. */ # ifdef __USE_ISOC99 # ifdef __FAST_MATH__ __inline_mathcodeNP (expm1, __x, __expm1_code) /* The argument range of the inline version of asinhl is slightly reduced. */ __inline_mathcodeNP (asinh, __x, \ register long double __y = __fabsl (__x); \ return (log1pl (__y * __y / (__libc_sqrtl (__y * __y + 1.0) + 1.0) + __y) \ * __sgn1l (__x))) __inline_mathcodeNP (acosh, __x, \ return logl (__x + __libc_sqrtl (__x - 1.0) * __libc_sqrtl (__x + 1.0))) __inline_mathcodeNP (atanh, __x, \ register long double __y = __fabsl (__x); \ return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x)) /* The argument range of the inline version of hypotl is slightly reduced. */ __inline_mathcodeNP2 (hypot, __x, __y, return __libc_sqrtl (__x * __x + __y * __y)) # endif # endif /* Undefine some of the large macros which are not used anymore. */ # ifdef __FAST_MATH__ # undef __expm1_code # undef __exp_code # endif /* __FAST_MATH__ */ # endif /* __NO_MATH_INLINES */ /* This code is used internally in the GNU libc. */ # ifdef __LIBC_INTERNAL_MATH_INLINES __inline_mathcode2_ (long double, __ieee754_atan2l, __y, __x, register long double __value; __asm __volatile__ ("fpatan\n\t" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value;) # endif #endif /* !__SSE2_MATH__ && !__x86_64__ */ bits/mman-linux.h 0000644 00000011437 15063602063 0007752 0 ustar 00 /* Definitions for POSIX memory map interface. Linux generic version. Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MMAN_H # error "Never use <bits/mman-linux.h> directly; include <sys/mman.h> instead." #endif /* The following definitions basically come from the kernel headers. But the kernel header is not namespace clean. */ /* Protections are chosen from these bits, OR'd together. The implementation does not necessarily support PROT_EXEC or PROT_WRITE without PROT_READ. The only guarantees are that no writing will be allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ #define PROT_READ 0x1 /* Page can be read. */ #define PROT_WRITE 0x2 /* Page can be written. */ #define PROT_EXEC 0x4 /* Page can be executed. */ #define PROT_NONE 0x0 /* Page can not be accessed. */ #define PROT_GROWSDOWN 0x01000000 /* Extend change to start of growsdown vma (mprotect only). */ #define PROT_GROWSUP 0x02000000 /* Extend change to start of growsup vma (mprotect only). */ /* Sharing types (must choose one and only one of these). */ #define MAP_SHARED 0x01 /* Share changes. */ #define MAP_PRIVATE 0x02 /* Changes are private. */ #ifdef __USE_MISC # define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate extension flags. */ # define MAP_TYPE 0x0f /* Mask for type of mapping. */ #endif /* Other flags. */ #define MAP_FIXED 0x10 /* Interpret addr exactly. */ #ifdef __USE_MISC # define MAP_FILE 0 # ifdef __MAP_ANONYMOUS # define MAP_ANONYMOUS __MAP_ANONYMOUS /* Don't use a file. */ # else # define MAP_ANONYMOUS 0x20 /* Don't use a file. */ # endif # define MAP_ANON MAP_ANONYMOUS /* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */ # define MAP_HUGE_SHIFT 26 # define MAP_HUGE_MASK 0x3f #endif /* Flags to `msync'. */ #define MS_ASYNC 1 /* Sync memory asynchronously. */ #define MS_SYNC 4 /* Synchronous memory sync. */ #define MS_INVALIDATE 2 /* Invalidate the caches. */ /* Flags for `mremap'. */ #ifdef __USE_GNU # define MREMAP_MAYMOVE 1 # define MREMAP_FIXED 2 #endif /* Advice to `madvise'. */ #ifdef __USE_MISC # define MADV_NORMAL 0 /* No further special treatment. */ # define MADV_RANDOM 1 /* Expect random page references. */ # define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define MADV_WILLNEED 3 /* Will need these pages. */ # define MADV_DONTNEED 4 /* Don't need these pages. */ # define MADV_FREE 8 /* Free pages only if memory pressure. */ # define MADV_REMOVE 9 /* Remove these pages and resources. */ # define MADV_DONTFORK 10 /* Do not inherit across fork. */ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ # define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ # define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, overrides the coredump filter bits. */ # define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */ # define MADV_WIPEONFORK 18 /* Zero memory on fork, child only. */ # define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif /* The POSIX people had to invent similar names for the same things. */ #ifdef __USE_XOPEN2K # define POSIX_MADV_NORMAL 0 /* No further special treatment. */ # define POSIX_MADV_RANDOM 1 /* Expect random page references. */ # define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ # define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ # define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ #endif /* Flags for `mlockall'. */ #ifndef MCL_CURRENT # define MCL_CURRENT 1 /* Lock all currently mapped pages. */ # define MCL_FUTURE 2 /* Lock all additions to address space. */ # define MCL_ONFAULT 4 /* Lock all pages that are faulted in. */ #endif #include <bits/mman-shared.h> bits/mman-shared.h 0000644 00000005260 15063602063 0010056 0 ustar 00 /* Memory-mapping-related declarations/definitions, not architecture-specific. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MMAN_H # error "Never use <bits/mman-shared.h> directly; include <sys/mman.h> instead." #endif #ifdef __USE_GNU /* Flags for memfd_create. */ # ifndef MFD_CLOEXEC # define MFD_CLOEXEC 1U # define MFD_ALLOW_SEALING 2U # define MFD_HUGETLB 4U # endif /* Flags for mlock2. */ # ifndef MLOCK_ONFAULT # define MLOCK_ONFAULT 1U # endif /* Access rights for pkey_alloc. */ # ifndef PKEY_DISABLE_ACCESS # define PKEY_DISABLE_ACCESS 0x1 # define PKEY_DISABLE_WRITE 0x2 # endif __BEGIN_DECLS /* Create a new memory file descriptor. NAME is a name for debugging. FLAGS is a combination of the MFD_* constants. */ int memfd_create (const char *__name, unsigned int __flags) __THROW; /* Lock pages from ADDR (inclusive) to ADDR + LENGTH (exclusive) into memory. FLAGS is a combination of the MLOCK_* flags above. */ int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW; /* Allocate a new protection key, with the PKEY_DISABLE_* bits specified in ACCESS_RIGHTS. The protection key mask for the current thread is updated to match the access privilege for the new key. */ int pkey_alloc (unsigned int __flags, unsigned int __access_rights) __THROW; /* Update the access rights for the current thread for KEY, which must have been allocated using pkey_alloc. */ int pkey_set (int __key, unsigned int __access_rights) __THROW; /* Return the access rights for the current thread for KEY, which must have been allocated using pkey_alloc. */ int pkey_get (int __key) __THROW; /* Free an allocated protection key, which must have been allocated using pkey_alloc. */ int pkey_free (int __key) __THROW; /* Apply memory protection flags for KEY to the specified address range. */ int pkey_mprotect (void *__addr, size_t __len, int __prot, int __pkey) __THROW; __END_DECLS #endif /* __USE_GNU */ bits/mman.h 0000644 00000004017 15063602063 0006611 0 ustar 00 /* Definitions for POSIX memory map interface. Linux/x86_64 version. Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MMAN_H # error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." #endif /* The following definitions basically come from the kernel headers. But the kernel header is not namespace clean. */ /* Other flags. */ #ifdef __USE_MISC # define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */ #endif /* These are Linux-specific. */ #ifdef __USE_MISC # define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ # define MAP_DENYWRITE 0x00800 /* ETXTBSY */ # define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ # define MAP_LOCKED 0x02000 /* Lock the mapping. */ # define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ # define MAP_STACK 0x20000 /* Allocation is for a stack. */ # define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ # define MAP_SYNC 0x80000 /* Perform synchronous page faults for the mapping. */ # define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap underlying mapping. */ #endif /* Include generic Linux declarations. */ #include <bits/mman-linux.h> bits/monetary-ldbl.h 0000644 00000002026 15063602063 0010430 0 ustar 00 /* -mlong-double-64 compatibility mode for monetary functions. Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MONETARY_H # error "Never include <bits/monetary-ldbl.h> directly; use <monetary.h> instead." #endif __LDBL_REDIR_DECL (strfmon) #ifdef __USE_GNU __LDBL_REDIR_DECL (strfmon_l) #endif bits/mqueue.h 0000644 00000002335 15063602063 0007163 0 ustar 00 /* Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MQUEUE_H # error "Never use <bits/mqueue.h> directly; include <mqueue.h> instead." #endif #include <bits/types.h> typedef int mqd_t; struct mq_attr { __syscall_slong_t mq_flags; /* Message queue flags. */ __syscall_slong_t mq_maxmsg; /* Maximum number of messages. */ __syscall_slong_t mq_msgsize; /* Maximum message size. */ __syscall_slong_t mq_curmsgs; /* Number of messages currently queued. */ __syscall_slong_t __pad[4]; }; bits/mqueue2.h 0000644 00000004146 15063602063 0007247 0 ustar 00 /* Checking macros for mq functions. Copyright (C) 2007-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never include <bits/mqueue2.h> directly; use <mqueue.h> instead." #endif /* Check that calls to mq_open with O_CREAT set have an appropriate third and fourth parameter. */ extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW __nonnull ((1)); extern mqd_t __mq_open_2 (const char *__name, int __oflag) __THROW __nonnull ((1)); extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name, int __oflag, ...), mq_open) __nonnull ((1)); __errordecl (__mq_open_wrong_number_of_args, "mq_open can be called either with 2 or 4 arguments"); __errordecl (__mq_open_missing_mode_and_attr, "mq_open with O_CREAT in second argument needs 4 arguments"); __fortify_function mqd_t __NTH (mq_open (const char *__name, int __oflag, ...)) { if (__va_arg_pack_len () != 0 && __va_arg_pack_len () != 2) __mq_open_wrong_number_of_args (); if (__builtin_constant_p (__oflag)) { if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () == 0) { __mq_open_missing_mode_and_attr (); return __mq_open_2 (__name, __oflag); } return __mq_open_alias (__name, __oflag, __va_arg_pack ()); } if (__va_arg_pack_len () == 0) return __mq_open_2 (__name, __oflag); return __mq_open_alias (__name, __oflag, __va_arg_pack ()); } bits/msq.h 0000644 00000005115 15063602063 0006461 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_MSG_H # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." #endif #include <bits/types.h> /* Define options for message queue functions. */ #define MSG_NOERROR 010000 /* no error if message is too big */ #ifdef __USE_GNU # define MSG_EXCEPT 020000 /* recv any msg except of specified type */ # define MSG_COPY 040000 /* copy (not remove) all queue messages */ #endif /* Types used in the structure definition. */ typedef __syscall_ulong_t msgqnum_t; typedef __syscall_ulong_t msglen_t; /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { struct ipc_perm msg_perm; /* structure describing operation permission */ __time_t msg_stime; /* time of last msgsnd command */ #ifndef __x86_64__ unsigned long int __glibc_reserved1; #endif __time_t msg_rtime; /* time of last msgrcv command */ #ifndef __x86_64__ unsigned long int __glibc_reserved2; #endif __time_t msg_ctime; /* time of last change */ #ifndef __x86_64__ unsigned long int __glibc_reserved3; #endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ __pid_t msg_lspid; /* pid of last msgsnd() */ __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; }; #ifdef __USE_MISC # define msg_cbytes __msg_cbytes /* ipcs ctl commands */ # define MSG_STAT 11 # define MSG_INFO 12 # define MSG_STAT_ANY 13 /* buffer for msgctl calls IPC_INFO, MSG_INFO */ struct msginfo { int msgpool; int msgmap; int msgmax; int msgmnb; int msgmni; int msgssz; int msgtql; unsigned short int msgseg; }; #endif /* __USE_MISC */ bits/netdb.h 0000644 00000002357 15063602063 0006762 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NETDB_H # error "Never include <bits/netdb.h> directly; use <netdb.h> instead." #endif /* Description of data base entry for a single network. NOTE: here a poor assumption is made. The network number is expected to fit into an unsigned long int variable. */ struct netent { char *n_name; /* Official name of network. */ char **n_aliases; /* Alias list. */ int n_addrtype; /* Net address type. */ uint32_t n_net; /* Network number. */ }; bits/param.h 0000644 00000002630 15063602063 0006760 0 ustar 00 /* Old-style Unix parameters and limits. Linux version. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PARAM_H # error "Never use <bits/param.h> directly; include <sys/param.h> instead." #endif #ifndef ARG_MAX # define __undef_ARG_MAX #endif #include <linux/limits.h> #include <linux/param.h> /* The kernel headers define ARG_MAX. The value is wrong, though. */ #ifdef __undef_ARG_MAX # undef ARG_MAX # undef __undef_ARG_MAX #endif #define MAXSYMLINKS 20 /* The following are not really correct but it is a value we used for a long time and which seems to be usable. People should not use NOFILE and NCARGS anyway. */ #define NOFILE 256 #define NCARGS 131072 bits/poll.h 0000644 00000004033 15063602063 0006625 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." #endif /* Event types that can be polled for. These bits may be set in `events' to indicate the interesting event types; they will appear in `revents' to indicate the status of the file descriptor. */ #define POLLIN 0x001 /* There is data to read. */ #define POLLPRI 0x002 /* There is urgent data to read. */ #define POLLOUT 0x004 /* Writing now will not block. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K8 /* These values are defined in XPG4.2. */ # define POLLRDNORM 0x040 /* Normal data may be read. */ # define POLLRDBAND 0x080 /* Priority data may be read. */ # define POLLWRNORM 0x100 /* Writing now will not block. */ # define POLLWRBAND 0x200 /* Priority data may be written. */ #endif #ifdef __USE_GNU /* These are extensions for Linux. */ # define POLLMSG 0x400 # define POLLREMOVE 0x1000 # define POLLRDHUP 0x2000 #endif /* Event types always implicitly polled for. These bits need not be set in `events', but they will appear in `revents' to indicate the status of the file descriptor. */ #define POLLERR 0x008 /* Error condition. */ #define POLLHUP 0x010 /* Hung up. */ #define POLLNVAL 0x020 /* Invalid polling request. */ bits/poll2.h 0000644 00000004665 15063602063 0006722 0 ustar 00 /* Checking macros for poll functions. Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never include <bits/poll2.h> directly; use <sys/poll.h> instead." #endif __BEGIN_DECLS extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds, int __timeout), poll); extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, __SIZE_TYPE__ __fdslen); extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, int __timeout, __SIZE_TYPE__ __fdslen), __poll_chk) __warnattr ("poll called with fds buffer too small file nfds entries"); __fortify_function int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) { return __glibc_fortify (poll, __nfds, sizeof (*__fds), __glibc_objsize (__fds), __fds, __nfds, __timeout); } #ifdef __USE_GNU extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss), ppoll); extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss, __SIZE_TYPE__ __fdslen), __ppoll_chk) __warnattr ("ppoll called with fds buffer too small file nfds entries"); __fortify_function int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss) { return __glibc_fortify (ppoll, __nfds, sizeof (*__fds), __glibc_objsize (__fds), __fds, __nfds, __timeout, __ss); } #endif __END_DECLS bits/posix1_lim.h 0000644 00000012104 15063602063 0007741 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 2.9.2 Minimum Values Added to <limits.h> * * Never include this file directly; use <limits.h> instead. */ #ifndef _BITS_POSIX1_LIM_H #define _BITS_POSIX1_LIM_H 1 #include <bits/wordsize.h> /* These are the standard-mandated minimum values. */ /* Minimum number of operations in one list I/O call. */ #define _POSIX_AIO_LISTIO_MAX 2 /* Minimal number of outstanding asynchronous I/O operations. */ #define _POSIX_AIO_MAX 1 /* Maximum length of arguments to `execve', including environment. */ #define _POSIX_ARG_MAX 4096 /* Maximum simultaneous processes per real user ID. */ #ifdef __USE_XOPEN2K # define _POSIX_CHILD_MAX 25 #else # define _POSIX_CHILD_MAX 6 #endif /* Minimal number of timer expiration overruns. */ #define _POSIX_DELAYTIMER_MAX 32 /* Maximum length of a host name (not including the terminating null) as returned from the GETHOSTNAME function. */ #define _POSIX_HOST_NAME_MAX 255 /* Maximum link count of a file. */ #define _POSIX_LINK_MAX 8 /* Maximum length of login name. */ #define _POSIX_LOGIN_NAME_MAX 9 /* Number of bytes in a terminal canonical input queue. */ #define _POSIX_MAX_CANON 255 /* Number of bytes for which space will be available in a terminal input queue. */ #define _POSIX_MAX_INPUT 255 /* Maximum number of message queues open for a process. */ #define _POSIX_MQ_OPEN_MAX 8 /* Maximum number of supported message priorities. */ #define _POSIX_MQ_PRIO_MAX 32 /* Number of bytes in a filename. */ #define _POSIX_NAME_MAX 14 /* Number of simultaneous supplementary group IDs per process. */ #ifdef __USE_XOPEN2K # define _POSIX_NGROUPS_MAX 8 #else # define _POSIX_NGROUPS_MAX 0 #endif /* Number of files one process can have open at once. */ #ifdef __USE_XOPEN2K # define _POSIX_OPEN_MAX 20 #else # define _POSIX_OPEN_MAX 16 #endif #if !defined __USE_XOPEN2K || defined __USE_GNU /* Number of descriptors that a process may examine with `pselect' or `select'. */ # define _POSIX_FD_SETSIZE _POSIX_OPEN_MAX #endif /* Number of bytes in a pathname. */ #define _POSIX_PATH_MAX 256 /* Number of bytes than can be written atomically to a pipe. */ #define _POSIX_PIPE_BUF 512 /* The number of repeated occurrences of a BRE permitted by the REGEXEC and REGCOMP functions when using the interval notation. */ #define _POSIX_RE_DUP_MAX 255 /* Minimal number of realtime signals reserved for the application. */ #define _POSIX_RTSIG_MAX 8 /* Number of semaphores a process can have. */ #define _POSIX_SEM_NSEMS_MAX 256 /* Maximal value of a semaphore. */ #define _POSIX_SEM_VALUE_MAX 32767 /* Number of pending realtime signals. */ #define _POSIX_SIGQUEUE_MAX 32 /* Largest value of a `ssize_t'. */ #define _POSIX_SSIZE_MAX 32767 /* Number of streams a process can have open at once. */ #define _POSIX_STREAM_MAX 8 /* The number of bytes in a symbolic link. */ #define _POSIX_SYMLINK_MAX 255 /* The number of symbolic links that can be traversed in the resolution of a pathname in the absence of a loop. */ #define _POSIX_SYMLOOP_MAX 8 /* Number of timer for a process. */ #define _POSIX_TIMER_MAX 32 /* Maximum number of characters in a tty name. */ #define _POSIX_TTY_NAME_MAX 9 /* Maximum length of a timezone name (element of `tzname'). */ #ifdef __USE_XOPEN2K # define _POSIX_TZNAME_MAX 6 #else # define _POSIX_TZNAME_MAX 3 #endif #if !defined __USE_XOPEN2K || defined __USE_GNU /* Maximum number of connections that can be queued on a socket. */ # define _POSIX_QLIMIT 1 /* Maximum number of bytes that can be buffered on a socket for send or receive. */ # define _POSIX_HIWAT _POSIX_PIPE_BUF /* Maximum number of elements in an `iovec' array. */ # define _POSIX_UIO_MAXIOV 16 #endif /* Maximum clock resolution in nanoseconds. */ #define _POSIX_CLOCKRES_MIN 20000000 /* Get the implementation-specific values for the above. */ #include <bits/local_lim.h> #ifndef SSIZE_MAX /* ssize_t is not formally required to be the signed type corresponding to size_t, but it is for all configurations supported by glibc. */ # if __WORDSIZE == 64 || __WORDSIZE32_SIZE_ULONG # define SSIZE_MAX LONG_MAX # else # define SSIZE_MAX INT_MAX # endif #endif /* This value is a guaranteed minimum maximum. The current maximum can be got from `sysconf'. */ #ifndef NGROUPS_MAX # define NGROUPS_MAX 8 #endif #endif /* bits/posix1_lim.h */ bits/posix2_lim.h 0000644 00000005462 15063602063 0007753 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; include <limits.h> instead. */ #ifndef _BITS_POSIX2_LIM_H #define _BITS_POSIX2_LIM_H 1 /* The maximum `ibase' and `obase' values allowed by the `bc' utility. */ #define _POSIX2_BC_BASE_MAX 99 /* The maximum number of elements allowed in an array by the `bc' utility. */ #define _POSIX2_BC_DIM_MAX 2048 /* The maximum `scale' value allowed by the `bc' utility. */ #define _POSIX2_BC_SCALE_MAX 99 /* The maximum length of a string constant accepted by the `bc' utility. */ #define _POSIX2_BC_STRING_MAX 1000 /* The maximum number of weights that can be assigned to an entry of the LC_COLLATE `order' keyword in the locale definition file. */ #define _POSIX2_COLL_WEIGHTS_MAX 2 /* The maximum number of expressions that can be nested within parentheses by the `expr' utility. */ #define _POSIX2_EXPR_NEST_MAX 32 /* The maximum length, in bytes, of an input line. */ #define _POSIX2_LINE_MAX 2048 /* The maximum number of repeated occurrences of a regular expression permitted when using the interval notation `\{M,N\}'. */ #define _POSIX2_RE_DUP_MAX 255 /* The maximum number of bytes in a character class name. We have no fixed limit, 2048 is a high number. */ #define _POSIX2_CHARCLASS_NAME_MAX 14 /* These values are implementation-specific, and may vary within the implementation. Their precise values can be obtained from sysconf. */ #ifndef BC_BASE_MAX #define BC_BASE_MAX _POSIX2_BC_BASE_MAX #endif #ifndef BC_DIM_MAX #define BC_DIM_MAX _POSIX2_BC_DIM_MAX #endif #ifndef BC_SCALE_MAX #define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX #endif #ifndef BC_STRING_MAX #define BC_STRING_MAX _POSIX2_BC_STRING_MAX #endif #ifndef COLL_WEIGHTS_MAX #define COLL_WEIGHTS_MAX 255 #endif #ifndef EXPR_NEST_MAX #define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX #endif #ifndef LINE_MAX #define LINE_MAX _POSIX2_LINE_MAX #endif #ifndef CHARCLASS_NAME_MAX #define CHARCLASS_NAME_MAX 2048 #endif /* This value is defined like this in regex.h. */ #define RE_DUP_MAX (0x7fff) #endif /* bits/posix2_lim.h */ bits/posix_opt.h 0000644 00000013206 15063602063 0007705 0 ustar 00 /* Define POSIX options for Linux. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_POSIX_OPT_H #define _BITS_POSIX_OPT_H 1 /* Job control is supported. */ #define _POSIX_JOB_CONTROL 1 /* Processes have a saved set-user-ID and a saved set-group-ID. */ #define _POSIX_SAVED_IDS 1 /* Priority scheduling is supported. */ #define _POSIX_PRIORITY_SCHEDULING 200809L /* Synchronizing file data is supported. */ #define _POSIX_SYNCHRONIZED_IO 200809L /* The fsync function is present. */ #define _POSIX_FSYNC 200809L /* Mapping of files to memory is supported. */ #define _POSIX_MAPPED_FILES 200809L /* Locking of all memory is supported. */ #define _POSIX_MEMLOCK 200809L /* Locking of ranges of memory is supported. */ #define _POSIX_MEMLOCK_RANGE 200809L /* Setting of memory protections is supported. */ #define _POSIX_MEMORY_PROTECTION 200809L /* Some filesystems allow all users to change file ownership. */ #define _POSIX_CHOWN_RESTRICTED 0 /* `c_cc' member of 'struct termios' structure can be disabled by using the value _POSIX_VDISABLE. */ #define _POSIX_VDISABLE '\0' /* Filenames are not silently truncated. */ #define _POSIX_NO_TRUNC 1 /* X/Open realtime support is available. */ #define _XOPEN_REALTIME 1 /* X/Open thread realtime support is available. */ #define _XOPEN_REALTIME_THREADS 1 /* XPG4.2 shared memory is supported. */ #define _XOPEN_SHM 1 /* Tell we have POSIX threads. */ #define _POSIX_THREADS 200809L /* We have the reentrant functions described in POSIX. */ #define _POSIX_REENTRANT_FUNCTIONS 1 #define _POSIX_THREAD_SAFE_FUNCTIONS 200809L /* We provide priority scheduling for threads. */ #define _POSIX_THREAD_PRIORITY_SCHEDULING 200809L /* We support user-defined stack sizes. */ #define _POSIX_THREAD_ATTR_STACKSIZE 200809L /* We support user-defined stacks. */ #define _POSIX_THREAD_ATTR_STACKADDR 200809L /* We support priority inheritence. */ #define _POSIX_THREAD_PRIO_INHERIT 200809L /* We support priority protection, though only for non-robust mutexes. */ #define _POSIX_THREAD_PRIO_PROTECT 200809L #ifdef __USE_XOPEN2K8 /* We support priority inheritence for robust mutexes. */ # define _POSIX_THREAD_ROBUST_PRIO_INHERIT 200809L /* We do not support priority protection for robust mutexes. */ # define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1 #endif /* We support POSIX.1b semaphores. */ #define _POSIX_SEMAPHORES 200809L /* Real-time signals are supported. */ #define _POSIX_REALTIME_SIGNALS 200809L /* We support asynchronous I/O. */ #define _POSIX_ASYNCHRONOUS_IO 200809L #define _POSIX_ASYNC_IO 1 /* Alternative name for Unix98. */ #define _LFS_ASYNCHRONOUS_IO 1 /* Support for prioritization is also available. */ #define _POSIX_PRIORITIZED_IO 200809L /* The LFS support in asynchronous I/O is also available. */ #define _LFS64_ASYNCHRONOUS_IO 1 /* The rest of the LFS is also available. */ #define _LFS_LARGEFILE 1 #define _LFS64_LARGEFILE 1 #define _LFS64_STDIO 1 /* POSIX shared memory objects are implemented. */ #define _POSIX_SHARED_MEMORY_OBJECTS 200809L /* CPU-time clocks support needs to be checked at runtime. */ #define _POSIX_CPUTIME 0 /* Clock support in threads must be also checked at runtime. */ #define _POSIX_THREAD_CPUTIME 0 /* GNU libc provides regular expression handling. */ #define _POSIX_REGEXP 1 /* Reader/Writer locks are available. */ #define _POSIX_READER_WRITER_LOCKS 200809L /* We have a POSIX shell. */ #define _POSIX_SHELL 1 /* We support the Timeouts option. */ #define _POSIX_TIMEOUTS 200809L /* We support spinlocks. */ #define _POSIX_SPIN_LOCKS 200809L /* The `spawn' function family is supported. */ #define _POSIX_SPAWN 200809L /* We have POSIX timers. */ #define _POSIX_TIMERS 200809L /* The barrier functions are available. */ #define _POSIX_BARRIERS 200809L /* POSIX message queues are available. */ #define _POSIX_MESSAGE_PASSING 200809L /* Thread process-shared synchronization is supported. */ #define _POSIX_THREAD_PROCESS_SHARED 200809L /* The monotonic clock might be available. */ #define _POSIX_MONOTONIC_CLOCK 0 /* The clock selection interfaces are available. */ #define _POSIX_CLOCK_SELECTION 200809L /* Advisory information interfaces are available. */ #define _POSIX_ADVISORY_INFO 200809L /* IPv6 support is available. */ #define _POSIX_IPV6 200809L /* Raw socket support is available. */ #define _POSIX_RAW_SOCKETS 200809L /* We have at least one terminal. */ #define _POSIX2_CHAR_TERM 200809L /* Neither process nor thread sporadic server interfaces is available. */ #define _POSIX_SPORADIC_SERVER -1 #define _POSIX_THREAD_SPORADIC_SERVER -1 /* trace.h is not available. */ #define _POSIX_TRACE -1 #define _POSIX_TRACE_EVENT_FILTER -1 #define _POSIX_TRACE_INHERIT -1 #define _POSIX_TRACE_LOG -1 /* Typed memory objects are not available. */ #define _POSIX_TYPED_MEMORY_OBJECTS -1 /* Streams are not available. */ #define _XOPEN_STREAMS -1 #endif /* bits/posix_opt.h */ bits/printf-ldbl.h 0000644 00000001737 15063602063 0010104 0 ustar 00 /* -mlong-double-64 compatibility mode for <printf.h> functions. Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _PRINTF_H # error "Never include <bits/printf-ldbl.h> directly; use <printf.h> instead." #endif __LDBL_REDIR_DECL (printf_size) bits/pthreadtypes-arch.h 0000644 00000006332 15063602063 0011312 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 #include <bits/wordsize.h> #ifdef __x86_64__ # if __WORDSIZE == 64 # define __SIZEOF_PTHREAD_MUTEX_T 40 # define __SIZEOF_PTHREAD_ATTR_T 56 # define __SIZEOF_PTHREAD_MUTEX_T 40 # define __SIZEOF_PTHREAD_RWLOCK_T 56 # define __SIZEOF_PTHREAD_BARRIER_T 32 # else # define __SIZEOF_PTHREAD_MUTEX_T 32 # define __SIZEOF_PTHREAD_ATTR_T 32 # define __SIZEOF_PTHREAD_MUTEX_T 32 # define __SIZEOF_PTHREAD_RWLOCK_T 44 # define __SIZEOF_PTHREAD_BARRIER_T 20 # endif #else # define __SIZEOF_PTHREAD_MUTEX_T 24 # define __SIZEOF_PTHREAD_ATTR_T 36 # define __SIZEOF_PTHREAD_MUTEX_T 24 # define __SIZEOF_PTHREAD_RWLOCK_T 32 # define __SIZEOF_PTHREAD_BARRIER_T 20 #endif #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 #define __SIZEOF_PTHREAD_COND_T 48 #define __SIZEOF_PTHREAD_CONDATTR_T 4 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 /* Definitions for internal mutex struct. */ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 1 #ifdef __x86_64__ # define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 # define __PTHREAD_MUTEX_USE_UNION 0 #else # define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 # define __PTHREAD_MUTEX_USE_UNION 1 #endif #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT struct __pthread_rwlock_arch_t { unsigned int __readers; unsigned int __writers; unsigned int __wrphase_futex; unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; #ifdef __x86_64__ int __cur_writer; int __shared; signed char __rwelision; # ifdef __ILP32__ unsigned char __pad1[3]; # define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 } # else unsigned char __pad1[7]; # define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 } # endif unsigned long int __pad2; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned int __flags; # define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1 #else /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned char __flags; unsigned char __shared; signed char __rwelision; # define __PTHREAD_RWLOCK_ELISION_EXTRA 0 unsigned char __pad2; int __cur_writer; #endif }; #ifndef __x86_64__ /* Extra attributes for the cleanup functions. */ # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) #endif #endif /* bits/pthreadtypes.h */ bits/pthreadtypes.h 0000644 00000005777 15063602063 0010413 0 ustar 00 /* Declaration of common pthread types for all architectures. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_PTHREADTYPES_COMMON_H # define _BITS_PTHREADTYPES_COMMON_H 1 /* For internal mutex and condition variable definitions. */ #include <bits/thread-shared-types.h> /* Thread identifiers. The structure of the attribute type is not exposed on purpose. */ typedef unsigned long int pthread_t; /* Data structures for mutex handling. The structure of the attribute type is not exposed on purpose. */ typedef union { char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; int __align; } pthread_mutexattr_t; /* Data structure for condition variable handling. The structure of the attribute type is not exposed on purpose. */ typedef union { char __size[__SIZEOF_PTHREAD_CONDATTR_T]; int __align; } pthread_condattr_t; /* Keys for thread-specific data */ typedef unsigned int pthread_key_t; /* Once-only execution */ typedef int __ONCE_ALIGNMENT pthread_once_t; union pthread_attr_t { char __size[__SIZEOF_PTHREAD_ATTR_T]; long int __align; }; #ifndef __have_pthread_attr_t typedef union pthread_attr_t pthread_attr_t; # define __have_pthread_attr_t 1 #endif typedef union { struct __pthread_mutex_s __data; char __size[__SIZEOF_PTHREAD_MUTEX_T]; long int __align; } pthread_mutex_t; typedef union { struct __pthread_cond_s __data; char __size[__SIZEOF_PTHREAD_COND_T]; __extension__ long long int __align; } pthread_cond_t; #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Data structure for reader-writer lock variable handling. The structure of the attribute type is deliberately not exposed. */ typedef union { struct __pthread_rwlock_arch_t __data; char __size[__SIZEOF_PTHREAD_RWLOCK_T]; long int __align; } pthread_rwlock_t; typedef union { char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; long int __align; } pthread_rwlockattr_t; #endif #ifdef __USE_XOPEN2K /* POSIX spinlock data type. */ typedef volatile int pthread_spinlock_t; /* POSIX barriers data type. The structure of the type is deliberately not exposed. */ typedef union { char __size[__SIZEOF_PTHREAD_BARRIER_T]; long int __align; } pthread_barrier_t; typedef union { char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; int __align; } pthread_barrierattr_t; #endif #endif bits/ptrace-shared.h 0000644 00000005524 15063602063 0010407 0 ustar 00 /* `ptrace' debugger support interface. Linux version, not architecture-specific. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PTRACE_H # error "Never use <bits/ptrace-shared.h> directly; include <sys/ptrace.h> instead." #endif /* Options set using PTRACE_SETOPTIONS. */ enum __ptrace_setoptions { PTRACE_O_TRACESYSGOOD = 0x00000001, PTRACE_O_TRACEFORK = 0x00000002, PTRACE_O_TRACEVFORK = 0x00000004, PTRACE_O_TRACECLONE = 0x00000008, PTRACE_O_TRACEEXEC = 0x00000010, PTRACE_O_TRACEVFORKDONE = 0x00000020, PTRACE_O_TRACEEXIT = 0x00000040, PTRACE_O_TRACESECCOMP = 0x00000080, PTRACE_O_EXITKILL = 0x00100000, PTRACE_O_SUSPEND_SECCOMP = 0x00200000, PTRACE_O_MASK = 0x003000ff }; enum __ptrace_eventcodes { /* Wait extended result codes for the above trace options. */ PTRACE_EVENT_FORK = 1, PTRACE_EVENT_VFORK = 2, PTRACE_EVENT_CLONE = 3, PTRACE_EVENT_EXEC = 4, PTRACE_EVENT_VFORK_DONE = 5, PTRACE_EVENT_EXIT = 6, PTRACE_EVENT_SECCOMP = 7, /* Extended result codes enabled by means other than options. */ PTRACE_EVENT_STOP = 128 }; /* Arguments for PTRACE_PEEKSIGINFO. */ struct __ptrace_peeksiginfo_args { __uint64_t off; /* From which siginfo to start. */ __uint32_t flags; /* Flags for peeksiginfo. */ __int32_t nr; /* How many siginfos to take. */ }; enum __ptrace_peeksiginfo_flags { /* Read signals from a shared (process wide) queue. */ PTRACE_PEEKSIGINFO_SHARED = (1 << 0) }; /* Argument and results of PTRACE_SECCOMP_GET_METADATA. */ struct __ptrace_seccomp_metadata { __uint64_t filter_off; /* Input: which filter. */ __uint64_t flags; /* Output: filter's flags. */ }; /* Perform process tracing functions. REQUEST is one of the values above, and determines the action to be taken. For all requests except PTRACE_TRACEME, PID specifies the process to be traced. PID and the other arguments described above for the various requests should appear (those that are used for the particular request) as: pid_t PID, void *ADDR, int DATA, void *ADDR2 after REQUEST. */ extern long int ptrace (enum __ptrace_request __request, ...) __THROW; bits/resource.h 0000644 00000014232 15063602063 0007510 0 ustar 00 /* Bit values & structures for resource limits. Linux version. Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_RESOURCE_H # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." #endif #include <bits/types.h> /* Transmute defines to enumerations. The macro re-definitions are necessary because some programs want to test for operating system features with #ifdef RUSAGE_SELF. In ISO C the reflexive definition is a no-op. */ /* Kinds of resource limit. */ enum __rlimit_resource { /* Per-process CPU limit, in seconds. */ RLIMIT_CPU = 0, #define RLIMIT_CPU RLIMIT_CPU /* Largest file that can be created, in bytes. */ RLIMIT_FSIZE = 1, #define RLIMIT_FSIZE RLIMIT_FSIZE /* Maximum size of data segment, in bytes. */ RLIMIT_DATA = 2, #define RLIMIT_DATA RLIMIT_DATA /* Maximum size of stack segment, in bytes. */ RLIMIT_STACK = 3, #define RLIMIT_STACK RLIMIT_STACK /* Largest core file that can be created, in bytes. */ RLIMIT_CORE = 4, #define RLIMIT_CORE RLIMIT_CORE /* Largest resident set size, in bytes. This affects swapping; processes that are exceeding their resident set size will be more likely to have physical memory taken from them. */ __RLIMIT_RSS = 5, #define RLIMIT_RSS __RLIMIT_RSS /* Number of open files. */ RLIMIT_NOFILE = 7, __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ #define RLIMIT_NOFILE RLIMIT_NOFILE #define RLIMIT_OFILE __RLIMIT_OFILE /* Address space limit. */ RLIMIT_AS = 9, #define RLIMIT_AS RLIMIT_AS /* Number of processes. */ __RLIMIT_NPROC = 6, #define RLIMIT_NPROC __RLIMIT_NPROC /* Locked-in-memory address space. */ __RLIMIT_MEMLOCK = 8, #define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK /* Maximum number of file locks. */ __RLIMIT_LOCKS = 10, #define RLIMIT_LOCKS __RLIMIT_LOCKS /* Maximum number of pending signals. */ __RLIMIT_SIGPENDING = 11, #define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING /* Maximum bytes in POSIX message queues. */ __RLIMIT_MSGQUEUE = 12, #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE /* Maximum nice priority allowed to raise to. Nice levels 19 .. -20 correspond to 0 .. 39 values of this resource limit. */ __RLIMIT_NICE = 13, #define RLIMIT_NICE __RLIMIT_NICE /* Maximum realtime priority allowed for non-priviledged processes. */ __RLIMIT_RTPRIO = 14, #define RLIMIT_RTPRIO __RLIMIT_RTPRIO /* Maximum CPU time in µs that a process scheduled under a real-time scheduling policy may consume without making a blocking system call before being forcibly descheduled. */ __RLIMIT_RTTIME = 15, #define RLIMIT_RTTIME __RLIMIT_RTTIME __RLIMIT_NLIMITS = 16, __RLIM_NLIMITS = __RLIMIT_NLIMITS #define RLIMIT_NLIMITS __RLIMIT_NLIMITS #define RLIM_NLIMITS __RLIM_NLIMITS }; /* Value to indicate that there is no limit. */ #ifndef __USE_FILE_OFFSET64 # define RLIM_INFINITY ((__rlim_t) -1) #else # define RLIM_INFINITY 0xffffffffffffffffuLL #endif #ifdef __USE_LARGEFILE64 # define RLIM64_INFINITY 0xffffffffffffffffuLL #endif /* We can represent all limits. */ #define RLIM_SAVED_MAX RLIM_INFINITY #define RLIM_SAVED_CUR RLIM_INFINITY /* Type for resource quantity measurement. */ #ifndef __USE_FILE_OFFSET64 typedef __rlim_t rlim_t; #else typedef __rlim64_t rlim_t; #endif #ifdef __USE_LARGEFILE64 typedef __rlim64_t rlim64_t; #endif struct rlimit { /* The current (soft) limit. */ rlim_t rlim_cur; /* The hard limit. */ rlim_t rlim_max; }; #ifdef __USE_LARGEFILE64 struct rlimit64 { /* The current (soft) limit. */ rlim64_t rlim_cur; /* The hard limit. */ rlim64_t rlim_max; }; #endif /* Whose usage statistics do you want? */ enum __rusage_who { /* The calling process. */ RUSAGE_SELF = 0, #define RUSAGE_SELF RUSAGE_SELF /* All of its terminated child processes. */ RUSAGE_CHILDREN = -1 #define RUSAGE_CHILDREN RUSAGE_CHILDREN #ifdef __USE_GNU , /* The calling thread. */ RUSAGE_THREAD = 1 # define RUSAGE_THREAD RUSAGE_THREAD /* Name for the same functionality on Solaris. */ # define RUSAGE_LWP RUSAGE_THREAD #endif }; #include <bits/types/struct_timeval.h> #include <bits/types/struct_rusage.h> /* Priority limits. */ #define PRIO_MIN -20 /* Minimum priority a process can have. */ #define PRIO_MAX 20 /* Maximum priority a process can have. */ /* The type of the WHICH argument to `getpriority' and `setpriority', indicating what flavor of entity the WHO argument specifies. */ enum __priority_which { PRIO_PROCESS = 0, /* WHO is a process ID. */ #define PRIO_PROCESS PRIO_PROCESS PRIO_PGRP = 1, /* WHO is a process group ID. */ #define PRIO_PGRP PRIO_PGRP PRIO_USER = 2 /* WHO is a user ID. */ #define PRIO_USER PRIO_USER }; __BEGIN_DECLS #ifdef __USE_GNU /* Modify and return resource limits of a process atomically. */ # ifndef __USE_FILE_OFFSET64 extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit *__new_limit, struct rlimit *__old_limit) __THROW; # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (prlimit, (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit *__new_limit, struct rlimit *__old_limit), prlimit64); # else # define prlimit prlimit64 # endif # endif # ifdef __USE_LARGEFILE64 extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit64 *__new_limit, struct rlimit64 *__old_limit) __THROW; # endif #endif __END_DECLS bits/sched.h 0000644 00000007243 15063602063 0006753 0 ustar 00 /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SCHED_H #define _BITS_SCHED_H 1 #ifndef _SCHED_H # error "Never include <bits/sched.h> directly; use <sched.h> instead." #endif /* Scheduling algorithms. */ #define SCHED_OTHER 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #ifdef __USE_GNU # define SCHED_BATCH 3 # define SCHED_ISO 4 # define SCHED_IDLE 5 # define SCHED_DEADLINE 6 # define SCHED_RESET_ON_FORK 0x40000000 #endif #ifdef __USE_GNU /* Cloning flags. */ # define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ # define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ # define CLONE_FS 0x00000200 /* Set if fs info shared between processes. */ # define CLONE_FILES 0x00000400 /* Set if open files shared between processes. */ # define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ # define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */ # define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to wake it up on mm_release. */ # define CLONE_PARENT 0x00008000 /* Set if we want to have the same parent as the cloner. */ # define CLONE_THREAD 0x00010000 /* Set to add to same thread group. */ # define CLONE_NEWNS 0x00020000 /* Set to create new namespace. */ # define CLONE_SYSVSEM 0x00040000 /* Set to shared SVID SEM_UNDO semantics. */ # define CLONE_SETTLS 0x00080000 /* Set TLS info. */ # define CLONE_PARENT_SETTID 0x00100000 /* Store TID in userlevel buffer before MM copy. */ # define CLONE_CHILD_CLEARTID 0x00200000 /* Register exit futex and memory location to clear. */ # define CLONE_DETACHED 0x00400000 /* Create clone detached. */ # define CLONE_UNTRACED 0x00800000 /* Set if the tracing process can't force CLONE_PTRACE on this clone. */ # define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in the child. */ # define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace. */ # define CLONE_NEWUTS 0x04000000 /* New utsname group. */ # define CLONE_NEWIPC 0x08000000 /* New ipcs. */ # define CLONE_NEWUSER 0x10000000 /* New user namespace. */ # define CLONE_NEWPID 0x20000000 /* New pid namespace. */ # define CLONE_NEWNET 0x40000000 /* New network namespace. */ # define CLONE_IO 0x80000000 /* Clone I/O context. */ #endif #include <bits/types/struct_sched_param.h> __BEGIN_DECLS #ifdef __USE_GNU /* Clone current process. */ extern int clone (int (*__fn) (void *__arg), void *__child_stack, int __flags, void *__arg, ...) __THROW; /* Unshare the specified resources. */ extern int unshare (int __flags) __THROW; /* Get index of currently used CPU. */ extern int sched_getcpu (void) __THROW; /* Switch process to namespace of type NSTYPE indicated by FD. */ extern int setns (int __fd, int __nstype) __THROW; #endif __END_DECLS #endif /* bits/sched.h */ bits/select.h 0000644 00000004071 15063602063 0007140 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SELECT_H # error "Never use <bits/select.h> directly; include <sys/select.h> instead." #endif #include <bits/wordsize.h> #if defined __GNUC__ && __GNUC__ >= 2 # if __WORDSIZE == 64 # define __FD_ZERO_STOS "stosq" # else # define __FD_ZERO_STOS "stosl" # endif # define __FD_ZERO(fdsp) \ do { \ int __d0, __d1; \ __asm__ __volatile__ ("cld; rep; " __FD_ZERO_STOS \ : "=c" (__d0), "=D" (__d1) \ : "a" (0), "0" (sizeof (fd_set) \ / sizeof (__fd_mask)), \ "1" (&__FDS_BITS (fdsp)[0]) \ : "memory"); \ } while (0) #else /* ! GNU CC */ /* We don't use `memset' because this would require a prototype and the array isn't too big. */ # define __FD_ZERO(set) \ do { \ unsigned int __i; \ fd_set *__arr = (set); \ for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ __FDS_BITS (__arr)[__i] = 0; \ } while (0) #endif /* GNU CC */ #define __FD_SET(d, set) \ ((void) (__FDS_BITS (set)[__FD_ELT (d)] |= __FD_MASK (d))) #define __FD_CLR(d, set) \ ((void) (__FDS_BITS (set)[__FD_ELT (d)] &= ~__FD_MASK (d))) #define __FD_ISSET(d, set) \ ((__FDS_BITS (set)[__FD_ELT (d)] & __FD_MASK (d)) != 0) bits/select2.h 0000644 00000002635 15063602063 0007226 0 ustar 00 /* Checking macros for select functions. Copyright (C) 2011-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SELECT_H # error "Never include <bits/select2.h> directly; use <sys/select.h> instead." #endif /* Helper functions to issue warnings and errors when needed. */ extern long int __fdelt_chk (long int __d); extern long int __fdelt_warn (long int __d) __warnattr ("bit outside of fd_set selected"); #undef __FD_ELT #define __FD_ELT(d) \ __extension__ \ ({ long int __d = (d); \ (__builtin_constant_p (__d) \ ? (0 <= __d && __d < __FD_SETSIZE \ ? (__d / __NFDBITS) \ : __fdelt_warn (__d)) \ : __fdelt_chk (__d)); }) bits/sem.h 0000644 00000005073 15063602063 0006450 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SEM_H # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." #endif #include <sys/types.h> /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ /* Commands for `semctl'. */ #define GETPID 11 /* get sempid */ #define GETVAL 12 /* get semval */ #define GETALL 13 /* get all semval's */ #define GETNCNT 14 /* get semncnt */ #define GETZCNT 15 /* get semzcnt */ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ /* Data structure describing a set of semaphores. */ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __glibc_reserved1; __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t __glibc_reserved2; __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; }; /* The user should define a union like the following to use it for arguments for `semctl'. union semun { int val; <= value for SETVAL struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET unsigned short int *array; <= array for GETALL & SETALL struct seminfo *__buf; <= buffer for IPC_INFO }; Previous versions of this file used to define this union but this is incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether one must define the union or not. */ #define _SEM_SEMUN_UNDEFINED 1 #ifdef __USE_MISC /* ipcs ctl cmds */ # define SEM_STAT 18 # define SEM_INFO 19 # define SEM_STAT_ANY 20 struct seminfo { int semmap; int semmni; int semmns; int semmnu; int semmsl; int semopm; int semume; int semusz; int semvmx; int semaem; }; #endif /* __USE_MISC */ bits/semaphore.h 0000644 00000002325 15063602063 0007644 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SEMAPHORE_H # error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead." #endif #include <bits/wordsize.h> #if __WORDSIZE == 64 # define __SIZEOF_SEM_T 32 #else # define __SIZEOF_SEM_T 16 #endif /* Value returned if `sem_open' failed. */ #define SEM_FAILED ((sem_t *) 0) typedef union { char __size[__SIZEOF_SEM_T]; long int __align; } sem_t; bits/setjmp.h 0000644 00000002406 15063602063 0007163 0 ustar 00 /* Copyright (C) 2001-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Define the machine-dependent type `jmp_buf'. x86-64 version. */ #ifndef _BITS_SETJMP_H #define _BITS_SETJMP_H 1 #if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif #include <bits/wordsize.h> #ifndef _ASM # if __WORDSIZE == 64 typedef long int __jmp_buf[8]; # elif defined __x86_64__ __extension__ typedef long long int __jmp_buf[8]; # else typedef int __jmp_buf[6]; # endif #endif #endif /* bits/setjmp.h */ bits/setjmp2.h 0000644 00000003250 15063602063 0007243 0 ustar 00 /* Checking macros for setjmp functions. Copyright (C) 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SETJMP_H # error "Never include <bits/setjmp2.h> directly; use <setjmp.h> instead." #endif /* Variant of the longjmp functions which perform some sanity checking. */ #ifdef __REDIRECT_NTH extern void __REDIRECT_NTHNL (longjmp, (struct __jmp_buf_tag __env[1], int __val), __longjmp_chk) __attribute__ ((__noreturn__)); extern void __REDIRECT_NTHNL (_longjmp, (struct __jmp_buf_tag __env[1], int __val), __longjmp_chk) __attribute__ ((__noreturn__)); extern void __REDIRECT_NTHNL (siglongjmp, (struct __jmp_buf_tag __env[1], int __val), __longjmp_chk) __attribute__ ((__noreturn__)); #else extern void __longjmp_chk (struct __jmp_buf_tag __env[1], int __val), __THROWNL __attribute__ ((__noreturn__)); # define longjmp __longjmp_chk # define _longjmp __longjmp_chk # define siglongjmp __longjmp_chk #endif bits/shm.h 0000644 00000007007 15063602063 0006452 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SHM_H # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." #endif #include <bits/types.h> /* Permission flag for shmget. */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ /* Flags for `shmat'. */ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ #define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ #define SHM_UNLOCK 12 /* unlock segment (root only) */ __BEGIN_DECLS /* Segment low boundary address multiple. */ #define SHMLBA (__getpagesize ()) extern int __getpagesize (void) __THROW __attribute__ ((__const__)); /* Type to count number of attaches. */ typedef __syscall_ulong_t shmatt_t; /* Data structure describing a shared memory segment. */ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ __time_t shm_atime; /* time of last shmat() */ #ifndef __x86_64__ unsigned long int __glibc_reserved1; #endif __time_t shm_dtime; /* time of last shmdt() */ #ifndef __x86_64__ unsigned long int __glibc_reserved2; #endif __time_t shm_ctime; /* time of last change by shmctl() */ #ifndef __x86_64__ unsigned long int __glibc_reserved3; #endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; }; #ifdef __USE_MISC /* ipcs ctl commands */ # define SHM_STAT 13 # define SHM_INFO 14 # define SHM_STAT_ANY 15 /* shm_mode upper byte flags */ # define SHM_DEST 01000 /* segment will be destroyed on last detach */ # define SHM_LOCKED 02000 /* segment will not be swapped */ # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ # define SHM_NORESERVE 010000 /* don't check for reservations */ struct shminfo { __syscall_ulong_t shmmax; __syscall_ulong_t shmmin; __syscall_ulong_t shmmni; __syscall_ulong_t shmseg; __syscall_ulong_t shmall; __syscall_ulong_t __glibc_reserved1; __syscall_ulong_t __glibc_reserved2; __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; }; struct shm_info { int used_ids; __syscall_ulong_t shm_tot; /* total allocated shm */ __syscall_ulong_t shm_rss; /* total resident shm */ __syscall_ulong_t shm_swp; /* total swapped shm */ __syscall_ulong_t swap_attempts; __syscall_ulong_t swap_successes; }; #endif /* __USE_MISC */ __END_DECLS bits/sigaction.h 0000644 00000005566 15063602063 0007653 0 ustar 00 /* The proper definitions for Linux's sigaction. Copyright (C) 1993-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGACTION_H #define _BITS_SIGACTION_H 1 #ifndef _SIGNAL_H # error "Never include <bits/sigaction.h> directly; use <signal.h> instead." #endif /* Structure describing the action to be taken when a signal arrives. */ struct sigaction { /* Signal handler. */ #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED union { /* Used if SA_SIGINFO is not set. */ __sighandler_t sa_handler; /* Used if SA_SIGINFO is set. */ void (*sa_sigaction) (int, siginfo_t *, void *); } __sigaction_handler; # define sa_handler __sigaction_handler.sa_handler # define sa_sigaction __sigaction_handler.sa_sigaction #else __sighandler_t sa_handler; #endif /* Additional set of signals to be blocked. */ __sigset_t sa_mask; /* Special flags. */ int sa_flags; /* Restore handler. */ void (*sa_restorer) (void); }; /* Bits in `sa_flags'. */ #define SA_NOCLDSTOP 1 /* Don't send SIGCHLD when children stop. */ #define SA_NOCLDWAIT 2 /* Don't create zombie on child death. */ #define SA_SIGINFO 4 /* Invoke signal-catching function with three arguments instead of one. */ #if defined __USE_XOPEN_EXTENDED || defined __USE_MISC # define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */ #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 # define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ # define SA_NODEFER 0x40000000 /* Don't automatically block the signal when its handler is being executed. */ # define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */ #endif #ifdef __USE_MISC # define SA_INTERRUPT 0x20000000 /* Historical no-op. */ /* Some aliases for the SA_ constants. */ # define SA_NOMASK SA_NODEFER # define SA_ONESHOT SA_RESETHAND # define SA_STACK SA_ONSTACK #endif /* Values for the HOW argument to `sigprocmask'. */ #define SIG_BLOCK 0 /* Block signals. */ #define SIG_UNBLOCK 1 /* Unblock signals. */ #define SIG_SETMASK 2 /* Set the set of blocked signals. */ #endif bits/sigcontext.h 0000644 00000010250 15063602063 0010044 0 ustar 00 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGCONTEXT_H #define _BITS_SIGCONTEXT_H 1 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." #endif #include <bits/types.h> #define FP_XSTATE_MAGIC1 0x46505853U #define FP_XSTATE_MAGIC2 0x46505845U #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2) struct _fpx_sw_bytes { __uint32_t magic1; __uint32_t extended_size; __uint64_t xstate_bv; __uint32_t xstate_size; __uint32_t __glibc_reserved1[7]; }; struct _fpreg { unsigned short significand[4]; unsigned short exponent; }; struct _fpxreg { unsigned short significand[4]; unsigned short exponent; unsigned short __glibc_reserved1[3]; }; struct _xmmreg { __uint32_t element[4]; }; #ifndef __x86_64__ struct _fpstate { /* Regular FPU environment. */ __uint32_t cw; __uint32_t sw; __uint32_t tag; __uint32_t ipoff; __uint32_t cssel; __uint32_t dataoff; __uint32_t datasel; struct _fpreg _st[8]; unsigned short status; unsigned short magic; /* FXSR FPU environment. */ __uint32_t _fxsr_env[6]; __uint32_t mxcsr; __uint32_t __glibc_reserved1; struct _fpxreg _fxsr_st[8]; struct _xmmreg _xmm[8]; __uint32_t __glibc_reserved2[56]; }; #ifndef sigcontext_struct /* Kernel headers before 2.1.1 define a struct sigcontext_struct, but we need sigcontext. Some packages have come to rely on sigcontext_struct being defined on 32-bit x86, so define this for their benefit. */ # define sigcontext_struct sigcontext #endif #define X86_FXSR_MAGIC 0x0000 struct sigcontext { unsigned short gs, __gsh; unsigned short fs, __fsh; unsigned short es, __esh; unsigned short ds, __dsh; unsigned long edi; unsigned long esi; unsigned long ebp; unsigned long esp; unsigned long ebx; unsigned long edx; unsigned long ecx; unsigned long eax; unsigned long trapno; unsigned long err; unsigned long eip; unsigned short cs, __csh; unsigned long eflags; unsigned long esp_at_signal; unsigned short ss, __ssh; struct _fpstate * fpstate; unsigned long oldmask; unsigned long cr2; }; #else /* __x86_64__ */ struct _fpstate { /* FPU environment matching the 64-bit FXSAVE layout. */ __uint16_t cwd; __uint16_t swd; __uint16_t ftw; __uint16_t fop; __uint64_t rip; __uint64_t rdp; __uint32_t mxcsr; __uint32_t mxcr_mask; struct _fpxreg _st[8]; struct _xmmreg _xmm[16]; __uint32_t __glibc_reserved1[24]; }; struct sigcontext { __uint64_t r8; __uint64_t r9; __uint64_t r10; __uint64_t r11; __uint64_t r12; __uint64_t r13; __uint64_t r14; __uint64_t r15; __uint64_t rdi; __uint64_t rsi; __uint64_t rbp; __uint64_t rbx; __uint64_t rdx; __uint64_t rax; __uint64_t rcx; __uint64_t rsp; __uint64_t rip; __uint64_t eflags; unsigned short cs; unsigned short gs; unsigned short fs; unsigned short __pad0; __uint64_t err; __uint64_t trapno; __uint64_t oldmask; __uint64_t cr2; __extension__ union { struct _fpstate * fpstate; __uint64_t __fpstate_word; }; __uint64_t __reserved1 [8]; }; #endif /* __x86_64__ */ struct _xsave_hdr { __uint64_t xstate_bv; __uint64_t __glibc_reserved1[2]; __uint64_t __glibc_reserved2[5]; }; struct _ymmh_state { __uint32_t ymmh_space[64]; }; struct _xstate { struct _fpstate fpstate; struct _xsave_hdr xstate_hdr; struct _ymmh_state ymmh; }; #endif /* _BITS_SIGCONTEXT_H */ bits/sigevent-consts.h 0000644 00000002676 15063602063 0011025 0 ustar 00 /* sigevent constants. Linux version. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGEVENT_CONSTS_H #define _BITS_SIGEVENT_CONSTS_H 1 #if !defined _SIGNAL_H && !defined _AIO_H #error "Don't include <bits/sigevent-consts.h> directly; use <signal.h> instead." #endif /* `sigev_notify' values. */ enum { SIGEV_SIGNAL = 0, /* Notify via signal. */ # define SIGEV_SIGNAL SIGEV_SIGNAL SIGEV_NONE, /* Other notification: meaningless. */ # define SIGEV_NONE SIGEV_NONE SIGEV_THREAD, /* Deliver via thread creation. */ # define SIGEV_THREAD SIGEV_THREAD SIGEV_THREAD_ID = 4 /* Send signal to specific thread. This is a Linux extension. */ #define SIGEV_THREAD_ID SIGEV_THREAD_ID }; #endif bits/siginfo-arch.h 0000644 00000001331 15063602063 0010226 0 ustar 00 /* Architecture-specific adjustments to siginfo_t. x86 version. */ #ifndef _BITS_SIGINFO_ARCH_H #define _BITS_SIGINFO_ARCH_H 1 #if defined __x86_64__ && __WORDSIZE == 32 /* si_utime and si_stime must be 4 byte aligned for x32 to match the kernel. We align siginfo_t to 8 bytes so that si_utime and si_stime are actually aligned to 8 bytes since their offsets are multiple of 8 bytes. Note: with some compilers, the alignment attribute would be ignored if it were put in __SI_CLOCK_T instead of encapsulated in a typedef. */ typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t; # define __SI_ALIGNMENT __attribute__ ((__aligned__ (8))) # define __SI_CLOCK_T __sigchld_clock_t #endif #endif bits/siginfo-consts-arch.h 0000644 00000000314 15063602063 0011535 0 ustar 00 /* Architecture-specific additional siginfo constants. */ #ifndef _BITS_SIGINFO_CONSTS_ARCH_H #define _BITS_SIGINFO_CONSTS_ARCH_H 1 /* This architecture has no additional siginfo constants. */ #endif bits/siginfo-consts.h 0000644 00000013525 15063602063 0010632 0 ustar 00 /* siginfo constants. Linux version. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGINFO_CONSTS_H #define _BITS_SIGINFO_CONSTS_H 1 #ifndef _SIGNAL_H #error "Don't include <bits/siginfo-consts.h> directly; use <signal.h> instead." #endif /* Most of these constants are uniform across all architectures, but there is one exception. */ #include <bits/siginfo-arch.h> #ifndef __SI_ASYNCIO_AFTER_SIGIO # define __SI_ASYNCIO_AFTER_SIGIO 1 #endif /* Values for `si_code'. Positive values are reserved for kernel-generated signals. */ enum { SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ SI_TKILL = -6, /* Sent by tkill. */ SI_SIGIO, /* Sent by queued SIGIO. */ #if __SI_ASYNCIO_AFTER_SIGIO SI_ASYNCIO, /* Sent by AIO completion. */ SI_MESGQ, /* Sent by real time mesq state change. */ SI_TIMER, /* Sent by timer expiration. */ #else SI_MESGQ, SI_TIMER, SI_ASYNCIO, #endif SI_QUEUE, /* Sent by sigqueue. */ SI_USER, /* Sent by kill, sigsend. */ SI_KERNEL = 0x80 /* Send by kernel. */ #define SI_ASYNCNL SI_ASYNCNL #define SI_TKILL SI_TKILL #define SI_SIGIO SI_SIGIO #define SI_ASYNCIO SI_ASYNCIO #define SI_MESGQ SI_MESGQ #define SI_TIMER SI_TIMER #define SI_ASYNCIO SI_ASYNCIO #define SI_QUEUE SI_QUEUE #define SI_USER SI_USER #define SI_KERNEL SI_KERNEL }; # if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* `si_code' values for SIGILL signal. */ enum { ILL_ILLOPC = 1, /* Illegal opcode. */ # define ILL_ILLOPC ILL_ILLOPC ILL_ILLOPN, /* Illegal operand. */ # define ILL_ILLOPN ILL_ILLOPN ILL_ILLADR, /* Illegal addressing mode. */ # define ILL_ILLADR ILL_ILLADR ILL_ILLTRP, /* Illegal trap. */ # define ILL_ILLTRP ILL_ILLTRP ILL_PRVOPC, /* Privileged opcode. */ # define ILL_PRVOPC ILL_PRVOPC ILL_PRVREG, /* Privileged register. */ # define ILL_PRVREG ILL_PRVREG ILL_COPROC, /* Coprocessor error. */ # define ILL_COPROC ILL_COPROC ILL_BADSTK /* Internal stack error. */ # define ILL_BADSTK ILL_BADSTK }; /* `si_code' values for SIGFPE signal. */ enum { FPE_INTDIV = 1, /* Integer divide by zero. */ # define FPE_INTDIV FPE_INTDIV FPE_INTOVF, /* Integer overflow. */ # define FPE_INTOVF FPE_INTOVF FPE_FLTDIV, /* Floating point divide by zero. */ # define FPE_FLTDIV FPE_FLTDIV FPE_FLTOVF, /* Floating point overflow. */ # define FPE_FLTOVF FPE_FLTOVF FPE_FLTUND, /* Floating point underflow. */ # define FPE_FLTUND FPE_FLTUND FPE_FLTRES, /* Floating point inexact result. */ # define FPE_FLTRES FPE_FLTRES FPE_FLTINV, /* Floating point invalid operation. */ # define FPE_FLTINV FPE_FLTINV FPE_FLTSUB /* Subscript out of range. */ # define FPE_FLTSUB FPE_FLTSUB }; /* `si_code' values for SIGSEGV signal. */ enum { SEGV_MAPERR = 1, /* Address not mapped to object. */ # define SEGV_MAPERR SEGV_MAPERR SEGV_ACCERR, /* Invalid permissions for mapped object. */ # define SEGV_ACCERR SEGV_ACCERR SEGV_BNDERR, /* Bounds checking failure. */ # define SEGV_BNDERR SEGV_BNDERR SEGV_PKUERR /* Protection key checking failure. */ # define SEGV_PKUERR SEGV_PKUERR }; /* `si_code' values for SIGBUS signal. */ enum { BUS_ADRALN = 1, /* Invalid address alignment. */ # define BUS_ADRALN BUS_ADRALN BUS_ADRERR, /* Non-existant physical address. */ # define BUS_ADRERR BUS_ADRERR BUS_OBJERR, /* Object specific hardware error. */ # define BUS_OBJERR BUS_OBJERR BUS_MCEERR_AR, /* Hardware memory error: action required. */ # define BUS_MCEERR_AR BUS_MCEERR_AR BUS_MCEERR_AO /* Hardware memory error: action optional. */ # define BUS_MCEERR_AO BUS_MCEERR_AO }; # endif # ifdef __USE_XOPEN_EXTENDED /* `si_code' values for SIGTRAP signal. */ enum { TRAP_BRKPT = 1, /* Process breakpoint. */ # define TRAP_BRKPT TRAP_BRKPT TRAP_TRACE /* Process trace trap. */ # define TRAP_TRACE TRAP_TRACE }; # endif # if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* `si_code' values for SIGCHLD signal. */ enum { CLD_EXITED = 1, /* Child has exited. */ # define CLD_EXITED CLD_EXITED CLD_KILLED, /* Child was killed. */ # define CLD_KILLED CLD_KILLED CLD_DUMPED, /* Child terminated abnormally. */ # define CLD_DUMPED CLD_DUMPED CLD_TRAPPED, /* Traced child has trapped. */ # define CLD_TRAPPED CLD_TRAPPED CLD_STOPPED, /* Child has stopped. */ # define CLD_STOPPED CLD_STOPPED CLD_CONTINUED /* Stopped child has continued. */ # define CLD_CONTINUED CLD_CONTINUED }; /* `si_code' values for SIGPOLL signal. */ enum { POLL_IN = 1, /* Data input available. */ # define POLL_IN POLL_IN POLL_OUT, /* Output buffers available. */ # define POLL_OUT POLL_OUT POLL_MSG, /* Input message available. */ # define POLL_MSG POLL_MSG POLL_ERR, /* I/O error. */ # define POLL_ERR POLL_ERR POLL_PRI, /* High priority input available. */ # define POLL_PRI POLL_PRI POLL_HUP /* Device disconnected. */ # define POLL_HUP POLL_HUP }; # endif /* Architectures might also add architecture-specific constants. These are all considered GNU extensions. */ #ifdef __USE_GNU # include <bits/siginfo-consts-arch.h> #endif #endif bits/signalfd.h 0000644 00000002052 15063602063 0007445 0 ustar 00 /* Copyright (C) 2007-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SIGNALFD_H # error "Never use <bits/signalfd.h> directly; include <sys/signalfd.h> instead." #endif /* Flags for signalfd. */ enum { SFD_CLOEXEC = 02000000, #define SFD_CLOEXEC SFD_CLOEXEC SFD_NONBLOCK = 00004000 #define SFD_NONBLOCK SFD_NONBLOCK }; bits/signum-generic.h 0000644 00000010364 15063602063 0010577 0 ustar 00 /* Signal number constants. Generic template. Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGNUM_GENERIC_H #define _BITS_SIGNUM_GENERIC_H 1 #ifndef _SIGNAL_H #error "Never include <bits/signum-generic.h> directly; use <signal.h> instead." #endif /* Fake signal functions. */ #define SIG_ERR ((__sighandler_t) -1) /* Error return. */ #define SIG_DFL ((__sighandler_t) 0) /* Default action. */ #define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ #ifdef __USE_XOPEN # define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ #endif /* We define here all the signal names listed in POSIX (1003.1-2008); as of 1003.1-2013, no additional signals have been added by POSIX. We also define here signal names that historically exist in every real-world POSIX variant (e.g. SIGWINCH). Signals in the 1-15 range are defined with their historical numbers. For other signals, we use the BSD numbers. There are two unallocated signal numbers in the 1-31 range: 7 and 29. Signal number 0 is reserved for use as kill(pid, 0), to test whether a process exists without sending it a signal. */ /* ISO C99 signals. */ #define SIGINT 2 /* Interactive attention signal. */ #define SIGILL 4 /* Illegal instruction. */ #define SIGABRT 6 /* Abnormal termination. */ #define SIGFPE 8 /* Erroneous arithmetic operation. */ #define SIGSEGV 11 /* Invalid access to storage. */ #define SIGTERM 15 /* Termination request. */ /* Historical signals specified by POSIX. */ #define SIGHUP 1 /* Hangup. */ #define SIGQUIT 3 /* Quit. */ #define SIGTRAP 5 /* Trace/breakpoint trap. */ #define SIGKILL 9 /* Killed. */ #define SIGBUS 10 /* Bus error. */ #define SIGSYS 12 /* Bad system call. */ #define SIGPIPE 13 /* Broken pipe. */ #define SIGALRM 14 /* Alarm clock. */ /* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */ #define SIGURG 16 /* Urgent data is available at a socket. */ #define SIGSTOP 17 /* Stop, unblockable. */ #define SIGTSTP 18 /* Keyboard stop. */ #define SIGCONT 19 /* Continue. */ #define SIGCHLD 20 /* Child terminated or stopped. */ #define SIGTTIN 21 /* Background read from control terminal. */ #define SIGTTOU 22 /* Background write to control terminal. */ #define SIGPOLL 23 /* Pollable event occurred (System V). */ #define SIGXCPU 24 /* CPU time limit exceeded. */ #define SIGXFSZ 25 /* File size limit exceeded. */ #define SIGVTALRM 26 /* Virtual timer expired. */ #define SIGPROF 27 /* Profiling timer expired. */ #define SIGUSR1 30 /* User-defined signal 1. */ #define SIGUSR2 31 /* User-defined signal 2. */ /* Nonstandard signals found in all modern POSIX systems (including both BSD and Linux). */ #define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ /* Archaic names for compatibility. */ #define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */ #define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */ #define SIGCLD SIGCHLD /* Old System V name */ /* Not all systems support real-time signals. bits/signum.h indicates that they are supported by overriding __SIGRTMAX to a value greater than __SIGRTMIN. These constants give the kernel-level hard limits, but some real-time signals may be used internally by glibc. Do not use these constants in application code; use SIGRTMIN and SIGRTMAX (defined in signal.h) instead. */ #define __SIGRTMIN 32 #define __SIGRTMAX __SIGRTMIN /* Biggest signal number + 1 (including real-time signals). */ #define _NSIG (__SIGRTMAX + 1) #endif /* bits/signum-generic.h. */ bits/signum.h 0000644 00000003141 15063602063 0007160 0 ustar 00 /* Signal number definitions. Linux version. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 #ifndef _SIGNAL_H #error "Never include <bits/signum.h> directly; use <signal.h> instead." #endif #include <bits/signum-generic.h> /* Adjustments and additions to the signal number constants for most Linux systems. */ #define SIGSTKFLT 16 /* Stack fault (obsolete). */ #define SIGPWR 30 /* Power failure imminent. */ #undef SIGBUS #define SIGBUS 7 #undef SIGUSR1 #define SIGUSR1 10 #undef SIGUSR2 #define SIGUSR2 12 #undef SIGCHLD #define SIGCHLD 17 #undef SIGCONT #define SIGCONT 18 #undef SIGSTOP #define SIGSTOP 19 #undef SIGTSTP #define SIGTSTP 20 #undef SIGURG #define SIGURG 23 #undef SIGPOLL #define SIGPOLL 29 #undef SIGSYS #define SIGSYS 31 #undef __SIGRTMAX #define __SIGRTMAX 64 #endif /* <signal.h> included. */ bits/sigstack.h 0000644 00000002217 15063602063 0007471 0 ustar 00 /* sigstack, sigaltstack definitions. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGSTACK_H #define _BITS_SIGSTACK_H 1 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H # error "Never include this file directly. Use <signal.h> instead" #endif /* Minimum stack size for a signal handler. */ #define MINSIGSTKSZ 2048 /* System default stack size. */ #define SIGSTKSZ 8192 #endif /* bits/sigstack.h */ bits/sigthread.h 0000644 00000003233 15063602063 0007632 0 ustar 00 /* Signal handling function for threaded programs. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SIGTHREAD_H #define _BITS_SIGTHREAD_H 1 #if !defined _SIGNAL_H && !defined _PTHREAD_H # error "Never include this file directly. Use <signal.h> instead" #endif /* Functions for handling signals. */ #include <bits/types/__sigset_t.h> /* Modify the signal mask for the calling thread. The arguments have the same meaning as for sigprocmask(2). */ extern int pthread_sigmask (int __how, const __sigset_t *__restrict __newmask, __sigset_t *__restrict __oldmask)__THROW; /* Send signal SIGNO to the given thread. */ extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; #ifdef __USE_GNU /* Queue signal and data to a thread. */ extern int pthread_sigqueue (pthread_t __threadid, int __signo, const union sigval __value) __THROW; #endif #endif /* bits/sigthread.h */ bits/sockaddr.h 0000644 00000002751 15063602063 0007456 0 ustar 00 /* Definition of struct sockaddr_* common members and sizes, generic version. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <sys/socket.h> instead. */ #ifndef _BITS_SOCKADDR_H #define _BITS_SOCKADDR_H 1 /* POSIX.1g specifies this type name for the `sa_family' member. */ typedef unsigned short int sa_family_t; /* This macro is used to declare the initial common members of the data types used for socket addresses, `struct sockaddr', `struct sockaddr_in', `struct sockaddr_un', etc. */ #define __SOCKADDR_COMMON(sa_prefix) \ sa_family_t sa_prefix##family #define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int)) /* Size of struct sockaddr_storage. */ #define _SS_SIZE 128 #endif /* bits/sockaddr.h */ bits/socket.h 0000644 00000036312 15063602063 0007154 0 ustar 00 /* System-specific socket constants and types. Linux version. Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __BITS_SOCKET_H #define __BITS_SOCKET_H #ifndef _SYS_SOCKET_H # error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." #endif #define __need_size_t #include <stddef.h> #include <sys/types.h> /* Type for length arguments in socket calls. */ #ifndef __socklen_t_defined typedef __socklen_t socklen_t; # define __socklen_t_defined #endif /* Get the architecture-dependent definition of enum __socket_type. */ #include <bits/socket_type.h> /* Protocol families. */ #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */ #define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_AX25 3 /* Amateur Radio AX.25. */ #define PF_IPX 4 /* Novell Internet Protocol. */ #define PF_APPLETALK 5 /* Appletalk DDP. */ #define PF_NETROM 6 /* Amateur radio NetROM. */ #define PF_BRIDGE 7 /* Multiprotocol bridge. */ #define PF_ATMPVC 8 /* ATM PVCs. */ #define PF_X25 9 /* Reserved for X.25 project. */ #define PF_INET6 10 /* IP version 6. */ #define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ #define PF_DECnet 12 /* Reserved for DECnet project. */ #define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ #define PF_SECURITY 14 /* Security callback pseudo AF. */ #define PF_KEY 15 /* PF_KEY key management API. */ #define PF_NETLINK 16 #define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ #define PF_PACKET 17 /* Packet family. */ #define PF_ASH 18 /* Ash. */ #define PF_ECONET 19 /* Acorn Econet. */ #define PF_ATMSVC 20 /* ATM SVCs. */ #define PF_RDS 21 /* RDS sockets. */ #define PF_SNA 22 /* Linux SNA Project */ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ #define PF_LLC 26 /* Linux LLC. */ #define PF_IB 27 /* Native InfiniBand address. */ #define PF_MPLS 28 /* MPLS. */ #define PF_CAN 29 /* Controller Area Network. */ #define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_IUCV 32 /* IUCV sockets. */ #define PF_RXRPC 33 /* RxRPC sockets. */ #define PF_ISDN 34 /* mISDN sockets. */ #define PF_PHONET 35 /* Phonet sockets. */ #define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ #define PF_CAIF 37 /* CAIF sockets. */ #define PF_ALG 38 /* Algorithm sockets. */ #define PF_NFC 39 /* NFC sockets. */ #define PF_VSOCK 40 /* vSockets. */ #define PF_KCM 41 /* Kernel Connection Multiplexor. */ #define PF_QIPCRTR 42 /* Qualcomm IPC Router. */ #define PF_SMC 43 /* SMC sockets. */ #define PF_XDP 44 /* XDP sockets. */ #define PF_MAX 45 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC #define AF_LOCAL PF_LOCAL #define AF_UNIX PF_UNIX #define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_AX25 PF_AX25 #define AF_IPX PF_IPX #define AF_APPLETALK PF_APPLETALK #define AF_NETROM PF_NETROM #define AF_BRIDGE PF_BRIDGE #define AF_ATMPVC PF_ATMPVC #define AF_X25 PF_X25 #define AF_INET6 PF_INET6 #define AF_ROSE PF_ROSE #define AF_DECnet PF_DECnet #define AF_NETBEUI PF_NETBEUI #define AF_SECURITY PF_SECURITY #define AF_KEY PF_KEY #define AF_NETLINK PF_NETLINK #define AF_ROUTE PF_ROUTE #define AF_PACKET PF_PACKET #define AF_ASH PF_ASH #define AF_ECONET PF_ECONET #define AF_ATMSVC PF_ATMSVC #define AF_RDS PF_RDS #define AF_SNA PF_SNA #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE #define AF_LLC PF_LLC #define AF_IB PF_IB #define AF_MPLS PF_MPLS #define AF_CAN PF_CAN #define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH #define AF_IUCV PF_IUCV #define AF_RXRPC PF_RXRPC #define AF_ISDN PF_ISDN #define AF_PHONET PF_PHONET #define AF_IEEE802154 PF_IEEE802154 #define AF_CAIF PF_CAIF #define AF_ALG PF_ALG #define AF_NFC PF_NFC #define AF_VSOCK PF_VSOCK #define AF_KCM PF_KCM #define AF_QIPCRTR PF_QIPCRTR #define AF_SMC PF_SMC #define AF_XDP PF_XDP #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. XXX These definitions also should go into the appropriate headers as far as they are available. */ #define SOL_RAW 255 #define SOL_DECNET 261 #define SOL_X25 262 #define SOL_PACKET 263 #define SOL_ATM 264 /* ATM layer (cell level). */ #define SOL_AAL 265 /* ATM Adaption Layer (packet level). */ #define SOL_IRDA 266 #define SOL_NETBEUI 267 #define SOL_LLC 268 #define SOL_DCCP 269 #define SOL_NETLINK 270 #define SOL_TIPC 271 #define SOL_RXRPC 272 #define SOL_PPPOL2TP 273 #define SOL_BLUETOOTH 274 #define SOL_PNPIPE 275 #define SOL_RDS 276 #define SOL_IUCV 277 #define SOL_CAIF 278 #define SOL_ALG 279 #define SOL_NFC 280 #define SOL_KCM 281 #define SOL_TLS 282 #define SOL_XDP 283 /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* Get the definition of the macro to define the common sockaddr members. */ #include <bits/sockaddr.h> /* Structure describing a generic socket address. */ struct sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ }; /* Structure large enough to hold any socket address (with the historical exception of AF_UNIX). */ #define __ss_aligntype unsigned long int #define _SS_PADSIZE \ (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) struct sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ char __ss_padding[_SS_PADSIZE]; __ss_aligntype __ss_align; /* Force desired alignment. */ }; /* Bits in the FLAGS argument to `send', `recv', et al. */ enum { MSG_OOB = 0x01, /* Process out-of-band data. */ #define MSG_OOB MSG_OOB MSG_PEEK = 0x02, /* Peek at incoming messages. */ #define MSG_PEEK MSG_PEEK MSG_DONTROUTE = 0x04, /* Don't use local routing. */ #define MSG_DONTROUTE MSG_DONTROUTE #ifdef __USE_GNU /* DECnet uses a different name. */ MSG_TRYHARD = MSG_DONTROUTE, # define MSG_TRYHARD MSG_DONTROUTE #endif MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ #define MSG_CTRUNC MSG_CTRUNC MSG_PROXY = 0x10, /* Supply or ask second address. */ #define MSG_PROXY MSG_PROXY MSG_TRUNC = 0x20, #define MSG_TRUNC MSG_TRUNC MSG_DONTWAIT = 0x40, /* Nonblocking IO. */ #define MSG_DONTWAIT MSG_DONTWAIT MSG_EOR = 0x80, /* End of record. */ #define MSG_EOR MSG_EOR MSG_WAITALL = 0x100, /* Wait for a full request. */ #define MSG_WAITALL MSG_WAITALL MSG_FIN = 0x200, #define MSG_FIN MSG_FIN MSG_SYN = 0x400, #define MSG_SYN MSG_SYN MSG_CONFIRM = 0x800, /* Confirm path validity. */ #define MSG_CONFIRM MSG_CONFIRM MSG_RST = 0x1000, #define MSG_RST MSG_RST MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */ #define MSG_ERRQUEUE MSG_ERRQUEUE MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */ #define MSG_NOSIGNAL MSG_NOSIGNAL MSG_MORE = 0x8000, /* Sender will send more. */ #define MSG_MORE MSG_MORE MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ #define MSG_WAITFORONE MSG_WAITFORONE MSG_BATCH = 0x40000, /* sendmmsg: more messages coming. */ #define MSG_BATCH MSG_BATCH MSG_ZEROCOPY = 0x4000000, /* Use user data in kernel path. */ #define MSG_ZEROCOPY MSG_ZEROCOPY MSG_FASTOPEN = 0x20000000, /* Send data in TCP SYN. */ #define MSG_FASTOPEN MSG_FASTOPEN MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file descriptor received through SCM_RIGHTS. */ #define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC }; /* Structure describing messages sent by `sendmsg' and received by `recvmsg'. */ struct msghdr { void *msg_name; /* Address to send to/receive from. */ socklen_t msg_namelen; /* Length of address data. */ struct iovec *msg_iov; /* Vector of data to send/receive into. */ size_t msg_iovlen; /* Number of elements in the vector. */ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ size_t msg_controllen; /* Ancillary data buffer length. !! The type should be socklen_t but the definition of the kernel is incompatible with this. */ int msg_flags; /* Flags on received message. */ }; /* Structure used for storage of ancillary data object information. */ struct cmsghdr { size_t cmsg_len; /* Length of data in cmsg_data plus length of cmsghdr structure. !! The type should be socklen_t but the definition of the kernel is incompatible with this. */ int cmsg_level; /* Originating protocol. */ int cmsg_type; /* Protocol specific type. */ #if __glibc_c99_flexarr_available __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ #endif }; /* Ancillary data object manipulation macros. */ #if __glibc_c99_flexarr_available # define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) #else # define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) #endif #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) #define CMSG_FIRSTHDR(mhdr) \ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ & (size_t) ~(sizeof (size_t) - 1)) #define CMSG_SPACE(len) (CMSG_ALIGN (len) \ + CMSG_ALIGN (sizeof (struct cmsghdr))) #define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) /* Given a length, return the additional padding necessary such that len + __CMSG_PADDING(len) == CMSG_ALIGN (len). */ #define __CMSG_PADDING(len) ((sizeof (size_t) \ - ((len) & (sizeof (size_t) - 1))) \ & (sizeof (size_t) - 1)) extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW; #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE # define _EXTERN_INLINE __extern_inline # endif _EXTERN_INLINE struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) { /* We may safely assume that __cmsg lies between __mhdr->msg_control and __mhdr->msg_controllen because the user is required to obtain the first cmsg via CMSG_FIRSTHDR, set its length, then obtain subsequent cmsgs via CMSG_NXTHDR, setting lengths along the way. However, we don't yet trust the value of __cmsg->cmsg_len and therefore do not use it in any pointer arithmetic until we check its value. */ unsigned char * __msg_control_ptr = (unsigned char *) __mhdr->msg_control; unsigned char * __cmsg_ptr = (unsigned char *) __cmsg; size_t __size_needed = sizeof (struct cmsghdr) + __CMSG_PADDING (__cmsg->cmsg_len); /* The current header is malformed, too small to be a full header. */ if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) return (struct cmsghdr *) 0; /* There isn't enough space between __cmsg and the end of the buffer to hold the current cmsg *and* the next one. */ if (((size_t) (__msg_control_ptr + __mhdr->msg_controllen - __cmsg_ptr) < __size_needed) || ((size_t) (__msg_control_ptr + __mhdr->msg_controllen - __cmsg_ptr - __size_needed) < __cmsg->cmsg_len)) return (struct cmsghdr *) 0; /* Now, we trust cmsg_len and can use it to find the next header. */ __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)); return __cmsg; } #endif /* Use `extern inline'. */ /* Socket level message types. This must match the definitions in <linux/socket.h>. */ enum { SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ #define SCM_RIGHTS SCM_RIGHTS #ifdef __USE_GNU , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif }; #ifdef __USE_GNU /* User visible structure for SCM_CREDENTIALS message */ struct ucred { pid_t pid; /* PID of sending process. */ uid_t uid; /* UID of sending process. */ gid_t gid; /* GID of sending process. */ }; #endif /* Ugly workaround for unclean kernel headers. */ #ifndef __USE_MISC # ifndef FIOGETOWN # define __SYS_SOCKET_H_undef_FIOGETOWN # endif # ifndef FIOSETOWN # define __SYS_SOCKET_H_undef_FIOSETOWN # endif # ifndef SIOCATMARK # define __SYS_SOCKET_H_undef_SIOCATMARK # endif # ifndef SIOCGPGRP # define __SYS_SOCKET_H_undef_SIOCGPGRP # endif # ifndef SIOCGSTAMP # define __SYS_SOCKET_H_undef_SIOCGSTAMP # endif # ifndef SIOCGSTAMPNS # define __SYS_SOCKET_H_undef_SIOCGSTAMPNS # endif # ifndef SIOCSPGRP # define __SYS_SOCKET_H_undef_SIOCSPGRP # endif #endif #ifndef IOCSIZE_MASK # define __SYS_SOCKET_H_undef_IOCSIZE_MASK #endif #ifndef IOCSIZE_SHIFT # define __SYS_SOCKET_H_undef_IOCSIZE_SHIFT #endif #ifndef IOC_IN # define __SYS_SOCKET_H_undef_IOC_IN #endif #ifndef IOC_INOUT # define __SYS_SOCKET_H_undef_IOC_INOUT #endif #ifndef IOC_OUT # define __SYS_SOCKET_H_undef_IOC_OUT #endif /* Get socket manipulation related informations from kernel headers. */ #include <asm/socket.h> #ifndef __USE_MISC # ifdef __SYS_SOCKET_H_undef_FIOGETOWN # undef __SYS_SOCKET_H_undef_FIOGETOWN # undef FIOGETOWN # endif # ifdef __SYS_SOCKET_H_undef_FIOSETOWN # undef __SYS_SOCKET_H_undef_FIOSETOWN # undef FIOSETOWN # endif # ifdef __SYS_SOCKET_H_undef_SIOCATMARK # undef __SYS_SOCKET_H_undef_SIOCATMARK # undef SIOCATMARK # endif # ifdef __SYS_SOCKET_H_undef_SIOCGPGRP # undef __SYS_SOCKET_H_undef_SIOCGPGRP # undef SIOCGPGRP # endif # ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP # undef __SYS_SOCKET_H_undef_SIOCGSTAMP # undef SIOCGSTAMP # endif # ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS # undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS # undef SIOCGSTAMPNS # endif # ifdef __SYS_SOCKET_H_undef_SIOCSPGRP # undef __SYS_SOCKET_H_undef_SIOCSPGRP # undef SIOCSPGRP # endif #endif #ifdef __SYS_SOCKET_H_undef_IOCSIZE_MASK # undef __SYS_SOCKET_H_undef_IOCSIZE_MASK # undef IOCSIZE_MASK #endif #ifdef __SYS_SOCKET_H_undef_IOCSIZE_SHIFT # undef __SYS_SOCKET_H_undef_IOCSIZE_SHIFT # undef IOCSIZE_SHIFT #endif #ifdef __SYS_SOCKET_H_undef_IOC_IN # undef __SYS_SOCKET_H_undef_IOC_IN # undef IOC_IN #endif #ifdef __SYS_SOCKET_H_undef_IOC_INOUT # undef __SYS_SOCKET_H_undef_IOC_INOUT # undef IOC_INOUT #endif #ifdef __SYS_SOCKET_H_undef_IOC_OUT # undef __SYS_SOCKET_H_undef_IOC_OUT # undef IOC_OUT #endif /* Structure used to manipulate the SO_LINGER option. */ struct linger { int l_onoff; /* Nonzero to linger on close. */ int l_linger; /* Time to linger. */ }; #endif /* bits/socket.h */ bits/socket2.h 0000644 00000005734 15063602063 0007242 0 ustar 00 /* Checking macros for socket functions. Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SOCKET_H # error "Never include <bits/socket2.h> directly; use <sys/socket.h> instead." #endif extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen, int __flags); extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n, int __flags), recv); extern ssize_t __REDIRECT (__recv_chk_warn, (int __fd, void *__buf, size_t __n, size_t __buflen, int __flags), __recv_chk) __warnattr ("recv called with bigger length than size of destination " "buffer"); __fortify_function ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) { size_t sz = __glibc_objsize0 (__buf); if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) return __recv_alias (__fd, __buf, __n, __flags); if (__glibc_unsafe_len (__n, sizeof (char), sz)) return __recv_chk_warn (__fd, __buf, __n, sz, __flags); return __recv_chk (__fd, __buf, __n, sz, __flags); } extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, size_t __buflen, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); extern ssize_t __REDIRECT (__recvfrom_alias, (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len), recvfrom); extern ssize_t __REDIRECT (__recvfrom_chk_warn, (int __fd, void *__restrict __buf, size_t __n, size_t __buflen, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len), __recvfrom_chk) __warnattr ("recvfrom called with bigger length than size of " "destination buffer"); __fortify_function ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { size_t sz = __glibc_objsize0 (__buf); if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); if (__glibc_unsafe_len (__n, sizeof (char), sz)) return __recvfrom_chk_warn (__fd, __buf, __n, sz, __flags, __addr, __addr_len); return __recvfrom_chk (__fd, __buf, __n, sz, __flags, __addr, __addr_len); } bits/socket_type.h 0000644 00000004247 15063602063 0010217 0 ustar 00 /* Define enum __socket_type for generic Linux. Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SOCKET_H # error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead." #endif /* Types of sockets. */ enum __socket_type { SOCK_STREAM = 1, /* Sequenced, reliable, connection-based byte streams. */ #define SOCK_STREAM SOCK_STREAM SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams of fixed maximum length. */ #define SOCK_DGRAM SOCK_DGRAM SOCK_RAW = 3, /* Raw protocol interface. */ #define SOCK_RAW SOCK_RAW SOCK_RDM = 4, /* Reliably-delivered messages. */ #define SOCK_RDM SOCK_RDM SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, datagrams of fixed maximum length. */ #define SOCK_SEQPACKET SOCK_SEQPACKET SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ #define SOCK_DCCP SOCK_DCCP SOCK_PACKET = 10, /* Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level. */ #define SOCK_PACKET SOCK_PACKET /* Flags to be ORed into the type parameter of socket and socketpair and used for the flags parameter of paccept. */ SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the new descriptor(s). */ #define SOCK_CLOEXEC SOCK_CLOEXEC SOCK_NONBLOCK = 00004000 /* Atomically mark descriptor(s) as non-blocking. */ #define SOCK_NONBLOCK SOCK_NONBLOCK }; bits/ss_flags.h 0000644 00000002243 15063602063 0007461 0 ustar 00 /* ss_flags values for stack_t. Linux version. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SS_FLAGS_H #define _BITS_SS_FLAGS_H 1 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H # error "Never include this file directly. Use <signal.h> instead" #endif /* Possible values for `ss_flags'. */ enum { SS_ONSTACK = 1, #define SS_ONSTACK SS_ONSTACK SS_DISABLE #define SS_DISABLE SS_DISABLE }; #endif /* bits/ss_flags.h */ bits/stab.def 0000644 00000021517 15063602063 0007125 0 ustar 00 /* Table of DBX symbol codes for the GNU system. Copyright (C) 1988, 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This contains contribution from Cygnus Support. */ /* Global variable. Only the name is significant. To find the address, look in the corresponding external symbol. */ __define_stab (N_GSYM, 0x20, "GSYM") /* Function name for BSD Fortran. Only the name is significant. To find the address, look in the corresponding external symbol. */ __define_stab (N_FNAME, 0x22, "FNAME") /* Function name or text-segment variable for C. Value is its address. Desc is supposedly starting line number, but GCC doesn't set it and DBX seems not to miss it. */ __define_stab (N_FUN, 0x24, "FUN") /* Data-segment variable with internal linkage. Value is its address. "Static Sym". */ __define_stab (N_STSYM, 0x26, "STSYM") /* BSS-segment variable with internal linkage. Value is its address. */ __define_stab (N_LCSYM, 0x28, "LCSYM") /* Name of main routine. Only the name is significant. This is not used in C. */ __define_stab (N_MAIN, 0x2a, "MAIN") /* Global symbol in Pascal. Supposedly the value is its line number; I'm skeptical. */ __define_stab (N_PC, 0x30, "PC") /* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */ __define_stab (N_NSYMS, 0x32, "NSYMS") /* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */ __define_stab (N_NOMAP, 0x34, "NOMAP") /* New stab from Solaris. I don't know what it means, but it don't seem to contain useful information. */ __define_stab (N_OBJ, 0x38, "OBJ") /* New stab from Solaris. I don't know what it means, but it don't seem to contain useful information. Possibly related to the optimization flags used in this module. */ __define_stab (N_OPT, 0x3c, "OPT") /* Register variable. Value is number of register. */ __define_stab (N_RSYM, 0x40, "RSYM") /* Modula-2 compilation unit. Can someone say what info it contains? */ __define_stab (N_M2C, 0x42, "M2C") /* Line number in text segment. Desc is the line number; value is corresponding address. */ __define_stab (N_SLINE, 0x44, "SLINE") /* Similar, for data segment. */ __define_stab (N_DSLINE, 0x46, "DSLINE") /* Similar, for bss segment. */ __define_stab (N_BSLINE, 0x48, "BSLINE") /* Sun's source-code browser stabs. ?? Don't know what the fields are. Supposedly the field is "path to associated .cb file". THIS VALUE OVERLAPS WITH N_BSLINE! */ __define_stab (N_BROWS, 0x48, "BROWS") /* GNU Modula-2 definition module dependency. Value is the modification time of the definition file. Other is non-zero if it is imported with the GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there are enough empty fields? */ __define_stab(N_DEFD, 0x4a, "DEFD") /* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2 and one is for C++. Still,... */ /* GNU C++ exception variable. Name is variable name. */ __define_stab (N_EHDECL, 0x50, "EHDECL") /* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */ __define_stab (N_MOD2, 0x50, "MOD2") /* GNU C++ `catch' clause. Value is its address. Desc is nonzero if this entry is immediately followed by a CAUGHT stab saying what exception was caught. Multiple CAUGHT stabs means that multiple exceptions can be caught here. If Desc is 0, it means all exceptions are caught here. */ __define_stab (N_CATCH, 0x54, "CATCH") /* Structure or union element. Value is offset in the structure. */ __define_stab (N_SSYM, 0x60, "SSYM") /* Name of main source file. Value is starting text address of the compilation. */ __define_stab (N_SO, 0x64, "SO") /* Automatic variable in the stack. Value is offset from frame pointer. Also used for type descriptions. */ __define_stab (N_LSYM, 0x80, "LSYM") /* Beginning of an include file. Only Sun uses this. In an object file, only the name is significant. The Sun linker puts data into some of the other fields. */ __define_stab (N_BINCL, 0x82, "BINCL") /* Name of sub-source file (#include file). Value is starting text address of the compilation. */ __define_stab (N_SOL, 0x84, "SOL") /* Parameter variable. Value is offset from argument pointer. (On most machines the argument pointer is the same as the frame pointer. */ __define_stab (N_PSYM, 0xa0, "PSYM") /* End of an include file. No name. This and N_BINCL act as brackets around the file's output. In an object file, there is no significant data in this entry. The Sun linker puts data into some of the fields. */ __define_stab (N_EINCL, 0xa2, "EINCL") /* Alternate entry point. Value is its address. */ __define_stab (N_ENTRY, 0xa4, "ENTRY") /* Beginning of lexical block. The desc is the nesting level in lexical blocks. The value is the address of the start of the text for the block. The variables declared inside the block *precede* the N_LBRAC symbol. */ __define_stab (N_LBRAC, 0xc0, "LBRAC") /* Place holder for deleted include file. Replaces a N_BINCL and everything up to the corresponding N_EINCL. The Sun linker generates these when it finds multiple identical copies of the symbols from an include file. This appears only in output from the Sun linker. */ __define_stab (N_EXCL, 0xc2, "EXCL") /* Modula-2 scope information. Can someone say what info it contains? */ __define_stab (N_SCOPE, 0xc4, "SCOPE") /* End of a lexical block. Desc matches the N_LBRAC's desc. The value is the address of the end of the text for the block. */ __define_stab (N_RBRAC, 0xe0, "RBRAC") /* Begin named common block. Only the name is significant. */ __define_stab (N_BCOMM, 0xe2, "BCOMM") /* End named common block. Only the name is significant (and it should match the N_BCOMM). */ __define_stab (N_ECOMM, 0xe4, "ECOMM") /* End common (local name): value is address. I'm not sure how this is used. */ __define_stab (N_ECOML, 0xe8, "ECOML") /* These STAB's are used on Gould systems for Non-Base register symbols or something like that. FIXME. I have assigned the values at random since I don't have a Gould here. Fixups from Gould folk welcome... */ __define_stab (N_NBTEXT, 0xF0, "NBTEXT") __define_stab (N_NBDATA, 0xF2, "NBDATA") __define_stab (N_NBBSS, 0xF4, "NBBSS") __define_stab (N_NBSTS, 0xF6, "NBSTS") __define_stab (N_NBLCS, 0xF8, "NBLCS") /* Second symbol entry containing a length-value for the preceding entry. The value is the length. */ __define_stab (N_LENG, 0xfe, "LENG") /* The above information, in matrix format. STAB MATRIX _________________________________________________ | 00 - 1F are not dbx stab symbols | | In most cases, the low bit is the EXTernal bit| | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA | | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT | | 08 BSS | 0A INDR | 0C FN_SEQ | 0E | | 09 |EXT | 0B | 0D | 0F | | 10 | 12 COMM | 14 SETA | 16 SETT | | 11 | 13 | 15 | 17 | | 18 SETD | 1A SETB | 1C SETV | 1E WARNING| | 19 | 1B | 1D | 1F FN | |_______________________________________________| | Debug entries with bit 01 set are unused. | | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM | | 28 LCSYM | 2A MAIN | 2C | 2E | | 30 PC | 32 NSYMS | 34 NOMAP | 36 | | 38 OBJ | 3A | 3C OPT | 3E | | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE | | 48 BSLINE*| 4A DEFD | 4C | 4E | | 50 EHDECL*| 52 | 54 CATCH | 56 | | 58 | 5A | 5C | 5E | | 60 SSYM | 62 | 64 SO | 66 | | 68 | 6A | 6C | 6E | | 70 | 72 | 74 | 76 | | 78 | 7A | 7C | 7E | | 80 LSYM | 82 BINCL | 84 SOL | 86 | | 88 | 8A | 8C | 8E | | 90 | 92 | 94 | 96 | | 98 | 9A | 9C | 9E | | A0 PSYM | A2 EINCL | A4 ENTRY | A6 | | A8 | AA | AC | AE | | B0 | B2 | B4 | B6 | | B8 | BA | BC | BE | | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 | | C8 | CA | CC | CE | | D0 | D2 | D4 | D6 | | D8 | DA | DC | DE | | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 | | E8 ECOML | EA | EC | EE | | F0 | F2 | F4 | F6 | | F8 | FA | FC | FE LENG | +-----------------------------------------------+ * 50 EHDECL is also MOD2. * 48 BSLINE is also BROWS. */ bits/stat.h 0000644 00000016703 15063602063 0006641 0 ustar 00 /* Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SYS_STAT_H && !defined _FCNTL_H # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." #endif #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 /* Versions of the `struct stat' data structure. */ #ifndef __x86_64__ # define _STAT_VER_LINUX_OLD 1 # define _STAT_VER_KERNEL 1 # define _STAT_VER_SVR4 2 # define _STAT_VER_LINUX 3 /* i386 versions of the `xmknod' interface. */ # define _MKNOD_VER_LINUX 1 # define _MKNOD_VER_SVR4 2 # define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ #else # define _STAT_VER_KERNEL 0 # define _STAT_VER_LINUX 1 /* x86-64 versions of the `xmknod' interface. */ # define _MKNOD_VER_LINUX 0 #endif #define _STAT_VER _STAT_VER_LINUX struct stat { __dev_t st_dev; /* Device. */ #ifndef __x86_64__ unsigned short int __pad1; #endif #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ #else __ino_t __st_ino; /* 32bit file serial number. */ #endif #ifndef __x86_64__ __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ #else __nlink_t st_nlink; /* Link count. */ __mode_t st_mode; /* File mode. */ #endif __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ #ifdef __x86_64__ int __pad0; #endif __dev_t st_rdev; /* Device number, if device. */ #ifndef __x86_64__ unsigned short int __pad2; #endif #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ #else __off64_t st_size; /* Size of file, in bytes. */ #endif __blksize_t st_blksize; /* Optimal block size for I/O. */ #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif #ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the identifier 'timespec' to appear in the <sys/stat.h> header. Therefore we have to handle the use of this header in strictly standard-compliant sources special. */ struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ # define st_atime st_atim.tv_sec /* Backward compatibility. */ # define st_mtime st_mtim.tv_sec # define st_ctime st_ctim.tv_sec #else __time_t st_atime; /* Time of last access. */ __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ #endif #ifdef __x86_64__ __syscall_slong_t __glibc_reserved[3]; #else # ifndef __USE_FILE_OFFSET64 unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; # else __ino64_t st_ino; /* File serial number. */ # endif #endif }; #ifdef __USE_LARGEFILE64 /* Note stat64 has the same shape as stat for x86-64. */ struct stat64 { __dev_t st_dev; /* Device. */ # ifdef __x86_64__ __ino64_t st_ino; /* File serial number. */ __nlink_t st_nlink; /* Link count. */ __mode_t st_mode; /* File mode. */ # else unsigned int __pad1; __ino_t __st_ino; /* 32bit file serial number. */ __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ # endif __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ # ifdef __x86_64__ int __pad0; __dev_t st_rdev; /* Device number, if device. */ __off_t st_size; /* Size of file, in bytes. */ # else __dev_t st_rdev; /* Device number, if device. */ unsigned int __pad2; __off64_t st_size; /* Size of file, in bytes. */ # endif __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the identifier 'timespec' to appear in the <sys/stat.h> header. Therefore we have to handle the use of this header in strictly standard-compliant sources special. */ struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ # else __time_t st_atime; /* Time of last access. */ __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ # endif # ifdef __x86_64__ __syscall_slong_t __glibc_reserved[3]; # else __ino64_t st_ino; /* File serial number. */ # endif }; #endif /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC /* Encoding of the file mode. */ #define __S_IFMT 0170000 /* These bits determine file type. */ /* File types. */ #define __S_IFDIR 0040000 /* Directory. */ #define __S_IFCHR 0020000 /* Character device. */ #define __S_IFBLK 0060000 /* Block device. */ #define __S_IFREG 0100000 /* Regular file. */ #define __S_IFIFO 0010000 /* FIFO. */ #define __S_IFLNK 0120000 /* Symbolic link. */ #define __S_IFSOCK 0140000 /* Socket. */ /* POSIX.1b objects. Note that these macros always evaluate to zero. But they do it by enforcing the correct use of the macros. */ #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) /* Protection bits. */ #define __S_ISUID 04000 /* Set user ID on execution. */ #define __S_ISGID 02000 /* Set group ID on execution. */ #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ #define __S_IREAD 0400 /* Read by owner. */ #define __S_IWRITE 0200 /* Write by owner. */ #define __S_IEXEC 0100 /* Execute by owner. */ #ifdef __USE_ATFILE # define UTIME_NOW ((1l << 30) - 1l) # define UTIME_OMIT ((1l << 30) - 2l) #endif #endif /* bits/stat.h */ bits/statfs.h 0000644 00000003574 15063602063 0007174 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATFS_H # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." #endif #include <bits/types.h> struct statfs { __fsword_t f_type; __fsword_t f_bsize; #ifndef __USE_FILE_OFFSET64 __fsblkcnt_t f_blocks; __fsblkcnt_t f_bfree; __fsblkcnt_t f_bavail; __fsfilcnt_t f_files; __fsfilcnt_t f_ffree; #else __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; #endif __fsid_t f_fsid; __fsword_t f_namelen; __fsword_t f_frsize; __fsword_t f_flags; __fsword_t f_spare[4]; }; #ifdef __USE_LARGEFILE64 struct statfs64 { __fsword_t f_type; __fsword_t f_bsize; __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsid_t f_fsid; __fsword_t f_namelen; __fsword_t f_frsize; __fsword_t f_flags; __fsword_t f_spare[4]; }; #endif /* Tell code we have these members. */ #define _STATFS_F_NAMELEN #define _STATFS_F_FRSIZE #define _STATFS_F_FLAGS bits/statvfs.h 0000644 00000006536 15063602063 0007363 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STATVFS_H # error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead." #endif #include <bits/types.h> /* For __fsblkcnt_t and __fsfilcnt_t. */ #if (__WORDSIZE == 32 \ && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) #define _STATVFSBUF_F_UNUSED #endif struct statvfs { unsigned long int f_bsize; unsigned long int f_frsize; #ifndef __USE_FILE_OFFSET64 __fsblkcnt_t f_blocks; __fsblkcnt_t f_bfree; __fsblkcnt_t f_bavail; __fsfilcnt_t f_files; __fsfilcnt_t f_ffree; __fsfilcnt_t f_favail; #else __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsfilcnt64_t f_favail; #endif unsigned long int f_fsid; #ifdef _STATVFSBUF_F_UNUSED int __f_unused; #endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; }; #ifdef __USE_LARGEFILE64 struct statvfs64 { unsigned long int f_bsize; unsigned long int f_frsize; __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsfilcnt64_t f_favail; unsigned long int f_fsid; #ifdef _STATVFSBUF_F_UNUSED int __f_unused; #endif unsigned long int f_flag; unsigned long int f_namemax; int __f_spare[6]; }; #endif /* Definitions for the flag in `f_flag'. These definitions should be kept in sync with the definitions in <sys/mount.h>. */ enum { ST_RDONLY = 1, /* Mount read-only. */ #define ST_RDONLY ST_RDONLY ST_NOSUID = 2 /* Ignore suid and sgid bits. */ #define ST_NOSUID ST_NOSUID #ifdef __USE_GNU , ST_NODEV = 4, /* Disallow access to device special files. */ # define ST_NODEV ST_NODEV ST_NOEXEC = 8, /* Disallow program execution. */ # define ST_NOEXEC ST_NOEXEC ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ # define ST_SYNCHRONOUS ST_SYNCHRONOUS ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ # define ST_MANDLOCK ST_MANDLOCK ST_WRITE = 128, /* Write on file/directory/symlink. */ # define ST_WRITE ST_WRITE ST_APPEND = 256, /* Append-only file. */ # define ST_APPEND ST_APPEND ST_IMMUTABLE = 512, /* Immutable file. */ # define ST_IMMUTABLE ST_IMMUTABLE ST_NOATIME = 1024, /* Do not update access times. */ # define ST_NOATIME ST_NOATIME ST_NODIRATIME = 2048, /* Do not update directory access times. */ # define ST_NODIRATIME ST_NODIRATIME ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */ # define ST_RELATIME ST_RELATIME #endif /* Use GNU. */ }; bits/statx-generic.h 0000644 00000004001 15063602063 0010427 0 ustar 00 /* Generic statx-related definitions and declarations. Copyright (C) 2018-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This interface is based on <linux/stat.h> in Linux. */ #ifndef _SYS_STAT_H # error Never include <bits/statx-generic.h> directly, include <sys/stat.h> instead. #endif #include <bits/types/struct_statx_timestamp.h> #include <bits/types/struct_statx.h> #ifndef STATX_TYPE # define STATX_TYPE 0x0001U # define STATX_MODE 0x0002U # define STATX_NLINK 0x0004U # define STATX_UID 0x0008U # define STATX_GID 0x0010U # define STATX_ATIME 0x0020U # define STATX_MTIME 0x0040U # define STATX_CTIME 0x0080U # define STATX_INO 0x0100U # define STATX_SIZE 0x0200U # define STATX_BLOCKS 0x0400U # define STATX_BASIC_STATS 0x07ffU # define STATX_ALL 0x0fffU # define STATX_BTIME 0x0800U # define STATX__RESERVED 0x80000000U # define STATX_ATTR_COMPRESSED 0x0004 # define STATX_ATTR_IMMUTABLE 0x0010 # define STATX_ATTR_APPEND 0x0020 # define STATX_ATTR_NODUMP 0x0040 # define STATX_ATTR_ENCRYPTED 0x0800 # define STATX_ATTR_AUTOMOUNT 0x1000 #endif /* !STATX_TYPE */ __BEGIN_DECLS /* Fill *BUF with information about PATH in DIRFD. */ int statx (int __dirfd, const char *__restrict __path, int __flags, unsigned int __mask, struct statx *__restrict __buf) __THROW __nonnull ((2, 5)); __END_DECLS bits/statx.h 0000644 00000002567 15063602063 0007034 0 ustar 00 /* statx-related definitions and declarations. Linux version. Copyright (C) 2018-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This interface is based on <linux/stat.h> in Linux. */ #ifndef _SYS_STAT_H # error Never include <bits/statx.h> directly, include <sys/stat.h> instead. #endif /* Use the Linux kernel header if available. */ /* Use "" to work around incorrect macro expansion of the __has_include argument (GCC PR 80005). */ #ifdef __has_include # if __has_include ("linux/stat.h") # include "linux/stat.h" # ifdef STATX_TYPE # define __statx_timestamp_defined 1 # define __statx_defined 1 # endif # endif #endif #include <bits/statx-generic.h> bits/stdint-intn.h 0000644 00000002014 15063602063 0010127 0 ustar 00 /* Define intN_t types. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_STDINT_INTN_H #define _BITS_STDINT_INTN_H 1 #include <bits/types.h> typedef __int8_t int8_t; typedef __int16_t int16_t; typedef __int32_t int32_t; typedef __int64_t int64_t; #endif /* bits/stdint-intn.h */ bits/stdint-uintn.h 0000644 00000002030 15063602063 0010312 0 ustar 00 /* Define uintN_t types. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_STDINT_UINTN_H #define _BITS_STDINT_UINTN_H 1 #include <bits/types.h> typedef __uint8_t uint8_t; typedef __uint16_t uint16_t; typedef __uint32_t uint32_t; typedef __uint64_t uint64_t; #endif /* bits/stdint-uintn.h */ bits/stdio-ldbl.h 0000644 00000005705 15063602063 0007723 0 ustar 00 /* -mlong-double-64 compatibility mode for stdio functions. Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDIO_H # error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead." #endif __LDBL_REDIR_DECL (fprintf) __LDBL_REDIR_DECL (printf) __LDBL_REDIR_DECL (sprintf) __LDBL_REDIR_DECL (vfprintf) __LDBL_REDIR_DECL (vprintf) __LDBL_REDIR_DECL (vsprintf) #if defined __USE_ISOC99 && !defined __USE_GNU \ && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf) __LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf) __LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf) #else __LDBL_REDIR_DECL (fscanf) __LDBL_REDIR_DECL (scanf) __LDBL_REDIR_DECL (sscanf) #endif #if defined __USE_ISOC99 || defined __USE_UNIX98 __LDBL_REDIR_DECL (snprintf) __LDBL_REDIR_DECL (vsnprintf) #endif #ifdef __USE_ISOC99 # if !defined __USE_GNU && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf) __LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf) __LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf) # else __LDBL_REDIR_DECL (vfscanf) __LDBL_REDIR_DECL (vsscanf) __LDBL_REDIR_DECL (vscanf) # endif #endif #ifdef __USE_XOPEN2K8 __LDBL_REDIR_DECL (vdprintf) __LDBL_REDIR_DECL (dprintf) #endif #ifdef __USE_GNU __LDBL_REDIR_DECL (vasprintf) __LDBL_REDIR_DECL (__asprintf) __LDBL_REDIR_DECL (asprintf) __LDBL_REDIR_DECL (obstack_printf) __LDBL_REDIR_DECL (obstack_vprintf) #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function __LDBL_REDIR_DECL (__sprintf_chk) __LDBL_REDIR_DECL (__vsprintf_chk) # if defined __USE_ISOC99 || defined __USE_UNIX98 __LDBL_REDIR_DECL (__snprintf_chk) __LDBL_REDIR_DECL (__vsnprintf_chk) # endif # if __USE_FORTIFY_LEVEL > 1 __LDBL_REDIR_DECL (__fprintf_chk) __LDBL_REDIR_DECL (__printf_chk) __LDBL_REDIR_DECL (__vfprintf_chk) __LDBL_REDIR_DECL (__vprintf_chk) # ifdef __USE_XOPEN2K8 __LDBL_REDIR_DECL (__dprintf_chk) __LDBL_REDIR_DECL (__vdprintf_chk) # endif # ifdef __USE_GNU __LDBL_REDIR_DECL (__asprintf_chk) __LDBL_REDIR_DECL (__vasprintf_chk) __LDBL_REDIR_DECL (__obstack_printf_chk) __LDBL_REDIR_DECL (__obstack_vprintf_chk) # endif # endif #endif bits/stdio.h 0000644 00000012722 15063602063 0007005 0 ustar 00 /* Optimizing macros and inline functions for stdio functions. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_STDIO_H #define _BITS_STDIO_H 1 #ifndef _STDIO_H # error "Never include <bits/stdio.h> directly; use <stdio.h> instead." #endif #ifndef __extern_inline # define __STDIO_INLINE inline #else # define __STDIO_INLINE __extern_inline #endif #ifdef __USE_EXTERN_INLINES /* For -D_FORTIFY_SOURCE{,=2,=3} bits/stdio2.h will define a different inline. */ # if !(__USE_FORTIFY_LEVEL > 0 && defined __fortify_function) /* Write formatted output to stdout from argument list ARG. */ __STDIO_INLINE int vprintf (const char *__restrict __fmt, __gnuc_va_list __arg) { return vfprintf (stdout, __fmt, __arg); } # endif /* Read a character from stdin. */ __STDIO_INLINE int getchar (void) { return getc (stdin); } # ifdef __USE_MISC /* Faster version when locking is not necessary. */ __STDIO_INLINE int fgetc_unlocked (FILE *__fp) { return __getc_unlocked_body (__fp); } # endif /* misc */ # ifdef __USE_POSIX /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int getc_unlocked (FILE *__fp) { return __getc_unlocked_body (__fp); } /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int getchar_unlocked (void) { return __getc_unlocked_body (stdin); } # endif /* POSIX */ /* Write a character to stdout. */ __STDIO_INLINE int putchar (int __c) { return putc (__c, stdout); } # ifdef __USE_MISC /* Faster version when locking is not necessary. */ __STDIO_INLINE int fputc_unlocked (int __c, FILE *__stream) { return __putc_unlocked_body (__c, __stream); } # endif /* misc */ # ifdef __USE_POSIX /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int putc_unlocked (int __c, FILE *__stream) { return __putc_unlocked_body (__c, __stream); } /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int putchar_unlocked (int __c) { return __putc_unlocked_body (__c, stdout); } # endif /* POSIX */ # ifdef __USE_GNU /* Like `getdelim', but reads up to a newline. */ __STDIO_INLINE __ssize_t getline (char **__lineptr, size_t *__n, FILE *__stream) { return __getdelim (__lineptr, __n, '\n', __stream); } # endif /* GNU */ # ifdef __USE_MISC /* Faster versions when locking is not required. */ __STDIO_INLINE int __NTH (feof_unlocked (FILE *__stream)) { return __feof_unlocked_body (__stream); } /* Faster versions when locking is not required. */ __STDIO_INLINE int __NTH (ferror_unlocked (FILE *__stream)) { return __ferror_unlocked_body (__stream); } # endif /* misc */ #endif /* Use extern inlines. */ #if defined __USE_MISC && defined __GNUC__ && defined __OPTIMIZE__ \ && !defined __cplusplus /* Perform some simple optimizations. */ # define fread_unlocked(ptr, size, n, stream) \ (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \ && (size_t) (size) * (size_t) (n) <= 8 \ && (size_t) (size) != 0) \ ? ({ char *__ptr = (char *) (ptr); \ FILE *__stream = (stream); \ size_t __cnt; \ for (__cnt = (size_t) (size) * (size_t) (n); \ __cnt > 0; --__cnt) \ { \ int __c = getc_unlocked (__stream); \ if (__c == EOF) \ break; \ *__ptr++ = __c; \ } \ ((size_t) (size) * (size_t) (n) - __cnt) \ / (size_t) (size); }) \ : (((__builtin_constant_p (size) && (size_t) (size) == 0) \ || (__builtin_constant_p (n) && (size_t) (n) == 0)) \ /* Evaluate all parameters once. */ \ ? ((void) (ptr), (void) (stream), (void) (size), \ (void) (n), (size_t) 0) \ : fread_unlocked (ptr, size, n, stream)))) # define fwrite_unlocked(ptr, size, n, stream) \ (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \ && (size_t) (size) * (size_t) (n) <= 8 \ && (size_t) (size) != 0) \ ? ({ const char *__ptr = (const char *) (ptr); \ FILE *__stream = (stream); \ size_t __cnt; \ for (__cnt = (size_t) (size) * (size_t) (n); \ __cnt > 0; --__cnt) \ if (putc_unlocked (*__ptr++, __stream) == EOF) \ break; \ ((size_t) (size) * (size_t) (n) - __cnt) \ / (size_t) (size); }) \ : (((__builtin_constant_p (size) && (size_t) (size) == 0) \ || (__builtin_constant_p (n) && (size_t) (n) == 0)) \ /* Evaluate all parameters once. */ \ ? ((void) (ptr), (void) (stream), (void) (size), \ (void) (n), (size_t) 0) \ : fwrite_unlocked (ptr, size, n, stream)))) #endif /* Define helper macro. */ #undef __STDIO_INLINE #endif /* bits/stdio.h. */ bits/stdio2.h 0000644 00000030402 15063602063 0007062 0 ustar 00 /* Checking macros for stdio functions. Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_STDIO2_H #define _BITS_STDIO2_H 1 #ifndef _STDIO_H # error "Never include <bits/stdio2.h> directly; use <stdio.h> instead." #endif extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen, const char *__restrict __format, ...) __THROW; extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen, const char *__restrict __format, __gnuc_va_list __ap) __THROW; #ifdef __va_arg_pack __fortify_function int __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) { return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, __glibc_objsize (__s), __fmt, __va_arg_pack ()); } #elif !defined __cplusplus # define sprintf(str, ...) \ __builtin___sprintf_chk (str, __USE_FORTIFY_LEVEL - 1, \ __glibc_objsize (str), __VA_ARGS__) #endif __fortify_function int __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt, __gnuc_va_list __ap)) { return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, __glibc_objsize (__s), __fmt, __ap); } #if defined __USE_ISOC99 || defined __USE_UNIX98 extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag, size_t __slen, const char *__restrict __format, ...) __THROW; extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, size_t __slen, const char *__restrict __format, __gnuc_va_list __ap) __THROW; # ifdef __va_arg_pack __fortify_function int __NTH (snprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, ...)) { return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __glibc_objsize (__s), __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define snprintf(str, len, ...) \ __builtin___snprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, \ __glibc_objsize (str), __VA_ARGS__) # endif __fortify_function int __NTH (vsnprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, __gnuc_va_list __ap)) { return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __glibc_objsize (__s), __fmt, __ap); } #endif #if __USE_FORTIFY_LEVEL > 1 extern int __fprintf_chk (FILE *__restrict __stream, int __flag, const char *__restrict __format, ...); extern int __printf_chk (int __flag, const char *__restrict __format, ...); extern int __vfprintf_chk (FILE *__restrict __stream, int __flag, const char *__restrict __format, __gnuc_va_list __ap); extern int __vprintf_chk (int __flag, const char *__restrict __format, __gnuc_va_list __ap); # ifdef __va_arg_pack __fortify_function int fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) { return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int printf (const char *__restrict __fmt, ...) { return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define printf(...) \ __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define fprintf(stream, ...) \ __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int vprintf (const char *__restrict __fmt, __gnuc_va_list __ap) { #ifdef __USE_EXTERN_INLINES return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); #else return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); #endif } __fortify_function int vfprintf (FILE *__restrict __stream, const char *__restrict __fmt, __gnuc_va_list __ap) { return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } # ifdef __USE_XOPEN2K8 extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern int __vdprintf_chk (int __fd, int __flag, const char *__restrict __fmt, __gnuc_va_list __arg) __attribute__ ((__format__ (__printf__, 3, 0))); # ifdef __va_arg_pack __fortify_function int dprintf (int __fd, const char *__restrict __fmt, ...) { return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define dprintf(fd, ...) \ __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap) { return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } # endif # ifdef __USE_GNU extern int __asprintf_chk (char **__restrict __ptr, int __flag, const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur; extern int __vasprintf_chk (char **__restrict __ptr, int __flag, const char *__restrict __fmt, __gnuc_va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur; extern int __obstack_printf_chk (struct obstack *__restrict __obstack, int __flag, const char *__restrict __format, ...) __THROW __attribute__ ((__format__ (__printf__, 3, 4))); extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack, int __flag, const char *__restrict __format, __gnuc_va_list __args) __THROW __attribute__ ((__format__ (__printf__, 3, 0))); # ifdef __va_arg_pack __fortify_function int __NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)) { return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int __NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)) { return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int __NTH (obstack_printf (struct obstack *__restrict __obstack, const char *__restrict __fmt, ...)) { return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define asprintf(ptr, ...) \ __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define __asprintf(ptr, ...) \ __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define obstack_printf(obstack, ...) \ __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int __NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt, __gnuc_va_list __ap)) { return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } __fortify_function int __NTH (obstack_vprintf (struct obstack *__restrict __obstack, const char *__restrict __fmt, __gnuc_va_list __ap)) { return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } # endif #endif #if __GLIBC_USE (DEPRECATED_GETS) extern char *__gets_chk (char *__str, size_t) __wur; extern char *__REDIRECT (__gets_warn, (char *__str), gets) __wur __warnattr ("please use fgets or getline instead, gets can't " "specify buffer size"); __fortify_function __wur char * gets (char *__str) { if (__glibc_objsize (__str) != (size_t) -1) return __gets_chk (__str, __glibc_objsize (__str)); return __gets_warn (__str); } #endif extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __wur; extern char *__REDIRECT (__fgets_alias, (char *__restrict __s, int __n, FILE *__restrict __stream), fgets) __wur; extern char *__REDIRECT (__fgets_chk_warn, (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream), __fgets_chk) __wur __warnattr ("fgets called with bigger size than length " "of destination buffer"); __fortify_function __wur char * fgets (char *__restrict __s, int __n, FILE *__restrict __stream) { size_t sz = __glibc_objsize (__s); if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) return __fgets_alias (__s, __n, __stream); if (__glibc_unsafe_len (__n, sizeof (char), sz)) return __fgets_chk_warn (__s, sz, __n, __stream); return __fgets_chk (__s, sz, __n, __stream); } extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __wur; extern size_t __REDIRECT (__fread_alias, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream), fread) __wur; extern size_t __REDIRECT (__fread_chk_warn, (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream), __fread_chk) __wur __warnattr ("fread called with bigger size * nmemb than length " "of destination buffer"); __fortify_function __wur size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { size_t sz = __glibc_objsize0 (__ptr); if (__glibc_safe_or_unknown_len (__n, __size, sz)) return __fread_alias (__ptr, __size, __n, __stream); if (__glibc_unsafe_len (__n, __size, sz)) return __fread_chk_warn (__ptr, sz, __size, __n, __stream); return __fread_chk (__ptr, sz, __size, __n, __stream); } #ifdef __USE_GNU extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __wur; extern char *__REDIRECT (__fgets_unlocked_alias, (char *__restrict __s, int __n, FILE *__restrict __stream), fgets_unlocked) __wur; extern char *__REDIRECT (__fgets_unlocked_chk_warn, (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream), __fgets_unlocked_chk) __wur __warnattr ("fgets_unlocked called with bigger size than length " "of destination buffer"); __fortify_function __wur char * fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) { size_t sz = __glibc_objsize (__s); if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) return __fgets_unlocked_alias (__s, __n, __stream); if (__glibc_unsafe_len (__n, sizeof (char), sz)) return __fgets_unlocked_chk_warn (__s, sz, __n, __stream); return __fgets_unlocked_chk (__s, sz, __n, __stream); } #endif #ifdef __USE_MISC # undef fread_unlocked extern size_t __fread_unlocked_chk (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __wur; extern size_t __REDIRECT (__fread_unlocked_alias, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream), fread_unlocked) __wur; extern size_t __REDIRECT (__fread_unlocked_chk_warn, (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream), __fread_unlocked_chk) __wur __warnattr ("fread_unlocked called with bigger size * nmemb than " "length of destination buffer"); __fortify_function __wur size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { size_t sz = __glibc_objsize0 (__ptr); if (__glibc_safe_or_unknown_len (__n, __size, sz)) { # ifdef __USE_EXTERN_INLINES if (__builtin_constant_p (__size) && __builtin_constant_p (__n) && (__size | __n) < (((size_t) 1) << (8 * sizeof (size_t) / 2)) && __size * __n <= 8) { size_t __cnt = __size * __n; char *__cptr = (char *) __ptr; if (__cnt == 0) return 0; for (; __cnt > 0; --__cnt) { int __c = getc_unlocked (__stream); if (__c == EOF) break; *__cptr++ = __c; } return (__cptr - (char *) __ptr) / __size; } # endif return __fread_unlocked_alias (__ptr, __size, __n, __stream); } if (__glibc_unsafe_len (__n, __size, sz)) return __fread_unlocked_chk_warn (__ptr, sz, __size, __n, __stream); return __fread_unlocked_chk (__ptr, sz, __size, __n, __stream); } #endif #endif /* bits/stdio2.h. */ bits/stdio_lim.h 0000644 00000002274 15063602063 0007647 0 ustar 00 /* Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_STDIO_LIM_H #define _BITS_STDIO_LIM_H 1 #ifndef _STDIO_H # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." #endif #define L_tmpnam 20 #define TMP_MAX 238328 #define FILENAME_MAX 4096 #ifdef __USE_POSIX # define L_ctermid 9 # if !defined __USE_XOPEN2K || defined __USE_GNU # define L_cuserid 9 # endif #endif #undef FOPEN_MAX #define FOPEN_MAX 16 #endif /* bits/stdio_lim.h */ bits/stdlib-bsearch.h 0000644 00000002541 15063602063 0010547 0 ustar 00 /* Perform binary search - inline version. Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ __extern_inline void * bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) { size_t __l, __u, __idx; const void *__p; int __comparison; __l = 0; __u = __nmemb; while (__l < __u) { __idx = (__l + __u) / 2; __p = (void *) (((const char *) __base) + (__idx * __size)); __comparison = (*__compar) (__key, __p); if (__comparison < 0) __u = __idx; else if (__comparison > 0) __l = __idx + 1; else return (void *) __p; } return NULL; } bits/stdlib-float.h 0000644 00000002132 15063602063 0010241 0 ustar 00 /* Floating-point inline functions for stdlib.h. Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDLIB_H # error "Never use <bits/stdlib-float.h> directly; include <stdlib.h> instead." #endif #ifdef __USE_EXTERN_INLINES __extern_inline double __NTH (atof (const char *__nptr)) { return strtod (__nptr, (char **) NULL); } #endif /* Optimizing and Inlining. */ bits/stdlib-ldbl.h 0000644 00000002534 15063602063 0010057 0 ustar 00 /* -mlong-double-64 compatibility mode for <stdlib.h> functions. Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDLIB_H # error "Never include <bits/stdlib-ldbl.h> directly; use <stdlib.h> instead." #endif #ifdef __USE_ISOC99 __LDBL_REDIR1_DECL (strtold, strtod) #endif #ifdef __USE_GNU __LDBL_REDIR1_DECL (strtold_l, strtod_l) #endif #if __GLIBC_USE (IEC_60559_BFP_EXT) __LDBL_REDIR1_DECL (strfroml, strfromd) #endif #ifdef __USE_MISC __LDBL_REDIR1_DECL (qecvt, ecvt) __LDBL_REDIR1_DECL (qfcvt, fcvt) __LDBL_REDIR1_DECL (qgcvt, gcvt) __LDBL_REDIR1_DECL (qecvt_r, ecvt_r) __LDBL_REDIR1_DECL (qfcvt_r, fcvt_r) #endif bits/stdlib.h 0000644 00000011715 15063602063 0007145 0 ustar 00 /* Checking macros for stdlib functions. Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDLIB_H # error "Never include <bits/stdlib.h> directly; use <stdlib.h> instead." #endif extern char *__realpath_chk (const char *__restrict __name, char *__restrict __resolved, size_t __resolvedlen) __THROW __wur; extern char *__REDIRECT_NTH (__realpath_alias, (const char *__restrict __name, char *__restrict __resolved), realpath) __wur; extern char *__REDIRECT_NTH (__realpath_chk_warn, (const char *__restrict __name, char *__restrict __resolved, size_t __resolvedlen), __realpath_chk) __wur __warnattr ("second argument of realpath must be either NULL or at " "least PATH_MAX bytes long buffer"); __fortify_function __wur char * __NTH (realpath (const char *__restrict __name, char *__restrict __resolved)) { size_t sz = __glibc_objsize (__resolved); if (sz == (size_t) -1) return __realpath_alias (__name, __resolved); #if defined _LIBC_LIMITS_H_ && defined PATH_MAX if (__glibc_unsafe_len (PATH_MAX, sizeof (char), sz)) return __realpath_chk_warn (__name, __resolved, sz); #endif return __realpath_chk (__name, __resolved, sz); } extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((2)); extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf, size_t __buflen), ptsname_r) __nonnull ((2)); extern int __REDIRECT_NTH (__ptsname_r_chk_warn, (int __fd, char *__buf, size_t __buflen, size_t __nreal), __ptsname_r_chk) __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than " "size of buf"); __fortify_function int __NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) { return __glibc_fortify (ptsname_r, __buflen, sizeof (char), __glibc_objsize (__buf), __fd, __buf, __buflen); } extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen) __THROW __wur; extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar), wctomb) __wur; __fortify_function __wur int __NTH (wctomb (char *__s, wchar_t __wchar)) { /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. But this would only disturb the namespace. So we define our own version here. */ #define __STDLIB_MB_LEN_MAX 16 #if defined MB_LEN_MAX && MB_LEN_MAX != __STDLIB_MB_LEN_MAX # error "Assumed value of MB_LEN_MAX wrong" #endif if (__glibc_objsize (__s) != (size_t) -1 && __STDLIB_MB_LEN_MAX > __glibc_objsize (__s)) return __wctomb_chk (__s, __wchar, __glibc_objsize (__s)); return __wctomb_alias (__s, __wchar); } extern size_t __mbstowcs_chk (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__mbstowcs_alias, (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len), mbstowcs); extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn, (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len, size_t __dstlen), __mbstowcs_chk) __warnattr ("mbstowcs called with dst buffer smaller than len " "* sizeof (wchar_t)"); __fortify_function size_t __NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len)) { return __glibc_fortify_n (mbstowcs, __len, sizeof (wchar_t), __glibc_objsize (__dst), __dst, __src, __len); } extern size_t __wcstombs_chk (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__wcstombs_alias, (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len), wcstombs); extern size_t __REDIRECT_NTH (__wcstombs_chk_warn, (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len, size_t __dstlen), __wcstombs_chk) __warnattr ("wcstombs called with dst buffer smaller than len"); __fortify_function size_t __NTH (wcstombs (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len)) { return __glibc_fortify (wcstombs, __len, sizeof (char), __glibc_objsize (__dst), __dst, __src, __len); } bits/string_fortified.h 0000644 00000011113 15063602063 0011215 0 ustar 00 /* Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_STRING_FORTIFIED_H #define _BITS_STRING_FORTIFIED_H 1 #ifndef _STRING_H # error "Never use <bits/string_fortified.h> directly; include <string.h> instead." #endif #if !__GNUC_PREREQ (5,0) __warndecl (__warn_memset_zero_len, "memset used with constant zero length parameter; this could be due to transposed parameters"); #endif __fortify_function void * __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)) { return __builtin___memcpy_chk (__dest, __src, __len, __glibc_objsize0 (__dest)); } __fortify_function void * __NTH (memmove (void *__dest, const void *__src, size_t __len)) { return __builtin___memmove_chk (__dest, __src, __len, __glibc_objsize0 (__dest)); } #ifdef __USE_GNU __fortify_function void * __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)) { return __builtin___mempcpy_chk (__dest, __src, __len, __glibc_objsize0 (__dest)); } #endif /* The first two tests here help to catch a somewhat common problem where the second and third parameter are transposed. This is especially problematic if the intended fill value is zero. In this case no work is done at all. We detect these problems by referring non-existing functions. */ __fortify_function void * __NTH (memset (void *__dest, int __ch, size_t __len)) { /* GCC-5.0 and newer implements these checks in the compiler, so we don't need them here. */ #if !__GNUC_PREREQ (5,0) if (__builtin_constant_p (__len) && __len == 0 && (!__builtin_constant_p (__ch) || __ch != 0)) { __warn_memset_zero_len (); return __dest; } #endif return __builtin___memset_chk (__dest, __ch, __len, __glibc_objsize0 (__dest)); } #ifdef __USE_MISC # include <bits/strings_fortified.h> void __explicit_bzero_chk (void *__dest, size_t __len, size_t __destlen) __THROW __nonnull ((1)); __fortify_function void __NTH (explicit_bzero (void *__dest, size_t __len)) { __explicit_bzero_chk (__dest, __len, __glibc_objsize0 (__dest)); } #endif __fortify_function char * __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) { return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest)); } #ifdef __USE_XOPEN2K8 __fortify_function char * __NTH (stpcpy (char *__restrict __dest, const char *__restrict __src)) { return __builtin___stpcpy_chk (__dest, __src, __glibc_objsize (__dest)); } #endif __fortify_function char * __NTH (strncpy (char *__restrict __dest, const char *__restrict __src, size_t __len)) { return __builtin___strncpy_chk (__dest, __src, __len, __glibc_objsize (__dest)); } #ifdef __USE_XOPEN2K8 # if __GNUC_PREREQ (4, 7) || __glibc_clang_prereq (2, 6) __fortify_function char * __NTH (stpncpy (char *__dest, const char *__src, size_t __n)) { return __builtin___stpncpy_chk (__dest, __src, __n, __glibc_objsize (__dest)); } # else extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, size_t __destlen) __THROW; extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src, size_t __n), stpncpy); __fortify_function char * __NTH (stpncpy (char *__dest, const char *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 && (!__builtin_constant_p (__n) || __n > __bos (__dest))) return __stpncpy_chk (__dest, __src, __n, __bos (__dest)); return __stpncpy_alias (__dest, __src, __n); } # endif #endif __fortify_function char * __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) { return __builtin___strcat_chk (__dest, __src, __glibc_objsize (__dest)); } __fortify_function char * __NTH (strncat (char *__restrict __dest, const char *__restrict __src, size_t __len)) { return __builtin___strncat_chk (__dest, __src, __len, __glibc_objsize (__dest)); } #endif /* bits/string_fortified.h */ bits/strings_fortified.h 0000644 00000002327 15063602063 0011407 0 ustar 00 /* Fortify macros for strings.h functions. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __STRINGS_FORTIFIED # define __STRINGS_FORTIFIED 1 __fortify_function void __NTH (bcopy (const void *__src, void *__dest, size_t __len)) { (void) __builtin___memmove_chk (__dest, __src, __len, __glibc_objsize0 (__dest)); } __fortify_function void __NTH (bzero (void *__dest, size_t __len)) { (void) __builtin___memset_chk (__dest, '\0', __len, __glibc_objsize0 (__dest)); } #endif bits/sys_errlist.h 0000644 00000002277 15063602063 0010251 0 ustar 00 /* Declare sys_errlist and sys_nerr, or don't. Compatibility (do) version. Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _STDIO_H # error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead." #endif /* sys_errlist and sys_nerr are deprecated. Use strerror instead. */ #ifdef __USE_MISC extern int sys_nerr; extern const char *const sys_errlist[]; #endif #ifdef __USE_GNU extern int _sys_nerr; extern const char *const _sys_errlist[]; #endif bits/syscall.h 0000644 00000131137 15063602063 0007337 0 ustar 00 /* Generated at libc build time from syscall list. */ /* The system call list corresponds to kernel 5.18. */ #ifndef _SYSCALL_H # error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead." #endif #define __GLIBC_LINUX_VERSION_CODE 332288 #ifdef __NR_FAST_atomic_update # define SYS_FAST_atomic_update __NR_FAST_atomic_update #endif #ifdef __NR_FAST_cmpxchg # define SYS_FAST_cmpxchg __NR_FAST_cmpxchg #endif #ifdef __NR_FAST_cmpxchg64 # define SYS_FAST_cmpxchg64 __NR_FAST_cmpxchg64 #endif #ifdef __NR__llseek # define SYS__llseek __NR__llseek #endif #ifdef __NR__newselect # define SYS__newselect __NR__newselect #endif #ifdef __NR__sysctl # define SYS__sysctl __NR__sysctl #endif #ifdef __NR_accept # define SYS_accept __NR_accept #endif #ifdef __NR_accept4 # define SYS_accept4 __NR_accept4 #endif #ifdef __NR_access # define SYS_access __NR_access #endif #ifdef __NR_acct # define SYS_acct __NR_acct #endif #ifdef __NR_acl_get # define SYS_acl_get __NR_acl_get #endif #ifdef __NR_acl_set # define SYS_acl_set __NR_acl_set #endif #ifdef __NR_add_key # define SYS_add_key __NR_add_key #endif #ifdef __NR_adjtimex # define SYS_adjtimex __NR_adjtimex #endif #ifdef __NR_afs_syscall # define SYS_afs_syscall __NR_afs_syscall #endif #ifdef __NR_alarm # define SYS_alarm __NR_alarm #endif #ifdef __NR_alloc_hugepages # define SYS_alloc_hugepages __NR_alloc_hugepages #endif #ifdef __NR_arc_gettls # define SYS_arc_gettls __NR_arc_gettls #endif #ifdef __NR_arc_settls # define SYS_arc_settls __NR_arc_settls #endif #ifdef __NR_arc_usr_cmpxchg # define SYS_arc_usr_cmpxchg __NR_arc_usr_cmpxchg #endif #ifdef __NR_arch_prctl # define SYS_arch_prctl __NR_arch_prctl #endif #ifdef __NR_arm_fadvise64_64 # define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64 #endif #ifdef __NR_arm_sync_file_range # define SYS_arm_sync_file_range __NR_arm_sync_file_range #endif #ifdef __NR_atomic_barrier # define SYS_atomic_barrier __NR_atomic_barrier #endif #ifdef __NR_atomic_cmpxchg_32 # define SYS_atomic_cmpxchg_32 __NR_atomic_cmpxchg_32 #endif #ifdef __NR_attrctl # define SYS_attrctl __NR_attrctl #endif #ifdef __NR_bdflush # define SYS_bdflush __NR_bdflush #endif #ifdef __NR_bind # define SYS_bind __NR_bind #endif #ifdef __NR_bpf # define SYS_bpf __NR_bpf #endif #ifdef __NR_break # define SYS_break __NR_break #endif #ifdef __NR_breakpoint # define SYS_breakpoint __NR_breakpoint #endif #ifdef __NR_brk # define SYS_brk __NR_brk #endif #ifdef __NR_cachectl # define SYS_cachectl __NR_cachectl #endif #ifdef __NR_cacheflush # define SYS_cacheflush __NR_cacheflush #endif #ifdef __NR_capget # define SYS_capget __NR_capget #endif #ifdef __NR_capset # define SYS_capset __NR_capset #endif #ifdef __NR_chdir # define SYS_chdir __NR_chdir #endif #ifdef __NR_chmod # define SYS_chmod __NR_chmod #endif #ifdef __NR_chown # define SYS_chown __NR_chown #endif #ifdef __NR_chown32 # define SYS_chown32 __NR_chown32 #endif #ifdef __NR_chroot # define SYS_chroot __NR_chroot #endif #ifdef __NR_clock_adjtime # define SYS_clock_adjtime __NR_clock_adjtime #endif #ifdef __NR_clock_adjtime64 # define SYS_clock_adjtime64 __NR_clock_adjtime64 #endif #ifdef __NR_clock_getres # define SYS_clock_getres __NR_clock_getres #endif #ifdef __NR_clock_getres_time64 # define SYS_clock_getres_time64 __NR_clock_getres_time64 #endif #ifdef __NR_clock_gettime # define SYS_clock_gettime __NR_clock_gettime #endif #ifdef __NR_clock_gettime64 # define SYS_clock_gettime64 __NR_clock_gettime64 #endif #ifdef __NR_clock_nanosleep # define SYS_clock_nanosleep __NR_clock_nanosleep #endif #ifdef __NR_clock_nanosleep_time64 # define SYS_clock_nanosleep_time64 __NR_clock_nanosleep_time64 #endif #ifdef __NR_clock_settime # define SYS_clock_settime __NR_clock_settime #endif #ifdef __NR_clock_settime64 # define SYS_clock_settime64 __NR_clock_settime64 #endif #ifdef __NR_clone # define SYS_clone __NR_clone #endif #ifdef __NR_clone2 # define SYS_clone2 __NR_clone2 #endif #ifdef __NR_clone3 # define SYS_clone3 __NR_clone3 #endif #ifdef __NR_close # define SYS_close __NR_close #endif #ifdef __NR_close_range # define SYS_close_range __NR_close_range #endif #ifdef __NR_cmpxchg_badaddr # define SYS_cmpxchg_badaddr __NR_cmpxchg_badaddr #endif #ifdef __NR_connect # define SYS_connect __NR_connect #endif #ifdef __NR_copy_file_range # define SYS_copy_file_range __NR_copy_file_range #endif #ifdef __NR_creat # define SYS_creat __NR_creat #endif #ifdef __NR_create_module # define SYS_create_module __NR_create_module #endif #ifdef __NR_delete_module # define SYS_delete_module __NR_delete_module #endif #ifdef __NR_dipc # define SYS_dipc __NR_dipc #endif #ifdef __NR_dup # define SYS_dup __NR_dup #endif #ifdef __NR_dup2 # define SYS_dup2 __NR_dup2 #endif #ifdef __NR_dup3 # define SYS_dup3 __NR_dup3 #endif #ifdef __NR_epoll_create # define SYS_epoll_create __NR_epoll_create #endif #ifdef __NR_epoll_create1 # define SYS_epoll_create1 __NR_epoll_create1 #endif #ifdef __NR_epoll_ctl # define SYS_epoll_ctl __NR_epoll_ctl #endif #ifdef __NR_epoll_ctl_old # define SYS_epoll_ctl_old __NR_epoll_ctl_old #endif #ifdef __NR_epoll_pwait # define SYS_epoll_pwait __NR_epoll_pwait #endif #ifdef __NR_epoll_pwait2 # define SYS_epoll_pwait2 __NR_epoll_pwait2 #endif #ifdef __NR_epoll_wait # define SYS_epoll_wait __NR_epoll_wait #endif #ifdef __NR_epoll_wait_old # define SYS_epoll_wait_old __NR_epoll_wait_old #endif #ifdef __NR_eventfd # define SYS_eventfd __NR_eventfd #endif #ifdef __NR_eventfd2 # define SYS_eventfd2 __NR_eventfd2 #endif #ifdef __NR_exec_with_loader # define SYS_exec_with_loader __NR_exec_with_loader #endif #ifdef __NR_execv # define SYS_execv __NR_execv #endif #ifdef __NR_execve # define SYS_execve __NR_execve #endif #ifdef __NR_execveat # define SYS_execveat __NR_execveat #endif #ifdef __NR_exit # define SYS_exit __NR_exit #endif #ifdef __NR_exit_group # define SYS_exit_group __NR_exit_group #endif #ifdef __NR_faccessat # define SYS_faccessat __NR_faccessat #endif #ifdef __NR_faccessat2 # define SYS_faccessat2 __NR_faccessat2 #endif #ifdef __NR_fadvise64 # define SYS_fadvise64 __NR_fadvise64 #endif #ifdef __NR_fadvise64_64 # define SYS_fadvise64_64 __NR_fadvise64_64 #endif #ifdef __NR_fallocate # define SYS_fallocate __NR_fallocate #endif #ifdef __NR_fanotify_init # define SYS_fanotify_init __NR_fanotify_init #endif #ifdef __NR_fanotify_mark # define SYS_fanotify_mark __NR_fanotify_mark #endif #ifdef __NR_fchdir # define SYS_fchdir __NR_fchdir #endif #ifdef __NR_fchmod # define SYS_fchmod __NR_fchmod #endif #ifdef __NR_fchmodat # define SYS_fchmodat __NR_fchmodat #endif #ifdef __NR_fchown # define SYS_fchown __NR_fchown #endif #ifdef __NR_fchown32 # define SYS_fchown32 __NR_fchown32 #endif #ifdef __NR_fchownat # define SYS_fchownat __NR_fchownat #endif #ifdef __NR_fcntl # define SYS_fcntl __NR_fcntl #endif #ifdef __NR_fcntl64 # define SYS_fcntl64 __NR_fcntl64 #endif #ifdef __NR_fdatasync # define SYS_fdatasync __NR_fdatasync #endif #ifdef __NR_fgetxattr # define SYS_fgetxattr __NR_fgetxattr #endif #ifdef __NR_finit_module # define SYS_finit_module __NR_finit_module #endif #ifdef __NR_flistxattr # define SYS_flistxattr __NR_flistxattr #endif #ifdef __NR_flock # define SYS_flock __NR_flock #endif #ifdef __NR_fork # define SYS_fork __NR_fork #endif #ifdef __NR_fp_udfiex_crtl # define SYS_fp_udfiex_crtl __NR_fp_udfiex_crtl #endif #ifdef __NR_free_hugepages # define SYS_free_hugepages __NR_free_hugepages #endif #ifdef __NR_fremovexattr # define SYS_fremovexattr __NR_fremovexattr #endif #ifdef __NR_fsconfig # define SYS_fsconfig __NR_fsconfig #endif #ifdef __NR_fsetxattr # define SYS_fsetxattr __NR_fsetxattr #endif #ifdef __NR_fsmount # define SYS_fsmount __NR_fsmount #endif #ifdef __NR_fsopen # define SYS_fsopen __NR_fsopen #endif #ifdef __NR_fspick # define SYS_fspick __NR_fspick #endif #ifdef __NR_fstat # define SYS_fstat __NR_fstat #endif #ifdef __NR_fstat64 # define SYS_fstat64 __NR_fstat64 #endif #ifdef __NR_fstatat64 # define SYS_fstatat64 __NR_fstatat64 #endif #ifdef __NR_fstatfs # define SYS_fstatfs __NR_fstatfs #endif #ifdef __NR_fstatfs64 # define SYS_fstatfs64 __NR_fstatfs64 #endif #ifdef __NR_fsync # define SYS_fsync __NR_fsync #endif #ifdef __NR_ftime # define SYS_ftime __NR_ftime #endif #ifdef __NR_ftruncate # define SYS_ftruncate __NR_ftruncate #endif #ifdef __NR_ftruncate64 # define SYS_ftruncate64 __NR_ftruncate64 #endif #ifdef __NR_futex # define SYS_futex __NR_futex #endif #ifdef __NR_futex_time64 # define SYS_futex_time64 __NR_futex_time64 #endif #ifdef __NR_futex_waitv # define SYS_futex_waitv __NR_futex_waitv #endif #ifdef __NR_futimesat # define SYS_futimesat __NR_futimesat #endif #ifdef __NR_get_kernel_syms # define SYS_get_kernel_syms __NR_get_kernel_syms #endif #ifdef __NR_get_mempolicy # define SYS_get_mempolicy __NR_get_mempolicy #endif #ifdef __NR_get_robust_list # define SYS_get_robust_list __NR_get_robust_list #endif #ifdef __NR_get_thread_area # define SYS_get_thread_area __NR_get_thread_area #endif #ifdef __NR_get_tls # define SYS_get_tls __NR_get_tls #endif #ifdef __NR_getcpu # define SYS_getcpu __NR_getcpu #endif #ifdef __NR_getcwd # define SYS_getcwd __NR_getcwd #endif #ifdef __NR_getdents # define SYS_getdents __NR_getdents #endif #ifdef __NR_getdents64 # define SYS_getdents64 __NR_getdents64 #endif #ifdef __NR_getdomainname # define SYS_getdomainname __NR_getdomainname #endif #ifdef __NR_getdtablesize # define SYS_getdtablesize __NR_getdtablesize #endif #ifdef __NR_getegid # define SYS_getegid __NR_getegid #endif #ifdef __NR_getegid32 # define SYS_getegid32 __NR_getegid32 #endif #ifdef __NR_geteuid # define SYS_geteuid __NR_geteuid #endif #ifdef __NR_geteuid32 # define SYS_geteuid32 __NR_geteuid32 #endif #ifdef __NR_getgid # define SYS_getgid __NR_getgid #endif #ifdef __NR_getgid32 # define SYS_getgid32 __NR_getgid32 #endif #ifdef __NR_getgroups # define SYS_getgroups __NR_getgroups #endif #ifdef __NR_getgroups32 # define SYS_getgroups32 __NR_getgroups32 #endif #ifdef __NR_gethostname # define SYS_gethostname __NR_gethostname #endif #ifdef __NR_getitimer # define SYS_getitimer __NR_getitimer #endif #ifdef __NR_getpagesize # define SYS_getpagesize __NR_getpagesize #endif #ifdef __NR_getpeername # define SYS_getpeername __NR_getpeername #endif #ifdef __NR_getpgid # define SYS_getpgid __NR_getpgid #endif #ifdef __NR_getpgrp # define SYS_getpgrp __NR_getpgrp #endif #ifdef __NR_getpid # define SYS_getpid __NR_getpid #endif #ifdef __NR_getpmsg # define SYS_getpmsg __NR_getpmsg #endif #ifdef __NR_getppid # define SYS_getppid __NR_getppid #endif #ifdef __NR_getpriority # define SYS_getpriority __NR_getpriority #endif #ifdef __NR_getrandom # define SYS_getrandom __NR_getrandom #endif #ifdef __NR_getresgid # define SYS_getresgid __NR_getresgid #endif #ifdef __NR_getresgid32 # define SYS_getresgid32 __NR_getresgid32 #endif #ifdef __NR_getresuid # define SYS_getresuid __NR_getresuid #endif #ifdef __NR_getresuid32 # define SYS_getresuid32 __NR_getresuid32 #endif #ifdef __NR_getrlimit # define SYS_getrlimit __NR_getrlimit #endif #ifdef __NR_getrusage # define SYS_getrusage __NR_getrusage #endif #ifdef __NR_getsid # define SYS_getsid __NR_getsid #endif #ifdef __NR_getsockname # define SYS_getsockname __NR_getsockname #endif #ifdef __NR_getsockopt # define SYS_getsockopt __NR_getsockopt #endif #ifdef __NR_gettid # define SYS_gettid __NR_gettid #endif #ifdef __NR_gettimeofday # define SYS_gettimeofday __NR_gettimeofday #endif #ifdef __NR_getuid # define SYS_getuid __NR_getuid #endif #ifdef __NR_getuid32 # define SYS_getuid32 __NR_getuid32 #endif #ifdef __NR_getunwind # define SYS_getunwind __NR_getunwind #endif #ifdef __NR_getxattr # define SYS_getxattr __NR_getxattr #endif #ifdef __NR_getxgid # define SYS_getxgid __NR_getxgid #endif #ifdef __NR_getxpid # define SYS_getxpid __NR_getxpid #endif #ifdef __NR_getxuid # define SYS_getxuid __NR_getxuid #endif #ifdef __NR_gtty # define SYS_gtty __NR_gtty #endif #ifdef __NR_idle # define SYS_idle __NR_idle #endif #ifdef __NR_init_module # define SYS_init_module __NR_init_module #endif #ifdef __NR_inotify_add_watch # define SYS_inotify_add_watch __NR_inotify_add_watch #endif #ifdef __NR_inotify_init # define SYS_inotify_init __NR_inotify_init #endif #ifdef __NR_inotify_init1 # define SYS_inotify_init1 __NR_inotify_init1 #endif #ifdef __NR_inotify_rm_watch # define SYS_inotify_rm_watch __NR_inotify_rm_watch #endif #ifdef __NR_io_cancel # define SYS_io_cancel __NR_io_cancel #endif #ifdef __NR_io_destroy # define SYS_io_destroy __NR_io_destroy #endif #ifdef __NR_io_getevents # define SYS_io_getevents __NR_io_getevents #endif #ifdef __NR_io_pgetevents # define SYS_io_pgetevents __NR_io_pgetevents #endif #ifdef __NR_io_pgetevents_time64 # define SYS_io_pgetevents_time64 __NR_io_pgetevents_time64 #endif #ifdef __NR_io_setup # define SYS_io_setup __NR_io_setup #endif #ifdef __NR_io_submit # define SYS_io_submit __NR_io_submit #endif #ifdef __NR_io_uring_enter # define SYS_io_uring_enter __NR_io_uring_enter #endif #ifdef __NR_io_uring_register # define SYS_io_uring_register __NR_io_uring_register #endif #ifdef __NR_io_uring_setup # define SYS_io_uring_setup __NR_io_uring_setup #endif #ifdef __NR_ioctl # define SYS_ioctl __NR_ioctl #endif #ifdef __NR_ioperm # define SYS_ioperm __NR_ioperm #endif #ifdef __NR_iopl # define SYS_iopl __NR_iopl #endif #ifdef __NR_ioprio_get # define SYS_ioprio_get __NR_ioprio_get #endif #ifdef __NR_ioprio_set # define SYS_ioprio_set __NR_ioprio_set #endif #ifdef __NR_ipc # define SYS_ipc __NR_ipc #endif #ifdef __NR_kcmp # define SYS_kcmp __NR_kcmp #endif #ifdef __NR_kern_features # define SYS_kern_features __NR_kern_features #endif #ifdef __NR_kexec_file_load # define SYS_kexec_file_load __NR_kexec_file_load #endif #ifdef __NR_kexec_load # define SYS_kexec_load __NR_kexec_load #endif #ifdef __NR_keyctl # define SYS_keyctl __NR_keyctl #endif #ifdef __NR_kill # define SYS_kill __NR_kill #endif #ifdef __NR_landlock_add_rule # define SYS_landlock_add_rule __NR_landlock_add_rule #endif #ifdef __NR_landlock_create_ruleset # define SYS_landlock_create_ruleset __NR_landlock_create_ruleset #endif #ifdef __NR_landlock_restrict_self # define SYS_landlock_restrict_self __NR_landlock_restrict_self #endif #ifdef __NR_lchown # define SYS_lchown __NR_lchown #endif #ifdef __NR_lchown32 # define SYS_lchown32 __NR_lchown32 #endif #ifdef __NR_lgetxattr # define SYS_lgetxattr __NR_lgetxattr #endif #ifdef __NR_link # define SYS_link __NR_link #endif #ifdef __NR_linkat # define SYS_linkat __NR_linkat #endif #ifdef __NR_listen # define SYS_listen __NR_listen #endif #ifdef __NR_listxattr # define SYS_listxattr __NR_listxattr #endif #ifdef __NR_llistxattr # define SYS_llistxattr __NR_llistxattr #endif #ifdef __NR_llseek # define SYS_llseek __NR_llseek #endif #ifdef __NR_lock # define SYS_lock __NR_lock #endif #ifdef __NR_lookup_dcookie # define SYS_lookup_dcookie __NR_lookup_dcookie #endif #ifdef __NR_lremovexattr # define SYS_lremovexattr __NR_lremovexattr #endif #ifdef __NR_lseek # define SYS_lseek __NR_lseek #endif #ifdef __NR_lsetxattr # define SYS_lsetxattr __NR_lsetxattr #endif #ifdef __NR_lstat # define SYS_lstat __NR_lstat #endif #ifdef __NR_lstat64 # define SYS_lstat64 __NR_lstat64 #endif #ifdef __NR_madvise # define SYS_madvise __NR_madvise #endif #ifdef __NR_mbind # define SYS_mbind __NR_mbind #endif #ifdef __NR_membarrier # define SYS_membarrier __NR_membarrier #endif #ifdef __NR_memfd_create # define SYS_memfd_create __NR_memfd_create #endif #ifdef __NR_memfd_secret # define SYS_memfd_secret __NR_memfd_secret #endif #ifdef __NR_memory_ordering # define SYS_memory_ordering __NR_memory_ordering #endif #ifdef __NR_migrate_pages # define SYS_migrate_pages __NR_migrate_pages #endif #ifdef __NR_mincore # define SYS_mincore __NR_mincore #endif #ifdef __NR_mkdir # define SYS_mkdir __NR_mkdir #endif #ifdef __NR_mkdirat # define SYS_mkdirat __NR_mkdirat #endif #ifdef __NR_mknod # define SYS_mknod __NR_mknod #endif #ifdef __NR_mknodat # define SYS_mknodat __NR_mknodat #endif #ifdef __NR_mlock # define SYS_mlock __NR_mlock #endif #ifdef __NR_mlock2 # define SYS_mlock2 __NR_mlock2 #endif #ifdef __NR_mlockall # define SYS_mlockall __NR_mlockall #endif #ifdef __NR_mmap # define SYS_mmap __NR_mmap #endif #ifdef __NR_mmap2 # define SYS_mmap2 __NR_mmap2 #endif #ifdef __NR_modify_ldt # define SYS_modify_ldt __NR_modify_ldt #endif #ifdef __NR_mount # define SYS_mount __NR_mount #endif #ifdef __NR_mount_setattr # define SYS_mount_setattr __NR_mount_setattr #endif #ifdef __NR_move_mount # define SYS_move_mount __NR_move_mount #endif #ifdef __NR_move_pages # define SYS_move_pages __NR_move_pages #endif #ifdef __NR_mprotect # define SYS_mprotect __NR_mprotect #endif #ifdef __NR_mpx # define SYS_mpx __NR_mpx #endif #ifdef __NR_mq_getsetattr # define SYS_mq_getsetattr __NR_mq_getsetattr #endif #ifdef __NR_mq_notify # define SYS_mq_notify __NR_mq_notify #endif #ifdef __NR_mq_open # define SYS_mq_open __NR_mq_open #endif #ifdef __NR_mq_timedreceive # define SYS_mq_timedreceive __NR_mq_timedreceive #endif #ifdef __NR_mq_timedreceive_time64 # define SYS_mq_timedreceive_time64 __NR_mq_timedreceive_time64 #endif #ifdef __NR_mq_timedsend # define SYS_mq_timedsend __NR_mq_timedsend #endif #ifdef __NR_mq_timedsend_time64 # define SYS_mq_timedsend_time64 __NR_mq_timedsend_time64 #endif #ifdef __NR_mq_unlink # define SYS_mq_unlink __NR_mq_unlink #endif #ifdef __NR_mremap # define SYS_mremap __NR_mremap #endif #ifdef __NR_msgctl # define SYS_msgctl __NR_msgctl #endif #ifdef __NR_msgget # define SYS_msgget __NR_msgget #endif #ifdef __NR_msgrcv # define SYS_msgrcv __NR_msgrcv #endif #ifdef __NR_msgsnd # define SYS_msgsnd __NR_msgsnd #endif #ifdef __NR_msync # define SYS_msync __NR_msync #endif #ifdef __NR_multiplexer # define SYS_multiplexer __NR_multiplexer #endif #ifdef __NR_munlock # define SYS_munlock __NR_munlock #endif #ifdef __NR_munlockall # define SYS_munlockall __NR_munlockall #endif #ifdef __NR_munmap # define SYS_munmap __NR_munmap #endif #ifdef __NR_name_to_handle_at # define SYS_name_to_handle_at __NR_name_to_handle_at #endif #ifdef __NR_nanosleep # define SYS_nanosleep __NR_nanosleep #endif #ifdef __NR_newfstatat # define SYS_newfstatat __NR_newfstatat #endif #ifdef __NR_nfsservctl # define SYS_nfsservctl __NR_nfsservctl #endif #ifdef __NR_ni_syscall # define SYS_ni_syscall __NR_ni_syscall #endif #ifdef __NR_nice # define SYS_nice __NR_nice #endif #ifdef __NR_old_adjtimex # define SYS_old_adjtimex __NR_old_adjtimex #endif #ifdef __NR_old_getpagesize # define SYS_old_getpagesize __NR_old_getpagesize #endif #ifdef __NR_oldfstat # define SYS_oldfstat __NR_oldfstat #endif #ifdef __NR_oldlstat # define SYS_oldlstat __NR_oldlstat #endif #ifdef __NR_oldolduname # define SYS_oldolduname __NR_oldolduname #endif #ifdef __NR_oldstat # define SYS_oldstat __NR_oldstat #endif #ifdef __NR_oldumount # define SYS_oldumount __NR_oldumount #endif #ifdef __NR_olduname # define SYS_olduname __NR_olduname #endif #ifdef __NR_open # define SYS_open __NR_open #endif #ifdef __NR_open_by_handle_at # define SYS_open_by_handle_at __NR_open_by_handle_at #endif #ifdef __NR_open_tree # define SYS_open_tree __NR_open_tree #endif #ifdef __NR_openat # define SYS_openat __NR_openat #endif #ifdef __NR_openat2 # define SYS_openat2 __NR_openat2 #endif #ifdef __NR_or1k_atomic # define SYS_or1k_atomic __NR_or1k_atomic #endif #ifdef __NR_osf_adjtime # define SYS_osf_adjtime __NR_osf_adjtime #endif #ifdef __NR_osf_afs_syscall # define SYS_osf_afs_syscall __NR_osf_afs_syscall #endif #ifdef __NR_osf_alt_plock # define SYS_osf_alt_plock __NR_osf_alt_plock #endif #ifdef __NR_osf_alt_setsid # define SYS_osf_alt_setsid __NR_osf_alt_setsid #endif #ifdef __NR_osf_alt_sigpending # define SYS_osf_alt_sigpending __NR_osf_alt_sigpending #endif #ifdef __NR_osf_asynch_daemon # define SYS_osf_asynch_daemon __NR_osf_asynch_daemon #endif #ifdef __NR_osf_audcntl # define SYS_osf_audcntl __NR_osf_audcntl #endif #ifdef __NR_osf_audgen # define SYS_osf_audgen __NR_osf_audgen #endif #ifdef __NR_osf_chflags # define SYS_osf_chflags __NR_osf_chflags #endif #ifdef __NR_osf_execve # define SYS_osf_execve __NR_osf_execve #endif #ifdef __NR_osf_exportfs # define SYS_osf_exportfs __NR_osf_exportfs #endif #ifdef __NR_osf_fchflags # define SYS_osf_fchflags __NR_osf_fchflags #endif #ifdef __NR_osf_fdatasync # define SYS_osf_fdatasync __NR_osf_fdatasync #endif #ifdef __NR_osf_fpathconf # define SYS_osf_fpathconf __NR_osf_fpathconf #endif #ifdef __NR_osf_fstat # define SYS_osf_fstat __NR_osf_fstat #endif #ifdef __NR_osf_fstatfs # define SYS_osf_fstatfs __NR_osf_fstatfs #endif #ifdef __NR_osf_fstatfs64 # define SYS_osf_fstatfs64 __NR_osf_fstatfs64 #endif #ifdef __NR_osf_fuser # define SYS_osf_fuser __NR_osf_fuser #endif #ifdef __NR_osf_getaddressconf # define SYS_osf_getaddressconf __NR_osf_getaddressconf #endif #ifdef __NR_osf_getdirentries # define SYS_osf_getdirentries __NR_osf_getdirentries #endif #ifdef __NR_osf_getdomainname # define SYS_osf_getdomainname __NR_osf_getdomainname #endif #ifdef __NR_osf_getfh # define SYS_osf_getfh __NR_osf_getfh #endif #ifdef __NR_osf_getfsstat # define SYS_osf_getfsstat __NR_osf_getfsstat #endif #ifdef __NR_osf_gethostid # define SYS_osf_gethostid __NR_osf_gethostid #endif #ifdef __NR_osf_getitimer # define SYS_osf_getitimer __NR_osf_getitimer #endif #ifdef __NR_osf_getlogin # define SYS_osf_getlogin __NR_osf_getlogin #endif #ifdef __NR_osf_getmnt # define SYS_osf_getmnt __NR_osf_getmnt #endif #ifdef __NR_osf_getrusage # define SYS_osf_getrusage __NR_osf_getrusage #endif #ifdef __NR_osf_getsysinfo # define SYS_osf_getsysinfo __NR_osf_getsysinfo #endif #ifdef __NR_osf_gettimeofday # define SYS_osf_gettimeofday __NR_osf_gettimeofday #endif #ifdef __NR_osf_kloadcall # define SYS_osf_kloadcall __NR_osf_kloadcall #endif #ifdef __NR_osf_kmodcall # define SYS_osf_kmodcall __NR_osf_kmodcall #endif #ifdef __NR_osf_lstat # define SYS_osf_lstat __NR_osf_lstat #endif #ifdef __NR_osf_memcntl # define SYS_osf_memcntl __NR_osf_memcntl #endif #ifdef __NR_osf_mincore # define SYS_osf_mincore __NR_osf_mincore #endif #ifdef __NR_osf_mount # define SYS_osf_mount __NR_osf_mount #endif #ifdef __NR_osf_mremap # define SYS_osf_mremap __NR_osf_mremap #endif #ifdef __NR_osf_msfs_syscall # define SYS_osf_msfs_syscall __NR_osf_msfs_syscall #endif #ifdef __NR_osf_msleep # define SYS_osf_msleep __NR_osf_msleep #endif #ifdef __NR_osf_mvalid # define SYS_osf_mvalid __NR_osf_mvalid #endif #ifdef __NR_osf_mwakeup # define SYS_osf_mwakeup __NR_osf_mwakeup #endif #ifdef __NR_osf_naccept # define SYS_osf_naccept __NR_osf_naccept #endif #ifdef __NR_osf_nfssvc # define SYS_osf_nfssvc __NR_osf_nfssvc #endif #ifdef __NR_osf_ngetpeername # define SYS_osf_ngetpeername __NR_osf_ngetpeername #endif #ifdef __NR_osf_ngetsockname # define SYS_osf_ngetsockname __NR_osf_ngetsockname #endif #ifdef __NR_osf_nrecvfrom # define SYS_osf_nrecvfrom __NR_osf_nrecvfrom #endif #ifdef __NR_osf_nrecvmsg # define SYS_osf_nrecvmsg __NR_osf_nrecvmsg #endif #ifdef __NR_osf_nsendmsg # define SYS_osf_nsendmsg __NR_osf_nsendmsg #endif #ifdef __NR_osf_ntp_adjtime # define SYS_osf_ntp_adjtime __NR_osf_ntp_adjtime #endif #ifdef __NR_osf_ntp_gettime # define SYS_osf_ntp_gettime __NR_osf_ntp_gettime #endif #ifdef __NR_osf_old_creat # define SYS_osf_old_creat __NR_osf_old_creat #endif #ifdef __NR_osf_old_fstat # define SYS_osf_old_fstat __NR_osf_old_fstat #endif #ifdef __NR_osf_old_getpgrp # define SYS_osf_old_getpgrp __NR_osf_old_getpgrp #endif #ifdef __NR_osf_old_killpg # define SYS_osf_old_killpg __NR_osf_old_killpg #endif #ifdef __NR_osf_old_lstat # define SYS_osf_old_lstat __NR_osf_old_lstat #endif #ifdef __NR_osf_old_open # define SYS_osf_old_open __NR_osf_old_open #endif #ifdef __NR_osf_old_sigaction # define SYS_osf_old_sigaction __NR_osf_old_sigaction #endif #ifdef __NR_osf_old_sigblock # define SYS_osf_old_sigblock __NR_osf_old_sigblock #endif #ifdef __NR_osf_old_sigreturn # define SYS_osf_old_sigreturn __NR_osf_old_sigreturn #endif #ifdef __NR_osf_old_sigsetmask # define SYS_osf_old_sigsetmask __NR_osf_old_sigsetmask #endif #ifdef __NR_osf_old_sigvec # define SYS_osf_old_sigvec __NR_osf_old_sigvec #endif #ifdef __NR_osf_old_stat # define SYS_osf_old_stat __NR_osf_old_stat #endif #ifdef __NR_osf_old_vadvise # define SYS_osf_old_vadvise __NR_osf_old_vadvise #endif #ifdef __NR_osf_old_vtrace # define SYS_osf_old_vtrace __NR_osf_old_vtrace #endif #ifdef __NR_osf_old_wait # define SYS_osf_old_wait __NR_osf_old_wait #endif #ifdef __NR_osf_oldquota # define SYS_osf_oldquota __NR_osf_oldquota #endif #ifdef __NR_osf_pathconf # define SYS_osf_pathconf __NR_osf_pathconf #endif #ifdef __NR_osf_pid_block # define SYS_osf_pid_block __NR_osf_pid_block #endif #ifdef __NR_osf_pid_unblock # define SYS_osf_pid_unblock __NR_osf_pid_unblock #endif #ifdef __NR_osf_plock # define SYS_osf_plock __NR_osf_plock #endif #ifdef __NR_osf_priocntlset # define SYS_osf_priocntlset __NR_osf_priocntlset #endif #ifdef __NR_osf_profil # define SYS_osf_profil __NR_osf_profil #endif #ifdef __NR_osf_proplist_syscall # define SYS_osf_proplist_syscall __NR_osf_proplist_syscall #endif #ifdef __NR_osf_reboot # define SYS_osf_reboot __NR_osf_reboot #endif #ifdef __NR_osf_revoke # define SYS_osf_revoke __NR_osf_revoke #endif #ifdef __NR_osf_sbrk # define SYS_osf_sbrk __NR_osf_sbrk #endif #ifdef __NR_osf_security # define SYS_osf_security __NR_osf_security #endif #ifdef __NR_osf_select # define SYS_osf_select __NR_osf_select #endif #ifdef __NR_osf_set_program_attributes # define SYS_osf_set_program_attributes __NR_osf_set_program_attributes #endif #ifdef __NR_osf_set_speculative # define SYS_osf_set_speculative __NR_osf_set_speculative #endif #ifdef __NR_osf_sethostid # define SYS_osf_sethostid __NR_osf_sethostid #endif #ifdef __NR_osf_setitimer # define SYS_osf_setitimer __NR_osf_setitimer #endif #ifdef __NR_osf_setlogin # define SYS_osf_setlogin __NR_osf_setlogin #endif #ifdef __NR_osf_setsysinfo # define SYS_osf_setsysinfo __NR_osf_setsysinfo #endif #ifdef __NR_osf_settimeofday # define SYS_osf_settimeofday __NR_osf_settimeofday #endif #ifdef __NR_osf_shmat # define SYS_osf_shmat __NR_osf_shmat #endif #ifdef __NR_osf_signal # define SYS_osf_signal __NR_osf_signal #endif #ifdef __NR_osf_sigprocmask # define SYS_osf_sigprocmask __NR_osf_sigprocmask #endif #ifdef __NR_osf_sigsendset # define SYS_osf_sigsendset __NR_osf_sigsendset #endif #ifdef __NR_osf_sigstack # define SYS_osf_sigstack __NR_osf_sigstack #endif #ifdef __NR_osf_sigwaitprim # define SYS_osf_sigwaitprim __NR_osf_sigwaitprim #endif #ifdef __NR_osf_sstk # define SYS_osf_sstk __NR_osf_sstk #endif #ifdef __NR_osf_stat # define SYS_osf_stat __NR_osf_stat #endif #ifdef __NR_osf_statfs # define SYS_osf_statfs __NR_osf_statfs #endif #ifdef __NR_osf_statfs64 # define SYS_osf_statfs64 __NR_osf_statfs64 #endif #ifdef __NR_osf_subsys_info # define SYS_osf_subsys_info __NR_osf_subsys_info #endif #ifdef __NR_osf_swapctl # define SYS_osf_swapctl __NR_osf_swapctl #endif #ifdef __NR_osf_swapon # define SYS_osf_swapon __NR_osf_swapon #endif #ifdef __NR_osf_syscall # define SYS_osf_syscall __NR_osf_syscall #endif #ifdef __NR_osf_sysinfo # define SYS_osf_sysinfo __NR_osf_sysinfo #endif #ifdef __NR_osf_table # define SYS_osf_table __NR_osf_table #endif #ifdef __NR_osf_uadmin # define SYS_osf_uadmin __NR_osf_uadmin #endif #ifdef __NR_osf_usleep_thread # define SYS_osf_usleep_thread __NR_osf_usleep_thread #endif #ifdef __NR_osf_uswitch # define SYS_osf_uswitch __NR_osf_uswitch #endif #ifdef __NR_osf_utc_adjtime # define SYS_osf_utc_adjtime __NR_osf_utc_adjtime #endif #ifdef __NR_osf_utc_gettime # define SYS_osf_utc_gettime __NR_osf_utc_gettime #endif #ifdef __NR_osf_utimes # define SYS_osf_utimes __NR_osf_utimes #endif #ifdef __NR_osf_utsname # define SYS_osf_utsname __NR_osf_utsname #endif #ifdef __NR_osf_wait4 # define SYS_osf_wait4 __NR_osf_wait4 #endif #ifdef __NR_osf_waitid # define SYS_osf_waitid __NR_osf_waitid #endif #ifdef __NR_pause # define SYS_pause __NR_pause #endif #ifdef __NR_pciconfig_iobase # define SYS_pciconfig_iobase __NR_pciconfig_iobase #endif #ifdef __NR_pciconfig_read # define SYS_pciconfig_read __NR_pciconfig_read #endif #ifdef __NR_pciconfig_write # define SYS_pciconfig_write __NR_pciconfig_write #endif #ifdef __NR_perf_event_open # define SYS_perf_event_open __NR_perf_event_open #endif #ifdef __NR_perfctr # define SYS_perfctr __NR_perfctr #endif #ifdef __NR_perfmonctl # define SYS_perfmonctl __NR_perfmonctl #endif #ifdef __NR_personality # define SYS_personality __NR_personality #endif #ifdef __NR_pidfd_getfd # define SYS_pidfd_getfd __NR_pidfd_getfd #endif #ifdef __NR_pidfd_open # define SYS_pidfd_open __NR_pidfd_open #endif #ifdef __NR_pidfd_send_signal # define SYS_pidfd_send_signal __NR_pidfd_send_signal #endif #ifdef __NR_pipe # define SYS_pipe __NR_pipe #endif #ifdef __NR_pipe2 # define SYS_pipe2 __NR_pipe2 #endif #ifdef __NR_pivot_root # define SYS_pivot_root __NR_pivot_root #endif #ifdef __NR_pkey_alloc # define SYS_pkey_alloc __NR_pkey_alloc #endif #ifdef __NR_pkey_free # define SYS_pkey_free __NR_pkey_free #endif #ifdef __NR_pkey_mprotect # define SYS_pkey_mprotect __NR_pkey_mprotect #endif #ifdef __NR_poll # define SYS_poll __NR_poll #endif #ifdef __NR_ppoll # define SYS_ppoll __NR_ppoll #endif #ifdef __NR_ppoll_time64 # define SYS_ppoll_time64 __NR_ppoll_time64 #endif #ifdef __NR_prctl # define SYS_prctl __NR_prctl #endif #ifdef __NR_pread64 # define SYS_pread64 __NR_pread64 #endif #ifdef __NR_preadv # define SYS_preadv __NR_preadv #endif #ifdef __NR_preadv2 # define SYS_preadv2 __NR_preadv2 #endif #ifdef __NR_prlimit64 # define SYS_prlimit64 __NR_prlimit64 #endif #ifdef __NR_process_madvise # define SYS_process_madvise __NR_process_madvise #endif #ifdef __NR_process_mrelease # define SYS_process_mrelease __NR_process_mrelease #endif #ifdef __NR_process_vm_readv # define SYS_process_vm_readv __NR_process_vm_readv #endif #ifdef __NR_process_vm_writev # define SYS_process_vm_writev __NR_process_vm_writev #endif #ifdef __NR_prof # define SYS_prof __NR_prof #endif #ifdef __NR_profil # define SYS_profil __NR_profil #endif #ifdef __NR_pselect6 # define SYS_pselect6 __NR_pselect6 #endif #ifdef __NR_pselect6_time64 # define SYS_pselect6_time64 __NR_pselect6_time64 #endif #ifdef __NR_ptrace # define SYS_ptrace __NR_ptrace #endif #ifdef __NR_putpmsg # define SYS_putpmsg __NR_putpmsg #endif #ifdef __NR_pwrite64 # define SYS_pwrite64 __NR_pwrite64 #endif #ifdef __NR_pwritev # define SYS_pwritev __NR_pwritev #endif #ifdef __NR_pwritev2 # define SYS_pwritev2 __NR_pwritev2 #endif #ifdef __NR_query_module # define SYS_query_module __NR_query_module #endif #ifdef __NR_quotactl # define SYS_quotactl __NR_quotactl #endif #ifdef __NR_quotactl_fd # define SYS_quotactl_fd __NR_quotactl_fd #endif #ifdef __NR_read # define SYS_read __NR_read #endif #ifdef __NR_readahead # define SYS_readahead __NR_readahead #endif #ifdef __NR_readdir # define SYS_readdir __NR_readdir #endif #ifdef __NR_readlink # define SYS_readlink __NR_readlink #endif #ifdef __NR_readlinkat # define SYS_readlinkat __NR_readlinkat #endif #ifdef __NR_readv # define SYS_readv __NR_readv #endif #ifdef __NR_reboot # define SYS_reboot __NR_reboot #endif #ifdef __NR_recv # define SYS_recv __NR_recv #endif #ifdef __NR_recvfrom # define SYS_recvfrom __NR_recvfrom #endif #ifdef __NR_recvmmsg # define SYS_recvmmsg __NR_recvmmsg #endif #ifdef __NR_recvmmsg_time64 # define SYS_recvmmsg_time64 __NR_recvmmsg_time64 #endif #ifdef __NR_recvmsg # define SYS_recvmsg __NR_recvmsg #endif #ifdef __NR_remap_file_pages # define SYS_remap_file_pages __NR_remap_file_pages #endif #ifdef __NR_removexattr # define SYS_removexattr __NR_removexattr #endif #ifdef __NR_rename # define SYS_rename __NR_rename #endif #ifdef __NR_renameat # define SYS_renameat __NR_renameat #endif #ifdef __NR_renameat2 # define SYS_renameat2 __NR_renameat2 #endif #ifdef __NR_request_key # define SYS_request_key __NR_request_key #endif #ifdef __NR_restart_syscall # define SYS_restart_syscall __NR_restart_syscall #endif #ifdef __NR_riscv_flush_icache # define SYS_riscv_flush_icache __NR_riscv_flush_icache #endif #ifdef __NR_rmdir # define SYS_rmdir __NR_rmdir #endif #ifdef __NR_rseq # define SYS_rseq __NR_rseq #endif #ifdef __NR_rt_sigaction # define SYS_rt_sigaction __NR_rt_sigaction #endif #ifdef __NR_rt_sigpending # define SYS_rt_sigpending __NR_rt_sigpending #endif #ifdef __NR_rt_sigprocmask # define SYS_rt_sigprocmask __NR_rt_sigprocmask #endif #ifdef __NR_rt_sigqueueinfo # define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo #endif #ifdef __NR_rt_sigreturn # define SYS_rt_sigreturn __NR_rt_sigreturn #endif #ifdef __NR_rt_sigsuspend # define SYS_rt_sigsuspend __NR_rt_sigsuspend #endif #ifdef __NR_rt_sigtimedwait # define SYS_rt_sigtimedwait __NR_rt_sigtimedwait #endif #ifdef __NR_rt_sigtimedwait_time64 # define SYS_rt_sigtimedwait_time64 __NR_rt_sigtimedwait_time64 #endif #ifdef __NR_rt_tgsigqueueinfo # define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo #endif #ifdef __NR_rtas # define SYS_rtas __NR_rtas #endif #ifdef __NR_s390_guarded_storage # define SYS_s390_guarded_storage __NR_s390_guarded_storage #endif #ifdef __NR_s390_pci_mmio_read # define SYS_s390_pci_mmio_read __NR_s390_pci_mmio_read #endif #ifdef __NR_s390_pci_mmio_write # define SYS_s390_pci_mmio_write __NR_s390_pci_mmio_write #endif #ifdef __NR_s390_runtime_instr # define SYS_s390_runtime_instr __NR_s390_runtime_instr #endif #ifdef __NR_s390_sthyi # define SYS_s390_sthyi __NR_s390_sthyi #endif #ifdef __NR_sched_get_affinity # define SYS_sched_get_affinity __NR_sched_get_affinity #endif #ifdef __NR_sched_get_priority_max # define SYS_sched_get_priority_max __NR_sched_get_priority_max #endif #ifdef __NR_sched_get_priority_min # define SYS_sched_get_priority_min __NR_sched_get_priority_min #endif #ifdef __NR_sched_getaffinity # define SYS_sched_getaffinity __NR_sched_getaffinity #endif #ifdef __NR_sched_getattr # define SYS_sched_getattr __NR_sched_getattr #endif #ifdef __NR_sched_getparam # define SYS_sched_getparam __NR_sched_getparam #endif #ifdef __NR_sched_getscheduler # define SYS_sched_getscheduler __NR_sched_getscheduler #endif #ifdef __NR_sched_rr_get_interval # define SYS_sched_rr_get_interval __NR_sched_rr_get_interval #endif #ifdef __NR_sched_rr_get_interval_time64 # define SYS_sched_rr_get_interval_time64 __NR_sched_rr_get_interval_time64 #endif #ifdef __NR_sched_set_affinity # define SYS_sched_set_affinity __NR_sched_set_affinity #endif #ifdef __NR_sched_setaffinity # define SYS_sched_setaffinity __NR_sched_setaffinity #endif #ifdef __NR_sched_setattr # define SYS_sched_setattr __NR_sched_setattr #endif #ifdef __NR_sched_setparam # define SYS_sched_setparam __NR_sched_setparam #endif #ifdef __NR_sched_setscheduler # define SYS_sched_setscheduler __NR_sched_setscheduler #endif #ifdef __NR_sched_yield # define SYS_sched_yield __NR_sched_yield #endif #ifdef __NR_seccomp # define SYS_seccomp __NR_seccomp #endif #ifdef __NR_security # define SYS_security __NR_security #endif #ifdef __NR_select # define SYS_select __NR_select #endif #ifdef __NR_semctl # define SYS_semctl __NR_semctl #endif #ifdef __NR_semget # define SYS_semget __NR_semget #endif #ifdef __NR_semop # define SYS_semop __NR_semop #endif #ifdef __NR_semtimedop # define SYS_semtimedop __NR_semtimedop #endif #ifdef __NR_semtimedop_time64 # define SYS_semtimedop_time64 __NR_semtimedop_time64 #endif #ifdef __NR_send # define SYS_send __NR_send #endif #ifdef __NR_sendfile # define SYS_sendfile __NR_sendfile #endif #ifdef __NR_sendfile64 # define SYS_sendfile64 __NR_sendfile64 #endif #ifdef __NR_sendmmsg # define SYS_sendmmsg __NR_sendmmsg #endif #ifdef __NR_sendmsg # define SYS_sendmsg __NR_sendmsg #endif #ifdef __NR_sendto # define SYS_sendto __NR_sendto #endif #ifdef __NR_set_mempolicy # define SYS_set_mempolicy __NR_set_mempolicy #endif #ifdef __NR_set_mempolicy_home_node # define SYS_set_mempolicy_home_node __NR_set_mempolicy_home_node #endif #ifdef __NR_set_robust_list # define SYS_set_robust_list __NR_set_robust_list #endif #ifdef __NR_set_thread_area # define SYS_set_thread_area __NR_set_thread_area #endif #ifdef __NR_set_tid_address # define SYS_set_tid_address __NR_set_tid_address #endif #ifdef __NR_set_tls # define SYS_set_tls __NR_set_tls #endif #ifdef __NR_setdomainname # define SYS_setdomainname __NR_setdomainname #endif #ifdef __NR_setfsgid # define SYS_setfsgid __NR_setfsgid #endif #ifdef __NR_setfsgid32 # define SYS_setfsgid32 __NR_setfsgid32 #endif #ifdef __NR_setfsuid # define SYS_setfsuid __NR_setfsuid #endif #ifdef __NR_setfsuid32 # define SYS_setfsuid32 __NR_setfsuid32 #endif #ifdef __NR_setgid # define SYS_setgid __NR_setgid #endif #ifdef __NR_setgid32 # define SYS_setgid32 __NR_setgid32 #endif #ifdef __NR_setgroups # define SYS_setgroups __NR_setgroups #endif #ifdef __NR_setgroups32 # define SYS_setgroups32 __NR_setgroups32 #endif #ifdef __NR_sethae # define SYS_sethae __NR_sethae #endif #ifdef __NR_sethostname # define SYS_sethostname __NR_sethostname #endif #ifdef __NR_setitimer # define SYS_setitimer __NR_setitimer #endif #ifdef __NR_setns # define SYS_setns __NR_setns #endif #ifdef __NR_setpgid # define SYS_setpgid __NR_setpgid #endif #ifdef __NR_setpgrp # define SYS_setpgrp __NR_setpgrp #endif #ifdef __NR_setpriority # define SYS_setpriority __NR_setpriority #endif #ifdef __NR_setregid # define SYS_setregid __NR_setregid #endif #ifdef __NR_setregid32 # define SYS_setregid32 __NR_setregid32 #endif #ifdef __NR_setresgid # define SYS_setresgid __NR_setresgid #endif #ifdef __NR_setresgid32 # define SYS_setresgid32 __NR_setresgid32 #endif #ifdef __NR_setresuid # define SYS_setresuid __NR_setresuid #endif #ifdef __NR_setresuid32 # define SYS_setresuid32 __NR_setresuid32 #endif #ifdef __NR_setreuid # define SYS_setreuid __NR_setreuid #endif #ifdef __NR_setreuid32 # define SYS_setreuid32 __NR_setreuid32 #endif #ifdef __NR_setrlimit # define SYS_setrlimit __NR_setrlimit #endif #ifdef __NR_setsid # define SYS_setsid __NR_setsid #endif #ifdef __NR_setsockopt # define SYS_setsockopt __NR_setsockopt #endif #ifdef __NR_settimeofday # define SYS_settimeofday __NR_settimeofday #endif #ifdef __NR_setuid # define SYS_setuid __NR_setuid #endif #ifdef __NR_setuid32 # define SYS_setuid32 __NR_setuid32 #endif #ifdef __NR_setxattr # define SYS_setxattr __NR_setxattr #endif #ifdef __NR_sgetmask # define SYS_sgetmask __NR_sgetmask #endif #ifdef __NR_shmat # define SYS_shmat __NR_shmat #endif #ifdef __NR_shmctl # define SYS_shmctl __NR_shmctl #endif #ifdef __NR_shmdt # define SYS_shmdt __NR_shmdt #endif #ifdef __NR_shmget # define SYS_shmget __NR_shmget #endif #ifdef __NR_shutdown # define SYS_shutdown __NR_shutdown #endif #ifdef __NR_sigaction # define SYS_sigaction __NR_sigaction #endif #ifdef __NR_sigaltstack # define SYS_sigaltstack __NR_sigaltstack #endif #ifdef __NR_signal # define SYS_signal __NR_signal #endif #ifdef __NR_signalfd # define SYS_signalfd __NR_signalfd #endif #ifdef __NR_signalfd4 # define SYS_signalfd4 __NR_signalfd4 #endif #ifdef __NR_sigpending # define SYS_sigpending __NR_sigpending #endif #ifdef __NR_sigprocmask # define SYS_sigprocmask __NR_sigprocmask #endif #ifdef __NR_sigreturn # define SYS_sigreturn __NR_sigreturn #endif #ifdef __NR_sigsuspend # define SYS_sigsuspend __NR_sigsuspend #endif #ifdef __NR_socket # define SYS_socket __NR_socket #endif #ifdef __NR_socketcall # define SYS_socketcall __NR_socketcall #endif #ifdef __NR_socketpair # define SYS_socketpair __NR_socketpair #endif #ifdef __NR_splice # define SYS_splice __NR_splice #endif #ifdef __NR_spu_create # define SYS_spu_create __NR_spu_create #endif #ifdef __NR_spu_run # define SYS_spu_run __NR_spu_run #endif #ifdef __NR_ssetmask # define SYS_ssetmask __NR_ssetmask #endif #ifdef __NR_stat # define SYS_stat __NR_stat #endif #ifdef __NR_stat64 # define SYS_stat64 __NR_stat64 #endif #ifdef __NR_statfs # define SYS_statfs __NR_statfs #endif #ifdef __NR_statfs64 # define SYS_statfs64 __NR_statfs64 #endif #ifdef __NR_statx # define SYS_statx __NR_statx #endif #ifdef __NR_stime # define SYS_stime __NR_stime #endif #ifdef __NR_stty # define SYS_stty __NR_stty #endif #ifdef __NR_subpage_prot # define SYS_subpage_prot __NR_subpage_prot #endif #ifdef __NR_swapcontext # define SYS_swapcontext __NR_swapcontext #endif #ifdef __NR_swapoff # define SYS_swapoff __NR_swapoff #endif #ifdef __NR_swapon # define SYS_swapon __NR_swapon #endif #ifdef __NR_switch_endian # define SYS_switch_endian __NR_switch_endian #endif #ifdef __NR_symlink # define SYS_symlink __NR_symlink #endif #ifdef __NR_symlinkat # define SYS_symlinkat __NR_symlinkat #endif #ifdef __NR_sync # define SYS_sync __NR_sync #endif #ifdef __NR_sync_file_range # define SYS_sync_file_range __NR_sync_file_range #endif #ifdef __NR_sync_file_range2 # define SYS_sync_file_range2 __NR_sync_file_range2 #endif #ifdef __NR_syncfs # define SYS_syncfs __NR_syncfs #endif #ifdef __NR_sys_debug_setcontext # define SYS_sys_debug_setcontext __NR_sys_debug_setcontext #endif #ifdef __NR_sys_epoll_create # define SYS_sys_epoll_create __NR_sys_epoll_create #endif #ifdef __NR_sys_epoll_ctl # define SYS_sys_epoll_ctl __NR_sys_epoll_ctl #endif #ifdef __NR_sys_epoll_wait # define SYS_sys_epoll_wait __NR_sys_epoll_wait #endif #ifdef __NR_syscall # define SYS_syscall __NR_syscall #endif #ifdef __NR_sysfs # define SYS_sysfs __NR_sysfs #endif #ifdef __NR_sysinfo # define SYS_sysinfo __NR_sysinfo #endif #ifdef __NR_syslog # define SYS_syslog __NR_syslog #endif #ifdef __NR_sysmips # define SYS_sysmips __NR_sysmips #endif #ifdef __NR_tee # define SYS_tee __NR_tee #endif #ifdef __NR_tgkill # define SYS_tgkill __NR_tgkill #endif #ifdef __NR_time # define SYS_time __NR_time #endif #ifdef __NR_timer_create # define SYS_timer_create __NR_timer_create #endif #ifdef __NR_timer_delete # define SYS_timer_delete __NR_timer_delete #endif #ifdef __NR_timer_getoverrun # define SYS_timer_getoverrun __NR_timer_getoverrun #endif #ifdef __NR_timer_gettime # define SYS_timer_gettime __NR_timer_gettime #endif #ifdef __NR_timer_gettime64 # define SYS_timer_gettime64 __NR_timer_gettime64 #endif #ifdef __NR_timer_settime # define SYS_timer_settime __NR_timer_settime #endif #ifdef __NR_timer_settime64 # define SYS_timer_settime64 __NR_timer_settime64 #endif #ifdef __NR_timerfd # define SYS_timerfd __NR_timerfd #endif #ifdef __NR_timerfd_create # define SYS_timerfd_create __NR_timerfd_create #endif #ifdef __NR_timerfd_gettime # define SYS_timerfd_gettime __NR_timerfd_gettime #endif #ifdef __NR_timerfd_gettime64 # define SYS_timerfd_gettime64 __NR_timerfd_gettime64 #endif #ifdef __NR_timerfd_settime # define SYS_timerfd_settime __NR_timerfd_settime #endif #ifdef __NR_timerfd_settime64 # define SYS_timerfd_settime64 __NR_timerfd_settime64 #endif #ifdef __NR_times # define SYS_times __NR_times #endif #ifdef __NR_tkill # define SYS_tkill __NR_tkill #endif #ifdef __NR_truncate # define SYS_truncate __NR_truncate #endif #ifdef __NR_truncate64 # define SYS_truncate64 __NR_truncate64 #endif #ifdef __NR_tuxcall # define SYS_tuxcall __NR_tuxcall #endif #ifdef __NR_udftrap # define SYS_udftrap __NR_udftrap #endif #ifdef __NR_ugetrlimit # define SYS_ugetrlimit __NR_ugetrlimit #endif #ifdef __NR_ulimit # define SYS_ulimit __NR_ulimit #endif #ifdef __NR_umask # define SYS_umask __NR_umask #endif #ifdef __NR_umount # define SYS_umount __NR_umount #endif #ifdef __NR_umount2 # define SYS_umount2 __NR_umount2 #endif #ifdef __NR_uname # define SYS_uname __NR_uname #endif #ifdef __NR_unlink # define SYS_unlink __NR_unlink #endif #ifdef __NR_unlinkat # define SYS_unlinkat __NR_unlinkat #endif #ifdef __NR_unshare # define SYS_unshare __NR_unshare #endif #ifdef __NR_uselib # define SYS_uselib __NR_uselib #endif #ifdef __NR_userfaultfd # define SYS_userfaultfd __NR_userfaultfd #endif #ifdef __NR_usr26 # define SYS_usr26 __NR_usr26 #endif #ifdef __NR_usr32 # define SYS_usr32 __NR_usr32 #endif #ifdef __NR_ustat # define SYS_ustat __NR_ustat #endif #ifdef __NR_utime # define SYS_utime __NR_utime #endif #ifdef __NR_utimensat # define SYS_utimensat __NR_utimensat #endif #ifdef __NR_utimensat_time64 # define SYS_utimensat_time64 __NR_utimensat_time64 #endif #ifdef __NR_utimes # define SYS_utimes __NR_utimes #endif #ifdef __NR_utrap_install # define SYS_utrap_install __NR_utrap_install #endif #ifdef __NR_vfork # define SYS_vfork __NR_vfork #endif #ifdef __NR_vhangup # define SYS_vhangup __NR_vhangup #endif #ifdef __NR_vm86 # define SYS_vm86 __NR_vm86 #endif #ifdef __NR_vm86old # define SYS_vm86old __NR_vm86old #endif #ifdef __NR_vmsplice # define SYS_vmsplice __NR_vmsplice #endif #ifdef __NR_vserver # define SYS_vserver __NR_vserver #endif #ifdef __NR_wait4 # define SYS_wait4 __NR_wait4 #endif #ifdef __NR_waitid # define SYS_waitid __NR_waitid #endif #ifdef __NR_waitpid # define SYS_waitpid __NR_waitpid #endif #ifdef __NR_write # define SYS_write __NR_write #endif #ifdef __NR_writev # define SYS_writev __NR_writev #endif bits/sysctl.h 0000644 00000001602 15063602064 0007200 0 ustar 00 /* Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if defined __x86_64__ && defined __ILP32__ # error "sysctl system call is unsupported in x32 kernel" #endif bits/syslog-ldbl.h 0000644 00000002265 15063602064 0010120 0 ustar 00 /* -mlong-double-64 compatibility mode for syslog functions. Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSLOG_H # error "Never include <bits/syslog-ldbl.h> directly; use <sys/syslog.h> instead." #endif __LDBL_REDIR_DECL (syslog) #ifdef __USE_MISC __LDBL_REDIR_DECL (vsyslog) #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function __LDBL_REDIR_DECL (__syslog_chk) # ifdef __USE_MISC __LDBL_REDIR_DECL (__vsyslog_chk) # endif #endif bits/syslog-path.h 0000644 00000002044 15063602064 0010132 0 ustar 00 /* <bits/syslog-path.h> -- _PATH_LOG definition Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSLOG_H # error "Never include this file directly. Use <sys/syslog.h> instead" #endif #ifndef _BITS_SYSLOG_PATH_H #define _BITS_SYSLOG_PATH_H 1 #define _PATH_LOG "/dev/log" #endif /* bits/syslog-path.h */ bits/syslog.h 0000644 00000003224 15063602064 0007201 0 ustar 00 /* Checking macros for syslog functions. Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SYSLOG_H # error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead." #endif extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); #ifdef __va_arg_pack __fortify_function void syslog (int __pri, const char *__fmt, ...) { __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } #elif !defined __cplusplus # define syslog(pri, ...) \ __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) #endif #ifdef __USE_MISC extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt, __gnuc_va_list __ap) __attribute__ ((__format__ (__printf__, 3, 0))); __fortify_function void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) { __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } #endif bits/sysmacros.h 0000644 00000005610 15063602064 0007705 0 ustar 00 /* Definitions of macros to access `dev_t' values. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_SYSMACROS_H #define _BITS_SYSMACROS_H 1 #ifndef _SYS_SYSMACROS_H # error "Never include <bits/sysmacros.h> directly; use <sys/sysmacros.h> instead." #endif /* dev_t in glibc is a 64-bit quantity, with 32-bit major and minor numbers. Our default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major number and m is a hex digit of the minor number. This is downward compatible with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also downward compatible with the Linux kernel, which (as of 2016) uses 32-bit dev_t, encoded as mmmM MMmm. Systems that use an incompatible encoding for dev_t should override this file in the appropriate sysdeps subdirectory. */ #define __SYSMACROS_DECLARE_MAJOR(DECL_TEMPL) \ DECL_TEMPL(unsigned int, major, (__dev_t __dev)) #define __SYSMACROS_DEFINE_MAJOR(DECL_TEMPL) \ __SYSMACROS_DECLARE_MAJOR (DECL_TEMPL) \ { \ unsigned int __major; \ __major = ((__dev & (__dev_t) 0x00000000000fff00u) >> 8); \ __major |= ((__dev & (__dev_t) 0xfffff00000000000u) >> 32); \ return __major; \ } #define __SYSMACROS_DECLARE_MINOR(DECL_TEMPL) \ DECL_TEMPL(unsigned int, minor, (__dev_t __dev)) #define __SYSMACROS_DEFINE_MINOR(DECL_TEMPL) \ __SYSMACROS_DECLARE_MINOR (DECL_TEMPL) \ { \ unsigned int __minor; \ __minor = ((__dev & (__dev_t) 0x00000000000000ffu) >> 0); \ __minor |= ((__dev & (__dev_t) 0x00000ffffff00000u) >> 12); \ return __minor; \ } #define __SYSMACROS_DECLARE_MAKEDEV(DECL_TEMPL) \ DECL_TEMPL(__dev_t, makedev, (unsigned int __major, unsigned int __minor)) #define __SYSMACROS_DEFINE_MAKEDEV(DECL_TEMPL) \ __SYSMACROS_DECLARE_MAKEDEV (DECL_TEMPL) \ { \ __dev_t __dev; \ __dev = (((__dev_t) (__major & 0x00000fffu)) << 8); \ __dev |= (((__dev_t) (__major & 0xfffff000u)) << 32); \ __dev |= (((__dev_t) (__minor & 0x000000ffu)) << 0); \ __dev |= (((__dev_t) (__minor & 0xffffff00u)) << 12); \ return __dev; \ } #endif /* bits/sysmacros.h */ bits/termios.h 0000644 00000012363 15063602064 0007347 0 ustar 00 /* termios type and macro definitions. Linux version. Copyright (C) 1993-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _TERMIOS_H # error "Never include <bits/termios.h> directly; use <termios.h> instead." #endif typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; #define NCCS 32 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; /* c_cc characters */ #define VINTR 0 #define VQUIT 1 #define VERASE 2 #define VKILL 3 #define VEOF 4 #define VTIME 5 #define VMIN 6 #define VSWTC 7 #define VSTART 8 #define VSTOP 9 #define VSUSP 10 #define VEOL 11 #define VREPRINT 12 #define VDISCARD 13 #define VWERASE 14 #define VLNEXT 15 #define VEOL2 16 /* c_iflag bits */ #define IGNBRK 0000001 #define BRKINT 0000002 #define IGNPAR 0000004 #define PARMRK 0000010 #define INPCK 0000020 #define ISTRIP 0000040 #define INLCR 0000100 #define IGNCR 0000200 #define ICRNL 0000400 #define IUCLC 0001000 #define IXON 0002000 #define IXANY 0004000 #define IXOFF 0010000 #define IMAXBEL 0020000 #define IUTF8 0040000 /* c_oflag bits */ #define OPOST 0000001 #define OLCUC 0000002 #define ONLCR 0000004 #define OCRNL 0000010 #define ONOCR 0000020 #define ONLRET 0000040 #define OFILL 0000100 #define OFDEL 0000200 #if defined __USE_MISC || defined __USE_XOPEN # define NLDLY 0000400 # define NL0 0000000 # define NL1 0000400 # define CRDLY 0003000 # define CR0 0000000 # define CR1 0001000 # define CR2 0002000 # define CR3 0003000 # define TABDLY 0014000 # define TAB0 0000000 # define TAB1 0004000 # define TAB2 0010000 # define TAB3 0014000 # define BSDLY 0020000 # define BS0 0000000 # define BS1 0020000 # define FFDLY 0100000 # define FF0 0000000 # define FF1 0100000 #endif #define VTDLY 0040000 #define VT0 0000000 #define VT1 0040000 #ifdef __USE_MISC # define XTABS 0014000 #endif /* c_cflag bit meaning */ #ifdef __USE_MISC # define CBAUD 0010017 #endif #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 #define B110 0000003 #define B134 0000004 #define B150 0000005 #define B200 0000006 #define B300 0000007 #define B600 0000010 #define B1200 0000011 #define B1800 0000012 #define B2400 0000013 #define B4800 0000014 #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 #ifdef __USE_MISC # define EXTA B19200 # define EXTB B38400 #endif #define CSIZE 0000060 #define CS5 0000000 #define CS6 0000020 #define CS7 0000040 #define CS8 0000060 #define CSTOPB 0000100 #define CREAD 0000200 #define PARENB 0000400 #define PARODD 0001000 #define HUPCL 0002000 #define CLOCAL 0004000 #ifdef __USE_MISC # define CBAUDEX 0010000 #endif #define B57600 0010001 #define B115200 0010002 #define B230400 0010003 #define B460800 0010004 #define B500000 0010005 #define B576000 0010006 #define B921600 0010007 #define B1000000 0010010 #define B1152000 0010011 #define B1500000 0010012 #define B2000000 0010013 #define B2500000 0010014 #define B3000000 0010015 #define B3500000 0010016 #define B4000000 0010017 #define __MAX_BAUD B4000000 #ifdef __USE_MISC # define CIBAUD 002003600000 /* input baud rate (not used) */ # define CMSPAR 010000000000 /* mark or space (stick) parity */ # define CRTSCTS 020000000000 /* flow control */ #endif /* c_lflag bits */ #define ISIG 0000001 #define ICANON 0000002 #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) # define XCASE 0000004 #endif #define ECHO 0000010 #define ECHOE 0000020 #define ECHOK 0000040 #define ECHONL 0000100 #define NOFLSH 0000200 #define TOSTOP 0000400 #ifdef __USE_MISC # define ECHOCTL 0001000 # define ECHOPRT 0002000 # define ECHOKE 0004000 # define FLUSHO 0010000 # define PENDIN 0040000 #endif #define IEXTEN 0100000 #ifdef __USE_MISC # define EXTPROC 0200000 #endif /* tcflow() and TCXONC use these */ #define TCOOFF 0 #define TCOON 1 #define TCIOFF 2 #define TCION 3 /* tcflush() and TCFLSH use these */ #define TCIFLUSH 0 #define TCOFLUSH 1 #define TCIOFLUSH 2 /* tcsetattr uses these */ #define TCSANOW 0 #define TCSADRAIN 1 #define TCSAFLUSH 2 #define _IOT_termios /* Hurd ioctl type field. */ \ _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) bits/thread-shared-types.h 0000644 00000015117 15063602064 0011542 0 ustar 00 /* Common threading primitives definitions for both POSIX and C11. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _THREAD_SHARED_TYPES_H #define _THREAD_SHARED_TYPES_H 1 /* Arch-specific definitions. Each architecture must define the following macros to define the expected sizes of pthread data types: __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. Also, the following macros must be define for internal pthread_mutex_t struct definitions (struct __pthread_mutex_s): __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' and before '__spin' (for 64 bits) or '__nusers' (for 32 bits). __PTHREAD_COMPAT_PADDING_END - any additional members at the end of the internal structure. __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock elision or 0 otherwise. __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The preferred value for new architectures is 0. __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and __list will be place inside a union for linuxthreads compatibility. The preferred value for new architectures is 0. For a new port the preferred values for the required defines are: #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 #define __PTHREAD_MUTEX_USE_UNION 0 __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to eventually support lock elision using transactional memory. The additional macro defines any constraint for the lock alignment inside the thread structures: __LOCK_ALIGNMENT - for internal lock/futex usage. Same idea but for the once locking primitive: __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) must be defined. */ #include <bits/pthreadtypes-arch.h> /* Common definition of pthread_mutex_t. */ #if !__PTHREAD_MUTEX_USE_UNION typedef struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __pthread_list_t; #else typedef struct __pthread_internal_slist { struct __pthread_internal_slist *__next; } __pthread_slist_t; #endif /* Lock elision support. */ #if __PTHREAD_MUTEX_LOCK_ELISION # if !__PTHREAD_MUTEX_USE_UNION # define __PTHREAD_SPINS_DATA \ short __spins; \ short __elision # define __PTHREAD_SPINS 0, 0 # else # define __PTHREAD_SPINS_DATA \ struct \ { \ short __espins; \ short __eelision; \ } __elision_data # define __PTHREAD_SPINS { 0, 0 } # define __spins __elision_data.__espins # define __elision __elision_data.__eelision # endif #else # define __PTHREAD_SPINS_DATA int __spins /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */ # define __PTHREAD_SPINS 0 #endif struct __pthread_mutex_s { int __lock __LOCK_ALIGNMENT; unsigned int __count; int __owner; #if !__PTHREAD_MUTEX_NUSERS_AFTER_KIND unsigned int __nusers; #endif /* KIND must stay at this position in the structure to maintain binary compatibility with static initializers. Concurrency notes: The __kind of a mutex is initialized either by the static PTHREAD_MUTEX_INITIALIZER or by a call to pthread_mutex_init. After a mutex has been initialized, the __kind of a mutex is usually not changed. BUT it can be set to -1 in pthread_mutex_destroy or elision can be enabled. This is done concurrently in the pthread_mutex_*lock functions by using the macro FORCE_ELISION. This macro is only defined for architectures which supports lock elision. For elision, there are the flags PTHREAD_MUTEX_ELISION_NP and PTHREAD_MUTEX_NO_ELISION_NP which can be set in addition to the already set type of a mutex. Before a mutex is initialized, only PTHREAD_MUTEX_NO_ELISION_NP can be set with pthread_mutexattr_settype. After a mutex has been initialized, the functions pthread_mutex_*lock can enable elision - if the mutex-type and the machine supports it - by setting the flag PTHREAD_MUTEX_ELISION_NP. This is done concurrently. Afterwards the lock / unlock functions are using specific elision code-paths. */ int __kind; __PTHREAD_COMPAT_PADDING_MID #if __PTHREAD_MUTEX_NUSERS_AFTER_KIND unsigned int __nusers; #endif #if !__PTHREAD_MUTEX_USE_UNION __PTHREAD_SPINS_DATA; __pthread_list_t __list; # define __PTHREAD_MUTEX_HAVE_PREV 1 #else __extension__ union { __PTHREAD_SPINS_DATA; __pthread_slist_t __list; }; # define __PTHREAD_MUTEX_HAVE_PREV 0 #endif __PTHREAD_COMPAT_PADDING_END }; /* Common definition of pthread_cond_t. */ struct __pthread_cond_s { __extension__ union { __extension__ unsigned long long int __wseq; struct { unsigned int __low; unsigned int __high; } __wseq32; }; __extension__ union { __extension__ unsigned long long int __g1_start; struct { unsigned int __low; unsigned int __high; } __g1_start32; }; unsigned int __glibc_unused___g_refs[2] __LOCK_ALIGNMENT; unsigned int __g_size[2]; unsigned int __g1_orig_size; unsigned int __wrefs; unsigned int __g_signals[2]; }; #endif /* _THREAD_SHARED_TYPES_H */ bits/time.h 0000644 00000005666 15063602064 0006633 0 ustar 00 /* System-dependent timing definitions. Linux version. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <time.h> instead. */ #ifndef _BITS_TIME_H #define _BITS_TIME_H 1 #include <bits/types.h> /* ISO/IEC 9899:1999 7.23.1: Components of time The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is the number per second of the value returned by the `clock' function. */ /* CAE XSH, Issue 4, Version 2: <time.h> The value of CLOCKS_PER_SEC is required to be 1 million on all XSI-conformant systems. */ #define CLOCKS_PER_SEC ((__clock_t) 1000000) #if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \ && !defined __USE_XOPEN2K /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK presents the real value for clock ticks per second for the system. */ extern long int __sysconf (int); # define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ #endif #ifdef __USE_POSIX199309 /* Identifier for system-wide realtime clock. */ # define CLOCK_REALTIME 0 /* Monotonic system-wide clock. */ # define CLOCK_MONOTONIC 1 /* High-resolution timer from the CPU. */ # define CLOCK_PROCESS_CPUTIME_ID 2 /* Thread-specific CPU-time clock. */ # define CLOCK_THREAD_CPUTIME_ID 3 /* Monotonic system-wide clock, not adjusted for frequency scaling. */ # define CLOCK_MONOTONIC_RAW 4 /* Identifier for system-wide realtime clock, updated only on ticks. */ # define CLOCK_REALTIME_COARSE 5 /* Monotonic system-wide clock, updated only on ticks. */ # define CLOCK_MONOTONIC_COARSE 6 /* Monotonic system-wide clock that includes time spent in suspension. */ # define CLOCK_BOOTTIME 7 /* Like CLOCK_REALTIME but also wakes suspended system. */ # define CLOCK_REALTIME_ALARM 8 /* Like CLOCK_BOOTTIME but also wakes suspended system. */ # define CLOCK_BOOTTIME_ALARM 9 /* Like CLOCK_REALTIME but in International Atomic Time. */ # define CLOCK_TAI 11 /* Flag to indicate time is absolute. */ # define TIMER_ABSTIME 1 #endif #ifdef __USE_GNU # include <bits/timex.h> __BEGIN_DECLS /* Tune a POSIX clock. */ extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW; __END_DECLS #endif /* use GNU */ #endif /* bits/time.h */ bits/timerfd.h 0000644 00000002116 15063602064 0007312 0 ustar 00 /* Copyright (C) 2008-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_TIMERFD_H # error "Never use <bits/timerfd.h> directly; include <sys/timerfd.h> instead." #endif /* Bits to be set in the FLAGS parameter of `timerfd_create'. */ enum { TFD_CLOEXEC = 02000000, #define TFD_CLOEXEC TFD_CLOEXEC TFD_NONBLOCK = 00004000 #define TFD_NONBLOCK TFD_NONBLOCK }; bits/timex.h 0000644 00000010763 15063602064 0007015 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TIMEX_H #define _BITS_TIMEX_H 1 #include <bits/types.h> #include <bits/types/struct_timeval.h> /* These definitions from linux/timex.h as of 3.18. */ struct timex { unsigned int modes; /* mode selector */ __syscall_slong_t offset; /* time offset (usec) */ __syscall_slong_t freq; /* frequency offset (scaled ppm) */ __syscall_slong_t maxerror; /* maximum error (usec) */ __syscall_slong_t esterror; /* estimated error (usec) */ int status; /* clock command/status */ __syscall_slong_t constant; /* pll time constant */ __syscall_slong_t precision; /* clock precision (usec) (ro) */ __syscall_slong_t tolerance; /* clock frequency tolerance (ppm) (ro) */ struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ __syscall_slong_t tick; /* (modified) usecs between clock ticks */ __syscall_slong_t ppsfreq; /* pps frequency (scaled ppm) (ro) */ __syscall_slong_t jitter; /* pps jitter (us) (ro) */ int shift; /* interval duration (s) (shift) (ro) */ __syscall_slong_t stabil; /* pps stability (scaled ppm) (ro) */ __syscall_slong_t jitcnt; /* jitter limit exceeded (ro) */ __syscall_slong_t calcnt; /* calibration intervals (ro) */ __syscall_slong_t errcnt; /* calibration errors (ro) */ __syscall_slong_t stbcnt; /* stability limit exceeded (ro) */ int tai; /* TAI offset (ro) */ /* ??? */ int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; /* Mode codes (timex.mode) */ #define ADJ_OFFSET 0x0001 /* time offset */ #define ADJ_FREQUENCY 0x0002 /* frequency offset */ #define ADJ_MAXERROR 0x0004 /* maximum time error */ #define ADJ_ESTERROR 0x0008 /* estimated time error */ #define ADJ_STATUS 0x0010 /* clock status */ #define ADJ_TIMECONST 0x0020 /* pll time constant */ #define ADJ_TAI 0x0080 /* set TAI offset */ #define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ #define ADJ_MICRO 0x1000 /* select microsecond resolution */ #define ADJ_NANO 0x2000 /* select nanosecond resolution */ #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ /* xntp 3.4 compatibility names */ #define MOD_OFFSET ADJ_OFFSET #define MOD_FREQUENCY ADJ_FREQUENCY #define MOD_MAXERROR ADJ_MAXERROR #define MOD_ESTERROR ADJ_ESTERROR #define MOD_STATUS ADJ_STATUS #define MOD_TIMECONST ADJ_TIMECONST #define MOD_CLKB ADJ_TICK #define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ #define MOD_TAI ADJ_TAI #define MOD_MICRO ADJ_MICRO #define MOD_NANO ADJ_NANO /* Status codes (timex.status) */ #define STA_PLL 0x0001 /* enable PLL updates (rw) */ #define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ #define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ #define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ #define STA_INS 0x0010 /* insert leap (rw) */ #define STA_DEL 0x0020 /* delete leap (rw) */ #define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ #define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ #define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ #define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ #define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ /* Read-only bits */ #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) #endif /* bits/timex.h */ bits/types.h 0000644 00000020217 15063602064 0007026 0 ustar 00 /* bits/types.h -- definitions of __*_t types underlying *_t types. Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <sys/types.h> instead. */ #ifndef _BITS_TYPES_H #define _BITS_TYPES_H 1 #include <features.h> #include <bits/wordsize.h> /* Convenience types. */ typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; /* Fixed-size types, underlying types depend on word size and compiler. */ typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; #if __WORDSIZE == 64 typedef signed long int __int64_t; typedef unsigned long int __uint64_t; #else __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif /* Smallest types with at least a given width. */ typedef __int8_t __int_least8_t; typedef __uint8_t __uint_least8_t; typedef __int16_t __int_least16_t; typedef __uint16_t __uint_least16_t; typedef __int32_t __int_least32_t; typedef __uint32_t __uint_least32_t; typedef __int64_t __int_least64_t; typedef __uint64_t __uint_least64_t; /* quad_t is also 64 bits. */ #if __WORDSIZE == 64 typedef long int __quad_t; typedef unsigned long int __u_quad_t; #else __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; #endif /* Largest integral types. */ #if __WORDSIZE == 64 typedef long int __intmax_t; typedef unsigned long int __uintmax_t; #else __extension__ typedef long long int __intmax_t; __extension__ typedef unsigned long long int __uintmax_t; #endif /* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE macros for each of the OS types we define below. The definitions of those macros must use the following macros for underlying types. We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned variants of each of the following integer types on this machine. 16 -- "natural" 16-bit type (always short) 32 -- "natural" 32-bit type (always int) 64 -- "natural" 64-bit type (long or long long) LONG32 -- 32-bit type, traditionally long QUAD -- 64-bit type, traditionally long long WORD -- natural type of __WORDSIZE bits (int or long) LONGWORD -- type of __WORDSIZE bits, traditionally long We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the conventional uses of `long' or `long long' type modifiers match the types we define, even when a less-adorned type would be the same size. This matters for (somewhat) portably writing printf/scanf formats for these types, where using the appropriate l or ll format modifiers can make the typedefs and the formats match up across all GNU platforms. If we used `long' when it's 64 bits where `long long' is expected, then the compiler would warn about the formats not matching the argument types, and the programmer changing them to shut up the compiler would break the program's portability. Here we assume what is presently the case in all the GCC configurations we support: long long is always 64 bits, long is always word/address size, and int is always 32 bits. */ #define __S16_TYPE short int #define __U16_TYPE unsigned short int #define __S32_TYPE int #define __U32_TYPE unsigned int #define __SLONGWORD_TYPE long int #define __ULONGWORD_TYPE unsigned long int #if __WORDSIZE == 32 # define __SQUAD_TYPE __int64_t # define __UQUAD_TYPE __uint64_t # define __SWORD_TYPE int # define __UWORD_TYPE unsigned int # define __SLONG32_TYPE long int # define __ULONG32_TYPE unsigned long int # define __S64_TYPE __int64_t # define __U64_TYPE __uint64_t /* We want __extension__ before typedef's that use nonstandard base types such as `long long' in C89 mode. */ # define __STD_TYPE __extension__ typedef #elif __WORDSIZE == 64 # define __SQUAD_TYPE long int # define __UQUAD_TYPE unsigned long int # define __SWORD_TYPE long int # define __UWORD_TYPE unsigned long int # define __SLONG32_TYPE int # define __ULONG32_TYPE unsigned int # define __S64_TYPE long int # define __U64_TYPE unsigned long int /* No need to mark the typedef with __extension__. */ # define __STD_TYPE typedef #else # error #endif #include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */ __STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ __STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ __STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */ __STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */ __STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/ __STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */ __STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */ __STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ __STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ __STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */ __STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */ __STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */ __STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ __STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ __STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ __STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ /* Clock ID used in clock and timer functions. */ __STD_TYPE __CLOCKID_T_TYPE __clockid_t; /* Timer ID returned by `timer_create'. */ __STD_TYPE __TIMER_T_TYPE __timer_t; /* Type to represent block size. */ __STD_TYPE __BLKSIZE_T_TYPE __blksize_t; /* Types from the Large File Support interface. */ /* Type to count number of disk blocks. */ __STD_TYPE __BLKCNT_T_TYPE __blkcnt_t; __STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t; /* Type to count file system blocks. */ __STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t; __STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t; /* Type to count file system nodes. */ __STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t; __STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t; /* Type of miscellaneous file system fields. */ __STD_TYPE __FSWORD_T_TYPE __fsword_t; __STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */ /* Signed long type used in system calls. */ __STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t; /* Unsigned long type used in system calls. */ __STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t; /* These few don't really vary by system, they always correspond to one of the other defined types. */ typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ typedef char *__caddr_t; /* Duplicates info from stdint.h but this is used in unistd.h. */ __STD_TYPE __SWORD_TYPE __intptr_t; /* Duplicate info from sys/socket.h. */ __STD_TYPE __U32_TYPE __socklen_t; /* C99: An integer type that can be accessed as an atomic entity, even in the presence of asynchronous interrupts. It is not currently necessary for this to be machine-specific. */ typedef int __sig_atomic_t; #undef __STD_TYPE #endif /* bits/types.h */ bits/typesizes.h 0000644 00000006505 15063602064 0007725 0 ustar 00 /* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. Copyright (C) 2012-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TYPES_H # error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." #endif #ifndef _BITS_TYPESIZES_H #define _BITS_TYPESIZES_H 1 /* See <bits/types.h> for the meaning of these macros. This file exists so that <bits/types.h> need not vary across different GNU platforms. */ /* X32 kernel interface is 64-bit. */ #if defined __x86_64__ && defined __ILP32__ # define __SYSCALL_SLONG_TYPE __SQUAD_TYPE # define __SYSCALL_ULONG_TYPE __UQUAD_TYPE #else # define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE # define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #endif #define __DEV_T_TYPE __UQUAD_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __SYSCALL_ULONG_TYPE #define __INO64_T_TYPE __UQUAD_TYPE #define __MODE_T_TYPE __U32_TYPE #ifdef __x86_64__ # define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE # define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE #else # define __NLINK_T_TYPE __UWORD_TYPE # define __FSWORD_T_TYPE __SWORD_TYPE #endif #define __OFF_T_TYPE __SYSCALL_SLONG_TYPE #define __OFF64_T_TYPE __SQUAD_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE #define __RLIM64_T_TYPE __UQUAD_TYPE #define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE #define __BLKCNT64_T_TYPE __SQUAD_TYPE #define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE #define __FSBLKCNT64_T_TYPE __UQUAD_TYPE #define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE #define __FSFILCNT64_T_TYPE __UQUAD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE #define __TIME_T_TYPE __SYSCALL_SLONG_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * #define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE #define __FSID_T_TYPE struct { int __val[2]; } #define __SSIZE_T_TYPE __SWORD_TYPE #define __CPU_MASK_TYPE __SYSCALL_ULONG_TYPE #ifdef __x86_64__ /* Tell the libc code that off_t and off64_t are actually the same type for all ABI purposes, even if possibly expressed as different base types for C type-checking purposes. */ # define __OFF_T_MATCHES_OFF64_T 1 /* Same for ino_t and ino64_t. */ # define __INO_T_MATCHES_INO64_T 1 /* And for __rlim_t and __rlim64_t. */ # define __RLIM_T_MATCHES_RLIM64_T 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 #endif /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 1024 #endif /* bits/typesizes.h */ bits/uintn-identity.h 0000644 00000003005 15063602064 0010642 0 ustar 00 /* Inline functions to return unsigned integer values unchanged. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _NETINET_IN_H && !defined _ENDIAN_H # error "Never use <bits/uintn-identity.h> directly; include <netinet/in.h> or <endian.h> instead." #endif #ifndef _BITS_UINTN_IDENTITY_H #define _BITS_UINTN_IDENTITY_H 1 #include <bits/types.h> /* These inline functions are to ensure the appropriate type conversions and associated diagnostics from macros that convert to a given endianness. */ static __inline __uint16_t __uint16_identity (__uint16_t __x) { return __x; } static __inline __uint32_t __uint32_identity (__uint32_t __x) { return __x; } static __inline __uint64_t __uint64_identity (__uint64_t __x) { return __x; } #endif /* _BITS_UINTN_IDENTITY_H. */ bits/uio-ext.h 0000644 00000003602 15063602064 0007253 0 ustar 00 /* Operating system-specific extensions to sys/uio.h - Linux version. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_UIO_EXT_H #define _BITS_UIO_EXT_H 1 #ifndef _SYS_UIO_H # error "Never include <bits/uio-ext.h> directly; use <sys/uio.h> instead." #endif __BEGIN_DECLS /* Read from another process' address space. */ extern ssize_t process_vm_readv (pid_t __pid, const struct iovec *__lvec, unsigned long int __liovcnt, const struct iovec *__rvec, unsigned long int __riovcnt, unsigned long int __flags) __THROW; /* Write to another process' address space. */ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, unsigned long int __liovcnt, const struct iovec *__rvec, unsigned long int __riovcnt, unsigned long int __flags) __THROW; /* Flags for preadv2/pwritev2. */ #define RWF_HIPRI 0x00000001 /* High priority request. */ #define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC. */ #define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */ #define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */ #define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */ __END_DECLS #endif /* bits/uio-ext.h */ bits/uio_lim.h 0000644 00000002550 15063602064 0007317 0 ustar 00 /* Implementation limits related to sys/uio.h - Linux version. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_UIO_LIM_H #define _BITS_UIO_LIM_H 1 /* Maximum length of the 'struct iovec' array in a single call to readv or writev. This macro has different values in different kernel versions. The latest versions of the kernel use 1024 and this is good choice. Since the C library implementation of readv/writev is able to emulate the functionality even if the currently running kernel does not support this large value the readv/writev call will not fail because of this. */ #define __IOV_MAX 1024 #endif bits/unistd.h 0000644 00000025074 15063602064 0007176 0 ustar 00 /* Checking macros for unistd functions. Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UNISTD_H # error "Never include <bits/unistd.h> directly; use <unistd.h> instead." #endif extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes, size_t __buflen) __wur; extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, size_t __nbytes), read) __wur; extern ssize_t __REDIRECT (__read_chk_warn, (int __fd, void *__buf, size_t __nbytes, size_t __buflen), __read_chk) __wur __warnattr ("read called with bigger length than size of " "the destination buffer"); __fortify_function __wur ssize_t read (int __fd, void *__buf, size_t __nbytes) { return __glibc_fortify (read, __nbytes, sizeof (char), __glibc_objsize0 (__buf), __fd, __buf, __nbytes); } #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes, __off_t __offset, size_t __bufsize) __wur; extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes, __off64_t __offset, size_t __bufsize) __wur; extern ssize_t __REDIRECT (__pread_alias, (int __fd, void *__buf, size_t __nbytes, __off_t __offset), pread) __wur; extern ssize_t __REDIRECT (__pread64_alias, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset), pread64) __wur; extern ssize_t __REDIRECT (__pread_chk_warn, (int __fd, void *__buf, size_t __nbytes, __off_t __offset, size_t __bufsize), __pread_chk) __wur __warnattr ("pread called with bigger length than size of " "the destination buffer"); extern ssize_t __REDIRECT (__pread64_chk_warn, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset, size_t __bufsize), __pread64_chk) __wur __warnattr ("pread64 called with bigger length than size of " "the destination buffer"); # ifndef __USE_FILE_OFFSET64 __fortify_function __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) { return __glibc_fortify (pread, __nbytes, sizeof (char), __glibc_objsize0 (__buf), __fd, __buf, __nbytes, __offset); } # else __fortify_function __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { return __glibc_fortify (pread64, __nbytes, sizeof (char), __glibc_objsize0 (__buf), __fd, __buf, __nbytes, __offset); } # endif # ifdef __USE_LARGEFILE64 __fortify_function __wur ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { return __glibc_fortify (pread64, __nbytes, sizeof (char), __glibc_objsize0 (__buf), __fd, __buf, __nbytes, __offset); } # endif #endif #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K extern ssize_t __readlink_chk (const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __THROW __nonnull ((1, 2)) __wur; extern ssize_t __REDIRECT_NTH (__readlink_alias, (const char *__restrict __path, char *__restrict __buf, size_t __len), readlink) __nonnull ((1, 2)) __wur; extern ssize_t __REDIRECT_NTH (__readlink_chk_warn, (const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen), __readlink_chk) __nonnull ((1, 2)) __wur __warnattr ("readlink called with bigger length " "than size of destination buffer"); __fortify_function __nonnull ((1, 2)) __wur ssize_t __NTH (readlink (const char *__restrict __path, char *__restrict __buf, size_t __len)) { return __glibc_fortify (readlink, __len, sizeof (char), __glibc_objsize (__buf), __path, __buf, __len); } #endif #ifdef __USE_ATFILE extern ssize_t __readlinkat_chk (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __THROW __nonnull ((2, 3)) __wur; extern ssize_t __REDIRECT_NTH (__readlinkat_alias, (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len), readlinkat) __nonnull ((2, 3)) __wur; extern ssize_t __REDIRECT_NTH (__readlinkat_chk_warn, (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen), __readlinkat_chk) __nonnull ((2, 3)) __wur __warnattr ("readlinkat called with bigger " "length than size of destination " "buffer"); __fortify_function __nonnull ((2, 3)) __wur ssize_t __NTH (readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len)) { return __glibc_fortify (readlinkat, __len, sizeof (char), __glibc_objsize (__buf), __fd, __path, __buf, __len); } #endif extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) __THROW __wur; extern char *__REDIRECT_NTH (__getcwd_alias, (char *__buf, size_t __size), getcwd) __wur; extern char *__REDIRECT_NTH (__getcwd_chk_warn, (char *__buf, size_t __size, size_t __buflen), __getcwd_chk) __wur __warnattr ("getcwd caller with bigger length than size of " "destination buffer"); __fortify_function __wur char * __NTH (getcwd (char *__buf, size_t __size)) { return __glibc_fortify (getcwd, __size, sizeof (char), __glibc_objsize (__buf), __buf, __size); } #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED extern char *__getwd_chk (char *__buf, size_t buflen) __THROW __nonnull ((1)) __wur; extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd) __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd " "doesn't specify buffer size"); __fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char * __NTH (getwd (char *__buf)) { if (__glibc_objsize (__buf) != (size_t) -1) return __getwd_chk (__buf, __glibc_objsize (__buf)); return __getwd_warn (__buf); } #endif extern size_t __confstr_chk (int __name, char *__buf, size_t __len, size_t __buflen) __THROW; extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf, size_t __len), confstr); extern size_t __REDIRECT_NTH (__confstr_chk_warn, (int __name, char *__buf, size_t __len, size_t __buflen), __confstr_chk) __warnattr ("confstr called with bigger length than size of destination " "buffer"); __fortify_function size_t __NTH (confstr (int __name, char *__buf, size_t __len)) { return __glibc_fortify (confstr, __len, sizeof (char), __glibc_objsize (__buf), __name, __buf, __len); } extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen) __THROW __wur; extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]), getgroups) __wur; extern int __REDIRECT_NTH (__getgroups_chk_warn, (int __size, __gid_t __list[], size_t __listlen), __getgroups_chk) __wur __warnattr ("getgroups called with bigger group count than what " "can fit into destination buffer"); __fortify_function int __NTH (getgroups (int __size, __gid_t __list[])) { return __glibc_fortify (getgroups, __size, sizeof (__gid_t), __glibc_objsize (__list), __size, __list); } extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((2)); extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf, size_t __buflen), ttyname_r) __nonnull ((2)); extern int __REDIRECT_NTH (__ttyname_r_chk_warn, (int __fd, char *__buf, size_t __buflen, size_t __nreal), __ttyname_r_chk) __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than " "size of destination buffer"); __fortify_function int __NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) { return __glibc_fortify (ttyname_r, __buflen, sizeof (char), __glibc_objsize (__buf), __fd, __buf, __buflen); } #ifdef __USE_POSIX199506 extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal) __nonnull ((1)); extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen), getlogin_r) __nonnull ((1)); extern int __REDIRECT (__getlogin_r_chk_warn, (char *__buf, size_t __buflen, size_t __nreal), __getlogin_r_chk) __nonnull ((1)) __warnattr ("getlogin_r called with bigger buflen than " "size of destination buffer"); __fortify_function int getlogin_r (char *__buf, size_t __buflen) { return __glibc_fortify (getlogin_r, __buflen, sizeof (char), __glibc_objsize (__buf), __buf, __buflen); } #endif #if defined __USE_MISC || defined __USE_UNIX98 extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((1)); extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), gethostname) __nonnull ((1)); extern int __REDIRECT_NTH (__gethostname_chk_warn, (char *__buf, size_t __buflen, size_t __nreal), __gethostname_chk) __nonnull ((1)) __warnattr ("gethostname called with bigger buflen than " "size of destination buffer"); __fortify_function int __NTH (gethostname (char *__buf, size_t __buflen)) { return __glibc_fortify (gethostname, __buflen, sizeof (char), __glibc_objsize (__buf), __buf, __buflen); } #endif #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_UNIX98) extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal) __THROW __nonnull ((1)) __wur; extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf, size_t __buflen), getdomainname) __nonnull ((1)) __wur; extern int __REDIRECT_NTH (__getdomainname_chk_warn, (char *__buf, size_t __buflen, size_t __nreal), __getdomainname_chk) __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger " "buflen than size of destination " "buffer"); __fortify_function int __NTH (getdomainname (char *__buf, size_t __buflen)) { return __glibc_fortify (getdomainname, __buflen, sizeof (char), __glibc_objsize (__buf), __buf, __buflen); } #endif bits/utmp.h 0000644 00000007742 15063602064 0006657 0 ustar 00 /* The `struct utmp' type, describing entries in the utmp file. Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UTMP_H # error "Never include <bits/utmp.h> directly; use <utmp.h> instead." #endif #include <paths.h> #include <sys/time.h> #include <sys/types.h> #include <bits/wordsize.h> #define UT_LINESIZE 32 #define UT_NAMESIZE 32 #define UT_HOSTSIZE 256 /* The structure describing an entry in the database of previous logins. */ struct lastlog { #if __WORDSIZE_TIME64_COMPAT32 int32_t ll_time; #else __time_t ll_time; #endif char ll_line[UT_LINESIZE]; char ll_host[UT_HOSTSIZE]; }; /* The structure describing the status of a terminated process. This type is used in `struct utmp' below. */ struct exit_status { short int e_termination; /* Process termination status. */ short int e_exit; /* Process exit status. */ }; /* The structure describing an entry in the user accounting database. */ struct utmp { short int ut_type; /* Type of login. */ pid_t ut_pid; /* Process ID of login process. */ char ut_line[UT_LINESIZE] __attribute_nonstring__; /* Devicename. */ char ut_id[4] __attribute_nonstring__; /* Inittab ID. */ char ut_user[UT_NAMESIZE] __attribute_nonstring__; /* Username. */ char ut_host[UT_HOSTSIZE] __attribute_nonstring__; /* Hostname for remote login. */ struct exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ /* The ut_session and ut_tv fields must be the same size when compiled 32- and 64-bit. This allows data files and shared memory to be shared between 32- and 64-bit applications. */ #if __WORDSIZE_TIME64_COMPAT32 int32_t ut_session; /* Session ID, used for windowing. */ struct { int32_t tv_sec; /* Seconds. */ int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else long int ut_session; /* Session ID, used for windowing. */ struct timeval ut_tv; /* Time entry was made. */ #endif int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __glibc_reserved[20]; /* Reserved for future use. */ }; /* Backwards compatibility hacks. */ #define ut_name ut_user #ifndef _NO_UT_TIME /* We have a problem here: `ut_time' is also used otherwise. Define _NO_UT_TIME if the compiler complains. */ # define ut_time ut_tv.tv_sec #endif #define ut_xtime ut_tv.tv_sec #define ut_addr ut_addr_v6[0] /* Values for the `ut_type' field of a `struct utmp'. */ #define EMPTY 0 /* No valid user accounting information. */ #define RUN_LVL 1 /* The system's runlevel. */ #define BOOT_TIME 2 /* Time of system boot. */ #define NEW_TIME 3 /* Time after system clock changed. */ #define OLD_TIME 4 /* Time when system clock changed. */ #define INIT_PROCESS 5 /* Process spawned by the init process. */ #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ #define USER_PROCESS 7 /* Normal process. */ #define DEAD_PROCESS 8 /* Terminated process. */ #define ACCOUNTING 9 /* Old Linux name for the EMPTY type. */ #define UT_UNKNOWN EMPTY /* Tell the user that we have a modern system with UT_HOST, UT_PID, UT_TYPE, UT_ID and UT_TV fields. */ #define _HAVE_UT_TYPE 1 #define _HAVE_UT_PID 1 #define _HAVE_UT_ID 1 #define _HAVE_UT_TV 1 #define _HAVE_UT_HOST 1 bits/utmpx.h 0000644 00000006771 15063602064 0007050 0 ustar 00 /* Structures and definitions for the user accounting database. GNU version. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _UTMPX_H # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead." #endif #include <bits/types.h> #include <sys/time.h> #include <bits/wordsize.h> #ifdef __USE_GNU # include <paths.h> # define _PATH_UTMPX _PATH_UTMP # define _PATH_WTMPX _PATH_WTMP #endif #define __UT_LINESIZE 32 #define __UT_NAMESIZE 32 #define __UT_HOSTSIZE 256 /* The structure describing the status of a terminated process. This type is used in `struct utmpx' below. */ struct __exit_status { #ifdef __USE_GNU short int e_termination; /* Process termination status. */ short int e_exit; /* Process exit status. */ #else short int __e_termination; /* Process termination status. */ short int __e_exit; /* Process exit status. */ #endif }; /* The structure describing an entry in the user accounting database. */ struct utmpx { short int ut_type; /* Type of login. */ __pid_t ut_pid; /* Process ID of login process. */ char ut_line[__UT_LINESIZE] __attribute_nonstring__; /* Devicename. */ char ut_id[4] __attribute_nonstring__; /* Inittab ID. */ char ut_user[__UT_NAMESIZE] __attribute_nonstring__; /* Username. */ char ut_host[__UT_HOSTSIZE] __attribute_nonstring__; /* Hostname for remote login. */ struct __exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ /* The fields ut_session and ut_tv must be the same size when compiled 32- and 64-bit. This allows files and shared memory to be shared between 32- and 64-bit applications. */ #if __WORDSIZE_TIME64_COMPAT32 __int32_t ut_session; /* Session ID, used for windowing. */ struct { __int32_t tv_sec; /* Seconds. */ __int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else long int ut_session; /* Session ID, used for windowing. */ struct timeval ut_tv; /* Time entry was made. */ #endif __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __glibc_reserved[20]; /* Reserved for future use. */ }; /* Values for the `ut_type' field of a `struct utmpx'. */ #define EMPTY 0 /* No valid user accounting information. */ #ifdef __USE_GNU # define RUN_LVL 1 /* The system's runlevel. */ #endif #define BOOT_TIME 2 /* Time of system boot. */ #define NEW_TIME 3 /* Time after system clock changed. */ #define OLD_TIME 4 /* Time when system clock changed. */ #define INIT_PROCESS 5 /* Process spawned by the init process. */ #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ #define USER_PROCESS 7 /* Normal process. */ #define DEAD_PROCESS 8 /* Terminated process. */ #ifdef __USE_GNU # define ACCOUNTING 9 /* System accounting. */ #endif bits/utsname.h 0000644 00000002274 15063602064 0007341 0 ustar 00 /* Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UTSNAME_H # error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead." #endif /* Length of the entries in `struct utsname' is 65. */ #define _UTSNAME_LENGTH 65 /* Linux provides as additional information in the `struct utsname' the name of the current domain. Define _UTSNAME_DOMAIN_LENGTH to a value != 0 to activate this entry. */ #define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH bits/waitflags.h 0000644 00000003240 15063602064 0007640 0 ustar 00 /* Definitions of flag bits for `waitpid' et al. Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SYS_WAIT_H && !defined _STDLIB_H # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead." #endif /* Bits in the third argument to `waitpid'. */ #define WNOHANG 1 /* Don't block waiting. */ #define WUNTRACED 2 /* Report status of stopped children. */ /* Bits in the fourth argument to `waitid'. */ #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 # define WSTOPPED 2 /* Report stopped child (same as WUNTRACED). */ # define WEXITED 4 /* Report dead child. */ # define WCONTINUED 8 /* Report continued child. */ # define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ #endif #define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */ #define __WALL 0x40000000 /* Wait for any child. */ #define __WCLONE 0x80000000 /* Wait for cloned process. */ bits/waitstatus.h 0000644 00000004356 15063602064 0010100 0 ustar 00 /* Definitions of status bits for `wait' et al. Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #if !defined _SYS_WAIT_H && !defined _STDLIB_H # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead." #endif /* Everything extant so far uses these same bits. */ /* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ #define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) /* If WIFSIGNALED(STATUS), the terminating signal. */ #define __WTERMSIG(status) ((status) & 0x7f) /* If WIFSTOPPED(STATUS), the signal that stopped the child. */ #define __WSTOPSIG(status) __WEXITSTATUS(status) /* Nonzero if STATUS indicates normal termination. */ #define __WIFEXITED(status) (__WTERMSIG(status) == 0) /* Nonzero if STATUS indicates termination by a signal. */ #define __WIFSIGNALED(status) \ (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) /* Nonzero if STATUS indicates the child is stopped. */ #define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) /* Nonzero if STATUS indicates the child continued after a stop. We only define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */ #ifdef WCONTINUED # define __WIFCONTINUED(status) ((status) == __W_CONTINUED) #endif /* Nonzero if STATUS indicates the child dumped core. */ #define __WCOREDUMP(status) ((status) & __WCOREFLAG) /* Macros for constructing status values. */ #define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) #define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) #define __W_CONTINUED 0xffff #define __WCOREFLAG 0x80 bits/wchar-ldbl.h 0000644 00000004567 15063602064 0007713 0 ustar 00 /* -mlong-double-64 compatibility mode for <wchar.h> functions. Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _WCHAR_H # error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead." #endif #if defined __USE_ISOC95 || defined __USE_UNIX98 __LDBL_REDIR_DECL (fwprintf); __LDBL_REDIR_DECL (wprintf); __LDBL_REDIR_DECL (swprintf); __LDBL_REDIR_DECL (vfwprintf); __LDBL_REDIR_DECL (vwprintf); __LDBL_REDIR_DECL (vswprintf); # if defined __USE_ISOC99 && !defined __USE_GNU \ && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf) __LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf) __LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf) # else __LDBL_REDIR_DECL (fwscanf); __LDBL_REDIR_DECL (wscanf); __LDBL_REDIR_DECL (swscanf); # endif #endif #ifdef __USE_ISOC99 __LDBL_REDIR1_DECL (wcstold, wcstod); # if !defined __USE_GNU && !defined __REDIRECT \ && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) __LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf) __LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf) __LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf) # else __LDBL_REDIR_DECL (vfwscanf); __LDBL_REDIR_DECL (vwscanf); __LDBL_REDIR_DECL (vswscanf); # endif #endif #ifdef __USE_GNU __LDBL_REDIR1_DECL (wcstold_l, wcstod_l); #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function __LDBL_REDIR_DECL (__swprintf_chk) __LDBL_REDIR_DECL (__vswprintf_chk) # if __USE_FORTIFY_LEVEL > 1 __LDBL_REDIR_DECL (__fwprintf_chk) __LDBL_REDIR_DECL (__wprintf_chk) __LDBL_REDIR_DECL (__vfwprintf_chk) __LDBL_REDIR_DECL (__vwprintf_chk) # endif #endif bits/wchar.h 0000644 00000003561 15063602064 0006771 0 ustar 00 /* wchar_t type related definitions. Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_WCHAR_H #define _BITS_WCHAR_H 1 /* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__ are not defined, give the right value and type as long as both int and wchar_t are 32-bit types. Adding L'\0' to a constant value ensures that the type is correct; it is necessary to use (L'\0' + 0) rather than just L'\0' so that the type in C++ is the promoted version of wchar_t rather than the distinct wchar_t type itself. Because wchar_t in preprocessor #if expressions is treated as intmax_t or uintmax_t, the expression (L'\0' - 1) would have the wrong value for WCHAR_MAX in such expressions and so cannot be used to define __WCHAR_MAX in the unsigned case. */ #ifdef __WCHAR_MAX__ # define __WCHAR_MAX __WCHAR_MAX__ #elif L'\0' - 1 > 0 # define __WCHAR_MAX (0xffffffffu + L'\0') #else # define __WCHAR_MAX (0x7fffffff + L'\0') #endif #ifdef __WCHAR_MIN__ # define __WCHAR_MIN __WCHAR_MIN__ #elif L'\0' - 1 > 0 # define __WCHAR_MIN (L'\0' + 0) #else # define __WCHAR_MIN (-__WCHAR_MAX - 1) #endif #endif /* bits/wchar.h */ bits/wchar2.h 0000644 00000043455 15063602064 0007061 0 ustar 00 /* Checking macros for wchar functions. Copyright (C) 2005-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _WCHAR_H # error "Never include <bits/wchar2.h> directly; use <wchar.h> instead." #endif extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1) __THROW; extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n), wmemcpy); extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1), __wmemcpy_chk) __warnattr ("wmemcpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n)) { return __glibc_fortify_n (wmemcpy, __n, sizeof (wchar_t), __glibc_objsize0 (__s1), __s1, __s2, __n); } extern wchar_t *__wmemmove_chk (wchar_t *__s1, const wchar_t *__s2, size_t __n, size_t __ns1) __THROW; extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1, const wchar_t *__s2, size_t __n), wmemmove); extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn, (wchar_t *__s1, const wchar_t *__s2, size_t __n, size_t __ns1), __wmemmove_chk) __warnattr ("wmemmove called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)) { return __glibc_fortify_n (wmemmove, __n, sizeof (wchar_t), __glibc_objsize0 (__s1), __s1, __s2, __n); } #ifdef __USE_GNU extern wchar_t *__wmempcpy_chk (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1) __THROW; extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n), wmempcpy); extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn, (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n, size_t __ns1), __wmempcpy_chk) __warnattr ("wmempcpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2, size_t __n)) { return __glibc_fortify_n (wmempcpy, __n, sizeof (wchar_t), __glibc_objsize0 (__s1), __s1, __s2, __n); } #endif extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, size_t __ns) __THROW; extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c, size_t __n), wmemset); extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn, (wchar_t *__s, wchar_t __c, size_t __n, size_t __ns), __wmemset_chk) __warnattr ("wmemset called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) { return __glibc_fortify_n (wmemset, __n, sizeof (wchar_t), __glibc_objsize0 (__s), __s, __c, __n); } extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n) __THROW; extern wchar_t *__REDIRECT_NTH (__wcscpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src), wcscpy); __fortify_function wchar_t * __NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { size_t sz = __glibc_objsize (__dest); if (sz != (size_t) -1) return __wcscpy_chk (__dest, __src, sz / sizeof (wchar_t)); return __wcscpy_alias (__dest, __src); } extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src), wcpcpy); __fortify_function wchar_t * __NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { size_t sz = __glibc_objsize (__dest); if (sz != (size_t) -1) return __wcpcpy_chk (__dest, __src, sz / sizeof (wchar_t)); return __wcpcpy_alias (__dest, __src); } extern wchar_t *__wcsncpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n), wcsncpy); extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen), __wcsncpy_chk) __warnattr ("wcsncpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { return __glibc_fortify_n (wcsncpy, __n, sizeof (wchar_t), __glibc_objsize (__dest), __dest, __src, __n); } extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n), wcpncpy); extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen), __wcpncpy_chk) __warnattr ("wcpncpy called with length bigger than size of destination " "buffer"); __fortify_function wchar_t * __NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { return __glibc_fortify_n (wcpncpy, __n, sizeof (wchar_t), __glibc_objsize (__dest), __dest, __src, __n); } extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcscat_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src), wcscat); __fortify_function wchar_t * __NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { size_t sz = __glibc_objsize (__dest); if (sz != (size_t) -1) return __wcscat_chk (__dest, __src, sz / sizeof (wchar_t)); return __wcscat_alias (__dest, __src); } extern wchar_t *__wcsncat_chk (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n, size_t __destlen) __THROW; extern wchar_t *__REDIRECT_NTH (__wcsncat_alias, (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n), wcsncat); __fortify_function wchar_t * __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { size_t sz = __glibc_objsize (__dest); if (sz != (size_t) -1) return __wcsncat_chk (__dest, __src, __n, sz / sizeof (wchar_t)); return __wcsncat_alias (__dest, __src, __n); } extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n, int __flag, size_t __s_len, const wchar_t *__restrict __format, ...) __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */; extern int __REDIRECT_NTH_LDBL (__swprintf_alias, (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, ...), swprintf); #ifdef __va_arg_pack __fortify_function int __NTH (swprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, ...)) { size_t sz = __glibc_objsize (__s); if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, sz / sizeof (wchar_t), __fmt, __va_arg_pack ()); return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ()); } #elif !defined __cplusplus /* XXX We might want to have support in gcc for swprintf. */ # define swprintf(s, n, ...) \ (__glibc_objsize (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \ ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, \ __glibc_objsize (s) / sizeof (wchar_t), __VA_ARGS__) \ : swprintf (s, n, __VA_ARGS__)) #endif extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, int __flag, size_t __s_len, const wchar_t *__restrict __format, __gnuc_va_list __arg) __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; extern int __REDIRECT_NTH_LDBL (__vswprintf_alias, (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, __gnuc_va_list __ap), vswprintf); __fortify_function int __NTH (vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, __gnuc_va_list __ap)) { size_t sz = __glibc_objsize (__s); if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, sz / sizeof (wchar_t), __fmt, __ap); return __vswprintf_alias (__s, __n, __fmt, __ap); } #if __USE_FORTIFY_LEVEL > 1 extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag, const wchar_t *__restrict __format, ...); extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format, ...); extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag, const wchar_t *__restrict __format, __gnuc_va_list __ap); extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, __gnuc_va_list __ap); # ifdef __va_arg_pack __fortify_function int wprintf (const wchar_t *__restrict __fmt, ...) { return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } __fortify_function int fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...) { return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } # elif !defined __cplusplus # define wprintf(...) \ __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # define fwprintf(stream, ...) \ __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) # endif __fortify_function int vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap) { return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); } __fortify_function int vfwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, __gnuc_va_list __ap) { return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } #endif extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream) __wur; extern wchar_t *__REDIRECT (__fgetws_alias, (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream), fgetws) __wur; extern wchar_t *__REDIRECT (__fgetws_chk_warn, (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream), __fgetws_chk) __wur __warnattr ("fgetws called with bigger size than length " "of destination buffer"); __fortify_function __wur wchar_t * fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { size_t sz = __glibc_objsize (__s); if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), sz)) return __fgetws_alias (__s, __n, __stream); if (__glibc_unsafe_len (__n, sizeof (wchar_t), sz)) return __fgetws_chk_warn (__s, sz / sizeof (wchar_t), __n, __stream); return __fgetws_chk (__s, sz / sizeof (wchar_t), __n, __stream); } #ifdef __USE_GNU extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream) __wur; extern wchar_t *__REDIRECT (__fgetws_unlocked_alias, (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream), fgetws_unlocked) __wur; extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn, (wchar_t *__restrict __s, size_t __size, int __n, __FILE *__restrict __stream), __fgetws_unlocked_chk) __wur __warnattr ("fgetws_unlocked called with bigger size than length " "of destination buffer"); __fortify_function __wur wchar_t * fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { size_t sz = __glibc_objsize (__s); if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), sz)) return __fgetws_unlocked_alias (__s, __n, __stream); if (__glibc_unsafe_len (__n, sizeof (wchar_t), sz)) return __fgetws_unlocked_chk_warn (__s, sz / sizeof (wchar_t), __n, __stream); return __fgetws_unlocked_chk (__s, sz / sizeof (wchar_t), __n, __stream); } #endif extern size_t __wcrtomb_chk (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __p, size_t __buflen) __THROW __wur; extern size_t __REDIRECT_NTH (__wcrtomb_alias, (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __ps), wcrtomb) __wur; __fortify_function __wur size_t __NTH (wcrtomb (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __ps)) { /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. But this would only disturb the namespace. So we define our own version here. */ #define __WCHAR_MB_LEN_MAX 16 #if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX # error "Assumed value of MB_LEN_MAX wrong" #endif if (__glibc_objsize (__s) != (size_t) -1 && __WCHAR_MB_LEN_MAX > __glibc_objsize (__s)) return __wcrtomb_chk (__s, __wchar, __ps, __glibc_objsize (__s)); return __wcrtomb_alias (__s, __wchar, __ps); } extern size_t __mbsrtowcs_chk (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__mbsrtowcs_alias, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps), mbsrtowcs); extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __mbsrtowcs_chk) __warnattr ("mbsrtowcs called with dst buffer smaller than len " "* sizeof (wchar_t)"); __fortify_function size_t __NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { return __glibc_fortify_n (mbsrtowcs, __len, sizeof (wchar_t), __glibc_objsize (__dst), __dst, __src, __len, __ps); } extern size_t __wcsrtombs_chk (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__wcsrtombs_alias, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps), wcsrtombs); extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __wcsrtombs_chk) __warnattr ("wcsrtombs called with dst buffer smaller than len"); __fortify_function size_t __NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __len, mbstate_t *__restrict __ps)) { return __glibc_fortify (wcsrtombs, __len, sizeof (char), __glibc_objsize (__dst), __dst, __src, __len, __ps); } #ifdef __USE_XOPEN2K8 extern size_t __mbsnrtowcs_chk (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps), mbsnrtowcs); extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn, (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __mbsnrtowcs_chk) __warnattr ("mbsnrtowcs called with dst buffer smaller than len " "* sizeof (wchar_t)"); __fortify_function size_t __NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src, size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) { return __glibc_fortify_n (mbsnrtowcs, __len, sizeof (wchar_t), __glibc_objsize (__dst), __dst, __src, __nmc, __len, __ps); } extern size_t __wcsnrtombs_chk (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen) __THROW; extern size_t __REDIRECT_NTH (__wcsnrtombs_alias, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps), wcsnrtombs); extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn, (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps, size_t __dstlen), __wcsnrtombs_chk) __warnattr ("wcsnrtombs called with dst buffer smaller than len"); __fortify_function size_t __NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src, size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) { return __glibc_fortify (wcsnrtombs, __len, sizeof (char), __glibc_objsize (__dst), __dst, __src, __nwc, __len, __ps); } #endif bits/wctype-wchar.h 0000644 00000014235 15063602064 0010302 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.25 * Wide character classification and mapping utilities <wctype.h> */ #ifndef _BITS_WCTYPE_WCHAR_H #define _BITS_WCTYPE_WCHAR_H 1 #if !defined _WCTYPE_H && !defined _WCHAR_H #error "Never include <bits/wctype-wchar.h> directly; include <wctype.h> or <wchar.h> instead." #endif #include <bits/types.h> #include <bits/types/wint_t.h> /* The definitions in this header are specified to appear in <wctype.h> in ISO C99, but in <wchar.h> in Unix98. _GNU_SOURCE follows C99. */ /* Scalar type that can hold values which represent locale-specific character classifications. */ typedef unsigned long int wctype_t; # ifndef _ISwbit /* The characteristics are stored always in network byte order (big endian). We define the bit value interpretations here dependent on the machine's byte order. */ # include <endian.h> # if __BYTE_ORDER == __BIG_ENDIAN # define _ISwbit(bit) (1 << (bit)) # else /* __BYTE_ORDER == __LITTLE_ENDIAN */ # define _ISwbit(bit) \ ((bit) < 8 ? (int) ((1UL << (bit)) << 24) \ : ((bit) < 16 ? (int) ((1UL << (bit)) << 8) \ : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8) \ : (int) ((1UL << (bit)) >> 24)))) # endif enum { __ISwupper = 0, /* UPPERCASE. */ __ISwlower = 1, /* lowercase. */ __ISwalpha = 2, /* Alphabetic. */ __ISwdigit = 3, /* Numeric. */ __ISwxdigit = 4, /* Hexadecimal numeric. */ __ISwspace = 5, /* Whitespace. */ __ISwprint = 6, /* Printing. */ __ISwgraph = 7, /* Graphical. */ __ISwblank = 8, /* Blank (usually SPC and TAB). */ __ISwcntrl = 9, /* Control character. */ __ISwpunct = 10, /* Punctuation. */ __ISwalnum = 11, /* Alphanumeric. */ _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */ _ISwlower = _ISwbit (__ISwlower), /* lowercase. */ _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */ _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */ _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */ _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */ _ISwprint = _ISwbit (__ISwprint), /* Printing. */ _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */ _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */ _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */ _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */ _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */ }; # endif /* Not _ISwbit */ __BEGIN_DECLS /* * Wide-character classification functions: 7.15.2.1. */ /* Test for any wide character for which `iswalpha' or `iswdigit' is true. */ extern int iswalnum (wint_t __wc) __THROW; /* Test for any wide character for which `iswupper' or 'iswlower' is true, or any wide character that is one of a locale-specific set of wide-characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswalpha (wint_t __wc) __THROW; /* Test for any control wide character. */ extern int iswcntrl (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a decimal-digit character. */ extern int iswdigit (wint_t __wc) __THROW; /* Test for any wide character for which `iswprint' is true and `iswspace' is false. */ extern int iswgraph (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a lowercase letter or is one of a locale-specific set of wide characters for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswlower (wint_t __wc) __THROW; /* Test for any printing wide character. */ extern int iswprint (wint_t __wc) __THROW; /* Test for any printing wide character that is one of a locale-specific et of wide characters for which neither `iswspace' nor `iswalnum' is true. */ extern int iswpunct (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a locale-specific set of wide characters for which none of `iswalnum', `iswgraph', or `iswpunct' is true. */ extern int iswspace (wint_t __wc) __THROW; /* Test for any wide character that corresponds to an uppercase letter or is one of a locale-specific set of wide character for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswupper (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a hexadecimal-digit character equivalent to that performed be the functions described in the previous subclause. */ extern int iswxdigit (wint_t __wc) __THROW; /* Test for any wide character that corresponds to a standard blank wide character or a locale-specific set of wide characters for which `iswalnum' is false. */ # ifdef __USE_ISOC99 extern int iswblank (wint_t __wc) __THROW; # endif /* * Extensible wide-character classification functions: 7.15.2.2. */ /* Construct value that describes a class of wide characters identified by the string argument PROPERTY. */ extern wctype_t wctype (const char *__property) __THROW; /* Determine whether the wide-character WC has the property described by DESC. */ extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; /* * Wide-character case-mapping functions: 7.15.3.1. */ /* Converts an uppercase letter to the corresponding lowercase letter. */ extern wint_t towlower (wint_t __wc) __THROW; /* Converts an lowercase letter to the corresponding uppercase letter. */ extern wint_t towupper (wint_t __wc) __THROW; __END_DECLS #endif /* bits/wctype-wchar.h. */ bits/wordsize.h 0000644 00000000672 15063602064 0007533 0 ustar 00 /* Determine the wordsize from the preprocessor defines. */ #if defined __x86_64__ && !defined __ILP32__ # define __WORDSIZE 64 #else # define __WORDSIZE 32 #define __WORDSIZE32_SIZE_ULONG 0 #define __WORDSIZE32_PTRDIFF_LONG 0 #endif #ifdef __x86_64__ # define __WORDSIZE_TIME64_COMPAT32 1 /* Both x86-64 and x32 use the 64-bit system call interface. */ # define __SYSCALL_WORDSIZE 64 #else # define __WORDSIZE_TIME64_COMPAT32 0 #endif bits/xopen_lim.h 0000644 00000007421 15063602064 0007656 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Never include this file directly; use <limits.h> instead. */ /* Additional definitions from X/Open Portability Guide, Issue 4, Version 2 System Interfaces and Headers, 4.16 <limits.h> Please note only the values which are not greater than the minimum stated in the standard document are listed. The `sysconf' functions should be used to obtain the actual value. */ #ifndef _XOPEN_LIM_H #define _XOPEN_LIM_H 1 /* We do not provide fixed values for ARG_MAX Maximum length of argument to the `exec' function including environment data. ATEXIT_MAX Maximum number of functions that may be registered with `atexit'. CHILD_MAX Maximum number of simultaneous processes per real user ID. OPEN_MAX Maximum number of files that one process can have open at anyone time. PAGESIZE PAGE_SIZE Size of bytes of a page. PASS_MAX Maximum number of significant bytes in a password. We only provide a fixed limit for IOV_MAX Maximum number of `iovec' structures that one process has available for use with `readv' or writev'. if this is indeed fixed by the underlying system. */ /* Maximum number of `iovec' structures that may be used in a single call to `readv', `writev', etc. */ #define _XOPEN_IOV_MAX _POSIX_UIO_MAXIOV #include <bits/uio_lim.h> #ifdef __IOV_MAX # define IOV_MAX __IOV_MAX #else # undef IOV_MAX #endif /* Maximum value of `digit' in calls to the `printf' and `scanf' functions. We have no limit, so return a reasonable value. */ #define NL_ARGMAX _POSIX_ARG_MAX /* Maximum number of bytes in a `LANG' name. We have no limit. */ #define NL_LANGMAX _POSIX2_LINE_MAX /* Maximum message number. We have no limit. */ #define NL_MSGMAX INT_MAX /* Maximum number of bytes in N-to-1 collation mapping. We have no limit. */ #if defined __USE_GNU || !defined __USE_XOPEN2K8 # define NL_NMAX INT_MAX #endif /* Maximum set number. We have no limit. */ #define NL_SETMAX INT_MAX /* Maximum number of bytes in a message. We have no limit. */ #define NL_TEXTMAX INT_MAX /* Default process priority. */ #define NZERO 20 /* Number of bits in a word of type `int'. */ #ifdef INT_MAX # if INT_MAX == 32767 # define WORD_BIT 16 # else # if INT_MAX == 2147483647 # define WORD_BIT 32 # else /* Safe assumption. */ # define WORD_BIT 64 # endif # endif #elif defined __INT_MAX__ # if __INT_MAX__ == 32767 # define WORD_BIT 16 # else # if __INT_MAX__ == 2147483647 # define WORD_BIT 32 # else /* Safe assumption. */ # define WORD_BIT 64 # endif # endif #else # define WORD_BIT 32 #endif /* Number of bits in a word of type `long int'. */ #ifdef LONG_MAX # if LONG_MAX == 2147483647 # define LONG_BIT 32 # else /* Safe assumption. */ # define LONG_BIT 64 # endif #elif defined __LONG_MAX__ # if __LONG_MAX__ == 2147483647 # define LONG_BIT 32 # else /* Safe assumption. */ # define LONG_BIT 64 # endif #else # include <bits/wordsize.h> # if __WORDSIZE == 64 # define LONG_BIT 64 # else # define LONG_BIT 32 # endif #endif #endif /* bits/xopen_lim.h */ bits/types/FILE.h 0000644 00000000264 15063602064 0007545 0 ustar 00 #ifndef __FILE_defined #define __FILE_defined 1 struct _IO_FILE; /* The opaque type of streams. This is the definition used elsewhere. */ typedef struct _IO_FILE FILE; #endif bits/types/__FILE.h 0000644 00000000156 15063602064 0010043 0 ustar 00 #ifndef ____FILE_defined #define ____FILE_defined 1 struct _IO_FILE; typedef struct _IO_FILE __FILE; #endif bits/types/__fpos64_t.h 0000644 00000000632 15063602064 0010767 0 ustar 00 #ifndef _____fpos64_t_defined #define _____fpos64_t_defined 1 #include <bits/types.h> #include <bits/types/__mbstate_t.h> /* The tag name of this struct is _G_fpos64_t to preserve historic C++ mangled names for functions taking fpos_t and/or fpos64_t arguments. That name should not be used in new code. */ typedef struct _G_fpos64_t { __off64_t __pos; __mbstate_t __state; } __fpos64_t; #endif bits/types/__fpos_t.h 0000644 00000000575 15063602064 0010623 0 ustar 00 #ifndef _____fpos_t_defined #define _____fpos_t_defined 1 #include <bits/types.h> #include <bits/types/__mbstate_t.h> /* The tag name of this struct is _G_fpos_t to preserve historic C++ mangled names for functions taking fpos_t arguments. That name should not be used in new code. */ typedef struct _G_fpos_t { __off_t __pos; __mbstate_t __state; } __fpos_t; #endif bits/types/__locale_t.h 0000644 00000003271 15063602064 0011107 0 ustar 00 /* Definition of struct __locale_struct and __locale_t. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TYPES___LOCALE_T_H #define _BITS_TYPES___LOCALE_T_H 1 /* POSIX.1-2008: the locale_t type, representing a locale context (implementation-namespace version). This type should be treated as opaque by applications; some details are exposed for the sake of efficiency in e.g. ctype functions. */ struct __locale_struct { /* Note: LC_ALL is not a valid index into this array. */ struct __locale_data *__locales[13]; /* 13 = __LC_LAST. */ /* To increase the speed of this solution we add some special members. */ const unsigned short int *__ctype_b; const int *__ctype_tolower; const int *__ctype_toupper; /* Note: LC_ALL is not a valid index into this array. */ const char *__names[13]; }; typedef struct __locale_struct *__locale_t; #endif /* bits/types/__locale_t.h */ bits/types/__mbstate_t.h 0000644 00000001064 15063602064 0011305 0 ustar 00 #ifndef ____mbstate_t_defined #define ____mbstate_t_defined 1 /* Integral type unchanged by default argument promotions that can hold any value corresponding to members of the extended character set, as well as at least one value that does not correspond to any member of the extended character set. */ #ifndef __WINT_TYPE__ # define __WINT_TYPE__ unsigned int #endif /* Conversion state information. */ typedef struct { int __count; union { __WINT_TYPE__ __wch; char __wchb[4]; } __value; /* Value so far. */ } __mbstate_t; #endif bits/types/__sigset_t.h 0000644 00000000316 15063602064 0011143 0 ustar 00 #ifndef ____sigset_t_defined #define ____sigset_t_defined #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) typedef struct { unsigned long int __val[_SIGSET_NWORDS]; } __sigset_t; #endif bits/types/__sigval_t.h 0000644 00000002173 15063602064 0011135 0 ustar 00 /* Define __sigval_t. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef ____sigval_t_defined #define ____sigval_t_defined /* Type for data associated with a signal. */ #ifdef __USE_POSIX199309 union sigval { int sival_int; void *sival_ptr; }; typedef union sigval __sigval_t; #else union __sigval { int __sival_int; void *__sival_ptr; }; typedef union __sigval __sigval_t; #endif #endif bits/types/clock_t.h 0000644 00000000217 15063602064 0010442 0 ustar 00 #ifndef __clock_t_defined #define __clock_t_defined 1 #include <bits/types.h> /* Returned by `clock'. */ typedef __clock_t clock_t; #endif bits/types/clockid_t.h 0000644 00000000256 15063602064 0010762 0 ustar 00 #ifndef __clockid_t_defined #define __clockid_t_defined 1 #include <bits/types.h> /* Clock ID used in clock and timer functions. */ typedef __clockid_t clockid_t; #endif bits/types/cookie_io_functions_t.h 0000644 00000005244 15063602064 0013404 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __cookie_io_functions_t_defined #define __cookie_io_functions_t_defined 1 #include <bits/types.h> /* Functions to do I/O and file management for a stream. */ /* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF. Return number of bytes read. */ typedef __ssize_t cookie_read_function_t (void *__cookie, char *__buf, size_t __nbytes); /* Write NBYTES bytes pointed to by BUF to COOKIE. Write all NBYTES bytes unless there is an error. Return number of bytes written. If there is an error, return 0 and do not write anything. If the file has been opened for append (__mode.__append set), then set the file pointer to the end of the file and then do the write; if not, just write at the current file pointer. */ typedef __ssize_t cookie_write_function_t (void *__cookie, const char *__buf, size_t __nbytes); /* Move COOKIE's file position to *POS bytes from the beginning of the file (if W is SEEK_SET), the current position (if W is SEEK_CUR), or the end of the file (if W is SEEK_END). Set *POS to the new file position. Returns zero if successful, nonzero if not. */ typedef int cookie_seek_function_t (void *__cookie, __off64_t *__pos, int __w); /* Close COOKIE. */ typedef int cookie_close_function_t (void *__cookie); /* The structure with the cookie function pointers. The tag name of this struct is _IO_cookie_io_functions_t to preserve historic C++ mangled names for functions taking cookie_io_functions_t arguments. That name should not be used in new code. */ typedef struct _IO_cookie_io_functions_t { cookie_read_function_t *read; /* Read bytes. */ cookie_write_function_t *write; /* Write bytes. */ cookie_seek_function_t *seek; /* Seek/tell file position. */ cookie_close_function_t *close; /* Close file. */ } cookie_io_functions_t; #endif bits/types/error_t.h 0000644 00000001575 15063602064 0010510 0 ustar 00 /* Define error_t. Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __error_t_defined # define __error_t_defined 1 typedef int error_t; #endif bits/types/locale_t.h 0000644 00000001726 15063602064 0010614 0 ustar 00 /* Definition of locale_t. Copyright (C) 2017-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TYPES_LOCALE_T_H #define _BITS_TYPES_LOCALE_T_H 1 #include <bits/types/__locale_t.h> typedef __locale_t locale_t; #endif /* bits/types/locale_t.h */ bits/types/mbstate_t.h 0000644 00000000207 15063602064 0011005 0 ustar 00 #ifndef __mbstate_t_defined #define __mbstate_t_defined 1 #include <bits/types/__mbstate_t.h> typedef __mbstate_t mbstate_t; #endif bits/types/res_state.h 0000644 00000003731 15063602064 0011021 0 ustar 00 #ifndef __res_state_defined #define __res_state_defined 1 #include <sys/types.h> #include <netinet/in.h> /* res_state: the global state used by the resolver stub. */ #define MAXNS 3 /* max # name servers we'll track */ #define MAXDFLSRCH 3 /* # default domain levels to try */ #define MAXDNSRCH 6 /* max # domains in search path */ #define MAXRESOLVSORT 10 /* number of net to sort on */ struct __res_state { int retrans; /* retransmition time interval */ int retry; /* number of times to retransmit */ unsigned long options; /* option flags - see below. */ int nscount; /* number of name servers */ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ unsigned short id; /* current message id */ /* 2 byte hole here. */ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ char defdname[256]; /* default domain (deprecated) */ unsigned long pfcode; /* RES_PRF_ flags - see below. */ unsigned ndots:4; /* threshold for initial abs. query */ unsigned nsort:4; /* number of elements in sort_list[] */ unsigned ipv6_unavail:1; /* connecting to IPv6 server failed */ unsigned unused:23; struct { struct in_addr addr; uint32_t mask; } sort_list[MAXRESOLVSORT]; /* 4 byte hole here on 64-bit architectures. */ void * __glibc_unused_qhook; void * __glibc_unused_rhook; int res_h_errno; /* last one set for this context */ int _vcsock; /* PRIVATE: for res_send VC i/o */ unsigned int _flags; /* PRIVATE: see below */ /* 4 byte hole here on 64-bit architectures. */ union { char pad[52]; /* On an i386 this means 512b total. */ struct { uint16_t nscount; uint16_t nsmap[MAXNS]; int nssocks[MAXNS]; uint16_t nscount6; uint16_t nsinit; struct sockaddr_in6 *nsaddrs[MAXNS]; #ifdef _LIBC unsigned long long int __glibc_extension_index __attribute__((packed)); #else unsigned int __glibc_reserved[2]; #endif } _ext; } _u; }; typedef struct __res_state *res_state; #endif /* __res_state_defined */ bits/types/sig_atomic_t.h 0000644 00000000420 15063602064 0011461 0 ustar 00 #ifndef __sig_atomic_t_defined #define __sig_atomic_t_defined 1 #include <bits/types.h> /* An integral type that can be modified atomically, without the possibility of a signal arriving in the middle of the operation. */ typedef __sig_atomic_t sig_atomic_t; #endif bits/types/sigevent_t.h 0000644 00000002264 15063602064 0011177 0 ustar 00 #ifndef __sigevent_t_defined #define __sigevent_t_defined 1 #include <bits/wordsize.h> #include <bits/types.h> #include <bits/types/__sigval_t.h> #define __SIGEV_MAX_SIZE 64 #if __WORDSIZE == 64 # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) #else # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3) #endif /* Forward declaration. */ #ifndef __have_pthread_attr_t typedef union pthread_attr_t pthread_attr_t; # define __have_pthread_attr_t 1 #endif /* Structure to transport application-defined values with signals. */ typedef struct sigevent { __sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[__SIGEV_PAD_SIZE]; /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the thread to receive the signal. */ __pid_t _tid; struct { void (*_function) (__sigval_t); /* Function to start. */ pthread_attr_t *_attribute; /* Thread attributes. */ } _sigev_thread; } _sigev_un; } sigevent_t; /* POSIX names to access some of the members. */ #define sigev_notify_function _sigev_un._sigev_thread._function #define sigev_notify_attributes _sigev_un._sigev_thread._attribute #endif bits/types/siginfo_t.h 0000644 00000007456 15063602064 0011021 0 ustar 00 #ifndef __siginfo_t_defined #define __siginfo_t_defined 1 #include <bits/wordsize.h> #include <bits/types.h> #include <bits/types/__sigval_t.h> #define __SI_MAX_SIZE 128 #if __WORDSIZE == 64 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) #else # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) #endif /* Some fields of siginfo_t have architecture-specific variations. */ #include <bits/siginfo-arch.h> #ifndef __SI_ALIGNMENT # define __SI_ALIGNMENT /* nothing */ #endif #ifndef __SI_BAND_TYPE # define __SI_BAND_TYPE long int #endif #ifndef __SI_CLOCK_T # define __SI_CLOCK_T __clock_t #endif #ifndef __SI_ERRNO_THEN_CODE # define __SI_ERRNO_THEN_CODE 1 #endif #ifndef __SI_HAVE_SIGSYS # define __SI_HAVE_SIGSYS 1 #endif #ifndef __SI_SIGFAULT_ADDL # define __SI_SIGFAULT_ADDL /* nothing */ #endif typedef struct { int si_signo; /* Signal number. */ #if __SI_ERRNO_THEN_CODE int si_errno; /* If non-zero, an errno value associated with this signal, as defined in <errno.h>. */ int si_code; /* Signal code. */ #else int si_code; int si_errno; #endif #if __WORDSIZE == 64 int __pad0; /* Explicit padding. */ #endif union { int _pad[__SI_PAD_SIZE]; /* kill(). */ struct { __pid_t si_pid; /* Sending process ID. */ __uid_t si_uid; /* Real user ID of sending process. */ } _kill; /* POSIX.1b timers. */ struct { int si_tid; /* Timer ID. */ int si_overrun; /* Overrun count. */ __sigval_t si_sigval; /* Signal value. */ } _timer; /* POSIX.1b signals. */ struct { __pid_t si_pid; /* Sending process ID. */ __uid_t si_uid; /* Real user ID of sending process. */ __sigval_t si_sigval; /* Signal value. */ } _rt; /* SIGCHLD. */ struct { __pid_t si_pid; /* Which child. */ __uid_t si_uid; /* Real user ID of sending process. */ int si_status; /* Exit value or signal. */ __SI_CLOCK_T si_utime; __SI_CLOCK_T si_stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ struct { void *si_addr; /* Faulting insn/memory ref. */ __SI_SIGFAULT_ADDL short int si_addr_lsb; /* Valid LSB of the reported address. */ union { /* used when si_code=SEGV_BNDERR */ struct { void *_lower; void *_upper; } _addr_bnd; /* used when si_code=SEGV_PKUERR */ __uint32_t _pkey; } _bounds; } _sigfault; /* SIGPOLL. */ struct { long int si_band; /* Band event for SIGPOLL. */ int si_fd; } _sigpoll; /* SIGSYS. */ #if __SI_HAVE_SIGSYS struct { void *_call_addr; /* Calling user insn. */ int _syscall; /* Triggering system call number. */ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ } _sigsys; #endif } _sifields; } siginfo_t __SI_ALIGNMENT; /* X/Open requires some more fields with fixed names. */ #define si_pid _sifields._kill.si_pid #define si_uid _sifields._kill.si_uid #define si_timerid _sifields._timer.si_tid #define si_overrun _sifields._timer.si_overrun #define si_status _sifields._sigchld.si_status #define si_utime _sifields._sigchld.si_utime #define si_stime _sifields._sigchld.si_stime #define si_value _sifields._rt.si_sigval #define si_int _sifields._rt.si_sigval.sival_int #define si_ptr _sifields._rt.si_sigval.sival_ptr #define si_addr _sifields._sigfault.si_addr #define si_addr_lsb _sifields._sigfault.si_addr_lsb #define si_lower _sifields._sigfault._bounds._addr_bnd._lower #define si_upper _sifields._sigfault._bounds._addr_bnd._upper #define si_pkey _sifields._sigfault._bounds._pkey #define si_band _sifields._sigpoll.si_band #define si_fd _sifields._sigpoll.si_fd #if __SI_HAVE_SIGSYS # define si_call_addr _sifields._sigsys._call_addr # define si_syscall _sifields._sigsys._syscall # define si_arch _sifields._sigsys._arch #endif #endif bits/types/sigset_t.h 0000644 00000000303 15063602064 0010641 0 ustar 00 #ifndef __sigset_t_defined #define __sigset_t_defined 1 #include <bits/types/__sigset_t.h> /* A set of signals to be blocked, unblocked, or waited for. */ typedef __sigset_t sigset_t; #endif bits/types/sigval_t.h 0000644 00000001127 15063602064 0010635 0 ustar 00 #ifndef __sigval_t_defined #define __sigval_t_defined #include <bits/types/__sigval_t.h> /* To avoid sigval_t (not a standard type name) having C++ name mangling depending on whether the selected standard includes union sigval, it should not be defined at all when using a standard for which the sigval name is not reserved; in that case, headers should not include <bits/types/sigval_t.h> and should use only the internal __sigval_t name. */ #ifndef __USE_POSIX199309 # error "sigval_t defined for standard not including union sigval" #endif typedef __sigval_t sigval_t; #endif bits/types/stack_t.h 0000644 00000002045 15063602064 0010455 0 ustar 00 /* Define stack_t. Linux version. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __stack_t_defined #define __stack_t_defined 1 #define __need_size_t #include <stddef.h> /* Structure describing a signal stack. */ typedef struct { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; #endif bits/types/struct_FILE.h 0000644 00000010007 15063602064 0011145 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __struct_FILE_defined #define __struct_FILE_defined 1 /* Caution: The contents of this file are not part of the official stdio.h API. However, much of it is part of the official *binary* interface, and therefore cannot be changed. */ #if defined _IO_USE_OLD_IO_FILE && !defined _LIBC # error "_IO_USE_OLD_IO_FILE should only be defined when building libc itself" #endif #if defined _IO_lock_t_defined && !defined _LIBC # error "_IO_lock_t_defined should only be defined when building libc itself" #endif #include <bits/types.h> struct _IO_FILE; struct _IO_marker; struct _IO_codecvt; struct _IO_wide_data; /* During the build of glibc itself, _IO_lock_t will already have been defined by internal headers. */ #ifndef _IO_lock_t_defined typedef void _IO_lock_t; #endif /* The tag name of this struct is _IO_FILE to preserve historic C++ mangled names for functions taking FILE* arguments. That name should not be used in new code. */ struct _IO_FILE { int _flags; /* High-order word is _IO_MAGIC; rest is flags. */ /* The following pointers correspond to the C++ streambuf protocol. */ char *_IO_read_ptr; /* Current read pointer */ char *_IO_read_end; /* End of get area. */ char *_IO_read_base; /* Start of putback+get area. */ char *_IO_write_base; /* Start of put area. */ char *_IO_write_ptr; /* Current put pointer. */ char *_IO_write_end; /* End of put area. */ char *_IO_buf_base; /* Start of reserve area. */ char *_IO_buf_end; /* End of reserve area. */ /* The following fields are used to support backing up and undo. */ char *_IO_save_base; /* Pointer to start of non-current get area. */ char *_IO_backup_base; /* Pointer to first valid character of backup area */ char *_IO_save_end; /* Pointer to end of non-current get area. */ struct _IO_marker *_markers; struct _IO_FILE *_chain; int _fileno; int _flags2; __off_t _old_offset; /* This used to be _offset but it's too small. */ /* 1+column number of pbase(); 0 is unknown. */ unsigned short _cur_column; signed char _vtable_offset; char _shortbuf[1]; _IO_lock_t *_lock; #ifdef _IO_USE_OLD_IO_FILE }; struct _IO_FILE_complete { struct _IO_FILE _file; #endif __off64_t _offset; /* Wide character stream stuff. */ struct _IO_codecvt *_codecvt; struct _IO_wide_data *_wide_data; struct _IO_FILE *_freeres_list; void *_freeres_buf; size_t __pad5; int _mode; /* Make sure we don't get into trouble again. */ char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; }; /* These macros are used by bits/stdio.h and internal headers. */ #define __getc_unlocked_body(_fp) \ (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end) \ ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++) #define __putc_unlocked_body(_ch, _fp) \ (__glibc_unlikely ((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \ ? __overflow (_fp, (unsigned char) (_ch)) \ : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch))) #define _IO_EOF_SEEN 0x0010 #define __feof_unlocked_body(_fp) (((_fp)->_flags & _IO_EOF_SEEN) != 0) #define _IO_ERR_SEEN 0x0020 #define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0) #define _IO_USER_LOCK 0x8000 /* Many more flag bits are defined internally. */ #endif bits/types/struct_iovec.h 0000644 00000002051 15063602064 0011533 0 ustar 00 /* Define struct iovec. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __iovec_defined #define __iovec_defined 1 #define __need_size_t #include <stddef.h> /* Structure for scatter/gather I/O. */ struct iovec { void *iov_base; /* Pointer to data. */ size_t iov_len; /* Length of data. */ }; #endif bits/types/struct_itimerspec.h 0000644 00000000440 15063602064 0012572 0 ustar 00 #ifndef __itimerspec_defined #define __itimerspec_defined 1 #include <bits/types.h> #include <bits/types/struct_timespec.h> /* POSIX.1b structure for timer start values and intervals. */ struct itimerspec { struct timespec it_interval; struct timespec it_value; }; #endif bits/types/struct_osockaddr.h 0000644 00000000422 15063602064 0012377 0 ustar 00 #ifndef __osockaddr_defined #define __osockaddr_defined 1 /* This is the 4.3 BSD `struct sockaddr' format, which is used as wire format in the grotty old 4.3 `talk' protocol. */ struct osockaddr { unsigned short int sa_family; unsigned char sa_data[14]; }; #endif bits/types/struct_rusage.h 0000644 00000007754 15063602064 0011733 0 ustar 00 /* Define struct rusage. Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __rusage_defined #define __rusage_defined 1 #include <bits/types.h> #include <bits/types/struct_timeval.h> /* Structure which says how much of each resource has been used. */ /* The purpose of all the unions is to have the kernel-compatible layout while keeping the API type as 'long int', and among machines where __syscall_slong_t is not 'long int', this only does the right thing for little-endian ones, like x32. */ struct rusage { /* Total amount of user time used. */ struct timeval ru_utime; /* Total amount of system time used. */ struct timeval ru_stime; /* Maximum resident set size (in kilobytes). */ __extension__ union { long int ru_maxrss; __syscall_slong_t __ru_maxrss_word; }; /* Amount of sharing of text segment memory with other processes (kilobyte-seconds). */ /* Maximum resident set size (in kilobytes). */ __extension__ union { long int ru_ixrss; __syscall_slong_t __ru_ixrss_word; }; /* Amount of data segment memory used (kilobyte-seconds). */ __extension__ union { long int ru_idrss; __syscall_slong_t __ru_idrss_word; }; /* Amount of stack memory used (kilobyte-seconds). */ __extension__ union { long int ru_isrss; __syscall_slong_t __ru_isrss_word; }; /* Number of soft page faults (i.e. those serviced by reclaiming a page from the list of pages awaiting reallocation. */ __extension__ union { long int ru_minflt; __syscall_slong_t __ru_minflt_word; }; /* Number of hard page faults (i.e. those that required I/O). */ __extension__ union { long int ru_majflt; __syscall_slong_t __ru_majflt_word; }; /* Number of times a process was swapped out of physical memory. */ __extension__ union { long int ru_nswap; __syscall_slong_t __ru_nswap_word; }; /* Number of input operations via the file system. Note: This and `ru_oublock' do not include operations with the cache. */ __extension__ union { long int ru_inblock; __syscall_slong_t __ru_inblock_word; }; /* Number of output operations via the file system. */ __extension__ union { long int ru_oublock; __syscall_slong_t __ru_oublock_word; }; /* Number of IPC messages sent. */ __extension__ union { long int ru_msgsnd; __syscall_slong_t __ru_msgsnd_word; }; /* Number of IPC messages received. */ __extension__ union { long int ru_msgrcv; __syscall_slong_t __ru_msgrcv_word; }; /* Number of signals delivered. */ __extension__ union { long int ru_nsignals; __syscall_slong_t __ru_nsignals_word; }; /* Number of voluntary context switches, i.e. because the process gave up the process before it had to (usually to wait for some resource to be available). */ __extension__ union { long int ru_nvcsw; __syscall_slong_t __ru_nvcsw_word; }; /* Number of involuntary context switches, i.e. a higher priority process became runnable or the current process used up its time slice. */ __extension__ union { long int ru_nivcsw; __syscall_slong_t __ru_nivcsw_word; }; }; #endif bits/types/struct_sched_param.h 0000644 00000002060 15063602064 0012674 0 ustar 00 /* Sched parameter structure. Generic version. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _BITS_TYPES_STRUCT_SCHED_PARAM #define _BITS_TYPES_STRUCT_SCHED_PARAM 1 /* Data structure to describe a process' schedulability. */ struct sched_param { int sched_priority; }; #endif /* bits/types/struct_sched_param.h */ bits/types/struct_sigstack.h 0000644 00000002060 15063602064 0012236 0 ustar 00 /* Define struct sigstack. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __sigstack_defined #define __sigstack_defined 1 /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; #endif bits/types/struct_statx.h 0000644 00000003550 15063602064 0011576 0 ustar 00 /* Definition of the generic version of struct statx. Copyright (C) 2018-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STAT_H # error Never include <bits/types/struct_statx.h> directly, include <sys/stat.h> instead. #endif #ifndef __statx_defined #define __statx_defined 1 /* Warning: The kernel may add additional fields to this struct in the future. Only use this struct for calling the statx function, not for storing data. (Expansion will be controlled by the mask argument of the statx function.) */ struct statx { __uint32_t stx_mask; __uint32_t stx_blksize; __uint64_t stx_attributes; __uint32_t stx_nlink; __uint32_t stx_uid; __uint32_t stx_gid; __uint16_t stx_mode; __uint16_t __statx_pad1[1]; __uint64_t stx_ino; __uint64_t stx_size; __uint64_t stx_blocks; __uint64_t stx_attributes_mask; struct statx_timestamp stx_atime; struct statx_timestamp stx_btime; struct statx_timestamp stx_ctime; struct statx_timestamp stx_mtime; __uint32_t stx_rdev_major; __uint32_t stx_rdev_minor; __uint32_t stx_dev_major; __uint32_t stx_dev_minor; __uint64_t __statx_pad2[14]; }; #endif /* __statx_defined */ bits/types/struct_statx_timestamp.h 0000644 00000002261 15063602064 0013657 0 ustar 00 /* Definition of the generic version of struct statx_timestamp. Copyright (C) 2018-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STAT_H # error Never include <bits/types/struct_statx_timestamp.h> directly, include <sys/stat.h> instead. #endif #ifndef __statx_timestamp_defined #define __statx_timestamp_defined 1 struct statx_timestamp { __int64_t tv_sec; __uint32_t tv_nsec; __int32_t __statx_timestamp_pad1[1]; }; #endif /* __statx_timestamp_defined */ bits/types/struct_timespec.h 0000644 00000000570 15063602064 0012243 0 ustar 00 /* NB: Include guard matches what <linux/time.h> uses. */ #ifndef _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC 1 #include <bits/types.h> /* POSIX.1b structure for a time value. This is like a `struct timeval' but has nanoseconds instead of microseconds. */ struct timespec { __time_t tv_sec; /* Seconds. */ __syscall_slong_t tv_nsec; /* Nanoseconds. */ }; #endif bits/types/struct_timeval.h 0000644 00000000437 15063602064 0012075 0 ustar 00 #ifndef __timeval_defined #define __timeval_defined 1 #include <bits/types.h> /* A time value that is accurate to the nearest microsecond but also has a range of years. */ struct timeval { __time_t tv_sec; /* Seconds. */ __suseconds_t tv_usec; /* Microseconds. */ }; #endif bits/types/struct_tm.h 0000644 00000001370 15063602064 0011051 0 ustar 00 #ifndef __struct_tm_defined #define __struct_tm_defined 1 #include <bits/types.h> /* ISO C `broken-down time' structure. */ struct tm { int tm_sec; /* Seconds. [0-60] (1 leap second) */ int tm_min; /* Minutes. [0-59] */ int tm_hour; /* Hours. [0-23] */ int tm_mday; /* Day. [1-31] */ int tm_mon; /* Month. [0-11] */ int tm_year; /* Year - 1900. */ int tm_wday; /* Day of week. [0-6] */ int tm_yday; /* Days in year.[0-365] */ int tm_isdst; /* DST. [-1/0/1]*/ # ifdef __USE_MISC long int tm_gmtoff; /* Seconds east of UTC. */ const char *tm_zone; /* Timezone abbreviation. */ # else long int __tm_gmtoff; /* Seconds east of UTC. */ const char *__tm_zone; /* Timezone abbreviation. */ # endif }; #endif bits/types/time_t.h 0000644 00000000212 15063602064 0010300 0 ustar 00 #ifndef __time_t_defined #define __time_t_defined 1 #include <bits/types.h> /* Returned by `time'. */ typedef __time_t time_t; #endif bits/types/timer_t.h 0000644 00000000237 15063602064 0010471 0 ustar 00 #ifndef __timer_t_defined #define __timer_t_defined 1 #include <bits/types.h> /* Timer ID returned by `timer_create'. */ typedef __timer_t timer_t; #endif bits/types/wint_t.h 0000644 00000001434 15063602064 0010332 0 ustar 00 #ifndef __wint_t_defined #define __wint_t_defined 1 /* Some versions of stddef.h provide wint_t, even though neither the C nor C++ standards, nor POSIX, specifies this. We assume that stddef.h will define the macro _WINT_T if and only if it provides wint_t, and conversely, that it will avoid providing wint_t if _WINT_T is already defined. */ #ifndef _WINT_T #define _WINT_T 1 /* Integral type unchanged by default argument promotions that can hold any value corresponding to members of the extended character set, as well as at least one value that does not correspond to any member of the extended character set. */ #ifndef __WINT_TYPE__ # define __WINT_TYPE__ unsigned int #endif typedef __WINT_TYPE__ wint_t; #endif /* _WINT_T */ #endif /* bits/types/wint_t.h */ bits/a.out.h 0000644 00000000414 15063602064 0006705 0 ustar 00 #ifndef __A_OUT_GNU_H__ # error "Never use <bits/a.out.h> directly; include <a.out.h> instead." #endif #ifdef __x86_64__ /* Signal to users of this header that this architecture really doesn't support a.out binary format. */ #define __NO_A_OUT_SUPPORT 1 #endif cpio.h 0000644 00000004333 15063602064 0005654 0 ustar 00 /* Extended cpio format from POSIX.1. This file is part of the GNU C Library. Copyright (C) 1992-2018 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU cpio. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _CPIO_H #define _CPIO_H 1 /* A cpio archive consists of a sequence of files. Each file has a 76 byte header, a variable length, NUL terminated filename, and variable length file data. A header for a filename "TRAILER!!!" indicates the end of the archive. */ /* All the fields in the header are ISO 646 (approximately ASCII) strings of octal numbers, left padded, not NUL terminated. Field Name Length in Bytes Notes c_magic 6 must be "070707" c_dev 6 c_ino 6 c_mode 6 see below for value c_uid 6 c_gid 6 c_nlink 6 c_rdev 6 only valid for chr and blk special files c_mtime 11 c_namesize 6 count includes terminating NUL in pathname c_filesize 11 must be 0 for FIFOs and directories */ /* Value for the field `c_magic'. */ #define MAGIC "070707" /* Values for c_mode, OR'd together: */ #define C_IRUSR 000400 #define C_IWUSR 000200 #define C_IXUSR 000100 #define C_IRGRP 000040 #define C_IWGRP 000020 #define C_IXGRP 000010 #define C_IROTH 000004 #define C_IWOTH 000002 #define C_IXOTH 000001 #define C_ISUID 004000 #define C_ISGID 002000 #define C_ISVTX 001000 #define C_ISBLK 060000 #define C_ISCHR 020000 #define C_ISDIR 040000 #define C_ISFIFO 010000 #define C_ISSOCK 0140000 #define C_ISLNK 0120000 #define C_ISCTG 0110000 #define C_ISREG 0100000 #endif /* cpio.h */ ctype.h 0000644 00000025323 15063602064 0006050 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard 7.4: Character handling <ctype.h> */ #ifndef _CTYPE_H #define _CTYPE_H 1 #include <features.h> #include <bits/types.h> __BEGIN_DECLS #ifndef _ISbit /* These are all the characteristics of characters. If there get to be more than 16 distinct characteristics, many things must be changed that use `unsigned short int's. The characteristics are stored always in network byte order (big endian). We define the bit value interpretations here dependent on the machine's byte order. */ # include <endian.h> # if __BYTE_ORDER == __BIG_ENDIAN # define _ISbit(bit) (1 << (bit)) # else /* __BYTE_ORDER == __LITTLE_ENDIAN */ # define _ISbit(bit) ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8)) # endif enum { _ISupper = _ISbit (0), /* UPPERCASE. */ _ISlower = _ISbit (1), /* lowercase. */ _ISalpha = _ISbit (2), /* Alphabetic. */ _ISdigit = _ISbit (3), /* Numeric. */ _ISxdigit = _ISbit (4), /* Hexadecimal numeric. */ _ISspace = _ISbit (5), /* Whitespace. */ _ISprint = _ISbit (6), /* Printing. */ _ISgraph = _ISbit (7), /* Graphical. */ _ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */ _IScntrl = _ISbit (9), /* Control character. */ _ISpunct = _ISbit (10), /* Punctuation. */ _ISalnum = _ISbit (11) /* Alphanumeric. */ }; #endif /* ! _ISbit */ /* These are defined in ctype-info.c. The declarations here must match those in localeinfo.h. In the thread-specific locale model (see `uselocale' in <locale.h>) we cannot use global variables for these as was done in the past. Instead, the following accessor functions return the address of each variable, which is local to the current thread if multithreaded. These point into arrays of 384, so they can be indexed by any `unsigned char' value [0,255]; by EOF (-1); or by any `signed char' value [-128,-1). ISO C requires that the ctype functions work for `unsigned char' values and for EOF; we also support negative `signed char' values for broken old programs. The case conversion arrays are of `int's rather than `unsigned char's because tolower (EOF) must be EOF, which doesn't fit into an `unsigned char'. But today more important is that the arrays are also used for multi-byte character sets. */ extern const unsigned short int **__ctype_b_loc (void) __THROW __attribute__ ((__const__)); extern const __int32_t **__ctype_tolower_loc (void) __THROW __attribute__ ((__const__)); extern const __int32_t **__ctype_toupper_loc (void) __THROW __attribute__ ((__const__)); #ifndef __cplusplus # define __isctype(c, type) \ ((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type) #elif defined __USE_EXTERN_INLINES # define __isctype_f(type) \ __extern_inline int \ is##type (int __c) __THROW \ { \ return (*__ctype_b_loc ())[(int) (__c)] & (unsigned short int) _IS##type; \ } #endif #define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */ #define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */ #define __exctype(name) extern int name (int) __THROW /* The following names are all functions: int isCHARACTERISTIC(int c); which return nonzero iff C has CHARACTERISTIC. For the meaning of the characteristic names, see the `enum' above. */ __exctype (isalnum); __exctype (isalpha); __exctype (iscntrl); __exctype (isdigit); __exctype (islower); __exctype (isgraph); __exctype (isprint); __exctype (ispunct); __exctype (isspace); __exctype (isupper); __exctype (isxdigit); /* Return the lowercase version of C. */ extern int tolower (int __c) __THROW; /* Return the uppercase version of C. */ extern int toupper (int __c) __THROW; /* ISO C99 introduced one new function. */ #ifdef __USE_ISOC99 __exctype (isblank); #endif #ifdef __USE_GNU /* Test C for a set of character classes according to MASK. */ extern int isctype (int __c, int __mask) __THROW; #endif #if defined __USE_MISC || defined __USE_XOPEN /* Return nonzero iff C is in the ASCII set (i.e., is no more than 7 bits wide). */ extern int isascii (int __c) __THROW; /* Return the part of C that is in the ASCII set (i.e., the low-order 7 bits of C). */ extern int toascii (int __c) __THROW; /* These are the same as `toupper' and `tolower' except that they do not check the argument for being in the range of a `char'. */ __exctype (_toupper); __exctype (_tolower); #endif /* Use X/Open or use misc. */ /* This code is needed for the optimized mapping functions. */ #define __tobody(c, f, a, args) \ (__extension__ \ ({ int __res; \ if (sizeof (c) > 1) \ { \ if (__builtin_constant_p (c)) \ { \ int __c = (c); \ __res = __c < -128 || __c > 255 ? __c : (a)[__c]; \ } \ else \ __res = f args; \ } \ else \ __res = (a)[(int) (c)]; \ __res; })) #if !defined __NO_CTYPE # ifdef __isctype_f __isctype_f (alnum) __isctype_f (alpha) __isctype_f (cntrl) __isctype_f (digit) __isctype_f (lower) __isctype_f (graph) __isctype_f (print) __isctype_f (punct) __isctype_f (space) __isctype_f (upper) __isctype_f (xdigit) # ifdef __USE_ISOC99 __isctype_f (blank) # endif # elif defined __isctype # define isalnum(c) __isctype((c), _ISalnum) # define isalpha(c) __isctype((c), _ISalpha) # define iscntrl(c) __isctype((c), _IScntrl) # define isdigit(c) __isctype((c), _ISdigit) # define islower(c) __isctype((c), _ISlower) # define isgraph(c) __isctype((c), _ISgraph) # define isprint(c) __isctype((c), _ISprint) # define ispunct(c) __isctype((c), _ISpunct) # define isspace(c) __isctype((c), _ISspace) # define isupper(c) __isctype((c), _ISupper) # define isxdigit(c) __isctype((c), _ISxdigit) # ifdef __USE_ISOC99 # define isblank(c) __isctype((c), _ISblank) # endif # endif # ifdef __USE_EXTERN_INLINES __extern_inline int __NTH (tolower (int __c)) { return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c; } __extern_inline int __NTH (toupper (int __c)) { return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c; } # endif # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus # define tolower(c) __tobody (c, tolower, *__ctype_tolower_loc (), (c)) # define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c)) # endif /* Optimizing gcc */ # if defined __USE_MISC || defined __USE_XOPEN # define isascii(c) __isascii (c) # define toascii(c) __toascii (c) # define _tolower(c) ((int) (*__ctype_tolower_loc ())[(int) (c)]) # define _toupper(c) ((int) (*__ctype_toupper_loc ())[(int) (c)]) # endif #endif /* Not __NO_CTYPE. */ #ifdef __USE_XOPEN2K8 /* POSIX.1-2008 extended locale interface (see locale.h). */ # include <bits/types/locale_t.h> /* These definitions are similar to the ones above but all functions take as an argument a handle for the locale which shall be used. */ # define __isctype_l(c, type, locale) \ ((locale)->__ctype_b[(int) (c)] & (unsigned short int) type) # define __exctype_l(name) \ extern int name (int, locale_t) __THROW /* The following names are all functions: int isCHARACTERISTIC(int c, locale_t *locale); which return nonzero iff C has CHARACTERISTIC. For the meaning of the characteristic names, see the `enum' above. */ __exctype_l (isalnum_l); __exctype_l (isalpha_l); __exctype_l (iscntrl_l); __exctype_l (isdigit_l); __exctype_l (islower_l); __exctype_l (isgraph_l); __exctype_l (isprint_l); __exctype_l (ispunct_l); __exctype_l (isspace_l); __exctype_l (isupper_l); __exctype_l (isxdigit_l); __exctype_l (isblank_l); /* Return the lowercase version of C in locale L. */ extern int __tolower_l (int __c, locale_t __l) __THROW; extern int tolower_l (int __c, locale_t __l) __THROW; /* Return the uppercase version of C. */ extern int __toupper_l (int __c, locale_t __l) __THROW; extern int toupper_l (int __c, locale_t __l) __THROW; # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus # define __tolower_l(c, locale) \ __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale)) # define __toupper_l(c, locale) \ __tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale)) # define tolower_l(c, locale) __tolower_l ((c), (locale)) # define toupper_l(c, locale) __toupper_l ((c), (locale)) # endif /* Optimizing gcc */ # ifndef __NO_CTYPE # define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l)) # define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l)) # define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l)) # define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l)) # define __islower_l(c,l) __isctype_l((c), _ISlower, (l)) # define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l)) # define __isprint_l(c,l) __isctype_l((c), _ISprint, (l)) # define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l)) # define __isspace_l(c,l) __isctype_l((c), _ISspace, (l)) # define __isupper_l(c,l) __isctype_l((c), _ISupper, (l)) # define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l)) # define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) # ifdef __USE_MISC # define __isascii_l(c,l) ((l), __isascii (c)) # define __toascii_l(c,l) ((l), __toascii (c)) # endif # define isalnum_l(c,l) __isalnum_l ((c), (l)) # define isalpha_l(c,l) __isalpha_l ((c), (l)) # define iscntrl_l(c,l) __iscntrl_l ((c), (l)) # define isdigit_l(c,l) __isdigit_l ((c), (l)) # define islower_l(c,l) __islower_l ((c), (l)) # define isgraph_l(c,l) __isgraph_l ((c), (l)) # define isprint_l(c,l) __isprint_l ((c), (l)) # define ispunct_l(c,l) __ispunct_l ((c), (l)) # define isspace_l(c,l) __isspace_l ((c), (l)) # define isupper_l(c,l) __isupper_l ((c), (l)) # define isxdigit_l(c,l) __isxdigit_l ((c), (l)) # define isblank_l(c,l) __isblank_l ((c), (l)) # ifdef __USE_MISC # define isascii_l(c,l) __isascii_l ((c), (l)) # define toascii_l(c,l) __toascii_l ((c), (l)) # endif # endif /* Not __NO_CTYPE. */ #endif /* Use POSIX 2008. */ __END_DECLS #endif /* ctype.h */ dirent.h 0000644 00000030304 15063602064 0006204 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 5.1.2 Directory Operations <dirent.h> */ #ifndef _DIRENT_H #define _DIRENT_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #ifdef __USE_XOPEN # ifndef __ino_t_defined # ifndef __USE_FILE_OFFSET64 typedef __ino_t ino_t; # else typedef __ino64_t ino_t; # endif # define __ino_t_defined # endif # if defined __USE_LARGEFILE64 && !defined __ino64_t_defined typedef __ino64_t ino64_t; # define __ino64_t_defined # endif #endif /* This file defines `struct dirent'. It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen' member that gives the length of `d_name'. It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen' member that gives the size of the entire directory entry. It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off' member that gives the file offset of the next directory entry. It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type' member that gives the type of the file. */ #include <bits/dirent.h> #if defined __USE_MISC && !defined d_fileno # define d_ino d_fileno /* Backward compatibility. */ #endif /* These macros extract size information from a `struct dirent *'. They may evaluate their argument multiple times, so it must not have side effects. Each of these may involve a relatively costly call to `strlen' on some systems, so these values should be cached. _D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including its terminating null character. _D_ALLOC_NAMLEN (DP) returns a size at least (_D_EXACT_NAMLEN (DP) + 1); that is, the allocation size needed to hold the DP->d_name string. Use this macro when you don't need the exact length, just an upper bound. This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN. */ #ifdef _DIRENT_HAVE_D_NAMLEN # define _D_EXACT_NAMLEN(d) ((d)->d_namlen) # define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) #else # define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name)) # ifdef _DIRENT_HAVE_D_RECLEN # define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0]) # else # define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \ _D_EXACT_NAMLEN (d) + 1) # endif #endif #ifdef __USE_MISC /* File types for `d_type'. */ enum { DT_UNKNOWN = 0, # define DT_UNKNOWN DT_UNKNOWN DT_FIFO = 1, # define DT_FIFO DT_FIFO DT_CHR = 2, # define DT_CHR DT_CHR DT_DIR = 4, # define DT_DIR DT_DIR DT_BLK = 6, # define DT_BLK DT_BLK DT_REG = 8, # define DT_REG DT_REG DT_LNK = 10, # define DT_LNK DT_LNK DT_SOCK = 12, # define DT_SOCK DT_SOCK DT_WHT = 14 # define DT_WHT DT_WHT }; /* Convert between stat structure types and directory types. */ # define IFTODT(mode) (((mode) & 0170000) >> 12) # define DTTOIF(dirtype) ((dirtype) << 12) #endif /* This is the data type of directory stream objects. The actual structure is opaque to users. */ typedef struct __dirstream DIR; /* Open a directory stream on NAME. Return a DIR stream on the directory, or NULL if it could not be opened. This function is a possible cancellation point and therefore not marked with __THROW. */ extern DIR *opendir (const char *__name) __nonnull ((1)); #ifdef __USE_XOPEN2K8 /* Same as opendir, but open the stream on the file descriptor FD. This function is a possible cancellation point and therefore not marked with __THROW. */ extern DIR *fdopendir (int __fd); #endif /* Close the directory stream DIRP. Return 0 if successful, -1 if not. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int closedir (DIR *__dirp) __nonnull ((1)); /* Read a directory entry from DIRP. Return a pointer to a `struct dirent' describing the entry, or NULL for EOF or error. The storage returned may be overwritten by a later readdir call on the same DIR stream. If the Large File Support API is selected we have to use the appropriate interface. This function is a possible cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern struct dirent *readdir (DIR *__dirp) __nonnull ((1)); #else # ifdef __REDIRECT extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64) __nonnull ((1)); # else # define readdir readdir64 # endif #endif #ifdef __USE_LARGEFILE64 extern struct dirent64 *readdir64 (DIR *__dirp) __nonnull ((1)); #endif #ifdef __USE_POSIX /* Reentrant version of `readdir'. Return in RESULT a pointer to the next entry. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int readdir_r (DIR *__restrict __dirp, struct dirent *__restrict __entry, struct dirent **__restrict __result) __nonnull ((1, 2, 3)) __attribute_deprecated__; # else # ifdef __REDIRECT extern int __REDIRECT (readdir_r, (DIR *__restrict __dirp, struct dirent *__restrict __entry, struct dirent **__restrict __result), readdir64_r) __nonnull ((1, 2, 3)) __attribute_deprecated__; # else # define readdir_r readdir64_r # endif # endif # ifdef __USE_LARGEFILE64 extern int readdir64_r (DIR *__restrict __dirp, struct dirent64 *__restrict __entry, struct dirent64 **__restrict __result) __nonnull ((1, 2, 3)) __attribute_deprecated__; # endif #endif /* POSIX or misc */ /* Rewind DIRP to the beginning of the directory. */ extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1)); #if defined __USE_MISC || defined __USE_XOPEN # include <bits/types.h> /* Seek to position POS on DIRP. */ extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1)); /* Return the current position of DIRP. */ extern long int telldir (DIR *__dirp) __THROW __nonnull ((1)); #endif #ifdef __USE_XOPEN2K8 /* Return the file descriptor used by DIRP. */ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); # if defined __OPTIMIZE__ && defined _DIR_dirfd # define dirfd(dirp) _DIR_dirfd (dirp) # endif # ifdef __USE_MISC # ifndef MAXNAMLEN /* Get the definitions of the POSIX.1 limits. */ # include <bits/posix1_lim.h> /* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */ # ifdef NAME_MAX # define MAXNAMLEN NAME_MAX # else # define MAXNAMLEN 255 # endif # endif # endif # define __need_size_t # include <stddef.h> /* Scan the directory DIR, calling SELECTOR on each directory entry. Entries for which SELECT returns nonzero are individually malloc'd, sorted using qsort with CMP, and collected in a malloc'd array in *NAMELIST. Returns the number of entries selected, or -1 on error. This function is a cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int scandir (const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)) __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT (scandir, (const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)), scandir64) __nonnull ((1, 2)); # else # define scandir scandir64 # endif # endif # if defined __USE_GNU && defined __USE_LARGEFILE64 /* This function is like `scandir' but it uses the 64bit dirent structure. Please note that the CMP function must now work with struct dirent64 **. */ extern int scandir64 (const char *__restrict __dir, struct dirent64 ***__restrict __namelist, int (*__selector) (const struct dirent64 *), int (*__cmp) (const struct dirent64 **, const struct dirent64 **)) __nonnull ((1, 2)); # endif # ifdef __USE_GNU /* Similar to `scandir' but a relative DIR name is interpreted relative to the directory for which DFD is a descriptor. This function is a cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int scandirat (int __dfd, const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)) __nonnull ((2, 3)); # else # ifdef __REDIRECT extern int __REDIRECT (scandirat, (int __dfd, const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (const struct dirent *), int (*__cmp) (const struct dirent **, const struct dirent **)), scandirat64) __nonnull ((2, 3)); # else # define scandirat scandirat64 # endif # endif /* This function is like `scandir' but it uses the 64bit dirent structure. Please note that the CMP function must now work with struct dirent64 **. */ extern int scandirat64 (int __dfd, const char *__restrict __dir, struct dirent64 ***__restrict __namelist, int (*__selector) (const struct dirent64 *), int (*__cmp) (const struct dirent64 **, const struct dirent64 **)) __nonnull ((2, 3)); # endif /* Function to compare two `struct dirent's alphabetically. */ # ifndef __USE_FILE_OFFSET64 extern int alphasort (const struct dirent **__e1, const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (alphasort, (const struct dirent **__e1, const struct dirent **__e2), alphasort64) __attribute_pure__ __nonnull ((1, 2)); # else # define alphasort alphasort64 # endif # endif # if defined __USE_GNU && defined __USE_LARGEFILE64 extern int alphasort64 (const struct dirent64 **__e1, const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif #endif /* Use XPG7. */ #ifdef __USE_MISC /* Read directory entries from FD into BUF, reading at most NBYTES. Reading starts at offset *BASEP, and *BASEP is updated with the new position after reading. Returns the number of bytes read; zero when at end of directory; or -1 for errors. */ # ifndef __USE_FILE_OFFSET64 extern __ssize_t getdirentries (int __fd, char *__restrict __buf, size_t __nbytes, __off_t *__restrict __basep) __THROW __nonnull ((2, 4)); # else # ifdef __REDIRECT extern __ssize_t __REDIRECT_NTH (getdirentries, (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep), getdirentries64) __nonnull ((2, 4)); # else # define getdirentries getdirentries64 # endif # endif # ifdef __USE_LARGEFILE64 extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep) __THROW __nonnull ((2, 4)); # endif #endif /* Use misc. */ #ifdef __USE_GNU /* Function to compare two `struct dirent's by name & version. */ # ifndef __USE_FILE_OFFSET64 extern int versionsort (const struct dirent **__e1, const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (versionsort, (const struct dirent **__e1, const struct dirent **__e2), versionsort64) __attribute_pure__ __nonnull ((1, 2)); # else # define versionsort versionsort64 # endif # endif # ifdef __USE_LARGEFILE64 extern int versionsort64 (const struct dirent64 **__e1, const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif #endif /* Use GNU. */ __END_DECLS #endif /* dirent.h */ dlfcn.h 0000644 00000016106 15063602064 0006011 0 ustar 00 /* User functions for run-time dynamic loading. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _DLFCN_H #define _DLFCN_H 1 #include <features.h> #define __need_size_t #include <stddef.h> /* Collect various system dependent definitions and declarations. */ #include <bits/dlfcn.h> #ifdef __USE_GNU /* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT the run-time address of the symbol called NAME in the next shared object is returned. The "next" relation is defined by the order the shared objects were loaded. */ # define RTLD_NEXT ((void *) -1l) /* If the first argument to `dlsym' or `dlvsym' is set to RTLD_DEFAULT the run-time address of the symbol called NAME in the global scope is returned. */ # define RTLD_DEFAULT ((void *) 0) /* Type for namespace indeces. */ typedef long int Lmid_t; /* Special namespace ID values. */ # define LM_ID_BASE 0 /* Initial namespace. */ # define LM_ID_NEWLM -1 /* For dlmopen: request new namespace. */ #endif __BEGIN_DECLS /* Open the shared object FILE and map it in; return a handle that can be passed to `dlsym' to get symbol values from it. */ extern void *dlopen (const char *__file, int __mode) __THROWNL; /* Unmap and close a shared object opened by `dlopen'. The handle cannot be used again after calling `dlclose'. */ extern int dlclose (void *__handle) __THROWNL __nonnull ((1)); /* Find the run-time address in the shared object HANDLE refers to of the symbol called NAME. */ extern void *dlsym (void *__restrict __handle, const char *__restrict __name) __THROW __nonnull ((2)); #ifdef __USE_GNU /* Like `dlopen', but request object to be allocated in a new namespace. */ extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROWNL; /* Find the run-time address in the shared object HANDLE refers to of the symbol called NAME with VERSION. */ extern void *dlvsym (void *__restrict __handle, const char *__restrict __name, const char *__restrict __version) __THROW __nonnull ((2, 3)); #endif /* When any of the above functions fails, call this function to return a string describing the error. Each call resets the error string so that a following call returns null. */ extern char *dlerror (void) __THROW; #ifdef __USE_GNU /* Structure containing information about object searched using `dladdr'. */ typedef struct { const char *dli_fname; /* File name of defining object. */ void *dli_fbase; /* Load address of that object. */ const char *dli_sname; /* Name of nearest symbol. */ void *dli_saddr; /* Exact value of nearest symbol. */ } Dl_info; /* Fill in *INFO with the following information about ADDRESS. Returns 0 iff no shared object's segments contain that address. */ extern int dladdr (const void *__address, Dl_info *__info) __THROW __nonnull ((2)); /* Same as `dladdr', but additionally sets *EXTRA_INFO according to FLAGS. */ extern int dladdr1 (const void *__address, Dl_info *__info, void **__extra_info, int __flags) __THROW __nonnull ((2)); /* These are the possible values for the FLAGS argument to `dladdr1'. This indicates what extra information is stored at *EXTRA_INFO. It may also be zero, in which case the EXTRA_INFO argument is not used. */ enum { /* Matching symbol table entry (const ElfNN_Sym *). */ RTLD_DL_SYMENT = 1, /* The object containing the address (struct link_map *). */ RTLD_DL_LINKMAP = 2 }; /* Get information about the shared object HANDLE refers to. REQUEST is from among the values below, and determines the use of ARG. On success, returns zero. On failure, returns -1 and records an error message to be fetched with `dlerror'. */ extern int dlinfo (void *__restrict __handle, int __request, void *__restrict __arg) __THROW __nonnull ((1, 3)); /* These are the possible values for the REQUEST argument to `dlinfo'. */ enum { /* Treat ARG as `lmid_t *'; store namespace ID for HANDLE there. */ RTLD_DI_LMID = 1, /* Treat ARG as `struct link_map **'; store the `struct link_map *' for HANDLE there. */ RTLD_DI_LINKMAP = 2, RTLD_DI_CONFIGADDR = 3, /* Unsupported, defined by Solaris. */ /* Treat ARG as `Dl_serinfo *' (see below), and fill in to describe the directories that will be searched for dependencies of this object. RTLD_DI_SERINFOSIZE fills in just the `dls_cnt' and `dls_size' entries to indicate the size of the buffer that must be passed to RTLD_DI_SERINFO to fill in the full information. */ RTLD_DI_SERINFO = 4, RTLD_DI_SERINFOSIZE = 5, /* Treat ARG as `char *', and store there the directory name used to expand $ORIGIN in this shared object's dependency file names. */ RTLD_DI_ORIGIN = 6, RTLD_DI_PROFILENAME = 7, /* Unsupported, defined by Solaris. */ RTLD_DI_PROFILEOUT = 8, /* Unsupported, defined by Solaris. */ /* Treat ARG as `size_t *', and store there the TLS module ID of this object's PT_TLS segment, as used in TLS relocations; store zero if this object does not define a PT_TLS segment. */ RTLD_DI_TLS_MODID = 9, /* Treat ARG as `void **', and store there a pointer to the calling thread's TLS block corresponding to this object's PT_TLS segment. Store a null pointer if this object does not define a PT_TLS segment, or if the calling thread has not allocated a block for it. */ RTLD_DI_TLS_DATA = 10, /* Treat ARG as const ElfW(Phdr) **, and store the address of the program header array at that location. The dlinfo call returns the number of program headers in the array. */ RTLD_DI_PHDR = 11, RTLD_DI_MAX = 11 }; /* This is the type of elements in `Dl_serinfo', below. The `dls_name' member points to space in the buffer passed to `dlinfo'. */ typedef struct { char *dls_name; /* Name of library search path directory. */ unsigned int dls_flags; /* Indicates where this directory came from. */ } Dl_serpath; /* This is the structure that must be passed (by reference) to `dlinfo' for the RTLD_DI_SERINFO and RTLD_DI_SERINFOSIZE requests. */ typedef struct { size_t dls_size; /* Size in bytes of the whole buffer. */ unsigned int dls_cnt; /* Number of elements in `dls_serpath'. */ Dl_serpath dls_serpath[1]; /* Actually longer, dls_cnt elements. */ } Dl_serinfo; #endif /* __USE_GNU */ __END_DECLS #endif /* dlfcn.h */ elf.h 0000644 00000525354 15063602064 0005503 0 ustar 00 /* This file defines standard ELF types, structures, and macros. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ELF_H #define _ELF_H 1 #include <features.h> __BEGIN_DECLS /* Standard ELF types. */ #include <stdint.h> /* Type for a 16-bit quantity. */ typedef uint16_t Elf32_Half; typedef uint16_t Elf64_Half; /* Types for signed and unsigned 32-bit quantities. */ typedef uint32_t Elf32_Word; typedef int32_t Elf32_Sword; typedef uint32_t Elf64_Word; typedef int32_t Elf64_Sword; /* Types for signed and unsigned 64-bit quantities. */ typedef uint64_t Elf32_Xword; typedef int64_t Elf32_Sxword; typedef uint64_t Elf64_Xword; typedef int64_t Elf64_Sxword; /* Type of addresses. */ typedef uint32_t Elf32_Addr; typedef uint64_t Elf64_Addr; /* Type of file offsets. */ typedef uint32_t Elf32_Off; typedef uint64_t Elf64_Off; /* Type for section indices, which are 16-bit quantities. */ typedef uint16_t Elf32_Section; typedef uint16_t Elf64_Section; /* Type for version symbol information. */ typedef Elf32_Half Elf32_Versym; typedef Elf64_Half Elf64_Versym; /* The ELF file header. This appears at the start of every ELF file. */ #define EI_NIDENT (16) typedef struct { unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ Elf32_Half e_type; /* Object file type */ Elf32_Half e_machine; /* Architecture */ Elf32_Word e_version; /* Object file version */ Elf32_Addr e_entry; /* Entry point virtual address */ Elf32_Off e_phoff; /* Program header table file offset */ Elf32_Off e_shoff; /* Section header table file offset */ Elf32_Word e_flags; /* Processor-specific flags */ Elf32_Half e_ehsize; /* ELF header size in bytes */ Elf32_Half e_phentsize; /* Program header table entry size */ Elf32_Half e_phnum; /* Program header table entry count */ Elf32_Half e_shentsize; /* Section header table entry size */ Elf32_Half e_shnum; /* Section header table entry count */ Elf32_Half e_shstrndx; /* Section header string table index */ } Elf32_Ehdr; typedef struct { unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ Elf64_Half e_type; /* Object file type */ Elf64_Half e_machine; /* Architecture */ Elf64_Word e_version; /* Object file version */ Elf64_Addr e_entry; /* Entry point virtual address */ Elf64_Off e_phoff; /* Program header table file offset */ Elf64_Off e_shoff; /* Section header table file offset */ Elf64_Word e_flags; /* Processor-specific flags */ Elf64_Half e_ehsize; /* ELF header size in bytes */ Elf64_Half e_phentsize; /* Program header table entry size */ Elf64_Half e_phnum; /* Program header table entry count */ Elf64_Half e_shentsize; /* Section header table entry size */ Elf64_Half e_shnum; /* Section header table entry count */ Elf64_Half e_shstrndx; /* Section header string table index */ } Elf64_Ehdr; /* Fields in the e_ident array. The EI_* macros are indices into the array. The macros under each EI_* macro are the values the byte may have. */ #define EI_MAG0 0 /* File identification byte 0 index */ #define ELFMAG0 0x7f /* Magic number byte 0 */ #define EI_MAG1 1 /* File identification byte 1 index */ #define ELFMAG1 'E' /* Magic number byte 1 */ #define EI_MAG2 2 /* File identification byte 2 index */ #define ELFMAG2 'L' /* Magic number byte 2 */ #define EI_MAG3 3 /* File identification byte 3 index */ #define ELFMAG3 'F' /* Magic number byte 3 */ /* Conglomeration of the identification bytes, for easy testing as a word. */ #define ELFMAG "\177ELF" #define SELFMAG 4 #define EI_CLASS 4 /* File class byte index */ #define ELFCLASSNONE 0 /* Invalid class */ #define ELFCLASS32 1 /* 32-bit objects */ #define ELFCLASS64 2 /* 64-bit objects */ #define ELFCLASSNUM 3 #define EI_DATA 5 /* Data encoding byte index */ #define ELFDATANONE 0 /* Invalid data encoding */ #define ELFDATA2LSB 1 /* 2's complement, little endian */ #define ELFDATA2MSB 2 /* 2's complement, big endian */ #define ELFDATANUM 3 #define EI_VERSION 6 /* File version byte index */ /* Value must be EV_CURRENT */ #define EI_OSABI 7 /* OS ABI identification */ #define ELFOSABI_NONE 0 /* UNIX System V ABI */ #define ELFOSABI_SYSV 0 /* Alias. */ #define ELFOSABI_HPUX 1 /* HP-UX */ #define ELFOSABI_NETBSD 2 /* NetBSD. */ #define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ #define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ #define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ #define ELFOSABI_AIX 7 /* IBM AIX. */ #define ELFOSABI_IRIX 8 /* SGI Irix. */ #define ELFOSABI_FREEBSD 9 /* FreeBSD. */ #define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ #define ELFOSABI_MODESTO 11 /* Novell Modesto. */ #define ELFOSABI_OPENBSD 12 /* OpenBSD. */ #define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ #define ELFOSABI_ARM 97 /* ARM */ #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ #define EI_ABIVERSION 8 /* ABI version */ #define EI_PAD 9 /* Byte index of padding bytes */ /* Legal values for e_type (object file type). */ #define ET_NONE 0 /* No file type */ #define ET_REL 1 /* Relocatable file */ #define ET_EXEC 2 /* Executable file */ #define ET_DYN 3 /* Shared object file */ #define ET_CORE 4 /* Core file */ #define ET_NUM 5 /* Number of defined types */ #define ET_LOOS 0xfe00 /* OS-specific range start */ #define ET_HIOS 0xfeff /* OS-specific range end */ #define ET_LOPROC 0xff00 /* Processor-specific range start */ #define ET_HIPROC 0xffff /* Processor-specific range end */ /* Legal values for e_machine (architecture). */ #define EM_NONE 0 /* No machine */ #define EM_M32 1 /* AT&T WE 32100 */ #define EM_SPARC 2 /* SUN SPARC */ #define EM_386 3 /* Intel 80386 */ #define EM_68K 4 /* Motorola m68k family */ #define EM_88K 5 /* Motorola m88k family */ #define EM_IAMCU 6 /* Intel MCU */ #define EM_860 7 /* Intel 80860 */ #define EM_MIPS 8 /* MIPS R3000 big-endian */ #define EM_S370 9 /* IBM System/370 */ #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ /* reserved 11-14 */ #define EM_PARISC 15 /* HPPA */ /* reserved 16 */ #define EM_VPP500 17 /* Fujitsu VPP500 */ #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ #define EM_960 19 /* Intel 80960 */ #define EM_PPC 20 /* PowerPC */ #define EM_PPC64 21 /* PowerPC 64-bit */ #define EM_S390 22 /* IBM S390 */ #define EM_SPU 23 /* IBM SPU/SPC */ /* reserved 24-35 */ #define EM_V800 36 /* NEC V800 series */ #define EM_FR20 37 /* Fujitsu FR20 */ #define EM_RH32 38 /* TRW RH-32 */ #define EM_RCE 39 /* Motorola RCE */ #define EM_ARM 40 /* ARM */ #define EM_FAKE_ALPHA 41 /* Digital Alpha */ #define EM_SH 42 /* Hitachi SH */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_TRICORE 44 /* Siemens Tricore */ #define EM_ARC 45 /* Argonaut RISC Core */ #define EM_H8_300 46 /* Hitachi H8/300 */ #define EM_H8_300H 47 /* Hitachi H8/300H */ #define EM_H8S 48 /* Hitachi H8S */ #define EM_H8_500 49 /* Hitachi H8/500 */ #define EM_IA_64 50 /* Intel Merced */ #define EM_MIPS_X 51 /* Stanford MIPS-X */ #define EM_COLDFIRE 52 /* Motorola Coldfire */ #define EM_68HC12 53 /* Motorola M68HC12 */ #define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */ #define EM_PCP 55 /* Siemens PCP */ #define EM_NCPU 56 /* Sony nCPU embeeded RISC */ #define EM_NDR1 57 /* Denso NDR1 microprocessor */ #define EM_STARCORE 58 /* Motorola Start*Core processor */ #define EM_ME16 59 /* Toyota ME16 processor */ #define EM_ST100 60 /* STMicroelectronic ST100 processor */ #define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam */ #define EM_X86_64 62 /* AMD x86-64 architecture */ #define EM_PDSP 63 /* Sony DSP Processor */ #define EM_PDP10 64 /* Digital PDP-10 */ #define EM_PDP11 65 /* Digital PDP-11 */ #define EM_FX66 66 /* Siemens FX66 microcontroller */ #define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ #define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ #define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ #define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ #define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ #define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ #define EM_SVX 73 /* Silicon Graphics SVx */ #define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ #define EM_VAX 75 /* Digital VAX */ #define EM_CRIS 76 /* Axis Communications 32-bit emb.proc */ #define EM_JAVELIN 77 /* Infineon Technologies 32-bit emb.proc */ #define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ #define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ #define EM_MMIX 80 /* Donald Knuth's educational 64-bit proc */ #define EM_HUANY 81 /* Harvard University machine-independent object files */ #define EM_PRISM 82 /* SiTera Prism */ #define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ #define EM_FR30 84 /* Fujitsu FR30 */ #define EM_D10V 85 /* Mitsubishi D10V */ #define EM_D30V 86 /* Mitsubishi D30V */ #define EM_V850 87 /* NEC v850 */ #define EM_M32R 88 /* Mitsubishi M32R */ #define EM_MN10300 89 /* Matsushita MN10300 */ #define EM_MN10200 90 /* Matsushita MN10200 */ #define EM_PJ 91 /* picoJava */ #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ #define EM_ARC_COMPACT 93 /* ARC International ARCompact */ #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ #define EM_VIDEOCORE 95 /* Alphamosaic VideoCore */ #define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Proc */ #define EM_NS32K 97 /* National Semi. 32000 */ #define EM_TPC 98 /* Tenor Network TPC */ #define EM_SNP1K 99 /* Trebia SNP 1000 */ #define EM_ST200 100 /* STMicroelectronics ST200 */ #define EM_IP2K 101 /* Ubicom IP2xxx */ #define EM_MAX 102 /* MAX processor */ #define EM_CR 103 /* National Semi. CompactRISC */ #define EM_F2MC16 104 /* Fujitsu F2MC16 */ #define EM_MSP430 105 /* Texas Instruments msp430 */ #define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */ #define EM_SE_C33 107 /* Seiko Epson S1C33 family */ #define EM_SEP 108 /* Sharp embedded microprocessor */ #define EM_ARCA 109 /* Arca RISC */ #define EM_UNICORE 110 /* PKU-Unity & MPRC Peking Uni. mc series */ #define EM_EXCESS 111 /* eXcess configurable cpu */ #define EM_DXP 112 /* Icera Semi. Deep Execution Processor */ #define EM_ALTERA_NIOS2 113 /* Altera Nios II */ #define EM_CRX 114 /* National Semi. CompactRISC CRX */ #define EM_XGATE 115 /* Motorola XGATE */ #define EM_C166 116 /* Infineon C16x/XC16x */ #define EM_M16C 117 /* Renesas M16C */ #define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F */ #define EM_CE 119 /* Freescale Communication Engine RISC */ #define EM_M32C 120 /* Renesas M32C */ /* reserved 121-130 */ #define EM_TSK3000 131 /* Altium TSK3000 */ #define EM_RS08 132 /* Freescale RS08 */ #define EM_SHARC 133 /* Analog Devices SHARC family */ #define EM_ECOG2 134 /* Cyan Technology eCOG2 */ #define EM_SCORE7 135 /* Sunplus S+core7 RISC */ #define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP */ #define EM_VIDEOCORE3 137 /* Broadcom VideoCore III */ #define EM_LATTICEMICO32 138 /* RISC for Lattice FPGA */ #define EM_SE_C17 139 /* Seiko Epson C17 */ #define EM_TI_C6000 140 /* Texas Instruments TMS320C6000 DSP */ #define EM_TI_C2000 141 /* Texas Instruments TMS320C2000 DSP */ #define EM_TI_C5500 142 /* Texas Instruments TMS320C55x DSP */ #define EM_TI_ARP32 143 /* Texas Instruments App. Specific RISC */ #define EM_TI_PRU 144 /* Texas Instruments Prog. Realtime Unit */ /* reserved 145-159 */ #define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW DSP */ #define EM_CYPRESS_M8C 161 /* Cypress M8C */ #define EM_R32C 162 /* Renesas R32C */ #define EM_TRIMEDIA 163 /* NXP Semi. TriMedia */ #define EM_QDSP6 164 /* QUALCOMM DSP6 */ #define EM_8051 165 /* Intel 8051 and variants */ #define EM_STXP7X 166 /* STMicroelectronics STxP7x */ #define EM_NDS32 167 /* Andes Tech. compact code emb. RISC */ #define EM_ECOG1X 168 /* Cyan Technology eCOG1X */ #define EM_MAXQ30 169 /* Dallas Semi. MAXQ30 mc */ #define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP */ #define EM_MANIK 171 /* M2000 Reconfigurable RISC */ #define EM_CRAYNV2 172 /* Cray NV2 vector architecture */ #define EM_RX 173 /* Renesas RX */ #define EM_METAG 174 /* Imagination Tech. META */ #define EM_MCST_ELBRUS 175 /* MCST Elbrus */ #define EM_ECOG16 176 /* Cyan Technology eCOG16 */ #define EM_CR16 177 /* National Semi. CompactRISC CR16 */ #define EM_ETPU 178 /* Freescale Extended Time Processing Unit */ #define EM_SLE9X 179 /* Infineon Tech. SLE9X */ #define EM_L10M 180 /* Intel L10M */ #define EM_K10M 181 /* Intel K10M */ /* reserved 182 */ #define EM_AARCH64 183 /* ARM AARCH64 */ /* reserved 184 */ #define EM_AVR32 185 /* Amtel 32-bit microprocessor */ #define EM_STM8 186 /* STMicroelectronics STM8 */ #define EM_TILE64 187 /* Tileta TILE64 */ #define EM_TILEPRO 188 /* Tilera TILEPro */ #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ #define EM_CUDA 190 /* NVIDIA CUDA */ #define EM_TILEGX 191 /* Tilera TILE-Gx */ #define EM_CLOUDSHIELD 192 /* CloudShield */ #define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st gen. */ #define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd gen. */ #define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */ #define EM_OPEN8 196 /* Open8 RISC */ #define EM_RL78 197 /* Renesas RL78 */ #define EM_VIDEOCORE5 198 /* Broadcom VideoCore V */ #define EM_78KOR 199 /* Renesas 78KOR */ #define EM_56800EX 200 /* Freescale 56800EX DSC */ #define EM_BA1 201 /* Beyond BA1 */ #define EM_BA2 202 /* Beyond BA2 */ #define EM_XCORE 203 /* XMOS xCORE */ #define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) */ /* reserved 205-209 */ #define EM_KM32 210 /* KM211 KM32 */ #define EM_KMX32 211 /* KM211 KMX32 */ #define EM_EMX16 212 /* KM211 KMX16 */ #define EM_EMX8 213 /* KM211 KMX8 */ #define EM_KVARC 214 /* KM211 KVARC */ #define EM_CDP 215 /* Paneve CDP */ #define EM_COGE 216 /* Cognitive Smart Memory Processor */ #define EM_COOL 217 /* Bluechip CoolEngine */ #define EM_NORC 218 /* Nanoradio Optimized RISC */ #define EM_CSR_KALIMBA 219 /* CSR Kalimba */ #define EM_Z80 220 /* Zilog Z80 */ #define EM_VISIUM 221 /* Controls and Data Services VISIUMcore */ #define EM_FT32 222 /* FTDI Chip FT32 */ #define EM_MOXIE 223 /* Moxie processor */ #define EM_AMDGPU 224 /* AMD GPU */ /* reserved 225-242 */ #define EM_RISCV 243 /* RISC-V */ #define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */ #define EM_NUM 248 /* Old spellings/synonyms. */ #define EM_ARC_A5 EM_ARC_COMPACT /* If it is necessary to assign new unofficial EM_* values, please pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision with official or non-GNU unofficial values. */ #define EM_ALPHA 0x9026 /* Legal values for e_version (version). */ #define EV_NONE 0 /* Invalid ELF version */ #define EV_CURRENT 1 /* Current version */ #define EV_NUM 2 /* Section header. */ typedef struct { Elf32_Word sh_name; /* Section name (string tbl index) */ Elf32_Word sh_type; /* Section type */ Elf32_Word sh_flags; /* Section flags */ Elf32_Addr sh_addr; /* Section virtual addr at execution */ Elf32_Off sh_offset; /* Section file offset */ Elf32_Word sh_size; /* Section size in bytes */ Elf32_Word sh_link; /* Link to another section */ Elf32_Word sh_info; /* Additional section information */ Elf32_Word sh_addralign; /* Section alignment */ Elf32_Word sh_entsize; /* Entry size if section holds table */ } Elf32_Shdr; typedef struct { Elf64_Word sh_name; /* Section name (string tbl index) */ Elf64_Word sh_type; /* Section type */ Elf64_Xword sh_flags; /* Section flags */ Elf64_Addr sh_addr; /* Section virtual addr at execution */ Elf64_Off sh_offset; /* Section file offset */ Elf64_Xword sh_size; /* Section size in bytes */ Elf64_Word sh_link; /* Link to another section */ Elf64_Word sh_info; /* Additional section information */ Elf64_Xword sh_addralign; /* Section alignment */ Elf64_Xword sh_entsize; /* Entry size if section holds table */ } Elf64_Shdr; /* Special section indices. */ #define SHN_UNDEF 0 /* Undefined section */ #define SHN_LORESERVE 0xff00 /* Start of reserved indices */ #define SHN_LOPROC 0xff00 /* Start of processor-specific */ #define SHN_BEFORE 0xff00 /* Order section before all others (Solaris). */ #define SHN_AFTER 0xff01 /* Order section after all others (Solaris). */ #define SHN_HIPROC 0xff1f /* End of processor-specific */ #define SHN_LOOS 0xff20 /* Start of OS-specific */ #define SHN_HIOS 0xff3f /* End of OS-specific */ #define SHN_ABS 0xfff1 /* Associated symbol is absolute */ #define SHN_COMMON 0xfff2 /* Associated symbol is common */ #define SHN_XINDEX 0xffff /* Index is in extra table. */ #define SHN_HIRESERVE 0xffff /* End of reserved indices */ /* Legal values for sh_type (section type). */ #define SHT_NULL 0 /* Section header table entry unused */ #define SHT_PROGBITS 1 /* Program data */ #define SHT_SYMTAB 2 /* Symbol table */ #define SHT_STRTAB 3 /* String table */ #define SHT_RELA 4 /* Relocation entries with addends */ #define SHT_HASH 5 /* Symbol hash table */ #define SHT_DYNAMIC 6 /* Dynamic linking information */ #define SHT_NOTE 7 /* Notes */ #define SHT_NOBITS 8 /* Program space with no data (bss) */ #define SHT_REL 9 /* Relocation entries, no addends */ #define SHT_SHLIB 10 /* Reserved */ #define SHT_DYNSYM 11 /* Dynamic linker symbol table */ #define SHT_INIT_ARRAY 14 /* Array of constructors */ #define SHT_FINI_ARRAY 15 /* Array of destructors */ #define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ #define SHT_GROUP 17 /* Section group */ #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ #define SHT_NUM 19 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific. */ #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ #define SHT_SUNW_move 0x6ffffffa #define SHT_SUNW_COMDAT 0x6ffffffb #define SHT_SUNW_syminfo 0x6ffffffc #define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ #define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ #define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ #define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ #define SHT_HIOS 0x6fffffff /* End OS-specific type */ #define SHT_LOPROC 0x70000000 /* Start of processor-specific */ #define SHT_HIPROC 0x7fffffff /* End of processor-specific */ #define SHT_LOUSER 0x80000000 /* Start of application-specific */ #define SHT_HIUSER 0x8fffffff /* End of application-specific */ /* Legal values for sh_flags (section flags). */ #define SHF_WRITE (1 << 0) /* Writable */ #define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ #define SHF_EXECINSTR (1 << 2) /* Executable */ #define SHF_MERGE (1 << 4) /* Might be merged */ #define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ #define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ #define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ #define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling required */ #define SHF_GROUP (1 << 9) /* Section is member of a group. */ #define SHF_TLS (1 << 10) /* Section hold thread-local data. */ #define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */ #define SHF_MASKOS 0x0ff00000 /* OS-specific. */ #define SHF_MASKPROC 0xf0000000 /* Processor-specific */ #define SHF_ORDERED (1 << 30) /* Special ordering requirement (Solaris). */ #define SHF_EXCLUDE (1U << 31) /* Section is excluded unless referenced or allocated (Solaris).*/ /* Section compression header. Used when SHF_COMPRESSED is set. */ typedef struct { Elf32_Word ch_type; /* Compression format. */ Elf32_Word ch_size; /* Uncompressed data size. */ Elf32_Word ch_addralign; /* Uncompressed data alignment. */ } Elf32_Chdr; typedef struct { Elf64_Word ch_type; /* Compression format. */ Elf64_Word ch_reserved; Elf64_Xword ch_size; /* Uncompressed data size. */ Elf64_Xword ch_addralign; /* Uncompressed data alignment. */ } Elf64_Chdr; /* Legal values for ch_type (compression algorithm). */ #define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */ #define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */ #define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */ #define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */ #define ELFCOMPRESS_HIPROC 0x7fffffff /* End of processor-specific. */ /* Section group handling. */ #define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ /* Symbol table entry. */ typedef struct { Elf32_Word st_name; /* Symbol name (string tbl index) */ Elf32_Addr st_value; /* Symbol value */ Elf32_Word st_size; /* Symbol size */ unsigned char st_info; /* Symbol type and binding */ unsigned char st_other; /* Symbol visibility */ Elf32_Section st_shndx; /* Section index */ } Elf32_Sym; typedef struct { Elf64_Word st_name; /* Symbol name (string tbl index) */ unsigned char st_info; /* Symbol type and binding */ unsigned char st_other; /* Symbol visibility */ Elf64_Section st_shndx; /* Section index */ Elf64_Addr st_value; /* Symbol value */ Elf64_Xword st_size; /* Symbol size */ } Elf64_Sym; /* The syminfo section if available contains additional information about every dynamic symbol. */ typedef struct { Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ Elf32_Half si_flags; /* Per symbol flags */ } Elf32_Syminfo; typedef struct { Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ Elf64_Half si_flags; /* Per symbol flags */ } Elf64_Syminfo; /* Possible values for si_boundto. */ #define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ #define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ #define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ /* Possible bitmasks for si_flags. */ #define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ #define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ #define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ #define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy loaded */ /* Syminfo version values. */ #define SYMINFO_NONE 0 #define SYMINFO_CURRENT 1 #define SYMINFO_NUM 2 /* How to extract and insert information held in the st_info field. */ #define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) #define ELF32_ST_TYPE(val) ((val) & 0xf) #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ #define ELF64_ST_BIND(val) ELF32_ST_BIND (val) #define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) #define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) /* Legal values for ST_BIND subfield of st_info (symbol binding). */ #define STB_LOCAL 0 /* Local symbol */ #define STB_GLOBAL 1 /* Global symbol */ #define STB_WEAK 2 /* Weak symbol */ #define STB_NUM 3 /* Number of defined types. */ #define STB_LOOS 10 /* Start of OS-specific */ #define STB_GNU_UNIQUE 10 /* Unique symbol. */ #define STB_HIOS 12 /* End of OS-specific */ #define STB_LOPROC 13 /* Start of processor-specific */ #define STB_HIPROC 15 /* End of processor-specific */ /* Legal values for ST_TYPE subfield of st_info (symbol type). */ #define STT_NOTYPE 0 /* Symbol type is unspecified */ #define STT_OBJECT 1 /* Symbol is a data object */ #define STT_FUNC 2 /* Symbol is a code object */ #define STT_SECTION 3 /* Symbol associated with a section */ #define STT_FILE 4 /* Symbol's name is file name */ #define STT_COMMON 5 /* Symbol is a common data object */ #define STT_TLS 6 /* Symbol is thread-local data object*/ #define STT_NUM 7 /* Number of defined types. */ #define STT_LOOS 10 /* Start of OS-specific */ #define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ #define STT_HIOS 12 /* End of OS-specific */ #define STT_LOPROC 13 /* Start of processor-specific */ #define STT_HIPROC 15 /* End of processor-specific */ /* Symbol table indices are found in the hash buckets and chain table of a symbol hash table section. This special index value indicates the end of a chain, meaning no further symbols are found in that bucket. */ #define STN_UNDEF 0 /* End of a chain. */ /* How to extract and insert information held in the st_other field. */ #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) /* For ELF64 the definitions are the same. */ #define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) /* Symbol visibility specification encoded in the st_other field. */ #define STV_DEFAULT 0 /* Default symbol visibility rules */ #define STV_INTERNAL 1 /* Processor specific hidden class */ #define STV_HIDDEN 2 /* Sym unavailable in other modules */ #define STV_PROTECTED 3 /* Not preemptible, not exported */ /* Relocation table entry without addend (in section of type SHT_REL). */ typedef struct { Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */ } Elf32_Rel; /* I have seen two different definitions of the Elf64_Rel and Elf64_Rela structures, so we'll leave them out until Novell (or whoever) gets their act together. */ /* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ typedef struct { Elf64_Addr r_offset; /* Address */ Elf64_Xword r_info; /* Relocation type and symbol index */ } Elf64_Rel; /* Relocation table entry with addend (in section of type SHT_RELA). */ typedef struct { Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */ Elf32_Sword r_addend; /* Addend */ } Elf32_Rela; typedef struct { Elf64_Addr r_offset; /* Address */ Elf64_Xword r_info; /* Relocation type and symbol index */ Elf64_Sxword r_addend; /* Addend */ } Elf64_Rela; /* How to extract and insert information held in the r_info field. */ #define ELF32_R_SYM(val) ((val) >> 8) #define ELF32_R_TYPE(val) ((val) & 0xff) #define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) #define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) /* Program segment header. */ typedef struct { Elf32_Word p_type; /* Segment type */ Elf32_Off p_offset; /* Segment file offset */ Elf32_Addr p_vaddr; /* Segment virtual address */ Elf32_Addr p_paddr; /* Segment physical address */ Elf32_Word p_filesz; /* Segment size in file */ Elf32_Word p_memsz; /* Segment size in memory */ Elf32_Word p_flags; /* Segment flags */ Elf32_Word p_align; /* Segment alignment */ } Elf32_Phdr; typedef struct { Elf64_Word p_type; /* Segment type */ Elf64_Word p_flags; /* Segment flags */ Elf64_Off p_offset; /* Segment file offset */ Elf64_Addr p_vaddr; /* Segment virtual address */ Elf64_Addr p_paddr; /* Segment physical address */ Elf64_Xword p_filesz; /* Segment size in file */ Elf64_Xword p_memsz; /* Segment size in memory */ Elf64_Xword p_align; /* Segment alignment */ } Elf64_Phdr; /* Special value for e_phnum. This indicates that the real number of program headers is too large to fit into e_phnum. Instead the real value is in the field sh_info of section 0. */ #define PN_XNUM 0xffff /* Legal values for p_type (segment type). */ #define PT_NULL 0 /* Program header table entry unused */ #define PT_LOAD 1 /* Loadable program segment */ #define PT_DYNAMIC 2 /* Dynamic linking information */ #define PT_INTERP 3 /* Program interpreter */ #define PT_NOTE 4 /* Auxiliary information */ #define PT_SHLIB 5 /* Reserved */ #define PT_PHDR 6 /* Entry for header table itself */ #define PT_TLS 7 /* Thread-local storage segment */ #define PT_NUM 8 /* Number of defined types */ #define PT_LOOS 0x60000000 /* Start of OS-specific */ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ #define PT_HISUNW 0x6fffffff #define PT_HIOS 0x6fffffff /* End of OS-specific */ #define PT_LOPROC 0x70000000 /* Start of processor-specific */ #define PT_HIPROC 0x7fffffff /* End of processor-specific */ /* Legal values for p_flags (segment flags). */ #define PF_X (1 << 0) /* Segment is executable */ #define PF_W (1 << 1) /* Segment is writable */ #define PF_R (1 << 2) /* Segment is readable */ #define PF_MASKOS 0x0ff00000 /* OS-specific */ #define PF_MASKPROC 0xf0000000 /* Processor-specific */ /* Legal values for note segment descriptor types for core files. */ #define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ #define NT_PRFPREG 2 /* Contains copy of fpregset struct. */ #define NT_FPREGSET 2 /* Contains copy of fpregset struct */ #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ #define NT_PRXREG 4 /* Contains copy of prxregset struct */ #define NT_TASKSTRUCT 4 /* Contains copy of task structure */ #define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ #define NT_AUXV 6 /* Contains copy of auxv array */ #define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ #define NT_ASRS 8 /* Contains copy of asrset struct */ #define NT_PSTATUS 10 /* Contains copy of pstatus struct */ #define NT_PSINFO 13 /* Contains copy of psinfo struct */ #define NT_PRCRED 14 /* Contains copy of prcred struct */ #define NT_UTSNAME 15 /* Contains copy of utsname struct */ #define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ #define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ #define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ #define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, size might increase */ #define NT_FILE 0x46494c45 /* Contains information about mapped files */ #define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ #define NT_PPC_TAR 0x103 /* Target Address Register */ #define NT_PPC_PPR 0x104 /* Program Priority Register */ #define NT_PPC_DSCR 0x105 /* Data Stream Control Register */ #define NT_PPC_EBB 0x106 /* Event Based Branch Registers */ #define NT_PPC_PMU 0x107 /* Performance Monitor Registers */ #define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */ #define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */ #define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */ #define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */ #define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */ #define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers. */ #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ #define NT_S390_TIMER 0x301 /* s390 timer register */ #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ #define NT_S390_CTRS 0x304 /* s390 control registers */ #define NT_S390_PREFIX 0x305 /* s390 prefix register */ #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half. */ #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31. */ #define NT_S390_GS_CB 0x30b /* s390 guarded storage registers. */ #define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block. */ #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation. */ #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ #define NT_ARM_TLS 0x401 /* ARM TLS register */ #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ /* Legal values for the note segment descriptor types for object files. */ #define NT_VERSION 1 /* Contains a version string. */ /* Dynamic section entry. */ typedef struct { Elf32_Sword d_tag; /* Dynamic entry type */ union { Elf32_Word d_val; /* Integer value */ Elf32_Addr d_ptr; /* Address value */ } d_un; } Elf32_Dyn; typedef struct { Elf64_Sxword d_tag; /* Dynamic entry type */ union { Elf64_Xword d_val; /* Integer value */ Elf64_Addr d_ptr; /* Address value */ } d_un; } Elf64_Dyn; /* Legal values for d_tag (dynamic entry type). */ #define DT_NULL 0 /* Marks end of dynamic section */ #define DT_NEEDED 1 /* Name of needed library */ #define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ #define DT_PLTGOT 3 /* Processor defined value */ #define DT_HASH 4 /* Address of symbol hash table */ #define DT_STRTAB 5 /* Address of string table */ #define DT_SYMTAB 6 /* Address of symbol table */ #define DT_RELA 7 /* Address of Rela relocs */ #define DT_RELASZ 8 /* Total size of Rela relocs */ #define DT_RELAENT 9 /* Size of one Rela reloc */ #define DT_STRSZ 10 /* Size of string table */ #define DT_SYMENT 11 /* Size of one symbol table entry */ #define DT_INIT 12 /* Address of init function */ #define DT_FINI 13 /* Address of termination function */ #define DT_SONAME 14 /* Name of shared object */ #define DT_RPATH 15 /* Library search path (deprecated) */ #define DT_SYMBOLIC 16 /* Start symbol search here */ #define DT_REL 17 /* Address of Rel relocs */ #define DT_RELSZ 18 /* Total size of Rel relocs */ #define DT_RELENT 19 /* Size of one Rel reloc */ #define DT_PLTREL 20 /* Type of reloc in PLT */ #define DT_DEBUG 21 /* For debugging; unspecified */ #define DT_TEXTREL 22 /* Reloc might modify .text */ #define DT_JMPREL 23 /* Address of PLT relocs */ #define DT_BIND_NOW 24 /* Process relocations of object */ #define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ #define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ #define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ #define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ #define DT_RUNPATH 29 /* Library search path */ #define DT_FLAGS 30 /* Flags for the object being loaded */ #define DT_ENCODING 32 /* Start of encoded range */ #define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ #define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ #define DT_SYMTAB_SHNDX 34 /* Address of SYMTAB_SHNDX section */ #define DT_NUM 35 /* Number used */ #define DT_LOOS 0x6000000d /* Start of OS-specific */ #define DT_HIOS 0x6ffff000 /* End of OS-specific */ #define DT_LOPROC 0x70000000 /* Start of processor-specific */ #define DT_HIPROC 0x7fffffff /* End of processor-specific */ #define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ /* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's approach. */ #define DT_VALRNGLO 0x6ffffd00 #define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ #define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ #define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ #define DT_CHECKSUM 0x6ffffdf8 #define DT_PLTPADSZ 0x6ffffdf9 #define DT_MOVEENT 0x6ffffdfa #define DT_MOVESZ 0x6ffffdfb #define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ #define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting the following DT_* entry. */ #define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ #define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ #define DT_VALRNGHI 0x6ffffdff #define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ #define DT_VALNUM 12 /* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the Dyn.d_un.d_ptr field of the Elf*_Dyn structure. If any adjustment is made to the ELF object after it has been built these entries will need to be adjusted. */ #define DT_ADDRRNGLO 0x6ffffe00 #define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ #define DT_TLSDESC_PLT 0x6ffffef6 #define DT_TLSDESC_GOT 0x6ffffef7 #define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ #define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ #define DT_CONFIG 0x6ffffefa /* Configuration information. */ #define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ #define DT_AUDIT 0x6ffffefc /* Object auditing. */ #define DT_PLTPAD 0x6ffffefd /* PLT padding. */ #define DT_MOVETAB 0x6ffffefe /* Move table. */ #define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ #define DT_ADDRRNGHI 0x6ffffeff #define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ #define DT_ADDRNUM 11 /* The versioning entry types. The next are defined as part of the GNU extension. */ #define DT_VERSYM 0x6ffffff0 #define DT_RELACOUNT 0x6ffffff9 #define DT_RELCOUNT 0x6ffffffa /* These were chosen by Sun. */ #define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ #define DT_VERDEF 0x6ffffffc /* Address of version definition table */ #define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ #define DT_VERNEED 0x6ffffffe /* Address of table with needed versions */ #define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ #define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ #define DT_VERSIONTAGNUM 16 /* Sun added these machine-independent extensions in the "processor-specific" range. Be compatible. */ #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ #define DT_FILTER 0x7fffffff /* Shared object to get values from */ #define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) #define DT_EXTRANUM 3 /* Values of `d_un.d_val' in the DT_FLAGS entry. */ #define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ #define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ #define DF_TEXTREL 0x00000004 /* Object contains text relocations */ #define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ #define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ /* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry in the dynamic section. */ #define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ #define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ #define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ #define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ #define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ #define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ #define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ #define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ #define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ #define DF_1_TRANS 0x00000200 #define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ #define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ #define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ #define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ #define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ #define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ #define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ #define DF_1_NODIRECT 0x00020000 /* Object has no-direct binding. */ #define DF_1_IGNMULDEF 0x00040000 #define DF_1_NOKSYMS 0x00080000 #define DF_1_NOHDR 0x00100000 #define DF_1_EDITED 0x00200000 /* Object is modified after built. */ #define DF_1_NORELOC 0x00400000 #define DF_1_SYMINTPOSE 0x00800000 /* Object has individual interposers. */ #define DF_1_GLOBAUDIT 0x01000000 /* Global auditing required. */ #define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */ #define DF_1_STUB 0x04000000 #define DF_1_PIE 0x08000000 /* Flags for the feature selection in DT_FEATURE_1. */ #define DTF_1_PARINIT 0x00000001 #define DTF_1_CONFEXP 0x00000002 /* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ #define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ #define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not generally available. */ /* Version definition sections. */ typedef struct { Elf32_Half vd_version; /* Version revision */ Elf32_Half vd_flags; /* Version information */ Elf32_Half vd_ndx; /* Version Index */ Elf32_Half vd_cnt; /* Number of associated aux entries */ Elf32_Word vd_hash; /* Version name hash value */ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ Elf32_Word vd_next; /* Offset in bytes to next verdef entry */ } Elf32_Verdef; typedef struct { Elf64_Half vd_version; /* Version revision */ Elf64_Half vd_flags; /* Version information */ Elf64_Half vd_ndx; /* Version Index */ Elf64_Half vd_cnt; /* Number of associated aux entries */ Elf64_Word vd_hash; /* Version name hash value */ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ Elf64_Word vd_next; /* Offset in bytes to next verdef entry */ } Elf64_Verdef; /* Legal values for vd_version (version revision). */ #define VER_DEF_NONE 0 /* No version */ #define VER_DEF_CURRENT 1 /* Current version */ #define VER_DEF_NUM 2 /* Given version number */ /* Legal values for vd_flags (version information flags). */ #define VER_FLG_BASE 0x1 /* Version definition of file itself */ #define VER_FLG_WEAK 0x2 /* Weak version identifier. Also used by vna_flags below. */ /* Versym symbol index values. */ #define VER_NDX_LOCAL 0 /* Symbol is local. */ #define VER_NDX_GLOBAL 1 /* Symbol is global. */ #define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ #define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ /* Auxialiary version information. */ typedef struct { Elf32_Word vda_name; /* Version or dependency names */ Elf32_Word vda_next; /* Offset in bytes to next verdaux entry */ } Elf32_Verdaux; typedef struct { Elf64_Word vda_name; /* Version or dependency names */ Elf64_Word vda_next; /* Offset in bytes to next verdaux entry */ } Elf64_Verdaux; /* Version dependency section. */ typedef struct { Elf32_Half vn_version; /* Version of structure */ Elf32_Half vn_cnt; /* Number of associated aux entries */ Elf32_Word vn_file; /* Offset of filename for this dependency */ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ Elf32_Word vn_next; /* Offset in bytes to next verneed entry */ } Elf32_Verneed; typedef struct { Elf64_Half vn_version; /* Version of structure */ Elf64_Half vn_cnt; /* Number of associated aux entries */ Elf64_Word vn_file; /* Offset of filename for this dependency */ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ Elf64_Word vn_next; /* Offset in bytes to next verneed entry */ } Elf64_Verneed; /* Legal values for vn_version (version revision). */ #define VER_NEED_NONE 0 /* No version */ #define VER_NEED_CURRENT 1 /* Current version */ #define VER_NEED_NUM 2 /* Given version number */ /* Auxiliary needed version information. */ typedef struct { Elf32_Word vna_hash; /* Hash value of dependency name */ Elf32_Half vna_flags; /* Dependency specific information */ Elf32_Half vna_other; /* Unused */ Elf32_Word vna_name; /* Dependency name string offset */ Elf32_Word vna_next; /* Offset in bytes to next vernaux entry */ } Elf32_Vernaux; typedef struct { Elf64_Word vna_hash; /* Hash value of dependency name */ Elf64_Half vna_flags; /* Dependency specific information */ Elf64_Half vna_other; /* Unused */ Elf64_Word vna_name; /* Dependency name string offset */ Elf64_Word vna_next; /* Offset in bytes to next vernaux entry */ } Elf64_Vernaux; /* Auxiliary vector. */ /* This vector is normally only used by the program interpreter. The usual definition in an ABI supplement uses the name auxv_t. The vector is not usually defined in a standard <elf.h> file, but it can't hurt. We rename it to avoid conflicts. The sizes of these types are an arrangement between the exec server and the program interpreter, so we don't fully specify them here. */ typedef struct { uint32_t a_type; /* Entry type */ union { uint32_t a_val; /* Integer value */ /* We use to have pointer elements added here. We cannot do that, though, since it does not work when using 32-bit definitions on 64-bit platforms and vice versa. */ } a_un; } Elf32_auxv_t; typedef struct { uint64_t a_type; /* Entry type */ union { uint64_t a_val; /* Integer value */ /* We use to have pointer elements added here. We cannot do that, though, since it does not work when using 32-bit definitions on 64-bit platforms and vice versa. */ } a_un; } Elf64_auxv_t; /* Legal values for a_type (entry type). */ #define AT_NULL 0 /* End of vector */ #define AT_IGNORE 1 /* Entry should be ignored */ #define AT_EXECFD 2 /* File descriptor of program */ #define AT_PHDR 3 /* Program headers for program */ #define AT_PHENT 4 /* Size of program header entry */ #define AT_PHNUM 5 /* Number of program headers */ #define AT_PAGESZ 6 /* System page size */ #define AT_BASE 7 /* Base address of interpreter */ #define AT_FLAGS 8 /* Flags */ #define AT_ENTRY 9 /* Entry point of program */ #define AT_NOTELF 10 /* Program is not ELF */ #define AT_UID 11 /* Real uid */ #define AT_EUID 12 /* Effective uid */ #define AT_GID 13 /* Real gid */ #define AT_EGID 14 /* Effective gid */ #define AT_CLKTCK 17 /* Frequency of times() */ /* Some more special a_type values describing the hardware. */ #define AT_PLATFORM 15 /* String identifying platform. */ #define AT_HWCAP 16 /* Machine-dependent hints about processor capabilities. */ /* This entry gives some information about the FPU initialization performed by the kernel. */ #define AT_FPUCW 18 /* Used FPU control word. */ /* Cache block sizes. */ #define AT_DCACHEBSIZE 19 /* Data cache block size. */ #define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ #define AT_UCACHEBSIZE 21 /* Unified cache block size. */ /* A special ignored value for PPC, used by the kernel to control the interpretation of the AUXV. Must be > 16. */ #define AT_IGNOREPPC 22 /* Entry should be ignored. */ #define AT_SECURE 23 /* Boolean, was exec setuid-like? */ #define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ #define AT_RANDOM 25 /* Address of 16 random bytes. */ #define AT_HWCAP2 26 /* More machine-dependent hints about processor capabilities. */ #define AT_EXECFN 31 /* Filename of executable. */ /* Pointer to the global system page used for system calls and other nice things. */ #define AT_SYSINFO 32 #define AT_SYSINFO_EHDR 33 /* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains log2 of line size; mask those to get cache size. */ #define AT_L1I_CACHESHAPE 34 #define AT_L1D_CACHESHAPE 35 #define AT_L2_CACHESHAPE 36 #define AT_L3_CACHESHAPE 37 /* Shapes of the caches, with more room to describe them. *GEOMETRY are comprised of cache line size in bytes in the bottom 16 bits and the cache associativity in the next 16 bits. */ #define AT_L1I_CACHESIZE 40 #define AT_L1I_CACHEGEOMETRY 41 #define AT_L1D_CACHESIZE 42 #define AT_L1D_CACHEGEOMETRY 43 #define AT_L2_CACHESIZE 44 #define AT_L2_CACHEGEOMETRY 45 #define AT_L3_CACHESIZE 46 #define AT_L3_CACHEGEOMETRY 47 /* Note section contents. Each entry in the note section begins with a header of a fixed form. */ typedef struct { Elf32_Word n_namesz; /* Length of the note's name. */ Elf32_Word n_descsz; /* Length of the note's descriptor. */ Elf32_Word n_type; /* Type of the note. */ } Elf32_Nhdr; typedef struct { Elf64_Word n_namesz; /* Length of the note's name. */ Elf64_Word n_descsz; /* Length of the note's descriptor. */ Elf64_Word n_type; /* Type of the note. */ } Elf64_Nhdr; /* Known names of notes. */ /* Solaris entries in the note section have this name. */ #define ELF_NOTE_SOLARIS "SUNW Solaris" /* Note entries for GNU systems have this name. */ #define ELF_NOTE_GNU "GNU" /* Defined types of notes for Solaris. */ /* Value of descriptor (one word) is desired pagesize for the binary. */ #define ELF_NOTE_PAGESIZE_HINT 1 /* Defined note types for GNU systems. */ /* ABI information. The descriptor consists of words: word 0: OS descriptor word 1: major version of the ABI word 2: minor version of the ABI word 3: subminor version of the ABI */ #define NT_GNU_ABI_TAG 1 #define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ /* Known OSes. These values can appear in word 0 of an NT_GNU_ABI_TAG note section entry. */ #define ELF_NOTE_OS_LINUX 0 #define ELF_NOTE_OS_GNU 1 #define ELF_NOTE_OS_SOLARIS2 2 #define ELF_NOTE_OS_FREEBSD 3 /* Synthetic hwcap information. The descriptor begins with two words: word 0: number of entries word 1: bitmask of enabled entries Then follow variable-length entries, one byte followed by a '\0'-terminated hwcap name string. The byte gives the bit number to test if enabled, (1U << bit) & bitmask. */ #define NT_GNU_HWCAP 2 /* Build ID bits as generated by ld --build-id. The descriptor consists of any nonzero number of bytes. */ #define NT_GNU_BUILD_ID 3 /* Version note generated by GNU gold containing a version string. */ #define NT_GNU_GOLD_VERSION 4 /* Program property. */ #define NT_GNU_PROPERTY_TYPE_0 5 /* Note section name of program property. */ #define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property" /* Values used in GNU .note.gnu.property notes (NT_GNU_PROPERTY_TYPE_0). */ /* Stack size. */ #define GNU_PROPERTY_STACK_SIZE 1 /* No copy relocation on protected data symbol. */ #define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2 /* Processor-specific semantics, lo */ #define GNU_PROPERTY_LOPROC 0xc0000000 /* Processor-specific semantics, hi */ #define GNU_PROPERTY_HIPROC 0xdfffffff /* Application-specific semantics, lo */ #define GNU_PROPERTY_LOUSER 0xe0000000 /* Application-specific semantics, hi */ #define GNU_PROPERTY_HIUSER 0xffffffff /* The x86 instruction sets indicated by the corresponding bits are used in program. Their support in the hardware is optional. */ #define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 /* The x86 instruction sets indicated by the corresponding bits are used in program and they must be supported by the hardware. */ #define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001 /* X86 processor-specific features used in program. */ #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 #define GNU_PROPERTY_X86_ISA_1_486 (1U << 0) #define GNU_PROPERTY_X86_ISA_1_586 (1U << 1) #define GNU_PROPERTY_X86_ISA_1_686 (1U << 2) #define GNU_PROPERTY_X86_ISA_1_SSE (1U << 3) #define GNU_PROPERTY_X86_ISA_1_SSE2 (1U << 4) #define GNU_PROPERTY_X86_ISA_1_SSE3 (1U << 5) #define GNU_PROPERTY_X86_ISA_1_SSSE3 (1U << 6) #define GNU_PROPERTY_X86_ISA_1_SSE4_1 (1U << 7) #define GNU_PROPERTY_X86_ISA_1_SSE4_2 (1U << 8) #define GNU_PROPERTY_X86_ISA_1_AVX (1U << 9) #define GNU_PROPERTY_X86_ISA_1_AVX2 (1U << 10) #define GNU_PROPERTY_X86_ISA_1_AVX512F (1U << 11) #define GNU_PROPERTY_X86_ISA_1_AVX512CD (1U << 12) #define GNU_PROPERTY_X86_ISA_1_AVX512ER (1U << 13) #define GNU_PROPERTY_X86_ISA_1_AVX512PF (1U << 14) #define GNU_PROPERTY_X86_ISA_1_AVX512VL (1U << 15) #define GNU_PROPERTY_X86_ISA_1_AVX512DQ (1U << 16) #define GNU_PROPERTY_X86_ISA_1_AVX512BW (1U << 17) /* This indicates that all executable sections are compatible with IBT. */ #define GNU_PROPERTY_X86_FEATURE_1_IBT (1U << 0) /* This indicates that all executable sections are compatible with SHSTK. */ #define GNU_PROPERTY_X86_FEATURE_1_SHSTK (1U << 1) /* Move records. */ typedef struct { Elf32_Xword m_value; /* Symbol value. */ Elf32_Word m_info; /* Size and index. */ Elf32_Word m_poffset; /* Symbol offset. */ Elf32_Half m_repeat; /* Repeat count. */ Elf32_Half m_stride; /* Stride info. */ } Elf32_Move; typedef struct { Elf64_Xword m_value; /* Symbol value. */ Elf64_Xword m_info; /* Size and index. */ Elf64_Xword m_poffset; /* Symbol offset. */ Elf64_Half m_repeat; /* Repeat count. */ Elf64_Half m_stride; /* Stride info. */ } Elf64_Move; /* Macro to construct move records. */ #define ELF32_M_SYM(info) ((info) >> 8) #define ELF32_M_SIZE(info) ((unsigned char) (info)) #define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) #define ELF64_M_SYM(info) ELF32_M_SYM (info) #define ELF64_M_SIZE(info) ELF32_M_SIZE (info) #define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) /* Motorola 68k specific definitions. */ /* Values for Elf32_Ehdr.e_flags. */ #define EF_CPU32 0x00810000 /* m68k relocs. */ #define R_68K_NONE 0 /* No reloc */ #define R_68K_32 1 /* Direct 32 bit */ #define R_68K_16 2 /* Direct 16 bit */ #define R_68K_8 3 /* Direct 8 bit */ #define R_68K_PC32 4 /* PC relative 32 bit */ #define R_68K_PC16 5 /* PC relative 16 bit */ #define R_68K_PC8 6 /* PC relative 8 bit */ #define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ #define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ #define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ #define R_68K_GOT32O 10 /* 32 bit GOT offset */ #define R_68K_GOT16O 11 /* 16 bit GOT offset */ #define R_68K_GOT8O 12 /* 8 bit GOT offset */ #define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ #define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ #define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ #define R_68K_PLT32O 16 /* 32 bit PLT offset */ #define R_68K_PLT16O 17 /* 16 bit PLT offset */ #define R_68K_PLT8O 18 /* 8 bit PLT offset */ #define R_68K_COPY 19 /* Copy symbol at runtime */ #define R_68K_GLOB_DAT 20 /* Create GOT entry */ #define R_68K_JMP_SLOT 21 /* Create PLT entry */ #define R_68K_RELATIVE 22 /* Adjust by program base */ #define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ #define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ #define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ #define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ #define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ #define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ #define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ #define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ #define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ #define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ #define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ #define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ #define R_68K_TLS_LE32 37 /* 32 bit offset relative to static TLS block */ #define R_68K_TLS_LE16 38 /* 16 bit offset relative to static TLS block */ #define R_68K_TLS_LE8 39 /* 8 bit offset relative to static TLS block */ #define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ #define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ #define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ /* Keep this the last entry. */ #define R_68K_NUM 43 /* Intel 80386 specific definitions. */ /* i386 relocs. */ #define R_386_NONE 0 /* No reloc */ #define R_386_32 1 /* Direct 32 bit */ #define R_386_PC32 2 /* PC relative 32 bit */ #define R_386_GOT32 3 /* 32 bit GOT entry */ #define R_386_PLT32 4 /* 32 bit PLT address */ #define R_386_COPY 5 /* Copy symbol at runtime */ #define R_386_GLOB_DAT 6 /* Create GOT entry */ #define R_386_JMP_SLOT 7 /* Create PLT entry */ #define R_386_RELATIVE 8 /* Adjust by program base */ #define R_386_GOTOFF 9 /* 32 bit offset to GOT */ #define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ #define R_386_32PLT 11 #define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ #define R_386_TLS_IE 15 /* Address of GOT entry for static TLS block offset */ #define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block offset */ #define R_386_TLS_LE 17 /* Offset relative to static TLS block */ #define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of general dynamic thread local data */ #define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of local dynamic thread local data in LE code */ #define R_386_16 20 #define R_386_PC16 21 #define R_386_8 22 #define R_386_PC8 23 #define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic thread local data */ #define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ #define R_386_TLS_GD_CALL 26 /* Relocation for call to __tls_get_addr() */ #define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ #define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic thread local data in LE code */ #define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ #define R_386_TLS_LDM_CALL 30 /* Relocation for call to __tls_get_addr() in LDM code */ #define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ #define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ #define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS block offset */ #define R_386_TLS_LE_32 34 /* Negated offset relative to static TLS block */ #define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ #define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ #define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ #define R_386_SIZE32 38 /* 32-bit symbol size */ #define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ #define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS descriptor for relaxation. */ #define R_386_TLS_DESC 41 /* TLS descriptor containing pointer to code and to argument, returning the TLS offset for the symbol. */ #define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ #define R_386_GOT32X 43 /* Load from 32 bit GOT entry, relaxable. */ /* Keep this the last entry. */ #define R_386_NUM 44 /* SUN SPARC specific definitions. */ /* Legal values for ST_TYPE subfield of st_info (symbol type). */ #define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ /* Values for Elf64_Ehdr.e_flags. */ #define EF_SPARCV9_MM 3 #define EF_SPARCV9_TSO 0 #define EF_SPARCV9_PSO 1 #define EF_SPARCV9_RMO 2 #define EF_SPARC_LEDATA 0x800000 /* little endian data */ #define EF_SPARC_EXT_MASK 0xFFFF00 #define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ #define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ #define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ #define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ /* SPARC relocs. */ #define R_SPARC_NONE 0 /* No reloc */ #define R_SPARC_8 1 /* Direct 8 bit */ #define R_SPARC_16 2 /* Direct 16 bit */ #define R_SPARC_32 3 /* Direct 32 bit */ #define R_SPARC_DISP8 4 /* PC relative 8 bit */ #define R_SPARC_DISP16 5 /* PC relative 16 bit */ #define R_SPARC_DISP32 6 /* PC relative 32 bit */ #define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ #define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ #define R_SPARC_HI22 9 /* High 22 bit */ #define R_SPARC_22 10 /* Direct 22 bit */ #define R_SPARC_13 11 /* Direct 13 bit */ #define R_SPARC_LO10 12 /* Truncated 10 bit */ #define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ #define R_SPARC_GOT13 14 /* 13 bit GOT entry */ #define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ #define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ #define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ #define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ #define R_SPARC_COPY 19 /* Copy symbol at runtime */ #define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ #define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ #define R_SPARC_RELATIVE 22 /* Adjust by program base */ #define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ /* Additional Sparc64 relocs. */ #define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ #define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ #define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ #define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ #define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ #define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ #define R_SPARC_10 30 /* Direct 10 bit */ #define R_SPARC_11 31 /* Direct 11 bit */ #define R_SPARC_64 32 /* Direct 64 bit */ #define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ #define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ #define R_SPARC_HM10 35 /* High middle 10 bits of ... */ #define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ #define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ #define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ #define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ #define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ #define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ #define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ #define R_SPARC_7 43 /* Direct 7 bit */ #define R_SPARC_5 44 /* Direct 5 bit */ #define R_SPARC_6 45 /* Direct 6 bit */ #define R_SPARC_DISP64 46 /* PC relative 64 bit */ #define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ #define R_SPARC_HIX22 48 /* High 22 bit complemented */ #define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ #define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ #define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ #define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ #define R_SPARC_REGISTER 53 /* Global register usage */ #define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ #define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ #define R_SPARC_TLS_GD_HI22 56 #define R_SPARC_TLS_GD_LO10 57 #define R_SPARC_TLS_GD_ADD 58 #define R_SPARC_TLS_GD_CALL 59 #define R_SPARC_TLS_LDM_HI22 60 #define R_SPARC_TLS_LDM_LO10 61 #define R_SPARC_TLS_LDM_ADD 62 #define R_SPARC_TLS_LDM_CALL 63 #define R_SPARC_TLS_LDO_HIX22 64 #define R_SPARC_TLS_LDO_LOX10 65 #define R_SPARC_TLS_LDO_ADD 66 #define R_SPARC_TLS_IE_HI22 67 #define R_SPARC_TLS_IE_LO10 68 #define R_SPARC_TLS_IE_LD 69 #define R_SPARC_TLS_IE_LDX 70 #define R_SPARC_TLS_IE_ADD 71 #define R_SPARC_TLS_LE_HIX22 72 #define R_SPARC_TLS_LE_LOX10 73 #define R_SPARC_TLS_DTPMOD32 74 #define R_SPARC_TLS_DTPMOD64 75 #define R_SPARC_TLS_DTPOFF32 76 #define R_SPARC_TLS_DTPOFF64 77 #define R_SPARC_TLS_TPOFF32 78 #define R_SPARC_TLS_TPOFF64 79 #define R_SPARC_GOTDATA_HIX22 80 #define R_SPARC_GOTDATA_LOX10 81 #define R_SPARC_GOTDATA_OP_HIX22 82 #define R_SPARC_GOTDATA_OP_LOX10 83 #define R_SPARC_GOTDATA_OP 84 #define R_SPARC_H34 85 #define R_SPARC_SIZE32 86 #define R_SPARC_SIZE64 87 #define R_SPARC_WDISP10 88 #define R_SPARC_JMP_IREL 248 #define R_SPARC_IRELATIVE 249 #define R_SPARC_GNU_VTINHERIT 250 #define R_SPARC_GNU_VTENTRY 251 #define R_SPARC_REV32 252 /* Keep this the last entry. */ #define R_SPARC_NUM 253 /* For Sparc64, legal values for d_tag of Elf64_Dyn. */ #define DT_SPARC_REGISTER 0x70000001 #define DT_SPARC_NUM 2 /* MIPS R3000 specific definitions. */ /* Legal values for e_flags field of Elf32_Ehdr. */ #define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used. */ #define EF_MIPS_PIC 2 /* Contains PIC code. */ #define EF_MIPS_CPIC 4 /* Uses PIC calling sequence. */ #define EF_MIPS_XGOT 8 #define EF_MIPS_64BIT_WHIRL 16 #define EF_MIPS_ABI2 32 #define EF_MIPS_ABI_ON32 64 #define EF_MIPS_FP64 512 /* Uses FP64 (12 callee-saved). */ #define EF_MIPS_NAN2008 1024 /* Uses IEEE 754-2008 NaN encoding. */ #define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */ /* Legal values for MIPS architecture level. */ #define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ #define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ #define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ #define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ #define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ #define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */ #define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */ #define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */ #define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */ /* The following are unofficial names and should not be used. */ #define E_MIPS_ARCH_1 EF_MIPS_ARCH_1 #define E_MIPS_ARCH_2 EF_MIPS_ARCH_2 #define E_MIPS_ARCH_3 EF_MIPS_ARCH_3 #define E_MIPS_ARCH_4 EF_MIPS_ARCH_4 #define E_MIPS_ARCH_5 EF_MIPS_ARCH_5 #define E_MIPS_ARCH_32 EF_MIPS_ARCH_32 #define E_MIPS_ARCH_64 EF_MIPS_ARCH_64 /* Special section indices. */ #define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols. */ #define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ #define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ #define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols. */ #define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols. */ /* Legal values for sh_type field of Elf32_Shdr. */ #define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link. */ #define SHT_MIPS_MSYM 0x70000001 #define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols. */ #define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes. */ #define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ #define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging info. */ #define SHT_MIPS_REGINFO 0x70000006 /* Register usage information. */ #define SHT_MIPS_PACKAGE 0x70000007 #define SHT_MIPS_PACKSYM 0x70000008 #define SHT_MIPS_RELD 0x70000009 #define SHT_MIPS_IFACE 0x7000000b #define SHT_MIPS_CONTENT 0x7000000c #define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ #define SHT_MIPS_SHDR 0x70000010 #define SHT_MIPS_FDESC 0x70000011 #define SHT_MIPS_EXTSYM 0x70000012 #define SHT_MIPS_DENSE 0x70000013 #define SHT_MIPS_PDESC 0x70000014 #define SHT_MIPS_LOCSYM 0x70000015 #define SHT_MIPS_AUXSYM 0x70000016 #define SHT_MIPS_OPTSYM 0x70000017 #define SHT_MIPS_LOCSTR 0x70000018 #define SHT_MIPS_LINE 0x70000019 #define SHT_MIPS_RFDESC 0x7000001a #define SHT_MIPS_DELTASYM 0x7000001b #define SHT_MIPS_DELTAINST 0x7000001c #define SHT_MIPS_DELTACLASS 0x7000001d #define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ #define SHT_MIPS_DELTADECL 0x7000001f #define SHT_MIPS_SYMBOL_LIB 0x70000020 #define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ #define SHT_MIPS_TRANSLATE 0x70000022 #define SHT_MIPS_PIXIE 0x70000023 #define SHT_MIPS_XLATE 0x70000024 #define SHT_MIPS_XLATE_DEBUG 0x70000025 #define SHT_MIPS_WHIRL 0x70000026 #define SHT_MIPS_EH_REGION 0x70000027 #define SHT_MIPS_XLATE_OLD 0x70000028 #define SHT_MIPS_PDR_EXCEPTION 0x70000029 #define SHT_MIPS_XHASH 0x7000002b /* Legal values for sh_flags field of Elf32_Shdr. */ #define SHF_MIPS_GPREL 0x10000000 /* Must be in global data area. */ #define SHF_MIPS_MERGE 0x20000000 #define SHF_MIPS_ADDR 0x40000000 #define SHF_MIPS_STRINGS 0x80000000 #define SHF_MIPS_NOSTRIP 0x08000000 #define SHF_MIPS_LOCAL 0x04000000 #define SHF_MIPS_NAMES 0x02000000 #define SHF_MIPS_NODUPE 0x01000000 /* Symbol tables. */ /* MIPS specific values for `st_other'. */ #define STO_MIPS_DEFAULT 0x0 #define STO_MIPS_INTERNAL 0x1 #define STO_MIPS_HIDDEN 0x2 #define STO_MIPS_PROTECTED 0x3 #define STO_MIPS_PLT 0x8 #define STO_MIPS_SC_ALIGN_UNUSED 0xff /* MIPS specific values for `st_info'. */ #define STB_MIPS_SPLIT_COMMON 13 /* Entries found in sections of type SHT_MIPS_GPTAB. */ typedef union { struct { Elf32_Word gt_current_g_value; /* -G value used for compilation. */ Elf32_Word gt_unused; /* Not used. */ } gt_header; /* First entry in section. */ struct { Elf32_Word gt_g_value; /* If this value were used for -G. */ Elf32_Word gt_bytes; /* This many bytes would be used. */ } gt_entry; /* Subsequent entries in section. */ } Elf32_gptab; /* Entry found in sections of type SHT_MIPS_REGINFO. */ typedef struct { Elf32_Word ri_gprmask; /* General registers used. */ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used. */ Elf32_Sword ri_gp_value; /* $gp register value. */ } Elf32_RegInfo; /* Entries found in sections of type SHT_MIPS_OPTIONS. */ typedef struct { unsigned char kind; /* Determines interpretation of the variable part of descriptor. */ unsigned char size; /* Size of descriptor, including header. */ Elf32_Section section; /* Section header index of section affected, 0 for global options. */ Elf32_Word info; /* Kind-specific information. */ } Elf_Options; /* Values for `kind' field in Elf_Options. */ #define ODK_NULL 0 /* Undefined. */ #define ODK_REGINFO 1 /* Register usage information. */ #define ODK_EXCEPTIONS 2 /* Exception processing options. */ #define ODK_PAD 3 /* Section padding options. */ #define ODK_HWPATCH 4 /* Hardware workarounds performed */ #define ODK_FILL 5 /* record the fill value used by the linker. */ #define ODK_TAGS 6 /* reserve space for desktop tools to write. */ #define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ #define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ /* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ #define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ #define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ #define OEX_PAGE0 0x10000 /* page zero must be mapped. */ #define OEX_SMM 0x20000 /* Force sequential memory mode? */ #define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ #define OEX_PRECISEFP OEX_FPDBUG #define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ #define OEX_FPU_INVAL 0x10 #define OEX_FPU_DIV0 0x08 #define OEX_FPU_OFLO 0x04 #define OEX_FPU_UFLO 0x02 #define OEX_FPU_INEX 0x01 /* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ #define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ #define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ #define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ #define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ #define OPAD_PREFIX 0x1 #define OPAD_POSTFIX 0x2 #define OPAD_SYMBOL 0x4 /* Entry found in `.options' section. */ typedef struct { Elf32_Word hwp_flags1; /* Extra flags. */ Elf32_Word hwp_flags2; /* Extra flags. */ } Elf_Options_Hw; /* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ #define OHWA0_R4KEOP_CHECKED 0x00000001 #define OHWA1_R4KEOP_CLEAN 0x00000002 /* MIPS relocs. */ #define R_MIPS_NONE 0 /* No reloc */ #define R_MIPS_16 1 /* Direct 16 bit */ #define R_MIPS_32 2 /* Direct 32 bit */ #define R_MIPS_REL32 3 /* PC relative 32 bit */ #define R_MIPS_26 4 /* Direct 26 bit shifted */ #define R_MIPS_HI16 5 /* High 16 bit */ #define R_MIPS_LO16 6 /* Low 16 bit */ #define R_MIPS_GPREL16 7 /* GP relative 16 bit */ #define R_MIPS_LITERAL 8 /* 16 bit literal entry */ #define R_MIPS_GOT16 9 /* 16 bit GOT entry */ #define R_MIPS_PC16 10 /* PC relative 16 bit */ #define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ #define R_MIPS_GPREL32 12 /* GP relative 32 bit */ #define R_MIPS_SHIFT5 16 #define R_MIPS_SHIFT6 17 #define R_MIPS_64 18 #define R_MIPS_GOT_DISP 19 #define R_MIPS_GOT_PAGE 20 #define R_MIPS_GOT_OFST 21 #define R_MIPS_GOT_HI16 22 #define R_MIPS_GOT_LO16 23 #define R_MIPS_SUB 24 #define R_MIPS_INSERT_A 25 #define R_MIPS_INSERT_B 26 #define R_MIPS_DELETE 27 #define R_MIPS_HIGHER 28 #define R_MIPS_HIGHEST 29 #define R_MIPS_CALL_HI16 30 #define R_MIPS_CALL_LO16 31 #define R_MIPS_SCN_DISP 32 #define R_MIPS_REL16 33 #define R_MIPS_ADD_IMMEDIATE 34 #define R_MIPS_PJUMP 35 #define R_MIPS_RELGOT 36 #define R_MIPS_JALR 37 #define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ #define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ #define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ #define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ #define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ #define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ #define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ #define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ #define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ #define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ #define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ #define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ #define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ #define R_MIPS_GLOB_DAT 51 #define R_MIPS_COPY 126 #define R_MIPS_JUMP_SLOT 127 /* Keep this the last entry. */ #define R_MIPS_NUM 128 /* Legal values for p_type field of Elf32_Phdr. */ #define PT_MIPS_REGINFO 0x70000000 /* Register usage information. */ #define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ #define PT_MIPS_OPTIONS 0x70000002 #define PT_MIPS_ABIFLAGS 0x70000003 /* FP mode requirement. */ /* Special program header types. */ #define PF_MIPS_LOCAL 0x10000000 /* Legal values for d_tag field of Elf32_Dyn. */ #define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ #define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ #define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ #define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ #define DT_MIPS_FLAGS 0x70000005 /* Flags */ #define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ #define DT_MIPS_MSYM 0x70000007 #define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ #define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ #define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ #define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ #define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ #define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ #define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ #define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ #define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ #define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ #define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ #define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in DT_MIPS_DELTA_CLASS. */ #define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ #define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in DT_MIPS_DELTA_INSTANCE. */ #define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ #define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in DT_MIPS_DELTA_RELOC. */ #define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta relocations refer to. */ #define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in DT_MIPS_DELTA_SYM. */ #define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the class declaration. */ #define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in DT_MIPS_DELTA_CLASSSYM. */ #define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ #define DT_MIPS_PIXIE_INIT 0x70000023 #define DT_MIPS_SYMBOL_LIB 0x70000024 #define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 #define DT_MIPS_LOCAL_GOTIDX 0x70000026 #define DT_MIPS_HIDDEN_GOTIDX 0x70000027 #define DT_MIPS_PROTECTED_GOTIDX 0x70000028 #define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ #define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ #define DT_MIPS_DYNSTR_ALIGN 0x7000002b #define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ #define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve function stored in GOT. */ #define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added by rld on dlopen() calls. */ #define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ #define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ #define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ /* The address of .got.plt in an executable using the new non-PIC ABI. */ #define DT_MIPS_PLTGOT 0x70000032 /* The base of the PLT in an executable using the new non-PIC ABI if that PLT is writable. For a non-writable PLT, this is omitted or has a zero value. */ #define DT_MIPS_RWPLT 0x70000034 /* An alternative description of the classic MIPS RLD_MAP that is usable in a PIE as it stores a relative offset from the address of the tag rather than an absolute address. */ #define DT_MIPS_RLD_MAP_REL 0x70000035 /* GNU-style hash table with xlat. */ #define DT_MIPS_XHASH 0x70000036 #define DT_MIPS_NUM 0x37 /* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ #define RHF_NONE 0 /* No flags */ #define RHF_QUICKSTART (1 << 0) /* Use quickstart */ #define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ #define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ #define RHF_NO_MOVE (1 << 3) #define RHF_SGI_ONLY (1 << 4) #define RHF_GUARANTEE_INIT (1 << 5) #define RHF_DELTA_C_PLUS_PLUS (1 << 6) #define RHF_GUARANTEE_START_INIT (1 << 7) #define RHF_PIXIE (1 << 8) #define RHF_DEFAULT_DELAY_LOAD (1 << 9) #define RHF_REQUICKSTART (1 << 10) #define RHF_REQUICKSTARTED (1 << 11) #define RHF_CORD (1 << 12) #define RHF_NO_UNRES_UNDEF (1 << 13) #define RHF_RLD_ORDER_SAFE (1 << 14) /* Entries found in sections of type SHT_MIPS_LIBLIST. */ typedef struct { Elf32_Word l_name; /* Name (string table index) */ Elf32_Word l_time_stamp; /* Timestamp */ Elf32_Word l_checksum; /* Checksum */ Elf32_Word l_version; /* Interface version */ Elf32_Word l_flags; /* Flags */ } Elf32_Lib; typedef struct { Elf64_Word l_name; /* Name (string table index) */ Elf64_Word l_time_stamp; /* Timestamp */ Elf64_Word l_checksum; /* Checksum */ Elf64_Word l_version; /* Interface version */ Elf64_Word l_flags; /* Flags */ } Elf64_Lib; /* Legal values for l_flags. */ #define LL_NONE 0 #define LL_EXACT_MATCH (1 << 0) /* Require exact match */ #define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ #define LL_REQUIRE_MINOR (1 << 2) #define LL_EXPORTS (1 << 3) #define LL_DELAY_LOAD (1 << 4) #define LL_DELTA (1 << 5) /* Entries found in sections of type SHT_MIPS_CONFLICT. */ typedef Elf32_Addr Elf32_Conflict; typedef struct { /* Version of flags structure. */ Elf32_Half version; /* The level of the ISA: 1-5, 32, 64. */ unsigned char isa_level; /* The revision of ISA: 0 for MIPS V and below, 1-n otherwise. */ unsigned char isa_rev; /* The size of general purpose registers. */ unsigned char gpr_size; /* The size of co-processor 1 registers. */ unsigned char cpr1_size; /* The size of co-processor 2 registers. */ unsigned char cpr2_size; /* The floating-point ABI. */ unsigned char fp_abi; /* Processor-specific extension. */ Elf32_Word isa_ext; /* Mask of ASEs used. */ Elf32_Word ases; /* Mask of general flags. */ Elf32_Word flags1; Elf32_Word flags2; } Elf_MIPS_ABIFlags_v0; /* Values for the register size bytes of an abi flags structure. */ #define MIPS_AFL_REG_NONE 0x00 /* No registers. */ #define MIPS_AFL_REG_32 0x01 /* 32-bit registers. */ #define MIPS_AFL_REG_64 0x02 /* 64-bit registers. */ #define MIPS_AFL_REG_128 0x03 /* 128-bit registers. */ /* Masks for the ases word of an ABI flags structure. */ #define MIPS_AFL_ASE_DSP 0x00000001 /* DSP ASE. */ #define MIPS_AFL_ASE_DSPR2 0x00000002 /* DSP R2 ASE. */ #define MIPS_AFL_ASE_EVA 0x00000004 /* Enhanced VA Scheme. */ #define MIPS_AFL_ASE_MCU 0x00000008 /* MCU (MicroController) ASE. */ #define MIPS_AFL_ASE_MDMX 0x00000010 /* MDMX ASE. */ #define MIPS_AFL_ASE_MIPS3D 0x00000020 /* MIPS-3D ASE. */ #define MIPS_AFL_ASE_MT 0x00000040 /* MT ASE. */ #define MIPS_AFL_ASE_SMARTMIPS 0x00000080 /* SmartMIPS ASE. */ #define MIPS_AFL_ASE_VIRT 0x00000100 /* VZ ASE. */ #define MIPS_AFL_ASE_MSA 0x00000200 /* MSA ASE. */ #define MIPS_AFL_ASE_MIPS16 0x00000400 /* MIPS16 ASE. */ #define MIPS_AFL_ASE_MICROMIPS 0x00000800 /* MICROMIPS ASE. */ #define MIPS_AFL_ASE_XPA 0x00001000 /* XPA ASE. */ #define MIPS_AFL_ASE_MASK 0x00001fff /* All ASEs. */ /* Values for the isa_ext word of an ABI flags structure. */ #define MIPS_AFL_EXT_XLR 1 /* RMI Xlr instruction. */ #define MIPS_AFL_EXT_OCTEON2 2 /* Cavium Networks Octeon2. */ #define MIPS_AFL_EXT_OCTEONP 3 /* Cavium Networks OcteonP. */ #define MIPS_AFL_EXT_LOONGSON_3A 4 /* Loongson 3A. */ #define MIPS_AFL_EXT_OCTEON 5 /* Cavium Networks Octeon. */ #define MIPS_AFL_EXT_5900 6 /* MIPS R5900 instruction. */ #define MIPS_AFL_EXT_4650 7 /* MIPS R4650 instruction. */ #define MIPS_AFL_EXT_4010 8 /* LSI R4010 instruction. */ #define MIPS_AFL_EXT_4100 9 /* NEC VR4100 instruction. */ #define MIPS_AFL_EXT_3900 10 /* Toshiba R3900 instruction. */ #define MIPS_AFL_EXT_10000 11 /* MIPS R10000 instruction. */ #define MIPS_AFL_EXT_SB1 12 /* Broadcom SB-1 instruction. */ #define MIPS_AFL_EXT_4111 13 /* NEC VR4111/VR4181 instruction. */ #define MIPS_AFL_EXT_4120 14 /* NEC VR4120 instruction. */ #define MIPS_AFL_EXT_5400 15 /* NEC VR5400 instruction. */ #define MIPS_AFL_EXT_5500 16 /* NEC VR5500 instruction. */ #define MIPS_AFL_EXT_LOONGSON_2E 17 /* ST Microelectronics Loongson 2E. */ #define MIPS_AFL_EXT_LOONGSON_2F 18 /* ST Microelectronics Loongson 2F. */ /* Masks for the flags1 word of an ABI flags structure. */ #define MIPS_AFL_FLAGS1_ODDSPREG 1 /* Uses odd single-precision registers. */ /* Object attribute values. */ enum { /* Not tagged or not using any ABIs affected by the differences. */ Val_GNU_MIPS_ABI_FP_ANY = 0, /* Using hard-float -mdouble-float. */ Val_GNU_MIPS_ABI_FP_DOUBLE = 1, /* Using hard-float -msingle-float. */ Val_GNU_MIPS_ABI_FP_SINGLE = 2, /* Using soft-float. */ Val_GNU_MIPS_ABI_FP_SOFT = 3, /* Using -mips32r2 -mfp64. */ Val_GNU_MIPS_ABI_FP_OLD_64 = 4, /* Using -mfpxx. */ Val_GNU_MIPS_ABI_FP_XX = 5, /* Using -mips32r2 -mfp64. */ Val_GNU_MIPS_ABI_FP_64 = 6, /* Using -mips32r2 -mfp64 -mno-odd-spreg. */ Val_GNU_MIPS_ABI_FP_64A = 7, /* Maximum allocated FP ABI value. */ Val_GNU_MIPS_ABI_FP_MAX = 7 }; /* HPPA specific definitions. */ /* Legal values for e_flags field of Elf32_Ehdr. */ #define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ #define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ #define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ #define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ #define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch prediction. */ #define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ #define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ /* Defined values for `e_flags & EF_PARISC_ARCH' are: */ #define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ #define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ #define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ /* Additional section indeces. */ #define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared symbols in ANSI C. */ #define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ /* Legal values for sh_type field of Elf32_Shdr. */ #define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ #define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ #define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ /* Legal values for sh_flags field of Elf32_Shdr. */ #define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ #define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ #define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ /* Legal values for ST_TYPE subfield of st_info (symbol type). */ #define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ #define STT_HP_OPAQUE (STT_LOOS + 0x1) #define STT_HP_STUB (STT_LOOS + 0x2) /* HPPA relocs. */ #define R_PARISC_NONE 0 /* No reloc. */ #define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ #define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ #define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ #define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ #define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ #define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ #define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ #define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ #define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ #define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ #define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ #define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ #define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ #define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ #define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ #define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ #define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ #define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ #define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ #define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ #define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ #define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ #define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ #define R_PARISC_FPTR64 64 /* 64 bits function address. */ #define R_PARISC_PLABEL32 65 /* 32 bits function address. */ #define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ #define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ #define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ #define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ #define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ #define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ #define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ #define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ #define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ #define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ #define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ #define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ #define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ #define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ #define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ #define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ #define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ #define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ #define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ #define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ #define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ #define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ #define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ #define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ #define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ #define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ #define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ #define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ #define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ #define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ #define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ #define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ #define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ #define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ #define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ #define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ #define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ #define R_PARISC_LORESERVE 128 #define R_PARISC_COPY 128 /* Copy relocation. */ #define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ #define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ #define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ #define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ #define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ #define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ #define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ #define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ #define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ #define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ #define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ #define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ #define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ #define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ #define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ #define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ #define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ #define R_PARISC_GNU_VTENTRY 232 #define R_PARISC_GNU_VTINHERIT 233 #define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ #define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ #define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ #define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ #define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ #define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ #define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ #define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ #define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ #define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ #define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ #define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ #define R_PARISC_TLS_LE21L R_PARISC_TPREL21L #define R_PARISC_TLS_LE14R R_PARISC_TPREL14R #define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L #define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R #define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 #define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 #define R_PARISC_HIRESERVE 255 /* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ #define PT_HP_TLS (PT_LOOS + 0x0) #define PT_HP_CORE_NONE (PT_LOOS + 0x1) #define PT_HP_CORE_VERSION (PT_LOOS + 0x2) #define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) #define PT_HP_CORE_COMM (PT_LOOS + 0x4) #define PT_HP_CORE_PROC (PT_LOOS + 0x5) #define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) #define PT_HP_CORE_STACK (PT_LOOS + 0x7) #define PT_HP_CORE_SHM (PT_LOOS + 0x8) #define PT_HP_CORE_MMF (PT_LOOS + 0x9) #define PT_HP_PARALLEL (PT_LOOS + 0x10) #define PT_HP_FASTBIND (PT_LOOS + 0x11) #define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) #define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) #define PT_HP_STACK (PT_LOOS + 0x14) #define PT_PARISC_ARCHEXT 0x70000000 #define PT_PARISC_UNWIND 0x70000001 /* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ #define PF_PARISC_SBP 0x08000000 #define PF_HP_PAGE_SIZE 0x00100000 #define PF_HP_FAR_SHARED 0x00200000 #define PF_HP_NEAR_SHARED 0x00400000 #define PF_HP_CODE 0x01000000 #define PF_HP_MODIFY 0x02000000 #define PF_HP_LAZYSWAP 0x04000000 #define PF_HP_SBP 0x08000000 /* Alpha specific definitions. */ /* Legal values for e_flags field of Elf64_Ehdr. */ #define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ #define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ /* Legal values for sh_type field of Elf64_Shdr. */ /* These two are primerily concerned with ECOFF debugging info. */ #define SHT_ALPHA_DEBUG 0x70000001 #define SHT_ALPHA_REGINFO 0x70000002 /* Legal values for sh_flags field of Elf64_Shdr. */ #define SHF_ALPHA_GPREL 0x10000000 /* Legal values for st_other field of Elf64_Sym. */ #define STO_ALPHA_NOPV 0x80 /* No PV required. */ #define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ /* Alpha relocs. */ #define R_ALPHA_NONE 0 /* No reloc */ #define R_ALPHA_REFLONG 1 /* Direct 32 bit */ #define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ #define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ #define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ #define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ #define R_ALPHA_GPDISP 6 /* Add displacement to GP */ #define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ #define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ #define R_ALPHA_SREL16 9 /* PC relative 16 bit */ #define R_ALPHA_SREL32 10 /* PC relative 32 bit */ #define R_ALPHA_SREL64 11 /* PC relative 64 bit */ #define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ #define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ #define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ #define R_ALPHA_COPY 24 /* Copy symbol at runtime */ #define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ #define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ #define R_ALPHA_RELATIVE 27 /* Adjust by program base */ #define R_ALPHA_TLS_GD_HI 28 #define R_ALPHA_TLSGD 29 #define R_ALPHA_TLS_LDM 30 #define R_ALPHA_DTPMOD64 31 #define R_ALPHA_GOTDTPREL 32 #define R_ALPHA_DTPREL64 33 #define R_ALPHA_DTPRELHI 34 #define R_ALPHA_DTPRELLO 35 #define R_ALPHA_DTPREL16 36 #define R_ALPHA_GOTTPREL 37 #define R_ALPHA_TPREL64 38 #define R_ALPHA_TPRELHI 39 #define R_ALPHA_TPRELLO 40 #define R_ALPHA_TPREL16 41 /* Keep this the last entry. */ #define R_ALPHA_NUM 46 /* Magic values of the LITUSE relocation addend. */ #define LITUSE_ALPHA_ADDR 0 #define LITUSE_ALPHA_BASE 1 #define LITUSE_ALPHA_BYTOFF 2 #define LITUSE_ALPHA_JSR 3 #define LITUSE_ALPHA_TLS_GD 4 #define LITUSE_ALPHA_TLS_LDM 5 /* Legal values for d_tag of Elf64_Dyn. */ #define DT_ALPHA_PLTRO (DT_LOPROC + 0) #define DT_ALPHA_NUM 1 /* PowerPC specific declarations */ /* Values for Elf32/64_Ehdr.e_flags. */ #define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ /* Cygnus local bits below */ #define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ #define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib flag */ /* PowerPC relocations defined by the ABIs */ #define R_PPC_NONE 0 #define R_PPC_ADDR32 1 /* 32bit absolute address */ #define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ #define R_PPC_ADDR16 3 /* 16bit absolute address */ #define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ #define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ #define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ #define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ #define R_PPC_ADDR14_BRTAKEN 8 #define R_PPC_ADDR14_BRNTAKEN 9 #define R_PPC_REL24 10 /* PC relative 26 bit */ #define R_PPC_REL14 11 /* PC relative 16 bit */ #define R_PPC_REL14_BRTAKEN 12 #define R_PPC_REL14_BRNTAKEN 13 #define R_PPC_GOT16 14 #define R_PPC_GOT16_LO 15 #define R_PPC_GOT16_HI 16 #define R_PPC_GOT16_HA 17 #define R_PPC_PLTREL24 18 #define R_PPC_COPY 19 #define R_PPC_GLOB_DAT 20 #define R_PPC_JMP_SLOT 21 #define R_PPC_RELATIVE 22 #define R_PPC_LOCAL24PC 23 #define R_PPC_UADDR32 24 #define R_PPC_UADDR16 25 #define R_PPC_REL32 26 #define R_PPC_PLT32 27 #define R_PPC_PLTREL32 28 #define R_PPC_PLT16_LO 29 #define R_PPC_PLT16_HI 30 #define R_PPC_PLT16_HA 31 #define R_PPC_SDAREL16 32 #define R_PPC_SECTOFF 33 #define R_PPC_SECTOFF_LO 34 #define R_PPC_SECTOFF_HI 35 #define R_PPC_SECTOFF_HA 36 /* PowerPC relocations defined for the TLS access ABI. */ #define R_PPC_TLS 67 /* none (sym+add)@tls */ #define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ #define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ #define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ #define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ #define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ #define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ #define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ #define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ #define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ #define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ #define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ #define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ #define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ #define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ #define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ #define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ #define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ #define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ #define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ #define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ #define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ #define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ #define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ #define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ #define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ #define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ #define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ #define R_PPC_TLSGD 95 /* none (sym+add)@tlsgd */ #define R_PPC_TLSLD 96 /* none (sym+add)@tlsld */ /* The remaining relocs are from the Embedded ELF ABI, and are not in the SVR4 ELF ABI. */ #define R_PPC_EMB_NADDR32 101 #define R_PPC_EMB_NADDR16 102 #define R_PPC_EMB_NADDR16_LO 103 #define R_PPC_EMB_NADDR16_HI 104 #define R_PPC_EMB_NADDR16_HA 105 #define R_PPC_EMB_SDAI16 106 #define R_PPC_EMB_SDA2I16 107 #define R_PPC_EMB_SDA2REL 108 #define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ #define R_PPC_EMB_MRKREF 110 #define R_PPC_EMB_RELSEC16 111 #define R_PPC_EMB_RELST_LO 112 #define R_PPC_EMB_RELST_HI 113 #define R_PPC_EMB_RELST_HA 114 #define R_PPC_EMB_BIT_FLD 115 #define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ /* Diab tool relocations. */ #define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ #define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ #define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ #define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ #define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ #define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ /* GNU extension to support local ifunc. */ #define R_PPC_IRELATIVE 248 /* GNU relocs used in PIC code sequences. */ #define R_PPC_REL16 249 /* half16 (sym+add-.) */ #define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ #define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ #define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ /* This is a phony reloc to handle any old fashioned TOC16 references that may still be in object files. */ #define R_PPC_TOC16 255 /* PowerPC specific values for the Dyn d_tag field. */ #define DT_PPC_GOT (DT_LOPROC + 0) #define DT_PPC_OPT (DT_LOPROC + 1) #define DT_PPC_NUM 2 /* PowerPC specific values for the DT_PPC_OPT Dyn entry. */ #define PPC_OPT_TLS 1 /* PowerPC64 relocations defined by the ABIs */ #define R_PPC64_NONE R_PPC_NONE #define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ #define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ #define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ #define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ #define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ #define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ #define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ #define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN #define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN #define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ #define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ #define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN #define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN #define R_PPC64_GOT16 R_PPC_GOT16 #define R_PPC64_GOT16_LO R_PPC_GOT16_LO #define R_PPC64_GOT16_HI R_PPC_GOT16_HI #define R_PPC64_GOT16_HA R_PPC_GOT16_HA #define R_PPC64_COPY R_PPC_COPY #define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT #define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT #define R_PPC64_RELATIVE R_PPC_RELATIVE #define R_PPC64_UADDR32 R_PPC_UADDR32 #define R_PPC64_UADDR16 R_PPC_UADDR16 #define R_PPC64_REL32 R_PPC_REL32 #define R_PPC64_PLT32 R_PPC_PLT32 #define R_PPC64_PLTREL32 R_PPC_PLTREL32 #define R_PPC64_PLT16_LO R_PPC_PLT16_LO #define R_PPC64_PLT16_HI R_PPC_PLT16_HI #define R_PPC64_PLT16_HA R_PPC_PLT16_HA #define R_PPC64_SECTOFF R_PPC_SECTOFF #define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO #define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI #define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA #define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ #define R_PPC64_ADDR64 38 /* doubleword64 S + A */ #define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ #define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ #define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ #define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ #define R_PPC64_UADDR64 43 /* doubleword64 S + A */ #define R_PPC64_REL64 44 /* doubleword64 S + A - P */ #define R_PPC64_PLT64 45 /* doubleword64 L + A */ #define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ #define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ #define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ #define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ #define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ #define R_PPC64_TOC 51 /* doubleword64 .TOC */ #define R_PPC64_PLTGOT16 52 /* half16* M + A */ #define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ #define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ #define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ #define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ #define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ #define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ #define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ #define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ #define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ #define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ #define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ #define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ #define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ #define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ /* PowerPC64 relocations defined for the TLS access ABI. */ #define R_PPC64_TLS 67 /* none (sym+add)@tls */ #define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ #define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ #define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ #define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ #define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ #define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ #define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ #define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ #define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ #define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ #define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ #define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ #define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ #define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ #define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ #define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ #define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ #define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ #define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ #define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ #define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ #define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ #define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ #define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ #define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ #define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ #define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ #define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ #define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ #define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ #define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ #define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ #define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ #define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ #define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ #define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ #define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ #define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ #define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ #define R_PPC64_TLSGD 107 /* none (sym+add)@tlsgd */ #define R_PPC64_TLSLD 108 /* none (sym+add)@tlsld */ #define R_PPC64_TOCSAVE 109 /* none */ /* Added when HA and HI relocs were changed to report overflows. */ #define R_PPC64_ADDR16_HIGH 110 #define R_PPC64_ADDR16_HIGHA 111 #define R_PPC64_TPREL16_HIGH 112 #define R_PPC64_TPREL16_HIGHA 113 #define R_PPC64_DTPREL16_HIGH 114 #define R_PPC64_DTPREL16_HIGHA 115 /* GNU extension to support local ifunc. */ #define R_PPC64_JMP_IREL 247 #define R_PPC64_IRELATIVE 248 #define R_PPC64_REL16 249 /* half16 (sym+add-.) */ #define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ #define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ #define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ /* e_flags bits specifying ABI. 1 for original function descriptor using ABI, 2 for revised ABI without function descriptors, 0 for unspecified or not using any features affected by the differences. */ #define EF_PPC64_ABI 3 /* PowerPC64 specific values for the Dyn d_tag field. */ #define DT_PPC64_GLINK (DT_LOPROC + 0) #define DT_PPC64_OPD (DT_LOPROC + 1) #define DT_PPC64_OPDSZ (DT_LOPROC + 2) #define DT_PPC64_OPT (DT_LOPROC + 3) #define DT_PPC64_NUM 4 /* PowerPC64 specific bits in the DT_PPC64_OPT Dyn entry. */ #define PPC64_OPT_TLS 1 #define PPC64_OPT_MULTI_TOC 2 #define PPC64_OPT_LOCALENTRY 4 /* PowerPC64 specific values for the Elf64_Sym st_other field. */ #define STO_PPC64_LOCAL_BIT 5 #define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT) #define PPC64_LOCAL_ENTRY_OFFSET(other) \ (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2) /* ARM specific declarations */ /* Processor specific flags for the ELF header e_flags field. */ #define EF_ARM_RELEXEC 0x01 #define EF_ARM_HASENTRY 0x02 #define EF_ARM_INTERWORK 0x04 #define EF_ARM_APCS_26 0x08 #define EF_ARM_APCS_FLOAT 0x10 #define EF_ARM_PIC 0x20 #define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ #define EF_ARM_NEW_ABI 0x80 #define EF_ARM_OLD_ABI 0x100 #define EF_ARM_SOFT_FLOAT 0x200 #define EF_ARM_VFP_FLOAT 0x400 #define EF_ARM_MAVERICK_FLOAT 0x800 #define EF_ARM_ABI_FLOAT_SOFT 0x200 /* NB conflicts with EF_ARM_SOFT_FLOAT */ #define EF_ARM_ABI_FLOAT_HARD 0x400 /* NB conflicts with EF_ARM_VFP_FLOAT */ /* Other constants defined in the ARM ELF spec. version B-01. */ /* NB. These conflict with values defined above. */ #define EF_ARM_SYMSARESORTED 0x04 #define EF_ARM_DYNSYMSUSESEGIDX 0x08 #define EF_ARM_MAPSYMSFIRST 0x10 #define EF_ARM_EABIMASK 0XFF000000 /* Constants defined in AAELF. */ #define EF_ARM_BE8 0x00800000 #define EF_ARM_LE8 0x00400000 #define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) #define EF_ARM_EABI_UNKNOWN 0x00000000 #define EF_ARM_EABI_VER1 0x01000000 #define EF_ARM_EABI_VER2 0x02000000 #define EF_ARM_EABI_VER3 0x03000000 #define EF_ARM_EABI_VER4 0x04000000 #define EF_ARM_EABI_VER5 0x05000000 /* Additional symbol types for Thumb. */ #define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ #define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ /* ARM-specific values for sh_flags */ #define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ #define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */ /* ARM-specific program header flags */ #define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */ #define PF_ARM_PI 0x20000000 /* Position-independent segment. */ #define PF_ARM_ABS 0x40000000 /* Absolute segment. */ /* Processor specific values for the Phdr p_type field. */ #define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ /* Processor specific values for the Shdr sh_type field. */ #define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ #define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ #define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ /* AArch64 relocs. */ #define R_AARCH64_NONE 0 /* No relocation. */ /* ILP32 AArch64 relocs. */ #define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */ #define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */ #define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */ #define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */ #define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */ #define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */ #define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */ #define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */ #define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */ #define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */ /* LP64 AArch64 relocs. */ #define R_AARCH64_ABS64 257 /* Direct 64 bit. */ #define R_AARCH64_ABS32 258 /* Direct 32 bit. */ #define R_AARCH64_ABS16 259 /* Direct 16-bit. */ #define R_AARCH64_PREL64 260 /* PC-relative 64-bit. */ #define R_AARCH64_PREL32 261 /* PC-relative 32-bit. */ #define R_AARCH64_PREL16 262 /* PC-relative 16-bit. */ #define R_AARCH64_MOVW_UABS_G0 263 /* Dir. MOVZ imm. from bits 15:0. */ #define R_AARCH64_MOVW_UABS_G0_NC 264 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_UABS_G1 265 /* Dir. MOVZ imm. from bits 31:16. */ #define R_AARCH64_MOVW_UABS_G1_NC 266 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_UABS_G2 267 /* Dir. MOVZ imm. from bits 47:32. */ #define R_AARCH64_MOVW_UABS_G2_NC 268 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_UABS_G3 269 /* Dir. MOV{K,Z} imm. from 63:48. */ #define R_AARCH64_MOVW_SABS_G0 270 /* Dir. MOV{N,Z} imm. from 15:0. */ #define R_AARCH64_MOVW_SABS_G1 271 /* Dir. MOV{N,Z} imm. from 31:16. */ #define R_AARCH64_MOVW_SABS_G2 272 /* Dir. MOV{N,Z} imm. from 47:32. */ #define R_AARCH64_LD_PREL_LO19 273 /* PC-rel. LD imm. from bits 20:2. */ #define R_AARCH64_ADR_PREL_LO21 274 /* PC-rel. ADR imm. from bits 20:0. */ #define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page-rel. ADRP imm. from 32:12. */ #define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Likewise; no overflow check. */ #define R_AARCH64_ADD_ABS_LO12_NC 277 /* Dir. ADD imm. from bits 11:0. */ #define R_AARCH64_LDST8_ABS_LO12_NC 278 /* Likewise for LD/ST; no check. */ #define R_AARCH64_TSTBR14 279 /* PC-rel. TBZ/TBNZ imm. from 15:2. */ #define R_AARCH64_CONDBR19 280 /* PC-rel. cond. br. imm. from 20:2. */ #define R_AARCH64_JUMP26 282 /* PC-rel. B imm. from bits 27:2. */ #define R_AARCH64_CALL26 283 /* Likewise for CALL. */ #define R_AARCH64_LDST16_ABS_LO12_NC 284 /* Dir. ADD imm. from bits 11:1. */ #define R_AARCH64_LDST32_ABS_LO12_NC 285 /* Likewise for bits 11:2. */ #define R_AARCH64_LDST64_ABS_LO12_NC 286 /* Likewise for bits 11:3. */ #define R_AARCH64_MOVW_PREL_G0 287 /* PC-rel. MOV{N,Z} imm. from 15:0. */ #define R_AARCH64_MOVW_PREL_G0_NC 288 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_PREL_G1 289 /* PC-rel. MOV{N,Z} imm. from 31:16. */ #define R_AARCH64_MOVW_PREL_G1_NC 290 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_PREL_G2 291 /* PC-rel. MOV{N,Z} imm. from 47:32. */ #define R_AARCH64_MOVW_PREL_G2_NC 292 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_PREL_G3 293 /* PC-rel. MOV{N,Z} imm. from 63:48. */ #define R_AARCH64_LDST128_ABS_LO12_NC 299 /* Dir. ADD imm. from bits 11:4. */ #define R_AARCH64_MOVW_GOTOFF_G0 300 /* GOT-rel. off. MOV{N,Z} imm. 15:0. */ #define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_GOTOFF_G1 302 /* GOT-rel. o. MOV{N,Z} imm. 31:16. */ #define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_GOTOFF_G2 304 /* GOT-rel. o. MOV{N,Z} imm. 47:32. */ #define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* Likewise for MOVK; no check. */ #define R_AARCH64_MOVW_GOTOFF_G3 306 /* GOT-rel. o. MOV{N,Z} imm. 63:48. */ #define R_AARCH64_GOTREL64 307 /* GOT-relative 64-bit. */ #define R_AARCH64_GOTREL32 308 /* GOT-relative 32-bit. */ #define R_AARCH64_GOT_LD_PREL19 309 /* PC-rel. GOT off. load imm. 20:2. */ #define R_AARCH64_LD64_GOTOFF_LO15 310 /* GOT-rel. off. LD/ST imm. 14:3. */ #define R_AARCH64_ADR_GOT_PAGE 311 /* P-page-rel. GOT off. ADRP 32:12. */ #define R_AARCH64_LD64_GOT_LO12_NC 312 /* Dir. GOT off. LD/ST imm. 11:3. */ #define R_AARCH64_LD64_GOTPAGE_LO15 313 /* GOT-page-rel. GOT off. LD/ST 14:3 */ #define R_AARCH64_TLSGD_ADR_PREL21 512 /* PC-relative ADR imm. 20:0. */ #define R_AARCH64_TLSGD_ADR_PAGE21 513 /* page-rel. ADRP imm. 32:12. */ #define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* direct ADD imm. from 11:0. */ #define R_AARCH64_TLSGD_MOVW_G1 515 /* GOT-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* GOT-rel. MOVK imm. 15:0. */ #define R_AARCH64_TLSLD_ADR_PREL21 517 /* Like 512; local dynamic model. */ #define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Like 513; local dynamic model. */ #define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* Like 514; local dynamic model. */ #define R_AARCH64_TLSLD_MOVW_G1 520 /* Like 515; local dynamic model. */ #define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* Like 516; local dynamic model. */ #define R_AARCH64_TLSLD_LD_PREL19 522 /* TLS PC-rel. load imm. 20:2. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* TLS DTP-rel. MOV{N,Z} 47:32. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* TLS DTP-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* TLS DTP-rel. MOV{N,Z} 15:0. */ #define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTP-rel. ADD imm. from 23:12. */ #define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTP-rel. ADD imm. from 11:0. */ #define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* Likewise; no ovfl. check. */ #define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTP-rel. LD/ST imm. 11:0. */ #define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTP-rel. LD/ST imm. 11:1. */ #define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTP-rel. LD/ST imm. 11:2. */ #define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTP-rel. LD/ST imm. 11:3. */ #define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* Likewise; no check. */ #define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* GOT-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* GOT-rel. MOVK 15:0. */ #define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page-rel. ADRP 32:12. */ #define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* Direct LD off. 11:3. */ #define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* PC-rel. load imm. 20:2. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TLS TP-rel. MOV{N,Z} 47:32. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TLS TP-rel. MOV{N,Z} 31:16. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TLS TP-rel. MOV{N,Z} 15:0. */ #define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* Likewise; MOVK; no check. */ #define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TP-rel. ADD imm. 23:12. */ #define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TP-rel. ADD imm. 11:0. */ #define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* Likewise; no ovfl. check. */ #define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TP-rel. LD/ST off. 11:0. */ #define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* Likewise; no ovfl. check. */ #define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TP-rel. LD/ST off. 11:1. */ #define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* Likewise; no check. */ #define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TP-rel. LD/ST off. 11:2. */ #define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* Likewise; no check. */ #define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TP-rel. LD/ST off. 11:3. */ #define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* Likewise; no check. */ #define R_AARCH64_TLSDESC_LD_PREL19 560 /* PC-rel. load immediate 20:2. */ #define R_AARCH64_TLSDESC_ADR_PREL21 561 /* PC-rel. ADR immediate 20:0. */ #define R_AARCH64_TLSDESC_ADR_PAGE21 562 /* Page-rel. ADRP imm. 32:12. */ #define R_AARCH64_TLSDESC_LD64_LO12 563 /* Direct LD off. from 11:3. */ #define R_AARCH64_TLSDESC_ADD_LO12 564 /* Direct ADD imm. from 11:0. */ #define R_AARCH64_TLSDESC_OFF_G1 565 /* GOT-rel. MOV{N,Z} imm. 31:16. */ #define R_AARCH64_TLSDESC_OFF_G0_NC 566 /* GOT-rel. MOVK imm. 15:0; no ck. */ #define R_AARCH64_TLSDESC_LDR 567 /* Relax LDR. */ #define R_AARCH64_TLSDESC_ADD 568 /* Relax ADD. */ #define R_AARCH64_TLSDESC_CALL 569 /* Relax BLR. */ #define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TP-rel. LD/ST off. 11:4. */ #define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* Likewise; no check. */ #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTP-rel. LD/ST imm. 11:4. */ #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 /* Likewise; no check. */ #define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */ #define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */ #define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */ #define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */ #define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */ #define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */ #define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */ #define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */ #define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */ /* AArch64 specific values for the Dyn d_tag field. */ #define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5) #define DT_AARCH64_NUM 6 /* AArch64 specific values for the st_other field. */ #define STO_AARCH64_VARIANT_PCS 0x80 /* ARM relocs. */ #define R_ARM_NONE 0 /* No reloc */ #define R_ARM_PC24 1 /* Deprecated PC relative 26 bit branch. */ #define R_ARM_ABS32 2 /* Direct 32 bit */ #define R_ARM_REL32 3 /* PC relative 32 bit */ #define R_ARM_PC13 4 #define R_ARM_ABS16 5 /* Direct 16 bit */ #define R_ARM_ABS12 6 /* Direct 12 bit */ #define R_ARM_THM_ABS5 7 /* Direct & 0x7C (LDR, STR). */ #define R_ARM_ABS8 8 /* Direct 8 bit */ #define R_ARM_SBREL32 9 #define R_ARM_THM_PC22 10 /* PC relative 24 bit (Thumb32 BL). */ #define R_ARM_THM_PC8 11 /* PC relative & 0x3FC (Thumb16 LDR, ADD, ADR). */ #define R_ARM_AMP_VCALL9 12 #define R_ARM_SWI24 13 /* Obsolete static relocation. */ #define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ #define R_ARM_THM_SWI8 14 /* Reserved. */ #define R_ARM_XPC25 15 /* Reserved. */ #define R_ARM_THM_XPC22 16 /* Reserved. */ #define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ #define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ #define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ #define R_ARM_COPY 20 /* Copy symbol at runtime */ #define R_ARM_GLOB_DAT 21 /* Create GOT entry */ #define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ #define R_ARM_RELATIVE 23 /* Adjust by program base */ #define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ #define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ #define R_ARM_GOT32 26 /* 32 bit GOT entry */ #define R_ARM_PLT32 27 /* Deprecated, 32 bit PLT address. */ #define R_ARM_CALL 28 /* PC relative 24 bit (BL, BLX). */ #define R_ARM_JUMP24 29 /* PC relative 24 bit (B, BL<cond>). */ #define R_ARM_THM_JUMP24 30 /* PC relative 24 bit (Thumb32 B.W). */ #define R_ARM_BASE_ABS 31 /* Adjust by program base. */ #define R_ARM_ALU_PCREL_7_0 32 /* Obsolete. */ #define R_ARM_ALU_PCREL_15_8 33 /* Obsolete. */ #define R_ARM_ALU_PCREL_23_15 34 /* Obsolete. */ #define R_ARM_LDR_SBREL_11_0 35 /* Deprecated, prog. base relative. */ #define R_ARM_ALU_SBREL_19_12 36 /* Deprecated, prog. base relative. */ #define R_ARM_ALU_SBREL_27_20 37 /* Deprecated, prog. base relative. */ #define R_ARM_TARGET1 38 #define R_ARM_SBREL31 39 /* Program base relative. */ #define R_ARM_V4BX 40 #define R_ARM_TARGET2 41 #define R_ARM_PREL31 42 /* 32 bit PC relative. */ #define R_ARM_MOVW_ABS_NC 43 /* Direct 16-bit (MOVW). */ #define R_ARM_MOVT_ABS 44 /* Direct high 16-bit (MOVT). */ #define R_ARM_MOVW_PREL_NC 45 /* PC relative 16-bit (MOVW). */ #define R_ARM_MOVT_PREL 46 /* PC relative (MOVT). */ #define R_ARM_THM_MOVW_ABS_NC 47 /* Direct 16 bit (Thumb32 MOVW). */ #define R_ARM_THM_MOVT_ABS 48 /* Direct high 16 bit (Thumb32 MOVT). */ #define R_ARM_THM_MOVW_PREL_NC 49 /* PC relative 16 bit (Thumb32 MOVW). */ #define R_ARM_THM_MOVT_PREL 50 /* PC relative high 16 bit (Thumb32 MOVT). */ #define R_ARM_THM_JUMP19 51 /* PC relative 20 bit (Thumb32 B<cond>.W). */ #define R_ARM_THM_JUMP6 52 /* PC relative X & 0x7E (Thumb16 CBZ, CBNZ). */ #define R_ARM_THM_ALU_PREL_11_0 53 /* PC relative 12 bit (Thumb32 ADR.W). */ #define R_ARM_THM_PC12 54 /* PC relative 12 bit (Thumb32 LDR{D,SB,H,SH}). */ #define R_ARM_ABS32_NOI 55 /* Direct 32-bit. */ #define R_ARM_REL32_NOI 56 /* PC relative 32-bit. */ #define R_ARM_ALU_PC_G0_NC 57 /* PC relative (ADD, SUB). */ #define R_ARM_ALU_PC_G0 58 /* PC relative (ADD, SUB). */ #define R_ARM_ALU_PC_G1_NC 59 /* PC relative (ADD, SUB). */ #define R_ARM_ALU_PC_G1 60 /* PC relative (ADD, SUB). */ #define R_ARM_ALU_PC_G2 61 /* PC relative (ADD, SUB). */ #define R_ARM_LDR_PC_G1 62 /* PC relative (LDR,STR,LDRB,STRB). */ #define R_ARM_LDR_PC_G2 63 /* PC relative (LDR,STR,LDRB,STRB). */ #define R_ARM_LDRS_PC_G0 64 /* PC relative (STR{D,H}, LDR{D,SB,H,SH}). */ #define R_ARM_LDRS_PC_G1 65 /* PC relative (STR{D,H}, LDR{D,SB,H,SH}). */ #define R_ARM_LDRS_PC_G2 66 /* PC relative (STR{D,H}, LDR{D,SB,H,SH}). */ #define R_ARM_LDC_PC_G0 67 /* PC relative (LDC, STC). */ #define R_ARM_LDC_PC_G1 68 /* PC relative (LDC, STC). */ #define R_ARM_LDC_PC_G2 69 /* PC relative (LDC, STC). */ #define R_ARM_ALU_SB_G0_NC 70 /* Program base relative (ADD,SUB). */ #define R_ARM_ALU_SB_G0 71 /* Program base relative (ADD,SUB). */ #define R_ARM_ALU_SB_G1_NC 72 /* Program base relative (ADD,SUB). */ #define R_ARM_ALU_SB_G1 73 /* Program base relative (ADD,SUB). */ #define R_ARM_ALU_SB_G2 74 /* Program base relative (ADD,SUB). */ #define R_ARM_LDR_SB_G0 75 /* Program base relative (LDR, STR, LDRB, STRB). */ #define R_ARM_LDR_SB_G1 76 /* Program base relative (LDR, STR, LDRB, STRB). */ #define R_ARM_LDR_SB_G2 77 /* Program base relative (LDR, STR, LDRB, STRB). */ #define R_ARM_LDRS_SB_G0 78 /* Program base relative (LDR, STR, LDRB, STRB). */ #define R_ARM_LDRS_SB_G1 79 /* Program base relative (LDR, STR, LDRB, STRB). */ #define R_ARM_LDRS_SB_G2 80 /* Program base relative (LDR, STR, LDRB, STRB). */ #define R_ARM_LDC_SB_G0 81 /* Program base relative (LDC,STC). */ #define R_ARM_LDC_SB_G1 82 /* Program base relative (LDC,STC). */ #define R_ARM_LDC_SB_G2 83 /* Program base relative (LDC,STC). */ #define R_ARM_MOVW_BREL_NC 84 /* Program base relative 16 bit (MOVW). */ #define R_ARM_MOVT_BREL 85 /* Program base relative high 16 bit (MOVT). */ #define R_ARM_MOVW_BREL 86 /* Program base relative 16 bit (MOVW). */ #define R_ARM_THM_MOVW_BREL_NC 87 /* Program base relative 16 bit (Thumb32 MOVW). */ #define R_ARM_THM_MOVT_BREL 88 /* Program base relative high 16 bit (Thumb32 MOVT). */ #define R_ARM_THM_MOVW_BREL 89 /* Program base relative 16 bit (Thumb32 MOVW). */ #define R_ARM_TLS_GOTDESC 90 #define R_ARM_TLS_CALL 91 #define R_ARM_TLS_DESCSEQ 92 /* TLS relaxation. */ #define R_ARM_THM_TLS_CALL 93 #define R_ARM_PLT32_ABS 94 #define R_ARM_GOT_ABS 95 /* GOT entry. */ #define R_ARM_GOT_PREL 96 /* PC relative GOT entry. */ #define R_ARM_GOT_BREL12 97 /* GOT entry relative to GOT origin (LDR). */ #define R_ARM_GOTOFF12 98 /* 12 bit, GOT entry relative to GOT origin (LDR, STR). */ #define R_ARM_GOTRELAX 99 #define R_ARM_GNU_VTENTRY 100 #define R_ARM_GNU_VTINHERIT 101 #define R_ARM_THM_PC11 102 /* PC relative & 0xFFE (Thumb16 B). */ #define R_ARM_THM_PC9 103 /* PC relative & 0x1FE (Thumb16 B/B<cond>). */ #define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic thread local data */ #define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic thread local data */ #define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS block */ #define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of static TLS block offset */ #define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static TLS block */ #define R_ARM_TLS_LDO12 109 /* 12 bit relative to TLS block (LDR, STR). */ #define R_ARM_TLS_LE12 110 /* 12 bit relative to static TLS block (LDR, STR). */ #define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative to GOT origin (LDR). */ #define R_ARM_ME_TOO 128 /* Obsolete. */ #define R_ARM_THM_TLS_DESCSEQ 129 #define R_ARM_THM_TLS_DESCSEQ16 129 #define R_ARM_THM_TLS_DESCSEQ32 130 #define R_ARM_THM_GOT_BREL12 131 /* GOT entry relative to GOT origin, 12 bit (Thumb32 LDR). */ #define R_ARM_IRELATIVE 160 #define R_ARM_RXPC25 249 #define R_ARM_RSBREL32 250 #define R_ARM_THM_RPC22 251 #define R_ARM_RREL32 252 #define R_ARM_RABS22 253 #define R_ARM_RPC24 254 #define R_ARM_RBASE 255 /* Keep this the last entry. */ #define R_ARM_NUM 256 /* IA-64 specific declarations. */ /* Processor specific flags for the Ehdr e_flags field. */ #define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ #define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ #define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ /* Processor specific values for the Phdr p_type field. */ #define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ #define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ #define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) #define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) #define PT_IA_64_HP_STACK (PT_LOOS + 0x14) /* Processor specific flags for the Phdr p_flags field. */ #define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ /* Processor specific values for the Shdr sh_type field. */ #define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ #define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ /* Processor specific flags for the Shdr sh_flags field. */ #define SHF_IA_64_SHORT 0x10000000 /* section near gp */ #define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ /* Processor specific values for the Dyn d_tag field. */ #define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) #define DT_IA_64_NUM 1 /* IA-64 relocations. */ #define R_IA64_NONE 0x00 /* none */ #define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ #define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ #define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ #define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ #define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ #define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ #define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ #define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ #define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ #define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ #define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ #define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ #define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ #define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ #define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ #define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ #define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ #define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ #define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ #define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ #define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ #define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ #define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ #define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ #define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ #define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ #define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ #define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ #define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ #define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ #define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ #define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ #define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ #define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ #define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ #define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ #define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ #define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ #define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ #define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ #define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ #define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ #define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ #define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ #define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ #define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ #define R_IA64_REL32MSB 0x6c /* data 4 + REL */ #define R_IA64_REL32LSB 0x6d /* data 4 + REL */ #define R_IA64_REL64MSB 0x6e /* data 8 + REL */ #define R_IA64_REL64LSB 0x6f /* data 8 + REL */ #define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ #define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ #define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ #define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ #define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ #define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ #define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ #define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ #define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ #define R_IA64_COPY 0x84 /* copy relocation */ #define R_IA64_SUB 0x85 /* Addend and symbol difference */ #define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ #define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ #define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ #define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ #define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ #define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ #define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ #define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ #define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ #define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ #define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ #define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ #define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ #define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ #define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ #define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ #define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ #define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ #define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ /* SH specific declarations */ /* Processor specific flags for the ELF header e_flags field. */ #define EF_SH_MACH_MASK 0x1f #define EF_SH_UNKNOWN 0x0 #define EF_SH1 0x1 #define EF_SH2 0x2 #define EF_SH3 0x3 #define EF_SH_DSP 0x4 #define EF_SH3_DSP 0x5 #define EF_SH4AL_DSP 0x6 #define EF_SH3E 0x8 #define EF_SH4 0x9 #define EF_SH2E 0xb #define EF_SH4A 0xc #define EF_SH2A 0xd #define EF_SH4_NOFPU 0x10 #define EF_SH4A_NOFPU 0x11 #define EF_SH4_NOMMU_NOFPU 0x12 #define EF_SH2A_NOFPU 0x13 #define EF_SH3_NOMMU 0x14 #define EF_SH2A_SH4_NOFPU 0x15 #define EF_SH2A_SH3_NOFPU 0x16 #define EF_SH2A_SH4 0x17 #define EF_SH2A_SH3E 0x18 /* SH relocs. */ #define R_SH_NONE 0 #define R_SH_DIR32 1 #define R_SH_REL32 2 #define R_SH_DIR8WPN 3 #define R_SH_IND12W 4 #define R_SH_DIR8WPL 5 #define R_SH_DIR8WPZ 6 #define R_SH_DIR8BP 7 #define R_SH_DIR8W 8 #define R_SH_DIR8L 9 #define R_SH_SWITCH16 25 #define R_SH_SWITCH32 26 #define R_SH_USES 27 #define R_SH_COUNT 28 #define R_SH_ALIGN 29 #define R_SH_CODE 30 #define R_SH_DATA 31 #define R_SH_LABEL 32 #define R_SH_SWITCH8 33 #define R_SH_GNU_VTINHERIT 34 #define R_SH_GNU_VTENTRY 35 #define R_SH_TLS_GD_32 144 #define R_SH_TLS_LD_32 145 #define R_SH_TLS_LDO_32 146 #define R_SH_TLS_IE_32 147 #define R_SH_TLS_LE_32 148 #define R_SH_TLS_DTPMOD32 149 #define R_SH_TLS_DTPOFF32 150 #define R_SH_TLS_TPOFF32 151 #define R_SH_GOT32 160 #define R_SH_PLT32 161 #define R_SH_COPY 162 #define R_SH_GLOB_DAT 163 #define R_SH_JMP_SLOT 164 #define R_SH_RELATIVE 165 #define R_SH_GOTOFF 166 #define R_SH_GOTPC 167 /* Keep this the last entry. */ #define R_SH_NUM 256 /* S/390 specific definitions. */ /* Valid values for the e_flags field. */ #define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ /* Additional s390 relocs */ #define R_390_NONE 0 /* No reloc. */ #define R_390_8 1 /* Direct 8 bit. */ #define R_390_12 2 /* Direct 12 bit. */ #define R_390_16 3 /* Direct 16 bit. */ #define R_390_32 4 /* Direct 32 bit. */ #define R_390_PC32 5 /* PC relative 32 bit. */ #define R_390_GOT12 6 /* 12 bit GOT offset. */ #define R_390_GOT32 7 /* 32 bit GOT offset. */ #define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ #define R_390_COPY 9 /* Copy symbol at runtime. */ #define R_390_GLOB_DAT 10 /* Create GOT entry. */ #define R_390_JMP_SLOT 11 /* Create PLT entry. */ #define R_390_RELATIVE 12 /* Adjust by program base. */ #define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ #define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ #define R_390_GOT16 15 /* 16 bit GOT offset. */ #define R_390_PC16 16 /* PC relative 16 bit. */ #define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ #define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ #define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ #define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ #define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ #define R_390_64 22 /* Direct 64 bit. */ #define R_390_PC64 23 /* PC relative 64 bit. */ #define R_390_GOT64 24 /* 64 bit GOT offset. */ #define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ #define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ #define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ #define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ #define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ #define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ #define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ #define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ #define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ #define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ #define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ #define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ #define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ #define R_390_TLS_GDCALL 38 /* Tag for function call in general dynamic TLS code. */ #define R_390_TLS_LDCALL 39 /* Tag for function call in local dynamic TLS code. */ #define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic thread local data. */ #define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic thread local data. */ #define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS block offset. */ #define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS block offset. */ #define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS block offset. */ #define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic thread local data in LE code. */ #define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic thread local data in LE code. */ #define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for negated static TLS block offset. */ #define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for negated static TLS block offset. */ #define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for negated static TLS block offset. */ #define R_390_TLS_LE32 50 /* 32 bit negated offset relative to static TLS block. */ #define R_390_TLS_LE64 51 /* 64 bit negated offset relative to static TLS block. */ #define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS block. */ #define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS block. */ #define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ #define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ #define R_390_TLS_TPOFF 56 /* Negated offset in static TLS block. */ #define R_390_20 57 /* Direct 20 bit. */ #define R_390_GOT20 58 /* 20 bit GOT offset. */ #define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ #define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS block offset. */ #define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ /* Keep this the last entry. */ #define R_390_NUM 62 /* CRIS relocations. */ #define R_CRIS_NONE 0 #define R_CRIS_8 1 #define R_CRIS_16 2 #define R_CRIS_32 3 #define R_CRIS_8_PCREL 4 #define R_CRIS_16_PCREL 5 #define R_CRIS_32_PCREL 6 #define R_CRIS_GNU_VTINHERIT 7 #define R_CRIS_GNU_VTENTRY 8 #define R_CRIS_COPY 9 #define R_CRIS_GLOB_DAT 10 #define R_CRIS_JUMP_SLOT 11 #define R_CRIS_RELATIVE 12 #define R_CRIS_16_GOT 13 #define R_CRIS_32_GOT 14 #define R_CRIS_16_GOTPLT 15 #define R_CRIS_32_GOTPLT 16 #define R_CRIS_32_GOTREL 17 #define R_CRIS_32_PLT_GOTREL 18 #define R_CRIS_32_PLT_PCREL 19 #define R_CRIS_NUM 20 /* AMD x86-64 relocations. */ #define R_X86_64_NONE 0 /* No reloc */ #define R_X86_64_64 1 /* Direct 64 bit */ #define R_X86_64_PC32 2 /* PC relative 32 bit signed */ #define R_X86_64_GOT32 3 /* 32 bit GOT entry */ #define R_X86_64_PLT32 4 /* 32 bit PLT address */ #define R_X86_64_COPY 5 /* Copy symbol at runtime */ #define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ #define R_X86_64_RELATIVE 8 /* Adjust by program base */ #define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative offset to GOT */ #define R_X86_64_32 10 /* Direct 32 bit zero extended */ #define R_X86_64_32S 11 /* Direct 32 bit sign extended */ #define R_X86_64_16 12 /* Direct 16 bit zero extended */ #define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ #define R_X86_64_8 14 /* Direct 8 bit sign extended */ #define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ #define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ #define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ #define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ #define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset to two GOT entries for GD symbol */ #define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset to two GOT entries for LD symbol */ #define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ #define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset to GOT entry for IE symbol */ #define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ #define R_X86_64_PC64 24 /* PC relative 64 bit */ #define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ #define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative offset to GOT */ #define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ #define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset to GOT entry */ #define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ #define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ #define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset to PLT entry */ #define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ #define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ #define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ #define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS descriptor. */ #define R_X86_64_TLSDESC 36 /* TLS descriptor. */ #define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ #define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ /* 39 Reserved was R_X86_64_PC32_BND */ /* 40 Reserved was R_X86_64_PLT32_BND */ #define R_X86_64_GOTPCRELX 41 /* Load from 32 bit signed pc relative offset to GOT entry without REX prefix, relaxable. */ #define R_X86_64_REX_GOTPCRELX 42 /* Load from 32 bit signed pc relative offset to GOT entry with REX prefix, relaxable. */ #define R_X86_64_NUM 43 /* x86-64 sh_type values. */ #define SHT_X86_64_UNWIND 0x70000001 /* Unwind information. */ /* AM33 relocations. */ #define R_MN10300_NONE 0 /* No reloc. */ #define R_MN10300_32 1 /* Direct 32 bit. */ #define R_MN10300_16 2 /* Direct 16 bit. */ #define R_MN10300_8 3 /* Direct 8 bit. */ #define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ #define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ #define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ #define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ #define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ #define R_MN10300_24 9 /* Direct 24 bit. */ #define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ #define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ #define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ #define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ #define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ #define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ #define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ #define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ #define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ #define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ #define R_MN10300_COPY 20 /* Copy symbol at runtime. */ #define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ #define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ #define R_MN10300_RELATIVE 23 /* Adjust by program base. */ #define R_MN10300_TLS_GD 24 /* 32-bit offset for global dynamic. */ #define R_MN10300_TLS_LD 25 /* 32-bit offset for local dynamic. */ #define R_MN10300_TLS_LDO 26 /* Module-relative offset. */ #define R_MN10300_TLS_GOTIE 27 /* GOT offset for static TLS block offset. */ #define R_MN10300_TLS_IE 28 /* GOT address for static TLS block offset. */ #define R_MN10300_TLS_LE 29 /* Offset relative to static TLS block. */ #define R_MN10300_TLS_DTPMOD 30 /* ID of module containing symbol. */ #define R_MN10300_TLS_DTPOFF 31 /* Offset in module TLS block. */ #define R_MN10300_TLS_TPOFF 32 /* Offset in static TLS block. */ #define R_MN10300_SYM_DIFF 33 /* Adjustment for next reloc as needed by linker relaxation. */ #define R_MN10300_ALIGN 34 /* Alignment requirement for linker relaxation. */ #define R_MN10300_NUM 35 /* M32R relocs. */ #define R_M32R_NONE 0 /* No reloc. */ #define R_M32R_16 1 /* Direct 16 bit. */ #define R_M32R_32 2 /* Direct 32 bit. */ #define R_M32R_24 3 /* Direct 24 bit. */ #define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ #define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ #define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ #define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ #define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ #define R_M32R_LO16 9 /* Low 16 bit. */ #define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ #define R_M32R_GNU_VTINHERIT 11 #define R_M32R_GNU_VTENTRY 12 /* M32R relocs use SHT_RELA. */ #define R_M32R_16_RELA 33 /* Direct 16 bit. */ #define R_M32R_32_RELA 34 /* Direct 32 bit. */ #define R_M32R_24_RELA 35 /* Direct 24 bit. */ #define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ #define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ #define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ #define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ #define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ #define R_M32R_LO16_RELA 41 /* Low 16 bit */ #define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ #define R_M32R_RELA_GNU_VTINHERIT 43 #define R_M32R_RELA_GNU_VTENTRY 44 #define R_M32R_REL32 45 /* PC relative 32 bit. */ #define R_M32R_GOT24 48 /* 24 bit GOT entry */ #define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ #define R_M32R_COPY 50 /* Copy symbol at runtime */ #define R_M32R_GLOB_DAT 51 /* Create GOT entry */ #define R_M32R_JMP_SLOT 52 /* Create PLT entry */ #define R_M32R_RELATIVE 53 /* Adjust by program base */ #define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ #define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ #define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned low */ #define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed low */ #define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ #define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to GOT with unsigned low */ #define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to GOT with signed low */ #define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to GOT */ #define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT with unsigned low */ #define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT with signed low */ #define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ #define R_M32R_NUM 256 /* Keep this the last entry. */ /* MicroBlaze relocations */ #define R_MICROBLAZE_NONE 0 /* No reloc. */ #define R_MICROBLAZE_32 1 /* Direct 32 bit. */ #define R_MICROBLAZE_32_PCREL 2 /* PC relative 32 bit. */ #define R_MICROBLAZE_64_PCREL 3 /* PC relative 64 bit. */ #define R_MICROBLAZE_32_PCREL_LO 4 /* Low 16 bits of PCREL32. */ #define R_MICROBLAZE_64 5 /* Direct 64 bit. */ #define R_MICROBLAZE_32_LO 6 /* Low 16 bit. */ #define R_MICROBLAZE_SRO32 7 /* Read-only small data area. */ #define R_MICROBLAZE_SRW32 8 /* Read-write small data area. */ #define R_MICROBLAZE_64_NONE 9 /* No reloc. */ #define R_MICROBLAZE_32_SYM_OP_SYM 10 /* Symbol Op Symbol relocation. */ #define R_MICROBLAZE_GNU_VTINHERIT 11 /* GNU C++ vtable hierarchy. */ #define R_MICROBLAZE_GNU_VTENTRY 12 /* GNU C++ vtable member usage. */ #define R_MICROBLAZE_GOTPC_64 13 /* PC-relative GOT offset. */ #define R_MICROBLAZE_GOT_64 14 /* GOT entry offset. */ #define R_MICROBLAZE_PLT_64 15 /* PLT offset (PC-relative). */ #define R_MICROBLAZE_REL 16 /* Adjust by program base. */ #define R_MICROBLAZE_JUMP_SLOT 17 /* Create PLT entry. */ #define R_MICROBLAZE_GLOB_DAT 18 /* Create GOT entry. */ #define R_MICROBLAZE_GOTOFF_64 19 /* 64 bit offset to GOT. */ #define R_MICROBLAZE_GOTOFF_32 20 /* 32 bit offset to GOT. */ #define R_MICROBLAZE_COPY 21 /* Runtime copy. */ #define R_MICROBLAZE_TLS 22 /* TLS Reloc. */ #define R_MICROBLAZE_TLSGD 23 /* TLS General Dynamic. */ #define R_MICROBLAZE_TLSLD 24 /* TLS Local Dynamic. */ #define R_MICROBLAZE_TLSDTPMOD32 25 /* TLS Module ID. */ #define R_MICROBLAZE_TLSDTPREL32 26 /* TLS Offset Within TLS Block. */ #define R_MICROBLAZE_TLSDTPREL64 27 /* TLS Offset Within TLS Block. */ #define R_MICROBLAZE_TLSGOTTPREL32 28 /* TLS Offset From Thread Pointer. */ #define R_MICROBLAZE_TLSTPREL32 29 /* TLS Offset From Thread Pointer. */ /* Legal values for d_tag (dynamic entry type). */ #define DT_NIOS2_GP 0x70000002 /* Address of _gp. */ /* Nios II relocations. */ #define R_NIOS2_NONE 0 /* No reloc. */ #define R_NIOS2_S16 1 /* Direct signed 16 bit. */ #define R_NIOS2_U16 2 /* Direct unsigned 16 bit. */ #define R_NIOS2_PCREL16 3 /* PC relative 16 bit. */ #define R_NIOS2_CALL26 4 /* Direct call. */ #define R_NIOS2_IMM5 5 /* 5 bit constant expression. */ #define R_NIOS2_CACHE_OPX 6 /* 5 bit expression, shift 22. */ #define R_NIOS2_IMM6 7 /* 6 bit constant expression. */ #define R_NIOS2_IMM8 8 /* 8 bit constant expression. */ #define R_NIOS2_HI16 9 /* High 16 bit. */ #define R_NIOS2_LO16 10 /* Low 16 bit. */ #define R_NIOS2_HIADJ16 11 /* High 16 bit, adjusted. */ #define R_NIOS2_BFD_RELOC_32 12 /* 32 bit symbol value + addend. */ #define R_NIOS2_BFD_RELOC_16 13 /* 16 bit symbol value + addend. */ #define R_NIOS2_BFD_RELOC_8 14 /* 8 bit symbol value + addend. */ #define R_NIOS2_GPREL 15 /* 16 bit GP pointer offset. */ #define R_NIOS2_GNU_VTINHERIT 16 /* GNU C++ vtable hierarchy. */ #define R_NIOS2_GNU_VTENTRY 17 /* GNU C++ vtable member usage. */ #define R_NIOS2_UJMP 18 /* Unconditional branch. */ #define R_NIOS2_CJMP 19 /* Conditional branch. */ #define R_NIOS2_CALLR 20 /* Indirect call through register. */ #define R_NIOS2_ALIGN 21 /* Alignment requirement for linker relaxation. */ #define R_NIOS2_GOT16 22 /* 16 bit GOT entry. */ #define R_NIOS2_CALL16 23 /* 16 bit GOT entry for function. */ #define R_NIOS2_GOTOFF_LO 24 /* %lo of offset to GOT pointer. */ #define R_NIOS2_GOTOFF_HA 25 /* %hiadj of offset to GOT pointer. */ #define R_NIOS2_PCREL_LO 26 /* %lo of PC relative offset. */ #define R_NIOS2_PCREL_HA 27 /* %hiadj of PC relative offset. */ #define R_NIOS2_TLS_GD16 28 /* 16 bit GOT offset for TLS GD. */ #define R_NIOS2_TLS_LDM16 29 /* 16 bit GOT offset for TLS LDM. */ #define R_NIOS2_TLS_LDO16 30 /* 16 bit module relative offset. */ #define R_NIOS2_TLS_IE16 31 /* 16 bit GOT offset for TLS IE. */ #define R_NIOS2_TLS_LE16 32 /* 16 bit LE TP-relative offset. */ #define R_NIOS2_TLS_DTPMOD 33 /* Module number. */ #define R_NIOS2_TLS_DTPREL 34 /* Module-relative offset. */ #define R_NIOS2_TLS_TPREL 35 /* TP-relative offset. */ #define R_NIOS2_COPY 36 /* Copy symbol at runtime. */ #define R_NIOS2_GLOB_DAT 37 /* Create GOT entry. */ #define R_NIOS2_JUMP_SLOT 38 /* Create PLT entry. */ #define R_NIOS2_RELATIVE 39 /* Adjust by program base. */ #define R_NIOS2_GOTOFF 40 /* 16 bit offset to GOT pointer. */ #define R_NIOS2_CALL26_NOAT 41 /* Direct call in .noat section. */ #define R_NIOS2_GOT_LO 42 /* %lo() of GOT entry. */ #define R_NIOS2_GOT_HA 43 /* %hiadj() of GOT entry. */ #define R_NIOS2_CALL_LO 44 /* %lo() of function GOT entry. */ #define R_NIOS2_CALL_HA 45 /* %hiadj() of function GOT entry. */ /* TILEPro relocations. */ #define R_TILEPRO_NONE 0 /* No reloc */ #define R_TILEPRO_32 1 /* Direct 32 bit */ #define R_TILEPRO_16 2 /* Direct 16 bit */ #define R_TILEPRO_8 3 /* Direct 8 bit */ #define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ #define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ #define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ #define R_TILEPRO_LO16 7 /* Low 16 bit */ #define R_TILEPRO_HI16 8 /* High 16 bit */ #define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ #define R_TILEPRO_COPY 10 /* Copy relocation */ #define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ #define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ #define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ #define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ #define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ #define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ #define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ #define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ #define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ #define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ #define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ #define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ #define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ #define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ #define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ #define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ #define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ #define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ #define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ #define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ #define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ #define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ #define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ #define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ #define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ #define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ #define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ #define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ #define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ #define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ #define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ #define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ #define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ #define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ #define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ #define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ #define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ #define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ #define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ #define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ #define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ #define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ /* Relocs 56-59 are currently not defined. */ #define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ #define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ #define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ #define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ #define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ #define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ #define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ #define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ #define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ #define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ #define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ #define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ #define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ #define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ #define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ #define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ #define R_TILEPRO_NUM 130 /* TILE-Gx relocations. */ #define R_TILEGX_NONE 0 /* No reloc */ #define R_TILEGX_64 1 /* Direct 64 bit */ #define R_TILEGX_32 2 /* Direct 32 bit */ #define R_TILEGX_16 3 /* Direct 16 bit */ #define R_TILEGX_8 4 /* Direct 8 bit */ #define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ #define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ #define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ #define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ #define R_TILEGX_HW0 9 /* hword 0 16-bit */ #define R_TILEGX_HW1 10 /* hword 1 16-bit */ #define R_TILEGX_HW2 11 /* hword 2 16-bit */ #define R_TILEGX_HW3 12 /* hword 3 16-bit */ #define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ #define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ #define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ #define R_TILEGX_COPY 16 /* Copy relocation */ #define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ #define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ #define R_TILEGX_RELATIVE 19 /* Adjust by program base */ #define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ #define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ #define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ #define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ #define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ #define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ #define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ #define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ #define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ #define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ #define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ #define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ #define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ #define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ #define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ #define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ #define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ #define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ #define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ #define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ #define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ #define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ #define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ #define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ #define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ #define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ #define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ #define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ #define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ #define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ #define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ #define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ #define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ #define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ #define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ #define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ #define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ #define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ #define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ #define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ #define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ #define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ #define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ #define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ #define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ #define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ #define R_TILEGX_IMM16_X0_HW0_PLT_PCREL 66 /* X0 pipe PC-rel PLT hword 0 */ #define R_TILEGX_IMM16_X1_HW0_PLT_PCREL 67 /* X1 pipe PC-rel PLT hword 0 */ #define R_TILEGX_IMM16_X0_HW1_PLT_PCREL 68 /* X0 pipe PC-rel PLT hword 1 */ #define R_TILEGX_IMM16_X1_HW1_PLT_PCREL 69 /* X1 pipe PC-rel PLT hword 1 */ #define R_TILEGX_IMM16_X0_HW2_PLT_PCREL 70 /* X0 pipe PC-rel PLT hword 2 */ #define R_TILEGX_IMM16_X1_HW2_PLT_PCREL 71 /* X1 pipe PC-rel PLT hword 2 */ #define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ #define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ #define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ #define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ #define R_TILEGX_IMM16_X0_HW3_PLT_PCREL 76 /* X0 pipe PC-rel PLT hword 3 */ #define R_TILEGX_IMM16_X1_HW3_PLT_PCREL 77 /* X1 pipe PC-rel PLT hword 3 */ #define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ #define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ #define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ #define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ #define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ #define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ #define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ #define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ #define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ #define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ #define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ #define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ /* Relocs 90-91 are currently not defined. */ #define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ #define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ #define R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL 94 /* X0 pipe PC-rel PLT last hword 0 */ #define R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL 95 /* X1 pipe PC-rel PLT last hword 0 */ #define R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL 96 /* X0 pipe PC-rel PLT last hword 1 */ #define R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL 97 /* X1 pipe PC-rel PLT last hword 1 */ #define R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL 98 /* X0 pipe PC-rel PLT last hword 2 */ #define R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL 99 /* X1 pipe PC-rel PLT last hword 2 */ #define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ #define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ #define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ #define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ /* Relocs 104-105 are currently not defined. */ #define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ #define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ #define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ #define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ #define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ #define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ #define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ #define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ #define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ #define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ #define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ #define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ #define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ #define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ #define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ #define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ #define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ #define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ #define R_TILEGX_NUM 130 /* RISC-V ELF Flags */ #define EF_RISCV_RVC 0x0001 #define EF_RISCV_FLOAT_ABI 0x0006 #define EF_RISCV_FLOAT_ABI_SOFT 0x0000 #define EF_RISCV_FLOAT_ABI_SINGLE 0x0002 #define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004 #define EF_RISCV_FLOAT_ABI_QUAD 0x0006 /* RISC-V relocations. */ #define R_RISCV_NONE 0 #define R_RISCV_32 1 #define R_RISCV_64 2 #define R_RISCV_RELATIVE 3 #define R_RISCV_COPY 4 #define R_RISCV_JUMP_SLOT 5 #define R_RISCV_TLS_DTPMOD32 6 #define R_RISCV_TLS_DTPMOD64 7 #define R_RISCV_TLS_DTPREL32 8 #define R_RISCV_TLS_DTPREL64 9 #define R_RISCV_TLS_TPREL32 10 #define R_RISCV_TLS_TPREL64 11 #define R_RISCV_BRANCH 16 #define R_RISCV_JAL 17 #define R_RISCV_CALL 18 #define R_RISCV_CALL_PLT 19 #define R_RISCV_GOT_HI20 20 #define R_RISCV_TLS_GOT_HI20 21 #define R_RISCV_TLS_GD_HI20 22 #define R_RISCV_PCREL_HI20 23 #define R_RISCV_PCREL_LO12_I 24 #define R_RISCV_PCREL_LO12_S 25 #define R_RISCV_HI20 26 #define R_RISCV_LO12_I 27 #define R_RISCV_LO12_S 28 #define R_RISCV_TPREL_HI20 29 #define R_RISCV_TPREL_LO12_I 30 #define R_RISCV_TPREL_LO12_S 31 #define R_RISCV_TPREL_ADD 32 #define R_RISCV_ADD8 33 #define R_RISCV_ADD16 34 #define R_RISCV_ADD32 35 #define R_RISCV_ADD64 36 #define R_RISCV_SUB8 37 #define R_RISCV_SUB16 38 #define R_RISCV_SUB32 39 #define R_RISCV_SUB64 40 #define R_RISCV_GNU_VTINHERIT 41 #define R_RISCV_GNU_VTENTRY 42 #define R_RISCV_ALIGN 43 #define R_RISCV_RVC_BRANCH 44 #define R_RISCV_RVC_JUMP 45 #define R_RISCV_RVC_LUI 46 #define R_RISCV_GPREL_I 47 #define R_RISCV_GPREL_S 48 #define R_RISCV_TPREL_I 49 #define R_RISCV_TPREL_S 50 #define R_RISCV_RELAX 51 #define R_RISCV_SUB6 52 #define R_RISCV_SET6 53 #define R_RISCV_SET8 54 #define R_RISCV_SET16 55 #define R_RISCV_SET32 56 #define R_RISCV_32_PCREL 57 #define R_RISCV_NUM 58 /* BPF specific declarations. */ #define R_BPF_NONE 0 /* No reloc */ #define R_BPF_64_64 1 #define R_BPF_64_32 10 /* Imagination Meta specific relocations. */ #define R_METAG_HIADDR16 0 #define R_METAG_LOADDR16 1 #define R_METAG_ADDR32 2 /* 32bit absolute address */ #define R_METAG_NONE 3 /* No reloc */ #define R_METAG_RELBRANCH 4 #define R_METAG_GETSETOFF 5 /* Backward compatability */ #define R_METAG_REG32OP1 6 #define R_METAG_REG32OP2 7 #define R_METAG_REG32OP3 8 #define R_METAG_REG16OP1 9 #define R_METAG_REG16OP2 10 #define R_METAG_REG16OP3 11 #define R_METAG_REG32OP4 12 #define R_METAG_HIOG 13 #define R_METAG_LOOG 14 #define R_METAG_REL8 15 #define R_METAG_REL16 16 /* GNU */ #define R_METAG_GNU_VTINHERIT 30 #define R_METAG_GNU_VTENTRY 31 /* PIC relocations */ #define R_METAG_HI16_GOTOFF 32 #define R_METAG_LO16_GOTOFF 33 #define R_METAG_GETSET_GOTOFF 34 #define R_METAG_GETSET_GOT 35 #define R_METAG_HI16_GOTPC 36 #define R_METAG_LO16_GOTPC 37 #define R_METAG_HI16_PLT 38 #define R_METAG_LO16_PLT 39 #define R_METAG_RELBRANCH_PLT 40 #define R_METAG_GOTOFF 41 #define R_METAG_PLT 42 #define R_METAG_COPY 43 #define R_METAG_JMP_SLOT 44 #define R_METAG_RELATIVE 45 #define R_METAG_GLOB_DAT 46 /* TLS relocations */ #define R_METAG_TLS_GD 47 #define R_METAG_TLS_LDM 48 #define R_METAG_TLS_LDO_HI16 49 #define R_METAG_TLS_LDO_LO16 50 #define R_METAG_TLS_LDO 51 #define R_METAG_TLS_IE 52 #define R_METAG_TLS_IENONPIC 53 #define R_METAG_TLS_IENONPIC_HI16 54 #define R_METAG_TLS_IENONPIC_LO16 55 #define R_METAG_TLS_TPOFF 56 #define R_METAG_TLS_DTPMOD 57 #define R_METAG_TLS_DTPOFF 58 #define R_METAG_TLS_LE 59 #define R_METAG_TLS_LE_HI16 60 #define R_METAG_TLS_LE_LO16 61 /* NDS32 relocations. */ #define R_NDS32_NONE 0 #define R_NDS32_32_RELA 20 #define R_NDS32_COPY 39 #define R_NDS32_GLOB_DAT 40 #define R_NDS32_JMP_SLOT 41 #define R_NDS32_RELATIVE 42 #define R_NDS32_TLS_TPOFF 102 #define R_NDS32_TLS_DESC 119 __END_DECLS #endif /* elf.h */ endian.h 0000644 00000006165 15063602064 0006165 0 ustar 00 /* Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ENDIAN_H #define _ENDIAN_H 1 #include <features.h> /* Definitions for byte order, according to significance of bytes, from low addresses to high addresses. The value is what you get by putting '4' in the most significant byte, '3' in the second most significant byte, '2' in the second least significant byte, and '1' in the least significant byte, and then writing down one digit for each byte, starting with the byte at the lowest address at the left, and proceeding to the byte with the highest address at the right. */ #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #define __PDP_ENDIAN 3412 /* This file defines `__BYTE_ORDER' for the particular machine. */ #include <bits/endian.h> /* Some machines may need to use a different endianness for floating point values. */ #ifndef __FLOAT_WORD_ORDER # define __FLOAT_WORD_ORDER __BYTE_ORDER #endif #ifdef __USE_MISC # define LITTLE_ENDIAN __LITTLE_ENDIAN # define BIG_ENDIAN __BIG_ENDIAN # define PDP_ENDIAN __PDP_ENDIAN # define BYTE_ORDER __BYTE_ORDER #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # define __LONG_LONG_PAIR(HI, LO) LO, HI #elif __BYTE_ORDER == __BIG_ENDIAN # define __LONG_LONG_PAIR(HI, LO) HI, LO #endif #if defined __USE_MISC && !defined __ASSEMBLER__ /* Conversion interfaces. */ # include <bits/byteswap.h> # include <bits/uintn-identity.h> # if __BYTE_ORDER == __LITTLE_ENDIAN # define htobe16(x) __bswap_16 (x) # define htole16(x) __uint16_identity (x) # define be16toh(x) __bswap_16 (x) # define le16toh(x) __uint16_identity (x) # define htobe32(x) __bswap_32 (x) # define htole32(x) __uint32_identity (x) # define be32toh(x) __bswap_32 (x) # define le32toh(x) __uint32_identity (x) # define htobe64(x) __bswap_64 (x) # define htole64(x) __uint64_identity (x) # define be64toh(x) __bswap_64 (x) # define le64toh(x) __uint64_identity (x) # else # define htobe16(x) __uint16_identity (x) # define htole16(x) __bswap_16 (x) # define be16toh(x) __uint16_identity (x) # define le16toh(x) __bswap_16 (x) # define htobe32(x) __uint32_identity (x) # define htole32(x) __bswap_32 (x) # define be32toh(x) __uint32_identity (x) # define le32toh(x) __bswap_32 (x) # define htobe64(x) __uint64_identity (x) # define htole64(x) __bswap_64 (x) # define be64toh(x) __uint64_identity (x) # define le64toh(x) __bswap_64 (x) # endif #endif #endif /* endian.h */ envz.h 0000644 00000005462 15063602064 0005710 0 ustar 00 /* Routines for dealing with '\0' separated environment vectors Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ENVZ_H #define _ENVZ_H 1 #include <features.h> #include <errno.h> /* Envz's are argz's too, and should be created etc., using the same routines. */ #include <argz.h> __BEGIN_DECLS /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */ extern char *envz_entry (const char *__restrict __envz, size_t __envz_len, const char *__restrict __name) __THROW __attribute_pure__; /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0 if there is none. */ extern char *envz_get (const char *__restrict __envz, size_t __envz_len, const char *__restrict __name) __THROW __attribute_pure__; /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN. If an entry with the same name already exists in ENVZ, it is removed. If VALUE is NULL, then the new entry will a special null one, for which envz_get will return NULL, although envz_entry will still return an entry; this is handy because when merging with another envz, the null entry can override an entry in the other one. Null entries can be removed with envz_strip (). */ extern error_t envz_add (char **__restrict __envz, size_t *__restrict __envz_len, const char *__restrict __name, const char *__restrict __value) __THROW; /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If OVERRIDE is true, then values in ENVZ2 will supersede those with the same name in ENV, otherwise not. */ extern error_t envz_merge (char **__restrict __envz, size_t *__restrict __envz_len, const char *__restrict __envz2, size_t __envz2_len, int __override) __THROW; /* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any. */ extern void envz_remove (char **__restrict __envz, size_t *__restrict __envz_len, const char *__restrict __name) __THROW; /* Remove null entries. */ extern void envz_strip (char **__restrict __envz, size_t *__restrict __envz_len) __THROW; __END_DECLS #endif /* envz.h */ err.h 0000644 00000004241 15063602064 0005510 0 ustar 00 /* 4.4BSD utility functions for error messages. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ERR_H #define _ERR_H 1 #include <features.h> #define __need___va_list #include <stdarg.h> #ifndef __GNUC_VA_LIST # define __gnuc_va_list void * #endif __BEGIN_DECLS /* Print "program: ", FORMAT, ": ", the standard error string for errno, and a newline, on stderr. */ extern void warn (const char *__format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); extern void vwarn (const char *__format, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, but without ": " and the standard error string. */ extern void warnx (const char *__format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); extern void vwarnx (const char *__format, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, and then exit with STATUS. */ extern void err (int __status, const char *__format, ...) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); extern void verr (int __status, const char *__format, __gnuc_va_list) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); extern void errx (int __status, const char *__format, ...) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); extern void verrx (int __status, const char *, __gnuc_va_list) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); __END_DECLS #endif /* err.h */ errno.h 0000644 00000003216 15063602064 0006046 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.5 Errors <errno.h> */ #ifndef _ERRNO_H #define _ERRNO_H 1 #include <features.h> /* The system-specific definitions of the E* constants, as macros. */ #include <bits/errno.h> /* When included from assembly language, this header only provides the E* constants. */ #ifndef __ASSEMBLER__ __BEGIN_DECLS /* The error code set by various library functions. */ extern int *__errno_location (void) __THROW __attribute_const__; # define errno (*__errno_location ()) # ifdef __USE_GNU /* The full and simple forms of the name with which the program was invoked. These variables are set up automatically at startup based on the value of argv[0]. */ extern char *program_invocation_name; extern char *program_invocation_short_name; #include <bits/types/error_t.h> # endif /* __USE_GNU */ __END_DECLS #endif /* !__ASSEMBLER__ */ #endif /* errno.h */ error.h 0000644 00000003767 15063602064 0006065 0 ustar 00 /* Declaration for error-reporting function Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ERROR_H #define _ERROR_H 1 #include <features.h> __BEGIN_DECLS /* Print a message with `fprintf (stderr, FORMAT, ...)'; if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) __attribute__ ((__format__ (__printf__, 5, 6))); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ extern void (*error_print_progname) (void); /* This variable is incremented each time `error' is called. */ extern unsigned int error_message_count; /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ extern int error_one_per_line; #if defined __extern_always_inline && defined __va_arg_pack # include <bits/error.h> #endif __END_DECLS #endif /* error.h */ execinfo.h 0000644 00000002762 15063602065 0006527 0 ustar 00 /* Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _EXECINFO_H #define _EXECINFO_H 1 #include <features.h> __BEGIN_DECLS /* Store up to SIZE return address of the current program state in ARRAY and return the exact number of values stored. */ extern int backtrace (void **__array, int __size) __nonnull ((1)); /* Return names of functions from the backtrace list in ARRAY in a newly malloc()ed memory block. */ extern char **backtrace_symbols (void *const *__array, int __size) __THROW __nonnull ((1)); /* This function is similar to backtrace_symbols() but it writes the result immediately to a file. */ extern void backtrace_symbols_fd (void *const *__array, int __size, int __fd) __THROW __nonnull ((1)); __END_DECLS #endif /* execinfo.h */ fcntl.h 0000644 00000025316 15063602065 0006035 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 6.5 File Control Operations <fcntl.h> */ #ifndef _FCNTL_H #define _FCNTL_H 1 #include <features.h> /* This must be early so <bits/fcntl.h> can define types winningly. */ __BEGIN_DECLS /* Get __mode_t, __dev_t and __off_t .*/ #include <bits/types.h> /* Get the definitions of O_*, F_*, FD_*: all the numbers and flag bits for `open', `fcntl', et al. */ #include <bits/fcntl.h> /* Detect if open needs mode as a third argument (or for openat as a fourth argument). */ #ifdef __O_TMPFILE # define __OPEN_NEEDS_MODE(oflag) \ (((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE) #else # define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0) #endif /* POSIX.1-2001 specifies that these types are defined by <fcntl.h>. Earlier POSIX standards permitted any type ending in `_t' to be defined by any POSIX header, so we don't conditionalize the definitions here. */ #ifndef __mode_t_defined typedef __mode_t mode_t; # define __mode_t_defined #endif #ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif # define __off_t_defined #endif #if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; # define __off64_t_defined #endif #ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined #endif /* For XPG all symbols from <sys/stat.h> should also be available. */ #ifdef __USE_XOPEN2K8 # include <bits/types/struct_timespec.h> #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # include <bits/stat.h> # define S_IFMT __S_IFMT # define S_IFDIR __S_IFDIR # define S_IFCHR __S_IFCHR # define S_IFBLK __S_IFBLK # define S_IFREG __S_IFREG # ifdef __S_IFIFO # define S_IFIFO __S_IFIFO # endif # ifdef __S_IFLNK # define S_IFLNK __S_IFLNK # endif # if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK # define S_IFSOCK __S_IFSOCK # endif /* Protection bits. */ # define S_ISUID __S_ISUID /* Set user ID on execution. */ # define S_ISGID __S_ISGID /* Set group ID on execution. */ # if defined __USE_MISC || defined __USE_XOPEN /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ # define S_ISVTX __S_ISVTX # endif # define S_IRUSR __S_IREAD /* Read by owner. */ # define S_IWUSR __S_IWRITE /* Write by owner. */ # define S_IXUSR __S_IEXEC /* Execute by owner. */ /* Read, write, and execute by owner. */ # define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) # define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ # define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ # define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ /* Read, write, and execute by group. */ # define S_IRWXG (S_IRWXU >> 3) # define S_IROTH (S_IRGRP >> 3) /* Read by others. */ # define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ # define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ /* Read, write, and execute by others. */ # define S_IRWXO (S_IRWXG >> 3) #endif #ifdef __USE_MISC # ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */ /* Values for the second argument to access. These may be OR'd together. */ # define R_OK 4 /* Test for read permission. */ # define W_OK 2 /* Test for write permission. */ # define X_OK 1 /* Test for execute permission. */ # define F_OK 0 /* Test for existence. */ # endif #endif /* Use misc. */ /* XPG wants the following symbols. <stdio.h> has the same definitions. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Seek from end of file. */ #endif /* XPG */ /* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to unlinkat. The two functions do completely different things and therefore, the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to faccessat would be undefined behavior and thus treating it equivalent to AT_EACCESS is valid undefined behavior. */ #ifdef __USE_ATFILE # define AT_FDCWD -100 /* Special value used to indicate the *at functions should use the current working directory. */ # define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ # define AT_REMOVEDIR 0x200 /* Remove directory instead of unlinking file. */ # define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ # ifdef __USE_GNU # define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal. */ # define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */ # define AT_STATX_SYNC_TYPE 0x6000 # define AT_STATX_SYNC_AS_STAT 0x0000 # define AT_STATX_FORCE_SYNC 0x2000 # define AT_STATX_DONT_SYNC 0x4000 # endif # define AT_EACCESS 0x200 /* Test access permitted for effective IDs, not real IDs. */ #endif /* Do the file control operation described by CMD on FD. The remaining arguments are interpreted depending on CMD. This function is a cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int fcntl (int __fd, int __cmd, ...); #else # ifdef __REDIRECT extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); # else # define fcntl fcntl64 # endif #endif #ifdef __USE_LARGEFILE64 extern int fcntl64 (int __fd, int __cmd, ...); #endif /* Open FILE and return a new file descriptor for it, or -1 on error. OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set in OFLAG, the third argument is taken as a `mode_t', the mode of the created file. This function is a cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int open (const char *__file, int __oflag, ...) __nonnull ((1)); #else # ifdef __REDIRECT extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64) __nonnull ((1)); # else # define open open64 # endif #endif #ifdef __USE_LARGEFILE64 extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1)); #endif #ifdef __USE_ATFILE /* Similar to `open' but a relative path name is interpreted relative to the directory for which FD is a descriptor. NOTE: some other `openat' implementation support additional functionality through this interface, especially using the O_XATTR flag. This is not yet supported here. This function is a cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int openat (int __fd, const char *__file, int __oflag, ...) __nonnull ((2)); # else # ifdef __REDIRECT extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag, ...), openat64) __nonnull ((2)); # else # define openat openat64 # endif # endif # ifdef __USE_LARGEFILE64 extern int openat64 (int __fd, const char *__file, int __oflag, ...) __nonnull ((2)); # endif #endif /* Create and open FILE, with mode MODE. This takes an `int' MODE argument because that is what `mode_t' will be widened to. This function is a cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int creat (const char *__file, mode_t __mode) __nonnull ((1)); #else # ifdef __REDIRECT extern int __REDIRECT (creat, (const char *__file, mode_t __mode), creat64) __nonnull ((1)); # else # define creat creat64 # endif #endif #ifdef __USE_LARGEFILE64 extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1)); #endif #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ && !defined __USE_POSIX)) /* NOTE: These declarations also appear in <unistd.h>; be sure to keep both files consistent. Some systems have them there and some here, and some software depends on the macros being defined without including both. */ /* `lockf' is a simpler interface to the locking facilities of `fcntl'. LEN is always relative to the current file position. The CMD argument is one of the following. */ # define F_ULOCK 0 /* Unlock a previously locked region. */ # define F_LOCK 1 /* Lock a region for exclusive use. */ # define F_TLOCK 2 /* Test and lock a region for exclusive use. */ # define F_TEST 3 /* Test a region for other processes locks. */ # ifndef __USE_FILE_OFFSET64 extern int lockf (int __fd, int __cmd, off_t __len); # else # ifdef __REDIRECT extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64); # else # define lockf lockf64 # endif # endif # ifdef __USE_LARGEFILE64 extern int lockf64 (int __fd, int __cmd, off64_t __len); # endif #endif #ifdef __USE_XOPEN2K /* Advice the system about the expected behaviour of the application with respect to the file associated with FD. */ # ifndef __USE_FILE_OFFSET64 extern int posix_fadvise (int __fd, off_t __offset, off_t __len, int __advise) __THROW; # else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset, __off64_t __len, int __advise), posix_fadvise64); # else # define posix_fadvise posix_fadvise64 # endif # endif # ifdef __USE_LARGEFILE64 extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len, int __advise) __THROW; # endif /* Reserve storage for the data of the file associated with FD. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int posix_fallocate (int __fd, off_t __offset, off_t __len); # else # ifdef __REDIRECT extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset, __off64_t __len), posix_fallocate64); # else # define posix_fallocate posix_fallocate64 # endif # endif # ifdef __USE_LARGEFILE64 extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len); # endif #endif /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ && defined __va_arg_pack_len # include <bits/fcntl2.h> #endif __END_DECLS #endif /* fcntl.h */ features.h 0000644 00000037276 15063602065 0006555 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FEATURES_H #define _FEATURES_H 1 /* These are defined by the user (or the compiler) to specify the desired environment: __STRICT_ANSI__ ISO Standard C. _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. __STDC_WANT_LIB_EXT2__ Extensions to ISO C99 from TR 27431-2:2010. __STDC_WANT_IEC_60559_BFP_EXT__ Extensions to ISO C11 from TS 18661-1:2014. __STDC_WANT_IEC_60559_FUNCS_EXT__ Extensions to ISO C11 from TS 18661-4:2015. __STDC_WANT_IEC_60559_TYPES_EXT__ Extensions to ISO C11 from TS 18661-3:2015. _POSIX_SOURCE IEEE Std 1003.1. _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; if >=199309L, add IEEE Std 1003.1b-1993; if >=199506L, add IEEE Std 1003.1c-1995; if >=200112L, all of IEEE 1003.1-2004 if >=200809L, all of IEEE 1003.1-2008 _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if Single Unix conformance is wanted, to 600 for the sixth revision, to 700 for the seventh revision. _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. _LARGEFILE_SOURCE Some more functions for correct standard I/O. _LARGEFILE64_SOURCE Additional functionality from LFS for large files. _FILE_OFFSET_BITS=N Select default filesystem interface. _ATFILE_SOURCE Additional *at interfaces. _GNU_SOURCE All of the above, plus GNU extensions. _DEFAULT_SOURCE The default set of features (taking precedence over __STRICT_ANSI__). _FORTIFY_SOURCE Add security hardening to many library functions. Set to 1 or 2; 2 performs stricter checks than 1. _REENTRANT, _THREAD_SAFE Obsolete; equivalent to _POSIX_C_SOURCE=199506L. The `-ansi' switch to the GNU C compiler, and standards conformance options such as `-std=c99', define __STRICT_ANSI__. If none of these are defined, or if _DEFAULT_SOURCE is defined, the default is to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to 200809L, as well as enabling miscellaneous functions from BSD and SVID. If more than one of these are defined, they accumulate. For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together give you ISO C, 1003.1, and 1003.2, but nothing else. These are defined by this file and are used by the header files to decide what to declare or define: __GLIBC_USE (F) Define things from feature set F. This is defined to 1 or 0; the subsequent macros are either defined or undefined, and those tests should be moved to __GLIBC_USE. __USE_ISOC11 Define ISO C11 things. __USE_ISOC99 Define ISO C99 things. __USE_ISOC95 Define ISO C90 AMD1 (C95) things. __USE_ISOCXX11 Define ISO C++11 things. __USE_POSIX Define IEEE Std 1003.1 things. __USE_POSIX2 Define IEEE Std 1003.2 things. __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. __USE_XOPEN Define XPG things. __USE_XOPEN_EXTENDED Define X/Open Unix things. __USE_UNIX98 Define Single Unix V2 things. __USE_XOPEN2K Define XPG6 things. __USE_XOPEN2KXSI Define XPG6 XSI things. __USE_XOPEN2K8 Define XPG7 things. __USE_XOPEN2K8XSI Define XPG7 XSI things. __USE_LARGEFILE Define correct standard I/O things. __USE_LARGEFILE64 Define LFS things with separate names. __USE_FILE_OFFSET64 Define 64bit interface as default. __USE_MISC Define things from 4.3BSD or System V Unix. __USE_ATFILE Define *at interfaces and AT_* constants for them. __USE_GNU Define GNU extensions. __USE_FORTIFY_LEVEL Additional security measures used, according to level. The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are defined by this file unconditionally. `__GNU_LIBRARY__' is provided only for compatibility. All new code should use the other symbols to test for features. All macros listed above as possibly being defined by this file are explicitly undefined if they are not explicitly defined. Feature-test macros that are not defined by the user or compiler but are implied by the other feature-test macros defined (or by the lack of any definitions) are defined by the file. ISO C feature test macros depend on the definition of the macro when an affected header is included, not when the first system header is included, and so they are handled in <bits/libc-header-start.h>, which does not have a multiple include guard. Feature test macros that can be handled from the first system header included are handled here. */ /* Undefine everything, so we get a clean slate. */ #undef __USE_ISOC11 #undef __USE_ISOC99 #undef __USE_ISOC95 #undef __USE_ISOCXX11 #undef __USE_POSIX #undef __USE_POSIX2 #undef __USE_POSIX199309 #undef __USE_POSIX199506 #undef __USE_XOPEN #undef __USE_XOPEN_EXTENDED #undef __USE_UNIX98 #undef __USE_XOPEN2K #undef __USE_XOPEN2KXSI #undef __USE_XOPEN2K8 #undef __USE_XOPEN2K8XSI #undef __USE_LARGEFILE #undef __USE_LARGEFILE64 #undef __USE_FILE_OFFSET64 #undef __USE_MISC #undef __USE_ATFILE #undef __USE_GNU #undef __USE_FORTIFY_LEVEL #undef __KERNEL_STRICT_NAMES #undef __GLIBC_USE_DEPRECATED_GETS /* Suppress kernel-name space pollution unless user expressedly asks for it. */ #ifndef _LOOSE_KERNEL_NAMES # define __KERNEL_STRICT_NAMES #endif /* Convenience macro to test the version of gcc. Use like this: #if __GNUC_PREREQ (2,8) ... code requiring gcc 2.8 or later ... #endif Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was added in 2.0. */ #if defined __GNUC__ && defined __GNUC_MINOR__ # define __GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #else # define __GNUC_PREREQ(maj, min) 0 #endif /* Similarly for clang. Features added to GCC after version 4.2 may or may not also be available in clang, and clang's definitions of __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such features can be queried via __has_extension/__has_feature. */ #if defined __clang_major__ && defined __clang_minor__ # define __glibc_clang_prereq(maj, min) \ ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min)) #else # define __glibc_clang_prereq(maj, min) 0 #endif /* Whether to use feature set F. */ #define __GLIBC_USE(F) __GLIBC_USE_ ## F /* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not issue a warning; the expectation is that the source is being transitioned to use the new macro. */ #if (defined _BSD_SOURCE || defined _SVID_SOURCE) \ && !defined _DEFAULT_SOURCE # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" # undef _DEFAULT_SOURCE # define _DEFAULT_SOURCE 1 #endif /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ #ifdef _GNU_SOURCE # undef _ISOC95_SOURCE # define _ISOC95_SOURCE 1 # undef _ISOC99_SOURCE # define _ISOC99_SOURCE 1 # undef _ISOC11_SOURCE # define _ISOC11_SOURCE 1 # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE # define _POSIX_C_SOURCE 200809L # undef _XOPEN_SOURCE # define _XOPEN_SOURCE 700 # undef _XOPEN_SOURCE_EXTENDED # define _XOPEN_SOURCE_EXTENDED 1 # undef _LARGEFILE64_SOURCE # define _LARGEFILE64_SOURCE 1 # undef _DEFAULT_SOURCE # define _DEFAULT_SOURCE 1 # undef _ATFILE_SOURCE # define _ATFILE_SOURCE 1 #endif /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, define _DEFAULT_SOURCE. */ #if (defined _DEFAULT_SOURCE \ || (!defined __STRICT_ANSI__ \ && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \ && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \ && !defined _XOPEN_SOURCE)) # undef _DEFAULT_SOURCE # define _DEFAULT_SOURCE 1 #endif /* This is to enable the ISO C11 extension. */ #if (defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) # define __USE_ISOC11 1 #endif /* This is to enable the ISO C99 extension. */ #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) # define __USE_ISOC99 1 #endif /* This is to enable the ISO C90 Amendment 1:1995 extension. */ #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L)) # define __USE_ISOC95 1 #endif #ifdef __cplusplus /* This is to enable compatibility for ISO C++17. */ # if __cplusplus >= 201703L # define __USE_ISOC11 1 # endif /* This is to enable compatibility for ISO C++11. Check the temporary macro for now, too. */ # if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ # define __USE_ISOCXX11 1 # define __USE_ISOC99 1 # endif #endif /* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE is defined, use POSIX.1-2008 (or another version depending on _XOPEN_SOURCE). */ #ifdef _DEFAULT_SOURCE # if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE # define __USE_POSIX_IMPLICITLY 1 # endif # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE # define _POSIX_C_SOURCE 200809L #endif #if ((!defined __STRICT_ANSI__ \ || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)) \ && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE) # define _POSIX_SOURCE 1 # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500 # define _POSIX_C_SOURCE 2 # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600 # define _POSIX_C_SOURCE 199506L # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700 # define _POSIX_C_SOURCE 200112L # else # define _POSIX_C_SOURCE 200809L # endif # define __USE_POSIX_IMPLICITLY 1 #endif /* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be defined in all multithreaded code. GNU libc has not required this for many years. We now treat them as compatibility synonyms for _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with comprehensive support for multithreaded code. Using them never lowers the selected level of POSIX conformance, only raises it. */ #if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \ && (defined _REENTRANT || defined _THREAD_SAFE)) # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE # define _POSIX_C_SOURCE 199506L #endif #if (defined _POSIX_SOURCE \ || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) \ || defined _XOPEN_SOURCE) # define __USE_POSIX 1 #endif #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE # define __USE_POSIX2 1 #endif #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L # define __USE_POSIX199309 1 #endif #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L # define __USE_POSIX199506 1 #endif #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L # define __USE_XOPEN2K 1 # undef __USE_ISOC95 # define __USE_ISOC95 1 # undef __USE_ISOC99 # define __USE_ISOC99 1 #endif #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L # define __USE_XOPEN2K8 1 # undef _ATFILE_SOURCE # define _ATFILE_SOURCE 1 #endif #ifdef _XOPEN_SOURCE # define __USE_XOPEN 1 # if (_XOPEN_SOURCE - 0) >= 500 # define __USE_XOPEN_EXTENDED 1 # define __USE_UNIX98 1 # undef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE 1 # if (_XOPEN_SOURCE - 0) >= 600 # if (_XOPEN_SOURCE - 0) >= 700 # define __USE_XOPEN2K8 1 # define __USE_XOPEN2K8XSI 1 # endif # define __USE_XOPEN2K 1 # define __USE_XOPEN2KXSI 1 # undef __USE_ISOC95 # define __USE_ISOC95 1 # undef __USE_ISOC99 # define __USE_ISOC99 1 # endif # else # ifdef _XOPEN_SOURCE_EXTENDED # define __USE_XOPEN_EXTENDED 1 # endif # endif #endif #ifdef _LARGEFILE_SOURCE # define __USE_LARGEFILE 1 #endif #ifdef _LARGEFILE64_SOURCE # define __USE_LARGEFILE64 1 #endif #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 # define __USE_FILE_OFFSET64 1 #endif #if defined _DEFAULT_SOURCE # define __USE_MISC 1 #endif #ifdef _ATFILE_SOURCE # define __USE_ATFILE 1 #endif #ifdef _GNU_SOURCE # define __USE_GNU 1 #endif #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 # if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0 # warning _FORTIFY_SOURCE requires compiling with optimization (-O) # elif !__GNUC_PREREQ (4, 1) # warning _FORTIFY_SOURCE requires GCC 4.1 or later # elif _FORTIFY_SOURCE > 2 && (__glibc_clang_prereq (9, 0) \ || __GNUC_PREREQ (12, 0)) # if _FORTIFY_SOURCE > 3 # warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform # endif # define __USE_FORTIFY_LEVEL 3 # elif _FORTIFY_SOURCE > 1 # if _FORTIFY_SOURCE > 2 # warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform # endif # define __USE_FORTIFY_LEVEL 2 # else # define __USE_FORTIFY_LEVEL 1 # endif #endif #ifndef __USE_FORTIFY_LEVEL # define __USE_FORTIFY_LEVEL 0 #endif /* The function 'gets' existed in C89, but is impossible to use safely. It has been removed from ISO C11 and ISO C++14. Note: for compatibility with various implementations of <cstdio>, this test must consider only the value of __cplusplus when compiling C++. */ #if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11 # define __GLIBC_USE_DEPRECATED_GETS 0 #else # define __GLIBC_USE_DEPRECATED_GETS 1 #endif /* Get definitions of __STDC_* predefined macros, if the compiler has not preincluded this header automatically. */ #include <stdc-predef.h> /* This macro indicates that the installed library is the GNU C Library. For historic reasons the value now is 6 and this will stay from now on. The use of this variable is deprecated. Use __GLIBC__ and __GLIBC_MINOR__ now (see below) when you want to test for a specific GNU C library version and use the values in <gnu/lib-names.h> to get the sonames of the shared libraries. */ #undef __GNU_LIBRARY__ #define __GNU_LIBRARY__ 6 /* Major and minor version number of the GNU C library package. Use these macros to test for features in specific releases. */ #define __GLIBC__ 2 #define __GLIBC_MINOR__ 28 #define __GLIBC_PREREQ(maj, min) \ ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) /* This is here only because every header file already includes this one. */ #ifndef __ASSEMBLER__ # ifndef _SYS_CDEFS_H # include <sys/cdefs.h> # endif /* If we don't have __REDIRECT, prototypes will be missing if __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ # if defined __USE_FILE_OFFSET64 && !defined __REDIRECT # define __USE_LARGEFILE 1 # define __USE_LARGEFILE64 1 # endif #endif /* !ASSEMBLER */ /* Decide whether we can define 'extern inline' functions in headers. */ #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ && defined __extern_inline # define __USE_EXTERN_INLINES 1 #endif /* This is here only because every header file already includes this one. Get the definitions of all the appropriate `__stub_FUNCTION' symbols. <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub that will always return failure (and set errno to ENOSYS). */ #include <gnu/stubs.h> #endif /* features.h */ fenv.h 0000644 00000013341 15063602065 0005660 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 7.6: Floating-point environment <fenv.h> */ #ifndef _FENV_H #define _FENV_H 1 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION #include <bits/libc-header-start.h> /* Get the architecture dependend definitions. The following definitions are expected to be done: fenv_t type for object representing an entire floating-point environment FE_DFL_ENV macro of type pointer to fenv_t to be used as the argument to functions taking an argument of type fenv_t; in this case the default environment will be used fexcept_t type for object representing the floating-point exception flags including status associated with the flags femode_t type for object representing floating-point control modes FE_DFL_MODE macro of type pointer to const femode_t to be used as the argument to fesetmode; in this case the default control modes will be used The following macros are defined iff the implementation supports this kind of exception. FE_INEXACT inexact result FE_DIVBYZERO division by zero FE_UNDERFLOW result not representable due to underflow FE_OVERFLOW result not representable due to overflow FE_INVALID invalid operation FE_ALL_EXCEPT bitwise OR of all supported exceptions The next macros are defined iff the appropriate rounding mode is supported by the implementation. FE_TONEAREST round to nearest FE_UPWARD round toward +Inf FE_DOWNWARD round toward -Inf FE_TOWARDZERO round toward 0 */ #include <bits/fenv.h> __BEGIN_DECLS /* Floating-point exception handling. */ /* Clear the supported exceptions represented by EXCEPTS. */ extern int feclearexcept (int __excepts) __THROW; /* Store implementation-defined representation of the exception flags indicated by EXCEPTS in the object pointed to by FLAGP. */ extern int fegetexceptflag (fexcept_t *__flagp, int __excepts) __THROW; /* Raise the supported exceptions represented by EXCEPTS. */ extern int feraiseexcept (int __excepts) __THROW; #if __GLIBC_USE (IEC_60559_BFP_EXT) /* Set the supported exception flags represented by EXCEPTS, without causing enabled traps to be taken. */ extern int fesetexcept (int __excepts) __THROW; #endif /* Set complete status for exceptions indicated by EXCEPTS according to the representation in the object pointed to by FLAGP. */ extern int fesetexceptflag (const fexcept_t *__flagp, int __excepts) __THROW; /* Determine which of subset of the exceptions specified by EXCEPTS are currently set. */ extern int fetestexcept (int __excepts) __THROW; #if __GLIBC_USE (IEC_60559_BFP_EXT) /* Determine which of subset of the exceptions specified by EXCEPTS are set in *FLAGP. */ extern int fetestexceptflag (const fexcept_t *__flagp, int __excepts) __THROW; #endif /* Rounding control. */ /* Get current rounding direction. */ extern int fegetround (void) __THROW __attribute_pure__; /* Establish the rounding direction represented by ROUND. */ extern int fesetround (int __rounding_direction) __THROW; /* Floating-point environment. */ /* Store the current floating-point environment in the object pointed to by ENVP. */ extern int fegetenv (fenv_t *__envp) __THROW; /* Save the current environment in the object pointed to by ENVP, clear exception flags and install a non-stop mode (if available) for all exceptions. */ extern int feholdexcept (fenv_t *__envp) __THROW; /* Establish the floating-point environment represented by the object pointed to by ENVP. */ extern int fesetenv (const fenv_t *__envp) __THROW; /* Save current exceptions in temporary storage, install environment represented by object pointed to by ENVP and raise exceptions according to saved exceptions. */ extern int feupdateenv (const fenv_t *__envp) __THROW; /* Control modes. */ #if __GLIBC_USE (IEC_60559_BFP_EXT) /* Store the current floating-point control modes in the object pointed to by MODEP. */ extern int fegetmode (femode_t *__modep) __THROW; /* Establish the floating-point control modes represented by the object pointed to by MODEP. */ extern int fesetmode (const femode_t *__modep) __THROW; #endif /* Include optimization. */ #ifdef __OPTIMIZE__ # include <bits/fenvinline.h> #endif /* NaN support. */ #if (__GLIBC_USE (IEC_60559_BFP_EXT) \ && defined FE_INVALID \ && defined __SUPPORT_SNAN__) # define FE_SNANS_ALWAYS_SIGNAL 1 #endif #ifdef __USE_GNU /* Enable individual exceptions. Will not enable more exceptions than EXCEPTS specifies. Returns the previous enabled exceptions if all exceptions are successfully set, otherwise returns -1. */ extern int feenableexcept (int __excepts) __THROW; /* Disable individual exceptions. Will not disable more exceptions than EXCEPTS specifies. Returns the previous enabled exceptions if all exceptions are successfully disabled, otherwise returns -1. */ extern int fedisableexcept (int __excepts) __THROW; /* Return enabled exceptions. */ extern int fegetexcept (void) __THROW; #endif __END_DECLS #endif /* fenv.h */ fmtmsg.h 0000644 00000006247 15063602065 0006226 0 ustar 00 /* Message display handling. Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __FMTMSG_H #define __FMTMSG_H 1 #include <features.h> __BEGIN_DECLS /* Values to control `fmtmsg' function. */ enum { MM_HARD = 0x001, /* Source of the condition is hardware. */ #define MM_HARD MM_HARD MM_SOFT = 0x002, /* Source of the condition is software. */ #define MM_SOFT MM_SOFT MM_FIRM = 0x004, /* Source of the condition is firmware. */ #define MM_FIRM MM_FIRM MM_APPL = 0x008, /* Condition detected by application. */ #define MM_APPL MM_APPL MM_UTIL = 0x010, /* Condition detected by utility. */ #define MM_UTIL MM_UTIL MM_OPSYS = 0x020, /* Condition detected by operating system. */ #define MM_OPSYS MM_OPSYS MM_RECOVER = 0x040, /* Recoverable error. */ #define MM_RECOVER MM_RECOVER MM_NRECOV = 0x080, /* Non-recoverable error. */ #define MM_NRECOV MM_NRECOV MM_PRINT = 0x100, /* Display message in standard error. */ #define MM_PRINT MM_PRINT MM_CONSOLE = 0x200 /* Display message on system console. */ #define MM_CONSOLE MM_CONSOLE }; /* Values to be for SEVERITY parameter of `fmtmsg'. */ enum { MM_NOSEV = 0, /* No severity level provided for the message. */ #define MM_NOSEV MM_NOSEV MM_HALT, /* Error causing application to halt. */ #define MM_HALT MM_HALT MM_ERROR, /* Application has encountered a non-fatal fault. */ #define MM_ERROR MM_ERROR MM_WARNING, /* Application has detected unusual non-error condition. */ #define MM_WARNING MM_WARNING MM_INFO /* Informative message. */ #define MM_INFO MM_INFO }; /* Macros which can be used as null values for the arguments of `fmtmsg'. */ #define MM_NULLLBL ((char *) 0) #define MM_NULLSEV 0 #define MM_NULLMC ((long int) 0) #define MM_NULLTXT ((char *) 0) #define MM_NULLACT ((char *) 0) #define MM_NULLTAG ((char *) 0) /* Possible return values of `fmtmsg'. */ enum { MM_NOTOK = -1, #define MM_NOTOK MM_NOTOK MM_OK = 0, #define MM_OK MM_OK MM_NOMSG = 1, #define MM_NOMSG MM_NOMSG MM_NOCON = 4 #define MM_NOCON MM_NOCON }; /* Print message with given CLASSIFICATION, LABEL, SEVERITY, TEXT, ACTION and TAG to console or standard error. */ extern int fmtmsg (long int __classification, const char *__label, int __severity, const char *__text, const char *__action, const char *__tag); #ifdef __USE_MISC /* Add or remove severity level. */ extern int addseverity (int __severity, const char *__string) __THROW; #endif __END_DECLS #endif /* fmtmsg.h */ fnmatch.h 0000644 00000004367 15063602065 0006352 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FNMATCH_H #define _FNMATCH_H 1 #ifdef __cplusplus extern "C" { #endif /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in <unistd.h>. */ #undef FNM_PATHNAME #undef FNM_NOESCAPE #undef FNM_PERIOD /* Bits set in the FLAGS argument to `fnmatch'. */ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ # define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ # define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */ #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ #define FNM_NOMATCH 1 /* This value is returned if the implementation does not support `fnmatch'. Since this is not the case here it will never be returned but the conformance test suites still require the symbol to be defined. */ #ifdef _XOPEN_SOURCE # define FNM_NOSYS (-1) #endif /* Match NAME against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch (const char *__pattern, const char *__name, int __flags); #ifdef __cplusplus } #endif #endif /* fnmatch.h */ fpu_control.h 0000644 00000006777 15063602065 0007273 0 ustar 00 /* FPU control word bits. x86 version. Copyright (C) 1993-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Olaf Flebbe. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _FPU_CONTROL_H #define _FPU_CONTROL_H 1 /* Note that this file sets on x86-64 only the x87 FPU, it does not touch the SSE unit. */ /* Here is the dirty part. Set up your 387 through the control word * (cw) register. * * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0 * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM * * IM: Invalid operation mask * DM: Denormalized operand mask * ZM: Zero-divide mask * OM: Overflow mask * UM: Underflow mask * PM: Precision (inexact result) mask * * Mask bit is 1 means no interrupt. * * PC: Precision control * 11 - round to extended precision * 10 - round to double precision * 00 - round to single precision * * RC: Rounding control * 00 - rounding to nearest * 01 - rounding down (toward - infinity) * 10 - rounding up (toward + infinity) * 11 - rounding toward zero * * IC: Infinity control * That is for 8087 and 80287 only. * * The hardware default is 0x037f which we use. */ #include <features.h> /* masking of interrupts */ #define _FPU_MASK_IM 0x01 #define _FPU_MASK_DM 0x02 #define _FPU_MASK_ZM 0x04 #define _FPU_MASK_OM 0x08 #define _FPU_MASK_UM 0x10 #define _FPU_MASK_PM 0x20 /* precision control */ #define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */ #define _FPU_DOUBLE 0x200 #define _FPU_SINGLE 0x0 /* rounding control */ #define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ #define _FPU_RC_DOWN 0x400 #define _FPU_RC_UP 0x800 #define _FPU_RC_ZERO 0xC00 #define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */ /* The fdlibm code requires strict IEEE double precision arithmetic, and no interrupts for exceptions, rounding to nearest. */ #define _FPU_DEFAULT 0x037f /* IEEE: same as above. */ #define _FPU_IEEE 0x037f /* Type of the control word. */ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); /* Macros for accessing the hardware control word. "*&" is used to work around a bug in older versions of GCC. __volatile__ is used to support combination of writing the control register and reading it back. Without __volatile__, the old value may be used for reading back under compiler optimization. Note that the use of these macros is not sufficient anymore with recent hardware nor on x86-64. Some floating point operations are executed in the SSE/SSE2 engines which have their own control and status register. */ #define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) #define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) /* Default control word set at startup. */ extern fpu_control_t __fpu_control; #endif /* fpu_control.h */ gshadow.h 0000644 00000010660 15063602065 0006357 0 ustar 00 /* Copyright (C) 2009-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Declaration of types and functions for shadow group suite. */ #ifndef _GSHADOW_H #define _GSHADOW_H 1 #include <features.h> #include <paths.h> #include <bits/types/FILE.h> #define __need_size_t #include <stddef.h> /* Path to the user database files. */ #define GSHADOW _PATH_GSHADOW __BEGIN_DECLS /* Structure of the group file. */ struct sgrp { char *sg_namp; /* Group name. */ char *sg_passwd; /* Encrypted password. */ char **sg_adm; /* Group administrator list. */ char **sg_mem; /* Group member list. */ }; /* Open database for reading. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void setsgent (void); /* Close database. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void endsgent (void); /* Get next entry from database, perhaps after opening the file. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *getsgent (void); /* Get shadow entry matching NAME. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *getsgnam (const char *__name); /* Read shadow entry from STRING. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *sgetsgent (const char *__string); /* Read next shadow entry from STREAM. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct sgrp *fgetsgent (FILE *__stream); /* Write line containing shadow password entry to stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int putsgent (const struct sgrp *__g, FILE *__stream); #ifdef __USE_MISC /* Reentrant versions of some of the functions above. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getsgent_r (struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); extern int getsgnam_r (const char *__name, struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); extern int sgetsgent_r (const char *__string, struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf, char *__buffer, size_t __buflen, struct sgrp **__result); #endif /* misc */ __END_DECLS #endif /* gshadow.h */ pcre2.h 0000644 00000127402 15063602065 0005741 0 ustar 00 /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ /* This is the public header file for the PCRE library, second API, to be #included by applications that call PCRE2 functions. Copyright (c) 2016-2018 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #ifndef PCRE2_H_IDEMPOTENT_GUARD #define PCRE2_H_IDEMPOTENT_GUARD /* The current PCRE version information. */ #define PCRE2_MAJOR 10 #define PCRE2_MINOR 32 #define PCRE2_PRERELEASE #define PCRE2_DATE 2018-09-10 /* For the benefit of systems without stdint.h, an alternative is to use inttypes.h. The existence of these headers is checked by configure or CMake. */ #define PCRE2_HAVE_STDINT_H 1 #define PCRE2_HAVE_INTTYPES_H 1 /* When an application links to a PCRE DLL in Windows, the symbols that are imported have to be identified as such. When building PCRE2, the appropriate export setting is defined in pcre2_internal.h, which includes this file. So we don't change existing definitions of PCRE2_EXP_DECL. */ #if defined(_WIN32) && !defined(PCRE2_STATIC) # ifndef PCRE2_EXP_DECL # define PCRE2_EXP_DECL extern __declspec(dllimport) # endif #endif /* By default, we use the standard "extern" declarations. */ #ifndef PCRE2_EXP_DECL # ifdef __cplusplus # define PCRE2_EXP_DECL extern "C" # else # define PCRE2_EXP_DECL extern # endif #endif /* When compiling with the MSVC compiler, it is sometimes necessary to include a "calling convention" before exported function names. (This is secondhand information; I know nothing about MSVC myself). For example, something like void __cdecl function(....) might be needed. In order so make this easy, all the exported functions have PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not set, we ensure here that it has no effect. */ #ifndef PCRE2_CALL_CONVENTION #define PCRE2_CALL_CONVENTION #endif /* Have to include limits.h, stdlib.h and stdint.h (or inttypes.h) to ensure that size_t and uint8_t, UCHAR_MAX, etc are defined. If the system has neither header, the relevant values must be provided by some other means. */ #include <limits.h> #include <stdlib.h> #if PCRE2_HAVE_STDINT_H #include <stdint.h> #elif PCRE2_HAVE_INTTYPES_H #include <inttypes.h> #endif /* Allow for C++ users compiling this directly. */ #ifdef __cplusplus extern "C" { #endif /* The following option bits can be passed to pcre2_compile(), pcre2_match(), or pcre2_dfa_match(). PCRE2_NO_UTF_CHECK affects only the function to which it is passed. Put these bits at the most significant end of the options word so others can be added next to them */ #define PCRE2_ANCHORED 0x80000000u #define PCRE2_NO_UTF_CHECK 0x40000000u #define PCRE2_ENDANCHORED 0x20000000u /* The following option bits can be passed only to pcre2_compile(). However, they may affect compilation, JIT compilation, and/or interpretive execution. The following tags indicate which: C alters what is compiled by pcre2_compile() J alters what is compiled by pcre2_jit_compile() M is inspected during pcre2_match() execution D is inspected during pcre2_dfa_match() execution */ #define PCRE2_ALLOW_EMPTY_CLASS 0x00000001u /* C */ #define PCRE2_ALT_BSUX 0x00000002u /* C */ #define PCRE2_AUTO_CALLOUT 0x00000004u /* C */ #define PCRE2_CASELESS 0x00000008u /* C */ #define PCRE2_DOLLAR_ENDONLY 0x00000010u /* J M D */ #define PCRE2_DOTALL 0x00000020u /* C */ #define PCRE2_DUPNAMES 0x00000040u /* C */ #define PCRE2_EXTENDED 0x00000080u /* C */ #define PCRE2_FIRSTLINE 0x00000100u /* J M D */ #define PCRE2_MATCH_UNSET_BACKREF 0x00000200u /* C J M */ #define PCRE2_MULTILINE 0x00000400u /* C */ #define PCRE2_NEVER_UCP 0x00000800u /* C */ #define PCRE2_NEVER_UTF 0x00001000u /* C */ #define PCRE2_NO_AUTO_CAPTURE 0x00002000u /* C */ #define PCRE2_NO_AUTO_POSSESS 0x00004000u /* C */ #define PCRE2_NO_DOTSTAR_ANCHOR 0x00008000u /* C */ #define PCRE2_NO_START_OPTIMIZE 0x00010000u /* J M D */ #define PCRE2_UCP 0x00020000u /* C J M D */ #define PCRE2_UNGREEDY 0x00040000u /* C */ #define PCRE2_UTF 0x00080000u /* C J M D */ #define PCRE2_NEVER_BACKSLASH_C 0x00100000u /* C */ #define PCRE2_ALT_CIRCUMFLEX 0x00200000u /* J M D */ #define PCRE2_ALT_VERBNAMES 0x00400000u /* C */ #define PCRE2_USE_OFFSET_LIMIT 0x00800000u /* J M D */ #define PCRE2_EXTENDED_MORE 0x01000000u /* C */ #define PCRE2_LITERAL 0x02000000u /* C */ /* An additional compile options word is available in the compile context. */ #define PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES 0x00000001u /* C */ #define PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL 0x00000002u /* C */ #define PCRE2_EXTRA_MATCH_WORD 0x00000004u /* C */ #define PCRE2_EXTRA_MATCH_LINE 0x00000008u /* C */ /* These are for pcre2_jit_compile(). */ #define PCRE2_JIT_COMPLETE 0x00000001u /* For full matching */ #define PCRE2_JIT_PARTIAL_SOFT 0x00000002u #define PCRE2_JIT_PARTIAL_HARD 0x00000004u /* These are for pcre2_match(), pcre2_dfa_match(), and pcre2_jit_match(). Note that PCRE2_ANCHORED and PCRE2_NO_UTF_CHECK can also be passed to these functions (though pcre2_jit_match() ignores the latter since it bypasses all sanity checks). */ #define PCRE2_NOTBOL 0x00000001u #define PCRE2_NOTEOL 0x00000002u #define PCRE2_NOTEMPTY 0x00000004u /* ) These two must be kept */ #define PCRE2_NOTEMPTY_ATSTART 0x00000008u /* ) adjacent to each other. */ #define PCRE2_PARTIAL_SOFT 0x00000010u #define PCRE2_PARTIAL_HARD 0x00000020u /* These are additional options for pcre2_dfa_match(). */ #define PCRE2_DFA_RESTART 0x00000040u #define PCRE2_DFA_SHORTEST 0x00000080u /* These are additional options for pcre2_substitute(), which passes any others through to pcre2_match(). */ #define PCRE2_SUBSTITUTE_GLOBAL 0x00000100u #define PCRE2_SUBSTITUTE_EXTENDED 0x00000200u #define PCRE2_SUBSTITUTE_UNSET_EMPTY 0x00000400u #define PCRE2_SUBSTITUTE_UNKNOWN_UNSET 0x00000800u #define PCRE2_SUBSTITUTE_OVERFLOW_LENGTH 0x00001000u /* A further option for pcre2_match(), not allowed for pcre2_dfa_match(), ignored for pcre2_jit_match(). */ #define PCRE2_NO_JIT 0x00002000u /* Options for pcre2_pattern_convert(). */ #define PCRE2_CONVERT_UTF 0x00000001u #define PCRE2_CONVERT_NO_UTF_CHECK 0x00000002u #define PCRE2_CONVERT_POSIX_BASIC 0x00000004u #define PCRE2_CONVERT_POSIX_EXTENDED 0x00000008u #define PCRE2_CONVERT_GLOB 0x00000010u #define PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR 0x00000030u #define PCRE2_CONVERT_GLOB_NO_STARSTAR 0x00000050u /* Newline and \R settings, for use in compile contexts. The newline values must be kept in step with values set in config.h and both sets must all be greater than zero. */ #define PCRE2_NEWLINE_CR 1 #define PCRE2_NEWLINE_LF 2 #define PCRE2_NEWLINE_CRLF 3 #define PCRE2_NEWLINE_ANY 4 #define PCRE2_NEWLINE_ANYCRLF 5 #define PCRE2_NEWLINE_NUL 6 #define PCRE2_BSR_UNICODE 1 #define PCRE2_BSR_ANYCRLF 2 /* Error codes for pcre2_compile(). Some of these are also used by pcre2_pattern_convert(). */ #define PCRE2_ERROR_END_BACKSLASH 101 #define PCRE2_ERROR_END_BACKSLASH_C 102 #define PCRE2_ERROR_UNKNOWN_ESCAPE 103 #define PCRE2_ERROR_QUANTIFIER_OUT_OF_ORDER 104 #define PCRE2_ERROR_QUANTIFIER_TOO_BIG 105 #define PCRE2_ERROR_MISSING_SQUARE_BRACKET 106 #define PCRE2_ERROR_ESCAPE_INVALID_IN_CLASS 107 #define PCRE2_ERROR_CLASS_RANGE_ORDER 108 #define PCRE2_ERROR_QUANTIFIER_INVALID 109 #define PCRE2_ERROR_INTERNAL_UNEXPECTED_REPEAT 110 #define PCRE2_ERROR_INVALID_AFTER_PARENS_QUERY 111 #define PCRE2_ERROR_POSIX_CLASS_NOT_IN_CLASS 112 #define PCRE2_ERROR_POSIX_NO_SUPPORT_COLLATING 113 #define PCRE2_ERROR_MISSING_CLOSING_PARENTHESIS 114 #define PCRE2_ERROR_BAD_SUBPATTERN_REFERENCE 115 #define PCRE2_ERROR_NULL_PATTERN 116 #define PCRE2_ERROR_BAD_OPTIONS 117 #define PCRE2_ERROR_MISSING_COMMENT_CLOSING 118 #define PCRE2_ERROR_PARENTHESES_NEST_TOO_DEEP 119 #define PCRE2_ERROR_PATTERN_TOO_LARGE 120 #define PCRE2_ERROR_HEAP_FAILED 121 #define PCRE2_ERROR_UNMATCHED_CLOSING_PARENTHESIS 122 #define PCRE2_ERROR_INTERNAL_CODE_OVERFLOW 123 #define PCRE2_ERROR_MISSING_CONDITION_CLOSING 124 #define PCRE2_ERROR_LOOKBEHIND_NOT_FIXED_LENGTH 125 #define PCRE2_ERROR_ZERO_RELATIVE_REFERENCE 126 #define PCRE2_ERROR_TOO_MANY_CONDITION_BRANCHES 127 #define PCRE2_ERROR_CONDITION_ASSERTION_EXPECTED 128 #define PCRE2_ERROR_BAD_RELATIVE_REFERENCE 129 #define PCRE2_ERROR_UNKNOWN_POSIX_CLASS 130 #define PCRE2_ERROR_INTERNAL_STUDY_ERROR 131 #define PCRE2_ERROR_UNICODE_NOT_SUPPORTED 132 #define PCRE2_ERROR_PARENTHESES_STACK_CHECK 133 #define PCRE2_ERROR_CODE_POINT_TOO_BIG 134 #define PCRE2_ERROR_LOOKBEHIND_TOO_COMPLICATED 135 #define PCRE2_ERROR_LOOKBEHIND_INVALID_BACKSLASH_C 136 #define PCRE2_ERROR_UNSUPPORTED_ESCAPE_SEQUENCE 137 #define PCRE2_ERROR_CALLOUT_NUMBER_TOO_BIG 138 #define PCRE2_ERROR_MISSING_CALLOUT_CLOSING 139 #define PCRE2_ERROR_ESCAPE_INVALID_IN_VERB 140 #define PCRE2_ERROR_UNRECOGNIZED_AFTER_QUERY_P 141 #define PCRE2_ERROR_MISSING_NAME_TERMINATOR 142 #define PCRE2_ERROR_DUPLICATE_SUBPATTERN_NAME 143 #define PCRE2_ERROR_INVALID_SUBPATTERN_NAME 144 #define PCRE2_ERROR_UNICODE_PROPERTIES_UNAVAILABLE 145 #define PCRE2_ERROR_MALFORMED_UNICODE_PROPERTY 146 #define PCRE2_ERROR_UNKNOWN_UNICODE_PROPERTY 147 #define PCRE2_ERROR_SUBPATTERN_NAME_TOO_LONG 148 #define PCRE2_ERROR_TOO_MANY_NAMED_SUBPATTERNS 149 #define PCRE2_ERROR_CLASS_INVALID_RANGE 150 #define PCRE2_ERROR_OCTAL_BYTE_TOO_BIG 151 #define PCRE2_ERROR_INTERNAL_OVERRAN_WORKSPACE 152 #define PCRE2_ERROR_INTERNAL_MISSING_SUBPATTERN 153 #define PCRE2_ERROR_DEFINE_TOO_MANY_BRANCHES 154 #define PCRE2_ERROR_BACKSLASH_O_MISSING_BRACE 155 #define PCRE2_ERROR_INTERNAL_UNKNOWN_NEWLINE 156 #define PCRE2_ERROR_BACKSLASH_G_SYNTAX 157 #define PCRE2_ERROR_PARENS_QUERY_R_MISSING_CLOSING 158 /* Error 159 is obsolete and should now never occur */ #define PCRE2_ERROR_VERB_ARGUMENT_NOT_ALLOWED 159 #define PCRE2_ERROR_VERB_UNKNOWN 160 #define PCRE2_ERROR_SUBPATTERN_NUMBER_TOO_BIG 161 #define PCRE2_ERROR_SUBPATTERN_NAME_EXPECTED 162 #define PCRE2_ERROR_INTERNAL_PARSED_OVERFLOW 163 #define PCRE2_ERROR_INVALID_OCTAL 164 #define PCRE2_ERROR_SUBPATTERN_NAMES_MISMATCH 165 #define PCRE2_ERROR_MARK_MISSING_ARGUMENT 166 #define PCRE2_ERROR_INVALID_HEXADECIMAL 167 #define PCRE2_ERROR_BACKSLASH_C_SYNTAX 168 #define PCRE2_ERROR_BACKSLASH_K_SYNTAX 169 #define PCRE2_ERROR_INTERNAL_BAD_CODE_LOOKBEHINDS 170 #define PCRE2_ERROR_BACKSLASH_N_IN_CLASS 171 #define PCRE2_ERROR_CALLOUT_STRING_TOO_LONG 172 #define PCRE2_ERROR_UNICODE_DISALLOWED_CODE_POINT 173 #define PCRE2_ERROR_UTF_IS_DISABLED 174 #define PCRE2_ERROR_UCP_IS_DISABLED 175 #define PCRE2_ERROR_VERB_NAME_TOO_LONG 176 #define PCRE2_ERROR_BACKSLASH_U_CODE_POINT_TOO_BIG 177 #define PCRE2_ERROR_MISSING_OCTAL_OR_HEX_DIGITS 178 #define PCRE2_ERROR_VERSION_CONDITION_SYNTAX 179 #define PCRE2_ERROR_INTERNAL_BAD_CODE_AUTO_POSSESS 180 #define PCRE2_ERROR_CALLOUT_NO_STRING_DELIMITER 181 #define PCRE2_ERROR_CALLOUT_BAD_STRING_DELIMITER 182 #define PCRE2_ERROR_BACKSLASH_C_CALLER_DISABLED 183 #define PCRE2_ERROR_QUERY_BARJX_NEST_TOO_DEEP 184 #define PCRE2_ERROR_BACKSLASH_C_LIBRARY_DISABLED 185 #define PCRE2_ERROR_PATTERN_TOO_COMPLICATED 186 #define PCRE2_ERROR_LOOKBEHIND_TOO_LONG 187 #define PCRE2_ERROR_PATTERN_STRING_TOO_LONG 188 #define PCRE2_ERROR_INTERNAL_BAD_CODE 189 #define PCRE2_ERROR_INTERNAL_BAD_CODE_IN_SKIP 190 #define PCRE2_ERROR_NO_SURROGATES_IN_UTF16 191 #define PCRE2_ERROR_BAD_LITERAL_OPTIONS 192 #define PCRE2_ERROR_SUPPORTED_ONLY_IN_UNICODE 193 #define PCRE2_ERROR_INVALID_HYPHEN_IN_OPTIONS 194 /* "Expected" matching error codes: no match and partial match. */ #define PCRE2_ERROR_NOMATCH (-1) #define PCRE2_ERROR_PARTIAL (-2) /* Error codes for UTF-8 validity checks */ #define PCRE2_ERROR_UTF8_ERR1 (-3) #define PCRE2_ERROR_UTF8_ERR2 (-4) #define PCRE2_ERROR_UTF8_ERR3 (-5) #define PCRE2_ERROR_UTF8_ERR4 (-6) #define PCRE2_ERROR_UTF8_ERR5 (-7) #define PCRE2_ERROR_UTF8_ERR6 (-8) #define PCRE2_ERROR_UTF8_ERR7 (-9) #define PCRE2_ERROR_UTF8_ERR8 (-10) #define PCRE2_ERROR_UTF8_ERR9 (-11) #define PCRE2_ERROR_UTF8_ERR10 (-12) #define PCRE2_ERROR_UTF8_ERR11 (-13) #define PCRE2_ERROR_UTF8_ERR12 (-14) #define PCRE2_ERROR_UTF8_ERR13 (-15) #define PCRE2_ERROR_UTF8_ERR14 (-16) #define PCRE2_ERROR_UTF8_ERR15 (-17) #define PCRE2_ERROR_UTF8_ERR16 (-18) #define PCRE2_ERROR_UTF8_ERR17 (-19) #define PCRE2_ERROR_UTF8_ERR18 (-20) #define PCRE2_ERROR_UTF8_ERR19 (-21) #define PCRE2_ERROR_UTF8_ERR20 (-22) #define PCRE2_ERROR_UTF8_ERR21 (-23) /* Error codes for UTF-16 validity checks */ #define PCRE2_ERROR_UTF16_ERR1 (-24) #define PCRE2_ERROR_UTF16_ERR2 (-25) #define PCRE2_ERROR_UTF16_ERR3 (-26) /* Error codes for UTF-32 validity checks */ #define PCRE2_ERROR_UTF32_ERR1 (-27) #define PCRE2_ERROR_UTF32_ERR2 (-28) /* Miscellaneous error codes for pcre2[_dfa]_match(), substring extraction functions, context functions, and serializing functions. They are in numerical order. Originally they were in alphabetical order too, but now that PCRE2 is released, the numbers must not be changed. */ #define PCRE2_ERROR_BADDATA (-29) #define PCRE2_ERROR_MIXEDTABLES (-30) /* Name was changed */ #define PCRE2_ERROR_BADMAGIC (-31) #define PCRE2_ERROR_BADMODE (-32) #define PCRE2_ERROR_BADOFFSET (-33) #define PCRE2_ERROR_BADOPTION (-34) #define PCRE2_ERROR_BADREPLACEMENT (-35) #define PCRE2_ERROR_BADUTFOFFSET (-36) #define PCRE2_ERROR_CALLOUT (-37) /* Never used by PCRE2 itself */ #define PCRE2_ERROR_DFA_BADRESTART (-38) #define PCRE2_ERROR_DFA_RECURSE (-39) #define PCRE2_ERROR_DFA_UCOND (-40) #define PCRE2_ERROR_DFA_UFUNC (-41) #define PCRE2_ERROR_DFA_UITEM (-42) #define PCRE2_ERROR_DFA_WSSIZE (-43) #define PCRE2_ERROR_INTERNAL (-44) #define PCRE2_ERROR_JIT_BADOPTION (-45) #define PCRE2_ERROR_JIT_STACKLIMIT (-46) #define PCRE2_ERROR_MATCHLIMIT (-47) #define PCRE2_ERROR_NOMEMORY (-48) #define PCRE2_ERROR_NOSUBSTRING (-49) #define PCRE2_ERROR_NOUNIQUESUBSTRING (-50) #define PCRE2_ERROR_NULL (-51) #define PCRE2_ERROR_RECURSELOOP (-52) #define PCRE2_ERROR_DEPTHLIMIT (-53) #define PCRE2_ERROR_RECURSIONLIMIT (-53) /* Obsolete synonym */ #define PCRE2_ERROR_UNAVAILABLE (-54) #define PCRE2_ERROR_UNSET (-55) #define PCRE2_ERROR_BADOFFSETLIMIT (-56) #define PCRE2_ERROR_BADREPESCAPE (-57) #define PCRE2_ERROR_REPMISSINGBRACE (-58) #define PCRE2_ERROR_BADSUBSTITUTION (-59) #define PCRE2_ERROR_BADSUBSPATTERN (-60) #define PCRE2_ERROR_TOOMANYREPLACE (-61) #define PCRE2_ERROR_BADSERIALIZEDDATA (-62) #define PCRE2_ERROR_HEAPLIMIT (-63) #define PCRE2_ERROR_CONVERT_SYNTAX (-64) #define PCRE2_ERROR_INTERNAL_DUPMATCH (-65) /* Request types for pcre2_pattern_info() */ #define PCRE2_INFO_ALLOPTIONS 0 #define PCRE2_INFO_ARGOPTIONS 1 #define PCRE2_INFO_BACKREFMAX 2 #define PCRE2_INFO_BSR 3 #define PCRE2_INFO_CAPTURECOUNT 4 #define PCRE2_INFO_FIRSTCODEUNIT 5 #define PCRE2_INFO_FIRSTCODETYPE 6 #define PCRE2_INFO_FIRSTBITMAP 7 #define PCRE2_INFO_HASCRORLF 8 #define PCRE2_INFO_JCHANGED 9 #define PCRE2_INFO_JITSIZE 10 #define PCRE2_INFO_LASTCODEUNIT 11 #define PCRE2_INFO_LASTCODETYPE 12 #define PCRE2_INFO_MATCHEMPTY 13 #define PCRE2_INFO_MATCHLIMIT 14 #define PCRE2_INFO_MAXLOOKBEHIND 15 #define PCRE2_INFO_MINLENGTH 16 #define PCRE2_INFO_NAMECOUNT 17 #define PCRE2_INFO_NAMEENTRYSIZE 18 #define PCRE2_INFO_NAMETABLE 19 #define PCRE2_INFO_NEWLINE 20 #define PCRE2_INFO_DEPTHLIMIT 21 #define PCRE2_INFO_RECURSIONLIMIT 21 /* Obsolete synonym */ #define PCRE2_INFO_SIZE 22 #define PCRE2_INFO_HASBACKSLASHC 23 #define PCRE2_INFO_FRAMESIZE 24 #define PCRE2_INFO_HEAPLIMIT 25 #define PCRE2_INFO_EXTRAOPTIONS 26 /* Request types for pcre2_config(). */ #define PCRE2_CONFIG_BSR 0 #define PCRE2_CONFIG_JIT 1 #define PCRE2_CONFIG_JITTARGET 2 #define PCRE2_CONFIG_LINKSIZE 3 #define PCRE2_CONFIG_MATCHLIMIT 4 #define PCRE2_CONFIG_NEWLINE 5 #define PCRE2_CONFIG_PARENSLIMIT 6 #define PCRE2_CONFIG_DEPTHLIMIT 7 #define PCRE2_CONFIG_RECURSIONLIMIT 7 /* Obsolete synonym */ #define PCRE2_CONFIG_STACKRECURSE 8 /* Obsolete */ #define PCRE2_CONFIG_UNICODE 9 #define PCRE2_CONFIG_UNICODE_VERSION 10 #define PCRE2_CONFIG_VERSION 11 #define PCRE2_CONFIG_HEAPLIMIT 12 #define PCRE2_CONFIG_NEVER_BACKSLASH_C 13 #define PCRE2_CONFIG_COMPILED_WIDTHS 14 /* Types for code units in patterns and subject strings. */ typedef uint8_t PCRE2_UCHAR8; typedef uint16_t PCRE2_UCHAR16; typedef uint32_t PCRE2_UCHAR32; typedef const PCRE2_UCHAR8 *PCRE2_SPTR8; typedef const PCRE2_UCHAR16 *PCRE2_SPTR16; typedef const PCRE2_UCHAR32 *PCRE2_SPTR32; /* The PCRE2_SIZE type is used for all string lengths and offsets in PCRE2, including pattern offsets for errors and subject offsets after a match. We define special values to indicate zero-terminated strings and unset offsets in the offset vector (ovector). */ #define PCRE2_SIZE size_t #define PCRE2_SIZE_MAX SIZE_MAX #define PCRE2_ZERO_TERMINATED (~(PCRE2_SIZE)0) #define PCRE2_UNSET (~(PCRE2_SIZE)0) /* Generic types for opaque structures and JIT callback functions. These declarations are defined in a macro that is expanded for each width later. */ #define PCRE2_TYPES_LIST \ struct pcre2_real_general_context; \ typedef struct pcre2_real_general_context pcre2_general_context; \ \ struct pcre2_real_compile_context; \ typedef struct pcre2_real_compile_context pcre2_compile_context; \ \ struct pcre2_real_match_context; \ typedef struct pcre2_real_match_context pcre2_match_context; \ \ struct pcre2_real_convert_context; \ typedef struct pcre2_real_convert_context pcre2_convert_context; \ \ struct pcre2_real_code; \ typedef struct pcre2_real_code pcre2_code; \ \ struct pcre2_real_match_data; \ typedef struct pcre2_real_match_data pcre2_match_data; \ \ struct pcre2_real_jit_stack; \ typedef struct pcre2_real_jit_stack pcre2_jit_stack; \ \ typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *); /* The structure for passing out data via the pcre_callout_function. We use a structure so that new fields can be added on the end in future versions, without changing the API of the function, thereby allowing old clients to work without modification. Define the generic version in a macro; the width-specific versions are generated from this macro below. */ /* Flags for the callout_flags field. These are cleared after a callout. */ #define PCRE2_CALLOUT_STARTMATCH 0x00000001u /* Set for each bumpalong */ #define PCRE2_CALLOUT_BACKTRACK 0x00000002u /* Set after a backtrack */ #define PCRE2_STRUCTURE_LIST \ typedef struct pcre2_callout_block { \ uint32_t version; /* Identifies version of block */ \ /* ------------------------ Version 0 ------------------------------- */ \ uint32_t callout_number; /* Number compiled into pattern */ \ uint32_t capture_top; /* Max current capture */ \ uint32_t capture_last; /* Most recently closed capture */ \ PCRE2_SIZE *offset_vector; /* The offset vector */ \ PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \ PCRE2_SPTR subject; /* The subject being matched */ \ PCRE2_SIZE subject_length; /* The length of the subject */ \ PCRE2_SIZE start_match; /* Offset to start of this match attempt */ \ PCRE2_SIZE current_position; /* Where we currently are in the subject */ \ PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \ PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \ /* ------------------- Added for Version 1 -------------------------- */ \ PCRE2_SIZE callout_string_offset; /* Offset to string within pattern */ \ PCRE2_SIZE callout_string_length; /* Length of string compiled into pattern */ \ PCRE2_SPTR callout_string; /* String compiled into pattern */ \ /* ------------------- Added for Version 2 -------------------------- */ \ uint32_t callout_flags; /* See above for list */ \ /* ------------------------------------------------------------------ */ \ } pcre2_callout_block; \ \ typedef struct pcre2_callout_enumerate_block { \ uint32_t version; /* Identifies version of block */ \ /* ------------------------ Version 0 ------------------------------- */ \ PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \ PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \ uint32_t callout_number; /* Number compiled into pattern */ \ PCRE2_SIZE callout_string_offset; /* Offset to string within pattern */ \ PCRE2_SIZE callout_string_length; /* Length of string compiled into pattern */ \ PCRE2_SPTR callout_string; /* String compiled into pattern */ \ /* ------------------------------------------------------------------ */ \ } pcre2_callout_enumerate_block; /* List the generic forms of all other functions in macros, which will be expanded for each width below. Start with functions that give general information. */ #define PCRE2_GENERAL_INFO_FUNCTIONS \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_config(uint32_t, void *); /* Functions for manipulating contexts. */ #define PCRE2_GENERAL_CONTEXT_FUNCTIONS \ PCRE2_EXP_DECL pcre2_general_context PCRE2_CALL_CONVENTION \ *pcre2_general_context_copy(pcre2_general_context *); \ PCRE2_EXP_DECL pcre2_general_context PCRE2_CALL_CONVENTION \ *pcre2_general_context_create(void *(*)(PCRE2_SIZE, void *), \ void (*)(void *, void *), void *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_general_context_free(pcre2_general_context *); #define PCRE2_COMPILE_CONTEXT_FUNCTIONS \ PCRE2_EXP_DECL pcre2_compile_context PCRE2_CALL_CONVENTION \ *pcre2_compile_context_copy(pcre2_compile_context *); \ PCRE2_EXP_DECL pcre2_compile_context PCRE2_CALL_CONVENTION \ *pcre2_compile_context_create(pcre2_general_context *);\ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_compile_context_free(pcre2_compile_context *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_bsr(pcre2_compile_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_character_tables(pcre2_compile_context *, const unsigned char *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_max_pattern_length(pcre2_compile_context *, PCRE2_SIZE); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_newline(pcre2_compile_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_parens_nest_limit(pcre2_compile_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_compile_recursion_guard(pcre2_compile_context *, \ int (*)(uint32_t, void *), void *); #define PCRE2_MATCH_CONTEXT_FUNCTIONS \ PCRE2_EXP_DECL pcre2_match_context PCRE2_CALL_CONVENTION \ *pcre2_match_context_copy(pcre2_match_context *); \ PCRE2_EXP_DECL pcre2_match_context PCRE2_CALL_CONVENTION \ *pcre2_match_context_create(pcre2_general_context *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_match_context_free(pcre2_match_context *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_callout(pcre2_match_context *, \ int (*)(pcre2_callout_block *, void *), void *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_depth_limit(pcre2_match_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_heap_limit(pcre2_match_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_match_limit(pcre2_match_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_offset_limit(pcre2_match_context *, PCRE2_SIZE); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_recursion_limit(pcre2_match_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_recursion_memory_management(pcre2_match_context *, \ void *(*)(PCRE2_SIZE, void *), void (*)(void *, void *), void *); #define PCRE2_CONVERT_CONTEXT_FUNCTIONS \ PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \ *pcre2_convert_context_copy(pcre2_convert_context *); \ PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \ *pcre2_convert_context_create(pcre2_general_context *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_convert_context_free(pcre2_convert_context *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_glob_escape(pcre2_convert_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_glob_separator(pcre2_convert_context *, uint32_t); /* Functions concerned with compiling a pattern to PCRE internal code. */ #define PCRE2_COMPILE_FUNCTIONS \ PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \ *pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \ pcre2_compile_context *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_code_free(pcre2_code *); \ PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \ *pcre2_code_copy(const pcre2_code *); \ PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \ *pcre2_code_copy_with_tables(const pcre2_code *); /* Functions that give information about a compiled pattern. */ #define PCRE2_PATTERN_INFO_FUNCTIONS \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_pattern_info(const pcre2_code *, uint32_t, void *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_callout_enumerate(const pcre2_code *, \ int (*)(pcre2_callout_enumerate_block *, void *), void *); /* Functions for running a match and inspecting the result. */ #define PCRE2_MATCH_FUNCTIONS \ PCRE2_EXP_DECL pcre2_match_data PCRE2_CALL_CONVENTION \ *pcre2_match_data_create(uint32_t, pcre2_general_context *); \ PCRE2_EXP_DECL pcre2_match_data PCRE2_CALL_CONVENTION \ *pcre2_match_data_create_from_pattern(const pcre2_code *, \ pcre2_general_context *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \ uint32_t, pcre2_match_data *, pcre2_match_context *, int *, PCRE2_SIZE); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \ uint32_t, pcre2_match_data *, pcre2_match_context *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_match_data_free(pcre2_match_data *); \ PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \ pcre2_get_mark(pcre2_match_data *); \ PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \ pcre2_get_ovector_count(pcre2_match_data *); \ PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \ *pcre2_get_ovector_pointer(pcre2_match_data *); \ PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \ pcre2_get_startchar(pcre2_match_data *); /* Convenience functions for handling matched substrings. */ #define PCRE2_SUBSTRING_FUNCTIONS \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_copy_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR *, \ PCRE2_SIZE *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_copy_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR *, \ PCRE2_SIZE *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_substring_free(PCRE2_UCHAR *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_get_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **, \ PCRE2_SIZE *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_get_bynumber(pcre2_match_data *, uint32_t, PCRE2_UCHAR **, \ PCRE2_SIZE *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_length_byname(pcre2_match_data *, PCRE2_SPTR, PCRE2_SIZE *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_length_bynumber(pcre2_match_data *, uint32_t, PCRE2_SIZE *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_nametable_scan(const pcre2_code *, PCRE2_SPTR, PCRE2_SPTR *, \ PCRE2_SPTR *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_number_from_name(const pcre2_code *, PCRE2_SPTR); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_substring_list_free(PCRE2_SPTR *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substring_list_get(pcre2_match_data *, PCRE2_UCHAR ***, PCRE2_SIZE **); /* Functions for serializing / deserializing compiled patterns. */ #define PCRE2_SERIALIZE_FUNCTIONS \ PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \ pcre2_serialize_encode(const pcre2_code **, int32_t, uint8_t **, \ PCRE2_SIZE *, pcre2_general_context *); \ PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \ pcre2_serialize_decode(pcre2_code **, int32_t, const uint8_t *, \ pcre2_general_context *); \ PCRE2_EXP_DECL int32_t PCRE2_CALL_CONVENTION \ pcre2_serialize_get_number_of_codes(const uint8_t *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_serialize_free(uint8_t *); /* Convenience function for match + substitute. */ #define PCRE2_SUBSTITUTE_FUNCTION \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_substitute(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \ uint32_t, pcre2_match_data *, pcre2_match_context *, PCRE2_SPTR, \ PCRE2_SIZE, PCRE2_UCHAR *, PCRE2_SIZE *); /* Functions for converting pattern source strings. */ #define PCRE2_CONVERT_FUNCTIONS \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_pattern_convert(PCRE2_SPTR, PCRE2_SIZE, uint32_t, PCRE2_UCHAR **, \ PCRE2_SIZE *, pcre2_convert_context *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_converted_pattern_free(PCRE2_UCHAR *); /* Functions for JIT processing */ #define PCRE2_JIT_FUNCTIONS \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_jit_compile(pcre2_code *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_jit_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \ uint32_t, pcre2_match_data *, pcre2_match_context *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_jit_free_unused_memory(pcre2_general_context *); \ PCRE2_EXP_DECL pcre2_jit_stack PCRE2_CALL_CONVENTION \ *pcre2_jit_stack_create(PCRE2_SIZE, PCRE2_SIZE, pcre2_general_context *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_jit_stack_assign(pcre2_match_context *, pcre2_jit_callback, void *); \ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_jit_stack_free(pcre2_jit_stack *); /* Other miscellaneous functions. */ #define PCRE2_OTHER_FUNCTIONS \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \ PCRE2_EXP_DECL const uint8_t PCRE2_CALL_CONVENTION \ *pcre2_maketables(pcre2_general_context *); \ /* Define macros that generate width-specific names from generic versions. The three-level macro scheme is necessary to get the macros expanded when we want them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for generating three versions of everything below. After that, PCRE2_SUFFIX will be re-defined to use PCRE2_CODE_UNIT_WIDTH, for use when macros such as pcre2_compile are called by application code. */ #define PCRE2_JOIN(a,b) a ## b #define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b) #define PCRE2_SUFFIX(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH) /* Data types */ #define PCRE2_UCHAR PCRE2_SUFFIX(PCRE2_UCHAR) #define PCRE2_SPTR PCRE2_SUFFIX(PCRE2_SPTR) #define pcre2_code PCRE2_SUFFIX(pcre2_code_) #define pcre2_jit_callback PCRE2_SUFFIX(pcre2_jit_callback_) #define pcre2_jit_stack PCRE2_SUFFIX(pcre2_jit_stack_) #define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_) #define pcre2_real_general_context PCRE2_SUFFIX(pcre2_real_general_context_) #define pcre2_real_compile_context PCRE2_SUFFIX(pcre2_real_compile_context_) #define pcre2_real_convert_context PCRE2_SUFFIX(pcre2_real_convert_context_) #define pcre2_real_match_context PCRE2_SUFFIX(pcre2_real_match_context_) #define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_) #define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_) /* Data blocks */ #define pcre2_callout_block PCRE2_SUFFIX(pcre2_callout_block_) #define pcre2_callout_enumerate_block PCRE2_SUFFIX(pcre2_callout_enumerate_block_) #define pcre2_general_context PCRE2_SUFFIX(pcre2_general_context_) #define pcre2_compile_context PCRE2_SUFFIX(pcre2_compile_context_) #define pcre2_convert_context PCRE2_SUFFIX(pcre2_convert_context_) #define pcre2_match_context PCRE2_SUFFIX(pcre2_match_context_) #define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_) /* Functions: the complete list in alphabetical order */ #define pcre2_callout_enumerate PCRE2_SUFFIX(pcre2_callout_enumerate_) #define pcre2_code_copy PCRE2_SUFFIX(pcre2_code_copy_) #define pcre2_code_copy_with_tables PCRE2_SUFFIX(pcre2_code_copy_with_tables_) #define pcre2_code_free PCRE2_SUFFIX(pcre2_code_free_) #define pcre2_compile PCRE2_SUFFIX(pcre2_compile_) #define pcre2_compile_context_copy PCRE2_SUFFIX(pcre2_compile_context_copy_) #define pcre2_compile_context_create PCRE2_SUFFIX(pcre2_compile_context_create_) #define pcre2_compile_context_free PCRE2_SUFFIX(pcre2_compile_context_free_) #define pcre2_config PCRE2_SUFFIX(pcre2_config_) #define pcre2_convert_context_copy PCRE2_SUFFIX(pcre2_convert_context_copy_) #define pcre2_convert_context_create PCRE2_SUFFIX(pcre2_convert_context_create_) #define pcre2_convert_context_free PCRE2_SUFFIX(pcre2_convert_context_free_) #define pcre2_converted_pattern_free PCRE2_SUFFIX(pcre2_converted_pattern_free_) #define pcre2_dfa_match PCRE2_SUFFIX(pcre2_dfa_match_) #define pcre2_general_context_copy PCRE2_SUFFIX(pcre2_general_context_copy_) #define pcre2_general_context_create PCRE2_SUFFIX(pcre2_general_context_create_) #define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_) #define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_) #define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_) #define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_) #define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_) #define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_) #define pcre2_jit_compile PCRE2_SUFFIX(pcre2_jit_compile_) #define pcre2_jit_match PCRE2_SUFFIX(pcre2_jit_match_) #define pcre2_jit_free_unused_memory PCRE2_SUFFIX(pcre2_jit_free_unused_memory_) #define pcre2_jit_stack_assign PCRE2_SUFFIX(pcre2_jit_stack_assign_) #define pcre2_jit_stack_create PCRE2_SUFFIX(pcre2_jit_stack_create_) #define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_) #define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_) #define pcre2_match PCRE2_SUFFIX(pcre2_match_) #define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_) #define pcre2_match_context_create PCRE2_SUFFIX(pcre2_match_context_create_) #define pcre2_match_context_free PCRE2_SUFFIX(pcre2_match_context_free_) #define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_) #define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_) #define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_) #define pcre2_pattern_convert PCRE2_SUFFIX(pcre2_pattern_convert_) #define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_) #define pcre2_serialize_decode PCRE2_SUFFIX(pcre2_serialize_decode_) #define pcre2_serialize_encode PCRE2_SUFFIX(pcre2_serialize_encode_) #define pcre2_serialize_free PCRE2_SUFFIX(pcre2_serialize_free_) #define pcre2_serialize_get_number_of_codes PCRE2_SUFFIX(pcre2_serialize_get_number_of_codes_) #define pcre2_set_bsr PCRE2_SUFFIX(pcre2_set_bsr_) #define pcre2_set_callout PCRE2_SUFFIX(pcre2_set_callout_) #define pcre2_set_character_tables PCRE2_SUFFIX(pcre2_set_character_tables_) #define pcre2_set_compile_extra_options PCRE2_SUFFIX(pcre2_set_compile_extra_options_) #define pcre2_set_compile_recursion_guard PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_) #define pcre2_set_depth_limit PCRE2_SUFFIX(pcre2_set_depth_limit_) #define pcre2_set_glob_escape PCRE2_SUFFIX(pcre2_set_glob_escape_) #define pcre2_set_glob_separator PCRE2_SUFFIX(pcre2_set_glob_separator_) #define pcre2_set_heap_limit PCRE2_SUFFIX(pcre2_set_heap_limit_) #define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_) #define pcre2_set_max_pattern_length PCRE2_SUFFIX(pcre2_set_max_pattern_length_) #define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_) #define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_) #define pcre2_set_offset_limit PCRE2_SUFFIX(pcre2_set_offset_limit_) #define pcre2_substitute PCRE2_SUFFIX(pcre2_substitute_) #define pcre2_substring_copy_byname PCRE2_SUFFIX(pcre2_substring_copy_byname_) #define pcre2_substring_copy_bynumber PCRE2_SUFFIX(pcre2_substring_copy_bynumber_) #define pcre2_substring_free PCRE2_SUFFIX(pcre2_substring_free_) #define pcre2_substring_get_byname PCRE2_SUFFIX(pcre2_substring_get_byname_) #define pcre2_substring_get_bynumber PCRE2_SUFFIX(pcre2_substring_get_bynumber_) #define pcre2_substring_length_byname PCRE2_SUFFIX(pcre2_substring_length_byname_) #define pcre2_substring_length_bynumber PCRE2_SUFFIX(pcre2_substring_length_bynumber_) #define pcre2_substring_list_get PCRE2_SUFFIX(pcre2_substring_list_get_) #define pcre2_substring_list_free PCRE2_SUFFIX(pcre2_substring_list_free_) #define pcre2_substring_nametable_scan PCRE2_SUFFIX(pcre2_substring_nametable_scan_) #define pcre2_substring_number_from_name PCRE2_SUFFIX(pcre2_substring_number_from_name_) /* Keep this old function name for backwards compatibility */ #define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_) /* Keep this obsolete function for backwards compatibility: it is now a noop. */ #define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_) /* Now generate all three sets of width-specific structures and function prototypes. */ #define PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS \ PCRE2_TYPES_LIST \ PCRE2_STRUCTURE_LIST \ PCRE2_GENERAL_INFO_FUNCTIONS \ PCRE2_GENERAL_CONTEXT_FUNCTIONS \ PCRE2_COMPILE_CONTEXT_FUNCTIONS \ PCRE2_CONVERT_CONTEXT_FUNCTIONS \ PCRE2_CONVERT_FUNCTIONS \ PCRE2_MATCH_CONTEXT_FUNCTIONS \ PCRE2_COMPILE_FUNCTIONS \ PCRE2_PATTERN_INFO_FUNCTIONS \ PCRE2_MATCH_FUNCTIONS \ PCRE2_SUBSTRING_FUNCTIONS \ PCRE2_SERIALIZE_FUNCTIONS \ PCRE2_SUBSTITUTE_FUNCTION \ PCRE2_JIT_FUNCTIONS \ PCRE2_OTHER_FUNCTIONS #define PCRE2_LOCAL_WIDTH 8 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS #undef PCRE2_LOCAL_WIDTH #define PCRE2_LOCAL_WIDTH 16 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS #undef PCRE2_LOCAL_WIDTH #define PCRE2_LOCAL_WIDTH 32 PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS #undef PCRE2_LOCAL_WIDTH /* Undefine the list macros; they are no longer needed. */ #undef PCRE2_TYPES_LIST #undef PCRE2_STRUCTURE_LIST #undef PCRE2_GENERAL_INFO_FUNCTIONS #undef PCRE2_GENERAL_CONTEXT_FUNCTIONS #undef PCRE2_COMPILE_CONTEXT_FUNCTIONS #undef PCRE2_CONVERT_CONTEXT_FUNCTIONS #undef PCRE2_MATCH_CONTEXT_FUNCTIONS #undef PCRE2_COMPILE_FUNCTIONS #undef PCRE2_PATTERN_INFO_FUNCTIONS #undef PCRE2_MATCH_FUNCTIONS #undef PCRE2_SUBSTRING_FUNCTIONS #undef PCRE2_SERIALIZE_FUNCTIONS #undef PCRE2_SUBSTITUTE_FUNCTION #undef PCRE2_JIT_FUNCTIONS #undef PCRE2_OTHER_FUNCTIONS #undef PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS /* PCRE2_CODE_UNIT_WIDTH must be defined. If it is 8, 16, or 32, redefine PCRE2_SUFFIX to use it. If it is 0, undefine the other macros and make PCRE2_SUFFIX a no-op. Otherwise, generate an error. */ #undef PCRE2_SUFFIX #ifndef PCRE2_CODE_UNIT_WIDTH #error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h. #error Use 8, 16, or 32; or 0 for a multi-width application. #else /* PCRE2_CODE_UNIT_WIDTH is defined */ #if PCRE2_CODE_UNIT_WIDTH == 8 || \ PCRE2_CODE_UNIT_WIDTH == 16 || \ PCRE2_CODE_UNIT_WIDTH == 32 #define PCRE2_SUFFIX(a) PCRE2_GLUE(a, PCRE2_CODE_UNIT_WIDTH) #elif PCRE2_CODE_UNIT_WIDTH == 0 #undef PCRE2_JOIN #undef PCRE2_GLUE #define PCRE2_SUFFIX(a) a #else #error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32. #endif #endif /* PCRE2_CODE_UNIT_WIDTH is defined */ #ifdef __cplusplus } /* extern "C" */ #endif #endif /* PCRE2_H_IDEMPOTENT_GUARD */ /* End of pcre2.h */ verto.h 0000644 00000045755 15063602065 0006077 0 ustar 00 /* * Copyright 2011 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef VERTO_H_ #define VERTO_H_ #include <time.h> /* For time_t */ #include <unistd.h> /* For pid_t */ #ifdef WIN32 #include <windows.h> typedef HANDLE verto_proc; typedef DWORD verto_proc_status; #else #include <sys/types.h> typedef pid_t verto_proc; typedef int verto_proc_status; #endif #define VERTO_SIG_IGN ((verto_callback *) 1) #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef struct verto_ctx verto_ctx; typedef struct verto_ev verto_ev; typedef enum { VERTO_EV_TYPE_NONE = 0, VERTO_EV_TYPE_IO = 1, VERTO_EV_TYPE_TIMEOUT = 1 << 1, VERTO_EV_TYPE_IDLE = 1 << 2, VERTO_EV_TYPE_SIGNAL = 1 << 3, VERTO_EV_TYPE_CHILD = 1 << 4 } verto_ev_type; typedef enum { VERTO_EV_FLAG_NONE = 0, VERTO_EV_FLAG_PERSIST = 1, VERTO_EV_FLAG_PRIORITY_LOW = 1 << 1, VERTO_EV_FLAG_PRIORITY_MEDIUM = 1 << 2, VERTO_EV_FLAG_PRIORITY_HIGH = 1 << 3, VERTO_EV_FLAG_IO_READ = 1 << 4, VERTO_EV_FLAG_IO_WRITE = 1 << 5, VERTO_EV_FLAG_IO_ERROR = 1 << 7, VERTO_EV_FLAG_IO_CLOSE_FD = 1 << 8, VERTO_EV_FLAG_REINITIABLE = 1 << 6, _VERTO_EV_FLAG_MUTABLE_MASK = VERTO_EV_FLAG_PRIORITY_LOW | VERTO_EV_FLAG_PRIORITY_MEDIUM | VERTO_EV_FLAG_PRIORITY_HIGH | VERTO_EV_FLAG_IO_READ | VERTO_EV_FLAG_IO_WRITE, _VERTO_EV_FLAG_MAX = VERTO_EV_FLAG_IO_CLOSE_FD } verto_ev_flag; typedef void (verto_callback)(verto_ctx *ctx, verto_ev *ev); /** * Creates a new event context using an optionally specified implementation * and/or optionally specified required features. * * If you are an application that has already decided on using a particular * event loop implementation, you should not call this function, but instead * import the verto-NAME.h header and link against the verto-NAME.so, where * NAME is the implementation you wish to use. * * If you are a library, you should generally avoid creating event contexts * on your own but allow applications to pass in a verto_ctx you can use. * * There are two cases where you should use this function. The first is * where you have a need to choose an implementation at run time, usually * for testing purposes. The second and more common is when you simply * wish to remain implementation agnostic. In this later case, you should * always call like this: verto_new(NULL, ...). This lets verto choose the best * implementation to use. * * If impl is not NULL, a new context is returned which is backed by the * implementation specified. If the implementation specified is not * available or if the required types (reqtypes) are not provided by the * named implementation, NULL is returned. The parameter 'impl' can specify: * * The full path to an implementation library * * The name of the implementation library (i.e. - "glib" or "libev") * * If impl is NULL, verto will attempt to automatically determine the * best implementation to use. * * First, verto will attempt to use an existing, previously loaded * implementation. This is handled automatically by internal caching of either * the first implementation loaded or the one specified by verto_set_default(). * * Second, verto will attempt to discern if you are already linked to any * of the supported implementations (to avoid wasting memory by loading * extra unnecessary libraries). If you are linked to one supported * implementation, that implementation will be chosen. If you are linked * to more than one supported implementation one of the ones linked to * will be chosen, but the order of the particular choice is undefined. * * Third, verto will attempt to load the compile-time default, if defined at * build time and available at runtime. * * Last, verto will attempt to load any implementation installed. The specific * order of this step is undefined. * * In all cases above, if the implementation does not support all the specified * features (reqtypes), it will be skipped and processing will continue from * where it left off. This means that if verto_new() returns non-NULL it is * guaranteed to support the features you specified. * * @see verto_set_default() * @param impl The implementation to use, or NULL. * @param reqtypes A bitwise or'd list of required event type features. * @return A new verto_ctx, or NULL on error. Call verto_free() when done. */ verto_ctx * verto_new(const char *impl, verto_ev_type reqtypes); /** * Gets the default event context using an optionally specified implementation. * * This function is essentially a singleton version of verto_new(). However, * since this function must return the same loop as the *_default() call of * the underlying implementation (if such a function exists), it is NOT a * global singleton, but a per-implementation singleton. For this reason, you * must call verto_free() when you are done with this loop. Even after calling * verto_free() on the default verto_ctx, you can safely call verto_default() * again and receive a new reference to the same (internally default) loop. * * In all other respects, verto_default() acts exactly like verto_new(). * * @see verto_new() * @see verto_free() * @param impl The implementation to use, or NULL. * @param reqtypes A bitwise or'd list of required event type features. * @return The default verto_ctx, or NULL on error. Call verto_free() when done. */ verto_ctx * verto_default(const char *impl, verto_ev_type reqtypes); /** * Sets the default implementation to use by its name. * * This function returns 1 on success and 0 on failure. It can fail for the * following reasons: * 1. The default implementation was already set via verto_set_default(). * 2. The implementation specified could not be found. * 3. The implementation specified didn't support the features specified. * 4. The impl argument was NULL. * 5. verto_new() was already called. * 6. verto_default() was already called. * 7. verto_new_NAME() was already called. * 8. verto_default_NAME() was already called. * 9. verto_convert_NAME() was already called. * * @see verto_new() * @see verto_default() * @param impl The implementation to use. * @param reqtypes A bitwise or'd list of required event type features. * @return The default verto_ctx, or NULL on error. Call verto_free() when done. */ int verto_set_default(const char *impl, verto_ev_type reqtypes); /** * Sets the allocator to use for verto_ctx and verto_ev objects. * * If you plan to set the allocator, you MUST call this function before any * other verto_*() calls. * * @see verto_new() * @see verto_default() * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @param resize The allocator to use (behaves like realloc(); * resize(ptr, 0) must free memory at ptr.) * @param hierarchical Zero if the allocator is not hierarchical */ int verto_set_allocator(void *(*resize)(void *mem, size_t size), int hierarchical); /** * Frees a verto_ctx. * * When called on a default verto_ctx, the reference will be freed but the * internal default loop will still be available via another call to * verto_default(). * * @see verto_new() * @see verto_default() * @param ctx The verto_ctx to free. */ void verto_free(verto_ctx *ctx); /** * Frees global state. * * Remove and free all allocated global state. Call only when no further * contexts exist and all threads have exited. * * @see verto_new() * @see verto_free() * @see verto_default() */ void verto_cleanup(void); /** * Run the verto_ctx forever, or at least until verto_break() is called. * * @see verto_break() * @param ctx The verto_ctx to run. */ void verto_run(verto_ctx *ctx); /** * Run the verto_ctx once. May block. * * @param ctx The verto_ctx to run once. */ void verto_run_once(verto_ctx *ctx); /** * Exits the currently running verto_ctx. * * @see verto_run() * @param ctx The verto_ctx to exit. */ void verto_break(verto_ctx *ctx); /** * Re-initializes the verto_ctx. * * This function deletes all events, except those which have set the * VERTO_EV_FLAG_REINITIABLE flag. If you fork(), you MUST call this in the * child process after the fork! * * If this function fails it indicates that at least one * VERTO_EV_FLAG_REINITIABLE event was not rearmed or that ctx was NULL. * * @see verto_new() * @see verto_default() * @param ctx The verto_ctx to re-initialize. * @return Non-zero on success, 0 on error. */ int verto_reinitialize(verto_ctx *ctx); /** * Adds a callback executed when a file descriptor is ready to be read/written. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * If VERTO_EV_FLAG_IO_CLOSE_FD is provided the passed in fd is automatically * closed when the event is freed with verto_del() * * NOTE: On Windows, the underlying select() only works with sockets. As such, * any attempt to add a non-socket io event on Windows will produce undefined * results and may even crash. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set (at least one VERTO_EV_FLAG_IO* required). * @param callback The callback to fire. * @param fd The file descriptor to watch for reads. * @return The verto_ev registered with the event context or NULL on error. */ verto_ev * verto_add_io(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, int fd); /** * Adds a callback executed after a period of time. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @param interval Time period to wait before firing (in milliseconds). * @return The verto_ev registered with the event context. */ verto_ev * verto_add_timeout(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, time_t interval); /** * Adds a callback executed when there is nothing else to do. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @return The verto_ev registered with the event context. */ verto_ev * verto_add_idle(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback); /** * Adds a callback executed when a signal is received. * * All verto_ev events are automatically freed when their parent verto_ctx is * freed. You do not need to free them manually. If VERTO_EV_FLAG_PERSIST is * provided, the event will repeat until verto_del() is called. If * VERTO_EV_FLAG_PERSIST is not provided, the event will be freed automatically * after its execution. In either case, you may call verto_del() at any time * to prevent the event from executing. * * NOTE: If you attempt to ignore a signal without the VERTO_EV_FLAG_PERSIST * flag, this function fails. * * NOTE: SIGCHLD is expressly not supported. If you want this notification, * please use verto_add_child(). * * WARNNIG: Signal events can only be reliably received in the default verto_ctx * in some implementations. Attempting to receive signal events in non-default * loops may result in assert() failures. * * WARNING: While verto does its best to protect you from crashes, there is * essentially no way to do signal events if you mix multiple implementations in * a single process. Attempting to do so will result in undefined behavior, * and potentially even a crash. You have been warned. * * @see verto_add_child() * @see verto_repeat() * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @param signal The signal to watch for. * @return The verto_ev registered with the event context. */ verto_ev * verto_add_signal(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, int signal); /** * Adds a callback executed when a child process exits. * * This event will be freed automatically after its execution. Due to the * nature of a process' life-cycle, child events cannot persist (processes only * exit once). This function returns NULL if you attempt to use * VERTO_EV_FLAG_PERSIST. You may, of course, call verto_del() at any time to * prevent the callback from firing. * * @see verto_del() * @param ctx The verto_ctx which will fire the callback. * @param flags The flags to set. * @param callback The callback to fire. * @param child The pid (POSIX) or handle (Win32) of the child to watch for. * @return The verto_ev registered with the event context. */ verto_ev * verto_add_child(verto_ctx *ctx, verto_ev_flag flags, verto_callback *callback, verto_proc proc); /** * Sets the private pointer of the verto_ev. * * The free callback will be called in two cases: * 1. When the event is deleted (manually or automatically) * 2. When verto_set_private() is called again, unless * free is NULL. * * @see verto_get_private() * @param ev The verto_ev * @param priv The private value to store * @param free The callback used to free the data or NULL */ void verto_set_private(verto_ev *ev, void *priv, verto_callback *free); /** * Gets the private pointer of the verto_ev. * * @see verto_set_private() * @param ev The verto_ev * @return The verto_ev private pointer */ void * verto_get_private(const verto_ev *ev); /** * Gets the type of the verto_ev. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @param ev The verto_ev * @return The verto_ev type */ verto_ev_type verto_get_type(const verto_ev *ev); /** * Gets the flags associated with the given verto_ev. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @see verto_set_flags() * @param ev The verto_ev * @return The verto_ev type */ verto_ev_flag verto_get_flags(const verto_ev *ev); /** * Sets the flags associated with the given verto_ev. * * See _VERTO_EV_FLAG_MUTABLE_MASK for the flags that can be changed * with this function. All others will be ignored. If the flags specified * are the same as the flags the event already has, this function is a no-op. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @see verto_get_flags() * @param ev The verto_ev * @param flags The flags for the event */ void verto_set_flags(verto_ev *ev, verto_ev_flag flags); /** * Gets the file descriptor associated with a read/write verto_ev. * * @see verto_add_io() * @param ev The verto_ev to retrieve the file descriptor from. * @return The file descriptor, or -1 if not a read/write event. */ int verto_get_fd(const verto_ev *ev); /** * Gets the file descriptor state from when the event fires. * * @see verto_add_io() * @param ev The verto_ev to retrieve the fd state from. * @return The fd state. */ verto_ev_flag verto_get_fd_state(const verto_ev *ev); /** * Gets the interval associated with a timeout verto_ev. * * @see verto_add_timeout() * @param ev The verto_ev to retrieve the interval from. * @return The interval, or 0 if not a timeout event. */ time_t verto_get_interval(const verto_ev *ev); /** * Gets the signal associated with a signal verto_ev. * * @see verto_add_signal() * @param ev The verto_ev to retrieve the signal from. * @return The signal, or -1 if not a signal event. */ int verto_get_signal(const verto_ev *ev); /** * Gets the process associated with a child verto_ev. * * @see verto_add_child() * @param ev The verto_ev to retrieve the process from. * @return The pid/handle, or 0/NULL if not a child event (POSIX/Win32). */ verto_proc verto_get_proc(const verto_ev *ev); /** * Gets the status of the process which caused this event to fire. * * @see verto_add_child() * @param ev The verto_ev to retrieve the status from. * @return The pid/handle status. */ verto_proc_status verto_get_proc_status(const verto_ev *ev); /** * Gets the verto_ctx associated with a verto_ev. * * This is a borrowed reference, don't attempt to free it! * * @param ev The verto_ev to retrieve the verto_ctx from. * @return The verto_ctx. */ verto_ctx * verto_get_ctx(const verto_ev *ev); /** * Removes an event from from the event context and frees it. * * The event and its contents cannot be used after this call. * * @see verto_add_io() * @see verto_add_timeout() * @see verto_add_idle() * @see verto_add_signal() * @see verto_add_child() * @param ev The event to delete. */ void verto_del(verto_ev *ev); /** * Returns the event types supported by this implementation. * * @param ctx The verto_ctx to query. * @return The event types supported. */ verto_ev_type verto_get_supported_types(verto_ctx *ctx); #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif /* VERTO_H_ */ gssrpc/auth.h 0000644 00000014510 15063602065 0007163 0 ustar 00 /* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * auth.h, Authentication interface. * * The data structures are completely opaque to the client. The client * is required to pass a AUTH * to routines that create rpc * "sessions". */ #ifndef GSSRPC_AUTH_H #define GSSRPC_AUTH_H #include <gssrpc/xdr.h> GSSRPC__BEGIN_DECLS #define MAX_AUTH_BYTES 400 #define MAXNETNAMELEN 255 /* maximum length of network user's name */ /* * Status returned from authentication check */ enum auth_stat { AUTH_OK=0, /* * failed at remote end */ AUTH_BADCRED=1, /* bogus credentials (seal broken) */ AUTH_REJECTEDCRED=2, /* client should begin new session */ AUTH_BADVERF=3, /* bogus verifier (seal broken) */ AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ AUTH_TOOWEAK=5, /* rejected due to security reasons */ /* * failed locally */ AUTH_INVALIDRESP=6, /* bogus response verifier */ AUTH_FAILED=7, /* some unknown reason */ /* * RPCSEC_GSS errors */ RPCSEC_GSS_CREDPROBLEM = 13, RPCSEC_GSS_CTXPROBLEM = 14 }; union des_block { char c[8]; }; typedef union des_block des_block; extern bool_t xdr_des_block(XDR *, des_block *); /* * Authentication info. Opaque to client. */ struct opaque_auth { enum_t oa_flavor; /* flavor of auth */ caddr_t oa_base; /* address of more auth stuff */ u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ }; /* * Auth handle, interface to client side authenticators. */ struct rpc_msg; typedef struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); /* nextverf & serialize */ int (*ah_marshal)(struct AUTH *, XDR *); /* validate varifier */ int (*ah_validate)(struct AUTH *, struct opaque_auth *); /* refresh credentials */ int (*ah_refresh)(struct AUTH *, struct rpc_msg *); /* destroy this structure */ void (*ah_destroy)(struct AUTH *); /* encode data for wire */ int (*ah_wrap)(struct AUTH *, XDR *, xdrproc_t, caddr_t); /* decode data from wire */ int (*ah_unwrap)(struct AUTH *, XDR *, xdrproc_t, caddr_t); } *ah_ops; void *ah_private; } AUTH; /* * Authentication ops. * The ops and the auth handle provide the interface to the authenticators. * * AUTH *auth; * XDR *xdrs; * struct opaque_auth verf; */ #define AUTH_NEXTVERF(auth) \ ((*((auth)->ah_ops->ah_nextverf))(auth)) #define auth_nextverf(auth) \ ((*((auth)->ah_ops->ah_nextverf))(auth)) #define AUTH_MARSHALL(auth, xdrs) \ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) #define auth_marshall(auth, xdrs) \ ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) #define AUTH_VALIDATE(auth, verfp) \ ((*((auth)->ah_ops->ah_validate))((auth), verfp)) #define auth_validate(auth, verfp) \ ((*((auth)->ah_ops->ah_validate))((auth), verfp)) #define AUTH_REFRESH(auth, msg) \ ((*((auth)->ah_ops->ah_refresh))(auth, msg)) #define auth_refresh(auth, msg) \ ((*((auth)->ah_ops->ah_refresh))(auth, msg)) #define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \ xfunc, xwhere)) #define auth_wrap(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \ xfunc, xwhere)) #define AUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \ xfunc, xwhere)) #define auth_unwrap(auth, xdrs, xfunc, xwhere) \ ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \ xfunc, xwhere)) #define AUTH_DESTROY(auth) \ ((*((auth)->ah_ops->ah_destroy))(auth)) #define auth_destroy(auth) \ ((*((auth)->ah_ops->ah_destroy))(auth)) #ifdef GSSRPC__IMPL /* RENAMED: should be _null_auth if we can use reserved namespace. */ extern struct opaque_auth gssrpc__null_auth; #endif /* * These are the various implementations of client side authenticators. */ /* * Unix style authentication * AUTH *authunix_create(machname, uid, gid, len, aup_gids) * char *machname; * int uid; * int gid; * int len; * int *aup_gids; */ extern AUTH *authunix_create(char *machname, int uid, int gid, int len, int *aup_gids); extern AUTH *authunix_create_default(void); /* takes no parameters */ extern AUTH *authnone_create(void); /* takes no parameters */ extern AUTH *authdes_create(); extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *); #define AUTH_NONE 0 /* no authentication */ #define AUTH_NULL 0 /* backward compatibility */ #define AUTH_UNIX 1 /* unix style (uid, gids) */ #define AUTH_SHORT 2 /* short hand unix style */ #define AUTH_DES 3 /* des style (encrypted timestamps) */ #define AUTH_GSSAPI 300001 /* GSS-API style */ #define RPCSEC_GSS 6 /* RPCSEC_GSS */ GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_H) */ gssrpc/auth_gss.h 0000644 00000011350 15063602065 0010036 0 ustar 00 /* include/gssrpc/auth_gss.h */ /* Copyright (c) 2000 The Regents of the University of Michigan. All rights reserved. Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>. All rights reserved, all wrongs reversed. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Id: auth_gss.h,v 1.13 2002/05/08 16:54:33 andros Exp */ #ifndef GSSRPC_AUTH_GSS_H #define GSSRPC_AUTH_GSS_H #include <gssrpc/rpc.h> #include <gssrpc/clnt.h> #ifdef HAVE_HEIMDAL #include <gssapi.h> #else #include <gssapi/gssapi.h> #endif GSSRPC__BEGIN_DECLS /* RPCSEC_GSS control procedures. */ typedef enum { RPCSEC_GSS_DATA = 0, RPCSEC_GSS_INIT = 1, RPCSEC_GSS_CONTINUE_INIT = 2, RPCSEC_GSS_DESTROY = 3 } rpc_gss_proc_t; /* RPCSEC_GSS services. */ typedef enum { RPCSEC_GSS_SVC_NONE = 1, RPCSEC_GSS_SVC_INTEGRITY = 2, RPCSEC_GSS_SVC_PRIVACY = 3 } rpc_gss_svc_t; #define RPCSEC_GSS_VERSION 1 /* RPCSEC_GSS security triple. */ struct rpc_gss_sec { gss_OID mech; /* mechanism */ gss_qop_t qop; /* quality of protection */ rpc_gss_svc_t svc; /* service */ gss_cred_id_t cred; /* cred handle */ uint32_t req_flags; /* req flags for init_sec_context */ }; /* Private data required for kernel implementation */ struct authgss_private_data { gss_ctx_id_t pd_ctx; /* Session context handle */ gss_buffer_desc pd_ctx_hndl; /* Credentials context handle */ uint32_t pd_seq_win; /* Sequence window */ }; /* Krb 5 default mechanism #define KRB5OID "1.2.840.113554.1.2.2" gss_OID_desc krb5oid = { 20, KRB5OID }; */ /* struct rpc_gss_sec krb5mech = { (gss_OID)&krb5oid, GSS_QOP_DEFAULT, RPCSEC_GSS_SVC_NONE }; */ /* Credentials. */ struct rpc_gss_cred { u_int gc_v; /* version */ rpc_gss_proc_t gc_proc; /* control procedure */ uint32_t gc_seq; /* sequence number */ rpc_gss_svc_t gc_svc; /* service */ gss_buffer_desc gc_ctx; /* context handle */ }; /* Context creation response. */ struct rpc_gss_init_res { gss_buffer_desc gr_ctx; /* context handle */ uint32_t gr_major; /* major status */ uint32_t gr_minor; /* minor status */ uint32_t gr_win; /* sequence window */ gss_buffer_desc gr_token; /* token */ }; /* Maximum sequence number value. */ #define MAXSEQ 0x80000000 /* Prototypes. */ bool_t xdr_rpc_gss_buf (XDR *xdrs, gss_buffer_t, u_int maxsize); bool_t xdr_rpc_gss_cred (XDR *xdrs, struct rpc_gss_cred *p); bool_t xdr_rpc_gss_init_args (XDR *xdrs, gss_buffer_desc *p); bool_t xdr_rpc_gss_init_res (XDR *xdrs, struct rpc_gss_init_res *p); bool_t xdr_rpc_gss_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_svc_t svc, uint32_t seq); bool_t xdr_rpc_gss_wrap_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_svc_t svc, uint32_t seq); bool_t xdr_rpc_gss_unwrap_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_svc_t svc, uint32_t seq); AUTH *authgss_create (CLIENT *, gss_name_t, struct rpc_gss_sec *); AUTH *authgss_create_default (CLIENT *, char *, struct rpc_gss_sec *); bool_t authgss_service (AUTH *auth, int svc); bool_t authgss_get_private_data (AUTH *auth, struct authgss_private_data *); #ifdef GSSRPC__IMPL void log_debug (const char *fmt, ...); void log_status (char *m, OM_uint32 major, OM_uint32 minor); void log_hexdump (const u_char *buf, int len, int offset); #endif GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_GSS_H) */ gssrpc/auth_gssapi.h 0000644 00000010355 15063602065 0010534 0 ustar 00 /* include/gssrpc/auth_gssapi.h - GSS-API style auth parameters for RPC */ /* * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved. */ #ifndef GSSRPC_AUTH_GSSAPI_H #define GSSRPC_AUTH_GSSAPI_H GSSRPC__BEGIN_DECLS #define AUTH_GSSAPI_EXIT 0 #define AUTH_GSSAPI_INIT 1 #define AUTH_GSSAPI_CONTINUE_INIT 2 #define AUTH_GSSAPI_MSG 3 #define AUTH_GSSAPI_DESTROY 4 /* * Yuck. Some sys/types.h files leak symbols */ #ifdef major #undef major #endif #ifdef minor #undef minor #endif typedef struct _auth_gssapi_name { char *name; gss_OID type; } auth_gssapi_name; typedef struct _auth_gssapi_creds { uint32_t version; bool_t auth_msg; gss_buffer_desc client_handle; } auth_gssapi_creds; typedef struct _auth_gssapi_init_arg { uint32_t version; gss_buffer_desc token; } auth_gssapi_init_arg; typedef struct _auth_gssapi_init_res { uint32_t version; gss_buffer_desc client_handle; OM_uint32 gss_major, gss_minor; gss_buffer_desc token; gss_buffer_desc signed_isn; } auth_gssapi_init_res; typedef void (*auth_gssapi_log_badauth_func) (OM_uint32 major, OM_uint32 minor, struct sockaddr_in *raddr, caddr_t data); /* auth_gssapi_log_badauth_func is IPv4-specific; this version gives the * transport handle so the fd can be used to get the address. */ typedef void (*auth_gssapi_log_badauth2_func) (OM_uint32 major, OM_uint32 minor, SVCXPRT *xprt, caddr_t data); typedef void (*auth_gssapi_log_badverf_func) (gss_name_t client, gss_name_t server, struct svc_req *rqst, struct rpc_msg *msg, caddr_t data); typedef void (*auth_gssapi_log_miscerr_func) (struct svc_req *rqst, struct rpc_msg *msg, char *error, caddr_t data); bool_t xdr_gss_buf(XDR *, gss_buffer_t); bool_t xdr_authgssapi_creds(XDR *, auth_gssapi_creds *); bool_t xdr_authgssapi_init_arg(XDR *, auth_gssapi_init_arg *); bool_t xdr_authgssapi_init_res(XDR *, auth_gssapi_init_res *); bool_t auth_gssapi_wrap_data (OM_uint32 *major, OM_uint32 *minor, gss_ctx_id_t context, uint32_t seq_num, XDR *out_xdrs, bool_t (*xdr_func)(), caddr_t xdr_ptr); bool_t auth_gssapi_unwrap_data (OM_uint32 *major, OM_uint32 *minor, gss_ctx_id_t context, uint32_t seq_num, XDR *in_xdrs, bool_t (*xdr_func)(), caddr_t xdr_ptr); AUTH *auth_gssapi_create (CLIENT *clnt, OM_uint32 *major_status, OM_uint32 *minor_status, gss_cred_id_t claimant_cred_handle, gss_name_t target_name, gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req, gss_OID *actual_mech_type, OM_uint32 *ret_flags, OM_uint32 *time_rec); AUTH *auth_gssapi_create_default (CLIENT *clnt, char *service_name); void auth_gssapi_display_status (char *msg, OM_uint32 major, OM_uint32 minor); bool_t auth_gssapi_seal_seq (gss_ctx_id_t context, uint32_t seq_num, gss_buffer_t out_buf); bool_t auth_gssapi_unseal_seq (gss_ctx_id_t context, gss_buffer_t in_buf, uint32_t *seq_num); bool_t svcauth_gssapi_set_names (auth_gssapi_name *names, int num); void svcauth_gssapi_unset_names (void); void svcauth_gssapi_set_log_badauth_func (auth_gssapi_log_badauth_func func, caddr_t data); void svcauth_gssapi_set_log_badauth2_func (auth_gssapi_log_badauth2_func func, caddr_t data); void svcauth_gssapi_set_log_badverf_func (auth_gssapi_log_badverf_func func, caddr_t data); void svcauth_gssapi_set_log_miscerr_func (auth_gssapi_log_miscerr_func func, caddr_t data); void svcauth_gss_set_log_badauth_func(auth_gssapi_log_badauth_func, caddr_t); void svcauth_gss_set_log_badauth2_func(auth_gssapi_log_badauth2_func, caddr_t); void svcauth_gss_set_log_badverf_func(auth_gssapi_log_badverf_func, caddr_t); void svcauth_gss_set_log_miscerr_func(auth_gssapi_log_miscerr_func, caddr_t data); #define GSS_COPY_BUFFER(dest, src) { \ (dest).length = (src).length; \ (dest).value = (src).value; } #define GSS_DUP_BUFFER(dest, src) { \ (dest).length = (src).length; \ (dest).value = (void *) malloc((dest).length); \ memcpy((dest).value, (src).value, (dest).length); } #define GSS_BUFFERS_EQUAL(b1, b2) (((b1).length == (b2).length) && \ !memcmp((b1).value,(b2).value,(b1.length))) GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_GSSAPI_H) */ gssrpc/auth_unix.h 0000644 00000005520 15063602065 0010227 0 ustar 00 /* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)auth_unix.h 1.5 86/07/16 SMI */ /* * auth_unix.h, Protocol for UNIX style authentication parameters for RPC */ #ifndef GSSRPC_AUTH_UNIX_H #define GSSRPC_AUTH_UNIX_H GSSRPC__BEGIN_DECLS /* * The system is very weak. The client uses no encryption for it * credentials and only sends null verifiers. The server sends backs * null verifiers or optionally a verifier that suggests a new short hand * for the credentials. */ /* The machine name is part of a credential; it may not exceed 255 bytes */ #define MAX_MACHINE_NAME 255 /* gids compose part of a credential; there may not be more than 16 of them */ #define NGRPS 16 /* * Unix style credentials. */ struct authunix_parms { uint32_t aup_time; char *aup_machname; int aup_uid; int aup_gid; u_int aup_len; int *aup_gids; }; extern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *); /* * If a response verifier has flavor AUTH_SHORT, * then the body of the response verifier encapsulates the following structure; * again it is serialized in the obvious fashion. */ struct short_hand_verf { struct opaque_auth new_cred; }; GSSRPC__END_DECLS #endif /* !defined(GSSRPC_AUTH_UNIX_H) */ gssrpc/clnt.h 0000644 00000022664 15063602065 0007173 0 ustar 00 /* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * clnt.h - Client side remote procedure call interface. */ #ifndef GSSRPC_CLNT_H #define GSSRPC_CLNT_H GSSRPC__BEGIN_DECLS /* * Rpc calls return an enum clnt_stat. This should be looked at more, * since each implementation is required to live with this (implementation * independent) list of errors. */ enum clnt_stat { RPC_SUCCESS=0, /* call succeeded */ /* * local errors */ RPC_CANTENCODEARGS=1, /* can't encode arguments */ RPC_CANTDECODERES=2, /* can't decode results */ RPC_CANTSEND=3, /* failure in sending call */ RPC_CANTRECV=4, /* failure in receiving result */ RPC_TIMEDOUT=5, /* call timed out */ /* * remote errors */ RPC_VERSMISMATCH=6, /* rpc versions not compatible */ RPC_AUTHERROR=7, /* authentication error */ RPC_PROGUNAVAIL=8, /* program not available */ RPC_PROGVERSMISMATCH=9, /* program version mismatched */ RPC_PROCUNAVAIL=10, /* procedure unavailable */ RPC_CANTDECODEARGS=11, /* decode arguments error */ RPC_SYSTEMERROR=12, /* generic "other problem" */ /* * callrpc & clnt_create errors */ RPC_UNKNOWNHOST=13, /* unknown host name */ RPC_UNKNOWNPROTO=17, /* unknown protocol */ /* * _ create errors */ RPC_PMAPFAILURE=14, /* the pmapper failed in its call */ RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ /* * unspecified error */ RPC_FAILED=16 }; /* * Error info. */ struct rpc_err { enum clnt_stat re_status; union { int RE_errno; /* realated system error */ enum auth_stat RE_why; /* why the auth error occurred */ struct { rpcvers_t low; /* lowest verion supported */ rpcvers_t high; /* highest verion supported */ } RE_vers; struct { /* maybe meaningful if RPC_FAILED */ int32_t s1; int32_t s2; } RE_lb; /* life boot & debugging only */ } ru; #define re_errno ru.RE_errno #define re_why ru.RE_why #define re_vers ru.RE_vers #define re_lb ru.RE_lb }; /* * Client rpc handle. * Created by individual implementations, see e.g. rpc_udp.c. * Client is responsible for initializing auth, see e.g. auth_none.c. */ typedef struct CLIENT { AUTH *cl_auth; /* authenticator */ struct clnt_ops { /* call remote procedure */ enum clnt_stat (*cl_call)(struct CLIENT *, rpcproc_t, xdrproc_t, void *, xdrproc_t, void *, struct timeval); /* abort a call */ void (*cl_abort)(struct CLIENT *); /* get specific error code */ void (*cl_geterr)(struct CLIENT *, struct rpc_err *); /* frees results */ bool_t (*cl_freeres)(struct CLIENT *, xdrproc_t, void *); /* destroy this structure */ void (*cl_destroy)(struct CLIENT *); /* the ioctl() of rpc */ /* XXX CITI makes 2nd arg take u_int */ bool_t (*cl_control)(struct CLIENT *, int, void *); } *cl_ops; void *cl_private; /* private stuff */ } CLIENT; /* * client side rpc interface ops * * Parameter types are: * */ /* * enum clnt_stat * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) * CLIENT *rh; * rpcproc_t proc; * xdrproc_t xargs; * caddr_t argsp; * xdrproc_t xres; * caddr_t resp; * struct timeval timeout; */ #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) /* * void * CLNT_ABORT(rh); * CLIENT *rh; */ #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) /* * struct rpc_err * CLNT_GETERR(rh); * CLIENT *rh; */ #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) /* * bool_t * CLNT_FREERES(rh, xres, resp); * CLIENT *rh; * xdrproc_t xres; * caddr_t resp; */ #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) /* * bool_t * CLNT_CONTROL(cl, request, info) * CLIENT *cl; * u_int request; * char *info; */ #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* * control operations that apply to both udp and tcp transports */ #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ /* * udp only control operations */ #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ /* * new control operations */ #define CLGET_LOCAL_ADDR 6 /* get local address (sockaddr, getsockname)*/ /* * void * CLNT_DESTROY(rh); * CLIENT *rh; */ #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) /* * RPCTEST is a test program which is accessable on every rpc * transport/port. It is used for testing, performance evaluation, * and network administration. */ #define RPCTEST_PROGRAM ((rpcprog_t)1) #define RPCTEST_VERSION ((rpcvers_t)1) #define RPCTEST_NULL_PROC ((rpcproc_t)2) #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) /* * By convention, procedure 0 takes null arguments and returns them */ #define NULLPROC ((rpcproc_t)0) /* * Below are the client handle creation routines for the various * implementations of client side rpc. They can return NULL if a * creation failure occurs. */ /* * Memory based rpc (for speed check and testing) * CLIENT * * clntraw_create(prog, vers) * rpcprog_t prog; * rpcvers_t vers; */ extern CLIENT *clntraw_create(rpcprog_t, rpcvers_t); /* * Generic client creation routine. Supported protocols are "udp" and "tcp" */ extern CLIENT *clnt_create(char *, rpcprog_t, rpcvers_t, char *); /* * TCP based rpc * CLIENT * * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) * struct sockaddr_in *raddr; * rpcprog_t prog; * rpcvers_t version; * int *sockp; * u_int sendsz; * u_int recvsz; */ extern CLIENT *clnttcp_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, int *, u_int, u_int); /* * UDP based rpc. * CLIENT * * clntudp_create(raddr, program, version, wait, sockp) * struct sockaddr_in *raddr; * rpcprog_t program; * rpcvers_t version; * struct timeval wait; * int *sockp; * * Same as above, but you specify max packet sizes. * CLIENT * * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) * struct sockaddr_in *raddr; * rpcprog_t program; * rpcvers_t version; * struct timeval wait; * int *sockp; * u_int sendsz; * u_int recvsz; */ extern CLIENT *clntudp_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, struct timeval, int *); extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, rpcprog_t, rpcvers_t, struct timeval, int *, u_int, u_int); /* * Print why creation failed */ void clnt_pcreateerror(char *); /* stderr */ char *clnt_spcreateerror(char *); /* string */ /* * Like clnt_perror(), but is more verbose in its output */ void clnt_perrno(enum clnt_stat); /* stderr */ /* * Print an English error message, given the client error code */ void clnt_perror(CLIENT *, char *); /* stderr */ char *clnt_sperror(CLIENT *, char *); /* string */ /* * If a creation fails, the following allows the user to figure out why. */ struct rpc_createerr { enum clnt_stat cf_stat; struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ }; extern struct rpc_createerr rpc_createerr; /* * Copy error message to buffer. */ char *clnt_sperrno(enum clnt_stat num); /* string */ #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ GSSRPC__END_DECLS #endif /* !defined(GSSRPC_CLNT_H) */ gssrpc/netdb.h 0000644 00000004612 15063602065 0007320 0 ustar 00 /* include/gssrpc/netdb.h */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */ /* @(#)rpc.h 1.8 87/07/24 SMI */ #ifndef RPC_NETDB_H #define RPC_NETDB_H #include <gssrpc/types.h> /* since the gssrpc library requires that any application using it be built with these header files, I am making the decision that any app which uses the rpcent routines must use this header file, or something compatible (which most <netdb.h> are) --marc */ /* Really belongs in <netdb.h> */ #ifdef STRUCT_RPCENT_IN_RPC_NETDB_H struct rpcent { char *r_name; /* name of server for this rpc program */ char **r_aliases; /* alias list */ int r_number; /* rpc program number */ }; #endif /*STRUCT_RPCENT_IN_RPC_NETDB_H*/ struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); #endif gssrpc/pmap_clnt.h 0000644 00000006545 15063602065 0010210 0 ustar 00 /* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * pmap_clnt.h * Supplies C routines to get to portmap services. */ #ifndef GSSRPC_PMAP_CLNT_H #define GSSRPC_PMAP_CLNT_H /* * Usage: * success = pmap_set(program, version, protocol, port); * success = pmap_unset(program, version); * port = pmap_getport(address, program, version, protocol); * head = pmap_getmaps(address); * clnt_stat = pmap_rmtcall(address, program, version, procedure, * xdrargs, argsp, xdrres, resp, tout, port_ptr) * (works for udp only.) * clnt_stat = clnt_broadcast(program, version, procedure, * xdrargs, argsp, xdrres, resp, eachresult) * (like pmap_rmtcall, except the call is broadcasted to all * locally connected nets. For each valid response received, * the procedure eachresult is called. Its form is: * done = eachresult(resp, raddr) * bool_t done; * caddr_t resp; * struct sockaddr_in raddr; * where resp points to the results of the call and raddr is the * address if the responder to the broadcast. */ GSSRPC__BEGIN_DECLS extern bool_t pmap_set(rpcprog_t, rpcvers_t, rpcprot_t, u_int); extern bool_t pmap_unset(rpcprog_t, rpcvers_t); extern struct pmaplist *pmap_getmaps(struct sockaddr_in *); enum clnt_stat pmap_rmtcall(struct sockaddr_in *, rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t, caddr_t, struct timeval, rpcport_t *); typedef bool_t (*resultproc_t)(caddr_t, struct sockaddr_in *); enum clnt_stat clnt_broadcast(rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t, caddr_t, resultproc_t); extern u_short pmap_getport(struct sockaddr_in *, rpcprog_t, rpcvers_t, rpcprot_t); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_PMAP_CLNT_H) */ gssrpc/pmap_prot.h 0000644 00000007401 15063602065 0010224 0 ustar 00 /* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * pmap_prot.h * Protocol for the local binder service, or pmap. * * The following procedures are supported by the protocol: * * PMAPPROC_NULL() returns () * takes nothing, returns nothing * * PMAPPROC_SET(struct pmap) returns (bool_t) * TRUE is success, FALSE is failure. Registers the tuple * [prog, vers, prot, port]. * * PMAPPROC_UNSET(struct pmap) returns (bool_t) * TRUE is success, FALSE is failure. Un-registers pair * [prog, vers]. prot and port are ignored. * * PMAPPROC_GETPORT(struct pmap) returns (u_short). * 0 is failure. Otherwise returns the port number where the pair * [prog, vers] is registered. It may lie! * * PMAPPROC_DUMP() RETURNS (struct pmaplist *) * * PMAPPROC_CALLIT(rpcprog_t, rpcvers_t, rpcproc_t, string<>) * RETURNS (port, string<>); * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); * Calls the procedure on the local machine. If it is not registered, * this procedure is quite; ie it does not return error information!!! * This procedure only is supported on rpc/udp and calls via * rpc/udp. This routine only passes null authentication parameters. * This file has no interface to xdr routines for PMAPPROC_CALLIT. * * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. */ #ifndef GSSRPC_PMAP_PROT_H #define GSSRPC_PMAP_PROT_H GSSRPC__BEGIN_DECLS #define PMAPPORT ((u_short)111) #define PMAPPROG ((rpcprog_t)100000) #define PMAPVERS ((rpcvers_t)2) #define PMAPVERS_PROTO ((rpcprot_t)2) #define PMAPVERS_ORIG ((rpcvers_t)1) #define PMAPPROC_NULL ((rpcproc_t)0) #define PMAPPROC_SET ((rpcproc_t)1) #define PMAPPROC_UNSET ((rpcproc_t)2) #define PMAPPROC_GETPORT ((rpcproc_t)3) #define PMAPPROC_DUMP ((rpcproc_t)4) #define PMAPPROC_CALLIT ((rpcproc_t)5) struct pmap { rpcprog_t pm_prog; rpcvers_t pm_vers; rpcprot_t pm_prot; rpcport_t pm_port; }; extern bool_t xdr_pmap(XDR *, struct pmap *); struct pmaplist { struct pmap pml_map; struct pmaplist *pml_next; }; extern bool_t xdr_pmaplist(XDR *, struct pmaplist **); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_PMAP_PROT_H) */ gssrpc/pmap_rmt.h 0000644 00000004377 15063602065 0010053 0 ustar 00 /* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Structures and XDR routines for parameters to and replies from * the portmapper remote-call-service. */ #ifndef GSSRPC_PMAP_RMT_H #define GSSRPC_PMAP_RMT_H GSSRPC__BEGIN_DECLS struct rmtcallargs { rpcprog_t prog; rpcvers_t vers; rpcproc_t proc; uint32_t arglen; caddr_t args_ptr; xdrproc_t xdr_args; }; bool_t xdr_rmtcall_args(XDR *, struct rmtcallargs *); struct rmtcallres { rpcport_t *port_ptr; uint32_t resultslen; caddr_t results_ptr; xdrproc_t xdr_results; }; bool_t xdr_rmtcallres(XDR *, struct rmtcallres *); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_PMAP_RMT_H) */ gssrpc/rename.h 0000644 00000024030 15063602065 0007467 0 ustar 00 /* include/gssrpc/rename.h */ /* * Copyright (C) 2004 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * * Namespace mangling for various purposes. * * Symbols in the object code need to be renamed to not conflict with * an OS-provided RPC implementation. Without renaming, the conflicts * can cause problems with things like RPC-enabled NSS * implementations. * * Symbols in headers should not conflict with implementation-reserved * namespace (prefixes "_[A-Z_]" for any purpose; prefix "_" * for file scope identifiers and tag names), or unnecessarily impinge * on user namespace. * * The renaming of the header directory is done to avoid problems when * the OS header files include <rpc/foo.h> and might get ours instead. * OS vendors should replace all the <gssrpc/foo.h> inclusions with * <rpc/foo.h> inclusions, as appropriate. Additionally, vendors * should probably put some symbols into the implementation namespace. * * For example, inclusion protection should change from "GSSRPC_*_H" * to "_RPC_*_H", struct tags should get "__" prefixes, etc. * * This implementation reserves the object code prefix "gssrpc_". * External names in the RPC API not beginning with "_" get renamed * with the prefix "gssrpc_" via #define, e.g., "foo" -> "gssrpc_foo". * External names in the RPC API beginning with "_" get textually * rewritten. */ #ifndef GSSRPC_RENAME_H #define GSSRPC_RENAME_H /* auth.h */ #define xdr_des_block gssrpc_xdr_des_block #define authany_wrap gssrpc_authany_wrap #define authany_unwrap gssrpc_authany_unwrap #define authunix_create gssrpc_authunix_create #define authunix_create_default gssrpc_authunix_create_default #define authnone_create gssrpc_authnone_create #define authdes_create gssrpc_authdes_create #define xdr_opaque_auth gssrpc_xdr_opaque_auth /* auth_gss.c */ #define auth_debug_gss gssrpc_auth_debug_gss #define misc_debug_gss gssrpc_misc_debug_gss /* auth_gss.h */ #define xdr_rpc_gss_buf gssrpc_xdr_rpc_gss_buf #define xdr_rpc_gss_cred gssrpc_xdr_rpc_gss_cred #define xdr_rpc_gss_init_args gssrpc_xdr_rpc_gss_init_args #define xdr_rpc_gss_init_res gssrpc_xdr_rpc_gss_init_res #define xdr_rpc_gss_data gssrpc_xdr_rpc_gss_data #define xdr_rpc_gss_wrap_data gssrpc_xdr_rpc_gss_wrap_data #define xdr_rpc_gss_unwrap_data gssrpc_xdr_rpc_gss_unwrap_data #define authgss_create gssrpc_authgss_create #define authgss_create_default gssrpc_authgss_create_default #define authgss_get_private_data gssrpc_authgss_get_private_data #define authgss_service gssrpc_authgss_service #ifdef GSSRPC__IMPL #define log_debug gssrpc_log_debug #define log_status gssrpc_log_status #define log_hexdump gssrpc_log_hexdump #endif /* auth_gssapi.c */ #define auth_debug_gssapi gssrpc_auth_debug_gssapi #define misc_debug_gssapi gssrpc_misc_debug_gssapi /* auth_gssapi.h */ #define xdr_gss_buf gssrpc_xdr_gss_buf #define xdr_authgssapi_creds gssrpc_xdr_authgssapi_creds #define xdr_authgssapi_init_arg gssrpc_xdr_authgssapi_init_arg #define xdr_authgssapi_init_res gssrpc_xdr_authgssapi_init_res #define auth_gssapi_wrap_data gssrpc_auth_gssapi_wrap_data #define auth_gssapi_unwrap_data gssrpc_auth_gssapi_unwrap_data #define auth_gssapi_create gssrpc_auth_gssapi_create #define auth_gssapi_create_default gssrpc_auth_gssapi_create_default #define auth_gssapi_display_status gssrpc_auth_gssapi_display_status #define auth_gssapi_seal_seq gssrpc_auth_gssapi_seal_seq #define auth_gssapi_unseal_seq gssrpc_auth_gssapi_unseal_seq #define svcauth_gssapi_set_names gssrpc_svcauth_gssapi_set_names #define svcauth_gssapi_unset_names gssrpc_svcauth_gssapi_unset_names #define svcauth_gssapi_set_log_badauth_func gssrpc_svcauth_gssapi_set_log_badauth_func #define svcauth_gssapi_set_log_badauth2_func gssrpc_svcauth_gssapi_set_log_badauth2_func #define svcauth_gssapi_set_log_badverf_func gssrpc_svcauth_gssapi_set_log_badverf_func #define svcauth_gssapi_set_log_miscerr_func gssrpc_svcauth_gssapi_set_log_miscerr_func #define svcauth_gss_set_log_badauth_func gssrpc_svcauth_gss_set_log_badauth_func #define svcauth_gss_set_log_badauth2_func gssrpc_svcauth_gss_set_log_badauth2_func #define svcauth_gss_set_log_badverf_func gssrpc_svcauth_gss_set_log_badverf_func #define svcauth_gss_set_log_miscerr_func gssrpc_svcauth_gss_set_log_miscerr_func /* auth_unix.h */ #define xdr_authunix_parms gssrpc_xdr_authunix_parms /* clnt.h */ #define clntraw_create gssrpc_clntraw_create #define clnt_create gssrpc_clnt_create #define clnttcp_create gssrpc_clnttcp_create #define clntudp_create gssrpc_clntudp_create #define clntudp_bufcreate gssrpc_clntudp_bufcreate #define clnt_pcreateerror gssrpc_clnt_pcreateerror #define clnt_spcreateerror gssrpc_clnt_spcreateerror #define clnt_perrno gssrpc_clnt_perrno #define clnt_perror gssrpc_clnt_perror #define clnt_sperror gssrpc_clnt_sperror /* XXX do we need to rename the struct? */ #define rpc_createerr gssrpc_rpc_createrr #define clnt_sperrno gssrpc_clnt_sperrno /* pmap_clnt.h */ #define pmap_set gssrpc_pmap_set #define pmap_unset gssrpc_pmap_unset #define pmap_getmaps gssrpc_pmap_getmaps #define pmap_rmtcall gssrpc_pmap_rmtcall #define clnt_broadcast gssrpc_clnt_broadcast #define pmap_getport gssrpc_pmap_getport /* pmap_prot.h */ #define xdr_pmap gssrpc_xdr_pmap #define xdr_pmaplist gssrpc_xdr_pmaplist /* pmap_rmt.h */ #define xdr_rmtcall_args gssrpc_xdr_rmtcall_args #define xdr_rmtcallres gssrpc_xdr_rmtcallres /* rpc.h */ #define get_myaddress gssrpc_get_myaddress #define bindresvport gssrpc_bindresvport #define bindresvport_sa gssrpc_bindresvport_sa #define callrpc gssrpc_callrpc #define getrpcport gssrpc_getrpcport /* rpc_msg.h */ #define xdr_callmsg gssrpc_xdr_callmsg #define xdr_callhdr gssrpc_xdr_callhdr #define xdr_replymsg gssrpc_xdr_replymsg #define xdr_accepted_reply gssrpc_xdr_accepted_reply #define xdr_rejected_reply gssrpc_xdr_rejected_reply /* svc.h */ #define svc_register gssrpc_svc_register #define registerrpc gssrpc_registerrpc #define svc_unregister gssrpc_svc_unregister #define xprt_register gssrpc_xprt_register #define xprt_unregister gssrpc_xprt_unregister #define svc_sendreply gssrpc_svc_sendreply #define svcerr_decode gssrpc_svcerr_decode #define svcerr_weakauth gssrpc_svcerr_weakauth #define svcerr_noproc gssrpc_svcerr_noproc #define svcerr_progvers gssrpc_svcerr_progvers #define svcerr_auth gssrpc_svcerr_auth #define svcerr_noprog gssrpc_svcerr_noprog #define svcerr_systemerr gssrpc_svcerr_systemerr #define svc_maxfd gssrpc_svc_maxfd #define svc_fdset gssrpc_svc_fdset #define svc_fds gssrpc_svc_fds #define rpctest_service gssrpc_rpctest_service #define svc_getreq gssrpc_svc_getreq #define svc_getreqset gssrpc_svc_getreqset #define svc_getreqset2 gssrpc_svc_getreqset2 #define svc_run gssrpc_svc_run #define svcraw_create gssrpc_svcraw_create #define svcudp_create gssrpc_svcudp_create #define svcudp_bufcreate gssrpc_svcudp_bufcreate #define svcudp_enablecache gssrpc_svcudp_enablecache #define svctcp_create gssrpc_svctcp_create #define svcfd_create gssrpc_svcfd_create /* svc_auth.h */ #define svc_auth_none_ops gssrpc_svc_auth_none_ops #define svc_auth_gssapi_ops gssrpc_svc_auth_gssapi_ops #define svc_auth_gss_ops gssrpc_svc_auth_gss_ops #define svcauth_gss_set_svc_name gssrpc_svcauth_gss_set_svc_name #define svcauth_gss_get_principal gssrpc_svcauth_gss_get_principal /* svc_auth_gss.c */ #define svc_debug_gss gssrpc_svc_debug_gss /* svc_auth_gssapi.c */ #define svc_debug_gssapi gssrpc_svc_debug_gssapi /* svc_auth_none.c */ #define svc_auth_none gssrpc_svc_auth_none /* xdr.h */ #define xdr_void gssrpc_xdr_void #define xdr_int gssrpc_xdr_int #define xdr_u_int gssrpc_xdr_u_int #define xdr_long gssrpc_xdr_long #define xdr_u_long gssrpc_xdr_u_long #define xdr_short gssrpc_xdr_short #define xdr_u_short gssrpc_xdr_u_short #define xdr_bool gssrpc_xdr_bool #define xdr_enum gssrpc_xdr_enum #define xdr_array gssrpc_xdr_array #define xdr_bytes gssrpc_xdr_bytes #define xdr_opaque gssrpc_xdr_opaque #define xdr_string gssrpc_xdr_string #define xdr_union gssrpc_xdr_union #define xdr_char gssrpc_xdr_char #define xdr_u_char gssrpc_xdr_u_char #define xdr_vector gssrpc_xdr_vector #define xdr_float gssrpc_xdr_float #define xdr_double gssrpc_xdr_double #define xdr_reference gssrpc_xdr_reference #define xdr_pointer gssrpc_xdr_pointer #define xdr_wrapstring gssrpc_xdr_wrapstring #define xdr_free gssrpc_xdr_free #define xdr_sizeof gssrpc_xdr_sizeof #define xdr_netobj gssrpc_xdr_netobj #define xdr_int32 gssrpc_xdr_int32 #define xdr_u_int32 gssrpc_xdr_u_int32 #define xdralloc_create gssrpc_xdralloc_create #define xdralloc_release gssrpc_xdralloc_release #define xdralloc_getdata gssrpc_xdralloc_getdata #define xdrmem_create gssrpc_xdrmem_create #define xdrstdio_create gssrpc_xdrstdio_create #define xdrrec_create gssrpc_xdrrec_create #define xdrrec_endofrecord gssrpc_xdrrec_endofrecord #define xdrrec_skiprecord gssrpc_xdrrec_skiprecord #define xdrrec_eof gssrpc_xdrrec_eof #endif /* !defined(GSSRPC_RENAME_H) */ gssrpc/rpc.h 0000644 00000006107 15063602065 0007011 0 ustar 00 /* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * rpc.h, Just includes the billions of rpc header files necessary to * do remote procedure calling. */ #ifndef GSSRPC_RPC_H #define GSSRPC_RPC_H #include <gssrpc/types.h> /* some typedefs */ #include <netinet/in.h> /* external data representation interfaces */ #include <gssrpc/xdr.h> /* generic (de)serializer */ /* Client side only authentication */ #include <gssrpc/auth.h> /* generic authenticator (client side) */ /* Client side (mostly) remote procedure call */ #include <gssrpc/clnt.h> /* generic rpc stuff */ /* semi-private protocol headers */ #include <gssrpc/rpc_msg.h> /* protocol for rpc messages */ #include <gssrpc/auth_unix.h> /* protocol for unix style cred */ #include <gssrpc/auth_gss.h> /* RPCSEC_GSS */ /* Server side only remote procedure callee */ #include <gssrpc/svc_auth.h> /* service side authenticator */ #include <gssrpc/svc.h> /* service manager and multiplexer */ /* * get the local host's IP address without consulting * name service library functions */ GSSRPC__BEGIN_DECLS extern int get_myaddress(struct sockaddr_in *); extern int bindresvport(int, struct sockaddr_in *); extern int bindresvport_sa(int, struct sockaddr *); extern int callrpc(char *, rpcprog_t, rpcvers_t, rpcproc_t, xdrproc_t, char *, xdrproc_t , char *); extern int getrpcport(char *, rpcprog_t, rpcvers_t, rpcprot_t); extern int gssrpc__rpc_dtablesize(void); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_RPC_H) */ gssrpc/rpc_msg.h 0000644 00000011762 15063602065 0007662 0 ustar 00 /* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)rpc_msg.h 1.7 86/07/16 SMI */ /* * rpc_msg.h * rpc message definition */ #ifndef GSSRPC_RPC_MSG_H #define GSSRPC_RPC_MSG_H GSSRPC__BEGIN_DECLS #define RPC_MSG_VERSION ((uint32_t) 2) #define RPC_SERVICE_PORT ((u_short) 2048) /* * Bottom up definition of an rpc message. * NOTE: call and reply use the same overall stuct but * different parts of unions within it. */ enum msg_type { CALL=0, REPLY=1 }; enum reply_stat { MSG_ACCEPTED=0, MSG_DENIED=1 }; enum accept_stat { SUCCESS=0, PROG_UNAVAIL=1, PROG_MISMATCH=2, PROC_UNAVAIL=3, GARBAGE_ARGS=4, SYSTEM_ERR=5 }; enum reject_stat { RPC_MISMATCH=0, AUTH_ERROR=1 }; /* * Reply part of an rpc exchange */ /* * Reply to an rpc request that was accepted by the server. * Note: there could be an error even though the request was * accepted. */ struct accepted_reply { struct opaque_auth ar_verf; enum accept_stat ar_stat; union { struct { rpcvers_t low; rpcvers_t high; } AR_versions; struct { caddr_t where; xdrproc_t proc; } AR_results; /* and many other null cases */ } ru; #define ar_results ru.AR_results #define ar_vers ru.AR_versions }; /* * Reply to an rpc request that was rejected by the server. */ struct rejected_reply { enum reject_stat rj_stat; union { struct { rpcvers_t low; rpcvers_t high; } RJ_versions; enum auth_stat RJ_why; /* why authentication did not work */ } ru; #define rj_vers ru.RJ_versions #define rj_why ru.RJ_why }; /* * Body of a reply to an rpc request. */ struct reply_body { enum reply_stat rp_stat; union { struct accepted_reply RP_ar; struct rejected_reply RP_dr; } ru; #define rp_acpt ru.RP_ar #define rp_rjct ru.RP_dr }; /* * Body of an rpc request call. */ struct call_body { rpcvers_t cb_rpcvers; /* must be equal to two */ rpcprog_t cb_prog; rpcvers_t cb_vers; rpcproc_t cb_proc; struct opaque_auth cb_cred; struct opaque_auth cb_verf; /* protocol specific - provided by client */ }; /* * The rpc message */ struct rpc_msg { uint32_t rm_xid; enum msg_type rm_direction; union { struct call_body RM_cmb; struct reply_body RM_rmb; } ru; #define rm_call ru.RM_cmb #define rm_reply ru.RM_rmb }; #define acpted_rply ru.RM_rmb.ru.RP_ar #define rjcted_rply ru.RM_rmb.ru.RP_dr /* * XDR routine to handle a rpc message. * xdr_callmsg(xdrs, cmsg) * XDR *xdrs; * struct rpc_msg *cmsg; */ extern bool_t xdr_callmsg(XDR *, struct rpc_msg *); /* * XDR routine to pre-serialize the static part of a rpc message. * xdr_callhdr(xdrs, cmsg) * XDR *xdrs; * struct rpc_msg *cmsg; */ extern bool_t xdr_callhdr(XDR *, struct rpc_msg *); /* * XDR routine to handle a rpc reply. * xdr_replymsg(xdrs, rmsg) * XDR *xdrs; * struct rpc_msg *rmsg; */ extern bool_t xdr_replymsg(XDR *, struct rpc_msg *); /* * Fills in the error part of a reply message. * _seterr_reply(msg, error) * struct rpc_msg *msg; * struct rpc_err *error; */ /* * RENAMED: should be _seterr_reply or __seterr_reply if we can use * reserved namespace. */ extern void gssrpc__seterr_reply(struct rpc_msg *, struct rpc_err *); /* XDR the MSG_ACCEPTED part of a reply message union */ extern bool_t xdr_accepted_reply(XDR *, struct accepted_reply *); /* XDR the MSG_DENIED part of a reply message union */ extern bool_t xdr_rejected_reply(XDR *, struct rejected_reply *); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_RPC_MSG_H) */ gssrpc/svc.h 0000644 00000026513 15063602065 0007023 0 ustar 00 /* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * svc.h, Server-side remote procedure call interface. */ #ifndef GSSRPC_SVC_H #define GSSRPC_SVC_H #include <gssrpc/svc_auth.h> GSSRPC__BEGIN_DECLS /* * This interface must manage two items concerning remote procedure calling: * * 1) An arbitrary number of transport connections upon which rpc requests * are received. The two most notable transports are TCP and UDP; they are * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; * they in turn call xprt_register and xprt_unregister. * * 2) An arbitrary number of locally registered services. Services are * described by the following four data: program number, version number, * "service dispatch" function, a transport handle, and a boolean that * indicates whether or not the exported program should be registered with a * local binder service; if true the program's number and version and the * port number from the transport handle are registered with the binder. * These data are registered with the rpc svc system via svc_register. * * A service's dispatch function is called whenever an rpc request comes in * on a transport. The request's program and version numbers must match * those of the registered service. The dispatch function is passed two * parameters, struct svc_req * and SVCXPRT *, defined below. */ enum xprt_stat { XPRT_DIED, XPRT_MOREREQS, XPRT_IDLE }; /* * Server side transport handle */ typedef struct SVCXPRT { #ifdef _WIN32 SOCKET xp_sock; #else int xp_sock; #endif u_short xp_port; /* associated port number */ struct xp_ops { /* receive incomming requests */ bool_t (*xp_recv)(struct SVCXPRT *, struct rpc_msg *); /* get transport status */ enum xprt_stat (*xp_stat)(struct SVCXPRT *); /* get arguments */ bool_t (*xp_getargs)(struct SVCXPRT *, xdrproc_t, void *); /* send reply */ bool_t (*xp_reply)(struct SVCXPRT *, struct rpc_msg *); /* free mem allocated for args */ bool_t (*xp_freeargs)(struct SVCXPRT *, xdrproc_t, void *); /* destroy this struct */ void (*xp_destroy)(struct SVCXPRT *); } *xp_ops; int xp_addrlen; /* length of remote address */ struct sockaddr_in xp_raddr; /* remote address */ struct opaque_auth xp_verf; /* raw response verifier */ SVCAUTH *xp_auth; /* auth flavor of current req */ void *xp_p1; /* private */ void *xp_p2; /* private */ int xp_laddrlen; /* lenght of local address */ struct sockaddr_in xp_laddr; /* local address */ } SVCXPRT; /* * Approved way of getting address of caller */ #define svc_getcaller(x) (&(x)->xp_raddr) /* * Operations defined on an SVCXPRT handle * * SVCXPRT *xprt; * struct rpc_msg *msg; * xdrproc_t xargs; * caddr_t argsp; */ #define SVC_RECV(xprt, msg) \ (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) #define svc_recv(xprt, msg) \ (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) #define SVC_STAT(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) #define svc_stat(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) #define SVC_GETARGS(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) #define svc_getargs(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) #define SVC_GETARGS_REQ(xprt, req, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs_req)((xprt), (req), (xargs), (argsp)) #define svc_getargs_req(xprt, req, xargs, argsp) \ (*(xprt)->xp_ops->xp_getargs_req)((xprt), (req), (xargs), (argsp)) #define SVC_REPLY(xprt, msg) \ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) #define svc_reply(xprt, msg) \ (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) #define SVC_REPLY_REQ(xprt, req, msg) \ (*(xprt)->xp_ops->xp_reply_req) ((xprt), (req), (msg)) #define svc_reply_req(xprt, msg) \ (*(xprt)->xp_ops->xp_reply_req) ((xprt), (req), (msg)) #define SVC_FREEARGS(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) #define svc_freeargs(xprt, xargs, argsp) \ (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) #define SVC_DESTROY(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) #define svc_destroy(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) /* * Service request */ struct svc_req { rpcprog_t rq_prog; /* service program number */ rpcvers_t rq_vers; /* service protocol version */ rpcproc_t rq_proc; /* the desired procedure */ struct opaque_auth rq_cred; /* raw creds from the wire */ void * rq_clntcred; /* read only cooked client cred */ void * rq_svccred; /* read only svc cred/context */ void * rq_clntname; /* read only client name */ SVCXPRT *rq_xprt; /* associated transport */ /* The request's auth flavor *should* be here, but the svc_req */ /* isn't passed around everywhere it is necessary. The */ /* transport *is* passed around, so the auth flavor it stored */ /* there. This means that the transport must be single */ /* threaded, but other parts of SunRPC already require that. */ /*SVCAUTH *rq_auth; associated auth flavor */ }; /* * Service registration * * svc_register(xprt, prog, vers, dispatch, protocol) * SVCXPRT *xprt; * rpcprog_t prog; * rpcvers_t vers; * void (*dispatch)(); * int protocol; like IPPROTO_TCP or _UDP; zero means do not register * * registerrpc(prog, vers, proc, routine, inproc, outproc) * returns 0 upon success, -1 if error. */ extern bool_t svc_register(SVCXPRT *, rpcprog_t, rpcvers_t, void (*)(struct svc_req *, SVCXPRT *), int); extern int registerrpc(rpcprog_t, rpcvers_t, rpcproc_t, char *(*)(void *), xdrproc_t, xdrproc_t); /* * Service un-registration * * svc_unregister(prog, vers) * rpcprog_t prog; * rpcvers_t vers; */ extern void svc_unregister(rpcprog_t, rpcvers_t); /* * Transport registration. * * xprt_register(xprt) * SVCXPRT *xprt; */ extern void xprt_register(SVCXPRT *); /* * Transport un-register * * xprt_unregister(xprt) * SVCXPRT *xprt; */ extern void xprt_unregister(SVCXPRT *); /* * When the service routine is called, it must first check to see if * it knows about the procedure; if not, it should call svcerr_noproc * and return. If so, it should deserialize its arguments via * SVC_GETARGS or the new SVC_GETARGS_REQ (both defined above). If * the deserialization does not work, svcerr_decode should be called * followed by a return. Successful decoding of the arguments should * be followed the execution of the procedure's code and a call to * svc_sendreply or the new svc_sendreply_req. * * Also, if the service refuses to execute the procedure due to too- * weak authentication parameters, svcerr_weakauth should be called. * Note: do not confuse access-control failure with weak authentication! * * NB: In pure implementations of rpc, the caller always waits for a reply * msg. This message is sent when svc_sendreply is called. * Therefore pure service implementations should always call * svc_sendreply even if the function logically returns void; use * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows * for the abuse of pure rpc via batched calling or pipelining. In the * case of a batched call, svc_sendreply should NOT be called since * this would send a return message, which is what batching tries to avoid. * It is the service/protocol writer's responsibility to know which calls are * batched and which are not. Warning: responding to batch calls may * deadlock the caller and server processes! */ extern bool_t svc_sendreply(SVCXPRT *, xdrproc_t, caddr_t); extern void svcerr_decode(SVCXPRT *); extern void svcerr_weakauth(SVCXPRT *); extern void svcerr_noproc(SVCXPRT *); extern void svcerr_progvers(SVCXPRT *, rpcvers_t, rpcvers_t); extern void svcerr_auth(SVCXPRT *, enum auth_stat); extern void svcerr_noprog(SVCXPRT *); extern void svcerr_systemerr(SVCXPRT *); /* * Lowest level dispatching -OR- who owns this process anyway. * Somebody has to wait for incoming requests and then call the correct * service routine. The routine svc_run does infinite waiting; i.e., * svc_run never returns. * Since another (co-existant) package may wish to selectively wait for * incoming calls or other events outside of the rpc architecture, the * routine svc_getreq is provided. It must be passed readfds, the * "in-place" results of a select system call (see select, section 2). */ /* * Global keeper of rpc service descriptors in use * dynamic; must be inspected before each call to select */ extern int svc_maxfd; #ifdef FD_SETSIZE extern fd_set svc_fdset; /* RENAMED */ #define gssrpc_svc_fds gsssrpc_svc_fdset.fds_bits[0] /* compatibility */ #else extern int svc_fds; #endif /* def FD_SETSIZE */ extern int svc_maxfd; /* * a small program implemented by the svc_rpc implementation itself; * also see clnt.h for protocol numbers. */ extern void rpctest_service(); extern void svc_getreq(int); #ifdef FD_SETSIZE extern void svc_getreqset(fd_set *);/* takes fdset instead of int */ extern void svc_getreqset2(fd_set *, int); #else extern void svc_getreqset(int *); #endif extern void svc_run(void); /* never returns */ /* * Socket to use on svcxxx_create call to get default socket */ #define RPC_ANYSOCK -1 /* * These are the existing service side transport implementations */ /* * Memory based rpc for testing and timing. */ extern SVCXPRT *svcraw_create(void); /* * Udp based rpc. */ extern SVCXPRT *svcudp_create(int); extern SVCXPRT *svcudp_bufcreate(int, u_int, u_int); extern int svcudp_enablecache(SVCXPRT *, uint32_t); /* * Tcp based rpc. */ extern SVCXPRT *svctcp_create(int, u_int, u_int); /* * Like svtcp_create(), except the routine takes any *open* UNIX file * descriptor as its first input. */ extern SVCXPRT *svcfd_create(int, u_int, u_int); /* XXX add auth_gsapi_log_*? */ GSSRPC__END_DECLS #endif /* !defined(GSSRPC_SVC_H) */ gssrpc/svc_auth.h 0000644 00000007610 15063602065 0010041 0 ustar 00 /* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)svc_auth.h 1.6 86/07/16 SMI */ /* * svc_auth.h, Service side of rpc authentication. */ /* * Interface to server-side authentication flavors. */ #ifndef GSSRPC_SVC_AUTH_H #define GSSRPC_SVC_AUTH_H #include <gssapi/gssapi.h> GSSRPC__BEGIN_DECLS struct svc_req; typedef struct SVCAUTH { struct svc_auth_ops { int (*svc_ah_wrap)(struct SVCAUTH *, XDR *, xdrproc_t, caddr_t); int (*svc_ah_unwrap)(struct SVCAUTH *, XDR *, xdrproc_t, caddr_t); int (*svc_ah_destroy)(struct SVCAUTH *); } *svc_ah_ops; void * svc_ah_private; } SVCAUTH; #ifdef GSSRPC__IMPL extern SVCAUTH svc_auth_none; extern struct svc_auth_ops svc_auth_none_ops; extern struct svc_auth_ops svc_auth_gssapi_ops; extern struct svc_auth_ops svc_auth_gss_ops; /* * Server side authenticator */ /* RENAMED: should be _authenticate. */ extern enum auth_stat gssrpc__authenticate(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch); #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->svc_ah_ops->svc_ah_wrap))(auth, xdrs, xfunc, xwhere)) #define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \ ((*((auth)->svc_ah_ops->svc_ah_unwrap))(auth, xdrs, xfunc, xwhere)) #define SVCAUTH_DESTROY(auth) \ ((*((auth)->svc_ah_ops->svc_ah_destroy))(auth)) /* no authentication */ /* RENAMED: should be _svcauth_none. */ enum auth_stat gssrpc__svcauth_none(struct svc_req *, struct rpc_msg *, bool_t *); /* unix style (uid, gids) */ /* RENAMED: shoudl be _svcauth_unix. */ enum auth_stat gssrpc__svcauth_unix(struct svc_req *, struct rpc_msg *, bool_t *); /* short hand unix style */ /* RENAMED: should be _svcauth_short. */ enum auth_stat gssrpc__svcauth_short(struct svc_req *, struct rpc_msg *, bool_t *); /* GSS-API style */ /* RENAMED: should be _svcauth_gssapi. */ enum auth_stat gssrpc__svcauth_gssapi(struct svc_req *, struct rpc_msg *, bool_t *); /* RPCSEC_GSS */ enum auth_stat gssrpc__svcauth_gss(struct svc_req *, struct rpc_msg *, bool_t *); #endif /* defined(GSSRPC__IMPL) */ /* * Approved way of getting principal of caller */ char *svcauth_gss_get_principal(SVCAUTH *auth); /* * Approved way of setting server principal */ bool_t svcauth_gss_set_svc_name(gss_name_t name); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_SVC_AUTH_H) */ gssrpc/types.h 0000644 00000007052 15063602065 0007371 0 ustar 00 /* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the “Oracle America, Inc.” nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)types.h 1.18 87/07/24 SMI */ /* * Rpc additions to <sys/types.h> */ #ifndef GSSRPC_TYPES_H #define GSSRPC_TYPES_H #include <sys/types.h> #include <sys/select.h> #include <sys/time.h> #include <unistd.h> /* * Try to get MAXHOSTNAMELEN from somewhere. */ #include <sys/param.h> /* #include <netdb.h> */ /* Get htonl(), ntohl(), etc. */ #include <netinet/in.h> #include <stdlib.h> #include <stdint.h> #include <limits.h> #ifndef GSSRPC__BEGIN_DECLS #ifdef __cplusplus #define GSSRPC__BEGIN_DECLS extern "C" { #define GSSRPC__END_DECLS } #else #define GSSRPC__BEGIN_DECLS #define GSSRPC__END_DECLS #endif #endif GSSRPC__BEGIN_DECLS #if defined(CHAR_BIT) && CHAR_BIT != 8 #error "Bytes must be exactly 8 bits." #endif /* Define if we need to fake up some BSD type aliases. */ #ifndef GSSRPC__BSD_TYPEALIASES /* Allow application to override. */ /* #undef GSSRPC__BSD_TYPEALIASES */ #endif #if GSSRPC__BSD_TYPEALIASES typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; #endif typedef uint32_t rpcprog_t; typedef uint32_t rpcvers_t; typedef uint32_t rpcprot_t; typedef uint32_t rpcproc_t; typedef uint32_t rpcport_t; typedef int32_t rpc_inline_t; /* This is for rpc/netdb.h */ #define STRUCT_RPCENT_IN_RPC_NETDB_H #define bool_t int #define enum_t int #ifndef FALSE # define FALSE (0) #endif #ifndef TRUE # define TRUE (1) #endif /* XXX namespace */ #define __dontcare__ -1 #ifndef NULL # define NULL 0 #endif /* * The below should probably be internal-only, but seem to be * traditionally exported in RPC implementations. */ #define mem_alloc(bsize) malloc(bsize) #define mem_free(ptr, bsize) free(ptr) #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK (uint32_t)0x7F000001 #endif #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif GSSRPC__END_DECLS #include <gssrpc/rename.h> #endif /* !defined(GSSRPC_TYPES_H) */ gssrpc/xdr.h 0000644 00000027003 15063602065 0007020 0 ustar 00 /* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */ /* * Copyright (c) 2010, Oracle America, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the "Oracle America, Inc." nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* @(#)xdr.h 1.19 87/04/22 SMI */ /* * xdr.h, External Data Representation Serialization Routines. */ #ifndef GSSRPC_XDR_H #define GSSRPC_XDR_H #include <stdio.h> /* for FILE */ GSSRPC__BEGIN_DECLS /* * XDR provides a conventional way for converting between C data * types and an external bit-string representation. Library supplied * routines provide for the conversion on built-in C data types. These * routines and utility routines defined here are used to help implement * a type encode/decode routine for each user-defined type. * * Each data type provides a single procedure which takes two arguments: * * bool_t * xdrproc(xdrs, argresp) * XDR *xdrs; * <type> *argresp; * * xdrs is an instance of a XDR handle, to which or from which the data * type is to be converted. argresp is a pointer to the structure to be * converted. The XDR handle contains an operation field which indicates * which of the operations (ENCODE, DECODE * or FREE) is to be performed. * * XDR_DECODE may allocate space if the pointer argresp is null. This * data can be freed with the XDR_FREE operation. * * We write only one procedure per data type to make it easy * to keep the encode and decode procedures for a data type consistent. * In many cases the same code performs all operations on a user defined type, * because all the hard work is done in the component type routines. * decode as a series of calls on the nested data types. */ /* * Xdr operations. XDR_ENCODE causes the type to be encoded into the * stream. XDR_DECODE causes the type to be extracted from the stream. * XDR_FREE can be used to release the space allocated by an XDR_DECODE * request. */ enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }; /* * This is the number of bytes per unit of external data. */ #define BYTES_PER_XDR_UNIT (4) #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ * BYTES_PER_XDR_UNIT) /* * A xdrproc_t exists for each data type which is to be encoded or decoded. * * The second argument to the xdrproc_t is a pointer to an opaque pointer. * The opaque pointer generally points to a structure of the data type * to be decoded. If this pointer is 0, then the type routines should * allocate dynamic storage of the appropriate size and return it. * bool_t (*xdrproc_t)(XDR *, caddr_t *); * * XXX can't actually prototype it, because some take three args!!! */ typedef bool_t (*xdrproc_t)(); /* * The XDR handle. * Contains operation which is being applied to the stream, * an operations vector for the paticular implementation (e.g. see xdr_mem.c), * and two private fields for the use of the particular impelementation. */ typedef struct XDR { enum xdr_op x_op; /* operation; fast additional param */ struct xdr_ops { /* get a long from underlying stream */ bool_t (*x_getlong)(struct XDR *, long *); /* put a long to underlying stream */ bool_t (*x_putlong)(struct XDR *, long *); /* get some bytes from underlying stream */ bool_t (*x_getbytes)(struct XDR *, caddr_t, u_int); /* put some bytes to underlying stream */ bool_t (*x_putbytes)(struct XDR *, caddr_t, u_int); /* returns bytes off from beginning */ u_int (*x_getpostn)(struct XDR *); /* lets you reposition the stream */ bool_t (*x_setpostn)(struct XDR *, u_int); /* buf quick ptr to buffered data */ rpc_inline_t *(*x_inline)(struct XDR *, int); /* free privates of this xdr_stream */ void (*x_destroy)(struct XDR *); } *x_ops; caddr_t x_public; /* users' data */ void * x_private; /* pointer to private data */ caddr_t x_base; /* private used for position info */ int x_handy; /* extra private word */ } XDR; /* * Operations defined on a XDR handle * * XDR *xdrs; * int32_t *longp; * caddr_t addr; * u_int len; * u_int pos; */ #define XDR_GETLONG(xdrs, longp) \ (*(xdrs)->x_ops->x_getlong)(xdrs, longp) #define xdr_getlong(xdrs, longp) \ (*(xdrs)->x_ops->x_getlong)(xdrs, longp) #define XDR_PUTLONG(xdrs, longp) \ (*(xdrs)->x_ops->x_putlong)(xdrs, longp) #define xdr_putlong(xdrs, longp) \ (*(xdrs)->x_ops->x_putlong)(xdrs, longp) #define XDR_GETBYTES(xdrs, addr, len) \ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) #define xdr_getbytes(xdrs, addr, len) \ (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) #define XDR_PUTBYTES(xdrs, addr, len) \ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) #define xdr_putbytes(xdrs, addr, len) \ (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) #define XDR_GETPOS(xdrs) \ (*(xdrs)->x_ops->x_getpostn)(xdrs) #define xdr_getpos(xdrs) \ (*(xdrs)->x_ops->x_getpostn)(xdrs) #define XDR_SETPOS(xdrs, pos) \ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) #define xdr_setpos(xdrs, pos) \ (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) #define XDR_INLINE(xdrs, len) \ (*(xdrs)->x_ops->x_inline)(xdrs, len) #define xdr_inline(xdrs, len) \ (*(xdrs)->x_ops->x_inline)(xdrs, len) #define XDR_DESTROY(xdrs) \ if ((xdrs)->x_ops->x_destroy) \ (*(xdrs)->x_ops->x_destroy)(xdrs) #define xdr_destroy(xdrs) \ if ((xdrs)->x_ops->x_destroy) \ (*(xdrs)->x_ops->x_destroy)(xdrs) /* * Support struct for discriminated unions. * You create an array of xdrdiscrim structures, terminated with * a entry with a null procedure pointer. The xdr_union routine gets * the discriminant value and then searches the array of structures * for a matching value. If a match is found the associated xdr routine * is called to handle that part of the union. If there is * no match, then a default routine may be called. * If there is no match and no default routine it is an error. */ #define NULL_xdrproc_t ((xdrproc_t)0) struct xdr_discrim { int value; xdrproc_t proc; }; /* * In-line routines for fast encode/decode of primitve data types. * Caveat emptor: these use single memory cycles to get the * data from the underlying buffer, and will fail to operate * properly if the data is not aligned. The standard way to use these * is to say: * if ((buf = XDR_INLINE(xdrs, count)) == NULL) * return (FALSE); * <<< macro calls >>> * where ``count'' is the number of bytes of data occupied * by the primitive data types. * * N.B. and frozen for all time: each data type here uses 4 bytes * of external representation. */ #define IXDR_GET_INT32(buf) ((int32_t)IXDR_GET_U_INT32(buf)) #define IXDR_PUT_INT32(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) #define IXDR_GET_U_INT32(buf) (ntohl((uint32_t)*(buf)++)) #define IXDR_PUT_U_INT32(buf, v) (*(buf)++ = (int32_t)htonl((v))) #define IXDR_GET_LONG(buf) ((long)IXDR_GET_INT32(buf)) #define IXDR_PUT_LONG(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_INT32(buf)) #define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_U_INT32(buf)) #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_INT32(buf)) #define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_U_INT32(buf)) #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v))) #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v))) #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v))) #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v))) /* * These are the "generic" xdr routines. */ extern bool_t xdr_void(XDR *, void *); extern bool_t xdr_int(XDR *, int *); extern bool_t xdr_u_int(XDR *, u_int *); extern bool_t xdr_long(XDR *, long *); extern bool_t xdr_u_long(XDR *, u_long *); extern bool_t xdr_short(XDR *, short *); extern bool_t xdr_u_short(XDR *, u_short *); extern bool_t xdr_bool(XDR *, bool_t *); extern bool_t xdr_enum(XDR *, enum_t *); extern bool_t xdr_array(XDR *, caddr_t *, u_int *, u_int, u_int, xdrproc_t); extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int); extern bool_t xdr_opaque(XDR *, caddr_t, u_int); extern bool_t xdr_string(XDR *, char **, u_int); extern bool_t xdr_union(XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t); extern bool_t xdr_char(XDR *, char *); extern bool_t xdr_u_char(XDR *, u_char *); extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t); extern bool_t xdr_float(XDR *, float *); extern bool_t xdr_double(XDR *, double *); extern bool_t xdr_reference(XDR *, caddr_t *, u_int, xdrproc_t); extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t); extern bool_t xdr_wrapstring(XDR *, char **); extern unsigned long xdr_sizeof(xdrproc_t, void *); #define xdr_rpcprog xdr_u_int32 #define xdr_rpcvers xdr_u_int32 #define xdr_rpcprot xdr_u_int32 #define xdr_rpcproc xdr_u_int32 #define xdr_rpcport xdr_u_int32 /* * Common opaque bytes objects used by many rpc protocols; * declared here due to commonality. */ #define MAX_NETOBJ_SZ 2048 struct netobj { u_int n_len; char *n_bytes; }; typedef struct netobj netobj; extern bool_t xdr_netobj(XDR *, struct netobj *); extern bool_t xdr_int32(XDR *, int32_t *); extern bool_t xdr_u_int32(XDR *, uint32_t *); /* * These are the public routines for the various implementations of * xdr streams. */ /* XDR allocating memory buffer */ extern void xdralloc_create(XDR *, enum xdr_op); /* destroy xdralloc, save buf */ extern void xdralloc_release(XDR *); /* get buffer from xdralloc */ extern caddr_t xdralloc_getdata(XDR *); /* XDR using memory buffers */ extern void xdrmem_create(XDR *, caddr_t, u_int, enum xdr_op); /* XDR using stdio library */ extern void xdrstdio_create(XDR *, FILE *, enum xdr_op); /* XDR pseudo records for tcp */ extern void xdrrec_create(XDR *xdrs, u_int, u_int, caddr_t, int (*) (caddr_t, caddr_t, int), int (*) (caddr_t, caddr_t, int)); /* make end of xdr record */ extern bool_t xdrrec_endofrecord(XDR *, bool_t); /* move to beginning of next record */ extern bool_t xdrrec_skiprecord (XDR *xdrs); /* true if no more input */ extern bool_t xdrrec_eof (XDR *xdrs); /* free memory buffers for xdr */ extern void xdr_free (xdrproc_t, void *); GSSRPC__END_DECLS #endif /* !defined(GSSRPC_XDR_H) */ finclude/math-vector-fortran.h 0000644 00000004512 15063602065 0012415 0 ustar 00 ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- ! Copyright (C) 2019 Free Software Foundation, Inc. ! This file is part of the GNU C Library. ! ! The GNU C Library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Lesser General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! ! The GNU C Library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Lesser General Public License for more details. ! ! You should have received a copy of the GNU Lesser General Public ! License along with the GNU C Library; if not, see ! <http://www.gnu.org/licenses/>. !GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') !GCC$ builtin (cos) attributes simd (notinbranch) if('x32') !GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') !GCC$ builtin (sin) attributes simd (notinbranch) if('x32') !GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') !GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') !GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') !GCC$ builtin (log) attributes simd (notinbranch) if('x32') !GCC$ builtin (logf) attributes simd (notinbranch) if('x32') !GCC$ builtin (exp) attributes simd (notinbranch) if('x32') !GCC$ builtin (expf) attributes simd (notinbranch) if('x32') !GCC$ builtin (pow) attributes simd (notinbranch) if('x32') !GCC$ builtin (powf) attributes simd (notinbranch) if('x32') fstab.h 0000644 00000006047 15063602065 0006026 0 ustar 00 /* * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fstab.h 8.1 (Berkeley) 6/2/93 */ #ifndef _FSTAB_H #define _FSTAB_H 1 #include <features.h> /* * File system table, see fstab(5). * * Used by dump, mount, umount, swapon, fsck, df, ... * * For ufs fs_spec field is the block special name. Programs that want to * use the character special name must create that name by prepending a 'r' * after the right most slash. Quota files are always named "quotas", so * if type is "rq", then use concatenation of fs_file and "quotas" to locate * quota file. */ #define _PATH_FSTAB "/etc/fstab" #define FSTAB "/etc/fstab" /* deprecated */ #define FSTAB_RW "rw" /* read/write device */ #define FSTAB_RQ "rq" /* read/write with quotas */ #define FSTAB_RO "ro" /* read-only device */ #define FSTAB_SW "sw" /* swap device */ #define FSTAB_XX "xx" /* ignore totally */ struct fstab { char *fs_spec; /* block special device name */ char *fs_file; /* file system path prefix */ char *fs_vfstype; /* File system type, ufs, nfs */ char *fs_mntops; /* Mount options ala -o */ const char *fs_type; /* FSTAB_* from fs_mntops */ int fs_freq; /* dump frequency, in days */ int fs_passno; /* pass number on parallel dump */ }; __BEGIN_DECLS extern struct fstab *getfsent (void) __THROW; extern struct fstab *getfsspec (const char *__name) __THROW; extern struct fstab *getfsfile (const char *__name) __THROW; extern int setfsent (void) __THROW; extern void endfsent (void) __THROW; __END_DECLS #endif /* fstab.h */ fts.h 0000644 00000020264 15063602065 0005520 0 ustar 00 /* File tree traversal functions declarations. Copyright (C) 1994-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fts.h 8.3 (Berkeley) 8/14/94 */ #ifndef _FTS_H #define _FTS_H 1 #include <features.h> #include <sys/types.h> typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ int fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ int (*fts_compar) (const void *, const void *); /* compare fn */ #define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */ #define FTS_LOGICAL 0x0002 /* logical walk */ #define FTS_NOCHDIR 0x0004 /* don't change directories */ #define FTS_NOSTAT 0x0008 /* don't get stat info */ #define FTS_PHYSICAL 0x0010 /* physical walk */ #define FTS_SEEDOT 0x0020 /* return dot and dot-dot */ #define FTS_XDEV 0x0040 /* don't cross devices */ #define FTS_WHITEOUT 0x0080 /* return whiteout information */ #define FTS_OPTIONMASK 0x00ff /* valid user option mask */ #define FTS_NAMEONLY 0x0100 /* (private) child names only */ #define FTS_STOP 0x0200 /* (private) unrecoverable error */ int fts_options; /* fts_open options, global flags */ } FTS; #ifdef __USE_LARGEFILE64 typedef struct { struct _ftsent64 *fts_cur; /* current node */ struct _ftsent64 *fts_child; /* linked list of children */ struct _ftsent64 **fts_array; /* sort array */ dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ int fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ int (*fts_compar) (const void *, const void *); /* compare fn */ int fts_options; /* fts_open options, global flags */ } FTS64; #endif typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ struct _ftsent *fts_link; /* next file in directory */ long fts_number; /* local numeric value */ void *fts_pointer; /* local address value */ char *fts_accpath; /* access path */ char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ unsigned short fts_pathlen; /* strlen(fts_path) */ unsigned short fts_namelen; /* strlen(fts_name) */ ino_t fts_ino; /* inode */ dev_t fts_dev; /* device */ nlink_t fts_nlink; /* link count */ #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 short fts_level; /* depth (-1 to N) */ #define FTS_D 1 /* preorder directory */ #define FTS_DC 2 /* directory that causes cycles */ #define FTS_DEFAULT 3 /* none of the above */ #define FTS_DNR 4 /* unreadable directory */ #define FTS_DOT 5 /* dot or dot-dot */ #define FTS_DP 6 /* postorder directory */ #define FTS_ERR 7 /* error; errno is set */ #define FTS_F 8 /* regular file */ #define FTS_INIT 9 /* initialized only */ #define FTS_NS 10 /* stat(2) failed */ #define FTS_NSOK 11 /* no stat(2) requested */ #define FTS_SL 12 /* symbolic link */ #define FTS_SLNONE 13 /* symbolic link without target */ #define FTS_W 14 /* whiteout object */ unsigned short fts_info; /* user flags for FTSENT structure */ #define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ #define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ unsigned short fts_flags; /* private flags for FTSENT structure */ #define FTS_AGAIN 1 /* read node again */ #define FTS_FOLLOW 2 /* follow symbolic link */ #define FTS_NOINSTR 3 /* no instructions */ #define FTS_SKIP 4 /* discard node */ unsigned short fts_instr; /* fts_set() instructions */ struct stat *fts_statp; /* stat(2) information */ char fts_name[1]; /* file name */ } FTSENT; #ifdef __USE_LARGEFILE64 typedef struct _ftsent64 { struct _ftsent64 *fts_cycle; /* cycle node */ struct _ftsent64 *fts_parent; /* parent directory */ struct _ftsent64 *fts_link; /* next file in directory */ long fts_number; /* local numeric value */ void *fts_pointer; /* local address value */ char *fts_accpath; /* access path */ char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ unsigned short fts_pathlen; /* strlen(fts_path) */ unsigned short fts_namelen; /* strlen(fts_name) */ ino64_t fts_ino; /* inode */ dev_t fts_dev; /* device */ nlink_t fts_nlink; /* link count */ short fts_level; /* depth (-1 to N) */ unsigned short fts_info; /* user flags for FTSENT structure */ unsigned short fts_flags; /* private flags for FTSENT structure */ unsigned short fts_instr; /* fts_set() instructions */ struct stat64 *fts_statp; /* stat(2) information */ char fts_name[1]; /* file name */ } FTSENT64; #endif __BEGIN_DECLS #ifndef __USE_FILE_OFFSET64 FTSENT *fts_children (FTS *, int); int fts_close (FTS *); FTS *fts_open (char * const *, int, int (*)(const FTSENT **, const FTSENT **)); FTSENT *fts_read (FTS *); int fts_set (FTS *, FTSENT *, int) __THROW; #else # ifdef __REDIRECT FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children); int __REDIRECT (fts_close, (FTS *), fts64_close); FTS *__REDIRECT (fts_open, (char * const *, int, int (*)(const FTSENT **, const FTSENT **)), fts64_open); FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read); int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set); # else # define fts_children fts64_children # define fts_close fts64_close # define fts_open fts64_open # define fts_read fts64_read # define fts_set fts64_set # endif #endif #ifdef __USE_LARGEFILE64 FTSENT64 *fts64_children (FTS64 *, int); int fts64_close (FTS64 *); FTS64 *fts64_open (char * const *, int, int (*)(const FTSENT64 **, const FTSENT64 **)); FTSENT64 *fts64_read (FTS64 *); int fts64_set (FTS64 *, FTSENT64 *, int) __THROW; #endif __END_DECLS #endif /* fts.h */ ftw.h 0000644 00000012203 15063602065 0005516 0 ustar 00 /* Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * X/Open Portability Guide 4.2: ftw.h */ #ifndef _FTW_H #define _FTW_H 1 #include <features.h> #include <sys/types.h> #include <sys/stat.h> __BEGIN_DECLS /* Values for the FLAG argument to the user function passed to `ftw' and 'nftw'. */ enum { FTW_F, /* Regular file. */ #define FTW_F FTW_F FTW_D, /* Directory. */ #define FTW_D FTW_D FTW_DNR, /* Unreadable directory. */ #define FTW_DNR FTW_DNR FTW_NS, /* Unstatable file. */ #define FTW_NS FTW_NS #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED FTW_SL, /* Symbolic link. */ # define FTW_SL FTW_SL #endif #ifdef __USE_XOPEN_EXTENDED /* These flags are only passed from the `nftw' function. */ FTW_DP, /* Directory, all subdirs have been visited. */ # define FTW_DP FTW_DP FTW_SLN /* Symbolic link naming non-existing file. */ # define FTW_SLN FTW_SLN #endif /* extended X/Open */ }; #ifdef __USE_XOPEN_EXTENDED /* Flags for fourth argument of `nftw'. */ enum { FTW_PHYS = 1, /* Perform physical walk, ignore symlinks. */ # define FTW_PHYS FTW_PHYS FTW_MOUNT = 2, /* Report only files on same file system as the argument. */ # define FTW_MOUNT FTW_MOUNT FTW_CHDIR = 4, /* Change to current directory while processing it. */ # define FTW_CHDIR FTW_CHDIR FTW_DEPTH = 8 /* Report files in directory before directory itself.*/ # define FTW_DEPTH FTW_DEPTH # ifdef __USE_GNU , FTW_ACTIONRETVAL = 16 /* Assume callback to return FTW_* values instead of zero to continue and non-zero to terminate. */ # define FTW_ACTIONRETVAL FTW_ACTIONRETVAL # endif }; #ifdef __USE_GNU /* Return values from callback functions. */ enum { FTW_CONTINUE = 0, /* Continue with next sibling or for FTW_D with the first child. */ # define FTW_CONTINUE FTW_CONTINUE FTW_STOP = 1, /* Return from `ftw' or `nftw' with FTW_STOP as return value. */ # define FTW_STOP FTW_STOP FTW_SKIP_SUBTREE = 2, /* Only meaningful for FTW_D: Don't walk through the subtree, instead just continue with its next sibling. */ # define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory (if FTW_DEPTH) and then its siblings. */ # define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS }; #endif /* Structure used for fourth argument to callback function for `nftw'. */ struct FTW { int base; int level; }; #endif /* extended X/Open */ /* Convenient types for callback functions. */ typedef int (*__ftw_func_t) (const char *__filename, const struct stat *__status, int __flag); #ifdef __USE_LARGEFILE64 typedef int (*__ftw64_func_t) (const char *__filename, const struct stat64 *__status, int __flag); #endif #ifdef __USE_XOPEN_EXTENDED typedef int (*__nftw_func_t) (const char *__filename, const struct stat *__status, int __flag, struct FTW *__info); # ifdef __USE_LARGEFILE64 typedef int (*__nftw64_func_t) (const char *__filename, const struct stat64 *__status, int __flag, struct FTW *__info); # endif #endif /* Call a function on every element in a directory tree. This function is a possible cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors) __nonnull ((1, 2)); #else # ifdef __REDIRECT extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, int __descriptors), ftw64) __nonnull ((1, 2)); # else # define ftw ftw64 # endif #endif #ifdef __USE_LARGEFILE64 extern int ftw64 (const char *__dir, __ftw64_func_t __func, int __descriptors) __nonnull ((1, 2)); #endif #ifdef __USE_XOPEN_EXTENDED /* Call a function on every element in a directory tree. FLAG allows to specify the behaviour more detailed. This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag), nftw64) __nonnull ((1, 2)); # else # define nftw nftw64 # endif # endif # ifdef __USE_LARGEFILE64 extern int nftw64 (const char *__dir, __nftw64_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # endif #endif __END_DECLS #endif /* ftw.h */ gconv.h 0000644 00000010472 15063602065 0006040 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This header provides no interface for a user to the internals of the gconv implementation in the libc. Therefore there is no use for these definitions beside for writing additional gconv modules. */ #ifndef _GCONV_H #define _GCONV_H 1 #include <features.h> #include <bits/types/__mbstate_t.h> #include <bits/types/wint_t.h> #define __need_size_t #define __need_wchar_t #include <stddef.h> /* ISO 10646 value used to signal invalid value. */ #define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd) /* Error codes for gconv functions. */ enum { __GCONV_OK = 0, __GCONV_NOCONV, __GCONV_NODB, __GCONV_NOMEM, __GCONV_EMPTY_INPUT, __GCONV_FULL_OUTPUT, __GCONV_ILLEGAL_INPUT, __GCONV_INCOMPLETE_INPUT, __GCONV_ILLEGAL_DESCRIPTOR, __GCONV_INTERNAL_ERROR }; /* Flags the `__gconv_open' function can set. */ enum { __GCONV_IS_LAST = 0x0001, __GCONV_IGNORE_ERRORS = 0x0002, __GCONV_SWAP = 0x0004, __GCONV_TRANSLIT = 0x0008 }; /* Forward declarations. */ struct __gconv_step; struct __gconv_step_data; struct __gconv_loaded_object; /* Type of a conversion function. */ typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *, const unsigned char **, const unsigned char *, unsigned char **, size_t *, int, int); /* Type of a specialized conversion function for a single byte to INTERNAL. */ typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char); /* Constructor and destructor for local data for conversion step. */ typedef int (*__gconv_init_fct) (struct __gconv_step *); typedef void (*__gconv_end_fct) (struct __gconv_step *); /* Description of a conversion step. */ struct __gconv_step { struct __gconv_loaded_object *__shlib_handle; const char *__modname; int __counter; char *__from_name; char *__to_name; __gconv_fct __fct; __gconv_btowc_fct __btowc_fct; __gconv_init_fct __init_fct; __gconv_end_fct __end_fct; /* Information about the number of bytes needed or produced in this step. This helps optimizing the buffer sizes. */ int __min_needed_from; int __max_needed_from; int __min_needed_to; int __max_needed_to; /* Flag whether this is a stateful encoding or not. */ int __stateful; void *__data; /* Pointer to step-local data. */ }; /* Additional data for steps in use of conversion descriptor. This is allocated by the `init' function. */ struct __gconv_step_data { unsigned char *__outbuf; /* Output buffer for this step. */ unsigned char *__outbufend; /* Address of first byte after the output buffer. */ /* Is this the last module in the chain. */ int __flags; /* Counter for number of invocations of the module function for this descriptor. */ int __invocation_counter; /* Flag whether this is an internal use of the module (in the mb*towc* and wc*tomb* functions) or regular with iconv(3). */ int __internal_use; __mbstate_t *__statep; __mbstate_t __state; /* This element must not be used directly by any module; always use STATEP! */ }; /* Combine conversion step description with data. */ typedef struct __gconv_info { size_t __nsteps; struct __gconv_step *__steps; __extension__ struct __gconv_step_data __data[0]; } *__gconv_t; /* Transliteration using the locale's data. */ extern int __gconv_transliterate (struct __gconv_step *step, struct __gconv_step_data *step_data, const unsigned char *inbufstart, const unsigned char **inbufp, const unsigned char *inbufend, unsigned char **outbufstart, size_t *irreversible); #endif /* gconv.h */ getopt.h 0000644 00000002674 15063602065 0006233 0 ustar 00 /* Declarations for getopt. Copyright (C) 1989-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Unlike the bulk of the getopt implementation, this file is NOT part of gnulib; gnulib also has a getopt.h but it is different. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #include <features.h> /* The type of the 'argv' argument to getopt_long and getopt_long_only is properly 'char **', since both functions may write to the array (in order to move all the options to the beginning). However, for compatibility with old versions of LSB, glibc has to use 'char *const *' instead. */ #ifndef __getopt_argv_const # define __getopt_argv_const const #endif #include <bits/getopt_core.h> #include <bits/getopt_ext.h> #endif /* getopt.h */ glob.h 0000644 00000014726 15063602065 0005655 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GLOB_H #define _GLOB_H 1 #include <sys/cdefs.h> __BEGIN_DECLS /* We need `size_t' for the following definitions. */ #ifndef __size_t typedef __SIZE_TYPE__ __size_t; # if defined __USE_XOPEN || defined __USE_XOPEN2K8 typedef __SIZE_TYPE__ size_t; # endif #else /* The GNU CC stddef.h version defines __size_t as empty. We need a real definition. */ # undef __size_t # define __size_t size_t #endif /* Bits set in the FLAGS argument to `glob'. */ #define GLOB_ERR (1 << 0)/* Return on read errors. */ #define GLOB_MARK (1 << 1)/* Append a slash to each name. */ #define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ #define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ #define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ #define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ #if !defined __USE_POSIX2 || defined __USE_MISC # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ # define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ # define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ # define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ # define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error if the user name is not available. */ # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) #else # define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD) #endif /* Error returns from `glob'. */ #define GLOB_NOSPACE 1 /* Ran out of memory. */ #define GLOB_ABORTED 2 /* Read error. */ #define GLOB_NOMATCH 3 /* No matches found. */ #define GLOB_NOSYS 4 /* Not implemented. */ #ifdef __USE_GNU /* Previous versions of this file defined GLOB_ABEND instead of GLOB_ABORTED. Provide a compatibility definition here. */ # define GLOB_ABEND GLOB_ABORTED #endif /* Structure describing a globbing run. */ #ifdef __USE_GNU struct stat; #endif typedef struct { __size_t gl_pathc; /* Count of paths matched by the pattern. */ char **gl_pathv; /* List of matched pathnames. */ __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ /* If the GLOB_ALTDIRFUNC flag is set, the following functions are used instead of the normal file access functions. */ void (*gl_closedir) (void *); #ifdef __USE_GNU struct dirent *(*gl_readdir) (void *); #else void *(*gl_readdir) (void *); #endif void *(*gl_opendir) (const char *); #ifdef __USE_GNU int (*gl_lstat) (const char *__restrict, struct stat *__restrict); int (*gl_stat) (const char *__restrict, struct stat *__restrict); #else int (*gl_lstat) (const char *__restrict, void *__restrict); int (*gl_stat) (const char *__restrict, void *__restrict); #endif } glob_t; #ifdef __USE_LARGEFILE64 # ifdef __USE_GNU struct stat64; # endif typedef struct { __size_t gl_pathc; char **gl_pathv; __size_t gl_offs; int gl_flags; /* If the GLOB_ALTDIRFUNC flag is set, the following functions are used instead of the normal file access functions. */ void (*gl_closedir) (void *); # ifdef __USE_GNU struct dirent64 *(*gl_readdir) (void *); # else void *(*gl_readdir) (void *); # endif void *(*gl_opendir) (const char *); # ifdef __USE_GNU int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict); int (*gl_stat) (const char *__restrict, struct stat64 *__restrict); # else int (*gl_lstat) (const char *__restrict, void *__restrict); int (*gl_stat) (const char *__restrict, void *__restrict); # endif } glob64_t; #endif /* Do glob searching for PATTERN, placing results in PGLOB. The bits defined above may be set in FLAGS. If a directory cannot be opened or read and ERRFUNC is not nil, it is called with the pathname that caused the error, and the `errno' value from the failing call; if it returns non-zero `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ #if !defined __USE_FILE_OFFSET64 extern int glob (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), glob_t *__restrict __pglob) __THROW; /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void globfree (glob_t *__pglob) __THROW; #else extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), glob_t *__restrict __pglob), glob64); extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); #endif #ifdef __USE_LARGEFILE64 extern int glob64 (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), glob64_t *__restrict __pglob) __THROW; extern void globfree64 (glob64_t *__pglob) __THROW; #endif #ifdef __USE_GNU /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. This function is not part of the interface specified by POSIX.2 but several programs want to use it. */ extern int glob_pattern_p (const char *__pattern, int __quote) __THROW; #endif __END_DECLS #endif /* glob.h */ gnu-versions.h 0000644 00000004446 15063602065 0007367 0 ustar 00 /* Header with interface version macros for library pieces copied elsewhere. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GNU_VERSIONS_H #define _GNU_VERSIONS_H 1 /* This file exists to define these few macros. Each specifies a version number associated with the library interface of a piece of the C library which is also distributed with other GNU packages. These pieces are both part of the GNU C library and also distributed with other GNU packages so those packages may use their facilities on systems lacking the GNU C library. The source files for each piece surround all their code with `#ifndef ELIDE_CODE' after defining it with this: #define OBSTACK_INTERFACE_VERSION 1 #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 #include <gnu-versions.h> #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION #define ELIDE_CODE #endif #endif This allows those one to avoid compiling those files when part of a GNU package not libc, on a system using a GNU C library that supports the same interface. Please preserve the format of the comments after each macro. And remember, if any of these versions change, the libc.so major version number must change too (so avoid it)! */ #define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */ #define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */ #define _GNU_GLOB_INTERFACE_VERSION 2 /* vs posix/glob.c */ #define _GNU_GETOPT_INTERFACE_VERSION 2 /* vs posix/getopt.c and posix/getopt1.c */ #endif /* gnu-versions.h */ grp.h 0000644 00000015036 15063602065 0005515 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 9.2.1 Group Database Access <grp.h> */ #ifndef _GRP_H #define _GRP_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #define __need_size_t #include <stddef.h> /* For the Single Unix specification we must define this type here. */ #if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined #endif /* The group structure. */ struct group { char *gr_name; /* Group name. */ char *gr_passwd; /* Password. */ __gid_t gr_gid; /* Group ID. */ char **gr_mem; /* Member list. */ }; #ifdef __USE_MISC # include <bits/types/FILE.h> #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Rewind the group-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setgrent (void); /* Close the group-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endgrent (void); /* Read an entry from the group-file stream, opening it if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrent (void); #endif #ifdef __USE_MISC /* Read a group entry from STREAM. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct group *fgetgrent (FILE *__stream); #endif #ifdef __USE_GNU /* Write the given entry onto the given stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int putgrent (const struct group *__restrict __p, FILE *__restrict __f); #endif /* Search for an entry with a matching group ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrgid (__gid_t __gid); /* Search for an entry with a matching group name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrnam (const char *__name); #ifdef __USE_POSIX # ifdef __USE_MISC /* Reasonable value for the buffer sized used in the reentrant functions below. But better use `sysconf'. */ # define NSS_BUFLEN_GROUP 1024 # endif /* Reentrant versions of some of the functions above. PLEASE NOTE: the `getgrent_r' function is not (yet) standardized. The interface may change in later versions of this library. But the interface is designed following the principals used for the other reentrant functions so the chances are good this is what the POSIX people would choose. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ # ifdef __USE_GNU extern int getgrent_r (struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # endif /* Search for an entry with a matching group ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); /* Search for an entry with a matching group name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getgrnam_r (const char *__restrict __name, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # ifdef __USE_MISC /* Read a group entry from STREAM. This function is not standardized an probably never will. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fgetgrent_r (FILE *__restrict __stream, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # endif #endif /* POSIX or reentrant */ #ifdef __USE_MISC # define __need_size_t # include <stddef.h> /* Set the group set for the current user to GROUPS (N of them). */ extern int setgroups (size_t __n, const __gid_t *__groups) __THROW; /* Store at most *NGROUPS members of the group set for USER into *GROUPS. Also include GROUP. The actual number of groups found is returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getgrouplist (const char *__user, __gid_t __group, __gid_t *__groups, int *__ngroups); /* Initialize the group set for the current user by reading the group database and using all groups of which USER is a member. Also include GROUP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int initgroups (const char *__user, __gid_t __group); #endif /* Use misc. */ __END_DECLS #endif /* grp.h */ zlib.h 0000644 00000274005 15063602065 0005670 0 ustar 00 /* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.11, January 15th, 2017 Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ #ifndef ZLIB_H #define ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.2.11" #define ZLIB_VERNUM 0x12b0 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 #define ZLIB_VER_REVISION 11 #define ZLIB_VER_SUBREVISION 0 /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. Compression can be done in a single step if the buffers are large enough, or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. The compressed data format used by default by the in-memory functions is the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped around a deflate stream, which is itself documented in RFC 1951. The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. This library can optionally read and write gzip and raw deflate streams in memory as well. The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single- file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in the case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { z_const Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total number of input bytes read so far */ Bytef *next_out; /* next output byte will go here */ uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total number of bytes output so far */ z_const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: binary or text for deflate, or the decoding state for inflate */ uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; /* gzip header information passed to and from zlib routines. See RFC 1952 for more details on the meanings of these fields. */ typedef struct gz_header_s { int text; /* true if compressed data believed to be text */ uLong time; /* modification time */ int xflags; /* extra flags (not used when writing a gzip file) */ int os; /* operating system */ Bytef *extra; /* pointer to extra field or Z_NULL if none */ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ uInt extra_max; /* space at extra (only when reading header) */ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ uInt name_max; /* space at name (only when reading header) */ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ uInt comm_max; /* space at comment (only when reading header) */ int hcrc; /* true if there was or will be a header crc */ int done; /* true when done reading gzip header (not used when writing a gzip file) */ } gz_header; typedef gz_header FAR *gz_headerp; /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application. The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value. zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. In that case, zlib is thread-safe. When zalloc and zfree are Z_NULL on entry to the initialization function, they are set to internal routines that use the standard library functions malloc() and free(). On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use by the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 #define Z_BLOCK 5 #define Z_TREES 6 /* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_RLE 3 #define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 #define Z_TEXT 1 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 /* Possible values of the data_type field for deflate() */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ /* basic functions */ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check is automatically made by deflateInit and inflateInit. */ /* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Generate more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary. Some output may be provided even if flush is zero. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), which can be used if desired to determine whether or not there is more ouput in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumulate before producing output, in order to maximize compression. If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. This completes the current deflate block and follows it with an empty stored block that is three bits plus filler bits to the next byte, followed by four bytes (00 00 ff ff). If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the output buffer, but the output is not aligned to a byte boundary. All of the input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. This completes the current deflate block and follows it with an empty fixed codes block that is 10 bits long. This assures that enough bytes are output in order for the decompressor to finish the block before the empty fixed codes block. If flush is set to Z_BLOCK, a deflate block is completed and emitted, as for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to seven bits of the current block are held to be written as the next byte after the next deflate block is completed. In this case, the decompressor may not be provided enough bits at this point in order to complete decompression of the data provided so far to the compressor. It may need to wait for the next block to be emitted. This is for advanced applications that need to control the emission of deflate blocks. If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out is greater than six to avoid repeated flush markers due to avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. Z_FINISH can be used in the first deflate call after deflateInit if all the compression is to be done in a single step. In order to complete in one call, avail_out must be at least the value returned by deflateBound (see below). Then deflate is guaranteed to return Z_STREAM_END. If not enough output space is provided, deflate will not return Z_STREAM_END, and it must be called again as described above. deflate() sets strm->adler to the Adler-32 checksum of all input read so far (that is, total_in bytes). If a gzip stream is being generated, then strm->adler will be the CRC-32 checksum of the input read so far. (See deflateInit2 below.) deflate() may update strm->data_type if it can make a good guess about the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was Z_NULL or the state was inadvertently written over by the application), or Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and deflate() can be called again with more input and more output space to continue compressing. */ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. In the current version of inflate, the provided input is not read or consumed. The allocation of a sliding window will be deferred to the first call of inflate (if the decompression does not complete on the first call). If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit does not perform any decompression. Actual decompression will be done by inflate(). So next_in, and avail_in, next_out, and avail_out are unused and unchanged. The current implementation of inflateInit() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), then next_in and avail_in are updated accordingly, and processing will resume at this point for the next call of inflate(). - Generate more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. If the caller of inflate() does not provide both available input and available output space, it is possible that there will be no progress made. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer. Z_BLOCK requests that inflate() stop if and when it gets to the next deflate block boundary. When decoding the zlib or gzip format, this will cause inflate() to return immediately after the header and before the first block. When doing a raw inflate, inflate() will go ahead and process the first block, and will return when it gets to the end of that block, or when it runs out of data. The Z_BLOCK option assists in appending to or combining deflate streams. To assist in this, on return inflate() always sets strm->data_type to the number of unused bits in the last byte taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate stream. The end-of-block will not be indicated until all of the uncompressed data from that block has been written to strm->next_out. The number of unused bits may in general be greater than seven, except when bit 7 of data_type is set, in which case the number of unused bits will be less than eight. data_type is set as noted here every time inflate() returns for all flush options, and so can be used to determine the amount of currently consumed input in bits. The Z_TREES option behaves as Z_BLOCK does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of strm->data_type when inflate() returns immediately after reaching the end of the deflate block header. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all of the uncompressed data for the operation to complete. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The use of Z_FINISH is not required to perform an inflation in one step. However it may be used to inform inflate that a faster approach can be used for the single inflate() call. Z_FINISH also informs inflate to not maintain a sliding window if the stream completes, which reduces inflate's memory footprint. If the stream does not complete, either because not all of the stream is provided or not enough output space is provided, then a sliding window will be allocated and inflate() can be called again to continue the operation as if Z_NO_FLUSH had been used. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the first call. So the effects of the flush parameter in this implementation are on the return value of inflate() as noted below, when inflate() returns early when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of memory for a sliding window when Z_FINISH is used. If a preset dictionary is needed after this call (see inflateSetDictionary below), inflate sets strm->adler to the Adler-32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the Adler-32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed Adler-32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() can decompress and check either zlib-wrapped or gzip-wrapped deflate data. The header type is detected automatically, if requested when initializing with inflateInit2(). Any information contained in the gzip header is not retained unless inflateGetHeader() is used. When processing gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output produced so far. The CRC-32 is checked against the gzip trailer, as is the uncompressed length, modulo 2^32. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect check value, in which case strm->msg points to a string with a more specific error), Z_STREAM_ERROR if the stream structure was inconsistent (for example next_in or next_out was Z_NULL, or the state was inadvertently written over by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress was possible or if there was not enough room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing. If Z_DATA_ERROR is returned, the application may then call inflateSync() to look for a good compression block if a partial recovery of the data is to be attempted. */ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state was inconsistent. */ /* Advanced functions */ /* The following functions are needed only in some special applications. */ /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy)); This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. For the current implementation of deflate(), a windowBits value of 8 (a window size of 256 bytes) is not supported. As a result, a request for 8 will result in 9 (a 512-byte window). In that case, providing 8 to inflateInit2() will result in an error when the zlib header with 9 is checked against the initialization of inflate(). The remedy is to not use 8 with deflateInit2() with this initialization, or at least in that case use 9 with inflateInit2(). windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data with no zlib header or trailer, and will not compute a check value. windowBits can also be greater than 15 for optional gzip encoding. Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no header crc, and the operating system will be set to the appropriate value, if the operating system was determined at compile time. If a gzip stream is being written, strm->adler is a CRC-32 instead of an Adler-32. For raw deflate or gzip encoding, a request for a 256-byte window is rejected as invalid, since only the zlib header provides a means of transmitting the window size to the decompressor. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no string match), or Z_RLE to limit match distances to one (run-length encoding). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. When using the zlib format, this function must be called immediately after deflateInit, deflateInit2 or deflateReset, and before any call of deflate. When doing raw deflate, this function must be called either before any call of deflate, or immediately after the completion of a deflate block, i.e. after all input has been consumed and all output has been delivered when using any of the flush options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size provided in deflateInit or deflateInit2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. In addition, the current implementation of deflate will use at most the window size minus 262 bytes of the provided dictionary. Upon return of this function, strm->adler is set to the Adler-32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The Adler-32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) If a raw deflate was requested, then the Adler-32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent (for example if deflate has already been called for this stream or if not at a block boundary for raw deflate). deflateSetDictionary does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, Bytef *dictionary, uInt *dictLength)); /* Returns the sliding dictionary being maintained by deflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. Similary, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up to 258 bytes less in that case, due to how zlib's implementation of deflate manages the sliding window and lookahead for matches, where matches can be up to 258 bytes long. If the application needs the last window-size bytes of input, then that would need to be saved by the application outside of zlib. deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. */ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate the internal compression state. The stream will leave the compression level and any other attributes that may have been set unchanged. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2(). This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the strategy is changed, and if there have been any deflate() calls since the state was initialized or reset, then the input available so far is compressed with the old level and strategy using deflate(strm, Z_BLOCK). There are three approaches for the compression levels 0, 1..3, and 4..9 respectively. The new level and strategy will take effect at the next call of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not take effect. In this case, deflateParams() can be called again with the same parameters and more output space to try again. In order to assure a change in the parameters on the first try, the deflate stream should be flushed using deflate() with Z_BLOCK or other flush request until strm.avail_out is not zero, before calling deflateParams(). Then no more input data should be provided before the deflateParams() call. If this is done, the old level and strategy will be applied to the data compressed before deflateParams(), and the new level and strategy will be applied to the the data compressed after deflateParams(). deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if there was not enough output space to complete the compression of the available input data before a change in the strategy or approach. Note that in the case of a Z_BUF_ERROR, the parameters are not changed. A return value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be retried with more output space. */ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for searching for the best matching string, and even then only by the most fanatic optimizer trying to squeeze out the last compressed bit for their specific input data. Read the deflate.c source code for the meaning of the max_lazy, good_length, nice_length, and max_chain parameters. deflateTune() can be called after deflateInit() or deflateInit2(), and returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(), and after deflateSetHeader(), if used. This would be used to allocate an output buffer for deflation in a single pass, and so would be called before deflate(). If that first deflate() call is provided the sourceLen input bytes, an output buffer allocated to the size returned by deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed to return Z_STREAM_END. Note that it is possible for the compressed size to be larger than the value returned by deflateBound() if flush options other than Z_FINISH or Z_NO_FLUSH are used. */ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, unsigned *pending, int *bits)); /* deflatePending() returns the number of bytes and bits of output that have been generated, but not yet provided in the available output. The bytes not provided would be due to the available output space having being consumed. The number of bits of output not provided are between 0 and 7, where they await more bits to join them in order to fill out a full byte. If pending or bits are Z_NULL, then those values are not set. deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits leftover from a previous deflate stream when appending to it. As such, this function can only be used for raw deflate, and must be used before the first deflate() call after a deflateInit2() or deflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the output. deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called after deflateInit2() or deflateReset() and before the first call of deflate(). The text, time, os, extra field, name, and comment information in the provided gz_header structure are written to the gzip header (xflag is ignored -- the extra flags are set according to the compression level). The caller must assure that, if not Z_NULL, name and comment are terminated with a zero byte, and that if extra is not Z_NULL, that extra_len bytes are available there. If hcrc is true, a gzip header crc is included. Note that the current versions of the command-line version of gzip (up through version 1.3.x) do not support header crc's, and will report that it is a "multi-part gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, the time set to zero, and os set to 255, with no extra, name, or comment fields. The gzip header is returned to the default state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. windowBits can also be zero to request that inflate use the window size in the zlib header of the compressed stream. windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an Adler-32 or a CRC-32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see below), inflate() will not automatically decode concatenated gzip streams. inflate() will return Z_STREAM_END at the end of the gzip stream. The state would need to be reset to continue decoding a subsequent gzip stream. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from possibly reading the zlib header if present: actual decompression will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unused and unchanged.) The current implementation of inflateInit2() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the Adler-32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). For raw inflate, this function can be called at any time to set the dictionary. If the provided dictionary is smaller than the window and there is already data in the window, then the provided dictionary will amend what's there. The application must insure that the dictionary that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect Adler-32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, Bytef *dictionary, uInt *dictLength)); /* Returns the sliding dictionary being maintained by inflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. Similary, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. */ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a possible full flush point (see above for the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync searches for a 00 00 FF FF pattern in the compressed data. All full flush points have this pattern, but not all occurrences of this pattern are full flush points. inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when randomly accessing a large stream. The first pass through the stream can periodically record the inflate state, allowing restarting inflate at those points when randomly accessing the stream. inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, int windowBits)); /* This function is the same as inflateReset, but it also permits changing the wrap and window size requests. The windowBits parameter is interpreted the same as it is for inflateInit2. If the window size is changed, then the memory allocated for the window is freed, and the window will be reallocated by inflate() if needed. inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL), or if the windowBits parameter is invalid. */ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); /* This function inserts bits in the inflate input stream. The intent is that this function is used to start inflating at a bit position in the middle of a byte. The provided bits will be used before any bytes are used from next_in. This function should only be used with raw inflate, and should be used before the first inflate() call after inflateInit2() or inflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the input. If bits is negative, then the input stream bit buffer is emptied. Then inflatePrime() can be called again to put bits in the buffer. This is used to clear out bits leftover after feeding inflate a block description prior to feeding inflate codes. inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); /* This function returns two values, one in the lower 16 bits of the return value, and the other in the remaining upper bits, obtained by shifting the return value down 16 bits. If the upper value is -1 and the lower value is zero, then inflate() is currently decoding information outside of a block. If the upper value is -1 and the lower value is non-zero, then inflate is in the middle of a stored block, with the lower value equaling the number of bytes from the input remaining to copy. If the upper value is not -1, then it is the number of bits back from the current bit position in the input of the code (literal or length/distance pair) currently being processed. In that case the lower value is the number of bytes already emitted for that code. A code is being processed if inflate is waiting for more input to complete decoding of the code, or if it has completed decoding but is waiting for more output space to write the literal or match data. inflateMark() is used to mark locations in the input data for random access, which may be at bit positions, and to note those cases where the output of a code may span boundaries of random access blocks. The current location in the input stream can be determined from avail_in and data_type as noted in the description for the Z_BLOCK flush parameter for inflate. inflateMark returns the value noted above, or -65536 if the provided source stream state was inconsistent. */ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after inflateInit2() or inflateReset(), and before the first call of inflate(). As inflate() processes the gzip stream, head->done is zero until the header is completed, at which time head->done is set to one. If a zlib stream is being decoded, then head->done is set to -1 to indicate that there will be no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be used to force inflate() to return immediately after header processing is complete and before any actual data is decompressed. The text, time, xflags, and os fields are filled in with the gzip header contents. hcrc is set to true if there is a header CRC. (The header CRC was valid if done is set to one.) If extra is not Z_NULL, then extra_max contains the maximum number of bytes to write to extra. Once done is true, extra_len contains the actual extra field length, and extra contains the extra field, or that field truncated if extra_max is less than extra_len. If name is not Z_NULL, then up to name_max characters are written there, terminated with a zero unless the length is greater than name_max. If comment is not Z_NULL, then up to comm_max characters are written there, terminated with a zero unless the length is greater than comm_max. When any of extra, name, or comment are not Z_NULL and the respective field is not present in the header, then that field is set to Z_NULL to signal its absence. This allows the use of deflateSetHeader() with the returned structure to duplicate the header. However if those fields are set to allocated memory, then the application will need to save those pointers elsewhere so that they can be eventually freed. If inflateGetHeader is not used, then the header information is simply discarded. The header is always checked for validity, including the header CRC if present. inflateReset() will reset the process to discard the header information. The application would need to call inflateGetHeader() again to retrieve the header from the next gzip stream. inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, unsigned char FAR *window)); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized before the call. If zalloc and zfree are Z_NULL, then the default library- derived memory allocation routines are used. windowBits is the base two logarithm of the window size, in the range 8..15. window is a caller supplied buffer of that size. Except for special applications where it is assured that deflate was used with small window sizes, windowBits must be 15 and a 32K byte window must be supplied to be able to decompress general deflate streams. See inflateBack() for the usage of these routines. inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of the parameters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ typedef unsigned (*in_func) OF((void FAR *, z_const unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is potentially more efficient than inflate() for file i/o applications, in that it avoids copying between the output and the sliding window by simply making the window itself the output buffer. inflate() can be faster on modern CPUs when used with large buffers. inflateBack() trusts the application to not change the output buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. inflateBack() may then be used multiple times to inflate a complete, raw deflate stream with each call. inflateBackEnd() is then called to free the allocated state. A raw deflate stream is one with no zlib or gzip header or trailer. This routine would normally be used in a utility that reads zip or gzip files and writes out uncompressed files. The utility would decode the header and process the trailer on its own, hence this routine expects only the raw deflate stream to decompress. This is different from the default behavior of inflate(), which expects a zlib header and trailer around the deflate stream. inflateBack() uses two subroutines supplied by the caller that are then called by inflateBack() for input and output. inflateBack() calls those routines until it reads a complete deflate stream and writes out all of the uncompressed data, or until it encounters an error. The function's parameters and return types are defined above in the in_func and out_func typedefs. inflateBack() will call in(in_desc, &buf) which should return the number of bytes of provided input, and a pointer to that input in buf. If there is no input available, in() must return zero -- buf is ignored in that case -- and inflateBack() will return a buffer error. inflateBack() will call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() should return zero on success, or non-zero on failure. If out() returns non-zero, inflateBack() will return with an error. Neither in() nor out() are permitted to change the contents of the window provided to inflateBackInit(), which is also the buffer that out() uses to write from. The length written by out() will be at most the window size. Any non-zero amount of input may be provided by in(). For convenience, inflateBack() can be provided input on the first call by setting strm->next_in and strm->avail_in. If that input is exhausted, then in() will be called. Therefore strm->next_in must be initialized before calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in must also be initialized, and then if strm->avail_in is not zero, input will initially be taken from strm->next_in[0 .. strm->avail_in - 1]. The in_desc and out_desc parameters of inflateBack() is passed as the first parameter of in() and out() respectively when they are called. These descriptors can be optionally used to pass any information that the caller- supplied in() and out() functions need to do their job. On return, inflateBack() will set strm->next_in and strm->avail_in to pass back any unused input that was provided by the last in() call. The return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR if in() or out() returned an error, Z_DATA_ERROR if there was a format error in the deflate stream (in which case strm->msg is set to indicate the nature of the error), or Z_STREAM_ERROR if the stream was not properly initialized. In the case of Z_BUF_ERROR, an input or output error can be distinguished using strm->next_in which will be Z_NULL only if in() returned an error. If strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning non-zero. (in() will always be called before out(), so strm->next_in is assured to be defined if out() returns non-zero.) Note that inflateBack() cannot return Z_OK. */ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); /* All memory allocated by inflateBackInit() is freed. inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream state was inconsistent. */ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1.0: size of uInt 3.2: size of uLong 5.4: size of voidpf (pointer) 7.6: size of z_off_t Compiler, assembler, and debug options: 8: ZLIB_DEBUG 9: ASMV or ASMINF -- use ASM code 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention 11: 0 (reserved) One-time table building (smaller code, but not thread-safe if true): 12: BUILDFIXED -- build static block decoding tables when needed 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed 14,15: 0 (reserved) Library content (indicates missing functionality): 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking deflate code when not needed) 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect and decode gzip streams (to avoid linking crc code) 18-19: 0 (reserved) Operation variations (changes in library functionality): 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate 21: FASTEST -- deflate algorithm with only one, lowest compression level 22,23: 0 (reserved) The sprintf variant used by gzprintf (zero is best): 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! 26: 0 = returns value, 1 = void -- 1 means inferred string length returned Remainder: 27-31: 0 (reserved) */ #ifndef Z_SOLO /* utility functions */ /* The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can be modified if you need special options. */ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed data. compress() is equivalent to compress2() with a level parameter of Z_DEFAULT_COMPRESSION. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed data. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the uncompressed data. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In the case where there is not enough room, uncompress() will fill the output buffer with the uncompressed data up to that point. */ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong *sourceLen)); /* Same as uncompress, except that sourceLen is a pointer, where the length of the source is *sourceLen. On return, *sourceLen is the number of source bytes consumed. */ /* gzip file access functions */ /* This library supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio, using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. */ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression as in "wb9F". (See the description of deflateInit2 for more information about the strategy parameter.) 'T' will request transparent writing or appending with no compression and not using the gzip format. "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since reading and writing to the same gzip file is not supported. The addition of "x" when writing will create the file exclusively, which fails if the file already exists. On systems that support it, the addition of "e" when reading or writing will set the flag to close the file on an execve() call. These functions, as well as gzip, will read and decode a sequence of gzip streams in a file. The append function of gzopen() can be used to create such a file. (Also see gzflush() for another way to do this.) When appending, gzopen does not test whether the file begins with a gzip stream, nor does it look for the end of the gzip streams to begin appending. gzopen will simply append a gzip stream to the existing file. gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. When reading, this will be detected automatically by looking for the magic two- byte gzip header. gzopen returns NULL if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the file could not be opened. */ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (if the file has been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, mode);. The duplicated descriptor should be saved to avoid a leak, since gzdopen does not close fd if it fails. If you are using fileno() to get the file descriptor from a FILE *, then you will have to use dup() to avoid double-close()ing the file descriptor. Both gzclose() and fclose() will close the associated file descriptor, so they need to have different file descriptors. gzdopen returns NULL if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen will not detect if fd is invalid (unless fd is -1). */ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); /* Set the internal buffer size used by this library's functions. The default buffer size is 8192 bytes. This function must be called after gzopen() or gzdopen(), and before any other calls that read or write the file. The buffer memory allocation is always deferred to the first read or write. Three times that size in buffer space is allocated. A larger buffer size of, for example, 64K or 128K bytes will noticeably increase the speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). gzbuffer() returns 0 on success, or -1 on failure, such as being called too late. */ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. Previously provided data is flushed before the parameter change. gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not opened for writing, Z_ERRNO if there is an error writing the flushed data, or Z_MEM_ERROR if there is a memory allocation error. */ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. After reaching the end of a gzip stream in the input, gzread will continue to read, looking for another gzip stream. Any number of gzip streams may be concatenated in the input file, and will all be decompressed by gzread(). If something other than a gzip stream is encountered after a gzip stream, that remaining trailing garbage is ignored (and no error is returned). gzread can be used to read a gzip file that is being concurrently written. Upon reaching the end of the input, gzread will return with the available data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then gzclearerr can be used to clear the end of file indicator in order to permit gzread to be tried again. Z_OK indicates that a gzip stream was completed on the last gzread. Z_BUF_ERROR indicates that the input file ended in the middle of a gzip stream. Note that gzread does not return -1 in the event of an incomplete gzip stream. This error is deferred until gzclose(), which will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip stream. Alternatively, gzerror can be used before gzclose to detect this case. gzread returns the number of uncompressed bytes actually read, less than len for end of file, or -1 for error. If len is too large to fit in an int, then nothing is read, -1 is returned, and the error state is set to Z_STREAM_ERROR. */ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, gzFile file)); /* Read up to nitems items of size size from file to buf, otherwise operating as gzread() does. This duplicates the interface of stdio's fread(), with size_t request and return types. If the library defines size_t, then z_size_t is identical to size_t. If not, then z_size_t is an unsigned integer type that can contain a pointer. gzfread() returns the number of full items read of size size, or zero if the end of the file was reached and a full item could not be read, or if there was an error. gzerror() must be consulted if zero is returned in order to determine if there was an error. If the multiplication of size and nitems overflows, i.e. the product does not fit in a z_size_t, then nothing is read, zero is returned, and the error state is set to Z_STREAM_ERROR. In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a multiple of size, then the final partial item is nevetheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior is the same as the behavior of fread() implementations in common libraries, but it prevents the direct use of gzfread() to read a concurrently written file, reseting and retrying on end-of-file, when size is not 1. */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes written or 0 in case of error. */ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, z_size_t nitems, gzFile file)); /* gzfwrite() writes nitems items of size size from buf to file, duplicating the interface of stdio's fwrite(), with size_t request and return types. If the library defines size_t, then z_size_t is identical to size_t. If not, then z_size_t is an unsigned integer type that can contain a pointer. gzfwrite() returns the number of full items written of size size, or zero if there was an error. If the multiplication of size and nitems overflows, i.e. the product does not fit in a z_size_t, then nothing is written, zero is returned, and the error state is set to Z_STREAM_ERROR. */ ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* Converts, formats, and writes the arguments to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or a negative zlib error code in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if zlib was compiled with the insecure functions sprintf() or vsprintf() because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. If any characters are read or if len == 1, the string is terminated with a null character. If no characters are read due to an end-of-file or len < 1, then the buffer is left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. it does not check to see if file is NULL, nor whether the structure file points to has been clobbered or not. */ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* Push one character back onto the stream to be read as the first character on the next read. At least one character of push-back is allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the output buffer size of pushed characters is allowed. (See gzbuffer above.) The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). */ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new gzip stream will be started in the output. gzread() is able to read such concatenated gzip streams. gzflush should be called only when strictly necessary because it will degrade compression if called too often. */ /* ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. */ ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ /* ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream, and is zero when starting, even if appending or reading a gzip stream from the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ /* ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); Returns the current offset in the file being read or written. This offset includes the count of bytes that precede the gzip stream, for example when appending or when using gzdopen() for reading. When reading, the offset does not include as yet unused buffered input. This information can be used for a progress indicator. On error, gzoffset() returns -1. */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* Returns true (1) if the end-of-file indicator has been set while reading, false (0) otherwise. Note that the end-of-file indicator is set only if the read tried to go past the end of the input, but came up short. Therefore, just like feof(), gzeof() may return false even if there is no more data to read, in the event that the last read request was for the exact number of bytes remaining in the input file. This will happen if the input file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file has grown since the previous end of file was detected. */ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* Returns true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input does not contain a gzip stream. If gzdirect() is used immediately after gzopen() or gzdopen() it will cause buffers to be allocated to allow reading the file to determine if it is a gzip file. Therefore if gzbuffer() is used, it should be called before gzdirect(). When writing, gzdirect() returns true (1) if transparent writing was requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: gzdirect() is not needed when writing. Transparent writing must be explicitly requested, so the application already knows the answer. When linking statically, using gzdirect() will include all of the zlib code for gzip file reading and decompression, which may not be desired.) */ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the last read ended in the middle of a gzip stream, or Z_OK on success. */ ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); /* Same as gzclose(), but gzclose_r() is only for use when reading, and gzclose_w() is only for use when writing or appending. The advantage to using these instead of gzclose() is that they avoid linking in zlib compression or decompression code that is not used when only reading or only writing respectively. If gzclose() is used, then both compression and decompression code will be included the application when linking to a static zlib library. */ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is closed, then the string previously returned by gzerror will no longer be available. gzerror() should be used to distinguish errors from end-of-file for those functions above that do not distinguish those cases in their return values. */ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* Clears the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ #endif /* !Z_SOLO */ /* checksum functions */ /* These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is Z_NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. Usage example: uLong adler = adler32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = adler32(adler, buffer, length); } if (adler != original_adler) error(); */ ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, z_size_t len)); /* Same as adler32(), but with a size_t length. */ /* ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, z_off_t len2)); Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note that the z_off_t type (like off_t) is a signed integer. If len2 is negative, the result has no meaning or utility. */ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. If buf is Z_NULL, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = crc32(crc, buffer, length); } if (crc != original_crc) error(); */ ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, z_size_t len)); /* Same as crc32(), but with a size_t length. */ /* ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2. */ /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, const char *version, int stream_size)); ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)); #ifdef Z_PREFIX_SET # define z_deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) # define z_inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) # define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) # define z_inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ (int)sizeof(z_stream)) # define z_inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, (int)sizeof(z_stream)) #else # define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) # define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) # define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) # define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ (int)sizeof(z_stream)) # define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, (int)sizeof(z_stream)) #endif #ifndef Z_SOLO /* gzgetc() macro and its supporting function and exposed data structure. Note * that the real internal state is much larger than the exposed structure. * This abbreviated structure exposes just enough for the gzgetc() macro. The * user should not mess with these exposed elements, since their names or * behavior could change in the future, perhaps even capriciously. They can * only be used by the gzgetc() macro. You have been warned. */ struct gzFile_s { unsigned have; unsigned char *next; z_off64_t pos; }; ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ #ifdef Z_PREFIX_SET # undef z_gzgetc # define z_gzgetc(g) \ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) #else # define gzgetc(g) \ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) #endif /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if * both are true, the application gets the *64 functions, and the regular * functions are changed to 64 bits) -- in case these are set on systems * without large file support, _LFS64_LARGEFILE must also be true */ #ifdef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) # ifdef Z_PREFIX_SET # define z_gzopen z_gzopen64 # define z_gzseek z_gzseek64 # define z_gztell z_gztell64 # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 # else # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 # endif # ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif #else /* Z_SOLO */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif /* !Z_SOLO */ /* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifndef Z_SOLO ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, const char *format, va_list va)); # endif #endif #ifdef __cplusplus } #endif #endif /* ZLIB_H */ zstd.h 0000644 00000352244 15063602065 0005716 0 ustar 00 /* * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. */ #if defined (__cplusplus) extern "C" { #endif #ifndef ZSTD_H_235446 #define ZSTD_H_235446 /* ====== Dependency ======*/ #include <limits.h> /* INT_MAX */ #include <stddef.h> /* size_t */ /* ===== ZSTDLIB_API : control library symbols visibility ===== */ #ifndef ZSTDLIB_VISIBILITY # if defined(__GNUC__) && (__GNUC__ >= 4) # define ZSTDLIB_VISIBILITY __attribute__ ((visibility ("default"))) # else # define ZSTDLIB_VISIBILITY # endif #endif #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) # define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBILITY #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) # define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ #else # define ZSTDLIB_API ZSTDLIB_VISIBILITY #endif /******************************************************************************* Introduction zstd, short for Zstandard, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios. The zstd compression library provides in-memory compression and decompression functions. The library supports regular compression levels from 1 up to ZSTD_maxCLevel(), which is currently 22. Levels >= 20, labeled `--ultra`, should be used with caution, as they require more memory. The library also offers negative compression levels, which extend the range of speed vs. ratio preferences. The lower the level, the faster the speed (at the cost of compression). Compression can be done in: - a single step (described as Simple API) - a single step, reusing a context (described as Explicit context) - unbounded multiple steps (described as Streaming compression) The compression ratio achievable on small data can be highly improved using a dictionary. Dictionary compression can be performed in: - a single step (described as Simple dictionary API) - a single step, reusing a dictionary (described as Bulk-processing dictionary API) Advanced experimental functions can be accessed using `#define ZSTD_STATIC_LINKING_ONLY` before including zstd.h. Advanced experimental APIs should never be used with a dynamically-linked library. They are not "stable"; their definitions or signatures may change in the future. Only static linking is allowed. *******************************************************************************/ /*------ Version ------*/ #define ZSTD_VERSION_MAJOR 1 #define ZSTD_VERSION_MINOR 4 #define ZSTD_VERSION_RELEASE 4 #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) ZSTDLIB_API unsigned ZSTD_versionNumber(void); /**< to check runtime library version */ #define ZSTD_LIB_VERSION ZSTD_VERSION_MAJOR.ZSTD_VERSION_MINOR.ZSTD_VERSION_RELEASE #define ZSTD_QUOTE(str) #str #define ZSTD_EXPAND_AND_QUOTE(str) ZSTD_QUOTE(str) #define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION) ZSTDLIB_API const char* ZSTD_versionString(void); /* requires v1.3.0+ */ /* ************************************* * Default constant ***************************************/ #ifndef ZSTD_CLEVEL_DEFAULT # define ZSTD_CLEVEL_DEFAULT 3 #endif /* ************************************* * Constants ***************************************/ /* All magic numbers are supposed read/written to/from files/memory using little-endian convention */ #define ZSTD_MAGICNUMBER 0xFD2FB528 /* valid since v0.8.0 */ #define ZSTD_MAGIC_DICTIONARY 0xEC30A437 /* valid since v0.7.0 */ #define ZSTD_MAGIC_SKIPPABLE_START 0x184D2A50 /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */ #define ZSTD_MAGIC_SKIPPABLE_MASK 0xFFFFFFF0 #define ZSTD_BLOCKSIZELOG_MAX 17 #define ZSTD_BLOCKSIZE_MAX (1<<ZSTD_BLOCKSIZELOG_MAX) /*************************************** * Simple API ***************************************/ /*! ZSTD_compress() : * Compresses `src` content as a single zstd compressed frame into already allocated `dst`. * Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`. * @return : compressed size written into `dst` (<= `dstCapacity), * or an error code if it fails (which can be tested using ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel); /*! ZSTD_decompress() : * `compressedSize` : must be the _exact_ size of some number of compressed and/or skippable frames. * `dstCapacity` is an upper bound of originalSize to regenerate. * If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data. * @return : the number of bytes decompressed into `dst` (<= `dstCapacity`), * or an errorCode if it fails (which can be tested using ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity, const void* src, size_t compressedSize); /*! ZSTD_getFrameContentSize() : requires v1.3.0+ * `src` should point to the start of a ZSTD encoded frame. * `srcSize` must be at least as large as the frame header. * hint : any size >= `ZSTD_frameHeaderSize_max` is large enough. * @return : - decompressed size of `src` frame content, if known * - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined * - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) * note 1 : a 0 return value means the frame is valid but "empty". * note 2 : decompressed size is an optional field, it may not be present, typically in streaming mode. * When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. * In which case, it's necessary to use streaming mode to decompress data. * Optionally, application can rely on some implicit limit, * as ZSTD_decompress() only needs an upper bound of decompressed size. * (For example, data could be necessarily cut into blocks <= 16 KB). * note 3 : decompressed size is always present when compression is completed using single-pass functions, * such as ZSTD_compress(), ZSTD_compressCCtx() ZSTD_compress_usingDict() or ZSTD_compress_usingCDict(). * note 4 : decompressed size can be very large (64-bits value), * potentially larger than what local system can handle as a single memory segment. * In which case, it's necessary to use streaming mode to decompress data. * note 5 : If source is untrusted, decompressed size could be wrong or intentionally modified. * Always ensure return value fits within application's authorized limits. * Each application can set its own limits. * note 6 : This function replaces ZSTD_getDecompressedSize() */ #define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1) #define ZSTD_CONTENTSIZE_ERROR (0ULL - 2) ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize); /*! ZSTD_getDecompressedSize() : * NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize(). * Both functions work the same way, but ZSTD_getDecompressedSize() blends * "empty", "unknown" and "error" results to the same return value (0), * while ZSTD_getFrameContentSize() gives them separate return values. * @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise. */ ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); /*! ZSTD_findFrameCompressedSize() : * `src` should point to the start of a ZSTD frame or skippable frame. * `srcSize` must be >= first frame size * @return : the compressed size of the first frame starting at `src`, * suitable to pass as `srcSize` to `ZSTD_decompress` or similar, * or an error code if input is invalid */ ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize); /*====== Helper functions ======*/ #define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */ ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */ ZSTDLIB_API unsigned ZSTD_isError(size_t code); /*!< tells if a `size_t` function result is an error code */ ZSTDLIB_API const char* ZSTD_getErrorName(size_t code); /*!< provides readable string from an error code */ ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed */ ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compression level available */ /*************************************** * Explicit context ***************************************/ /*= Compression context * When compressing many times, * it is recommended to allocate a context just once, * and re-use it for each successive compression operation. * This will make workload friendlier for system's memory. * Note : re-using context is just a speed / resource optimization. * It doesn't change the compression ratio, which remains identical. * Note 2 : In multi-threaded environments, * use one different context per thread for parallel execution. */ typedef struct ZSTD_CCtx_s ZSTD_CCtx; ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx(void); ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx); /*! ZSTD_compressCCtx() : * Same as ZSTD_compress(), using an explicit ZSTD_CCtx. * Important : in order to behave similarly to `ZSTD_compress()`, * this function compresses at requested compression level, * __ignoring any other parameter__ . * If any advanced parameter was set using the advanced API, * they will all be reset. Only `compressionLevel` remains. */ ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel); /*= Decompression context * When decompressing many times, * it is recommended to allocate a context only once, * and re-use it for each successive compression operation. * This will make workload friendlier for system's memory. * Use one context per thread for parallel execution. */ typedef struct ZSTD_DCtx_s ZSTD_DCtx; ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx(void); ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); /*! ZSTD_decompressDCtx() : * Same as ZSTD_decompress(), * requires an allocated ZSTD_DCtx. * Compatible with sticky parameters. */ ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); /*************************************** * Advanced compression API ***************************************/ /* API design : * Parameters are pushed one by one into an existing context, * using ZSTD_CCtx_set*() functions. * Pushed parameters are sticky : they are valid for next compressed frame, and any subsequent frame. * "sticky" parameters are applicable to `ZSTD_compress2()` and `ZSTD_compressStream*()` ! * __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ . * * It's possible to reset all parameters to "default" using ZSTD_CCtx_reset(). * * This API supercedes all other "advanced" API entry points in the experimental section. * In the future, we expect to remove from experimental API entry points which are redundant with this API. */ /* Compression strategies, listed from fastest to strongest */ typedef enum { ZSTD_fast=1, ZSTD_dfast=2, ZSTD_greedy=3, ZSTD_lazy=4, ZSTD_lazy2=5, ZSTD_btlazy2=6, ZSTD_btopt=7, ZSTD_btultra=8, ZSTD_btultra2=9 /* note : new strategies _might_ be added in the future. Only the order (from fast to strong) is guaranteed */ } ZSTD_strategy; typedef enum { /* compression parameters * Note: When compressing with a ZSTD_CDict these parameters are superseded * by the parameters used to construct the ZSTD_CDict. * See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */ ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table. * Note that exact compression parameters are dynamically determined, * depending on both compression level and srcSize (when known). * Default level is ZSTD_CLEVEL_DEFAULT==3. * Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT. * Note 1 : it's possible to pass a negative compression level. * Note 2 : setting a level resets all other compression parameters to default */ /* Advanced compression parameters : * It's possible to pin down compression parameters to some specific values. * In which case, these values are no longer dynamically selected by the compressor */ ZSTD_c_windowLog=101, /* Maximum allowed back-reference distance, expressed as power of 2. * This will set a memory budget for streaming decompression, * with larger values requiring more memory * and typically compressing more. * Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX. * Special: value 0 means "use default windowLog". * Note: Using a windowLog greater than ZSTD_WINDOWLOG_LIMIT_DEFAULT * requires explicitly allowing such size at streaming decompression stage. */ ZSTD_c_hashLog=102, /* Size of the initial probe table, as a power of 2. * Resulting memory usage is (1 << (hashLog+2)). * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX. * Larger tables improve compression ratio of strategies <= dFast, * and improve speed of strategies > dFast. * Special: value 0 means "use default hashLog". */ ZSTD_c_chainLog=103, /* Size of the multi-probe search table, as a power of 2. * Resulting memory usage is (1 << (chainLog+2)). * Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX. * Larger tables result in better and slower compression. * This parameter is useless for "fast" strategy. * It's still useful when using "dfast" strategy, * in which case it defines a secondary probe table. * Special: value 0 means "use default chainLog". */ ZSTD_c_searchLog=104, /* Number of search attempts, as a power of 2. * More attempts result in better and slower compression. * This parameter is useless for "fast" and "dFast" strategies. * Special: value 0 means "use default searchLog". */ ZSTD_c_minMatch=105, /* Minimum size of searched matches. * Note that Zstandard can still find matches of smaller size, * it just tweaks its search algorithm to look for this size and larger. * Larger values increase compression and decompression speed, but decrease ratio. * Must be clamped between ZSTD_MINMATCH_MIN and ZSTD_MINMATCH_MAX. * Note that currently, for all strategies < btopt, effective minimum is 4. * , for all strategies > fast, effective maximum is 6. * Special: value 0 means "use default minMatchLength". */ ZSTD_c_targetLength=106, /* Impact of this field depends on strategy. * For strategies btopt, btultra & btultra2: * Length of Match considered "good enough" to stop search. * Larger values make compression stronger, and slower. * For strategy fast: * Distance between match sampling. * Larger values make compression faster, and weaker. * Special: value 0 means "use default targetLength". */ ZSTD_c_strategy=107, /* See ZSTD_strategy enum definition. * The higher the value of selected strategy, the more complex it is, * resulting in stronger and slower compression. * Special: value 0 means "use default strategy". */ /* LDM mode parameters */ ZSTD_c_enableLongDistanceMatching=160, /* Enable long distance matching. * This parameter is designed to improve compression ratio * for large inputs, by finding large matches at long distance. * It increases memory usage and window size. * Note: enabling this parameter increases default ZSTD_c_windowLog to 128 MB * except when expressly set to a different value. */ ZSTD_c_ldmHashLog=161, /* Size of the table for long distance matching, as a power of 2. * Larger values increase memory usage and compression ratio, * but decrease compression speed. * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX * default: windowlog - 7. * Special: value 0 means "automatically determine hashlog". */ ZSTD_c_ldmMinMatch=162, /* Minimum match size for long distance matcher. * Larger/too small values usually decrease compression ratio. * Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX. * Special: value 0 means "use default value" (default: 64). */ ZSTD_c_ldmBucketSizeLog=163, /* Log size of each bucket in the LDM hash table for collision resolution. * Larger values improve collision resolution but decrease compression speed. * The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX. * Special: value 0 means "use default value" (default: 3). */ ZSTD_c_ldmHashRateLog=164, /* Frequency of inserting/looking up entries into the LDM hash table. * Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN). * Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage. * Larger values improve compression speed. * Deviating far from default value will likely result in a compression ratio decrease. * Special: value 0 means "automatically determine hashRateLog". */ /* frame parameters */ ZSTD_c_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1) * Content size must be known at the beginning of compression. * This is automatically the case when using ZSTD_compress2(), * For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */ ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */ ZSTD_c_dictIDFlag=202, /* When applicable, dictionary's ID is written into frame header (default:1) */ /* multi-threading parameters */ /* These parameters are only useful if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD). * They return an error otherwise. */ ZSTD_c_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel. * When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() : * ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller, * while compression work is performed in parallel, within worker threads. * (note : a strong exception to this rule is when first invocation of ZSTD_compressStream2() sets ZSTD_e_end : * in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call). * More workers improve speed, but also increase memory usage. * Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */ ZSTD_c_jobSize=401, /* Size of a compression job. This value is enforced only when nbWorkers >= 1. * Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads. * 0 means default, which is dynamically determined based on compression parameters. * Job size must be a minimum of overlap size, or 1 MB, whichever is largest. * The minimum size is automatically and transparently enforced. */ ZSTD_c_overlapLog=402, /* Control the overlap size, as a fraction of window size. * The overlap size is an amount of data reloaded from previous job at the beginning of a new job. * It helps preserve compression ratio, while each job is compressed in parallel. * This value is enforced only when nbWorkers >= 1. * Larger values increase compression ratio, but decrease speed. * Possible values range from 0 to 9 : * - 0 means "default" : value will be determined by the library, depending on strategy * - 1 means "no overlap" * - 9 means "full overlap", using a full window size. * Each intermediate rank increases/decreases load size by a factor 2 : * 9: full window; 8: w/2; 7: w/4; 6: w/8; 5:w/16; 4: w/32; 3:w/64; 2:w/128; 1:no overlap; 0:default * default value varies between 6 and 9, depending on strategy */ /* note : additional experimental parameters are also available * within the experimental section of the API. * At the time of this writing, they include : * ZSTD_c_rsyncable * ZSTD_c_format * ZSTD_c_forceMaxWindow * ZSTD_c_forceAttachDict * ZSTD_c_literalCompressionMode * ZSTD_c_targetCBlockSize * ZSTD_c_srcSizeHint * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. * note : never ever use experimentalParam? names directly; * also, the enums values themselves are unstable and can still change. */ ZSTD_c_experimentalParam1=500, ZSTD_c_experimentalParam2=10, ZSTD_c_experimentalParam3=1000, ZSTD_c_experimentalParam4=1001, ZSTD_c_experimentalParam5=1002, ZSTD_c_experimentalParam6=1003, ZSTD_c_experimentalParam7=1004 } ZSTD_cParameter; typedef struct { size_t error; int lowerBound; int upperBound; } ZSTD_bounds; /*! ZSTD_cParam_getBounds() : * All parameters must belong to an interval with lower and upper bounds, * otherwise they will either trigger an error or be automatically clamped. * @return : a structure, ZSTD_bounds, which contains * - an error status field, which must be tested using ZSTD_isError() * - lower and upper bounds, both inclusive */ ZSTDLIB_API ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter cParam); /*! ZSTD_CCtx_setParameter() : * Set one compression parameter, selected by enum ZSTD_cParameter. * All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds(). * Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). * Setting a parameter is generally only possible during frame initialization (before starting compression). * Exception : when using multi-threading mode (nbWorkers >= 1), * the following parameters can be updated _during_ compression (within same frame): * => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy. * new parameters will be active for next job only (after a flush()). * @return : an error code (which can be tested using ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value); /*! ZSTD_CCtx_setPledgedSrcSize() : * Total input data size to be compressed as a single frame. * Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag. * This value will also be controlled at end of frame, and trigger an error if not respected. * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame. * In order to mean "unknown content size", pass constant ZSTD_CONTENTSIZE_UNKNOWN. * ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame. * Note 2 : pledgedSrcSize is only valid once, for the next frame. * It's discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN. * Note 3 : Whenever all input data is provided and consumed in a single round, * for example with ZSTD_compress2(), * or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end), * this value is automatically overridden by srcSize instead. */ ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize); typedef enum { ZSTD_reset_session_only = 1, ZSTD_reset_parameters = 2, ZSTD_reset_session_and_parameters = 3 } ZSTD_ResetDirective; /*! ZSTD_CCtx_reset() : * There are 2 different things that can be reset, independently or jointly : * - The session : will stop compressing current frame, and make CCtx ready to start a new one. * Useful after an error, or to interrupt any ongoing compression. * Any internal data not yet flushed is cancelled. * Compression parameters and dictionary remain unchanged. * They will be used to compress next frame. * Resetting session never fails. * - The parameters : changes all parameters back to "default". * This removes any reference to any dictionary too. * Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing) * otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError()) * - Both : similar to resetting the session, followed by resetting parameters. */ ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset); /*! ZSTD_compress2() : * Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API. * ZSTD_compress2() always starts a new frame. * Should cctx hold data from a previously unfinished frame, everything about it is forgotten. * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*() * - The function is always blocking, returns when compression is completed. * Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`. * @return : compressed size written into `dst` (<= `dstCapacity), * or an error code if it fails (which can be tested using ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_compress2( ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); /*************************************** * Advanced decompression API ***************************************/ /* The advanced API pushes parameters one by one into an existing DCtx context. * Parameters are sticky, and remain valid for all following frames * using the same DCtx context. * It's possible to reset parameters to default values using ZSTD_DCtx_reset(). * Note : This API is compatible with existing ZSTD_decompressDCtx() and ZSTD_decompressStream(). * Therefore, no new decompression function is necessary. */ typedef enum { ZSTD_d_windowLogMax=100, /* Select a size limit (in power of 2) beyond which * the streaming API will refuse to allocate memory buffer * in order to protect the host from unreasonable memory requirements. * This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode. * By default, a decompression context accepts window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT). * Special: value 0 means "use default maximum windowLog". */ /* note : additional experimental parameters are also available * within the experimental section of the API. * At the time of this writing, they include : * ZSTD_c_format * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. * note : never ever use experimentalParam? names directly */ ZSTD_d_experimentalParam1=1000 } ZSTD_dParameter; /*! ZSTD_dParam_getBounds() : * All parameters must belong to an interval with lower and upper bounds, * otherwise they will either trigger an error or be automatically clamped. * @return : a structure, ZSTD_bounds, which contains * - an error status field, which must be tested using ZSTD_isError() * - both lower and upper bounds, inclusive */ ZSTDLIB_API ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam); /*! ZSTD_DCtx_setParameter() : * Set one compression parameter, selected by enum ZSTD_dParameter. * All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds(). * Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). * Setting a parameter is only possible during frame initialization (before starting decompression). * @return : 0, or an error code (which can be tested using ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int value); /*! ZSTD_DCtx_reset() : * Return a DCtx to clean state. * Session and parameters can be reset jointly or separately. * Parameters can only be reset when no active frame is being decompressed. * @return : 0, or an error code, which can be tested with ZSTD_isError() */ ZSTDLIB_API size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset); /**************************** * Streaming ****************************/ typedef struct ZSTD_inBuffer_s { const void* src; /**< start of input buffer */ size_t size; /**< size of input buffer */ size_t pos; /**< position where reading stopped. Will be updated. Necessarily 0 <= pos <= size */ } ZSTD_inBuffer; typedef struct ZSTD_outBuffer_s { void* dst; /**< start of output buffer */ size_t size; /**< size of output buffer */ size_t pos; /**< position where writing stopped. Will be updated. Necessarily 0 <= pos <= size */ } ZSTD_outBuffer; /*-*********************************************************************** * Streaming compression - HowTo * * A ZSTD_CStream object is required to track streaming operation. * Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources. * ZSTD_CStream objects can be reused multiple times on consecutive compression operations. * It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. * * For parallel execution, use one separate ZSTD_CStream per thread. * * note : since v1.3.0, ZSTD_CStream and ZSTD_CCtx are the same thing. * * Parameters are sticky : when starting a new compression on the same context, * it will re-use the same sticky parameters as previous compression session. * When in doubt, it's recommended to fully initialize the context before usage. * Use ZSTD_CCtx_reset() to reset the context and ZSTD_CCtx_setParameter(), * ZSTD_CCtx_setPledgedSrcSize(), or ZSTD_CCtx_loadDictionary() and friends to * set more specific parameters, the pledged source size, or load a dictionary. * * Use ZSTD_compressStream2() with ZSTD_e_continue as many times as necessary to * consume input stream. The function will automatically update both `pos` * fields within `input` and `output`. * Note that the function may not consume the entire input, for example, because * the output buffer is already full, in which case `input.pos < input.size`. * The caller must check if input has been entirely consumed. * If not, the caller must make some room to receive more compressed data, * and then present again remaining input data. * note: ZSTD_e_continue is guaranteed to make some forward progress when called, * but doesn't guarantee maximal forward progress. This is especially relevant * when compressing with multiple threads. The call won't block if it can * consume some input, but if it can't it will wait for some, but not all, * output to be flushed. * @return : provides a minimum amount of data remaining to be flushed from internal buffers * or an error code, which can be tested using ZSTD_isError(). * * At any moment, it's possible to flush whatever data might remain stuck within internal buffer, * using ZSTD_compressStream2() with ZSTD_e_flush. `output->pos` will be updated. * Note that, if `output->size` is too small, a single invocation with ZSTD_e_flush might not be enough (return code > 0). * In which case, make some room to receive more compressed data, and call again ZSTD_compressStream2() with ZSTD_e_flush. * You must continue calling ZSTD_compressStream2() with ZSTD_e_flush until it returns 0, at which point you can change the * operation. * note: ZSTD_e_flush will flush as much output as possible, meaning when compressing with multiple threads, it will * block until the flush is complete or the output buffer is full. * @return : 0 if internal buffers are entirely flushed, * >0 if some data still present within internal buffer (the value is minimal estimation of remaining size), * or an error code, which can be tested using ZSTD_isError(). * * Calling ZSTD_compressStream2() with ZSTD_e_end instructs to finish a frame. * It will perform a flush and write frame epilogue. * The epilogue is required for decoders to consider a frame completed. * flush operation is the same, and follows same rules as calling ZSTD_compressStream2() with ZSTD_e_flush. * You must continue calling ZSTD_compressStream2() with ZSTD_e_end until it returns 0, at which point you are free to * start a new frame. * note: ZSTD_e_end will flush as much output as possible, meaning when compressing with multiple threads, it will * block until the flush is complete or the output buffer is full. * @return : 0 if frame fully completed and fully flushed, * >0 if some data still present within internal buffer (the value is minimal estimation of remaining size), * or an error code, which can be tested using ZSTD_isError(). * * *******************************************************************/ typedef ZSTD_CCtx ZSTD_CStream; /**< CCtx and CStream are now effectively same object (>= v1.3.0) */ /* Continue to distinguish them for compatibility with older versions <= v1.2.0 */ /*===== ZSTD_CStream management functions =====*/ ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream(void); ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream* zcs); /*===== Streaming compression functions =====*/ typedef enum { ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal compression ratio */ ZSTD_e_flush=1, /* flush any data provided so far, * it creates (at least) one new block, that can be decoded immediately on reception; * frame will continue: any future data can still reference previously compressed data, improving compression. * note : multithreaded compression will block to flush as much output as possible. */ ZSTD_e_end=2 /* flush any remaining data _and_ close current frame. * note that frame is only closed after compressed data is fully flushed (return value == 0). * After that point, any additional data starts a new frame. * note : each frame is independent (does not reference any content from previous frame). : note : multithreaded compression will block to flush as much output as possible. */ } ZSTD_EndDirective; /*! ZSTD_compressStream2() : * Behaves about the same as ZSTD_compressStream, with additional control on end directive. * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*() * - Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode) * - output->pos must be <= dstCapacity, input->pos must be <= srcSize * - output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit. * - When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller. * - When nbWorkers>=1, function is non-blocking : it just acquires a copy of input, and distributes jobs to internal worker threads, flush whatever is available, * and then immediately returns, just indicating that there is some data remaining to be flushed. * The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte. * - Exception : if the first call requests a ZSTD_e_end directive and provides enough dstCapacity, the function delegates to ZSTD_compress2() which is always blocking. * - @return provides a minimum amount of data remaining to be flushed from internal buffers * or an error code, which can be tested using ZSTD_isError(). * if @return != 0, flush is not fully completed, there is still some data left within internal buffers. * This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers. * For ZSTD_e_end, @return == 0 when internal buffers are fully flushed and frame is completed. * - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0), * only ZSTD_e_end or ZSTD_e_flush operations are allowed. * Before starting a new compression job, or changing compression parameters, * it is required to fully flush internal buffers. */ ZSTDLIB_API size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, ZSTD_outBuffer* output, ZSTD_inBuffer* input, ZSTD_EndDirective endOp); /* These buffer sizes are softly recommended. * They are not required : ZSTD_compressStream*() happily accepts any buffer size, for both input and output. * Respecting the recommended size just makes it a bit easier for ZSTD_compressStream*(), * reducing the amount of memory shuffling and buffering, resulting in minor performance savings. * * However, note that these recommendations are from the perspective of a C caller program. * If the streaming interface is invoked from some other language, * especially managed ones such as Java or Go, through a foreign function interface such as jni or cgo, * a major performance rule is to reduce crossing such interface to an absolute minimum. * It's not rare that performance ends being spent more into the interface, rather than compression itself. * In which cases, prefer using large buffers, as large as practical, * for both input and output, to reduce the nb of roundtrips. */ ZSTDLIB_API size_t ZSTD_CStreamInSize(void); /**< recommended size for input buffer */ ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block. */ /* ***************************************************************************** * This following is a legacy streaming API. * It can be replaced by ZSTD_CCtx_reset() and ZSTD_compressStream2(). * It is redundant, but remains fully supported. * Advanced parameters and dictionary compression can only be used through the * new API. ******************************************************************************/ /*! * Equivalent to: * * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any) * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); */ ZSTDLIB_API size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel); /*! * Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue). * NOTE: The return value is different. ZSTD_compressStream() returns a hint for * the next read size (if non-zero and not an error). ZSTD_compressStream2() * returns the minimum nb of bytes left to flush (if non-zero and not an error). */ ZSTDLIB_API size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input); /*! Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush). */ ZSTDLIB_API size_t ZSTD_flushStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); /*! Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end). */ ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); /*-*************************************************************************** * Streaming decompression - HowTo * * A ZSTD_DStream object is required to track streaming operations. * Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources. * ZSTD_DStream objects can be re-used multiple times. * * Use ZSTD_initDStream() to start a new decompression operation. * @return : recommended first input size * Alternatively, use advanced API to set specific properties. * * Use ZSTD_decompressStream() repetitively to consume your input. * The function will update both `pos` fields. * If `input.pos < input.size`, some input has not been consumed. * It's up to the caller to present again remaining data. * The function tries to flush all data decoded immediately, respecting output buffer size. * If `output.pos < output.size`, decoder has flushed everything it could. * But if `output.pos == output.size`, there might be some data left within internal buffers., * In which case, call ZSTD_decompressStream() again to flush whatever remains in the buffer. * Note : with no additional input provided, amount of data flushed is necessarily <= ZSTD_BLOCKSIZE_MAX. * @return : 0 when a frame is completely decoded and fully flushed, * or an error code, which can be tested using ZSTD_isError(), * or any other value > 0, which means there is still some decoding or flushing to do to complete current frame : * the return value is a suggested next input size (just a hint for better latency) * that will never request more than the remaining frame size. * *******************************************************************************/ typedef ZSTD_DCtx ZSTD_DStream; /**< DCtx and DStream are now effectively same object (>= v1.3.0) */ /* For compatibility with versions <= v1.2.0, prefer differentiating them. */ /*===== ZSTD_DStream management functions =====*/ ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream(void); ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream* zds); /*===== Streaming decompression functions =====*/ /* This function is redundant with the advanced API and equivalent to: * * ZSTD_DCtx_reset(zds); * ZSTD_DCtx_refDDict(zds, NULL); */ ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream* zds); ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input); ZSTDLIB_API size_t ZSTD_DStreamInSize(void); /*!< recommended size for input buffer */ ZSTDLIB_API size_t ZSTD_DStreamOutSize(void); /*!< recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances. */ /************************** * Simple dictionary API ***************************/ /*! ZSTD_compress_usingDict() : * Compression at an explicit compression level using a Dictionary. * A dictionary can be any arbitrary data segment (also called a prefix), * or a buffer with specified information (see dictBuilder/zdict.h). * Note : This function loads the dictionary, resulting in significant startup delay. * It's intended for a dictionary used only once. * Note 2 : When `dict == NULL || dictSize < 8` no dictionary is used. */ ZSTDLIB_API size_t ZSTD_compress_usingDict(ZSTD_CCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const void* dict,size_t dictSize, int compressionLevel); /*! ZSTD_decompress_usingDict() : * Decompression using a known Dictionary. * Dictionary must be identical to the one used during compression. * Note : This function loads the dictionary, resulting in significant startup delay. * It's intended for a dictionary used only once. * Note : When `dict == NULL || dictSize < 8` no dictionary is used. */ ZSTDLIB_API size_t ZSTD_decompress_usingDict(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const void* dict,size_t dictSize); /*********************************** * Bulk processing dictionary API **********************************/ typedef struct ZSTD_CDict_s ZSTD_CDict; /*! ZSTD_createCDict() : * When compressing multiple messages or blocks using the same dictionary, * it's recommended to digest the dictionary only once, since it's a costly operation. * ZSTD_createCDict() will create a state from digesting a dictionary. * The resulting state can be used for future compression operations with very limited startup cost. * ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. * @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict. * Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content. * Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer, * in which case the only thing that it transports is the @compressionLevel. * This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively, * expecting a ZSTD_CDict parameter with any data, including those without a known dictionary. */ ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize, int compressionLevel); /*! ZSTD_freeCDict() : * Function frees memory allocated by ZSTD_createCDict(). */ ZSTDLIB_API size_t ZSTD_freeCDict(ZSTD_CDict* CDict); /*! ZSTD_compress_usingCDict() : * Compression using a digested Dictionary. * Recommended when same dictionary is used multiple times. * Note : compression level is _decided at dictionary creation time_, * and frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no) */ ZSTDLIB_API size_t ZSTD_compress_usingCDict(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const ZSTD_CDict* cdict); typedef struct ZSTD_DDict_s ZSTD_DDict; /*! ZSTD_createDDict() : * Create a digested dictionary, ready to start decompression operation without startup delay. * dictBuffer can be released after DDict creation, as its content is copied inside DDict. */ ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict(const void* dictBuffer, size_t dictSize); /*! ZSTD_freeDDict() : * Function frees memory allocated with ZSTD_createDDict() */ ZSTDLIB_API size_t ZSTD_freeDDict(ZSTD_DDict* ddict); /*! ZSTD_decompress_usingDDict() : * Decompression using a digested Dictionary. * Recommended when same dictionary is used multiple times. */ ZSTDLIB_API size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const ZSTD_DDict* ddict); /******************************** * Dictionary helper functions *******************************/ /*! ZSTD_getDictID_fromDict() : * Provides the dictID stored within dictionary. * if @return == 0, the dictionary is not conformant with Zstandard specification. * It can still be loaded, but as a content-only dictionary. */ ZSTDLIB_API unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize); /*! ZSTD_getDictID_fromDDict() : * Provides the dictID of the dictionary loaded into `ddict`. * If @return == 0, the dictionary is not conformant to Zstandard specification, or empty. * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */ ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict); /*! ZSTD_getDictID_fromFrame() : * Provides the dictID required to decompressed the frame stored within `src`. * If @return == 0, the dictID could not be decoded. * This could for one of the following reasons : * - The frame does not require a dictionary to be decoded (most common case). * - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information. * Note : this use case also happens when using a non-conformant dictionary. * - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`). * - This is not a Zstandard frame. * When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code. */ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); /******************************************************************************* * Advanced dictionary and prefix API * * This API allows dictionaries to be used with ZSTD_compress2(), * ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and * only reset with the context is reset with ZSTD_reset_parameters or * ZSTD_reset_session_and_parameters. Prefixes are single-use. ******************************************************************************/ /*! ZSTD_CCtx_loadDictionary() : * Create an internal CDict from `dict` buffer. * Decompression will have to use same dictionary. * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary, * meaning "return to no-dictionary mode". * Note 1 : Dictionary is sticky, it will be used for all future compressed frames. * To return to "no-dictionary" situation, load a NULL dictionary (or reset parameters). * Note 2 : Loading a dictionary involves building tables. * It's also a CPU consuming operation, with non-negligible impact on latency. * Tables are dependent on compression parameters, and for this reason, * compression parameters can no longer be changed after loading a dictionary. * Note 3 :`dict` content will be copied internally. * Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead. * In such a case, dictionary buffer must outlive its users. * Note 4 : Use ZSTD_CCtx_loadDictionary_advanced() * to precisely select how dictionary content must be interpreted. */ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize); /*! ZSTD_CCtx_refCDict() : * Reference a prepared dictionary, to be used for all next compressed frames. * Note that compression parameters are enforced from within CDict, * and supersede any compression parameter previously set within CCtx. * The parameters ignored are labled as "superseded-by-cdict" in the ZSTD_cParameter enum docs. * The ignored parameters will be used again if the CCtx is returned to no-dictionary mode. * The dictionary will remain valid for future compressed frames using same CCtx. * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Special : Referencing a NULL CDict means "return to no-dictionary mode". * Note 1 : Currently, only one dictionary can be managed. * Referencing a new dictionary effectively "discards" any previous one. * Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx. */ ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /*! ZSTD_CCtx_refPrefix() : * Reference a prefix (single-usage dictionary) for next compressed frame. * A prefix is **only used once**. Tables are discarded at end of frame (ZSTD_e_end). * Decompression will need same prefix to properly regenerate data. * Compressing with a prefix is similar in outcome as performing a diff and compressing it, * but performs much faster, especially during decompression (compression speed is tunable with compression level). * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary * Note 1 : Prefix buffer is referenced. It **must** outlive compression. * Its content must remain unmodified during compression. * Note 2 : If the intention is to diff some large src data blob with some prior version of itself, * ensure that the window size is large enough to contain the entire source. * See ZSTD_c_windowLog. * Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters. * It's a CPU consuming operation, with non-negligible impact on latency. * If there is a need to use the same prefix multiple times, consider loadDictionary instead. * Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent). * Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation. */ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize); /*! ZSTD_DCtx_loadDictionary() : * Create an internal DDict from dict buffer, * to be used to decompress next frames. * The dictionary remains valid for all future frames, until explicitly invalidated. * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, * meaning "return to no-dictionary mode". * Note 1 : Loading a dictionary involves building tables, * which has a non-negligible impact on CPU usage and latency. * It's recommended to "load once, use many times", to amortize the cost * Note 2 :`dict` content will be copied internally, so `dict` can be released after loading. * Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead. * Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of * how dictionary content is loaded and interpreted. */ ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); /*! ZSTD_DCtx_refDDict() : * Reference a prepared dictionary, to be used to decompress next frames. * The dictionary remains active for decompression of future frames using same DCtx. * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Note 1 : Currently, only one dictionary can be managed. * Referencing a new dictionary effectively "discards" any previous one. * Special: referencing a NULL DDict means "return to no-dictionary mode". * Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx. */ ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); /*! ZSTD_DCtx_refPrefix() : * Reference a prefix (single-usage dictionary) to decompress next frame. * This is the reverse operation of ZSTD_CCtx_refPrefix(), * and must use the same prefix as the one used during compression. * Prefix is **only used once**. Reference is discarded at end of frame. * End of frame is reached when ZSTD_decompressStream() returns 0. * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Note 1 : Adding any prefix (including NULL) invalidates any previously set prefix or dictionary * Note 2 : Prefix buffer is referenced. It **must** outlive decompression. * Prefix buffer must remain unmodified up to the end of frame, * reached when ZSTD_decompressStream() returns 0. * Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent). * Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section) * Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost. * A full dictionary is more costly, as it requires building tables. */ ZSTDLIB_API size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize); /* === Memory management === */ /*! ZSTD_sizeof_*() : * These functions give the _current_ memory usage of selected object. * Note that object memory usage can evolve (increase or decrease) over time. */ ZSTDLIB_API size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx); ZSTDLIB_API size_t ZSTD_sizeof_DCtx(const ZSTD_DCtx* dctx); ZSTDLIB_API size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs); ZSTDLIB_API size_t ZSTD_sizeof_DStream(const ZSTD_DStream* zds); ZSTDLIB_API size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict); ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); #endif /* ZSTD_H_235446 */ /* ************************************************************************************** * ADVANCED AND EXPERIMENTAL FUNCTIONS **************************************************************************************** * The definitions in the following section are considered experimental. * They are provided for advanced scenarios. * They should never be used with a dynamic library, as prototypes may change in the future. * Use them only in association with static linking. * ***************************************************************************************/ #if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY) #define ZSTD_H_ZSTD_STATIC_LINKING_ONLY /**************************************************************************************** * experimental API (static linking only) **************************************************************************************** * The following symbols and constants * are not planned to join "stable API" status in the near future. * They can still change in future versions. * Some of them are planned to remain in the static_only section indefinitely. * Some of them might be removed in the future (especially when redundant with existing stable functions) * ***************************************************************************************/ #define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1) /* minimum input size required to query frame header size */ #define ZSTD_FRAMEHEADERSIZE_MIN(format) ((format) == ZSTD_f_zstd1 ? 6 : 2) #define ZSTD_FRAMEHEADERSIZE_MAX 18 /* can be useful for static allocation */ #define ZSTD_SKIPPABLEHEADERSIZE 8 /* compression parameter bounds */ #define ZSTD_WINDOWLOG_MAX_32 30 #define ZSTD_WINDOWLOG_MAX_64 31 #define ZSTD_WINDOWLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64)) #define ZSTD_WINDOWLOG_MIN 10 #define ZSTD_HASHLOG_MAX ((ZSTD_WINDOWLOG_MAX < 30) ? ZSTD_WINDOWLOG_MAX : 30) #define ZSTD_HASHLOG_MIN 6 #define ZSTD_CHAINLOG_MAX_32 29 #define ZSTD_CHAINLOG_MAX_64 30 #define ZSTD_CHAINLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_CHAINLOG_MAX_32 : ZSTD_CHAINLOG_MAX_64)) #define ZSTD_CHAINLOG_MIN ZSTD_HASHLOG_MIN #define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1) #define ZSTD_SEARCHLOG_MIN 1 #define ZSTD_MINMATCH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */ #define ZSTD_MINMATCH_MIN 3 /* only for ZSTD_btopt+, faster strategies are limited to 4 */ #define ZSTD_TARGETLENGTH_MAX ZSTD_BLOCKSIZE_MAX #define ZSTD_TARGETLENGTH_MIN 0 /* note : comparing this constant to an unsigned results in a tautological test */ #define ZSTD_STRATEGY_MIN ZSTD_fast #define ZSTD_STRATEGY_MAX ZSTD_btultra2 #define ZSTD_OVERLAPLOG_MIN 0 #define ZSTD_OVERLAPLOG_MAX 9 #define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27 /* by default, the streaming decoder will refuse any frame * requiring larger than (1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT) window size, * to preserve host's memory from unreasonable requirements. * This limit can be overridden using ZSTD_DCtx_setParameter(,ZSTD_d_windowLogMax,). * The limit does not apply for one-pass decoders (such as ZSTD_decompress()), since no additional memory is allocated */ /* LDM parameter bounds */ #define ZSTD_LDM_HASHLOG_MIN ZSTD_HASHLOG_MIN #define ZSTD_LDM_HASHLOG_MAX ZSTD_HASHLOG_MAX #define ZSTD_LDM_MINMATCH_MIN 4 #define ZSTD_LDM_MINMATCH_MAX 4096 #define ZSTD_LDM_BUCKETSIZELOG_MIN 1 #define ZSTD_LDM_BUCKETSIZELOG_MAX 8 #define ZSTD_LDM_HASHRATELOG_MIN 0 #define ZSTD_LDM_HASHRATELOG_MAX (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN) /* Advanced parameter bounds */ #define ZSTD_TARGETCBLOCKSIZE_MIN 64 #define ZSTD_TARGETCBLOCKSIZE_MAX ZSTD_BLOCKSIZE_MAX #define ZSTD_SRCSIZEHINT_MIN 0 #define ZSTD_SRCSIZEHINT_MAX INT_MAX /* internal */ #define ZSTD_HASHLOG3_MAX 17 /* --- Advanced types --- */ typedef struct ZSTD_CCtx_params_s ZSTD_CCtx_params; typedef struct { unsigned int matchPos; /* Match pos in dst */ /* If seqDef.offset > 3, then this is seqDef.offset - 3 * If seqDef.offset < 3, then this is the corresponding repeat offset * But if seqDef.offset < 3 and litLength == 0, this is the * repeat offset before the corresponding repeat offset * And if seqDef.offset == 3 and litLength == 0, this is the * most recent repeat offset - 1 */ unsigned int offset; unsigned int litLength; /* Literal length */ unsigned int matchLength; /* Match length */ /* 0 when seq not rep and seqDef.offset otherwise * when litLength == 0 this will be <= 4, otherwise <= 3 like normal */ unsigned int rep; } ZSTD_Sequence; typedef struct { unsigned windowLog; /**< largest match distance : larger == more compression, more memory needed during decompression */ unsigned chainLog; /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */ unsigned hashLog; /**< dispatch table : larger == faster, more memory */ unsigned searchLog; /**< nb of searches : larger == more compression, slower */ unsigned minMatch; /**< match length searched : larger == faster decompression, sometimes less compression */ unsigned targetLength; /**< acceptable match size for optimal parser (only) : larger == more compression, slower */ ZSTD_strategy strategy; /**< see ZSTD_strategy definition above */ } ZSTD_compressionParameters; typedef struct { int contentSizeFlag; /**< 1: content size will be in frame header (when known) */ int checksumFlag; /**< 1: generate a 32-bits checksum using XXH64 algorithm at end of frame, for error detection */ int noDictIDFlag; /**< 1: no dictID will be saved into frame header (dictID is only useful for dictionary compression) */ } ZSTD_frameParameters; typedef struct { ZSTD_compressionParameters cParams; ZSTD_frameParameters fParams; } ZSTD_parameters; typedef enum { ZSTD_dct_auto = 0, /* dictionary is "full" when starting with ZSTD_MAGIC_DICTIONARY, otherwise it is "rawContent" */ ZSTD_dct_rawContent = 1, /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */ ZSTD_dct_fullDict = 2 /* refuses to load a dictionary if it does not respect Zstandard's specification, starting with ZSTD_MAGIC_DICTIONARY */ } ZSTD_dictContentType_e; typedef enum { ZSTD_dlm_byCopy = 0, /**< Copy dictionary content internally */ ZSTD_dlm_byRef = 1 /**< Reference dictionary content -- the dictionary buffer must outlive its users. */ } ZSTD_dictLoadMethod_e; typedef enum { ZSTD_f_zstd1 = 0, /* zstd frame format, specified in zstd_compression_format.md (default) */ ZSTD_f_zstd1_magicless = 1 /* Variant of zstd frame format, without initial 4-bytes magic number. * Useful to save 4 bytes per generated frame. * Decoder cannot recognise automatically this format, requiring this instruction. */ } ZSTD_format_e; typedef enum { /* Note: this enum and the behavior it controls are effectively internal * implementation details of the compressor. They are expected to continue * to evolve and should be considered only in the context of extremely * advanced performance tuning. * * Zstd currently supports the use of a CDict in three ways: * * - The contents of the CDict can be copied into the working context. This * means that the compression can search both the dictionary and input * while operating on a single set of internal tables. This makes * the compression faster per-byte of input. However, the initial copy of * the CDict's tables incurs a fixed cost at the beginning of the * compression. For small compressions (< 8 KB), that copy can dominate * the cost of the compression. * * - The CDict's tables can be used in-place. In this model, compression is * slower per input byte, because the compressor has to search two sets of * tables. However, this model incurs no start-up cost (as long as the * working context's tables can be reused). For small inputs, this can be * faster than copying the CDict's tables. * * - The CDict's tables are not used at all, and instead we use the working * context alone to reload the dictionary and use params based on the source * size. See ZSTD_compress_insertDictionary() and ZSTD_compress_usingDict(). * This method is effective when the dictionary sizes are very small relative * to the input size, and the input size is fairly large to begin with. * * Zstd has a simple internal heuristic that selects which strategy to use * at the beginning of a compression. However, if experimentation shows that * Zstd is making poor choices, it is possible to override that choice with * this enum. */ ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */ ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */ ZSTD_dictForceCopy = 2, /* Always copy the dictionary. */ ZSTD_dictForceLoad = 3 /* Always reload the dictionary */ } ZSTD_dictAttachPref_e; typedef enum { ZSTD_lcm_auto = 0, /**< Automatically determine the compression mode based on the compression level. * Negative compression levels will be uncompressed, and positive compression * levels will be compressed. */ ZSTD_lcm_huffman = 1, /**< Always attempt Huffman compression. Uncompressed literals will still be * emitted if Huffman compression is not profitable. */ ZSTD_lcm_uncompressed = 2 /**< Always emit uncompressed literals. */ } ZSTD_literalCompressionMode_e; /*************************************** * Frame size functions ***************************************/ /*! ZSTD_findDecompressedSize() : * `src` should point to the start of a series of ZSTD encoded and/or skippable frames * `srcSize` must be the _exact_ size of this series * (i.e. there should be a frame boundary at `src + srcSize`) * @return : - decompressed size of all data in all successive frames * - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN * - if an error occurred: ZSTD_CONTENTSIZE_ERROR * * note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. * When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. * In which case, it's necessary to use streaming mode to decompress data. * note 2 : decompressed size is always present when compression is done with ZSTD_compress() * note 3 : decompressed size can be very large (64-bits value), * potentially larger than what local system can handle as a single memory segment. * In which case, it's necessary to use streaming mode to decompress data. * note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. * Always ensure result fits within application's authorized limits. * Each application can set its own limits. * note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to * read each contained frame header. This is fast as most of the data is skipped, * however it does mean that all frame data must be present and valid. */ ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize); /*! ZSTD_decompressBound() : * `src` should point to the start of a series of ZSTD encoded and/or skippable frames * `srcSize` must be the _exact_ size of this series * (i.e. there should be a frame boundary at `src + srcSize`) * @return : - upper-bound for the decompressed size of all data in all successive frames * - if an error occured: ZSTD_CONTENTSIZE_ERROR * * note 1 : an error can occur if `src` contains an invalid or incorrectly formatted frame. * note 2 : the upper-bound is exact when the decompressed size field is available in every ZSTD encoded frame of `src`. * in this case, `ZSTD_findDecompressedSize` and `ZSTD_decompressBound` return the same value. * note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by: * upper-bound = # blocks * min(128 KB, Window_Size) */ ZSTDLIB_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize); /*! ZSTD_frameHeaderSize() : * srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX. * @return : size of the Frame Header, * or an error code (if srcSize is too small) */ ZSTDLIB_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize); /*! ZSTD_getSequences() : * Extract sequences from the sequence store * zc can be used to insert custom compression params. * This function invokes ZSTD_compress2 * @return : number of sequences extracted */ ZSTDLIB_API size_t ZSTD_getSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, size_t outSeqsSize, const void* src, size_t srcSize); /*************************************** * Memory management ***************************************/ /*! ZSTD_estimate*() : * These functions make it possible to estimate memory usage of a future * {D,C}Ctx, before its creation. * * ZSTD_estimateCCtxSize() will provide a budget large enough for any * compression level up to selected one. Unlike ZSTD_estimateCStreamSize*(), * this estimate does not include space for a window buffer, so this estimate * is guaranteed to be enough for single-shot compressions, but not streaming * compressions. It will however assume the input may be arbitrarily large, * which is the worst case. If srcSize is known to always be small, * ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation. * ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with * ZSTD_getCParams() to create cParams from compressionLevel. * ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with * ZSTD_CCtxParams_setParameter(). * * Note: only single-threaded compression is supported. This function will * return an error code if ZSTD_c_nbWorkers is >= 1. */ ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel); ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams); ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params); ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void); /*! ZSTD_estimateCStreamSize() : * ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one. * It will also consider src size to be arbitrarily "large", which is worst case. * If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation. * ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel. * ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1. * Note : CStream size estimation is only correct for single-threaded compression. * ZSTD_DStream memory budget depends on window Size. * This information can be passed manually, using ZSTD_estimateDStreamSize, * or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame(); * Note : if streaming is init with function ZSTD_init?Stream_usingDict(), * an internal ?Dict will be created, which additional size is not estimated here. * In this case, get total size by adding ZSTD_estimate?DictSize */ ZSTDLIB_API size_t ZSTD_estimateCStreamSize(int compressionLevel); ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams); ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params); ZSTDLIB_API size_t ZSTD_estimateDStreamSize(size_t windowSize); ZSTDLIB_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize); /*! ZSTD_estimate?DictSize() : * ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict(). * ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced(). * Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller. */ ZSTDLIB_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel); ZSTDLIB_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod); ZSTDLIB_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod); /*! ZSTD_initStatic*() : * Initialize an object using a pre-allocated fixed-size buffer. * workspace: The memory area to emplace the object into. * Provided pointer *must be 8-bytes aligned*. * Buffer must outlive object. * workspaceSize: Use ZSTD_estimate*Size() to determine * how large workspace must be to support target scenario. * @return : pointer to object (same address as workspace, just different type), * or NULL if error (size too small, incorrect alignment, etc.) * Note : zstd will never resize nor malloc() when using a static buffer. * If the object requires more memory than available, * zstd will just error out (typically ZSTD_error_memory_allocation). * Note 2 : there is no corresponding "free" function. * Since workspace is allocated externally, it must be freed externally too. * Note 3 : cParams : use ZSTD_getCParams() to convert a compression level * into its associated cParams. * Limitation 1 : currently not compatible with internal dictionary creation, triggered by * ZSTD_CCtx_loadDictionary(), ZSTD_initCStream_usingDict() or ZSTD_initDStream_usingDict(). * Limitation 2 : static cctx currently not compatible with multi-threading. * Limitation 3 : static dctx is incompatible with legacy support. */ ZSTDLIB_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize); ZSTDLIB_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */ ZSTDLIB_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize); ZSTDLIB_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */ ZSTDLIB_API const ZSTD_CDict* ZSTD_initStaticCDict( void* workspace, size_t workspaceSize, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams); ZSTDLIB_API const ZSTD_DDict* ZSTD_initStaticDDict( void* workspace, size_t workspaceSize, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); /*! Custom memory allocation : * These prototypes make it possible to pass your own allocation/free functions. * ZSTD_customMem is provided at creation time, using ZSTD_create*_advanced() variants listed below. * All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones. */ typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size); typedef void (*ZSTD_freeFunction) (void* opaque, void* address); typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem; static ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */ ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem); ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem); ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem); ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem); ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams, ZSTD_customMem customMem); ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_customMem customMem); /*************************************** * Advanced compression functions ***************************************/ /*! ZSTD_createCDict_byReference() : * Create a digested dictionary for compression * Dictionary content is just referenced, not duplicated. * As a consequence, `dictBuffer` **must** outlive CDict, * and its content must remain unmodified throughout the lifetime of CDict. * note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */ ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel); /*! ZSTD_getCParams() : * @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize. * `estimatedSrcSize` value is optional, select 0 if not known */ ZSTDLIB_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); /*! ZSTD_getParams() : * same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`. * All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0 */ ZSTDLIB_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); /*! ZSTD_checkCParams() : * Ensure param values remain within authorized range. * @return 0 on success, or an error code (can be checked with ZSTD_isError()) */ ZSTDLIB_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params); /*! ZSTD_adjustCParams() : * optimize params for a given `srcSize` and `dictSize`. * `srcSize` can be unknown, in which case use ZSTD_CONTENTSIZE_UNKNOWN. * `dictSize` must be `0` when there is no dictionary. * cPar can be invalid : all parameters will be clamped within valid range in the @return struct. * This function never fails (wide contract) */ ZSTDLIB_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize); /*! ZSTD_compress_advanced() : * Note : this function is now DEPRECATED. * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters. * This prototype will be marked as deprecated and generate compilation warning on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const void* dict,size_t dictSize, ZSTD_parameters params); /*! ZSTD_compress_usingCDict_advanced() : * Note : this function is now REDUNDANT. * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters. * This prototype will be marked as deprecated and generate compilation warning in some future version */ ZSTDLIB_API size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const ZSTD_CDict* cdict, ZSTD_frameParameters fParams); /*! ZSTD_CCtx_loadDictionary_byReference() : * Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx. * It saves some memory, but also requires that `dict` outlives its usage within `cctx` */ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize); /*! ZSTD_CCtx_loadDictionary_advanced() : * Same as ZSTD_CCtx_loadDictionary(), but gives finer control over * how to load the dictionary (by copy ? by reference ?) * and how to interpret it (automatic ? force raw mode ? full mode only ?) */ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); /*! ZSTD_CCtx_refPrefix_advanced() : * Same as ZSTD_CCtx_refPrefix(), but gives finer control over * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); /* === experimental parameters === */ /* these parameters can be used with ZSTD_setParameter() * they are not guaranteed to remain supported in the future */ /* Enables rsyncable mode, * which makes compressed files more rsync friendly * by adding periodic synchronization points to the compressed data. * The target average block size is ZSTD_c_jobSize / 2. * It's possible to modify the job size to increase or decrease * the granularity of the synchronization point. * Once the jobSize is smaller than the window size, * it will result in compression ratio degradation. * NOTE 1: rsyncable mode only works when multithreading is enabled. * NOTE 2: rsyncable performs poorly in combination with long range mode, * since it will decrease the effectiveness of synchronization points, * though mileage may vary. * NOTE 3: Rsyncable mode limits maximum compression speed to ~400 MB/s. * If the selected compression level is already running significantly slower, * the overall speed won't be significantly impacted. */ #define ZSTD_c_rsyncable ZSTD_c_experimentalParam1 /* Select a compression format. * The value must be of type ZSTD_format_e. * See ZSTD_format_e enum definition for details */ #define ZSTD_c_format ZSTD_c_experimentalParam2 /* Force back-reference distances to remain < windowSize, * even when referencing into Dictionary content (default:0) */ #define ZSTD_c_forceMaxWindow ZSTD_c_experimentalParam3 /* Controls whether the contents of a CDict * are used in place, or copied into the working context. * Accepts values from the ZSTD_dictAttachPref_e enum. * See the comments on that enum for an explanation of the feature. */ #define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4 /* Controls how the literals are compressed (default is auto). * The value must be of type ZSTD_literalCompressionMode_e. * See ZSTD_literalCompressionMode_t enum definition for details. */ #define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5 /* Tries to fit compressed block size to be around targetCBlockSize. * No target when targetCBlockSize == 0. * There is no guarantee on compressed block size (default:0) */ #define ZSTD_c_targetCBlockSize ZSTD_c_experimentalParam6 /* User's best guess of source size. * Hint is not valid when srcSizeHint == 0. * There is no guarantee that hint is close to actual source size, * but compression ratio may regress significantly if guess considerably underestimates */ #define ZSTD_c_srcSizeHint ZSTD_c_experimentalParam7 /*! ZSTD_CCtx_getParameter() : * Get the requested compression parameter value, selected by enum ZSTD_cParameter, * and store it into int* value. * @return : 0, or an error code (which can be tested with ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value); /*! ZSTD_CCtx_params : * Quick howto : * - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure * - ZSTD_CCtxParams_setParameter() : Push parameters one by one into * an existing ZSTD_CCtx_params structure. * This is similar to * ZSTD_CCtx_setParameter(). * - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to * an existing CCtx. * These parameters will be applied to * all subsequent frames. * - ZSTD_compressStream2() : Do compression using the CCtx. * - ZSTD_freeCCtxParams() : Free the memory. * * This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams() * for static allocation of CCtx for single-threaded compression. */ ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void); ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /*! ZSTD_CCtxParams_reset() : * Reset params to default values. */ ZSTDLIB_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params); /*! ZSTD_CCtxParams_init() : * Initializes the compression parameters of cctxParams according to * compression level. All other parameters are reset to their default values. */ ZSTDLIB_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel); /*! ZSTD_CCtxParams_init_advanced() : * Initializes the compression and frame parameters of cctxParams according to * params. All other parameters are reset to their default values. */ ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params); /*! ZSTD_CCtxParams_setParameter() : * Similar to ZSTD_CCtx_setParameter. * Set one compression parameter, selected by enum ZSTD_cParameter. * Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_setParametersUsingCCtxParams(). * @result : 0, or an error code (which can be tested with ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value); /*! ZSTD_CCtxParams_getParameter() : * Similar to ZSTD_CCtx_getParameter. * Get the requested value of one compression parameter, selected by enum ZSTD_cParameter. * @result : 0, or an error code (which can be tested with ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value); /*! ZSTD_CCtx_setParametersUsingCCtxParams() : * Apply a set of ZSTD_CCtx_params to the compression context. * This can be done even after compression is started, * if nbWorkers==0, this will have no impact until a new compression is started. * if nbWorkers>=1, new parameters will be picked up at next job, * with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated). */ ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams( ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params); /*! ZSTD_compressStream2_simpleArgs() : * Same as ZSTD_compressStream2(), * but using only integral types as arguments. * This variant might be helpful for binders from dynamic languages * which have troubles handling structures containing memory pointers. */ ZSTDLIB_API size_t ZSTD_compressStream2_simpleArgs ( ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, size_t* dstPos, const void* src, size_t srcSize, size_t* srcPos, ZSTD_EndDirective endOp); /*************************************** * Advanced decompression functions ***************************************/ /*! ZSTD_isFrame() : * Tells if the content of `buffer` starts with a valid Frame Identifier. * Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0. * Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled. * Note 3 : Skippable Frame Identifiers are considered valid. */ ZSTDLIB_API unsigned ZSTD_isFrame(const void* buffer, size_t size); /*! ZSTD_createDDict_byReference() : * Create a digested dictionary, ready to start decompression operation without startup delay. * Dictionary content is referenced, and therefore stays in dictBuffer. * It is important that dictBuffer outlives DDict, * it must remain read accessible throughout the lifetime of DDict */ ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize); /*! ZSTD_DCtx_loadDictionary_byReference() : * Same as ZSTD_DCtx_loadDictionary(), * but references `dict` content instead of copying it into `dctx`. * This saves memory if `dict` remains around., * However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression. */ ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); /*! ZSTD_DCtx_loadDictionary_advanced() : * Same as ZSTD_DCtx_loadDictionary(), * but gives direct control over * how to load the dictionary (by copy ? by reference ?) * and how to interpret it (automatic ? force raw mode ? full mode only ?). */ ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); /*! ZSTD_DCtx_refPrefix_advanced() : * Same as ZSTD_DCtx_refPrefix(), but gives finer control over * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */ ZSTDLIB_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); /*! ZSTD_DCtx_setMaxWindowSize() : * Refuses allocating internal buffers for frames requiring a window size larger than provided limit. * This protects a decoder context from reserving too much memory for itself (potential attack scenario). * This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode. * By default, a decompression context accepts all window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) * @return : 0, or an error code (which can be tested using ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize); /* ZSTD_d_format * experimental parameter, * allowing selection between ZSTD_format_e input compression formats */ #define ZSTD_d_format ZSTD_d_experimentalParam1 /*! ZSTD_DCtx_setFormat() : * Instruct the decoder context about what kind of data to decode next. * This instruction is mandatory to decode data without a fully-formed header, * such ZSTD_f_zstd1_magicless for example. * @return : 0, or an error code (which can be tested using ZSTD_isError()). */ ZSTDLIB_API size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format); /*! ZSTD_decompressStream_simpleArgs() : * Same as ZSTD_decompressStream(), * but using only integral types as arguments. * This can be helpful for binders from dynamic languages * which have troubles handling structures containing memory pointers. */ ZSTDLIB_API size_t ZSTD_decompressStream_simpleArgs ( ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, size_t* dstPos, const void* src, size_t srcSize, size_t* srcPos); /******************************************************************** * Advanced streaming functions * Warning : most of these functions are now redundant with the Advanced API. * Once Advanced API reaches "stable" status, * redundant functions will be deprecated, and then at some point removed. ********************************************************************/ /*===== Advanced Streaming compression functions =====*/ /**! ZSTD_initCStream_srcSize() : * This function is deprecated, and equivalent to: * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any) * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); * * pledgedSrcSize must be correct. If it is not known at init time, use * ZSTD_CONTENTSIZE_UNKNOWN. Note that, for compatibility with older programs, * "0" also disables frame content size field. It may be enabled in the future. * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, int compressionLevel, unsigned long long pledgedSrcSize); /**! ZSTD_initCStream_usingDict() : * This function is deprecated, and is equivalent to: * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); * ZSTD_CCtx_loadDictionary(zcs, dict, dictSize); * * Creates of an internal CDict (incompatible with static CCtx), except if * dict == NULL or dictSize < 8, in which case no dict is used. * Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if * it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy. * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel); /**! ZSTD_initCStream_advanced() : * This function is deprecated, and is approximately equivalent to: * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * // Pseudocode: Set each zstd parameter and leave the rest as-is. * for ((param, value) : params) { * ZSTD_CCtx_setParameter(zcs, param, value); * } * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); * ZSTD_CCtx_loadDictionary(zcs, dict, dictSize); * * dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy. * pledgedSrcSize must be correct. * If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN. * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); /**! ZSTD_initCStream_usingCDict() : * This function is deprecated, and equivalent to: * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * ZSTD_CCtx_refCDict(zcs, cdict); * * note : cdict will just be referenced, and must outlive compression session * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict); /**! ZSTD_initCStream_usingCDict_advanced() : * This function is DEPRECATED, and is approximately equivalent to: * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * // Pseudocode: Set each zstd frame parameter and leave the rest as-is. * for ((fParam, value) : fParams) { * ZSTD_CCtx_setParameter(zcs, fParam, value); * } * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); * ZSTD_CCtx_refCDict(zcs, cdict); * * same as ZSTD_initCStream_usingCDict(), with control over frame parameters. * pledgedSrcSize must be correct. If srcSize is not known at init time, use * value ZSTD_CONTENTSIZE_UNKNOWN. * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const ZSTD_CDict* cdict, ZSTD_frameParameters fParams, unsigned long long pledgedSrcSize); /*! ZSTD_resetCStream() : * This function is deprecated, and is equivalent to: * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); * * start a new frame, using same parameters from previous frame. * This is typically useful to skip dictionary loading stage, since it will re-use it in-place. * Note that zcs must be init at least once before using ZSTD_resetCStream(). * If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN. * If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end. * For the time being, pledgedSrcSize==0 is interpreted as "srcSize unknown" for compatibility with older programs, * but it will change to mean "empty" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead. * @return : 0, or an error code (which can be tested using ZSTD_isError()) * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); typedef struct { unsigned long long ingested; /* nb input bytes read and buffered */ unsigned long long consumed; /* nb input bytes actually compressed */ unsigned long long produced; /* nb of compressed bytes generated and buffered */ unsigned long long flushed; /* nb of compressed bytes flushed : not provided; can be tracked from caller side */ unsigned currentJobID; /* MT only : latest started job nb */ unsigned nbActiveWorkers; /* MT only : nb of workers actively compressing at probe time */ } ZSTD_frameProgression; /* ZSTD_getFrameProgression() : * tells how much data has been ingested (read from input) * consumed (input actually compressed) and produced (output) for current frame. * Note : (ingested - consumed) is amount of input data buffered internally, not yet compressed. * Aggregates progression inside active worker threads. */ ZSTDLIB_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx); /*! ZSTD_toFlushNow() : * Tell how many bytes are ready to be flushed immediately. * Useful for multithreading scenarios (nbWorkers >= 1). * Probe the oldest active job, defined as oldest job not yet entirely flushed, * and check its output buffer. * @return : amount of data stored in oldest job and ready to be flushed immediately. * if @return == 0, it means either : * + there is no active job (could be checked with ZSTD_frameProgression()), or * + oldest job is still actively compressing data, * but everything it has produced has also been flushed so far, * therefore flush speed is limited by production speed of oldest job * irrespective of the speed of concurrent (and newer) jobs. */ ZSTDLIB_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx); /*===== Advanced Streaming decompression functions =====*/ /** * This function is deprecated, and is equivalent to: * * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); * ZSTD_DCtx_loadDictionary(zds, dict, dictSize); * * note: no dictionary will be used if dict == NULL or dictSize < 8 * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); /** * This function is deprecated, and is equivalent to: * * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); * ZSTD_DCtx_refDDict(zds, ddict); * * note : ddict is referenced, it must outlive decompression session * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict); /** * This function is deprecated, and is equivalent to: * * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); * * re-use decompression parameters from previous init; saves dictionary loading * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ ZSTDLIB_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); /********************************************************************* * Buffer-less and synchronous inner streaming functions * * This is an advanced API, giving full control over buffer management, for users which need direct control over memory. * But it's also a complex one, with several restrictions, documented below. * Prefer normal streaming API for an easier experience. ********************************************************************* */ /** Buffer-less streaming compression (synchronous mode) A ZSTD_CCtx object is required to track streaming operations. Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource. ZSTD_CCtx object can be re-used multiple times within successive compression operations. Start by initializing a context. Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression, or ZSTD_compressBegin_advanced(), for finer parameter control. It's also possible to duplicate a reference context which has already been initialized, using ZSTD_copyCCtx() Then, consume your input using ZSTD_compressContinue(). There are some important considerations to keep in mind when using this advanced function : - ZSTD_compressContinue() has no internal buffer. It uses externally provided buffers only. - Interface is synchronous : input is consumed entirely and produces 1+ compressed blocks. - Caller must ensure there is enough space in `dst` to store compressed data under worst case scenario. Worst case evaluation is provided by ZSTD_compressBound(). ZSTD_compressContinue() doesn't guarantee recover after a failed compression. - ZSTD_compressContinue() presumes prior input ***is still accessible and unmodified*** (up to maximum distance size, see WindowLog). It remembers all previous contiguous blocks, plus one separated memory segment (which can itself consists of multiple contiguous blocks) - ZSTD_compressContinue() detects that prior input has been overwritten when `src` buffer overlaps. In which case, it will "discard" the relevant memory section from its history. Finish a frame with ZSTD_compressEnd(), which will write the last block(s) and optional checksum. It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame. Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders. `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again. */ /*===== Buffer-less streaming compression functions =====*/ ZSTDLIB_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel); ZSTDLIB_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel); ZSTDLIB_API size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); /**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */ ZSTDLIB_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */ ZSTDLIB_API size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize); /* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */ ZSTDLIB_API size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */ ZSTDLIB_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); ZSTDLIB_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); /*- Buffer-less streaming decompression (synchronous mode) A ZSTD_DCtx object is required to track streaming operations. Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it. A ZSTD_DCtx object can be re-used multiple times. First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader(). Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough. Data fragment must be large enough to ensure successful decoding. `ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough. @result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled. >0 : `srcSize` is too small, please provide at least @result bytes on next attempt. errorCode, which can be tested using ZSTD_isError(). It fills a ZSTD_frameHeader structure with important information to correctly decode the frame, such as the dictionary ID, content size, or maximum back-reference distance (`windowSize`). Note that these values could be wrong, either because of data corruption, or because a 3rd party deliberately spoofs false information. As a consequence, check that values remain within valid application range. For example, do not allocate memory blindly, check that `windowSize` is within expectation. Each application can set its own limits, depending on local restrictions. For extended interoperability, it is recommended to support `windowSize` of at least 8 MB. ZSTD_decompressContinue() needs previous data blocks during decompression, up to `windowSize` bytes. ZSTD_decompressContinue() is very sensitive to contiguity, if 2 blocks don't follow each other, make sure that either the compressor breaks contiguity at the same place, or that previous contiguous segment is large enough to properly handle maximum back-reference distance. There are multiple ways to guarantee this condition. The most memory efficient way is to use a round buffer of sufficient size. Sufficient size is determined by invoking ZSTD_decodingBufferSize_min(), which can @return an error code if required value is too large for current system (in 32-bits mode). In a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one, up to the moment there is not enough room left in the buffer to guarantee decoding another full block, which maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`. At which point, decoding can resume from the beginning of the buffer. Note that already decoded data stored in the buffer should be flushed before being overwritten. There are alternatives possible, for example using two or more buffers of size `windowSize` each, though they consume more memory. Finally, if you control the compression process, you can also ignore all buffer size rules, as long as the encoder and decoder progress in "lock-step", aka use exactly the same buffer sizes, break contiguity at the same place, etc. Once buffers are setup, start decompression, with ZSTD_decompressBegin(). If decompression requires a dictionary, use ZSTD_decompressBegin_usingDict() or ZSTD_decompressBegin_usingDDict(). Then use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively. ZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue(). ZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail. @result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity). It can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item. It can also be an error code, which can be tested with ZSTD_isError(). A frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero. Context can then be reset to start a new decompression. Note : it's possible to know if next input to present is a header or a block, using ZSTD_nextInputType(). This information is not required to properly decode a frame. == Special case : skippable frames == Skippable frames allow integration of user-defined data into a flow of concatenated frames. Skippable frames will be ignored (skipped) by decompressor. The format of skippable frames is as follows : a) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits c) Frame Content - any content (User Data) of length equal to Frame Size For skippable frames ZSTD_getFrameHeader() returns zfhPtr->frameType==ZSTD_skippableFrame. For skippable frames ZSTD_decompressContinue() always returns 0 : it only skips the content. */ /*===== Buffer-less streaming decompression functions =====*/ typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e; typedef struct { unsigned long long frameContentSize; /* if == ZSTD_CONTENTSIZE_UNKNOWN, it means this field is not available. 0 means "empty" */ unsigned long long windowSize; /* can be very large, up to <= frameContentSize */ unsigned blockSizeMax; ZSTD_frameType_e frameType; /* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */ unsigned headerSize; unsigned dictID; unsigned checksumFlag; } ZSTD_frameHeader; /*! ZSTD_getFrameHeader() : * decode Frame Header, or requires larger `srcSize`. * @return : 0, `zfhPtr` is correctly filled, * >0, `srcSize` is too small, value is wanted `srcSize` amount, * or an error code, which can be tested using ZSTD_isError() */ ZSTDLIB_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */ /*! ZSTD_getFrameHeader_advanced() : * same as ZSTD_getFrameHeader(), * with added capability to select a format (like ZSTD_f_zstd1_magicless) */ ZSTDLIB_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format); ZSTDLIB_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize); /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */ ZSTDLIB_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx); ZSTDLIB_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); ZSTDLIB_API size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); ZSTDLIB_API size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx); ZSTDLIB_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); /* misc */ ZSTDLIB_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx); typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e; ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); /* ============================ */ /** Block level API */ /* ============================ */ /*! Block functions produce and decode raw zstd blocks, without frame metadata. Frame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 100 bytes). But users will have to take in charge needed metadata to regenerate data, such as compressed and content sizes. A few rules to respect : - Compressing and decompressing require a context structure + Use ZSTD_createCCtx() and ZSTD_createDCtx() - It is necessary to init context before starting + compression : any ZSTD_compressBegin*() variant, including with dictionary + decompression : any ZSTD_decompressBegin*() variant, including with dictionary + copyCCtx() and copyDCtx() can be used too - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB + If input is larger than a block size, it's necessary to split input data into multiple blocks + For inputs larger than a single block, consider using regular ZSTD_compress() instead. Frame metadata is not that costly, and quickly becomes negligible as source size grows larger than a block. - When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero) ! ===> In which case, nothing is produced into `dst` ! + User __must__ test for such outcome and deal directly with uncompressed data + A block cannot be declared incompressible if ZSTD_compressBlock() return value was != 0. Doing so would mess up with statistics history, leading to potential data corruption. + ZSTD_decompressBlock() _doesn't accept uncompressed data as input_ !! + In case of multiple successive blocks, should some of them be uncompressed, decoder must be informed of their existence in order to follow proper history. Use ZSTD_insertBlock() for such a case. */ /*===== Raw zstd block functions =====*/ ZSTDLIB_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx); ZSTDLIB_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); ZSTDLIB_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); ZSTDLIB_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */ #endif /* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */ #if defined (__cplusplus) } #endif gelf.h 0000644 00000026216 15063602066 0005645 0 ustar 00 /* This file defines generic ELF types, structures, and macros. Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify it under the terms of either * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version or both in parallel, as here. elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GELF_H #define _GELF_H 1 #include <libelf.h> #ifdef __cplusplus extern "C" { #endif /* Class independent type definitions. Correctly speaking this is not true. We assume that 64-bit binaries are the largest class and therefore all other classes can be represented without loss. */ /* Type for a 16-bit quantity. */ typedef Elf64_Half GElf_Half; /* Types for signed and unsigned 32-bit quantities. */ typedef Elf64_Word GElf_Word; typedef Elf64_Sword GElf_Sword; /* Types for signed and unsigned 64-bit quantities. */ typedef Elf64_Xword GElf_Xword; typedef Elf64_Sxword GElf_Sxword; /* Type of addresses. */ typedef Elf64_Addr GElf_Addr; /* Type of file offsets. */ typedef Elf64_Off GElf_Off; /* The ELF file header. This appears at the start of every ELF file. */ typedef Elf64_Ehdr GElf_Ehdr; /* Section header. */ typedef Elf64_Shdr GElf_Shdr; /* Section index. */ /* XXX This should probably be a larger type in preparation of times when regular section indices can be larger. */ typedef Elf64_Section GElf_Section; /* Symbol table entry. */ typedef Elf64_Sym GElf_Sym; /* The syminfo section if available contains additional information about every dynamic symbol. */ typedef Elf64_Syminfo GElf_Syminfo; /* Relocation table entry without addend (in section of type SHT_REL). */ typedef Elf64_Rel GElf_Rel; /* Relocation table entry with addend (in section of type SHT_RELA). */ typedef Elf64_Rela GElf_Rela; /* Relative relocation entry (in section of type SHT_RELR). */ typedef Elf64_Relr GElf_Relr; /* Program segment header. */ typedef Elf64_Phdr GElf_Phdr; /* Header of a compressed section. */ typedef Elf64_Chdr GElf_Chdr; /* Dynamic section entry. */ typedef Elf64_Dyn GElf_Dyn; /* Version definition sections. */ typedef Elf64_Verdef GElf_Verdef; /* Auxiliary version information. */ typedef Elf64_Verdaux GElf_Verdaux; /* Version dependency section. */ typedef Elf64_Verneed GElf_Verneed; /* Auxiliary needed version information. */ typedef Elf64_Vernaux GElf_Vernaux; /* Type for version symbol information. */ typedef Elf64_Versym GElf_Versym; /* Auxiliary vector. */ typedef Elf64_auxv_t GElf_auxv_t; /* Note section contents. */ typedef Elf64_Nhdr GElf_Nhdr; /* Move structure. */ typedef Elf64_Move GElf_Move; /* Library list structure. */ typedef Elf64_Lib GElf_Lib; /* How to extract and insert information held in the st_info field. */ #define GELF_ST_BIND(val) ELF64_ST_BIND (val) #define GELF_ST_TYPE(val) ELF64_ST_TYPE (val) #define GELF_ST_INFO(bind, type) ELF64_ST_INFO (bind, type) /* How to extract information held in the st_other field. */ #define GELF_ST_VISIBILITY(val) ELF64_ST_VISIBILITY (val) /* How to extract and insert information held in the r_info field. */ #define GELF_R_SYM(info) ELF64_R_SYM (info) #define GELF_R_TYPE(info) ELF64_R_TYPE (info) #define GELF_R_INFO(sym, type) ELF64_R_INFO (sym, type) /* How to extract and insert information held in the m_info field. */ #define GELF_M_SYM(info) ELF64_M_SYM (info) #define GELF_M_SIZE(info) ELF64_M_SIZE (info) #define GELF_M_INFO(sym, size) ELF64_M_INFO (sym, size) /* Get class of the file associated with ELF. */ extern int gelf_getclass (Elf *__elf); /* Return size of array of COUNT elements of the type denoted by TYPE in the external representation. The binary class is taken from ELF. The result is based on version VERSION of the ELF standard. */ extern size_t gelf_fsize (Elf *__elf, Elf_Type __type, size_t __count, unsigned int __version); /* Retrieve object file header. */ extern GElf_Ehdr *gelf_getehdr (Elf *__elf, GElf_Ehdr *__dest); /* Update the ELF header. */ extern int gelf_update_ehdr (Elf *__elf, GElf_Ehdr *__src); /* Create new ELF header if none exists. Creates an Elf32_Ehdr if CLASS is ELFCLASS32 or an Elf64_Ehdr if CLASS is ELFCLASS64. Returns NULL on error. */ extern void *gelf_newehdr (Elf *__elf, int __class); /* Get section at OFFSET. */ extern Elf_Scn *gelf_offscn (Elf *__elf, GElf_Off __offset); /* Retrieve section header. */ extern GElf_Shdr *gelf_getshdr (Elf_Scn *__scn, GElf_Shdr *__dst); /* Update section header. */ extern int gelf_update_shdr (Elf_Scn *__scn, GElf_Shdr *__src); /* Retrieve program header table entry. */ extern GElf_Phdr *gelf_getphdr (Elf *__elf, int __ndx, GElf_Phdr *__dst); /* Update the program header. */ extern int gelf_update_phdr (Elf *__elf, int __ndx, GElf_Phdr *__src); /* Create new program header with PHNUM entries. Creates either an Elf32_Phdr or an Elf64_Phdr depending on whether the given ELF is ELFCLASS32 or ELFCLASS64. Returns NULL on error. */ extern void *gelf_newphdr (Elf *__elf, size_t __phnum); /* Get compression header of section if any. Returns NULL and sets elf_errno if the section isn't compressed or an error occurred. */ extern GElf_Chdr *gelf_getchdr (Elf_Scn *__scn, GElf_Chdr *__dst); /* Convert data structure from the representation in the file represented by ELF to their memory representation. */ extern Elf_Data *gelf_xlatetom (Elf *__elf, Elf_Data *__dest, const Elf_Data *__src, unsigned int __encode); /* Convert data structure from to the representation in memory represented by ELF file representation. */ extern Elf_Data *gelf_xlatetof (Elf *__elf, Elf_Data *__dest, const Elf_Data *__src, unsigned int __encode); /* Retrieve REL relocation info at the given index. */ extern GElf_Rel *gelf_getrel (Elf_Data *__data, int __ndx, GElf_Rel *__dst); /* Retrieve RELA relocation info at the given index. */ extern GElf_Rela *gelf_getrela (Elf_Data *__data, int __ndx, GElf_Rela *__dst); /* Update REL relocation information at given index. */ extern int gelf_update_rel (Elf_Data *__dst, int __ndx, GElf_Rel *__src); /* Update RELA relocation information at given index. */ extern int gelf_update_rela (Elf_Data *__dst, int __ndx, GElf_Rela *__src); /* Retrieve symbol information from the symbol table at the given index. */ extern GElf_Sym *gelf_getsym (Elf_Data *__data, int __ndx, GElf_Sym *__dst); /* Update symbol information in the symbol table at the given index. */ extern int gelf_update_sym (Elf_Data *__data, int __ndx, GElf_Sym *__src); /* Retrieve symbol information and separate section index from the symbol table at the given index. */ extern GElf_Sym *gelf_getsymshndx (Elf_Data *__symdata, Elf_Data *__shndxdata, int __ndx, GElf_Sym *__sym, Elf32_Word *__xshndx); /* Update symbol information and separate section index in the symbol table at the given index. */ extern int gelf_update_symshndx (Elf_Data *__symdata, Elf_Data *__shndxdata, int __ndx, GElf_Sym *__sym, Elf32_Word __xshndx); /* Retrieve additional symbol information from the symbol table at the given index. */ extern GElf_Syminfo *gelf_getsyminfo (Elf_Data *__data, int __ndx, GElf_Syminfo *__dst); /* Update additional symbol information in the symbol table at the given index. */ extern int gelf_update_syminfo (Elf_Data *__data, int __ndx, GElf_Syminfo *__src); /* Get information from dynamic table at the given index. */ extern GElf_Dyn *gelf_getdyn (Elf_Data *__data, int __ndx, GElf_Dyn *__dst); /* Update information in dynamic table at the given index. */ extern int gelf_update_dyn (Elf_Data *__dst, int __ndx, GElf_Dyn *__src); /* Get move structure at the given index. */ extern GElf_Move *gelf_getmove (Elf_Data *__data, int __ndx, GElf_Move *__dst); /* Update move structure at the given index. */ extern int gelf_update_move (Elf_Data *__data, int __ndx, GElf_Move *__src); /* Get library from table at the given index. */ extern GElf_Lib *gelf_getlib (Elf_Data *__data, int __ndx, GElf_Lib *__dst); /* Update library in table at the given index. */ extern int gelf_update_lib (Elf_Data *__data, int __ndx, GElf_Lib *__src); /* Retrieve symbol version information at given index. */ extern GElf_Versym *gelf_getversym (Elf_Data *__data, int __ndx, GElf_Versym *__dst); /* Update symbol version information. */ extern int gelf_update_versym (Elf_Data *__data, int __ndx, GElf_Versym *__src); /* Retrieve required symbol version information at given offset. */ extern GElf_Verneed *gelf_getverneed (Elf_Data *__data, int __offset, GElf_Verneed *__dst); /* Update required symbol version information. */ extern int gelf_update_verneed (Elf_Data *__data, int __offset, GElf_Verneed *__src); /* Retrieve additional required symbol version information at given offset. */ extern GElf_Vernaux *gelf_getvernaux (Elf_Data *__data, int __offset, GElf_Vernaux *__dst); /* Update additional required symbol version information. */ extern int gelf_update_vernaux (Elf_Data *__data, int __offset, GElf_Vernaux *__src); /* Retrieve symbol version definition information at given offset. */ extern GElf_Verdef *gelf_getverdef (Elf_Data *__data, int __offset, GElf_Verdef *__dst); /* Update symbol version definition information. */ extern int gelf_update_verdef (Elf_Data *__data, int __offset, GElf_Verdef *__src); /* Retrieve additional symbol version definition information at given offset. */ extern GElf_Verdaux *gelf_getverdaux (Elf_Data *__data, int __offset, GElf_Verdaux *__dst); /* Update additional symbol version definition information. */ extern int gelf_update_verdaux (Elf_Data *__data, int __offset, GElf_Verdaux *__src); /* Get auxv entry at the given index. */ extern GElf_auxv_t *gelf_getauxv (Elf_Data *__data, int __ndx, GElf_auxv_t *__dst); /* Update auxv entry at the given index. */ extern int gelf_update_auxv (Elf_Data *__data, int __ndx, GElf_auxv_t *__src); /* Get note header at the given offset into the data, and the offsets of the note's name and descriptor data. Returns the offset of the next note header, or 0 for an invalid offset or corrupt note header. */ extern size_t gelf_getnote (Elf_Data *__data, size_t __offset, GElf_Nhdr *__result, size_t *__name_offset, size_t *__desc_offset); /* Compute simple checksum from permanent parts of the ELF file. */ extern long int gelf_checksum (Elf *__elf); #ifdef __cplusplus } #endif #endif /* gelf.h */ kadm5/admin.h 0000644 00000050137 15063602066 0007020 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/kadm5/admin.h */ /* * Copyright 2001, 2008 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved * * $Header$ */ /* * This API is not considered as stable as the main krb5 API. * * - We may make arbitrary incompatible changes between feature * releases (e.g. from 1.7 to 1.8). * - We will make some effort to avoid making incompatible changes for * bugfix releases, but will make them if necessary. */ #ifndef __KADM5_ADMIN_H__ #define __KADM5_ADMIN_H__ #include <sys/types.h> #include <gssrpc/rpc.h> #include <krb5.h> #include <kdb.h> #include <com_err.h> #include <kadm5/kadm_err.h> #include <kadm5/chpass_util_strings.h> #ifndef KADM5INT_BEGIN_DECLS #if defined(__cplusplus) #define KADM5INT_BEGIN_DECLS extern "C" { #define KADM5INT_END_DECLS } #else #define KADM5INT_BEGIN_DECLS #define KADM5INT_END_DECLS #endif #endif KADM5INT_BEGIN_DECLS #define KADM5_ADMIN_SERVICE "kadmin/admin" #define KADM5_CHANGEPW_SERVICE "kadmin/changepw" #define KADM5_HIST_PRINCIPAL "kadmin/history" #define KADM5_KIPROP_HOST_SERVICE "kiprop" typedef krb5_principal kadm5_princ_t; typedef char *kadm5_policy_t; typedef long kadm5_ret_t; #define KADM5_PW_FIRST_PROMPT \ (error_message(CHPASS_UTIL_NEW_PASSWORD_PROMPT)) #define KADM5_PW_SECOND_PROMPT \ (error_message(CHPASS_UTIL_NEW_PASSWORD_AGAIN_PROMPT)) /* * Successful return code */ #define KADM5_OK 0 /* * Field masks */ /* kadm5_principal_ent_t */ #define KADM5_PRINCIPAL 0x000001 #define KADM5_PRINC_EXPIRE_TIME 0x000002 #define KADM5_PW_EXPIRATION 0x000004 #define KADM5_LAST_PWD_CHANGE 0x000008 #define KADM5_ATTRIBUTES 0x000010 #define KADM5_MAX_LIFE 0x000020 #define KADM5_MOD_TIME 0x000040 #define KADM5_MOD_NAME 0x000080 #define KADM5_KVNO 0x000100 #define KADM5_MKVNO 0x000200 #define KADM5_AUX_ATTRIBUTES 0x000400 #define KADM5_POLICY 0x000800 #define KADM5_POLICY_CLR 0x001000 /* version 2 masks */ #define KADM5_MAX_RLIFE 0x002000 #define KADM5_LAST_SUCCESS 0x004000 #define KADM5_LAST_FAILED 0x008000 #define KADM5_FAIL_AUTH_COUNT 0x010000 #define KADM5_KEY_DATA 0x020000 #define KADM5_TL_DATA 0x040000 #ifdef notyet /* Novell */ #define KADM5_CPW_FUNCTION 0x080000 #define KADM5_RANDKEY_USED 0x100000 #endif #define KADM5_LOAD 0x200000 #define KADM5_KEY_HIST 0x400000 /* all but KEY_DATA, TL_DATA, LOAD */ #define KADM5_PRINCIPAL_NORMAL_MASK 0x41ffff /* kadm5_policy_ent_t */ #define KADM5_PW_MAX_LIFE 0x00004000 #define KADM5_PW_MIN_LIFE 0x00008000 #define KADM5_PW_MIN_LENGTH 0x00010000 #define KADM5_PW_MIN_CLASSES 0x00020000 #define KADM5_PW_HISTORY_NUM 0x00040000 #define KADM5_REF_COUNT 0x00080000 #define KADM5_PW_MAX_FAILURE 0x00100000 #define KADM5_PW_FAILURE_COUNT_INTERVAL 0x00200000 #define KADM5_PW_LOCKOUT_DURATION 0x00400000 #define KADM5_POLICY_ATTRIBUTES 0x00800000 #define KADM5_POLICY_MAX_LIFE 0x01000000 #define KADM5_POLICY_MAX_RLIFE 0x02000000 #define KADM5_POLICY_ALLOWED_KEYSALTS 0x04000000 #define KADM5_POLICY_TL_DATA 0x08000000 /* kadm5_config_params */ #define KADM5_CONFIG_REALM 0x00000001 #define KADM5_CONFIG_DBNAME 0x00000002 #define KADM5_CONFIG_MKEY_NAME 0x00000004 #define KADM5_CONFIG_MAX_LIFE 0x00000008 #define KADM5_CONFIG_MAX_RLIFE 0x00000010 #define KADM5_CONFIG_EXPIRATION 0x00000020 #define KADM5_CONFIG_FLAGS 0x00000040 /*#define KADM5_CONFIG_ADMIN_KEYTAB 0x00000080*/ #define KADM5_CONFIG_STASH_FILE 0x00000100 #define KADM5_CONFIG_ENCTYPE 0x00000200 #define KADM5_CONFIG_ADBNAME 0x00000400 #define KADM5_CONFIG_ADB_LOCKFILE 0x00000800 #define KADM5_CONFIG_KADMIND_LISTEN 0x00001000 #define KADM5_CONFIG_ACL_FILE 0x00002000 #define KADM5_CONFIG_KADMIND_PORT 0x00004000 #define KADM5_CONFIG_ENCTYPES 0x00008000 #define KADM5_CONFIG_ADMIN_SERVER 0x00010000 #define KADM5_CONFIG_DICT_FILE 0x00020000 #define KADM5_CONFIG_MKEY_FROM_KBD 0x00040000 #define KADM5_CONFIG_KPASSWD_PORT 0x00080000 #define KADM5_CONFIG_OLD_AUTH_GSSAPI 0x00100000 #define KADM5_CONFIG_NO_AUTH 0x00200000 #define KADM5_CONFIG_AUTH_NOFALLBACK 0x00400000 #define KADM5_CONFIG_KPASSWD_LISTEN 0x00800000 #define KADM5_CONFIG_IPROP_ENABLED 0x01000000 #define KADM5_CONFIG_ULOG_SIZE 0x02000000 #define KADM5_CONFIG_POLL_TIME 0x04000000 #define KADM5_CONFIG_IPROP_LOGFILE 0x08000000 #define KADM5_CONFIG_IPROP_PORT 0x10000000 #define KADM5_CONFIG_KVNO 0x20000000 #define KADM5_CONFIG_IPROP_RESYNC_TIMEOUT 0x40000000 #define KADM5_CONFIG_IPROP_LISTEN 0x80000000 /* * permission bits */ #define KADM5_PRIV_GET 0x01 #define KADM5_PRIV_ADD 0x02 #define KADM5_PRIV_MODIFY 0x04 #define KADM5_PRIV_DELETE 0x08 /* * API versioning constants */ #define KADM5_MASK_BITS 0xffffff00 #define KADM5_STRUCT_VERSION_MASK 0x12345600 #define KADM5_STRUCT_VERSION_1 (KADM5_STRUCT_VERSION_MASK|0x01) #define KADM5_STRUCT_VERSION KADM5_STRUCT_VERSION_1 #define KADM5_API_VERSION_MASK 0x12345700 #define KADM5_API_VERSION_2 (KADM5_API_VERSION_MASK|0x02) #define KADM5_API_VERSION_3 (KADM5_API_VERSION_MASK|0x03) #define KADM5_API_VERSION_4 (KADM5_API_VERSION_MASK|0x04) typedef struct _kadm5_principal_ent_t { krb5_principal principal; krb5_timestamp princ_expire_time; krb5_timestamp last_pwd_change; krb5_timestamp pw_expiration; krb5_deltat max_life; krb5_principal mod_name; krb5_timestamp mod_date; krb5_flags attributes; krb5_kvno kvno; krb5_kvno mkvno; char *policy; long aux_attributes; /* version 2 fields */ krb5_deltat max_renewable_life; krb5_timestamp last_success; krb5_timestamp last_failed; krb5_kvno fail_auth_count; krb5_int16 n_key_data; krb5_int16 n_tl_data; krb5_tl_data *tl_data; krb5_key_data *key_data; } kadm5_principal_ent_rec, *kadm5_principal_ent_t; typedef struct _kadm5_policy_ent_t { char *policy; long pw_min_life; long pw_max_life; long pw_min_length; long pw_min_classes; long pw_history_num; long policy_refcnt; /* no longer used */ /* version 3 fields */ krb5_kvno pw_max_fail; krb5_deltat pw_failcnt_interval; krb5_deltat pw_lockout_duration; /* version 4 fields */ krb5_flags attributes; krb5_deltat max_life; krb5_deltat max_renewable_life; char *allowed_keysalts; krb5_int16 n_tl_data; krb5_tl_data *tl_data; } kadm5_policy_ent_rec, *kadm5_policy_ent_t; /* * Data structure returned by kadm5_get_config_params() */ typedef struct _kadm5_config_params { long mask; char * realm; int kadmind_port; int kpasswd_port; char * admin_server; #ifdef notyet /* Novell */ /* ABI change? */ char * kpasswd_server; #endif /* Deprecated except for db2 backwards compatibility. Don't add new uses except as fallbacks for parameters that should be specified in the database module section of the config file. */ char * dbname; char * acl_file; char * dict_file; int mkey_from_kbd; char * stash_file; char * mkey_name; krb5_enctype enctype; krb5_deltat max_life; krb5_deltat max_rlife; krb5_timestamp expiration; krb5_flags flags; krb5_key_salt_tuple *keysalts; krb5_int32 num_keysalts; krb5_kvno kvno; bool_t iprop_enabled; uint32_t iprop_ulogsize; krb5_deltat iprop_poll_time; char * iprop_logfile; /* char * iprop_server;*/ int iprop_port; int iprop_resync_timeout; char * kadmind_listen; char * kpasswd_listen; char * iprop_listen; } kadm5_config_params; typedef struct _kadm5_key_data { krb5_kvno kvno; krb5_keyblock key; krb5_keysalt salt; } kadm5_key_data; /* * functions */ krb5_error_code kadm5_get_config_params(krb5_context context, int use_kdc_config, kadm5_config_params *params_in, kadm5_config_params *params_out); krb5_error_code kadm5_free_config_params(krb5_context context, kadm5_config_params *params); krb5_error_code kadm5_get_admin_service_name(krb5_context, char *, char *, size_t); /* * For all initialization functions, the caller must first initialize * a context with kadm5_init_krb5_context which will survive as long * as the resulting handle. The caller should free the context with * krb5_free_context. */ kadm5_ret_t kadm5_init(krb5_context context, char *client_name, char *pass, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_anonymous(krb5_context context, char *client_name, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_with_password(krb5_context context, char *client_name, char *pass, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_with_skey(krb5_context context, char *client_name, char *keytab, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_init_with_creds(krb5_context context, char *client_name, krb5_ccache cc, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle); kadm5_ret_t kadm5_lock(void *server_handle); kadm5_ret_t kadm5_unlock(void *server_handle); kadm5_ret_t kadm5_flush(void *server_handle); kadm5_ret_t kadm5_destroy(void *server_handle); kadm5_ret_t kadm5_create_principal(void *server_handle, kadm5_principal_ent_t ent, long mask, char *pass); kadm5_ret_t kadm5_create_principal_3(void *server_handle, kadm5_principal_ent_t ent, long mask, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, char *pass); kadm5_ret_t kadm5_delete_principal(void *server_handle, krb5_principal principal); kadm5_ret_t kadm5_modify_principal(void *server_handle, kadm5_principal_ent_t ent, long mask); kadm5_ret_t kadm5_rename_principal(void *server_handle, krb5_principal,krb5_principal); kadm5_ret_t kadm5_get_principal(void *server_handle, krb5_principal principal, kadm5_principal_ent_t ent, long mask); kadm5_ret_t kadm5_chpass_principal(void *server_handle, krb5_principal principal, char *pass); kadm5_ret_t kadm5_chpass_principal_3(void *server_handle, krb5_principal principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, char *pass); kadm5_ret_t kadm5_randkey_principal(void *server_handle, krb5_principal principal, krb5_keyblock **keyblocks, int *n_keys); kadm5_ret_t kadm5_randkey_principal_3(void *server_handle, krb5_principal principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, krb5_keyblock **keyblocks, int *n_keys); kadm5_ret_t kadm5_setkey_principal(void *server_handle, krb5_principal principal, krb5_keyblock *keyblocks, int n_keys); kadm5_ret_t kadm5_setkey_principal_3(void *server_handle, krb5_principal principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, krb5_keyblock *keyblocks, int n_keys); kadm5_ret_t kadm5_setkey_principal_4(void *server_handle, krb5_principal principal, krb5_boolean keepold, kadm5_key_data *key_data, int n_key_data); kadm5_ret_t kadm5_decrypt_key(void *server_handle, kadm5_principal_ent_t entry, krb5_int32 ktype, krb5_int32 stype, krb5_int32 kvno, krb5_keyblock *keyblock, krb5_keysalt *keysalt, int *kvnop); kadm5_ret_t kadm5_create_policy(void *server_handle, kadm5_policy_ent_t ent, long mask); kadm5_ret_t kadm5_delete_policy(void *server_handle, kadm5_policy_t policy); kadm5_ret_t kadm5_modify_policy(void *server_handle, kadm5_policy_ent_t ent, long mask); kadm5_ret_t kadm5_get_policy(void *server_handle, kadm5_policy_t policy, kadm5_policy_ent_t ent); kadm5_ret_t kadm5_get_privs(void *server_handle, long *privs); kadm5_ret_t kadm5_chpass_principal_util(void *server_handle, krb5_principal princ, char *new_pw, char **ret_pw, char *msg_ret, unsigned int msg_len); kadm5_ret_t kadm5_free_principal_ent(void *server_handle, kadm5_principal_ent_t ent); kadm5_ret_t kadm5_free_policy_ent(void *server_handle, kadm5_policy_ent_t ent); kadm5_ret_t kadm5_get_principals(void *server_handle, char *exp, char ***princs, int *count); kadm5_ret_t kadm5_get_policies(void *server_handle, char *exp, char ***pols, int *count); kadm5_ret_t kadm5_free_key_data(void *server_handle, krb5_int16 *n_key_data, krb5_key_data *key_data); kadm5_ret_t kadm5_free_name_list(void *server_handle, char **names, int count); krb5_error_code kadm5_init_krb5_context (krb5_context *); krb5_error_code kadm5_init_iprop(void *server_handle, char **db_args); kadm5_ret_t kadm5_get_principal_keys(void *server_handle, krb5_principal principal, krb5_kvno kvno, kadm5_key_data **key_data, int *n_key_data); kadm5_ret_t kadm5_purgekeys(void *server_handle, krb5_principal principal, int keepkvno); kadm5_ret_t kadm5_get_strings(void *server_handle, krb5_principal principal, krb5_string_attr **strings_out, int *count_out); kadm5_ret_t kadm5_set_string(void *server_handle, krb5_principal principal, const char *key, const char *value); kadm5_ret_t kadm5_free_strings(void *server_handle, krb5_string_attr *strings, int count); kadm5_ret_t kadm5_free_kadm5_key_data(krb5_context context, int n_key_data, kadm5_key_data *key_data); KADM5INT_END_DECLS #endif /* __KADM5_ADMIN_H__ */ kadm5/chpass_util_strings.h 0000644 00000003014 15063602066 0012007 0 ustar 00 /* * et-h-chpass_util_strings.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define CHPASS_UTIL_GET_POLICY_INFO (-1492553984L) #define CHPASS_UTIL_GET_PRINC_INFO (-1492553983L) #define CHPASS_UTIL_NEW_PASSWORD_MISMATCH (-1492553982L) #define CHPASS_UTIL_NEW_PASSWORD_PROMPT (-1492553981L) #define CHPASS_UTIL_NEW_PASSWORD_AGAIN_PROMPT (-1492553980L) #define CHPASS_UTIL_NO_PASSWORD_READ (-1492553979L) #define CHPASS_UTIL_NO_POLICY_YET_Q_ERROR (-1492553978L) #define CHPASS_UTIL_PASSWORD_CHANGED (-1492553977L) #define CHPASS_UTIL_PASSWORD_IN_DICTIONARY (-1492553976L) #define CHPASS_UTIL_PASSWORD_NOT_CHANGED (-1492553975L) #define CHPASS_UTIL_PASSWORD_TOO_SHORT (-1492553974L) #define CHPASS_UTIL_TOO_FEW_CLASSES (-1492553973L) #define CHPASS_UTIL_PASSWORD_TOO_SOON (-1492553972L) #define CHPASS_UTIL_PASSWORD_REUSE (-1492553971L) #define CHPASS_UTIL_WHILE_TRYING_TO_CHANGE (-1492553970L) #define CHPASS_UTIL_WHILE_READING_PASSWORD (-1492553969L) extern const struct error_table et_ovku_error_table; extern void initialize_ovku_error_table(void); /* For compatibility with Heimdal */ extern void initialize_ovku_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_ovku (-1492553984L) /* for compatibility with older versions... */ #define init_ovku_err_tbl initialize_ovku_error_table #define ovku_err_base ERROR_TABLE_BASE_ovku kadm5/kadm_err.h 0000644 00000010371 15063602066 0007510 0 ustar 00 /* * et-h-kadm_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KADM5_FAILURE (43787520L) #define KADM5_AUTH_GET (43787521L) #define KADM5_AUTH_ADD (43787522L) #define KADM5_AUTH_MODIFY (43787523L) #define KADM5_AUTH_DELETE (43787524L) #define KADM5_AUTH_INSUFFICIENT (43787525L) #define KADM5_BAD_DB (43787526L) #define KADM5_DUP (43787527L) #define KADM5_RPC_ERROR (43787528L) #define KADM5_NO_SRV (43787529L) #define KADM5_BAD_HIST_KEY (43787530L) #define KADM5_NOT_INIT (43787531L) #define KADM5_UNK_PRINC (43787532L) #define KADM5_UNK_POLICY (43787533L) #define KADM5_BAD_MASK (43787534L) #define KADM5_BAD_CLASS (43787535L) #define KADM5_BAD_LENGTH (43787536L) #define KADM5_BAD_POLICY (43787537L) #define KADM5_BAD_PRINCIPAL (43787538L) #define KADM5_BAD_AUX_ATTR (43787539L) #define KADM5_BAD_HISTORY (43787540L) #define KADM5_BAD_MIN_PASS_LIFE (43787541L) #define KADM5_PASS_Q_TOOSHORT (43787542L) #define KADM5_PASS_Q_CLASS (43787543L) #define KADM5_PASS_Q_DICT (43787544L) #define KADM5_PASS_REUSE (43787545L) #define KADM5_PASS_TOOSOON (43787546L) #define KADM5_POLICY_REF (43787547L) #define KADM5_INIT (43787548L) #define KADM5_BAD_PASSWORD (43787549L) #define KADM5_PROTECT_PRINCIPAL (43787550L) #define KADM5_BAD_SERVER_HANDLE (43787551L) #define KADM5_BAD_STRUCT_VERSION (43787552L) #define KADM5_OLD_STRUCT_VERSION (43787553L) #define KADM5_NEW_STRUCT_VERSION (43787554L) #define KADM5_BAD_API_VERSION (43787555L) #define KADM5_OLD_LIB_API_VERSION (43787556L) #define KADM5_OLD_SERVER_API_VERSION (43787557L) #define KADM5_NEW_LIB_API_VERSION (43787558L) #define KADM5_NEW_SERVER_API_VERSION (43787559L) #define KADM5_SECURE_PRINC_MISSING (43787560L) #define KADM5_NO_RENAME_SALT (43787561L) #define KADM5_BAD_CLIENT_PARAMS (43787562L) #define KADM5_BAD_SERVER_PARAMS (43787563L) #define KADM5_AUTH_LIST (43787564L) #define KADM5_AUTH_CHANGEPW (43787565L) #define KADM5_GSS_ERROR (43787566L) #define KADM5_BAD_TL_TYPE (43787567L) #define KADM5_MISSING_CONF_PARAMS (43787568L) #define KADM5_BAD_SERVER_NAME (43787569L) #define KADM5_AUTH_SETKEY (43787570L) #define KADM5_SETKEY_DUP_ENCTYPES (43787571L) #define KADM5_SETV4KEY_INVAL_ENCTYPE (43787572L) #define KADM5_SETKEY3_ETYPE_MISMATCH (43787573L) #define KADM5_MISSING_KRB5_CONF_PARAMS (43787574L) #define KADM5_XDR_FAILURE (43787575L) #define KADM5_CANT_RESOLVE (43787576L) #define KADM5_PASS_Q_GENERIC (43787577L) #define KADM5_BAD_KEYSALTS (43787578L) #define KADM5_SETKEY_BAD_KVNO (43787579L) #define KADM5_AUTH_EXTRACT (43787580L) #define KADM5_PROTECT_KEYS (43787581L) #define KADM5_AUTH_INITIAL (43787582L) extern const struct error_table et_ovk_error_table; extern void initialize_ovk_error_table(void); /* For compatibility with Heimdal */ extern void initialize_ovk_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_ovk (43787520L) /* for compatibility with older versions... */ #define init_ovk_err_tbl initialize_ovk_error_table #define ovk_err_base ERROR_TABLE_BASE_ovk gnu/lib-names.h 0000644 00000000723 15063602066 0007363 0 ustar 00 /* This file is automatically generated. It defines macros to allow user program to find the shared library files which come as part of GNU libc. */ #ifndef __GNU_LIB_NAMES_H #define __GNU_LIB_NAMES_H 1 #if !defined __x86_64__ # include <gnu/lib-names-32.h> #endif #if defined __x86_64__ && defined __LP64__ # include <gnu/lib-names-64.h> #endif #if defined __x86_64__ && defined __ILP32__ # include <gnu/lib-names-x32.h> #endif #endif /* gnu/lib-names.h */ gnu/libc-version.h 0000644 00000002357 15063602066 0010115 0 ustar 00 /* Interface to GNU libc specific functions for version information. Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _GNU_LIBC_VERSION_H #define _GNU_LIBC_VERSION_H 1 #include <features.h> __BEGIN_DECLS /* Return string describing release status of currently running GNU libc. */ extern const char *gnu_get_libc_release (void) __THROW; /* Return string describing version of currently running GNU libc. */ extern const char *gnu_get_libc_version (void) __THROW; __END_DECLS #endif /* gnu/libc-version.h */ gnu/stubs.h 0000644 00000000600 15063602066 0006646 0 ustar 00 /* This file is automatically generated. This file selects the right generated file of `__stub_FUNCTION' macros based on the architecture being compiled for. */ #if !defined __x86_64__ # include <gnu/stubs-32.h> #endif #if defined __x86_64__ && defined __LP64__ # include <gnu/stubs-64.h> #endif #if defined __x86_64__ && defined __ILP32__ # include <gnu/stubs-x32.h> #endif gnu/lib-names-64.h 0000644 00000003201 15063602066 0007604 0 ustar 00 /* This file is automatically generated. */ #ifndef __GNU_LIB_NAMES_H # error "Never use <gnu/lib-names-64.h> directly; include <gnu/lib-names.h> instead." #endif #define LD_LINUX_X86_64_SO "ld-linux-x86-64.so.2" #define LD_SO "ld-linux-x86-64.so.2" #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" #define LIBMVEC_SO "libmvec.so.1" #define LIBM_SO "libm.so.6" #define LIBNSL_SO "libnsl.so.1" #define LIBNSS_COMPAT_SO "libnss_compat.so.2" #define LIBNSS_DB_SO "libnss_db.so.2" #define LIBNSS_DNS_SO "libnss_dns.so.2" #define LIBNSS_FILES_SO "libnss_files.so.2" #define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" #define LIBNSS_LDAP_SO "libnss_ldap.so.2" #define LIBNSS_NISPLUS_SO "libnss_nisplus.so.2" #define LIBNSS_NIS_SO "libnss_nis.so.2" #define LIBNSS_TEST1_SO "libnss_test1.so.2" #define LIBNSS_TEST2_SO "libnss_test2.so.2" #define LIBPTHREAD_SO "libpthread.so.0" #define LIBRESOLV_SO "libresolv.so.2" #define LIBRT_SO "librt.so.1" #define LIBTHREAD_DB_SO "libthread_db.so.1" #define LIBUTIL_SO "libutil.so.1" gnu/stubs-64.h 0000644 00000001145 15063602066 0007102 0 ustar 00 /* This file is automatically generated. It defines a symbol `__stub_FUNCTION' for each function in the C library which is a stub, meaning it will fail every time called, usually setting errno to ENOSYS. */ #ifdef _LIBC #error Applications may not define the macro _LIBC #endif #define __stub___compat_bdflush #define __stub_chflags #define __stub_fattach #define __stub_fchflags #define __stub_fdetach #define __stub_getmsg #define __stub_gtty #define __stub_lchmod #define __stub_putmsg #define __stub_revoke #define __stub_setlogin #define __stub_sigreturn #define __stub_sstk #define __stub_stty iconv.h 0000644 00000003501 15063602066 0006036 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _ICONV_H #define _ICONV_H 1 #include <features.h> #define __need_size_t #include <stddef.h> __BEGIN_DECLS /* Identifier for conversion method from one codeset to another. */ typedef void *iconv_t; /* Allocate descriptor for code conversion from codeset FROMCODE to codeset TOCODE. This function is a possible cancellation point and therefore not marked with __THROW. */ extern iconv_t iconv_open (const char *__tocode, const char *__fromcode); /* Convert at most *INBYTESLEFT bytes from *INBUF according to the code conversion algorithm specified by CD and place up to *OUTBYTESLEFT bytes in buffer at *OUTBUF. */ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, size_t *__restrict __inbytesleft, char **__restrict __outbuf, size_t *__restrict __outbytesleft); /* Free resources allocated for descriptor CD for code conversion. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int iconv_close (iconv_t __cd); __END_DECLS #endif /* iconv.h */ ieee754.h 0000644 00000011456 15063602066 0006077 0 ustar 00 /* Copyright (C) 1992-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _IEEE754_H #define _IEEE754_H 1 #include <features.h> #include <endian.h> __BEGIN_DECLS union ieee754_float { float f; /* This is the IEEE 754 single-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:8; unsigned int mantissa:23; #endif /* Big endian. */ #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int mantissa:23; unsigned int exponent:8; unsigned int negative:1; #endif /* Little endian. */ } ieee; /* This format makes it easier to see if a NaN is a signalling NaN. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:8; unsigned int quiet_nan:1; unsigned int mantissa:22; #endif /* Big endian. */ #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int mantissa:22; unsigned int quiet_nan:1; unsigned int exponent:8; unsigned int negative:1; #endif /* Little endian. */ } ieee_nan; }; #define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ union ieee754_double { double d; /* This is the IEEE 754 double-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:11; /* Together these comprise the mantissa. */ unsigned int mantissa0:20; unsigned int mantissa1:32; #endif /* Big endian. */ #if __BYTE_ORDER == __LITTLE_ENDIAN # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int mantissa0:20; unsigned int exponent:11; unsigned int negative:1; unsigned int mantissa1:32; # else /* Together these comprise the mantissa. */ unsigned int mantissa1:32; unsigned int mantissa0:20; unsigned int exponent:11; unsigned int negative:1; # endif #endif /* Little endian. */ } ieee; /* This format makes it easier to see if a NaN is a signalling NaN. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:11; unsigned int quiet_nan:1; /* Together these comprise the mantissa. */ unsigned int mantissa0:19; unsigned int mantissa1:32; #else # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int mantissa0:19; unsigned int quiet_nan:1; unsigned int exponent:11; unsigned int negative:1; unsigned int mantissa1:32; # else /* Together these comprise the mantissa. */ unsigned int mantissa1:32; unsigned int mantissa0:19; unsigned int quiet_nan:1; unsigned int exponent:11; unsigned int negative:1; # endif #endif } ieee_nan; }; #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ union ieee854_long_double { long double d; /* This is the IEEE 854 double-extended-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:15; unsigned int empty:16; unsigned int mantissa0:32; unsigned int mantissa1:32; #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; unsigned int mantissa0:32; unsigned int mantissa1:32; # else unsigned int mantissa1:32; unsigned int mantissa0:32; unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; # endif #endif } ieee; /* This is for NaNs in the IEEE 854 double-extended-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:15; unsigned int empty:16; unsigned int one:1; unsigned int quiet_nan:1; unsigned int mantissa0:30; unsigned int mantissa1:32; #endif #if __BYTE_ORDER == __LITTLE_ENDIAN # if __FLOAT_WORD_ORDER == __BIG_ENDIAN unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; unsigned int mantissa0:30; unsigned int quiet_nan:1; unsigned int one:1; unsigned int mantissa1:32; # else unsigned int mantissa1:32; unsigned int mantissa0:30; unsigned int quiet_nan:1; unsigned int one:1; unsigned int exponent:15; unsigned int negative:1; unsigned int empty:16; # endif #endif } ieee_nan; }; #define IEEE854_LONG_DOUBLE_BIAS 0x3fff __END_DECLS #endif /* ieee754.h */ ifaddrs.h 0000644 00000005430 15063602066 0006337 0 ustar 00 /* ifaddrs.h -- declarations for getting network interface addresses Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _IFADDRS_H #define _IFADDRS_H 1 #include <features.h> #include <sys/socket.h> __BEGIN_DECLS /* The `getifaddrs' function generates a linked list of these structures. Each element of the list describes one network interface. */ struct ifaddrs { struct ifaddrs *ifa_next; /* Pointer to the next structure. */ char *ifa_name; /* Name of this network interface. */ unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */ struct sockaddr *ifa_addr; /* Network address of this interface. */ struct sockaddr *ifa_netmask; /* Netmask of this interface. */ union { /* At most one of the following two is valid. If the IFF_BROADCAST bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid. It is never the case that both these bits are set at once. */ struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */ struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */ } ifa_ifu; /* These very same macros are defined by <net/if.h> for `struct ifaddr'. So if they are defined already, the existing definitions will be fine. */ # ifndef ifa_broadaddr # define ifa_broadaddr ifa_ifu.ifu_broadaddr # endif # ifndef ifa_dstaddr # define ifa_dstaddr ifa_ifu.ifu_dstaddr # endif void *ifa_data; /* Address-specific data (may be unused). */ }; /* Create a linked list of `struct ifaddrs' structures, one for each network interface on the host machine. If successful, store the list in *IFAP and return 0. On errors, return -1 and set `errno'. The storage returned in *IFAP is allocated dynamically and can only be properly freed by passing it to `freeifaddrs'. */ extern int getifaddrs (struct ifaddrs **__ifap) __THROW; /* Reclaim the storage allocated by a previous `getifaddrs' call. */ extern void freeifaddrs (struct ifaddrs *__ifa) __THROW; __END_DECLS #endif /* ifaddrs.h */ inttypes.h 0000644 00000027164 15063602066 0006612 0 ustar 00 /* Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99: 7.8 Format conversion of integer types <inttypes.h> */ #ifndef _INTTYPES_H #define _INTTYPES_H 1 #include <features.h> /* Get the type definitions. */ #include <stdint.h> /* Get a definition for wchar_t. But we must not define wchar_t itself. */ #ifndef ____gwchar_t_defined # ifdef __cplusplus # define __gwchar_t wchar_t # elif defined __WCHAR_TYPE__ typedef __WCHAR_TYPE__ __gwchar_t; # else # define __need_wchar_t # include <stddef.h> typedef wchar_t __gwchar_t; # endif # define ____gwchar_t_defined 1 #endif # if __WORDSIZE == 64 # define __PRI64_PREFIX "l" # define __PRIPTR_PREFIX "l" # else # define __PRI64_PREFIX "ll" # define __PRIPTR_PREFIX # endif /* Macros for printing format specifiers. */ /* Decimal notation. */ # define PRId8 "d" # define PRId16 "d" # define PRId32 "d" # define PRId64 __PRI64_PREFIX "d" # define PRIdLEAST8 "d" # define PRIdLEAST16 "d" # define PRIdLEAST32 "d" # define PRIdLEAST64 __PRI64_PREFIX "d" # define PRIdFAST8 "d" # define PRIdFAST16 __PRIPTR_PREFIX "d" # define PRIdFAST32 __PRIPTR_PREFIX "d" # define PRIdFAST64 __PRI64_PREFIX "d" # define PRIi8 "i" # define PRIi16 "i" # define PRIi32 "i" # define PRIi64 __PRI64_PREFIX "i" # define PRIiLEAST8 "i" # define PRIiLEAST16 "i" # define PRIiLEAST32 "i" # define PRIiLEAST64 __PRI64_PREFIX "i" # define PRIiFAST8 "i" # define PRIiFAST16 __PRIPTR_PREFIX "i" # define PRIiFAST32 __PRIPTR_PREFIX "i" # define PRIiFAST64 __PRI64_PREFIX "i" /* Octal notation. */ # define PRIo8 "o" # define PRIo16 "o" # define PRIo32 "o" # define PRIo64 __PRI64_PREFIX "o" # define PRIoLEAST8 "o" # define PRIoLEAST16 "o" # define PRIoLEAST32 "o" # define PRIoLEAST64 __PRI64_PREFIX "o" # define PRIoFAST8 "o" # define PRIoFAST16 __PRIPTR_PREFIX "o" # define PRIoFAST32 __PRIPTR_PREFIX "o" # define PRIoFAST64 __PRI64_PREFIX "o" /* Unsigned integers. */ # define PRIu8 "u" # define PRIu16 "u" # define PRIu32 "u" # define PRIu64 __PRI64_PREFIX "u" # define PRIuLEAST8 "u" # define PRIuLEAST16 "u" # define PRIuLEAST32 "u" # define PRIuLEAST64 __PRI64_PREFIX "u" # define PRIuFAST8 "u" # define PRIuFAST16 __PRIPTR_PREFIX "u" # define PRIuFAST32 __PRIPTR_PREFIX "u" # define PRIuFAST64 __PRI64_PREFIX "u" /* lowercase hexadecimal notation. */ # define PRIx8 "x" # define PRIx16 "x" # define PRIx32 "x" # define PRIx64 __PRI64_PREFIX "x" # define PRIxLEAST8 "x" # define PRIxLEAST16 "x" # define PRIxLEAST32 "x" # define PRIxLEAST64 __PRI64_PREFIX "x" # define PRIxFAST8 "x" # define PRIxFAST16 __PRIPTR_PREFIX "x" # define PRIxFAST32 __PRIPTR_PREFIX "x" # define PRIxFAST64 __PRI64_PREFIX "x" /* UPPERCASE hexadecimal notation. */ # define PRIX8 "X" # define PRIX16 "X" # define PRIX32 "X" # define PRIX64 __PRI64_PREFIX "X" # define PRIXLEAST8 "X" # define PRIXLEAST16 "X" # define PRIXLEAST32 "X" # define PRIXLEAST64 __PRI64_PREFIX "X" # define PRIXFAST8 "X" # define PRIXFAST16 __PRIPTR_PREFIX "X" # define PRIXFAST32 __PRIPTR_PREFIX "X" # define PRIXFAST64 __PRI64_PREFIX "X" /* Macros for printing `intmax_t' and `uintmax_t'. */ # define PRIdMAX __PRI64_PREFIX "d" # define PRIiMAX __PRI64_PREFIX "i" # define PRIoMAX __PRI64_PREFIX "o" # define PRIuMAX __PRI64_PREFIX "u" # define PRIxMAX __PRI64_PREFIX "x" # define PRIXMAX __PRI64_PREFIX "X" /* Macros for printing `intptr_t' and `uintptr_t'. */ # define PRIdPTR __PRIPTR_PREFIX "d" # define PRIiPTR __PRIPTR_PREFIX "i" # define PRIoPTR __PRIPTR_PREFIX "o" # define PRIuPTR __PRIPTR_PREFIX "u" # define PRIxPTR __PRIPTR_PREFIX "x" # define PRIXPTR __PRIPTR_PREFIX "X" /* Macros for scanning format specifiers. */ /* Signed decimal notation. */ # define SCNd8 "hhd" # define SCNd16 "hd" # define SCNd32 "d" # define SCNd64 __PRI64_PREFIX "d" # define SCNdLEAST8 "hhd" # define SCNdLEAST16 "hd" # define SCNdLEAST32 "d" # define SCNdLEAST64 __PRI64_PREFIX "d" # define SCNdFAST8 "hhd" # define SCNdFAST16 __PRIPTR_PREFIX "d" # define SCNdFAST32 __PRIPTR_PREFIX "d" # define SCNdFAST64 __PRI64_PREFIX "d" /* Signed decimal notation. */ # define SCNi8 "hhi" # define SCNi16 "hi" # define SCNi32 "i" # define SCNi64 __PRI64_PREFIX "i" # define SCNiLEAST8 "hhi" # define SCNiLEAST16 "hi" # define SCNiLEAST32 "i" # define SCNiLEAST64 __PRI64_PREFIX "i" # define SCNiFAST8 "hhi" # define SCNiFAST16 __PRIPTR_PREFIX "i" # define SCNiFAST32 __PRIPTR_PREFIX "i" # define SCNiFAST64 __PRI64_PREFIX "i" /* Unsigned decimal notation. */ # define SCNu8 "hhu" # define SCNu16 "hu" # define SCNu32 "u" # define SCNu64 __PRI64_PREFIX "u" # define SCNuLEAST8 "hhu" # define SCNuLEAST16 "hu" # define SCNuLEAST32 "u" # define SCNuLEAST64 __PRI64_PREFIX "u" # define SCNuFAST8 "hhu" # define SCNuFAST16 __PRIPTR_PREFIX "u" # define SCNuFAST32 __PRIPTR_PREFIX "u" # define SCNuFAST64 __PRI64_PREFIX "u" /* Octal notation. */ # define SCNo8 "hho" # define SCNo16 "ho" # define SCNo32 "o" # define SCNo64 __PRI64_PREFIX "o" # define SCNoLEAST8 "hho" # define SCNoLEAST16 "ho" # define SCNoLEAST32 "o" # define SCNoLEAST64 __PRI64_PREFIX "o" # define SCNoFAST8 "hho" # define SCNoFAST16 __PRIPTR_PREFIX "o" # define SCNoFAST32 __PRIPTR_PREFIX "o" # define SCNoFAST64 __PRI64_PREFIX "o" /* Hexadecimal notation. */ # define SCNx8 "hhx" # define SCNx16 "hx" # define SCNx32 "x" # define SCNx64 __PRI64_PREFIX "x" # define SCNxLEAST8 "hhx" # define SCNxLEAST16 "hx" # define SCNxLEAST32 "x" # define SCNxLEAST64 __PRI64_PREFIX "x" # define SCNxFAST8 "hhx" # define SCNxFAST16 __PRIPTR_PREFIX "x" # define SCNxFAST32 __PRIPTR_PREFIX "x" # define SCNxFAST64 __PRI64_PREFIX "x" /* Macros for scanning `intmax_t' and `uintmax_t'. */ # define SCNdMAX __PRI64_PREFIX "d" # define SCNiMAX __PRI64_PREFIX "i" # define SCNoMAX __PRI64_PREFIX "o" # define SCNuMAX __PRI64_PREFIX "u" # define SCNxMAX __PRI64_PREFIX "x" /* Macros for scaning `intptr_t' and `uintptr_t'. */ # define SCNdPTR __PRIPTR_PREFIX "d" # define SCNiPTR __PRIPTR_PREFIX "i" # define SCNoPTR __PRIPTR_PREFIX "o" # define SCNuPTR __PRIPTR_PREFIX "u" # define SCNxPTR __PRIPTR_PREFIX "x" __BEGIN_DECLS #if __WORDSIZE == 64 /* We have to define the `uintmax_t' type using `ldiv_t'. */ typedef struct { long int quot; /* Quotient. */ long int rem; /* Remainder. */ } imaxdiv_t; #else /* We have to define the `uintmax_t' type using `lldiv_t'. */ typedef struct { __extension__ long long int quot; /* Quotient. */ __extension__ long long int rem; /* Remainder. */ } imaxdiv_t; #endif /* Compute absolute value of N. */ extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__)); /* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) __THROW __attribute__ ((__const__)); /* Like `strtol' but convert to `intmax_t'. */ extern intmax_t strtoimax (const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW; /* Like `strtoul' but convert to `uintmax_t'. */ extern uintmax_t strtoumax (const char *__restrict __nptr, char ** __restrict __endptr, int __base) __THROW; /* Like `wcstol' but convert to `intmax_t'. */ extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, __gwchar_t **__restrict __endptr, int __base) __THROW; /* Like `wcstoul' but convert to `uintmax_t'. */ extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, __gwchar_t ** __restrict __endptr, int __base) __THROW; #ifdef __USE_EXTERN_INLINES # if __WORDSIZE == 64 extern long int __strtol_internal (const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtol_internal (nptr, endptr, base, 0); } extern unsigned long int __strtoul_internal (const char *__restrict __nptr, char ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtoul_internal (nptr, endptr, base, 0); } extern long int __wcstol_internal (const __gwchar_t * __restrict __nptr, __gwchar_t **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (wcstoimax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstol_internal (nptr, endptr, base, 0); } extern unsigned long int __wcstoul_internal (const __gwchar_t * __restrict __nptr, __gwchar_t ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (wcstoumax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstoul_internal (nptr, endptr, base, 0); } # else /* __WORDSIZE == 32 */ __extension__ extern long long int __strtoll_internal (const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtoll_internal (nptr, endptr, base, 0); } __extension__ extern unsigned long long int __strtoull_internal (const char * __restrict __nptr, char ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `strtoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr, int base)) { return __strtoull_internal (nptr, endptr, base, 0); } __extension__ extern long long int __wcstoll_internal (const __gwchar_t *__restrict __nptr, __gwchar_t **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstol' but convert to `intmax_t'. */ __extern_inline intmax_t __NTH (wcstoimax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstoll_internal (nptr, endptr, base, 0); } __extension__ extern unsigned long long int __wcstoull_internal (const __gwchar_t * __restrict __nptr, __gwchar_t ** __restrict __endptr, int __base, int __group) __THROW __nonnull ((1)) __wur; /* Like `wcstoul' but convert to `uintmax_t'. */ __extern_inline uintmax_t __NTH (wcstoumax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base)) { return __wcstoull_internal (nptr, endptr, base, 0); } # endif /* __WORDSIZE == 32 */ #endif /* Use extern inlines. */ __END_DECLS #endif /* inttypes.h */ langinfo.h 0000644 00000042670 15063602066 0006527 0 ustar 00 /* Access to locale-dependent parameters. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LANGINFO_H #define _LANGINFO_H 1 /* Get the type definition. */ #include <nl_types.h> #include <bits/locale.h> /* Define the __LC_* category names. */ __BEGIN_DECLS /* Construct an `nl_item' value for `nl_langinfo' from a locale category (LC_*) and an item index within the category. Some code may depend on the item values within a category increasing monotonically with the indices. */ #define _NL_ITEM(category, index) (((category) << 16) | (index)) /* Extract the category and item index from a constructed `nl_item' value. */ #define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16) #define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff) /* Enumeration of locale items that can be queried with `nl_langinfo'. */ enum { /* LC_TIME category: date and time formatting. */ /* Abbreviated days of the week. */ ABDAY_1 = _NL_ITEM (__LC_TIME, 0), /* Sun */ #define ABDAY_1 ABDAY_1 ABDAY_2, #define ABDAY_2 ABDAY_2 ABDAY_3, #define ABDAY_3 ABDAY_3 ABDAY_4, #define ABDAY_4 ABDAY_4 ABDAY_5, #define ABDAY_5 ABDAY_5 ABDAY_6, #define ABDAY_6 ABDAY_6 ABDAY_7, #define ABDAY_7 ABDAY_7 /* Long-named days of the week. */ DAY_1, /* Sunday */ #define DAY_1 DAY_1 DAY_2, /* Monday */ #define DAY_2 DAY_2 DAY_3, /* Tuesday */ #define DAY_3 DAY_3 DAY_4, /* Wednesday */ #define DAY_4 DAY_4 DAY_5, /* Thursday */ #define DAY_5 DAY_5 DAY_6, /* Friday */ #define DAY_6 DAY_6 DAY_7, /* Saturday */ #define DAY_7 DAY_7 /* Abbreviated month names, in the grammatical form used when the month is a part of a complete date. */ ABMON_1, /* Jan */ #define ABMON_1 ABMON_1 ABMON_2, #define ABMON_2 ABMON_2 ABMON_3, #define ABMON_3 ABMON_3 ABMON_4, #define ABMON_4 ABMON_4 ABMON_5, #define ABMON_5 ABMON_5 ABMON_6, #define ABMON_6 ABMON_6 ABMON_7, #define ABMON_7 ABMON_7 ABMON_8, #define ABMON_8 ABMON_8 ABMON_9, #define ABMON_9 ABMON_9 ABMON_10, #define ABMON_10 ABMON_10 ABMON_11, #define ABMON_11 ABMON_11 ABMON_12, #define ABMON_12 ABMON_12 /* Long month names, in the grammatical form used when the month is a part of a complete date. */ MON_1, /* January */ #define MON_1 MON_1 MON_2, #define MON_2 MON_2 MON_3, #define MON_3 MON_3 MON_4, #define MON_4 MON_4 MON_5, #define MON_5 MON_5 MON_6, #define MON_6 MON_6 MON_7, #define MON_7 MON_7 MON_8, #define MON_8 MON_8 MON_9, #define MON_9 MON_9 MON_10, #define MON_10 MON_10 MON_11, #define MON_11 MON_11 MON_12, #define MON_12 MON_12 AM_STR, /* Ante meridiem string. */ #define AM_STR AM_STR PM_STR, /* Post meridiem string. */ #define PM_STR PM_STR D_T_FMT, /* Date and time format for strftime. */ #define D_T_FMT D_T_FMT D_FMT, /* Date format for strftime. */ #define D_FMT D_FMT T_FMT, /* Time format for strftime. */ #define T_FMT T_FMT T_FMT_AMPM, /* 12-hour time format for strftime. */ #define T_FMT_AMPM T_FMT_AMPM ERA, /* Alternate era. */ #define ERA ERA __ERA_YEAR, /* Year in alternate era format. */ #ifdef __USE_GNU # define ERA_YEAR __ERA_YEAR #endif ERA_D_FMT, /* Date in alternate era format. */ #define ERA_D_FMT ERA_D_FMT ALT_DIGITS, /* Alternate symbols for digits. */ #define ALT_DIGITS ALT_DIGITS ERA_D_T_FMT, /* Date and time in alternate era format. */ #define ERA_D_T_FMT ERA_D_T_FMT ERA_T_FMT, /* Time in alternate era format. */ #define ERA_T_FMT ERA_T_FMT _NL_TIME_ERA_NUM_ENTRIES, /* Number entries in the era arrays. */ _NL_TIME_ERA_ENTRIES, /* Structure with era entries in usable form.*/ _NL_WABDAY_1, /* Sun */ _NL_WABDAY_2, _NL_WABDAY_3, _NL_WABDAY_4, _NL_WABDAY_5, _NL_WABDAY_6, _NL_WABDAY_7, /* Long-named days of the week. */ _NL_WDAY_1, /* Sunday */ _NL_WDAY_2, /* Monday */ _NL_WDAY_3, /* Tuesday */ _NL_WDAY_4, /* Wednesday */ _NL_WDAY_5, /* Thursday */ _NL_WDAY_6, /* Friday */ _NL_WDAY_7, /* Saturday */ /* Abbreviated month names, in the grammatical form used when the month is a part of a complete date. */ _NL_WABMON_1, /* Jan */ _NL_WABMON_2, _NL_WABMON_3, _NL_WABMON_4, _NL_WABMON_5, _NL_WABMON_6, _NL_WABMON_7, _NL_WABMON_8, _NL_WABMON_9, _NL_WABMON_10, _NL_WABMON_11, _NL_WABMON_12, /* Long month names, in the grammatical form used when the month is a part of a complete date. */ _NL_WMON_1, /* January */ _NL_WMON_2, _NL_WMON_3, _NL_WMON_4, _NL_WMON_5, _NL_WMON_6, _NL_WMON_7, _NL_WMON_8, _NL_WMON_9, _NL_WMON_10, _NL_WMON_11, _NL_WMON_12, _NL_WAM_STR, /* Ante meridiem string. */ _NL_WPM_STR, /* Post meridiem string. */ _NL_WD_T_FMT, /* Date and time format for strftime. */ _NL_WD_FMT, /* Date format for strftime. */ _NL_WT_FMT, /* Time format for strftime. */ _NL_WT_FMT_AMPM, /* 12-hour time format for strftime. */ _NL_WERA_YEAR, /* Year in alternate era format. */ _NL_WERA_D_FMT, /* Date in alternate era format. */ _NL_WALT_DIGITS, /* Alternate symbols for digits. */ _NL_WERA_D_T_FMT, /* Date and time in alternate era format. */ _NL_WERA_T_FMT, /* Time in alternate era format. */ _NL_TIME_WEEK_NDAYS, _NL_TIME_WEEK_1STDAY, _NL_TIME_WEEK_1STWEEK, _NL_TIME_FIRST_WEEKDAY, _NL_TIME_FIRST_WORKDAY, _NL_TIME_CAL_DIRECTION, _NL_TIME_TIMEZONE, _DATE_FMT, /* strftime format for date. */ #define _DATE_FMT _DATE_FMT _NL_W_DATE_FMT, _NL_TIME_CODESET, /* Long month names, in the grammatical form used when the month is named by itself. */ __ALTMON_1, /* January */ __ALTMON_2, __ALTMON_3, __ALTMON_4, __ALTMON_5, __ALTMON_6, __ALTMON_7, __ALTMON_8, __ALTMON_9, __ALTMON_10, __ALTMON_11, __ALTMON_12, #ifdef __USE_GNU # define ALTMON_1 __ALTMON_1 # define ALTMON_2 __ALTMON_2 # define ALTMON_3 __ALTMON_3 # define ALTMON_4 __ALTMON_4 # define ALTMON_5 __ALTMON_5 # define ALTMON_6 __ALTMON_6 # define ALTMON_7 __ALTMON_7 # define ALTMON_8 __ALTMON_8 # define ALTMON_9 __ALTMON_9 # define ALTMON_10 __ALTMON_10 # define ALTMON_11 __ALTMON_11 # define ALTMON_12 __ALTMON_12 #endif /* Long month names, in the grammatical form used when the month is named by itself. */ _NL_WALTMON_1, /* January */ _NL_WALTMON_2, _NL_WALTMON_3, _NL_WALTMON_4, _NL_WALTMON_5, _NL_WALTMON_6, _NL_WALTMON_7, _NL_WALTMON_8, _NL_WALTMON_9, _NL_WALTMON_10, _NL_WALTMON_11, _NL_WALTMON_12, /* Abbreviated month names, in the grammatical form used when the month is named by itself. */ _NL_ABALTMON_1, /* Jan */ _NL_ABALTMON_2, _NL_ABALTMON_3, _NL_ABALTMON_4, _NL_ABALTMON_5, _NL_ABALTMON_6, _NL_ABALTMON_7, _NL_ABALTMON_8, _NL_ABALTMON_9, _NL_ABALTMON_10, _NL_ABALTMON_11, _NL_ABALTMON_12, /* Abbreviated month names, in the grammatical form used when the month is named by itself. */ _NL_WABALTMON_1, /* Jan */ _NL_WABALTMON_2, _NL_WABALTMON_3, _NL_WABALTMON_4, _NL_WABALTMON_5, _NL_WABALTMON_6, _NL_WABALTMON_7, _NL_WABALTMON_8, _NL_WABALTMON_9, _NL_WABALTMON_10, _NL_WABALTMON_11, _NL_WABALTMON_12, _NL_NUM_LC_TIME, /* Number of indices in LC_TIME category. */ /* LC_COLLATE category: text sorting. This information is accessed by the strcoll and strxfrm functions. These `nl_langinfo' names are used only internally. */ _NL_COLLATE_NRULES = _NL_ITEM (__LC_COLLATE, 0), _NL_COLLATE_RULESETS, _NL_COLLATE_TABLEMB, _NL_COLLATE_WEIGHTMB, _NL_COLLATE_EXTRAMB, _NL_COLLATE_INDIRECTMB, _NL_COLLATE_GAP1, _NL_COLLATE_GAP2, _NL_COLLATE_GAP3, _NL_COLLATE_TABLEWC, _NL_COLLATE_WEIGHTWC, _NL_COLLATE_EXTRAWC, _NL_COLLATE_INDIRECTWC, _NL_COLLATE_SYMB_HASH_SIZEMB, _NL_COLLATE_SYMB_TABLEMB, _NL_COLLATE_SYMB_EXTRAMB, _NL_COLLATE_COLLSEQMB, _NL_COLLATE_COLLSEQWC, _NL_COLLATE_CODESET, _NL_NUM_LC_COLLATE, /* LC_CTYPE category: character classification. This information is accessed by the functions in <ctype.h>. These `nl_langinfo' names are used only internally. */ _NL_CTYPE_CLASS = _NL_ITEM (__LC_CTYPE, 0), _NL_CTYPE_TOUPPER, _NL_CTYPE_GAP1, _NL_CTYPE_TOLOWER, _NL_CTYPE_GAP2, _NL_CTYPE_CLASS32, _NL_CTYPE_GAP3, _NL_CTYPE_GAP4, _NL_CTYPE_GAP5, _NL_CTYPE_GAP6, _NL_CTYPE_CLASS_NAMES, _NL_CTYPE_MAP_NAMES, _NL_CTYPE_WIDTH, _NL_CTYPE_MB_CUR_MAX, _NL_CTYPE_CODESET_NAME, CODESET = _NL_CTYPE_CODESET_NAME, #define CODESET CODESET _NL_CTYPE_TOUPPER32, _NL_CTYPE_TOLOWER32, _NL_CTYPE_CLASS_OFFSET, _NL_CTYPE_MAP_OFFSET, _NL_CTYPE_INDIGITS_MB_LEN, _NL_CTYPE_INDIGITS0_MB, _NL_CTYPE_INDIGITS1_MB, _NL_CTYPE_INDIGITS2_MB, _NL_CTYPE_INDIGITS3_MB, _NL_CTYPE_INDIGITS4_MB, _NL_CTYPE_INDIGITS5_MB, _NL_CTYPE_INDIGITS6_MB, _NL_CTYPE_INDIGITS7_MB, _NL_CTYPE_INDIGITS8_MB, _NL_CTYPE_INDIGITS9_MB, _NL_CTYPE_INDIGITS_WC_LEN, _NL_CTYPE_INDIGITS0_WC, _NL_CTYPE_INDIGITS1_WC, _NL_CTYPE_INDIGITS2_WC, _NL_CTYPE_INDIGITS3_WC, _NL_CTYPE_INDIGITS4_WC, _NL_CTYPE_INDIGITS5_WC, _NL_CTYPE_INDIGITS6_WC, _NL_CTYPE_INDIGITS7_WC, _NL_CTYPE_INDIGITS8_WC, _NL_CTYPE_INDIGITS9_WC, _NL_CTYPE_OUTDIGIT0_MB, _NL_CTYPE_OUTDIGIT1_MB, _NL_CTYPE_OUTDIGIT2_MB, _NL_CTYPE_OUTDIGIT3_MB, _NL_CTYPE_OUTDIGIT4_MB, _NL_CTYPE_OUTDIGIT5_MB, _NL_CTYPE_OUTDIGIT6_MB, _NL_CTYPE_OUTDIGIT7_MB, _NL_CTYPE_OUTDIGIT8_MB, _NL_CTYPE_OUTDIGIT9_MB, _NL_CTYPE_OUTDIGIT0_WC, _NL_CTYPE_OUTDIGIT1_WC, _NL_CTYPE_OUTDIGIT2_WC, _NL_CTYPE_OUTDIGIT3_WC, _NL_CTYPE_OUTDIGIT4_WC, _NL_CTYPE_OUTDIGIT5_WC, _NL_CTYPE_OUTDIGIT6_WC, _NL_CTYPE_OUTDIGIT7_WC, _NL_CTYPE_OUTDIGIT8_WC, _NL_CTYPE_OUTDIGIT9_WC, _NL_CTYPE_TRANSLIT_TAB_SIZE, _NL_CTYPE_TRANSLIT_FROM_IDX, _NL_CTYPE_TRANSLIT_FROM_TBL, _NL_CTYPE_TRANSLIT_TO_IDX, _NL_CTYPE_TRANSLIT_TO_TBL, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING, _NL_CTYPE_TRANSLIT_IGNORE_LEN, _NL_CTYPE_TRANSLIT_IGNORE, _NL_CTYPE_MAP_TO_NONASCII, _NL_CTYPE_NONASCII_CASE, _NL_CTYPE_EXTRA_MAP_1, _NL_CTYPE_EXTRA_MAP_2, _NL_CTYPE_EXTRA_MAP_3, _NL_CTYPE_EXTRA_MAP_4, _NL_CTYPE_EXTRA_MAP_5, _NL_CTYPE_EXTRA_MAP_6, _NL_CTYPE_EXTRA_MAP_7, _NL_CTYPE_EXTRA_MAP_8, _NL_CTYPE_EXTRA_MAP_9, _NL_CTYPE_EXTRA_MAP_10, _NL_CTYPE_EXTRA_MAP_11, _NL_CTYPE_EXTRA_MAP_12, _NL_CTYPE_EXTRA_MAP_13, _NL_CTYPE_EXTRA_MAP_14, _NL_NUM_LC_CTYPE, /* LC_MONETARY category: formatting of monetary quantities. These items each correspond to a member of `struct lconv', defined in <locale.h>. */ __INT_CURR_SYMBOL = _NL_ITEM (__LC_MONETARY, 0), #ifdef __USE_GNU # define INT_CURR_SYMBOL __INT_CURR_SYMBOL #endif __CURRENCY_SYMBOL, #ifdef __USE_GNU # define CURRENCY_SYMBOL __CURRENCY_SYMBOL #endif __MON_DECIMAL_POINT, #ifdef __USE_GNU # define MON_DECIMAL_POINT __MON_DECIMAL_POINT #endif __MON_THOUSANDS_SEP, #ifdef __USE_GNU # define MON_THOUSANDS_SEP __MON_THOUSANDS_SEP #endif __MON_GROUPING, #ifdef __USE_GNU # define MON_GROUPING __MON_GROUPING #endif __POSITIVE_SIGN, #ifdef __USE_GNU # define POSITIVE_SIGN __POSITIVE_SIGN #endif __NEGATIVE_SIGN, #ifdef __USE_GNU # define NEGATIVE_SIGN __NEGATIVE_SIGN #endif __INT_FRAC_DIGITS, #ifdef __USE_GNU # define INT_FRAC_DIGITS __INT_FRAC_DIGITS #endif __FRAC_DIGITS, #ifdef __USE_GNU # define FRAC_DIGITS __FRAC_DIGITS #endif __P_CS_PRECEDES, #ifdef __USE_GNU # define P_CS_PRECEDES __P_CS_PRECEDES #endif __P_SEP_BY_SPACE, #ifdef __USE_GNU # define P_SEP_BY_SPACE __P_SEP_BY_SPACE #endif __N_CS_PRECEDES, #ifdef __USE_GNU # define N_CS_PRECEDES __N_CS_PRECEDES #endif __N_SEP_BY_SPACE, #ifdef __USE_GNU # define N_SEP_BY_SPACE __N_SEP_BY_SPACE #endif __P_SIGN_POSN, #ifdef __USE_GNU # define P_SIGN_POSN __P_SIGN_POSN #endif __N_SIGN_POSN, #ifdef __USE_GNU # define N_SIGN_POSN __N_SIGN_POSN #endif _NL_MONETARY_CRNCYSTR, #define CRNCYSTR _NL_MONETARY_CRNCYSTR __INT_P_CS_PRECEDES, #ifdef __USE_GNU # define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES #endif __INT_P_SEP_BY_SPACE, #ifdef __USE_GNU # define INT_P_SEP_BY_SPACE __INT_P_SEP_BY_SPACE #endif __INT_N_CS_PRECEDES, #ifdef __USE_GNU # define INT_N_CS_PRECEDES __INT_N_CS_PRECEDES #endif __INT_N_SEP_BY_SPACE, #ifdef __USE_GNU # define INT_N_SEP_BY_SPACE __INT_N_SEP_BY_SPACE #endif __INT_P_SIGN_POSN, #ifdef __USE_GNU # define INT_P_SIGN_POSN __INT_P_SIGN_POSN #endif __INT_N_SIGN_POSN, #ifdef __USE_GNU # define INT_N_SIGN_POSN __INT_N_SIGN_POSN #endif _NL_MONETARY_DUO_INT_CURR_SYMBOL, _NL_MONETARY_DUO_CURRENCY_SYMBOL, _NL_MONETARY_DUO_INT_FRAC_DIGITS, _NL_MONETARY_DUO_FRAC_DIGITS, _NL_MONETARY_DUO_P_CS_PRECEDES, _NL_MONETARY_DUO_P_SEP_BY_SPACE, _NL_MONETARY_DUO_N_CS_PRECEDES, _NL_MONETARY_DUO_N_SEP_BY_SPACE, _NL_MONETARY_DUO_INT_P_CS_PRECEDES, _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE, _NL_MONETARY_DUO_INT_N_CS_PRECEDES, _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE, _NL_MONETARY_DUO_P_SIGN_POSN, _NL_MONETARY_DUO_N_SIGN_POSN, _NL_MONETARY_DUO_INT_P_SIGN_POSN, _NL_MONETARY_DUO_INT_N_SIGN_POSN, _NL_MONETARY_UNO_VALID_FROM, _NL_MONETARY_UNO_VALID_TO, _NL_MONETARY_DUO_VALID_FROM, _NL_MONETARY_DUO_VALID_TO, _NL_MONETARY_CONVERSION_RATE, _NL_MONETARY_DECIMAL_POINT_WC, _NL_MONETARY_THOUSANDS_SEP_WC, _NL_MONETARY_CODESET, _NL_NUM_LC_MONETARY, /* LC_NUMERIC category: formatting of numbers. These also correspond to members of `struct lconv'; see <locale.h>. */ __DECIMAL_POINT = _NL_ITEM (__LC_NUMERIC, 0), #ifdef __USE_GNU # define DECIMAL_POINT __DECIMAL_POINT #endif RADIXCHAR = __DECIMAL_POINT, #define RADIXCHAR RADIXCHAR __THOUSANDS_SEP, #ifdef __USE_GNU # define THOUSANDS_SEP __THOUSANDS_SEP #endif THOUSEP = __THOUSANDS_SEP, #define THOUSEP THOUSEP __GROUPING, #ifdef __USE_GNU # define GROUPING __GROUPING #endif _NL_NUMERIC_DECIMAL_POINT_WC, _NL_NUMERIC_THOUSANDS_SEP_WC, _NL_NUMERIC_CODESET, _NL_NUM_LC_NUMERIC, __YESEXPR = _NL_ITEM (__LC_MESSAGES, 0), /* Regex matching ``yes'' input. */ #define YESEXPR __YESEXPR __NOEXPR, /* Regex matching ``no'' input. */ #define NOEXPR __NOEXPR __YESSTR, /* Output string for ``yes''. */ #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K) # define YESSTR __YESSTR #endif __NOSTR, /* Output string for ``no''. */ #if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K) # define NOSTR __NOSTR #endif _NL_MESSAGES_CODESET, _NL_NUM_LC_MESSAGES, _NL_PAPER_HEIGHT = _NL_ITEM (__LC_PAPER, 0), _NL_PAPER_WIDTH, _NL_PAPER_CODESET, _NL_NUM_LC_PAPER, _NL_NAME_NAME_FMT = _NL_ITEM (__LC_NAME, 0), _NL_NAME_NAME_GEN, _NL_NAME_NAME_MR, _NL_NAME_NAME_MRS, _NL_NAME_NAME_MISS, _NL_NAME_NAME_MS, _NL_NAME_CODESET, _NL_NUM_LC_NAME, _NL_ADDRESS_POSTAL_FMT = _NL_ITEM (__LC_ADDRESS, 0), _NL_ADDRESS_COUNTRY_NAME, _NL_ADDRESS_COUNTRY_POST, _NL_ADDRESS_COUNTRY_AB2, _NL_ADDRESS_COUNTRY_AB3, _NL_ADDRESS_COUNTRY_CAR, _NL_ADDRESS_COUNTRY_NUM, _NL_ADDRESS_COUNTRY_ISBN, _NL_ADDRESS_LANG_NAME, _NL_ADDRESS_LANG_AB, _NL_ADDRESS_LANG_TERM, _NL_ADDRESS_LANG_LIB, _NL_ADDRESS_CODESET, _NL_NUM_LC_ADDRESS, _NL_TELEPHONE_TEL_INT_FMT = _NL_ITEM (__LC_TELEPHONE, 0), _NL_TELEPHONE_TEL_DOM_FMT, _NL_TELEPHONE_INT_SELECT, _NL_TELEPHONE_INT_PREFIX, _NL_TELEPHONE_CODESET, _NL_NUM_LC_TELEPHONE, _NL_MEASUREMENT_MEASUREMENT = _NL_ITEM (__LC_MEASUREMENT, 0), _NL_MEASUREMENT_CODESET, _NL_NUM_LC_MEASUREMENT, _NL_IDENTIFICATION_TITLE = _NL_ITEM (__LC_IDENTIFICATION, 0), _NL_IDENTIFICATION_SOURCE, _NL_IDENTIFICATION_ADDRESS, _NL_IDENTIFICATION_CONTACT, _NL_IDENTIFICATION_EMAIL, _NL_IDENTIFICATION_TEL, _NL_IDENTIFICATION_FAX, _NL_IDENTIFICATION_LANGUAGE, _NL_IDENTIFICATION_TERRITORY, _NL_IDENTIFICATION_AUDIENCE, _NL_IDENTIFICATION_APPLICATION, _NL_IDENTIFICATION_ABBREVIATION, _NL_IDENTIFICATION_REVISION, _NL_IDENTIFICATION_DATE, _NL_IDENTIFICATION_CATEGORY, _NL_IDENTIFICATION_CODESET, _NL_NUM_LC_IDENTIFICATION, /* This marks the highest value used. */ _NL_NUM }; /* This macro produces an item you can pass to `nl_langinfo' or `nl_langinfo_l' to get the name of the locale in use for CATEGORY. */ #define _NL_LOCALE_NAME(category) _NL_ITEM ((category), \ _NL_ITEM_INDEX (-1)) #ifdef __USE_GNU # define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category) #endif /* Return the current locale's value for ITEM. If ITEM is invalid, an empty string is returned. The string returned will not change until `setlocale' is called; it is usually in read-only memory and cannot be modified. */ extern char *nl_langinfo (nl_item __item) __THROW; #ifdef __USE_XOPEN2K8 /* POSIX.1-2008 extended locale interface (see locale.h). */ # include <bits/types/locale_t.h> /* Just like nl_langinfo but get the information from the locale object L. */ extern char *nl_langinfo_l (nl_item __item, locale_t __l); #endif __END_DECLS #endif /* langinfo.h */ lastlog.h 0000644 00000000176 15063602066 0006372 0 ustar 00 /* This header file is used in 4.3BSD to define `struct lastlog', which we define in <bits/utmp.h>. */ #include <utmp.h> libgen.h 0000644 00000002551 15063602066 0006164 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LIBGEN_H #define _LIBGEN_H 1 #include <features.h> __BEGIN_DECLS /* Return directory part of PATH or "." if none is available. */ extern char *dirname (char *__path) __THROW; /* Return final component of PATH. This is the weird XPG version of this function. It sometimes will modify its argument. Therefore we normally use the GNU version (in <string.h>) and only if this header is included make the XPG version available under the real name. */ extern char *__xpg_basename (char *__path) __THROW; #define basename __xpg_basename __END_DECLS #endif /* libgen.h */ libintl.h 0000644 00000010743 15063602066 0006363 0 ustar 00 /* Message catalogs for internationalization. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is derived from the file libgettext.h in the GNU gettext package. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LIBINTL_H #define _LIBINTL_H 1 #include <features.h> /* We define an additional symbol to signal that we use the GNU implementation of gettext. */ #define __USE_GNU_GETTEXT 1 /* Provide information about the supported file formats. Returns the maximum minor revision number supported for a given major revision. */ #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \ ((major) == 0 ? 1 : -1) __BEGIN_DECLS /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ extern char *gettext (const char *__msgid) __THROW __attribute_format_arg__ (1); /* Look up MSGID in the DOMAINNAME message catalog for the current LC_MESSAGES locale. */ extern char *dgettext (const char *__domainname, const char *__msgid) __THROW __attribute_format_arg__ (2); extern char *__dgettext (const char *__domainname, const char *__msgid) __THROW __attribute_format_arg__ (2); /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ extern char *dcgettext (const char *__domainname, const char *__msgid, int __category) __THROW __attribute_format_arg__ (2); extern char *__dcgettext (const char *__domainname, const char *__msgid, int __category) __THROW __attribute_format_arg__ (2); /* Similar to `gettext' but select the plural form corresponding to the number N. */ extern char *ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n) __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2); /* Similar to `dgettext' but select the plural form corresponding to the number N. */ extern char *dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n) __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); /* Similar to `dcgettext' but select the plural form corresponding to the number N. */ extern char *dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ extern char *textdomain (const char *__domainname) __THROW; /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ extern char *bindtextdomain (const char *__domainname, const char *__dirname) __THROW; /* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ extern char *bind_textdomain_codeset (const char *__domainname, const char *__codeset) __THROW; /* Optimized version of the function above. */ #if defined __OPTIMIZE__ && !defined __cplusplus /* We need NULL for `gettext'. */ # define __need_NULL # include <stddef.h> /* We need LC_MESSAGES for `dgettext'. */ # include <locale.h> /* These must be macros. Inlined functions are useless because the `__builtin_constant_p' predicate in dcgettext would always return false. */ # define gettext(msgid) dgettext (NULL, msgid) # define dgettext(domainname, msgid) \ dcgettext (domainname, msgid, LC_MESSAGES) # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n) # define dngettext(domainname, msgid1, msgid2, n) \ dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) #endif /* Optimizing. */ __END_DECLS #endif /* libintl.h */ limits.h 0000644 00000012444 15063602066 0006227 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types <limits.h> */ #ifndef _LIBC_LIMITS_H_ #define _LIBC_LIMITS_H_ 1 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION #include <bits/libc-header-start.h> /* Maximum length of any multibyte character in any locale. We define this value here since the gcc header does not define the correct value. */ #define MB_LEN_MAX 16 /* If we are not using GNU CC we have to define all the symbols ourself. Otherwise use gcc's definitions (see below). */ #if !defined __GNUC__ || __GNUC__ < 2 /* We only protect from multiple inclusion here, because all the other #include's protect themselves, and in GCC 2 we may #include_next through multiple copies of this file before we get to GCC's. */ # ifndef _LIMITS_H # define _LIMITS_H 1 #include <bits/wordsize.h> /* We don't have #include_next. Define ANSI <limits.h> for standard 32-bit words. */ /* These assume 8-bit `char's, 16-bit `short int's, and 32-bit `int's and `long int's. */ /* Number of bits in a `char'. */ # define CHAR_BIT 8 /* Minimum and maximum values a `signed char' can hold. */ # define SCHAR_MIN (-128) # define SCHAR_MAX 127 /* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ # define UCHAR_MAX 255 /* Minimum and maximum values a `char' can hold. */ # ifdef __CHAR_UNSIGNED__ # define CHAR_MIN 0 # define CHAR_MAX UCHAR_MAX # else # define CHAR_MIN SCHAR_MIN # define CHAR_MAX SCHAR_MAX # endif /* Minimum and maximum values a `signed short int' can hold. */ # define SHRT_MIN (-32768) # define SHRT_MAX 32767 /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */ # define USHRT_MAX 65535 /* Minimum and maximum values a `signed int' can hold. */ # define INT_MIN (-INT_MAX - 1) # define INT_MAX 2147483647 /* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ # define UINT_MAX 4294967295U /* Minimum and maximum values a `signed long int' can hold. */ # if __WORDSIZE == 64 # define LONG_MAX 9223372036854775807L # else # define LONG_MAX 2147483647L # endif # define LONG_MIN (-LONG_MAX - 1L) /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */ # if __WORDSIZE == 64 # define ULONG_MAX 18446744073709551615UL # else # define ULONG_MAX 4294967295UL # endif # ifdef __USE_ISOC99 /* Minimum and maximum values a `signed long long int' can hold. */ # define LLONG_MAX 9223372036854775807LL # define LLONG_MIN (-LLONG_MAX - 1LL) /* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ # define ULLONG_MAX 18446744073709551615ULL # endif /* ISO C99 */ # endif /* limits.h */ #endif /* GCC 2. */ #endif /* !_LIBC_LIMITS_H_ */ /* Get the compiler's limits.h, which defines almost all the ISO constants. We put this #include_next outside the double inclusion check because it should be possible to include this file more than once and still get the definitions from gcc's header. */ #if defined __GNUC__ && !defined _GCC_LIMITS_H_ /* `_GCC_LIMITS_H_' is what GCC's file defines. */ # include_next <limits.h> #endif /* The <limits.h> files in some gcc versions don't define LLONG_MIN, LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for ages are available. */ #if defined __USE_ISOC99 && defined __GNUC__ # ifndef LLONG_MIN # define LLONG_MIN (-LLONG_MAX-1) # endif # ifndef LLONG_MAX # define LLONG_MAX __LONG_LONG_MAX__ # endif # ifndef ULLONG_MAX # define ULLONG_MAX (LLONG_MAX * 2ULL + 1) # endif #endif /* The integer width macros are not defined by GCC's <limits.h> before GCC 7, or if _GNU_SOURCE rather than __STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature. */ #if __GLIBC_USE (IEC_60559_BFP_EXT) # ifndef CHAR_WIDTH # define CHAR_WIDTH 8 # endif # ifndef SCHAR_WIDTH # define SCHAR_WIDTH 8 # endif # ifndef UCHAR_WIDTH # define UCHAR_WIDTH 8 # endif # ifndef SHRT_WIDTH # define SHRT_WIDTH 16 # endif # ifndef USHRT_WIDTH # define USHRT_WIDTH 16 # endif # ifndef INT_WIDTH # define INT_WIDTH 32 # endif # ifndef UINT_WIDTH # define UINT_WIDTH 32 # endif # ifndef LONG_WIDTH # define LONG_WIDTH __WORDSIZE # endif # ifndef ULONG_WIDTH # define ULONG_WIDTH __WORDSIZE # endif # ifndef LLONG_WIDTH # define LLONG_WIDTH 64 # endif # ifndef ULLONG_WIDTH # define ULLONG_WIDTH 64 # endif #endif /* Use IEC_60559_BFP_EXT. */ #ifdef __USE_POSIX /* POSIX adds things to <limits.h>. */ # include <bits/posix1_lim.h> #endif #ifdef __USE_POSIX2 # include <bits/posix2_lim.h> #endif #ifdef __USE_XOPEN # include <bits/xopen_lim.h> #endif link.h 0000644 00000016062 15063602066 0005663 0 ustar 00 /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINK_H #define _LINK_H 1 #include <features.h> #include <elf.h> #include <dlfcn.h> #include <sys/types.h> /* We use this macro to refer to ELF types independent of the native wordsize. `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ #define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type) #define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) #define _ElfW_1(e,w,t) e##w##t #include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */ #include <bits/link.h> /* Rendezvous structure used by the run-time dynamic linker to communicate details of shared object loading to the debugger. If the executable's dynamic section has a DT_DEBUG element, the run-time linker sets that element's value to the address where this structure can be found. */ struct r_debug { int r_version; /* Version number for this protocol. */ struct link_map *r_map; /* Head of the chain of loaded objects. */ /* This is the address of a function internal to the run-time linker, that will always be called when the linker begins to map in a library or unmap it, and again when the mapping change is complete. The debugger can set a breakpoint at this address if it wants to notice shared object mapping changes. */ ElfW(Addr) r_brk; enum { /* This state value describes the mapping change taking place when the `r_brk' address is called. */ RT_CONSISTENT, /* Mapping change is complete. */ RT_ADD, /* Beginning to add a new object. */ RT_DELETE /* Beginning to remove an object mapping. */ } r_state; ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */ }; /* This is the instance of that structure used by the dynamic linker. */ extern struct r_debug _r_debug; /* This symbol refers to the "dynamic structure" in the `.dynamic' section of whatever module refers to `_DYNAMIC'. So, to find its own `struct r_debug', a program could do: for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) if (dyn->d_tag == DT_DEBUG) r_debug = (struct r_debug *) dyn->d_un.d_ptr; */ extern ElfW(Dyn) _DYNAMIC[]; /* Structure describing a loaded shared object. The `l_next' and `l_prev' members form a chain of all the shared objects loaded at startup. These data structures exist in space used by the run-time dynamic linker; modifying them may have disastrous results. */ struct link_map { /* These first few members are part of the protocol with the debugger. This is the same format used in SVR4. */ ElfW(Addr) l_addr; /* Difference between the address in the ELF file and the addresses in memory. */ char *l_name; /* Absolute file name object was found in. */ ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ }; #ifdef __USE_GNU /* Version numbers for la_version handshake interface. */ #include <bits/link_lavcurrent.h> /* Activity types signaled through la_activity. */ enum { LA_ACT_CONSISTENT, /* Link map consistent again. */ LA_ACT_ADD, /* New object will be added. */ LA_ACT_DELETE /* Objects will be removed. */ }; /* Values representing origin of name for dynamic loading. */ enum { LA_SER_ORIG = 0x01, /* Original name. */ LA_SER_LIBPATH = 0x02, /* Directory from LD_LIBRARY_PATH. */ LA_SER_RUNPATH = 0x04, /* Directory from RPATH/RUNPATH. */ LA_SER_CONFIG = 0x08, /* Found through ldconfig. */ LA_SER_DEFAULT = 0x40, /* Default directory. */ LA_SER_SECURE = 0x80 /* Unused. */ }; /* Values for la_objopen return value. */ enum { LA_FLG_BINDTO = 0x01, /* Audit symbols bound to this object. */ LA_FLG_BINDFROM = 0x02 /* Audit symbols bound from this object. */ }; /* Values for la_symbind flags parameter. */ enum { LA_SYMB_NOPLTENTER = 0x01, /* la_pltenter will not be called. */ LA_SYMB_NOPLTEXIT = 0x02, /* la_pltexit will not be called. */ LA_SYMB_STRUCTCALL = 0x04, /* Return value is a structure. */ LA_SYMB_DLSYM = 0x08, /* Binding due to dlsym call. */ LA_SYMB_ALTVALUE = 0x10 /* Value has been changed by a previous la_symbind call. */ }; struct dl_phdr_info { ElfW(Addr) dlpi_addr; const char *dlpi_name; const ElfW(Phdr) *dlpi_phdr; ElfW(Half) dlpi_phnum; /* Note: Following members were introduced after the first version of this structure was available. Check the SIZE argument passed to the dl_iterate_phdr callback to determine whether or not each later member is available. */ /* Incremented when a new object may have been added. */ __extension__ unsigned long long int dlpi_adds; /* Incremented when an object may have been removed. */ __extension__ unsigned long long int dlpi_subs; /* If there is a PT_TLS segment, its module ID as used in TLS relocations, else zero. */ size_t dlpi_tls_modid; /* The address of the calling thread's instance of this module's PT_TLS segment, if it has one and it has been allocated in the calling thread, otherwise a null pointer. */ void *dlpi_tls_data; }; __BEGIN_DECLS extern int dl_iterate_phdr (int (*__callback) (struct dl_phdr_info *, size_t, void *), void *__data); /* Prototypes for the ld.so auditing interfaces. These are not defined anywhere in ld.so but instead have to be provided by the auditing DSO. */ extern unsigned int la_version (unsigned int __version); extern void la_activity (uintptr_t *__cookie, unsigned int __flag); extern char *la_objsearch (const char *__name, uintptr_t *__cookie, unsigned int __flag); extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid, uintptr_t *__cookie); extern void la_preinit (uintptr_t *__cookie); extern uintptr_t la_symbind32 (Elf32_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, unsigned int *__flags, const char *__symname); extern uintptr_t la_symbind64 (Elf64_Sym *__sym, unsigned int __ndx, uintptr_t *__refcook, uintptr_t *__defcook, unsigned int *__flags, const char *__symname); extern unsigned int la_objclose (uintptr_t *__cookie); __END_DECLS #endif #endif /* link.h */ locale.h 0000644 00000016772 15063602066 0006175 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.11 Localization <locale.h> */ #ifndef _LOCALE_H #define _LOCALE_H 1 #include <features.h> #define __need_NULL #include <stddef.h> #include <bits/locale.h> __BEGIN_DECLS /* These are the possibilities for the first argument to setlocale. The code assumes that the lowest LC_* symbol has the value zero. */ #define LC_CTYPE __LC_CTYPE #define LC_NUMERIC __LC_NUMERIC #define LC_TIME __LC_TIME #define LC_COLLATE __LC_COLLATE #define LC_MONETARY __LC_MONETARY #define LC_MESSAGES __LC_MESSAGES #define LC_ALL __LC_ALL #define LC_PAPER __LC_PAPER #define LC_NAME __LC_NAME #define LC_ADDRESS __LC_ADDRESS #define LC_TELEPHONE __LC_TELEPHONE #define LC_MEASUREMENT __LC_MEASUREMENT #define LC_IDENTIFICATION __LC_IDENTIFICATION /* Structure giving information about numeric and monetary notation. */ struct lconv { /* Numeric (non-monetary) information. */ char *decimal_point; /* Decimal point character. */ char *thousands_sep; /* Thousands separator. */ /* Each element is the number of digits in each group; elements with higher indices are farther left. An element with value CHAR_MAX means that no further grouping is done. An element with value 0 means that the previous element is used for all groups farther left. */ char *grouping; /* Monetary information. */ /* First three chars are a currency symbol from ISO 4217. Fourth char is the separator. Fifth char is '\0'. */ char *int_curr_symbol; char *currency_symbol; /* Local currency symbol. */ char *mon_decimal_point; /* Decimal point character. */ char *mon_thousands_sep; /* Thousands separator. */ char *mon_grouping; /* Like `grouping' element (above). */ char *positive_sign; /* Sign for positive values. */ char *negative_sign; /* Sign for negative values. */ char int_frac_digits; /* Int'l fractional digits. */ char frac_digits; /* Local fractional digits. */ /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */ char p_cs_precedes; /* 1 iff a space separates currency_symbol from a positive value. */ char p_sep_by_space; /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */ char n_cs_precedes; /* 1 iff a space separates currency_symbol from a negative value. */ char n_sep_by_space; /* Positive and negative sign positions: 0 Parentheses surround the quantity and currency_symbol. 1 The sign string precedes the quantity and currency_symbol. 2 The sign string follows the quantity and currency_symbol. 3 The sign string immediately precedes the currency_symbol. 4 The sign string immediately follows the currency_symbol. */ char p_sign_posn; char n_sign_posn; #ifdef __USE_ISOC99 /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */ char int_p_cs_precedes; /* 1 iff a space separates int_curr_symbol from a positive value. */ char int_p_sep_by_space; /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */ char int_n_cs_precedes; /* 1 iff a space separates int_curr_symbol from a negative value. */ char int_n_sep_by_space; /* Positive and negative sign positions: 0 Parentheses surround the quantity and int_curr_symbol. 1 The sign string precedes the quantity and int_curr_symbol. 2 The sign string follows the quantity and int_curr_symbol. 3 The sign string immediately precedes the int_curr_symbol. 4 The sign string immediately follows the int_curr_symbol. */ char int_p_sign_posn; char int_n_sign_posn; #else char __int_p_cs_precedes; char __int_p_sep_by_space; char __int_n_cs_precedes; char __int_n_sep_by_space; char __int_p_sign_posn; char __int_n_sign_posn; #endif }; /* Set and/or return the current locale. */ extern char *setlocale (int __category, const char *__locale) __THROW; /* Return the numeric/monetary information for the current locale. */ extern struct lconv *localeconv (void) __THROW; #ifdef __USE_XOPEN2K8 /* POSIX.1-2008 extends the locale interface with functions for explicit creation and manipulation of 'locale_t' objects representing locale contexts, and a set of parallel locale-sensitive text processing functions that take a locale_t argument. This enables applications to work with data from multiple locales simultaneously and thread-safely. */ # include <bits/types/locale_t.h> /* Return a reference to a data structure representing a set of locale datasets. Unlike for the CATEGORY parameter for `setlocale' the CATEGORY_MASK parameter here uses a single bit for each category, made by OR'ing together LC_*_MASK bits above. */ extern locale_t newlocale (int __category_mask, const char *__locale, locale_t __base) __THROW; /* These are the bits that can be set in the CATEGORY_MASK argument to `newlocale'. In the GNU implementation, LC_FOO_MASK has the value of (1 << LC_FOO), but this is not a part of the interface that callers can assume will be true. */ # define LC_CTYPE_MASK (1 << __LC_CTYPE) # define LC_NUMERIC_MASK (1 << __LC_NUMERIC) # define LC_TIME_MASK (1 << __LC_TIME) # define LC_COLLATE_MASK (1 << __LC_COLLATE) # define LC_MONETARY_MASK (1 << __LC_MONETARY) # define LC_MESSAGES_MASK (1 << __LC_MESSAGES) # define LC_PAPER_MASK (1 << __LC_PAPER) # define LC_NAME_MASK (1 << __LC_NAME) # define LC_ADDRESS_MASK (1 << __LC_ADDRESS) # define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE) # define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT) # define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION) # define LC_ALL_MASK (LC_CTYPE_MASK \ | LC_NUMERIC_MASK \ | LC_TIME_MASK \ | LC_COLLATE_MASK \ | LC_MONETARY_MASK \ | LC_MESSAGES_MASK \ | LC_PAPER_MASK \ | LC_NAME_MASK \ | LC_ADDRESS_MASK \ | LC_TELEPHONE_MASK \ | LC_MEASUREMENT_MASK \ | LC_IDENTIFICATION_MASK \ ) /* Return a duplicate of the set of locale in DATASET. All usage counters are increased if necessary. */ extern locale_t duplocale (locale_t __dataset) __THROW; /* Free the data associated with a locale dataset previously returned by a call to `setlocale_r'. */ extern void freelocale (locale_t __dataset) __THROW; /* Switch the current thread's locale to DATASET. If DATASET is null, instead just return the current setting. The special value LC_GLOBAL_LOCALE is the initial setting for all threads and can also be installed any time, meaning the thread uses the global settings controlled by `setlocale'. */ extern locale_t uselocale (locale_t __dataset) __THROW; /* This value can be passed to `uselocale' and may be returned by it. Passing this value to any other function has undefined behavior. */ # define LC_GLOBAL_LOCALE ((locale_t) -1L) #endif __END_DECLS #endif /* locale.h */ malloc.h 0000644 00000013726 15063602066 0006201 0 ustar 00 /* Prototypes and definition for malloc implementation. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MALLOC_H #define _MALLOC_H 1 #include <features.h> #include <stddef.h> #include <stdio.h> #ifdef _LIBC # define __MALLOC_HOOK_VOLATILE # define __MALLOC_DEPRECATED #else # define __MALLOC_HOOK_VOLATILE volatile # define __MALLOC_DEPRECATED __attribute_deprecated__ #endif __BEGIN_DECLS /* Allocate SIZE bytes of memory. */ extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ extern void *calloc (size_t __nmemb, size_t __size) __THROW __attribute_malloc__ __wur; /* Re-allocate the previously allocated block in __ptr, making the new block SIZE bytes long. */ /* __attribute_malloc__ is not used, because if realloc returns the same pointer that was passed to it, aliasing needs to be allowed between objects pointed by the old and new pointers. */ extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_warn_unused_result__; /* Re-allocate the previously allocated block in PTR, making the new block large enough for NMEMB elements of SIZE bytes each. */ /* __attribute_malloc__ is not used, because if reallocarray returns the same pointer that was passed to it, aliasing needs to be allowed between objects pointed by the old and new pointers. */ extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) __THROW __attribute_warn_unused_result__; /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free (void *__ptr) __THROW; /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ extern void *memalign (size_t __alignment, size_t __size) __THROW __attribute_malloc__ __wur; /* Allocate SIZE bytes on a page boundary. */ extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up __size to nearest pagesize. */ extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ __wur; /* Underlying allocation function; successive calls should return contiguous pieces of memory. */ extern void *(*__morecore) (ptrdiff_t __size); /* Default value of `__morecore'. */ extern void *__default_morecore (ptrdiff_t __size) __THROW __attribute_malloc__; /* SVID2/XPG mallinfo structure */ struct mallinfo { int arena; /* non-mmapped space allocated from system */ int ordblks; /* number of free chunks */ int smblks; /* number of fastbin blocks */ int hblks; /* number of mmapped regions */ int hblkhd; /* space in mmapped regions */ int usmblks; /* always 0, preserved for backwards compatibility */ int fsmblks; /* space available in freed fastbin blocks */ int uordblks; /* total allocated space */ int fordblks; /* total free space */ int keepcost; /* top-most, releasable (via malloc_trim) space */ }; /* Returns a copy of the updated current mallinfo. */ extern struct mallinfo mallinfo (void) __THROW; /* SVID2/XPG mallopt options */ #ifndef M_MXFAST # define M_MXFAST 1 /* maximum request size for "fastbins" */ #endif #ifndef M_NLBLKS # define M_NLBLKS 2 /* UNUSED in this malloc */ #endif #ifndef M_GRAIN # define M_GRAIN 3 /* UNUSED in this malloc */ #endif #ifndef M_KEEP # define M_KEEP 4 /* UNUSED in this malloc */ #endif /* mallopt options that actually do something */ #define M_TRIM_THRESHOLD -1 #define M_TOP_PAD -2 #define M_MMAP_THRESHOLD -3 #define M_MMAP_MAX -4 #define M_CHECK_ACTION -5 #define M_PERTURB -6 #define M_ARENA_TEST -7 #define M_ARENA_MAX -8 /* General SVID/XPG interface to tunable parameters. */ extern int mallopt (int __param, int __val) __THROW; /* Release all but __pad bytes of freed top-most memory back to the system. Return 1 if successful, else 0. */ extern int malloc_trim (size_t __pad) __THROW; /* Report the number of usable allocated bytes associated with allocated chunk __ptr. */ extern size_t malloc_usable_size (void *__ptr) __THROW; /* Prints brief summary statistics on stderr. */ extern void malloc_stats (void) __THROW; /* Output information about state of allocator to stream FP. */ extern int malloc_info (int __options, FILE *__fp) __THROW; /* Hooks for debugging and user-defined versions. */ extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr, const void *) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook)(size_t __size, const void *) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook)(void *__ptr, size_t __size, const void *) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment, size_t __size, const void *) __MALLOC_DEPRECATED; extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); /* Activate a standard set of debugging hooks. */ extern void __malloc_check_init (void) __THROW __MALLOC_DEPRECATED; __END_DECLS #endif /* malloc.h */ math.h 0000644 00000150106 15063602066 0005655 0 ustar 00 /* Declarations for math functions. Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * ISO C99 Standard: 7.12 Mathematics <math.h> */ #ifndef _MATH_H #define _MATH_H 1 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION #include <bits/libc-header-start.h> #if defined log && defined __GNUC__ # warning A macro called log was already defined when <math.h> was included. # warning This will cause compilation problems. #endif __BEGIN_DECLS /* Get definitions of __intmax_t and __uintmax_t. */ #include <bits/types.h> /* Get machine-dependent vector math functions declarations. */ #include <bits/math-vector.h> /* Gather machine dependent type support. */ #include <bits/floatn.h> /* Value returned on overflow. With IEEE 754 floating point, this is +Infinity, otherwise the largest representable positive value. */ #if __GNUC_PREREQ (3, 3) # define HUGE_VAL (__builtin_huge_val ()) #else /* This may provoke compiler warnings, and may not be rounded to +Infinity in all IEEE 754 rounding modes, but is the best that can be done in ISO C while remaining a constant expression. 10,000 is greater than the maximum (decimal) exponent for all supported floating-point formats and widths. */ # define HUGE_VAL 1e10000 #endif #ifdef __USE_ISOC99 # if __GNUC_PREREQ (3, 3) # define HUGE_VALF (__builtin_huge_valf ()) # define HUGE_VALL (__builtin_huge_vall ()) # else # define HUGE_VALF 1e10000f # define HUGE_VALL 1e10000L # endif #endif #if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define HUGE_VAL_F16 (__builtin_huge_valf16 ()) #endif #if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define HUGE_VAL_F32 (__builtin_huge_valf32 ()) #endif #if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define HUGE_VAL_F64 (__builtin_huge_valf64 ()) #endif #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define HUGE_VAL_F128 (__builtin_huge_valf128 ()) #endif #if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define HUGE_VAL_F32X (__builtin_huge_valf32x ()) #endif #if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define HUGE_VAL_F64X (__builtin_huge_valf64x ()) #endif #if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define HUGE_VAL_F128X (__builtin_huge_valf128x ()) #endif #ifdef __USE_ISOC99 /* IEEE positive infinity. */ # if __GNUC_PREREQ (3, 3) # define INFINITY (__builtin_inff ()) # else # define INFINITY HUGE_VALF # endif /* IEEE Not A Number. */ # if __GNUC_PREREQ (3, 3) # define NAN (__builtin_nanf ("")) # else /* This will raise an "invalid" exception outside static initializers, but is the best that can be done in ISO C while remaining a constant expression. */ # define NAN (0.0f / 0.0f) # endif #endif /* __USE_ISOC99 */ #if __GLIBC_USE (IEC_60559_BFP_EXT) /* Signaling NaN macros, if supported. */ # if __GNUC_PREREQ (3, 3) # define SNANF (__builtin_nansf ("")) # define SNAN (__builtin_nans ("")) # define SNANL (__builtin_nansl ("")) # endif #endif #if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define SNANF16 (__builtin_nansf16 ("")) #endif #if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define SNANF32 (__builtin_nansf32 ("")) #endif #if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define SNANF64 (__builtin_nansf64 ("")) #endif #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) # define SNANF128 (__builtin_nansf128 ("")) #endif #if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define SNANF32X (__builtin_nansf32x ("")) #endif #if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define SNANF64X (__builtin_nansf64x ("")) #endif #if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT) # define SNANF128X (__builtin_nansf128x ("")) #endif /* Get __GLIBC_FLT_EVAL_METHOD. */ #include <bits/flt-eval-method.h> #ifdef __USE_ISOC99 /* Define the following typedefs. float_t floating-point type at least as wide as `float' used to evaluate `float' expressions double_t floating-point type at least as wide as `double' used to evaluate `double' expressions */ # if __GLIBC_FLT_EVAL_METHOD == 0 || __GLIBC_FLT_EVAL_METHOD == 16 typedef float float_t; typedef double double_t; # elif __GLIBC_FLT_EVAL_METHOD == 1 typedef double float_t; typedef double double_t; # elif __GLIBC_FLT_EVAL_METHOD == 2 typedef long double float_t; typedef long double double_t; # elif __GLIBC_FLT_EVAL_METHOD == 32 typedef _Float32 float_t; typedef double double_t; # elif __GLIBC_FLT_EVAL_METHOD == 33 typedef _Float32x float_t; typedef _Float32x double_t; # elif __GLIBC_FLT_EVAL_METHOD == 64 typedef _Float64 float_t; typedef _Float64 double_t; # elif __GLIBC_FLT_EVAL_METHOD == 65 typedef _Float64x float_t; typedef _Float64x double_t; # elif __GLIBC_FLT_EVAL_METHOD == 128 typedef _Float128 float_t; typedef _Float128 double_t; # elif __GLIBC_FLT_EVAL_METHOD == 129 typedef _Float128x float_t; typedef _Float128x double_t; # else # error "Unknown __GLIBC_FLT_EVAL_METHOD" # endif #endif /* Define macros for the return values of ilogb and llogb, based on __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. FP_ILOGB0 Expands to a value returned by `ilogb (0.0)'. FP_ILOGBNAN Expands to a value returned by `ilogb (NAN)'. FP_LLOGB0 Expands to a value returned by `llogb (0.0)'. FP_LLOGBNAN Expands to a value returned by `llogb (NAN)'. */ #include <bits/fp-logb.h> #ifdef __USE_ISOC99 # if __FP_LOGB0_IS_MIN # define FP_ILOGB0 (-2147483647 - 1) # else # define FP_ILOGB0 (-2147483647) # endif # if __FP_LOGBNAN_IS_MIN # define FP_ILOGBNAN (-2147483647 - 1) # else # define FP_ILOGBNAN 2147483647 # endif #endif #if __GLIBC_USE (IEC_60559_BFP_EXT) # if __WORDSIZE == 32 # define __FP_LONG_MAX 0x7fffffffL # else # define __FP_LONG_MAX 0x7fffffffffffffffL # endif # if __FP_LOGB0_IS_MIN # define FP_LLOGB0 (-__FP_LONG_MAX - 1) # else # define FP_LLOGB0 (-__FP_LONG_MAX) # endif # if __FP_LOGBNAN_IS_MIN # define FP_LLOGBNAN (-__FP_LONG_MAX - 1) # else # define FP_LLOGBNAN __FP_LONG_MAX # endif #endif /* Get the architecture specific values describing the floating-point evaluation. The following symbols will get defined: FP_FAST_FMA FP_FAST_FMAF FP_FAST_FMAL If defined it indicates that the `fma' function generally executes about as fast as a multiply and an add. This macro is defined only iff the `fma' function is implemented directly with a hardware multiply-add instructions. */ #include <bits/fp-fast.h> #if __GLIBC_USE (IEC_60559_BFP_EXT) /* Rounding direction macros for fromfp functions. */ enum { FP_INT_UPWARD = # define FP_INT_UPWARD 0 FP_INT_UPWARD, FP_INT_DOWNWARD = # define FP_INT_DOWNWARD 1 FP_INT_DOWNWARD, FP_INT_TOWARDZERO = # define FP_INT_TOWARDZERO 2 FP_INT_TOWARDZERO, FP_INT_TONEARESTFROMZERO = # define FP_INT_TONEARESTFROMZERO 3 FP_INT_TONEARESTFROMZERO, FP_INT_TONEAREST = # define FP_INT_TONEAREST 4 FP_INT_TONEAREST, }; #endif /* The file <bits/mathcalls.h> contains the prototypes for all the actual math functions. These macros are used for those prototypes, so we can easily declare each function as both `name' and `__name', and can declare the float versions `namef' and `__namef'. */ #define __SIMD_DECL(function) __CONCAT (__DECL_SIMD_, function) #define __MATHCALL_VEC(function, suffix, args) \ __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \ __MATHCALL (function, suffix, args) #define __MATHDECL_VEC(type, function,suffix, args) \ __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \ __MATHDECL(type, function,suffix, args) #define __MATHCALL(function,suffix, args) \ __MATHDECL (_Mdouble_,function,suffix, args) #define __MATHDECL(type, function,suffix, args) \ __MATHDECL_1(type, function,suffix, args); \ __MATHDECL_1(type, __CONCAT(__,function),suffix, args) #define __MATHCALLX(function,suffix, args, attrib) \ __MATHDECLX (_Mdouble_,function,suffix, args, attrib) #define __MATHDECLX(type, function,suffix, args, attrib) \ __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \ __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib) #define __MATHDECL_1(type, function,suffix, args) \ extern type __MATH_PRECNAME(function,suffix) args __THROW #define _Mdouble_ double #define __MATH_PRECNAME(name,r) __CONCAT(name,r) #define __MATH_DECLARING_DOUBLE 1 #define __MATH_DECLARING_FLOATN 0 #include <bits/mathcalls-helper-functions.h> #include <bits/mathcalls.h> #undef _Mdouble_ #undef __MATH_PRECNAME #undef __MATH_DECLARING_DOUBLE #undef __MATH_DECLARING_FLOATN #ifdef __USE_ISOC99 /* Include the file of declarations again, this time using `float' instead of `double' and appending f to each function name. */ # define _Mdouble_ float # define __MATH_PRECNAME(name,r) name##f##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 0 # include <bits/mathcalls-helper-functions.h> # include <bits/mathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \ || defined __LDBL_COMPAT \ || defined _LIBC_TEST # ifdef __LDBL_COMPAT # ifdef __USE_ISOC99 extern float __nldbl_nexttowardf (float __x, long double __y) __THROW __attribute__ ((__const__)); # ifdef __REDIRECT_NTH extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y), __nldbl_nexttowardf) __attribute__ ((__const__)); extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), nextafter) __attribute__ ((__const__)); extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __y), nextafter) __attribute__ ((__const__)); # endif # endif # undef __MATHDECL_1 # define __MATHDECL_2(type, function,suffix, args, alias) \ extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix), \ args, alias) # define __MATHDECL_1(type, function,suffix, args) \ __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix)) # endif /* Include the file of declarations again, this time using `long double' instead of `double' and appending l to each function name. */ # define _Mdouble_ long double # define __MATH_PRECNAME(name,r) name##l##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 0 # define __MATH_DECLARE_LDOUBLE 1 # include <bits/mathcalls-helper-functions.h> # include <bits/mathcalls.h> # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # endif /* !(__NO_LONG_DOUBLE_MATH && _LIBC) || __LDBL_COMPAT */ #endif /* Use ISO C99. */ /* Include the file of declarations for _FloatN and _FloatNx types. */ #if __HAVE_DISTINCT_FLOAT16 || (__HAVE_FLOAT16 && !defined _LIBC) # define _Mdouble_ _Float16 # define __MATH_PRECNAME(name,r) name##f16##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # if __HAVE_DISTINCT_FLOAT16 # include <bits/mathcalls-helper-functions.h> # endif # if __GLIBC_USE (IEC_60559_TYPES_EXT) # include <bits/mathcalls.h> # endif # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN #endif /* __HAVE_DISTINCT_FLOAT16 || (__HAVE_FLOAT16 && !_LIBC). */ #if __HAVE_DISTINCT_FLOAT32 || (__HAVE_FLOAT32 && !defined _LIBC) # define _Mdouble_ _Float32 # define __MATH_PRECNAME(name,r) name##f32##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # if __HAVE_DISTINCT_FLOAT32 # include <bits/mathcalls-helper-functions.h> # endif # if __GLIBC_USE (IEC_60559_TYPES_EXT) # include <bits/mathcalls.h> # endif # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN #endif /* __HAVE_DISTINCT_FLOAT32 || (__HAVE_FLOAT32 && !_LIBC). */ #if __HAVE_DISTINCT_FLOAT64 || (__HAVE_FLOAT64 && !defined _LIBC) # define _Mdouble_ _Float64 # define __MATH_PRECNAME(name,r) name##f64##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # if __HAVE_DISTINCT_FLOAT64 # include <bits/mathcalls-helper-functions.h> # endif # if __GLIBC_USE (IEC_60559_TYPES_EXT) # include <bits/mathcalls.h> # endif # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN #endif /* __HAVE_DISTINCT_FLOAT64 || (__HAVE_FLOAT64 && !_LIBC). */ #if __HAVE_DISTINCT_FLOAT128 || (__HAVE_FLOAT128 && !defined _LIBC) # define _Mdouble_ _Float128 # define __MATH_PRECNAME(name,r) name##f128##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # if __HAVE_DISTINCT_FLOAT128 # include <bits/mathcalls-helper-functions.h> # endif # if __GLIBC_USE (IEC_60559_TYPES_EXT) # include <bits/mathcalls.h> # endif # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN #endif /* __HAVE_DISTINCT_FLOAT128 || (__HAVE_FLOAT128 && !_LIBC). */ #if __HAVE_DISTINCT_FLOAT32X || (__HAVE_FLOAT32X && !defined _LIBC) # define _Mdouble_ _Float32x # define __MATH_PRECNAME(name,r) name##f32x##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # if __HAVE_DISTINCT_FLOAT32X # include <bits/mathcalls-helper-functions.h> # endif # if __GLIBC_USE (IEC_60559_TYPES_EXT) # include <bits/mathcalls.h> # endif # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN #endif /* __HAVE_DISTINCT_FLOAT32X || (__HAVE_FLOAT32X && !_LIBC). */ #if __HAVE_DISTINCT_FLOAT64X || (__HAVE_FLOAT64X && !defined _LIBC) # define _Mdouble_ _Float64x # define __MATH_PRECNAME(name,r) name##f64x##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # if __HAVE_DISTINCT_FLOAT64X # include <bits/mathcalls-helper-functions.h> # endif # if __GLIBC_USE (IEC_60559_TYPES_EXT) # include <bits/mathcalls.h> # endif # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN #endif /* __HAVE_DISTINCT_FLOAT64X || (__HAVE_FLOAT64X && !_LIBC). */ #if __HAVE_DISTINCT_FLOAT128X || (__HAVE_FLOAT128X && !defined _LIBC) # define _Mdouble_ _Float128x # define __MATH_PRECNAME(name,r) name##f128x##r # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # if __HAVE_DISTINCT_FLOAT128X # include <bits/mathcalls-helper-functions.h> # endif # if __GLIBC_USE (IEC_60559_TYPES_EXT) # include <bits/mathcalls.h> # endif # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN #endif /* __HAVE_DISTINCT_FLOAT128X || (__HAVE_FLOAT128X && !_LIBC). */ #undef __MATHDECL_1 #undef __MATHDECL #undef __MATHCALL /* Declare functions returning a narrower type. */ #define __MATHCALL_NARROW_ARGS_1 (_Marg_ __x) #define __MATHCALL_NARROW_ARGS_2 (_Marg_ __x, _Marg_ __y) #define __MATHCALL_NARROW_ARGS_3 (_Marg_ __x, _Marg_ __y, _Marg_ __z) #define __MATHCALL_NARROW_NORMAL(func, nargs) \ extern _Mret_ func __MATHCALL_NARROW_ARGS_ ## nargs __THROW #define __MATHCALL_NARROW_REDIR(func, redir, nargs) \ extern _Mret_ __REDIRECT_NTH (func, __MATHCALL_NARROW_ARGS_ ## nargs, \ redir) #define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_NORMAL (func, nargs) #if __GLIBC_USE (IEC_60559_BFP_EXT) # define _Mret_ float # define _Marg_ double # define __MATHCALL_NAME(name) f ## name # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # define _Mret_ float # define _Marg_ long double # define __MATHCALL_NAME(name) f ## name ## l # ifdef __LDBL_COMPAT # define __MATHCALL_REDIR_NAME(name) f ## name # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_REDIR (func, redir, nargs) # endif # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # ifdef __LDBL_COMPAT # undef __MATHCALL_REDIR_NAME # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_NORMAL (func, nargs) # endif # define _Mret_ double # define _Marg_ long double # define __MATHCALL_NAME(name) d ## name ## l # ifdef __LDBL_COMPAT # define __MATHCALL_REDIR_NAME(name) __nldbl_d ## name ## l # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_REDIR (func, redir, nargs) # endif # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # ifdef __LDBL_COMPAT # undef __MATHCALL_REDIR_NAME # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_NORMAL (func, nargs) # endif #endif #if __GLIBC_USE (IEC_60559_TYPES_EXT) # if __HAVE_FLOAT16 && __HAVE_FLOAT32 # define _Mret_ _Float16 # define _Marg_ _Float32 # define __MATHCALL_NAME(name) f16 ## name ## f32 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT16 && __HAVE_FLOAT32X # define _Mret_ _Float16 # define _Marg_ _Float32x # define __MATHCALL_NAME(name) f16 ## name ## f32x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT16 && __HAVE_FLOAT64 # define _Mret_ _Float16 # define _Marg_ _Float64 # define __MATHCALL_NAME(name) f16 ## name ## f64 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT16 && __HAVE_FLOAT64X # define _Mret_ _Float16 # define _Marg_ _Float64x # define __MATHCALL_NAME(name) f16 ## name ## f64x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT16 && __HAVE_FLOAT128 # define _Mret_ _Float16 # define _Marg_ _Float128 # define __MATHCALL_NAME(name) f16 ## name ## f128 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT16 && __HAVE_FLOAT128X # define _Mret_ _Float16 # define _Marg_ _Float128x # define __MATHCALL_NAME(name) f16 ## name ## f128x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32 && __HAVE_FLOAT32X # define _Mret_ _Float32 # define _Marg_ _Float32x # define __MATHCALL_NAME(name) f32 ## name ## f32x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32 && __HAVE_FLOAT64 # define _Mret_ _Float32 # define _Marg_ _Float64 # define __MATHCALL_NAME(name) f32 ## name ## f64 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32 && __HAVE_FLOAT64X # define _Mret_ _Float32 # define _Marg_ _Float64x # define __MATHCALL_NAME(name) f32 ## name ## f64x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32 && __HAVE_FLOAT128 # define _Mret_ _Float32 # define _Marg_ _Float128 # define __MATHCALL_NAME(name) f32 ## name ## f128 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32 && __HAVE_FLOAT128X # define _Mret_ _Float32 # define _Marg_ _Float128x # define __MATHCALL_NAME(name) f32 ## name ## f128x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32X && __HAVE_FLOAT64 # define _Mret_ _Float32x # define _Marg_ _Float64 # define __MATHCALL_NAME(name) f32x ## name ## f64 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32X && __HAVE_FLOAT64X # define _Mret_ _Float32x # define _Marg_ _Float64x # define __MATHCALL_NAME(name) f32x ## name ## f64x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32X && __HAVE_FLOAT128 # define _Mret_ _Float32x # define _Marg_ _Float128 # define __MATHCALL_NAME(name) f32x ## name ## f128 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT32X && __HAVE_FLOAT128X # define _Mret_ _Float32x # define _Marg_ _Float128x # define __MATHCALL_NAME(name) f32x ## name ## f128x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT64 && __HAVE_FLOAT64X # define _Mret_ _Float64 # define _Marg_ _Float64x # define __MATHCALL_NAME(name) f64 ## name ## f64x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT64 && __HAVE_FLOAT128 # define _Mret_ _Float64 # define _Marg_ _Float128 # define __MATHCALL_NAME(name) f64 ## name ## f128 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT64 && __HAVE_FLOAT128X # define _Mret_ _Float64 # define _Marg_ _Float128x # define __MATHCALL_NAME(name) f64 ## name ## f128x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT64X && __HAVE_FLOAT128 # define _Mret_ _Float64x # define _Marg_ _Float128 # define __MATHCALL_NAME(name) f64x ## name ## f128 # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT64X && __HAVE_FLOAT128X # define _Mret_ _Float64x # define _Marg_ _Float128x # define __MATHCALL_NAME(name) f64x ## name ## f128x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif # if __HAVE_FLOAT128 && __HAVE_FLOAT128X # define _Mret_ _Float128 # define _Marg_ _Float128x # define __MATHCALL_NAME(name) f128 ## name ## f128x # include <bits/mathcalls-narrow.h> # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME # endif #endif #undef __MATHCALL_NARROW_ARGS_1 #undef __MATHCALL_NARROW_ARGS_2 #undef __MATHCALL_NARROW_ARGS_3 #undef __MATHCALL_NARROW_NORMAL #undef __MATHCALL_NARROW_REDIR #undef __MATHCALL_NARROW #if defined __USE_MISC || defined __USE_XOPEN /* This variable is used by `gamma' and `lgamma'. */ extern int signgam; #endif #if (__HAVE_DISTINCT_FLOAT16 \ || __HAVE_DISTINCT_FLOAT32 \ || __HAVE_DISTINCT_FLOAT64 \ || __HAVE_DISTINCT_FLOAT32X \ || __HAVE_DISTINCT_FLOAT64X \ || __HAVE_DISTINCT_FLOAT128X) # error "Unsupported _FloatN or _FloatNx types for <math.h>." #endif /* Depending on the type of TG_ARG, call an appropriately suffixed version of FUNC with arguments (including parentheses) ARGS. Suffixed functions may not exist for long double if it has the same format as double, or for other types with the same format as float, double or long double. The behavior is undefined if the argument does not have a real floating type. The definition may use a conditional expression, so all suffixed versions of FUNC must return the same type (FUNC may include a cast if necessary rather than being a single identifier). */ #ifdef __NO_LONG_DOUBLE_MATH # if __HAVE_DISTINCT_FLOAT128 # error "Distinct _Float128 without distinct long double not supported." # endif # define __MATH_TG(TG_ARG, FUNC, ARGS) \ (sizeof (TG_ARG) == sizeof (float) ? FUNC ## f ARGS : FUNC ARGS) #elif __HAVE_DISTINCT_FLOAT128 # if __HAVE_GENERIC_SELECTION # if __HAVE_FLOATN_NOT_TYPEDEF && __HAVE_FLOAT32 # define __MATH_TG_F32(FUNC, ARGS) _Float32: FUNC ## f ARGS, # else # define __MATH_TG_F32(FUNC, ARGS) # endif # if __HAVE_FLOATN_NOT_TYPEDEF && __HAVE_FLOAT64X # if __HAVE_FLOAT64X_LONG_DOUBLE # define __MATH_TG_F64X(FUNC, ARGS) _Float64x: FUNC ## l ARGS, # else # define __MATH_TG_F64X(FUNC, ARGS) _Float64x: FUNC ## f128 ARGS, # endif # else # define __MATH_TG_F64X(FUNC, ARGS) # endif # define __MATH_TG(TG_ARG, FUNC, ARGS) \ _Generic ((TG_ARG), \ float: FUNC ## f ARGS, \ __MATH_TG_F32 (FUNC, ARGS) \ default: FUNC ARGS, \ long double: FUNC ## l ARGS, \ __MATH_TG_F64X (FUNC, ARGS) \ _Float128: FUNC ## f128 ARGS) # else # if __HAVE_FLOATN_NOT_TYPEDEF # error "Non-typedef _FloatN but no _Generic." # endif # define __MATH_TG(TG_ARG, FUNC, ARGS) \ __builtin_choose_expr \ (__builtin_types_compatible_p (__typeof (TG_ARG), float), \ FUNC ## f ARGS, \ __builtin_choose_expr \ (__builtin_types_compatible_p (__typeof (TG_ARG), double), \ FUNC ARGS, \ __builtin_choose_expr \ (__builtin_types_compatible_p (__typeof (TG_ARG), long double), \ FUNC ## l ARGS, \ FUNC ## f128 ARGS))) # endif #else # define __MATH_TG(TG_ARG, FUNC, ARGS) \ (sizeof (TG_ARG) == sizeof (float) \ ? FUNC ## f ARGS \ : sizeof (TG_ARG) == sizeof (double) \ ? FUNC ARGS \ : FUNC ## l ARGS) #endif /* ISO C99 defines some generic macros which work on any data type. */ #ifdef __USE_ISOC99 /* All floating-point numbers can be put in one of these categories. */ enum { FP_NAN = # define FP_NAN 0 FP_NAN, FP_INFINITE = # define FP_INFINITE 1 FP_INFINITE, FP_ZERO = # define FP_ZERO 2 FP_ZERO, FP_SUBNORMAL = # define FP_SUBNORMAL 3 FP_SUBNORMAL, FP_NORMAL = # define FP_NORMAL 4 FP_NORMAL }; /* GCC bug 66462 means we cannot use the math builtins with -fsignaling-nan, so disable builtins if this is enabled. When fixed in a newer GCC, the __SUPPORT_SNAN__ check may be skipped for those versions. */ /* Return number of classification appropriate for X. */ # if ((__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ || __glibc_clang_prereq (2,8)) \ && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus) /* The check for __cplusplus allows the use of the builtin, even when optimization for size is on. This is provided for libstdc++, only to let its configure test work when it is built with -Os. No further use of this definition of fpclassify is expected in C++ mode, since libstdc++ provides its own version of fpclassify in cmath (which undefines fpclassify). */ # define fpclassify(x) __builtin_fpclassify (FP_NAN, FP_INFINITE, \ FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x) # else # define fpclassify(x) __MATH_TG ((x), __fpclassify, (x)) # endif /* Return nonzero value if sign of X is negative. */ # if __GNUC_PREREQ (6,0) || __glibc_clang_prereq (3,3) # define signbit(x) __builtin_signbit (x) # elif defined __cplusplus /* In C++ mode, __MATH_TG cannot be used, because it relies on __builtin_types_compatible_p, which is a C-only builtin. The check for __cplusplus allows the use of the builtin instead of __MATH_TG. This is provided for libstdc++, only to let its configure test work. No further use of this definition of signbit is expected in C++ mode, since libstdc++ provides its own version of signbit in cmath (which undefines signbit). */ # define signbit(x) __builtin_signbitl (x) # elif __GNUC_PREREQ (4,0) # define signbit(x) __MATH_TG ((x), __builtin_signbit, (x)) # else # define signbit(x) __MATH_TG ((x), __signbit, (x)) # endif /* Return nonzero value if X is not +-Inf or NaN. */ # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ || __glibc_clang_prereq (2,8) # define isfinite(x) __builtin_isfinite (x) # else # define isfinite(x) __MATH_TG ((x), __finite, (x)) # endif /* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */ # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ || __glibc_clang_prereq (2,8) # define isnormal(x) __builtin_isnormal (x) # else # define isnormal(x) (fpclassify (x) == FP_NORMAL) # endif /* Return nonzero value if X is a NaN. We could use `fpclassify' but we already have this functions `__isnan' and it is faster. */ # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ || __glibc_clang_prereq (2,8) # define isnan(x) __builtin_isnan (x) # else # define isnan(x) __MATH_TG ((x), __isnan, (x)) # endif /* Return nonzero value if X is positive or negative infinity. */ # if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \ && !defined __SUPPORT_SNAN__ && !defined __cplusplus /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0, use the helper function, __isinff128, with older compilers. This is only provided for C mode, because in C++ mode, GCC has no support for __builtin_types_compatible_p (and when in C++ mode, this macro is not used anyway, because libstdc++ headers undefine it). */ # define isinf(x) \ (__builtin_types_compatible_p (__typeof (x), _Float128) \ ? __isinff128 (x) : __builtin_isinf_sign (x)) # elif (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ || __glibc_clang_prereq (3,7) # define isinf(x) __builtin_isinf_sign (x) # else # define isinf(x) __MATH_TG ((x), __isinf, (x)) # endif /* Bitmasks for the math_errhandling macro. */ # define MATH_ERRNO 1 /* errno set by math functions. */ # define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */ /* By default all math functions support both errno and exception handling (except for soft floating point implementations which may only support errno handling). If errno handling is disabled, exceptions are still supported by GLIBC. Set math_errhandling to 0 with -ffast-math (this is nonconforming but it is more useful than leaving it undefined). */ # ifdef __FAST_MATH__ # define math_errhandling 0 # elif defined __NO_MATH_ERRNO__ # define math_errhandling (MATH_ERREXCEPT) # else # define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT) # endif #endif /* Use ISO C99. */ #if __GLIBC_USE (IEC_60559_BFP_EXT) # include <bits/iscanonical.h> /* Return nonzero value if X is a signaling NaN. */ # ifndef __cplusplus # define issignaling(x) __MATH_TG ((x), __issignaling, (x)) # else /* In C++ mode, __MATH_TG cannot be used, because it relies on __builtin_types_compatible_p, which is a C-only builtin. On the other hand, overloading provides the means to distinguish between the floating-point types. The overloading resolution will match the correct parameter (regardless of type qualifiers (i.e.: const and volatile)). */ extern "C++" { inline int issignaling (float __val) { return __issignalingf (__val); } inline int issignaling (double __val) { return __issignaling (__val); } inline int issignaling (long double __val) { # ifdef __NO_LONG_DOUBLE_MATH return __issignaling (__val); # else return __issignalingl (__val); # endif } # if __HAVE_FLOAT128_UNLIKE_LDBL /* When using an IEEE 128-bit long double, _Float128 is defined as long double in C++. */ inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); } # endif } /* extern C++ */ # endif /* Return nonzero value if X is subnormal. */ # define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL) /* Return nonzero value if X is zero. */ # ifndef __cplusplus # ifdef __SUPPORT_SNAN__ # define iszero(x) (fpclassify (x) == FP_ZERO) # else # define iszero(x) (((__typeof (x)) (x)) == 0) # endif # else /* __cplusplus */ extern "C++" { # ifdef __SUPPORT_SNAN__ inline int iszero (float __val) { return __fpclassifyf (__val) == FP_ZERO; } inline int iszero (double __val) { return __fpclassify (__val) == FP_ZERO; } inline int iszero (long double __val) { # ifdef __NO_LONG_DOUBLE_MATH return __fpclassify (__val) == FP_ZERO; # else return __fpclassifyl (__val) == FP_ZERO; # endif } # if __HAVE_FLOAT128_UNLIKE_LDBL /* When using an IEEE 128-bit long double, _Float128 is defined as long double in C++. */ inline int iszero (_Float128 __val) { return __fpclassifyf128 (__val) == FP_ZERO; } # endif # else template <class __T> inline bool iszero (__T __val) { return __val == 0; } # endif } /* extern C++ */ # endif /* __cplusplus */ #endif /* Use IEC_60559_BFP_EXT. */ #ifdef __USE_XOPEN /* X/Open wants another strange constant. */ # define MAXFLOAT 3.40282347e+38F #endif /* Some useful constants. */ #if defined __USE_MISC || defined __USE_XOPEN # define M_E 2.7182818284590452354 /* e */ # define M_LOG2E 1.4426950408889634074 /* log_2 e */ # define M_LOG10E 0.43429448190325182765 /* log_10 e */ # define M_LN2 0.69314718055994530942 /* log_e 2 */ # define M_LN10 2.30258509299404568402 /* log_e 10 */ # define M_PI 3.14159265358979323846 /* pi */ # define M_PI_2 1.57079632679489661923 /* pi/2 */ # define M_PI_4 0.78539816339744830962 /* pi/4 */ # define M_1_PI 0.31830988618379067154 /* 1/pi */ # define M_2_PI 0.63661977236758134308 /* 2/pi */ # define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ # define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ # define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif /* The above constants are not adequate for computation using `long double's. Therefore we provide as an extension constants with similar names as a GNU extension. Provide enough digits for the 128-bit IEEE quad. */ #ifdef __USE_GNU # define M_El 2.718281828459045235360287471352662498L /* e */ # define M_LOG2El 1.442695040888963407359924681001892137L /* log_2 e */ # define M_LOG10El 0.434294481903251827651128918916605082L /* log_10 e */ # define M_LN2l 0.693147180559945309417232121458176568L /* log_e 2 */ # define M_LN10l 2.302585092994045684017991454684364208L /* log_e 10 */ # define M_PIl 3.141592653589793238462643383279502884L /* pi */ # define M_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */ # define M_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */ # define M_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */ # define M_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */ # define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */ # define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */ # define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */ #endif #if __HAVE_FLOAT16 && defined __USE_GNU # define M_Ef16 __f16 (2.718281828459045235360287471352662498) /* e */ # define M_LOG2Ef16 __f16 (1.442695040888963407359924681001892137) /* log_2 e */ # define M_LOG10Ef16 __f16 (0.434294481903251827651128918916605082) /* log_10 e */ # define M_LN2f16 __f16 (0.693147180559945309417232121458176568) /* log_e 2 */ # define M_LN10f16 __f16 (2.302585092994045684017991454684364208) /* log_e 10 */ # define M_PIf16 __f16 (3.141592653589793238462643383279502884) /* pi */ # define M_PI_2f16 __f16 (1.570796326794896619231321691639751442) /* pi/2 */ # define M_PI_4f16 __f16 (0.785398163397448309615660845819875721) /* pi/4 */ # define M_1_PIf16 __f16 (0.318309886183790671537767526745028724) /* 1/pi */ # define M_2_PIf16 __f16 (0.636619772367581343075535053490057448) /* 2/pi */ # define M_2_SQRTPIf16 __f16 (1.128379167095512573896158903121545172) /* 2/sqrt(pi) */ # define M_SQRT2f16 __f16 (1.414213562373095048801688724209698079) /* sqrt(2) */ # define M_SQRT1_2f16 __f16 (0.707106781186547524400844362104849039) /* 1/sqrt(2) */ #endif #if __HAVE_FLOAT32 && defined __USE_GNU # define M_Ef32 __f32 (2.718281828459045235360287471352662498) /* e */ # define M_LOG2Ef32 __f32 (1.442695040888963407359924681001892137) /* log_2 e */ # define M_LOG10Ef32 __f32 (0.434294481903251827651128918916605082) /* log_10 e */ # define M_LN2f32 __f32 (0.693147180559945309417232121458176568) /* log_e 2 */ # define M_LN10f32 __f32 (2.302585092994045684017991454684364208) /* log_e 10 */ # define M_PIf32 __f32 (3.141592653589793238462643383279502884) /* pi */ # define M_PI_2f32 __f32 (1.570796326794896619231321691639751442) /* pi/2 */ # define M_PI_4f32 __f32 (0.785398163397448309615660845819875721) /* pi/4 */ # define M_1_PIf32 __f32 (0.318309886183790671537767526745028724) /* 1/pi */ # define M_2_PIf32 __f32 (0.636619772367581343075535053490057448) /* 2/pi */ # define M_2_SQRTPIf32 __f32 (1.128379167095512573896158903121545172) /* 2/sqrt(pi) */ # define M_SQRT2f32 __f32 (1.414213562373095048801688724209698079) /* sqrt(2) */ # define M_SQRT1_2f32 __f32 (0.707106781186547524400844362104849039) /* 1/sqrt(2) */ #endif #if __HAVE_FLOAT64 && defined __USE_GNU # define M_Ef64 __f64 (2.718281828459045235360287471352662498) /* e */ # define M_LOG2Ef64 __f64 (1.442695040888963407359924681001892137) /* log_2 e */ # define M_LOG10Ef64 __f64 (0.434294481903251827651128918916605082) /* log_10 e */ # define M_LN2f64 __f64 (0.693147180559945309417232121458176568) /* log_e 2 */ # define M_LN10f64 __f64 (2.302585092994045684017991454684364208) /* log_e 10 */ # define M_PIf64 __f64 (3.141592653589793238462643383279502884) /* pi */ # define M_PI_2f64 __f64 (1.570796326794896619231321691639751442) /* pi/2 */ # define M_PI_4f64 __f64 (0.785398163397448309615660845819875721) /* pi/4 */ # define M_1_PIf64 __f64 (0.318309886183790671537767526745028724) /* 1/pi */ # define M_2_PIf64 __f64 (0.636619772367581343075535053490057448) /* 2/pi */ # define M_2_SQRTPIf64 __f64 (1.128379167095512573896158903121545172) /* 2/sqrt(pi) */ # define M_SQRT2f64 __f64 (1.414213562373095048801688724209698079) /* sqrt(2) */ # define M_SQRT1_2f64 __f64 (0.707106781186547524400844362104849039) /* 1/sqrt(2) */ #endif #if __HAVE_FLOAT128 && defined __USE_GNU # define M_Ef128 __f128 (2.718281828459045235360287471352662498) /* e */ # define M_LOG2Ef128 __f128 (1.442695040888963407359924681001892137) /* log_2 e */ # define M_LOG10Ef128 __f128 (0.434294481903251827651128918916605082) /* log_10 e */ # define M_LN2f128 __f128 (0.693147180559945309417232121458176568) /* log_e 2 */ # define M_LN10f128 __f128 (2.302585092994045684017991454684364208) /* log_e 10 */ # define M_PIf128 __f128 (3.141592653589793238462643383279502884) /* pi */ # define M_PI_2f128 __f128 (1.570796326794896619231321691639751442) /* pi/2 */ # define M_PI_4f128 __f128 (0.785398163397448309615660845819875721) /* pi/4 */ # define M_1_PIf128 __f128 (0.318309886183790671537767526745028724) /* 1/pi */ # define M_2_PIf128 __f128 (0.636619772367581343075535053490057448) /* 2/pi */ # define M_2_SQRTPIf128 __f128 (1.128379167095512573896158903121545172) /* 2/sqrt(pi) */ # define M_SQRT2f128 __f128 (1.414213562373095048801688724209698079) /* sqrt(2) */ # define M_SQRT1_2f128 __f128 (0.707106781186547524400844362104849039) /* 1/sqrt(2) */ #endif #if __HAVE_FLOAT32X && defined __USE_GNU # define M_Ef32x __f32x (2.718281828459045235360287471352662498) /* e */ # define M_LOG2Ef32x __f32x (1.442695040888963407359924681001892137) /* log_2 e */ # define M_LOG10Ef32x __f32x (0.434294481903251827651128918916605082) /* log_10 e */ # define M_LN2f32x __f32x (0.693147180559945309417232121458176568) /* log_e 2 */ # define M_LN10f32x __f32x (2.302585092994045684017991454684364208) /* log_e 10 */ # define M_PIf32x __f32x (3.141592653589793238462643383279502884) /* pi */ # define M_PI_2f32x __f32x (1.570796326794896619231321691639751442) /* pi/2 */ # define M_PI_4f32x __f32x (0.785398163397448309615660845819875721) /* pi/4 */ # define M_1_PIf32x __f32x (0.318309886183790671537767526745028724) /* 1/pi */ # define M_2_PIf32x __f32x (0.636619772367581343075535053490057448) /* 2/pi */ # define M_2_SQRTPIf32x __f32x (1.128379167095512573896158903121545172) /* 2/sqrt(pi) */ # define M_SQRT2f32x __f32x (1.414213562373095048801688724209698079) /* sqrt(2) */ # define M_SQRT1_2f32x __f32x (0.707106781186547524400844362104849039) /* 1/sqrt(2) */ #endif #if __HAVE_FLOAT64X && defined __USE_GNU # define M_Ef64x __f64x (2.718281828459045235360287471352662498) /* e */ # define M_LOG2Ef64x __f64x (1.442695040888963407359924681001892137) /* log_2 e */ # define M_LOG10Ef64x __f64x (0.434294481903251827651128918916605082) /* log_10 e */ # define M_LN2f64x __f64x (0.693147180559945309417232121458176568) /* log_e 2 */ # define M_LN10f64x __f64x (2.302585092994045684017991454684364208) /* log_e 10 */ # define M_PIf64x __f64x (3.141592653589793238462643383279502884) /* pi */ # define M_PI_2f64x __f64x (1.570796326794896619231321691639751442) /* pi/2 */ # define M_PI_4f64x __f64x (0.785398163397448309615660845819875721) /* pi/4 */ # define M_1_PIf64x __f64x (0.318309886183790671537767526745028724) /* 1/pi */ # define M_2_PIf64x __f64x (0.636619772367581343075535053490057448) /* 2/pi */ # define M_2_SQRTPIf64x __f64x (1.128379167095512573896158903121545172) /* 2/sqrt(pi) */ # define M_SQRT2f64x __f64x (1.414213562373095048801688724209698079) /* sqrt(2) */ # define M_SQRT1_2f64x __f64x (0.707106781186547524400844362104849039) /* 1/sqrt(2) */ #endif #if __HAVE_FLOAT128X && defined __USE_GNU # error "M_* values needed for _Float128x" #endif /* When compiling in strict ISO C compatible mode we must not use the inline functions since they, among other things, do not set the `errno' variable correctly. */ #if defined __STRICT_ANSI__ && !defined __NO_MATH_INLINES # define __NO_MATH_INLINES 1 #endif #ifdef __USE_ISOC99 # if __GNUC_PREREQ (3, 1) /* ISO C99 defines some macros to compare number while taking care for unordered numbers. Many FPUs provide special instructions to support these operations. Generic support in GCC for these as builtins went in 2.97, but not all cpus added their patterns until 3.1. Therefore we enable the builtins from 3.1 onwards and use a generic implementation othwerwise. */ # define isgreater(x, y) __builtin_isgreater(x, y) # define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) # define isless(x, y) __builtin_isless(x, y) # define islessequal(x, y) __builtin_islessequal(x, y) # define islessgreater(x, y) __builtin_islessgreater(x, y) # define isunordered(x, y) __builtin_isunordered(x, y) # else # define isgreater(x, y) \ (__extension__ ({ __typeof__ (x) __x = (x); __typeof__ (y) __y = (y); \ !isunordered (__x, __y) && __x > __y; })) # define isgreaterequal(x, y) \ (__extension__ ({ __typeof__ (x) __x = (x); __typeof__ (y) __y = (y); \ !isunordered (__x, __y) && __x >= __y; })) # define isless(x, y) \ (__extension__ ({ __typeof__ (x) __x = (x); __typeof__ (y) __y = (y); \ !isunordered (__x, __y) && __x < __y; })) # define islessequal(x, y) \ (__extension__ ({ __typeof__ (x) __x = (x); __typeof__ (y) __y = (y); \ !isunordered (__x, __y) && __x <= __y; })) # define islessgreater(x, y) \ (__extension__ ({ __typeof__ (x) __x = (x); __typeof__ (y) __y = (y); \ !isunordered (__x, __y) && __x != __y; })) /* isunordered must always check both operands first for signaling NaNs. */ # define isunordered(x, y) \ (__extension__ ({ __typeof__ (x) __u = (x); __typeof__ (y) __v = (y); \ __u != __v && (__u != __u || __v != __v); })) # endif #endif /* Get machine-dependent inline versions (if there are any). */ #ifdef __USE_EXTERN_INLINES # include <bits/mathinline.h> #endif /* Define special entry points to use when the compiler got told to only expect finite results. */ #if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 /* Include bits/math-finite.h for double. */ # define _Mdouble_ double # define __MATH_DECLARING_DOUBLE 1 # define __MATH_DECLARING_FLOATN 0 # define __REDIRFROM_X(function, reentrant) \ function ## reentrant # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X /* When __USE_ISOC99 is defined, include math-finite for float and long double, as well. */ # ifdef __USE_ISOC99 /* Include bits/math-finite.h for float. */ # define _Mdouble_ float # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 0 # define __REDIRFROM_X(function, reentrant) \ function ## f ## reentrant # define __REDIRTO_X(function, reentrant) \ __ ## function ## f ## reentrant ## _finite # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X /* Include bits/math-finite.h for long double. */ # ifdef __MATH_DECLARE_LDOUBLE # define _Mdouble_ long double # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 0 # define __REDIRFROM_X(function, reentrant) \ function ## l ## reentrant # ifdef __NO_LONG_DOUBLE_MATH # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## l ## reentrant ## _finite # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif # endif /* __USE_ISOC99. */ /* Include bits/math-finite.h for _FloatN and _FloatNx. */ # if (__HAVE_DISTINCT_FLOAT16 || (__HAVE_FLOAT16 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # define _Mdouble_ _Float16 # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # define __REDIRFROM_X(function, reentrant) \ function ## f16 ## reentrant # if __HAVE_DISTINCT_FLOAT16 # define __REDIRTO_X(function, reentrant) \ __ ## function ## f16 ## reentrant ## _finite # else # error "non-disinct _Float16" # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif # if (__HAVE_DISTINCT_FLOAT32 || (__HAVE_FLOAT32 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # define _Mdouble_ _Float32 # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # define __REDIRFROM_X(function, reentrant) \ function ## f32 ## reentrant # if __HAVE_DISTINCT_FLOAT32 # define __REDIRTO_X(function, reentrant) \ __ ## function ## f32 ## reentrant ## _finite # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## f ## reentrant ## _finite # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif # if (__HAVE_DISTINCT_FLOAT64 || (__HAVE_FLOAT64 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # define _Mdouble_ _Float64 # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # define __REDIRFROM_X(function, reentrant) \ function ## f64 ## reentrant # if __HAVE_DISTINCT_FLOAT64 # define __REDIRTO_X(function, reentrant) \ __ ## function ## f64 ## reentrant ## _finite # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif # if (__HAVE_DISTINCT_FLOAT128 || (__HAVE_FLOAT128 && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # define _Mdouble_ _Float128 # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # define __REDIRFROM_X(function, reentrant) \ function ## f128 ## reentrant # if __HAVE_DISTINCT_FLOAT128 # define __REDIRTO_X(function, reentrant) \ __ ## function ## f128 ## reentrant ## _finite # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## l ## reentrant ## _finite # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif # if (__HAVE_DISTINCT_FLOAT32X || (__HAVE_FLOAT32X && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # define _Mdouble_ _Float32x # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # define __REDIRFROM_X(function, reentrant) \ function ## f32x ## reentrant # if __HAVE_DISTINCT_FLOAT32X # define __REDIRTO_X(function, reentrant) \ __ ## function ## f32x ## reentrant ## _finite # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif # if (__HAVE_DISTINCT_FLOAT64X || (__HAVE_FLOAT64X && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # define _Mdouble_ _Float64x # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # define __REDIRFROM_X(function, reentrant) \ function ## f64x ## reentrant # if __HAVE_DISTINCT_FLOAT64X # define __REDIRTO_X(function, reentrant) \ __ ## function ## f64x ## reentrant ## _finite # elif __HAVE_FLOAT64X_LONG_DOUBLE # define __REDIRTO_X(function, reentrant) \ __ ## function ## l ## reentrant ## _finite # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## f128 ## reentrant ## _finite # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif # if (__HAVE_DISTINCT_FLOAT128X || (__HAVE_FLOAT128X && !defined _LIBC)) \ && __GLIBC_USE (IEC_60559_TYPES_EXT) # define _Mdouble_ _Float128x # define __MATH_DECLARING_DOUBLE 0 # define __MATH_DECLARING_FLOATN 1 # define __REDIRFROM_X(function, reentrant) \ function ## f128x ## reentrant # if __HAVE_DISTINCT_FLOAT128X # define __REDIRTO_X(function, reentrant) \ __ ## function ## f128x ## reentrant ## _finite # else # error "non-disinct _Float128x" # endif # include <bits/math-finite.h> # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X # endif #endif /* __FINITE_MATH_ONLY__ > 0. */ #if __GLIBC_USE (IEC_60559_BFP_EXT) /* An expression whose type has the widest of the evaluation formats of X and Y (which are of floating-point types). */ # if __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ > 64 # define __MATH_EVAL_FMT2(x, y) ((x) + (y) + 0.0L) # elif __FLT_EVAL_METHOD__ == 1 || __FLT_EVAL_METHOD__ > 32 # define __MATH_EVAL_FMT2(x, y) ((x) + (y) + 0.0) # elif __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 32 # define __MATH_EVAL_FMT2(x, y) ((x) + (y) + 0.0f) # else # define __MATH_EVAL_FMT2(x, y) ((x) + (y)) # endif /* Return X == Y but raising "invalid" and setting errno if X or Y is a NaN. */ # if !defined __cplusplus || (__cplusplus < 201103L && !defined __GNUC__) # define iseqsig(x, y) \ __MATH_TG (__MATH_EVAL_FMT2 (x, y), __iseqsig, ((x), (y))) # else /* In C++ mode, __MATH_TG cannot be used, because it relies on __builtin_types_compatible_p, which is a C-only builtin. Moreover, the comparison macros from ISO C take two floating-point arguments, which need not have the same type. Choosing what underlying function to call requires evaluating the formats of the arguments, then selecting which is wider. The macro __MATH_EVAL_FMT2 provides this information, however, only the type of the macro expansion is relevant (actually evaluating the expression would be incorrect). Thus, the type is used as a template parameter for __iseqsig_type, which calls the appropriate underlying function. */ extern "C++" { template<typename> struct __iseqsig_type; template<> struct __iseqsig_type<float> { static int __call (float __x, float __y) throw () { return __iseqsigf (__x, __y); } }; template<> struct __iseqsig_type<double> { static int __call (double __x, double __y) throw () { return __iseqsig (__x, __y); } }; template<> struct __iseqsig_type<long double> { static int __call (long double __x, long double __y) throw () { # ifndef __NO_LONG_DOUBLE_MATH return __iseqsigl (__x, __y); # else return __iseqsig (__x, __y); # endif } }; # if __HAVE_FLOAT128_UNLIKE_LDBL /* When using an IEEE 128-bit long double, _Float128 is defined as long double in C++. */ template<> struct __iseqsig_type<_Float128> { static int __call (_Float128 __x, _Float128 __y) throw () { return __iseqsigf128 (__x, __y); } }; # endif template<typename _T1, typename _T2> inline int iseqsig (_T1 __x, _T2 __y) throw () { # if __cplusplus >= 201103L typedef decltype (__MATH_EVAL_FMT2 (__x, __y)) _T3; # else typedef __typeof (__MATH_EVAL_FMT2 (__x, __y)) _T3; # endif return __iseqsig_type<_T3>::__call (__x, __y); } } /* extern "C++" */ # endif /* __cplusplus */ #endif __END_DECLS #endif /* math.h */ mcheck.h 0000644 00000004602 15063602066 0006155 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MCHECK_H #define _MCHECK_H 1 #include <features.h> __BEGIN_DECLS /* Return values for `mprobe': these are the kinds of inconsistencies that `mcheck' enables detection of. */ enum mcheck_status { MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */ MCHECK_OK, /* Block is fine. */ MCHECK_FREE, /* Block freed twice. */ MCHECK_HEAD, /* Memory before the block was clobbered. */ MCHECK_TAIL /* Memory after the block was clobbered. */ }; /* Activate a standard collection of debugging hooks. This must be called before `malloc' is ever called. ABORTFUNC is called with an error code (see enum above) when an inconsistency is detected. If ABORTFUNC is null, the standard function prints on stderr and then calls `abort'. */ extern int mcheck (void (*__abortfunc)(enum mcheck_status)) __THROW; /* Similar to `mcheck' but performs checks for all block whenever one of the memory handling functions is called. This can be very slow. */ extern int mcheck_pedantic (void (*__abortfunc)(enum mcheck_status)) __THROW; /* Force check of all blocks now. */ extern void mcheck_check_all (void); /* Check for aberrations in a particular malloc'd block. You must have called `mcheck' already. These are the same checks that `mcheck' does when you free or reallocate a block. */ extern enum mcheck_status mprobe (void *__ptr) __THROW; /* Activate a standard collection of tracing hooks. */ extern void mtrace (void) __THROW; extern void muntrace (void) __THROW; __END_DECLS #endif /* mcheck.h */ memory.h 0000644 00000001673 15063602066 0006240 0 ustar 00 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * SVID */ #ifndef _MEMORY_H #define _MEMORY_H 1 #include <features.h> #ifndef _STRING_H # include <string.h> #endif /* string.h */ #endif /* memory.h */ mntent.h 0000644 00000006436 15063602066 0006237 0 ustar 00 /* Utilities for reading/writing fstab, mtab, etc. Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MNTENT_H #define _MNTENT_H 1 #include <features.h> #include <paths.h> #include <bits/types/FILE.h> /* File listing canonical interesting mount points. */ #define MNTTAB _PATH_MNTTAB /* Deprecated alias. */ /* File listing currently active mount points. */ #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */ /* General filesystem types. */ #define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */ #define MNTTYPE_NFS "nfs" /* Network file system. */ #define MNTTYPE_SWAP "swap" /* Swap device. */ /* Generic mount options. */ #define MNTOPT_DEFAULTS "defaults" /* Use all default options. */ #define MNTOPT_RO "ro" /* Read only. */ #define MNTOPT_RW "rw" /* Read/write. */ #define MNTOPT_SUID "suid" /* Set uid allowed. */ #define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */ #define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */ __BEGIN_DECLS /* Structure describing a mount table entry. */ struct mntent { char *mnt_fsname; /* Device or server for filesystem. */ char *mnt_dir; /* Directory mounted on. */ char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */ char *mnt_opts; /* Comma-separated options for fs. */ int mnt_freq; /* Dump frequency (in days). */ int mnt_passno; /* Pass number for `fsck'. */ }; /* Prepare to begin reading and/or writing mount table entries from the beginning of FILE. MODE is as for `fopen'. */ extern FILE *setmntent (const char *__file, const char *__mode) __THROW; /* Read one mount table entry from STREAM. Returns a pointer to storage reused on the next call, or null for EOF or error (use feof/ferror to check). */ extern struct mntent *getmntent (FILE *__stream) __THROW; #ifdef __USE_MISC /* Reentrant version of the above function. */ extern struct mntent *getmntent_r (FILE *__restrict __stream, struct mntent *__restrict __result, char *__restrict __buffer, int __bufsize) __THROW; #endif /* Write the mount table entry described by MNT to STREAM. Return zero on success, nonzero on failure. */ extern int addmntent (FILE *__restrict __stream, const struct mntent *__restrict __mnt) __THROW; /* Close a stream opened with `setmntent'. */ extern int endmntent (FILE *__stream) __THROW; /* Search MNT->mnt_opts for an option matching OPT. Returns the address of the substring, or null if none found. */ extern char *hasmntopt (const struct mntent *__mnt, const char *__opt) __THROW; __END_DECLS #endif /* mntent.h */ monetary.h 0000644 00000003413 15063602066 0006560 0 ustar 00 /* Header file for monetary value formatting functions. Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MONETARY_H #define _MONETARY_H 1 #include <features.h> /* Get needed types. */ #define __need_size_t #include <stddef.h> #include <bits/types.h> #ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined #endif __BEGIN_DECLS /* Formatting a monetary value according to the current locale. */ extern ssize_t strfmon (char *__restrict __s, size_t __maxsize, const char *__restrict __format, ...) __THROW __attribute_format_strfmon__ (3, 4); #ifdef __USE_XOPEN2K8 /* POSIX.1-2008 extended locale interface (see locale.h). */ # include <bits/types/locale_t.h> /* Formatting a monetary value according to the given locale. */ extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize, locale_t __loc, const char *__restrict __format, ...) __THROW __attribute_format_strfmon__ (4, 5); #endif #ifdef __LDBL_COMPAT # include <bits/monetary-ldbl.h> #endif __END_DECLS #endif /* monetary.h */ mqueue.h 0000644 00000007257 15063602066 0006235 0 ustar 00 /* Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MQUEUE_H #define _MQUEUE_H 1 #include <features.h> #include <sys/types.h> #include <fcntl.h> #include <bits/types/sigevent_t.h> #include <bits/types/struct_timespec.h> /* Get the definition of mqd_t and struct mq_attr. */ #include <bits/mqueue.h> __BEGIN_DECLS /* Establish connection between a process and a message queue NAME and return message queue descriptor or (mqd_t) -1 on error. OFLAG determines the type of access used. If O_CREAT is on OFLAG, the third argument is taken as a `mode_t', the mode of the created message queue, and the fourth argument is taken as `struct mq_attr *', pointer to message queue attributes. If the fourth argument is NULL, default attributes are used. */ extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW __nonnull ((1)); /* Removes the association between message queue descriptor MQDES and its message queue. */ extern int mq_close (mqd_t __mqdes) __THROW; /* Query status and attributes of message queue MQDES. */ extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat) __THROW __nonnull ((2)); /* Set attributes associated with message queue MQDES and if OMQSTAT is not NULL also query its old attributes. */ extern int mq_setattr (mqd_t __mqdes, const struct mq_attr *__restrict __mqstat, struct mq_attr *__restrict __omqstat) __THROW __nonnull ((2)); /* Remove message queue named NAME. */ extern int mq_unlink (const char *__name) __THROW __nonnull ((1)); /* Register notification issued upon message arrival to an empty message queue MQDES. */ extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification) __THROW; /* Receive the oldest from highest priority messages in message queue MQDES. */ extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len, unsigned int *__msg_prio) __nonnull ((2)); /* Add message pointed by MSG_PTR to message queue MQDES. */ extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio) __nonnull ((2)); #ifdef __USE_XOPEN2K /* Receive the oldest from highest priority messages in message queue MQDES, stop waiting if ABS_TIMEOUT expires. */ extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, size_t __msg_len, unsigned int *__restrict __msg_prio, const struct timespec *__restrict __abs_timeout) __nonnull ((2, 5)); /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking on full message queue if ABS_TIMEOUT expires. */ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio, const struct timespec *__abs_timeout) __nonnull ((2, 5)); #endif /* Define some inlines helping to catch common problems. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ && defined __va_arg_pack_len # include <bits/mqueue2.h> #endif __END_DECLS #endif /* mqueue.h */ netdb.h 0000644 00000066703 15063602066 0006031 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* All data returned by the network data base library are supplied in host order and returned in network order (suitable for use in system calls). */ #ifndef _NETDB_H #define _NETDB_H 1 #include <features.h> #include <netinet/in.h> #include <bits/stdint-uintn.h> #ifdef __USE_MISC /* This is necessary to make this include file properly replace the Sun version. */ # include <rpc/netdb.h> #endif #ifdef __USE_GNU # include <bits/types/sigevent_t.h> # include <bits/types/struct_timespec.h> #endif #include <bits/netdb.h> /* Absolute file name for network data base files. */ #define _PATH_HEQUIV "/etc/hosts.equiv" #define _PATH_HOSTS "/etc/hosts" #define _PATH_NETWORKS "/etc/networks" #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" #define _PATH_PROTOCOLS "/etc/protocols" #define _PATH_SERVICES "/etc/services" __BEGIN_DECLS #if defined __USE_MISC || !defined __USE_XOPEN2K8 /* Error status for non-reentrant lookup functions. We use a macro to access always the thread-specific `h_errno' variable. */ # define h_errno (*__h_errno_location ()) /* Function to get address of global `h_errno' variable. */ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); /* Possible values left in `h_errno'. */ # define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ # define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL. */ # define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP. */ # define NO_DATA 4 /* Valid name, no data record of requested type. */ #endif #ifdef __USE_MISC # define NETDB_INTERNAL -1 /* See errno. */ # define NETDB_SUCCESS 0 /* No problem. */ # define NO_ADDRESS NO_DATA /* No address, look for MX record. */ #endif #if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED /* Highest reserved Internet port number. */ # define IPPORT_RESERVED 1024 #endif #ifdef __USE_GNU /* Scope delimiter for getaddrinfo(), getnameinfo(). */ # define SCOPE_DELIMITER '%' #endif #ifdef __USE_MISC /* Print error indicated by `h_errno' variable on standard error. STR if non-null is printed before the error string. */ extern void herror (const char *__str) __THROW; /* Return string associated with error ERR_NUM. */ extern const char *hstrerror (int __err_num) __THROW; #endif /* Description of data base entry for a single host. */ struct hostent { char *h_name; /* Official name of host. */ char **h_aliases; /* Alias list. */ int h_addrtype; /* Host address type. */ int h_length; /* Length of address. */ char **h_addr_list; /* List of addresses from name server. */ #ifdef __USE_MISC # define h_addr h_addr_list[0] /* Address, for backward compatibility.*/ #endif }; /* Open host data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void sethostent (int __stay_open); /* Close host data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endhostent (void); /* Get next entry from host data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostent (void); /* Return entry from host data base which address match ADDR with length LEN and type TYPE. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len, int __type); /* Return entry from host data base for host with NAME. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostbyname (const char *__name); #ifdef __USE_MISC /* Return entry from host data base for host with NAME. AF must be set to the address type which is `AF_INET' for IPv4 or `AF_INET6' for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct hostent *gethostbyname2 (const char *__name, int __af); /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. The last argument is a pointer to a variable which gets the value which would be stored in the global variable `herrno' by the non-reentrant functions. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int gethostent_r (struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int gethostbyname_r (const char *__restrict __name, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int gethostbyname2_r (const char *__restrict __name, int __af, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); #endif /* misc */ /* Open network data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setnetent (int __stay_open); /* Close network data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endnetent (void); /* Get next entry from network data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct netent *getnetent (void); /* Return entry from network data base which address match NET and type TYPE. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct netent *getnetbyaddr (uint32_t __net, int __type); /* Return entry from network data base for network with NAME. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct netent *getnetbyname (const char *__name); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. The last argument is a pointer to a variable which gets the value which would be stored in the global variable `herrno' by the non-reentrant functions. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getnetent_r (struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); extern int getnetbyaddr_r (uint32_t __net, int __type, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); extern int getnetbyname_r (const char *__restrict __name, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); #endif /* misc */ /* Description of data base entry for a single service. */ struct servent { char *s_name; /* Official service name. */ char **s_aliases; /* Alias list. */ int s_port; /* Port number. */ char *s_proto; /* Protocol to use. */ }; /* Open service data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setservent (int __stay_open); /* Close service data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endservent (void); /* Get next entry from service data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct servent *getservent (void); /* Return entry from network data base for network with NAME and protocol PROTO. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct servent *getservbyname (const char *__name, const char *__proto); /* Return entry from service data base which matches port PORT and protocol PROTO. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct servent *getservbyport (int __port, const char *__proto); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getservent_r (struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); extern int getservbyname_r (const char *__restrict __name, const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); extern int getservbyport_r (int __port, const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); #endif /* misc */ /* Description of data base entry for a single service. */ struct protoent { char *p_name; /* Official protocol name. */ char **p_aliases; /* Alias list. */ int p_proto; /* Protocol number. */ }; /* Open protocol data base files and mark them as staying open even after a later search if STAY_OPEN is non-zero. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setprotoent (int __stay_open); /* Close protocol data base files and clear `stay open' flag. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endprotoent (void); /* Get next entry from protocol data base file. Open data base if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct protoent *getprotoent (void); /* Return entry from protocol data base for network with NAME. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct protoent *getprotobyname (const char *__name); /* Return entry from protocol data base which number is PROTO. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct protoent *getprotobynumber (int __proto); #ifdef __USE_MISC /* Reentrant versions of the functions above. The additional arguments specify a buffer of BUFLEN starting at BUF. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int getprotoent_r (struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); extern int getprotobyname_r (const char *__restrict __name, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); extern int getprotobynumber_r (int __proto, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); /* Establish network group NETGROUP for enumeration. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int setnetgrent (const char *__netgroup); /* Free all space allocated by previous `setnetgrent' call. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void endnetgrent (void); /* Get next member of netgroup established by last `setnetgrent' call and return pointers to elements in HOSTP, USERP, and DOMAINP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getnetgrent (char **__restrict __hostp, char **__restrict __userp, char **__restrict __domainp); /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int innetgr (const char *__netgroup, const char *__host, const char *__user, const char *__domain); /* Reentrant version of `getnetgrent' where result is placed in BUFFER. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getnetgrent_r (char **__restrict __hostp, char **__restrict __userp, char **__restrict __domainp, char *__restrict __buffer, size_t __buflen); #endif /* misc */ #ifdef __USE_MISC /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. The local user is LOCUSER, on the remote machine the command is executed as REMUSER. In *FD2P the descriptor to the socket for the connection is returned. The caller must have the right to use a reserved port. When the function returns *AHOST contains the official host name. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rcmd (char **__restrict __ahost, unsigned short int __rport, const char *__restrict __locuser, const char *__restrict __remuser, const char *__restrict __cmd, int *__restrict __fd2p); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport, const char *__restrict __locuser, const char *__restrict __remuser, const char *__restrict __cmd, int *__restrict __fd2p, sa_family_t __af); /* Call `rexecd' at port RPORT on remote machine *AHOST to execute CMD. The process runs at the remote machine using the ID of user NAME whose cleartext password is PASSWD. In *FD2P the descriptor to the socket for the connection is returned. When the function returns *AHOST contains the official host name. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rexec (char **__restrict __ahost, int __rport, const char *__restrict __name, const char *__restrict __pass, const char *__restrict __cmd, int *__restrict __fd2p); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rexec_af (char **__restrict __ahost, int __rport, const char *__restrict __name, const char *__restrict __pass, const char *__restrict __cmd, int *__restrict __fd2p, sa_family_t __af); /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. If SUSER is not zero the user tries to become superuser. Return 0 if it is possible. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int ruserok (const char *__rhost, int __suser, const char *__remuser, const char *__locuser); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int ruserok_af (const char *__rhost, int __suser, const char *__remuser, const char *__locuser, sa_family_t __af); /* Check whether user REMUSER on system indicated by IPv4 address RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are not supported. If SUSER is not zero the user tries to become superuser. Return 0 if it is possible. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int iruserok (uint32_t __raddr, int __suser, const char *__remuser, const char *__locuser); /* This is the equivalent function where the pfamiliy if the address pointed to by RADDR is determined by the value of AF. It therefore can be used for IPv6 This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int iruserok_af (const void *__raddr, int __suser, const char *__remuser, const char *__locuser, sa_family_t __af); /* Try to allocate reserved port, returning a descriptor for a socket opened at this port or -1 if unsuccessful. The search for an available port will start at ALPORT and continues with lower numbers. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rresvport (int *__alport); /* This is the equivalent function where the protocol can be selected and which therefore can be used for IPv6. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int rresvport_af (int *__alport, sa_family_t __af); #endif /* Extension from POSIX.1:2001. */ #ifdef __USE_XOPEN2K /* Structure to contain information about address of a service provider. */ struct addrinfo { int ai_flags; /* Input flags. */ int ai_family; /* Protocol family for socket. */ int ai_socktype; /* Socket type. */ int ai_protocol; /* Protocol for socket. */ socklen_t ai_addrlen; /* Length of socket address. */ struct sockaddr *ai_addr; /* Socket address for socket. */ char *ai_canonname; /* Canonical name for service location. */ struct addrinfo *ai_next; /* Pointer to next in list. */ }; # ifdef __USE_GNU /* Structure used as control block for asynchronous lookup. */ struct gaicb { const char *ar_name; /* Name to look up. */ const char *ar_service; /* Service name. */ const struct addrinfo *ar_request; /* Additional request specification. */ struct addrinfo *ar_result; /* Pointer to result. */ /* The following are internal elements. */ int __return; int __glibc_reserved[5]; }; /* Lookup mode. */ # define GAI_WAIT 0 # define GAI_NOWAIT 1 # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ # define AI_CANONNAME 0x0002 /* Request for canonical name. */ # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose returned address type.. */ # ifdef __USE_GNU # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded in the current locale's character set) before looking it up. */ # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */ # define AI_IDN_ALLOW_UNASSIGNED \ __glibc_macro_warning ("AI_IDN_ALLOW_UNASSIGNED is deprecated") 0x0100 # define AI_IDN_USE_STD3_ASCII_RULES \ __glibc_macro_warning ("AI_IDN_USE_STD3_ASCII_RULES is deprecated") 0x0200 # endif # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ /* Error values for `getaddrinfo' function. */ # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ # define EAI_FAMILY -6 /* `ai_family' not supported. */ # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ # define EAI_MEMORY -10 /* Memory allocation failure. */ # define EAI_SYSTEM -11 /* System error returned in `errno'. */ # define EAI_OVERFLOW -12 /* Argument buffer overflow. */ # ifdef __USE_GNU # define EAI_NODATA -5 /* No address associated with NAME. */ # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ # define EAI_INPROGRESS -100 /* Processing request in progress. */ # define EAI_CANCELED -101 /* Request canceled. */ # define EAI_NOTCANCELED -102 /* Request not canceled. */ # define EAI_ALLDONE -103 /* All requests done. */ # define EAI_INTR -104 /* Interrupted by a signal. */ # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ # endif # ifdef __USE_MISC # define NI_MAXHOST 1025 # define NI_MAXSERV 32 # endif # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ # define NI_NUMERICSERV 2 /* Don't convert port number to name. */ # define NI_NOFQDN 4 /* Only return nodename portion. */ # define NI_NAMEREQD 8 /* Don't return numeric addresses. */ # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ # ifdef __USE_GNU # define NI_IDN 32 /* Convert name from IDN format. */ # define NI_IDN_ALLOW_UNASSIGNED \ __glibc_macro_warning ("NI_IDN_ALLOW_UNASSIGNED is deprecated") 64 # define NI_IDN_USE_STD3_ASCII_RULES \ __glibc_macro_warning ("NI_IDN_USE_STD3_ASCII_RULES is deprecated") 128 # endif /* Translate name of a service location and/or a service name to set of socket addresses. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getaddrinfo (const char *__restrict __name, const char *__restrict __service, const struct addrinfo *__restrict __req, struct addrinfo **__restrict __pai); /* Free `addrinfo' structure AI including associated storage. */ extern void freeaddrinfo (struct addrinfo *__ai) __THROW; /* Convert error return from getaddrinfo() to a string. */ extern const char *gai_strerror (int __ecode) __THROW; /* Translate a socket address to a location and service name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getnameinfo (const struct sockaddr *__restrict __sa, socklen_t __salen, char *__restrict __host, socklen_t __hostlen, char *__restrict __serv, socklen_t __servlen, int __flags); #endif /* POSIX */ #ifdef __USE_GNU /* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all requests are handled. If WAIT is GAI_NOWAIT return immediately after queueing the requests and signal completion according to SIG. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr], int __ent, struct sigevent *__restrict __sig); /* Suspend execution of the thread until at least one of the ENT requests in LIST is handled. If TIMEOUT is not a null pointer it specifies the longest time the function keeps waiting before returning with an error. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int gai_suspend (const struct gaicb *const __list[], int __ent, const struct timespec *__timeout); /* Get the error status of the request REQ. */ extern int gai_error (struct gaicb *__req) __THROW; /* Cancel the requests associated with GAICBP. */ extern int gai_cancel (struct gaicb *__gaicbp) __THROW; #endif /* GNU */ __END_DECLS #endif /* netdb.h */ nl_types.h 0000644 00000003330 15063602066 0006555 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _NL_TYPES_H #define _NL_TYPES_H 1 #include <features.h> /* The default message set used by the gencat program. */ #define NL_SETD 1 /* Value for FLAG parameter of `catgets' to say we want XPG4 compliance. */ #define NL_CAT_LOCALE 1 __BEGIN_DECLS /* Message catalog descriptor type. */ typedef void *nl_catd; /* Type used by `nl_langinfo'. */ typedef int nl_item; /* Open message catalog for later use, returning descriptor. This function is a possible cancellation point and therefore not marked with __THROW. */ extern nl_catd catopen (const char *__cat_name, int __flag) __nonnull ((1)); /* Return translation with NUMBER in SET of CATALOG; if not found return STRING. */ extern char *catgets (nl_catd __catalog, int __set, int __number, const char *__string) __THROW __nonnull ((1)); /* Close message CATALOG. */ extern int catclose (nl_catd __catalog) __THROW __nonnull ((1)); __END_DECLS #endif /* nl_types.h */ nss.h 0000644 00000003526 15063602066 0005532 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Define interface to NSS. This is meant for the interface functions and for implementors of new services. */ #ifndef _NSS_H #define _NSS_H 1 #include <features.h> #include <stdint.h> __BEGIN_DECLS /* Possible results of lookup using a nss_* function. */ enum nss_status { NSS_STATUS_TRYAGAIN = -2, NSS_STATUS_UNAVAIL, NSS_STATUS_NOTFOUND, NSS_STATUS_SUCCESS, NSS_STATUS_RETURN }; /* Data structure used for the 'gethostbyname4_r' function. */ struct gaih_addrtuple { struct gaih_addrtuple *next; char *name; int family; uint32_t addr[4]; uint32_t scopeid; }; /* Overwrite service selection for database DBNAME using specification in STRING. This function should only be used by system programs which have to work around non-existing services (e.e., while booting). Attention: Using this function repeatedly will slowly eat up the whole memory since previous selection data cannot be freed. */ extern int __nss_configure_lookup (const char *__dbname, const char *__string) __THROW; __END_DECLS #endif /* nss.h */ obstack.h 0000644 00000051472 15063602066 0006360 0 ustar 00 /* obstack.h - object stack macros Copyright (C) 1988-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Summary: All the apparent functions defined here are macros. The idea is that you would use these pre-tested macros to solve a very specific set of problems, and they would run fast. Caution: no side-effects in arguments please!! They may be evaluated MANY times!! These macros operate a stack of objects. Each object starts life small, and may grow to maturity. (Consider building a word syllable by syllable.) An object can move while it is growing. Once it has been "finished" it never changes address again. So the "top of the stack" is typically an immature growing object, while the rest of the stack is of mature, fixed size and fixed address objects. These routines grab large chunks of memory, using a function you supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, by calling 'obstack_chunk_free'. You must define them and declare them before using any obstack macros. Each independent stack is represented by a 'struct obstack'. Each of the obstack macros expects a pointer to such a structure as the first argument. One motivation for this package is the problem of growing char strings in symbol tables. Unless you are "fascist pig with a read-only mind" --Gosper's immortal quote from HAKMEM item 154, out of context--you would not like to put any arbitrary upper limit on the length of your symbols. In practice this often means you will build many short symbols and a few long symbols. At the time you are reading a symbol you don't know how long it is. One traditional method is to read a symbol into a buffer, realloc()ating the buffer every time you try to read a symbol that is longer than the buffer. This is beaut, but you still will want to copy the symbol from the buffer to a more permanent symbol-table entry say about half the time. With obstacks, you can work differently. Use one obstack for all symbol names. As you read a symbol, grow the name in the obstack gradually. When the name is complete, finalize it. Then, if the symbol exists already, free the newly read name. The way we do this is to take a large chunk, allocating memory from low addresses. When you want to build a symbol in the chunk you just add chars above the current "high water mark" in the chunk. When you have finished adding chars, because you got to the end of the symbol, you know how long the chars are, and you can create a new object. Mostly the chars will not burst over the highest address of the chunk, because you would typically expect a chunk to be (say) 100 times as long as an average object. In case that isn't clear, when we have enough chars to make up the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) so we just point to it where it lies. No moving of chars is needed and this is the second win: potentially long strings need never be explicitly shuffled. Once an object is formed, it does not change its address during its lifetime. When the chars burst over a chunk boundary, we allocate a larger chunk, and then copy the partly formed object from the end of the old chunk to the beginning of the new larger chunk. We then carry on accreting characters to the end of the object as we normally would. A special macro is provided to add a single char at a time to a growing object. This allows the use of register variables, which break the ordinary 'growth' macro. Summary: We allocate large chunks. We carve out one object at a time from the current chunk. Once carved, an object never moves. We are free to append data of any size to the currently growing object. Exactly one object is growing in an obstack at any one time. You can run one obstack per control block. You may have as many control blocks as you dare. Because of the way we do it, you can "unwind" an obstack back to a previous state. (You may remove objects much as you would with a stack.) */ /* Don't do the contents of this file more than once. */ #ifndef _OBSTACK_H #define _OBSTACK_H 1 /* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is defined, as with GNU C, use that; that way we don't pollute the namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h> and use ptrdiff_t. */ #ifdef __PTRDIFF_TYPE__ # define PTR_INT_TYPE __PTRDIFF_TYPE__ #else # include <stddef.h> # define PTR_INT_TYPE ptrdiff_t #endif /* If B is the base of an object addressed by P, return the result of aligning P to the next multiple of A + 1. B and P must be of type char *. A + 1 must be a power of 2. */ #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) /* Similar to _BPTR_ALIGN (B, P, A), except optimize the common case where pointers can be converted to integers, aligned as integers, and converted back again. If PTR_INT_TYPE is narrower than a pointer (e.g., the AS/400), play it safe and compute the alignment relative to B. Otherwise, use the faster strategy of computing the alignment relative to 0. */ #define __PTR_ALIGN(B, P, A) \ __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \ P, A) #include <string.h> #ifndef __attribute_pure__ # define __attribute_pure__ _GL_ATTRIBUTE_PURE #endif #ifdef __cplusplus extern "C" { #endif struct _obstack_chunk /* Lives at front of each chunk. */ { char *limit; /* 1 past end of this chunk */ struct _obstack_chunk *prev; /* address of prior chunk or NULL */ char contents[4]; /* objects begin here */ }; struct obstack /* control current object in current chunk */ { long chunk_size; /* preferred size to allocate chunks in */ struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ char *object_base; /* address of object we are building */ char *next_free; /* where to add next char to current object */ char *chunk_limit; /* address of char after current chunk */ union { PTR_INT_TYPE tempint; void *tempptr; } temp; /* Temporary for some macros. */ int alignment_mask; /* Mask of alignment for each object. */ /* These prototypes vary based on 'use_extra_arg', and we use casts to the prototypeless function type in all assignments, but having prototypes here quiets -Wstrict-prototypes. */ struct _obstack_chunk *(*chunkfun) (void *, long); void (*freefun) (void *, struct _obstack_chunk *); void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object : 1; /* There is a possibility that the current chunk contains a zero-length object. This prevents freeing the chunk if we allocate a bigger chunk to replace it. */ unsigned alloc_failed : 1; /* No longer used, as we now call the failed handler on error, but retained for binary compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ extern void _obstack_newchunk (struct obstack *, int); extern int _obstack_begin (struct obstack *, int, int, void *(*)(long), void (*)(void *)); extern int _obstack_begin_1 (struct obstack *, int, int, void *(*)(void *, long), void (*)(void *, void *), void *); extern int _obstack_memory_used (struct obstack *) __attribute_pure__; /* The default name of the function for freeing a chunk is 'obstack_free', but gnulib users can override this by defining '__obstack_free'. */ #ifndef __obstack_free # define __obstack_free obstack_free #endif extern void __obstack_free (struct obstack *, void *); /* Error handler called when 'obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. The default action is to print a message and abort. */ extern void (*obstack_alloc_failed_handler) (void); /* Exit value used when 'print_and_abort' is used. */ extern int obstack_exit_failure; /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ #define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ #define obstack_chunk_size(h) ((h)->chunk_size) /* Pointer to next byte not yet allocated in current chunk. */ #define obstack_next_free(h) ((h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) /* To prevent prototype warnings provide complete argument list. */ #define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ (void *(*)(long))obstack_chunk_alloc, \ (void (*)(void *))obstack_chunk_free) #define obstack_begin(h, size) \ _obstack_begin ((h), (size), 0, \ (void *(*)(long))obstack_chunk_alloc, \ (void (*)(void *))obstack_chunk_free) #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ _obstack_begin ((h), (size), (alignment), \ (void *(*)(long))(chunkfun), \ (void (*)(void *))(freefun)) #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ _obstack_begin_1 ((h), (size), (alignment), \ (void *(*)(void *, long))(chunkfun), \ (void (*)(void *, void *))(freefun), (arg)) #define obstack_chunkfun(h, newchunkfun) \ ((h)->chunkfun = (struct _obstack_chunk *(*)(void *, long))(newchunkfun)) #define obstack_freefun(h, newfreefun) \ ((h)->freefun = (void (*)(void *, struct _obstack_chunk *))(newfreefun)) #define obstack_1grow_fast(h, achar) (*((h)->next_free)++ = (achar)) #define obstack_blank_fast(h, n) ((h)->next_free += (n)) #define obstack_memory_used(h) _obstack_memory_used (h) #if defined __GNUC__ # if ! (2 < __GNUC__ + (8 <= __GNUC_MINOR__)) # define __extension__ # endif /* For GNU C, if not -traditional, we can define these macros to compute all args only once without using a global variable. Also, we can avoid using the 'temp' slot, to make faster code. */ # define obstack_object_size(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->next_free - __o->object_base); }) # define obstack_room(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->chunk_limit - __o->next_free); }) # define obstack_make_room(OBSTACK, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ (void) 0; }) # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (__o->chunk->prev == 0 \ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ __o->chunk->contents, \ __o->alignment_mask)); }) # define obstack_grow(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->next_free + __len > __o->chunk_limit) \ _obstack_newchunk (__o, __len); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ (void) 0; }) # define obstack_grow0(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->next_free + __len + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, __len + 1); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ (void) 0; }) # define obstack_1grow(OBSTACK, datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, 1); \ obstack_1grow_fast (__o, datum); \ (void) 0; }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ # define obstack_ptr_grow(OBSTACK, datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (void *)); \ obstack_ptr_grow_fast (__o, datum); }) \ # define obstack_int_grow(OBSTACK, datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (int) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (int)); \ obstack_int_grow_fast (__o, datum); }) # define obstack_ptr_grow_fast(OBSTACK, aptr) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__p1 = __o1->next_free; \ *(const void **) __p1 = (aptr); \ __o1->next_free += sizeof (const void *); \ (void) 0; }) # define obstack_int_grow_fast(OBSTACK, aint) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__p1 = __o1->next_free; \ *(int *) __p1 = (aint); \ __o1->next_free += sizeof (int); \ (void) 0; }) # define obstack_blank(OBSTACK, length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ obstack_blank_fast (__o, __len); \ (void) 0; }) # define obstack_alloc(OBSTACK, length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_blank (__h, (length)); \ obstack_finish (__h); }) # define obstack_copy(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow (__h, (where), (length)); \ obstack_finish (__h); }) # define obstack_copy0(OBSTACK, where, length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow0 (__h, (where), (length)); \ obstack_finish (__h); }) /* The local variable is named __o1 to avoid a name conflict when obstack_blank is called. */ # define obstack_finish(OBSTACK) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__value = (void *) __o1->object_base; \ if (__o1->next_free == __value) \ __o1->maybe_empty_object = 1; \ __o1->next_free \ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ __o1->alignment_mask); \ if (__o1->next_free - (char *) __o1->chunk \ > __o1->chunk_limit - (char *) __o1->chunk) \ __o1->next_free = __o1->chunk_limit; \ __o1->object_base = __o1->next_free; \ __value; }) # define obstack_free(OBSTACK, OBJ) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ void *__obj = (OBJ); \ if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \ __o->next_free = __o->object_base = (char *) __obj; \ else (__obstack_free) (__o, __obj); }) #else /* not __GNUC__ */ # define obstack_object_size(h) \ (unsigned) ((h)->next_free - (h)->object_base) # define obstack_room(h) \ (unsigned) ((h)->chunk_limit - (h)->next_free) # define obstack_empty_p(h) \ ((h)->chunk->prev == 0 \ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ (h)->chunk->contents, \ (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions in the arms of the conditional expression. Casting the third operand to void was tried before, but some compilers won't accept it. */ # define obstack_make_room(h, length) \ ((h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0)) # define obstack_grow(h, where, length) \ ((h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint) # define obstack_grow0(h, where, length) \ ((h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint, \ *((h)->next_free)++ = 0) # define obstack_1grow(h, datum) \ ((((h)->next_free + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), 1), 0) : 0), \ obstack_1grow_fast (h, datum)) # define obstack_ptr_grow(h, datum) \ ((((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ obstack_ptr_grow_fast (h, datum)) # define obstack_int_grow(h, datum) \ ((((h)->next_free + sizeof (int) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ obstack_int_grow_fast (h, datum)) # define obstack_ptr_grow_fast(h, aptr) \ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) # define obstack_int_grow_fast(h, aint) \ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) # define obstack_blank(h, length) \ ((h)->temp.tempint = (length), \ (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ obstack_blank_fast (h, (h)->temp.tempint)) # define obstack_alloc(h, length) \ (obstack_blank ((h), (length)), obstack_finish ((h))) # define obstack_copy(h, where, length) \ (obstack_grow ((h), (where), (length)), obstack_finish ((h))) # define obstack_copy0(h, where, length) \ (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) # define obstack_finish(h) \ (((h)->next_free == (h)->object_base \ ? (((h)->maybe_empty_object = 1), 0) \ : 0), \ (h)->temp.tempptr = (h)->object_base, \ (h)->next_free \ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ (h)->alignment_mask), \ (((h)->next_free - (char *) (h)->chunk \ > (h)->chunk_limit - (char *) (h)->chunk) \ ? ((h)->next_free = (h)->chunk_limit) : 0), \ (h)->object_base = (h)->next_free, \ (h)->temp.tempptr) # define obstack_free(h, obj) \ ((h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \ ((((h)->temp.tempint > 0 \ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ ? (void) ((h)->next_free = (h)->object_base \ = (h)->temp.tempint + (char *) (h)->chunk) \ : (__obstack_free) (h, (h)->temp.tempint + (char *) (h)->chunk))) #endif /* not __GNUC__ */ #ifdef __cplusplus } /* C++ */ #endif #endif /* obstack.h */ paths.h 0000644 00000005641 15063602066 0006046 0 ustar 00 /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)paths.h 8.1 (Berkeley) 6/2/93 */ #ifndef _PATHS_H_ #define _PATHS_H_ /* Default search path. */ #define _PATH_DEFPATH "/usr/bin:/bin" /* All standard utilities path. */ #define _PATH_STDPATH \ "/usr/bin:/bin:/usr/sbin:/sbin" #define _PATH_BSHELL "/bin/sh" #define _PATH_CONSOLE "/dev/console" #define _PATH_CSHELL "/bin/csh" #define _PATH_DEVDB "/var/run/dev.db" #define _PATH_DEVNULL "/dev/null" #define _PATH_DRUM "/dev/drum" #define _PATH_GSHADOW "/etc/gshadow" #define _PATH_KLOG "/proc/kmsg" #define _PATH_KMEM "/dev/kmem" #define _PATH_LASTLOG "/var/log/lastlog" #define _PATH_MAILDIR "/var/mail" #define _PATH_MAN "/usr/share/man" #define _PATH_MEM "/dev/mem" #define _PATH_MNTTAB "/etc/fstab" #define _PATH_MOUNTED "/etc/mtab" #define _PATH_NOLOGIN "/etc/nologin" #define _PATH_PRESERVE "/var/lib" #define _PATH_RWHODIR "/var/spool/rwho" #define _PATH_SENDMAIL "/usr/sbin/sendmail" #define _PATH_SHADOW "/etc/shadow" #define _PATH_SHELLS "/etc/shells" #define _PATH_TTY "/dev/tty" #define _PATH_UNIX "/boot/vmlinux" #define _PATH_UTMP "/var/run/utmp" #define _PATH_VI "/usr/bin/vi" #define _PATH_WTMP "/var/log/wtmp" /* Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" #define _PATH_TMP "/tmp/" #define _PATH_VARDB "/var/db/" #define _PATH_VARRUN "/var/run/" #define _PATH_VARTMP "/var/tmp/" #endif /* !_PATHS_H_ */ poll.h 0000644 00000000026 15063602066 0005665 0 ustar 00 #include <sys/poll.h> re_comp.h 0000644 00000001702 15063602066 0006345 0 ustar 00 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _RE_COMP_H #define _RE_COMP_H 1 /* This is only a wrapper around the <regex.h> file. XPG4.2 mentions this name. */ #include <regex.h> #endif /* re_comp.h */ pcre2posix.h 0000644 00000013254 15063602066 0007024 0 ustar 00 /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ /* PCRE2 is a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel Original API code Copyright (c) 1997-2012 University of Cambridge New API code Copyright (c) 2016 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ /* Have to include stdlib.h in order to ensure that size_t is defined. */ #include <stdlib.h> /* Allow for C++ users */ #ifdef __cplusplus extern "C" { #endif /* Options, mostly defined by POSIX, but with some extras. */ #define REG_ICASE 0x0001 /* Maps to PCRE2_CASELESS */ #define REG_NEWLINE 0x0002 /* Maps to PCRE2_MULTILINE */ #define REG_NOTBOL 0x0004 /* Maps to PCRE2_NOTBOL */ #define REG_NOTEOL 0x0008 /* Maps to PCRE2_NOTEOL */ #define REG_DOTALL 0x0010 /* NOT defined by POSIX; maps to PCRE2_DOTALL */ #define REG_NOSUB 0x0020 /* Do not report what was matched */ #define REG_UTF 0x0040 /* NOT defined by POSIX; maps to PCRE2_UTF */ #define REG_STARTEND 0x0080 /* BSD feature: pass subject string by so,eo */ #define REG_NOTEMPTY 0x0100 /* NOT defined by POSIX; maps to PCRE2_NOTEMPTY */ #define REG_UNGREEDY 0x0200 /* NOT defined by POSIX; maps to PCRE2_UNGREEDY */ #define REG_UCP 0x0400 /* NOT defined by POSIX; maps to PCRE2_UCP */ #define REG_PEND 0x0800 /* GNU feature: pass end pattern by re_endp */ #define REG_NOSPEC 0x1000 /* Maps to PCRE2_LITERAL */ /* This is not used by PCRE2, but by defining it we make it easier to slot PCRE2 into existing programs that make POSIX calls. */ #define REG_EXTENDED 0 /* Error values. Not all these are relevant or used by the wrapper. */ enum { REG_ASSERT = 1, /* internal error ? */ REG_BADBR, /* invalid repeat counts in {} */ REG_BADPAT, /* pattern error */ REG_BADRPT, /* ? * + invalid */ REG_EBRACE, /* unbalanced {} */ REG_EBRACK, /* unbalanced [] */ REG_ECOLLATE, /* collation error - not relevant */ REG_ECTYPE, /* bad class */ REG_EESCAPE, /* bad escape sequence */ REG_EMPTY, /* empty expression */ REG_EPAREN, /* unbalanced () */ REG_ERANGE, /* bad range inside [] */ REG_ESIZE, /* expression too big */ REG_ESPACE, /* failed to get memory */ REG_ESUBREG, /* bad back reference */ REG_INVARG, /* bad argument */ REG_NOMATCH /* match failed */ }; /* The structure representing a compiled regular expression. It is also used for passing the pattern end pointer when REG_PEND is set. */ typedef struct { void *re_pcre2_code; void *re_match_data; const char *re_endp; size_t re_nsub; size_t re_erroffset; int re_cflags; } regex_t; /* The structure in which a captured offset is returned. */ typedef int regoff_t; typedef struct { regoff_t rm_so; regoff_t rm_eo; } regmatch_t; /* When an application links to a PCRE2 DLL in Windows, the symbols that are imported have to be identified as such. When building PCRE2, the appropriate export settings are needed, and are set in pcre2posix.c before including this file. */ #if defined(_WIN32) && !defined(PCRE2_STATIC) && !defined(PCRE2POSIX_EXP_DECL) # define PCRE2POSIX_EXP_DECL extern __declspec(dllimport) # define PCRE2POSIX_EXP_DEFN __declspec(dllimport) #endif /* By default, we use the standard "extern" declarations. */ #ifndef PCRE2POSIX_EXP_DECL # ifdef __cplusplus # define PCRE2POSIX_EXP_DECL extern "C" # define PCRE2POSIX_EXP_DEFN extern "C" # else # define PCRE2POSIX_EXP_DECL extern # define PCRE2POSIX_EXP_DEFN extern # endif #endif /* The functions */ PCRE2POSIX_EXP_DECL int regcomp(regex_t *, const char *, int); PCRE2POSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t, regmatch_t *, int); PCRE2POSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t); PCRE2POSIX_EXP_DECL void regfree(regex_t *); #ifdef __cplusplus } /* extern "C" */ #endif /* End of pcre2posix.h */ zstd_errors.h 0000644 00000007247 15063602066 0007313 0 ustar 00 /* * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. */ #ifndef ZSTD_ERRORS_H_398273423 #define ZSTD_ERRORS_H_398273423 #if defined (__cplusplus) extern "C" { #endif /*===== dependency =====*/ #include <stddef.h> /* size_t */ /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */ #ifndef ZSTDERRORLIB_VISIBILITY # if defined(__GNUC__) && (__GNUC__ >= 4) # define ZSTDERRORLIB_VISIBILITY __attribute__ ((visibility ("default"))) # else # define ZSTDERRORLIB_VISIBILITY # endif #endif #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) # define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBILITY #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) # define ZSTDERRORLIB_API __declspec(dllimport) ZSTDERRORLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ #else # define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY #endif /*-********************************************* * Error codes list *-********************************************* * Error codes _values_ are pinned down since v1.3.1 only. * Therefore, don't rely on values if you may link to any version < v1.3.1. * * Only values < 100 are considered stable. * * note 1 : this API shall be used with static linking only. * dynamic linking is not yet officially supported. * note 2 : Prefer relying on the enum than on its value whenever possible * This is the only supported way to use the error list < v1.3.1 * note 3 : ZSTD_isError() is always correct, whatever the library version. **********************************************/ typedef enum { ZSTD_error_no_error = 0, ZSTD_error_GENERIC = 1, ZSTD_error_prefix_unknown = 10, ZSTD_error_version_unsupported = 12, ZSTD_error_frameParameter_unsupported = 14, ZSTD_error_frameParameter_windowTooLarge = 16, ZSTD_error_corruption_detected = 20, ZSTD_error_checksum_wrong = 22, ZSTD_error_dictionary_corrupted = 30, ZSTD_error_dictionary_wrong = 32, ZSTD_error_dictionaryCreation_failed = 34, ZSTD_error_parameter_unsupported = 40, ZSTD_error_parameter_outOfBound = 42, ZSTD_error_tableLog_tooLarge = 44, ZSTD_error_maxSymbolValue_tooLarge = 46, ZSTD_error_maxSymbolValue_tooSmall = 48, ZSTD_error_stage_wrong = 60, ZSTD_error_init_missing = 62, ZSTD_error_memory_allocation = 64, ZSTD_error_workSpace_tooSmall= 66, ZSTD_error_dstSize_tooSmall = 70, ZSTD_error_srcSize_wrong = 72, ZSTD_error_dstBuffer_null = 74, /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */ ZSTD_error_frameIndex_tooLarge = 100, ZSTD_error_seekableIO = 102, ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */ } ZSTD_ErrorCode; /*! ZSTD_getErrorCode() : convert a `size_t` function result into a `ZSTD_ErrorCode` enum type, which can be used to compare with enum list published above */ ZSTDERRORLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult); ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); /**< Same as ZSTD_getErrorName, but using a `ZSTD_ErrorCode` enum argument */ #if defined (__cplusplus) } #endif #endif /* ZSTD_ERRORS_H_398273423 */ krb5/ccselect_plugin.h 0000644 00000010165 15063602066 0010732 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Declarations for credential cache selection module implementors. * * The ccselect pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * Credential cache selection modules should define a function named * ccselect_<modulename>_initvt, matching the signature: * * krb5_error_code * ccselect_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_ccselect_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_CCSELECT_PLUGIN_H #define KRB5_CCSELECT_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* An abstract type for credential cache selection module data. */ typedef struct krb5_ccselect_moddata_st *krb5_ccselect_moddata; #define KRB5_CCSELECT_PRIORITY_AUTHORITATIVE 2 #define KRB5_CCSELECT_PRIORITY_HEURISTIC 1 /*** Method type declarations ***/ /* * Mandatory: Initialize module data and set *priority_out to one of the * KRB5_CCSELECT_PRIORITY constants above. Authoritative modules will be * consulted before heuristic ones. */ typedef krb5_error_code (*krb5_ccselect_init_fn)(krb5_context context, krb5_ccselect_moddata *data_out, int *priority_out); /* * Mandatory: Select a cache based on a server principal. Return 0 on success, * with *cache_out set to the selected cache and *princ_out set to its default * principal. Return KRB5_PLUGIN_NO_HANDLE to defer to other modules. Return * KRB5_CC_NOTFOUND with *princ_out set if the client principal can be * authoritatively determined but no cache exists for it. Return other errors * as appropriate. */ typedef krb5_error_code (*krb5_ccselect_choose_fn)(krb5_context context, krb5_ccselect_moddata data, krb5_principal server, krb5_ccache *cache_out, krb5_principal *princ_out); /* Optional: Release resources used by module data. */ typedef void (*krb5_ccselect_fini_fn)(krb5_context context, krb5_ccselect_moddata data); /*** vtable declarations **/ /* Credential cache selection plugin vtable for major version 1. */ typedef struct krb5_ccselect_vtable_st { const char *name; /* Mandatory: name of module. */ krb5_ccselect_init_fn init; krb5_ccselect_choose_fn choose; krb5_ccselect_fini_fn fini; /* Minor version 1 ends here. */ } *krb5_ccselect_vtable; #endif /* KRB5_CCSELECT_PLUGIN_H */ krb5/certauth_plugin.h 0000644 00000011771 15063602066 0010770 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* include/krb5/certauth_plugin.h - certauth plugin header. */ /* * Copyright (C) 2017 by Red Hat, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for certauth plugin module implementors. * * The certauth pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * certauth plugin modules should define a function named * certauth_<modulename>_initvt, matching the signature: * * krb5_error_code * certauth_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_certauth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_CERTAUTH_PLUGIN_H #define KRB5_CERTAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* Abstract module data type. */ typedef struct krb5_certauth_moddata_st *krb5_certauth_moddata; /* A module can optionally include <kdb.h> to inspect the client principal * entry when authorizing a request. */ struct _krb5_db_entry_new; /* * Optional: Initialize module data. */ typedef krb5_error_code (*krb5_certauth_init_fn)(krb5_context context, krb5_certauth_moddata *moddata_out); /* * Optional: Clean up the module data. */ typedef void (*krb5_certauth_fini_fn)(krb5_context context, krb5_certauth_moddata moddata); /* * Mandatory: return 0 or KRB5_CERTAUTH_HWAUTH if the DER-encoded cert is * authorized for PKINIT authentication by princ; otherwise return one of the * following error codes: * - KRB5KDC_ERR_CLIENT_NAME_MISMATCH - incorrect SAN value * - KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE - incorrect EKU * - KRB5KDC_ERR_CERTIFICATE_MISMATCH - other extension error * - KRB5_PLUGIN_NO_HANDLE - the module has no opinion about cert * * Returning KRB5_CERTAUTH_HWAUTH will cause the hw-authent flag to be set in * the issued ticket (new in release 1.19). * * - opts is used by built-in modules to receive internal data, and must be * ignored by other modules. * - db_entry receives the client principal database entry, and can be ignored * by modules that do not link with libkdb5. * - *authinds_out optionally returns a null-terminated list of authentication * indicator strings upon KRB5_PLUGIN_NO_HANDLE or accepted authorization. */ typedef krb5_error_code (*krb5_certauth_authorize_fn)(krb5_context context, krb5_certauth_moddata moddata, const uint8_t *cert, size_t cert_len, krb5_const_principal princ, const void *opts, const struct _krb5_db_entry_new *db_entry, char ***authinds_out); /* * Free indicators allocated by a module. Mandatory if authorize returns * authentication indicators. */ typedef void (*krb5_certauth_free_indicator_fn)(krb5_context context, krb5_certauth_moddata moddata, char **authinds); typedef struct krb5_certauth_vtable_st { const char *name; krb5_certauth_init_fn init; krb5_certauth_fini_fn fini; krb5_certauth_authorize_fn authorize; krb5_certauth_free_indicator_fn free_ind; } *krb5_certauth_vtable; #endif /* KRB5_CERTAUTH_PLUGIN_H */ krb5/clpreauth_plugin.h 0000644 00000036243 15063602066 0011141 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (c) 2006 Red Hat, Inc. * Portions copyright (c) 2006, 2011 Massachusetts Institute of Technology * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Red Hat, Inc., nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for clpreauth plugin module implementors. * * The clpreauth interface has a single supported major version, which is * 1. Major version 1 has a current minor version of 2. clpreauth modules * should define a function named clpreauth_<modulename>_initvt, matching * the signature: * * krb5_error_code * clpreauth_modname_initvt(krb5_context context, int maj_ver, * int min_ver, krb5_plugin_vtable vtable); * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for the interface and maj_ver: * maj_ver == 1: Cast to krb5_clpreauth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_CLPREAUTH_PLUGIN_H #define KRB5_CLPREAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* clpreauth mechanism property flags */ /* Provides a real answer which we can send back to the KDC. The client * assumes that one real answer will be enough. */ #define PA_REAL 0x00000001 /* Doesn't provide a real answer, but must be given a chance to run before any * REAL mechanism callbacks. */ #define PA_INFO 0x00000002 /* Abstract type for a client request information handle. */ typedef struct krb5_clpreauth_rock_st *krb5_clpreauth_rock; /* Abstract types for module data and per-request module data. */ typedef struct krb5_clpreauth_moddata_st *krb5_clpreauth_moddata; typedef struct krb5_clpreauth_modreq_st *krb5_clpreauth_modreq; /* Before using a callback after version 1, modules must check the vers * field of the callback structure. */ typedef struct krb5_clpreauth_callbacks_st { int vers; /* * If an AS-REP has been received, return the enctype of the AS-REP * encrypted part. Otherwise return the enctype chosen from etype-info, or * the first requested enctype if no etype-info was received. */ krb5_enctype (*get_etype)(krb5_context context, krb5_clpreauth_rock rock); /* Get a pointer to the FAST armor key, or NULL if the client is not using * FAST. The returned pointer is an alias and should not be freed. */ krb5_keyblock *(*fast_armor)(krb5_context context, krb5_clpreauth_rock rock); /* * Get a pointer to the client-supplied reply key, possibly invoking the * prompter to ask for a password if this has not already been done. The * returned pointer is an alias and should not be freed. */ krb5_error_code (*get_as_key)(krb5_context context, krb5_clpreauth_rock rock, krb5_keyblock **keyblock); /* Replace the reply key to be used to decrypt the AS response. */ krb5_error_code (*set_as_key)(krb5_context context, krb5_clpreauth_rock rock, const krb5_keyblock *keyblock); /* End of version 1 clpreauth callbacks. */ /* * Get the current time for use in a preauth response. If * allow_unauth_time is true and the library has been configured to allow * it, the current time will be offset using unauthenticated timestamp * information received from the KDC in the preauth-required error, if one * has been received. Otherwise, the timestamp in a preauth-required error * will only be used if it is protected by a FAST channel. Only set * allow_unauth_time if using an unauthenticated time offset would not * create a security issue. */ krb5_error_code (*get_preauth_time)(krb5_context context, krb5_clpreauth_rock rock, krb5_boolean allow_unauth_time, krb5_timestamp *time_out, krb5_int32 *usec_out); /* Set a question to be answered by the responder and optionally provide * a challenge. */ krb5_error_code (*ask_responder_question)(krb5_context context, krb5_clpreauth_rock rock, const char *question, const char *challenge); /* Get an answer from the responder, or NULL if the question was * unanswered. */ const char *(*get_responder_answer)(krb5_context context, krb5_clpreauth_rock rock, const char *question); /* Indicate interest in the AS key through the responder interface. */ void (*need_as_key)(krb5_context context, krb5_clpreauth_rock rock); /* * Get a configuration/state item from an input ccache, which may allow it * to retrace the steps it took last time. The returned data string is an * alias and should not be freed. */ const char *(*get_cc_config)(krb5_context context, krb5_clpreauth_rock rock, const char *key); /* * Set a configuration/state item which will be recorded to an output * ccache, if the calling application supplied one. Both key and data * should be valid UTF-8 text. */ krb5_error_code (*set_cc_config)(krb5_context context, krb5_clpreauth_rock rock, const char *key, const char *data); /* End of version 2 clpreauth callbacks (added in 1.11). */ /* * Prevent further fallbacks to other preauth mechanisms if the KDC replies * with an error. (The module itself can still respond to errors with its * tryagain method, or continue after KDC_ERR_MORE_PREAUTH_DATA_REQUIRED * errors with its process method.) A module should invoke this callback * from the process method when it generates an authenticated request using * credentials; often this will be the first or only client message * generated by the mechanism. */ void (*disable_fallback)(krb5_context context, krb5_clpreauth_rock rock); /* End of version 3 clpreauth callbacks (added in 1.17). */ } *krb5_clpreauth_callbacks; /* * Optional: per-plugin initialization/cleanup. The init function is called by * libkrb5 when the plugin is loaded, and the fini function is called before * the plugin is unloaded. These may be called multiple times in case the * plugin is used in multiple contexts. The returned context lives the * lifetime of the krb5_context. */ typedef krb5_error_code (*krb5_clpreauth_init_fn)(krb5_context context, krb5_clpreauth_moddata *moddata_out); typedef void (*krb5_clpreauth_fini_fn)(krb5_context context, krb5_clpreauth_moddata moddata); /* * Optional (mandatory before MIT krb5 1.12): pa_type will be a member of the * vtable's pa_type_list. Return PA_REAL if pa_type is a real * preauthentication type or PA_INFO if it is an informational type. If this * function is not defined in 1.12 or later, all pa_type values advertised by * the module will be assumed to be real. */ typedef int (*krb5_clpreauth_get_flags_fn)(krb5_context context, krb5_preauthtype pa_type); /* * Optional: per-request initialization/cleanup. The request_init function is * called when beginning to process a get_init_creds request and the * request_fini function is called when processing of the request is complete. * This is optional. It may be called multiple times in the lifetime of a * krb5_context. */ typedef void (*krb5_clpreauth_request_init_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq *modreq_out); typedef void (*krb5_clpreauth_request_fini_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq); /* * Optional: process server-supplied data in pa_data and set responder * questions. * * encoded_previous_request may be NULL if there has been no previous request * in the AS exchange. */ typedef krb5_error_code (*krb5_clpreauth_prep_questions_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq, krb5_get_init_creds_opt *opt, krb5_clpreauth_callbacks cb, krb5_clpreauth_rock rock, krb5_kdc_req *request, krb5_data *encoded_request_body, krb5_data *encoded_previous_request, krb5_pa_data *pa_data); /* * Mandatory: process server-supplied data in pa_data and return created data * in pa_data_out. Also called after the AS-REP is received if the AS-REP * includes preauthentication data of the associated type. * * as_key contains the client-supplied key if known, or an empty keyblock if * not. If it is empty, the module may use gak_fct to fill it in. * * encoded_previous_request may be NULL if there has been no previous request * in the AS exchange. */ typedef krb5_error_code (*krb5_clpreauth_process_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq, krb5_get_init_creds_opt *opt, krb5_clpreauth_callbacks cb, krb5_clpreauth_rock rock, krb5_kdc_req *request, krb5_data *encoded_request_body, krb5_data *encoded_previous_request, krb5_pa_data *pa_data, krb5_prompter_fct prompter, void *prompter_data, krb5_pa_data ***pa_data_out); /* * Optional: Attempt to use error and error_padata to try to recover from the * given error. To work with both FAST and non-FAST errors, an implementation * should generally consult error_padata rather than decoding error->e_data. * For non-FAST errors, it contains the e_data decoded as either pa-data or * typed-data. * * If this function is provided, and it returns 0 and stores data in * pa_data_out, then the client library will retransmit the request. */ typedef krb5_error_code (*krb5_clpreauth_tryagain_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_clpreauth_modreq modreq, krb5_get_init_creds_opt *opt, krb5_clpreauth_callbacks cb, krb5_clpreauth_rock rock, krb5_kdc_req *request, krb5_data *encoded_request_body, krb5_data *encoded_previous_request, krb5_preauthtype pa_type, krb5_error *error, krb5_pa_data **error_padata, krb5_prompter_fct prompter, void *prompter_data, krb5_pa_data ***pa_data_out); /* * Optional: receive krb5_get_init_creds_opt information. The attr and value * information supplied should be copied into moddata by the module if it * wishes to reference it after returning from this call. */ typedef krb5_error_code (*krb5_clpreauth_supply_gic_opts_fn)(krb5_context context, krb5_clpreauth_moddata moddata, krb5_get_init_creds_opt *opt, const char *attr, const char *value); typedef struct krb5_clpreauth_vtable_st { /* Mandatory: name of module. */ char *name; /* Mandatory: pointer to zero-terminated list of pa_types which this module * can provide services for. */ krb5_preauthtype *pa_type_list; /* Optional: pointer to zero-terminated list of enc_types which this module * claims to add support for. */ krb5_enctype *enctype_list; krb5_clpreauth_init_fn init; krb5_clpreauth_fini_fn fini; krb5_clpreauth_get_flags_fn flags; krb5_clpreauth_request_init_fn request_init; krb5_clpreauth_request_fini_fn request_fini; krb5_clpreauth_process_fn process; krb5_clpreauth_tryagain_fn tryagain; krb5_clpreauth_supply_gic_opts_fn gic_opts; /* Minor version 1 ends here. */ krb5_clpreauth_prep_questions_fn prep_questions; /* Minor version 2 ends here. */ } *krb5_clpreauth_vtable; /* * This function allows a clpreauth plugin to obtain preauth options. The * preauth_data returned from this function should be freed by calling * krb5_get_init_creds_opt_free_pa(). */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_get_pa(krb5_context context, krb5_get_init_creds_opt *opt, int *num_preauth_data, krb5_gic_opt_pa_data **preauth_data); /* * This function frees the preauth_data that was returned by * krb5_get_init_creds_opt_get_pa(). */ void KRB5_CALLCONV krb5_get_init_creds_opt_free_pa(krb5_context context, int num_preauth_data, krb5_gic_opt_pa_data *preauth_data); #endif /* KRB5_CLPREAUTH_PLUGIN_H */ krb5/hostrealm_plugin.h 0000644 00000012524 15063602066 0011144 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 by the Massachusetts Institute of Technology. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for hostrealm plugin module implementors. * * The hostrealm pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * Hostrealm plugin modules should define a function named * hostrealm_<modulename>_initvt, matching the signature: * * krb5_error_code * hostrealm_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_hostrealm_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_HOSTREALM_PLUGIN_H #define KRB5_HOSTREALM_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* An abstract type for hostrealm module data. */ typedef struct krb5_hostrealm_moddata_st *krb5_hostrealm_moddata; /*** Method type declarations ***/ /* Optional: Initialize module data. */ typedef krb5_error_code (*krb5_hostrealm_init_fn)(krb5_context context, krb5_hostrealm_moddata *data); /* * Optional: Determine the possible realms of a hostname, using only secure, * authoritative mechanisms (ones which should be used prior to trying * referrals when getting a service ticket). Return success with a * null-terminated list of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to * defer to later modules, or another error to terminate processing. */ typedef krb5_error_code (*krb5_hostrealm_host_realm_fn)(krb5_context context, krb5_hostrealm_moddata data, const char *host, char ***realms_out); /* * Optional: Determine the possible realms of a hostname, using heuristic or * less secure mechanisms (ones which should be used after trying referrals * when getting a service ticket). Return success with a null-terminated list * of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to defer to later modules, * or another error to terminate processing. */ typedef krb5_error_code (*krb5_hostrealm_fallback_realm_fn)(krb5_context context, krb5_hostrealm_moddata data, const char *host, char ***realms_out); /* * Optional: Determine the possible default realms of the local host. Return * success with a null-terminated list of realms in *realms_out, * KRB5_PLUGIN_NO_HANDLE to defer to later modules, or another error to * terminate processing. */ typedef krb5_error_code (*krb5_hostrealm_default_realm_fn)(krb5_context context, krb5_hostrealm_moddata data, char ***realms_out); /* * Mandatory (if any of the query methods are implemented): Release the memory * returned by one of the interface methods. */ typedef void (*krb5_hostrealm_free_list_fn)(krb5_context context, krb5_hostrealm_moddata data, char **list); /* Optional: Release resources used by module data. */ typedef void (*krb5_hostrealm_fini_fn)(krb5_context context, krb5_hostrealm_moddata data); /* hostrealm vtable for major version 1. */ typedef struct krb5_hostrealm_vtable_st { const char *name; /* Mandatory: name of module. */ krb5_hostrealm_init_fn init; krb5_hostrealm_fini_fn fini; krb5_hostrealm_host_realm_fn host_realm; krb5_hostrealm_fallback_realm_fn fallback_realm; krb5_hostrealm_default_realm_fn default_realm; krb5_hostrealm_free_list_fn free_list; /* Minor version 1 ends here. */ } *krb5_hostrealm_vtable; #endif /* KRB5_HOSTREALM_PLUGIN_H */ krb5/kadm5_auth_plugin.h 0000644 00000030302 15063602066 0011162 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2017 by the Massachusetts Institute of Technology. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for kadm5_auth plugin module implementors. * * The kadm5_auth pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * kadm5_auth plugin modules should define a function named * kadm5_auth_<modulename>_initvt, matching the signature: * * krb5_error_code * kadm5_auth_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_kadm5_auth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_KADM5_AUTH_PLUGIN_H #define KRB5_KADM5_AUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* An abstract type for kadm5_auth module data. */ typedef struct kadm5_auth_moddata_st *kadm5_auth_moddata; /* * A module can optionally include <kadm5/admin.h> to inspect principal or * policy records from requests that add or modify principals or policies. * Note that fields of principal and policy structures are only valid if the * corresponding bit is set in the accompanying mask parameter. */ struct _kadm5_principal_ent_t; struct _kadm5_policy_ent_t; /* * A module can optionally generate restrictions when checking permissions for * adding or modifying a principal entry. Restriction fields will only be * honored if the corresponding mask bit is set. The operable mask bits are * defined in <kadmin/admin.h> and are: * * - KADM5_ATTRIBUTES for require_attrs, forbid_attrs * - KADM5_POLICY for policy * - KADM5_POLICY_CLR to require that policy be unset * - KADM5_PRINC_EXPIRE_TIME for princ_lifetime * - KADM5_PW_EXPIRATION for pw_lifetime * - KADM5_MAX_LIFE for max_life * - KADM5_MAX_RLIFE for max_renewable_life */ struct kadm5_auth_restrictions { long mask; krb5_flags require_attrs; krb5_flags forbid_attrs; krb5_deltat princ_lifetime; krb5_deltat pw_lifetime; krb5_deltat max_life; krb5_deltat max_renewable_life; char *policy; }; /*** Method type declarations ***/ /* * Optional: Initialize module data. acl_file is the realm's configured ACL * file, or NULL if none was configured. Return 0 on success, * KRB5_PLUGIN_NO_HANDLE if the module is inoperable (due to configuration, for * example), and any other error code to abort kadmind startup. Optionally set * *data_out to a module data object to be passed to future calls. */ typedef krb5_error_code (*kadm5_auth_init_fn)(krb5_context context, const char *acl_file, kadm5_auth_moddata *data_out); /* Optional: Release resources used by module data. */ typedef void (*kadm5_auth_fini_fn)(krb5_context context, kadm5_auth_moddata data); /* * Each check method below should return 0 to explicitly authorize the request, * KRB5_PLUGIN_NO_HANDLE to neither authorize nor deny the request, and any * other error code (such as EPERM) to explicitly deny the request. If a check * method is not defined, the module will neither authorize nor deny the * request. A request succeeds if at least one kadm5_auth module explicitly * authorizes the request and none of the modules explicitly deny it. */ /* Optional: authorize an add-principal operation, and optionally generate * restrictions. */ typedef krb5_error_code (*kadm5_auth_addprinc_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target, const struct _kadm5_principal_ent_t *ent, long mask, struct kadm5_auth_restrictions **rs_out); /* Optional: authorize a modify-principal operation, and optionally generate * restrictions. */ typedef krb5_error_code (*kadm5_auth_modprinc_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target, const struct _kadm5_principal_ent_t *ent, long mask, struct kadm5_auth_restrictions **rs_out); /* Optional: authorize a set-string operation. */ typedef krb5_error_code (*kadm5_auth_setstr_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target, const char *key, const char *value); /* Optional: authorize a change-password operation. */ typedef krb5_error_code (*kadm5_auth_cpw_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize a randomize-keys operation. */ typedef krb5_error_code (*kadm5_auth_chrand_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize a set-key operation. */ typedef krb5_error_code (*kadm5_auth_setkey_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize a purgekeys operation. */ typedef krb5_error_code (*kadm5_auth_purgekeys_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize a delete-principal operation. */ typedef krb5_error_code (*kadm5_auth_delprinc_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize a rename-principal operation. */ typedef krb5_error_code (*kadm5_auth_renprinc_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal src, krb5_const_principal dest); /* Optional: authorize a get-principal operation. */ typedef krb5_error_code (*kadm5_auth_getprinc_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize a get-strings operation. */ typedef krb5_error_code (*kadm5_auth_getstrs_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize an extract-keys operation. */ typedef krb5_error_code (*kadm5_auth_extract_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, krb5_const_principal target); /* Optional: authorize a list-principals operation. */ typedef krb5_error_code (*kadm5_auth_listprincs_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client); /* Optional: authorize an add-policy operation. */ typedef krb5_error_code (*kadm5_auth_addpol_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, const char *policy, const struct _kadm5_policy_ent_t *ent, long mask); /* Optional: authorize a modify-policy operation. */ typedef krb5_error_code (*kadm5_auth_modpol_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, const char *policy, const struct _kadm5_policy_ent_t *ent, long mask); /* Optional: authorize a delete-policy operation. */ typedef krb5_error_code (*kadm5_auth_delpol_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, const char *policy); /* Optional: authorize a get-policy operation. client_policy is the client * principal's policy name, or NULL if it does not have one. */ typedef krb5_error_code (*kadm5_auth_getpol_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client, const char *policy, const char *client_policy); /* Optional: authorize a list-policies operation. */ typedef krb5_error_code (*kadm5_auth_listpols_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client); /* Optional: authorize an iprop operation. */ typedef krb5_error_code (*kadm5_auth_iprop_fn)(krb5_context context, kadm5_auth_moddata data, krb5_const_principal client); /* * Optional: receive a notification that the most recent authorized operation * has ended. If a kadm5_auth module is also a KDB module, it can assume that * all KDB methods invoked between a kadm5_auth authorization method invocation * and a kadm5_auth end invocation are performed as part of the authorized * operation. * * The end method may be invoked without a preceding authorization method in * some cases; the module must be prepared to ignore such calls. */ typedef void (*kadm5_auth_end_fn)(krb5_context context, kadm5_auth_moddata data); /* * Optional: free a restrictions object. This method does not need to be * defined if the module does not generate restrictions objects, or if it * returns aliases to restrictions objects contained from within the module * data. */ typedef void (*kadm5_auth_free_restrictions_fn)(krb5_context context, kadm5_auth_moddata data, struct kadm5_auth_restrictions *rs); /* kadm5_auth vtable for major version 1. */ typedef struct kadm5_auth_vtable_st { const char *name; /* Mandatory: name of module. */ kadm5_auth_init_fn init; kadm5_auth_fini_fn fini; kadm5_auth_addprinc_fn addprinc; kadm5_auth_modprinc_fn modprinc; kadm5_auth_setstr_fn setstr; kadm5_auth_cpw_fn cpw; kadm5_auth_chrand_fn chrand; kadm5_auth_setkey_fn setkey; kadm5_auth_purgekeys_fn purgekeys; kadm5_auth_delprinc_fn delprinc; kadm5_auth_renprinc_fn renprinc; kadm5_auth_getprinc_fn getprinc; kadm5_auth_getstrs_fn getstrs; kadm5_auth_extract_fn extract; kadm5_auth_listprincs_fn listprincs; kadm5_auth_addpol_fn addpol; kadm5_auth_modpol_fn modpol; kadm5_auth_delpol_fn delpol; kadm5_auth_getpol_fn getpol; kadm5_auth_listpols_fn listpols; kadm5_auth_iprop_fn iprop; kadm5_auth_end_fn end; kadm5_auth_free_restrictions_fn free_restrictions; /* Minor version 1 ends here. */ } *kadm5_auth_vtable; #endif /* KRB5_KADM5_AUTH_PLUGIN_H */ krb5/kadm5_hook_plugin.h 0000644 00000014021 15063602066 0011161 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2010 by the Massachusetts Institute of Technology. * All rights reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ #ifndef H_KRB5_KADM5_HOOK_PLUGIN #define H_KRB5_KADM5_HOOK_PLUGIN /** * @file krb5/krb5_kadm5_hook_plugin.h * Provide a plugin interface for kadm5 operations. This interface * permits a plugin to intercept principal modification, creation and * change password operations. Operations run at two stages: a * precommit stage that runs before the operation is committed to the * database and a postcommit operation that runs after the database * is updated; see #kadm5_hook_stage for details on semantics. * * This interface is based on a proposed extension to Heimdal by Russ * Allbery; it is likely that Heimdal will adopt an approach based on * stacked kdb modules rather than this interface. For MIT, writing a * plugin to this interface is significantly easier than stacking kdb * modules. Also, the kadm5 interface is significantly more stable * than the kdb interface, so this approach is more desirable than * stacked kdb modules. * * This interface depends on kadm5/admin.h. As such, the interface * does not provide strong guarantees of ABI stability. * * The kadm5_hook interface currently has only one supported major version, * which is 1. Major version 1 has a current minor version number of 2. * * kadm5_hook plugins should: * kadm5_hook_<modulename>_initvt, matching the signature: * * krb5_error_code * kadm5_hook_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to kadm5_hook_vftable_1 * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #include <krb5/krb5.h> #include <krb5/plugin.h> #include <kadm5/admin.h> /** * Whether the operation is being run before or after the database * update. */ enum kadm5_hook_stage { /** In this stage, any plugin failure prevents following plugins from * running and aborts the operation.*/ KADM5_HOOK_STAGE_PRECOMMIT, /** In this stage, plugin failures are logged but otherwise ignored.*/ KADM5_HOOK_STAGE_POSTCOMMIT }; /** Opaque module data pointer. */ typedef struct kadm5_hook_modinfo_st kadm5_hook_modinfo; /** * Interface for the v1 virtual table for the kadm5_hook plugin. * All entry points are optional. The name field must be provided. */ typedef struct kadm5_hook_vtable_1_st { /** A text string identifying the plugin for logging messages. */ const char *name; /** Initialize a plugin module. * @param modinfo returns newly allocated module info for future * calls. Cleaned up by the fini() function. */ kadm5_ret_t (*init)(krb5_context, kadm5_hook_modinfo **modinfo); /** Clean up a module and free @a modinfo. */ void (*fini)(krb5_context, kadm5_hook_modinfo *modinfo); /** Indicates that the password is being changed. * @param stage is an integer from #kadm5_hook_stage enumeration * @param keepold is true if existing keys are being kept. * @param newpass is NULL if the key sare being randomized. */ kadm5_ret_t (*chpass)(krb5_context, kadm5_hook_modinfo *modinfo, int stage, krb5_principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, const char *newpass); /** Indicate a principal is created. */ kadm5_ret_t (*create)(krb5_context, kadm5_hook_modinfo *, int stage, kadm5_principal_ent_t, long mask, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, const char *password); /** Modify a principal. */ kadm5_ret_t (*modify)(krb5_context, kadm5_hook_modinfo *, int stage, kadm5_principal_ent_t, long mask); /** Indicate a principal is deleted. */ kadm5_ret_t (*remove)(krb5_context, kadm5_hook_modinfo *modinfo, int stage, krb5_principal); /* End of minor version 1. */ /** Indicate a principal is renamed. */ kadm5_ret_t (*rename)(krb5_context, kadm5_hook_modinfo *modinfo, int stage, krb5_principal, krb5_principal); /* End of minor version 2. */ } kadm5_hook_vftable_1; #endif /*H_KRB5_KADM5_HOOK_PLUGIN*/ krb5/kdcpolicy_plugin.h 0000644 00000012310 15063602066 0011120 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* include/krb5/kdcpolicy_plugin.h - KDC policy plugin interface */ /* * Copyright (C) 2017 by Red Hat, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for kdcpolicy plugin module implementors. * * The kdcpolicy pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * kdcpolicy plugin modules should define a function named * kdcpolicy_<modulename>_initvt, matching the signature: * * krb5_error_code * kdcpolicy_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_kdcpolicy_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_POLICY_PLUGIN_H #define KRB5_POLICY_PLUGIN_H #include <krb5/krb5.h> /* Abstract module datatype. */ typedef struct krb5_kdcpolicy_moddata_st *krb5_kdcpolicy_moddata; /* A module can optionally include kdb.h to inspect principal entries when * authorizing requests. */ struct _krb5_db_entry_new; /* * Optional: Initialize module data. Return 0 on success, * KRB5_PLUGIN_NO_HANDLE if the module is inoperable (due to configuration, for * example), and any other error code to abort KDC startup. Optionally set * *data_out to a module data object to be passed to future calls. */ typedef krb5_error_code (*krb5_kdcpolicy_init_fn)(krb5_context context, krb5_kdcpolicy_moddata *data_out); /* Optional: Clean up module data. */ typedef krb5_error_code (*krb5_kdcpolicy_fini_fn)(krb5_context context, krb5_kdcpolicy_moddata moddata); /* * Optional: return an error code and set status to an appropriate string * literal to deny an AS request; otherwise return 0. lifetime_out, if set, * restricts the ticket lifetime. renew_lifetime_out, if set, restricts the * ticket renewable lifetime. */ typedef krb5_error_code (*krb5_kdcpolicy_check_as_fn)(krb5_context context, krb5_kdcpolicy_moddata moddata, const krb5_kdc_req *request, const struct _krb5_db_entry_new *client, const struct _krb5_db_entry_new *server, const char *const *auth_indicators, const char **status, krb5_deltat *lifetime_out, krb5_deltat *renew_lifetime_out); /* * Optional: return an error code and set status to an appropriate string * literal to deny a TGS request; otherwise return 0. lifetime_out, if set, * restricts the ticket lifetime. renew_lifetime_out, if set, restricts the * ticket renewable lifetime. */ typedef krb5_error_code (*krb5_kdcpolicy_check_tgs_fn)(krb5_context context, krb5_kdcpolicy_moddata moddata, const krb5_kdc_req *request, const struct _krb5_db_entry_new *server, const krb5_ticket *ticket, const char *const *auth_indicators, const char **status, krb5_deltat *lifetime_out, krb5_deltat *renew_lifetime_out); typedef struct krb5_kdcpolicy_vtable_st { const char *name; krb5_kdcpolicy_init_fn init; krb5_kdcpolicy_fini_fn fini; krb5_kdcpolicy_check_as_fn check_as; krb5_kdcpolicy_check_tgs_fn check_tgs; } *krb5_kdcpolicy_vtable; #endif /* KRB5_POLICY_PLUGIN_H */ krb5/kdcpreauth_plugin.h 0000644 00000042172 15063602066 0011302 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (c) 2006 Red Hat, Inc. * Portions copyright (c) 2006, 2011 Massachusetts Institute of Technology * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Red Hat, Inc., nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for kdcpreauth plugin module implementors. * * The kdcpreauth interface has a single supported major version, which is 1. * Major version 1 has a current minor version of 2. kdcpreauth modules should * define a function named kdcpreauth_<modulename>_initvt, matching the * signature: * * krb5_error_code * kdcpreauth_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for the interface and maj_ver: * kdcpreauth, maj_ver == 1: Cast to krb5_kdcpreauth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_KDCPREAUTH_PLUGIN_H #define KRB5_KDCPREAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* kdcpreauth mechanism property flags */ /* * Causes the KDC to include this mechanism in a list of supported preauth * types if the user's DB entry flags the user as requiring hardware-based * preauthentication. */ #define PA_HARDWARE 0x00000004 /* * Causes the KDC to include this mechanism in a list of supported preauth * types if the user's DB entry flags the user as requiring preauthentication, * and to fail preauthentication if we can't verify the client data. The * flipside of PA_SUFFICIENT. */ #define PA_REQUIRED 0x00000008 /* * Causes the KDC to include this mechanism in a list of supported preauth * types if the user's DB entry flags the user as requiring preauthentication, * and to mark preauthentication as successful if we can verify the client * data. The flipside of PA_REQUIRED. */ #define PA_SUFFICIENT 0x00000010 /* * Marks this preauthentication mechanism as one which changes the key which is * used for encrypting the response to the client. Modules which have this * flag have their server_return_fn called before modules which do not, and are * passed over if a previously-called module has modified the encrypting key. */ #define PA_REPLACES_KEY 0x00000020 /* * Not really a padata type, so don't include it in any list of preauth types * which gets sent over the wire. */ #define PA_PSEUDO 0x00000080 /* * Indicates that e_data in non-FAST errors should be encoded as typed data * instead of padata. */ #define PA_TYPED_E_DATA 0x00000100 /* Abstract type for a KDC callback data handle. */ typedef struct krb5_kdcpreauth_rock_st *krb5_kdcpreauth_rock; /* Abstract type for module data and per-request module data. */ typedef struct krb5_kdcpreauth_moddata_st *krb5_kdcpreauth_moddata; typedef struct krb5_kdcpreauth_modreq_st *krb5_kdcpreauth_modreq; /* The verto context structure type (typedef is in verto.h; we want to avoid a * header dependency for the moment). */ struct verto_ctx; /* Before using a callback after version 1, modules must check the vers * field of the callback structure. */ typedef struct krb5_kdcpreauth_callbacks_st { int vers; krb5_deltat (*max_time_skew)(krb5_context context, krb5_kdcpreauth_rock rock); /* * Get an array of krb5_keyblock structures containing the client keys * matching the request enctypes, terminated by an entry with key type = 0. * Returns ENOENT if no keys are available for the request enctypes. Free * the resulting object with the free_keys callback. */ krb5_error_code (*client_keys)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_keyblock **keys_out); /* Free the result of client_keys. */ void (*free_keys)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_keyblock *keys); /* * Get the encoded request body, which is sometimes needed for checksums. * For a FAST request this is the encoded inner request body. The returned * pointer is an alias and should not be freed. */ krb5_data *(*request_body)(krb5_context context, krb5_kdcpreauth_rock rock); /* Get a pointer to the FAST armor key, or NULL if the request did not use * FAST. The returned pointer is an alias and should not be freed. */ krb5_keyblock *(*fast_armor)(krb5_context context, krb5_kdcpreauth_rock rock); /* Retrieve a string attribute from the client DB entry, or NULL if no such * attribute is set. Free the result with the free_string callback. */ krb5_error_code (*get_string)(krb5_context context, krb5_kdcpreauth_rock rock, const char *key, char **value_out); /* Free the result of get_string. */ void (*free_string)(krb5_context context, krb5_kdcpreauth_rock rock, char *string); /* Get a pointer to the client DB entry (returned as a void pointer to * avoid a dependency on a libkdb5 type). */ void *(*client_entry)(krb5_context context, krb5_kdcpreauth_rock rock); /* Get a pointer to the verto context which should be used by an * asynchronous edata or verify method. */ struct verto_ctx *(*event_context)(krb5_context context, krb5_kdcpreauth_rock rock); /* End of version 1 kdcpreauth callbacks. */ /* Return true if the client DB entry contains any keys matching the * request enctypes. */ krb5_boolean (*have_client_keys)(krb5_context context, krb5_kdcpreauth_rock rock); /* End of version 2 kdcpreauth callbacks. */ /* * Get the decrypted client long-term key chosen according to the request * enctype list, or NULL if no matching key was found. The returned * pointer is an alias and should not be freed. If invoked from * return_padata, the result will be the same as the encrypting_key * parameter if it is not NULL, and will therefore reflect the modified * reply key if a return_padata handler has replaced the reply key. */ const krb5_keyblock *(*client_keyblock)(krb5_context context, krb5_kdcpreauth_rock rock); /* Assert an authentication indicator in the AS-REP authdata. Duplicate * indicators will be ignored. */ krb5_error_code (*add_auth_indicator)(krb5_context context, krb5_kdcpreauth_rock rock, const char *indicator); /* * Read a data value for pa_type from the request cookie, placing it in * *out. The value placed there is an alias and must not be freed. * Returns true if a value for pa_type was retrieved, false if not. */ krb5_boolean (*get_cookie)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_preauthtype pa_type, krb5_data *out); /* * Set a data value for pa_type to be sent in a secure cookie in the next * error response. If pa_type is already present, the value is ignored. * If the preauth mechanism has different preauth types for requests and * responses, use the request type. Secure cookies are encrypted in a key * known only to the KDCs, but can be replayed within a short time window * for requests using the same client principal. */ krb5_error_code (*set_cookie)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_preauthtype pa_type, const krb5_data *data); /* End of version 3 kdcpreauth callbacks. */ /* * Return true if princ matches the principal named in the request or the * client principal (possibly canonicalized). If princ does not match, * attempt a database lookup of princ with aliases allowed and compare the * result to the client principal, returning true if it matches. * Otherwise, return false. */ krb5_boolean (*match_client)(krb5_context context, krb5_kdcpreauth_rock rock, krb5_principal princ); /* * Get an alias to the client DB entry principal (possibly canonicalized). */ krb5_principal (*client_name)(krb5_context context, krb5_kdcpreauth_rock rock); /* End of version 4 kdcpreauth callbacks. */ /* * Instruct the KDC to send a freshness token in the method data * accompanying a PREAUTH_REQUIRED or PREAUTH_FAILED error, if the client * indicated support for freshness tokens. This callback should only be * invoked from the edata method. */ void (*send_freshness_token)(krb5_context context, krb5_kdcpreauth_rock rock); /* Validate a freshness token sent by the client. Return 0 on success, * KRB5KDC_ERR_PREAUTH_EXPIRED on error. */ krb5_error_code (*check_freshness_token)(krb5_context context, krb5_kdcpreauth_rock rock, const krb5_data *token); /* End of version 5 kdcpreauth callbacks. */ } *krb5_kdcpreauth_callbacks; /* Optional: preauth plugin initialization function. */ typedef krb5_error_code (*krb5_kdcpreauth_init_fn)(krb5_context context, krb5_kdcpreauth_moddata *moddata_out, const char **realmnames); /* Optional: preauth plugin cleanup function. */ typedef void (*krb5_kdcpreauth_fini_fn)(krb5_context context, krb5_kdcpreauth_moddata moddata); /* * Optional: return the flags which the KDC should use for this module. This * is a callback instead of a static value because the module may or may not * wish to count itself as a hardware preauthentication module (in other words, * the flags may be affected by the configuration, for example if a site * administrator can force a particular preauthentication type to be supported * using only hardware). This function is called for each entry entry in the * server_pa_type_list. */ typedef int (*krb5_kdcpreauth_flags_fn)(krb5_context context, krb5_preauthtype pa_type); /* * Responder for krb5_kdcpreauth_edata_fn. If invoked with a non-zero code, pa * will be ignored and the padata type will not be included in the hint list. * If invoked with a zero code and a null pa value, the padata type will be * included in the list with an empty value. If invoked with a zero code and a * non-null pa value, pa will be included in the hint list and will later be * freed by the KDC. */ typedef void (*krb5_kdcpreauth_edata_respond_fn)(void *arg, krb5_error_code code, krb5_pa_data *pa); /* * Optional: provide pa_data to send to the client as part of the "you need to * use preauthentication" error. The implementation must invoke the respond * when complete, whether successful or not, either before returning or * asynchronously using the verto context returned by cb->event_context(). * * This function is not allowed to create a modreq object because we have no * guarantee that the client will ever make a follow-up request, or that it * will hit this KDC if it does. */ typedef void (*krb5_kdcpreauth_edata_fn)(krb5_context context, krb5_kdc_req *request, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_preauthtype pa_type, krb5_kdcpreauth_edata_respond_fn respond, void *arg); /* * Responder for krb5_kdcpreauth_verify_fn. Invoke with the arg parameter * supplied to verify, the error code (0 for success), an optional module * request state object to be consumed by return_fn or free_modreq_fn, optional * e_data to be passed to the caller if code is nonzero, and optional * authorization data to be included in the ticket. In non-FAST replies, * e_data will be encoded as typed-data if the module sets the PA_TYPED_E_DATA * flag, and as pa-data otherwise. e_data and authz_data will be freed by the * KDC. */ typedef void (*krb5_kdcpreauth_verify_respond_fn)(void *arg, krb5_error_code code, krb5_kdcpreauth_modreq modreq, krb5_pa_data **e_data, krb5_authdata **authz_data); /* * Optional: verify preauthentication data sent by the client, setting the * TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags" * field as appropriate. The implementation must invoke the respond function * when complete, whether successful or not, either before returning or * asynchronously using the verto context returned by cb->event_context(). */ typedef void (*krb5_kdcpreauth_verify_fn)(krb5_context context, krb5_data *req_pkt, krb5_kdc_req *request, krb5_enc_tkt_part *enc_tkt_reply, krb5_pa_data *data, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_verify_respond_fn respond, void *arg); /* * Optional: generate preauthentication response data to send to the client as * part of the AS-REP. If it needs to override the key which is used to * encrypt the response, it can do so. */ typedef krb5_error_code (*krb5_kdcpreauth_return_fn)(krb5_context context, krb5_pa_data *padata, krb5_data *req_pkt, krb5_kdc_req *request, krb5_kdc_rep *reply, krb5_keyblock *encrypting_key, krb5_pa_data **send_pa_out, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_modreq modreq); /* Optional: free a per-request context. */ typedef void (*krb5_kdcpreauth_free_modreq_fn)(krb5_context, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_modreq modreq); /* Optional: invoked after init_fn to provide the module with a pointer to the * verto main loop. */ typedef krb5_error_code (*krb5_kdcpreauth_loop_fn)(krb5_context context, krb5_kdcpreauth_moddata moddata, struct verto_ctx *ctx); typedef struct krb5_kdcpreauth_vtable_st { /* Mandatory: name of module. */ char *name; /* Mandatory: pointer to zero-terminated list of pa_types which this module * can provide services for. */ krb5_preauthtype *pa_type_list; krb5_kdcpreauth_init_fn init; krb5_kdcpreauth_fini_fn fini; krb5_kdcpreauth_flags_fn flags; krb5_kdcpreauth_edata_fn edata; krb5_kdcpreauth_verify_fn verify; krb5_kdcpreauth_return_fn return_padata; krb5_kdcpreauth_free_modreq_fn free_modreq; /* Minor 1 ends here. */ krb5_kdcpreauth_loop_fn loop; /* Minor 2 ends here. */ } *krb5_kdcpreauth_vtable; #endif /* KRB5_KDCPREAUTH_PLUGIN_H */ krb5/krb5.h 0000644 00001256744 15063602066 0006452 0 ustar 00 /* This file is generated, please don't edit it directly. */ #ifndef KRB5_KRB5_H_INCLUDED #define KRB5_KRB5_H_INCLUDED /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* General definitions for Kerberos version 5. */ /* * Copyright 1989, 1990, 1995, 2001, 2003, 2007, 2011 by the Massachusetts * Institute of Technology. All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * Copyright (C) 1998 by the FundsXpress, INC. * * All rights reserved. * * Export of this software from the United States of America may require * a specific license from the United States Government. It is the * responsibility of any person or organization contemplating export to * obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of FundsXpress. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. FundsXpress makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef KRB5_GENERAL__ #define KRB5_GENERAL__ /** @defgroup KRB5_H krb5 library API * @{ */ /* By default, do not expose deprecated interfaces. */ #ifndef KRB5_DEPRECATED #define KRB5_DEPRECATED 0 #endif #if defined(__MACH__) && defined(__APPLE__) # include <TargetConditionals.h> # if TARGET_RT_MAC_CFM # error "Use KfM 4.0 SDK headers for CFM compilation." # endif #endif #if defined(_MSDOS) || defined(_WIN32) #include <win-mac.h> #endif #ifndef KRB5_CONFIG__ #ifndef KRB5_CALLCONV #define KRB5_CALLCONV #define KRB5_CALLCONV_C #endif /* !KRB5_CALLCONV */ #endif /* !KRB5_CONFIG__ */ #ifndef KRB5_CALLCONV_WRONG #define KRB5_CALLCONV_WRONG #endif #ifndef THREEPARAMOPEN #define THREEPARAMOPEN(x,y,z) open(x,y,z) #endif #if KRB5_PRIVATE #ifndef WRITABLEFOPEN #define WRITABLEFOPEN(x,y) fopen(x,y) #endif #endif #define KRB5_OLD_CRYPTO #include <stdlib.h> #include <limits.h> /* for *_MAX */ #include <stdarg.h> #include <stdint.h> #ifndef KRB5INT_BEGIN_DECLS #if defined(__cplusplus) #define KRB5INT_BEGIN_DECLS extern "C" { #define KRB5INT_END_DECLS } #else #define KRB5INT_BEGIN_DECLS #define KRB5INT_END_DECLS #endif #endif KRB5INT_BEGIN_DECLS #if defined(TARGET_OS_MAC) && TARGET_OS_MAC # pragma pack(push,2) #endif #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 30203 # define KRB5_ATTR_DEPRECATED __attribute__((deprecated)) #elif defined _WIN32 # define KRB5_ATTR_DEPRECATED __declspec(deprecated) #else # define KRB5_ATTR_DEPRECATED #endif /* from profile.h */ struct _profile_t; /* typedef struct _profile_t *profile_t; */ /* * begin wordsize.h */ /* * Word-size related definition. */ typedef uint8_t krb5_octet; typedef int16_t krb5_int16; typedef uint16_t krb5_ui_2; typedef int32_t krb5_int32; typedef uint32_t krb5_ui_4; #define VALID_INT_BITS INT_MAX #define VALID_UINT_BITS UINT_MAX #define KRB5_INT32_MAX 2147483647 /* this strange form is necessary since - is a unary operator, not a sign indicator */ #define KRB5_INT32_MIN (-KRB5_INT32_MAX-1) #define KRB5_INT16_MAX 65535 /* this strange form is necessary since - is a unary operator, not a sign indicator */ #define KRB5_INT16_MIN (-KRB5_INT16_MAX-1) /* * end wordsize.h */ /* * begin "base-defs.h" */ /* * Basic definitions for Kerberos V5 library */ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif typedef unsigned int krb5_boolean; typedef unsigned int krb5_msgtype; typedef unsigned int krb5_kvno; typedef krb5_int32 krb5_addrtype; typedef krb5_int32 krb5_enctype; typedef krb5_int32 krb5_cksumtype; typedef krb5_int32 krb5_authdatatype; typedef krb5_int32 krb5_keyusage; typedef krb5_int32 krb5_cryptotype; typedef krb5_int32 krb5_preauthtype; /* This may change, later on */ typedef krb5_int32 krb5_flags; /** * Represents a timestamp in seconds since the POSIX epoch. This legacy type * is used frequently in the ABI, but cannot represent timestamps after 2038 as * a positive number. Code which uses this type should cast values of it to * uint32_t so that negative values are treated as timestamps between 2038 and * 2106 on platforms with 64-bit time_t. */ typedef krb5_int32 krb5_timestamp; typedef krb5_int32 krb5_deltat; /** * Used to convey an operation status. The value 0 indicates success; any * other values are com_err codes. Use krb5_get_error_message() to obtain a * string describing the error. */ typedef krb5_int32 krb5_error_code; typedef krb5_error_code krb5_magic; typedef struct _krb5_data { krb5_magic magic; unsigned int length; char *data; } krb5_data; /* Originally introduced for PKINIT; now unused. Do not use this. */ typedef struct _krb5_octet_data { krb5_magic magic; unsigned int length; krb5_octet *data; } krb5_octet_data; /* Originally used to recognize AFS and default salts. No longer used. */ #define SALT_TYPE_AFS_LENGTH UINT_MAX #define SALT_TYPE_NO_LENGTH UINT_MAX typedef void * krb5_pointer; typedef void const * krb5_const_pointer; typedef struct krb5_principal_data { krb5_magic magic; krb5_data realm; krb5_data *data; /**< An array of strings */ krb5_int32 length; krb5_int32 type; } krb5_principal_data; typedef krb5_principal_data * krb5_principal; /* * Per V5 spec on definition of principal types */ #define KRB5_NT_UNKNOWN 0 /**< Name type not known */ #define KRB5_NT_PRINCIPAL 1 /**< Just the name of the principal as in DCE, or for users */ #define KRB5_NT_SRV_INST 2 /**< Service and other unique instance (krbtgt) */ #define KRB5_NT_SRV_HST 3 /**< Service with host name as instance (telnet, rcommands) */ #define KRB5_NT_SRV_XHST 4 /**< Service with host as remaining components */ #define KRB5_NT_UID 5 /**< Unique ID */ #define KRB5_NT_X500_PRINCIPAL 6 /**< PKINIT */ #define KRB5_NT_SMTP_NAME 7 /**< Name in form of SMTP email name */ #define KRB5_NT_ENTERPRISE_PRINCIPAL 10 /**< Windows 2000 UPN */ #define KRB5_NT_WELLKNOWN 11 /**< Well-known (special) principal */ #define KRB5_WELLKNOWN_NAMESTR "WELLKNOWN" /**< First component of NT_WELLKNOWN principals */ #define KRB5_NT_MS_PRINCIPAL -128 /**< Windows 2000 UPN and SID */ #define KRB5_NT_MS_PRINCIPAL_AND_ID -129 /**< NT 4 style name */ #define KRB5_NT_ENT_PRINCIPAL_AND_ID -130 /**< NT 4 style name and SID */ /** Constant version of krb5_principal_data */ typedef const krb5_principal_data *krb5_const_principal; #define krb5_princ_realm(context, princ) (&(princ)->realm) #define krb5_princ_set_realm(context, princ,value) ((princ)->realm = *(value)) #define krb5_princ_set_realm_length(context, princ,value) (princ)->realm.length = (value) #define krb5_princ_set_realm_data(context, princ,value) (princ)->realm.data = (value) #define krb5_princ_size(context, princ) (princ)->length #define krb5_princ_type(context, princ) (princ)->type #define krb5_princ_name(context, princ) (princ)->data #define krb5_princ_component(context, princ,i) \ (((i) < krb5_princ_size(context, princ)) \ ? (princ)->data + (i) \ : NULL) /** Constant for realm referrals. */ #define KRB5_REFERRAL_REALM "" /* * Referral-specific functions. */ /** * Check for a match with KRB5_REFERRAL_REALM. * * @param [in] r Realm to check * * @return @c TRUE if @a r is zero-length, @c FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_is_referral_realm(const krb5_data *r); /** * Return an anonymous realm data. * * This function returns constant storage that must not be freed. * * @sa #KRB5_ANONYMOUS_REALMSTR */ const krb5_data *KRB5_CALLCONV krb5_anonymous_realm(void); /** * Build an anonymous principal. * * This function returns constant storage that must not be freed. * * @sa #KRB5_ANONYMOUS_PRINCSTR */ krb5_const_principal KRB5_CALLCONV krb5_anonymous_principal(void); #define KRB5_ANONYMOUS_REALMSTR "WELLKNOWN:ANONYMOUS" /**< Anonymous realm */ #define KRB5_ANONYMOUS_PRINCSTR "ANONYMOUS" /**< Anonymous principal name */ /* * end "base-defs.h" */ /* * begin "hostaddr.h" */ /** Structure for address */ typedef struct _krb5_address { krb5_magic magic; krb5_addrtype addrtype; unsigned int length; krb5_octet *contents; } krb5_address; /* per Kerberos v5 protocol spec */ #define ADDRTYPE_INET 0x0002 #define ADDRTYPE_CHAOS 0x0005 #define ADDRTYPE_XNS 0x0006 #define ADDRTYPE_ISO 0x0007 #define ADDRTYPE_DDP 0x0010 #define ADDRTYPE_NETBIOS 0x0014 #define ADDRTYPE_INET6 0x0018 /* not yet in the spec... */ #define ADDRTYPE_ADDRPORT 0x0100 #define ADDRTYPE_IPPORT 0x0101 /* macros to determine if a type is a local type */ #define ADDRTYPE_IS_LOCAL(addrtype) (addrtype & 0x8000) /* * end "hostaddr.h" */ struct _krb5_context; typedef struct _krb5_context * krb5_context; struct _krb5_auth_context; typedef struct _krb5_auth_context * krb5_auth_context; struct _krb5_cryptosystem_entry; /* * begin "encryption.h" */ /** Exposed contents of a key. */ typedef struct _krb5_keyblock { krb5_magic magic; krb5_enctype enctype; unsigned int length; krb5_octet *contents; } krb5_keyblock; struct krb5_key_st; /** * Opaque identifier for a key. * * Use with the krb5_k APIs for better performance for repeated operations with * the same key and usage. Key identifiers must not be used simultaneously * within multiple threads, as they may contain mutable internal state and are * not mutex-protected. */ typedef struct krb5_key_st *krb5_key; #ifdef KRB5_OLD_CRYPTO typedef struct _krb5_encrypt_block { krb5_magic magic; krb5_enctype crypto_entry; /* to call krb5_encrypt_size, you need this. it was a pointer, but it doesn't have to be. gross. */ krb5_keyblock *key; } krb5_encrypt_block; #endif typedef struct _krb5_checksum { krb5_magic magic; krb5_cksumtype checksum_type; /* checksum type */ unsigned int length; krb5_octet *contents; } krb5_checksum; typedef struct _krb5_enc_data { krb5_magic magic; krb5_enctype enctype; krb5_kvno kvno; krb5_data ciphertext; } krb5_enc_data; /** * Structure to describe a region of text to be encrypted or decrypted. * * The @a flags member describes the type of the iov. * The @a data member points to the memory that will be manipulated. * All iov APIs take a pointer to the first element of an array of krb5_crypto_iov's * along with the size of that array. Buffer contents are manipulated in-place; * data is overwritten. Callers must allocate the right number of krb5_crypto_iov * structures before calling into an iov API. */ typedef struct _krb5_crypto_iov { krb5_cryptotype flags; /**< @ref KRB5_CRYPTO_TYPE type of the iov */ krb5_data data; } krb5_crypto_iov; /* per Kerberos v5 protocol spec */ #define ENCTYPE_NULL 0x0000 #define ENCTYPE_DES_CBC_CRC 0x0001 /**< @deprecated no longer supported */ #define ENCTYPE_DES_CBC_MD4 0x0002 /**< @deprecated no longer supported */ #define ENCTYPE_DES_CBC_MD5 0x0003 /**< @deprecated no longer supported */ #define ENCTYPE_DES_CBC_RAW 0x0004 /**< @deprecated no longer supported */ #define ENCTYPE_DES3_CBC_SHA 0x0005 /**< @deprecated no longer supported */ #define ENCTYPE_DES3_CBC_RAW 0x0006 /**< @deprecated no longer supported */ #define ENCTYPE_DES_HMAC_SHA1 0x0008 /**< @deprecated no longer supported */ /* PKINIT */ #define ENCTYPE_DSA_SHA1_CMS 0x0009 /**< DSA with SHA1, CMS signature */ #define ENCTYPE_MD5_RSA_CMS 0x000a /**< MD5 with RSA, CMS signature */ #define ENCTYPE_SHA1_RSA_CMS 0x000b /**< SHA1 with RSA, CMS signature */ #define ENCTYPE_RC2_CBC_ENV 0x000c /**< RC2 cbc mode, CMS enveloped data */ #define ENCTYPE_RSA_ENV 0x000d /**< RSA encryption, CMS enveloped data */ #define ENCTYPE_RSA_ES_OAEP_ENV 0x000e /**< RSA w/OEAP encryption, CMS enveloped data */ #define ENCTYPE_DES3_CBC_ENV 0x000f /**< @deprecated no longer supported */ #define ENCTYPE_DES3_CBC_SHA1 0x0010 /**< @deprecated removed */ #define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011 /**< RFC 3962 */ #define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012 /**< RFC 3962 */ #define ENCTYPE_AES128_CTS_HMAC_SHA256_128 0x0013 /**< RFC 8009 */ #define ENCTYPE_AES256_CTS_HMAC_SHA384_192 0x0014 /**< RFC 8009 */ #define ENCTYPE_ARCFOUR_HMAC 0x0017 /**< RFC 4757 */ #define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018 /**< RFC 4757 */ #define ENCTYPE_CAMELLIA128_CTS_CMAC 0x0019 /**< RFC 6803 */ #define ENCTYPE_CAMELLIA256_CTS_CMAC 0x001a /**< RFC 6803 */ #define ENCTYPE_UNKNOWN 0x01ff /* * Historically we used the value 9 for unkeyed SHA-1. RFC 3961 assigns this * value to rsa-md5-des3, which fortunately is unused. For ABI compatibility * we allow either 9 or 14 for SHA-1. */ #define CKSUMTYPE_CRC32 0x0001 #define CKSUMTYPE_RSA_MD4 0x0002 #define CKSUMTYPE_RSA_MD4_DES 0x0003 #define CKSUMTYPE_DESCBC 0x0004 /* des-mac-k */ /* rsa-md4-des-k */ #define CKSUMTYPE_RSA_MD5 0x0007 #define CKSUMTYPE_RSA_MD5_DES 0x0008 #define CKSUMTYPE_NIST_SHA 0x0009 #define CKSUMTYPE_HMAC_SHA1_DES3 0x000c /* @deprecated removed */ #define CKSUMTYPE_SHA1 0x000d /**< RFC 3962 */ #define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f /**< RFC 3962. Used with ENCTYPE_AES128_CTS_HMAC_SHA1_96 */ #define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010 /**< RFC 3962. Used with ENCTYPE_AES256_CTS_HMAC_SHA1_96 */ #define CKSUMTYPE_HMAC_SHA256_128_AES128 0x0013 /**< RFC 8009 */ #define CKSUMTYPE_HMAC_SHA384_192_AES256 0x0014 /**< RFC 8009 */ #define CKSUMTYPE_CMAC_CAMELLIA128 0x0011 /**< RFC 6803 */ #define CKSUMTYPE_CMAC_CAMELLIA256 0x0012 /**< RFC 6803 */ #define CKSUMTYPE_MD5_HMAC_ARCFOUR -137 /* Microsoft netlogon */ #define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /**< RFC 4757 */ /* * The following are entropy source designations. Whenever * krb5_C_random_add_entropy is called, one of these source ids is passed in. * This allows the library to better estimate bits of entropy in the sample and * to keep track of what sources of entropy have contributed enough entropy. * Sources marked internal MUST NOT be used by applications outside the * Kerberos library */ enum { KRB5_C_RANDSOURCE_OLDAPI = 0, /*calls to krb5_C_RANDOM_SEED (INTERNAL)*/ KRB5_C_RANDSOURCE_OSRAND = 1, /* /dev/random or equivalent (internal)*/ KRB5_C_RANDSOURCE_TRUSTEDPARTY = 2, /* From KDC or other trusted party*/ /* * This source should be used carefully; data in this category * should be from a third party trusted to give random bits * For example keys issued by the KDC in the application server. */ KRB5_C_RANDSOURCE_TIMING = 3, /* Timing of operations*/ KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL = 4, /*Protocol data possibly from attacker*/ KRB5_C_RANDSOURCE_MAX = 5 /*Do not use; maximum source ID*/ }; #ifndef krb5_roundup /* round x up to nearest multiple of y */ #define krb5_roundup(x, y) ((((x) + (y) - 1)/(y))*(y)) #endif /* roundup */ /* macro function definitions to help clean up code */ #if 1 #define krb5_x(ptr,args) ((ptr)?((*(ptr)) args):(abort(),1)) #define krb5_xc(ptr,args) ((ptr)?((*(ptr)) args):(abort(),(char*)0)) #else #define krb5_x(ptr,args) ((*(ptr)) args) #define krb5_xc(ptr,args) ((*(ptr)) args) #endif /** * Encrypt data using a key (operates on keyblock). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Data to be encrypted * @param [out] output Encrypted data * * This function encrypts the data block @a input and stores the output into @a * output. The actual encryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result (using krb5_c_encrypt_length() to determine the amount * of space needed). @a output->length will be set to the actual length of the * ciphertext. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_encrypt(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_data *input, krb5_enc_data *output); /** * Decrypt data using a key (operates on keyblock). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Encrypted data * @param [out] output Decrypted data * * This function decrypts the data block @a input and stores the output into @a * output. The actual decryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result. The usual practice is to allocate an output buffer as * long as the ciphertext, and let krb5_c_decrypt() trim @a output->length. * For some enctypes, the resulting @a output->length may include padding * bytes. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_decrypt(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_enc_data *input, krb5_data *output); /** * Compute encrypted data length. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] inputlen Length of the data to be encrypted * @param [out] length Length of the encrypted data * * This function computes the length of the ciphertext produced by encrypting * @a inputlen bytes including padding, confounder, and checksum. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype, size_t inputlen, size_t *length); /** * Return cipher block size. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] blocksize Block size for @a enctype * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_block_size(krb5_context context, krb5_enctype enctype, size_t *blocksize); /** * Return length of the specified key in bytes. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] keybytes Number of bytes required to make a key * @param [out] keylength Length of final key * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_keylengths(krb5_context context, krb5_enctype enctype, size_t *keybytes, size_t *keylength); /** * Initialize a new cipher state. * * @param [in] context Library context * @param [in] key Key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [out] new_state New cipher state * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_init_state(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, krb5_data *new_state); /** * Free a cipher state previously allocated by krb5_c_init_state(). * * @param [in] context Library context * @param [in] key Key * @param [in] state Cipher state to be freed * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_free_state(krb5_context context, const krb5_keyblock *key, krb5_data *state); /** * Generate enctype-specific pseudo-random bytes. * * @param [in] context Library context * @param [in] keyblock Key * @param [in] input Input data * @param [out] output Output data * * This function selects a pseudo-random function based on @a keyblock and * computes its value over @a input, placing the result into @a output. * The caller must preinitialize @a output and allocate space for the * result, using krb5_c_prf_length() to determine the required length. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_prf(krb5_context context, const krb5_keyblock *keyblock, krb5_data *input, krb5_data *output); /** * Get the output length of pseudo-random functions for an encryption type. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] len Length of PRF output * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_prf_length(krb5_context context, krb5_enctype enctype, size_t *len); /** * Generate pseudo-random bytes using RFC 6113 PRF+. * * @param [in] context Library context * @param [in] k KDC contribution key * @param [in] input Input data * @param [out] output Pseudo-random output buffer * * This function fills @a output with PRF+(k, input) as defined in RFC 6113 * section 5.1. The caller must preinitialize @a output and allocate the * desired amount of space. The length of the pseudo-random output will match * the length of @a output. * * @note RFC 4402 defines a different PRF+ operation. This function does not * implement that operation. * * @return 0 on success, @c E2BIG if output->length is too large for PRF+ to * generate, @c ENOMEM on allocation failure, or an error code from * krb5_c_prf() */ krb5_error_code KRB5_CALLCONV krb5_c_prfplus(krb5_context context, const krb5_keyblock *k, const krb5_data *input, krb5_data *output); /** * Derive a key using some input data (via RFC 6113 PRF+). * * @param [in] context Library context * @param [in] k KDC contribution key * @param [in] input Input string * @param [in] enctype Output key enctype (or @c ENCTYPE_NULL) * @param [out] out Derived keyblock * * This function uses PRF+ as defined in RFC 6113 to derive a key from another * key and an input string. If @a enctype is @c ENCTYPE_NULL, the output key * will have the same enctype as the input key. */ krb5_error_code KRB5_CALLCONV krb5_c_derive_prfplus(krb5_context context, const krb5_keyblock *k, const krb5_data *input, krb5_enctype enctype, krb5_keyblock **out); /** * Compute the KRB-FX-CF2 combination of two keys and pepper strings. * * @param [in] context Library context * @param [in] k1 KDC contribution key * @param [in] pepper1 String "PKINIT" * @param [in] k2 Reply key * @param [in] pepper2 String "KeyExchange" * @param [out] out Output key * * This function computes the KRB-FX-CF2 function over its inputs and places * the results in a newly allocated keyblock. This function is simple in that * it assumes that @a pepper1 and @a pepper2 are C strings with no internal * nulls and that the enctype of the result will be the same as that of @a k1. * @a k1 and @a k2 may be of different enctypes. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_fx_cf2_simple(krb5_context context, const krb5_keyblock *k1, const char *pepper1, const krb5_keyblock *k2, const char *pepper2, krb5_keyblock **out); /** * Generate an enctype-specific random encryption key. * * @param [in] context Library context * @param [in] enctype Encryption type of the generated key * @param [out] k5_random_key An allocated and initialized keyblock * * Use krb5_free_keyblock_contents() to free @a k5_random_key when * no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_make_random_key(krb5_context context, krb5_enctype enctype, krb5_keyblock *k5_random_key); /** * Generate an enctype-specific key from random data. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] random_data Random input data * @param [out] k5_random_key Resulting key * * This function takes random input data @a random_data and produces a valid * key @a k5_random_key for a given @a enctype. * * @note It is assumed that @a k5_random_key has already been initialized and * @a k5_random_key->contents has been allocated with the correct length. * * @sa krb5_c_keylengths() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_to_key(krb5_context context, krb5_enctype enctype, krb5_data *random_data, krb5_keyblock *k5_random_key); /** * Add entropy to the pseudo-random number generator. * * @param [in] context Library context * @param [in] randsource Entropy source (see KRB5_RANDSOURCE types) * @param [in] data Data * * Contribute entropy to the PRNG used by krb5 crypto operations. This may or * may not affect the output of the next crypto operation requiring random * data. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_add_entropy(krb5_context context, unsigned int randsource, const krb5_data *data); /** * Generate pseudo-random bytes. * * @param [in] context Library context * @param [out] data Random data * * Fills in @a data with bytes from the PRNG used by krb5 crypto operations. * The caller must preinitialize @a data and allocate the desired amount of * space. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_make_octets(krb5_context context, krb5_data *data); /** * Collect entropy from the OS if possible. * * @param [in] context Library context * @param [in] strong Strongest available source of entropy * @param [out] success 1 if OS provides entropy, 0 otherwise * * If @a strong is non-zero, this function attempts to use the strongest * available source of entropy. Setting this flag may cause the function to * block on some operating systems. Good uses include seeding the PRNG for * kadmind and realm setup. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_random_os_entropy(krb5_context context, int strong, int *success); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_c_random_seed(krb5_context context, krb5_data *data); /** * Convert a string (such a password) to a key. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] string String to be converted * @param [in] salt Salt value * @param [out] key Generated key * * This function converts @a string to a @a key of encryption type @a enctype, * using the specified @a salt. The newly created @a key must be released by * calling krb5_free_keyblock_contents() when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_string_to_key(krb5_context context, krb5_enctype enctype, const krb5_data *string, const krb5_data *salt, krb5_keyblock *key); /** * Convert a string (such as a password) to a key with additional parameters. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] string String to be converted * @param [in] salt Salt value * @param [in] params Parameters * @param [out] key Generated key * * This function is similar to krb5_c_string_to_key(), but also takes * parameters which may affect the algorithm in an enctype-dependent way. The * newly created @a key must be released by calling * krb5_free_keyblock_contents() when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_string_to_key_with_params(krb5_context context, krb5_enctype enctype, const krb5_data *string, const krb5_data *salt, const krb5_data *params, krb5_keyblock *key); /** * Compare two encryption types. * * @param [in] context Library context * @param [in] e1 First encryption type * @param [in] e2 Second encryption type * @param [out] similar @c TRUE if types are similar, @c FALSE if not * * This function determines whether two encryption types use the same kind of * keys. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_enctype_compare(krb5_context context, krb5_enctype e1, krb5_enctype e2, krb5_boolean *similar); /** * Compute a checksum (operates on keyblock). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] input Input data * @param [out] cksum Generated checksum * * This function computes a checksum of type @a cksumtype over @a input, using * @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and * @a key is non-null, the checksum type will be the mandatory-to-implement * checksum type for the key's encryption type. The actual checksum key will * be derived from @a key and @a usage if key derivation is specified for the * checksum type. The newly created @a cksum must be released by calling * krb5_free_checksum_contents() when it is no longer needed. * * @note This function is similar to krb5_k_make_checksum(), but operates * on keyblock @a key. * * @sa krb5_c_verify_checksum() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_make_checksum(krb5_context context, krb5_cksumtype cksumtype, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *input, krb5_checksum *cksum); /** * Verify a checksum (operates on keyblock). * * @param [in] context Library context * @param [in] key Encryption key for a keyed checksum * @param [in] usage @a key usage * @param [in] data Data to be used to compute a new checksum * using @a key to compare @a cksum against * @param [in] cksum Checksum to be verified * @param [out] valid Non-zero for success, zero for failure * * This function verifies that @a cksum is a valid checksum for @a data. If * the checksum type of @a cksum is a keyed checksum, @a key is used to verify * the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL, * the mandatory checksum type for @a key will be used. The actual checksum * key will be derived from @a key and @a usage if key derivation is specified * for the checksum type. * * @note This function is similar to krb5_k_verify_checksum(), but operates * on keyblock @a key. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *data, const krb5_checksum *cksum, krb5_boolean *valid); /** * Return the length of checksums for a checksum type. * * @param [in] context Library context * @param [in] cksumtype Checksum type * @param [out] length Checksum length * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_checksum_length(krb5_context context, krb5_cksumtype cksumtype, size_t *length); /** * Return a list of keyed checksum types usable with an encryption type. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [out] count Count of allowable checksum types * @param [out] cksumtypes Array of allowable checksum types * * Use krb5_free_cksumtypes() to free @a cksumtypes when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_keyed_checksum_types(krb5_context context, krb5_enctype enctype, unsigned int *count, krb5_cksumtype **cksumtypes); /** @defgroup KRB5_KEYUSAGE KRB5_KEYUSAGE * @{ */ #define KRB5_KEYUSAGE_AS_REQ_PA_ENC_TS 1 #define KRB5_KEYUSAGE_KDC_REP_TICKET 2 #define KRB5_KEYUSAGE_AS_REP_ENCPART 3 #define KRB5_KEYUSAGE_TGS_REQ_AD_SESSKEY 4 #define KRB5_KEYUSAGE_TGS_REQ_AD_SUBKEY 5 #define KRB5_KEYUSAGE_TGS_REQ_AUTH_CKSUM 6 #define KRB5_KEYUSAGE_TGS_REQ_AUTH 7 #define KRB5_KEYUSAGE_TGS_REP_ENCPART_SESSKEY 8 #define KRB5_KEYUSAGE_TGS_REP_ENCPART_SUBKEY 9 #define KRB5_KEYUSAGE_AP_REQ_AUTH_CKSUM 10 #define KRB5_KEYUSAGE_AP_REQ_AUTH 11 #define KRB5_KEYUSAGE_AP_REP_ENCPART 12 #define KRB5_KEYUSAGE_KRB_PRIV_ENCPART 13 #define KRB5_KEYUSAGE_KRB_CRED_ENCPART 14 #define KRB5_KEYUSAGE_KRB_SAFE_CKSUM 15 #define KRB5_KEYUSAGE_APP_DATA_ENCRYPT 16 #define KRB5_KEYUSAGE_APP_DATA_CKSUM 17 #define KRB5_KEYUSAGE_KRB_ERROR_CKSUM 18 #define KRB5_KEYUSAGE_AD_KDCISSUED_CKSUM 19 #define KRB5_KEYUSAGE_AD_MTE 20 #define KRB5_KEYUSAGE_AD_ITE 21 /* XXX need to register these */ #define KRB5_KEYUSAGE_GSS_TOK_MIC 22 #define KRB5_KEYUSAGE_GSS_TOK_WRAP_INTEG 23 #define KRB5_KEYUSAGE_GSS_TOK_WRAP_PRIV 24 /* Defined in Integrating SAM Mechanisms with Kerberos draft */ #define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_CKSUM 25 /** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST */ #define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID 26 /** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY */ #define KRB5_KEYUSAGE_PA_SAM_RESPONSE 27 /* Defined in [MS-SFU] */ /** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID */ #define KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST 26 /** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_RESPONSE */ #define KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY 27 /* unused */ #define KRB5_KEYUSAGE_PA_REFERRAL 26 #define KRB5_KEYUSAGE_AD_SIGNEDPATH -21 #define KRB5_KEYUSAGE_IAKERB_FINISHED 42 #define KRB5_KEYUSAGE_PA_PKINIT_KX 44 #define KRB5_KEYUSAGE_PA_OTP_REQUEST 45 /**< See RFC 6560 section 4.2 */ /* define in draft-ietf-krb-wg-preauth-framework*/ #define KRB5_KEYUSAGE_FAST_REQ_CHKSUM 50 #define KRB5_KEYUSAGE_FAST_ENC 51 #define KRB5_KEYUSAGE_FAST_REP 52 #define KRB5_KEYUSAGE_FAST_FINISHED 53 #define KRB5_KEYUSAGE_ENC_CHALLENGE_CLIENT 54 #define KRB5_KEYUSAGE_ENC_CHALLENGE_KDC 55 #define KRB5_KEYUSAGE_AS_REQ 56 #define KRB5_KEYUSAGE_CAMMAC 64 #define KRB5_KEYUSAGE_SPAKE 65 /* Key usage values 512-1023 are reserved for uses internal to a Kerberos * implementation. */ #define KRB5_KEYUSAGE_PA_FX_COOKIE 513 /**< Used for encrypted FAST cookies */ #define KRB5_KEYUSAGE_PA_AS_FRESHNESS 514 /**< Used for freshness tokens */ /** @} */ /* end of KRB5_KEYUSAGE group */ /** * Verify that a specified encryption type is a valid Kerberos encryption type. * * @param [in] ktype Encryption type * * @return @c TRUE if @a ktype is valid, @c FALSE if not */ krb5_boolean KRB5_CALLCONV krb5_c_valid_enctype(krb5_enctype ktype); /** * Verify that specified checksum type is a valid Kerberos checksum type. * * @param [in] ctype Checksum type * * @return @c TRUE if @a ctype is valid, @c FALSE if not */ krb5_boolean KRB5_CALLCONV krb5_c_valid_cksumtype(krb5_cksumtype ctype); /** * Test whether a checksum type is collision-proof. * * @param [in] ctype Checksum type * * @return @c TRUE if @a ctype is collision-proof, @c FALSE if it is not * collision-proof or not a valid checksum type. */ krb5_boolean KRB5_CALLCONV krb5_c_is_coll_proof_cksum(krb5_cksumtype ctype); /** * Test whether a checksum type is keyed. * * @param [in] ctype Checksum type * * @return @c TRUE if @a ctype is a keyed checksum type, @c FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_c_is_keyed_cksum(krb5_cksumtype ctype); /* AEAD APIs */ /** @defgroup KRB5_CRYPTO_TYPE KRB5_CRYPTO_TYPE * @{ */ #define KRB5_CRYPTO_TYPE_EMPTY 0 /**< [in] ignored */ #define KRB5_CRYPTO_TYPE_HEADER 1 /**< [out] header */ #define KRB5_CRYPTO_TYPE_DATA 2 /**< [in, out] plaintext */ #define KRB5_CRYPTO_TYPE_SIGN_ONLY 3 /**< [in] associated data */ #define KRB5_CRYPTO_TYPE_PADDING 4 /**< [out] padding */ #define KRB5_CRYPTO_TYPE_TRAILER 5 /**< [out] checksum for encrypt */ #define KRB5_CRYPTO_TYPE_CHECKSUM 6 /**< [out] checksum for MIC */ #define KRB5_CRYPTO_TYPE_STREAM 7 /**< [in] entire message without decomposing the structure into header, data and trailer buffers */ /** @} */ /* end of KRB5_CRYPTO_TYPE group */ /** * Fill in a checksum element in IOV array (operates on keyblock) * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] data IOV array * @param [in] num_data Size of @a data * * Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over * #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data. * Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified. * * @note This function is similar to krb5_k_make_checksum_iov(), but operates * on keyblock @a key. * * @sa krb5_c_verify_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, const krb5_keyblock *key, krb5_keyusage usage, krb5_crypto_iov *data, size_t num_data); /** * Validate a checksum element in IOV array (operates on keyblock). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] data IOV array * @param [in] num_data Size of @a data * @param [out] valid Non-zero for success, zero for failure * * Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a * valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY * regions in the iov. * * @note This function is similar to krb5_k_verify_checksum_iov(), but operates * on keyblock @a key. * * @sa krb5_c_make_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, const krb5_keyblock *key, krb5_keyusage usage, const krb5_crypto_iov *data, size_t num_data, krb5_boolean *valid); /** * Encrypt data in place supporting AEAD (operates on keyblock). * * @param [in] context Library context * @param [in] keyblock Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function encrypts the data block @a data and stores the output in-place. * The actual encryption key will be derived from @a keyblock and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_k_encrypt_iov(), but operates * on keyblock @a keyblock. * * @sa krb5_c_decrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_encrypt_iov(krb5_context context, const krb5_keyblock *keyblock, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Decrypt data in place supporting AEAD (operates on keyblock). * * @param [in] context Library context * @param [in] keyblock Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function decrypts the data block @a data and stores the output in-place. * The actual decryption key will be derived from @a keyblock and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_k_decrypt_iov(), but operates * on keyblock @a keyblock. * * @sa krb5_c_decrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_decrypt_iov(krb5_context context, const krb5_keyblock *keyblock, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Return a length of a message field specific to the encryption type. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] type Type field (See @ref KRB5_CRYPTO_TYPE types) * @param [out] size Length of the @a type specific to @a enctype * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_crypto_length(krb5_context context, krb5_enctype enctype, krb5_cryptotype type, unsigned int *size); /** * Fill in lengths for header, trailer and padding in a IOV array. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in,out] data IOV array * @param [in] num_data Size of @a data * * Padding is set to the actual padding required based on the provided * @a data buffers. Typically this API is used after setting up the data * buffers and #KRB5_CRYPTO_TYPE_SIGN_ONLY buffers, but before actually * allocating header, trailer and padding. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_c_crypto_length_iov(krb5_context context, krb5_enctype enctype, krb5_crypto_iov *data, size_t num_data); /** * Return a number of padding octets. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] data_length Length of the plaintext to pad * @param [out] size Number of padding octets * * This function returns the number of the padding octets required to pad * @a data_length octets of plaintext. * * @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE */ krb5_error_code KRB5_CALLCONV krb5_c_padding_length(krb5_context context, krb5_enctype enctype, size_t data_length, unsigned int *size); /** * Create a krb5_key from the enctype and key data in a keyblock. * * @param [in] context Library context * @param [in] key_data Keyblock * @param [out] out Opaque key * * The reference count on a key @a out is set to 1. * Use krb5_k_free_key() to free @a out when it is no longer needed. * * @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE */ krb5_error_code KRB5_CALLCONV krb5_k_create_key(krb5_context context, const krb5_keyblock *key_data, krb5_key *out); /** Increment the reference count on a key. */ void KRB5_CALLCONV krb5_k_reference_key(krb5_context context, krb5_key key); /** Decrement the reference count on a key and free it if it hits zero. */ void KRB5_CALLCONV krb5_k_free_key(krb5_context context, krb5_key key); /** Retrieve a copy of the keyblock from a krb5_key structure. */ krb5_error_code KRB5_CALLCONV krb5_k_key_keyblock(krb5_context context, krb5_key key, krb5_keyblock **key_data); /** Retrieve the enctype of a krb5_key structure. */ krb5_enctype KRB5_CALLCONV krb5_k_key_enctype(krb5_context context, krb5_key key); /** * Encrypt data using a key (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Data to be encrypted * @param [out] output Encrypted data * * This function encrypts the data block @a input and stores the output into @a * output. The actual encryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result (using krb5_c_encrypt_length() to determine the amount * of space needed). @a output->length will be set to the actual length of the * ciphertext. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_encrypt(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_data *input, krb5_enc_data *output); /** * Encrypt data in place supporting AEAD (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function encrypts the data block @a data and stores the output in-place. * The actual encryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the encryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_c_encrypt_iov(), but operates * on opaque key @a key. * * @sa krb5_k_decrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_encrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Decrypt data using a key (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] cipher_state Cipher state; specify NULL if not needed * @param [in] input Encrypted data * @param [out] output Decrypted data * * This function decrypts the data block @a input and stores the output into @a * output. The actual decryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * * @note The caller must initialize @a output and allocate at least enough * space for the result. The usual practice is to allocate an output buffer as * long as the ciphertext, and let krb5_c_decrypt() trim @a output->length. * For some enctypes, the resulting @a output->length may include padding * bytes. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_decrypt(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, const krb5_enc_data *input, krb5_data *output); /** * Decrypt data in place supporting AEAD (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] cipher_state Cipher state; specify NULL if not needed * @param [in,out] data IOV array. Modified in-place. * @param [in] num_data Size of @a data * * This function decrypts the data block @a data and stores the output in-place. * The actual decryption key will be derived from @a key and @a usage * if key derivation is specified for the encryption type. If non-null, @a * cipher_state specifies the beginning state for the decryption operation, and * is updated with the state to be passed as input to the next operation. * The caller must allocate the right number of krb5_crypto_iov * structures before calling into this API. * * @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the * iov structure are adjusted to reflect actual lengths of the ciphertext used. * For example, if the padding length is too large, the length will be reduced. * Lengths are never increased. * * @note This function is similar to krb5_c_decrypt_iov(), but operates * on opaque key @a key. * * @sa krb5_k_encrypt_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_decrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *cipher_state, krb5_crypto_iov *data, size_t num_data); /** * Compute a checksum (operates on opaque key). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] input Input data * @param [out] cksum Generated checksum * * This function computes a checksum of type @a cksumtype over @a input, using * @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and * @a key is non-null, the checksum type will be the mandatory-to-implement * checksum type for the key's encryption type. The actual checksum key will * be derived from @a key and @a usage if key derivation is specified for the * checksum type. The newly created @a cksum must be released by calling * krb5_free_checksum_contents() when it is no longer needed. * * @note This function is similar to krb5_c_make_checksum(), but operates * on opaque @a key. * * @sa krb5_c_verify_checksum() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_make_checksum(krb5_context context, krb5_cksumtype cksumtype, krb5_key key, krb5_keyusage usage, const krb5_data *input, krb5_checksum *cksum); /** * Fill in a checksum element in IOV array (operates on opaque key) * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in,out] data IOV array * @param [in] num_data Size of @a data * * Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over * #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data. * Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified. * * @note This function is similar to krb5_c_make_checksum_iov(), but operates * on opaque @a key. * * @sa krb5_k_verify_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, krb5_key key, krb5_keyusage usage, krb5_crypto_iov *data, size_t num_data); /** * Verify a checksum (operates on opaque key). * * @param [in] context Library context * @param [in] key Encryption key for a keyed checksum * @param [in] usage @a key usage * @param [in] data Data to be used to compute a new checksum * using @a key to compare @a cksum against * @param [in] cksum Checksum to be verified * @param [out] valid Non-zero for success, zero for failure * * This function verifies that @a cksum is a valid checksum for @a data. If * the checksum type of @a cksum is a keyed checksum, @a key is used to verify * the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL, * the mandatory checksum type for @a key will be used. The actual checksum * key will be derived from @a key and @a usage if key derivation is specified * for the checksum type. * * @note This function is similar to krb5_c_verify_checksum(), but operates * on opaque @a key. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_verify_checksum(krb5_context context, krb5_key key, krb5_keyusage usage, const krb5_data *data, const krb5_checksum *cksum, krb5_boolean *valid); /** * Validate a checksum element in IOV array (operates on opaque key). * * @param [in] context Library context * @param [in] cksumtype Checksum type (0 for mandatory type) * @param [in] key Encryption key for a keyed checksum * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) * @param [in] data IOV array * @param [in] num_data Size of @a data * @param [out] valid Non-zero for success, zero for failure * * Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a * valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY * regions in the iov. * * @note This function is similar to krb5_c_verify_checksum_iov(), but operates * on opaque @a key. * * @sa krb5_k_make_checksum_iov() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, krb5_key key, krb5_keyusage usage, const krb5_crypto_iov *data, size_t num_data, krb5_boolean *valid); /** * Generate enctype-specific pseudo-random bytes (operates on opaque key). * * @param [in] context Library context * @param [in] key Key * @param [in] input Input data * @param [out] output Output data * * This function selects a pseudo-random function based on @a key and * computes its value over @a input, placing the result into @a output. * The caller must preinitialize @a output and allocate space for the * result. * * @note This function is similar to krb5_c_prf(), but operates * on opaque @a key. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_k_prf(krb5_context context, krb5_key key, krb5_data *input, krb5_data *output); #ifdef KRB5_OLD_CRYPTO /* * old cryptosystem routine prototypes. These are now layered * on top of the functions above. */ /** @deprecated Replaced by krb5_c_* API family.*/ krb5_error_code KRB5_CALLCONV krb5_encrypt(krb5_context context, krb5_const_pointer inptr, krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock, krb5_pointer ivec); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_decrypt(krb5_context context, krb5_const_pointer inptr, krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock, krb5_pointer ivec); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_process_key(krb5_context context, krb5_encrypt_block *eblock, const krb5_keyblock * key); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_finish_key(krb5_context context, krb5_encrypt_block * eblock); /** @deprecated See krb5_c_string_to_key() */ krb5_error_code KRB5_CALLCONV krb5_string_to_key(krb5_context context, const krb5_encrypt_block *eblock, krb5_keyblock * keyblock, const krb5_data *data, const krb5_data *salt); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_init_random_key(krb5_context context, const krb5_encrypt_block *eblock, const krb5_keyblock *keyblock, krb5_pointer *ptr); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_finish_random_key(krb5_context context, const krb5_encrypt_block *eblock, krb5_pointer *ptr); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_random_key(krb5_context context, const krb5_encrypt_block *eblock, krb5_pointer ptr, krb5_keyblock **keyblock); /** @deprecated Replaced by krb5_c_* API family. */ krb5_enctype KRB5_CALLCONV krb5_eblock_enctype(krb5_context context, const krb5_encrypt_block *eblock); /** @deprecated Replaced by krb5_c_* API family. */ krb5_error_code KRB5_CALLCONV krb5_use_enctype(krb5_context context, krb5_encrypt_block *eblock, krb5_enctype enctype); /** @deprecated Replaced by krb5_c_* API family. */ size_t KRB5_CALLCONV krb5_encrypt_size(size_t length, krb5_enctype crypto); /** @deprecated See krb5_c_checksum_length() */ size_t KRB5_CALLCONV krb5_checksum_size(krb5_context context, krb5_cksumtype ctype); /** @deprecated See krb5_c_make_checksum() */ krb5_error_code KRB5_CALLCONV krb5_calculate_checksum(krb5_context context, krb5_cksumtype ctype, krb5_const_pointer in, size_t in_length, krb5_const_pointer seed, size_t seed_length, krb5_checksum * outcksum); /** @deprecated See krb5_c_verify_checksum() */ krb5_error_code KRB5_CALLCONV krb5_verify_checksum(krb5_context context, krb5_cksumtype ctype, const krb5_checksum * cksum, krb5_const_pointer in, size_t in_length, krb5_const_pointer seed, size_t seed_length); #endif /* KRB5_OLD_CRYPTO */ /* * end "encryption.h" */ /* * begin "fieldbits.h" */ /* kdc_options for kdc_request */ /* options is 32 bits; each host is responsible to put the 4 bytes representing these bits into net order before transmission */ /* #define KDC_OPT_RESERVED 0x80000000 */ #define KDC_OPT_FORWARDABLE 0x40000000 #define KDC_OPT_FORWARDED 0x20000000 #define KDC_OPT_PROXIABLE 0x10000000 #define KDC_OPT_PROXY 0x08000000 #define KDC_OPT_ALLOW_POSTDATE 0x04000000 #define KDC_OPT_POSTDATED 0x02000000 /* #define KDC_OPT_UNUSED 0x01000000 */ #define KDC_OPT_RENEWABLE 0x00800000 /* #define KDC_OPT_UNUSED 0x00400000 */ /* #define KDC_OPT_RESERVED 0x00200000 */ /* #define KDC_OPT_RESERVED 0x00100000 */ /* #define KDC_OPT_RESERVED 0x00080000 */ /* #define KDC_OPT_RESERVED 0x00040000 */ #define KDC_OPT_CNAME_IN_ADDL_TKT 0x00020000 #define KDC_OPT_CANONICALIZE 0x00010000 #define KDC_OPT_REQUEST_ANONYMOUS 0x00008000 /* #define KDC_OPT_RESERVED 0x00004000 */ /* #define KDC_OPT_RESERVED 0x00002000 */ /* #define KDC_OPT_RESERVED 0x00001000 */ /* #define KDC_OPT_RESERVED 0x00000800 */ /* #define KDC_OPT_RESERVED 0x00000400 */ /* #define KDC_OPT_RESERVED 0x00000200 */ /* #define KDC_OPT_RESERVED 0x00000100 */ /* #define KDC_OPT_RESERVED 0x00000080 */ /* #define KDC_OPT_RESERVED 0x00000040 */ #define KDC_OPT_DISABLE_TRANSITED_CHECK 0x00000020 #define KDC_OPT_RENEWABLE_OK 0x00000010 #define KDC_OPT_ENC_TKT_IN_SKEY 0x00000008 /* #define KDC_OPT_UNUSED 0x00000004 */ #define KDC_OPT_RENEW 0x00000002 #define KDC_OPT_VALIDATE 0x00000001 /* * Mask of ticket flags in the TGT which should be converted into KDC * options when using the TGT to get derivative tickets. * * New mask = KDC_OPT_FORWARDABLE | KDC_OPT_PROXIABLE | * KDC_OPT_ALLOW_POSTDATE | KDC_OPT_RENEWABLE */ #define KDC_TKT_COMMON_MASK 0x54800000 /* definitions for ap_options fields */ /** @defgroup AP_OPTS AP_OPTS * * ap_options are 32 bits; each host is responsible to put the 4 bytes * representing these bits into net order before transmission * @{ */ #define AP_OPTS_RESERVED 0x80000000 #define AP_OPTS_USE_SESSION_KEY 0x40000000 /**< Use session key */ #define AP_OPTS_MUTUAL_REQUIRED 0x20000000 /**< Perform a mutual authentication exchange */ #define AP_OPTS_ETYPE_NEGOTIATION 0x00000002 #define AP_OPTS_USE_SUBKEY 0x00000001 /**< Generate a subsession key from the current session key obtained from the credentials */ /* #define AP_OPTS_RESERVED 0x10000000 */ /* #define AP_OPTS_RESERVED 0x08000000 */ /* #define AP_OPTS_RESERVED 0x04000000 */ /* #define AP_OPTS_RESERVED 0x02000000 */ /* #define AP_OPTS_RESERVED 0x01000000 */ /* #define AP_OPTS_RESERVED 0x00800000 */ /* #define AP_OPTS_RESERVED 0x00400000 */ /* #define AP_OPTS_RESERVED 0x00200000 */ /* #define AP_OPTS_RESERVED 0x00100000 */ /* #define AP_OPTS_RESERVED 0x00080000 */ /* #define AP_OPTS_RESERVED 0x00040000 */ /* #define AP_OPTS_RESERVED 0x00020000 */ /* #define AP_OPTS_RESERVED 0x00010000 */ /* #define AP_OPTS_RESERVED 0x00008000 */ /* #define AP_OPTS_RESERVED 0x00004000 */ /* #define AP_OPTS_RESERVED 0x00002000 */ /* #define AP_OPTS_RESERVED 0x00001000 */ /* #define AP_OPTS_RESERVED 0x00000800 */ /* #define AP_OPTS_RESERVED 0x00000400 */ /* #define AP_OPTS_RESERVED 0x00000200 */ /* #define AP_OPTS_RESERVED 0x00000100 */ /* #define AP_OPTS_RESERVED 0x00000080 */ /* #define AP_OPTS_RESERVED 0x00000040 */ /* #define AP_OPTS_RESERVED 0x00000020 */ /* #define AP_OPTS_RESERVED 0x00000010 */ /* #define AP_OPTS_RESERVED 0x00000008 */ /* #define AP_OPTS_RESERVED 0x00000004 */ #define AP_OPTS_WIRE_MASK 0xfffffff0 /** @} */ /* end of AP_OPTS group */ /* definitions for ad_type fields. */ #define AD_TYPE_RESERVED 0x8000 #define AD_TYPE_EXTERNAL 0x4000 #define AD_TYPE_REGISTERED 0x2000 #define AD_TYPE_FIELD_TYPE_MASK 0x1fff /* Ticket flags */ /* flags are 32 bits; each host is responsible to put the 4 bytes representing these bits into net order before transmission */ /* #define TKT_FLG_RESERVED 0x80000000 */ #define TKT_FLG_FORWARDABLE 0x40000000 #define TKT_FLG_FORWARDED 0x20000000 #define TKT_FLG_PROXIABLE 0x10000000 #define TKT_FLG_PROXY 0x08000000 #define TKT_FLG_MAY_POSTDATE 0x04000000 #define TKT_FLG_POSTDATED 0x02000000 #define TKT_FLG_INVALID 0x01000000 #define TKT_FLG_RENEWABLE 0x00800000 #define TKT_FLG_INITIAL 0x00400000 #define TKT_FLG_PRE_AUTH 0x00200000 #define TKT_FLG_HW_AUTH 0x00100000 #define TKT_FLG_TRANSIT_POLICY_CHECKED 0x00080000 #define TKT_FLG_OK_AS_DELEGATE 0x00040000 #define TKT_FLG_ENC_PA_REP 0x00010000 #define TKT_FLG_ANONYMOUS 0x00008000 /* #define TKT_FLG_RESERVED 0x00004000 */ /* #define TKT_FLG_RESERVED 0x00002000 */ /* #define TKT_FLG_RESERVED 0x00001000 */ /* #define TKT_FLG_RESERVED 0x00000800 */ /* #define TKT_FLG_RESERVED 0x00000400 */ /* #define TKT_FLG_RESERVED 0x00000200 */ /* #define TKT_FLG_RESERVED 0x00000100 */ /* #define TKT_FLG_RESERVED 0x00000080 */ /* #define TKT_FLG_RESERVED 0x00000040 */ /* #define TKT_FLG_RESERVED 0x00000020 */ /* #define TKT_FLG_RESERVED 0x00000010 */ /* #define TKT_FLG_RESERVED 0x00000008 */ /* #define TKT_FLG_RESERVED 0x00000004 */ /* #define TKT_FLG_RESERVED 0x00000002 */ /* #define TKT_FLG_RESERVED 0x00000001 */ /* definitions for lr_type fields. */ #define LR_TYPE_THIS_SERVER_ONLY 0x8000 #define LR_TYPE_INTERPRETATION_MASK 0x7fff /* definitions for msec direction bit for KRB_SAFE, KRB_PRIV */ #define MSEC_DIRBIT 0x8000 #define MSEC_VAL_MASK 0x7fff /* * end "fieldbits.h" */ /* * begin "proto.h" */ /** Protocol version number */ #define KRB5_PVNO 5 /* Message types */ #define KRB5_AS_REQ ((krb5_msgtype)10) /**< Initial authentication request */ #define KRB5_AS_REP ((krb5_msgtype)11) /**< Response to AS request */ #define KRB5_TGS_REQ ((krb5_msgtype)12) /**< Ticket granting server request */ #define KRB5_TGS_REP ((krb5_msgtype)13) /**< Response to TGS request */ #define KRB5_AP_REQ ((krb5_msgtype)14) /**< Auth req to application server */ #define KRB5_AP_REP ((krb5_msgtype)15) /**< Response to mutual AP request */ #define KRB5_SAFE ((krb5_msgtype)20) /**< Safe application message */ #define KRB5_PRIV ((krb5_msgtype)21) /**< Private application message */ #define KRB5_CRED ((krb5_msgtype)22) /**< Cred forwarding message */ #define KRB5_ERROR ((krb5_msgtype)30) /**< Error response */ /* LastReq types */ #define KRB5_LRQ_NONE 0 #define KRB5_LRQ_ALL_LAST_TGT 1 #define KRB5_LRQ_ONE_LAST_TGT (-1) #define KRB5_LRQ_ALL_LAST_INITIAL 2 #define KRB5_LRQ_ONE_LAST_INITIAL (-2) #define KRB5_LRQ_ALL_LAST_TGT_ISSUED 3 #define KRB5_LRQ_ONE_LAST_TGT_ISSUED (-3) #define KRB5_LRQ_ALL_LAST_RENEWAL 4 #define KRB5_LRQ_ONE_LAST_RENEWAL (-4) #define KRB5_LRQ_ALL_LAST_REQ 5 #define KRB5_LRQ_ONE_LAST_REQ (-5) #define KRB5_LRQ_ALL_PW_EXPTIME 6 #define KRB5_LRQ_ONE_PW_EXPTIME (-6) #define KRB5_LRQ_ALL_ACCT_EXPTIME 7 #define KRB5_LRQ_ONE_ACCT_EXPTIME (-7) /* PADATA types */ #define KRB5_PADATA_NONE 0 #define KRB5_PADATA_AP_REQ 1 #define KRB5_PADATA_TGS_REQ KRB5_PADATA_AP_REQ #define KRB5_PADATA_ENC_TIMESTAMP 2 /**< RFC 4120 */ #define KRB5_PADATA_PW_SALT 3 /**< RFC 4120 */ #if 0 /* Not used */ #define KRB5_PADATA_ENC_ENCKEY 4 /* Key encrypted within itself */ #endif #define KRB5_PADATA_ENC_UNIX_TIME 5 /**< timestamp encrypted in key. RFC 4120 */ #define KRB5_PADATA_ENC_SANDIA_SECURID 6 /**< SecurId passcode. RFC 4120 */ #define KRB5_PADATA_SESAME 7 /**< Sesame project. RFC 4120 */ #define KRB5_PADATA_OSF_DCE 8 /**< OSF DCE. RFC 4120 */ #define KRB5_CYBERSAFE_SECUREID 9 /**< Cybersafe. RFC 4120 */ #define KRB5_PADATA_AFS3_SALT 10 /**< Cygnus. RFC 4120, 3961 */ #define KRB5_PADATA_ETYPE_INFO 11 /**< Etype info for preauth. RFC 4120 */ #define KRB5_PADATA_SAM_CHALLENGE 12 /**< SAM/OTP */ #define KRB5_PADATA_SAM_RESPONSE 13 /**< SAM/OTP */ #define KRB5_PADATA_PK_AS_REQ_OLD 14 /**< PKINIT */ #define KRB5_PADATA_PK_AS_REP_OLD 15 /**< PKINIT */ #define KRB5_PADATA_PK_AS_REQ 16 /**< PKINIT. RFC 4556 */ #define KRB5_PADATA_PK_AS_REP 17 /**< PKINIT. RFC 4556 */ #define KRB5_PADATA_ETYPE_INFO2 19 /**< RFC 4120 */ #define KRB5_PADATA_USE_SPECIFIED_KVNO 20 /**< RFC 4120 */ #define KRB5_PADATA_SVR_REFERRAL_INFO 20 /**< Windows 2000 referrals. RFC 6820 */ #define KRB5_PADATA_SAM_REDIRECT 21 /**< SAM/OTP. RFC 4120 */ #define KRB5_PADATA_GET_FROM_TYPED_DATA 22 /**< Embedded in typed data. RFC 4120 */ #define KRB5_PADATA_REFERRAL 25 /**< draft referral system */ #define KRB5_PADATA_SAM_CHALLENGE_2 30 /**< draft challenge system, updated */ #define KRB5_PADATA_SAM_RESPONSE_2 31 /**< draft challenge system, updated */ /* MS-KILE */ #define KRB5_PADATA_PAC_REQUEST 128 /**< include Windows PAC */ #define KRB5_PADATA_FOR_USER 129 /**< username protocol transition request */ #define KRB5_PADATA_S4U_X509_USER 130 /**< certificate protocol transition request */ #define KRB5_PADATA_AS_CHECKSUM 132 /**< AS checksum */ #define KRB5_PADATA_FX_COOKIE 133 /**< RFC 6113 */ #define KRB5_PADATA_FX_FAST 136 /**< RFC 6113 */ #define KRB5_PADATA_FX_ERROR 137 /**< RFC 6113 */ #define KRB5_PADATA_ENCRYPTED_CHALLENGE 138 /**< RFC 6113 */ #define KRB5_PADATA_OTP_CHALLENGE 141 /**< RFC 6560 section 4.1 */ #define KRB5_PADATA_OTP_REQUEST 142 /**< RFC 6560 section 4.2 */ #define KRB5_PADATA_OTP_PIN_CHANGE 144 /**< RFC 6560 section 4.3 */ #define KRB5_PADATA_PKINIT_KX 147 /**< RFC 6112 */ #define KRB5_ENCPADATA_REQ_ENC_PA_REP 149 /**< RFC 6806 */ #define KRB5_PADATA_AS_FRESHNESS 150 /**< RFC 8070 */ #define KRB5_PADATA_SPAKE 151 #define KRB5_PADATA_PAC_OPTIONS 167 /**< MS-KILE and MS-SFU */ #define KRB5_SAM_USE_SAD_AS_KEY 0x80000000 #define KRB5_SAM_SEND_ENCRYPTED_SAD 0x40000000 #define KRB5_SAM_MUST_PK_ENCRYPT_SAD 0x20000000 /**< currently must be zero */ /** Transited encoding types */ #define KRB5_DOMAIN_X500_COMPRESS 1 /** alternate authentication types */ #define KRB5_ALTAUTH_ATT_CHALLENGE_RESPONSE 64 /* authorization data types. See RFC 4120 section 5.2.6 */ /** @defgroup KRB5_AUTHDATA KRB5_AUTHDATA * @{ */ #define KRB5_AUTHDATA_IF_RELEVANT 1 #define KRB5_AUTHDATA_KDC_ISSUED 4 #define KRB5_AUTHDATA_AND_OR 5 #define KRB5_AUTHDATA_MANDATORY_FOR_KDC 8 #define KRB5_AUTHDATA_INITIAL_VERIFIED_CAS 9 #define KRB5_AUTHDATA_OSF_DCE 64 #define KRB5_AUTHDATA_SESAME 65 #define KRB5_AUTHDATA_CAMMAC 96 #define KRB5_AUTHDATA_WIN2K_PAC 128 #define KRB5_AUTHDATA_ETYPE_NEGOTIATION 129 /**< RFC 4537 */ #define KRB5_AUTHDATA_SIGNTICKET 512 /**< @deprecated use PAC */ #define KRB5_AUTHDATA_FX_ARMOR 71 #define KRB5_AUTHDATA_AUTH_INDICATOR 97 #define KRB5_AUTHDATA_AP_OPTIONS 143 /** @} */ /* end of KRB5_AUTHDATA group */ /* password change constants */ #define KRB5_KPASSWD_SUCCESS 0 /**< Success */ #define KRB5_KPASSWD_MALFORMED 1 /**< Malformed request */ #define KRB5_KPASSWD_HARDERROR 2 /**< Server error */ #define KRB5_KPASSWD_AUTHERROR 3 /**< Authentication error */ #define KRB5_KPASSWD_SOFTERROR 4 /**< Password change rejected */ /* These are Microsoft's extensions in RFC 3244, and it looks like they'll become standardized, possibly with other additions. */ #define KRB5_KPASSWD_ACCESSDENIED 5 /**< Not authorized */ #define KRB5_KPASSWD_BAD_VERSION 6 /**< Unknown RPC version */ /** The presented credentials were not obtained using a password directly */ #define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7 /* * end "proto.h" */ /* Time set */ /** Ticket start time, end time, and renewal duration. */ typedef struct _krb5_ticket_times { krb5_timestamp authtime; /**< Time at which KDC issued the initial ticket that corresponds to this ticket */ /* XXX ? should ktime in KDC_REP == authtime in ticket? otherwise client can't get this */ krb5_timestamp starttime; /**< optional in ticket, if not present, use @a authtime */ krb5_timestamp endtime; /**< Ticket expiration time */ krb5_timestamp renew_till; /**< Latest time at which renewal of ticket can be valid */ } krb5_ticket_times; /** Structure for auth data */ typedef struct _krb5_authdata { krb5_magic magic; krb5_authdatatype ad_type; /**< ADTYPE */ unsigned int length; /**< Length of data */ krb5_octet *contents; /**< Data */ } krb5_authdata; /** Structure for transited encoding */ typedef struct _krb5_transited { krb5_magic magic; krb5_octet tr_type; /**< Transited encoding type */ krb5_data tr_contents; /**< Contents */ } krb5_transited; /** Encrypted part of ticket. */ typedef struct _krb5_enc_tkt_part { krb5_magic magic; /* to-be-encrypted portion */ krb5_flags flags; /**< flags */ krb5_keyblock *session; /**< session key: includes enctype */ krb5_principal client; /**< client name/realm */ krb5_transited transited; /**< list of transited realms */ krb5_ticket_times times; /**< auth, start, end, renew_till */ krb5_address **caddrs; /**< array of ptrs to addresses */ krb5_authdata **authorization_data; /**< auth data */ } krb5_enc_tkt_part; /** * Ticket structure. * * The C representation of the ticket message, with a pointer to the * C representation of the encrypted part. */ typedef struct _krb5_ticket { krb5_magic magic; /* cleartext portion */ krb5_principal server; /**< server name/realm */ krb5_enc_data enc_part; /**< encryption type, kvno, encrypted encoding */ krb5_enc_tkt_part *enc_part2; /**< ptr to decrypted version, if available */ } krb5_ticket; /* the unencrypted version */ /** * Ticket authenticator. * * The C representation of an unencrypted authenticator. */ typedef struct _krb5_authenticator { krb5_magic magic; krb5_principal client; /**< client name/realm */ krb5_checksum *checksum; /**< checksum, includes type, optional */ krb5_int32 cusec; /**< client usec portion */ krb5_timestamp ctime; /**< client sec portion */ krb5_keyblock *subkey; /**< true session key, optional */ krb5_ui_4 seq_number; /**< sequence #, optional */ krb5_authdata **authorization_data; /**< authoriazation data */ } krb5_authenticator; /** Ticket authentication data. */ typedef struct _krb5_tkt_authent { krb5_magic magic; krb5_ticket *ticket; krb5_authenticator *authenticator; krb5_flags ap_options; } krb5_tkt_authent; /** Credentials structure including ticket, session key, and lifetime info. */ typedef struct _krb5_creds { krb5_magic magic; krb5_principal client; /**< client's principal identifier */ krb5_principal server; /**< server's principal identifier */ krb5_keyblock keyblock; /**< session encryption key info */ krb5_ticket_times times; /**< lifetime info */ krb5_boolean is_skey; /**< true if ticket is encrypted in another ticket's skey */ krb5_flags ticket_flags; /**< flags in ticket */ krb5_address **addresses; /**< addrs in ticket */ krb5_data ticket; /**< ticket string itself */ krb5_data second_ticket; /**< second ticket, if related to ticket (via DUPLICATE-SKEY or ENC-TKT-IN-SKEY) */ krb5_authdata **authdata; /**< authorization data */ } krb5_creds; /** Last request entry */ typedef struct _krb5_last_req_entry { krb5_magic magic; krb5_int32 lr_type; /**< LR type */ krb5_timestamp value; /**< Timestamp */ } krb5_last_req_entry; /** Pre-authentication data */ typedef struct _krb5_pa_data { krb5_magic magic; krb5_preauthtype pa_type; /**< Preauthentication data type */ unsigned int length; /**< Length of data */ krb5_octet *contents; /**< Data */ } krb5_pa_data; /* Don't use this; use krb5_pa_data instead. */ typedef struct _krb5_typed_data { krb5_magic magic; krb5_int32 type; unsigned int length; krb5_octet *data; } krb5_typed_data; /** C representation of KDC-REQ protocol message, including KDC-REQ-BODY */ typedef struct _krb5_kdc_req { krb5_magic magic; krb5_msgtype msg_type; /**< KRB5_AS_REQ or KRB5_TGS_REQ */ krb5_pa_data **padata; /**< Preauthentication data */ /* real body */ krb5_flags kdc_options; /**< Requested options */ krb5_principal client; /**< Client principal and realm */ krb5_principal server; /**< Server principal and realm */ krb5_timestamp from; /**< Requested start time */ krb5_timestamp till; /**< Requested end time */ krb5_timestamp rtime; /**< Requested renewable end time */ krb5_int32 nonce; /**< Nonce to match request and response */ int nktypes; /**< Number of enctypes */ krb5_enctype *ktype; /**< Requested enctypes */ krb5_address **addresses; /**< Requested addresses (optional) */ krb5_enc_data authorization_data; /**< Encrypted authz data (optional) */ krb5_authdata **unenc_authdata; /**< Unencrypted authz data */ krb5_ticket **second_ticket; /**< Second ticket array (optional) */ } krb5_kdc_req; /** * C representation of @c EncKDCRepPart protocol message. * * This is the cleartext message that is encrypted and inserted in @c KDC-REP. */ typedef struct _krb5_enc_kdc_rep_part { krb5_magic magic; /* encrypted part: */ krb5_msgtype msg_type; /**< krb5 message type */ krb5_keyblock *session; /**< Session key */ krb5_last_req_entry **last_req; /**< Array of pointers to entries */ krb5_int32 nonce; /**< Nonce from request */ krb5_timestamp key_exp; /**< Expiration date */ krb5_flags flags; /**< Ticket flags */ krb5_ticket_times times; /**< Lifetime info */ krb5_principal server; /**< Server's principal identifier */ krb5_address **caddrs; /**< Array of ptrs to addrs, optional */ krb5_pa_data **enc_padata; /**< Encrypted preauthentication data */ } krb5_enc_kdc_rep_part; /** Representation of the @c KDC-REP protocol message. */ typedef struct _krb5_kdc_rep { krb5_magic magic; /* cleartext part: */ krb5_msgtype msg_type; /**< KRB5_AS_REP or KRB5_KDC_REP */ krb5_pa_data **padata; /**< Preauthentication data from KDC */ krb5_principal client; /**< Client principal and realm */ krb5_ticket *ticket; /**< Ticket */ krb5_enc_data enc_part; /**< Encrypted part of reply */ krb5_enc_kdc_rep_part *enc_part2; /**< Unencrypted version, if available */ } krb5_kdc_rep; /** Error message structure */ typedef struct _krb5_error { krb5_magic magic; /* some of these may be meaningless in certain contexts */ krb5_timestamp ctime; /**< Client sec portion; optional */ krb5_int32 cusec; /**< Client usec portion; optional */ krb5_int32 susec; /**< Server usec portion */ krb5_timestamp stime; /**< Server sec portion */ krb5_ui_4 error; /**< Error code (protocol error #'s) */ krb5_principal client; /**< Client principal and realm */ krb5_principal server; /**< Server principal and realm */ krb5_data text; /**< Descriptive text */ krb5_data e_data; /**< Additional error-describing data */ } krb5_error; /** Authentication header. */ typedef struct _krb5_ap_req { krb5_magic magic; krb5_flags ap_options; /**< Requested options */ krb5_ticket *ticket; /**< Ticket */ krb5_enc_data authenticator; /**< Encrypted authenticator */ } krb5_ap_req; /** * C representaton of AP-REP message. * * The server's response to a client's request for mutual authentication. */ typedef struct _krb5_ap_rep { krb5_magic magic; krb5_enc_data enc_part; /**< Ciphertext of ApRepEncPart */ } krb5_ap_rep; /** Cleartext that is encrypted and put into @c _krb5_ap_rep. */ typedef struct _krb5_ap_rep_enc_part { krb5_magic magic; krb5_timestamp ctime; /**< Client time, seconds portion */ krb5_int32 cusec; /**< Client time, microseconds portion */ krb5_keyblock *subkey; /**< Subkey (optional) */ krb5_ui_4 seq_number; /**< Sequence number */ } krb5_ap_rep_enc_part; /* Unused */ typedef struct _krb5_response { krb5_magic magic; krb5_octet message_type; krb5_data response; krb5_int32 expected_nonce; krb5_timestamp request_time; } krb5_response; /** Credentials information inserted into @c EncKrbCredPart. */ typedef struct _krb5_cred_info { krb5_magic magic; krb5_keyblock *session; /**< Session key used to encrypt ticket */ krb5_principal client; /**< Client principal and realm */ krb5_principal server; /**< Server principal and realm */ krb5_flags flags; /**< Ticket flags */ krb5_ticket_times times; /**< Auth, start, end, renew_till */ krb5_address **caddrs; /**< Array of pointers to addrs (optional) */ } krb5_cred_info; /** Cleartext credentials information. */ typedef struct _krb5_cred_enc_part { krb5_magic magic; krb5_int32 nonce; /**< Nonce (optional) */ krb5_timestamp timestamp; /**< Generation time, seconds portion */ krb5_int32 usec; /**< Generation time, microseconds portion */ krb5_address *s_address; /**< Sender address (optional) */ krb5_address *r_address; /**< Recipient address (optional) */ krb5_cred_info **ticket_info; } krb5_cred_enc_part; /** Credentials data structure.*/ typedef struct _krb5_cred { krb5_magic magic; krb5_ticket **tickets; /**< Tickets */ krb5_enc_data enc_part; /**< Encrypted part */ krb5_cred_enc_part *enc_part2; /**< Unencrypted version, if available */ } krb5_cred; /* Unused, but here for API compatibility. */ typedef struct _passwd_phrase_element { krb5_magic magic; krb5_data *passwd; krb5_data *phrase; } passwd_phrase_element; /* Unused, but here for API compatibility. */ typedef struct _krb5_pwd_data { krb5_magic magic; int sequence_count; passwd_phrase_element **element; } krb5_pwd_data; /* Unused, but here for API compatibility. */ typedef struct _krb5_pa_svr_referral_data { /** Referred name, only realm is required */ krb5_principal principal; } krb5_pa_svr_referral_data; /* Unused, but here for API compatibility. */ typedef struct _krb5_pa_server_referral_data { krb5_data *referred_realm; krb5_principal true_principal_name; krb5_principal requested_principal_name; krb5_timestamp referral_valid_until; krb5_checksum rep_cksum; } krb5_pa_server_referral_data; typedef struct _krb5_pa_pac_req { /** TRUE if a PAC should be included in TGS-REP */ krb5_boolean include_pac; } krb5_pa_pac_req; /* * begin "safepriv.h" */ /** @defgroup KRB5_AUTH_CONTEXT KRB5_AUTH_CONTEXT * @{ */ /** Prevent replays with timestamps and replay cache. */ #define KRB5_AUTH_CONTEXT_DO_TIME 0x00000001 /** Save timestamps for application. */ #define KRB5_AUTH_CONTEXT_RET_TIME 0x00000002 /** Prevent replays with sequence numbers. */ #define KRB5_AUTH_CONTEXT_DO_SEQUENCE 0x00000004 /** Save sequence numbers for application. */ #define KRB5_AUTH_CONTEXT_RET_SEQUENCE 0x00000008 #define KRB5_AUTH_CONTEXT_PERMIT_ALL 0x00000010 #define KRB5_AUTH_CONTEXT_USE_SUBKEY 0x00000020 /** @} */ /* end of KRB5_AUTH_CONTEXT group */ /** * Replay data. * * Sequence number and timestamp information output by krb5_rd_priv() and * krb5_rd_safe(). */ typedef struct krb5_replay_data { krb5_timestamp timestamp; /**< Timestamp, seconds portion */ krb5_int32 usec; /**< Timestamp, microseconds portion */ krb5_ui_4 seq; /**< Sequence number */ } krb5_replay_data; /* Flags for krb5_auth_con_genaddrs(). */ /** Generate the local network address. */ #define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR 0x00000001 /** Generate the remote network address. */ #define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR 0x00000002 /** Generate the local network address and the local port. */ #define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR 0x00000004 /** Generate the remote network address and the remote port. */ #define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR 0x00000008 /** Type of function used as a callback to generate checksum data for mk_req */ typedef krb5_error_code (KRB5_CALLCONV * krb5_mk_req_checksum_func)(krb5_context, krb5_auth_context, void *, krb5_data **); /* * end "safepriv.h" */ /* * begin "ccache.h" */ /** Cursor for sequential lookup */ typedef krb5_pointer krb5_cc_cursor; struct _krb5_ccache; typedef struct _krb5_ccache *krb5_ccache; struct _krb5_cc_ops; typedef struct _krb5_cc_ops krb5_cc_ops; struct _krb5_cccol_cursor; /** Cursor for iterating over all ccaches */ typedef struct _krb5_cccol_cursor *krb5_cccol_cursor; /* Flags for krb5_cc_retrieve_cred. */ /** The requested lifetime must be at least as great as the time specified. */ #define KRB5_TC_MATCH_TIMES 0x00000001 /** The is_skey field must match exactly. */ #define KRB5_TC_MATCH_IS_SKEY 0x00000002 /** All the flags set in the match credentials must be set. */ #define KRB5_TC_MATCH_FLAGS 0x00000004 /** All the time fields must match exactly. */ #define KRB5_TC_MATCH_TIMES_EXACT 0x00000008 /** All the flags must match exactly. */ #define KRB5_TC_MATCH_FLAGS_EXACT 0x00000010 /** The authorization data must match. */ #define KRB5_TC_MATCH_AUTHDATA 0x00000020 /** Only the name portion of the principal name must match. */ #define KRB5_TC_MATCH_SRV_NAMEONLY 0x00000040 /** The second ticket must match. */ #define KRB5_TC_MATCH_2ND_TKT 0x00000080 /** The encryption key type must match. */ #define KRB5_TC_MATCH_KTYPE 0x00000100 /** The supported key types must match. */ #define KRB5_TC_SUPPORTED_KTYPES 0x00000200 /* Flags for krb5_cc_set_flags and similar. */ /** Open and close the file for each cache operation. */ #define KRB5_TC_OPENCLOSE 0x00000001 /**< @deprecated has no effect */ #define KRB5_TC_NOTICKET 0x00000002 /** * Retrieve the name, but not type of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * * @warning Returns the name of the credential cache. The result is an alias * into @a cache and should not be freed or modified by the caller. This name * does not include the cache type, so should not be used as input to * krb5_cc_resolve(). * * @return * On success - the name of the credential cache. */ const char * KRB5_CALLCONV krb5_cc_get_name(krb5_context context, krb5_ccache cache); /** * Retrieve the full name of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] fullname_out Full name of cache * * Use krb5_free_string() to free @a fullname_out when it is no longer needed. * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_cc_get_full_name(krb5_context context, krb5_ccache cache, char **fullname_out); #if KRB5_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_cc_gen_new(krb5_context context, krb5_ccache *cache); #endif /* KRB5_DEPRECATED */ /** * Initialize a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] principal Default principal name * * Destroy any existing contents of @a cache and initialize it for the default * principal @a principal. * * @retval * 0 Success * @return * System errors; Permission errors; Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_initialize(krb5_context context, krb5_ccache cache, krb5_principal principal); /** * Destroy a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * * This function destroys any existing contents of @a cache and closes the * handle to it. * * @retval * 0 Success * @return * Permission errors */ krb5_error_code KRB5_CALLCONV krb5_cc_destroy(krb5_context context, krb5_ccache cache); /** * Close a credential cache handle. * * @param [in] context Library context * @param [in] cache Credential cache handle * * This function closes a credential cache handle @a cache without affecting * the contents of the cache. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_close(krb5_context context, krb5_ccache cache); /** * Store credentials in a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] creds Credentials to be stored in cache * * This function stores @a creds into @a cache. If @a creds->server and the * server in the decoded ticket @a creds->ticket differ, the credentials will * be stored under both server principal names. * * @retval * 0 Success * @return Permission errors; storage failure errors; Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_store_cred(krb5_context context, krb5_ccache cache, krb5_creds *creds); /** * Retrieve a specified credentials from a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] flags Flags bit mask * @param [in] mcreds Credentials to match * @param [out] creds Credentials matching the requested value * * This function searches a credential cache for credentials matching @a mcreds * and returns it if found. * * Valid values for @a flags are: * * @li #KRB5_TC_MATCH_TIMES The requested lifetime must be at least as * great as in @a mcreds . * @li #KRB5_TC_MATCH_IS_SKEY The @a is_skey field much match exactly. * @li #KRB5_TC_MATCH_FLAGS Flags set in @a mcreds must be set. * @li #KRB5_TC_MATCH_TIMES_EXACT The requested lifetime must match exactly. * @li #KRB5_TC_MATCH_FLAGS_EXACT Flags must match exactly. * @li #KRB5_TC_MATCH_AUTHDATA The authorization data must match. * @li #KRB5_TC_MATCH_SRV_NAMEONLY Only the name portion of the principal * name must match, not the realm. * @li #KRB5_TC_MATCH_2ND_TKT The second tickets must match. * @li #KRB5_TC_MATCH_KTYPE The encryption key types must match. * @li #KRB5_TC_SUPPORTED_KTYPES Check all matching entries that have any * supported encryption type and return the * one with the encryption type listed earliest. * * Use krb5_free_cred_contents() to free @a creds when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_retrieve_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, krb5_creds *mcreds, krb5_creds *creds); /** * Get the default principal of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] principal Primary principal * * Returns the default client principal of a credential cache as set by * krb5_cc_initialize(). * * Use krb5_free_principal() to free @a principal when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_get_principal(krb5_context context, krb5_ccache cache, krb5_principal *principal); /** * Prepare to sequentially read every credential in a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] cursor Cursor * * krb5_cc_end_seq_get() must be called to complete the retrieve operation. * * @note If the cache represented by @a cache is modified between the time of * the call to this function and the time of the final krb5_cc_end_seq_get(), * these changes may not be reflected in the results of krb5_cc_next_cred() * calls. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_start_seq_get(krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor); /** * Retrieve the next entry from the credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] cursor Cursor * @param [out] creds Next credential cache entry * * This function fills in @a creds with the next entry in @a cache and advances * @a cursor. * * Use krb5_free_cred_contents() to free @a creds when it is no longer needed. * * @sa krb5_cc_start_seq_get(), krb5_end_seq_get() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_next_cred(krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor, krb5_creds *creds); /** * Finish a series of sequential processing credential cache entries. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] cursor Cursor * * This function finishes processing credential cache entries and invalidates * @a cursor. * * @sa krb5_cc_start_seq_get(), krb5_cc_next_cred() * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_cc_end_seq_get(krb5_context context, krb5_ccache cache, krb5_cc_cursor *cursor); /** * Remove credentials from a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] flags Bitwise-ORed search flags * @param [in] creds Credentials to be matched * * @warning This function is not implemented for some cache types. * * This function accepts the same flag values as krb5_cc_retrieve_cred(). * * @retval KRB5_CC_NOSUPP Not implemented for this cache type * @return No matches found; Data cannot be deleted; Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, krb5_creds *creds); /** * Set options flags on a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [in] flags Flag bit mask * * This function resets @a cache flags to @a flags. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_set_flags(krb5_context context, krb5_ccache cache, krb5_flags flags); /** * Retrieve flags from a credential cache structure. * * @param [in] context Library context * @param [in] cache Credential cache handle * @param [out] flags Flag bit mask * * @warning For memory credential cache always returns a flag mask of 0. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_get_flags(krb5_context context, krb5_ccache cache, krb5_flags *flags); /** * Retrieve the type of a credential cache. * * @param [in] context Library context * @param [in] cache Credential cache handle * * @return The type of a credential cache as an alias that must not be modified * or freed by the caller. */ const char * KRB5_CALLCONV krb5_cc_get_type(krb5_context context, krb5_ccache cache); /** * Move a credential cache. * * @param [in] context Library context * @param [in] src The credential cache to move the content from * @param [in] dst The credential cache to move the content to * * This function reinitializes @a dst and populates it with the credentials and * default principal of @a src; then, if successful, destroys @a src. * * @retval * 0 Success; @a src is closed. * @return * Kerberos error codes; @a src is still allocated. */ krb5_error_code KRB5_CALLCONV krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst); /** * Prepare to iterate over the collection of known credential caches. * * @param [in] context Library context * @param [out] cursor Cursor * * Get a new cache iteration @a cursor that will iterate over all known * credential caches independent of type. * * Use krb5_cccol_cursor_free() to release @a cursor when it is no longer * needed. * * @sa krb5_cccol_cursor_next() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor); /** * Get the next credential cache in the collection. * * @param [in] context Library context * @param [in] cursor Cursor * @param [out] ccache Credential cache handle * * @note When all caches are iterated over and the end of the list is reached, * @a ccache is set to NULL. * * Use krb5_cc_close() to close @a ccache when it is no longer needed. * * @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_free() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor, krb5_ccache *ccache); /** * Free a credential cache collection cursor. * * @param [in] context Library context * @param [in] cursor Cursor * * @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_next() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor); /** * Check if the credential cache collection contains any credentials. * * @param [in] context Library context * * @version New in 1.11 * * @retval 0 Credentials are available in the collection * @retval KRB5_CC_NOTFOUND The collection contains no credentials */ krb5_error_code KRB5_CALLCONV krb5_cccol_have_content(krb5_context context); /** * Create a new credential cache of the specified type with a unique name. * * @param [in] context Library context * @param [in] type Credential cache type name * @param [in] hint Unused * @param [out] id Credential cache handle * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_new_unique(krb5_context context, const char *type, const char *hint, krb5_ccache *id); /* * end "ccache.h" */ /* * begin "rcache.h" */ struct krb5_rc_st; typedef struct krb5_rc_st *krb5_rcache; /* * end "rcache.h" */ /* * begin "keytab.h" */ /* XXX */ #define MAX_KEYTAB_NAME_LEN 1100 /**< Long enough for MAXPATHLEN + some extra */ typedef krb5_pointer krb5_kt_cursor; /** A key table entry. */ typedef struct krb5_keytab_entry_st { krb5_magic magic; krb5_principal principal; /**< Principal of this key */ krb5_timestamp timestamp; /**< Time entry written to keytable */ krb5_kvno vno; /**< Key version number */ krb5_keyblock key; /**< The secret key */ } krb5_keytab_entry; struct _krb5_kt; typedef struct _krb5_kt *krb5_keytab; /** * Return the type of a key table. * * @param [in] context Library context * @param [in] keytab Key table handle * * @return The type of a key table as an alias that must not be modified or * freed by the caller. */ const char * KRB5_CALLCONV krb5_kt_get_type(krb5_context context, krb5_keytab keytab); /** * Get a key table name. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] name Key table name * @param [in] namelen Maximum length to fill in name * * Fill @a name with the name of @a keytab including the type and delimiter. * * @sa MAX_KEYTAB_NAME_LEN * * @retval * 0 Success * @retval * KRB5_KT_NAME_TOOLONG Key table name does not fit in @a namelen bytes * * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name, unsigned int namelen); /** * Close a key table handle. * * @param [in] context Library context * @param [in] keytab Key table handle * * @retval 0 */ krb5_error_code KRB5_CALLCONV krb5_kt_close(krb5_context context, krb5_keytab keytab); /** * Get an entry from a key table. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [in] principal Principal name * @param [in] vno Key version number (0 for highest available) * @param [in] enctype Encryption type (0 zero for any enctype) * @param [out] entry Returned entry from key table * * Retrieve an entry from a key table which matches the @a keytab, @a * principal, @a vno, and @a enctype. If @a vno is zero, retrieve the * highest-numbered kvno matching the other fields. If @a enctype is 0, match * any enctype. * * Use krb5_free_keytab_entry_contents() to free @a entry when it is no longer * needed. * * @note If @a vno is zero, the function retrieves the highest-numbered-kvno * entry that matches the specified principal. * * @retval * 0 Success * @retval * Kerberos error codes on failure */ krb5_error_code KRB5_CALLCONV krb5_kt_get_entry(krb5_context context, krb5_keytab keytab, krb5_const_principal principal, krb5_kvno vno, krb5_enctype enctype, krb5_keytab_entry *entry); /** * Start a sequential retrieval of key table entries. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] cursor Cursor * * Prepare to read sequentially every key in the specified key table. Use * krb5_kt_end_seq_get() to release the cursor when it is no longer needed. * * @sa krb5_kt_next_entry(), krb5_kt_end_seq_get() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_start_seq_get(krb5_context context, krb5_keytab keytab, krb5_kt_cursor *cursor); /** * Retrieve the next entry from the key table. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] entry Returned key table entry * @param [in] cursor Key table cursor * * Return the next sequential entry in @a keytab and advance @a cursor. * Callers must release the returned entry with krb5_kt_free_entry(). * * @sa krb5_kt_start_seq_get(), krb5_kt_end_seq_get() * * @retval * 0 Success * @retval * KRB5_KT_END - if the last entry was reached * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_next_entry(krb5_context context, krb5_keytab keytab, krb5_keytab_entry *entry, krb5_kt_cursor *cursor); /** * Release a keytab cursor. * * @param [in] context Library context * @param [in] keytab Key table handle * @param [out] cursor Cursor * * This function should be called to release the cursor created by * krb5_kt_start_seq_get(). * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_end_seq_get(krb5_context context, krb5_keytab keytab, krb5_kt_cursor *cursor); /** * Check if a keytab exists and contains entries. * * @param [in] context Library context * @param [in] keytab Key table handle * * @version New in 1.11 * * @retval 0 Keytab exists and contains entries * @retval KRB5_KT_NOTFOUND Keytab does not contain entries */ krb5_error_code KRB5_CALLCONV krb5_kt_have_content(krb5_context context, krb5_keytab keytab); /* * end "keytab.h" */ /* * begin "func-proto.h" */ #define KRB5_INIT_CONTEXT_SECURE 0x1 /**< Use secure context configuration */ #define KRB5_INIT_CONTEXT_KDC 0x2 /**< Use KDC configuration if available */ /** * Create a krb5 library context. * * @param [out] context Library context * * The @a context must be released by calling krb5_free_context() when * it is no longer needed. * * @warning Any program or module that needs the Kerberos code to not trust the * environment must use krb5_init_secure_context(), or clean out the * environment. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_context(krb5_context *context); /** * Create a krb5 library context using only configuration files. * * @param [out] context Library context * * Create a context structure, using only system configuration files. All * information passed through the environment variables is ignored. * * The @a context must be released by calling krb5_free_context() when * it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_secure_context(krb5_context *context); /** * Create a krb5 library context using a specified profile. * * @param [in] profile Profile object (NULL to create default profile) * @param [in] flags Context initialization flags * @param [out] context Library context * * Create a context structure, optionally using a specified profile and * initialization flags. If @a profile is NULL, the default profile will be * created from config files. If @a profile is non-null, a copy of it will be * made for the new context; the caller should still clean up its copy. Valid * flag values are: * * @li #KRB5_INIT_CONTEXT_SECURE Ignore environment variables * @li #KRB5_INIT_CONTEXT_KDC Use KDC configuration if creating profile */ krb5_error_code KRB5_CALLCONV krb5_init_context_profile(struct _profile_t *profile, krb5_flags flags, krb5_context *context); /** * Free a krb5 library context. * * @param [in] context Library context * * This function frees a @a context that was created by krb5_init_context() * or krb5_init_secure_context(). */ void KRB5_CALLCONV krb5_free_context(krb5_context context); /** * Copy a krb5_context structure. * * @param [in] ctx Library context * @param [out] nctx_out New context structure * * The newly created context must be released by calling krb5_free_context() * when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_context(krb5_context ctx, krb5_context *nctx_out); /** * Set default TGS encryption types in a krb5_context structure. * * @param [in] context Library context * @param [in] etypes Encryption type(s) to set * * This function sets the default enctype list for TGS requests * made using @a context to @a etypes. * * @note This overrides the default list (from config file or built-in). * * @retval * 0 Success * @retval * KRB5_PROG_ETYPE_NOSUPP Program lacks support for encryption type * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_default_tgs_enctypes(krb5_context context, const krb5_enctype *etypes); /** * Return a list of encryption types permitted for session keys. * * @param [in] context Library context * @param [out] ktypes Zero-terminated list of encryption types * * This function returns the list of encryption types permitted for session * keys within @a context, as determined by configuration or by a previous call * to krb5_set_default_tgs_enctypes(). * * Use krb5_free_enctypes() to free @a ktypes when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_permitted_enctypes(krb5_context context, krb5_enctype **ktypes); /** * Test whether the Kerberos library was built with multithread support. * * @retval * TRUE if the library is threadsafe; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_is_thread_safe(void); /* libkrb.spec */ /** * Decrypt a ticket using the specified key table. * * @param [in] context Library context * @param [in] kt Key table * @param [in] ticket Ticket to be decrypted * * This function takes a @a ticket as input and decrypts it using * key data from @a kt. The result is placed into @a ticket->enc_part2. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_server_decrypt_ticket_keytab(krb5_context context, const krb5_keytab kt, krb5_ticket *ticket); /** * Free an array of credential structures. * * @param [in] context Library context * @param [in] tgts Null-terminated array of credentials to free * * @note The last entry in the array @a tgts must be a NULL pointer. */ void KRB5_CALLCONV krb5_free_tgt_creds(krb5_context context, krb5_creds **tgts); /** @defgroup KRB5_GC KRB5_GC * @{ */ #define KRB5_GC_USER_USER 1 /**< Want user-user ticket */ #define KRB5_GC_CACHED 2 /**< Want cached ticket only */ #define KRB5_GC_CANONICALIZE 4 /**< Set canonicalize KDC option */ #define KRB5_GC_NO_STORE 8 /**< Do not store in credential cache */ #define KRB5_GC_FORWARDABLE 16 /**< Acquire forwardable tickets */ #define KRB5_GC_NO_TRANSIT_CHECK 32 /**< Disable transited check */ #define KRB5_GC_CONSTRAINED_DELEGATION 64 /**< Constrained delegation */ /** @} */ /* end of KRB5_GC group */ /** * Get an additional ticket. * * @param [in] context Library context * @param [in] options Options * @param [in] ccache Credential cache handle * @param [in] in_creds Input credentials * @param [out] out_creds Output updated credentials * * Use @a ccache or a TGS exchange to get a service ticket matching @a * in_creds. * * Valid values for @a options are: * @li #KRB5_GC_CACHED Search only credential cache for the ticket * @li #KRB5_GC_USER_USER Return a user to user authentication ticket * * @a in_creds must be non-null. @a in_creds->client and @a in_creds->server * must be filled in to specify the client and the server respectively. If any * authorization data needs to be requested for the service ticket (such as * restrictions on how the ticket can be used), specify it in @a * in_creds->authdata; otherwise set @a in_creds->authdata to NULL. The * session key type is specified in @a in_creds->keyblock.enctype, if it is * nonzero. * * The expiration date is specified in @a in_creds->times.endtime. * The KDC may return tickets with an earlier expiration date. * If @a in_creds->times.endtime is set to 0, the latest possible * expiration date will be requested. * * Any returned ticket and intermediate ticket-granting tickets are stored * in @a ccache. * * Use krb5_free_creds() to free @a out_creds when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_credentials(krb5_context context, krb5_flags options, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds); /** * Serialize a @c krb5_creds object. * * @param [in] context Library context * @param [in] creds The credentials object to serialize * @param [out] data_out The serialized credentials * * Serialize @a creds in the format used by the FILE ccache format (vesion 4) * and KCM ccache protocol. * * Use krb5_free_data() to free @a data_out when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_marshal_credentials(krb5_context context, krb5_creds *in_creds, krb5_data **data_out); /** * Deserialize a @c krb5_creds object. * * @param [in] context Library context * @param [in] data The serialized credentials * @param [out] creds_out The resulting creds object * * Deserialize @a data to credentials in the format used by the FILE ccache * format (vesion 4) and KCM ccache protocol. * * Use krb5_free_creds() to free @a creds_out when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_unmarshal_credentials(krb5_context context, const krb5_data *data, krb5_creds **creds_out); /** @deprecated Replaced by krb5_get_validated_creds. */ krb5_error_code KRB5_CALLCONV krb5_get_credentials_validate(krb5_context context, krb5_flags options, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds); /** @deprecated Replaced by krb5_get_renewed_creds. */ krb5_error_code KRB5_CALLCONV krb5_get_credentials_renew(krb5_context context, krb5_flags options, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds); /** * Create a @c KRB_AP_REQ message. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] ap_req_options @ref AP_OPTS options * @param [in] service Service name, or NULL to use @c "host" * @param [in] hostname Host name, or NULL to use local hostname * @param [in] in_data Application data to be checksummed in the * authenticator, or NULL * @param [in] ccache Credential cache used to obtain credentials * for the desired service. * @param [out] outbuf @c AP-REQ message * * This function is similar to krb5_mk_req_extended() except that it uses a * given @a hostname, @a service, and @a ccache to construct a service * principal name and obtain credentials. * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_req(krb5_context context, krb5_auth_context *auth_context, krb5_flags ap_req_options, const char *service, const char *hostname, krb5_data *in_data, krb5_ccache ccache, krb5_data *outbuf); /** * Create a @c KRB_AP_REQ message using supplied credentials. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] ap_req_options @ref AP_OPTS options * @param [in] in_data Application data to be checksummed in the * authenticator, or NULL * @param [in] in_creds Credentials for the service with valid ticket * and key * @param [out] outbuf @c AP-REQ message * * Valid @a ap_req_options are: * @li #AP_OPTS_USE_SESSION_KEY - Use the session key when creating the * request used for user to user * authentication. * @li #AP_OPTS_MUTUAL_REQUIRED - Request a mutual authentication packet from * the receiver. * @li #AP_OPTS_USE_SUBKEY - Generate a subsession key from the current * session key obtained from the credentials. * * This function creates a KRB_AP_REQ message using supplied credentials @a * in_creds. @a auth_context may point to an existing auth context or to NULL, * in which case a new one will be created. If @a in_data is non-null, a * checksum of it will be included in the authenticator contained in the * KRB_AP_REQ message. Use krb5_free_data_contents() to free @a outbuf when it * is no longer needed. * * On successful return, the authenticator is stored in @a auth_context with * the @a client and @a checksum fields nulled out. (This is to prevent * pointer-sharing problems; the caller should not need these fields anyway, * since the caller supplied them.) * * @sa krb5_mk_req() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_req_extended(krb5_context context, krb5_auth_context *auth_context, krb5_flags ap_req_options, krb5_data *in_data, krb5_creds *in_creds, krb5_data *outbuf); /** * Format and encrypt a @c KRB_AP_REP message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] outbuf @c AP-REP message * * This function fills in @a outbuf with an AP-REP message using information * from @a auth_context. * * If the flags in @a auth_context indicate that a sequence number should be * used (either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or * #KRB5_AUTH_CONTEXT_RET_SEQUENCE) and the local sequence number in @a * auth_context is 0, a new number will be generated with * krb5_generate_seq_number(). * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_rep(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf); /** * Format and encrypt a @c KRB_AP_REP message for DCE RPC. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] outbuf @c AP-REP message * * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_rep_dce(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf); /** * Parse and decrypt a @c KRB_AP_REP message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] inbuf AP-REP message * @param [out] repl Decrypted reply message * * This function parses, decrypts and verifies a message from @a inbuf and * fills in @a repl with a pointer to allocated memory containing the fields * from the encrypted response. * * Use krb5_free_ap_rep_enc_part() to free @a repl when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_rep(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_ap_rep_enc_part **repl); /** * Parse and decrypt a @c KRB_AP_REP message for DCE RPC. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] inbuf AP-REP message * @param [out] nonce Sequence number from the decrypted reply * * This function parses, decrypts and verifies a message from @a inbuf and * fills in @a nonce with a decrypted reply sequence number. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_rep_dce(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_ui_4 *nonce); /** * Format and encode a @c KRB_ERROR message. * * @param [in] context Library context * @param [in] dec_err Error structure to be encoded * @param [out] enc_err Encoded error structure * * This function creates a @c KRB_ERROR message in @a enc_err. Use * krb5_free_data_contents() to free @a enc_err when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_error(krb5_context context, const krb5_error *dec_err, krb5_data *enc_err); /** * Decode a @c KRB-ERROR message. * * @param [in] context Library context * @param [in] enc_errbuf Encoded error message * @param [out] dec_error Decoded error message * * This function processes @c KRB-ERROR message @a enc_errbuf and returns * an allocated structure @a dec_error containing the error message. * Use krb5_free_error() to free @a dec_error when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_error(krb5_context context, const krb5_data *enc_errbuf, krb5_error **dec_error); /** * Process @c KRB-SAFE message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] inbuf @c KRB-SAFE message to be parsed * @param [out] userdata_out Data parsed from @c KRB-SAFE message * @param [out] rdata_out Replay data. Specify NULL if not needed * * This function parses a @c KRB-SAFE message, verifies its integrity, and * stores its data into @a userdata_out. * * @note The @a rdata_out argument is required if the * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set * in @a auth_context. * * If @a auth_context has a remote address set, the address will be used to * verify the sender address in the KRB-SAFE message. If @a auth_context has a * local address set, it will be used to verify the receiver address in the * KRB-SAFE message if the message contains one. * * If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the * sequence number of the KRB-SAFE message is checked against the remote * sequence number field of @a auth_context. Otherwise, the sequence number is * not used. * * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, then the * timestamp in the message is verified to be within the permitted clock skew * of the current time, and the message is checked against an in-memory replay * cache to detect reflections or replays. * * Use krb5_free_data_contents() to free @a userdata_out when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_safe(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_data *userdata_out, krb5_replay_data *rdata_out); /** * Process a @c KRB-PRIV message. * * @param [in] context Library context * @param [in] auth_context Authentication structure * @param [in] inbuf @c KRB-PRIV message to be parsed * @param [out] userdata_out Data parsed from @c KRB-PRIV message * @param [out] rdata_out Replay data. Specify NULL if not needed * * This function parses a @c KRB-PRIV message, verifies its integrity, and * stores its unencrypted data into @a userdata_out. * * @note The @a rdata_out argument is required if the * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set * in @a auth_context. * * If @a auth_context has a remote address set, the address will be used to * verify the sender address in the KRB-PRIV message. If @a auth_context has a * local address set, it will be used to verify the receiver address in the * KRB-PRIV message if the message contains one. * * If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the * sequence number of the KRB-PRIV message is checked against the remote * sequence number field of @a auth_context. Otherwise, the sequence number is * not used. * * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, then the * timestamp in the message is verified to be within the permitted clock skew * of the current time, and the message is checked against an in-memory replay * cache to detect reflections or replays. * * Use krb5_free_data_contents() to free @a userdata_out when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_priv(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, krb5_data *userdata_out, krb5_replay_data *rdata_out); /** * Convert a string principal name to a krb5_principal structure. * * @param [in] context Library context * @param [in] name String representation of a principal name * @param [out] principal_out New principal * * Convert a string representation of a principal name to a krb5_principal * structure. * * A string representation of a Kerberos name consists of one or more principal * name components, separated by slashes, optionally followed by the \@ * character and a realm name. If the realm name is not specified, the local * realm is used. * * To use the slash and \@ symbols as part of a component (quoted) instead of * using them as a component separator or as a realm prefix), put a backslash * (\) character in front of the symbol. Similarly, newline, tab, backspace, * and NULL characters can be included in a component by using @c n, @c t, @c b * or @c 0, respectively. * * @note The realm in a Kerberos @a name cannot contain slash, colon, * or NULL characters. * * Use krb5_free_principal() to free @a principal_out when it is no longer * needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_parse_name(krb5_context context, const char *name, krb5_principal *principal_out); #define KRB5_PRINCIPAL_PARSE_NO_REALM 0x1 /**< Error if realm is present */ #define KRB5_PRINCIPAL_PARSE_REQUIRE_REALM 0x2 /**< Error if realm is not present */ #define KRB5_PRINCIPAL_PARSE_ENTERPRISE 0x4 /**< Create single-component enterprise principle */ #define KRB5_PRINCIPAL_PARSE_IGNORE_REALM 0x8 /**< Ignore realm if present */ /** * Convert a string principal name to a krb5_principal with flags. * * @param [in] context Library context * @param [in] name String representation of a principal name * @param [in] flags Flag * @param [out] principal_out New principal * * Similar to krb5_parse_name(), this function converts a single-string * representation of a principal name to a krb5_principal structure. * * The following flags are valid: * @li #KRB5_PRINCIPAL_PARSE_NO_REALM - no realm must be present in @a name * @li #KRB5_PRINCIPAL_PARSE_REQUIRE_REALM - realm must be present in @a name * @li #KRB5_PRINCIPAL_PARSE_ENTERPRISE - create single-component enterprise * principal * @li #KRB5_PRINCIPAL_PARSE_IGNORE_REALM - ignore realm if present in @a name * * If @c KRB5_PRINCIPAL_PARSE_NO_REALM or @c KRB5_PRINCIPAL_PARSE_IGNORE_REALM * is specified in @a flags, the realm of the new principal will be empty. * Otherwise, the default realm for @a context will be used if @a name does not * specify a realm. * * Use krb5_free_principal() to free @a principal_out when it is no longer * needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_parse_name_flags(krb5_context context, const char *name, int flags, krb5_principal *principal_out); /** * Convert a krb5_principal structure to a string representation. * * @param [in] context Library context * @param [in] principal Principal * @param [out] name String representation of principal name * * The resulting string representation uses the format and quoting conventions * described for krb5_parse_name(). * * Use krb5_free_unparsed_name() to free @a name when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_unparse_name(krb5_context context, krb5_const_principal principal, char **name); /** * Convert krb5_principal structure to string and length. * * @param [in] context Library context * @param [in] principal Principal * @param [in,out] name String representation of principal name * @param [in,out] size Size of unparsed name * * This function is similar to krb5_unparse_name(), but allows the use of an * existing buffer for the result. If size is not NULL, then @a name must * point to either NULL or an existing buffer of at least the size pointed to * by @a size. The buffer will be allocated or resized if necessary, with the * new pointer stored into @a name. Whether or not the buffer is resized, the * necessary space for the result, including null terminator, will be stored * into @a size. * * If size is NULL, this function behaves exactly as krb5_unparse_name(). * * @retval * 0 Success * @return * Kerberos error codes. On failure @a name is set to NULL */ krb5_error_code KRB5_CALLCONV krb5_unparse_name_ext(krb5_context context, krb5_const_principal principal, char **name, unsigned int *size); #define KRB5_PRINCIPAL_UNPARSE_SHORT 0x1 /**< Omit realm if it is the local realm */ #define KRB5_PRINCIPAL_UNPARSE_NO_REALM 0x2 /**< Omit realm always */ #define KRB5_PRINCIPAL_UNPARSE_DISPLAY 0x4 /**< Don't escape special characters */ /** * Convert krb5_principal structure to a string with flags. * * @param [in] context Library context * @param [in] principal Principal * @param [in] flags Flags * @param [out] name String representation of principal name * * Similar to krb5_unparse_name(), this function converts a krb5_principal * structure to a string representation. * * The following flags are valid: * @li #KRB5_PRINCIPAL_UNPARSE_SHORT - omit realm if it is the local realm * @li #KRB5_PRINCIPAL_UNPARSE_NO_REALM - omit realm * @li #KRB5_PRINCIPAL_UNPARSE_DISPLAY - do not quote special characters * * Use krb5_free_unparsed_name() to free @a name when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes. On failure @a name is set to NULL */ krb5_error_code KRB5_CALLCONV krb5_unparse_name_flags(krb5_context context, krb5_const_principal principal, int flags, char **name); /** * Convert krb5_principal structure to string format with flags. * * @param [in] context Library context * @param [in] principal Principal * @param [in] flags Flags * @param [out] name Single string format of principal name * @param [out] size Size of unparsed name buffer * * @sa krb5_unparse_name() krb5_unparse_name_flags() krb5_unparse_name_ext() * * @retval * 0 Success * @return * Kerberos error codes. On failure @a name is set to NULL */ krb5_error_code KRB5_CALLCONV krb5_unparse_name_flags_ext(krb5_context context, krb5_const_principal principal, int flags, char **name, unsigned int *size); /** * Set the realm field of a principal * * @param [in] context Library context * @param [in] principal Principal name * @param [in] realm Realm name * * Set the realm name part of @a principal to @a realm, overwriting the * previous realm. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_principal_realm(krb5_context context, krb5_principal principal, const char *realm); /** * Search a list of addresses for a specified address. * * @param [in] context Library context * @param [in] addr Address to search for * @param [in] addrlist Address list to be searched (or NULL) * * @note If @a addrlist contains only a NetBIOS addresses, it will be treated * as a null list. * * @return * TRUE if @a addr is listed in @a addrlist, or @c addrlist is NULL; FALSE * otherwise */ krb5_boolean KRB5_CALLCONV_WRONG krb5_address_search(krb5_context context, const krb5_address *addr, krb5_address *const *addrlist); /** * Compare two Kerberos addresses. * * @param [in] context Library context * @param [in] addr1 First address to be compared * @param [in] addr2 Second address to be compared * * @return * TRUE if the addresses are the same, FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_address_compare(krb5_context context, const krb5_address *addr1, const krb5_address *addr2); /** * Return an ordering of the specified addresses. * * @param [in] context Library context * @param [in] addr1 First address * @param [in] addr2 Second address * * @retval * 0 The two addresses are the same * @retval * \< 0 First address is less than second * @retval * \> 0 First address is greater than second */ int KRB5_CALLCONV krb5_address_order(krb5_context context, const krb5_address *addr1, const krb5_address *addr2); /** * Compare the realms of two principals. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * * @retval * TRUE if the realm names are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_realm_compare(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2); /** * Compare two principals. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * * @retval * TRUE if the principals are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_principal_compare(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2); /** * Compare two principals ignoring realm components. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * * Similar to krb5_principal_compare(), but do not compare the realm * components of the principals. * * @retval * TRUE if the principals are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_principal_compare_any_realm(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2); #define KRB5_PRINCIPAL_COMPARE_IGNORE_REALM 1 /**< ignore realm component */ #define KRB5_PRINCIPAL_COMPARE_ENTERPRISE 2 /**< UPNs as real principals */ #define KRB5_PRINCIPAL_COMPARE_CASEFOLD 4 /**< case-insensitive */ #define KRB5_PRINCIPAL_COMPARE_UTF8 8 /**< treat principals as UTF-8 */ /** * Compare two principals with additional flags. * * @param [in] context Library context * @param [in] princ1 First principal * @param [in] princ2 Second principal * @param [in] flags Flags * * Valid flags are: * @li #KRB5_PRINCIPAL_COMPARE_IGNORE_REALM - ignore realm component * @li #KRB5_PRINCIPAL_COMPARE_ENTERPRISE - UPNs as real principals * @li #KRB5_PRINCIPAL_COMPARE_CASEFOLD case-insensitive * @li #KRB5_PRINCIPAL_COMPARE_UTF8 - treat principals as UTF-8 * * @sa krb5_principal_compare() * * @retval * TRUE if the principal names are the same; FALSE otherwise */ krb5_boolean KRB5_CALLCONV krb5_principal_compare_flags(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2, int flags); /** * Initialize an empty @c krb5_keyblock. * * @param [in] context Library context * @param [in] enctype Encryption type * @param [in] length Length of keyblock (or 0) * @param [out] out New keyblock structure * * Initialize a new keyblock and allocate storage for the contents of the key. * It is legal to pass in a length of 0, in which case contents are left * unallocated. Use krb5_free_keyblock() to free @a out when it is no longer * needed. * * @note If @a length is set to 0, contents are left unallocated. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_keyblock(krb5_context context, krb5_enctype enctype, size_t length, krb5_keyblock **out); /** * Copy a keyblock. * * @param [in] context Library context * @param [in] from Keyblock to be copied * @param [out] to Copy of keyblock @a from * * This function creates a new keyblock with the same contents as @a from. Use * krb5_free_keyblock() to free @a to when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_keyblock(krb5_context context, const krb5_keyblock *from, krb5_keyblock **to); /** * Copy the contents of a keyblock. * * @param [in] context Library context * @param [in] from Key to be copied * @param [out] to Output key * * This function copies the contents of @a from to @a to. Use * krb5_free_keyblock_contents() to free @a to when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_keyblock_contents(krb5_context context, const krb5_keyblock *from, krb5_keyblock *to); /** * Copy a krb5_creds structure. * * @param [in] context Library context * @param [in] incred Credentials structure to be copied * @param [out] outcred Copy of @a incred * * This function creates a new credential with the contents of @a incred. Use * krb5_free_creds() to free @a outcred when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_creds(krb5_context context, const krb5_creds *incred, krb5_creds **outcred); /** * Copy a krb5_data object. * * @param [in] context Library context * @param [in] indata Data object to be copied * @param [out] outdata Copy of @a indata * * This function creates a new krb5_data object with the contents of @a indata. * Use krb5_free_data() to free @a outdata when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_data(krb5_context context, const krb5_data *indata, krb5_data **outdata); /** * Copy a principal. * * @param [in] context Library context * @param [in] inprinc Principal to be copied * @param [out] outprinc Copy of @a inprinc * * This function creates a new principal structure with the contents of @a * inprinc. Use krb5_free_principal() to free @a outprinc when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_principal(krb5_context context, krb5_const_principal inprinc, krb5_principal *outprinc); /** * Copy an array of addresses. * * @param [in] context Library context * @param [in] inaddr Array of addresses to be copied * @param [out] outaddr Copy of array of addresses * * This function creates a new address array containing a copy of @a inaddr. * Use krb5_free_addresses() to free @a outaddr when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_addresses(krb5_context context, krb5_address *const *inaddr, krb5_address ***outaddr); /** * Copy a krb5_ticket structure. * * @param [in] context Library context * @param [in] from Ticket to be copied * @param [out] pto Copy of ticket * * This function creates a new krb5_ticket structure containing the contents of * @a from. Use krb5_free_ticket() to free @a pto when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_ticket(krb5_context context, const krb5_ticket *from, krb5_ticket **pto); /** * Copy an authorization data list. * * @param [in] context Library context * @param [in] in_authdat List of @a krb5_authdata structures * @param [out] out New array of @a krb5_authdata structures * * This function creates a new authorization data list containing a copy of @a * in_authdat, which must be null-terminated. Use krb5_free_authdata() to free * @a out when it is no longer needed. * * @note The last array entry in @a in_authdat must be a NULL pointer. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_authdata(krb5_context context, krb5_authdata *const *in_authdat, krb5_authdata ***out); /** * Find authorization data elements. * * @param [in] context Library context * @param [in] ticket_authdata Authorization data list from ticket * @param [in] ap_req_authdata Authorization data list from AP request * @param [in] ad_type Authorization data type to find * @param [out] results List of matching entries * * This function searches @a ticket_authdata and @a ap_req_authdata for * elements of type @a ad_type. Either input list may be NULL, in which case * it will not be searched; otherwise, the input lists must be terminated by * NULL entries. This function will search inside AD-IF-RELEVANT containers if * found in either list. Use krb5_free_authdata() to free @a results when it * is no longer needed. * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_find_authdata(krb5_context context, krb5_authdata *const *ticket_authdata, krb5_authdata *const *ap_req_authdata, krb5_authdatatype ad_type, krb5_authdata ***results); /** * Merge two authorization data lists into a new list. * * @param [in] context Library context * @param [in] inauthdat1 First list of @a krb5_authdata structures * @param [in] inauthdat2 Second list of @a krb5_authdata structures * @param [out] outauthdat Merged list of @a krb5_authdata structures * * Merge two authdata arrays, such as the array from a ticket * and authenticator. * Use krb5_free_authdata() to free @a outauthdat when it is no longer needed. * * @note The last array entry in @a inauthdat1 and @a inauthdat2 * must be a NULL pointer. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_merge_authdata(krb5_context context, krb5_authdata *const *inauthdat1, krb5_authdata * const *inauthdat2, krb5_authdata ***outauthdat); /** * Copy a krb5_authenticator structure. * * @param [in] context Library context * @param [in] authfrom krb5_authenticator structure to be copied * @param [out] authto Copy of krb5_authenticator structure * * This function creates a new krb5_authenticator structure with the content of * @a authfrom. Use krb5_free_authenticator() to free @a authto when it is no * longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_authenticator(krb5_context context, const krb5_authenticator *authfrom, krb5_authenticator **authto); /** * Copy a krb5_checksum structure. * * @param [in] context Library context * @param [in] ckfrom Checksum to be copied * @param [out] ckto Copy of krb5_checksum structure * * This function creates a new krb5_checksum structure with the contents of @a * ckfrom. Use krb5_free_checksum() to free @a ckto when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_copy_checksum(krb5_context context, const krb5_checksum *ckfrom, krb5_checksum **ckto); /** * Generate a replay cache object for server use and open it. * * @param [in] context Library context * @param [in] piece Unused (replay cache identifier) * @param [out] rcptr Handle to an open rcache * * This function creates a handle to the default replay cache. Use * krb5_rc_close() to close @a rcptr when it is no longer needed. * * @version Prior to release 1.18, this function creates a handle to a * different replay cache for each unique value of @a piece. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_server_rcache(krb5_context context, const krb5_data *piece, krb5_rcache *rcptr); /** * Build a principal name using length-counted strings. * * @param [in] context Library context * @param [out] princ Principal name * @param [in] rlen Realm name length * @param [in] realm Realm name * @param [in] ... List of unsigned int/char * components, followed by 0 * * This function creates a principal from a length-counted string and a * variable-length list of length-counted components. The list of components * ends with the first 0 length argument (so it is not possible to specify an * empty component with this function). Call krb5_free_principal() to free * allocated memory for principal when it is no longer needed. * * @code * Example of how to build principal WELLKNOWN/ANONYMOUS@R * krb5_build_principal_ext(context, &principal, strlen("R"), "R", * (unsigned int)strlen(KRB5_WELLKNOWN_NAMESTR), * KRB5_WELLKNOWN_NAMESTR, * (unsigned int)strlen(KRB5_ANONYMOUS_PRINCSTR), * KRB5_ANONYMOUS_PRINCSTR, 0); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV_C krb5_build_principal_ext(krb5_context context, krb5_principal * princ, unsigned int rlen, const char * realm, ...); /** * Build a principal name using null-terminated strings. * * @param [in] context Library context * @param [out] princ Principal name * @param [in] rlen Realm name length * @param [in] realm Realm name * @param [in] ... List of char * components, ending with NULL * * Call krb5_free_principal() to free @a princ when it is no longer needed. * * @note krb5_build_principal() and krb5_build_principal_alloc_va() perform the * same task. krb5_build_principal() takes variadic arguments. * krb5_build_principal_alloc_va() takes a pre-computed @a varargs pointer. * * @code * Example of how to build principal H/S@R * krb5_build_principal(context, &principal, * strlen("R"), "R", "H", "S", (char*)NULL); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV_C krb5_build_principal(krb5_context context, krb5_principal * princ, unsigned int rlen, const char * realm, ...) #if __GNUC__ >= 4 __attribute__ ((sentinel)) #endif ; #if KRB5_DEPRECATED /** @deprecated Replaced by krb5_build_principal_alloc_va(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_build_principal_va(krb5_context context, krb5_principal princ, unsigned int rlen, const char *realm, va_list ap); #endif /** * Build a principal name, using a precomputed variable argument list * * @param [in] context Library context * @param [out] princ Principal structure * @param [in] rlen Realm name length * @param [in] realm Realm name * @param [in] ap List of char * components, ending with NULL * * Similar to krb5_build_principal(), this function builds a principal name, * but its name components are specified as a va_list. * * Use krb5_free_principal() to deallocate @a princ when it is no longer * needed. * * @code * Function usage example: * va_list ap; * va_start(ap, realm); * krb5_build_principal_alloc_va(context, princ, rlen, realm, ap); * va_end(ap); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_build_principal_alloc_va(krb5_context context, krb5_principal *princ, unsigned int rlen, const char *realm, va_list ap); /** * Convert a Kerberos V4 principal to a Kerberos V5 principal. * * @param [in] context Library context * @param [in] name V4 name * @param [in] instance V4 instance * @param [in] realm Realm * @param [out] princ V5 principal * * This function builds a @a princ from V4 specification based on given input * @a name.instance\@realm. * * Use krb5_free_principal() to free @a princ when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_425_conv_principal(krb5_context context, const char *name, const char *instance, const char *realm, krb5_principal *princ); /** * Convert a Kerberos V5 principal to a Kerberos V4 principal. * * @param [in] context Library context * @param [in] princ V5 Principal * @param [out] name V4 principal's name to be filled in * @param [out] inst V4 principal's instance name to be filled in * @param [out] realm Principal's realm name to be filled in * * This function separates a V5 principal @a princ into @a name, @a instance, * and @a realm. * * @retval * 0 Success * @retval * KRB5_INVALID_PRINCIPAL Invalid principal name * @retval * KRB5_CONFIG_CANTOPEN Can't open or find Kerberos configuration file * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_524_conv_principal(krb5_context context, krb5_const_principal princ, char *name, char *inst, char *realm); /** *@deprecated */ struct credentials; /** * Convert a Kerberos V5 credentials to a Kerberos V4 credentials * * @note Not implemented * * @retval KRB524_KRB4_DISABLED (always) */ int KRB5_CALLCONV krb5_524_convert_creds(krb5_context context, krb5_creds *v5creds, struct credentials *v4creds); #if KRB5_DEPRECATED #define krb524_convert_creds_kdc krb5_524_convert_creds #define krb524_init_ets(x) (0) #endif /* libkt.spec */ /** * Get a handle for a key table. * * @param [in] context Library context * @param [in] name Name of the key table * @param [out] ktid Key table handle * * Resolve the key table name @a name and set @a ktid to a handle identifying * the key table. Use krb5_kt_close() to free @a ktid when it is no longer * needed. * * @a name must be of the form @c type:residual, where @a type must be a type * known to the library and @a residual portion should be specific to the * particular keytab type. If no @a type is given, the default is @c FILE. * * If @a name is of type @c FILE, the keytab file is not opened by this call. * * @code * Example: krb5_kt_resolve(context, "FILE:/tmp/filename", &ktid); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_resolve(krb5_context context, const char *name, krb5_keytab *ktid); /** * Duplicate keytab handle. * * @param [in] context Library context * @param [in] in Key table handle to be duplicated * @param [out] out Key table handle * * Create a new handle referring to the same key table as @a in. The new * handle and @a in can be closed independently. * * @version New in 1.12 */ krb5_error_code KRB5_CALLCONV krb5_kt_dup(krb5_context context, krb5_keytab in, krb5_keytab *out); /** * Get the default key table name. * * @param [in] context Library context * @param [out] name Default key table name * @param [in] name_size Space available in @a name * * Fill @a name with the name of the default key table for @a context. * * @sa MAX_KEYTAB_NAME_LEN * * @retval * 0 Success * @retval * KRB5_CONFIG_NOTENUFSPACE Buffer is too short * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_default_name(krb5_context context, char *name, int name_size); /** * Resolve the default key table. * * @param [in] context Library context * @param [out] id Key table handle * * Set @a id to a handle to the default key table. The key table is not * opened. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_default(krb5_context context, krb5_keytab *id); /** * Resolve the default client key table. * * @param [in] context Library context * @param [out] keytab_out Key table handle * * Fill @a keytab_out with a handle to the default client key table. * * @version New in 1.11 * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_client_default(krb5_context context, krb5_keytab *keytab_out); /** * Free the contents of a key table entry. * * @param [in] context Library context * @param [in] entry Key table entry whose contents are to be freed * * @note The pointer is not freed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_free_keytab_entry_contents(krb5_context context, krb5_keytab_entry *entry); /** @deprecated Use krb5_free_keytab_entry_contents instead. */ krb5_error_code KRB5_CALLCONV krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *entry); /* remove and add are functions, so that they can return NOWRITE if not a writable keytab */ /** * Remove an entry from a key table. * * @param [in] context Library context * @param [in] id Key table handle * @param [in] entry Entry to remove from key table * * @retval * 0 Success * @retval * KRB5_KT_NOWRITE Key table is not writable * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_remove_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry); /** * Add a new entry to a key table. * * @param [in] context Library context * @param [in] id Key table handle * @param [in] entry Entry to be added * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_KT_NOWRITE Key table is not writeable * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_kt_add_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry); /** * Convert a principal name into the default salt for that principal. * * @param [in] context Library context * @param [in] pr Principal name * @param [out] ret Default salt for @a pr to be filled in * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV_WRONG krb5_principal2salt(krb5_context context, krb5_const_principal pr, krb5_data *ret); /* librc.spec--see rcache.h */ /* libcc.spec */ /** * Resolve a credential cache name. * * @param [in] context Library context * @param [in] name Credential cache name to be resolved * @param [out] cache Credential cache handle * * Fills in @a cache with a @a cache handle that corresponds to the name in @a * name. @a name should be of the form @c type:residual, and @a type must be a * type known to the library. If the @a name does not contain a colon, * interpret it as a file name. * * @code * Example: krb5_cc_resolve(context, "MEMORY:C_", &cache); * @endcode * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_resolve(krb5_context context, const char *name, krb5_ccache *cache); /** * Duplicate ccache handle. * * @param [in] context Library context * @param [in] in Credential cache handle to be duplicated * @param [out] out Credential cache handle * * Create a new handle referring to the same cache as @a in. * The new handle and @a in can be closed independently. */ krb5_error_code KRB5_CALLCONV krb5_cc_dup(krb5_context context, krb5_ccache in, krb5_ccache *out); /** * Return the name of the default credential cache. * * @param [in] context Library context * * Return a pointer to the default credential cache name for @a context, as * determined by a prior call to krb5_cc_set_default_name(), by the KRB5CCNAME * environment variable, by the default_ccache_name profile variable, or by the * operating system or build-time default value. The returned value must not * be modified or freed by the caller. The returned value becomes invalid when * @a context is destroyed krb5_free_context() or if a subsequent call to * krb5_cc_set_default_name() is made on @a context. * * The default credential cache name is cached in @a context between calls to * this function, so if the value of KRB5CCNAME changes in the process * environment after the first call to this function on, that change will not * be reflected in later calls with the same context. The caller can invoke * krb5_cc_set_default_name() with a NULL value of @a name to clear the cached * value and force the default name to be recomputed. * * @return * Name of default credential cache for the current user. */ const char *KRB5_CALLCONV krb5_cc_default_name(krb5_context context); /** * Set the default credential cache name. * * @param [in] context Library context * @param [in] name Default credential cache name or NULL * * Set the default credential cache name to @a name for future operations using * @a context. If @a name is NULL, clear any previous application-set default * name and forget any cached value of the default name for @a context. * * Calls to this function invalidate the result of any previous calls to * krb5_cc_default_name() using @a context. * * @retval * 0 Success * @retval * KV5M_CONTEXT Bad magic number for @c _krb5_context structure * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_set_default_name(krb5_context context, const char *name); /** * Resolve the default credential cache name. * * @param [in] context Library context * @param [out] ccache Pointer to credential cache name * * Create a handle to the default credential cache as given by * krb5_cc_default_name(). * * @retval * 0 Success * @retval * KV5M_CONTEXT Bad magic number for @c _krb5_context structure * @retval * KRB5_FCC_INTERNAL The name of the default credential cache cannot be * obtained * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_default(krb5_context context, krb5_ccache *ccache); /** * Copy a credential cache. * * @param [in] context Library context * @param [in] incc Credential cache to be copied * @param [out] outcc Copy of credential cache to be filled in * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_copy_creds(krb5_context context, krb5_ccache incc, krb5_ccache outcc); /** * Get a configuration value from a credential cache. * * @param [in] context Library context * @param [in] id Credential cache handle * @param [in] principal Configuration for this principal; * if NULL, global for the whole cache * @param [in] key Name of config variable * @param [out] data Data to be fetched * * Use krb5_free_data_contents() to free @a data when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_get_config(krb5_context context, krb5_ccache id, krb5_const_principal principal, const char *key, krb5_data *data); /** * Store a configuration value in a credential cache. * * @param [in] context Library context * @param [in] id Credential cache handle * @param [in] principal Configuration for a specific principal; * if NULL, global for the whole cache * @param [in] key Name of config variable * @param [in] data Data to store, or NULL to remove * * @note Existing configuration under the same key is over-written. * * @warning Before version 1.10 @a data was assumed to be always non-null. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_set_config(krb5_context context, krb5_ccache id, krb5_const_principal principal, const char *key, krb5_data *data); /** * Test whether a principal is a configuration principal. * * @param [in] context Library context * @param [in] principal Principal to check * * @return * @c TRUE if the principal is a configuration principal (generated part of * krb5_cc_set_config()); @c FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_is_config_principal(krb5_context context, krb5_const_principal principal); /** * Make a credential cache the primary cache for its collection. * * @param [in] context Library context * @param [in] cache Credential cache handle * * If the type of @a cache supports it, set @a cache to be the primary * credential cache for the collection it belongs to. * * @retval * 0 Success, or the type of @a cache doesn't support switching * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cc_switch(krb5_context context, krb5_ccache cache); /** * Determine whether a credential cache type supports switching. * * @param [in] context Library context * @param [in] type Credential cache type * * @version New in 1.10 * * @retval TRUE if @a type supports switching * @retval FALSE if it does not or is not a valid credential cache type. */ krb5_boolean KRB5_CALLCONV krb5_cc_support_switch(krb5_context context, const char *type); /** * Find a credential cache with a specified client principal. * * @param [in] context Library context * @param [in] client Client principal * @param [out] cache_out Credential cache handle * * Find a cache within the collection whose default principal is @a client. * Use @a krb5_cc_close to close @a ccache when it is no longer needed. * * @retval 0 Success * @retval KRB5_CC_NOTFOUND * * @sa krb5_cccol_cursor_new * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_cc_cache_match(krb5_context context, krb5_principal client, krb5_ccache *cache_out); /** * Select a credential cache to use with a server principal. * * @param [in] context Library context * @param [in] server Server principal * @param [out] cache_out Credential cache handle * @param [out] princ_out Client principal * * Select a cache within the collection containing credentials most appropriate * for use with @a server, according to configured rules and heuristics. * * Use krb5_cc_close() to release @a cache_out when it is no longer needed. * Use krb5_free_principal() to release @a princ_out when it is no longer * needed. Note that @a princ_out is set in some error conditions. * * @return * If an appropriate cache is found, 0 is returned, @a cache_out is set to the * selected cache, and @a princ_out is set to the default principal of that * cache. * * If the appropriate client principal can be authoritatively determined but * the cache collection contains no credentials for that principal, then * KRB5_CC_NOTFOUND is returned, @a cache_out is set to NULL, and @a princ_out * is set to the appropriate client principal. * * If no configured mechanism can determine the appropriate cache or principal, * KRB5_CC_NOTFOUND is returned and @a cache_out and @a princ_out are set to * NULL. * * Any other error code indicates a fatal error in the processing of a cache * selection mechanism. * * @version New in 1.10 */ krb5_error_code KRB5_CALLCONV krb5_cc_select(krb5_context context, krb5_principal server, krb5_ccache *cache_out, krb5_principal *princ_out); /* krb5_free.c */ /** * Free the storage assigned to a principal. * * @param [in] context Library context * @param [in] val Principal to be freed */ void KRB5_CALLCONV krb5_free_principal(krb5_context context, krb5_principal val); /** * Free a krb5_authenticator structure. * * @param [in] context Library context * @param [in] val Authenticator structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_authenticator(krb5_context context, krb5_authenticator *val); /** * Free the data stored in array of addresses. * * @param [in] context Library context * @param [in] val Array of addresses to be freed * * This function frees the contents of @a val and the array itself. * * @note The last entry in the array must be a NULL pointer. */ void KRB5_CALLCONV krb5_free_addresses(krb5_context context, krb5_address **val); /** * Free the storage assigned to array of authentication data. * * @param [in] context Library context * @param [in] val Array of authentication data to be freed * * This function frees the contents of @a val and the array itself. * * @note The last entry in the array must be a NULL pointer. */ void KRB5_CALLCONV krb5_free_authdata(krb5_context context, krb5_authdata **val); /** * Free a ticket. * * @param [in] context Library context * @param [in] val Ticket to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_ticket(krb5_context context, krb5_ticket *val); /** * Free an error allocated by krb5_read_error() or krb5_sendauth(). * * @param [in] context Library context * @param [in] val Error data structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_error(krb5_context context, krb5_error *val); /** * Free a krb5_creds structure. * * @param [in] context Library context * @param [in] val Credential structure to be freed. * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_creds(krb5_context context, krb5_creds *val); /** * Free the contents of a krb5_creds structure. * * @param [in] context Library context * @param [in] val Credential structure to free contents of * * This function frees the contents of @a val, but not the structure itself. */ void KRB5_CALLCONV krb5_free_cred_contents(krb5_context context, krb5_creds *val); /** * Free a krb5_checksum structure. * * @param [in] context Library context * @param [in] val Checksum structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_checksum(krb5_context context, krb5_checksum *val); /** * Free the contents of a krb5_checksum structure. * * @param [in] context Library context * @param [in] val Checksum structure to free contents of * * This function frees the contents of @a val, but not the structure itself. */ void KRB5_CALLCONV krb5_free_checksum_contents(krb5_context context, krb5_checksum *val); /** * Free a krb5_keyblock structure. * * @param [in] context Library context * @param [in] val Keyblock to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_keyblock(krb5_context context, krb5_keyblock *val); /** * Free the contents of a krb5_keyblock structure. * * @param [in] context Library context * @param [in] key Keyblock to be freed * * This function frees the contents of @a key, but not the structure itself. */ void KRB5_CALLCONV krb5_free_keyblock_contents(krb5_context context, krb5_keyblock *key); /** * Free a krb5_ap_rep_enc_part structure. * * @param [in] context Library context * @param [in] val AP-REP enc part to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_ap_rep_enc_part(krb5_context context, krb5_ap_rep_enc_part *val); /** * Free a krb5_data structure. * * @param [in] context Library context * @param [in] val Data structure to be freed * * This function frees the contents of @a val and the structure itself. */ void KRB5_CALLCONV krb5_free_data(krb5_context context, krb5_data *val); /* Free a krb5_octet_data structure (should be unused). */ void KRB5_CALLCONV krb5_free_octet_data(krb5_context context, krb5_octet_data *val); /** * Free the contents of a krb5_data structure and zero the data field. * * @param [in] context Library context * @param [in] val Data structure to free contents of * * This function frees the contents of @a val, but not the structure itself. */ void KRB5_CALLCONV krb5_free_data_contents(krb5_context context, krb5_data *val); /** * Free a string representation of a principal. * * @param [in] context Library context * @param [in] val Name string to be freed */ void KRB5_CALLCONV krb5_free_unparsed_name(krb5_context context, char *val); /** * Free a string allocated by a krb5 function. * * @param [in] context Library context * @param [in] val String to be freed * * @version New in 1.10 */ void KRB5_CALLCONV krb5_free_string(krb5_context context, char *val); /** * Free an array of encryption types. * * @param [in] context Library context * @param [in] val Array of enctypes to be freed * * @version New in 1.12 */ void KRB5_CALLCONV krb5_free_enctypes(krb5_context context, krb5_enctype *val); /** * Free an array of checksum types. * * @param [in] context Library context * @param [in] val Array of checksum types to be freed */ void KRB5_CALLCONV krb5_free_cksumtypes(krb5_context context, krb5_cksumtype *val); /* From krb5/os, but needed by the outside world */ /** * Retrieve the system time of day, in sec and ms, since the epoch. * * @param [in] context Library context * @param [out] seconds System timeofday, seconds portion * @param [out] microseconds System timeofday, microseconds portion * * This function retrieves the system time of day with the context * specific time offset adjustment. * * @sa krb5_crypto_us_timeofday() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_us_timeofday(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds); /** * Retrieve the current time with context specific time offset adjustment. * * @param [in] context Library context * @param [out] timeret Timestamp to fill in * * This function retrieves the system time of day with the context specific * time offset adjustment. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_timeofday(krb5_context context, krb5_timestamp *timeret); /** * Check if a timestamp is within the allowed clock skew of the current time. * * @param [in] context Library context * @param [in] date Timestamp to check * * This function checks if @a date is close enough to the current time * according to the configured allowable clock skew. * * @version New in 1.10 * * @retval 0 Success * @retval KRB5KRB_AP_ERR_SKEW @a date is not within allowable clock skew */ krb5_error_code KRB5_CALLCONV krb5_check_clockskew(krb5_context context, krb5_timestamp date); /** * Return all interface addresses for this host. * * @param [in] context Library context * @param [out] addr Array of krb5_address pointers, ending with * NULL * * Use krb5_free_addresses() to free @a addr when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_os_localaddr(krb5_context context, krb5_address ***addr); /** * Retrieve the default realm. * * @param [in] context Library context * @param [out] lrealm Default realm name * * Retrieves the default realm to be used if no user-specified realm is * available. * * Use krb5_free_default_realm() to free @a lrealm when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_default_realm(krb5_context context, char **lrealm); /** * Override the default realm for the specified context. * * @param [in] context Library context * @param [in] lrealm Realm name for the default realm * * If @a lrealm is NULL, clear the default realm setting. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_default_realm(krb5_context context, const char *lrealm); /** * Free a default realm string returned by krb5_get_default_realm(). * * @param [in] context Library context * @param [in] lrealm Realm to be freed */ void KRB5_CALLCONV krb5_free_default_realm(krb5_context context, char *lrealm); /** * Canonicalize a hostname, possibly using name service. * * @param [in] context Library context * @param [in] host Input hostname * @param [out] canonhost_out Canonicalized hostname * * This function canonicalizes orig_hostname, possibly using name service * lookups if configuration permits. Use krb5_free_string() to free @a * canonhost_out when it is no longer needed. * * @version New in 1.15 */ krb5_error_code KRB5_CALLCONV krb5_expand_hostname(krb5_context context, const char *host, char **canonhost_out); /** * Generate a full principal name from a service name. * * @param [in] context Library context * @param [in] hostname Host name, or NULL to use local host * @param [in] sname Service name, or NULL to use @c "host" * @param [in] type Principal type * @param [out] ret_princ Generated principal * * This function converts a @a hostname and @a sname into @a krb5_principal * structure @a ret_princ. The returned principal will be of the form @a * sname\/hostname\@REALM where REALM is determined by krb5_get_host_realm(). * In some cases this may be the referral (empty) realm. * * The @a type can be one of the following: * * @li #KRB5_NT_SRV_HST canonicalizes the host name before looking up the * realm and generating the principal. * * @li #KRB5_NT_UNKNOWN accepts the hostname as given, and does not * canonicalize it. * * Use krb5_free_principal to free @a ret_princ when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_sname_to_principal(krb5_context context, const char *hostname, const char *sname, krb5_int32 type, krb5_principal *ret_princ); /** * Test whether a principal matches a matching principal. * * @param [in] context Library context * @param [in] matching Matching principal * @param [in] princ Principal to test * * @note A matching principal is a host-based principal with an empty realm * and/or second data component (hostname). Profile configuration may cause * the hostname to be ignored even if it is present. A principal matches a * matching principal if the former has the same non-empty (and non-ignored) * components of the latter. * * If @a matching is NULL, return TRUE. If @a matching is not a matching * principal, return the value of krb5_principal_compare(context, matching, * princ). * * @return * TRUE if @a princ matches @a matching, FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_sname_match(krb5_context context, krb5_const_principal matching, krb5_const_principal princ); /** * Change a password for an existing Kerberos account. * * @param [in] context Library context * @param [in] creds Credentials for kadmin/changepw service * @param [in] newpw New password * @param [out] result_code Numeric error code from server * @param [out] result_code_string String equivalent to @a result_code * @param [out] result_string Change password response from the KDC * * Change the password for the existing principal identified by @a creds. * * The possible values of the output @a result_code are: * * @li #KRB5_KPASSWD_SUCCESS (0) - success * @li #KRB5_KPASSWD_MALFORMED (1) - Malformed request error * @li #KRB5_KPASSWD_HARDERROR (2) - Server error * @li #KRB5_KPASSWD_AUTHERROR (3) - Authentication error * @li #KRB5_KPASSWD_SOFTERROR (4) - Password change rejected * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_change_password(krb5_context context, krb5_creds *creds, const char *newpw, int *result_code, krb5_data *result_code_string, krb5_data *result_string); /** * Set a password for a principal using specified credentials. * * @param [in] context Library context * @param [in] creds Credentials for kadmin/changepw service * @param [in] newpw New password * @param [in] change_password_for Change the password for this principal * @param [out] result_code Numeric error code from server * @param [out] result_code_string String equivalent to @a result_code * @param [out] result_string Data returned from the remote system * * This function uses the credentials @a creds to set the password @a newpw for * the principal @a change_password_for. It implements the set password * operation of RFC 3244, for interoperability with Microsoft Windows * implementations. * * @note If @a change_password_for is NULL, the change is performed on the * current principal. If @a change_password_for is non-null, the change is * performed on the principal name passed in @a change_password_for. * * The error code and strings are returned in @a result_code, * @a result_code_string and @a result_string. * * @sa krb5_set_password_using_ccache() * * @retval * 0 Success and result_code is set to #KRB5_KPASSWD_SUCCESS. * @return * Kerberos error codes. */ krb5_error_code KRB5_CALLCONV krb5_set_password(krb5_context context, krb5_creds *creds, const char *newpw, krb5_principal change_password_for, int *result_code, krb5_data *result_code_string, krb5_data *result_string); /** * Set a password for a principal using cached credentials. * * @param [in] context Library context * @param [in] ccache Credential cache * @param [in] newpw New password * @param [in] change_password_for Change the password for this principal * @param [out] result_code Numeric error code from server * @param [out] result_code_string String equivalent to @a result_code * @param [out] result_string Data returned from the remote system * * This function uses the cached credentials from @a ccache to set the password * @a newpw for the principal @a change_password_for. It implements RFC 3244 * set password operation (interoperable with MS Windows implementations) using * the credential cache. * * The error code and strings are returned in @a result_code, * @a result_code_string and @a result_string. * * @note If @a change_password_for is set to NULL, the change is performed on * the default principal in @a ccache. If @a change_password_for is non null, * the change is performed on the specified principal. * * @sa krb5_set_password() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_password_using_ccache(krb5_context context, krb5_ccache ccache, const char *newpw, krb5_principal change_password_for, int *result_code, krb5_data *result_code_string, krb5_data *result_string); /** * Get a result message for changing or setting a password. * * @param [in] context Library context * @param [in] server_string Data returned from the remote system * @param [out] message_out A message displayable to the user * * This function processes the @a server_string returned in the @a * result_string parameter of krb5_change_password(), krb5_set_password(), and * related functions, and returns a displayable string. If @a server_string * contains Active Directory structured policy information, it will be * converted into human-readable text. * * Use krb5_free_string() to free @a message_out when it is no longer needed. * * @retval * 0 Success * @return * Kerberos error codes * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_chpw_message(krb5_context context, const krb5_data *server_string, char **message_out); /** * Retrieve configuration profile from the context. * * @param [in] context Library context * @param [out] profile Pointer to data read from a configuration file * * This function creates a new @a profile object that reflects profile * in the supplied @a context. * * The @a profile object may be freed with profile_release() function. * See profile.h and profile API for more details. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_profile(krb5_context context, struct _profile_t ** profile); #if KRB5_DEPRECATED /** @deprecated Replaced by krb5_get_init_creds_password().*/ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_password(krb5_context context, krb5_flags options, krb5_address *const *addrs, krb5_enctype *ktypes, krb5_preauthtype *pre_auth_types, const char *password, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep **ret_as_reply); /** @deprecated Replaced by krb5_get_init_creds(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_skey(krb5_context context, krb5_flags options, krb5_address *const *addrs, krb5_enctype *ktypes, krb5_preauthtype *pre_auth_types, const krb5_keyblock *key, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep **ret_as_reply); /** @deprecated Replaced by krb5_get_init_creds_keytab(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_get_in_tkt_with_keytab(krb5_context context, krb5_flags options, krb5_address *const *addrs, krb5_enctype *ktypes, krb5_preauthtype *pre_auth_types, krb5_keytab arg_keytab, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep **ret_as_reply); #endif /* KRB5_DEPRECATED */ /** * Parse and decrypt a @c KRB_AP_REQ message. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] inbuf AP-REQ message to be parsed * @param [in] server Matching principal for server, or NULL to * allow any principal in keytab * @param [in] keytab Key table, or NULL to use the default * @param [out] ap_req_options If non-null, the AP-REQ flags on output * @param [out] ticket If non-null, ticket from the AP-REQ message * * This function parses, decrypts and verifies a AP-REQ message from @a inbuf * and stores the authenticator in @a auth_context. * * If a keyblock was specified in @a auth_context using * krb5_auth_con_setuseruserkey(), that key is used to decrypt the ticket in * AP-REQ message and @a keytab is ignored. In this case, @a server should be * specified as a complete principal name to allow for proper transited-path * checking and replay cache selection. * * Otherwise, the decryption key is obtained from @a keytab, or from the * default keytab if it is NULL. In this case, @a server may be a complete * principal name, a matching principal (see krb5_sname_match()), or NULL to * match any principal name. The keys tried against the encrypted part of the * ticket are determined as follows: * * - If @a server is a complete principal name, then its entry in @a keytab is * tried. * - Otherwise, if @a keytab is iterable, then all entries in @a keytab which * match @a server are tried. * - Otherwise, the server principal in the ticket must match @a server, and * its entry in @a keytab is tried. * * The client specified in the decrypted authenticator must match the client * specified in the decrypted ticket. * * If the @a remote_addr field of @a auth_context is set, the request must come * from that address. * * If a replay cache handle is provided in the @a auth_context, the * authenticator and ticket are verified against it. If no conflict is found, * the new authenticator is then stored in the replay cache of @a auth_context. * * Various other checks are performed on the decoded data, including * cross-realm policy, clockskew, and ticket validation times. * * On success the authenticator, subkey, and remote sequence number of the * request are stored in @a auth_context. If the #AP_OPTS_MUTUAL_REQUIRED * bit is set, the local sequence number is XORed with the remote sequence * number in the request. * * Use krb5_free_ticket() to free @a ticket when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_req(krb5_context context, krb5_auth_context *auth_context, const krb5_data *inbuf, krb5_const_principal server, krb5_keytab keytab, krb5_flags *ap_req_options, krb5_ticket **ticket); /** * Retrieve a service key from a key table. * * @param [in] context Library context * @param [in] keyprocarg Name of a key table (NULL to use default name) * @param [in] principal Service principal * @param [in] vno Key version number (0 for highest available) * @param [in] enctype Encryption type (0 for any type) * @param [out] key Service key from key table * * Open and search the specified key table for the entry identified by @a * principal, @a enctype, and @a vno. If no key is found, return an error code. * * The default key table is used, unless @a keyprocarg is non-null. * @a keyprocarg designates a specific key table. * * Use krb5_free_keyblock() to free @a key when it is no longer needed. * * @retval * 0 Success * @return Kerberos error code if not found or @a keyprocarg is invalid. */ krb5_error_code KRB5_CALLCONV krb5_kt_read_service_key(krb5_context context, krb5_pointer keyprocarg, krb5_principal principal, krb5_kvno vno, krb5_enctype enctype, krb5_keyblock **key); /** * Format a @c KRB-SAFE message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] userdata User data in the message * @param [out] der_out Formatted @c KRB-SAFE buffer * @param [out] rdata_out Replay data. Specify NULL if not needed * * This function creates an integrity protected @c KRB-SAFE message * using data supplied by the application. * * Fields in @a auth_context specify the checksum type, the keyblock that * can be used to seed the checksum, full addresses (host and port) for * the sender and receiver, and @ref KRB5_AUTH_CONTEXT flags. * * The local address in @a auth_context must be set, and is used to form the * sender address used in the KRB-SAFE message. The remote address is * optional; if specified, it will be used to form the receiver address used in * the message. * * @note The @a rdata_out argument is required if the * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set * in @a auth_context. * * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, a * timestamp is included in the KRB-SAFE message, and an entry for the message * is entered in an in-memory replay cache to detect if the message is * reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not set, no * replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a * auth_context, a timestamp is included in the KRB-SAFE message and is stored * in @a rdata_out. * * If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE * is set, the @a auth_context local sequence number is included in the * KRB-SAFE message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE * is set, the sequence number used is stored in @a rdata_out. * * Use krb5_free_data_contents() to free @a der_out when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_safe(krb5_context context, krb5_auth_context auth_context, const krb5_data *userdata, krb5_data *der_out, krb5_replay_data *rdata_out); /** * Format a @c KRB-PRIV message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] userdata User data for @c KRB-PRIV message * @param [out] der_out Formatted @c KRB-PRIV message * @param [out] rdata_out Replay data (NULL if not needed) * * This function is similar to krb5_mk_safe(), but the message is encrypted and * integrity-protected, not just integrity-protected. * * The local address in @a auth_context must be set, and is used to form the * sender address used in the KRB-PRIV message. The remote address is * optional; if specified, it will be used to form the receiver address used in * the message. * * @note The @a rdata_out argument is required if the * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set * in @a auth_context. * * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, a * timestamp is included in the KRB-PRIV message, and an entry for the message * is entered in an in-memory replay cache to detect if the message is * reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not set, no * replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a * auth_context, a timestamp is included in the KRB-PRIV message and is stored * in @a rdata_out. * * If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE * is set, the @a auth_context local sequence number is included in the * KRB-PRIV message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE * is set, the sequence number used is stored in @a rdata_out. * * Use krb5_free_data_contents() to free @a der_out when it is no longer * needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_priv(krb5_context context, krb5_auth_context auth_context, const krb5_data *userdata, krb5_data *der_out, krb5_replay_data *rdata_out); /** * Client function for @c sendauth protocol. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] fd File descriptor that describes network socket * @param [in] appl_version Application protocol version to be matched * with the receiver's application version * @param [in] client Client principal * @param [in] server Server principal * @param [in] ap_req_options @ref AP_OPTS options * @param [in] in_data Data to be sent to the server * @param [in] in_creds Input credentials, or NULL to use @a ccache * @param [in] ccache Credential cache * @param [out] error If non-null, contains KRB_ERROR message * returned from server * @param [out] rep_result If non-null and @a ap_req_options is * #AP_OPTS_MUTUAL_REQUIRED, contains the result * of mutual authentication exchange * @param [out] out_creds If non-null, the retrieved credentials * * This function performs the client side of a sendauth/recvauth exchange by * sending and receiving messages over @a fd. * * Credentials may be specified in three ways: * * @li If @a in_creds is NULL, credentials are obtained with * krb5_get_credentials() using the principals @a client and @a server. @a * server must be non-null; @a client may NULL to use the default principal of * @a ccache. * * @li If @a in_creds is non-null, but does not contain a ticket, credentials * for the exchange are obtained with krb5_get_credentials() using @a in_creds. * In this case, the values of @a client and @a server are unused. * * @li If @a in_creds is a complete credentials structure, it used directly. * In this case, the values of @a client, @a server, and @a ccache are unused. * * If the server is using a different application protocol than that specified * in @a appl_version, an error will be returned. * * Use krb5_free_creds() to free @a out_creds, krb5_free_ap_rep_enc_part() to * free @a rep_result, and krb5_free_error() to free @a error when they are no * longer needed. * * @sa krb5_recvauth() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_sendauth(krb5_context context, krb5_auth_context *auth_context, krb5_pointer fd, char *appl_version, krb5_principal client, krb5_principal server, krb5_flags ap_req_options, krb5_data *in_data, krb5_creds *in_creds, krb5_ccache ccache, krb5_error **error, krb5_ap_rep_enc_part **rep_result, krb5_creds **out_creds); /** * Server function for @a sendauth protocol. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] fd File descriptor * @param [in] appl_version Application protocol version to be matched * against the client's application version * @param [in] server Server principal (NULL for any in @a keytab) * @param [in] flags Additional specifications * @param [in] keytab Key table containing service keys * @param [out] ticket Ticket (NULL if not needed) * * This function performs the server side of a sendauth/recvauth exchange by * sending and receiving messages over @a fd. * * Use krb5_free_ticket() to free @a ticket when it is no longer needed. * * @sa krb5_sendauth() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_recvauth(krb5_context context, krb5_auth_context *auth_context, krb5_pointer fd, char *appl_version, krb5_principal server, krb5_int32 flags, krb5_keytab keytab, krb5_ticket **ticket); /** * Server function for @a sendauth protocol with version parameter. * * @param [in] context Library context * @param [in,out] auth_context Pre-existing or newly created auth context * @param [in] fd File descriptor * @param [in] server Server principal (NULL for any in @a keytab) * @param [in] flags Additional specifications * @param [in] keytab Decryption key * @param [out] ticket Ticket (NULL if not needed) * @param [out] version sendauth protocol version (NULL if not needed) * * This function is similar to krb5_recvauth() with the additional output * information place into @a version. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_recvauth_version(krb5_context context, krb5_auth_context *auth_context, krb5_pointer fd, krb5_principal server, krb5_int32 flags, krb5_keytab keytab, krb5_ticket **ticket, krb5_data *version); /** * Format a @c KRB-CRED message for an array of credentials. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] creds Null-terminated array of credentials * @param [out] der_out Encoded credentials * @param [out] rdata_out Replay cache information (NULL if not needed) * * This function takes an array of credentials @a creds and formats * a @c KRB-CRED message @a der_out to pass to krb5_rd_cred(). * * The local and remote addresses in @a auth_context are optional; if either is * specified, they are used to form the sender and receiver addresses in the * KRB-CRED message. * * @note The @a rdata_out argument is required if the * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set * in @a auth_context. * * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, an entry * for the message is entered in an in-memory replay cache to detect if the * message is reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not * set, no replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a * auth_context, the timestamp used for the KRB-CRED message is stored in @a * rdata_out. * * If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE * is set, the @a auth_context local sequence number is included in the * KRB-CRED message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE * is set, the sequence number used is stored in @a rdata_out. * * Use krb5_free_data_contents() to free @a der_out when it is no longer * needed. * * The message will be encrypted using the send subkey of @a auth_context if it * is present, or the session key otherwise. If neither key is present, the * credentials will not be encrypted, and the message should only be sent over * a secure channel. No replay cache entry is used in this case. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_ncred(krb5_context context, krb5_auth_context auth_context, krb5_creds **creds, krb5_data **der_out, krb5_replay_data *rdata_out); /** * Format a @c KRB-CRED message for a single set of credentials. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] creds Pointer to credentials * @param [out] der_out Encoded credentials * @param [out] rdata_out Replay cache data (NULL if not needed) * * This is a convenience function that calls krb5_mk_ncred() with a single set * of credentials. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_mk_1cred(krb5_context context, krb5_auth_context auth_context, krb5_creds *creds, krb5_data **der_out, krb5_replay_data *rdata_out); /** * Read and validate a @c KRB-CRED message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] creddata @c KRB-CRED message * @param [out] creds_out Null-terminated array of forwarded credentials * @param [out] rdata_out Replay data (NULL if not needed) * * @note The @a rdata_out argument is required if the * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set * in @a auth_context.` * * @a creddata will be decrypted using the receiving subkey if it is present in * @a auth_context, or the session key if the receiving subkey is not present * or fails to decrypt the message. * * Use krb5_free_tgt_creds() to free @a creds_out when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_rd_cred(krb5_context context, krb5_auth_context auth_context, krb5_data *creddata, krb5_creds ***creds_out, krb5_replay_data *rdata_out); /** * Get a forwarded TGT and format a @c KRB-CRED message. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] rhost Remote host * @param [in] client Client principal of TGT * @param [in] server Principal of server to receive TGT * @param [in] cc Credential cache handle (NULL to use default) * @param [in] forwardable Whether TGT should be forwardable * @param [out] outbuf KRB-CRED message * * Get a TGT for use at the remote host @a rhost and format it into a KRB-CRED * message. If @a rhost is NULL and @a server is of type #KRB5_NT_SRV_HST, * the second component of @a server will be used. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @retval * KRB5_PRINC_NOMATCH Requested principal and ticket do not match * @retval * KRB5_NO_TKT_SUPPLIED Request did not supply a ticket * @retval * KRB5_CC_BADNAME Credential cache name or principal name malformed * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_fwd_tgt_creds(krb5_context context, krb5_auth_context auth_context, const char *rhost, krb5_principal client, krb5_principal server, krb5_ccache cc, int forwardable, krb5_data *outbuf); /** * Create and initialize an authentication context. * * @param [in] context Library context * @param [out] auth_context Authentication context * * This function creates an authentication context to hold configuration and * state relevant to krb5 functions for authenticating principals and * protecting messages once authentication has occurred. * * By default, flags for the context are set to enable the use of the replay * cache (#KRB5_AUTH_CONTEXT_DO_TIME), but not sequence numbers. Use * krb5_auth_con_setflags() to change the flags. * * The allocated @a auth_context must be freed with krb5_auth_con_free() when * it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_init(krb5_context context, krb5_auth_context *auth_context); /** * Free a krb5_auth_context structure. * * @param [in] context Library context * @param [in] auth_context Authentication context to be freed * * This function frees an auth context allocated by krb5_auth_con_init(). * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_free(krb5_context context, krb5_auth_context auth_context); /** * Set a flags field in a krb5_auth_context structure. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] flags Flags bit mask * * Valid values for @a flags are: * @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps * @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps * @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers * @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setflags(krb5_context context, krb5_auth_context auth_context, krb5_int32 flags); /** * Retrieve flags from a krb5_auth_context structure. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] flags Flags bit mask * * Valid values for @a flags are: * @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps * @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps * @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers * @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getflags(krb5_context context, krb5_auth_context auth_context, krb5_int32 *flags); /** * Set a checksum callback in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] func Checksum callback * @param [in] data Callback argument * * Set a callback to obtain checksum data in krb5_mk_req(). The callback will * be invoked after the subkey and local sequence number are stored in @a * auth_context. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_set_checksum_func( krb5_context context, krb5_auth_context auth_context, krb5_mk_req_checksum_func func, void *data); /** * Get the checksum callback from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] func Checksum callback * @param [out] data Callback argument * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_get_checksum_func( krb5_context context, krb5_auth_context auth_context, krb5_mk_req_checksum_func *func, void **data); /** * Set the local and remote addresses in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] local_addr Local address * @param [in] remote_addr Remote address * * This function releases the storage assigned to the contents of the local and * remote addresses of @a auth_context and then sets them to @a local_addr and * @a remote_addr respectively. * * @sa krb5_auth_con_genaddrs() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV_WRONG krb5_auth_con_setaddrs(krb5_context context, krb5_auth_context auth_context, krb5_address *local_addr, krb5_address *remote_addr); /** * Retrieve address fields from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] local_addr Local address (NULL if not needed) * @param [out] remote_addr Remote address (NULL if not needed) * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getaddrs(krb5_context context, krb5_auth_context auth_context, krb5_address **local_addr, krb5_address **remote_addr); /** * Set local and remote port fields in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] local_port Local port * @param [in] remote_port Remote port * * This function releases the storage assigned to the contents of the local and * remote ports of @a auth_context and then sets them to @a local_port and @a * remote_port respectively. * * @sa krb5_auth_con_genaddrs() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setports(krb5_context context, krb5_auth_context auth_context, krb5_address *local_port, krb5_address *remote_port); /** * Set the session key in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] keyblock User key * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock); /** * Retrieve the session key from an auth context as a keyblock. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] keyblock Session key * * This function creates a keyblock containing the session key from @a * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no * longer needed * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock); /** * Retrieve the session key from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] key Session key * * This function sets @a key to the session key from @a auth_context. Use * krb5_k_free_key() to release @a key when it is no longer needed. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getkey_k(krb5_context context, krb5_auth_context auth_context, krb5_key *key); /** * Retrieve the send subkey from an auth context as a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] keyblock Send subkey * * This function creates a keyblock containing the send subkey from @a * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no * longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getsendsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock); /** * Retrieve the send subkey from an auth context. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] key Send subkey * * This function sets @a key to the send subkey from @a auth_context. Use * krb5_k_free_key() to release @a key when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getsendsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key *key); /** * Retrieve the receiving subkey from an auth context as a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] keyblock Receiving subkey * * This function creates a keyblock containing the receiving subkey from @a * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no * longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getrecvsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock); /** * Retrieve the receiving subkey from an auth context as a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] key Receiving subkey * * This function sets @a key to the receiving subkey from @a auth_context. Use * krb5_k_free_key() to release @a key when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getrecvsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key *key); /** * Set the send subkey in an auth context with a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [in] keyblock Send subkey * * This function sets the send subkey in @a ac to a copy of @a keyblock. * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setsendsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock *keyblock); /** * Set the send subkey in an auth context. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [out] key Send subkey * * This function sets the send subkey in @a ac to @a key, incrementing its * reference count. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setsendsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key key); /** * Set the receiving subkey in an auth context with a keyblock. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [in] keyblock Receiving subkey * * This function sets the receiving subkey in @a ac to a copy of @a keyblock. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setrecvsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock *keyblock); /** * Set the receiving subkey in an auth context. * * @param [in] ctx Library context * @param [in] ac Authentication context * @param [in] key Receiving subkey * * This function sets the receiving subkey in @a ac to @a key, incrementing its * reference count. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setrecvsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key key); #if KRB5_DEPRECATED /** @deprecated Replaced by krb5_auth_con_getsendsubkey(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_auth_con_getlocalsubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock); /** @deprecated Replaced by krb5_auth_con_getrecvsubkey(). */ KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV krb5_auth_con_getremotesubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock); #endif /** * Retrieve the local sequence number from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] seqnumber Local sequence number * * Retrieve the local sequence number from @a auth_context and return it in @a * seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a * auth_context for this function to be useful. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getlocalseqnumber(krb5_context context, krb5_auth_context auth_context, krb5_int32 *seqnumber); /** * Retrieve the remote sequence number from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] seqnumber Remote sequence number * * Retrieve the remote sequence number from @a auth_context and return it in @a * seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a * auth_context for this function to be useful. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getremoteseqnumber(krb5_context context, krb5_auth_context auth_context, krb5_int32 *seqnumber); /** * Cause an auth context to use cipher state. * * @param [in] context Library context * @param [in] auth_context Authentication context * * Prepare @a auth_context to use cipher state when krb5_mk_priv() or * krb5_rd_priv() encrypt or decrypt data. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_initivector(krb5_context context, krb5_auth_context auth_context); /** * Set the replay cache in an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] rcache Replay cache haddle * * This function sets the replay cache in @a auth_context to @a rcache. @a * rcache will be closed when @a auth_context is freed, so the caller should * relinquish that responsibility. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_setrcache(krb5_context context, krb5_auth_context auth_context, krb5_rcache rcache); /** * Retrieve the replay cache from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] rcache Replay cache handle * * This function fetches the replay cache from @a auth_context. The caller * should not close @a rcache. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV_WRONG krb5_auth_con_getrcache(krb5_context context, krb5_auth_context auth_context, krb5_rcache *rcache); /** * Retrieve the authenticator from an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [out] authenticator Authenticator * * Use krb5_free_authenticator() to free @a authenticator when it is no longer * needed. * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_getauthenticator(krb5_context context, krb5_auth_context auth_context, krb5_authenticator **authenticator); /** * Set checksum type in an an auth context. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] cksumtype Checksum type * * This function sets the checksum type in @a auth_context to be used by * krb5_mk_req() for the authenticator checksum. * * @retval 0 Success. Otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_set_req_cksumtype(krb5_context context, krb5_auth_context auth_context, krb5_cksumtype cksumtype); #define KRB5_REALM_BRANCH_CHAR '.' /* * end "func-proto.h" */ /* * begin stuff from libos.h */ /** * @brief Read a password from keyboard input. * * @param [in] context Library context * @param [in] prompt First user prompt when reading password * @param [in] prompt2 Second user prompt (NULL to prompt only once) * @param [out] return_pwd Returned password * @param [in,out] size_return On input, maximum size of password; on output, * size of password read * * This function reads a password from keyboard input and stores it in @a * return_pwd. @a size_return should be set by the caller to the amount of * storage space available in @a return_pwd; on successful return, it will be * set to the length of the password read. * * @a prompt is printed to the terminal, followed by ": ", and then a password * is read from the keyboard. * * If @a prompt2 is NULL, the password is read only once. Otherwise, @a * prompt2 is printed to the terminal and a second password is read. If the * two passwords entered are not identical, KRB5_LIBOS_BADPWDMATCH is returned. * * Echoing is turned off when the password is read. * * @retval * 0 Success * @return * Error in reading or verifying the password * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_read_password(krb5_context context, const char *prompt, const char *prompt2, char *return_pwd, unsigned int *size_return); /** * Convert a principal name to a local name. * * @param [in] context Library context * @param [in] aname Principal name * @param [in] lnsize_in Space available in @a lname * @param [out] lname Local name buffer to be filled in * * If @a aname does not correspond to any local account, KRB5_LNAME_NOTRANS is * returned. If @a lnsize_in is too small for the local name, * KRB5_CONFIG_NOTENUFSPACE is returned. * * Local names, rather than principal names, can be used by programs that * translate to an environment-specific name (for example, a user account * name). * * @retval * 0 Success * @retval * System errors * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_aname_to_localname(krb5_context context, krb5_const_principal aname, int lnsize_in, char *lname); /** * Get the Kerberos realm names for a host. * * @param [in] context Library context * @param [in] host Host name (or NULL) * @param [out] realmsp Null-terminated list of realm names * * Fill in @a realmsp with a pointer to a null-terminated list of realm names. * If there are no known realms for the host, a list containing the referral * (empty) realm is returned. * * If @a host is NULL, the local host's realms are determined. * * Use krb5_free_host_realm() to release @a realmsp when it is no longer * needed. * * @retval * 0 Success * @retval * ENOMEM Insufficient memory * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_host_realm(krb5_context context, const char *host, char ***realmsp); /** * * @param [in] context Library context * @param [in] hdata Host name (or NULL) * @param [out] realmsp Null-terminated list of realm names * * Fill in @a realmsp with a pointer to a null-terminated list of realm names * obtained through heuristics or insecure resolution methods which have lower * priority than KDC referrals. * * If @a host is NULL, the local host's realms are determined. * * Use krb5_free_host_realm() to release @a realmsp when it is no longer * needed. */ krb5_error_code KRB5_CALLCONV krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***realmsp); /** * Free the memory allocated by krb5_get_host_realm(). * * @param [in] context Library context * @param [in] realmlist List of realm names to be released * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_free_host_realm(krb5_context context, char *const *realmlist); /** * Determine if a principal is authorized to log in as a local user. * * @param [in] context Library context * @param [in] principal Principal name * @param [in] luser Local username * * Determine whether @a principal is authorized to log in as a local user @a * luser. * * @retval * TRUE Principal is authorized to log in as user; FALSE otherwise. */ krb5_boolean KRB5_CALLCONV krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser); /** * Generate auth context addresses from a connected socket. * * @param [in] context Library context * @param [in] auth_context Authentication context * @param [in] infd Connected socket descriptor * @param [in] flags Flags * * This function sets the local and/or remote addresses in @a auth_context * based on the local and remote endpoints of the socket @a infd. The * following flags determine the operations performed: * * @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR Generate local address. * @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR Generate remote address. * @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR Generate local address and port. * @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR Generate remote address and port. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_auth_con_genaddrs(krb5_context context, krb5_auth_context auth_context, int infd, int flags); /** * Set time offset field in a krb5_context structure. * * @param [in] context Library context * @param [in] seconds Real time, seconds portion * @param [in] microseconds Real time, microseconds portion * * This function sets the time offset in @a context to the difference between * the system time and the real time as determined by @a seconds and @a * microseconds. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_set_real_time(krb5_context context, krb5_timestamp seconds, krb5_int32 microseconds); /** * Return the time offsets from the os context. * * @param [in] context Library context * @param [out] seconds Time offset, seconds portion * @param [out] microseconds Time offset, microseconds portion * * This function returns the time offsets in @a context. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_time_offsets(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds); /* str_conv.c */ /** * Convert a string to an encryption type. * * @param [in] string String to convert to an encryption type * @param [out] enctypep Encryption type * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_enctype(char *string, krb5_enctype *enctypep); /** * Convert a string to a salt type. * * @param [in] string String to convert to an encryption type * @param [out] salttypep Salt type to be filled in * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_salttype(char *string, krb5_int32 *salttypep); /** * Convert a string to a checksum type. * * @param [in] string String to be converted * @param [out] cksumtypep Checksum type to be filled in * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_cksumtype(char *string, krb5_cksumtype *cksumtypep); /** * Convert a string to a timestamp. * * @param [in] string String to be converted * @param [out] timestampp Pointer to timestamp * * @retval 0 Success; otherwise - EINVAL */ krb5_error_code KRB5_CALLCONV krb5_string_to_timestamp(char *string, krb5_timestamp *timestampp); /** * Convert a string to a delta time value. * * @param [in] string String to be converted * @param [out] deltatp Delta time to be filled in * * @retval 0 Success; otherwise - KRB5_DELTAT_BADFORMAT */ krb5_error_code KRB5_CALLCONV krb5_string_to_deltat(char *string, krb5_deltat *deltatp); /** * Convert an encryption type to a string. * * @param [in] enctype Encryption type * @param [out] buffer Buffer to hold encryption type string * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_enctype_to_string(krb5_enctype enctype, char *buffer, size_t buflen); /** * Convert an encryption type to a name or alias. * * @param [in] enctype Encryption type * @param [in] shortest Flag * @param [out] buffer Buffer to hold encryption type string * @param [in] buflen Storage available in @a buffer * * If @a shortest is FALSE, this function returns the enctype's canonical name * (like "aes128-cts-hmac-sha1-96"). If @a shortest is TRUE, it return the * enctype's shortest alias (like "aes128-cts"). * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_enctype_to_name(krb5_enctype enctype, krb5_boolean shortest, char *buffer, size_t buflen); /** * Convert a salt type to a string. * * @param [in] salttype Salttype to convert * @param [out] buffer Buffer to receive the converted string * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_salttype_to_string(krb5_int32 salttype, char *buffer, size_t buflen); /** * Convert a checksum type to a string. * * @param [in] cksumtype Checksum type * @param [out] buffer Buffer to hold converted checksum type * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_cksumtype_to_string(krb5_cksumtype cksumtype, char *buffer, size_t buflen); /** * Convert a timestamp to a string. * * @param [in] timestamp Timestamp to convert * @param [out] buffer Buffer to hold converted timestamp * @param [in] buflen Storage available in @a buffer * * The string is returned in the locale's appropriate date and time * representation. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_timestamp_to_string(krb5_timestamp timestamp, char *buffer, size_t buflen); /** * Convert a timestamp to a string, with optional output padding * * @param [in] timestamp Timestamp to convert * @param [out] buffer Buffer to hold the converted timestamp * @param [in] buflen Length of buffer * @param [in] pad Optional value to pad @a buffer if converted * timestamp does not fill it * * If @a pad is not NULL, @a buffer is padded out to @a buflen - 1 characters * with the value of *@a pad. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_timestamp_to_sfstring(krb5_timestamp timestamp, char *buffer, size_t buflen, char *pad); /** * Convert a relative time value to a string. * * @param [in] deltat Relative time value to convert * @param [out] buffer Buffer to hold time string * @param [in] buflen Storage available in @a buffer * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_deltat_to_string(krb5_deltat deltat, char *buffer, size_t buflen); /* The name of the Kerberos ticket granting service... and its size */ #define KRB5_TGS_NAME "krbtgt" #define KRB5_TGS_NAME_SIZE 6 /* flags for recvauth */ #define KRB5_RECVAUTH_SKIP_VERSION 0x0001 #define KRB5_RECVAUTH_BADAUTHVERS 0x0002 /* initial ticket api functions */ /** Text for prompt used in prompter callback function. */ typedef struct _krb5_prompt { char *prompt; /**< The prompt to show to the user */ int hidden; /**< Boolean; informative prompt or hidden (e.g. PIN) */ krb5_data *reply; /**< Must be allocated before call to prompt routine */ } krb5_prompt; /** Pointer to a prompter callback function. */ typedef krb5_error_code (KRB5_CALLCONV *krb5_prompter_fct)(krb5_context context, void *data, const char *name, const char *banner, int num_prompts, krb5_prompt prompts[]); /** * Prompt user for password. * * @param [in] context Library context * @param data Unused (callback argument) * @param [in] name Name to output during prompt * @param [in] banner Banner to output during prompt * @param [in] num_prompts Number of prompts in @a prompts * @param [in] prompts Array of prompts and replies * * This function is intended to be used as a prompter callback for * krb5_get_init_creds_password() or krb5_init_creds_init(). * * Writes @a name and @a banner to stdout, each followed by a newline, then * writes each prompt field in the @a prompts array, followed by ": ", and sets * the reply field of the entry to a line of input read from stdin. If the * hidden flag is set for a prompt, then terminal echoing is turned off when * input is read. * * @retval * 0 Success * @return * Kerberos error codes * */ krb5_error_code KRB5_CALLCONV krb5_prompter_posix(krb5_context context, void *data, const char *name, const char *banner, int num_prompts, krb5_prompt prompts[]); /** * Long-term password responder question * * This question is asked when the long-term password is needed. It has no * challenge and the response is simply the password string. * * @version New in 1.11 */ #define KRB5_RESPONDER_QUESTION_PASSWORD "password" /** * OTP responder question * * The OTP responder question is asked when the KDC indicates that an OTP * value is required in order to complete the authentication. The JSON format * of the challenge is: * * @n { * @n "service": <string (optional)>, * @n "tokenInfo": [ * @n { * @n "flags": <number>, * @n "vendor": <string (optional)>, * @n "challenge": <string (optional)>, * @n "length": <number (optional)>, * @n "format": <number (optional)>, * @n "tokenID": <string (optional)>, * @n "algID": <string (optional)>, * @n }, * @n ... * @n ] * @n } * * The answer to the question MUST be JSON formatted: * * @n { * @n "tokeninfo": <number>, * @n "value": <string (optional)>, * @n "pin": <string (optional)>, * @n } * * For more detail, please see RFC 6560. * * @version New in 1.11 */ #define KRB5_RESPONDER_QUESTION_OTP "otp" /** * These format constants identify the format of the token value. */ #define KRB5_RESPONDER_OTP_FORMAT_DECIMAL 0 #define KRB5_RESPONDER_OTP_FORMAT_HEXADECIMAL 1 #define KRB5_RESPONDER_OTP_FORMAT_ALPHANUMERIC 2 /** * This flag indicates that the token value MUST be collected. */ #define KRB5_RESPONDER_OTP_FLAGS_COLLECT_TOKEN 0x0001 /** * This flag indicates that the PIN value MUST be collected. */ #define KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN 0x0002 /** * This flag indicates that the token is now in re-synchronization mode with * the server. The user is expected to reply with the next code displayed on * the token. */ #define KRB5_RESPONDER_OTP_FLAGS_NEXTOTP 0x0004 /** * This flag indicates that the PIN MUST be returned as a separate item. This * flag only takes effect if KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN is set. If * this flag is not set, the responder may either concatenate PIN + token value * and store it as "value" in the answer or it may return them separately. If * they are returned separately, they will be concatenated internally. */ #define KRB5_RESPONDER_OTP_FLAGS_SEPARATE_PIN 0x0008 /** * PKINIT responder question * * The PKINIT responder question is asked when the client needs a password * that's being used to protect key information, and is formatted as a JSON * object. A specific identity's flags value, if not zero, is the bitwise-OR * of one or more of the KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_* flags defined * below, and possibly other flags to be added later. Any resemblance to * similarly-named CKF_* values in the PKCS#11 API should not be depended on. * * @n { * @n identity <string> : flags <number>, * @n ... * @n } * * The answer to the question MUST be JSON formatted: * * @n { * @n identity <string> : password <string>, * @n ... * @n } * * @version New in 1.12 */ #define KRB5_RESPONDER_QUESTION_PKINIT "pkinit" /** * This flag indicates that an incorrect PIN was supplied at least once since * the last time the correct PIN was supplied. */ #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_COUNT_LOW (1 << 0) /** * This flag indicates that supplying an incorrect PIN will cause the token to * lock itself. */ #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_FINAL_TRY (1 << 1) /** * This flag indicates that the user PIN is locked, and you can't log in to the * token with it. */ #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_LOCKED (1 << 2) /** * A container for a set of preauthentication questions and answers * * A responder context is supplied by the krb5 authentication system to a @ref * krb5_responder_fn callback. It contains a list of questions and can receive * answers. Questions contained in a responder context can be listed using * krb5_responder_list_questions(), retrieved using * krb5_responder_get_challenge(), or answered using * krb5_responder_set_answer(). The form of a question's challenge and * answer depend on the question name. * * @version New in 1.11 */ typedef struct krb5_responder_context_st *krb5_responder_context; /** * List the question names contained in the responder context. * * @param [in] ctx Library context * @param [in] rctx Responder context * * Return a pointer to a null-terminated list of question names which are * present in @a rctx. The pointer is an alias, valid only as long as the * lifetime of @a rctx, and should not be modified or freed by the caller. A * question's challenge can be retrieved using krb5_responder_get_challenge() * and answered using krb5_responder_set_answer(). * * @version New in 1.11 */ const char * const * KRB5_CALLCONV krb5_responder_list_questions(krb5_context ctx, krb5_responder_context rctx); /** * Retrieve the challenge data for a given question in the responder context. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] question Question name * * Return a pointer to a C string containing the challenge for @a question * within @a rctx, or NULL if the question is not present in @a rctx. The * structure of the question depends on the question name, but will always be * printable UTF-8 text. The returned pointer is an alias, valid only as long * as the lifetime of @a rctx, and should not be modified or freed by the * caller. * * @version New in 1.11 */ const char * KRB5_CALLCONV krb5_responder_get_challenge(krb5_context ctx, krb5_responder_context rctx, const char *question); /** * Answer a named question in the responder context. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] question Question name * @param [in] answer The string to set (MUST be printable UTF-8) * * This function supplies an answer to @a question within @a rctx. The * appropriate form of the answer depends on the question name. * * @retval EINVAL @a question is not present within @a rctx * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_responder_set_answer(krb5_context ctx, krb5_responder_context rctx, const char *question, const char *answer); /** * Responder function for an initial credential exchange. * * @param [in] ctx Library context * @param [in] data Callback data * @param [in] rctx Responder context * * A responder function is like a prompter function, but is used for handling * questions and answers as potentially complex data types. Client * preauthentication modules will insert a set of named "questions" into * the responder context. Each question may optionally contain a challenge. * This challenge is printable UTF-8, but may be an encoded value. The * precise encoding and contents of the challenge are specific to the question * asked. When the responder is called, it should answer all the questions it * understands. Like the challenge, the answer MUST be printable UTF-8, but * may contain structured/encoded data formatted to the expected answer format * of the question. * * If a required question is unanswered, the prompter may be called. */ typedef krb5_error_code (KRB5_CALLCONV *krb5_responder_fn)(krb5_context ctx, void *data, krb5_responder_context rctx); typedef struct _krb5_responder_otp_tokeninfo { krb5_flags flags; krb5_int32 format; /* -1 when not specified. */ krb5_int32 length; /* -1 when not specified. */ char *vendor; char *challenge; char *token_id; char *alg_id; } krb5_responder_otp_tokeninfo; typedef struct _krb5_responder_otp_challenge { char *service; krb5_responder_otp_tokeninfo **tokeninfo; } krb5_responder_otp_challenge; /** * Decode the KRB5_RESPONDER_QUESTION_OTP to a C struct. * * A convenience function which parses the KRB5_RESPONDER_QUESTION_OTP * question challenge data, making it available in native C. The main feature * of this function is the ability to interact with OTP tokens without parsing * the JSON. * * The returned value must be passed to krb5_responder_otp_challenge_free() to * be freed. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [out] chl Challenge structure * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_responder_otp_get_challenge(krb5_context ctx, krb5_responder_context rctx, krb5_responder_otp_challenge **chl); /** * Answer the KRB5_RESPONDER_QUESTION_OTP question. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] ti The index of the tokeninfo selected * @param [in] value The value to set, or NULL for none * @param [in] pin The pin to set, or NULL for none * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_responder_otp_set_answer(krb5_context ctx, krb5_responder_context rctx, size_t ti, const char *value, const char *pin); /** * Free the value returned by krb5_responder_otp_get_challenge(). * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] chl The challenge to free * * @version New in 1.11 */ void KRB5_CALLCONV krb5_responder_otp_challenge_free(krb5_context ctx, krb5_responder_context rctx, krb5_responder_otp_challenge *chl); typedef struct _krb5_responder_pkinit_identity { char *identity; krb5_int32 token_flags; /* 0 when not specified or not applicable. */ } krb5_responder_pkinit_identity; typedef struct _krb5_responder_pkinit_challenge { krb5_responder_pkinit_identity **identities; } krb5_responder_pkinit_challenge; /** * Decode the KRB5_RESPONDER_QUESTION_PKINIT to a C struct. * * A convenience function which parses the KRB5_RESPONDER_QUESTION_PKINIT * question challenge data, making it available in native C. The main feature * of this function is the ability to read the challenge without parsing * the JSON. * * The returned value must be passed to krb5_responder_pkinit_challenge_free() * to be freed. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [out] chl_out Challenge structure * * @version New in 1.12 */ krb5_error_code KRB5_CALLCONV krb5_responder_pkinit_get_challenge(krb5_context ctx, krb5_responder_context rctx, krb5_responder_pkinit_challenge **chl_out); /** * Answer the KRB5_RESPONDER_QUESTION_PKINIT question for one identity. * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] identity The identity for which a PIN is being supplied * @param [in] pin The provided PIN, or NULL for none * * @version New in 1.12 */ krb5_error_code KRB5_CALLCONV krb5_responder_pkinit_set_answer(krb5_context ctx, krb5_responder_context rctx, const char *identity, const char *pin); /** * Free the value returned by krb5_responder_pkinit_get_challenge(). * * @param [in] ctx Library context * @param [in] rctx Responder context * @param [in] chl The challenge to free * * @version New in 1.12 */ void KRB5_CALLCONV krb5_responder_pkinit_challenge_free(krb5_context ctx, krb5_responder_context rctx, krb5_responder_pkinit_challenge *chl); /** Store options for @c _krb5_get_init_creds */ typedef struct _krb5_get_init_creds_opt { krb5_flags flags; krb5_deltat tkt_life; krb5_deltat renew_life; int forwardable; int proxiable; krb5_enctype *etype_list; int etype_list_length; krb5_address **address_list; krb5_preauthtype *preauth_list; int preauth_list_length; krb5_data *salt; } krb5_get_init_creds_opt; #define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001 #define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002 #define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004 #define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008 #define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010 #define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020 #define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040 #define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080 #define KRB5_GET_INIT_CREDS_OPT_CHG_PWD_PRMPT 0x0100 #define KRB5_GET_INIT_CREDS_OPT_CANONICALIZE 0x0200 #define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS 0x0400 /** * Allocate a new initial credential options structure. * * @param [in] context Library context * @param [out] opt New options structure * * This function is the preferred way to create an options structure for * getting initial credentials, and is required to make use of certain options. * Use krb5_get_init_creds_opt_free() to free @a opt when it is no longer * needed. * * @retval 0 - Success; Kerberos errors otherwise. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_alloc(krb5_context context, krb5_get_init_creds_opt **opt); /** * Free initial credential options. * * @param [in] context Library context * @param [in] opt Options structure to free * * @sa krb5_get_init_creds_opt_alloc() */ void KRB5_CALLCONV krb5_get_init_creds_opt_free(krb5_context context, krb5_get_init_creds_opt *opt); /** @deprecated Use krb5_get_init_creds_opt_alloc() instead. */ void KRB5_CALLCONV krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt); /** * Set the ticket lifetime in initial credential options. * * @param [in] opt Options structure * @param [in] tkt_life Ticket lifetime */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_tkt_life(krb5_get_init_creds_opt *opt, krb5_deltat tkt_life); /** * Set the ticket renewal lifetime in initial credential options. * * @param [in] opt Pointer to @a options field * @param [in] renew_life Ticket renewal lifetime */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_renew_life(krb5_get_init_creds_opt *opt, krb5_deltat renew_life); /** * Set or unset the forwardable flag in initial credential options. * * @param [in] opt Options structure * @param [in] forwardable Whether credentials should be forwardable */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_forwardable(krb5_get_init_creds_opt *opt, int forwardable); /** * Set or unset the proxiable flag in initial credential options. * * @param [in] opt Options structure * @param [in] proxiable Whether credentials should be proxiable */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_proxiable(krb5_get_init_creds_opt *opt, int proxiable); /** * Set or unset the canonicalize flag in initial credential options. * * @param [in] opt Options structure * @param [in] canonicalize Whether to canonicalize client principal */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_canonicalize(krb5_get_init_creds_opt *opt, int canonicalize); /** * Set or unset the anonymous flag in initial credential options. * * @param [in] opt Options structure * @param [in] anonymous Whether to make an anonymous request * * This function may be used to request anonymous credentials from the KDC by * setting @a anonymous to non-zero. Note that anonymous credentials are only * a request; clients must verify that credentials are anonymous if that is a * requirement. */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_anonymous(krb5_get_init_creds_opt *opt, int anonymous); /** * Set allowable encryption types in initial credential options. * * @param [in] opt Options structure * @param [in] etype_list Array of encryption types * @param [in] etype_list_length Length of @a etype_list */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_etype_list(krb5_get_init_creds_opt *opt, krb5_enctype *etype_list, int etype_list_length); /** * Set address restrictions in initial credential options. * * @param [in] opt Options structure * @param [in] addresses Null-terminated array of addresses */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_address_list(krb5_get_init_creds_opt *opt, krb5_address **addresses); /** * Set preauthentication types in initial credential options. * * @param [in] opt Options structure * @param [in] preauth_list Array of preauthentication types * @param [in] preauth_list_length Length of @a preauth_list * * This function can be used to perform optimistic preauthentication when * getting initial credentials, in combination with * krb5_get_init_creds_opt_set_salt() and krb5_get_init_creds_opt_set_pa(). */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_preauth_list(krb5_get_init_creds_opt *opt, krb5_preauthtype *preauth_list, int preauth_list_length); /** * Set salt for optimistic preauthentication in initial credential options. * * @param [in] opt Options structure * @param [in] salt Salt data * * When getting initial credentials with a password, a salt string it used to * convert the password to a key. Normally this salt is obtained from the * first KDC reply, but when performing optimistic preauthentication, the * client may need to supply the salt string with this function. */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt, krb5_data *salt); /** * Set or unset change-password-prompt flag in initial credential options. * * @param [in] opt Options structure * @param [in] prompt Whether to prompt to change password * * This flag is on by default. It controls whether * krb5_get_init_creds_password() will react to an expired-password error by * prompting for a new password and attempting to change the old one. */ void KRB5_CALLCONV krb5_get_init_creds_opt_set_change_password_prompt(krb5_get_init_creds_opt *opt, int prompt); /** Generic preauth option attribute/value pairs */ typedef struct _krb5_gic_opt_pa_data { char *attr; char *value; } krb5_gic_opt_pa_data; /** * Supply options for preauthentication in initial credential options. * * @param [in] context Library context * @param [in] opt Options structure * @param [in] attr Preauthentication option name * @param [in] value Preauthentication option value * * This function allows the caller to supply options for preauthentication. * The values of @a attr and @a value are supplied to each preauthentication * module available within @a context. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_pa(krb5_context context, krb5_get_init_creds_opt *opt, const char *attr, const char *value); /** * Set location of FAST armor ccache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] fast_ccache_name Credential cache name * * Sets the location of a credential cache containing an armor ticket to * protect an initial credential exchange using the FAST protocol extension. * * In version 1.7, setting an armor ccache requires that FAST be used for the * exchange. In version 1.8 or later, setting the armor ccache causes FAST to * be used if the KDC supports it; krb5_get_init_creds_opt_set_fast_flags() * must be used to require that FAST be used. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_fast_ccache_name(krb5_context context, krb5_get_init_creds_opt *opt, const char *fast_ccache_name); /** * Set FAST armor cache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] ccache Credential cache handle * * This function is similar to krb5_get_init_creds_opt_set_fast_ccache_name(), * but uses a credential cache handle instead of a name. * * @version New in 1.9 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_fast_ccache(krb5_context context, krb5_get_init_creds_opt *opt, krb5_ccache ccache); /** * Set an input credential cache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] ccache Credential cache handle * * If an input credential cache is set, then the krb5_get_init_creds family of * APIs will read settings from it. Setting an input ccache is desirable when * the application wishes to perform authentication in the same way (using the * same preauthentication mechanisms, and making the same non-security- * sensitive choices) as the previous authentication attempt, which stored * information in the passed-in ccache. * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_in_ccache(krb5_context context, krb5_get_init_creds_opt *opt, krb5_ccache ccache); /** * Set an output credential cache in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] ccache Credential cache handle * * If an output credential cache is set, then the krb5_get_init_creds family of * APIs will write credentials to it. Setting an output ccache is desirable * both because it simplifies calling code and because it permits the * krb5_get_init_creds APIs to write out configuration information about the * realm to the ccache. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_out_ccache(krb5_context context, krb5_get_init_creds_opt *opt, krb5_ccache ccache); /** * @brief Ask the KDC to include or not include a PAC in the ticket * * @param [in] context Library context * @param [in] opt Options structure * @param [in] req_pac Whether to request a PAC or not * * If this option is set, the AS request will include a PAC-REQUEST pa-data * item explicitly asking the KDC to either include or not include a privilege * attribute certificate in the ticket authorization data. By default, no * request is made; typically the KDC will default to including a PAC if it * supports them. * * @version New in 1.15 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_pac_request(krb5_context context, krb5_get_init_creds_opt *opt, krb5_boolean req_pac); /** * Set FAST flags in initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [in] flags FAST flags * * The following flag values are valid: * @li #KRB5_FAST_REQUIRED - Require FAST to be used * * @retval * 0 - Success; Kerberos errors otherwise. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_fast_flags(krb5_context context, krb5_get_init_creds_opt *opt, krb5_flags flags); /** * Retrieve FAST flags from initial credential options. * * @param [in] context Library context * @param [in] opt Options * @param [out] out_flags FAST flags * * @retval * 0 - Success; Kerberos errors otherwise. */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_get_fast_flags(krb5_context context, krb5_get_init_creds_opt *opt, krb5_flags *out_flags); /* Fast flags*/ #define KRB5_FAST_REQUIRED 0x0001 /**< Require KDC to support FAST*/ typedef void (KRB5_CALLCONV *krb5_expire_callback_func)(krb5_context context, void *data, krb5_timestamp password_expiration, krb5_timestamp account_expiration, krb5_boolean is_last_req); /** * Set an expiration callback in initial credential options. * * @param [in] context Library context * @param [in] opt Options structure * @param [in] cb Callback function * @param [in] data Callback argument * * Set a callback to receive password and account expiration times. * * @a cb will be invoked if and only if credentials are successfully acquired. * The callback will receive the @a context from the calling function and the * @a data argument supplied with this API. The remaining arguments should be * interpreted as follows: * * If @a is_last_req is true, then the KDC reply contained last-req entries * which unambiguously indicated the password expiration, account expiration, * or both. (If either value was not present, the corresponding argument will * be 0.) Furthermore, a non-zero @a password_expiration should be taken as a * suggestion from the KDC that a warning be displayed. * * If @a is_last_req is false, then @a account_expiration will be 0 and @a * password_expiration will contain the expiration time of either the password * or account, or 0 if no expiration time was indicated in the KDC reply. The * callback should independently decide whether to display a password * expiration warning. * * Note that @a cb may be invoked even if credentials are being acquired for * the kadmin/changepw service in order to change the password. It is the * caller's responsibility to avoid displaying a password expiry warning in * this case. * * @warning Setting an expire callback with this API will cause * krb5_get_init_creds_password() not to send password expiry warnings to the * prompter, as it ordinarily may. * * @version New in 1.9 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_expire_callback(krb5_context context, krb5_get_init_creds_opt *opt, krb5_expire_callback_func cb, void *data); /** * Set the responder function in initial credential options. * * @param [in] context Library context * @param [in] opt Options structure * @param [in] responder Responder function * @param [in] data Responder data argument * * @version New in 1.11 */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_opt_set_responder(krb5_context context, krb5_get_init_creds_opt *opt, krb5_responder_fn responder, void *data); /** * Get initial credentials using a password. * * @param [in] context Library context * @param [out] creds New credentials * @param [in] client Client principal * @param [in] password Password (or NULL) * @param [in] prompter Prompter function * @param [in] data Prompter callback data * @param [in] start_time Time when ticket becomes valid (0 for now) * @param [in] in_tkt_service Service name of initial credentials (or NULL) * @param [in] k5_gic_options Initial credential options * * This function requests KDC for an initial credentials for @a client using @a * password. If @a password is NULL, a password will be prompted for using @a * prompter if necessary. If @a in_tkt_service is specified, it is parsed as a * principal name (with the realm ignored) and used as the service principal * for the request; otherwise the ticket-granting service is used. * * @sa krb5_verify_init_creds() * * @retval * 0 Success * @retval * EINVAL Invalid argument * @retval * KRB5_KDC_UNREACH Cannot contact any KDC for requested realm * @retval * KRB5_PREAUTH_FAILED Generic Pre-athentication failure * @retval * KRB5_LIBOS_PWDINTR Password read interrupted * @retval * KRB5_REALM_CANT_RESOLVE Cannot resolve network address for KDC in requested realm * @retval * KRB5KDC_ERR_KEY_EXP Password has expired * @retval * KRB5_LIBOS_BADPWDMATCH Password mismatch * @retval * KRB5_CHPW_PWDNULL New password cannot be zero length * @retval * KRB5_CHPW_FAIL Password change failed * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_password(krb5_context context, krb5_creds *creds, krb5_principal client, const char *password, krb5_prompter_fct prompter, void *data, krb5_deltat start_time, const char *in_tkt_service, krb5_get_init_creds_opt *k5_gic_options); /** * Retrieve enctype, salt and s2kparams from KDC * * @param [in] context Library context * @param [in] principal Principal whose information is requested * @param [in] opt Initial credential options * @param [out] enctype_out The enctype chosen by KDC * @param [out] salt_out Salt returned from KDC * @param [out] s2kparams_out String-to-key parameters returned from KDC * * Send an initial ticket request for @a principal and extract the encryption * type, salt type, and string-to-key parameters from the KDC response. If the * KDC provides no etype-info, set @a enctype_out to @c ENCTYPE_NULL and set @a * salt_out and @a s2kparams_out to empty. If the KDC etype-info provides no * salt, compute the default salt and place it in @a salt_out. If the KDC * etype-info provides no string-to-key parameters, set @a s2kparams_out to * empty. * * @a opt may be used to specify options which affect the initial request, such * as request encryption types or a FAST armor cache (see * krb5_get_init_creds_opt_set_etype_list() and * krb5_get_init_creds_opt_set_fast_ccache_name()). * * Use krb5_free_data_contents() to free @a salt_out and @a s2kparams_out when * they are no longer needed. * * @version New in 1.17 * * @retval 0 Success * @return A Kerberos error code */ krb5_error_code KRB5_CALLCONV krb5_get_etype_info(krb5_context context, krb5_principal principal, krb5_get_init_creds_opt *opt, krb5_enctype *enctype_out, krb5_data *salt_out, krb5_data *s2kparams_out); struct _krb5_init_creds_context; typedef struct _krb5_init_creds_context *krb5_init_creds_context; #define KRB5_INIT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */ /** * Free an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * * @a context must be the same as the one passed to krb5_init_creds_init() for * this initial credentials context. */ void KRB5_CALLCONV krb5_init_creds_free(krb5_context context, krb5_init_creds_context ctx); /** * Acquire credentials using an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * * This function synchronously obtains credentials using a context created by * krb5_init_creds_init(). On successful return, the credentials can be * retrieved with krb5_init_creds_get_creds(). * * @a context must be the same as the one passed to krb5_init_creds_init() for * this initial credentials context. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get(krb5_context context, krb5_init_creds_context ctx); /** * Retrieve acquired credentials from an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [out] creds Acquired credentials * * This function copies the acquired initial credentials from @a ctx into @a * creds, after the successful completion of krb5_init_creds_get() or * krb5_init_creds_step(). Use krb5_free_cred_contents() to free @a creds when * it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get_creds(krb5_context context, krb5_init_creds_context ctx, krb5_creds *creds); /** * Get the last error from KDC from an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [out] error Error from KDC, or NULL if none was received * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get_error(krb5_context context, krb5_init_creds_context ctx, krb5_error **error); /** * Create a context for acquiring initial credentials. * * @param [in] context Library context * @param [in] client Client principal to get initial creds for * @param [in] prompter Prompter callback * @param [in] data Prompter callback argument * @param [in] start_time Time when credentials become valid (0 for now) * @param [in] options Options structure (NULL for default) * @param [out] ctx New initial credentials context * * This function creates a new context for acquiring initial credentials. Use * krb5_init_creds_free() to free @a ctx when it is no longer needed. * * Any subsequent calls to krb5_init_creds_step(), krb5_init_creds_get(), or * krb5_init_creds_free() for this initial credentials context must use the * same @a context argument as the one passed to this function. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_init(krb5_context context, krb5_principal client, krb5_prompter_fct prompter, void *data, krb5_deltat start_time, krb5_get_init_creds_opt *options, krb5_init_creds_context *ctx); /** * Specify a keytab to use for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] keytab Key table handle * * This function supplies a keytab containing the client key for an initial * credentials request. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_set_keytab(krb5_context context, krb5_init_creds_context ctx, krb5_keytab keytab); /** * Get the next KDC request for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] in KDC response (empty on the first call) * @param [out] out Next KDC request * @param [out] realm Realm for next KDC request * @param [out] flags Output flags * * This function constructs the next KDC request in an initial credential * exchange, allowing the caller to control the transport of KDC requests and * replies. On the first call, @a in should be set to an empty buffer; on * subsequent calls, it should be set to the KDC's reply to the previous * request. * * If more requests are needed, @a flags will be set to * #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in * @a out. If no more requests are needed, @a flags will not contain * #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty. * * If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should * transmit the next request using TCP rather than UDP. If this function * returns any other error, the initial credential exchange has failed. * * @a context must be the same as the one passed to krb5_init_creds_init() for * this initial credentials context. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_step(krb5_context context, krb5_init_creds_context ctx, krb5_data *in, krb5_data *out, krb5_data *realm, unsigned int *flags); /** * Set a password for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] password Password * * This function supplies a password to be used to construct the client key for * an initial credentials request. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_set_password(krb5_context context, krb5_init_creds_context ctx, const char *password); /** * Specify a service principal for acquiring initial credentials. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [in] service Service principal string * * This function supplies a service principal string to acquire initial * credentials for instead of the default krbtgt service. @a service is parsed * as a principal name; any realm part is ignored. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_set_service(krb5_context context, krb5_init_creds_context ctx, const char *service); /** * Retrieve ticket times from an initial credentials context. * * @param [in] context Library context * @param [in] ctx Initial credentials context * @param [out] times Ticket times for acquired credentials * * The initial credentials context must have completed obtaining credentials * via either krb5_init_creds_get() or krb5_init_creds_step(). * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_init_creds_get_times(krb5_context context, krb5_init_creds_context ctx, krb5_ticket_times *times); struct _krb5_tkt_creds_context; typedef struct _krb5_tkt_creds_context *krb5_tkt_creds_context; /** * Create a context to get credentials from a KDC's Ticket Granting Service. * * @param[in] context Library context * @param[in] ccache Credential cache handle * @param[in] creds Input credentials * @param[in] options @ref KRB5_GC options for this request. * @param[out] ctx New TGS request context * * This function prepares to obtain credentials matching @a creds, either by * retrieving them from @a ccache or by making requests to ticket-granting * services beginning with a ticket-granting ticket for the client principal's * realm. * * The resulting TGS acquisition context can be used asynchronously with * krb5_tkt_creds_step() or synchronously with krb5_tkt_creds_get(). See also * krb5_get_credentials() for synchronous use. * * Use krb5_tkt_creds_free() to free @a ctx when it is no longer needed. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_init(krb5_context context, krb5_ccache ccache, krb5_creds *creds, krb5_flags options, krb5_tkt_creds_context *ctx); /** * Synchronously obtain credentials using a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * * This function synchronously obtains credentials using a context created by * krb5_tkt_creds_init(). On successful return, the credentials can be * retrieved with krb5_tkt_creds_get_creds(). * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_get(krb5_context context, krb5_tkt_creds_context ctx); /** * Retrieve acquired credentials from a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * @param[out] creds Acquired credentials * * This function copies the acquired initial credentials from @a ctx into @a * creds, after the successful completion of krb5_tkt_creds_get() or * krb5_tkt_creds_step(). Use krb5_free_cred_contents() to free @a creds when * it is no longer needed. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_get_creds(krb5_context context, krb5_tkt_creds_context ctx, krb5_creds *creds); /** * Free a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * * @version New in 1.9 */ void KRB5_CALLCONV krb5_tkt_creds_free(krb5_context context, krb5_tkt_creds_context ctx); #define KRB5_TKT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */ /** * Get the next KDC request in a TGS exchange. * * @param[in] context Library context * @param[in] ctx TGS request context * @param[in] in KDC response (empty on the first call) * @param[out] out Next KDC request * @param[out] realm Realm for next KDC request * @param[out] flags Output flags * * This function constructs the next KDC request for a TGS exchange, allowing * the caller to control the transport of KDC requests and replies. On the * first call, @a in should be set to an empty buffer; on subsequent calls, it * should be set to the KDC's reply to the previous request. * * If more requests are needed, @a flags will be set to * #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in @a * out. If no more requests are needed, @a flags will not contain * #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty. * * If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should * transmit the next request using TCP rather than UDP. If this function * returns any other error, the TGS exchange has failed. * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_step(krb5_context context, krb5_tkt_creds_context ctx, krb5_data *in, krb5_data *out, krb5_data *realm, unsigned int *flags); /** * Retrieve ticket times from a TGS request context. * * @param[in] context Library context * @param[in] ctx TGS request context * @param[out] times Ticket times for acquired credentials * * The TGS request context must have completed obtaining credentials via either * krb5_tkt_creds_get() or krb5_tkt_creds_step(). * * @version New in 1.9 * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_tkt_creds_get_times(krb5_context context, krb5_tkt_creds_context ctx, krb5_ticket_times *times); /** * Get initial credentials using a key table. * * @param [in] context Library context * @param [out] creds New credentials * @param [in] client Client principal * @param [in] arg_keytab Key table handle * @param [in] start_time Time when ticket becomes valid (0 for now) * @param [in] in_tkt_service Service name of initial credentials (or NULL) * @param [in] k5_gic_options Initial credential options * * This function requests KDC for an initial credentials for @a client using a * client key stored in @a arg_keytab. If @a in_tkt_service is specified, it * is parsed as a principal name (with the realm ignored) and used as the * service principal for the request; otherwise the ticket-granting service is * used. * * @sa krb5_verify_init_creds() * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_init_creds_keytab(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_keytab arg_keytab, krb5_deltat start_time, const char *in_tkt_service, krb5_get_init_creds_opt *k5_gic_options); typedef struct _krb5_verify_init_creds_opt { krb5_flags flags; int ap_req_nofail; /**< boolean */ } krb5_verify_init_creds_opt; #define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001 /** * Initialize a credential verification options structure. * * @param [in] k5_vic_options Verification options structure */ void KRB5_CALLCONV krb5_verify_init_creds_opt_init(krb5_verify_init_creds_opt *k5_vic_options); /** * Set whether credential verification is required. * * @param [in] k5_vic_options Verification options structure * @param [in] ap_req_nofail Whether to require successful verification * * This function determines how krb5_verify_init_creds() behaves if no keytab * information is available. If @a ap_req_nofail is @c FALSE, verification * will be skipped in this case and krb5_verify_init_creds() will return * successfully. If @a ap_req_nofail is @c TRUE, krb5_verify_init_creds() will * not return successfully unless verification can be performed. * * If this function is not used, the behavior of krb5_verify_init_creds() is * determined through configuration. */ void KRB5_CALLCONV krb5_verify_init_creds_opt_set_ap_req_nofail(krb5_verify_init_creds_opt * k5_vic_options, int ap_req_nofail); /** * Verify initial credentials against a keytab. * * @param [in] context Library context * @param [in] creds Initial credentials to be verified * @param [in] server Server principal (or NULL) * @param [in] keytab Key table (NULL to use default keytab) * @param [in] ccache Credential cache for fetched creds (or NULL) * @param [in] options Verification options (NULL for default options) * * This function attempts to verify that @a creds were obtained from a KDC with * knowledge of a key in @a keytab, or the default keytab if @a keytab is NULL. * If @a server is provided, the highest-kvno key entry for that principal name * is used to verify the credentials; otherwise, all unique "host" service * principals in the keytab are tried. * * If the specified keytab does not exist, or is empty, or cannot be read, or * does not contain an entry for @a server, then credential verification may be * skipped unless configuration demands that it succeed. The caller can * control this behavior by providing a verification options structure; see * krb5_verify_init_creds_opt_init() and * krb5_verify_init_creds_opt_set_ap_req_nofail(). * * If @a ccache is NULL, any additional credentials fetched during the * verification process will be destroyed. If @a ccache points to NULL, a * memory ccache will be created for the additional credentials and returned in * @a ccache. If @a ccache points to a valid credential cache handle, the * additional credentials will be stored in that cache. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_verify_init_creds(krb5_context context, krb5_creds *creds, krb5_principal server, krb5_keytab keytab, krb5_ccache *ccache, krb5_verify_init_creds_opt *options); /** * Get validated credentials from the KDC. * * @param [in] context Library context * @param [out] creds Validated credentials * @param [in] client Client principal name * @param [in] ccache Credential cache * @param [in] in_tkt_service Server principal string (or NULL) * * This function gets a validated credential using a postdated credential from * @a ccache. If @a in_tkt_service is specified, it is parsed (with the realm * part ignored) and used as the server principal of the credential; * otherwise, the ticket-granting service is used. * * If successful, the validated credential is placed in @a creds. * * @sa krb5_get_renewed_creds() * * @retval * 0 Success * @retval * KRB5_NO_2ND_TKT Request missing second ticket * @retval * KRB5_NO_TKT_SUPPLIED Request did not supply a ticket * @retval * KRB5_PRINC_NOMATCH Requested principal and ticket do not match * @retval * KRB5_KDCREP_MODIFIED KDC reply did not match expectations * @retval * KRB5_KDCREP_SKEW Clock skew too great in KDC reply * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_validated_creds(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_ccache ccache, const char *in_tkt_service); /** * Get renewed credential from KDC using an existing credential. * * @param [in] context Library context * @param [out] creds Renewed credentials * @param [in] client Client principal name * @param [in] ccache Credential cache * @param [in] in_tkt_service Server principal string (or NULL) * * This function gets a renewed credential using an existing one from @a * ccache. If @a in_tkt_service is specified, it is parsed (with the realm * part ignored) and used as the server principal of the credential; otherwise, * the ticket-granting service is used. * * If successful, the renewed credential is placed in @a creds. * * @retval * 0 Success * @return * Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_get_renewed_creds(krb5_context context, krb5_creds *creds, krb5_principal client, krb5_ccache ccache, const char *in_tkt_service); /** * Decode an ASN.1-formatted ticket. * * @param [in] code ASN.1-formatted ticket * @param [out] rep Decoded ticket information * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_decode_ticket(const krb5_data *code, krb5_ticket **rep); /** * Retrieve a string value from the appdefaults section of krb5.conf. * * @param [in] context Library context * @param [in] appname Application name * @param [in] realm Realm name * @param [in] option Option to be checked * @param [in] default_value Default value to return if no match is found * @param [out] ret_value String value of @a option * * This function gets the application defaults for @a option based on the given * @a appname and/or @a realm. * * @sa krb5_appdefault_boolean() */ void KRB5_CALLCONV krb5_appdefault_string(krb5_context context, const char *appname, const krb5_data *realm, const char *option, const char *default_value, char ** ret_value); /** * Retrieve a boolean value from the appdefaults section of krb5.conf. * * @param [in] context Library context * @param [in] appname Application name * @param [in] realm Realm name * @param [in] option Option to be checked * @param [in] default_value Default value to return if no match is found * @param [out] ret_value Boolean value of @a option * * This function gets the application defaults for @a option based on the given * @a appname and/or @a realm. * * @sa krb5_appdefault_string() */ void KRB5_CALLCONV krb5_appdefault_boolean(krb5_context context, const char *appname, const krb5_data *realm, const char *option, int default_value, int *ret_value); /* * Prompter enhancements */ /** Prompt for password */ #define KRB5_PROMPT_TYPE_PASSWORD 0x1 /** Prompt for new password (during password change) */ #define KRB5_PROMPT_TYPE_NEW_PASSWORD 0x2 /** Prompt for new password again */ #define KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN 0x3 /** Prompt for preauthentication data (such as an OTP value) */ #define KRB5_PROMPT_TYPE_PREAUTH 0x4 typedef krb5_int32 krb5_prompt_type; /** * Get prompt types array from a context. * * @param [in] context Library context * * @return * Pointer to an array of prompt types corresponding to the prompter's @a * prompts arguments. Each type has one of the following values: * @li #KRB5_PROMPT_TYPE_PASSWORD * @li #KRB5_PROMPT_TYPE_NEW_PASSWORD * @li #KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN * @li #KRB5_PROMPT_TYPE_PREAUTH */ krb5_prompt_type* KRB5_CALLCONV krb5_get_prompt_types(krb5_context context); /* Error reporting */ /** * Set an extended error message for an error code. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Error string for the error code * @param [in] ... printf(3) style parameters */ void KRB5_CALLCONV_C krb5_set_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, ...) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 4))) #endif ; /** * Set an extended error message for an error code using a va_list. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Error string for the error code * @param [in] args List of vprintf(3) style arguments */ void KRB5_CALLCONV krb5_vset_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, va_list args) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 0))) #endif ; /** * Add a prefix to the message for an error code. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] ... printf(3) style parameters * * Format a message and prepend it to the current message for @a code. The * prefix will be separated from the old message with a colon and space. */ void KRB5_CALLCONV_C krb5_prepend_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, ...) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 4))) #endif ; /** * Add a prefix to the message for an error code using a va_list. * * @param [in] ctx Library context * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] args List of vprintf(3) style arguments * * This function is similar to krb5_prepend_error_message(), but uses a * va_list instead of variadic arguments. */ void KRB5_CALLCONV krb5_vprepend_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, va_list args) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 3, 0))) #endif ; /** * Add a prefix to a different error code's message. * * @param [in] ctx Library context * @param [in] old_code Previous error code * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] ... printf(3) style parameters * * Format a message and prepend it to the message for @a old_code. The prefix * will be separated from the old message with a colon and space. Set the * resulting message as the extended error message for @a code. */ void KRB5_CALLCONV_C krb5_wrap_error_message(krb5_context ctx, krb5_error_code old_code, krb5_error_code code, const char *fmt, ...) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 4, 5))) #endif ; /** * Add a prefix to a different error code's message using a va_list. * * @param [in] ctx Library context * @param [in] old_code Previous error code * @param [in] code Error code * @param [in] fmt Format string for error message prefix * @param [in] args List of vprintf(3) style arguments * * This function is similar to krb5_wrap_error_message(), but uses a * va_list instead of variadic arguments. */ void KRB5_CALLCONV krb5_vwrap_error_message(krb5_context ctx, krb5_error_code old_code, krb5_error_code code, const char *fmt, va_list args) #if !defined(__cplusplus) && (__GNUC__ > 2) __attribute__((__format__(__printf__, 4, 0))) #endif ; /** * Copy the most recent extended error message from one context to another. * * @param [in] dest_ctx Library context to copy message to * @param [in] src_ctx Library context with current message */ void KRB5_CALLCONV krb5_copy_error_message(krb5_context dest_ctx, krb5_context src_ctx); /** * Get the (possibly extended) error message for a code. * * @param [in] ctx Library context * @param [in] code Error code * * The behavior of krb5_get_error_message() is only defined the first time it * is called after a failed call to a krb5 function using the same context, and * only when the error code passed in is the same as that returned by the krb5 * function. * * This function never returns NULL, so its result may be used unconditionally * as a C string. * * The string returned by this function must be freed using * krb5_free_error_message() * * @note Future versions may return the same string for the second * and following calls. */ const char * KRB5_CALLCONV krb5_get_error_message(krb5_context ctx, krb5_error_code code); /** * Free an error message generated by krb5_get_error_message(). * * @param [in] ctx Library context * @param [in] msg Pointer to error message */ void KRB5_CALLCONV krb5_free_error_message(krb5_context ctx, const char *msg); /** * Clear the extended error message in a context. * * @param [in] ctx Library context * * This function unsets the extended error message in a context, to ensure that * it is not mistakenly applied to another occurrence of the same error code. */ void KRB5_CALLCONV krb5_clear_error_message(krb5_context ctx); /** * Unwrap authorization data. * * @param [in] context Library context * @param [in] type @ref KRB5_AUTHDATA type of @a container * @param [in] container Authorization data to be decoded * @param [out] authdata List of decoded authorization data * * @sa krb5_encode_authdata_container() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_decode_authdata_container(krb5_context context, krb5_authdatatype type, const krb5_authdata *container, krb5_authdata ***authdata); /** * Wrap authorization data in a container. * * @param [in] context Library context * @param [in] type @ref KRB5_AUTHDATA type of @a container * @param [in] authdata List of authorization data to be encoded * @param [out] container List of encoded authorization data * * The result is returned in @a container as a single-element list. * * @sa krb5_decode_authdata_container() * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_encode_authdata_container(krb5_context context, krb5_authdatatype type, krb5_authdata * const*authdata, krb5_authdata ***container); /* * AD-KDCIssued */ /** * Encode and sign AD-KDCIssued authorization data. * * @param [in] context Library context * @param [in] key Session key * @param [in] issuer The name of the issuing principal * @param [in] authdata List of authorization data to be signed * @param [out] ad_kdcissued List containing AD-KDCIssued authdata * * This function wraps a list of authorization data entries @a authdata in an * AD-KDCIssued container (see RFC 4120 section 5.2.6.2) signed with @a key. * The result is returned in @a ad_kdcissued as a single-element list. */ krb5_error_code KRB5_CALLCONV krb5_make_authdata_kdc_issued(krb5_context context, const krb5_keyblock *key, krb5_const_principal issuer, krb5_authdata *const *authdata, krb5_authdata ***ad_kdcissued); /** * Unwrap and verify AD-KDCIssued authorization data. * * @param [in] context Library context * @param [in] key Session key * @param [in] ad_kdcissued AD-KDCIssued authorization data to be unwrapped * @param [out] issuer Name of issuing principal (or NULL) * @param [out] authdata Unwrapped list of authorization data * * This function unwraps an AD-KDCIssued authdatum (see RFC 4120 section * 5.2.6.2) and verifies its signature against @a key. The issuer field of the * authdatum element is returned in @a issuer, and the unwrapped list of * authdata is returned in @a authdata. */ krb5_error_code KRB5_CALLCONV krb5_verify_authdata_kdc_issued(krb5_context context, const krb5_keyblock *key, const krb5_authdata *ad_kdcissued, krb5_principal *issuer, krb5_authdata ***authdata); /* * Windows PAC */ /* Microsoft defined types of data */ #define KRB5_PAC_LOGON_INFO 1 /**< Logon information */ #define KRB5_PAC_CREDENTIALS_INFO 2 /**< Credentials information */ #define KRB5_PAC_SERVER_CHECKSUM 6 /**< Server checksum */ #define KRB5_PAC_PRIVSVR_CHECKSUM 7 /**< KDC checksum */ #define KRB5_PAC_CLIENT_INFO 10 /**< Client name and ticket info */ #define KRB5_PAC_DELEGATION_INFO 11 /**< Constrained delegation info */ #define KRB5_PAC_UPN_DNS_INFO 12 /**< User principal name and DNS info */ #define KRB5_PAC_CLIENT_CLAIMS 13 /**< Client claims information */ #define KRB5_PAC_DEVICE_INFO 14 /**< Device information */ #define KRB5_PAC_DEVICE_CLAIMS 15 /**< Device claims information */ #define KRB5_PAC_TICKET_CHECKSUM 16 /**< Ticket checksum */ #define KRB5_PAC_ATTRIBUTES_INFO 17 /**< PAC attributes */ #define KRB5_PAC_REQUESTOR 18 /**< PAC requestor SID */ #define KRB5_PAC_FULL_CHECKSUM 19 /**< KDC full checksum */ struct krb5_pac_data; /** PAC data structure to convey authorization information */ typedef struct krb5_pac_data *krb5_pac; /** * Add a buffer to a PAC handle. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] type Buffer type * @param [in] data contents * * This function adds a buffer of type @a type and contents @a data to @a pac * if there isn't already a buffer of this type present. * * The valid values of @a type is one of the following: * @li #KRB5_PAC_LOGON_INFO - Logon information * @li #KRB5_PAC_CREDENTIALS_INFO - Credentials information * @li #KRB5_PAC_SERVER_CHECKSUM - Server checksum * @li #KRB5_PAC_PRIVSVR_CHECKSUM - KDC checksum * @li #KRB5_PAC_CLIENT_INFO - Client name and ticket information * @li #KRB5_PAC_DELEGATION_INFO - Constrained delegation information * @li #KRB5_PAC_UPN_DNS_INFO - User principal name and DNS information * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_add_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type, const krb5_data *data); /** * Free a PAC handle. * * @param [in] context Library context * @param [in] pac PAC to be freed * * This function frees the contents of @a pac and the structure itself. */ void KRB5_CALLCONV krb5_pac_free(krb5_context context, krb5_pac pac); /** * Retrieve a buffer value from a PAC. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] type Type of buffer to retrieve * @param [out] data Buffer value * * Use krb5_free_data_contents() to free @a data when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_get_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type, krb5_data *data); /** * Return an array of buffer types in a PAC handle. * * @param [in] context Library context * @param [in] pac PAC handle * @param [out] len Number of entries in @a types * @param [out] types Array of buffer types * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_get_types(krb5_context context, krb5_pac pac, size_t *len, krb5_ui_4 **types); /** * Create an empty Privilege Attribute Certificate (PAC) handle. * * @param [in] context Library context * @param [out] pac New PAC handle * * Use krb5_pac_free() to free @a pac when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_init(krb5_context context, krb5_pac *pac); /** * Unparse an encoded PAC into a new handle. * * @param [in] context Library context * @param [in] ptr PAC buffer * @param [in] len Length of @a ptr * @param [out] pac PAC handle * * Use krb5_pac_free() to free @a pac when it is no longer needed. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_parse(krb5_context context, const void *ptr, size_t len, krb5_pac *pac); /** * Verify a PAC. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] authtime Expected timestamp * @param [in] principal Expected principal name (or NULL) * @param [in] server Key to validate server checksum (or NULL) * @param [in] privsvr Key to validate KDC checksum (or NULL) * * This function validates @a pac against the supplied @a server, @a privsvr, * @a principal and @a authtime. If @a principal is NULL, the principal and * authtime are not verified. If @a server or @a privsvr is NULL, the * corresponding checksum is not verified. * * If successful, @a pac is marked as verified. * * @note A checksum mismatch can occur if the PAC was copied from a cross-realm * TGT by an ignorant KDC; also macOS Server Open Directory (as of 10.6) * generates PACs with no server checksum at all. One should consider not * failing the whole authentication because of this reason, but, instead, * treating the ticket as if it did not contain a PAC or marking the PAC * information as non-verified. * * @retval 0 Success; otherwise - Kerberos error codes */ krb5_error_code KRB5_CALLCONV krb5_pac_verify(krb5_context context, const krb5_pac pac, krb5_timestamp authtime, krb5_const_principal principal, const krb5_keyblock *server, const krb5_keyblock *privsvr); /** * Verify a PAC, possibly from a specified realm. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] authtime Expected timestamp * @param [in] principal Expected principal name (or NULL) * @param [in] server Key to validate server checksum (or NULL) * @param [in] privsvr Key to validate KDC checksum (or NULL) * @param [in] with_realm If true, expect the realm of @a principal * * This function is similar to krb5_pac_verify(), but adds a parameter * @a with_realm. If @a with_realm is true, the PAC_CLIENT_INFO field is * expected to include the realm of @a principal as well as the name. This * flag is necessary to verify PACs in cross-realm S4U2Self referral TGTs. * * @version New in 1.17 */ krb5_error_code KRB5_CALLCONV krb5_pac_verify_ext(krb5_context context, const krb5_pac pac, krb5_timestamp authtime, krb5_const_principal principal, const krb5_keyblock *server, const krb5_keyblock *privsvr, krb5_boolean with_realm); /** * Verify a PAC, possibly including ticket signature * * @param [in] context Library context * @param [in] enc_tkt Ticket enc-part, possibly containing a PAC * @param [in] server_princ Canonicalized name of ticket server * @param [in] server Key to validate server checksum (or NULL) * @param [in] privsvr Key to validate KDC checksum (or NULL) * @param [out] pac_out Verified PAC (NULL if no PAC included) * * If a PAC is present in @a enc_tkt, verify its signatures. If @a privsvr is * not NULL and @a server_princ is not a krbtgt or kadmin/changepw service, * require a ticket signature over @a enc_tkt in addition to the KDC signature. * Place the verified PAC in @a pac_out. If an invalid PAC signature is found, * return an error matching the Windows KDC protocol code for that condition as * closely as possible. * * If no PAC is present in @a enc_tkt, set @a pac_out to NULL and return * successfully. * * @note This function does not validate the PAC_CLIENT_INFO buffer. If a * specific value is expected, the caller can make a separate call to * krb5_pac_verify_ext() with a principal but no keys. * * @retval 0 Success; otherwise - Kerberos error codes * * @version New in 1.20 */ krb5_error_code KRB5_CALLCONV krb5_kdc_verify_ticket(krb5_context context, const krb5_enc_tkt_part *enc_tkt, krb5_const_principal server_princ, const krb5_keyblock *server, const krb5_keyblock *privsvr, krb5_pac *pac_out); /** @deprecated Use krb5_kdc_sign_ticket() instead. */ krb5_error_code KRB5_CALLCONV krb5_pac_sign(krb5_context context, krb5_pac pac, krb5_timestamp authtime, krb5_const_principal principal, const krb5_keyblock *server_key, const krb5_keyblock *privsvr_key, krb5_data *data); /** @deprecated Use krb5_kdc_sign_ticket() instead. */ krb5_error_code KRB5_CALLCONV krb5_pac_sign_ext(krb5_context context, krb5_pac pac, krb5_timestamp authtime, krb5_const_principal principal, const krb5_keyblock *server_key, const krb5_keyblock *privsvr_key, krb5_boolean with_realm, krb5_data *data); /** * Compatibility function used by IPA if the 1.20 KDB diver API is not * available. It generates PAC signatures, including the extended KDC one when * relevant. * * It is similar to krb5_kdc_sign_ticket(), except it will not generate the * PAC ticket signature, and therefore does not expect encrypted ticket part as * parameter. * * @param [in] context Library context * @param [in] pac PAC handle * @param [in] authtime Expected timestamp * @param [in] client_princ Client principal name (or NULL) * @param [in] server_princ Server principal name * @param [in] server_key Key for server checksum * @param [in] privsvr_key Key for KDC checksum * @param [in] with_realm If true, include the realm of @a client_princ * @param [out] data Signed PAC encoding * * This function signs @a pac using the keys @a server_key and @a privsvr_key * and returns the signed encoding in @a data. @a pac is modified to include * the server and KDC checksum buffers. Use krb5_free_data_contents() to free * @a data when it is no longer needed. * * If @a with_realm is true, the PAC_CLIENT_INFO field of the signed PAC will * include the realm of @a client_princ as well as the name. This flag is * necessary to generate PACs for cross-realm S4U2Self referrals. */ krb5_error_code KRB5_CALLCONV krb5_pac_full_sign_compat(krb5_context context, krb5_pac pac, krb5_timestamp authtime, krb5_const_principal client_princ, krb5_const_principal server_princ, const krb5_keyblock *server_key, const krb5_keyblock *privsvr_key, krb5_boolean with_realm, krb5_data *data); /** * Sign a PAC, possibly including a ticket signature * * @param [in] context Library context * @param [in] enc_tkt The ticket for the signature * @param [in] pac PAC handle * @param [in] server_princ Canonical ticket server name * @param [in] client_princ PAC_CLIENT_INFO principal (or NULL) * @param [in] server Key for server checksum * @param [in] privsvr Key for KDC and ticket checksum * @param [in] with_realm If true, include the realm of @a principal * * Sign @a pac using the keys @a server and @a privsvr. Include a ticket * signature over @a enc_tkt if @a server_princ is not a TGS or kadmin/changepw * principal name. Add the signed PAC's encoding to the authorization data of * @a enc_tkt in the first slot, wrapped in an AD-IF-RELEVANT container. If @a * client_princ is non-null, add a PAC_CLIENT_INFO buffer, including the realm * if @a with_realm is true. * * @retval 0 on success, otherwise - Kerberos error codes * * @version New in 1.20 */ krb5_error_code KRB5_CALLCONV krb5_kdc_sign_ticket(krb5_context context, krb5_enc_tkt_part *enc_tkt, const krb5_pac pac, krb5_const_principal server_princ, krb5_const_principal client_princ, const krb5_keyblock *server, const krb5_keyblock *privsvr, krb5_boolean with_realm); /** * Read client information from a PAC. * * @param [in] context Library context * @param [in] pac PAC handle * @param [out] authtime_out Authentication timestamp (NULL if not needed) * @param [out] princname_out Client account name * * Read the PAC_CLIENT_INFO buffer in @a pac. Place the client account name as * a string in @a princname_out. If @a authtime_out is not NULL, place the * initial authentication timestamp in @a authtime_out. * * @retval 0 on success, ENOENT if no PAC_CLIENT_INFO buffer is present in @a * pac, ERANGE if the buffer contains invalid lengths. * * @version New in 1.18 */ krb5_error_code KRB5_CALLCONV krb5_pac_get_client_info(krb5_context context, const krb5_pac pac, krb5_timestamp *authtime_out, char **princname_out); /** * Allow the application to override the profile's allow_weak_crypto setting. * * @param [in] context Library context * @param [in] enable Boolean flag * * This function allows an application to override the allow_weak_crypto * setting. It is primarily for use by aklog. * * @retval 0 (always) */ krb5_error_code KRB5_CALLCONV krb5_allow_weak_crypto(krb5_context context, krb5_boolean enable); /** * A wrapper for passing information to a @c krb5_trace_callback. * * Currently, it only contains the formatted message as determined * the the format string and arguments of the tracing macro, but it * may be extended to contain more fields in the future. */ typedef struct _krb5_trace_info { const char *message; } krb5_trace_info; typedef void (KRB5_CALLCONV *krb5_trace_callback)(krb5_context context, const krb5_trace_info *info, void *cb_data); /** * Specify a callback function for trace events. * * @param [in] context Library context * @param [in] fn Callback function * @param [in] cb_data Callback data * * Specify a callback for trace events occurring in krb5 operations performed * within @a context. @a fn will be invoked with @a context as the first * argument, @a cb_data as the last argument, and a pointer to a * krb5_trace_info as the second argument. If the trace callback is reset via * this function or @a context is destroyed, @a fn will be invoked with a NULL * second argument so it can clean up @a cb_data. Supply a NULL value for @a * fn to disable trace callbacks within @a context. * * @note This function overrides the information passed through the * @a KRB5_TRACE environment variable. * * @version New in 1.9 * * @return Returns KRB5_TRACE_NOSUPP if tracing is not supported in the library * (unless @a fn is NULL). */ krb5_error_code KRB5_CALLCONV krb5_set_trace_callback(krb5_context context, krb5_trace_callback fn, void *cb_data); /** * Specify a file name for directing trace events. * * @param [in] context Library context * @param [in] filename File name * * Open @a filename for appending (creating it, if necessary) and set up a * callback to write trace events to it. * * @note This function overrides the information passed through the * @a KRB5_TRACE environment variable. * * @version New in 1.9 * * @retval KRB5_TRACE_NOSUPP Tracing is not supported in the library. */ krb5_error_code KRB5_CALLCONV krb5_set_trace_filename(krb5_context context, const char *filename); /** * Hook function for inspecting or modifying messages sent to KDCs. * * @param [in] context Library context * @param [in] data Callback data * @param [in] realm The realm the message will be sent to * @param [in] message The original message to be sent to the KDC * @param [out] new_message_out Optional replacement message to be sent * @param [out] reply_out Optional synthetic reply * * If the hook function returns an error code, the KDC communication will be * aborted and the error code will be returned to the library operation which * initiated the communication. * * If the hook function sets @a reply_out, @a message will not be sent to the * KDC, and the given reply will used instead. * * If the hook function sets @a new_message_out, the given message will be sent * to the KDC in place of @a message. * * If the hook function returns successfully without setting either output, * @a message will be sent to the KDC normally. * * The hook function should use krb5_copy_data() to construct the value for * @a new_message_out or @a reply_out, to ensure that it can be freed correctly * by the library. * * @version New in 1.15 * * @retval 0 Success * @return A Kerberos error code */ typedef krb5_error_code (KRB5_CALLCONV *krb5_pre_send_fn)(krb5_context context, void *data, const krb5_data *realm, const krb5_data *message, krb5_data **new_message_out, krb5_data **new_reply_out); /** * Hook function for inspecting or overriding KDC replies. * * @param [in] context Library context * @param [in] data Callback data * @param [in] code Status of KDC communication * @param [in] realm The realm the reply was received from * @param [in] message The message sent to the realm's KDC * @param [in] reply The reply received from the KDC * @param [out] new_reply_out Optional replacement reply * * If @a code is zero, @a reply contains the reply received from the KDC. The * hook function may return an error code to simulate an error, may synthesize * a different reply by setting @a new_reply_out, or may simply return * successfully to do nothing. * * If @a code is non-zero, KDC communication failed and @a reply should be * ignored. The hook function may return @a code or a different error code, or * may synthesize a reply by setting @a new_reply_out and return successfully. * * The hook function should use krb5_copy_data() to construct the value for * @a new_reply_out, to ensure that it can be freed correctly by the library. * * @version New in 1.15 * * @retval 0 Success * @return A Kerberos error code */ typedef krb5_error_code (KRB5_CALLCONV *krb5_post_recv_fn)(krb5_context context, void *data, krb5_error_code code, const krb5_data *realm, const krb5_data *message, const krb5_data *reply, krb5_data **new_reply_out); /** * Set a KDC pre-send hook function. * * @param [in] context Library context * @param [in] send_hook Hook function (or NULL to disable the hook) * @param [in] data Callback data to be passed to @a send_hook * * @a send_hook will be called before messages are sent to KDCs by library * functions such as krb5_get_credentials(). The hook function may inspect, * override, or synthesize its own reply to the message. * * @version New in 1.15 */ void KRB5_CALLCONV krb5_set_kdc_send_hook(krb5_context context, krb5_pre_send_fn send_hook, void *data); /** * Set a KDC post-receive hook function. * * @param [in] context The library context. * @param [in] recv_hook Hook function (or NULL to disable the hook) * @param [in] data Callback data to be passed to @a recv_hook * * @a recv_hook will be called after a reply is received from a KDC during a * call to a library function such as krb5_get_credentials(). The hook * function may inspect or override the reply. This hook will not be executed * if the pre-send hook returns a synthetic reply. * * @version New in 1.15 */ void KRB5_CALLCONV krb5_set_kdc_recv_hook(krb5_context context, krb5_post_recv_fn recv_hook, void *data); #if defined(TARGET_OS_MAC) && TARGET_OS_MAC # pragma pack(pop) #endif KRB5INT_END_DECLS /* Don't use this! We're going to phase it out. It's just here to keep applications from breaking right away. */ #define krb5_const const #undef KRB5_ATTR_DEPRECATED /** @} */ /* end of KRB5_H group */ #endif /* KRB5_GENERAL__ */ /* * et-h-krb5_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB5KDC_ERR_NONE (-1765328384L) #define KRB5KDC_ERR_NAME_EXP (-1765328383L) #define KRB5KDC_ERR_SERVICE_EXP (-1765328382L) #define KRB5KDC_ERR_BAD_PVNO (-1765328381L) #define KRB5KDC_ERR_C_OLD_MAST_KVNO (-1765328380L) #define KRB5KDC_ERR_S_OLD_MAST_KVNO (-1765328379L) #define KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN (-1765328378L) #define KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN (-1765328377L) #define KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE (-1765328376L) #define KRB5KDC_ERR_NULL_KEY (-1765328375L) #define KRB5KDC_ERR_CANNOT_POSTDATE (-1765328374L) #define KRB5KDC_ERR_NEVER_VALID (-1765328373L) #define KRB5KDC_ERR_POLICY (-1765328372L) #define KRB5KDC_ERR_BADOPTION (-1765328371L) #define KRB5KDC_ERR_ETYPE_NOSUPP (-1765328370L) #define KRB5KDC_ERR_SUMTYPE_NOSUPP (-1765328369L) #define KRB5KDC_ERR_PADATA_TYPE_NOSUPP (-1765328368L) #define KRB5KDC_ERR_TRTYPE_NOSUPP (-1765328367L) #define KRB5KDC_ERR_CLIENT_REVOKED (-1765328366L) #define KRB5KDC_ERR_SERVICE_REVOKED (-1765328365L) #define KRB5KDC_ERR_TGT_REVOKED (-1765328364L) #define KRB5KDC_ERR_CLIENT_NOTYET (-1765328363L) #define KRB5KDC_ERR_SERVICE_NOTYET (-1765328362L) #define KRB5KDC_ERR_KEY_EXP (-1765328361L) #define KRB5KDC_ERR_PREAUTH_FAILED (-1765328360L) #define KRB5KDC_ERR_PREAUTH_REQUIRED (-1765328359L) #define KRB5KDC_ERR_SERVER_NOMATCH (-1765328358L) #define KRB5KDC_ERR_MUST_USE_USER2USER (-1765328357L) #define KRB5KDC_ERR_PATH_NOT_ACCEPTED (-1765328356L) #define KRB5KDC_ERR_SVC_UNAVAILABLE (-1765328355L) #define KRB5PLACEHOLD_30 (-1765328354L) #define KRB5KRB_AP_ERR_BAD_INTEGRITY (-1765328353L) #define KRB5KRB_AP_ERR_TKT_EXPIRED (-1765328352L) #define KRB5KRB_AP_ERR_TKT_NYV (-1765328351L) #define KRB5KRB_AP_ERR_REPEAT (-1765328350L) #define KRB5KRB_AP_ERR_NOT_US (-1765328349L) #define KRB5KRB_AP_ERR_BADMATCH (-1765328348L) #define KRB5KRB_AP_ERR_SKEW (-1765328347L) #define KRB5KRB_AP_ERR_BADADDR (-1765328346L) #define KRB5KRB_AP_ERR_BADVERSION (-1765328345L) #define KRB5KRB_AP_ERR_MSG_TYPE (-1765328344L) #define KRB5KRB_AP_ERR_MODIFIED (-1765328343L) #define KRB5KRB_AP_ERR_BADORDER (-1765328342L) #define KRB5KRB_AP_ERR_ILL_CR_TKT (-1765328341L) #define KRB5KRB_AP_ERR_BADKEYVER (-1765328340L) #define KRB5KRB_AP_ERR_NOKEY (-1765328339L) #define KRB5KRB_AP_ERR_MUT_FAIL (-1765328338L) #define KRB5KRB_AP_ERR_BADDIRECTION (-1765328337L) #define KRB5KRB_AP_ERR_METHOD (-1765328336L) #define KRB5KRB_AP_ERR_BADSEQ (-1765328335L) #define KRB5KRB_AP_ERR_INAPP_CKSUM (-1765328334L) #define KRB5KRB_AP_PATH_NOT_ACCEPTED (-1765328333L) #define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L) #define KRB5PLACEHOLD_53 (-1765328331L) #define KRB5PLACEHOLD_54 (-1765328330L) #define KRB5PLACEHOLD_55 (-1765328329L) #define KRB5PLACEHOLD_56 (-1765328328L) #define KRB5PLACEHOLD_57 (-1765328327L) #define KRB5PLACEHOLD_58 (-1765328326L) #define KRB5PLACEHOLD_59 (-1765328325L) #define KRB5KRB_ERR_GENERIC (-1765328324L) #define KRB5KRB_ERR_FIELD_TOOLONG (-1765328323L) #define KRB5KDC_ERR_CLIENT_NOT_TRUSTED (-1765328322L) #define KRB5KDC_ERR_KDC_NOT_TRUSTED (-1765328321L) #define KRB5KDC_ERR_INVALID_SIG (-1765328320L) #define KRB5KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED (-1765328319L) #define KRB5KDC_ERR_CERTIFICATE_MISMATCH (-1765328318L) #define KRB5KRB_AP_ERR_NO_TGT (-1765328317L) #define KRB5KDC_ERR_WRONG_REALM (-1765328316L) #define KRB5KRB_AP_ERR_USER_TO_USER_REQUIRED (-1765328315L) #define KRB5KDC_ERR_CANT_VERIFY_CERTIFICATE (-1765328314L) #define KRB5KDC_ERR_INVALID_CERTIFICATE (-1765328313L) #define KRB5KDC_ERR_REVOKED_CERTIFICATE (-1765328312L) #define KRB5KDC_ERR_REVOCATION_STATUS_UNKNOWN (-1765328311L) #define KRB5KDC_ERR_REVOCATION_STATUS_UNAVAILABLE (-1765328310L) #define KRB5KDC_ERR_CLIENT_NAME_MISMATCH (-1765328309L) #define KRB5KDC_ERR_KDC_NAME_MISMATCH (-1765328308L) #define KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE (-1765328307L) #define KRB5KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED (-1765328306L) #define KRB5KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED (-1765328305L) #define KRB5KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED (-1765328304L) #define KRB5KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED (-1765328303L) #define KRB5PLACEHOLD_82 (-1765328302L) #define KRB5PLACEHOLD_83 (-1765328301L) #define KRB5PLACEHOLD_84 (-1765328300L) #define KRB5KRB_AP_ERR_IAKERB_KDC_NOT_FOUND (-1765328299L) #define KRB5KRB_AP_ERR_IAKERB_KDC_NO_RESPONSE (-1765328298L) #define KRB5PLACEHOLD_87 (-1765328297L) #define KRB5PLACEHOLD_88 (-1765328296L) #define KRB5PLACEHOLD_89 (-1765328295L) #define KRB5KDC_ERR_PREAUTH_EXPIRED (-1765328294L) #define KRB5KDC_ERR_MORE_PREAUTH_DATA_REQUIRED (-1765328293L) #define KRB5PLACEHOLD_92 (-1765328292L) #define KRB5KDC_ERR_UNKNOWN_CRITICAL_FAST_OPTION (-1765328291L) #define KRB5PLACEHOLD_94 (-1765328290L) #define KRB5PLACEHOLD_95 (-1765328289L) #define KRB5PLACEHOLD_96 (-1765328288L) #define KRB5PLACEHOLD_97 (-1765328287L) #define KRB5PLACEHOLD_98 (-1765328286L) #define KRB5PLACEHOLD_99 (-1765328285L) #define KRB5KDC_ERR_NO_ACCEPTABLE_KDF (-1765328284L) #define KRB5PLACEHOLD_101 (-1765328283L) #define KRB5PLACEHOLD_102 (-1765328282L) #define KRB5PLACEHOLD_103 (-1765328281L) #define KRB5PLACEHOLD_104 (-1765328280L) #define KRB5PLACEHOLD_105 (-1765328279L) #define KRB5PLACEHOLD_106 (-1765328278L) #define KRB5PLACEHOLD_107 (-1765328277L) #define KRB5PLACEHOLD_108 (-1765328276L) #define KRB5PLACEHOLD_109 (-1765328275L) #define KRB5PLACEHOLD_110 (-1765328274L) #define KRB5PLACEHOLD_111 (-1765328273L) #define KRB5PLACEHOLD_112 (-1765328272L) #define KRB5PLACEHOLD_113 (-1765328271L) #define KRB5PLACEHOLD_114 (-1765328270L) #define KRB5PLACEHOLD_115 (-1765328269L) #define KRB5PLACEHOLD_116 (-1765328268L) #define KRB5PLACEHOLD_117 (-1765328267L) #define KRB5PLACEHOLD_118 (-1765328266L) #define KRB5PLACEHOLD_119 (-1765328265L) #define KRB5PLACEHOLD_120 (-1765328264L) #define KRB5PLACEHOLD_121 (-1765328263L) #define KRB5PLACEHOLD_122 (-1765328262L) #define KRB5PLACEHOLD_123 (-1765328261L) #define KRB5PLACEHOLD_124 (-1765328260L) #define KRB5PLACEHOLD_125 (-1765328259L) #define KRB5PLACEHOLD_126 (-1765328258L) #define KRB5PLACEHOLD_127 (-1765328257L) #define KRB5_ERR_RCSID (-1765328256L) #define KRB5_LIBOS_BADLOCKFLAG (-1765328255L) #define KRB5_LIBOS_CANTREADPWD (-1765328254L) #define KRB5_LIBOS_BADPWDMATCH (-1765328253L) #define KRB5_LIBOS_PWDINTR (-1765328252L) #define KRB5_PARSE_ILLCHAR (-1765328251L) #define KRB5_PARSE_MALFORMED (-1765328250L) #define KRB5_CONFIG_CANTOPEN (-1765328249L) #define KRB5_CONFIG_BADFORMAT (-1765328248L) #define KRB5_CONFIG_NOTENUFSPACE (-1765328247L) #define KRB5_BADMSGTYPE (-1765328246L) #define KRB5_CC_BADNAME (-1765328245L) #define KRB5_CC_UNKNOWN_TYPE (-1765328244L) #define KRB5_CC_NOTFOUND (-1765328243L) #define KRB5_CC_END (-1765328242L) #define KRB5_NO_TKT_SUPPLIED (-1765328241L) #define KRB5KRB_AP_WRONG_PRINC (-1765328240L) #define KRB5KRB_AP_ERR_TKT_INVALID (-1765328239L) #define KRB5_PRINC_NOMATCH (-1765328238L) #define KRB5_KDCREP_MODIFIED (-1765328237L) #define KRB5_KDCREP_SKEW (-1765328236L) #define KRB5_IN_TKT_REALM_MISMATCH (-1765328235L) #define KRB5_PROG_ETYPE_NOSUPP (-1765328234L) #define KRB5_PROG_KEYTYPE_NOSUPP (-1765328233L) #define KRB5_WRONG_ETYPE (-1765328232L) #define KRB5_PROG_SUMTYPE_NOSUPP (-1765328231L) #define KRB5_REALM_UNKNOWN (-1765328230L) #define KRB5_SERVICE_UNKNOWN (-1765328229L) #define KRB5_KDC_UNREACH (-1765328228L) #define KRB5_NO_LOCALNAME (-1765328227L) #define KRB5_MUTUAL_FAILED (-1765328226L) #define KRB5_RC_TYPE_EXISTS (-1765328225L) #define KRB5_RC_MALLOC (-1765328224L) #define KRB5_RC_TYPE_NOTFOUND (-1765328223L) #define KRB5_RC_UNKNOWN (-1765328222L) #define KRB5_RC_REPLAY (-1765328221L) #define KRB5_RC_IO (-1765328220L) #define KRB5_RC_NOIO (-1765328219L) #define KRB5_RC_PARSE (-1765328218L) #define KRB5_RC_IO_EOF (-1765328217L) #define KRB5_RC_IO_MALLOC (-1765328216L) #define KRB5_RC_IO_PERM (-1765328215L) #define KRB5_RC_IO_IO (-1765328214L) #define KRB5_RC_IO_UNKNOWN (-1765328213L) #define KRB5_RC_IO_SPACE (-1765328212L) #define KRB5_TRANS_CANTOPEN (-1765328211L) #define KRB5_TRANS_BADFORMAT (-1765328210L) #define KRB5_LNAME_CANTOPEN (-1765328209L) #define KRB5_LNAME_NOTRANS (-1765328208L) #define KRB5_LNAME_BADFORMAT (-1765328207L) #define KRB5_CRYPTO_INTERNAL (-1765328206L) #define KRB5_KT_BADNAME (-1765328205L) #define KRB5_KT_UNKNOWN_TYPE (-1765328204L) #define KRB5_KT_NOTFOUND (-1765328203L) #define KRB5_KT_END (-1765328202L) #define KRB5_KT_NOWRITE (-1765328201L) #define KRB5_KT_IOERR (-1765328200L) #define KRB5_NO_TKT_IN_RLM (-1765328199L) #define KRB5DES_BAD_KEYPAR (-1765328198L) #define KRB5DES_WEAK_KEY (-1765328197L) #define KRB5_BAD_ENCTYPE (-1765328196L) #define KRB5_BAD_KEYSIZE (-1765328195L) #define KRB5_BAD_MSIZE (-1765328194L) #define KRB5_CC_TYPE_EXISTS (-1765328193L) #define KRB5_KT_TYPE_EXISTS (-1765328192L) #define KRB5_CC_IO (-1765328191L) #define KRB5_FCC_PERM (-1765328190L) #define KRB5_FCC_NOFILE (-1765328189L) #define KRB5_FCC_INTERNAL (-1765328188L) #define KRB5_CC_WRITE (-1765328187L) #define KRB5_CC_NOMEM (-1765328186L) #define KRB5_CC_FORMAT (-1765328185L) #define KRB5_CC_NOT_KTYPE (-1765328184L) #define KRB5_INVALID_FLAGS (-1765328183L) #define KRB5_NO_2ND_TKT (-1765328182L) #define KRB5_NOCREDS_SUPPLIED (-1765328181L) #define KRB5_SENDAUTH_BADAUTHVERS (-1765328180L) #define KRB5_SENDAUTH_BADAPPLVERS (-1765328179L) #define KRB5_SENDAUTH_BADRESPONSE (-1765328178L) #define KRB5_SENDAUTH_REJECTED (-1765328177L) #define KRB5_PREAUTH_BAD_TYPE (-1765328176L) #define KRB5_PREAUTH_NO_KEY (-1765328175L) #define KRB5_PREAUTH_FAILED (-1765328174L) #define KRB5_RCACHE_BADVNO (-1765328173L) #define KRB5_CCACHE_BADVNO (-1765328172L) #define KRB5_KEYTAB_BADVNO (-1765328171L) #define KRB5_PROG_ATYPE_NOSUPP (-1765328170L) #define KRB5_RC_REQUIRED (-1765328169L) #define KRB5_ERR_BAD_HOSTNAME (-1765328168L) #define KRB5_ERR_HOST_REALM_UNKNOWN (-1765328167L) #define KRB5_SNAME_UNSUPP_NAMETYPE (-1765328166L) #define KRB5KRB_AP_ERR_V4_REPLY (-1765328165L) #define KRB5_REALM_CANT_RESOLVE (-1765328164L) #define KRB5_TKT_NOT_FORWARDABLE (-1765328163L) #define KRB5_FWD_BAD_PRINCIPAL (-1765328162L) #define KRB5_GET_IN_TKT_LOOP (-1765328161L) #define KRB5_CONFIG_NODEFREALM (-1765328160L) #define KRB5_SAM_UNSUPPORTED (-1765328159L) #define KRB5_SAM_INVALID_ETYPE (-1765328158L) #define KRB5_SAM_NO_CHECKSUM (-1765328157L) #define KRB5_SAM_BAD_CHECKSUM (-1765328156L) #define KRB5_KT_NAME_TOOLONG (-1765328155L) #define KRB5_KT_KVNONOTFOUND (-1765328154L) #define KRB5_APPL_EXPIRED (-1765328153L) #define KRB5_LIB_EXPIRED (-1765328152L) #define KRB5_CHPW_PWDNULL (-1765328151L) #define KRB5_CHPW_FAIL (-1765328150L) #define KRB5_KT_FORMAT (-1765328149L) #define KRB5_NOPERM_ETYPE (-1765328148L) #define KRB5_CONFIG_ETYPE_NOSUPP (-1765328147L) #define KRB5_OBSOLETE_FN (-1765328146L) #define KRB5_EAI_FAIL (-1765328145L) #define KRB5_EAI_NODATA (-1765328144L) #define KRB5_EAI_NONAME (-1765328143L) #define KRB5_EAI_SERVICE (-1765328142L) #define KRB5_ERR_NUMERIC_REALM (-1765328141L) #define KRB5_ERR_BAD_S2K_PARAMS (-1765328140L) #define KRB5_ERR_NO_SERVICE (-1765328139L) #define KRB5_CC_READONLY (-1765328138L) #define KRB5_CC_NOSUPP (-1765328137L) #define KRB5_DELTAT_BADFORMAT (-1765328136L) #define KRB5_PLUGIN_NO_HANDLE (-1765328135L) #define KRB5_PLUGIN_OP_NOTSUPP (-1765328134L) #define KRB5_ERR_INVALID_UTF8 (-1765328133L) #define KRB5_ERR_FAST_REQUIRED (-1765328132L) #define KRB5_LOCAL_ADDR_REQUIRED (-1765328131L) #define KRB5_REMOTE_ADDR_REQUIRED (-1765328130L) #define KRB5_TRACE_NOSUPP (-1765328129L) extern const struct error_table et_krb5_error_table; extern void initialize_krb5_error_table(void); /* For compatibility with Heimdal */ extern void initialize_krb5_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_krb5 (-1765328384L) /* for compatibility with older versions... */ #define init_krb5_err_tbl initialize_krb5_error_table #define krb5_err_base ERROR_TABLE_BASE_krb5 /* * et-h-k5e1_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB5_PLUGIN_VER_NOTSUPP (-1750600192L) #define KRB5_PLUGIN_BAD_MODULE_SPEC (-1750600191L) #define KRB5_PLUGIN_NAME_NOTFOUND (-1750600190L) #define KRB5KDC_ERR_DISCARD (-1750600189L) #define KRB5_DCC_CANNOT_CREATE (-1750600188L) #define KRB5_KCC_INVALID_ANCHOR (-1750600187L) #define KRB5_KCC_UNKNOWN_VERSION (-1750600186L) #define KRB5_KCC_INVALID_UID (-1750600185L) #define KRB5_KCM_MALFORMED_REPLY (-1750600184L) #define KRB5_KCM_RPC_ERROR (-1750600183L) #define KRB5_KCM_REPLY_TOO_BIG (-1750600182L) #define KRB5_KCM_NO_SERVER (-1750600181L) #define KRB5_CERTAUTH_HWAUTH (-1750600180L) extern const struct error_table et_k5e1_error_table; extern void initialize_k5e1_error_table(void); /* For compatibility with Heimdal */ extern void initialize_k5e1_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_k5e1 (-1750600192L) /* for compatibility with older versions... */ #define init_k5e1_err_tbl initialize_k5e1_error_table #define k5e1_err_base ERROR_TABLE_BASE_k5e1 /* * et-h-kdb5_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB5_KDB_RCSID (-1780008448L) #define KRB5_KDB_INUSE (-1780008447L) #define KRB5_KDB_UK_SERROR (-1780008446L) #define KRB5_KDB_UK_RERROR (-1780008445L) #define KRB5_KDB_UNAUTH (-1780008444L) #define KRB5_KDB_NOENTRY (-1780008443L) #define KRB5_KDB_ILL_WILDCARD (-1780008442L) #define KRB5_KDB_DB_INUSE (-1780008441L) #define KRB5_KDB_DB_CHANGED (-1780008440L) #define KRB5_KDB_TRUNCATED_RECORD (-1780008439L) #define KRB5_KDB_RECURSIVELOCK (-1780008438L) #define KRB5_KDB_NOTLOCKED (-1780008437L) #define KRB5_KDB_BADLOCKMODE (-1780008436L) #define KRB5_KDB_DBNOTINITED (-1780008435L) #define KRB5_KDB_DBINITED (-1780008434L) #define KRB5_KDB_ILLDIRECTION (-1780008433L) #define KRB5_KDB_NOMASTERKEY (-1780008432L) #define KRB5_KDB_BADMASTERKEY (-1780008431L) #define KRB5_KDB_INVALIDKEYSIZE (-1780008430L) #define KRB5_KDB_CANTREAD_STORED (-1780008429L) #define KRB5_KDB_BADSTORED_MKEY (-1780008428L) #define KRB5_KDB_NOACTMASTERKEY (-1780008427L) #define KRB5_KDB_KVNONOMATCH (-1780008426L) #define KRB5_KDB_STORED_MKEY_NOTCURRENT (-1780008425L) #define KRB5_KDB_CANTLOCK_DB (-1780008424L) #define KRB5_KDB_DB_CORRUPT (-1780008423L) #define KRB5_KDB_BAD_VERSION (-1780008422L) #define KRB5_KDB_BAD_SALTTYPE (-1780008421L) #define KRB5_KDB_BAD_ENCTYPE (-1780008420L) #define KRB5_KDB_BAD_CREATEFLAGS (-1780008419L) #define KRB5_KDB_NO_PERMITTED_KEY (-1780008418L) #define KRB5_KDB_NO_MATCHING_KEY (-1780008417L) #define KRB5_KDB_DBTYPE_NOTFOUND (-1780008416L) #define KRB5_KDB_DBTYPE_NOSUP (-1780008415L) #define KRB5_KDB_DBTYPE_INIT (-1780008414L) #define KRB5_KDB_SERVER_INTERNAL_ERR (-1780008413L) #define KRB5_KDB_ACCESS_ERROR (-1780008412L) #define KRB5_KDB_INTERNAL_ERROR (-1780008411L) #define KRB5_KDB_CONSTRAINT_VIOLATION (-1780008410L) #define KRB5_LOG_CONV (-1780008409L) #define KRB5_LOG_UNSTABLE (-1780008408L) #define KRB5_LOG_CORRUPT (-1780008407L) #define KRB5_LOG_ERROR (-1780008406L) #define KRB5_KDB_DBTYPE_MISMATCH (-1780008405L) #define KRB5_KDB_POLICY_REF (-1780008404L) #define KRB5_KDB_STRINGS_TOOLONG (-1780008403L) extern const struct error_table et_kdb5_error_table; extern void initialize_kdb5_error_table(void); /* For compatibility with Heimdal */ extern void initialize_kdb5_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_kdb5 (-1780008448L) /* for compatibility with older versions... */ #define init_kdb5_err_tbl initialize_kdb5_error_table #define kdb5_err_base ERROR_TABLE_BASE_kdb5 /* * et-h-kv5m_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KV5M_NONE (-1760647424L) #define KV5M_PRINCIPAL (-1760647423L) #define KV5M_DATA (-1760647422L) #define KV5M_KEYBLOCK (-1760647421L) #define KV5M_CHECKSUM (-1760647420L) #define KV5M_ENCRYPT_BLOCK (-1760647419L) #define KV5M_ENC_DATA (-1760647418L) #define KV5M_CRYPTOSYSTEM_ENTRY (-1760647417L) #define KV5M_CS_TABLE_ENTRY (-1760647416L) #define KV5M_CHECKSUM_ENTRY (-1760647415L) #define KV5M_AUTHDATA (-1760647414L) #define KV5M_TRANSITED (-1760647413L) #define KV5M_ENC_TKT_PART (-1760647412L) #define KV5M_TICKET (-1760647411L) #define KV5M_AUTHENTICATOR (-1760647410L) #define KV5M_TKT_AUTHENT (-1760647409L) #define KV5M_CREDS (-1760647408L) #define KV5M_LAST_REQ_ENTRY (-1760647407L) #define KV5M_PA_DATA (-1760647406L) #define KV5M_KDC_REQ (-1760647405L) #define KV5M_ENC_KDC_REP_PART (-1760647404L) #define KV5M_KDC_REP (-1760647403L) #define KV5M_ERROR (-1760647402L) #define KV5M_AP_REQ (-1760647401L) #define KV5M_AP_REP (-1760647400L) #define KV5M_AP_REP_ENC_PART (-1760647399L) #define KV5M_RESPONSE (-1760647398L) #define KV5M_SAFE (-1760647397L) #define KV5M_PRIV (-1760647396L) #define KV5M_PRIV_ENC_PART (-1760647395L) #define KV5M_CRED (-1760647394L) #define KV5M_CRED_INFO (-1760647393L) #define KV5M_CRED_ENC_PART (-1760647392L) #define KV5M_PWD_DATA (-1760647391L) #define KV5M_ADDRESS (-1760647390L) #define KV5M_KEYTAB_ENTRY (-1760647389L) #define KV5M_CONTEXT (-1760647388L) #define KV5M_OS_CONTEXT (-1760647387L) #define KV5M_ALT_METHOD (-1760647386L) #define KV5M_ETYPE_INFO_ENTRY (-1760647385L) #define KV5M_DB_CONTEXT (-1760647384L) #define KV5M_AUTH_CONTEXT (-1760647383L) #define KV5M_KEYTAB (-1760647382L) #define KV5M_RCACHE (-1760647381L) #define KV5M_CCACHE (-1760647380L) #define KV5M_PREAUTH_OPS (-1760647379L) #define KV5M_SAM_CHALLENGE (-1760647378L) #define KV5M_SAM_CHALLENGE_2 (-1760647377L) #define KV5M_SAM_KEY (-1760647376L) #define KV5M_ENC_SAM_RESPONSE_ENC (-1760647375L) #define KV5M_ENC_SAM_RESPONSE_ENC_2 (-1760647374L) #define KV5M_SAM_RESPONSE (-1760647373L) #define KV5M_SAM_RESPONSE_2 (-1760647372L) #define KV5M_PREDICTED_SAM_RESPONSE (-1760647371L) #define KV5M_PASSWD_PHRASE_ELEMENT (-1760647370L) #define KV5M_GSS_OID (-1760647369L) #define KV5M_GSS_QUEUE (-1760647368L) #define KV5M_FAST_ARMORED_REQ (-1760647367L) #define KV5M_FAST_REQ (-1760647366L) #define KV5M_FAST_RESPONSE (-1760647365L) #define KV5M_AUTHDATA_CONTEXT (-1760647364L) extern const struct error_table et_kv5m_error_table; extern void initialize_kv5m_error_table(void); /* For compatibility with Heimdal */ extern void initialize_kv5m_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_kv5m (-1760647424L) /* for compatibility with older versions... */ #define init_kv5m_err_tbl initialize_kv5m_error_table #define kv5m_err_base ERROR_TABLE_BASE_kv5m /* * et-h-krb524_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define KRB524_BADKEY (-1750206208L) #define KRB524_BADADDR (-1750206207L) #define KRB524_BADPRINC (-1750206206L) #define KRB524_BADREALM (-1750206205L) #define KRB524_V4ERR (-1750206204L) #define KRB524_ENCFULL (-1750206203L) #define KRB524_DECEMPTY (-1750206202L) #define KRB524_NOTRESP (-1750206201L) #define KRB524_KRB4_DISABLED (-1750206200L) extern const struct error_table et_k524_error_table; extern void initialize_k524_error_table(void); /* For compatibility with Heimdal */ extern void initialize_k524_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_k524 (-1750206208L) /* for compatibility with older versions... */ #define init_k524_err_tbl initialize_k524_error_table #define k524_err_base ERROR_TABLE_BASE_k524 /* * et-h-asn1_err.h: * This file is automatically generated; please do not edit it. */ #include <et/com_err.h> #define ASN1_BAD_TIMEFORMAT (1859794432L) #define ASN1_MISSING_FIELD (1859794433L) #define ASN1_MISPLACED_FIELD (1859794434L) #define ASN1_TYPE_MISMATCH (1859794435L) #define ASN1_OVERFLOW (1859794436L) #define ASN1_OVERRUN (1859794437L) #define ASN1_BAD_ID (1859794438L) #define ASN1_BAD_LENGTH (1859794439L) #define ASN1_BAD_FORMAT (1859794440L) #define ASN1_PARSE_ERROR (1859794441L) #define ASN1_BAD_GMTIME (1859794442L) #define ASN1_MISMATCH_INDEF (1859794443L) #define ASN1_MISSING_EOC (1859794444L) #define ASN1_OMITTED (1859794445L) extern const struct error_table et_asn1_error_table; extern void initialize_asn1_error_table(void); /* For compatibility with Heimdal */ extern void initialize_asn1_error_table_r(struct et_list **list); #define ERROR_TABLE_BASE_asn1 (1859794432L) /* for compatibility with older versions... */ #define init_asn1_err_tbl initialize_asn1_error_table #define asn1_err_base ERROR_TABLE_BASE_asn1 #endif /* KRB5_KRB5_H_INCLUDED */ krb5/localauth_plugin.h 0000644 00000013371 15063602067 0011124 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2013 by the Massachusetts Institute of Technology. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Declarations for localauth plugin module implementors. * * The localauth pluggable interface currently has only one supported major * version, which is 1. Major version 1 has a current minor version number of * 1. * * Localauth plugin modules should define a function named * localauth_<modulename>_initvt, matching the signature: * * krb5_error_code * localauth_modname_initvt(krb5_context context, int maj_ver, int min_ver, * krb5_plugin_vtable vtable); * * The initvt function should: * * - Check that the supplied maj_ver number is supported by the module, or * return KRB5_PLUGIN_VER_NOTSUPP if it is not. * * - Cast the vtable pointer as appropriate for maj_ver: * maj_ver == 1: Cast to krb5_localauth_vtable * * - Initialize the methods of the vtable, stopping as appropriate for the * supplied min_ver. Optional methods may be left uninitialized. * * Memory for the vtable is allocated by the caller, not by the module. */ #ifndef KRB5_LOCALAUTH_PLUGIN_H #define KRB5_LOCALAUTH_PLUGIN_H #include <krb5/krb5.h> #include <krb5/plugin.h> /* An abstract type for localauth module data. */ typedef struct krb5_localauth_moddata_st *krb5_localauth_moddata; /*** Method type declarations ***/ /* Optional: Initialize module data. */ typedef krb5_error_code (*krb5_localauth_init_fn)(krb5_context context, krb5_localauth_moddata *data); /* Optional: Release resources used by module data. */ typedef void (*krb5_localauth_fini_fn)(krb5_context context, krb5_localauth_moddata data); /* * Optional: Determine whether aname is authorized to log in as the local * account lname. Return 0 if aname is authorized, EPERM if aname is * authoritatively not authorized, KRB5_PLUGIN_NO_HANDLE if the module cannot * determine whether aname is authorized, and any other error code for a * serious failure to process the request. aname will be considered authorized * if at least one module returns 0 and all other modules return * KRB5_PLUGIN_NO_HANDLE. */ typedef krb5_error_code (*krb5_localauth_userok_fn)(krb5_context context, krb5_localauth_moddata data, krb5_const_principal aname, const char *lname); /* * Optional (mandatory if an2ln_types is set): Determine the local account name * corresponding to aname. Return 0 and set *lname_out if a mapping can be * determined; the contents of *lname_out will later be released with a call to * the module's free_string method. Return KRB5_LNAME_NOTRANS if no mapping * can be determined. Return any other error code for a serious failure to * process the request; this will halt the krb5_aname_to_localname operation. * * If the module's an2ln_types field is set, this method will only be invoked * when a profile "auth_to_local" value references one of the module's types. * type and residual will be set to the type and residual of the auth_to_local * value. * * If the module's an2ln_types field is not set but the an2ln method is * implemented, this method will be invoked independently of the profile's * auth_to_local settings, with type and residual set to NULL. If multiple * modules are registered with an2ln methods but no an2ln_types field, the * order of invocation is not defined, but all such modules will be consulted * before the built-in mechanisms are tried. */ typedef krb5_error_code (*krb5_localauth_an2ln_fn)(krb5_context context, krb5_localauth_moddata data, const char *type, const char *residual, krb5_const_principal aname, char **lname_out); /* * Optional (mandatory if an2ln is implemented): Release the memory returned by * an invocation of an2ln. */ typedef void (*krb5_localauth_free_string_fn)(krb5_context context, krb5_localauth_moddata data, char *str); /* localauth vtable for major version 1. */ typedef struct krb5_localauth_vtable_st { const char *name; /* Mandatory: name of module. */ const char **an2ln_types; /* Optional: uppercase auth_to_local types */ krb5_localauth_init_fn init; krb5_localauth_fini_fn fini; krb5_localauth_userok_fn userok; krb5_localauth_an2ln_fn an2ln; krb5_localauth_free_string_fn free_string; /* Minor version 1 ends here. */ } *krb5_localauth_vtable; #endif /* KRB5_LOCALAUTH_PLUGIN_H */ krb5/locate_plugin.h 0000644 00000005100 15063602067 0010406 0 ustar 00 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2006 Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ /* * * Service location plugin definitions for Kerberos 5. */ #ifndef KRB5_LOCATE_PLUGIN_H_INCLUDED #define KRB5_LOCATE_PLUGIN_H_INCLUDED #include <krb5/krb5.h> enum locate_service_type { locate_service_kdc = 1, locate_service_master_kdc, locate_service_kadmin, locate_service_krb524, locate_service_kpasswd }; typedef struct krb5plugin_service_locate_ftable { int minor_version; /* currently 0 */ /* Per-context setup and teardown. Returned void* blob is private to the plugin. */ krb5_error_code (*init)(krb5_context, void **); void (*fini)(void *); /* Callback function returns non-zero if the plugin function should quit and return; this may be because of an error, or may indicate we've already contacted the service, whatever. The lookup function should only return an error if it detects a problem, not if the callback function tells it to quit. */ krb5_error_code (*lookup)(void *, enum locate_service_type svc, const char *realm, int socktype, int family, int (*cbfun